diff --git a/.github/workflows/shortwave.yml b/.github/workflows/shortwave.yml new file mode 100644 index 00000000..3630edc4 --- /dev/null +++ b/.github/workflows/shortwave.yml @@ -0,0 +1,38 @@ +name: Shortwave checks + +on: + pull_request: + paths: + - 'applications/shortwave/**' + - '.github/workflows/shortwave.yml' + push: + branches: [main] + paths: + - 'applications/shortwave/**' + - '.github/workflows/shortwave.yml' + workflow_dispatch: + +permissions: + contents: read + +jobs: + check: + runs-on: ubuntu-latest + defaults: + run: + working-directory: applications/shortwave + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22.23.2 + cache: npm + cache-dependency-path: applications/shortwave/package-lock.json + - run: npm ci + - run: npm test + - run: npm run types:workers + - run: npm run typecheck + - run: npm run build:workers + - run: npx wrangler deploy --dry-run + +# Live Cloud and browser acceptance is a separate, explicitly configured run. diff --git a/README.md b/README.md index fc09280f..2d9d660f 100644 --- a/README.md +++ b/README.md @@ -64,13 +64,14 @@ ClickHouse ships official client libraries for [C# / .NET](https://clickhouse.co - [Provision a database for a TypeScript application](./applications/report-history/README.md): Use `clickhousectl` to create the Cloud service for a report-history application. - [Investigate and resolve a latency SLA breach](./ai/clickhousectl/agentic-sla-scaling/README.md): Give an agent access to `clickhousectl` to inspect a live service and apply a scaling change. -### Postgres managed by ClickHouse: transactions alongside analytics +### ClickHouse Managed Postgres: transactions alongside analytics -[Postgres managed by ClickHouse](https://clickhouse.com/cloud/postgres) is a managed PostgreSQL service in ClickHouse Cloud for transactional applications, with native integration into ClickHouse for analytics. Use Postgres for application records and transactions, then replicate changes to ClickHouse for reporting and aggregation. +[ClickHouse Managed Postgres](https://clickhouse.com/cloud/postgres) is a managed PostgreSQL service in ClickHouse Cloud for transactional applications, with native integration into ClickHouse for analytics. Use Postgres for application records and transactions, then replicate changes to ClickHouse for reporting and aggregation. [ClickPipes](https://clickhouse.com/cloud/clickpipes) provides managed ingestion into ClickHouse Cloud, including Postgres change data capture (CDC), streaming sources, and object storage. -- [Postgres-to-ClickHouse data modeling](./postgresql-clickhouse-data-modeling/README.md): Replicate a tiny fixture from PostgreSQL to ClickHouse with PeerDB, then verify inserts, updates, and deletes. Follow the separate managed Postgres and ClickPipes walkthrough for ClickHouse Cloud; a larger Stack Overflow import is optional. +- [Shortwave link shortener](./applications/shortwave/README.md): Build and deploy a link shortener using ClickHouse Managed Postgres for application data, ClickPipes for metadata sync, and ClickHouse for click analytics. +- [Postgres-to-ClickHouse data modeling](./postgresql-clickhouse-data-modeling/README.md): Replicate a tiny fixture from PostgreSQL to ClickHouse with PeerDB, then verify inserts, updates, and deletes. Follow the separate ClickHouse Managed Postgres and ClickPipes walkthrough for ClickHouse Cloud; a larger Stack Overflow import is optional. ### ClickStack: logs, metrics, traces, and session replay @@ -108,7 +109,7 @@ Browse [all local analytics examples](./local-analytics/README.md) for more file | Directory | What you'll find | | --- | --- | -| [applications](./applications/) | Application examples, including report results and run history with ClickHouse Cloud. | +| [applications](./applications/) | Application examples: a link shortener, report results, and run history with ClickHouse Cloud. | | [ai](./ai/README.md) | AI agents, MCP integrations, and workflows using `clickhousectl`. | | [blog-examples](./blog-examples/) | Code and resources accompanying the [ClickHouse Blog](https://clickhouse.com/blog). | | [clickstack](./clickstack/) | Observability examples for LLM applications and MCP servers. | diff --git a/applications/shortwave/.env.example b/applications/shortwave/.env.example new file mode 100644 index 00000000..e29dc6eb --- /dev/null +++ b/applications/shortwave/.env.example @@ -0,0 +1,26 @@ +# Local application runtime against your ClickHouse Cloud deployment. +# Copy to .env in your checkout. Never commit the populated file. +VITE_CLERK_PUBLISHABLE_KEY=pk_test_replace_me +CLERK_SECRET_KEY=sk_test_replace_me +APP_URL=http://localhost:4317 +PORT=4317 +DATABASE_URL=postgresql://link_shortener_app:replace_me@replace-me.postgres.clickhouse.cloud:5432/postgres +# Relative to the project directory; keep certificate verification enabled. +PG_CA_CERT_PATH=.deployment/postgres-ca.pem +CLICKHOUSE_URL=https://replace-me.clickhouse.cloud:8443 +CLICKHOUSE_DATABASE=link_shortener +# Use the destination database recorded by ClickPipes setup. +CLICKHOUSE_CDC_DATABASE=default +CLICKHOUSE_USERNAME=link_shortener_app +CLICKHOUSE_PASSWORD=replace_me +# Comma-separated verified short hostnames attached to your deployed Worker. +PUBLIC_CUSTOM_DOMAINS= + +# Optional hosted smoke checks. Set APP_URL to your deployed HTTPS application +# origin and use a signed-in account that has verified SMOKE_CUSTOM_ORIGIN. +# Keep that account UUID and the smoke receipt private. +SMOKE_CUSTOM_ORIGIN= +SMOKE_ACCOUNT_ID= + +# Cloud API keys belong in the CLI credential store; migration credentials belong +# in .deployment/passwords.env. Never add either to this runtime environment. diff --git a/applications/shortwave/.gitignore b/applications/shortwave/.gitignore new file mode 100644 index 00000000..4265f016 --- /dev/null +++ b/applications/shortwave/.gitignore @@ -0,0 +1,24 @@ +.env +.env.* +!.env.example +node_modules/ +.output/ +.tanstack/ +dist/ +.vite/ +coverage/ +*.log +.DS_Store +.secrets/ +.deployment/ +.private/ +# clickhousectl can save Cloud credentials and Query API keys here. +.clickhouse/ +.wrangler/ +.dev.vars +.dev.vars.* +*.pem +test-results/ +playwright-report/ +playwright/.auth/ +playwright/.clerk/ diff --git a/applications/shortwave/AGENTS.md b/applications/shortwave/AGENTS.md new file mode 100644 index 00000000..f18c68a5 --- /dev/null +++ b/applications/shortwave/AGENTS.md @@ -0,0 +1,42 @@ +# Agent instructions + +## Project context + +- Shortwave is a link-shortener example; see the [deployment and release checklist](docs/v1-readiness.md). Cloudflare Workers is the implemented host. Keep local development in the isolated VM. +- Start with [README.md](README.md); read the relevant brief, architecture, or setup document linked there. Keep proposals distinct from settled decisions. +- Use TanStack, Click UI, and Clerk. Deploy both databases and ClickPipes in ClickHouse Cloud; use `clickhousectl` for Cloud provisioning and orchestration. Use Wrangler for Cloudflare resources. `pg_clickhouse` and ClickStack remain proposals. + +## Implementation and deployment contract + +- Keep deployer hostnames, resource IDs, personal paths, and credentials out of the public example. Generate configuration from explicit inputs; keep `.deployment`, `.private`, `.secrets`, environment files and credential-bearing logs private. +- Document infrastructure as explicit `clickhousectl` and Wrangler commands in README and the hosting guide. Keep database setup in SQL files passed to the CLI; do not add JavaScript provisioning wrappers. Review inputs before creation and verify the built Worker config matches the recorded account, bindings and hostnames before deployment. +- Postgres owns authorization and redirects. ClickPipes owns `cdc_links`; never apply the local metadata fixture to Cloud. Preserve CDC version/delete handling and event-ID deduplication across delivery retries. +- Separate runtime, migration, and management credentials. Preserve TLS verification and account isolation. Reuse recorded resources on setup retries; reconcile ambiguous outcomes before retrying, and target cleanup by recorded IDs. Never delete a receipt to force recreation. +- For assessments, deliver findings and acceptance criteria. For implementation requests, finish authorized work and verification; follow the user's scope over conflicting skill advice and identify concrete blockers. +- Run relevant checks in the VM: `npm test`, `npm run typecheck`, and `npm run build:workers`. Live integration/browser checks require their documented Cloud fixtures. Report passed, skipped, and unverified checks separately; publication requires the fresh-deployment checklist. + +## Development sandbox + +- This VM workflow is for maintainer/agent development. Public deployment instructions assume CLI tools on the reader's laptop; see [maintainer environment](docs/maintainer-environment.md) for our setup. + +- Before installing dependencies or running application code, create a dedicated OrbStack Linux VM using the CLI. Reuse `link-shortener-dev` only after checking its isolation settings with `orb info`. + + ```sh + orb list + orb create --isolated --isolate-network ubuntu:noble link-shortener-dev + orb info link-shortener-dev + orb -m link-shortener-dev -w /home sh -lc 'mkdir -p "$HOME/link-shortener"' + orb -m link-shortener-dev -w /home sh -lc 'cd "$HOME/link-shortener" && ' + ``` + +- Create only if absent; replace `` with the intended command. Verify flags with installed CLI help if needed; do not silently fall back to an unisolated machine. +- Copy source into the VM's own filesystem with `scripts/vm.sh push`. Use `scripts/install-tools.sh` inside Linux for the pinned tools; run dependency installs, development servers, builds and tests there. Keep caches, `node_modules` and build output inside the VM; databases remain in ClickHouse Cloud. +- Keep host mounts, SSH-agent forwarding, host command execution, and host Docker sockets disabled. Transfer only project files and explicitly needed credentials; copy reviewed source changes back without generated files or secrets. +- Host-side document/source editing, read-only inspection, and OrbStack management are fine. Do not install project dependencies on macOS. Documentation-only tasks do not require starting a VM. + +## Keep changes reviewable + +- UI copy: use plain task names. Do not add promotional subtitles, taglines, or routine explanatory captions unless the user requests them. Helper text must resolve a concrete ambiguity or explain an actionable state; audit new visible strings before handover. +- Update the relevant documentation when decisions change. Link to authoritative sources for platform claims; mark untested commands and unresolved assumptions. +- For code changes, run appropriate checks inside the VM; report what passed and what remains unverified. For documentation, check links and consistency. See README for build, typecheck, and test commands. +- Keep this file short and operational. Put architecture, setup walkthroughs, and task history in `docs/`, not here. diff --git a/applications/shortwave/CLAUDE.md b/applications/shortwave/CLAUDE.md new file mode 120000 index 00000000..47dc3e3d --- /dev/null +++ b/applications/shortwave/CLAUDE.md @@ -0,0 +1 @@ +AGENTS.md \ No newline at end of file diff --git a/applications/shortwave/README.md b/applications/shortwave/README.md new file mode 100644 index 00000000..dcfad16f --- /dev/null +++ b/applications/shortwave/README.md @@ -0,0 +1,431 @@ +# Shortwave + +[Read the accompanying article](https://clickhouse.com/resources/engineering/build-saas-link-shortener-postgres-clickhouse). + +A link-shortener example built on ClickHouse Cloud's unified data stack: +**[ClickHouse Managed Postgres](https://clickhouse.com/cloud/postgres)** stores +application data, **ClickPipes** syncs link metadata, and **ClickHouse** powers +click analytics. The TanStack Start application uses React, Click UI, and Clerk +and runs on Cloudflare Workers. + +Create and edit short links, organize them with tags and folders, save UTM +templates, download QR codes, and explore recorded traffic. + +**[Sign up for a ClickHouse Cloud free trial with $300 in credits](https://clickhouse.com/cloud).** + +This example is intended for an owner-operated deployment with restricted signup. +See [scope and limits](docs/v1-readiness.md#scope-and-limits) before deploying. + +## How it works + +```mermaid +flowchart LR + Browser[Browser] --> Worker[TanStack app on Cloudflare Workers] + Worker --> Hyperdrive[Hyperdrive: verified TLS, no query cache] + Hyperdrive --> PG[ClickHouse Managed Postgres] + PG -->|links metadata| Pipe[ClickPipes CDC] + Pipe --> CH[ClickHouse Cloud] + PG -->|durable click outbox| Cron[Workers scheduled delivery] + Cron -->|click events| CH + Worker -->|analytics queries| CH + Worker --> Clerk[Clerk authentication] +``` + +Postgres owns authorization and redirects. A redirect GET commits its event to +an outbox before returning. A scheduled Worker delivers events to ClickHouse; +reports count distinct event IDs so delivery retries do not inflate totals. +ClickPipes independently replicates link metadata into `default.cdc_links`. +Current tags can regroup earlier traffic after sync; UTM values are recorded +at click time. Reports use UTC and include bots and previews. Raw events have a +180-day TTL; deletion by TTL is eventual. + +Both databases and the ClickPipe run in **ClickHouse Cloud**. Cloudflare hosts +the complete app, server routes, redirects, and scheduler. No development machine +is needed for hosted operation. See [architecture](docs/architecture.md). + +## Deploy your own instance + +Run the CLI tools on your laptop. They create the databases in ClickHouse Cloud +and deploy the application to Cloudflare Workers. Once deployed, the application +runs independently of your laptop. + +### 1. Install tools, clone the repo, and sign in + +You need: + +- [Node.js 22](https://nodejs.org/en/download) (22.12 or later), npm, and Git. +- A [ClickHouse Cloud account](https://clickhouse.com/cloud) with ClickHouse Managed Postgres + and Postgres ClickPipes available. +- A [Cloudflare account](https://dash.cloudflare.com/sign-up) with Workers, + Hyperdrive, and an active DNS zone for your domain. +- A [Clerk application](https://dashboard.clerk.com/) for sign-in. Use production + keys when serving real users. + +The commands below work in Bash or zsh on macOS and Linux. Start by installing +[clickhousectl](https://clickhouse.com/docs/interfaces/cli): + +```sh +curl -fsSL https://clickhouse.com/cli | sh +export PATH="$HOME/.local/bin:$PATH" +clickhousectl --version +``` + +Clone the examples repository and open this application: + +```sh +git clone https://github.com/ClickHouse/examples.git +cd examples/applications/shortwave +npm ci +npx wrangler --version +``` + +`npm ci` installs the app dependencies and the repository's +[Wrangler version](https://developers.cloudflare.com/workers/wrangler/install-and-update/). +Run the remaining commands from this directory. + +The SQL steps also use the Postgres client (`psql` 15 or later), `jq` to read CLI +responses, and OpenSSL to generate passwords. If needed, install them: + +**macOS with [Homebrew](https://brew.sh):** + +```sh +brew install libpq jq openssl@3 +export PATH="$(brew --prefix libpq)/bin:$(brew --prefix openssl@3)/bin:$PATH" +``` + +**Ubuntu/Debian:** + +```sh +sudo apt-get update +sudo apt-get install -y postgresql-client jq openssl +``` + +Create an Admin API key in your ClickHouse Cloud organization using +[these instructions](https://clickhouse.com/docs/cloud/manage/openapi), then sign +in to both CLIs. ClickHouse prompts for your Key ID and Key secret; Wrangler +opens your browser to sign in. + +```sh +clickhousectl cloud auth login --interactive +clickhousectl cloud auth status +clickhousectl cloud org list +npx wrangler login +npx wrangler whoami +``` + +Cloud creation requires API key authentication; ClickHouse OAuth is read-only. +Keep the CLI credential store (`.clickhouse/`) and credentials private. + +Create a private directory for deployment settings and command results. +`umask 077` makes newly created files readable only by your user: + +```sh +umask 077 +mkdir -p .deployment +``` + +Create `.deployment/resources.env` in an editor with these inputs, replacing +all placeholders. Add the returned IDs and endpoints to it as you proceed. +`source` loads these saved values into your current terminal so later commands +can use names such as `$CH_ORG_ID`. Run it again after editing the file or opening +a new terminal. + +```dotenv +CH_ORG_ID=YOUR_ORGANIZATION_UUID +DEPLOYMENT_NAME=shortwave-example +CLOUD_REGION=us-east-1 +PG_SIZE=YOUR_AVAILABLE_POSTGRES_SIZE +PROVISIONING_CIDR=YOUR_PUBLIC_EGRESS_IP/32 +``` + +```sh +source .deployment/resources.env +``` + +Review the region, instance size, replica count, and ingress before creation. +The commands below request one ClickHouse replica with 8 GiB and non-HA Postgres +18. Confirm availability and cost for your organization: +[ClickHouse pricing](https://clickhouse.com/pricing), +[Workers pricing](https://developers.cloudflare.com/workers/platform/pricing/), +[Hyperdrive pricing](https://developers.cloudflare.com/hyperdrive/platform/pricing/). + +`.deployment/` holds private inputs, credentials, and CLI receipts. Back it up. +Run each create command once and preserve its output. If one fails or is +interrupted, [inspect the outcome](docs/operations.md#interrupted-setup) before +retrying; reuse resources that already exist. Run setup from one terminal at a time. + +### 2. Create the two databases + +Create ClickHouse with explicit provisioning ingress: + +```sh +clickhousectl cloud service create \ + --org-id "$CH_ORG_ID" --name "$DEPLOYMENT_NAME-ch" \ + --provider aws --region "$CLOUD_REGION" \ + --min-replica-memory-gb 8 --max-replica-memory-gb 8 --num-replicas 1 \ + --ip-allow "$PROVISIONING_CIDR" --json \ + > .deployment/clickhouse-create.json +``` + +Create ClickHouse Managed Postgres: + +```sh +clickhousectl cloud postgres create \ + --org-id "$CH_ORG_ID" --name "$DEPLOYMENT_NAME-pg" \ + --provider aws --region "$CLOUD_REGION" --size "$PG_SIZE" \ + --pg-version 18 --ha-type none --json \ + > .deployment/postgres-create.json +``` + +These receipts include the initial credentials, which are returned once. Keep +them private. Extract the IDs and save them in `.deployment/resources.env`: + +```sh +CH_SERVICE_ID="$(jq -er '.service.id' .deployment/clickhouse-create.json)" +PG_SERVICE_ID="$(jq -er '.id' .deployment/postgres-create.json)" +``` + +Check readiness with these commands. Repeat inspection until both report +`running` (ClickHouse may also report `idle`); do not repeat creation while waiting. + +```sh +clickhousectl cloud service get "$CH_SERVICE_ID" --org-id "$CH_ORG_ID" --json +clickhousectl cloud postgres get "$PG_SERVICE_ID" --org-id "$CH_ORG_ID" --json +clickhousectl cloud postgres certs get "$PG_SERVICE_ID" --org-id "$CH_ORG_ID" \ + --output .deployment/postgres-ca.pem +``` + +Record `PGHOST`, `PGPORT`, `PGDATABASE`, and `PGADMIN` from the direct Postgres +connection details, and `CLICKHOUSE_URL` from the HTTPS endpoint, in +`.deployment/resources.env`. Use the direct Postgres port, not a transaction +pooler, for migrations and CDC. The default source database is normally `postgres`; +use the database in your connection details. + +### 3. Create Postgres roles and apply SQL + +Generate separate passwords once, before creating any roles. The generated +values are safe in shell files and connection URLs. Keep the existing file on +retries; creating a role that already exists does not change its password. + +```sh +cat > .deployment/passwords.env < .deployment/clickhouse-app-user.sql +clickhousectl cloud service query --org-id "$CH_ORG_ID" --id "$CH_SERVICE_ID" \ + --queries-file .deployment/clickhouse-app-user.sql +clickhousectl cloud service query --org-id "$CH_ORG_ID" --id "$CH_SERVICE_ID" \ + --queries-file infra/clickhouse/003_events_grant.sql +``` + +The [runtime user](https://clickhouse.com/docs/sql-reference/statements/create/user) +can read and insert events, but cannot manage the schema. +Never apply `migrations/clickhouse/002_local_metadata.sql` to Cloud: ClickPipes +creates and owns its destination table. + +### 5. Create the links ClickPipe + +The [mapping file](infra/clickpipe-links.json) explicitly selects `public.links`, +`ReplacingMergeTree`, and sorting by `id`. CDC takes an initial snapshot and then +streams changes. Keep delete tombstones for the application's current-row reads. + +```sh +clickhousectl cloud clickpipe create postgres "$CH_SERVICE_ID" \ + --org-id "$CH_ORG_ID" --name "$DEPLOYMENT_NAME-cdc" \ + --host "$PGHOST" --port "$PGPORT" --pg-database "$PGDATABASE" \ + --username link_shortener_cdc --password "$PG_CDC_PASSWORD" \ + --ca-certificate .deployment/postgres-ca.pem \ + --publication-name link_shortener_clickpipe --replication-mode cdc \ + --sync-interval-seconds 10 --delete-on-merge false \ + --table-mapping-json "$(cat infra/clickpipe-links.json)" --json \ + > .deployment/clickpipe-create.json +CLICKPIPE_ID="$(jq -er '.id' .deployment/clickpipe-create.json)" +clickhousectl cloud clickpipe get "$CH_SERVICE_ID" "$CLICKPIPE_ID" \ + --org-id "$CH_ORG_ID" --json +``` + +Save `CLICKPIPE_ID` in `.deployment/resources.env`. Keep shell tracing off when +running commands with passwords, and keep their output private. + +Wait for `default.cdc_links` to exist, then check its versioned engine and grant +runtime read access: + +```sh +clickhousectl cloud service query --org-id "$CH_ORG_ID" --id "$CH_SERVICE_ID" \ + --queries-file infra/clickhouse/verify-cdc.sql +clickhousectl cloud service query --org-id "$CH_ORG_ID" --id "$CH_SERVICE_ID" \ + --queries-file infra/clickhouse/004_cdc_grant.sql +clickhousectl cloud service query --org-id "$CH_ORG_ID" --id "$CH_SERVICE_ID" \ + --query 'SHOW GRANTS FOR link_shortener_app' +``` + +Expect one CDC table using `ReplacingMergeTree`, sorted by `id`, with +`_peerdb_version` and `_peerdb_is_deleted`. Expect only event SELECT/INSERT and CDC +SELECT grants for the application. See [CDC verification](infra/README.md#verify-data-flow) +for insert/update/delete checks; schema inspection alone does not prove sync. + +### 6. Save runtime configuration and verify Postgres + +Create a runtime-only environment for local development and acceptance checks: + +```sh +cat > .deployment/runtime.env <`. Complete the +[fresh-deployment checklist](docs/v1-readiness.md): redirects must change +immediately after edits, analytics must receive scheduled events, tag edits must +sync, disabled links must return 410, HEAD must not count, and a second account +must not access your data. Verify that visits and analytics keep working after +you close the deployment terminal. + +Creating a link writes application data; it does not create infrastructure. +Use [operations](docs/operations.md) for upgrades, interrupted commands, credential +rotation and explicit deletion commands. Cloud resources remain billable until +you remove them. + +## Develop and contribute + +See [development and checks](docs/development.md) to run the app locally or contribute. +The ordinary checks run without Cloud credentials; integration, browser and +hosted acceptance use explicitly configured test resources. + +```sh +npm test +npm run types:workers +npm run typecheck +npm run build:workers +npx wrangler deploy --dry-run +``` + +- [Deployment inputs and order](docs/setup-plan.md) +- [Architecture](docs/architecture.md) and [decisions](docs/decisions.md) +- [Deployment and release checklist](docs/v1-readiness.md) + +V1 supports Cloudflare Workers hosting. Vercel, automatic customer-domain +provisioning, ClickStack, and pg_clickhouse are future extensions. diff --git a/applications/shortwave/docs/architecture.md b/applications/shortwave/docs/architecture.md new file mode 100644 index 00000000..39a5db67 --- /dev/null +++ b/applications/shortwave/docs/architecture.md @@ -0,0 +1,92 @@ +# Architecture + +Shortwave separates operational state, metadata replication, and traffic facts. +All data services run in ClickHouse Cloud; the complete TanStack Start application +runs on Cloudflare Workers. Clerk supplies authentication and Click UI supplies +the interface components. + +## Operational data + +[ClickHouse Managed Postgres](https://clickhouse.com/cloud/postgres) owns accounts, +links, custom domains, tags, folders, UTM templates, QR styles, and the click +outbox. Server functions obtain the identity +from Clerk's verified session and scope each operation to its account. Composite +foreign keys preserve account ownership for folders and custom domains. + +A redirect resolves the exact hostname and slug in Postgres. Slugs and domain +assignment are immutable; destinations and enabled status can change. Successful +GET redirects commit an event to the outbox before returning HTTP 302 with +caching disabled. HEAD resolves without recording traffic. Missing links return +404 and disabled links return 410. A Postgres or outbox-commit failure fails the +redirect; ClickHouse availability is not on the redirect's critical path. + +Workers connects through Hyperdrive with origin certificate verification and +query caching disabled, so operational changes are read immediately. Node +development connects directly using the service CA. Runtime connections are +scoped to a Worker invocation and closed after response streaming completes. + +## Traffic facts + +The scheduled Worker runs every minute and drains at most five batches of 500 +outbox events. Delivery uses row locks and SKIP LOCKED; transient insert failures +are retried with backoff. ClickHouse inserts use async_insert=1 and +wait_for_async_insert=1. An acknowledgement or transaction-commit failure can +cause another delivery of the same immutable event ID. + +Reports use uniqExact(event_id), not raw row counts, so at-least-once delivery +does not inflate the displayed totals. click_events is a MergeTree table ordered +by account_id, occurred_at, link_id, event_id, partitioned monthly, with eventual +180-day TTL expiry. UTC reports offer up to 90 days and a preceding comparison. +The current day is partial. Counts include bots and previews and do not measure +unique people, physical QR scans, or destination-page loads. No IP fingerprint +is stored; geography is not inferred without a trusted signal. + +UTM values are captured at the time of the redirect. Updating a saved UTM +template does not rewrite existing links or historical events. A QR code encodes +the short URL, so changing the destination preserves printed QR codes. + +## Metadata sync + +ClickPipes replicates only public.links, including the tags array, into +cdc_links. Saved tag vocabulary, folders, domain ownership, and Clerk data remain +outside the publication. ClickPipes creates and owns the destination table; +never apply migrations/clickhouse/002_local_metadata.sql to Cloud. + +Current-state queries use a ReplacingMergeTree destination ordered by stable id, +FINAL, and _peerdb_is_deleted = 0. The app compares source and replicated link +revisions to show a syncing state. Current tags regroup historical traffic after +replication catches up; historical UTMs stay unchanged. These semantics follow +[ClickPipes deduplication guidance](https://clickhouse.com/docs/integrations/clickpipes/postgres/deduplication). + +The tested CLI baseline is +[clickhousectl](https://clickhouse.com/docs/interfaces/cli) 0.4.2. Its Postgres ClickPipe destination +is default; event data is in link_shortener. CLICKHOUSE_CDC_DATABASE qualifies +metadata separately. Explicit table-mapping JSON selects ReplacingMergeTree and +id sorting instead of relying on CLI defaults. Other CLI versions must be checked +against their help and verified before changing this contract. + +## Domains and previews + +TXT verification proves that an application account controls an exact hostname. +Hosting configuration separately permits that hostname to serve links. +[Custom domains](custom-domains.md) explains the operator setup and lifecycle. + +Authenticated destination previews permit bounded public HTTP(S) resources and +repeat validation for redirects. Private/reserved addresses, mixed public/private +DNS answers, credentials, unsupported ports, oversized resources, and SVG images +are rejected. Node pins connections to a validated address; Workers uses public +egress fetch with global_fetch_strictly_public and platform TLS verification. +The browser receives bounded raster data URLs instead of fetching preview images +directly. Preview caches and concurrency controls are ephemeral per process. + +## Limits and extensions + +The app limits each account to 100 new links per rolling day and 100 folders. +These controls do not replace signup policy or abuse operations. The reference +instance is intended for an operator's own users. See [operations](operations.md) +for access, delivery failures, retention, recovery, and cleanup. + +Cloudflare for SaaS customer-domain onboarding, Vercel, teams, pg_clickhouse, +ClickStack, aggregate materialized views, and load/HA benchmarking are extensions. +None is required for the V1 data flow. Do not add aggregate views without proving +that retries and metadata changes preserve analytical correctness. diff --git a/applications/shortwave/docs/connectivity-check.md b/applications/shortwave/docs/connectivity-check.md new file mode 100644 index 00000000..898c850b --- /dev/null +++ b/applications/shortwave/docs/connectivity-check.md @@ -0,0 +1,87 @@ +# Optional hosted database connectivity check + +The [diagnostic entrypoint](../scripts/workers-connectivity-check.ts) can check the +application's Postgres and ClickHouse drivers from Cloudflare Workers before +Clerk is configured. It is separate from the application and is intended to be +deleted after the check. This optional procedure has not been verified through +a live deployment; record its results independently if you use it. + +## Scope and payload + +Create private configuration from your recorded deployment. +Use its exact Cloudflare account and Hyperdrive ID. Choose a distinct Worker name +ending in `-runtime-check`, verify that name does not already exist in that account, +and save a private receipt before creation. Do not adopt an existing Worker. + +| Item | Diagnostic configuration | +| --- | --- | +| Entrypoint | `../scripts/workers-connectivity-check.ts` from a private `.deployment` config | +| Worker name | Distinct from the application; recorded in the diagnostic receipt | +| Account | Recorded Cloudflare account | +| Hyperdrive | Existing recorded Hyperdrive binding | +| Public endpoint | Temporary `workers.dev` endpoint; no custom-domain routes | +| Scheduled handlers | None; no cron configuration | +| Compatibility | Same compatibility date/flags as the application's recorded config | +| Ordinary vars | None required | + +The only secrets uploaded are `DIAGNOSTIC_TOKEN`, generated from 32 random bytes, +and these existing application runtime variables: + +- `CLICKHOUSE_URL` +- `CLICKHOUSE_USERNAME` +- `CLICKHOUSE_PASSWORD` +- `CLICKHOUSE_DATABASE` +- `CLICKHOUSE_CDC_DATABASE` + +The Worker uses the existing Hyperdrive binding for Postgres. It receives no +Postgres management or migration password, ClickHouse Cloud management key, +Clerk key or Cloudflare management token. Wrangler authenticates the deployment +using the operator's existing session. All generated config, secrets, URLs and +receipts stay under `.deployment` in your checkout. + +## Request behavior + +The endpoint rejects missing/incorrect bearer tokens and non-GET requests with +HTTP 401 before opening a database connection. An authenticated GET runs exactly +`SELECT 1 AS ok` against Postgres and ClickHouse using the application's runtime +drivers, then closes its request-scoped connections. It returns only: + +```json +{ + "stages": [ + { "stage": "postgres", "ok": true }, + { "stage": "clickhouse", "ok": true }, + { "stage": "close", "ok": true } + ] +} +``` + +All stages passing produces HTTP 200; database failure produces HTTP 503. It +returns no database rows, hostnames, usernames, passwords, exception messages, +stacks or arbitrary error properties. It writes no application data. The optional +`?port=443` request changes only the ClickHouse HTTPS port; other overrides are +rejected. This lets the operator compare the configured native HTTPS port with +443 without changing the real application's settings. + +## Lifecycle (live deployment unverified) + +1. Follow the [explicit ingress commands](hosting.md#3-allow-database-connections). + Inspect the recorded service and organization, review proposed ranges, then use + `clickhousectl cloud service update --add-ip-allow` for approved missing CIDRs. + Inspect the result again, preserving unrelated entries. Those shared ranges are a persistent network-access change until + the service or those ingress rules are removed. Do not widen access further if the test fails. +2. Prepare private config/secrets and record the previously absent diagnostic + Worker name and account. Upload runtime secrets and deploy that Worker through + Wrangler. Save command output privately. +3. Read the temporary `workers.dev` URL from Wrangler's deployment output. Check + that an unauthenticated request returns 401. Make an authenticated GET and save + only stage results. If ClickHouse fails on its configured HTTPS port, repeat + with `?port=443` and retain both results. +4. Delete the diagnostic Worker by the exact recorded name/account, including + after a failed test. Verify its absence through the account's Worker inventory. + Retain the receipt and private logs. Do not delete the application Worker, + Hyperdrive, CA, zone, Clerk instance or databases as part of this check. + +This proves deployed runtime transport and credentials. It does not prove Clerk +sign-in, link creation, ClickPipes convergence, event ingestion or cron delivery; +those remain part of [fresh-deployment acceptance](v1-readiness.md). diff --git a/applications/shortwave/docs/custom-domains.md b/applications/shortwave/docs/custom-domains.md new file mode 100644 index 00000000..8bd0bc10 --- /dev/null +++ b/applications/shortwave/docs/custom-domains.md @@ -0,0 +1,59 @@ +# Custom domains + +The deployer configures hostnames they control. Use app.mydomain.com for the +application and mydomain.com for short links, or go.mydomain.com if the apex +already hosts another website. The registrar can differ from the DNS provider; +the reference Workers deployment requires an active owned Cloudflare zone. + +## Connect a hostname + +1. Configure the app origin and short hostname in the private deployment inputs. +2. Attach both exact names as Workers Custom Domains. Cloudflare supplies routing + DNS and certificates. Resolve conflicting records deliberately and preserve + mail and unrelated website records. Follow + [Cloudflare's instructions](https://developers.cloudflare.com/workers/configuration/routing/custom-domains/). +3. Deploy and verify public HTTPS for both names. APP_URL is the dashboard origin; + PUBLIC_CUSTOM_DOMAINS contains short hostnames, excluding the dashboard. +4. Sign in, open Domains, and add the exact short hostname. Copy its generated TXT + name and value into DNS. For mydomain.com the name is + _shortwave-verification.mydomain.com; for go.mydomain.com it is + _shortwave-verification.go.mydomain.com. Select Check DNS after propagation. +5. Select the verified domain when creating a link. Visit the copied URL signed + out, decode the downloaded QR, edit the destination, then disable the link. + Confirm 302 redirects after edits and 410 after disabling. + +See the [deployment walkthrough](setup-plan.md) for the provisioning commands. + +## Three independent conditions + +| Condition | Meaning | How to verify | +| --- | --- | --- | +| Ownership | A signed-in account controls the DNS challenge | App TXT check | +| Routing | Requests reach the intended Worker | Cloudflare domain configuration and public request | +| HTTPS | The hostname has a valid served certificate | Public HTTPS smoke check | + +The app's Ready for links state combines verified ownership with the configured +hosting allowlist. It is not a live certificate probe. Deploy-time verification +must establish routing and HTTPS independently. + +DNS is configured per hostname, never per short link. Individual destinations +are Postgres rows resolved at /r/:slug. The short-domain root redirects to the +app; app pages are not served on short-only hostnames. + +## Ownership and lifecycle + +Claims are account-scoped, with one verified owner per canonical hostname. +Rechecking a missing or mismatched TXT record returns a claim to pending; +temporary resolver errors preserve the previous ownership state and report the +error. Checks are manual; retain the TXT record for later rechecks. + +A link's domain assignment and slug are immutable. The same slug can exist in +separate hostname namespaces. A domain with referenced links cannot be removed, +including when those links are disabled. Do not detach routing for a hostname +while its printed links are expected to remain usable. + +Removing a claim in the app does not delete provider resources. Removing a +Workers Custom Domain does not delete a Postgres claim. An operator must manage +both parts deliberately. Automatic onboarding of other customers' domains, +certificate polling, periodic ownership checks, and provider cleanup are future +extensions, not capabilities of this example. diff --git a/applications/shortwave/docs/decisions.md b/applications/shortwave/docs/decisions.md new file mode 100644 index 00000000..c4e334f5 --- /dev/null +++ b/applications/shortwave/docs/decisions.md @@ -0,0 +1,26 @@ +# Decisions + +| Decision | Reason | +| --- | --- | +| ClickHouse Cloud only | ClickHouse Managed Postgres owns operational data, ClickHouse serves analytics, and ClickPipes syncs metadata in one data platform | +| [clickhousectl](https://clickhouse.com/docs/interfaces/cli) for Cloud provisioning | One inspectable CLI manages Cloud service lifecycle and CDC; SQL execution dependencies are documented explicitly | +| Explicit CLI steps and SQL files | Readers deploy from their laptops using clickhousectl and Wrangler; SQL files show database setup. The maintainer VM is a development choice | +| Cloudflare Workers for V1 | One deployment runs the TanStack frontend, server functions, redirects, and scheduled delivery | +| Clerk for identity | Server-verified sessions map to account-scoped application data | +| TanStack Start, React, Click UI | A complete application interface with server functions and the ClickHouse design system | +| Hyperdrive, verified TLS, no query cache | Pool connections while preserving current operational reads | +| Durable Postgres outbox | Successful redirects record events before acknowledgement; cron handles temporary ClickHouse failures | +| Distinct event IDs in reports | At-least-once retries must not inflate counts | +| ClickPipes-managed links metadata | Current tag filters demonstrate operational edits propagating into analytics | +| 180-day eventual raw-event TTL | Supports 90-day reports with a preceding-period comparison | +| Operator-owned domains | A complete self-hosting path without building a multi-customer hostname provisioning service | +| /r/:slug, HTTP 302, no cache | Namespaces redirects and allows immediate destination changes | +| Immutable slug/domain assignment | Keeps printed short URLs and QR codes stable | +| Plain UI copy | Page titles and helper text describe tasks or actionable states | + +[Architecture](architecture.md) explains the data contracts and failure behavior. +[Deployment](setup-plan.md) defines setup inputs and commands. +[Deployment checks](v1-readiness.md) define acceptance criteria and verification limits. + +Vercel, automatic third-party domain onboarding, teams, ClickStack, pg_clickhouse, +materialized aggregates, and performance/HA benchmarking remain extensions. diff --git a/applications/shortwave/docs/development.md b/applications/shortwave/docs/development.md new file mode 100644 index 00000000..7c96d77c --- /dev/null +++ b/applications/shortwave/docs/development.md @@ -0,0 +1,99 @@ +# Development and checks + +Both databases and ClickPipes run in ClickHouse Cloud. A local web server is for +editing and testing the application against those Cloud resources. + +Install the [tools in README](../README.md#1-install-tools-clone-the-repo-and-sign-in) +and run `npm ci` in your checkout. The commands below run from the project root. + +## Run the application + +Follow [Cloud setup](../README.md#deploy-your-own-instance) first. Copy its runtime values +into your local application environment, then add Clerk development +keys and the local app origin using [.env.example](../.env.example) as a reference. +Do not add Cloud API keys or migration passwords to the runtime environment. + +```sh +umask 077 +cp .deployment/runtime.env .env +# Edit .env privately: add Clerk development keys and APP_URL=http://localhost:4317. +npm run dev +``` + +Open http://localhost:4317. Use Clerk development keys for local work, browser +automation and hosted evaluation. See [Clerk setup](hosting.md#1-prepare-a-domain-and-authentication) +for production launch configuration. + +If this Cloud data stack has no deployed scheduler, deliver its durable events +from a second terminal: + +```sh +npm run events:flush -- --watch +``` + +Do not leave this local flusher running when testing Workers cron or fixture +outbox assertions. Hosted operation must work without the development machine. + +## Checks + +```sh +npm test +npm run types:workers +npm run typecheck +npm run build:workers +npx wrangler deploy --dry-run +npm audit +``` + +The ordinary unit run skips live integration suites. It covers URL/domain +validation, previews, request isolation, CDC fixture locking, and cleanup scope. +CI does not need Cloud or Clerk credentials. + +Live tests require isolated Cloud test resources and configured .env values: + +```sh +npm run test:integration +npx playwright install --with-deps chromium +npm run dev +# In another terminal: +npm run test:browser +``` + +Browser tests use Clerk development keys, official test helpers, and reserved +`+clerk_test` addresses. They create synthetic users and clean their Postgres +fixtures; raw ClickHouse test events expire under the normal TTL. Traces and +videos are disabled to avoid retaining authentication tokens. Keep generated +screenshots private until their content has been reviewed. + +Integration tests must not race a global outbox delivery process. Use a separate +Cloud test deployment, or coordinate a pause of every flusher including Workers +cron. Report skipped checks separately from passing checks. + +The default `npm run build` and `npm start` use the Node adapter for local +validation. The release hosting path is Workers. Review changes to package-lock.json, +src/routeTree.gen.ts and worker-configuration.d.ts before committing generated files. + +Apply schema changes with the explicit `clickhousectl` file commands in README. +See [migration order and upgrade records](../migrations/README.md); there is no +JavaScript migration runner or automatic migration ledger. + +## Browser download troubleshooting + +Interactive hosted acceptance can use your usual browser. Record whether a check +was a manual journey or an automated Playwright run. + +Use `npx playwright install --with-deps chromium` to install the browser and +system dependencies. If the download times out, consult +[Playwright browser installation](https://playwright.dev/docs/browsers) for proxy, +certificate and timeout settings. Inspect the artifacts required by the installed +Playwright version with: + +```sh +npx playwright install --dry-run chromium +``` + +If you install that matching browser separately, set +`PLAYWRIGHT_CHROMIUM_EXECUTABLE` to its executable path before running +`npm run test:browser`. This override is supported by the +[Playwright configuration](../playwright.config.ts). Keep downloaded binaries and +caches out of version control. diff --git a/applications/shortwave/docs/hosting.md b/applications/shortwave/docs/hosting.md new file mode 100644 index 00000000..18dbdc04 --- /dev/null +++ b/applications/shortwave/docs/hosting.md @@ -0,0 +1,250 @@ +# Deploy the application to Cloudflare Workers + +Run these commands from the project root in your laptop terminal (Bash or zsh). +Complete the [database setup in README](../README.md#deploy-your-own-instance) +first. Keep `.deployment/resources.env`, `passwords.env`, `runtime.env`, service +receipts, and `postgres-ca.pem` private. Use the lockfile's Wrangler version. + +## 1. Prepare a domain and authentication + +Choose an application hostname and a short-link hostname in an active Cloudflare +zone in your account. Use a short-link subdomain if your apex already hosts a +website. Resolve conflicting DNS records before attaching the hostnames. +[Workers Custom Domains](https://developers.cloudflare.com/workers/configuration/routing/custom-domains/) +configures routing DNS and HTTPS certificates. + +Bring your own Clerk production application and restrict signup to your intended +users. Complete its domain/DNS setup; Clerk CNAME records should be **DNS only** +in Cloudflare. See [Clerk production deployment](https://clerk.com/docs/guides/development/deployment/production). + +Create `.deployment/clerk.env` in an editor, using a matching pair from that instance: + +```dotenv +VITE_CLERK_PUBLISHABLE_KEY=pk_live_replace_me +CLERK_SECRET_KEY=sk_live_replace_me +``` + +For local development or disposable evaluation, use a separate Clerk development +instance with matching `pk_test_` / `sk_test_` keys. Production session behavior +needs its own acceptance check. Never mix keys from different instances. + +Add these inputs to `.deployment/resources.env`: + +```dotenv +CLOUDFLARE_ACCOUNT_ID=YOUR_CLOUDFLARE_ACCOUNT_ID +WORKER_NAME=shortwave-example +APP_HOSTNAME=app.mydomain.com +SHORT_HOSTNAME=mydomain.com +``` + +```sh +umask 077 +source .deployment/resources.env +source .deployment/passwords.env +source .deployment/clerk.env +export CLOUDFLARE_ACCOUNT_ID +npx wrangler whoami +``` + +README already signed you in to Wrangler. `export CLOUDFLARE_ACCOUNT_ID` tells +Wrangler which of your accounts to use. Verify the selected account before any +write. It must match `account_id` in the private Wrangler config below. Reuse a valid Wrangler +session; `whoami` checks it. For noninteractive use, store a scoped +`CLOUDFLARE_API_TOKEN` as a secret environment variable in your CI system. +[Wrangler authentication](https://developers.cloudflare.com/workers/wrangler/commands/general/) +uses either the session or that token. + +A scoped token needs Workers Scripts: Edit, Hyperdrive: Edit, and SSL and +Certificates: Edit in the selected account, plus Zone: Read and Workers Routes: +Edit for the selected zones. DNS: Edit is needed only if you automate DNS record +changes. Check the current [permission labels](https://developers.cloudflare.com/fundamentals/api/reference/permissions/). + +## 2. Upload the Postgres CA + +Inspect existing certificates before creating one, then record the upload output: + +```sh +npx wrangler cert list +npx wrangler cert upload certificate-authority \ + --ca-cert .deployment/postgres-ca.pem --name "$WORKER_NAME-postgres-ca" \ + > .deployment/ca-upload.txt +``` + +Save the returned ID as `PG_CA_CERT_ID` in `.deployment/resources.env`, then +source the file again. On an interrupted upload, inspect the account's certificate +list and match the certificate before retrying. See +[Wrangler certificates](https://developers.cloudflare.com/workers/wrangler/commands/certificates/) +and [Hyperdrive TLS](https://developers.cloudflare.com/hyperdrive/configuration/tls-ssl-certificates-for-hyperdrive/). + +## 3. Allow database connections + +Hyperdrive must reach the Postgres origin. If that endpoint has a firewall, +configure it using [Hyperdrive networking](https://developers.cloudflare.com/hyperdrive/configuration/firewall-and-networking-configuration/). + +For ClickHouse, use the CLI login from README and inspect current access rules +alongside Cloudflare's published ranges: + +```sh +clickhousectl cloud service get "$CH_SERVICE_ID" --org-id "$CH_ORG_ID" --json \ + > .deployment/clickhouse-current.json +curl --fail --silent --show-error https://api.cloudflare.com/client/v4/ips \ + > .deployment/cloudflare-ips.json +jq '.ipAccessList' .deployment/clickhouse-current.json +jq -er '.result.ipv4_cidrs[]' .deployment/cloudflare-ips.json +``` + +Review the proposed additions. To allow a range you have approved, repeat this +command for each missing CIDR, replacing the placeholder with the actual range: + +```sh +clickhousectl cloud service update "$CH_SERVICE_ID" --org-id "$CH_ORG_ID" \ + --add-ip-allow 'APPROVED_CLOUDFLARE_CIDR' --json +``` + +`--add-ip-allow` preserves unrelated entries. Record added CIDRs privately and +inspect the service again after updating. Do not replace the access list or add +`0.0.0.0/0` as a connectivity workaround. These are shared ranges, so restricted +database credentials remain required. Published proxy ranges alone do not prove +egress for every Workers transport; verify the app's actual HTTPS ClickHouse +connection with hosted analytics and event delivery. + +## 4. Create Hyperdrive + +Inspect the account before creation, then create the connection using the +restricted Postgres runtime user: + +```sh +npx wrangler hyperdrive list +npx wrangler hyperdrive create "$WORKER_NAME-postgres" \ + --origin-host "$PGHOST" --origin-port "$PGPORT" --database "$PGDATABASE" \ + --origin-scheme postgres --origin-user link_shortener_app \ + --origin-password "$PG_APP_PASSWORD" \ + --ca-certificate-id "$PG_CA_CERT_ID" --sslmode verify-full \ + --caching-disabled --origin-connection-limit 20 \ + > .deployment/hyperdrive-create.txt +``` + +Keep shell tracing disabled and command output private when supplying passwords. + +Save the returned ID as `HYPERDRIVE_ID` in `.deployment/resources.env` and reload +it. On retries, inspect the recorded ID instead of creating a second connection: + +```sh +npx wrangler hyperdrive get "$HYPERDRIVE_ID" +``` + +Confirm the origin host, port, database, and user match the recorded Postgres +runtime connection; `caching.disabled` must be `true`, the CA ID must match, and +`sslmode` must be `verify-full`. Query caching must stay disabled so redirects and +authorization see current data. See [Wrangler Hyperdrive commands](https://developers.cloudflare.com/hyperdrive/reference/wrangler-commands/). + +## 5. Fill the private Wrangler configuration + +Create `.deployment/wrangler.json` with the following content. Replace the account, +Worker name, hostnames and Hyperdrive ID with your recorded inputs. Keep paths +relative to `.deployment`; keep the generic development config in the project +root. Add another custom-domain route and comma-separated `PUBLIC_CUSTOM_DOMAINS` +entry if you need another short hostname. + +```json +{ + "$schema": "../node_modules/wrangler/config-schema.json", + "name": "YOUR_WORKER_NAME", + "account_id": "YOUR_CLOUDFLARE_ACCOUNT_ID", + "main": "../src/worker.ts", + "compatibility_date": "2026-09-06", + "compatibility_flags": ["nodejs_compat", "global_fetch_strictly_public"], + "workers_dev": false, + "vars": { + "APP_URL": "https://app.mydomain.com", + "PUBLIC_CUSTOM_DOMAINS": "mydomain.com" + }, + "hyperdrive": [{ "binding": "HYPERDRIVE", "id": "YOUR_HYPERDRIVE_ID" }], + "routes": [ + { "pattern": "app.mydomain.com", "custom_domain": true }, + { "pattern": "mydomain.com", "custom_domain": true } + ], + "secrets": { + "required": [ + "CLERK_SECRET_KEY", "CLICKHOUSE_URL", "CLICKHOUSE_USERNAME", + "CLICKHOUSE_PASSWORD", "CLICKHOUSE_DATABASE", "CLICKHOUSE_CDC_DATABASE" + ] + }, + "observability": { "enabled": true, "head_sampling_rate": 1 }, + "triggers": { "crons": ["* * * * *"] } +} +``` + +Before the first upload, check in Cloudflare that the Worker name is unused and +that none of these hostnames belongs to another Worker. For an existing deployment, +compare the private config with its recorded account, names, IDs and hostnames. +Wrangler can overwrite an existing Worker, so do not adopt a name merely because +it matches. The scheduled event sender runs every minute. + +## 6. Build, upload secrets, and deploy + +Build using the private config and your Clerk publishable key: + +```sh +CLOUDFLARE_VITE_WRANGLER_CONFIG_PATH="$PWD/.deployment/wrangler.json" \ + VITE_CLERK_PUBLISHABLE_KEY="$VITE_CLERK_PUBLISHABLE_KEY" npm run build:workers +BUILD_CONFIG="$PWD/.wrangler/deploy/$(jq -er '.configPath' .wrangler/deploy/config.json)" +jq '{name, account_id, hyperdrive, vars, routes, triggers}' "$BUILD_CONFIG" +``` + +The [Cloudflare Vite plugin](https://developers.cloudflare.com/workers/vite-plugin/reference/api/) +generates the deployment config. Verify that the output contains your recorded +Worker, account, Hyperdrive binding, hostnames and scheduler before uploading. +Deploy that generated config so the Worker includes the built application/assets. +Do not deploy the generic development template. + +Create a secrets file containing only the values the Worker needs. Wrangler +accepts this standard environment-file format directly: + +```sh +source .deployment/runtime.env +source .deployment/clerk.env +cat > .deployment/workers-secrets.env <`. This is the maintainer's development workflow; +people deploying the example follow [README](../README.md) from their laptops. + +## Generated files and browser checks + +After changing dependencies or route generation in the VM, copy back only reviewed +package-lock.json, src/routeTree.gen.ts, and generic worker-configuration.d.ts. +The VM helper's pull-generated command handles the first two; inspect Worker types +before copying them. + +An interactive browser on the host can reach the development app at the VM's +address. Keep the automated Playwright runner, dependencies, binaries, and caches +inside Linux. Preserve VM isolation and report manual and automated checks separately. +The optional `scripts/install-local-services.sh` creates web/event user services +inside this VM for development convenience. diff --git a/applications/shortwave/docs/operations.md b/applications/shortwave/docs/operations.md new file mode 100644 index 00000000..728c978e --- /dev/null +++ b/applications/shortwave/docs/operations.md @@ -0,0 +1,156 @@ +# Operations + +Run commands from your checkout using the CLI logins from +[README](../README.md#deploy-your-own-instance). Load your recorded settings and +select your Cloudflare account: + +```sh +source .deployment/resources.env +export CLOUDFLARE_ACCOUNT_ID +``` + +Keep `.deployment/`, the CLI's `.clickhouse/` credentials, and command logs private. + +## Inspect and diagnose + +```sh +clickhousectl cloud postgres get "$PG_SERVICE_ID" --org-id "$CH_ORG_ID" --json +clickhousectl cloud service get "$CH_SERVICE_ID" --org-id "$CH_ORG_ID" --json +clickhousectl cloud clickpipe get "$CH_SERVICE_ID" "$CLICKPIPE_ID" --org-id "$CH_ORG_ID" --json +npx wrangler hyperdrive get "$HYPERDRIVE_ID" +npx wrangler deployments list --config .deployment/wrangler.json +``` + +Repeat the runtime privilege checks in README, [CDC verification](../infra/README.md#verify-data-flow), +and [HTTPS checks](hosting.md#7-check-https-and-application-behavior) as needed. +Provider status does not prove sign-in or event delivery. + +| Symptom | Check | +| --- | --- | +| Database connection fails only on Workers | Hyperdrive CA/TLS and ClickHouse ingress; local success does not prove hosted connectivity | +| Sign-in fails or loops | Matching Clerk instance/key pair, APP_URL and allowed origin; production domain and DNS-only CNAMEs | +| Analytics says delayed | Postgres click_outbox, Worker cron, ClickHouse INSERT grant and service readiness | +| Tags are still syncing | ClickPipe state, source publication, direct Postgres connection and source/replicated revisions | +| Ownership verified but links unavailable | Hosted hostname configuration and independent DNS/HTTPS check | +| TXT verification fails | Exact record name/value, propagation and resolver errors | + +Read the outbox using the runtime login and verified TLS: + +```sh +source .deployment/passwords.env +export PGSSLMODE=verify-full +export PGSSLROOTCERT="$PWD/.deployment/postgres-ca.pem" +PGPASSWORD="$PG_APP_PASSWORD" clickhousectl local postgres client \ + --host "$PGHOST" --port "$PGPORT" \ + --query 'SELECT count(*), min(created_at), max(attempts) FROM click_outbox' \ + -- -X -v ON_ERROR_STOP=1 -U link_shortener_app -d "$PGDATABASE" +clickhousectl cloud service query --id "$CH_SERVICE_ID" --org-id "$CH_ORG_ID" \ + --queries-file infra/clickhouse/verify-events.sql +npx wrangler tail --config .deployment/wrangler.json +``` + +Raw event rows may contain delivery retries; distinct event IDs determine the +reported counts. Reports include bots/previews and use UTC. Raw events expire +eventually after 180 days. Disabling a link returns 410 but retains its data. + +## Interrupted setup + +Creation and SQL execution are separate commands. A missing response is not proof +of failure. Keep every receipt, even if empty or partial, and inspect the exact +organization/account before another write: + +```sh +clickhousectl cloud service list --org-id "$CH_ORG_ID" --json +clickhousectl cloud postgres list --org-id "$CH_ORG_ID" --json +clickhousectl cloud clickpipe list "$CH_SERVICE_ID" --org-id "$CH_ORG_ID" --json +npx wrangler hyperdrive list +npx wrangler cert list +``` + +Match the intended name, creation time, account, endpoint and configuration. +Inspect a candidate by ID; if the attempted resource exists, record that ID and +continue with it. Recover credentials from the original receipt or your private +backup. Never infer ownership from a common name alone. Only retry creation when +the provider confirms that no resource was created; preserve the failed receipt +under a separate name so the original evidence is retained. Never overwrite the +receipt from a successful create command. + +A lost password needs a deliberate credential reset and consumer update, not a +new service. Never delete private state to force recreation. For ambiguous Worker +uploads, inspect the exact Worker and deployment history: secret upload may have +created it before the application deploy failed. + +For interrupted SQL, follow [migration recovery](../migrations/README.md#upgrades-and-interrupted-sql). +The manual workflow has no automatic reconciliation, migration ledger or locking; +run one setup/migration session at a time and record completed steps. + +### Existing deployments from the old helpers + +Keep `cloud-state.json`, `hosting-state.json`, `cloud-secrets.json`, create +receipts, runtime/migration environments and existing private Wrangler config. +Read their resource IDs and credentials into the new private input files rather +than rerunning creation or password generation. Preserve the database's old +`schema_migrations` history. Inspect all provider resources before using their IDs. +The retired JavaScript is not needed to keep the deployed application running. + +## Access and credentials + +Configure Clerk for your intended users; see [hosting](hosting.md#1-prepare-a-domain-and-authentication). +Public signup requires an operator-owned abuse policy and rate controls beyond +this example. See [Clerk user management](https://clerk.com/docs/guides/users/managing). + +Rotate credentials at the provider, update the private files, then update every +consumer. A Postgres runtime password change also requires +`npx wrangler hyperdrive update "$HYPERDRIVE_ID" --origin-password "$PG_APP_PASSWORD"` +with the new value loaded privately. Inspect the resulting TLS/cache settings. +A ClickHouse runtime or Clerk secret change needs Worker secret upload. Changing +a Clerk publishable key also needs a rebuild. Never send migration, CDC or +management credentials to Workers. SQL's `IF NOT EXISTS` clauses do not rotate +existing passwords. Do not regenerate the whole password file to rotate one login. + +## Upgrade and recovery + +Retain the current source revision, resource inventory, Worker version and database +backup/restore point. Add numbered SQL files instead of changing applied migrations. +Apply only pending SQL with the documented migration login; record each result. + +```sh +npm ci +npm test +npm run typecheck +``` + +Then repeat the [build and Wrangler deployment steps](hosting.md#6-build-upload-secrets-and-deploy) +and signed-in acceptance. A Worker rollback restores code, not schema. Prefer +backward-compatible migrations so the previous Worker can still read the data. + +For Postgres recovery, inspect `clickhousectl cloud postgres restore --help` and +restore to a new service at the chosen timestamp. A restored source needs a new +connection/CA/Hyperdrive configuration and a compatible ClickPipe before cutover; +record its new ID without replacing the original receipt. ClickHouse backups and +event retention need separate consideration. Full data-loss recovery and HA/load +drills remain unverified release claims. + +## Remove a deployment + +Stop traffic and decide whether to drain/export data. Confirm the exact recorded +account, names and IDs with the inspection commands above. Delete only dedicated +resources, in this order. These commands delete the services and their data: + +```sh +npx wrangler delete "$WORKER_NAME" --config .deployment/wrangler.json +npx wrangler hyperdrive delete "$HYPERDRIVE_ID" +npx wrangler cert delete --id "$PG_CA_CERT_ID" +clickhousectl cloud clickpipe delete "$CH_SERVICE_ID" "$CLICKPIPE_ID" --org-id "$CH_ORG_ID" +clickhousectl cloud postgres delete "$PG_SERVICE_ID" --org-id "$CH_ORG_ID" +clickhousectl cloud service delete "$CH_SERVICE_ID" --org-id "$CH_ORG_ID" --force +``` + +Delete the CA only after confirming no other connection uses it. Check the selected +hostnames for leftover DNS/TXT records and edge certificates; remove only items +created for this deployment after checking their use. Keep shared zones, domain +registrations, Clerk instances and unrelated resources. + +Confirm removal with successful account-scoped lists. A failed request is not proof +that a resource is absent. Preserve receipts until removal is confirmed. Stopping +your laptop or removing Worker routes does not stop database billing. diff --git a/applications/shortwave/docs/project-brief.md b/applications/shortwave/docs/project-brief.md new file mode 100644 index 00000000..84d3cd4a --- /dev/null +++ b/applications/shortwave/docs/project-brief.md @@ -0,0 +1,20 @@ +# Example scope + +Shortwave is a usable link shortener showing the unified data stack in +ClickHouse Cloud. The reader deploys their own +[ClickHouse Managed Postgres](https://clickhouse.com/cloud/postgres), ClickHouse, +and ClickPipe using [clickhousectl](https://clickhouse.com/docs/interfaces/cli), +then deploys the full application to Cloudflare Workers and connects a domain +they control. + +The app includes account-owned links, editable destinations, tags, folders, +UTM composition and templates, downloadable QR codes, custom domains, and click +analytics. Its developer lesson is the difference between authoritative +operational state, replicated current metadata, and immutable traffic facts. + +The V1 acceptance journey is clone, provision, deploy, attach domain, sign in, +create a link, generate traffic, inspect analytics, edit tags and observe sync, +edit/disable the destination, and remove the deployment's resources. + +Read [README](../README.md) for the walkthrough, [architecture](architecture.md) +for data semantics, and the [deployment checklist](v1-readiness.md) for acceptance criteria. diff --git a/applications/shortwave/docs/setup-plan.md b/applications/shortwave/docs/setup-plan.md new file mode 100644 index 00000000..a71f17cb --- /dev/null +++ b/applications/shortwave/docs/setup-plan.md @@ -0,0 +1,57 @@ +# Deployment inputs and order + +The step-by-step commands live in [README](../README.md#deploy-your-own-instance) +and the [Workers hosting guide](hosting.md). Database setup uses SQL files passed +directly to `clickhousectl`; hosting uses Wrangler. There is no repository-specific +provisioning runner. + +| Input | Source | Used by | +| --- | --- | --- | +| Cloud organization ID and Admin API key pair | [ClickHouse Cloud API keys](https://clickhouse.com/docs/cloud/manage/openapi) | Cloud management and Query API setup | +| Region, Postgres size/version/HA, ClickHouse memory/replicas | Organization's placements and quotas | Database creation | +| Provisioning public egress CIDR | Your laptop's public outbound address | ClickHouse network access | +| Cloudflare account and active zone | Operator's Cloudflare account | Worker, Hyperdrive, certificates and hostnames | +| Application and short-link hostnames | Domain controlled by the operator | Clerk, Worker routes and application domains | +| Matching Clerk key pair | Operator's Clerk instance | Browser authentication and session validation | +| Postgres CA registration ID | Wrangler CA upload | Hyperdrive verified origin TLS | + +## Sequence + +1. Install clickhousectl on your laptop, clone the repo, and run `npm ci` to + install app dependencies and Wrangler. Sign in to ClickHouse Cloud and Cloudflare. +2. Save private inputs and review the actual create commands: placement, sizes, + ingress and costs are explicit in README. +3. Create ClickHouse and ClickHouse Managed Postgres with `clickhousectl`. Keep create + receipts, record IDs, inspect readiness and download the CA. +4. Run the Postgres role SQL, numbered schema files, grants and publication SQL. + Use the administrator only where needed; the migration login owns app tables. +5. Run ClickHouse database/event/user/grant SQL through the Cloud Query API. +6. Create the links ClickPipe using the checked-in mapping. Inspect its destination + and grant runtime SELECT. Save runtime credentials separately. +7. Configure Clerk, networking and Hyperdrive with the documented commands. Fill + the private Wrangler config using the recorded account, IDs and hostnames. +8. Build with that config and the Clerk publishable key, inspect the generated + deployment target, upload runtime secrets and deploy with Wrangler. +9. Verify the short domain's TXT challenge and complete [acceptance](v1-readiness.md). +10. Keep the receipts for [operations and cleanup](operations.md). + +## Private files + +Use ignored `.deployment/` files for `resources.env` (inputs, endpoints and IDs), +`passwords.env` (separate database passwords), +`clerk.env`, `runtime.env`, the CA, rendered SQL, Wrangler config and CLI receipts. +Never publish these or credential-bearing logs. Keep `.clickhouse/` private too: +the CLI may store management and service Query API credentials there. + +Record completed commands. Inspect ambiguous results before retrying and reuse +the exact resource IDs. The CLI workflow does not automatically reconcile outcomes +or record migration hashes. See [migration records](../migrations/README.md). +Existing deployments retain their earlier private receipts and credentials. +Use a separate checkout/private directory for a separate deployment. + +## Domain scope + +The operator configures hostnames in their Cloudflare account. For example, +`app.mydomain.com` hosts the app and `mydomain.com/r/` hosts short links. +Use `go.mydomain.com` if the apex is occupied. No infrastructure is created per link. +Automatic onboarding of unrelated customers' domains remains a future extension. diff --git a/applications/shortwave/docs/v1-readiness.md b/applications/shortwave/docs/v1-readiness.md new file mode 100644 index 00000000..bada74f3 --- /dev/null +++ b/applications/shortwave/docs/v1-readiness.md @@ -0,0 +1,75 @@ +# Deployment and release checklist + +Use this checklist for a fresh Shortwave deployment or a release candidate. +Run the walkthrough in [README](../README.md) from your laptop with dedicated +ClickHouse Cloud resources and hostnames you control. Keep +resource IDs, credentials, accounts, screenshots and logs in private receipts. + +## Fresh-deployment acceptance + +Record the source revision, tool versions and results for each check. A passing +unit test does not establish that a hosted service or integration works. + +- [ ] Install the documented tools, clone the repository and run `npm ci`. +- [ ] Run `npm test`, `npm run types:workers`, `npm run typecheck`, + `npm run build:workers`, and a Wrangler deployment dry run. Report skipped live + suites separately. Review `npm audit` findings. +- [ ] Review the explicit CLI inputs and commands, then provision ClickHouse Managed Postgres, + ClickHouse and a links-only ClickPipe. Verify runtime permissions and TLS. +- [ ] Confirm populated metadata snapshot, updates preserving large unchanged + fields, and delete tombstones converge through ClickPipes. +- [ ] Rehearse an interrupted command: inspect the provider, reuse the recorded + resource IDs/credentials, and continue without duplicate creation. +- [ ] Build with the private config, inspect the generated target and deploy with Wrangler. Verify public HTTPS, sign-in and + ownership of the configured short hostname through its TXT challenge. +- [ ] Create, edit, disable and visit links on the application and short hostname. + Check immediate destination changes, HTTP 410 for disabled links, and HTTP 404 + for missing links or the wrong hostname. HEAD requests must not count visits. +- [ ] Verify a second account cannot read or mutate the first account's data. +- [ ] Exercise tags, folders and UTM templates; download and decode a QR code. +- [ ] Confirm historical UTM values remain unchanged, current tags regroup earlier + traffic after sync, and retries do not inflate distinct-event counts. +- [ ] Stop local application and event-delivery processes. Generate new hosted + visits and verify Workers cron delivers them to analytics independently. +- [ ] Redeploy while preserving links, verified domains, resource IDs, runtime + credentials and analytics. +- [ ] Remove only the dedicated deployment's recorded Worker, Hyperdrive, CA, + ClickPipe and databases. Check its DNS records and edge certificates; preserve + shared zones, Clerk instances and unrelated resources. + +See [development and checks](development.md) for Cloud integration and browser +fixtures, [Cloud setup](../infra/README.md) for CDC checks, and +[operations](operations.md) for recovery and cleanup. + +## Public release review + +- [ ] Review the exact files and any Git history being published for credentials, + personal paths, deployment hostnames, resource IDs and internal working notes. +- [ ] Exclude `.deployment/`, `.private/`, `.secrets/`, `.clickhouse/`, populated + environment files, CLI logs, browser authentication state and build output. +- [ ] Review every included image for account details, private URLs and tokens. +- [ ] Check local documentation links, provider links, product names and setup + commands. Keep example values visibly distinct from deployer configuration. +- [ ] Apply the destination repository's license, layout and CI requirements. + A standalone distribution also needs an explicitly selected license. +- [ ] Record the checks performed for the exact release candidate, including + failures, skips and unverified environments. + +## Scope and limits + +Shortwave supports an owner-operated deployment with restricted signup on +Cloudflare Workers. Both databases and ClickPipes run in ClickHouse Cloud. + +Development checks have run on Linux arm64 with Node 22.23.2 and clickhousectl +0.4.2. The laptop walkthrough uses standard macOS/Linux tools; full provisioning +from either platform still requires a fresh Cloud rehearsal before release. +Production Clerk sessions must be tested with the operator's own production instance; the +existing automated browser fixtures use development keys. + +This example does not provide a public shortening service's abuse-response +process, performance SLA, tested HA/failover plan or complete data-loss recovery +procedure. Review [operations](operations.md) before serving real users. + +Vercel, automatic third-party customer-domain onboarding, ClickStack, +pg_clickhouse, teams and additional analytics features are possible extensions, +not implemented capabilities. diff --git a/applications/shortwave/infra/README.md b/applications/shortwave/infra/README.md new file mode 100644 index 00000000..0bf584bc --- /dev/null +++ b/applications/shortwave/infra/README.md @@ -0,0 +1,76 @@ +# Infrastructure SQL and ClickPipe mapping + +Follow the [commands in the project README](../README.md#deploy-your-own-instance). +This directory contains inputs to those commands, not a provisioning program. +The repository keeps its existing migration paths; `clickhousectl local init` +is only needed when scaffolding a new project. + +| File | Run as | Purpose | +| --- | --- | --- | +| [postgres/001_roles.sql](postgres/001_roles.sql) | Postgres administrator | Create migration/runtime/CDC logins; grant schema access | +| [postgres/002_grants.sql](postgres/002_grants.sql) | Postgres migration login | Grant table access; enable full replica identity | +| [postgres/003_publication.sql](postgres/003_publication.sql) | Postgres administrator | Require logical WAL and publish only public.links | +| [postgres/verify.sql](postgres/verify.sql) | Postgres runtime login | Check privilege boundaries, publication, replica identity and TLS | +| [clickhouse/001_database.sql](clickhouse/001_database.sql) | Cloud Query API | Create analytics database | +| [clickhouse/002_app_user.sql](clickhouse/002_app_user.sql) | Cloud Query API | Template for a runtime user; render its hash privately before execution | +| [clickhouse/003_events_grant.sql](clickhouse/003_events_grant.sql) | Cloud Query API | Grant event reads/inserts | +| [clickhouse/004_cdc_grant.sql](clickhouse/004_cdc_grant.sql) | Cloud Query API | Grant CDC reads after ClickPipes creates the table | +| [clickhouse/verify-events.sql](clickhouse/verify-events.sql) | Runtime or Query API | Compare raw rows with distinct event IDs | +| [clickhouse/verify-cdc.sql](clickhouse/verify-cdc.sql) | Runtime or Query API | Inspect CDC engine and version/delete columns | +| [clickpipe-links.json](clickpipe-links.json) | clickhousectl create postgres | Explicit links-only CDC mapping | + +ClickHouse's Cloud query command accepts **one statement per file** in the checked +0.4.2 CLI. Postgres files use `psql`, with `-X` and `ON_ERROR_STOP=1`. The role file +also uses `psql` environment variables and identifier/literal quoting. No SQL +extension is needed for the current schema. App table definitions live in +[migrations](../migrations/README.md). + +The Cloud Query API's migration credential and Cloud management API keys stay +with the operator. The app receives only its restricted runtime login. Postgres +also has separate migration and replication logins; the replication login reads +only links. Passwords and rendered SQL stay under `.deployment/`. + +## Verify data flow + +Schema inspection in README does not establish runtime connectivity or CDC. +The fixture verifier uses the application's runtime database credentials and +changes only its synthetic source rows: + +```sh +node --env-file=.deployment/runtime.env scripts/verify-cdc.mjs +``` + +It checks insert, update of tags while preserving large unchanged URL fields, +and a delete tombstone. It cleans its source account/link and keeps a private +receipt in `.deployment/`; a synthetic destination tombstone remains. Failed +cleanup can be retried using its exact receipt: + +```sh +node --env-file=.deployment/runtime.env scripts/verify-cdc.mjs \ + --cleanup .deployment/cdc-YOUR_RUN_ID.json +``` + +For a **disposable test deployment only**, verify a populated resnapshot with +browser/integration runs and other flushers stopped. Start this in one terminal: + +```sh +node --env-file=.deployment/runtime.env scripts/verify-cdc.mjs --await-snapshot +``` + +Wait until it prints that the fixture is ready, then run this explicit management +command in another terminal with the recorded IDs and ClickHouse CLI authenticated: + +```sh +clickhousectl cloud clickpipe resync "$CH_SERVICE_ID" "$CLICKPIPE_ID" \ + --org-id "$CH_ORG_ID" +``` + +Resync snapshots the whole pipe. The verifier waits up to ten minutes for the +CDC table UUID to change, then verifies the populated snapshot, updates and +persistent tombstone. It never runs infrastructure commands or receives management +keys. Do not resync a production pipe merely to test setup. + +Run the [hosted acceptance checklist](../docs/v1-readiness.md) separately to verify +authentication, authorization, redirects, event delivery and Worker networking. +The direct-command setup needs a fresh-deployment rehearsal before publication; +CLI syntax checks and ordinary tests are not a Cloud acceptance pass. diff --git a/applications/shortwave/infra/clickhouse/001_database.sql b/applications/shortwave/infra/clickhouse/001_database.sql new file mode 100644 index 00000000..3357aac0 --- /dev/null +++ b/applications/shortwave/infra/clickhouse/001_database.sql @@ -0,0 +1 @@ +CREATE DATABASE IF NOT EXISTS link_shortener; diff --git a/applications/shortwave/infra/clickhouse/002_app_user.sql b/applications/shortwave/infra/clickhouse/002_app_user.sql new file mode 100644 index 00000000..c0409cd1 --- /dev/null +++ b/applications/shortwave/infra/clickhouse/002_app_user.sql @@ -0,0 +1,4 @@ +-- Render this template to .deployment before running it; see README. +-- IF NOT EXISTS preserves the existing password on a setup retry. +CREATE USER IF NOT EXISTS link_shortener_app +IDENTIFIED WITH sha256_hash BY 'REPLACE_WITH_SHA256_HASH'; diff --git a/applications/shortwave/infra/clickhouse/003_events_grant.sql b/applications/shortwave/infra/clickhouse/003_events_grant.sql new file mode 100644 index 00000000..5317002f --- /dev/null +++ b/applications/shortwave/infra/clickhouse/003_events_grant.sql @@ -0,0 +1 @@ +GRANT SELECT, INSERT ON link_shortener.click_events TO link_shortener_app; diff --git a/applications/shortwave/infra/clickhouse/004_cdc_grant.sql b/applications/shortwave/infra/clickhouse/004_cdc_grant.sql new file mode 100644 index 00000000..35706f45 --- /dev/null +++ b/applications/shortwave/infra/clickhouse/004_cdc_grant.sql @@ -0,0 +1 @@ +GRANT SELECT ON default.cdc_links TO link_shortener_app; diff --git a/applications/shortwave/infra/clickhouse/verify-cdc.sql b/applications/shortwave/infra/clickhouse/verify-cdc.sql new file mode 100644 index 00000000..8f51c6a6 --- /dev/null +++ b/applications/shortwave/infra/clickhouse/verify-cdc.sql @@ -0,0 +1,2 @@ +SELECT engine, sorting_key, create_table_query +FROM system.tables WHERE database = 'default' AND name = 'cdc_links'; diff --git a/applications/shortwave/infra/clickhouse/verify-events.sql b/applications/shortwave/infra/clickhouse/verify-events.sql new file mode 100644 index 00000000..09a9f7b0 --- /dev/null +++ b/applications/shortwave/infra/clickhouse/verify-events.sql @@ -0,0 +1,2 @@ +SELECT count() AS stored_rows, uniqExact(event_id) AS distinct_events +FROM link_shortener.click_events; diff --git a/applications/shortwave/infra/clickpipe-links.json b/applications/shortwave/infra/clickpipe-links.json new file mode 100644 index 00000000..fb2bc17c --- /dev/null +++ b/applications/shortwave/infra/clickpipe-links.json @@ -0,0 +1,11 @@ +{ + "sourceSchemaName": "public", + "sourceTable": "links", + "targetTable": "cdc_links", + "excludedColumns": [], + "sortingKeys": ["id"], + "useCustomSortingKey": true, + "partitionByExpr": "", + "partitionKey": "", + "tableEngine": "ReplacingMergeTree" +} diff --git a/applications/shortwave/infra/postgres/001_roles.sql b/applications/shortwave/infra/postgres/001_roles.sql new file mode 100644 index 00000000..e0ab0809 --- /dev/null +++ b/applications/shortwave/infra/postgres/001_roles.sql @@ -0,0 +1,27 @@ +\set ON_ERROR_STOP on +\getenv app_password PG_APP_PASSWORD +\getenv migration_password PG_MIGRATION_PASSWORD +\getenv cdc_password PG_CDC_PASSWORD + +BEGIN; + +-- Run as the service administrator. Existing passwords are never reset here. +SELECT format('CREATE ROLE link_shortener_migration LOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE NOREPLICATION PASSWORD %L', :'migration_password') +WHERE NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'link_shortener_migration') +\gexec +SELECT format('CREATE ROLE link_shortener_app LOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE NOREPLICATION PASSWORD %L', :'app_password') +WHERE NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'link_shortener_app') +\gexec +SELECT format('CREATE ROLE link_shortener_cdc LOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE REPLICATION PASSWORD %L', :'cdc_password') +WHERE NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'link_shortener_cdc') +\gexec + +-- The administrator must be able to publish migration-owned tables. +GRANT link_shortener_migration TO CURRENT_USER; +REVOKE CREATE ON SCHEMA public FROM PUBLIC; +GRANT USAGE, CREATE ON SCHEMA public TO link_shortener_migration; +GRANT USAGE ON SCHEMA public TO link_shortener_app, link_shortener_cdc; +SELECT format('GRANT CONNECT ON DATABASE %I TO link_shortener_migration, link_shortener_app, link_shortener_cdc', current_database()) +\gexec + +COMMIT; diff --git a/applications/shortwave/infra/postgres/002_grants.sql b/applications/shortwave/infra/postgres/002_grants.sql new file mode 100644 index 00000000..823244e4 --- /dev/null +++ b/applications/shortwave/infra/postgres/002_grants.sql @@ -0,0 +1,11 @@ +-- Run as link_shortener_migration after the numbered schema migrations. +BEGIN; +GRANT SELECT, INSERT, UPDATE, DELETE ON + accounts, links, utm_templates, qr_styles, click_outbox, account_tags, + folders, link_folders, custom_domains +TO link_shortener_app; +GRANT SELECT ON links TO link_shortener_cdc; + +-- Preserve unchanged large text and array values on CDC updates. +ALTER TABLE links REPLICA IDENTITY FULL; +COMMIT; diff --git a/applications/shortwave/infra/postgres/003_publication.sql b/applications/shortwave/infra/postgres/003_publication.sql new file mode 100644 index 00000000..6643d185 --- /dev/null +++ b/applications/shortwave/infra/postgres/003_publication.sql @@ -0,0 +1,19 @@ +-- Run as the service administrator, after tables and grants exist. +BEGIN; +DO $$ +BEGIN + IF current_setting('wal_level') <> 'logical' THEN + RAISE EXCEPTION 'Enable wal_level=logical before creating the ClickPipe'; + END IF; + IF NOT EXISTS (SELECT FROM pg_publication WHERE pubname = 'link_shortener_clickpipe') THEN + CREATE PUBLICATION link_shortener_clickpipe FOR TABLE public.links; + END IF; + IF (SELECT count(*) FROM pg_publication_tables + WHERE pubname = 'link_shortener_clickpipe') <> 1 + OR NOT EXISTS (SELECT FROM pg_publication_tables + WHERE pubname = 'link_shortener_clickpipe' + AND schemaname = 'public' AND tablename = 'links') THEN + RAISE EXCEPTION 'link_shortener_clickpipe must contain only public.links'; + END IF; +END $$; +COMMIT; diff --git a/applications/shortwave/infra/postgres/verify.sql b/applications/shortwave/infra/postgres/verify.sql new file mode 100644 index 00000000..a0e02786 --- /dev/null +++ b/applications/shortwave/infra/postgres/verify.sql @@ -0,0 +1,22 @@ +\set ON_ERROR_STOP on +-- Run with the runtime login, using verify-full TLS. +DO $$ +BEGIN + IF current_user <> 'link_shortener_app' THEN + RAISE EXCEPTION 'Verify with the runtime login'; + END IF; + IF EXISTS (SELECT FROM pg_roles WHERE rolname = current_user + AND (rolsuper OR rolcreaterole OR rolcreatedb OR rolreplication)) + OR has_schema_privilege(current_user, 'public', 'CREATE') THEN + RAISE EXCEPTION 'Runtime login has management or schema privileges'; + END IF; + IF EXISTS (SELECT FROM pg_tables WHERE schemaname = 'public' + AND tableowner = current_user) THEN + RAISE EXCEPTION 'Runtime login must not own application tables'; + END IF; +END $$; +SELECT id FROM accounts LIMIT 1; +SELECT pubname, schemaname, tablename FROM pg_publication_tables +WHERE pubname = 'link_shortener_clickpipe'; +SELECT relreplident FROM pg_class WHERE oid = 'public.links'::regclass; +SELECT ssl FROM pg_stat_ssl WHERE pid = pg_backend_pid(); diff --git a/applications/shortwave/migrations/README.md b/applications/shortwave/migrations/README.md new file mode 100644 index 00000000..ab41f926 --- /dev/null +++ b/applications/shortwave/migrations/README.md @@ -0,0 +1,49 @@ +# Schema migrations + +Apply these SQL files with the explicit `clickhousectl` commands in the +[project README](../README.md#3-create-postgres-roles-and-apply-sql). Read each file +before running it. Postgres application tables belong to +`link_shortener_migration`; use that login for migrations. + +| Order | File | Change | +| --- | --- | --- | +| 1 | [postgres/001_initial.sql](postgres/001_initial.sql) | Accounts, links, templates, QR styles and durable event outbox | +| 2 | [postgres/002_saved_tags.sql](postgres/002_saved_tags.sql) | Saved account tags and backfill | +| 3 | [postgres/003_folders.sql](postgres/003_folders.sql) | Folders and link membership | +| 4 | [postgres/004_custom_domains.sql](postgres/004_custom_domains.sql) | Domain ownership claims | +| 5 | [postgres/005_domain_links.sql](postgres/005_domain_links.sql) | Domain-scoped links and slug uniqueness | +| 6 | [../infra/postgres/002_grants.sql](../infra/postgres/002_grants.sql) | Runtime/CDC grants and replica identity after table creation | + +ClickHouse uses [clickhouse/001_events.sql](clickhouse/001_events.sql), applied +with `--database link_shortener`. The metadata fixture +[clickhouse/002_local_metadata.sql](clickhouse/002_local_metadata.sql) is **local +only**; never apply it to ClickHouse Cloud. ClickPipes owns `default.cdc_links`. + +## Upgrades and interrupted SQL + +Add a numbered file for each new schema change; preserve already-applied files. +Keep a private record of the source revision, successful filenames and checksums: + +```sh +openssl dgst -sha256 migrations/postgres/*.sql migrations/clickhouse/001_events.sql \ + > .deployment/migration-checksums.txt +``` + +This is an operator record, not an automatic migration ledger. Save a separate +copy per release, mark each completed command, and apply only pending migrations +on upgrades. Stop on any error before running the next file. Postgres files wrap +their changes in a transaction; an interrupted connection rolls back an uncommitted +transaction. A lost response may follow a successful commit, so inspect the +schema before retrying. Do not run concurrent migrations. + +For deployments previously created by the JavaScript bootstrap, retain the +existing private receipts and `schema_migrations` table. Use its filenames and +hashes to establish what is already applied; do not regenerate passwords or +recreate services. The direct CLI workflow does not update that old ledger. +Record subsequent migrations separately. Existing roles and Cloud resources +remain usable without the retired setup code. + +The five current Postgres files can be reapplied when recovering their outcome, +but some include data backfills. Review their effects rather than treating every +future migration as automatically safe to rerun. ClickHouse DDL has no enclosing +transaction; inspect the destination before retrying a timed-out statement. diff --git a/applications/shortwave/migrations/clickhouse/001_events.sql b/applications/shortwave/migrations/clickhouse/001_events.sql new file mode 100644 index 00000000..53b2eae8 --- /dev/null +++ b/applications/shortwave/migrations/clickhouse/001_events.sql @@ -0,0 +1,25 @@ +CREATE TABLE IF NOT EXISTS click_events ( + event_id UUID, + account_id UUID, + link_id UUID, + occurred_at DateTime64(3, 'UTC'), + ingested_at DateTime64(3, 'UTC') DEFAULT now64(3), + utm_source String, + utm_medium String, + utm_campaign String, + utm_term String, + utm_content String, + referrer_domain String, + country LowCardinality(String), + device LowCardinality(String), + browser LowCardinality(String), + is_bot UInt8, + is_demo UInt8 DEFAULT 0 +) +ENGINE = MergeTree +PARTITION BY toYYYYMM(occurred_at) +ORDER BY (account_id, occurred_at, link_id, event_id) +TTL occurred_at + INTERVAL 180 DAY DELETE; + +-- Retry-safe counts use uniqExact(event_id). A sorting key does not deduplicate. +-- ClickPipes creates cdc_links separately. Do not create its cloud table here. diff --git a/applications/shortwave/migrations/clickhouse/002_local_metadata.sql b/applications/shortwave/migrations/clickhouse/002_local_metadata.sql new file mode 100644 index 00000000..044b2409 --- /dev/null +++ b/applications/shortwave/migrations/clickhouse/002_local_metadata.sql @@ -0,0 +1,12 @@ +-- LOCAL DEVELOPMENT ONLY. Cloud uses a ClickPipes-managed cdc_links table. +CREATE TABLE IF NOT EXISTS cdc_links ( + id UUID, + account_id UUID, + slug String, + title String, + tags Array(String), + _peerdb_version UInt64, + _peerdb_is_deleted UInt8 +) +ENGINE = ReplacingMergeTree(_peerdb_version) +ORDER BY id; diff --git a/applications/shortwave/migrations/postgres/001_initial.sql b/applications/shortwave/migrations/postgres/001_initial.sql new file mode 100644 index 00000000..1917a93d --- /dev/null +++ b/applications/shortwave/migrations/postgres/001_initial.sql @@ -0,0 +1,57 @@ +BEGIN; + +CREATE TABLE IF NOT EXISTS accounts ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid(), + clerk_user_id text NOT NULL UNIQUE, + created_at timestamptz NOT NULL DEFAULT now() +); + +CREATE TABLE IF NOT EXISTS links ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid(), + account_id uuid NOT NULL REFERENCES accounts(id), + slug varchar(48) NOT NULL UNIQUE CHECK (slug ~ '^[a-zA-Z0-9][a-zA-Z0-9_-]{2,47}$'), + title varchar(160) NOT NULL DEFAULT '', + destination text NOT NULL, + resolved_url text NOT NULL, + utm jsonb NOT NULL DEFAULT '{}', + tags text[] NOT NULL DEFAULT '{}', + enabled boolean NOT NULL DEFAULT true, + revision bigint NOT NULL DEFAULT 1, + created_at timestamptz NOT NULL DEFAULT now(), + updated_at timestamptz NOT NULL DEFAULT now(), + UNIQUE (account_id, id) +); +CREATE INDEX IF NOT EXISTS links_account_created ON links (account_id, created_at DESC); +CREATE INDEX IF NOT EXISTS links_tags ON links USING gin (tags); + +CREATE TABLE IF NOT EXISTS utm_templates ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid(), + account_id uuid NOT NULL REFERENCES accounts(id), + name varchar(80) NOT NULL, + values jsonb NOT NULL, + created_at timestamptz NOT NULL DEFAULT now(), + updated_at timestamptz NOT NULL DEFAULT now(), + UNIQUE (account_id, name) +); + +CREATE TABLE IF NOT EXISTS qr_styles ( + link_id uuid PRIMARY KEY, + account_id uuid NOT NULL, + style jsonb NOT NULL, + FOREIGN KEY (account_id, link_id) REFERENCES links(account_id, id) ON DELETE CASCADE +); + +-- This durable queue is deliberately excluded from the CDC publication. +-- A redirect is acknowledged only after its event is committed here. +CREATE TABLE IF NOT EXISTS click_outbox ( + event_id uuid PRIMARY KEY, + account_id uuid NOT NULL REFERENCES accounts(id), + event jsonb NOT NULL, + attempts integer NOT NULL DEFAULT 0, + next_attempt_at timestamptz NOT NULL DEFAULT now(), + created_at timestamptz NOT NULL DEFAULT now() +); +CREATE INDEX IF NOT EXISTS click_outbox_ready ON click_outbox (next_attempt_at, created_at); +CREATE INDEX IF NOT EXISTS click_outbox_account ON click_outbox (account_id); + +COMMIT; diff --git a/applications/shortwave/migrations/postgres/002_saved_tags.sql b/applications/shortwave/migrations/postgres/002_saved_tags.sql new file mode 100644 index 00000000..126636a0 --- /dev/null +++ b/applications/shortwave/migrations/postgres/002_saved_tags.sql @@ -0,0 +1,24 @@ +BEGIN; + +-- Reusable account vocabulary stays available after a tag is removed from a link. +-- Link membership remains in links.tags for the existing CDC analytics path. +CREATE TABLE IF NOT EXISTS account_tags ( + account_id uuid NOT NULL REFERENCES accounts(id) ON DELETE CASCADE, + name varchar(40) NOT NULL CHECK (length(btrim(name)) > 0), + PRIMARY KEY (account_id, name) +); + +INSERT INTO account_tags (account_id, name) +SELECT DISTINCT account_id, unnest(tags) FROM links +ON CONFLICT DO NOTHING; + +-- Existing Cloud runtime role; fresh setups may create their role afterwards. +DO $$ +BEGIN + IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'link_shortener_app') THEN + GRANT SELECT, INSERT ON account_tags TO link_shortener_app; + END IF; +END +$$; + +COMMIT; diff --git a/applications/shortwave/migrations/postgres/003_folders.sql b/applications/shortwave/migrations/postgres/003_folders.sql new file mode 100644 index 00000000..e5fd6313 --- /dev/null +++ b/applications/shortwave/migrations/postgres/003_folders.sql @@ -0,0 +1,29 @@ +BEGIN; + +-- Flat, account-owned folders. Keep CDC's links table unchanged. +CREATE TABLE IF NOT EXISTS folders ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid(), + account_id uuid NOT NULL REFERENCES accounts(id) ON DELETE CASCADE, + name varchar(80) NOT NULL CHECK (length(trim(name)) > 0), + UNIQUE (account_id, id) +); +CREATE UNIQUE INDEX IF NOT EXISTS folders_account_name ON folders (account_id, lower(name)); + +-- One optional folder per link; deleting a folder only removes membership. +CREATE TABLE IF NOT EXISTS link_folders ( + link_id uuid PRIMARY KEY, + account_id uuid NOT NULL, + folder_id uuid NOT NULL, + FOREIGN KEY (account_id, link_id) REFERENCES links(account_id, id) ON DELETE CASCADE, + FOREIGN KEY (account_id, folder_id) REFERENCES folders(account_id, id) ON DELETE CASCADE +); +CREATE INDEX IF NOT EXISTS link_folders_account_folder ON link_folders (account_id, folder_id); + +DO $$ +BEGIN + IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'link_shortener_app') THEN + GRANT SELECT, INSERT, UPDATE, DELETE ON folders, link_folders TO link_shortener_app; + END IF; +END $$; + +COMMIT; diff --git a/applications/shortwave/migrations/postgres/004_custom_domains.sql b/applications/shortwave/migrations/postgres/004_custom_domains.sql new file mode 100644 index 00000000..016ab1fb --- /dev/null +++ b/applications/shortwave/migrations/postgres/004_custom_domains.sql @@ -0,0 +1,30 @@ +BEGIN; + +-- Claims prove ownership only. They do not change link routing or slug scope. +CREATE TABLE IF NOT EXISTS custom_domains ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid(), + account_id uuid NOT NULL REFERENCES accounts(id) ON DELETE CASCADE, + hostname varchar(229) NOT NULL CHECK (hostname = lower(hostname)), + verification_token varchar(64) NOT NULL CHECK (verification_token ~ '^[0-9a-f]{64}$'), + status text NOT NULL DEFAULT 'pending' CHECK (status IN ('pending', 'verified')), + verified_at timestamptz, + last_checked_at timestamptz, + verification_error text, + verification_attempt uuid, + created_at timestamptz NOT NULL DEFAULT now(), + UNIQUE (account_id, hostname), + CHECK ((status = 'verified') = (verified_at IS NOT NULL)) +); + +-- Pending claims cannot prevent another account proving ownership. +CREATE UNIQUE INDEX IF NOT EXISTS custom_domains_verified_hostname + ON custom_domains (hostname) WHERE status = 'verified'; + +DO $$ +BEGIN + IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'link_shortener_app') THEN + GRANT SELECT, INSERT, UPDATE, DELETE ON custom_domains TO link_shortener_app; + END IF; +END $$; + +COMMIT; diff --git a/applications/shortwave/migrations/postgres/005_domain_links.sql b/applications/shortwave/migrations/postgres/005_domain_links.sql new file mode 100644 index 00000000..b25a4154 --- /dev/null +++ b/applications/shortwave/migrations/postgres/005_domain_links.sql @@ -0,0 +1,21 @@ +BEGIN; + +CREATE UNIQUE INDEX IF NOT EXISTS custom_domains_account_id_id + ON custom_domains (account_id, id); + +ALTER TABLE links ADD COLUMN IF NOT EXISTS domain_id uuid; +DO $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'links_owned_domain_fk' AND conrelid = 'links'::regclass) THEN + ALTER TABLE links ADD CONSTRAINT links_owned_domain_fk + FOREIGN KEY (account_id, domain_id) REFERENCES custom_domains (account_id, id) + ON DELETE RESTRICT; + END IF; +END $$; + +-- Old links keep the default application's slug namespace and URL paths. +ALTER TABLE links DROP CONSTRAINT IF EXISTS links_slug_key; +CREATE UNIQUE INDEX IF NOT EXISTS links_default_slug ON links (slug) WHERE domain_id IS NULL; +CREATE UNIQUE INDEX IF NOT EXISTS links_domain_slug ON links (domain_id, slug) WHERE domain_id IS NOT NULL; + +COMMIT; diff --git a/applications/shortwave/package-lock.json b/applications/shortwave/package-lock.json new file mode 100644 index 00000000..f6e21645 --- /dev/null +++ b/applications/shortwave/package-lock.json @@ -0,0 +1,9042 @@ +{ + "name": "shortwave", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "shortwave", + "version": "0.1.0", + "dependencies": { + "@clerk/tanstack-react-start": "^1.5.8", + "@clickhouse/click-ui": "^0.10.0", + "@clickhouse/client": "^1.12.1", + "@clickhouse/client-web": "^1.23.1", + "@tanstack/react-router": "^1.170.32", + "@tanstack/react-start": "^1.168.49", + "lucide-react": "^0.577.0", + "pg": "^8.16.3", + "qr-code-styling": "^1.9.2", + "react": "^19.2.8", + "react-dom": "^19.2.8", + "zod": "^4.3.6" + }, + "devDependencies": { + "@clerk/testing": "^2.2.33", + "@cloudflare/vite-plugin": "^1.54.8", + "@playwright/test": "^1.63.0", + "@types/node": "^22.19.0", + "@types/pg": "^8.16.0", + "@types/pngjs": "^6.0.5", + "@types/react": "^19.2.0", + "@types/react-dom": "^19.2.0", + "@vitejs/plugin-react": "^6.1.1", + "jsqr": "^1.4.0", + "nitro": "3.0.260903-beta", + "pngjs": "^7.0.0", + "tsx": "^4.21.0", + "typescript": "^5.9.3", + "vite": "^8.2.2", + "wrangler": "^4.131.1" + }, + "engines": { + "node": ">=22.12.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.27.1", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz", + "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz", + "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.7", + "@babel/helper-compilation-targets": "^7.29.7", + "@babel/helper-module-transforms": "^7.29.7", + "@babel/helpers": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/template": "^7.29.7", + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/core/node_modules/@babel/code-frame": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.29.7", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/generator": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.8.tgz", + "integrity": "sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg==", + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.8", + "@babel/types": "^7.29.8", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz", + "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==", + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.29.7", + "@babel/helper-validator-option": "^7.29.7", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz", + "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz", + "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==", + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz", + "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==", + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7", + "@babel/traverse": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz", + "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.7.tgz", + "integrity": "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==", + "license": "MIT", + "dependencies": { + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.8.tgz", + "integrity": "sha512-E8lTAYNB1KW+FH+VGJuZM1ioAx2E6oVlvQFRrf5P8ZZmsiJXYAD9vTFV7yyEURNzgh1dFqMZuO6tUwcARbqFCA==", + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.8" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.7.tgz", + "integrity": "sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz", + "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template/node_modules/@babel/code-frame": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.29.7", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.8.tgz", + "integrity": "sha512-I5z7H3bf/41ktsNVLtpN0wAa336HkqIHQ5BuPLEhTkt1jVSyZpeNKIzTgEWmlxjdg81R0IgUCcaE+Ok3NvrfZg==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.8", + "@babel/helper-globals": "^7.29.7", + "@babel/parser": "^7.29.8", + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.8", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/@babel/code-frame": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.29.7", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.8.tgz", + "integrity": "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==", + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@clerk/backend": { + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/@clerk/backend/-/backend-3.17.1.tgz", + "integrity": "sha512-HDBknkYVTMknYsRNHeI0lUE+e4QfOty/LDzWKpbnaaKJUMzHZDUcVo9RQnLdg18XvhaBN7z1OoRiphJ82nimRA==", + "license": "MIT", + "dependencies": { + "@clerk/shared": "^4.31.0", + "standardwebhooks": "^1.0.0", + "tslib": "2.8.1" + }, + "engines": { + "node": ">=20.9.0" + } + }, + "node_modules/@clerk/react": { + "version": "6.15.1", + "resolved": "https://registry.npmjs.org/@clerk/react/-/react-6.15.1.tgz", + "integrity": "sha512-zzlLSjsSls+hH4qU6OX+vPeQizroSGo5xzWe5Ez2O6phwjgN+3a2x8ifevjwbbLRKVU86q+LoLMoctZT3eH5zQ==", + "license": "MIT", + "dependencies": { + "@clerk/shared": "^4.31.0", + "tslib": "2.8.1" + }, + "engines": { + "node": ">=20.9.0" + }, + "peerDependencies": { + "react": "^18.0.0 || ~19.0.3 || ~19.1.4 || ~19.2.3 || ~19.3.0-0", + "react-dom": "^18.0.0 || ~19.0.3 || ~19.1.4 || ~19.2.3 || ~19.3.0-0" + } + }, + "node_modules/@clerk/shared": { + "version": "4.31.0", + "resolved": "https://registry.npmjs.org/@clerk/shared/-/shared-4.31.0.tgz", + "integrity": "sha512-jw7J8dmdcXzeGHFAaMA92r04Ej1eVhAeHlcF2XuCKU+teGt3SV4yc2I0eWSqoLmsYpzgBgA66SJ6lLk22R2+fQ==", + "license": "MIT", + "dependencies": { + "@tanstack/query-core": "^5.100.6", + "dequal": "2.0.3", + "glob-to-regexp": "0.4.1", + "js-cookie": "3.0.7" + }, + "engines": { + "node": ">=20.9.0" + }, + "peerDependencies": { + "react": "^18.0.0 || ~19.0.3 || ~19.1.4 || ~19.2.3 || ~19.3.0-0", + "react-dom": "^18.0.0 || ~19.0.3 || ~19.1.4 || ~19.2.3 || ~19.3.0-0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-dom": { + "optional": true + } + } + }, + "node_modules/@clerk/tanstack-react-start": { + "version": "1.5.12", + "resolved": "https://registry.npmjs.org/@clerk/tanstack-react-start/-/tanstack-react-start-1.5.12.tgz", + "integrity": "sha512-go7aI5VPsVScroc30m80v2Xqc9/gvWEhzKQCn1L6mSKSIEpJk4Ii1aJOiQHetQyscGP0ENt2umR+XSoluNurVQ==", + "license": "MIT", + "dependencies": { + "@clerk/backend": "^3.17.1", + "@clerk/react": "^6.15.1", + "@clerk/shared": "^4.31.0", + "tslib": "2.8.1" + }, + "engines": { + "node": ">=20.9.0" + }, + "peerDependencies": { + "@tanstack/react-router": "^1.168.10", + "@tanstack/react-start": "^1.167.17", + "react": "^18.0.0 || ~19.0.3 || ~19.1.4 || ~19.2.3 || ~19.3.0-0", + "react-dom": "^18.0.0 || ~19.0.3 || ~19.1.4 || ~19.2.3 || ~19.3.0-0" + } + }, + "node_modules/@clerk/testing": { + "version": "2.2.33", + "resolved": "https://registry.npmjs.org/@clerk/testing/-/testing-2.2.33.tgz", + "integrity": "sha512-+LzWrSwkU3j0jWylS4znQmbivDKmAPN7HuBcwFyBOU92Bp+/JHyylrzaR3RVOwex/Cea8Cztsl/Y+Ys4tXs4Ww==", + "dev": true, + "license": "MIT", + "dependencies": { + "@clerk/backend": "^3.17.1", + "@clerk/shared": "^4.31.0", + "dotenv": "17.2.2" + }, + "engines": { + "node": ">=20.9.0" + }, + "peerDependencies": { + "@playwright/test": "^1", + "cypress": "^13 || ^14 || ^15" + }, + "peerDependenciesMeta": { + "@playwright/test": { + "optional": true + }, + "cypress": { + "optional": true + } + } + }, + "node_modules/@clickhouse/click-ui": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@clickhouse/click-ui/-/click-ui-0.10.0.tgz", + "integrity": "sha512-uF7efYqbOWSxCNhTecueNcvIlWCpHerAJ6RjZs3Xcr1UKojJJzI2cIZX/o+0+3vZTRVdUDXPOKVTB1w07EHy2A==", + "license": "Apache-2.0", + "dependencies": { + "@h6s/calendar": "2.2.0", + "@radix-ui/react-accordion": "1.2.12", + "@radix-ui/react-avatar": "1.1.1", + "@radix-ui/react-checkbox": "1.1.2", + "@radix-ui/react-context-menu": "2.2.2", + "@radix-ui/react-dialog": "1.1.2", + "@radix-ui/react-dismissable-layer": "1.1.1", + "@radix-ui/react-dropdown-menu": "2.1.2", + "@radix-ui/react-hover-card": "1.1.2", + "@radix-ui/react-popover": "1.1.2", + "@radix-ui/react-popper": "1.2.1", + "@radix-ui/react-radio-group": "1.2.1", + "@radix-ui/react-separator": "1.1.1", + "@radix-ui/react-switch": "1.1.1", + "@radix-ui/react-tabs": "1.1.1", + "@radix-ui/react-toast": "1.2.2", + "@radix-ui/react-tooltip": "1.1.2", + "class-variance-authority": "^0.7.1", + "clsx": "^2.1.1", + "dayjs": "^1.11.19", + "lodash-es": "^4.17.23", + "react-sortablejs": "^6.1.4", + "react-syntax-highlighter": "^16.1.0", + "react-virtualized-auto-sizer": "^1.0.20", + "react-window": "^1.8.9", + "sortablejs": "^1.15.0" + }, + "engines": { + "node": ">=22.12.0" + }, + "peerDependencies": { + "dayjs": "^1.11.19", + "react": "^18.3.1 || ^19.0.0", + "react-dom": "^18.3.1 || ^19.0.0" + } + }, + "node_modules/@clickhouse/client": { + "version": "1.23.1", + "resolved": "https://registry.npmjs.org/@clickhouse/client/-/client-1.23.1.tgz", + "integrity": "sha512-vs3/Zc1dHvT171btW5nMoPsPCJ6QVJ5pp7obxzO5sjqwFx/jjz9wwCAqcFOdc2DhprugDBaVn+4dVY8hG3A9nw==", + "license": "Apache-2.0", + "engines": { + "node": ">=20" + } + }, + "node_modules/@clickhouse/client-web": { + "version": "1.23.1", + "resolved": "https://registry.npmjs.org/@clickhouse/client-web/-/client-web-1.23.1.tgz", + "integrity": "sha512-VpYPSnBD7PWmEucp8wfd24u9tkyLwFH2ATyMT9R6J8b4U9snbVX1QjanJt/92YtSjam1GblhM7t3oChmJF/m0Q==", + "license": "Apache-2.0" + }, + "node_modules/@cloudflare/kv-asset-handler": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.5.0.tgz", + "integrity": "sha512-jxQYkj8dSIzc0cD6cMMNdOc1UVjqSqu8BZdor5s8cGjW2I8BjODt/kWPVdY+u9zj3ms75Q5qaZgnxUad83+eAg==", + "dev": true, + "license": "MIT OR Apache-2.0", + "engines": { + "node": ">=22.0.0" + } + }, + "node_modules/@cloudflare/unenv-preset": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/@cloudflare/unenv-preset/-/unenv-preset-2.16.1.tgz", + "integrity": "sha512-ECxObrMfyTl5bhQf/lZCXwo5G6xX9IAUo+nDMKK4SZ8m4Jvvxp52vilxyySSWh2YTZz8+HQ07qGH/2rEom1vDw==", + "dev": true, + "license": "MIT OR Apache-2.0", + "peerDependencies": { + "unenv": "2.0.0-rc.24", + "workerd": ">1.20260305.0 <2.0.0-0" + }, + "peerDependenciesMeta": { + "workerd": { + "optional": true + } + } + }, + "node_modules/@cloudflare/vite-plugin": { + "version": "1.54.8", + "resolved": "https://registry.npmjs.org/@cloudflare/vite-plugin/-/vite-plugin-1.54.8.tgz", + "integrity": "sha512-FuwhWzDg48bIKEj1fcNyS3K2aZeNhlVSPZueDVGrp2fOf+8c8rqaCj66+KUKHuMCqHMfwo2LRbJyGOz+NrKuYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cloudflare/unenv-preset": "2.16.1", + "miniflare": "5.20260911.0-alpha", + "unenv": "2.0.0-rc.24", + "workerd": "1.20260911.1", + "wrangler": "4.131.1", + "ws": "8.21.0" + }, + "bin": { + "cf-vite": "bin/cf-vite" + }, + "peerDependencies": { + "vite": "^6.1.0 || ^7.0.0 || ^8.0.0", + "wrangler": "^4.131.1" + } + }, + "node_modules/@cloudflare/workerd-darwin-64": { + "version": "1.20260911.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20260911.1.tgz", + "integrity": "sha512-785eaY1bkR1cm4Z/PCUeteZYmTMe6lre2zz63/GdGGimsoMsKxgl4brFPRukim8iv28EyD1XoCB/VPYF20BERA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-darwin-arm64": { + "version": "1.20260911.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20260911.1.tgz", + "integrity": "sha512-WU4bFqEN0H7ndGWxoedegv95DmNVBtv0ncXcHG9nYFTUI78sxEb0qoT3U6Ga4hyBkzsJFBX/zvVBIGX3qKldGA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-linux-64": { + "version": "1.20260911.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20260911.1.tgz", + "integrity": "sha512-0Y2gy62oxQxWa38qinSPE6zNL5+JmumJtDY9AWW1HB8KHuATxN71o5MGzmVFfB8PwZsiHfUd2Sv7O22krCOrhw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-linux-arm64": { + "version": "1.20260911.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20260911.1.tgz", + "integrity": "sha512-kttNPnx1r2lCqFUoMH62z7CqGV+j4QBbw5fdtaz4pzOrzBv0AWkNATt7onFUe+SwP8zhcepMtbm2F4kKzTf6VA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-windows-64": { + "version": "1.20260911.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20260911.1.tgz", + "integrity": "sha512-5iO/YfoBDOgO3CrHdkiiVP8SL3O2jC+c6Ux3d378TSPKLhU5+CgHjtE/ZSodWQrzr4FzFRqdW8S7n5nbyD1MHQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz", + "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@floating-ui/core": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.8.0.tgz", + "integrity": "sha512-0CIZ5itps/8x7BG8dEIhs53BvCUH2PCoogtakwRTut+Arm58sJooJ0AuZhLw2HJYIR5cMLNPBSS728sPho2khQ==", + "license": "MIT", + "dependencies": { + "@floating-ui/utils": "^0.2.12" + } + }, + "node_modules/@floating-ui/dom": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.8.0.tgz", + "integrity": "sha512-yXSrzeHZBTZadLOlfyhCkJHNeLJnHRnRInwdZ40L7ZiaAtrBwoYlsDrX3v5zB1Utk7CLfzcOVnVVWoXEky7Ceg==", + "license": "MIT", + "dependencies": { + "@floating-ui/core": "^1.8.0", + "@floating-ui/utils": "^0.2.12" + } + }, + "node_modules/@floating-ui/react-dom": { + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.9.tgz", + "integrity": "sha512-JDjEFGCpImxDCA7JJKviA0M9+RtmJdj0m/NVU5IMgBK+AmZouAQQ7/+2GLH0GXXY0YMw9oXPB8hKdbPYg5QLYg==", + "license": "MIT", + "dependencies": { + "@floating-ui/dom": "^1.8.0" + }, + "peerDependencies": { + "react": ">=16.8.0", + "react-dom": ">=16.8.0" + } + }, + "node_modules/@floating-ui/utils": { + "version": "0.2.12", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.12.tgz", + "integrity": "sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww==", + "license": "MIT" + }, + "node_modules/@h6s/calendar": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@h6s/calendar/-/calendar-2.2.0.tgz", + "integrity": "sha512-o1fb4RlMWDRIOiMEX65vN5qDTiD/OyC++EkJzmoz9l1vUOkN89gTE+wNE83XZBi3hbYqMV3CNhgKf51n/0hcBw==", + "peerDependencies": { + "react": ">= 18" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + }, + "react-native": { + "optional": true + } + } + }, + "node_modules/@img/colour": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz", + "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.4.tgz", + "integrity": "sha512-Uhfl4V4lhP2nbUVF9+hyH1+luj86f1gUFeo8ALYxFoULoU+G87D43BfeMP8XHsk9boxAnCY/bf2EHwhA7MuGsA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.3.3" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.4.tgz", + "integrity": "sha512-hWniXY3bG5qKpkKrAwPe4y+VTPmf086YQAnkxWh7uA1YrlRouWGa0M0Mxj3ZjnXFkv7/TD1bTy9lGUK26vRvWw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.3.3" + } + }, + "node_modules/@img/sharp-freebsd-wasm32": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.4.tgz", + "integrity": "sha512-lIsKw/BU+kjB4eZjxrYrZmwOJYi3Ajrv66iAlBmUPyKc3HpnloevB1g3wxGD9P/5BbQ1brBGl65VRRrCvQDEqA==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "dependencies": { + "@img/sharp-wasm32": "0.35.4" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.3.tgz", + "integrity": "sha512-suTBPTDGrI9WodccaDdwZItTSaBYASlBk1NSfElSHrUfzu3szG6lvIF58+WiFvnfzuK8ZBFS5zE00PxqxnRiPg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.3.tgz", + "integrity": "sha512-FVJZ5mITMobmXIz/hPDTw0EintTW5H3WfrxwLqEqjiIihlu+hVRyGrFQ60xl0Lxn7Bt3zdpevPaQi0HEzqz9fw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.3.tgz", + "integrity": "sha512-3rbU4vqXXc3hY/OiXdl52xZvT0F1yEngWfvqudtPJg/KkyiaQw2DRsFrNzpmLvfavbwOq3qXn36GP8obHRULQA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.3.tgz", + "integrity": "sha512-0DaL0A6Xu6sQSQFwe4iVCrKWU2cCTItnRsYsCdxAMm9NF6twAA9BKnoqy4hqz4+azQ0JHuA26qiUKsf1XJ/v5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-ppc64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.3.tgz", + "integrity": "sha512-cdn1OvUBwsXhbC0zSzJnNzf5MZ/mTrobawDvNXBTxe8VtqKAm0sRuEY2Evzovb/w9JMk4TvRxqt1mekSuJz64w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-riscv64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.3.tgz", + "integrity": "sha512-HjPVx7yKz+0lqdhDlTw1tt90wamBoxhiXpvl1XZpJLiHH4RCJ5yDTqH+VlYPv2fwFs89JFw4c1IexYOcQUi4IQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.3.tgz", + "integrity": "sha512-neWLh+3yCNThxnfy3c4BbVBeGgt9aftno+XbT56iK28RgeDs3UOFWviLWlUu0bArYVYJaFDK+RRohbicUNCm8Q==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.3.tgz", + "integrity": "sha512-4vKmvAst9nrowcqquKFAyZJUDolUaIp8uRiN0mWFguJ1IplC9/pitXtlnnlU4aa/eJw3J7i67V+pwUL+wZGdsA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.3.tgz", + "integrity": "sha512-Y9kQaLMuNoB0bPYOOdcZMaseNrFpPodIWWMrx+CZyydf2xn68j9WYc6sWWRrDwNkzCQjKYfc68L7jKjGlHMibw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.3.tgz", + "integrity": "sha512-fj8Mv0HHfD1Rr+4I68+3agJynxDWtBFgicTbSOb9Bke6pIwzGcJ+RX/yHjmiEGFMCavY/dxvem7MyNaJF+wDiw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.4.tgz", + "integrity": "sha512-7OAS8gI0EReKGVN2HssHlM6umJgxF5VI3xN0p9FA91p/YO+ou5hiNghLdZ5BEHztwaaK5+bLKRf8x/o2L2nk9A==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.3.3" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.4.tgz", + "integrity": "sha512-De4jpEnAU8Hd5oT0j1G3uL4ZvTuipVMn7YC6vPaJhy6/7EwEae0SVAoBrUMYQbkLGDm85taVWwuPc1a44LTzCQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.3.3" + } + }, + "node_modules/@img/sharp-linux-ppc64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.4.tgz", + "integrity": "sha512-2oYZJeIl4kCcMGk4ouZVjnkCtFrpQFlNEtJ6GbxzhHQchwH0NH/qEb9ykmOl29dqwMq+JhFdZn+1ak2FKhI9fQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-ppc64": "1.3.3" + } + }, + "node_modules/@img/sharp-linux-riscv64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.4.tgz", + "integrity": "sha512-cPbNChoRURAWdebDIHSenxRpgEdy7JkPydSnUxRm9VvKD7m0/xVaR/8Fzlu81pk5nHEvHH87UZUA7cTtwnbJSA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-riscv64": "1.3.3" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.4.tgz", + "integrity": "sha512-RY0JFY8Fd6RonCBtHz+DvadaPkXDSI1AUn6yWL9TipqkZ1vY8w8evqdgyDFnkm4/K1ve1TvZiaePP5oSd4+WVQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.3.3" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.4.tgz", + "integrity": "sha512-9qvvEAuk8k89TfWUoX2htWjbAMX8p+NxCppjpcg5k6xMsjhBQPTsoIh36h9Qde4WRuGpJeYnOjdosDn/cnv+OA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.3.3" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.4.tgz", + "integrity": "sha512-KB5jxpfWQTr0nc3xdHtWChdbifHrBGsd2SM62Eyxrl8afikm+f5qGBU75SJIZBT/S1MC8XyacdlXBMSWq6OURA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.3.3" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.4.tgz", + "integrity": "sha512-f+eZJZIQNEEd26RPSW+76chwOf1XtA2Y/O+5ocVyLliHkeih3e+jhLVBdNTd2rS3IbNXK8+ug93Vf5ZXtF5Lxg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.3.3" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.4.tgz", + "integrity": "sha512-zQnl4Kwp7Q6NHsENtU2T/00Zi+w3AQNwz3+UaTyVBy2FpXrzXzGjndpK61onhZjRtRpQXxCTeqw19bVyXOh7jA==", + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.11.3" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-webcontainers-wasm32": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.4.tgz", + "integrity": "sha512-ESfNkywmCfPNyaZjxooddJQiQ+l/nTpGEOGthxiLnIHXC/CmcBixnfwUleX9mCz9ovrUUvKMap/pm8RYbzfwaA==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@img/sharp-wasm32": "0.35.4" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-arm64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.4.tgz", + "integrity": "sha512-iNdlBX9gLVvqe2I3uIJSIKTq6wckP/DYxZtcqxm09x5Gi24DnFBmPAWZmr60ZyYMG0xlzo6goG3670ar+RXvRw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.4.tgz", + "integrity": "sha512-kqRsbaa5CS6KHlpxnN7WhE6vAAugXyZButpRdvDWetlv6Qv4N9WTcrWzF7tXfB9T7MsoadqdI8hmwLq6UlLvtw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.4.tgz", + "integrity": "sha512-XtmnYhBcrORsJ4XJngyzr/EWP0hRZLAZRFaApdKuviyqF78+ylxh2y06ZmtULAMOnObJ3ucpN0AcwSWnMowTRg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@oozcitak/dom": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@oozcitak/dom/-/dom-2.0.2.tgz", + "integrity": "sha512-GjpKhkSYC3Mj4+lfwEyI1dqnsKTgwGy48ytZEhm4A/xnH/8z9M3ZVXKr/YGQi3uCLs1AEBS+x5T2JPiueEDW8w==", + "license": "MIT", + "dependencies": { + "@oozcitak/infra": "^2.0.2", + "@oozcitak/url": "^3.0.0", + "@oozcitak/util": "^10.0.0" + }, + "engines": { + "node": ">=20.0" + } + }, + "node_modules/@oozcitak/infra": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@oozcitak/infra/-/infra-2.0.2.tgz", + "integrity": "sha512-2g+E7hoE2dgCz/APPOEK5s3rMhJvNxSMBrP+U+j1OWsIbtSpWxxlUjq1lU8RIsFJNYv7NMlnVsCuHcUzJW+8vA==", + "license": "MIT", + "dependencies": { + "@oozcitak/util": "^10.0.0" + }, + "engines": { + "node": ">=20.0" + } + }, + "node_modules/@oozcitak/url": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@oozcitak/url/-/url-3.0.0.tgz", + "integrity": "sha512-ZKfET8Ak1wsLAiLWNfFkZc/BraDccuTJKR6svTYc7sVjbR+Iu0vtXdiDMY4o6jaFl5TW2TlS7jbLl4VovtAJWQ==", + "license": "MIT", + "dependencies": { + "@oozcitak/infra": "^2.0.2", + "@oozcitak/util": "^10.0.0" + }, + "engines": { + "node": ">=20.0" + } + }, + "node_modules/@oozcitak/util": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@oozcitak/util/-/util-10.0.0.tgz", + "integrity": "sha512-hAX0pT/73190NLqBPPWSdBVGtbY6VOhWYK3qqHqtXQ1gK7kS2yz4+ivsN07hpJ6I3aeMtKP6J6npsEKOAzuTLA==", + "license": "MIT", + "engines": { + "node": ">=20.0" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.148.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.148.0.tgz", + "integrity": "sha512-Nm4s/jB+4FpFsPhWGEC4h7rzksesmtnMXomo6rCMcg/b8zLQuOziRgkCS1fxDCXOlJB/6Q8oABOZ/OP6RIPj9A==", + "devOptional": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, + "node_modules/@playwright/test": { + "version": "1.63.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.63.0.tgz", + "integrity": "sha512-oxMK4vllB9RK5NQ2l1pq1IfOf2AvnEuj/vYGDj0H2nMtmtZpKtCwt/l00GEO6xjGfpBNAvjovvYdCm50dRQkpQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright": "1.63.0" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@poppinss/colors": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@poppinss/colors/-/colors-4.1.6.tgz", + "integrity": "sha512-H9xkIdFswbS8n1d6vmRd8+c10t2Qe+rZITbbDHHkQixH5+2x1FDGmi/0K+WgWiqQFKPSlIYB7jlH6Kpfn6Fleg==", + "dev": true, + "license": "MIT", + "dependencies": { + "kleur": "^4.1.5" + } + }, + "node_modules/@poppinss/dumper": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/@poppinss/dumper/-/dumper-0.6.5.tgz", + "integrity": "sha512-NBdYIb90J7LfOI32dOewKI1r7wnkiH6m920puQ3qHUeZkxNkQiFnXVWoE6YtFSv6QOiPPf7ys6i+HWWecDz7sw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@poppinss/colors": "^4.1.5", + "@sindresorhus/is": "^7.0.2", + "supports-color": "^10.0.0" + } + }, + "node_modules/@poppinss/exception": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@poppinss/exception/-/exception-1.2.3.tgz", + "integrity": "sha512-dCED+QRChTVatE9ibtoaxc+WkdzOSjYTKi/+uacHWIsfodVfpsueo3+DKpgU5Px8qXjgmXkSvhXvSCz3fnP9lw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@radix-ui/primitive": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.3.tgz", + "integrity": "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg==", + "license": "MIT" + }, + "node_modules/@radix-ui/react-accordion": { + "version": "1.2.12", + "resolved": "https://registry.npmjs.org/@radix-ui/react-accordion/-/react-accordion-1.2.12.tgz", + "integrity": "sha512-T4nygeh9YE9dLRPhAHSeOZi7HBXo+0kYIPJXayZfvWOWA0+n3dESrZbjfDPUABkUNym6Hd+f2IR113To8D2GPA==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.3", + "@radix-ui/react-collapsible": "1.1.12", + "@radix-ui/react-collection": "1.1.7", + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-direction": "1.1.1", + "@radix-ui/react-id": "1.1.1", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-use-controllable-state": "1.2.2" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-arrow": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.1.tgz", + "integrity": "sha512-NaVpZfmv8SKeZbn4ijN2V3jlHA9ngBG16VnIIm22nUR0Yk8KUALyBxT3KYEUnNuch9sTE8UTsS3whzBgKOL30w==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-arrow/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.1.tgz", + "integrity": "sha512-Y9VzoRDSJtgFMUCoiZBDVo084VQ5hfpXxVE+NgkdNsjiDBByiImMZKKhxMwCbdHvhlENG6a833CbFkOQvTricw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-arrow/node_modules/@radix-ui/react-primitive": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.1.tgz", + "integrity": "sha512-sHCWTtxwNn3L3fH8qAfnF3WbUZycW93SM1j3NFDzXBiz8D6F5UTTy8G1+WFEaiCdvCVRJWj6N2R4Xq6HdiHmDg==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-arrow/node_modules/@radix-ui/react-slot": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.1.tgz", + "integrity": "sha512-RApLLOcINYJA+dMVbOju7MYv1Mb2EBp2nH4HdDzXTSyaR5optlm6Otrz1euW3HbdOR8UmmFK06TD+A9frYWv+g==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-avatar": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-avatar/-/react-avatar-1.1.1.tgz", + "integrity": "sha512-eoOtThOmxeoizxpX6RiEsQZ2wj5r4+zoeqAwO0cBaFQGjJwIH3dIX0OCxNrCyrrdxG+vBweMETh3VziQG7c1kw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-context": "1.1.1", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-callback-ref": "1.1.0", + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-context": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.1.tgz", + "integrity": "sha512-UASk9zi+crv9WteK/NU4PLvOoL3OuE6BWVKNF6hPRBtYBDXQ2u5iu3O59zUlJiTVvkyuycnqrztsHVJwcK9K+Q==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz", + "integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-avatar/node_modules/@radix-ui/react-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz", + "integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-checkbox": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-checkbox/-/react-checkbox-1.1.2.tgz", + "integrity": "sha512-/i0fl686zaJbDQLNKrkCbMyDm6FQMt4jg323k7HuqitoANm9sE23Ql8yOK3Wusk34HSLKDChhMux05FnP6KUkw==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.1", + "@radix-ui/react-presence": "1.1.1", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-controllable-state": "1.1.0", + "@radix-ui/react-use-previous": "1.1.0", + "@radix-ui/react-use-size": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-checkbox/node_modules/@radix-ui/primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.0.tgz", + "integrity": "sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA==", + "license": "MIT" + }, + "node_modules/@radix-ui/react-checkbox/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-checkbox/node_modules/@radix-ui/react-context": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.1.tgz", + "integrity": "sha512-UASk9zi+crv9WteK/NU4PLvOoL3OuE6BWVKNF6hPRBtYBDXQ2u5iu3O59zUlJiTVvkyuycnqrztsHVJwcK9K+Q==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-checkbox/node_modules/@radix-ui/react-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz", + "integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-checkbox/node_modules/@radix-ui/react-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz", + "integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-checkbox/node_modules/@radix-ui/react-use-controllable-state": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.1.0.tgz", + "integrity": "sha512-MtfMVJiSr2NjzS0Aa90NPTnvTSg6C/JLCV7ma0W6+OMV78vd8OyRpID+Ng9LxzsPbLeuBnWBA1Nq30AtBIDChw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-callback-ref": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-collapsible": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/@radix-ui/react-collapsible/-/react-collapsible-1.1.12.tgz", + "integrity": "sha512-Uu+mSh4agx2ib1uIGPP4/CKNULyajb3p92LsVXmH2EHVMTfZWpll88XJ0j4W0z3f8NK1eYl1+Mf/szHPmcHzyA==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.3", + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-id": "1.1.1", + "@radix-ui/react-presence": "1.1.5", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-use-controllable-state": "1.2.2", + "@radix-ui/react-use-layout-effect": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-collapsible/node_modules/@radix-ui/react-presence": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@radix-ui/react-presence/-/react-presence-1.1.5.tgz", + "integrity": "sha512-/jfEwNDdQVBCNvjkGit4h6pMOzq8bHkopq458dPt2lMjx+eBQUohZNG9A7DtO/O5ukSbxuaNGXMjHicgwy6rQQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-use-layout-effect": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-collapsible/node_modules/@radix-ui/react-use-layout-effect": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.1.tgz", + "integrity": "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-collection": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.1.7.tgz", + "integrity": "sha512-Fh9rGN0MoI4ZFUNyfFVNU4y9LUz93u9/0K+yLgA2bwRojxM8JU1DyvvMBabnZPBgMWREAJvU2jjVzq+LrFUglw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-slot": "1.2.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.2.tgz", + "integrity": "sha512-z4eqJvfiNnFMHIIvXP3CY57y2WJs5g2v3X0zm9mEJkrkNv4rDxu+sg9Jh8EkXyeqBkB7SOcboo9dMVqhyrACIg==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-context": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.2.tgz", + "integrity": "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-context-menu": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context-menu/-/react-context-menu-2.2.2.tgz", + "integrity": "sha512-99EatSTpW+hRYHt7m8wdDlLtkmTovEe8Z/hnxUPV+SKuuNL5HWNhQI4QSdjZqNSgXHay2z4M3Dym73j9p2Gx5Q==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-context": "1.1.1", + "@radix-ui/react-menu": "2.1.2", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-callback-ref": "1.1.0", + "@radix-ui/react-use-controllable-state": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.0.tgz", + "integrity": "sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA==", + "license": "MIT" + }, + "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-context": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.1.tgz", + "integrity": "sha512-UASk9zi+crv9WteK/NU4PLvOoL3OuE6BWVKNF6hPRBtYBDXQ2u5iu3O59zUlJiTVvkyuycnqrztsHVJwcK9K+Q==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz", + "integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz", + "integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-use-controllable-state": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.1.0.tgz", + "integrity": "sha512-MtfMVJiSr2NjzS0Aa90NPTnvTSg6C/JLCV7ma0W6+OMV78vd8OyRpID+Ng9LxzsPbLeuBnWBA1Nq30AtBIDChw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-callback-ref": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dialog": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-dialog/-/react-dialog-1.1.2.tgz", + "integrity": "sha512-Yj4dZtqa2o+kG61fzB0H2qUvmwBA2oyQroGLyNtBj1beo1khoQ3q1a2AO8rrQYjd8256CO9+N8L9tvsS+bnIyA==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.1", + "@radix-ui/react-dismissable-layer": "1.1.1", + "@radix-ui/react-focus-guards": "1.1.1", + "@radix-ui/react-focus-scope": "1.1.0", + "@radix-ui/react-id": "1.1.0", + "@radix-ui/react-portal": "1.1.2", + "@radix-ui/react-presence": "1.1.1", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-slot": "1.1.0", + "@radix-ui/react-use-controllable-state": "1.1.0", + "aria-hidden": "^1.1.1", + "react-remove-scroll": "2.6.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.0.tgz", + "integrity": "sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA==", + "license": "MIT" + }, + "node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.1.tgz", + "integrity": "sha512-UASk9zi+crv9WteK/NU4PLvOoL3OuE6BWVKNF6hPRBtYBDXQ2u5iu3O59zUlJiTVvkyuycnqrztsHVJwcK9K+Q==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.0.tgz", + "integrity": "sha512-EJUrI8yYh7WOjNOqpoJaf1jlFIH2LvtgAl+YcFqNCa+4hj64ZXmPkAKOFs/ukjz3byN6bdb/AVUqHkI8/uWWMA==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz", + "integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz", + "integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.1.0.tgz", + "integrity": "sha512-MtfMVJiSr2NjzS0Aa90NPTnvTSg6C/JLCV7ma0W6+OMV78vd8OyRpID+Ng9LxzsPbLeuBnWBA1Nq30AtBIDChw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-callback-ref": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.6.0.tgz", + "integrity": "sha512-I2U4JVEsQenxDAKaVa3VZ/JeJZe0/2DxPWL8Tj8yLKctQJQiZM52pn/GWFpSp8dftjM3pSAHVJZscAnC/y+ySQ==", + "license": "MIT", + "dependencies": { + "react-remove-scroll-bar": "^2.3.6", + "react-style-singleton": "^2.2.1", + "tslib": "^2.1.0", + "use-callback-ref": "^1.3.0", + "use-sidecar": "^1.1.2" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-direction": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.1.1.tgz", + "integrity": "sha512-1UEWRX6jnOA2y4H5WczZ44gOOjTEmlqv1uNW4GAJEO5+bauCBhv8snY65Iw5/VOS/ghKN9gr2KjnLKxrsvoMVw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dismissable-layer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.1.tgz", + "integrity": "sha512-QSxg29lfr/xcev6kSz7MAlmDnzbP1eI/Dwn3Tp1ip0KT5CUELsxkekFEMVBEoykI3oV39hKT4TKZzBNMbcTZYQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-callback-ref": "1.1.0", + "@radix-ui/react-use-escape-keydown": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.0.tgz", + "integrity": "sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA==", + "license": "MIT" + }, + "node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz", + "integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz", + "integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dropdown-menu": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-dropdown-menu/-/react-dropdown-menu-2.1.2.tgz", + "integrity": "sha512-GVZMR+eqK8/Kes0a36Qrv+i20bAPXSn8rCBTHx30w+3ECnR5o3xixAlqcVaYvLeyKUsm0aqyhWfmUcqufM8nYA==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.1", + "@radix-ui/react-id": "1.1.0", + "@radix-ui/react-menu": "2.1.2", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-controllable-state": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.0.tgz", + "integrity": "sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA==", + "license": "MIT" + }, + "node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-context": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.1.tgz", + "integrity": "sha512-UASk9zi+crv9WteK/NU4PLvOoL3OuE6BWVKNF6hPRBtYBDXQ2u5iu3O59zUlJiTVvkyuycnqrztsHVJwcK9K+Q==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-id": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.0.tgz", + "integrity": "sha512-EJUrI8yYh7WOjNOqpoJaf1jlFIH2LvtgAl+YcFqNCa+4hj64ZXmPkAKOFs/ukjz3byN6bdb/AVUqHkI8/uWWMA==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz", + "integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz", + "integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-use-controllable-state": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.1.0.tgz", + "integrity": "sha512-MtfMVJiSr2NjzS0Aa90NPTnvTSg6C/JLCV7ma0W6+OMV78vd8OyRpID+Ng9LxzsPbLeuBnWBA1Nq30AtBIDChw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-callback-ref": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-focus-guards": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-focus-guards/-/react-focus-guards-1.1.1.tgz", + "integrity": "sha512-pSIwfrT1a6sIoDASCSpFwOasEwKTZWDw/iBdtnqKO7v6FeOzYJ7U53cPzYFVR3geGGXgVHaH+CdngrrAzqUGxg==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-focus-scope": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.1.0.tgz", + "integrity": "sha512-200UD8zylvEyL8Bx+z76RJnASR2gRMuxlgFCPAe/Q/679a/r0eK3MBVYMb7vZODZcffZBdob1EGnky78xmVvcA==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-callback-ref": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz", + "integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz", + "integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-hover-card": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-hover-card/-/react-hover-card-1.1.2.tgz", + "integrity": "sha512-Y5w0qGhysvmqsIy6nQxaPa6mXNKznfoGjOfBgzOjocLxr2XlSjqBMYQQL+FfyogsMuX+m8cZyQGYhJxvxUzO4w==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.1", + "@radix-ui/react-dismissable-layer": "1.1.1", + "@radix-ui/react-popper": "1.2.0", + "@radix-ui/react-portal": "1.1.2", + "@radix-ui/react-presence": "1.1.1", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-controllable-state": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-hover-card/node_modules/@radix-ui/primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.0.tgz", + "integrity": "sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA==", + "license": "MIT" + }, + "node_modules/@radix-ui/react-hover-card/node_modules/@radix-ui/react-arrow": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.0.tgz", + "integrity": "sha512-FmlW1rCg7hBpEBwFbjHwCW6AmWLQM6g/v0Sn8XbP9NvmSZ2San1FpQeyPtufzOMSIx7Y4dzjlHoifhp+7NkZhw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.0.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-hover-card/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-hover-card/node_modules/@radix-ui/react-context": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.1.tgz", + "integrity": "sha512-UASk9zi+crv9WteK/NU4PLvOoL3OuE6BWVKNF6hPRBtYBDXQ2u5iu3O59zUlJiTVvkyuycnqrztsHVJwcK9K+Q==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-hover-card/node_modules/@radix-ui/react-popper": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.2.0.tgz", + "integrity": "sha512-ZnRMshKF43aBxVWPWvbj21+7TQCvhuULWJ4gNIKYpRlQt5xGRhLx66tMp8pya2UkGHTSlhpXwmjqltDYHhw7Vg==", + "license": "MIT", + "dependencies": { + "@floating-ui/react-dom": "^2.0.0", + "@radix-ui/react-arrow": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-callback-ref": "1.1.0", + "@radix-ui/react-use-layout-effect": "1.1.0", + "@radix-ui/react-use-rect": "1.1.0", + "@radix-ui/react-use-size": "1.1.0", + "@radix-ui/rect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-hover-card/node_modules/@radix-ui/react-popper/node_modules/@radix-ui/react-context": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.0.tgz", + "integrity": "sha512-OKrckBy+sMEgYM/sMmqmErVn0kZqrHPJze+Ql3DzYsDDp0hl0L62nx/2122/Bvps1qz645jlcu2tD9lrRSdf8A==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-hover-card/node_modules/@radix-ui/react-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz", + "integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-hover-card/node_modules/@radix-ui/react-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz", + "integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-hover-card/node_modules/@radix-ui/react-use-controllable-state": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.1.0.tgz", + "integrity": "sha512-MtfMVJiSr2NjzS0Aa90NPTnvTSg6C/JLCV7ma0W6+OMV78vd8OyRpID+Ng9LxzsPbLeuBnWBA1Nq30AtBIDChw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-callback-ref": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-id": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.1.tgz", + "integrity": "sha512-kGkGegYIdQsOb4XjsfM97rXsiHaBwco+hFI66oO4s9LU+PLAC5oJ7khdOVFxkhsmlbpUqDAvXw11CluXP+jkHg==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-id/node_modules/@radix-ui/react-use-layout-effect": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.1.tgz", + "integrity": "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-menu": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-menu/-/react-menu-2.1.2.tgz", + "integrity": "sha512-lZ0R4qR2Al6fZ4yCCZzu/ReTFrylHFxIqy7OezIpWF4bL0o9biKo0pFIvkaew3TyZ9Fy5gYVrR5zCGZBVbO1zg==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-collection": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.1", + "@radix-ui/react-direction": "1.1.0", + "@radix-ui/react-dismissable-layer": "1.1.1", + "@radix-ui/react-focus-guards": "1.1.1", + "@radix-ui/react-focus-scope": "1.1.0", + "@radix-ui/react-id": "1.1.0", + "@radix-ui/react-popper": "1.2.0", + "@radix-ui/react-portal": "1.1.2", + "@radix-ui/react-presence": "1.1.1", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-roving-focus": "1.1.0", + "@radix-ui/react-slot": "1.1.0", + "@radix-ui/react-use-callback-ref": "1.1.0", + "aria-hidden": "^1.1.1", + "react-remove-scroll": "2.6.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-menu/node_modules/@radix-ui/primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.0.tgz", + "integrity": "sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA==", + "license": "MIT" + }, + "node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-arrow": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.0.tgz", + "integrity": "sha512-FmlW1rCg7hBpEBwFbjHwCW6AmWLQM6g/v0Sn8XbP9NvmSZ2San1FpQeyPtufzOMSIx7Y4dzjlHoifhp+7NkZhw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.0.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-collection": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.1.0.tgz", + "integrity": "sha512-GZsZslMJEyo1VKm5L1ZJY8tGDxZNPAoUeQUIbKeJfoi7Q4kmig5AsgLMYYuyYbfjd8fBmFORAIwYAkXMnXZgZw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-context": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.0.tgz", + "integrity": "sha512-OKrckBy+sMEgYM/sMmqmErVn0kZqrHPJze+Ql3DzYsDDp0hl0L62nx/2122/Bvps1qz645jlcu2tD9lrRSdf8A==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-context": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.1.tgz", + "integrity": "sha512-UASk9zi+crv9WteK/NU4PLvOoL3OuE6BWVKNF6hPRBtYBDXQ2u5iu3O59zUlJiTVvkyuycnqrztsHVJwcK9K+Q==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-direction": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.1.0.tgz", + "integrity": "sha512-BUuBvgThEiAXh2DWu93XsT+a3aWrGqolGlqqw5VU1kG7p/ZH2cuDlM1sRLNnY3QcBS69UIz2mcKhMxDsdewhjg==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-id": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.0.tgz", + "integrity": "sha512-EJUrI8yYh7WOjNOqpoJaf1jlFIH2LvtgAl+YcFqNCa+4hj64ZXmPkAKOFs/ukjz3byN6bdb/AVUqHkI8/uWWMA==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-popper": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.2.0.tgz", + "integrity": "sha512-ZnRMshKF43aBxVWPWvbj21+7TQCvhuULWJ4gNIKYpRlQt5xGRhLx66tMp8pya2UkGHTSlhpXwmjqltDYHhw7Vg==", + "license": "MIT", + "dependencies": { + "@floating-ui/react-dom": "^2.0.0", + "@radix-ui/react-arrow": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-callback-ref": "1.1.0", + "@radix-ui/react-use-layout-effect": "1.1.0", + "@radix-ui/react-use-rect": "1.1.0", + "@radix-ui/react-use-size": "1.1.0", + "@radix-ui/rect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-popper/node_modules/@radix-ui/react-context": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.0.tgz", + "integrity": "sha512-OKrckBy+sMEgYM/sMmqmErVn0kZqrHPJze+Ql3DzYsDDp0hl0L62nx/2122/Bvps1qz645jlcu2tD9lrRSdf8A==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz", + "integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz", + "integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-menu/node_modules/react-remove-scroll": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.6.0.tgz", + "integrity": "sha512-I2U4JVEsQenxDAKaVa3VZ/JeJZe0/2DxPWL8Tj8yLKctQJQiZM52pn/GWFpSp8dftjM3pSAHVJZscAnC/y+ySQ==", + "license": "MIT", + "dependencies": { + "react-remove-scroll-bar": "^2.3.6", + "react-style-singleton": "^2.2.1", + "tslib": "^2.1.0", + "use-callback-ref": "^1.3.0", + "use-sidecar": "^1.1.2" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popover": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-popover/-/react-popover-1.1.2.tgz", + "integrity": "sha512-u2HRUyWW+lOiA2g0Le0tMmT55FGOEWHwPFt1EPfbLly7uXQExFo5duNKqG2DzmFXIdqOeNd+TpE8baHWJCyP9w==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.1", + "@radix-ui/react-dismissable-layer": "1.1.1", + "@radix-ui/react-focus-guards": "1.1.1", + "@radix-ui/react-focus-scope": "1.1.0", + "@radix-ui/react-id": "1.1.0", + "@radix-ui/react-popper": "1.2.0", + "@radix-ui/react-portal": "1.1.2", + "@radix-ui/react-presence": "1.1.1", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-slot": "1.1.0", + "@radix-ui/react-use-controllable-state": "1.1.0", + "aria-hidden": "^1.1.1", + "react-remove-scroll": "2.6.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popover/node_modules/@radix-ui/primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.0.tgz", + "integrity": "sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA==", + "license": "MIT" + }, + "node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-arrow": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.0.tgz", + "integrity": "sha512-FmlW1rCg7hBpEBwFbjHwCW6AmWLQM6g/v0Sn8XbP9NvmSZ2San1FpQeyPtufzOMSIx7Y4dzjlHoifhp+7NkZhw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.0.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-context": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.1.tgz", + "integrity": "sha512-UASk9zi+crv9WteK/NU4PLvOoL3OuE6BWVKNF6hPRBtYBDXQ2u5iu3O59zUlJiTVvkyuycnqrztsHVJwcK9K+Q==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-id": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.0.tgz", + "integrity": "sha512-EJUrI8yYh7WOjNOqpoJaf1jlFIH2LvtgAl+YcFqNCa+4hj64ZXmPkAKOFs/ukjz3byN6bdb/AVUqHkI8/uWWMA==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-popper": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.2.0.tgz", + "integrity": "sha512-ZnRMshKF43aBxVWPWvbj21+7TQCvhuULWJ4gNIKYpRlQt5xGRhLx66tMp8pya2UkGHTSlhpXwmjqltDYHhw7Vg==", + "license": "MIT", + "dependencies": { + "@floating-ui/react-dom": "^2.0.0", + "@radix-ui/react-arrow": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-callback-ref": "1.1.0", + "@radix-ui/react-use-layout-effect": "1.1.0", + "@radix-ui/react-use-rect": "1.1.0", + "@radix-ui/react-use-size": "1.1.0", + "@radix-ui/rect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-popper/node_modules/@radix-ui/react-context": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.0.tgz", + "integrity": "sha512-OKrckBy+sMEgYM/sMmqmErVn0kZqrHPJze+Ql3DzYsDDp0hl0L62nx/2122/Bvps1qz645jlcu2tD9lrRSdf8A==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz", + "integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz", + "integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-use-controllable-state": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.1.0.tgz", + "integrity": "sha512-MtfMVJiSr2NjzS0Aa90NPTnvTSg6C/JLCV7ma0W6+OMV78vd8OyRpID+Ng9LxzsPbLeuBnWBA1Nq30AtBIDChw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-callback-ref": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popover/node_modules/react-remove-scroll": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.6.0.tgz", + "integrity": "sha512-I2U4JVEsQenxDAKaVa3VZ/JeJZe0/2DxPWL8Tj8yLKctQJQiZM52pn/GWFpSp8dftjM3pSAHVJZscAnC/y+ySQ==", + "license": "MIT", + "dependencies": { + "react-remove-scroll-bar": "^2.3.6", + "react-style-singleton": "^2.2.1", + "tslib": "^2.1.0", + "use-callback-ref": "^1.3.0", + "use-sidecar": "^1.1.2" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popper": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.2.1.tgz", + "integrity": "sha512-3kn5Me69L+jv82EKRuQCXdYyf1DqHwD2U/sxoNgBGCB7K9TRc3bQamQ+5EPM9EvyPdli0W41sROd+ZU1dTCztw==", + "license": "MIT", + "dependencies": { + "@floating-ui/react-dom": "^2.0.0", + "@radix-ui/react-arrow": "1.1.1", + "@radix-ui/react-compose-refs": "1.1.1", + "@radix-ui/react-context": "1.1.1", + "@radix-ui/react-primitive": "2.0.1", + "@radix-ui/react-use-callback-ref": "1.1.0", + "@radix-ui/react-use-layout-effect": "1.1.0", + "@radix-ui/react-use-rect": "1.1.0", + "@radix-ui/react-use-size": "1.1.0", + "@radix-ui/rect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popper/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.1.tgz", + "integrity": "sha512-Y9VzoRDSJtgFMUCoiZBDVo084VQ5hfpXxVE+NgkdNsjiDBByiImMZKKhxMwCbdHvhlENG6a833CbFkOQvTricw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popper/node_modules/@radix-ui/react-context": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.1.tgz", + "integrity": "sha512-UASk9zi+crv9WteK/NU4PLvOoL3OuE6BWVKNF6hPRBtYBDXQ2u5iu3O59zUlJiTVvkyuycnqrztsHVJwcK9K+Q==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popper/node_modules/@radix-ui/react-primitive": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.1.tgz", + "integrity": "sha512-sHCWTtxwNn3L3fH8qAfnF3WbUZycW93SM1j3NFDzXBiz8D6F5UTTy8G1+WFEaiCdvCVRJWj6N2R4Xq6HdiHmDg==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popper/node_modules/@radix-ui/react-slot": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.1.tgz", + "integrity": "sha512-RApLLOcINYJA+dMVbOju7MYv1Mb2EBp2nH4HdDzXTSyaR5optlm6Otrz1euW3HbdOR8UmmFK06TD+A9frYWv+g==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-portal": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.1.2.tgz", + "integrity": "sha512-WeDYLGPxJb/5EGBoedyJbT0MpoULmwnIPMJMSldkuiMsBAv7N1cRdsTWZWht9vpPOiN3qyiGAtbK2is47/uMFg==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-portal/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-portal/node_modules/@radix-ui/react-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz", + "integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-portal/node_modules/@radix-ui/react-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz", + "integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-presence": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-presence/-/react-presence-1.1.1.tgz", + "integrity": "sha512-IeFXVi4YS1K0wVZzXNrbaaUvIJ3qdY+/Ih4eHFhWA9SwGR9UDX7Ck8abvL57C4cv3wwMvUE0OG69Qc3NCcTe/A==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-presence/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-primitive": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz", + "integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.2.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-radio-group": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-radio-group/-/react-radio-group-1.2.1.tgz", + "integrity": "sha512-kdbv54g4vfRjja9DNWPMxKvXblzqbpEC8kspEkZ6dVP7kQksGCn+iZHkcCz2nb00+lPdRvxrqy4WrvvV1cNqrQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.1", + "@radix-ui/react-direction": "1.1.0", + "@radix-ui/react-presence": "1.1.1", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-roving-focus": "1.1.0", + "@radix-ui/react-use-controllable-state": "1.1.0", + "@radix-ui/react-use-previous": "1.1.0", + "@radix-ui/react-use-size": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.0.tgz", + "integrity": "sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA==", + "license": "MIT" + }, + "node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/react-context": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.1.tgz", + "integrity": "sha512-UASk9zi+crv9WteK/NU4PLvOoL3OuE6BWVKNF6hPRBtYBDXQ2u5iu3O59zUlJiTVvkyuycnqrztsHVJwcK9K+Q==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/react-direction": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.1.0.tgz", + "integrity": "sha512-BUuBvgThEiAXh2DWu93XsT+a3aWrGqolGlqqw5VU1kG7p/ZH2cuDlM1sRLNnY3QcBS69UIz2mcKhMxDsdewhjg==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/react-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz", + "integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/react-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz", + "integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-radio-group/node_modules/@radix-ui/react-use-controllable-state": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.1.0.tgz", + "integrity": "sha512-MtfMVJiSr2NjzS0Aa90NPTnvTSg6C/JLCV7ma0W6+OMV78vd8OyRpID+Ng9LxzsPbLeuBnWBA1Nq30AtBIDChw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-callback-ref": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-roving-focus": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-roving-focus/-/react-roving-focus-1.1.0.tgz", + "integrity": "sha512-EA6AMGeq9AEeQDeSH0aZgG198qkfHSbvWTf1HvoDmOB5bBG/qTxjYMWUKMnYiV6J/iP/J8MEFSuB2zRU2n7ODA==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-collection": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.0", + "@radix-ui/react-direction": "1.1.0", + "@radix-ui/react-id": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-callback-ref": "1.1.0", + "@radix-ui/react-use-controllable-state": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.0.tgz", + "integrity": "sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA==", + "license": "MIT" + }, + "node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-collection": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.1.0.tgz", + "integrity": "sha512-GZsZslMJEyo1VKm5L1ZJY8tGDxZNPAoUeQUIbKeJfoi7Q4kmig5AsgLMYYuyYbfjd8fBmFORAIwYAkXMnXZgZw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-context": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.0.tgz", + "integrity": "sha512-OKrckBy+sMEgYM/sMmqmErVn0kZqrHPJze+Ql3DzYsDDp0hl0L62nx/2122/Bvps1qz645jlcu2tD9lrRSdf8A==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-direction": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.1.0.tgz", + "integrity": "sha512-BUuBvgThEiAXh2DWu93XsT+a3aWrGqolGlqqw5VU1kG7p/ZH2cuDlM1sRLNnY3QcBS69UIz2mcKhMxDsdewhjg==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-id": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.0.tgz", + "integrity": "sha512-EJUrI8yYh7WOjNOqpoJaf1jlFIH2LvtgAl+YcFqNCa+4hj64ZXmPkAKOFs/ukjz3byN6bdb/AVUqHkI8/uWWMA==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz", + "integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz", + "integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-use-controllable-state": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.1.0.tgz", + "integrity": "sha512-MtfMVJiSr2NjzS0Aa90NPTnvTSg6C/JLCV7ma0W6+OMV78vd8OyRpID+Ng9LxzsPbLeuBnWBA1Nq30AtBIDChw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-callback-ref": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-separator": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-separator/-/react-separator-1.1.1.tgz", + "integrity": "sha512-RRiNRSrD8iUiXriq/Y5n4/3iE8HzqgLHsusUSg5jVpU2+3tqcUFPJXHDymwEypunc2sWxDUS3UC+rkZRlHedsw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-separator/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.1.tgz", + "integrity": "sha512-Y9VzoRDSJtgFMUCoiZBDVo084VQ5hfpXxVE+NgkdNsjiDBByiImMZKKhxMwCbdHvhlENG6a833CbFkOQvTricw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-separator/node_modules/@radix-ui/react-primitive": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.1.tgz", + "integrity": "sha512-sHCWTtxwNn3L3fH8qAfnF3WbUZycW93SM1j3NFDzXBiz8D6F5UTTy8G1+WFEaiCdvCVRJWj6N2R4Xq6HdiHmDg==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-separator/node_modules/@radix-ui/react-slot": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.1.tgz", + "integrity": "sha512-RApLLOcINYJA+dMVbOju7MYv1Mb2EBp2nH4HdDzXTSyaR5optlm6Otrz1euW3HbdOR8UmmFK06TD+A9frYWv+g==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-slot": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.3.tgz", + "integrity": "sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.2" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-switch": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-switch/-/react-switch-1.1.1.tgz", + "integrity": "sha512-diPqDDoBcZPSicYoMWdWx+bCPuTRH4QSp9J+65IvtdS0Kuzt67bI6n32vCj8q6NZmYW/ah+2orOtMwcX5eQwIg==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.1", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-controllable-state": "1.1.0", + "@radix-ui/react-use-previous": "1.1.0", + "@radix-ui/react-use-size": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-switch/node_modules/@radix-ui/primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.0.tgz", + "integrity": "sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA==", + "license": "MIT" + }, + "node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-context": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.1.tgz", + "integrity": "sha512-UASk9zi+crv9WteK/NU4PLvOoL3OuE6BWVKNF6hPRBtYBDXQ2u5iu3O59zUlJiTVvkyuycnqrztsHVJwcK9K+Q==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz", + "integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz", + "integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-use-controllable-state": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.1.0.tgz", + "integrity": "sha512-MtfMVJiSr2NjzS0Aa90NPTnvTSg6C/JLCV7ma0W6+OMV78vd8OyRpID+Ng9LxzsPbLeuBnWBA1Nq30AtBIDChw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-callback-ref": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tabs": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-tabs/-/react-tabs-1.1.1.tgz", + "integrity": "sha512-3GBUDmP2DvzmtYLMsHmpA1GtR46ZDZ+OreXM/N+kkQJOPIgytFWWTfDQmBQKBvaFS0Vno0FktdbVzN28KGrMdw==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-context": "1.1.1", + "@radix-ui/react-direction": "1.1.0", + "@radix-ui/react-id": "1.1.0", + "@radix-ui/react-presence": "1.1.1", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-roving-focus": "1.1.0", + "@radix-ui/react-use-controllable-state": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tabs/node_modules/@radix-ui/primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.0.tgz", + "integrity": "sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA==", + "license": "MIT" + }, + "node_modules/@radix-ui/react-tabs/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tabs/node_modules/@radix-ui/react-context": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.1.tgz", + "integrity": "sha512-UASk9zi+crv9WteK/NU4PLvOoL3OuE6BWVKNF6hPRBtYBDXQ2u5iu3O59zUlJiTVvkyuycnqrztsHVJwcK9K+Q==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tabs/node_modules/@radix-ui/react-direction": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.1.0.tgz", + "integrity": "sha512-BUuBvgThEiAXh2DWu93XsT+a3aWrGqolGlqqw5VU1kG7p/ZH2cuDlM1sRLNnY3QcBS69UIz2mcKhMxDsdewhjg==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tabs/node_modules/@radix-ui/react-id": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.0.tgz", + "integrity": "sha512-EJUrI8yYh7WOjNOqpoJaf1jlFIH2LvtgAl+YcFqNCa+4hj64ZXmPkAKOFs/ukjz3byN6bdb/AVUqHkI8/uWWMA==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tabs/node_modules/@radix-ui/react-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz", + "integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tabs/node_modules/@radix-ui/react-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz", + "integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tabs/node_modules/@radix-ui/react-use-controllable-state": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.1.0.tgz", + "integrity": "sha512-MtfMVJiSr2NjzS0Aa90NPTnvTSg6C/JLCV7ma0W6+OMV78vd8OyRpID+Ng9LxzsPbLeuBnWBA1Nq30AtBIDChw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-callback-ref": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-toast": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-toast/-/react-toast-1.2.2.tgz", + "integrity": "sha512-Z6pqSzmAP/bFJoqMAston4eSNa+ud44NSZTiZUmUen+IOZ5nBY8kzuU5WDBVyFXPtcW6yUalOHsxM/BP6Sv8ww==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-collection": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.1", + "@radix-ui/react-dismissable-layer": "1.1.1", + "@radix-ui/react-portal": "1.1.2", + "@radix-ui/react-presence": "1.1.1", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-callback-ref": "1.1.0", + "@radix-ui/react-use-controllable-state": "1.1.0", + "@radix-ui/react-use-layout-effect": "1.1.0", + "@radix-ui/react-visually-hidden": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-toast/node_modules/@radix-ui/primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.0.tgz", + "integrity": "sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA==", + "license": "MIT" + }, + "node_modules/@radix-ui/react-toast/node_modules/@radix-ui/react-collection": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.1.0.tgz", + "integrity": "sha512-GZsZslMJEyo1VKm5L1ZJY8tGDxZNPAoUeQUIbKeJfoi7Q4kmig5AsgLMYYuyYbfjd8fBmFORAIwYAkXMnXZgZw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-toast/node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-context": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.0.tgz", + "integrity": "sha512-OKrckBy+sMEgYM/sMmqmErVn0kZqrHPJze+Ql3DzYsDDp0hl0L62nx/2122/Bvps1qz645jlcu2tD9lrRSdf8A==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-toast/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-toast/node_modules/@radix-ui/react-context": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.1.tgz", + "integrity": "sha512-UASk9zi+crv9WteK/NU4PLvOoL3OuE6BWVKNF6hPRBtYBDXQ2u5iu3O59zUlJiTVvkyuycnqrztsHVJwcK9K+Q==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-toast/node_modules/@radix-ui/react-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz", + "integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-toast/node_modules/@radix-ui/react-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz", + "integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-toast/node_modules/@radix-ui/react-use-controllable-state": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.1.0.tgz", + "integrity": "sha512-MtfMVJiSr2NjzS0Aa90NPTnvTSg6C/JLCV7ma0W6+OMV78vd8OyRpID+Ng9LxzsPbLeuBnWBA1Nq30AtBIDChw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-callback-ref": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tooltip": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-tooltip/-/react-tooltip-1.1.2.tgz", + "integrity": "sha512-9XRsLwe6Yb9B/tlnYCPVUd/TFS4J7HuOZW345DCeC6vKIxQGMZdx21RK4VoZauPD5frgkXTYVS5y90L+3YBn4w==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.0", + "@radix-ui/react-dismissable-layer": "1.1.0", + "@radix-ui/react-id": "1.1.0", + "@radix-ui/react-popper": "1.2.0", + "@radix-ui/react-portal": "1.1.1", + "@radix-ui/react-presence": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-slot": "1.1.0", + "@radix-ui/react-use-controllable-state": "1.1.0", + "@radix-ui/react-visually-hidden": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.0.tgz", + "integrity": "sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA==", + "license": "MIT" + }, + "node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-arrow": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.0.tgz", + "integrity": "sha512-FmlW1rCg7hBpEBwFbjHwCW6AmWLQM6g/v0Sn8XbP9NvmSZ2San1FpQeyPtufzOMSIx7Y4dzjlHoifhp+7NkZhw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.0.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-context": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.0.tgz", + "integrity": "sha512-OKrckBy+sMEgYM/sMmqmErVn0kZqrHPJze+Ql3DzYsDDp0hl0L62nx/2122/Bvps1qz645jlcu2tD9lrRSdf8A==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-dismissable-layer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.0.tgz", + "integrity": "sha512-/UovfmmXGptwGcBQawLzvn2jOfM0t4z3/uKffoBlj724+n3FvBbZ7M0aaBOmkp6pqFYpO4yx8tSVJjx3Fl2jig==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-callback-ref": "1.1.0", + "@radix-ui/react-use-escape-keydown": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-id": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.0.tgz", + "integrity": "sha512-EJUrI8yYh7WOjNOqpoJaf1jlFIH2LvtgAl+YcFqNCa+4hj64ZXmPkAKOFs/ukjz3byN6bdb/AVUqHkI8/uWWMA==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-popper": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.2.0.tgz", + "integrity": "sha512-ZnRMshKF43aBxVWPWvbj21+7TQCvhuULWJ4gNIKYpRlQt5xGRhLx66tMp8pya2UkGHTSlhpXwmjqltDYHhw7Vg==", + "license": "MIT", + "dependencies": { + "@floating-ui/react-dom": "^2.0.0", + "@radix-ui/react-arrow": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-callback-ref": "1.1.0", + "@radix-ui/react-use-layout-effect": "1.1.0", + "@radix-ui/react-use-rect": "1.1.0", + "@radix-ui/react-use-size": "1.1.0", + "@radix-ui/rect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-portal": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.1.1.tgz", + "integrity": "sha512-A3UtLk85UtqhzFqtoC8Q0KvR2GbXF3mtPgACSazajqq6A41mEQgo53iPzY4i6BwDxlIFqWIhiQ2G729n+2aw/g==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-presence": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-presence/-/react-presence-1.1.0.tgz", + "integrity": "sha512-Gq6wuRN/asf9H/E/VzdKoUtT8GC9PQc9z40/vEr0VCJ4u5XvvhWIrSsCB6vD2/cH7ugTdSfYq9fLJCcM00acrQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz", + "integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz", + "integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-use-controllable-state": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.1.0.tgz", + "integrity": "sha512-MtfMVJiSr2NjzS0Aa90NPTnvTSg6C/JLCV7ma0W6+OMV78vd8OyRpID+Ng9LxzsPbLeuBnWBA1Nq30AtBIDChw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-callback-ref": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-callback-ref": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.1.0.tgz", + "integrity": "sha512-CasTfvsy+frcFkbXtSJ2Zu9JHpN8TYKxkgJGWbjiZhFivxaeW7rMeZt7QELGVLaYVfFMsKHjb7Ak0nMEe+2Vfw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-controllable-state": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.2.2.tgz", + "integrity": "sha512-BjasUjixPFdS+NKkypcyyN5Pmg83Olst0+c6vGov0diwTEo6mgdqVR6hxcEgFuh4QrAs7Rc+9KuGJ9TVCj0Zzg==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-effect-event": "0.0.2", + "@radix-ui/react-use-layout-effect": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-controllable-state/node_modules/@radix-ui/react-use-layout-effect": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.1.tgz", + "integrity": "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-effect-event": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-effect-event/-/react-use-effect-event-0.0.2.tgz", + "integrity": "sha512-Qp8WbZOBe+blgpuUT+lw2xheLP8q0oatc9UpmiemEICxGvFLYmHm9QowVZGHtJlGbS6A6yJ3iViad/2cVjnOiA==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-effect-event/node_modules/@radix-ui/react-use-layout-effect": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.1.tgz", + "integrity": "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-escape-keydown": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-escape-keydown/-/react-use-escape-keydown-1.1.0.tgz", + "integrity": "sha512-L7vwWlR1kTTQ3oh7g1O0CBF3YCyyTj8NmhLR+phShpyA50HCfBFKVJTpshm9PzLiKmehsrQzTYTpX9HvmC9rhw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-callback-ref": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-layout-effect": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.0.tgz", + "integrity": "sha512-+FPE0rOdziWSrH9athwI1R0HDVbWlEhd+FR+aSDk4uWGmSJ9Z54sdZVDQPZAinJhJXwfT+qnj969mCsT2gfm5w==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-previous": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-previous/-/react-use-previous-1.1.0.tgz", + "integrity": "sha512-Z/e78qg2YFnnXcW88A4JmTtm4ADckLno6F7OXotmkQfeuCVaKuYzqAATPhVzl3delXE7CxIV8shofPn3jPc5Og==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-rect": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-rect/-/react-use-rect-1.1.0.tgz", + "integrity": "sha512-0Fmkebhr6PiseyZlYAOtLS+nb7jLmpqTrJyv61Pe68MKYW6OWdRE2kI70TaYY27u7H0lajqM3hSMMLFq18Z7nQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/rect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-size": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-size/-/react-use-size-1.1.0.tgz", + "integrity": "sha512-XW3/vWuIXHa+2Uwcc2ABSfcCledmXhhQPlGbfcRXbiUQI5Icjcg19BGCZVKKInYbvUCut/ufbbLLPFC5cbb1hw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-visually-hidden": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-visually-hidden/-/react-visually-hidden-1.1.0.tgz", + "integrity": "sha512-N8MDZqtgCgG5S3aV60INAB475osJousYpZ4cTJ2cFbMpdHS5Y6loLTH8LPtkj2QN0x93J30HT/M3qJXM0+lyeQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.0.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz", + "integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz", + "integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz", + "integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/rect": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/rect/-/rect-1.1.0.tgz", + "integrity": "sha512-A9+lCBZoaMJlVKcRBz2YByCG+Cp2t6nAnMnNba+XiWxnj6r4JUFqfsgwocMBZU9LPtdxC6wB56ySYpc7LQIoJg==", + "license": "MIT" + }, + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.7.tgz", + "integrity": "sha512-EypzgnYCwyVY4NDHKzGmNJT5b+XaQEBniHxsMdeIQLB/tcCzZnhqrzHpZFbX9iaxx+5RiB8caATBtfvZP7zVxQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.7.tgz", + "integrity": "sha512-l17HE9EweWaqJZhuUuNBN/FzM62xw+DECVnJyvMsxn8vJFAGLy5QfLDoYAcronkAN8VxKZHezDpulHDPx95vFw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.7.tgz", + "integrity": "sha512-8ED8ELFvHXc6OCETIn4gXObPiaR6bckM/ipXtbzlPVDRMBfEGjCKgO90F9YtfdpDatVx/ZQw7aZ1vUMf/+T3Mw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.7.tgz", + "integrity": "sha512-/WPripjtiAIZ2tWY7ddijORT0Ujg87wxWW/qcoFVCKAWVDPhtY0xr7Dj0M3GyNGz60jGwTElhro/mkF9dT7dDQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.7.tgz", + "integrity": "sha512-14DI4NcqpvbICxSnGLx3PmtDaWqRP/KGSGb6C+JLLVPeZRl6dKdHba3pGsqT3vpdTqhEYIPG0MMQ8c0xYqoJxA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.7.tgz", + "integrity": "sha512-bxrWIRvHWQvbJwi+VIie/kDJmQxcNE6xxWwZdqF/ExVAigtHkv54WTLQPb+QsZdnFy18fg7JPfWGL0RH6vwIlQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.7.tgz", + "integrity": "sha512-toOY2BChBZyuxU7OYX6Tn389di4IzAqPTycVcci0O7FSfBqzRB3RZn+K5Is6ANf4tmgRd/K1yZTsNTXbkXsnLg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.7.tgz", + "integrity": "sha512-lAIXTH/aiLRLxsTgQvfhjo4K1ydWIp00+V0voOr9beb/9ZmkUFrSIb03dXNFRgMNvkE6oGsF10ioQ6UsI+vS5Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.7.tgz", + "integrity": "sha512-kdnwS28Pkenp/mZMRwjXXXwxQ7pIsm+bF919LUK93BOyhcLsrVKdP2p9fxpiPNPAbNuch8ypQt0pm2P2LYCAGg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.7.tgz", + "integrity": "sha512-516OdsyLdr5E65paF3yBF55t8mfm9+gmtCsK3xI7XKXIT7EfRlHhxL8K/NR6Hu8BWSgF5+1w74lTL0+nxcc8Qw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.7.tgz", + "integrity": "sha512-r8/z8n7GFaYRln3xmP1Cxy0HH/HLM0uBUPkEuSVEfKGDA89M0FsZRZJRSwe/tJjRx+fpH/gjorfhB8tmEbSFLA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.7.tgz", + "integrity": "sha512-pAsE8iiDxUg1xBqdhrTfg45AVDVpirjz00sblEYClGNNcMnDb+e8beQgqIAw6LvauX/APvgxUnwrgun/YYGBhw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.7.tgz", + "integrity": "sha512-lTcIYmmnQQA8Or/2DatS6oSqcdLHvendjS+zLu+FwgToynWMRSmQdpM65fTANJgIS4mjbMOo5KT2lnT9SAb96w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.7.tgz", + "integrity": "sha512-e3Gu3WxbNk/UqQhxqU7YIYO+9ZBvWNz3U+h/qRFosscMFzdRPbXYSaSWgSnklv2fz1TgzBTcti2z35c/7irsHw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.7.tgz", + "integrity": "sha512-W/jg5qoRSqjsEv0+dZi4e687mcHqmVuU0P4fK6qS/xjetW2Gmc1W8j//z5nAeNcC8Ttm0hV46IjcYeuVwYhuiw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/@sindresorhus/is": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-7.2.0.tgz", + "integrity": "sha512-P1Cz1dWaFfR4IR+U13mqqiGsLFf1KbayybWwdd2vfctdV6hDpUkgCY0nKOLLTMSoRd/jJNjtbqzf13K8DCCXQw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/@speed-highlight/core": { + "version": "1.2.24", + "resolved": "https://registry.npmjs.org/@speed-highlight/core/-/core-1.2.24.tgz", + "integrity": "sha512-qeW2e1l78afw8VhRPfPQ1Gjj+KU5XFQ/OFV5ti6eTa9bruO7mJyZtA4vw0ofqmA3tKCkROE9xLk3VZoeRc98nw==", + "dev": true, + "license": "CC0-1.0" + }, + "node_modules/@stablelib/base64": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stablelib/base64/-/base64-1.0.1.tgz", + "integrity": "sha512-1bnPQqSxSuc3Ii6MhBysoWCg58j97aUjuCSZrGSmDxNqtytIi0k8utUenAwTZN4V5mXXYGsVUI9zeBqy+jBOSQ==", + "license": "MIT" + }, + "node_modules/@tanstack/history": { + "version": "1.162.1", + "resolved": "https://registry.npmjs.org/@tanstack/history/-/history-1.162.1.tgz", + "integrity": "sha512-DR9t6lfLVdrjgCwpglrR9DR7Ok8/HlXjcOE+goWXF3zyuLUO/ug7vMbSFxTqrQTtbRghJfyhmIZ0S6LhPIy44w==", + "license": "MIT", + "engines": { + "node": ">=20.19" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/query-core": { + "version": "5.102.8", + "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.102.8.tgz", + "integrity": "sha512-ZNjkJ33CqvPNec/6lZBnHqLc3EVGPZ9ySLhYahU9TcuRFdmwXewuj0c4hwSWcGHqEUwcSrKeZ+oGcvPBqXcQcg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/react-router": { + "version": "1.170.32", + "resolved": "https://registry.npmjs.org/@tanstack/react-router/-/react-router-1.170.32.tgz", + "integrity": "sha512-SIpxvaTKco100a5ZR3ePmArbhtm3XOx+w1dpGYY9gxHDta4iXSKDdQuhLonwJbIMkVJsU1rwXf0UDHMrF/1snw==", + "license": "MIT", + "dependencies": { + "@tanstack/history": "1.162.1", + "@tanstack/react-store": "^0.9.3", + "@tanstack/router-core": "1.171.27", + "isbot": "^5.1.22" + }, + "engines": { + "node": ">=20.19" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": ">=18.0.0 || >=19.0.0", + "react-dom": ">=18.0.0 || >=19.0.0" + } + }, + "node_modules/@tanstack/react-start": { + "version": "1.168.49", + "resolved": "https://registry.npmjs.org/@tanstack/react-start/-/react-start-1.168.49.tgz", + "integrity": "sha512-iQb1ZoEHqvZMGLR4G7v3tTtgL06yv/bwxvGP3waVHxVn7bRpyopM44YbOluaGkcJzc13ZTvdLKWYNAN3bxMX/Q==", + "license": "MIT", + "dependencies": { + "@tanstack/react-router": "1.170.32", + "@tanstack/react-start-client": "1.168.30", + "@tanstack/react-start-rsc": "0.1.48", + "@tanstack/react-start-server": "1.167.37", + "@tanstack/router-utils": "1.162.2", + "@tanstack/start-client-core": "1.170.27", + "@tanstack/start-plugin-core": "1.171.39", + "@tanstack/start-server-core": "1.169.31", + "pathe": "^2.0.3" + }, + "engines": { + "node": ">=22.12.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "@rsbuild/core": "^2.0.0", + "react": ">=18.0.0 || >=19.0.0", + "react-dom": ">=18.0.0 || >=19.0.0", + "vite": ">=7.0.0" + }, + "peerDependenciesMeta": { + "@rsbuild/core": { + "optional": true + }, + "@vitejs/plugin-rsc": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@tanstack/react-start-client": { + "version": "1.168.30", + "resolved": "https://registry.npmjs.org/@tanstack/react-start-client/-/react-start-client-1.168.30.tgz", + "integrity": "sha512-qsZuykUl1EF0/rc1bin1RtjFzz07YMOTBzhOstSDzbOVm/WKf1QKFTN+qAZi74xlbXSWNuT2MiFRyg4RKwj8iw==", + "license": "MIT", + "dependencies": { + "@tanstack/react-router": "1.170.32", + "@tanstack/router-core": "1.171.27", + "@tanstack/start-client-core": "1.170.27" + }, + "engines": { + "node": ">=22.12.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": ">=18.0.0 || >=19.0.0", + "react-dom": ">=18.0.0 || >=19.0.0" + } + }, + "node_modules/@tanstack/react-start-rsc": { + "version": "0.1.48", + "resolved": "https://registry.npmjs.org/@tanstack/react-start-rsc/-/react-start-rsc-0.1.48.tgz", + "integrity": "sha512-UglRdTMuF3c4dvzL/gh4dMVbMWHsPy8ZgTQdT2qpTlyt1b/3m+R40tBFdsfTgw76VTXivW+qV/ih0PN9000XTw==", + "license": "MIT", + "dependencies": { + "@tanstack/react-router": "1.170.32", + "@tanstack/router-core": "1.171.27", + "@tanstack/router-utils": "1.162.2", + "@tanstack/start-client-core": "1.170.27", + "@tanstack/start-fn-stubs": "1.162.0", + "@tanstack/start-plugin-core": "1.171.39", + "@tanstack/start-storage-context": "1.167.29", + "pathe": "^2.0.3" + }, + "engines": { + "node": ">=22.12.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "@rspack/core": ">=2.0.0-0", + "@vitejs/plugin-rsc": ">=0.5.30", + "react": ">=18.0.0 || >=19.0.0", + "react-dom": ">=18.0.0 || >=19.0.0", + "react-server-dom-rspack": ">=0.0.2" + }, + "peerDependenciesMeta": { + "@rspack/core": { + "optional": true + }, + "@vitejs/plugin-rsc": { + "optional": true + }, + "react-server-dom-rspack": { + "optional": true + } + } + }, + "node_modules/@tanstack/react-start-server": { + "version": "1.167.37", + "resolved": "https://registry.npmjs.org/@tanstack/react-start-server/-/react-start-server-1.167.37.tgz", + "integrity": "sha512-cODHpFU8vIm7AdHii9W3NEuwyruNmT5wLDZjRsJLT9Jp+7FACnfJrRbvxnp1ldSv/9mxcHKi/OgwbdHQeMZcAQ==", + "license": "MIT", + "dependencies": { + "@tanstack/react-router": "1.170.32", + "@tanstack/router-core": "1.171.27", + "@tanstack/start-server-core": "1.169.31" + }, + "engines": { + "node": ">=22.12.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": ">=18.0.0 || >=19.0.0", + "react-dom": ">=18.0.0 || >=19.0.0" + } + }, + "node_modules/@tanstack/react-store": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/@tanstack/react-store/-/react-store-0.9.3.tgz", + "integrity": "sha512-y2iHd/N9OkoQbFJLUX1T9vbc2O9tjH0pQRgTcx1/Nz4IlwLvkgpuglXUx+mXt0g5ZDFrEeDnONPqkbfxXJKwRg==", + "license": "MIT", + "dependencies": { + "@tanstack/store": "0.9.3", + "use-sync-external-store": "^1.6.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/@tanstack/router-core": { + "version": "1.171.27", + "resolved": "https://registry.npmjs.org/@tanstack/router-core/-/router-core-1.171.27.tgz", + "integrity": "sha512-wDwSLvoLwIaNcnx9UNcN9Mb7Y8QwCYq1U1RQZwyN186gnkIoIYI2SOxy8VqH1vFigbkHkk4FmwMAQlghPgDK2g==", + "license": "MIT", + "dependencies": { + "@tanstack/history": "1.162.1", + "cookie-es": "^3.0.0", + "seroval": "^1.6.2", + "seroval-plugins": "^1.6.2" + }, + "engines": { + "node": ">=20.19" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/router-generator": { + "version": "1.167.33", + "resolved": "https://registry.npmjs.org/@tanstack/router-generator/-/router-generator-1.167.33.tgz", + "integrity": "sha512-Z3lCWIPuRUMPmuI8Mm48x/s49TxmHOaFVZ52j1W1QKYrsFHyT6U/h9bqfHJDxfQ8kz7y9q+W1YPKZ15Ee7yuCA==", + "license": "MIT", + "dependencies": { + "@babel/types": "^7.28.5", + "@tanstack/router-core": "1.171.27", + "@tanstack/router-utils": "1.162.2", + "@tanstack/virtual-file-routes": "1.162.0", + "jiti": "^2.7.0", + "magic-string": "^0.30.21", + "prettier": "^3.5.0", + "zod": "^4.4.3" + }, + "engines": { + "node": ">=20.19" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/router-plugin": { + "version": "1.168.35", + "resolved": "https://registry.npmjs.org/@tanstack/router-plugin/-/router-plugin-1.168.35.tgz", + "integrity": "sha512-foDAZKFqHXae+oFbIgcsSvy2QCVRn7XdS3nhwcRvD+ed6JrKPUP/1lQMsZLJqWycgR1vkZF7gs955KGa0NZQ0w==", + "license": "MIT", + "dependencies": { + "@babel/core": "^7.28.5", + "@babel/template": "^7.27.2", + "@babel/types": "^7.28.5", + "@tanstack/router-core": "1.171.27", + "@tanstack/router-generator": "1.167.33", + "@tanstack/router-utils": "1.162.2", + "chokidar": "^5.0.0", + "unplugin": "^3.0.0", + "zod": "^4.4.3" + }, + "engines": { + "node": ">=20.19" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "@rsbuild/core": ">=1.0.2 || ^2.0.0", + "@tanstack/react-router": "^1.170.32", + "vite": ">=5.0.0 || >=6.0.0 || >=7.0.0 || >=8.0.0", + "vite-plugin-solid": "^2.11.10 || ^3.0.0-0", + "webpack": ">=5.92.0" + }, + "peerDependenciesMeta": { + "@rsbuild/core": { + "optional": true + }, + "@tanstack/react-router": { + "optional": true + }, + "vite": { + "optional": true + }, + "vite-plugin-solid": { + "optional": true + }, + "webpack": { + "optional": true + } + } + }, + "node_modules/@tanstack/router-utils": { + "version": "1.162.2", + "resolved": "https://registry.npmjs.org/@tanstack/router-utils/-/router-utils-1.162.2.tgz", + "integrity": "sha512-hTWqJtqIFFdvuCl8WXNyrodp2L9zo2G37xKRrcVmVRWpAB2h+U1LuRAfS4tsFTiWOIoE/B+WDVFB8JpoEdw6jQ==", + "license": "MIT", + "dependencies": { + "@babel/generator": "^7.28.5", + "@babel/parser": "^7.28.5", + "@babel/types": "^7.28.5", + "ansis": "^4.1.0", + "babel-dead-code-elimination": "^1.0.12", + "diff": "^8.0.2", + "pathe": "^2.0.3", + "tinyglobby": "^0.2.15" + }, + "engines": { + "node": ">=20.19" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/start-client-core": { + "version": "1.170.27", + "resolved": "https://registry.npmjs.org/@tanstack/start-client-core/-/start-client-core-1.170.27.tgz", + "integrity": "sha512-Ro6ZSM0NgYKDMxM0e8qyU4mBfnld2Zb74BA/9f4i35C0Y3IAA8Zxs/DIPfOo9VRYWp5c5n5Q8dRBn2qn0vtPhQ==", + "license": "MIT", + "dependencies": { + "@tanstack/router-core": "1.171.27", + "@tanstack/start-fn-stubs": "1.162.0", + "@tanstack/start-storage-context": "1.167.29", + "seroval": "^1.6.2" + }, + "engines": { + "node": ">=22.12.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/start-fn-stubs": { + "version": "1.162.0", + "resolved": "https://registry.npmjs.org/@tanstack/start-fn-stubs/-/start-fn-stubs-1.162.0.tgz", + "integrity": "sha512-QWfUZ3Yo923tdQn38LyKMU8rcTw69zc+T4dAvgTWV4O56SqFRsGfS0lSWIMhJRwXIx/bvdi7nTUBDdZtTHtpTQ==", + "license": "MIT", + "engines": { + "node": ">=22.12.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/start-plugin-core": { + "version": "1.171.39", + "resolved": "https://registry.npmjs.org/@tanstack/start-plugin-core/-/start-plugin-core-1.171.39.tgz", + "integrity": "sha512-Zyj6G4MDFLXcHYhPavhewCBo8dsxi3qvPk31zl/QtTzYzOY9rJHDDBGarKsJq20ziChmkGn/sttYqb4vGCxJDA==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "7.27.1", + "@babel/core": "^7.28.5", + "@babel/types": "^7.28.5", + "@tanstack/router-core": "1.171.27", + "@tanstack/router-generator": "1.167.33", + "@tanstack/router-plugin": "1.168.35", + "@tanstack/router-utils": "1.162.2", + "@tanstack/start-server-core": "1.169.31", + "exsolve": "^1.0.7", + "lightningcss": "^1.32.0", + "pathe": "^2.0.3", + "picomatch": "^4.0.3", + "seroval": "^1.6.2", + "source-map": "^0.7.6", + "srvx": "^0.11.9", + "tinyglobby": "^0.2.15", + "ufo": "^1.5.4", + "vitefu": "^1.1.1", + "xmlbuilder2": "^4.0.3", + "zod": "^4.4.3" + }, + "engines": { + "node": ">=22.12.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "@rsbuild/core": "^2.0.0", + "vite": ">=7.0.0" + }, + "peerDependenciesMeta": { + "@rsbuild/core": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@tanstack/start-server-core": { + "version": "1.169.31", + "resolved": "https://registry.npmjs.org/@tanstack/start-server-core/-/start-server-core-1.169.31.tgz", + "integrity": "sha512-56w8l+Fao01YCrmv0hzNxL3b3FRmqLRGdE11izZNQsW+1CcSYuehAM5khWKABuI1DI/UIBLGV7BwL4Dlg0eHCw==", + "license": "MIT", + "dependencies": { + "@tanstack/history": "1.162.1", + "@tanstack/router-core": "1.171.27", + "@tanstack/start-client-core": "1.170.27", + "@tanstack/start-storage-context": "1.167.29", + "fetchdts": "^0.1.6", + "h3-v2": "npm:h3@2.0.1-rc.20", + "seroval": "^1.6.2" + }, + "engines": { + "node": ">=22.12.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/start-storage-context": { + "version": "1.167.29", + "resolved": "https://registry.npmjs.org/@tanstack/start-storage-context/-/start-storage-context-1.167.29.tgz", + "integrity": "sha512-8qfprC5774XMRDQlMogkfiGpFLiBf0xDG4bMFUbfkSzpCAQwpLbgGY4Zwft22O9rKYq2vUXusKAdVjvJTUEquQ==", + "license": "MIT", + "dependencies": { + "@tanstack/router-core": "1.171.27" + }, + "engines": { + "node": ">=22.12.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/store": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/@tanstack/store/-/store-0.9.3.tgz", + "integrity": "sha512-8reSzl/qGWGGVKhBoxXPMWzATSbZLZFWhwBAFO9NAyp0TxzfBP0mIrGb8CP8KrQTmvzXlR/vFPPUrHTLBGyFyw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/virtual-file-routes": { + "version": "1.162.0", + "resolved": "https://registry.npmjs.org/@tanstack/virtual-file-routes/-/virtual-file-routes-1.162.0.tgz", + "integrity": "sha512-uhOeFyxLcU41HzvrxsGpiWdcMbScY1EDgbZ5K7DVRMYInbLYWAC0EA/kx9wXAoSM8q82bUG2hRl8+EAjE6XAbA==", + "license": "MIT", + "engines": { + "node": ">=20.19" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@types/hast": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.5.tgz", + "integrity": "sha512-rp/ezSWaD1m44dPKICGhiskI13nVr7qTloFwDa/IYkhhf5nzwP+zIQcIJh3WIFSBOy/H1PzB40jPjMDksN4F+g==", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/node": { + "version": "22.20.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.20.1.tgz", + "integrity": "sha512-EANqOCF9QFyra+4pfxUcX9STKJpCLjMbObVzljIJomAWSnuSIEAvyzEU53GaajbXJEgdh0iEcPL+DGvpUd4k1Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/@types/pg": { + "version": "8.23.1", + "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.23.1.tgz", + "integrity": "sha512-fKVHpikPdg4GKks3JuLEhvwSyvwzF23hnabPy6DD8ljVbC7+6J5dQzdv4arV6jqq57djnMgs1HKBxX4P8aBI3A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "pg-protocol": "*", + "pg-types": "^2.2.0" + } + }, + "node_modules/@types/pngjs": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/@types/pngjs/-/pngjs-6.0.5.tgz", + "integrity": "sha512-0k5eKfrA83JOZPppLtS2C7OUtyNAl2wKNxfyYl9Q5g9lPkgBl/9hNyAu6HuEH2J4XmIv2znEpkDd0SaZVxW6iQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/prismjs": { + "version": "1.26.6", + "resolved": "https://registry.npmjs.org/@types/prismjs/-/prismjs-1.26.6.tgz", + "integrity": "sha512-vqlvI7qlMvcCBbVe0AKAb4f97//Hy0EBTaiW8AalRnG/xAN5zOiWWyrNqNXeq8+KAuvRewjCVY1+IPxk4RdNYw==", + "license": "MIT" + }, + "node_modules/@types/react": { + "version": "19.2.18", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.18.tgz", + "integrity": "sha512-AnzbBERsrLKtk2XSfTbYRLjQPdy116Sty4q+T+Bp3IC4l6jNBvreVPAHmpq9qhXQM7CXZPjLVmGMw9sy+hxQ3w==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.2.7", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.7.tgz", + "integrity": "sha512-I8bPpDLcHBv1qiIiXDCy71Rt8eQDKJP0sMSWJphDdAcdqiJ1sGpZamavoEIRZmYzjia9LuEb2HlYdDpmoENpvQ==", + "devOptional": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.2.0" + } + }, + "node_modules/@types/sortablejs": { + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/@types/sortablejs/-/sortablejs-1.15.9.tgz", + "integrity": "sha512-7HP+rZGE2p886PKV9c9OJzLBI6BBJu1O7lJGYnPyG3fS4/duUCcngkNCjsLwIMV+WMqANe3tt4irrXHSIe68OQ==", + "license": "MIT", + "peer": true + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "license": "MIT" + }, + "node_modules/@vitejs/plugin-react": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-6.1.1.tgz", + "integrity": "sha512-yxLaQV9gkhS8ezJqCM6+ndU7mDY6gqAg75NQ+0IjwEI8IYOmQCgkRwHKVSfWXW076DsqMo0Dk+0FK1U+M5RgFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rolldown/pluginutils": "^1.0.1" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "peerDependencies": { + "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0", + "babel-plugin-react-compiler": "^1.0.0", + "oxc-transform-react": "^0.145.0", + "vite": "^8.0.0" + }, + "peerDependenciesMeta": { + "@rolldown/plugin-babel": { + "optional": true + }, + "babel-plugin-react-compiler": { + "optional": true + }, + "oxc-transform-react": { + "optional": true + } + } + }, + "node_modules/ansis": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/ansis/-/ansis-4.3.1.tgz", + "integrity": "sha512-BJ8/l4R5LRE7hW9WdSuGYrLSHi2ynxeFpDFbH0K/CgNeY/tyhk+vO6TYxXC5r5CpUhNVX310xzPsN/H9lCdfOA==", + "license": "ISC", + "engines": { + "node": ">=14" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" + }, + "node_modules/aria-hidden": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/aria-hidden/-/aria-hidden-1.2.6.tgz", + "integrity": "sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA==", + "license": "MIT", + "dependencies": { + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/babel-dead-code-elimination": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/babel-dead-code-elimination/-/babel-dead-code-elimination-1.0.12.tgz", + "integrity": "sha512-GERT7L2TiYcYDtYk1IpD+ASAYXjKbLTDPhBtYj7X1NuRMDTMtAx9kyBenub1Ev41lo91OHCKdmP+egTDmfQ7Ig==", + "license": "MIT", + "dependencies": { + "@babel/core": "^7.23.7", + "@babel/parser": "^7.23.6", + "@babel/traverse": "^7.23.7", + "@babel/types": "^7.23.6" + } + }, + "node_modules/baseline-browser-mapping": { + "version": "2.11.21", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.21.tgz", + "integrity": "sha512-uh8vpY/1/YyFkunIDFH/12p7/7VdPKA1hejMVEbdkEaWnUz0Hesvx5EbiU6XxjyHZIOju+ZMbQJkRh+es3/spQ==", + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.cjs" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/blake3-wasm": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/blake3-wasm/-/blake3-wasm-2.1.5.tgz", + "integrity": "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==", + "dev": true, + "license": "MIT" + }, + "node_modules/browserslist": { + "version": "4.28.9", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.9.tgz", + "integrity": "sha512-EWazOblFYUvlGZcfGhPUPmYh3nikUxBVb+y9MJun5f3hBi812X+8MSQTujLBtgK3cf51fJWbWfOjyeO954d+Eg==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "baseline-browser-mapping": "^2.11.20", + "caniuse-lite": "^1.0.30001810", + "electron-to-chromium": "^1.5.420", + "node-releases": "^2.0.54", + "update-browserslist-db": "^1.3.2" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001810", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz", + "integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/character-entities": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", + "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-reference-invalid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", + "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/chokidar": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-5.0.0.tgz", + "integrity": "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==", + "license": "MIT", + "dependencies": { + "readdirp": "^5.0.0" + }, + "engines": { + "node": ">= 20.19.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/class-variance-authority": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/class-variance-authority/-/class-variance-authority-0.7.1.tgz", + "integrity": "sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg==", + "license": "Apache-2.0", + "dependencies": { + "clsx": "^2.1.1" + }, + "funding": { + "url": "https://polar.sh/cva" + } + }, + "node_modules/classnames": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.1.tgz", + "integrity": "sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA==", + "license": "MIT" + }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/consola": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/consola/-/consola-3.4.2.tgz", + "integrity": "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.18.0 || >=16.10.0" + } + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "license": "MIT" + }, + "node_modules/cookie": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz", + "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/cookie-es": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-3.1.1.tgz", + "integrity": "sha512-UaXxwISYJPTr9hwQxMFYZ7kNhSXboMXP+Z3TRX6f1/NyaGPfuNUZOWP1pUEb75B2HjfklIYLVRfWiFZJyC6Npg==", + "license": "MIT" + }, + "node_modules/crossws": { + "version": "0.4.12", + "resolved": "https://registry.npmjs.org/crossws/-/crossws-0.4.12.tgz", + "integrity": "sha512-aypfsr6t0uNvkqaZc6zvBfXzC6pLI0/sIulpkV6RwCVtZqG5ebBzv4weImKK0VNCj91Wl9F5j7p5WU4MNrybng==", + "devOptional": true, + "license": "MIT", + "peerDependencies": { + "srvx": ">=0.11.5" + }, + "peerDependenciesMeta": { + "srvx": { + "optional": true + } + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/dayjs": { + "version": "1.11.23", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.23.tgz", + "integrity": "sha512-QDTCU0M0MxR3hQfnlDJfwekQiaanm1ubOD231u73WBckQ/fsamwRLiE2GBz6D3a/xF1NgfiDLJjXBa1hYOYTtQ==", + "license": "MIT" + }, + "node_modules/db0": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/db0/-/db0-0.4.1.tgz", + "integrity": "sha512-6RBY/bSn42UrqATwsiULj2uYFyEykB3XeA/NLIVQeHNXlYV6D4Idxx3/aa6k5Y45Dwzx7sygeLotnqHWSeURYA==", + "dev": true, + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decode-named-character-reference": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.3.0.tgz", + "integrity": "sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q==", + "license": "MIT", + "dependencies": { + "character-entities": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/detect-node-es": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz", + "integrity": "sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==", + "license": "MIT" + }, + "node_modules/diff": { + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.4.tgz", + "integrity": "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/dotenv": { + "version": "17.2.2", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.2.tgz", + "integrity": "sha512-Sf2LSQP+bOlhKWWyhFsn0UsfdK/kCWRv1iuA2gXAwt3dyNabr6QSj00I2V10pidqz69soatm9ZwZvpQMTIOd5Q==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.422", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.422.tgz", + "integrity": "sha512-UvA/32XqrLDdZSn7Jllo1AYNcWji/G0d5M0GTViE7KoGBiMunw3a34Sb2KO4ZZyrSEhqsxFoVhWWJshdyfKqJA==", + "license": "ISC" + }, + "node_modules/env-runner": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/env-runner/-/env-runner-0.2.1.tgz", + "integrity": "sha512-2iDP2DfheAMMAKeXBggEuFmpSq+1Xs6wQoHba1g65pZFXlC3VHD1O6/tgVzS6GQLv+P2koPKZPKgKhXkigNBdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "crossws": "^0.4.12", + "exsolve": "^1.1.1", + "httpxy": "^0.5.5", + "srvx": "^1.0.0" + }, + "bin": { + "env-runner": "dist/cli.mjs" + } + }, + "node_modules/env-runner/node_modules/srvx": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/srvx/-/srvx-1.0.3.tgz", + "integrity": "sha512-aOuk+yNJA61yA6eJJvQJxpJLIxz090hKMqDGzd35tGsvwaodi1RPuYSFUp5EINaJp7snjVwLkO2RXVMPZBYnnA==", + "dev": true, + "license": "MIT", + "bin": { + "srvx": "bin/srvx.mjs" + }, + "engines": { + "node": ">=20.16.0" + } + }, + "node_modules/error-stack-parser-es": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/error-stack-parser-es/-/error-stack-parser-es-1.0.5.tgz", + "integrity": "sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/esbuild": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", + "devOptional": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/exsolve": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/exsolve/-/exsolve-1.1.1.tgz", + "integrity": "sha512-9U/jZUgjnSGyntRr6y5Muu1MJcwFl6kPu7k8qLF0IMNfLqvw0NZ4nnVDq0RVoZ0RvCyumib4Ez3KYrVfilrw+g==", + "license": "MIT" + }, + "node_modules/fast-sha256": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-sha256/-/fast-sha256-1.3.0.tgz", + "integrity": "sha512-n11RGP/lrWEFI/bWdygLxhI+pVeo1ZYIVwvvPkW7azl/rOy+F3HYRZ2K5zeE9mmkhQppyv9sQFx0JM9UabnpPQ==", + "license": "Unlicense" + }, + "node_modules/fault": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/fault/-/fault-1.0.4.tgz", + "integrity": "sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==", + "license": "MIT", + "dependencies": { + "format": "^0.2.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fetchdts": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/fetchdts/-/fetchdts-0.1.7.tgz", + "integrity": "sha512-YoZjBdafyLIop9lSxXVI33oLD5kN31q4Td+CasofLLYeLXRFeOsuOw0Uo+XNRi9PZlbfdlN2GmRtm4tCEQ9/KA==", + "license": "MIT" + }, + "node_modules/format": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", + "integrity": "sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==", + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-nonce": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-nonce/-/get-nonce-1.0.1.tgz", + "integrity": "sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "license": "BSD-2-Clause" + }, + "node_modules/h3": { + "version": "2.0.1-rc.31", + "resolved": "https://registry.npmjs.org/h3/-/h3-2.0.1-rc.31.tgz", + "integrity": "sha512-AG7qZzF99a0BSYoXT3evJgIhwSIUKow7R+hwkLRZS06WJ9nbSb7QXUDgs1ByBjp6svTvl++N/GKA7I9YPz9cQQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "rou3": "^0.9.2", + "srvx": "^1.0.2" + }, + "bin": { + "h3": "bin/h3.mjs" + }, + "engines": { + "node": ">=20.11.1" + }, + "peerDependencies": { + "crossws": "^0.4.12", + "ocache": ">=0.3.0" + }, + "peerDependenciesMeta": { + "crossws": { + "optional": true + }, + "ocache": { + "optional": true + } + } + }, + "node_modules/h3-v2": { + "name": "h3", + "version": "2.0.1-rc.20", + "resolved": "https://registry.npmjs.org/h3/-/h3-2.0.1-rc.20.tgz", + "integrity": "sha512-28ljodXuUp0fZovdiSRq4G9OgrxCztrJe5VdYzXAB7ueRvI7pIUqLU14Xi3XqdYJ/khXjfpUOOD2EQa6CmBgsg==", + "license": "MIT", + "dependencies": { + "rou3": "^0.8.1", + "srvx": "^0.11.13" + }, + "bin": { + "h3": "bin/h3.mjs" + }, + "engines": { + "node": ">=20.11.1" + }, + "peerDependencies": { + "crossws": "^0.4.1" + }, + "peerDependenciesMeta": { + "crossws": { + "optional": true + } + } + }, + "node_modules/h3/node_modules/rou3": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/rou3/-/rou3-0.9.2.tgz", + "integrity": "sha512-3SOzvaAg8rkHrXtRjpCvCvbyO5to9oOO27Z/XqHEYXfMRVSw/qMIVdmaOk9W2lcRLtR6dlqTjo9hDeJk70QBYQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/h3/node_modules/srvx": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/srvx/-/srvx-1.0.3.tgz", + "integrity": "sha512-aOuk+yNJA61yA6eJJvQJxpJLIxz090hKMqDGzd35tGsvwaodi1RPuYSFUp5EINaJp7snjVwLkO2RXVMPZBYnnA==", + "dev": true, + "license": "MIT", + "bin": { + "srvx": "bin/srvx.mjs" + }, + "engines": { + "node": ">=20.16.0" + } + }, + "node_modules/hast-util-parse-selector": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-4.0.0.tgz", + "integrity": "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hastscript": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-9.0.1.tgz", + "integrity": "sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-parse-selector": "^4.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/highlight.js": { + "version": "10.7.3", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz", + "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==", + "license": "BSD-3-Clause", + "engines": { + "node": "*" + } + }, + "node_modules/highlightjs-vue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/highlightjs-vue/-/highlightjs-vue-1.0.0.tgz", + "integrity": "sha512-PDEfEF102G23vHmPhLyPboFCD+BkMGu+GuJe2d9/eH4FsCwvgBpnc9n0pGE+ffKdph38s6foEZiEjdgHdzp+IA==", + "license": "CC0-1.0" + }, + "node_modules/hookable": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/hookable/-/hookable-6.1.1.tgz", + "integrity": "sha512-U9LYDy1CwhMCnprUfeAZWZGByVbhd54hwepegYTK7Pi5NvqEj63ifz5z+xukznehT7i6NIZRu89Ay1AZmRsLEQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/httpxy": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/httpxy/-/httpxy-0.5.5.tgz", + "integrity": "sha512-uDjmnPyp1q4Sgzf3w+J/Fc6UqcCEj0x4Wjp7OqK5dGhNeDgpyrAmnS6ey8QWrX3SWDon2DMKf9sBa5X9+CVyMA==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-alphabetical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", + "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-alphanumerical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", + "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", + "license": "MIT", + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-decimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", + "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-hexadecimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", + "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/isbot": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/isbot/-/isbot-5.2.2.tgz", + "integrity": "sha512-iQcBXcd+Rv/pkubRyGh2utW2j1oPG5hZY6TUhVPpqK4G+o3IbxpJNx04hgksjc/N7GK5pEorUxDeg31cFgEk/w==", + "license": "Unlicense", + "engines": { + "node": ">=18" + } + }, + "node_modules/jiti": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz", + "integrity": "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==", + "license": "MIT", + "bin": { + "jiti": "lib/jiti-cli.mjs" + } + }, + "node_modules/js-cookie": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.7.tgz", + "integrity": "sha512-z/wZZgDrkNV1eA0ULjM/F9/50Ya8fbzgKneSpoPsXSGd0KnpdtHfOZWK+GcwLk+EZbS4F9RBhU+K2RgzuDaItw==", + "license": "MIT", + "engines": { + "node": ">=20" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", + "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsqr": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jsqr/-/jsqr-1.4.0.tgz", + "integrity": "sha512-dxLob7q65Xg2DvstYkRpkYtmKm2sPJ9oFhrhmudT1dZvNFFTlroai3AWSpLey/w5vMcLBXRgOJsbXpdN9HzU/A==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/kleur": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/lightningcss": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "cpu": [ + "arm" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lodash-es": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.18.1.tgz", + "integrity": "sha512-J8xewKD/Gk22OZbhpOVSwcs60zhd95ESDwezOFuA3/099925PdHJ7OFHNTGtajL3AlZkykD32HykiMo+BIBI8A==", + "license": "MIT" + }, + "node_modules/lowlight": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/lowlight/-/lowlight-1.20.0.tgz", + "integrity": "sha512-8Ktj+prEb1RoCPkEOrPMYUN/nCggB7qAWe3a7OpMjWQkh3l2RD5wKRQ+o8Q8YuI9RG/xs95waaI/E6ym/7NsTw==", + "license": "MIT", + "dependencies": { + "fault": "^1.0.0", + "highlight.js": "~10.7.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/lucide-react": { + "version": "0.577.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.577.0.tgz", + "integrity": "sha512-4LjoFv2eEPwYDPg/CUdBJQSDfPyzXCRrVW1X7jrx/trgxnxkHFjnVZINbzvzxjN70dxychOfg+FTYwBiS3pQ5A==", + "license": "ISC", + "peerDependencies": { + "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/memoize-one": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-5.2.1.tgz", + "integrity": "sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q==", + "license": "MIT" + }, + "node_modules/miniflare": { + "version": "5.20260911.0-alpha", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-5.20260911.0-alpha.tgz", + "integrity": "sha512-CRieJmvHx+7rNqnA5SKdsYsER6rfkUIE/jruIUw+fLhsQ4sORfuMtr3+FQzsQ9/y8lhk061V4Fl1DFdHiyBB6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cspotcode/source-map-support": "0.8.1", + "sharp": "0.35.4", + "undici": "7.29.0", + "workerd": "1.20260911.1", + "ws": "8.21.0", + "youch": "4.1.0-beta.10" + }, + "engines": { + "node": ">=22.0.0" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.18", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.18.tgz", + "integrity": "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==", + "devOptional": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/nf3": { + "version": "0.3.24", + "resolved": "https://registry.npmjs.org/nf3/-/nf3-0.3.24.tgz", + "integrity": "sha512-HxLK4bo+5jNsEETZp4w3tJblHOA9MCBY14IN9nZJJV8JDxt9yNIYxuBuLMjTAR5GFa3HL61+8VQDUrXv3/C8fw==", + "dev": true, + "license": "MIT" + }, + "node_modules/nitro": { + "version": "3.0.260903-beta", + "resolved": "https://registry.npmjs.org/nitro/-/nitro-3.0.260903-beta.tgz", + "integrity": "sha512-54gANPi62O8rfMvepiJUVuIzEIinYfpeHbebywlLxvVTgIYXDwSvpaU9Id+0sJOBjBx0wC1/CVYXJkH7SY+l0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "consola": "^3.4.2", + "crossws": "^0.4.12", + "db0": "^0.4.1", + "env-runner": "^0.2.1", + "h3": "^2.0.1-rc.31", + "hookable": "^6.1.1", + "nf3": "^0.3.24", + "ocache": "^0.3.0", + "rolldown": "^1.2.7", + "rou3": "^0.9.2", + "srvx": "^1.0.3", + "unenv": "^2.0.0-rc.24", + "unstorage": "^2.0.0-alpha.10" + }, + "bin": { + "nitro": "dist/cli/index.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/nitro/node_modules/rou3": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/rou3/-/rou3-0.9.2.tgz", + "integrity": "sha512-3SOzvaAg8rkHrXtRjpCvCvbyO5to9oOO27Z/XqHEYXfMRVSw/qMIVdmaOk9W2lcRLtR6dlqTjo9hDeJk70QBYQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/nitro/node_modules/srvx": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/srvx/-/srvx-1.0.3.tgz", + "integrity": "sha512-aOuk+yNJA61yA6eJJvQJxpJLIxz090hKMqDGzd35tGsvwaodi1RPuYSFUp5EINaJp7snjVwLkO2RXVMPZBYnnA==", + "dev": true, + "license": "MIT", + "bin": { + "srvx": "bin/srvx.mjs" + }, + "engines": { + "node": ">=20.16.0" + } + }, + "node_modules/node-releases": { + "version": "2.0.54", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.54.tgz", + "integrity": "sha512-YHs7BmmcsdAI5Ozuf8JZo6PT0mv2GIWC9vMfvUC3dp65M8hn7Ux8CPL+2oBI7juNuj9d0ndhTcznq2ODBps9cQ==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/ocache": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/ocache/-/ocache-0.3.0.tgz", + "integrity": "sha512-RS/9P0zeBb0gDJmadGERLH8lZNXK7xbufTDhclkXGvFGTsj0G4M5/cLk+mizcERH29mLXNnocfB5wjcK70wGJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/parse-entities": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.2.tgz", + "integrity": "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^2.0.0", + "character-entities-legacy": "^3.0.0", + "character-reference-invalid": "^2.0.0", + "decode-named-character-reference": "^1.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0", + "is-hexadecimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/parse-entities/node_modules/@types/unist": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", + "license": "MIT" + }, + "node_modules/path-to-regexp": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", + "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "license": "MIT" + }, + "node_modules/pg": { + "version": "8.23.0", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.23.0.tgz", + "integrity": "sha512-Ip2EQCngowJLGOfCwkFhPXU7/ljlhn6Rxlmy4XYfL2Y+vyRM59+8uR2xqRWKdYmbXmxCFOAmKxBuSUCdF34qLg==", + "license": "MIT", + "dependencies": { + "pg-connection-string": "^2.14.0", + "pg-pool": "^3.14.0", + "pg-protocol": "^1.16.0", + "pg-types": "2.2.0", + "pgpass": "1.0.5" + }, + "engines": { + "node": ">= 16.0.0" + }, + "optionalDependencies": { + "pg-cloudflare": "^1.4.0" + }, + "peerDependencies": { + "pg-native": ">=3.0.1" + }, + "peerDependenciesMeta": { + "pg-native": { + "optional": true + } + } + }, + "node_modules/pg-cloudflare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.4.0.tgz", + "integrity": "sha512-Vo7z/6rrQYxpNRylp4Tlob2elzbh+N/MOQbxFVWCxS7oEx6jF53GTJFxK2WWpKuBRkmiin4Mt+xofFDjx09R0A==", + "license": "MIT", + "optional": true + }, + "node_modules/pg-connection-string": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.14.0.tgz", + "integrity": "sha512-XwWDGcLRGCXAR8F/AM5bG7Q+A3Wm2s6QeEjlOKZLlH3UYcguiqCWKyWXVag5TLTIjR7oOJUY8kcADaZgWPyLeg==", + "license": "MIT" + }, + "node_modules/pg-int8": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", + "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", + "license": "ISC", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/pg-pool": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.14.0.tgz", + "integrity": "sha512-gKtPkFdQPU3DksooVLi9LsjZxrsBUZIpa+7aVx+LV5pNh0KzP4Zleud2po+ConrxbuXGBJ6Hfer6hdgpIBpBaw==", + "license": "MIT", + "peerDependencies": { + "pg": ">=8.0" + } + }, + "node_modules/pg-protocol": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.16.0.tgz", + "integrity": "sha512-sILXutLVjCLjcDuOmvhX5e2Z4cS5qG/6Bu3VkpFwdf/633ElGLpEh9bgmuI5I4sqKqkifQiGyiCcx1HdtrK7tg==", + "license": "MIT" + }, + "node_modules/pg-types": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", + "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", + "license": "MIT", + "dependencies": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pgpass": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz", + "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==", + "license": "MIT", + "dependencies": { + "split2": "^4.1.0" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/playwright": { + "version": "1.63.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.63.0.tgz", + "integrity": "sha512-+7ziBLidS4NaNCdt57SUDT+wYmmd5fmiQejUic/kb+YsYSCPyOOE9sebzMjNmQrsnNpDJqd4WHvV/8lfKfUDUg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright-core": "1.63.0" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/playwright-core": { + "version": "1.63.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.63.0.tgz", + "integrity": "sha512-rYCsBF/M5HjUch52bbtVONEFjv6Xu8sm8h72dNlR5bzIE1fvC/bxgspzkjSfU+MweEMmPM8KJebG6nnyxo5mCg==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/pngjs": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-7.0.0.tgz", + "integrity": "sha512-LKWqWJRhstyYo9pGvgor/ivk2w94eSjE3RGVuzLGlr3NmD8bf7RcYGze1mNdEHRP6TRP6rMuDHk5t44hnTRyow==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.19.0" + } + }, + "node_modules/postcss": { + "version": "8.5.28", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz", + "integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==", + "devOptional": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.18", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postgres-array": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", + "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/postgres-bytea": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.1.tgz", + "integrity": "sha512-5+5HqXnsZPE65IJZSMkZtURARZelel2oXUEO8rH83VS/hxH5vv1uHquPg5wZs8yMAfdv971IU+kcPUczi7NVBQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-date": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", + "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-interval": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", + "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", + "license": "MIT", + "dependencies": { + "xtend": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/prettier": { + "version": "3.9.6", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.9.6.tgz", + "integrity": "sha512-OpN0zzVdiaiAhxpuuj5efpIS4sY9j7bY6uR5mnj5yPzGkdkjNKSJeUThPb60Jw29QuAZgA4o+/iB49kFiaBX6g==", + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prismjs": { + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz", + "integrity": "sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/property-information": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.2.0.tgz", + "integrity": "sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/qr-code-styling": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/qr-code-styling/-/qr-code-styling-1.9.2.tgz", + "integrity": "sha512-RgJaZJ1/RrXJ6N0j7a+pdw3zMBmzZU4VN2dtAZf8ZggCfRB5stEQ3IoDNGaNhYY3nnZKYlYSLl5YkfWN5dPutg==", + "license": "MIT", + "dependencies": { + "qrcode-generator": "^1.4.4" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/qrcode-generator": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/qrcode-generator/-/qrcode-generator-1.5.2.tgz", + "integrity": "sha512-pItrW0Z9HnDBnFmgiNrY1uxRdri32Uh9EjNYLPVC2zZ3ZRIIEqBoDgm4DkvDwNNDHTK7FNkmr8zAa77BYc9xNw==", + "license": "MIT" + }, + "node_modules/react": { + "version": "19.2.8", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.8.tgz", + "integrity": "sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.2.8", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.8.tgz", + "integrity": "sha512-rVprimfGBG3DR+Tq0IQG2DT5PxKth1WIGDmj5yPmlzr4YBe7uyE+Du4oVqTDXZSHGGGXRtTJEGSSePyQCMBglQ==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.27.0" + }, + "peerDependencies": { + "react": "^19.2.8" + } + }, + "node_modules/react-remove-scroll-bar": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/react-remove-scroll-bar/-/react-remove-scroll-bar-2.3.8.tgz", + "integrity": "sha512-9r+yi9+mgU33AKcj6IbT9oRCO78WriSj6t/cF8DWBZJ9aOGPOTEDvdUDz1FwKim7QXWwmHqtdHnRJfhAxEG46Q==", + "license": "MIT", + "dependencies": { + "react-style-singleton": "^2.2.2", + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/react-sortablejs": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/react-sortablejs/-/react-sortablejs-6.1.4.tgz", + "integrity": "sha512-fc7cBosfhnbh53Mbm6a45W+F735jwZ1UFIYSrIqcO/gRIFoDyZeMtgKlpV4DdyQfbCzdh5LoALLTDRxhMpTyXQ==", + "license": "MIT", + "dependencies": { + "classnames": "2.3.1", + "tiny-invariant": "1.2.0" + }, + "peerDependencies": { + "@types/sortablejs": "1", + "react": ">=16.9.0", + "react-dom": ">=16.9.0", + "sortablejs": "1" + } + }, + "node_modules/react-style-singleton": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/react-style-singleton/-/react-style-singleton-2.2.3.tgz", + "integrity": "sha512-b6jSvxvVnyptAiLjbkWLE/lOnR4lfTtDAl+eUC7RZy+QQWc6wRzIV2CE6xBuMmDxc2qIihtDCZD5NPOFl7fRBQ==", + "license": "MIT", + "dependencies": { + "get-nonce": "^1.0.0", + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/react-syntax-highlighter": { + "version": "16.1.1", + "resolved": "https://registry.npmjs.org/react-syntax-highlighter/-/react-syntax-highlighter-16.1.1.tgz", + "integrity": "sha512-PjVawBGy80C6YbC5DDZJeUjBmC7skaoEUdvfFQediQHgCL7aKyVHe57SaJGfQsloGDac+gCpTfRdtxzWWKmCXA==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.28.4", + "highlight.js": "^10.4.1", + "highlightjs-vue": "^1.0.0", + "lowlight": "^1.17.0", + "prismjs": "^1.30.0", + "refractor": "^5.0.0" + }, + "engines": { + "node": ">= 16.20.2" + }, + "peerDependencies": { + "react": ">= 0.14.0" + } + }, + "node_modules/react-virtualized-auto-sizer": { + "version": "1.0.26", + "resolved": "https://registry.npmjs.org/react-virtualized-auto-sizer/-/react-virtualized-auto-sizer-1.0.26.tgz", + "integrity": "sha512-CblNyiNVw2o+hsa5/49NH2ogGxZ+t+3aweRvNSq7TVjDIlwk7ir4lencEg5HxHeSzwNarSkNkiu0qJSOXtxm5A==", + "license": "MIT", + "peerDependencies": { + "react": "^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/react-window": { + "version": "1.8.11", + "resolved": "https://registry.npmjs.org/react-window/-/react-window-1.8.11.tgz", + "integrity": "sha512-+SRbUVT2scadgFSWx+R1P754xHPEqvcfSfVX10QYg6POOz+WNgkN48pS+BtZNIMGiL1HYrSEiCkwsMS15QogEQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.0.0", + "memoize-one": ">=3.1.1 <6" + }, + "engines": { + "node": ">8.0.0" + }, + "peerDependencies": { + "react": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/readdirp": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-5.1.1.tgz", + "integrity": "sha512-Kko+Y5XQ6fM+Ce3dq3m9YGxnacYZYl9cA1wZjaF3Vbry2L3i1qVg8+CAgNPsXRArPMUMCaOR7oa9Nqntc43JKA==", + "license": "MIT", + "engines": { + "node": ">= 20.19.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/refractor": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/refractor/-/refractor-5.0.0.tgz", + "integrity": "sha512-QXOrHQF5jOpjjLfiNk5GFnWhRXvxjUVnlFxkeDmewR5sXkr3iM46Zo+CnRR8B+MDVqkULW4EcLVcRBNOPXHosw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/prismjs": "^1.0.0", + "hastscript": "^9.0.0", + "parse-entities": "^4.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/rolldown": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.7.tgz", + "integrity": "sha512-g0EtLvBjTUB7jhyV0S/TCup3v/XSVl45vUIGbOGU4QPiyjTenCe4mKuFvW9fEgYmS2Fo42AUssRmNuMziXdrig==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.148.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm-eabi": "1.2.7", + "@rolldown/binding-android-arm64": "1.2.7", + "@rolldown/binding-darwin-arm64": "1.2.7", + "@rolldown/binding-darwin-x64": "1.2.7", + "@rolldown/binding-freebsd-x64": "1.2.7", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.7", + "@rolldown/binding-linux-arm64-gnu": "1.2.7", + "@rolldown/binding-linux-arm64-musl": "1.2.7", + "@rolldown/binding-linux-ppc64-gnu": "1.2.7", + "@rolldown/binding-linux-s390x-gnu": "1.2.7", + "@rolldown/binding-linux-x64-gnu": "1.2.7", + "@rolldown/binding-linux-x64-musl": "1.2.7", + "@rolldown/binding-openharmony-arm64": "1.2.7", + "@rolldown/binding-win32-arm64-msvc": "1.2.7", + "@rolldown/binding-win32-x64-msvc": "1.2.7" + } + }, + "node_modules/rou3": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/rou3/-/rou3-0.8.1.tgz", + "integrity": "sha512-ePa+XGk00/3HuCqrEnK3LxJW7I0SdNg6EFzKUJG73hMAdDcOUC/i/aSz7LSDwLrGr33kal/rqOGydzwl6U7zBA==", + "license": "MIT" + }, + "node_modules/scheduler": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", + "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/seroval": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/seroval/-/seroval-1.6.4.tgz", + "integrity": "sha512-LErWMNS2RRFdu2RMA5u/PA59/IWs0XsikyEXGQ2/36iEWFrdG0ABmg17E17cikrv76891kOAMq3TkTFXpwAHXw==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/seroval-plugins": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/seroval-plugins/-/seroval-plugins-1.6.4.tgz", + "integrity": "sha512-R0f1U9hmn38+dFMz6b6ab8lwucmw4AtiY7St+JPWudy1dm+Bs3g884nyrsH9Cy6rKpZKLYayXuMda9GZ/fl8JQ==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "seroval": "^1.0" + } + }, + "node_modules/sharp": { + "version": "0.35.4", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.4.tgz", + "integrity": "sha512-n++8XWcj+jCOr2IOl7h8LbKnGBDY4aPbmprMONBNFdn0ImXqpGVv5zliDs0V9HbmbCQLpbuo2ej9rAoOQTvMDA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@img/colour": "^1.1.0", + "detect-libc": "^2.1.2", + "semver": "^7.8.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.35.4", + "@img/sharp-darwin-x64": "0.35.4", + "@img/sharp-freebsd-wasm32": "0.35.4", + "@img/sharp-libvips-darwin-arm64": "1.3.3", + "@img/sharp-libvips-darwin-x64": "1.3.3", + "@img/sharp-libvips-linux-arm": "1.3.3", + "@img/sharp-libvips-linux-arm64": "1.3.3", + "@img/sharp-libvips-linux-ppc64": "1.3.3", + "@img/sharp-libvips-linux-riscv64": "1.3.3", + "@img/sharp-libvips-linux-s390x": "1.3.3", + "@img/sharp-libvips-linux-x64": "1.3.3", + "@img/sharp-libvips-linuxmusl-arm64": "1.3.3", + "@img/sharp-libvips-linuxmusl-x64": "1.3.3", + "@img/sharp-linux-arm": "0.35.4", + "@img/sharp-linux-arm64": "0.35.4", + "@img/sharp-linux-ppc64": "0.35.4", + "@img/sharp-linux-riscv64": "0.35.4", + "@img/sharp-linux-s390x": "0.35.4", + "@img/sharp-linux-x64": "0.35.4", + "@img/sharp-linuxmusl-arm64": "0.35.4", + "@img/sharp-linuxmusl-x64": "0.35.4", + "@img/sharp-webcontainers-wasm32": "0.35.4", + "@img/sharp-win32-arm64": "0.35.4", + "@img/sharp-win32-ia32": "0.35.4", + "@img/sharp-win32-x64": "0.35.4" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/sharp/node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/sortablejs": { + "version": "1.15.7", + "resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.15.7.tgz", + "integrity": "sha512-Kk8wLQPlS+yi1ZEf48a4+fzHa4yxjC30M/Sr2AnQu+f/MPwvvX9XjZ6OWejiz8crBsLwSq8GHqaxaET7u6ux0A==", + "license": "MIT" + }, + "node_modules/source-map": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz", + "integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==", + "license": "BSD-3-Clause", + "engines": { + "node": ">= 12" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "devOptional": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "license": "ISC", + "engines": { + "node": ">= 10.x" + } + }, + "node_modules/srvx": { + "version": "0.11.22", + "resolved": "https://registry.npmjs.org/srvx/-/srvx-0.11.22.tgz", + "integrity": "sha512-LqZxxBDMKuMAZzFzJnDCkFOrs9MZQZr0LvHiO/SuSZVdQaXD7xQ5UWTUxheJrQPve1qk9MG2B/yttUvJxw8egQ==", + "license": "MIT", + "bin": { + "srvx": "bin/srvx.mjs" + }, + "engines": { + "node": ">=20.16.0" + } + }, + "node_modules/standardwebhooks": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/standardwebhooks/-/standardwebhooks-1.1.1.tgz", + "integrity": "sha512-bCbX9ZEyFkWPsRz7Bl3NuQUJohmwGSev/yhr7vhaGPlc4AfIrspIRa6cPTBuI1ItmrTDJ4d/S2hCsfe4+vQGnQ==", + "license": "MIT", + "dependencies": { + "@stablelib/base64": "^1.0.0", + "fast-sha256": "^1.3.0" + } + }, + "node_modules/supports-color": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-10.2.2.tgz", + "integrity": "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/tiny-invariant": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.2.0.tgz", + "integrity": "sha512-1Uhn/aqw5C6RI4KejVeTg6mIS7IqxnLJ8Mv2tV5rTc0qWobay7pDUz6Wi392Cnc8ak1H0F2cjoRzb2/AW4+Fvg==", + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/tsx": { + "version": "4.23.13", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.23.13.tgz", + "integrity": "sha512-BL5MGkRln6aDYhb0xbQlEAGw743BaZYWdbWtdJOBriYJboKgUUYCadFp2/FpBBZquBC/ezNBn7wMMPx7FDZUDw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.28.0" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/ufo": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.4.tgz", + "integrity": "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA==", + "license": "MIT" + }, + "node_modules/undici": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.29.0.tgz", + "integrity": "sha512-IDxfleLmmbSskfWSUATiN1nfn2rDuvnMOqb5CWR92iIfojA0Ud+ulOAAEQ57LPr9rWmsreUyf5lwyao+7GNNVw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.18.1" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/unenv": { + "version": "2.0.0-rc.24", + "resolved": "https://registry.npmjs.org/unenv/-/unenv-2.0.0-rc.24.tgz", + "integrity": "sha512-i7qRCmY42zmCwnYlh9H2SvLEypEFGye5iRmEMKjcGi7zk9UquigRjFtTLz0TYqr0ZGLZhaMHl/foy1bZR+Cwlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "pathe": "^2.0.3" + } + }, + "node_modules/unplugin": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-3.3.0.tgz", + "integrity": "sha512-qa66K+crbfyE6JK10GjvbJeRrOsuC/JpbnHctfyp/i4oBTxWOzJfRZyDiOk1PtErMFRu8JhsU/wPvOdBNWe5Rg==", + "license": "MIT", + "dependencies": { + "@jridgewell/remapping": "^2.3.5", + "picomatch": "^4.0.4", + "webpack-virtual-modules": "^0.6.2" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "peerDependencies": { + "@farmfe/core": "*", + "@rspack/core": "*", + "bun-types-no-globals": "*", + "esbuild": "*", + "rolldown": "*", + "rollup": "*", + "unloader": "*", + "vite": "*", + "webpack": "*" + }, + "peerDependenciesMeta": { + "@farmfe/core": { + "optional": true + }, + "@rspack/core": { + "optional": true + }, + "bun-types-no-globals": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "rolldown": { + "optional": true + }, + "rollup": { + "optional": true + }, + "unloader": { + "optional": true + }, + "vite": { + "optional": true + }, + "webpack": { + "optional": true + } + } + }, + "node_modules/unstorage": { + "version": "2.0.0-alpha.10", + "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-2.0.0-alpha.10.tgz", + "integrity": "sha512-6h1veZp8gnp4dGllf0tDijoXxDYymJu251IpKKkrSVH+QHL6tXFbwG85KM+CBHSgpkkgtPuIiZ9oLCLP5+1Evw==", + "dev": true, + "license": "MIT" + }, + "node_modules/update-browserslist-db": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.2.tgz", + "integrity": "sha512-UQ+MSxlhRm1bzjhU+DcuXfjFO1FzNtqhK5+9Yvlp90ItDLk5vT932A0rFu619nf7RVS+Y/VeaUW1jaRDqZ8VJw==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/use-callback-ref": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/use-callback-ref/-/use-callback-ref-1.3.3.tgz", + "integrity": "sha512-jQL3lRnocaFtu3V00JToYz/4QkNWswxijDaCVNZRiRTO3HQDLsdu1ZtmIUvV4yPp+rvWm5j0y0TG/S61cuijTg==", + "license": "MIT", + "dependencies": { + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/use-sidecar": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/use-sidecar/-/use-sidecar-1.1.3.tgz", + "integrity": "sha512-Fedw0aZvkhynoPYlA5WXrMCAMm+nSWdZt6lzJQ7Ok8S6Q+VsHmHpRWndVRJ8Be0ZbkfPc5LRYH+5XrzXcEeLRQ==", + "license": "MIT", + "dependencies": { + "detect-node-es": "^1.1.0", + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/use-sync-external-store": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz", + "integrity": "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/vite": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.2.2.tgz", + "integrity": "sha512-cFKLV/PRgAUlIRm5WjMjJ86jrftzpqcgH+Us+DS8mI3CDNiH30Whrz8uHL3+MOLPAgqbMBAqWdAHAphOAM+z/Q==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "lightningcss": "^1.33.0", + "picomatch": "^4.0.5", + "postcss": "^8.5.26", + "rolldown": "~1.2.4", + "tinyglobby": "^0.2.17" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.4.0 || ^0.5.0", + "esbuild": "^0.27.0 || ^0.28.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vitefu": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.3.tgz", + "integrity": "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg==", + "license": "MIT", + "workspaces": [ + "tests/deps/*", + "tests/projects/*", + "tests/projects/workspace/packages/*" + ], + "peerDependencies": { + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "vite": { + "optional": true + } + } + }, + "node_modules/webpack-virtual-modules": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.6.2.tgz", + "integrity": "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==", + "license": "MIT" + }, + "node_modules/workerd": { + "version": "1.20260911.1", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20260911.1.tgz", + "integrity": "sha512-vRr8QdBxueQOZJO1hRCI73EZlix87IAyBAcSyI3rA1VB+6oxjw3oaqzYnIV8C4IOPtUgihbdMAgzkb5GM4V7DQ==", + "dev": true, + "hasInstallScript": true, + "license": "Apache-2.0", + "bin": { + "workerd": "bin/workerd" + }, + "engines": { + "node": ">=16" + }, + "optionalDependencies": { + "@cloudflare/workerd-darwin-64": "1.20260911.1", + "@cloudflare/workerd-darwin-arm64": "1.20260911.1", + "@cloudflare/workerd-linux-64": "1.20260911.1", + "@cloudflare/workerd-linux-arm64": "1.20260911.1", + "@cloudflare/workerd-windows-64": "1.20260911.1" + } + }, + "node_modules/wrangler": { + "version": "4.131.1", + "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-4.131.1.tgz", + "integrity": "sha512-1u5FMdJAn6UOcL02cVsIITcnHrk6mC7N+RF10EkVhPL18R/o9g5BZb4PCjByL+3AsRP5wQpppCIPHhYPRmIJwg==", + "dev": true, + "license": "MIT OR Apache-2.0", + "dependencies": { + "@cloudflare/kv-asset-handler": "0.5.0", + "@cloudflare/unenv-preset": "2.16.1", + "blake3-wasm": "2.1.5", + "esbuild": "0.28.1", + "miniflare": "5.20260911.0-alpha", + "path-to-regexp": "6.3.0", + "unenv": "2.0.0-rc.24", + "workerd": "1.20260911.1" + }, + "bin": { + "cf-wrangler": "bin/cf-wrangler.js", + "wrangler": "bin/wrangler.js", + "wrangler2": "bin/wrangler.js" + }, + "engines": { + "node": ">=22.0.0" + }, + "optionalDependencies": { + "fsevents": "2.3.3" + }, + "peerDependencies": { + "@cloudflare/workers-types": "^5.20260911.1" + }, + "peerDependenciesMeta": { + "@cloudflare/workers-types": { + "optional": true + } + } + }, + "node_modules/wrangler/node_modules/@esbuild/aix-ppc64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz", + "integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/android-arm": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.1.tgz", + "integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/android-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz", + "integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/android-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.1.tgz", + "integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/darwin-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz", + "integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/darwin-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz", + "integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz", + "integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/freebsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz", + "integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/linux-arm": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz", + "integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/linux-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz", + "integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/linux-ia32": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz", + "integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/linux-loong64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz", + "integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/linux-mips64el": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz", + "integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/linux-ppc64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz", + "integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/linux-riscv64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz", + "integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/linux-s390x": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz", + "integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/linux-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.1.tgz", + "integrity": "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz", + "integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/netbsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz", + "integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz", + "integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/openbsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz", + "integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz", + "integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/sunos-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz", + "integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/win32-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz", + "integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/win32-ia32": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz", + "integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/@esbuild/win32-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz", + "integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/wrangler/node_modules/esbuild": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.1.tgz", + "integrity": "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "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" + } + }, + "node_modules/ws": { + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz", + "integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xmlbuilder2": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/xmlbuilder2/-/xmlbuilder2-4.0.3.tgz", + "integrity": "sha512-bx8Q1STctnNaaDymWnkfQLKofs0mGNN7rLLapJlGuV3VlvegD7Ls4ggMjE3aUSWItCCzU0PEv45lI87iSigiCA==", + "license": "MIT", + "dependencies": { + "@oozcitak/dom": "^2.0.2", + "@oozcitak/infra": "^2.0.2", + "@oozcitak/util": "^10.0.0", + "js-yaml": "^4.1.1" + }, + "engines": { + "node": ">=20.0" + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "license": "ISC" + }, + "node_modules/youch": { + "version": "4.1.0-beta.10", + "resolved": "https://registry.npmjs.org/youch/-/youch-4.1.0-beta.10.tgz", + "integrity": "sha512-rLfVLB4FgQneDr0dv1oddCVZmKjcJ6yX6mS4pU82Mq/Dt9a3cLZQ62pDBL4AUO+uVrCvtWz3ZFUL2HFAFJ/BXQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@poppinss/colors": "^4.1.5", + "@poppinss/dumper": "^0.6.4", + "@speed-highlight/core": "^1.2.7", + "cookie": "^1.0.2", + "youch-core": "^0.3.3" + } + }, + "node_modules/youch-core": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/youch-core/-/youch-core-0.3.3.tgz", + "integrity": "sha512-ho7XuGjLaJ2hWHoK8yFnsUGy2Y5uDpqSTq1FkHLK4/oqKtyUU1AFbOOxY4IpC9f0fTLjwYbslUz0Po5BpD1wrA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@poppinss/exception": "^1.2.2", + "error-stack-parser-es": "^1.0.5" + } + }, + "node_modules/zod": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.5.4.tgz", + "integrity": "sha512-sC95tT5iHHH9gtpj6A81kh+NEaRAUFN+qlUPDUbRfOMvNf5QCBqsb3WgvnpVtK5Y+4UfA6KqufotuTvMGiTlsA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + } +} diff --git a/applications/shortwave/package.json b/applications/shortwave/package.json new file mode 100644 index 00000000..2f96ae0d --- /dev/null +++ b/applications/shortwave/package.json @@ -0,0 +1,54 @@ +{ + "name": "shortwave", + "version": "0.1.0", + "private": true, + "type": "module", + "engines": { + "node": ">=22.12.0" + }, + "scripts": { + "dev": "node --env-file-if-exists=.env ./node_modules/vite/bin/vite.js --host 0.0.0.0 --port 4317 --strictPort", + "build": "vite build", + "start": "node --env-file-if-exists=.env .output/server/index.mjs", + "typecheck": "tsc --noEmit", + "test": "tsx --test tests/*.test.ts", + "test:integration": "RUN_INTEGRATION=1 tsx --test tests/*.test.ts", + "test:browser": "playwright test", + "events:flush": "tsx scripts/flush-events.ts", + "build:workers": "vite build --mode workers", + "dev:workers": "vite --mode workers --host 0.0.0.0 --port 4318 --strictPort", + "types:workers": "wrangler types --strict-vars false" + }, + "dependencies": { + "@clerk/tanstack-react-start": "^1.5.8", + "@clickhouse/click-ui": "^0.10.0", + "@clickhouse/client": "^1.12.1", + "@clickhouse/client-web": "^1.23.1", + "@tanstack/react-router": "^1.170.32", + "@tanstack/react-start": "^1.168.49", + "lucide-react": "^0.577.0", + "pg": "^8.16.3", + "qr-code-styling": "^1.9.2", + "react": "^19.2.8", + "react-dom": "^19.2.8", + "zod": "^4.3.6" + }, + "devDependencies": { + "@clerk/testing": "^2.2.33", + "@cloudflare/vite-plugin": "^1.54.8", + "@playwright/test": "^1.63.0", + "@types/node": "^22.19.0", + "@types/pg": "^8.16.0", + "@types/pngjs": "^6.0.5", + "@types/react": "^19.2.0", + "@types/react-dom": "^19.2.0", + "@vitejs/plugin-react": "^6.1.1", + "jsqr": "^1.4.0", + "nitro": "3.0.260903-beta", + "pngjs": "^7.0.0", + "tsx": "^4.21.0", + "typescript": "^5.9.3", + "vite": "^8.2.2", + "wrangler": "^4.131.1" + } +} diff --git a/applications/shortwave/playwright.config.ts b/applications/shortwave/playwright.config.ts new file mode 100644 index 00000000..37cbdaad --- /dev/null +++ b/applications/shortwave/playwright.config.ts @@ -0,0 +1,26 @@ +import { defineConfig } from "@playwright/test"; +import { loadEnvFile } from "node:process"; +try { + loadEnvFile(".env"); +} catch (error) { + if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error; +} + +export default defineConfig({ + testDir: "./tests/browser", + timeout: 120_000, + expect: { timeout: 15_000 }, + workers: 1, + fullyParallel: false, + use: { + baseURL: process.env.BROWSER_BASE_URL || "http://localhost:4317", + headless: true, + viewport: { width: 1440, height: 1000 }, + launchOptions: process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE + ? { executablePath: process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE } + : {}, + // Auth tokens must not be saved into traces or videos. + trace: "off", + video: "off", + }, +}); diff --git a/applications/shortwave/public/favicon.svg b/applications/shortwave/public/favicon.svg new file mode 100644 index 00000000..e88110da --- /dev/null +++ b/applications/shortwave/public/favicon.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/applications/shortwave/scripts/cleanup-hosted-smoke.ts b/applications/shortwave/scripts/cleanup-hosted-smoke.ts new file mode 100644 index 00000000..b52fe77a --- /dev/null +++ b/applications/shortwave/scripts/cleanup-hosted-smoke.ts @@ -0,0 +1,64 @@ +import { readFile } from "node:fs/promises"; +import { closeDatabases, getClickHouse, getPostgres } from "../src/server/db"; +import { loadSmokeEnvironment, smokeAccountId, smokeServices, receiptLinkIds } from "./hosted-smoke-config"; + +// Preview by default. Deletion is restricted to one private run receipt, an +// explicitly selected account, and matching service endpoints. CDC stays intact. +let stage = "configuration"; +try { + loadSmokeEnvironment(); + const accountId = smokeAccountId(); + const services = smokeServices(); + const apply = process.argv.includes("--apply"); + const receiptIndex = process.argv.indexOf("--receipt"); + const receiptPath = receiptIndex >= 0 ? process.argv[receiptIndex + 1] : undefined; + stage = "private fixture receipt validation"; + if (!receiptPath || !/^\.secrets\/[A-Za-z0-9_-]+\.json$/.test(receiptPath)) + throw new Error("Pass --receipt .secrets/.json"); + const ids = receiptLinkIds(JSON.parse(await readFile(receiptPath, "utf8")), accountId, services); + if (apply) { + if (!process.env.CLICKHOUSE_MIGRATION_USERNAME || !process.env.CLICKHOUSE_MIGRATION_PASSWORD) + throw new Error("Migration credentials required"); + process.env.CLICKHOUSE_USERNAME = process.env.CLICKHOUSE_MIGRATION_USERNAME; + process.env.CLICKHOUSE_PASSWORD = process.env.CLICKHOUSE_MIGRATION_PASSWORD; + } + if (!ids.length) { + console.log("Receipt contains no created links; no changes made."); + } else { + stage = "Postgres absence verification"; + const existing = await getPostgres().query("SELECT id FROM links WHERE id = ANY($1::uuid[])", [ids]); + if (existing.rows.length) throw new Error("A fixture link still exists in Postgres; remove it through the app first"); + const pending = await getPostgres().query( + "SELECT event_id FROM click_outbox WHERE account_id = $1 AND event->>'link_id' = ANY($2::text[]) LIMIT 1", + [accountId, ids], + ); + if (pending.rows.length) throw new Error("Fixture events still await delivery; wait before cleanup"); + const client = getClickHouse(); + const params = { account: accountId, links: ids }; + const countEvents = async () => { + const result = await client.query({ + query: "SELECT count() AS count FROM click_events WHERE account_id = {account:UUID} AND link_id IN {links:Array(UUID)}", + query_params: params, format: "JSONEachRow", + }); + return Number((await result.json<{ count: string }>())[0]!.count); + }; + const before = await countEvents(); + console.log(`Matched ${ids.length} deleted fixture links with ${before} ClickHouse event rows.`); + if (apply && before) { + stage = "scoped ClickHouse event cleanup"; + await client.command({ + query: "ALTER TABLE click_events DELETE WHERE account_id = {account:UUID} AND link_id IN {links:Array(UUID)}", + query_params: params, clickhouse_settings: { mutations_sync: "2" }, + }); + if (await countEvents() !== 0) throw new Error("Events still present after mutation"); + console.log("Receipt-scoped fixture events removed and absence verified."); + } else if (!apply) console.log("Preview complete. Add --apply with migration credentials to remove these fixture events."); + else console.log("Fixture events are already absent."); + } +} catch { + console.error(`Hosted smoke cleanup failed during ${stage}; verify the receipt, account and service configuration. Private database details omitted.`); + process.exitCode = 1; +} finally { + try { await closeDatabases(); } + catch { console.error("Database cleanup failed."); process.exitCode = 1; } +} diff --git a/applications/shortwave/scripts/flush-events.ts b/applications/shortwave/scripts/flush-events.ts new file mode 100644 index 00000000..74a5e6b1 --- /dev/null +++ b/applications/shortwave/scripts/flush-events.ts @@ -0,0 +1,36 @@ +import { loadEnvFile } from "node:process"; +import { setTimeout } from "node:timers/promises"; +import { flushOutbox } from "../src/server/service"; +import { closeDatabases } from "../src/server/db"; + +try { + loadEnvFile(".env"); +} catch (error) { + if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error; +} +const watch = process.argv.includes("--watch"); +let stopped = false; +process.on("SIGTERM", () => { + stopped = true; +}); +process.on("SIGINT", () => { + stopped = true; +}); +try { + do { + try { + const result = await flushOutbox(); + if (!watch || result.delivered || result.failed) + console.log(JSON.stringify(result)); + if (!watch && result.failed) process.exitCode = 1; + } catch { + console.error( + "Event delivery failed; durable events remain queued for retry.", + ); + if (!watch) process.exitCode = 1; + } + if (watch && !stopped) await setTimeout(2_000); + } while (watch && !stopped); +} finally { + await closeDatabases(); +} diff --git a/applications/shortwave/scripts/hosted-smoke-config.ts b/applications/shortwave/scripts/hosted-smoke-config.ts new file mode 100644 index 00000000..f36b6783 --- /dev/null +++ b/applications/shortwave/scripts/hosted-smoke-config.ts @@ -0,0 +1,49 @@ +import { loadEnvFile } from "node:process"; + +export const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/; + +export function loadSmokeEnvironment() { + try { loadEnvFile(".env"); } + catch (error) { if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error; } +} + +export function smokeAccountId(): string { + const account = process.env.SMOKE_ACCOUNT_ID; + if (!account || !uuidPattern.test(account)) + throw new Error("Set SMOKE_ACCOUNT_ID to the account UUID shown by your deployment."); + return account; +} + +export function httpsOrigin(name: string): string { + const value = process.env[name]; + if (!value) throw new Error(`Set ${name} to an HTTPS origin.`); + const url = new URL(value); + if (url.protocol !== "https:" || url.username || url.password || url.port || + url.pathname !== "/" || url.search || url.hash) + throw new Error(`${name} must be an HTTPS origin without credentials, path, or port.`); + return url.origin; +} + +// Bind private receipts to the target services as well as the fixture account. +export function smokeServices() { + const postgres = new URL(process.env.DATABASE_URL || ""); + const clickhouse = new URL(process.env.CLICKHOUSE_URL || ""); + return { + postgres: `${postgres.host}${postgres.pathname}`, + clickhouse: clickhouse.origin, + database: process.env.CLICKHOUSE_DATABASE || "default", + }; +} + +export function receiptLinkIds(value: unknown, accountId: string, services: ReturnType): string[] { + if (!value || typeof value !== "object") throw new Error("Invalid fixture receipt"); + const receipt = value as Record; + const recordedServices = receipt.services as Record | undefined; + if (receipt.kind !== "shortwave-hosted-smoke" || receipt.accountId !== accountId || + !recordedServices || Object.entries(services).some(([key, entry]) => recordedServices[key] !== entry) || + !Array.isArray(receipt.linkIds) || receipt.linkIds.length > 3 || + new Set(receipt.linkIds).size !== receipt.linkIds.length || + receipt.linkIds.some((id) => typeof id !== "string" || !uuidPattern.test(id))) + throw new Error("Receipt does not match this account and deployment"); + return receipt.linkIds as string[]; +} diff --git a/applications/shortwave/scripts/install-local-services.sh b/applications/shortwave/scripts/install-local-services.sh new file mode 100644 index 00000000..9288e5a7 --- /dev/null +++ b/applications/shortwave/scripts/install-local-services.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# Execute inside the development VM, through scripts/vm.sh run. +set -eu +if [ "$(uname -s)" != Linux ]; then echo 'Run this inside the isolated development VM.' >&2; exit 1; fi +project_dir=$(pwd) +mkdir -p "$HOME/.config/systemd/user" +cat > "$HOME/.config/systemd/user/shortwave-web.service" < "$HOME/.config/systemd/user/shortwave-events.service" <&2; exit 1; } +for tool in curl tar xz sha256sum awk; do + command -v "$tool" >/dev/null || { echo "Missing prerequisite: $tool" >&2; exit 1; } +done +case "$(uname -m)" in + aarch64) node_arch=arm64; cli_arch=aarch64 ;; + x86_64) node_arch=x64; cli_arch=x86_64 ;; + *) echo 'Supported architectures: aarch64 and x86_64.' >&2; exit 1 ;; +esac +node_version=22.23.2 +cli_version=0.4.2 +tools_dir="$HOME/.local/share/shortwave-tools" +bin_dir="$HOME/.local/bin" +mkdir -p "$tools_dir" "$bin_dir" +stage=$(mktemp -d) +trap 'rm -rf "$stage"' EXIT HUP INT TERM +cd "$stage" +node_archive="node-v${node_version}-linux-${node_arch}.tar.xz" +curl --fail --silent --show-error --location --retry 3 --max-time 180 \ + "https://nodejs.org/dist/v${node_version}/${node_archive}" -o "$node_archive" +curl --fail --silent --show-error --location --retry 3 --max-time 60 \ + "https://nodejs.org/dist/v${node_version}/SHASUMS256.txt" -o SHASUMS256.txt +awk -v file="$node_archive" '$2 == file {print}' SHASUMS256.txt > node.sha256 +[ -s node.sha256 ] || { echo 'Node checksum not found.' >&2; exit 1; } +sha256sum --check node.sha256 +tar -xJf "$node_archive" -C "$tools_dir" +cli_base="clickhousectl-${cli_arch}-unknown-linux-musl-v${cli_version}" +curl --fail --silent --show-error --location --retry 3 --max-time 180 \ + "https://builds.clickhouse.com/clickhousectl/${cli_base}.tar.gz" -o cli.tar.gz +tar -xzf cli.tar.gz -C "$tools_dir" +# Reject unexpected contents before linking any executable into PATH. +[ -x "$tools_dir/$cli_base/clickhousectl" ] || { echo 'Unexpected CLI archive layout.' >&2; exit 1; } +for tool in node npm npx; do + ln -sf "$tools_dir/node-v${node_version}-linux-${node_arch}/bin/$tool" "$bin_dir/$tool" +done +ln -sf "$tools_dir/$cli_base/clickhousectl" "$bin_dir/clickhousectl" +PATH="$bin_dir:$PATH" +export PATH +[ "$(node --version)" = "v${node_version}" ] || exit 1 +[ "$(clickhousectl --version)" = "clickhousectl ${cli_version}" ] || exit 1 +node --version +clickhousectl --version +echo 'Tools installed. Add $HOME/.local/bin to PATH in this terminal.' diff --git a/applications/shortwave/scripts/recover-hosted-smoke.ts b/applications/shortwave/scripts/recover-hosted-smoke.ts new file mode 100644 index 00000000..17540c03 --- /dev/null +++ b/applications/shortwave/scripts/recover-hosted-smoke.ts @@ -0,0 +1,73 @@ +import { mkdir, writeFile } from "node:fs/promises"; +import { randomUUID } from "node:crypto"; +import { closeDatabases, getClickHouse, getPostgres } from "../src/server/db"; +import { loadSmokeEnvironment, smokeAccountId, smokeServices } from "./hosted-smoke-config"; + +let stage = "configuration"; +try { + loadSmokeEnvironment(); + const accountId = smokeAccountId(); + const services = smokeServices(); + if (!process.env.CLICKHOUSE_MIGRATION_USERNAME || !process.env.CLICKHOUSE_MIGRATION_PASSWORD) + throw new Error("Read-only query-log inspection requires management credentials"); + process.env.CLICKHOUSE_USERNAME = process.env.CLICKHOUSE_MIGRATION_USERNAME; + process.env.CLICKHOUSE_PASSWORD = process.env.CLICKHOUSE_MIGRATION_PASSWORD; + const client = getClickHouse(); + stage = "query-log schema inspection"; + const schema = await client.query({ query: "DESCRIBE TABLE system.query_log", format: "JSONEachRow" }); + const hasParameters = (await schema.json<{ name: string }>()).some((row) => row.name === "query_parameters"); + stage = "exact smoke query lookup"; + const result = await client.query({ + query: `SELECT query${hasParameters ? ", query_parameters" : ""} FROM system.query_log + WHERE event_time >= now() - INTERVAL 2 DAY AND type = 'QueryFinish' + AND startsWith(query, 'SELECT link_id, uniqExact(event_id) AS clicks FROM click_events') + AND position(query, 'GROUP BY link_id') > 0 + AND position(query, 'link_id IN') > 0 + AND position(query, 'is_demo') = 0 + ORDER BY event_time DESC LIMIT 100`, + format: "JSONEachRow", + }); + const rows = await result.json<{ query: string; query_parameters?: Record }>(); + const uuidPattern = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/g; + const candidates = new Map(); + for (const row of rows) { + const parameters = row.query_parameters || {}; + const parameterAccount = parameters.account ?? parameters.param_account; + const parameterLinks = parameters.links ?? parameters.param_links; + let ids: string[] | undefined; + if (parameterAccount?.replace(/^'|'$/g, "") === accountId && parameterLinks) { + ids = parameterLinks.match(uuidPattern) || []; + if (parameterLinks.replace(uuidPattern, "").replace(/[\s,'"\[\]]/g, "")) continue; + } else { + // ClickHouse logs typed parameter substitution as _CAST literals. + // Recognize only the observed UUID and Array(UUID) forms. + const account = row.query.match(/account_id\s*=\s*_CAST\('([0-9a-f-]{36})',\s*'UUID'\)/)?.[1] + || row.query.match(/account_id\s*=\s*'([0-9a-f-]{36})'/)?.[1]; + const links = row.query.match(/link_id\s+IN\s+_CAST\(\[([^\]]+)\],\s*'Array\(UUID\)'\)/)?.[1] + || row.query.match(/link_id\s+IN\s*\[([^\]]+)\]/)?.[1]; + if (account !== accountId || !links) continue; + ids = links.match(uuidPattern) || []; + if (links.replace(uuidPattern, "").replace(/[\s,'"]/g, "")) continue; + } + if (ids.length !== 3 || new Set(ids).size !== 3) continue; + ids.sort(); + candidates.set(ids.join(","), ids); + } + console.log(`Found ${rows.length} exact smoke-query log rows and ${candidates.size} distinct recoverable fixture sets.`); + if (candidates.size === 1) { + const linkIds = [...candidates.values()][0]!; + stage = "Postgres absence verification"; + const live = await getPostgres().query("SELECT id FROM links WHERE id = ANY($1::uuid[])", [linkIds]); + if (live.rows.length) throw new Error("Recovered links still exist"); + await mkdir(".secrets", { recursive: true, mode: 0o700 }); + const path = `.secrets/recovered-hosted-smoke-${randomUUID()}.json`; + await writeFile(path, JSON.stringify({ kind: "shortwave-hosted-smoke", evidence: "exact-query-log-parameters", services, accountId, linkIds }, null, 2), { mode: 0o600 }); + console.log(`Recovered one exact fixture set, verified Postgres absence, and saved a private receipt at ${path}. No database data changed.`); + } else console.log("No unambiguous fixture receipt recovered. No database data changed."); +} catch { + console.error(`Bounded read-only fixture recovery failed during ${stage}; private query details omitted.`); + process.exitCode = 1; +} finally { + try { await closeDatabases(); } + catch { process.exitCode = 1; } +} diff --git a/applications/shortwave/scripts/test-hosted-domain.ts b/applications/shortwave/scripts/test-hosted-domain.ts new file mode 100644 index 00000000..b458abf9 --- /dev/null +++ b/applications/shortwave/scripts/test-hosted-domain.ts @@ -0,0 +1,173 @@ +import { randomUUID } from "node:crypto"; +import { mkdir, writeFile } from "node:fs/promises"; +import { setTimeout as delay } from "node:timers/promises"; +import { closeDatabases, getClickHouse, getPostgres } from "../src/server/db"; +import { createLink, updateLink } from "../src/server/service"; +import { getAnalytics } from "../src/server/analytics"; +import { httpsOrigin, loadSmokeEnvironment, smokeAccountId, smokeServices } from "./hosted-smoke-config"; + +// Run in the isolated development VM after deployment, with its local event +// worker stopped. No local flush is performed: delivery must come from Cron. +// Only temporary link IDs created by this invocation are deleted. ClickHouse +// fixture IDs are retained in a VM-private receipt for scoped ClickHouse cleanup. +class SmokeFailure extends Error {} +function check(condition: unknown, message: string): asserts condition { + if (!condition) throw new SmokeFailure(message); +} + +const linkIds: string[] = []; +let accountId: string | undefined; +let stage = "configuration"; + +async function request(origin: string, slug: string, method: "GET" | "HEAD", status: number, location?: string) { + const response = await fetch(`${origin}/r/${slug}`, { + method, + redirect: "manual", + headers: { "User-Agent": "ShortwaveHostedSmoke/1.0" }, + signal: AbortSignal.timeout(20_000), + }); + check(response.status === status, `${method} on ${new URL(origin).hostname}: expected ${status}, received ${response.status}.`); + check(response.headers.get("cache-control")?.includes("no-store"), "Redirect response must prohibit caching."); + if (location) check(response.headers.get("location") === location, "Redirect destination differs from the saved link."); + await response.arrayBuffer(); +} + +try { + loadSmokeEnvironment(); + const customOrigin = httpsOrigin("SMOKE_CUSTOM_ORIGIN"); + const appOrigin = httpsOrigin("APP_URL"); + check(customOrigin !== appOrigin, "The custom and application origins must differ."); + accountId = smokeAccountId(); + const hostname = new URL(customOrigin).hostname; + const services = smokeServices(); + const cdcDatabase = process.env.CLICKHOUSE_CDC_DATABASE || process.env.CLICKHOUSE_DATABASE || "default"; + check(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(cdcDatabase), "Invalid ClickPipes destination database."); + // The same hosting configuration is applied to local service calls which + // create fixtures; public requests still exercise the deployed Worker config. + process.env.APP_URL = appOrigin; + process.env.PUBLIC_CUSTOM_DOMAINS = hostname; + stage = "verified domain lookup"; + const owner = await getPostgres().query<{ id: string; account_id: string; clerk_user_id: string }>( + `SELECT d.id, d.account_id, a.clerk_user_id FROM custom_domains d + JOIN accounts a ON a.id = d.account_id + WHERE d.hostname = $1 AND d.account_id = $2 AND d.status = 'verified'`, [hostname, accountId], + ); + check(owner.rows.length === 1, "The requested account must own the verified custom domain before this test."); + const domain = owner.rows[0]!; + accountId = domain.account_id; + const slug = `smoke-${randomUUID()}`; + await mkdir(".secrets", { recursive: true, mode: 0o700 }); + const receiptPath = `.secrets/hosted-${slug}.json`; + const saveReceipt = () => writeFile(receiptPath, JSON.stringify({ + kind: "shortwave-hosted-smoke", services, accountId, domainId: domain.id, slug, linkIds, + }, null, 2), { mode: 0o600 }); + await saveReceipt(); + console.log(`Private fixture receipt: ${receiptPath}`); + const customDestination = "https://example.com/shortwave-hosted-custom"; + const editedDestination = "https://example.com/shortwave-hosted-edited"; + const defaultDestination = "https://example.com/shortwave-hosted-default"; + + stage = "temporary link creation"; + const custom = await createLink(domain.clerk_user_id, { + slug, domainId: domain.id, destination: customDestination, title: "Hosted domain smoke test", + }); + linkIds.push(custom.id); + await saveReceipt(); + const standard = await createLink(domain.clerk_user_id, { + slug, destination: defaultDestination, title: "Hosted default smoke test", + }); + linkIds.push(standard.id); + await saveReceipt(); + + stage = "HTTPS host-specific redirects"; + await request(customOrigin, slug, "GET", 302, customDestination); + await request(appOrigin, slug, "GET", 302, defaultDestination); + await request(customOrigin, slug, "HEAD", 302, customDestination); + await request(appOrigin, slug, "HEAD", 302, defaultDestination); + const customOnly = await createLink(domain.clerk_user_id, { + domainId: domain.id, destination: customDestination, title: "Hosted host-isolation smoke test", + }); + linkIds.push(customOnly.id); + await saveReceipt(); + await request(appOrigin, customOnly.slug, "GET", 404); + await request(customOrigin, customOnly.slug, "HEAD", 302, customDestination); + await request(customOrigin, `absent-${randomUUID()}`, "GET", 404); + console.log("HTTPS custom/default redirects, hostname isolation, missing links and HEAD passed."); + + stage = "immediate redirect edits and disable"; + await updateLink(domain.clerk_user_id, custom.id, { destination: editedDestination, domainId: domain.id, title: "Hosted domain smoke test" }); + await request(customOrigin, slug, "GET", 302, editedDestination); + await updateLink(domain.clerk_user_id, custom.id, { destination: editedDestination, enabled: false, title: "Hosted edited domain smoke test" }); + await request(customOrigin, slug, "GET", 410); + await request(customOrigin, slug, "HEAD", 410); + console.log("Destination edits and disabled-link responses passed."); + + stage = "scheduled outbox delivery"; + const deadline = Date.now() + 90_000; + let delivered = false; + do { + const pending = await getPostgres().query<{ count: number }>( + "SELECT count(*)::int AS count FROM click_outbox WHERE account_id = $1 AND event->>'link_id' = ANY($2::text[])", + [accountId, linkIds], + ); + if (pending.rows[0]!.count === 0) { + const result = await getClickHouse().query({ + query: `SELECT link_id, uniqExact(event_id) AS clicks FROM click_events + WHERE account_id = {account:UUID} AND link_id IN {links:Array(UUID)} + GROUP BY link_id`, + query_params: { account: accountId, links: linkIds }, + format: "JSONEachRow", + }); + const counts = new Map((await result.json<{ link_id: string; clicks: string | number }>()).map((row) => [row.link_id, Number(row.clicks)])); + if (counts.get(custom.id) === 2 && counts.get(standard.id) === 1 && !counts.has(customOnly.id)) { + delivered = true; + break; + } + check([...counts.values()].reduce((sum, count) => sum + count, 0) <= 3, "Unexpected extra redirect events, possibly from HEAD or disabled requests."); + } + if (Date.now() < deadline) await delay(3_000); + } while (Date.now() < deadline); + check(delivered, "Scheduled delivery did not produce exactly three expected ClickHouse events within 90 seconds."); + console.log("Scheduled outbox delivery and exact ClickHouse event attribution passed; HEAD/404/410 added no events."); + + stage = "analytics report"; + const report = await getAnalytics(domain.clerk_user_id, { linkId: custom.id }); + check(report.status !== "unavailable" && report.totalClicks === 2, "Custom-domain analytics did not report the two successful GET requests."); + console.log("Custom-domain analytics reported two clicks."); + + stage = "ClickPipes metadata convergence"; + const cdcDeadline = Date.now() + 120_000; + let metadataConverged = false; + do { + const result = await getClickHouse().query({ + query: `SELECT title FROM ${cdcDatabase}.cdc_links FINAL + WHERE account_id = {account:UUID} AND id = {link:UUID} AND _peerdb_is_deleted = 0`, + query_params: { account: accountId, link: custom.id }, format: "JSONEachRow", + }); + const rows = await result.json<{ title: string }>(); + if (rows.length === 1 && rows[0]!.title === "Hosted edited domain smoke test") { + metadataConverged = true; + break; + } + if (Date.now() < cdcDeadline) await delay(3_000); + } while (Date.now() < cdcDeadline); + check(metadataConverged, "ClickPipes did not replicate the edited metadata within 120 seconds."); + console.log("ClickPipes latest metadata matched the edited Postgres link."); +} catch (error) { + // Raw network/database errors may contain credentials or account data. + console.error(`Hosted domain smoke failed during ${stage}.${error instanceof SmokeFailure ? ` ${error.message}` : " Check the deployment configuration and service health."}`); + process.exitCode = 1; +} finally { + try { + if (accountId && linkIds.length) { + await getPostgres().query( + "DELETE FROM click_outbox WHERE account_id = $1 AND event->>'link_id' = ANY($2::text[])", [accountId, linkIds], + ); + await getPostgres().query("DELETE FROM links WHERE account_id = $1 AND id = ANY($2::uuid[])", [accountId, linkIds]); + console.log("Temporary Postgres links and remaining fixture outbox events removed."); + } + } catch { + console.error("Hosted smoke fixture cleanup failed; rerun scoped cleanup before handover."); + process.exitCode = 1; + } finally { await closeDatabases(); } +} diff --git a/applications/shortwave/scripts/verify-cdc.mjs b/applications/shortwave/scripts/verify-cdc.mjs new file mode 100644 index 00000000..277cf379 --- /dev/null +++ b/applications/shortwave/scripts/verify-cdc.mjs @@ -0,0 +1,155 @@ +#!/usr/bin/env node +// Run with --env-file=.deployment/runtime.env. Only synthetic fixture rows are +// changed; ClickPipes remains the sole writer of the CDC destination table. +import { randomBytes, randomUUID, createHash } from 'node:crypto'; +import { readFile, writeFile, mkdir, open, unlink } from 'node:fs/promises'; +import { resolve, relative, sep } from 'node:path'; +import { setTimeout as sleep } from 'node:timers/promises'; +import { Client } from 'pg'; +import { createClient, ClickHouseLogLevel } from '@clickhouse/client'; + +process.umask(0o077); +const directory = resolve('.deployment'); +const cleanupMode = process.argv[2] === '--cleanup'; +const snapshotMode = process.argv[2] === '--await-snapshot'; +if (process.argv.length > 2 && !(cleanupMode && process.argv[3] && process.argv.length === 4) && !(snapshotMode && process.argv.length === 3)) { + console.error('Usage: node --env-file=.deployment/runtime.env scripts/verify-cdc.mjs [--cleanup .deployment/RECEIPT.json | --await-snapshot]'); + process.exit(1); +} +let receiptPath; +let receipt; +let postgres; +let clickhouse; +let sourceFingerprint; +let snapshotLock; + +async function save() { + await writeFile(receiptPath, `${JSON.stringify(receipt, null, 2)}\n`, { mode: 0o600 }); +} +async function cleanup() { + if (!postgres || !receipt) return; + if (receipt.sourceFingerprint !== sourceFingerprint) throw new Error('Runtime environment does not match the recorded source database'); + const owned = (await postgres.query('SELECT id FROM accounts WHERE id = $1 AND clerk_user_id = $2', [receipt.accountId, receipt.marker])).rows.length; + if (owned) { + await postgres.query('BEGIN'); + try { + await postgres.query('DELETE FROM links WHERE id = $1 AND account_id = $2', [receipt.linkId, receipt.accountId]); + await postgres.query('DELETE FROM accounts WHERE id = $1 AND clerk_user_id = $2', [receipt.accountId, receipt.marker]); + await postgres.query('COMMIT'); + } catch (error) { await postgres.query('ROLLBACK'); throw error; } + } + receipt.sourceCleanedAt = new Date().toISOString(); + await save(); +} + +async function awaitSnapshot() { + // The operator runs clickhousectl resync separately, after this fixture is ready. + const database = process.env.CLICKHOUSE_CDC_DATABASE; + const tableUuid = async () => { + const result = await clickhouse.query({ query: 'SELECT uuid FROM system.tables WHERE database = {database:String} AND name = {table:String}', query_params: { database, table: 'cdc_links' }, format: 'JSONEachRow' }); + const rows = await result.json(); + if (rows.length !== 1) throw new Error('CDC destination table is missing'); + return rows[0].uuid; + }; + const previousUuid = await tableUuid(); + receipt.snapshotWaitStartedAt = new Date().toISOString(); + await save(); + console.log('Snapshot fixture ready. Run the documented clickhousectl resync command for this disposable deployment in another terminal.'); + // A row in the old destination could be CDC from before resync. Require the + // documented atomic swap of the snapshot table (a different table UUID) + // before claiming that the populated snapshot was verified. + const until = Date.now() + 600_000; + while (Date.now() < until) { + if (await tableUuid() !== previousUuid) { + receipt.passed.push('Snapshot destination atomically replaced'); + await save(); + console.log('Snapshot destination atomically replaced: passed'); + return; + } + await sleep(5_000); + } + throw new Error('Snapshot destination did not swap within ten minutes'); +} +async function awaitCdc(label, matches) { + const database = process.env.CLICKHOUSE_CDC_DATABASE; + if (!database || !/^[a-z_][a-z_0-9]*$/i.test(database)) throw new Error('Configure CLICKHOUSE_CDC_DATABASE'); + const until = Date.now() + 180_000; + while (Date.now() < until) { + const result = await clickhouse.query({ + query: `SELECT account_id, revision, title, destination, resolved_url, tags, _peerdb_is_deleted FROM ${database}.cdc_links FINAL WHERE id = {id:UUID}`, + query_params: { id: receipt.linkId }, format: 'JSONEachRow', + }); + const rows = await result.json(); + if (rows.length === 1 && matches(rows[0])) { + receipt.passed.push(label); + await save(); + console.log(`${label}: passed`); + return; + } + await sleep(5_000); + } + throw new Error(`${label} did not converge within three minutes`); +} + +try { + if (!process.env.DATABASE_URL || !process.env.PG_CA_CERT_PATH || !process.env.CLICKHOUSE_URL || !process.env.CLICKHOUSE_USERNAME || !process.env.CLICKHOUSE_PASSWORD) throw new Error('Load runtime.env before running CDC verification'); + await mkdir(directory, { recursive: true, mode: 0o700 }); + if (snapshotMode) { + snapshotLock = await open(resolve(directory, 'cdc-snapshot.lock'), 'wx', 0o600); + await snapshotLock.writeFile(`${process.pid}\n`); + } + if (cleanupMode) { + receiptPath = resolve(process.argv[3]); + const local = relative(directory, receiptPath); + if (!local || local === '..' || local.startsWith(`..${sep}`)) throw new Error('Cleanup receipt must be inside .deployment'); + receipt = JSON.parse(await readFile(receiptPath, 'utf8')); + const uuid = /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i; + if (receipt.kind !== 'shortwave-cdc-verification' || !uuid.test(receipt.runId) || !uuid.test(receipt.accountId) || !uuid.test(receipt.linkId) || receipt.marker !== `__shortwave_cdc_check_${receipt.runId}`) throw new Error('Invalid CDC cleanup receipt'); + } else { + const runId = randomUUID(); + receipt = { kind: 'shortwave-cdc-verification', runId, accountId: randomUUID(), linkId: randomUUID(), marker: `__shortwave_cdc_check_${runId}`, startedAt: new Date().toISOString(), passed: [] }; + receiptPath = resolve(directory, `cdc-${runId}.json`); + await save(); + } + const connection = new URL(process.env.DATABASE_URL); + connection.search = ''; + sourceFingerprint = createHash('sha256').update(`${connection.hostname}:${connection.port || '5432'}${connection.pathname}`).digest('hex'); + if (!cleanupMode) { receipt.sourceFingerprint = sourceFingerprint; await save(); } + else if (receipt.sourceFingerprint !== sourceFingerprint) throw new Error('Runtime environment does not match the recorded source database'); + postgres = new Client({ connectionString: connection.toString(), ssl: { ca: await readFile(process.env.PG_CA_CERT_PATH, 'utf8'), rejectUnauthorized: true }, connectionTimeoutMillis: 15_000, statement_timeout: 30_000 }); + await postgres.connect(); + if (cleanupMode) { + await cleanup(); + console.log('Recorded CDC source fixture cleaned.'); + } else { + clickhouse = createClient({ url: process.env.CLICKHOUSE_URL, username: process.env.CLICKHOUSE_USERNAME, password: process.env.CLICKHOUSE_PASSWORD, log: { level: ClickHouseLogLevel.OFF }, request_timeout: 30_000 }); + // High-entropy values exceed a Postgres page even after compression, + // requiring TOAST storage. Updating other fields must preserve both URLs. + const destination = `https://example.com/cdc-check?data=${randomBytes(16_384).toString('base64url')}`; + await postgres.query('BEGIN'); + try { + await postgres.query('INSERT INTO accounts(id, clerk_user_id) VALUES ($1, $2)', [receipt.accountId, receipt.marker]); + await postgres.query('INSERT INTO links(id, account_id, slug, title, destination, resolved_url, tags) VALUES ($1, $2, $3, $4, $5, $5, $6)', [receipt.linkId, receipt.accountId, `cdc_${randomBytes(12).toString('hex')}`, 'CDC verification', destination, ['cdc-before', 'shared']]); + await postgres.query('COMMIT'); + } catch (error) { await postgres.query('ROLLBACK'); throw error; } + if (snapshotMode) await awaitSnapshot(); + await awaitCdc(snapshotMode ? 'Populated snapshot' : 'CDC insert', row => row.account_id === receipt.accountId && Number(row.revision) === 1 && Number(row._peerdb_is_deleted) === 0 && row.destination === destination && row.resolved_url === destination && JSON.stringify(row.tags) === JSON.stringify(['cdc-before', 'shared'])); + await postgres.query('UPDATE links SET title = $1, tags = $2, revision = revision + 1, updated_at = now() WHERE id = $3 AND account_id = $4', ['CDC verification updated', ['cdc-after', 'shared'], receipt.linkId, receipt.accountId]); + await awaitCdc('CDC update preserves unchanged TOAST and replaces tags', row => row.account_id === receipt.accountId && Number(row.revision) === 2 && Number(row._peerdb_is_deleted) === 0 && row.title === 'CDC verification updated' && row.destination === destination && row.resolved_url === destination && JSON.stringify(row.tags) === JSON.stringify(['cdc-after', 'shared'])); + await postgres.query('DELETE FROM links WHERE id = $1 AND account_id = $2', [receipt.linkId, receipt.accountId]); + await awaitCdc('CDC delete tombstone', row => Number(row._peerdb_is_deleted) === 1); + await cleanup(); + receipt.completedAt = new Date().toISOString(); + await save(); + console.log('CDC verification passed; the source account and link were removed. A synthetic destination tombstone remains.'); + } +} catch (error) { + if (receipt) { receipt.failureCode = typeof error.code === 'string' ? error.code : 'verification_failed'; await save().catch(() => {}); } + console.error('CDC verification failed. The private receipt records the completed assertions and identifies only this fixture for cleanup.'); + try { await cleanup(); } catch { console.error('Source cleanup remains pending; run again with --cleanup and the private receipt.'); } + process.exitCode = 1; +} finally { + await Promise.allSettled([postgres?.end(), clickhouse?.close()]); + if (snapshotLock) { await snapshotLock.close(); await unlink(resolve(directory, 'cdc-snapshot.lock')); } + if (receiptPath) console.log(`Private receipt: ${receiptPath}`); +} diff --git a/applications/shortwave/scripts/vm.sh b/applications/shortwave/scripts/vm.sh new file mode 100644 index 00000000..71ac237e --- /dev/null +++ b/applications/shortwave/scripts/vm.sh @@ -0,0 +1,60 @@ +#!/bin/sh +# Host-side OrbStack management only. Application commands execute in the VM. +set -eu +cd "$(dirname "$0")/.." +machine=link-shortener-dev +case "${1:-}" in + push|pull-generated|run) ;; + *) echo 'Usage: sh scripts/vm.sh push | pull-generated | run [args...]' >&2; exit 2 ;; +esac +# Fail closed if this VM is absent, isolation is disabled, or the CLI schema +# changes. Creating/configuring a VM is an explicit prerequisite in AGENTS.md. +command -v jq >/dev/null 2>&1 || { echo 'Install jq to verify OrbStack isolation.' >&2; exit 1; } +info=$(orb info "$machine" --format json) +if ! printf '%s\n' "$info" | jq -e ' + .record.config.isolated == true and + .record.config.isolate_network == true and + .record.config.forward_ssh_agent == false +' >/dev/null; then + echo 'Refusing to use a VM without verified host/network isolation and disabled SSH-agent forwarding.' >&2 + exit 1 +fi +vm_home=$(orb -m "$machine" -w /home sh -lc 'printf "%s" "$HOME"') +case "$vm_home" in + /home/*|/root) ;; + *) echo 'Unexpected VM home directory; refusing to transfer source.' >&2; exit 1 ;; +esac +project="$vm_home/link-shortener" +orb -m "$machine" -w /home mkdir -p "$project" +case "$1" in + push) + # Stage the archive first so tar failure cannot be hidden by a successful + # receiver. Public templates are included; private state never crosses. + archive=$(mktemp "${TMPDIR:-/tmp}/shortwave-source.XXXXXXXX") + trap 'rm -f "$archive"' EXIT HUP INT TERM + COPYFILE_DISABLE=1 tar --no-xattrs --exclude=.git --exclude='.env*' \ + --exclude=.secrets --exclude=.private --exclude='.deployment*' --exclude=.clickhouse --exclude='*.pem' --exclude=.wrangler \ + --exclude='.dev.vars*' --exclude=node_modules --exclude=.output \ + --exclude=dist --exclude=.tanstack --exclude=.vite --exclude=coverage \ + --exclude=test-results --exclude=playwright-report --exclude=playwright \ + --exclude='*.log' --exclude='._*' -cf "$archive" . + COPYFILE_DISABLE=1 tar --no-xattrs -rf "$archive" .env.example + orb -m "$machine" -w "$project" tar -xf - < "$archive" + ;; + pull-generated) + # Lockfile and router source are reviewable; no build products or credentials. + # Stage both before replacing local files so a failed read cannot truncate. + generated=$(mktemp -d "${TMPDIR:-/tmp}/shortwave-generated.XXXXXXXX") + trap 'rm -rf "$generated"' EXIT HUP INT TERM + orb -m "$machine" -w "$project" cat package-lock.json > "$generated/package-lock.json" + orb -m "$machine" -w "$project" cat src/routeTree.gen.ts > "$generated/routeTree.gen.ts" + mv "$generated/package-lock.json" package-lock.json + mv "$generated/routeTree.gen.ts" src/routeTree.gen.ts + ;; + run) + shift + [ "$#" -gt 0 ] || { echo 'run requires a command.' >&2; exit 2; } + exec orb -m "$machine" -w "$project" env \ + PATH="$vm_home/.local/bin:/usr/local/bin:/usr/bin:/bin" "$@" + ;; +esac diff --git a/applications/shortwave/scripts/workers-connectivity-check.ts b/applications/shortwave/scripts/workers-connectivity-check.ts new file mode 100644 index 00000000..a96bf490 --- /dev/null +++ b/applications/shortwave/scripts/workers-connectivity-check.ts @@ -0,0 +1,51 @@ +// Optional diagnostic Worker. Deploy under a distinct name with no routes/cron. +// Its only database operations are SELECT 1 using application runtime drivers. +import { getClickHouse, getPostgres } from "../src/server/db"; +import { closeWorkersRuntime, createWorkersRuntime, runWorkersRuntime } from "../src/server/runtime"; + +type DiagnosticEnv = Env & { DIAGNOSTIC_TOKEN: string }; +type Stage = { stage: "postgres" | "clickhouse" | "close"; ok: boolean }; + +export default { + async fetch(request: Request, env: DiagnosticEnv) { + if (!env.DIAGNOSTIC_TOKEN || request.method !== "GET" || + request.headers.get("authorization") !== `Bearer ${env.DIAGNOSTIC_TOKEN}`) { + return new Response("Unauthorized", { status: 401, headers: { "Cache-Control": "no-store" } }); + } + const port = new URL(request.url).searchParams.get("port"); + if (port !== null && port !== "443") return new Response("Invalid port", { status: 400 }); + if (port === "443") { + try { + const url = new URL(env.CLICKHOUSE_URL); + url.port = "443"; + env = { ...env, CLICKHOUSE_URL: url.toString() }; + } catch { + return Response.json({ stages: [{ stage: "clickhouse", ok: false }] }, { status: 503 }); + } + } + const runtime = createWorkersRuntime(env); + return runWorkersRuntime(runtime, async () => { + const stages: Stage[] = []; + try { + try { + await getPostgres().query("SELECT 1 AS ok"); + stages.push({ stage: "postgres", ok: true }); + } catch { stages.push({ stage: "postgres", ok: false }); } + try { + const result = await getClickHouse().query({ query: "SELECT 1 AS ok", format: "JSONEachRow" }); + await result.json(); + stages.push({ stage: "clickhouse", ok: true }); + } catch { stages.push({ stage: "clickhouse", ok: false }); } + } finally { + try { + await closeWorkersRuntime(runtime); + stages.push({ stage: "close", ok: true }); + } catch { stages.push({ stage: "close", ok: false }); } + } + return Response.json({ stages }, { + status: stages.every(stage => stage.ok) ? 200 : 503, + headers: { "Cache-Control": "no-store" }, + }); + }); + }, +} satisfies ExportedHandler; diff --git a/applications/shortwave/scripts/workers-preview-smoke.ts b/applications/shortwave/scripts/workers-preview-smoke.ts new file mode 100644 index 00000000..c67db236 --- /dev/null +++ b/applications/shortwave/scripts/workers-preview-smoke.ts @@ -0,0 +1,41 @@ +// Local workerd smoke entrypoint. Run with a temporary Wrangler configuration; +// this script is not imported by or deployed with the application Worker. +import { readWorkersPublicResource, resolveWorkersPreviewAddresses } from "../src/server/preview-workers"; +import { parsePreviewMetadata } from "../src/server/preview"; +import { checkDomainTxt } from "../src/server/custom-domains"; +import { createWorkersRuntime, runWorkersRuntime } from "../src/server/runtime"; + +export default { + async fetch(_request: Request, env: Env) { + return runWorkersRuntime(createWorkersRuntime(env), async () => { + const results: Record = {}; + results.dnsOwnership = await checkDomainTxt("_shortwave-verification.example.com", "smoke-nonmatching-value"); + results.googleAddresses = await resolveWorkersPreviewAddresses("www.google.com"); + results.badsslAddresses = await resolveWorkersPreviewAddresses("wrong.host.badssl.com"); + for (const [name, url] of [ + ["publicHttps", "https://www.google.com/"], + ["wrongCertificate", "https://wrong.host.badssl.com/"], + ["privateIp", "http://127.0.0.1/"], + ]) { + try { + const page = await readWorkersPublicResource(url, "html", Date.now() + 10_000, { + fetch: async (target, options) => { + const response = await globalThis.fetch(target, options); + results[`${name}Http`] = { + status: response.status, + type: response.headers.get("content-type"), + length: response.headers.get("content-length"), + server: response.headers.get("server"), + }; + return response; + }, + }); + results[name] = { status: "ready", title: parsePreviewMetadata(page.body.toString("utf8"), page.url).title }; + } catch (error) { + results[name] = { status: "rejected", message: error instanceof Error ? error.message : "Preview failed" }; + } + } + return Response.json(results); + }); + }, +}; diff --git a/applications/shortwave/scripts/workers-runtime-smoke.ts b/applications/shortwave/scripts/workers-runtime-smoke.ts new file mode 100644 index 00000000..c3b4d6fa --- /dev/null +++ b/applications/shortwave/scripts/workers-runtime-smoke.ts @@ -0,0 +1,74 @@ +import { getClickHouse, getPostgres } from "../src/server/db"; +import { closeWorkersRuntime, createWorkersRuntime, runWorkersRuntime, runtimeEnvironment } from "../src/server/runtime"; + +type SafeError = { name: string; code?: string; message: string; detail?: string; cause?: SafeError }; + +function safeError(error: unknown, depth = 0): SafeError { + const value = error && typeof error === "object" ? error as Record : {}; + const source = typeof value.message === "string" ? value.message : ""; + // Classify private error text without returning it, URLs, stacks, headers, + // queries, binding values or arbitrary driver error properties. + const categories: [RegExp, string][] = [ + [/not configured/i, "Required runtime configuration is missing."], + [/authentication|password|unauthorized|access denied/i, "Database authentication or authorization failed."], + [/certificate|tls|ssl/i, "TLS or certificate validation failed."], + [/timeout|timed out|deadline/i, "The database request timed out."], + [/dns|enotfound|getaddrinfo/i, "Hostname resolution failed."], + [/fetch failed|network|connection|socket|econn/i, "A network or connection request failed."], + [/not implemented|not supported|unsupported/i, "The runtime does not support a required operation."], + [/undefined|not a function|not defined/i, "A required runtime API or value is unavailable."], + [/json|parse|unexpected token/i, "The response could not be parsed."], + [/permission|forbidden/i, "The operation was forbidden."], + [/database.*not exist|unknown database/i, "The configured database does not exist."], + [/cannot.*read|cannot.*convert/i, "The client could not read or convert a runtime value."], + ]; + const names = ["Error", "TypeError", "RangeError", "ReferenceError", "SyntaxError", "AbortError", "TimeoutError", "ClickHouseError", "DatabaseError"]; + const codes = ["ECONNREFUSED", "ECONNRESET", "ETIMEDOUT", "ENOTFOUND", "EAI_AGAIN", "ENETUNREACH", "EHOSTUNREACH", "UND_ERR_CONNECT_TIMEOUT", "CERT_HAS_EXPIRED", "ERR_TLS_CERT_ALTNAME_INVALID"]; + const code = String(value.code ?? ""); + const result: SafeError = { + name: typeof value.name === "string" && names.includes(value.name) ? value.name : "Error", + message: categories.find(([pattern]) => pattern.test(source))?.[1] ?? "Database runtime operation failed; private error details omitted.", + }; + if (codes.includes(code) || /^\d{1,5}$/.test(code)) result.code = code; + if (value.cause && depth < 2) result.cause = safeError(value.cause, depth + 1); + // This diagnostic issues only SELECT 1. Redact all runtime values and network + // addresses before returning the bounded driver diagnostic. + let detail = source; + for (const key of ["CLICKHOUSE_URL", "CLICKHOUSE_USERNAME", "CLICKHOUSE_PASSWORD", "CLICKHOUSE_DATABASE", "CLICKHOUSE_CDC_DATABASE", "CLERK_SECRET_KEY"]) { + const secret = runtimeEnvironment(key); + if (secret) detail = detail.replaceAll(secret, "[redacted]"); + } + result.detail = detail.replace(/https?:\/\/\S+/g, "[url]").replace(/[\w.-]+\.clickhouse\.cloud/gi, "[host]").slice(0, 500); + return result; +} + +export default { + async fetch(request, env) { + if (new URL(request.url).searchParams.get("port") === "443") { + const url = new URL(env.CLICKHOUSE_URL); + url.port = "443"; + env = { ...env, CLICKHOUSE_URL: url.toString() }; + } + const runtime = createWorkersRuntime(env); + return runWorkersRuntime(runtime, async () => { + const stages: { stage: string; ok: boolean; error?: SafeError }[] = []; + try { + try { + await getPostgres().query("SELECT 1 AS ok"); + stages.push({ stage: "postgres", ok: true }); + } catch (error) { stages.push({ stage: "postgres", ok: false, error: safeError(error) }); } + try { + const result = await getClickHouse().query({ query: "SELECT 1 AS ok", format: "JSONEachRow" }); + await result.json(); + stages.push({ stage: "clickhouse", ok: true }); + } catch (error) { stages.push({ stage: "clickhouse", ok: false, error: safeError(error) }); } + } finally { + try { + await closeWorkersRuntime(runtime); + stages.push({ stage: "close", ok: true }); + } catch (error) { stages.push({ stage: "close", ok: false, error: safeError(error) }); } + } + return Response.json({ stages }, { status: stages.every((stage) => stage.ok) ? 200 : 503, headers: { "Cache-Control": "no-store" } }); + }); + }, +} satisfies ExportedHandler; diff --git a/applications/shortwave/scripts/wrangler-preview-smoke.jsonc b/applications/shortwave/scripts/wrangler-preview-smoke.jsonc new file mode 100644 index 00000000..b6714436 --- /dev/null +++ b/applications/shortwave/scripts/wrangler-preview-smoke.jsonc @@ -0,0 +1,6 @@ +{ + "name": "shortwave-preview-local-smoke", + "main": "workers-preview-smoke.ts", + "compatibility_date": "2026-09-06", + "compatibility_flags": ["nodejs_compat", "global_fetch_strictly_public"] +} diff --git a/applications/shortwave/src/components/app-select.css b/applications/shortwave/src/components/app-select.css new file mode 100644 index 00000000..f4a3c3d3 --- /dev/null +++ b/applications/shortwave/src/components/app-select.css @@ -0,0 +1,16 @@ +.app-select { position: relative; min-width: 0; } +.app-select-trigger { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 41px; padding: 10px 12px; border: 1px solid #383d45; border-radius: 6px; background: #191b1f; color: #d4d6dd; font: inherit; text-align: left; } +.app-select-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.app-select-icon { display: inline-flex; align-items: center; flex-shrink: 0; } +.app-select-trigger > svg { flex-shrink: 0; } +.app-select-trigger[aria-expanded="true"] { border-color: var(--yellow); } +.app-select-trigger:disabled { cursor: not-allowed; opacity: .55; } +.app-select-options { position: absolute; z-index: 25; top: calc(100% + 6px); left: 0; width: 100%; margin: 0; padding: 4px; list-style: none; overflow-y: auto; overscroll-behavior: contain; border: 1px solid #484b54; border-radius: 8px; background: #23252b; box-shadow: 0 10px 28px #0008; color: #e4e6eb; font-size: 12px; } +.app-select-options-above { top: auto; bottom: calc(100% + 6px); } +.app-select-options > li { display: grid; grid-template-columns: minmax(0, 1fr) 15px; align-items: center; column-gap: 12px; min-height: 36px; padding: 8px 10px; border-radius: 4px; cursor: pointer; } +.app-select-options > li > span { min-width: 0; white-space: normal; overflow-wrap: break-word; word-break: normal; } +.app-select-options > li > svg { flex-shrink: 0; } +.app-select-options > li[data-active="true"] { background: var(--yellow-muted); color: var(--yellow); } +.analytics-filters > .app-select { max-width: 230px; min-width: 130px; } +.analytics-filters .app-select-trigger { min-height: 39px; font-size: 11px; } +@media (max-width: 600px) { .analytics-filters > .app-select { flex: 1 1 calc(50% - 10px); max-width: none; } } diff --git a/applications/shortwave/src/components/app-select.tsx b/applications/shortwave/src/components/app-select.tsx new file mode 100644 index 00000000..b8bfd792 --- /dev/null +++ b/applications/shortwave/src/components/app-select.tsx @@ -0,0 +1,196 @@ +import { useEffect, useId, useLayoutEffect, useRef, useState, type ReactNode } from "react"; +import { Check, ChevronDown } from "lucide-react"; +import "./app-select.css"; + +type Option = { value: string; label: string }; +type Placement = { above: boolean; maxHeight: number; visible: boolean }; + +/** Select-only combobox. Focus remains on its trigger, including inside dialogs. */ +export function AppSelect({ + value, onValueChange, options, id, disabled, className = "", name, icon, + "aria-label": ariaLabel, +}: { + value: string; + onValueChange: (value: string) => void; + options: Option[]; + id?: string; + "aria-label"?: string; + disabled?: boolean; + className?: string; + name?: string; + icon?: ReactNode; +}) { + const generatedId = useId(); + const triggerId = id || generatedId; + const root = useRef(null); + const trigger = useRef(null); + const list = useRef(null); + const search = useRef({ value: "", at: 0 }); + const [open, setOpen] = useState(false); + const [active, setActive] = useState(0); + const [placement, setPlacement] = useState({ above: false, maxHeight: 220, visible: false }); + const selected = options.findIndex((option) => option.value === value); + const expanded = open && placement.visible && !disabled; + + function show(index = Math.max(0, selected)) { + if (disabled || !options.length) return; + search.current = { value: "", at: 0 }; + setActive(index); + setOpen(true); + } + function choose(index: number) { + if (options[index]) onValueChange(options[index].value); + setOpen(false); + trigger.current?.focus(); + } + + useEffect(() => { + if (!open) return; + const outside = (event: PointerEvent) => { + if (!root.current?.contains(event.target as Node)) setOpen(false); + }; + document.addEventListener("pointerdown", outside); + return () => document.removeEventListener("pointerdown", outside); + }, [open]); + + useLayoutEffect(() => { + if (!open || !trigger.current) return; + const target = trigger.current; + const dialog = target.closest("dialog"); + const popup = target.closest(".utm-popup"); + const footer = dialog?.querySelector(".modal-actions"); + const heading = dialog?.querySelector(".modal-heading"); + const viewport = window.visualViewport; + function position() { + const rect = target.getBoundingClientRect(); + const bounds = dialog?.getBoundingClientRect(); + const popupBounds = popup?.getBoundingClientRect(); + const viewportTop = viewport?.offsetTop ?? 0; + const viewportBottom = viewportTop + (viewport?.height ?? window.innerHeight); + const top = Math.max(viewportTop, bounds?.top ?? 0, heading?.getBoundingClientRect().bottom ?? 0, popupBounds?.top ?? 0) + 8; + const bottom = Math.min(viewportBottom, bounds?.bottom ?? Infinity, popupBounds?.bottom ?? Infinity, + footer && !footer.contains(target) ? footer.getBoundingClientRect().top : Infinity) - 8; + const below = Math.max(0, bottom - rect.bottom - 6); + const above = Math.max(0, rect.top - top - 6); + const desired = Math.min(220, options.length * 36 + 10); + const placeAbove = below < desired && above > below; + const maxHeight = Math.floor(Math.min(desired, placeAbove ? above : below)); + const visible = rect.top >= top && rect.bottom <= bottom && maxHeight >= 36; + // Dismiss if scrolling hides the anchor; an invisible menu must not commit a choice. + if (!visible) setOpen(false); + setPlacement((current) => current.above === placeAbove && current.maxHeight === maxHeight && current.visible === visible + ? current : { above: placeAbove, maxHeight, visible }); + } + position(); + const observer = new ResizeObserver(position); + observer.observe(target); + if (dialog) observer.observe(dialog); + if (popup) observer.observe(popup); + window.addEventListener("scroll", position, true); + window.addEventListener("resize", position); + viewport?.addEventListener("resize", position); + viewport?.addEventListener("scroll", position); + return () => { + observer.disconnect(); + window.removeEventListener("scroll", position, true); + window.removeEventListener("resize", position); + viewport?.removeEventListener("resize", position); + viewport?.removeEventListener("scroll", position); + }; + }, [open, options.length]); + + useLayoutEffect(() => { + const menu = list.current; + const option = menu?.children[active] as HTMLElement | undefined; + if (!expanded || !menu || !option) return; + // Keep scrolling local to the menu, avoiding jumps in the enclosing dialog. + if (option.offsetTop < menu.scrollTop) menu.scrollTop = option.offsetTop; + else if (option.offsetTop + option.offsetHeight > menu.scrollTop + menu.clientHeight) { + menu.scrollTop = option.offsetTop + option.offsetHeight - menu.clientHeight; + } + }, [active, expanded, placement.maxHeight]); + + return ( +
+ {name && } + + {open && !disabled && ( + + )} +
+ ); +} diff --git a/applications/shortwave/src/components/destination-preview.css b/applications/shortwave/src/components/destination-preview.css new file mode 100644 index 00000000..e95b01ba --- /dev/null +++ b/applications/shortwave/src/components/destination-preview.css @@ -0,0 +1,13 @@ +.destination-preview { min-width: 0; } +.destination-preview h3 { margin: 0 0 16px; font-size: 14px; font-weight: 600; } +.destination-preview-card { overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface, #1d1e20); } +.destination-preview-media { position: relative; width: 100%; aspect-ratio: 1.91; overflow: hidden; } +.destination-preview-image, .destination-preview-placeholder { position: absolute; inset: 0; width: 100%; height: 100%; } +.destination-preview-image { display: block; object-fit: cover; } +.destination-preview-placeholder { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; padding: 16px; color: var(--muted); background: rgba(255, 255, 255, .025); font-size: 12px; text-align: center; } +.destination-preview-placeholder > svg { flex-shrink: 0; } +.destination-preview-copy { display: grid; grid-template-rows: 16.5px 43.2px 57.6px; gap: 8px; padding: 18px; overflow-wrap: anywhere; } +.destination-preview-copy > * { min-width: 0; min-height: 0; overflow: hidden; } +.destination-preview-copy small { color: var(--muted); font-size: 11px; line-height: 16.5px; white-space: nowrap; text-overflow: ellipsis; } +.destination-preview-copy strong { font-size: 16px; line-height: 21.6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; } +.destination-preview-copy p { margin: 0; color: var(--muted); font-size: 12px; line-height: 19.2px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; } diff --git a/applications/shortwave/src/components/destination-preview.tsx b/applications/shortwave/src/components/destination-preview.tsx new file mode 100644 index 00000000..c818cce0 --- /dev/null +++ b/applications/shortwave/src/components/destination-preview.tsx @@ -0,0 +1,50 @@ +import { useEffect, useState } from "react"; +import { Image as ImageIcon } from "lucide-react"; +import { validateDestination } from "../lib/domain"; +import type { DestinationMetadata } from "../lib/preview"; +import { fetchDestinationPreview } from "../routes/-preview-api"; +import "./destination-preview.css"; + +export function DestinationPreview({ destination }: { destination: string }) { + const [result, setResult] = useState<{ url: string; metadata: DestinationMetadata | null } | null>(null); + const [brokenImage, setBrokenImage] = useState(null); + let previewDestination = ""; + let hostname = ""; + try { + previewDestination = validateDestination(destination); + hostname = new URL(previewDestination).hostname; + } catch { /* Incomplete draft. */ } + useEffect(() => { + if (!hostname) return; + let active = true; + const timer = setTimeout(() => { + fetchDestinationPreview({ data: previewDestination }) + .then((metadata) => { if (active) setResult({ url: previewDestination, metadata }); }) + .catch(() => { if (active) setResult({ url: previewDestination, metadata: null }); }); + }, 650); + return () => { active = false; clearTimeout(timer); }; + }, [previewDestination, hostname]); + const current = result?.url === previewDestination ? result : null; + const metadata = current?.metadata; + const loading = Boolean(hostname && !current); + const unavailable = Boolean(hostname && current && metadata?.status !== "ready"); + return ( +
+

Destination preview

+
+
+ {metadata?.image && metadata.image !== brokenImage ? ( + {metadata.imageAlt setBrokenImage(metadata.image)} /> + ) : ( +
{loading ? "Loading preview…" : hostname ? "No image available" : "Add a destination to preview"}
+ )} +
+
+ {metadata?.siteName || hostname} + {metadata?.title || hostname} +

{unavailable ? "Preview unavailable. You can still save this link." : ""}{!unavailable && (metadata?.description || "")}

+
+
+
+ ); +} diff --git a/applications/shortwave/src/components/domains.css b/applications/shortwave/src/components/domains.css new file mode 100644 index 00000000..a615e5c2 --- /dev/null +++ b/applications/shortwave/src/components/domains.css @@ -0,0 +1,43 @@ +.domain-hosting-notice { margin: 0 0 24px; color: var(--muted); font-size: 13px; line-height: 1.6; } +.domain-list { display: grid; gap: 20px; } +.domain-card { min-width: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); } +.domain-card-heading { display: flex; gap: 13px; align-items: center; padding: 20px 22px; } +.domain-icon { flex-shrink: 0; color: var(--muted); } +.domain-card-heading h2 { margin: 0; font-size: 16px; font-weight: 550; overflow-wrap: anywhere; min-width: 0; } +.domain-status { display: inline-flex; flex-shrink: 0; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 6px; color: #d7d8df; background: #ffffff09; font-size: 11px; } +.domain-status-verified { color: #a9ddb7; background: #a9ddb710; } +.domain-remove { margin-left: auto; flex-shrink: 0; } +.domain-dns { padding: 0 22px 22px; } +.domain-dns > p { margin: 0 0 16px; font-size: 12px; line-height: 1.6; color: var(--muted); } +.domain-dns-table { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: 100%; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; font-size: 12px; } +.domain-table-caption { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } +.domain-dns-table th { text-align: left; color: var(--muted); background: var(--bg); font-size: 11px; font-weight: 500; } +.domain-dns-table th, .domain-dns-table td { padding: 12px; vertical-align: top; } +.domain-dns-table th:first-child { width: 65px; } +.domain-dns-table th:last-child { width: 65px; } +.domain-dns-table td { border-top: 1px solid var(--border); } +.domain-dns-value { min-width: 0; } +.domain-dns-value-line { display: flex; align-items: flex-start; gap: 6px; } +.domain-dns-value code { font-size: 11px; line-height: 1.7; overflow-wrap: anywhere; user-select: all; min-width: 0; } +.domain-dns-value .icon-button { width: 25px; height: 25px; flex-shrink: 0; margin: -3px 0 0 auto; } +.domain-copy-feedback { display: block; color: #a9ddb7; margin-top: 5px; font-size: 11px; line-height: 1.5; } +.domain-copy-error { color: #ffb4ae; } +.domain-dns > .domain-dns-help { margin: 12px 0 20px; font-size: 11px; } +.domain-check-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; } +.domain-check-row .button-secondary { min-height: 37px; font-size: 12px; } +.domain-last-checked { color: var(--muted); font-size: 11px; } +.domain-dns > .domain-check-success { margin: 12px 0 0; color: #a9ddb7; } +.domain-remove-body { overflow-wrap: anywhere; } +.modal-body > .domain-input-help { margin: -7px 0 0; color: var(--muted); line-height: 1.6; } +@media (max-width: 700px) { + .domain-card-heading { display: grid; grid-template-columns: 22px minmax(0, 1fr) 32px; gap: 10px; padding: 16px; } + .domain-card-heading h2 { font-size: 14px; } + .domain-status { grid-column: 2; justify-self: start; } + .domain-remove { grid-column: 3; grid-row: 1 / 3; } + .domain-dns { padding: 0 16px 16px; } + .domain-dns-table, .domain-dns-table tbody, .domain-dns-table tr { display: block; } + .domain-dns-table thead { display: none; } + .domain-dns-table td { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; padding: 12px; } + .domain-dns-table td:first-child { border-top: 0; } + .domain-dns-table td::before { content: attr(data-label); font-size: 11px; color: var(--muted); } +} diff --git a/applications/shortwave/src/components/folder-manager.css b/applications/shortwave/src/components/folder-manager.css new file mode 100644 index 00000000..e770135d --- /dev/null +++ b/applications/shortwave/src/components/folder-manager.css @@ -0,0 +1,24 @@ +.folder-workspace { display: grid; gap: 30px; } +.folder-create-form { display: flex; align-items: end; gap: 12px; max-width: 560px; } +.folder-create-form .field { flex: 1; min-width: 0; margin: 0; } +.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 22px; align-items: start; } +.folder-tile { position: relative; min-width: 0; border-radius: 12px; } +.folder-tile-link { display: flex; flex-direction: column; align-items: center; width: 100%; padding: 26px 16px 18px; border-radius: inherit; color: inherit; } +.folder-tile:hover, .folder-tile:focus-within { background: var(--yellow-muted); } +.folder-tile-icon { color: var(--yellow); fill: #faff6924; flex-shrink: 0; margin-bottom: 14px; } +.folder-tile h2 { max-width: 100%; margin: 0; font-size: 14px; font-weight: 500; line-height: 1.5; text-align: center; overflow-wrap: anywhere; } +.folder-tile-actions { position: absolute; top: 0; right: 0; } +.folder-tile-actions > .icon-button { width: 36px; height: 36px; } +.folder-action-menu { position: absolute; top: calc(100% + 4px); right: 0; width: 156px; padding: 6px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); box-shadow: 0 10px 24px #0005; z-index: 8; } +.folder-action-menu-above { top: auto; bottom: calc(100% + 4px); } +.folder-action-menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 9px 10px; border: 0; border-radius: 5px; background: transparent; color: var(--text); text-align: left; } +.folder-action-menu button:hover, .folder-action-menu button:focus-visible { color: var(--yellow); background: var(--yellow-muted); } +.folder-action-menu button svg { flex-shrink: 0; } +.folder-delete-name { overflow-wrap: anywhere; } +@media (max-width: 540px) { + .folder-create-form { flex-wrap: wrap; } + .folder-create-form .field { flex-basis: 100%; } + .folder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; } + .folder-tile-link { padding-inline: 10px; } + .folder-action-menu { width: min(156px, calc((100vw - 60px) / 2)); } +} diff --git a/applications/shortwave/src/components/folder-manager.tsx b/applications/shortwave/src/components/folder-manager.tsx new file mode 100644 index 00000000..8c9993d8 --- /dev/null +++ b/applications/shortwave/src/components/folder-manager.tsx @@ -0,0 +1,166 @@ +import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from "react"; +import { Folder as FolderIcon, MoreHorizontal, Pencil, Plus, Trash2 } from "lucide-react"; +import { Link } from "@tanstack/react-router"; +import type { Folder } from "../lib/types"; +import { removeFolder, saveFolder } from "../routes/-api"; +import { ErrorNotice, Modal, PrimaryButton, message } from "./ui"; +import "./folder-manager.css"; + +export function FolderManager({ folders, onChange }: { + folders: Folder[]; + onChange: (folders: Folder[]) => void; +}) { + const [name, setName] = useState(""); + const [busy, setBusy] = useState(false); + const saving = useRef(false); + const createInput = useRef(null); + const renameInput = useRef(null); + const returnFocus = useRef(null); + const pendingFocus = useRef(null); + const [error, setError] = useState(""); + const [action, setAction] = useState<{ kind: "rename" | "delete"; folder: Folder } | null>(null); + const [editName, setEditName] = useState(""); + useLayoutEffect(() => { + if (!action && !busy && pendingFocus.current) { + pendingFocus.current.focus(); + pendingFocus.current = null; + } + }, [action, busy]); + const closeAction = useCallback(() => { + if (saving.current) return; + pendingFocus.current = returnFocus.current; + setAction(null); + setError(""); + }, []); + + async function act(operation: () => Promise) { + if (saving.current) return; + saving.current = true; setBusy(true); setError(""); + try { await operation(); } catch (err) { setError(message(err)); } + finally { saving.current = false; setBusy(false); } + } + + return
+ {error && !action && } +
{ + event.preventDefault(); + void act(async () => { + const folder = await saveFolder({ data: { name } }); + onChange([...folders, folder]); setName(""); + }); + }}> + + Create folder +
+ {!folders.length &&

No folders yet.

} +
+ {folders.map((folder) => { + returnFocus.current = trigger; + setEditName(folder.name); + setError(""); + setAction({ kind, folder }); + }} />)} +
+ {action && +
{ + event.preventDefault(); + void act(async () => { + if (action.kind === "rename") { + const saved = await saveFolder({ data: { id: action.folder.id, name: editName } }); + onChange(folders.map((item) => item.id === saved.id ? saved : item)); + pendingFocus.current = returnFocus.current; + } else { + await removeFolder({ data: action.folder.id }); + onChange(folders.filter((item) => item.id !== action.folder.id)); + pendingFocus.current = createInput.current; + } + setAction(null); + }); + }}> +
+ {error && } + {action.kind === "rename" ? : <> +

“{action.folder.name}”

+

Links will move to No folder.

+ } +
+
+ + + {action.kind === "rename" ? "Save name" : "Delete folder"} + +
+
+
} +
; +} + +function FolderTile({ folder, disabled, onAction }: { + folder: Folder; + disabled: boolean; + onAction: (kind: "rename" | "delete", trigger: HTMLButtonElement) => void; +}) { + const [open, setOpen] = useState(false); + const [above, setAbove] = useState(false); + const trigger = useRef(null); + const lastItemOnOpen = useRef(false); + const menu = useRef(null); + const anchor = useRef(null); + const menuId = useId(); + useLayoutEffect(() => { + if (!open) return; + const place = () => { + const bounds = anchor.current?.getBoundingClientRect(); + if (bounds && menu.current) setAbove(bounds.bottom + menu.current.offsetHeight + 16 > window.innerHeight); + }; + place(); + window.addEventListener("resize", place); + window.addEventListener("scroll", place, true); + return () => { + window.removeEventListener("resize", place); + window.removeEventListener("scroll", place, true); + }; + }, [open]); + useEffect(() => { + if (!open) return; + const items = menu.current?.querySelectorAll("button"); + items?.[lastItemOnOpen.current ? items.length - 1 : 0]?.focus(); + const dismiss = (event: PointerEvent | FocusEvent) => { + if (!anchor.current?.contains(event.target as Node)) setOpen(false); + }; + document.addEventListener("pointerdown", dismiss); + document.addEventListener("focusin", dismiss); + return () => { + document.removeEventListener("pointerdown", dismiss); + document.removeEventListener("focusin", dismiss); + }; + }, [open]); + + return
+ { if (disabled) event.preventDefault(); }}> +
; +} diff --git a/applications/shortwave/src/components/folder-picker.tsx b/applications/shortwave/src/components/folder-picker.tsx new file mode 100644 index 00000000..4e47724c --- /dev/null +++ b/applications/shortwave/src/components/folder-picker.tsx @@ -0,0 +1,173 @@ +import { useEffect, useId, useLayoutEffect, useRef, useState } from "react"; +import { Check, ChevronDown, Folder, Plus } from "lucide-react"; +import type { Folder as FolderValue } from "../lib/types"; +import { fetchFolders, saveFolder } from "../routes/-api"; +import { ErrorNotice, message } from "./ui"; +import "./folders.css"; + +export function FolderPicker({ value, onChange, disabled = false, onBusyChange, onOpen }: { + value: string | null; + onChange: (id: string | null) => void; + disabled?: boolean; + onBusyChange?: (busy: boolean) => void; + onOpen?: () => void; +}) { + const [folders, setFolders] = useState([]); + const [open, setOpen] = useState(false); + const [query, setQuery] = useState(""); + const [busy, setBusy] = useState(false); + const creating = useRef(false); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(""); + const popup = useRef(null); + const options = useRef(null); + const pointerActive = useRef(false); + const root = useRef(null); + const trigger = useRef(null); + const input = useRef(null); + const id = useId(); + function openPicker() { + onOpen?.(); + setOpen(true); + } + useEffect(() => { + let active = true; + fetchFolders().then((rows) => { if (active) setFolders(rows); }) + .catch((err) => { if (active) setError(message(err)); }) + .finally(() => { if (active) setLoading(false); }); + return () => { active = false; }; + }, []); + useLayoutEffect(() => { + if (!open) return; + const panel = popup.current; + const button = trigger.current; + if (!panel || !button) return; + const viewport = window.visualViewport; + const position = () => { + const rect = button.getBoundingClientRect(); + const viewportTop = viewport?.offsetTop ?? 0; + const viewportLeft = viewport?.offsetLeft ?? 0; + const viewportBottom = viewportTop + (viewport?.height ?? window.innerHeight); + const viewportRight = viewportLeft + (viewport?.width ?? window.innerWidth); + const top = rect.bottom + 6; + const width = Math.min(rect.width, viewportRight - viewportLeft - 16); + // The top layer avoids both dialog clipping and scrollable overflow. + // Stay below Folder, allowing the menu to overlap the footer if needed. + const height = Math.max(0, Math.min(172, viewportBottom - top - 8)); + panel.style.top = `${top}px`; + panel.style.left = `${Math.max(viewportLeft + 8, Math.min(rect.left, viewportRight - width - 8))}px`; + panel.style.width = `${width}px`; + panel.style.height = `${height}px`; + if (!creating.current && (rect.top < viewportTop || rect.bottom > viewportBottom || height <= 0)) setOpen(false); + }; + const pointerDown = () => { pointerActive.current = true; }; + const pointerUp = () => { pointerActive.current = false; }; + const dismiss = (event: MouseEvent) => { + if (!creating.current && !root.current?.contains(event.target as Node)) setOpen(false); + }; + position(); + panel.showPopover(); + input.current?.focus({ preventScroll: true }); + const observer = new ResizeObserver(position); + observer.observe(button); + const form = root.current?.closest(".link-editor-form"); + if (form) observer.observe(form); + window.addEventListener("resize", position); + document.addEventListener("scroll", position, true); + viewport?.addEventListener("resize", position); + viewport?.addEventListener("scroll", position); + document.addEventListener("pointerdown", pointerDown, true); + document.addEventListener("pointerup", pointerUp, true); + document.addEventListener("pointercancel", pointerUp, true); + document.addEventListener("click", dismiss, true); + return () => { + observer.disconnect(); + window.removeEventListener("resize", position); + document.removeEventListener("scroll", position, true); + viewport?.removeEventListener("resize", position); + viewport?.removeEventListener("scroll", position); + document.removeEventListener("pointerdown", pointerDown, true); + document.removeEventListener("pointerup", pointerUp, true); + document.removeEventListener("pointercancel", pointerUp, true); + document.removeEventListener("click", dismiss, true); + pointerActive.current = false; + if (panel.isConnected && panel.matches(":popover-open")) panel.hidePopover(); + }; + }, [open]); + useLayoutEffect(() => { + if (error && options.current) options.current.scrollTop = 0; + }, [error]); + const select = (id: string | null) => { onChange(id); setOpen(false); setQuery(""); trigger.current?.focus({ preventScroll: true }); }; + const filtered = folders.filter((folder) => folder.name.toLowerCase().includes(query.trim().toLowerCase())); + const canCreate = query.trim() && !folders.some((folder) => folder.name.toLowerCase() === query.trim().toLowerCase()); + return ( +
{ + if (!creating.current && !pointerActive.current && !event.currentTarget.contains(event.relatedTarget as Node)) setOpen(false); + }} onKeyDown={(event) => { + if (!open || event.nativeEvent.isComposing || event.keyCode === 229) return; + if (event.key === "Escape") { + event.preventDefault(); event.stopPropagation(); + if (!creating.current) { setOpen(false); trigger.current?.focus({ preventScroll: true }); } + } + // Folder search/creation must never submit the containing link form. + if (event.key === "Enter") { + event.stopPropagation(); + if (event.target === input.current || event.shiftKey) event.preventDefault(); + } + if (event.key === "ArrowDown" || event.key === "ArrowUp") { + event.preventDefault(); event.stopPropagation(); + const controls = [...root.current!.querySelectorAll(".folder-popup input, .folder-popup button:not(:disabled)")]; + const current = controls.indexOf(document.activeElement as HTMLElement); + const nextIndex = current < 0 + ? event.key === "ArrowDown" ? 0 : controls.length - 1 + : (current + (event.key === "ArrowDown" ? 1 : -1) + controls.length) % controls.length; + const next = controls[nextIndex]; + next?.focus({ preventScroll: true }); + const list = options.current; + if (next && list?.contains(next)) { + if (next.offsetTop < list.scrollTop) list.scrollTop = next.offsetTop; + else if (next.offsetTop + next.offsetHeight > list.scrollTop + list.clientHeight) { + list.scrollTop = next.offsetTop + next.offsetHeight - list.clientHeight; + } + } + } + }}> + Folder +
+ + {open && } +
+
+ ); +} diff --git a/applications/shortwave/src/components/folders.css b/applications/shortwave/src/components/folders.css new file mode 100644 index 00000000..6a808fdb --- /dev/null +++ b/applications/shortwave/src/components/folders.css @@ -0,0 +1,30 @@ +.folder-anchor { display: flex; flex-direction: column; gap: 6px; min-width: 0; } +.folder-trigger { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 46px; padding: 10px 12px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; text-align: left; } +.folder-trigger > span, .folder-popup button > span { flex: 1; overflow-wrap: anywhere; } +.folder-popup { display: none; position: fixed; inset: auto; margin: 0; flex-direction: column; gap: 4px; min-height: 0; height: 172px; max-height: 172px; overflow: hidden; padding: 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); box-shadow: 0 10px 24px #0005; } +.folder-popup:popover-open { display: flex; } +.folder-popup > input { flex-shrink: 0; } +.folder-options { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; } +.folder-popup button { display: flex; align-items: center; gap: 8px; width: 100%; height: 36px; padding: 9px 8px; margin: 0; color: var(--text); background: transparent; border: 0; border-radius: 5px; text-align: left; line-height: 18px; } +.folder-popup button > span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } +.folder-popup button > svg { flex-shrink: 0; } +.folder-popup button:hover, .folder-popup button:focus-visible { color: var(--yellow); background: var(--yellow-muted); } +.folder-popup p { padding: 4px 8px; } +.folder-popup .error-notice { font-size: 12px; margin: 8px 0; } +.folder-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } +.folder-manager { display: grid; gap: 16px; } +.folder-manager form, .folder-manager-row { display: flex; align-items: center; gap: 8px; } +.folder-manager .field { flex: 1; margin: 0; min-width: 0; } +.folder-manager-row { padding-top: 12px; border-top: 1px solid var(--border); } +.folder-manager-row input { width: 100%; min-width: 0; padding: 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); color: var(--text); } +.folder-manager-row > input { flex: 1; } +.folder-manager .folder-delete-confirm { margin: 0; font-size: 13px; } +.folder-tag { display: inline-flex; align-items: center; gap: 5px; } +@media (max-width: 540px) { .folder-manager-row { flex-wrap: wrap; } .folder-manager-row > input { flex-basis: 100%; } } + +.links-filter-bar { flex-wrap: wrap; } +.links-filter-bar .search-field { min-width: min(100%, 240px); } +@media (max-width: 620px) { + .links-filter-bar .search-field { flex: 1 1 100%; max-width: none; } + .links-filter-bar .button-secondary { margin-left: auto; font-size: 11px; padding: 8px 10px; } +} diff --git a/applications/shortwave/src/components/link-editor.css b/applications/shortwave/src/components/link-editor.css new file mode 100644 index 00000000..8293de4a --- /dev/null +++ b/applications/shortwave/src/components/link-editor.css @@ -0,0 +1,51 @@ +.modal:has(.link-editor-form) { width: 1020px; height: auto; max-height: 92dvh; display: flex; flex-direction: column; overflow: hidden; } +.modal:has(.link-editor-form) > .modal-heading { flex-shrink: 0; } +.link-editor-form { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; scrollbar-gutter: stable; } +.link-editor-layout { flex-shrink: 0; } +.link-editor-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 30px; } +.link-editor-fields, .link-editor-preview { min-width: 0; } +.link-editor-fields > .field:last-child { margin-bottom: 0; } +.link-editor-fields > .checkbox-field { margin-top: 20px; } +.link-editor-preview { border-left: 1px solid #33353b; padding-left: 30px; } +.link-editor-actions { z-index: 12; justify-content: space-between; align-items: center; margin-top: 0; flex-shrink: 0; } +.link-editor-save-actions { display: flex; align-items: center; gap: 10px; } +.link-editor-actions > button, .link-editor-save-actions > button { height: 40px; min-height: 40px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; } +.link-editor-save-actions > button > span { display: inline-flex; align-items: center; gap: 9px; } +.utm-toggle { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; } +.utm-toggle[aria-expanded="true"] { border-color: var(--yellow); } +.utm-active-dot { width: 5px; height: 5px; background: var(--yellow); border-radius: 50%; } +.utm-fields { display: grid; gap: 16px; } +.utm-popup { + position: fixed; + inset: 0; + width: 560px; + max-width: calc(100% - 32px); + max-height: 92dvh; + margin: auto; + overflow-y: auto; + overscroll-behavior: contain; + padding: 18px; + border: 1px solid #484b54; + border-radius: 10px; + background: #202126; + color: var(--text); + box-shadow: 0 16px 60px #0009; +} +.utm-popup:not([open]) { display: none; } +.utm-popup::backdrop { background: #0008; } +.utm-popup-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; } +.utm-popup-heading h3 { margin: 0; font-size: 14px; } +.utm-popup .icon-button { flex-shrink: 0; } +.submit-shortcut { display: inline-flex; align-items: center; min-height: 22px; padding: 1px 5px; border: 1px solid currentColor; border-radius: 4px; font-family: inherit; font-size: 11px; line-height: 1; opacity: .7; white-space: nowrap; } +@media (max-width: 760px) { + .link-editor-layout { grid-template-columns: 1fr; gap: 22px; } + .link-editor-preview { border-left: 0; border-top: 1px solid #33353b; padding: 22px 0 0; } +} +@media (max-width: 420px) { + .link-editor-actions { padding-left: 12px; padding-right: 12px; gap: 7px; } + .link-editor-save-actions { gap: 7px; } + .link-editor-actions > button, .link-editor-save-actions > button { padding-left: 10px; padding-right: 10px; gap: 7px; } + .link-editor-save-actions > button > span { gap: 7px; } + .utm-toggle { gap: 5px; } + .utm-popup { padding: 14px; } +} diff --git a/applications/shortwave/src/components/link-editor.tsx b/applications/shortwave/src/components/link-editor.tsx new file mode 100644 index 00000000..3af71f93 --- /dev/null +++ b/applications/shortwave/src/components/link-editor.tsx @@ -0,0 +1,265 @@ +import { useCallback, useEffect, useId, useRef, useState, type FormEvent } from "react"; +import { Link2, SlidersHorizontal } from "lucide-react"; +import type { Link, UtmValues } from "../lib/types"; +import { DestinationPreview } from "./destination-preview"; +import { FolderPicker } from "./folder-picker"; +import { UtmDialog } from "./utm-dialog"; +export { UtmFields } from "./utm-dialog"; +import { utmKeys, validateDestination } from "../lib/domain"; +import { saveLink } from "../routes/-api"; +import { ErrorNotice, message, Modal, PrimaryButton } from "./ui"; +import { TagInput } from "./tag-input"; +import { AppSelect } from "./app-select"; +import { fetchDomains } from "../routes/-domains-api"; +import type { CustomDomain } from "../lib/custom-domains"; +import "./link-editor.css"; +import "./utm-editor.css"; + +export function LinkEditor({ + link, + onClose, + onSaved, +}: { + link?: Link; + onClose: () => void; + onSaved: (link: Link) => void; +}) { + const [destination, setDestination] = useState(link?.destination || ""); + const [title, setTitle] = useState(link?.title || ""); + const [slug, setSlug] = useState(link?.slug || ""); + const [domainId, setDomainId] = useState(link?.domainId || ""); + const [domains, setDomains] = useState([]); + const [domainsLoading, setDomainsLoading] = useState(!link); + const [domainError, setDomainError] = useState(""); + useEffect(() => { + if (link) return; + let active = true; + void fetchDomains().then((items) => { + if (!active) return; + const ready = items.filter((item) => item.routingReady); + setDomains(ready); + if (ready.length === 1) setDomainId(ready[0].id); + }).catch(() => { if (active) setDomainError("Domains could not load. You can use the default domain or reopen this form to retry."); }) + .finally(() => { if (active) setDomainsLoading(false); }); + return () => { active = false; }; + }, [link]); + const [tags, setTags] = useState(link?.tags || []); + const [folderId, setFolderId] = useState(link?.folderId ?? null); + const [folderBusy, setFolderBusy] = useState(false); + const folderPending = useRef(false); + const updateFolderBusy = useCallback((pending: boolean) => { + folderPending.current = pending; + setFolderBusy(pending); + }, []); + const [tagDraft, setTagDraft] = useState(""); + const [tagError, setTagError] = useState(""); + const tagInput = useRef(null); + const utmId = useId(); + const [utm, setUtm] = useState(link?.utm || {}); + const [utmExpanded, setUtmExpanded] = useState(false); + const utmTrigger = useRef(null); + const submitButton = useRef(null); + const [enabled, setEnabled] = useState(link?.enabled ?? true); + const [templateBusy, setTemplateBusy] = useState(false); + const templatePending = useRef(false); + const updateTemplateBusy = useCallback((pending: boolean) => { + templatePending.current = pending; + setTemplateBusy(pending); + }, []); + const [error, setError] = useState(""); + const [busy, setBusy] = useState(false); + const savePending = useRef(false); + const closeEditor = useCallback(() => { + if (!savePending.current && !folderPending.current && !templatePending.current) onClose(); + }, [onClose]); + async function submit(event: FormEvent) { + event.preventDefault(); + if (savePending.current || folderPending.current || domainsLoading) return; + const nextTags = [...new Set([...tags, tagDraft.trim()].filter(Boolean))]; + if (nextTags.length > 12) { + setUtmExpanded(false); + setTagError("Use up to 12 tags per link."); + tagInput.current?.focus(); + return; + } + setError(""); + savePending.current = true; + setBusy(true); + try { + const result = await saveLink({ + data: { + id: link?.id, + input: { + destination: validateDestination(destination), + title, + ...(link ? {} : { domainId: domainId || null }), + ...(link ? {} : slug ? { slug } : {}), + tags: nextTags, + folderId, + utm, + enabled, + }, + }, + }); + onSaved(result); + } catch (err) { + setError(message(err)); + } finally { + savePending.current = false; + setBusy(false); + } + } + return ( + +
setUtmExpanded(false)} + onKeyDown={(event) => { + if (event.key !== "Enter" || !event.shiftKey || event.ctrlKey || event.metaKey || event.altKey) return; + if (event.defaultPrevented || event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229) return; + event.preventDefault(); + if (event.repeat || savePending.current || folderPending.current || utmExpanded) return; + const button = submitButton.current?.querySelector('button[type="submit"]'); + event.currentTarget.requestSubmit(button ?? undefined); + }} + > +
+
+ {error && } + + {(domains.length > 0 || link?.domainId) &&
+ Domain {link && Permanent} + ({ value: item.id, label: item.hostname }))]} /> + {domainError && {domainError}} +
} +
+ + +
+ + + {link && ( + + )} +
+ +
+
+ +
+ + + {busy ? "Saving…" : link ? "Save changes" : "Create link"} + + +
+
+ + {utmExpanded && setUtmExpanded(false)} + onSave={(next) => { setUtm(next); setUtmExpanded(false); }} />} +
+ ); +} diff --git a/applications/shortwave/src/components/qr-editor.tsx b/applications/shortwave/src/components/qr-editor.tsx new file mode 100644 index 00000000..64f557ce --- /dev/null +++ b/applications/shortwave/src/components/qr-editor.tsx @@ -0,0 +1,208 @@ +import { useEffect, useId, useRef, useState } from "react"; +import { Download, Upload } from "lucide-react"; +import type QRCodeStyling from "qr-code-styling"; +import type { Link, QrStyle } from "../lib/types"; +import { qrStyleSchema } from "../lib/domain"; +import { CLICKHOUSE_QR_LOGO, qrLogoImage } from "../lib/qr-logo"; +import { saveQr } from "../routes/-api"; +import { ErrorNotice, message, Modal, PrimaryButton, shortUrl } from "./ui"; +import { AppSelect } from "./app-select"; + +export function QrEditor({ + link, + onClose, + onSaved, +}: { + link: Link; + onClose: () => void; + onSaved: (style: QrStyle) => void; +}) { + const [style, setStyle] = useState(() => ({ + ...link.qrStyle, + logo: link.qrStyle.logo ?? CLICKHOUSE_QR_LOGO, + })); + const [error, setError] = useState(""); + const [busy, setBusy] = useState(false); + const [ready, setReady] = useState(false); + const [saved, setSaved] = useState(false); + const dotStyleId = useId(); + const container = useRef(null); + const qr = useRef(null); + useEffect(() => { + let active = true; + setReady(false); + import("qr-code-styling") + .then(({ default: QR }) => { + if (!active || !container.current) return; + const code = new QR({ + width: 280, + height: 280, + type: "canvas", + data: shortUrl(link.slug, link.domainHostname), + margin: 16, + qrOptions: { errorCorrectionLevel: "H" }, + dotsOptions: { color: style.foreground, type: style.dots }, + backgroundOptions: { color: style.background }, + image: qrLogoImage(style.logo, style.background), + imageOptions: { + // Accepted logos are already self-contained; retain SVG vectors on export. + saveAsBlob: false, + hideBackgroundDots: true, + imageSize: 0.22, + margin: 5, + }, + }); + container.current.replaceChildren(); + code.append(container.current); + qr.current = code; + setReady(true); + }) + .catch(() => + setError("The QR preview could not load. Please try again."), + ); + return () => { + active = false; + }; + }, [style, link.slug, link.domainHostname]); + function update(part: Partial) { + setStyle((old) => ({ ...old, ...part })); + setSaved(false); + setError(""); + } + async function upload(file?: File) { + if (!file) return; + if ( + !["image/png", "image/jpeg", "image/webp"].includes(file.type) || + file.size > 120_000 + ) { + setError("Choose a PNG, JPEG, or WebP logo smaller than 120 KB."); + return; + } + const reader = new FileReader(); + reader.onload = () => update({ logo: String(reader.result) }); + reader.onerror = () => setError("This image could not be read."); + reader.readAsDataURL(file); + } + async function save() { + setBusy(true); + setError(""); + try { + const result = await saveQr({ data: { linkId: link.id, style } }); + onSaved(result); + setSaved(true); + } catch (err) { + setError(message(err)); + } finally { + setBusy(false); + } + } + async function download(extension: "png" | "svg") { + try { + qrStyleSchema.parse(style); + await qr.current?.download({ name: `shortwave-${link.slug}`, extension }); + } catch (err) { + setError(message(err)); + } + } + return ( + +
+ {error && } +
+
+
+

{shortUrl(link.slug, link.domainHostname)}

+
+
+
+ + +
+
+ + + update({ dots: value as QrStyle["dots"] }) + } + options={[ + { value: "square", label: "Classic squares" }, + { value: "rounded", label: "Soft corners" }, + { value: "dots", label: "Round dots" }, + ]} + /> +
+ +
+ {style.logo && style.logo !== CLICKHOUSE_QR_LOGO && ( + + )} +
+
+
+
+
+
+ + +
+ void save()}> + {busy ? "Saving…" : saved ? "Style saved" : "Save style"} + +
+ + ); +} diff --git a/applications/shortwave/src/components/shell.tsx b/applications/shortwave/src/components/shell.tsx new file mode 100644 index 00000000..9655ea2d --- /dev/null +++ b/applications/shortwave/src/components/shell.tsx @@ -0,0 +1,140 @@ +import { useUser, UserButton } from "@clerk/tanstack-react-start"; +import { Link, Outlet } from "@tanstack/react-router"; +import { + ArrowUpRight, + BarChart3, + Folder, + Globe, + Link2, + Menu, + SlidersHorizontal, + UserRound, + X, +} from "lucide-react"; +import { useState, type ReactNode } from "react"; +import { Brand, Loading } from "./ui"; +import { WorkspaceShortcutProvider, WorkspaceShortcuts } from "./workspace-shortcuts"; + +export function AuthGate({ children }: { children: ReactNode }) { + if (!import.meta.env.VITE_CLERK_PUBLISHABLE_KEY) return ; + return {children}; +} +function Authenticated({ children }: { children: ReactNode }) { + const { isLoaded, isSignedIn } = useUser(); + if (!isLoaded) return ; + if (!isSignedIn) + return ( +
+ +
+

Sign in

+ + Sign in + +

+ New here?{" "} + + Create an account + +

+
+
+ ); + return children; +} +export function AuthUnavailable() { + return ( +
+ +
+

Account access unavailable

+

+ Account access hasn’t been configured for this instance yet. Please + check back soon. +

+ + Back to home + +
+
+ ); +} +export function AppShell() { + return ( + + + + ); +} +function SignedInShell() { + const [mobile, setMobile] = useState(false); + const { user } = useUser(); + const nav = [ + { to: "/links", label: "Links", icon: Link2 }, + { to: "/analytics", label: "Analytics", icon: BarChart3 }, + { to: "/templates", label: "UTM templates", icon: SlidersHorizontal }, + { to: "/folders", label: "Folders", icon: Folder }, + { to: "/domains", label: "Domains", icon: Globe }, + { to: "/account", label: "Account", icon: UserRound }, + ] as const; + return ( +
+ + Skip to content + +
+ + +
+ +
+
+ +
+
+ Shortwave © {new Date().getFullYear()} +
+
+
+ ); +} diff --git a/applications/shortwave/src/components/tag-input.css b/applications/shortwave/src/components/tag-input.css new file mode 100644 index 00000000..41aa2ac7 --- /dev/null +++ b/applications/shortwave/src/components/tag-input.css @@ -0,0 +1,57 @@ +.tag-input-anchor { position: relative; } +.tag-input-shell { + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 6px; + padding: 7px 10px; + min-height: 46px; + border: 1px solid var(--border); + border-radius: 8px; + background: var(--bg); +} +.tag-input-shell:focus-within { border-color: var(--yellow); } +.field .tag-input-shell input:not([type="color"]):not([type="file"]) { + flex: 1 1 120px; + min-width: 90px; + width: 120px; + height: auto; + border: 0; + padding: 5px 2px; + background: transparent; + outline: none; + box-shadow: none; +} +.tag-chip { + display: inline-flex; + align-items: center; + gap: 5px; + max-width: 100%; + padding: 4px 7px; + border-radius: 5px; + background: var(--yellow-muted); + color: var(--yellow); + font-size: 12px; +} +.tag-chip > span { overflow-wrap: anywhere; } +.tag-chip button { display: flex; padding: 2px; color: inherit; background: none; border: 0; } +.tag-suggestions { + position: absolute; + top: calc(100% + 6px); + left: 0; + right: 0; + z-index: 5; + list-style: none; + padding: 5px; + margin: 0; + max-height: 170px; + overflow-y: auto; + overscroll-behavior: contain; + background: var(--surface); + border: 1px solid var(--border); + border-radius: 8px; + box-shadow: 0 10px 24px #0005; +} +.tag-suggestions-above { top: auto; bottom: calc(100% + 6px); } +.tag-suggestions li { display: flex; align-items: center; min-height: 36px; padding: 7px 10px; cursor: pointer; border-radius: 4px; overflow-wrap: anywhere; } +.tag-suggestions li:hover, .tag-suggestions li[aria-selected="true"] { background: var(--yellow-muted); color: var(--yellow); } diff --git a/applications/shortwave/src/components/tag-input.tsx b/applications/shortwave/src/components/tag-input.tsx new file mode 100644 index 00000000..95248119 --- /dev/null +++ b/applications/shortwave/src/components/tag-input.tsx @@ -0,0 +1,218 @@ +import { + useEffect, + useId, + useLayoutEffect, + useRef, + useState, + type RefObject, +} from "react"; +import { X } from "lucide-react"; +import { fetchTags } from "../routes/-api"; +import "./tag-input.css"; + +type Placement = { above: boolean; maxHeight: number; visible: boolean }; + +export function TagInput({ + tags, + onTagsChange, + draft, + onDraftChange, + error, + onErrorChange, + inputRef, +}: { + tags: string[]; + onTagsChange: (tags: string[]) => void; + draft: string; + onDraftChange: (draft: string) => void; + error: string; + onErrorChange: (error: string) => void; + inputRef: RefObject; +}) { + const id = useId(); + const anchor = useRef(null); + const list = useRef(null); + const [suggestions, setSuggestions] = useState([]); + const [focused, setFocused] = useState(false); + const [activeSuggestion, setActiveSuggestion] = useState(-1); + const [placement, setPlacement] = useState({ above: false, maxHeight: 170, visible: false }); + const hasSuggestions = focused && suggestions.length > 0; + const open = hasSuggestions && placement.visible; + + useEffect(() => { + let active = true; + setSuggestions([]); + setActiveSuggestion(-1); + if (!focused) return; + const timer = setTimeout(() => { + fetchTags({ data: draft.trim() }) + .then((data) => { + if (active) { + setSuggestions(data.filter((tag) => !tags.includes(tag))); + onErrorChange(""); + } + }) + .catch(() => { + if (active) onErrorChange("Saved tags could not be loaded. You can still add tags."); + }); + }, 150); + return () => { + active = false; + clearTimeout(timer); + }; + }, [draft, tags, focused, onErrorChange]); + + useLayoutEffect(() => { + if (!hasSuggestions || !anchor.current) return; + const target = anchor.current; + const dialog = target.closest("dialog"); + const footer = dialog?.querySelector(".modal-actions"); + const viewport = window.visualViewport; + function position() { + const rect = target.getBoundingClientRect(); + const bounds = dialog?.getBoundingClientRect(); + const viewportTop = viewport?.offsetTop ?? 0; + const viewportBottom = viewportTop + (viewport?.height ?? window.innerHeight); + const top = Math.max(viewportTop, bounds?.top ?? 0) + 8; + const bottom = Math.min(viewportBottom, bounds?.bottom ?? window.innerHeight, footer?.getBoundingClientRect().top ?? Infinity) - 8; + const below = Math.max(0, bottom - rect.bottom - 6); + const above = Math.max(0, rect.top - top - 6); + const desiredHeight = Math.min(170, suggestions.length * 36 + 12); + const placeAbove = below < desiredHeight && above > below; + const maxHeight = Math.floor(Math.min(170, placeAbove ? above : below)); + const visible = rect.top >= top && rect.bottom <= bottom && maxHeight >= 36; + setPlacement((current) => current.above === placeAbove && current.maxHeight === maxHeight && current.visible === visible + ? current : { above: placeAbove, maxHeight, visible }); + } + position(); + const observer = new ResizeObserver(position); + observer.observe(target); + if (dialog) observer.observe(dialog); + if (footer) observer.observe(footer); + // Capture scrolling ancestors; the overlay itself never alters their layout. + window.addEventListener("scroll", position, true); + window.addEventListener("resize", position); + viewport?.addEventListener("resize", position); + viewport?.addEventListener("scroll", position); + return () => { + observer.disconnect(); + window.removeEventListener("scroll", position, true); + window.removeEventListener("resize", position); + viewport?.removeEventListener("resize", position); + viewport?.removeEventListener("scroll", position); + }; + }, [hasSuggestions, suggestions.length]); + + useLayoutEffect(() => { + const menu = list.current; + const option = menu?.children[activeSuggestion] as HTMLElement | undefined; + if (!menu || !option || !open) return; + // Scroll only the options, never the dialog or the page behind it. + if (option.offsetTop < menu.scrollTop) menu.scrollTop = option.offsetTop; + else if (option.offsetTop + option.offsetHeight > menu.scrollTop + menu.clientHeight) { + menu.scrollTop = option.offsetTop + option.offsetHeight - menu.clientHeight; + } + }, [activeSuggestion, open, placement.maxHeight]); + + function commitTag(value: string) { + const tag = value.trim(); + if (!tag) return; + if (!tags.includes(tag) && tags.length >= 12) { + onErrorChange("Use up to 12 tags per link."); + return; + } + if (!tags.includes(tag)) onTagsChange([...tags, tag]); + onDraftChange(""); + onErrorChange(""); + setActiveSuggestion(-1); + inputRef.current?.focus(); + } + + return ( +
+ +
+
+ {tags.map((tag) => ( + + {tag} + + + ))} + = 0 ? `${id}-option-${activeSuggestion}` : undefined} + aria-describedby={error ? `${id}-error` : undefined} + placeholder="Add a tag" + autoComplete="off" + maxLength={40} + value={draft} + onChange={(event) => { onDraftChange(event.target.value); setFocused(true); setActiveSuggestion(-1); }} + onFocus={() => setFocused(true)} + onBlur={() => { setFocused(false); setActiveSuggestion(-1); }} + onKeyDown={(event) => { + if (event.nativeEvent.isComposing) return; + if (event.key === "Enter") { + event.preventDefault(); + commitTag((open ? suggestions[activeSuggestion] : undefined) ?? draft); + } else if (event.key === "ArrowDown" || event.key === "ArrowUp") { + event.preventDefault(); + setFocused(true); + if (suggestions.length) { + const direction = event.key === "ArrowDown" ? 1 : -1; + setActiveSuggestion((index) => index < 0 + ? direction > 0 ? 0 : suggestions.length - 1 + : (index + direction + suggestions.length) % suggestions.length); + } + } else if (event.key === "Escape" && focused) { + event.preventDefault(); + event.stopPropagation(); + setFocused(false); + setActiveSuggestion(-1); + } else if (event.key === "Backspace" && !draft && tags.length) { + event.preventDefault(); + onDraftChange(tags[tags.length - 1]!); + onTagsChange(tags.slice(0, -1)); + } + }} + /> +
+ {hasSuggestions && ( + + )} +
+ {error && {error}} +
+ ); +} diff --git a/applications/shortwave/src/components/ui.css b/applications/shortwave/src/components/ui.css new file mode 100644 index 00000000..37e3edf7 --- /dev/null +++ b/applications/shortwave/src/components/ui.css @@ -0,0 +1,8 @@ +.primary-button { min-height: 40px; padding: 0 16px; } +.primary-button-content { display: inline-flex; align-items: center; justify-content: center; gap: 9px; } +.primary-button-content > svg, .primary-button-content > kbd { flex-shrink: 0; } +.primary-button-content > kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; min-height: 22px; padding: 1px 5px; border: 1px solid currentColor; border-radius: 4px; font: inherit; font-size: 11px; line-height: 1; opacity: .7; white-space: nowrap; } +@media (max-width: 420px) { + .primary-button { padding-left: 12px; padding-right: 12px; } + .primary-button-content { gap: 7px; } +} diff --git a/applications/shortwave/src/components/ui.tsx b/applications/shortwave/src/components/ui.tsx new file mode 100644 index 00000000..a22b28ab --- /dev/null +++ b/applications/shortwave/src/components/ui.tsx @@ -0,0 +1,219 @@ +import { Button } from "@clickhouse/click-ui"; +import "./ui.css"; +import { useEffect, useRef, useState, type ReactNode, type RefObject } from "react"; +import { + ArrowUpRight, + Check, + Copy, + LoaderCircle, + Radio, + X, +} from "lucide-react"; + +export function Brand() { + return ( + + + + + shortwave. + + ); +} +export function PrimaryButton({ + children, + className = "", + ...props +}: React.ComponentProps) { + return ( + + ); +} +export function Loading() { + return ( +
+ Loading… +
+ ); +} +export function ErrorNotice({ message }: { message: string }) { + return ( +
+ {message} +
+ ); +} +export function message(error: unknown) { + return error instanceof Error + ? error.message + : "Something went wrong. Please try again."; +} +export function CopyButton({ value }: { value: string }) { + const [copied, setCopied] = useState(false); + const [error, setError] = useState(false); + useEffect(() => { + if (copied) { + const timer = setTimeout(() => setCopied(false), 2000); + return () => clearTimeout(timer); + } + }, [copied]); + return ( + + ); +} +export function Modal({ + title, + children, + onClose, + wide = false, + initialFocus, +}: { + title: string; + children: ReactNode; + onClose: () => void; + wide?: boolean; + initialFocus?: RefObject; +}) { + const dialogRef = useRef(null); + useEffect(() => { + const previous = document.activeElement as HTMLElement | null; + const dialog = dialogRef.current; + const target = initialFocus?.current || dialog?.querySelector("input, button, select"); + target?.focus(); + const key = (event: KeyboardEvent) => { + // Let nested controls consume Escape (for example, a tag suggestion list). + if (event.defaultPrevented) return; + if (event.key === "Escape") onClose(); + if (event.key === "Tab" && dialog) { + const items = [ + ...dialog.querySelectorAll( + "button, input, select, textarea, a[href]", + ), + ].filter((el) => !el.matches(":disabled") && el.tabIndex >= 0 && el.getClientRects().length > 0); + const first = items[0]; + const last = items[items.length - 1]; + if (event.shiftKey && document.activeElement === first) { + event.preventDefault(); + last?.focus(); + } else if (!event.shiftKey && document.activeElement === last) { + event.preventDefault(); + first?.focus(); + } + } + }; + document.addEventListener("keydown", key); + const overflow = document.body.style.overflow; + document.body.style.overflow = "hidden"; + return () => { + document.removeEventListener("keydown", key); + document.body.style.overflow = overflow; + previous?.focus(); + }; + }, [onClose, initialFocus]); + return ( +
{ + if (e.target === e.currentTarget) onClose(); + }} + > + +
+

{title}

+ +
+ {children} +
+
+ ); +} +export function EmptyState({ + title, + children, + icon, +}: { + title: string; + children: ReactNode; + icon: ReactNode; +}) { + return ( +
+
{icon}
+

{title}

+
{children}
+
+ ); +} +export function SectionHeading({ + title, + children, + action, +}: { + title: string; + children?: ReactNode; + action?: ReactNode; +}) { + return ( +
+
+

{title}

+ {children &&

{children}

} +
+ {action} +
+ ); +} +export function shortUrl(slug: string, domainHostname?: string | null) { + const origin = domainHostname ? `https://${domainHostname}` : typeof window !== "undefined" ? window.location.origin : ""; + return `${origin}/r/${slug}`; +} +export function ExternalLink({ + href, + children, +}: { + href: string; + children: ReactNode; +}) { + return ( + + {children} + + + ); +} diff --git a/applications/shortwave/src/components/utm-dialog.tsx b/applications/shortwave/src/components/utm-dialog.tsx new file mode 100644 index 00000000..7ac69a08 --- /dev/null +++ b/applications/shortwave/src/components/utm-dialog.tsx @@ -0,0 +1,220 @@ +import { useEffect, useLayoutEffect, useRef, useState, type RefObject } from "react"; +import { Check, ChevronDown, X } from "lucide-react"; +import { mergeUtm, utmKeys, utmSchema } from "../lib/domain"; +import type { UtmTemplate, UtmValues } from "../lib/types"; +import { fetchTemplates, saveTemplate } from "../routes/-api"; +import { ErrorNotice, message } from "./ui"; +import "./utm-editor.css"; + +function editableValues(destination: string, value: UtmValues): UtmValues { + try { return { ...mergeUtm(destination, value).utm, ...value }; } + catch { return { ...value }; } +} + +export function UtmFields({ value, onChange }: { value: UtmValues; onChange: (value: UtmValues) => void }) { + return
+ {utmKeys.map((key) => )} +
; +} + +export function UtmDialog({ id, value, destination, onSave, onClose, onBusyChange, returnFocus }: { + id: string; + value: UtmValues; + destination: string; + onSave: (value: UtmValues) => void; + onClose: () => void; + onBusyChange: (busy: boolean) => void; + returnFocus: RefObject; +}) { + // This component mounts for each editing session. Only Save commits its copy. + const [draft, setDraft] = useState(() => editableValues(destination, value)); + const [templates, setTemplates] = useState([]); + const [selectedTemplate, setSelectedTemplate] = useState(""); + const [templateName, setTemplateName] = useState(""); + const [menuOpen, setMenuOpen] = useState(false); + const [busy, setBusy] = useState(false); + const pending = useRef(false); + const [error, setError] = useState(""); + const [templateError, setTemplateError] = useState(""); + const [loadingTemplates, setLoadingTemplates] = useState(true); + const dialog = useRef(null); + const menu = useRef(null); + const menuTrigger = useRef(null); + const nameInput = useRef(null); + const backdropPointer = useRef(false); + let preview = ""; + try { preview = mergeUtm(destination, draft).resolvedUrl; } catch { /* An incomplete destination does not prevent composing UTMs. */ } + + useLayoutEffect(() => { + const element = dialog.current!; + const trigger = returnFocus.current; + element.showModal(); + element.querySelector(".utm-parameter-rows input")?.focus({ preventScroll: true }); + return () => { + if (element.open) element.close(); + trigger?.focus({ preventScroll: true }); + }; + }, []); + + useEffect(() => { + let active = true; + fetchTemplates().then((items) => { if (active) setTemplates((current) => [...items, ...current.filter((saved) => !items.some((item) => item.id === saved.id))]); }) + .catch(() => { if (active) setTemplateError("Saved templates could not be loaded."); }) + .finally(() => { if (active) setLoadingTemplates(false); }); + return () => { active = false; }; + }, []); + + useLayoutEffect(() => { + if (!menuOpen || !menu.current || !menuTrigger.current) return; + const element = menu.current; + const trigger = menuTrigger.current; + const viewport = window.visualViewport; + const position = () => { + const rect = trigger.getBoundingClientRect(); + const top = (viewport?.offsetTop ?? 0) + 8; + const left = (viewport?.offsetLeft ?? 0) + 8; + const bottom = (viewport?.offsetTop ?? 0) + (viewport?.height ?? window.innerHeight) - 8; + const right = (viewport?.offsetLeft ?? 0) + (viewport?.width ?? window.innerWidth) - 8; + const above = Math.max(0, rect.top - top - 6); + const below = Math.max(0, bottom - rect.bottom - 6); + // Prefer above the footer so its Save and Cancel actions stay exposed. + const useAbove = above >= 200 || above > below; + const height = Math.min(320, useAbove ? above : below); + const width = Math.min(300, right - left); + element.style.width = `${width}px`; + element.style.maxHeight = `${height}px`; + element.style.left = `${Math.max(left, Math.min(rect.left, right - width))}px`; + element.style.top = useAbove ? "auto" : `${rect.bottom + 6}px`; + element.style.bottom = useAbove ? `${window.innerHeight - rect.top + 6}px` : "auto"; + if (!pending.current && (rect.top < top || rect.bottom > bottom)) setMenuOpen(false); + }; + const outside = (event: MouseEvent) => { + if (!pending.current && !element.contains(event.target as Node) && !trigger.contains(event.target as Node)) setMenuOpen(false); + }; + position(); + element.showPopover(); + (element.querySelector(".utm-saved-templates button") ?? nameInput.current)?.focus({ preventScroll: true }); + const observer = new ResizeObserver(position); + observer.observe(trigger); + window.addEventListener("resize", position); + document.addEventListener("scroll", position, true); + document.addEventListener("click", outside, true); + viewport?.addEventListener("resize", position); + viewport?.addEventListener("scroll", position); + return () => { + observer.disconnect(); + window.removeEventListener("resize", position); + document.removeEventListener("scroll", position, true); + document.removeEventListener("click", outside, true); + viewport?.removeEventListener("resize", position); + viewport?.removeEventListener("scroll", position); + if (element.isConnected && element.matches(":popover-open")) element.hidePopover(); + }; + }, [menuOpen]); + + function closeMenu() { + if (pending.current) return; + setMenuOpen(false); + menuTrigger.current?.focus({ preventScroll: true }); + } + function cancel() { + if (!pending.current) onClose(); + } + function save() { + if (pending.current) return; + const result = utmSchema.safeParse(draft); + if (!result.success) { setError("Use up to 200 characters per UTM field."); return; } + onSave(result.data); + } + async function createTemplate() { + if (pending.current || !templateName.trim()) return; + const parsed = utmSchema.safeParse(draft); + if (!parsed.success) { setTemplateError("Use up to 200 characters per UTM field."); return; } + pending.current = true; + setBusy(true); onBusyChange(true); setTemplateError(""); + try { + const template = await saveTemplate({ data: { name: templateName.trim(), values: parsed.data } }); + setTemplates((items) => [...items.filter((item) => item.id !== template.id), template].sort((a, b) => a.name.localeCompare(b.name))); + setSelectedTemplate(template.id); setTemplateName(""); + } catch (err) { setTemplateError(message(err)); } + finally { + pending.current = false; setBusy(false); onBusyChange(false); + requestAnimationFrame(() => nameInput.current?.focus({ preventScroll: true })); + } + } + + return { event.preventDefault(); if (menuOpen) closeMenu(); else cancel(); }} + onMouseDown={(event) => event.stopPropagation()} + onPointerDown={(event) => { + const bounds = event.currentTarget.getBoundingClientRect(); + backdropPointer.current = event.target === event.currentTarget && (event.clientX < bounds.left || event.clientX > bounds.right || event.clientY < bounds.top || event.clientY > bounds.bottom); + }} + onClick={(event) => { + event.stopPropagation(); + const bounds = event.currentTarget.getBoundingClientRect(); + const outside = event.clientX < bounds.left || event.clientX > bounds.right || event.clientY < bounds.top || event.clientY > bounds.bottom; + if (backdropPointer.current && event.target === event.currentTarget && outside) cancel(); + backdropPointer.current = false; + }} + onKeyDown={(event) => { + event.stopPropagation(); + if (event.defaultPrevented || event.nativeEvent.isComposing) return; + if (event.key === "Escape") { event.preventDefault(); if (menuOpen) closeMenu(); else cancel(); } + else if (event.key === "Tab") { + const controls = [...event.currentTarget.querySelectorAll('button:not(:disabled), input:not(:disabled)')] + .filter((item) => item.tabIndex >= 0 && item.getClientRects().length > 0); + const first = controls[0]; const last = controls[controls.length - 1]; + if (event.shiftKey && document.activeElement === first) { event.preventDefault(); last?.focus(); } + else if (!event.shiftKey && document.activeElement === last) { event.preventDefault(); first?.focus(); } + } else if (event.key === "Enter" && (event.shiftKey || (event.target instanceof HTMLElement && event.target.tagName !== "BUTTON"))) event.preventDefault(); + }}> +
+

UTM parameters

+ +
+
+ { setDraft(next); setSelectedTemplate(""); setError(""); }} /> +
+ {error && } + +
+ +
+ + +
+
+ {menuOpen && } +
; +} diff --git a/applications/shortwave/src/components/utm-editor.css b/applications/shortwave/src/components/utm-editor.css new file mode 100644 index 00000000..d91ce654 --- /dev/null +++ b/applications/shortwave/src/components/utm-editor.css @@ -0,0 +1,30 @@ +.utm-editor { display: grid; gap: 18px; } +.utm-editor .field { margin: 0; } +.utm-parameter-rows { min-width: 0; margin: 0; padding: 0; border: 0; } +.utm-parameter-rows .form-grid { grid-template-columns: 1fr; gap: 10px; } +.utm-parameter-rows .field { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 12px; } +.utm-url-preview-field { display: grid; gap: 8px; min-width: 0; color: var(--muted); font-size: 11px; } +.utm-url-preview { width: 100%; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px; background: #17181c; color: var(--text); font-family: monospace; font-size: 11px; white-space: nowrap; } +.utm-url-preview::placeholder { color: var(--muted); font-family: inherit; } +.utm-dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; } +.utm-dialog-save-actions { display: flex; align-items: center; gap: 8px; } +.utm-dialog-actions button { height: 36px; padding: 0 12px; font-size: 12px; } +.utm-dialog-actions .utm-templates-toggle { display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; font-size: 11px; } +.utm-templates-toggle[aria-expanded="true"] { border-color: var(--yellow); } +.utm-template-menu { display: none; position: fixed; inset: auto; margin: 0; width: 300px; max-width: calc(100% - 16px); flex-direction: column; gap: 8px; overflow-y: auto; overscroll-behavior: contain; padding: 8px; border: 1px solid #484b54; border-radius: 8px; background: #24252b; color: var(--text); box-shadow: 0 12px 30px #0008; } +.utm-template-menu:popover-open { display: flex; } +.utm-saved-templates { min-height: 0; max-height: 172px; overflow-y: auto; overscroll-behavior: contain; } +.utm-saved-templates:empty { display: none; } +.utm-saved-templates > button { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 8px; border: 0; border-radius: 5px; background: transparent; color: var(--text); text-align: left; font-size: 12px; } +.utm-saved-templates > button > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.utm-saved-templates > button > svg { flex-shrink: 0; color: var(--yellow); } +.utm-saved-templates > button:hover, .utm-saved-templates > button:focus-visible { color: var(--yellow); background: var(--yellow-muted); } +.utm-saved-templates > p { margin: 0; padding: 8px; font-size: 12px; } +.utm-template-create { display: grid; flex-shrink: 0; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); } +.utm-saved-templates:empty + .utm-template-create { padding-top: 0; border-top: 0; } +.utm-template-create > button { height: 36px; justify-content: center; font-size: 12px; } +.utm-template-menu .error-notice { margin: 0; font-size: 12px; } +@media (max-width: 550px) { + .utm-parameter-rows .field { grid-template-columns: 104px minmax(0, 1fr); gap: 8px; } + .utm-parameter-rows .field > span small { display: block; margin: 4px 0 0; } +} diff --git a/applications/shortwave/src/components/workspace-shortcuts.css b/applications/shortwave/src/components/workspace-shortcuts.css new file mode 100644 index 00000000..4e85b34e --- /dev/null +++ b/applications/shortwave/src/components/workspace-shortcuts.css @@ -0,0 +1,39 @@ +kbd { + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 20px; + padding: 2px 5px; + border: 1px solid currentColor; + border-radius: 4px; + font-family: inherit; + font-size: 11px; + line-height: 1.3; + opacity: .75; +} +.workspace-shortcuts-button { + display: flex; + align-items: center; + gap: 13px; + width: 100%; + min-height: 44px; + padding: 12px 14px; + color: var(--muted); + background: transparent; + border: 0; + border-radius: 7px; + font-size: 12px; +} +.workspace-shortcuts-button kbd { margin-left: auto; } +.workspace-shortcuts-button:hover { color: var(--text); background: #ffffff05; } +.shortcut-help dl { margin: 0 0 22px; } +.shortcut-help dl > div { + display: flex; + align-items: center; + justify-content: space-between; + gap: 20px; + padding: 12px 0; + border-bottom: 1px solid var(--border); +} +.shortcut-help dt { font-size: 14px; } +.shortcut-help dd { margin: 0; } diff --git a/applications/shortwave/src/components/workspace-shortcuts.tsx b/applications/shortwave/src/components/workspace-shortcuts.tsx new file mode 100644 index 00000000..f4bb8e77 --- /dev/null +++ b/applications/shortwave/src/components/workspace-shortcuts.tsx @@ -0,0 +1,75 @@ +import { createContext, useCallback, useContext, useEffect, useRef, useState, type ReactNode } from "react"; +import { Keyboard } from "lucide-react"; +import { Modal } from "./ui"; +import "./workspace-shortcuts.css"; + +type LinkShortcuts = { + onCreate: () => void; + onSearch: () => void; +}; +const ShortcutContext = createContext<{ + register: (actions: LinkShortcuts) => () => void; + showHelp: () => void; +} | null>(null); + +export function useLinkShortcuts(onCreate: () => void, onSearch: () => void) { + const context = useContext(ShortcutContext); + const register = context?.register; + useEffect(() => register?.({ onCreate, onSearch }), [register, onCreate, onSearch]); +} + +export function WorkspaceShortcutProvider({ children }: { children: ReactNode }) { + const [open, setOpen] = useState(false); + const actions = useRef(null); + const register = useCallback((next: LinkShortcuts) => { + actions.current = next; + return () => { if (actions.current === next) actions.current = null; }; + }, []); + const showHelp = useCallback(() => setOpen(true), []); + const close = useCallback(() => setOpen(false), []); + useEffect(() => { + const handle = (event: KeyboardEvent) => { + const target = event.target; + if (event.defaultPrevented || event.repeat || event.isComposing || + event.ctrlKey || event.metaKey || event.altKey || + document.querySelector('dialog[open], [role="dialog"], [role="menu"], [role="listbox"], [aria-modal="true"]') || + (target instanceof HTMLElement && (target.isContentEditable || + target.closest('input, textarea, select, [contenteditable]:not([contenteditable="false"]), [role="textbox"], [role="combobox"]')))) return; + if (event.key.toLowerCase() === "c" && !event.shiftKey && actions.current) { + event.preventDefault(); + actions.current.onCreate(); + } else if (event.key === "/" && !event.shiftKey && actions.current) { + event.preventDefault(); + actions.current.onSearch(); + } else if (event.key === "?") { + event.preventDefault(); + setOpen(true); + } + }; + document.addEventListener("keydown", handle); + return () => document.removeEventListener("keydown", handle); + }, []); + return + {children} + {open && +
+
+
Create a link
C
+
Search links
/
+
Show shortcuts
?
+
Save a link
⇧ ↵
+
Close popup or dialog
Esc
+
+

Create and search work on the Links page. Create, search, and help shortcuts pause while typing or using a dialog.

+
+
} +
; +} + +export function WorkspaceShortcuts() { + const context = useContext(ShortcutContext); + return ; +} diff --git a/applications/shortwave/src/lib/custom-domains.ts b/applications/shortwave/src/lib/custom-domains.ts new file mode 100644 index 00000000..2fb2464d --- /dev/null +++ b/applications/shortwave/src/lib/custom-domains.ts @@ -0,0 +1,18 @@ +export const DOMAIN_VERIFICATION_LABEL = "_shortwave-verification"; +export const DOMAIN_VERIFICATION_PREFIX = "shortwave-verification="; +export const MAX_CUSTOM_DOMAIN_LENGTH = 253 - DOMAIN_VERIFICATION_LABEL.length - 1; +export const DOMAIN_CHECK_INTERVAL_MS = 10_000; +export const MAX_CUSTOM_DOMAINS = 20; + +export type CustomDomain = { + id: string; + hostname: string; + status: "pending" | "verified"; + routingReady: boolean; + verificationName: string; + verificationValue: string; + verifiedAt: string | null; + lastCheckedAt: string | null; + verificationError: string | null; + createdAt: string; +}; diff --git a/applications/shortwave/src/lib/domain.ts b/applications/shortwave/src/lib/domain.ts new file mode 100644 index 00000000..0b8a953f --- /dev/null +++ b/applications/shortwave/src/lib/domain.ts @@ -0,0 +1,182 @@ +import { z } from "zod"; +import type { QrStyle, UtmValues } from "./types"; +import { CLICKHOUSE_QR_LOGO } from "./qr-logo"; + +export const utmKeys = [ + "source", + "medium", + "campaign", + "term", + "content", +] as const; +export const utmSchema = z + .object({ + source: z.string().trim().max(200).optional(), + medium: z.string().trim().max(200).optional(), + campaign: z.string().trim().max(200).optional(), + term: z.string().trim().max(200).optional(), + content: z.string().trim().max(200).optional(), + }) + .strict(); + +export function validateDestination(value: string): string { + if (value.length > 4096 || /[\u0000-\u001f\u007f]/.test(value)) + throw new Error("Enter a valid URL under 4,096 characters."); + const input = value.trim(); + const explicitWebScheme = /^https?:\/\//i.test(input); + const hostWithPort = /^(?:localhost|(?:[^\s:/?#@]+\.)+[^\s:/?#@]+):\d+(?:[/?#]|$)/i.test(input); + if (!input || input.includes("\\") || (!explicitWebScheme && /^[a-z][a-z0-9+.-]*:/i.test(input) && !hostWithPort)) { + throw new Error("Enter a web address, using HTTP or HTTPS without embedded credentials."); + } + // Protocol-relative addresses also default to HTTPS. A single slash is a path. + const address = input.startsWith("//") ? input.slice(2) : input; + if (!explicitWebScheme && /^[/?#]/.test(address)) + throw new Error("Enter a web address such as example.com/path."); + let url: URL; + try { + url = new URL(explicitWebScheme ? input : `https://${address}`); + } catch { + throw new Error("Enter a web address such as example.com/path."); + } + if ( + !["https:", "http:"].includes(url.protocol) || + !url.hostname || + url.username || + url.password + ) { + throw new Error("Use an HTTP or HTTPS URL without embedded credentials."); + } + // Avoid interpreting a relative path (for example, docs/setup) as a host. + const hostname = url.hostname.replace(/\.$/, ""); + if (!explicitWebScheme && hostname !== "localhost" && !hostname.startsWith("[") && + (!hostname.includes(".") || hostname.split(".").some((label) => !label))) { + throw new Error("Enter a web address such as example.com/path."); + } + if (url.toString().length > 4096) + throw new Error("Enter a valid URL under 4,096 characters."); + return url.toString(); +} + +export function validateSlug(value: string): string { + const slug = value.trim(); + if (!/^[a-zA-Z0-9][a-zA-Z0-9_-]{2,47}$/.test(slug)) + throw new Error( + "Use 3–48 letters, numbers, hyphens, or underscores for the slug.", + ); + return slug; +} + +/** Explicit nonempty values replace existing UTMs; empty values remove them; omitted values survive. */ +export function mergeUtm( + destination: string, + input: UtmValues = {}, +): { resolvedUrl: string; utm: UtmValues } { + const url = new URL(validateDestination(destination)); + const values = utmSchema.parse(input); + const snapshot: UtmValues = {}; + for (const key of utmKeys) { + const param = `utm_${key}`; + if (values[key] !== undefined) { + if (values[key]) url.searchParams.set(param, values[key]!); + else url.searchParams.delete(param); + } + const value = url.searchParams.get(param); + // Inherited values must remain editable under the form's UTM limit. + if (value) snapshot[key] = z.string().max(200).parse(value); + } + if (url.toString().length > 8192) + throw new Error("The resulting destination URL is too long."); + return { resolvedUrl: url.toString(), utm: snapshot }; +} + +export const linkInputSchema = z + .object({ + destination: z.string().transform(validateDestination), + title: z.string().trim().max(160).default(""), + slug: z.string().transform(validateSlug).optional(), + domainId: z.string().uuid().nullable().optional(), + utm: utmSchema.default({}), + tags: z + .array(z.string().trim().min(1).max(40)) + .max(12) + .default([]) + .transform((tags) => [...new Set(tags)]), + folderId: z.string().uuid().nullable().optional(), + enabled: z.boolean().default(true), + }) + .strict(); + +export const defaultQrStyle: QrStyle = { + foreground: "#171717", + background: "#ffffff", + dots: "square", + logo: CLICKHOUSE_QR_LOGO, +}; +export const qrStyleSchema = z + .object({ + foreground: z.string().regex(/^#[0-9a-fA-F]{6}$/), + background: z.string().regex(/^#[0-9a-fA-F]{6}$/), + dots: z.enum(["square", "rounded", "dots"]), + logo: z.union([z.literal(CLICKHOUSE_QR_LOGO), z + .string() + .max(180_000) + .regex(/^data:image\/(png|jpeg|webp);base64,[A-Za-z0-9+/]+=*$/)]) + .nullish().transform((logo) => logo ?? CLICKHOUSE_QR_LOGO), + }) + .strict() + .refine((style) => contrastRatio(style.foreground, style.background) >= 4.5, { + message: + "Choose colours with at least 4.5:1 contrast so the QR code stays readable.", + }); + +export function contrastRatio(first: string, second: string): number { + const luminance = (hex: string) => { + const channels = [1, 3, 5] + .map((offset) => parseInt(hex.slice(offset, offset + 2), 16) / 255) + .map((value) => + value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4, + ); + return ( + channels[0]! * 0.2126 + channels[1]! * 0.7152 + channels[2]! * 0.0722 + ); + }; + const a = luminance(first), + b = luminance(second); + return (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05); +} + +export function requestDimensions(referrer?: string | null, userAgent = "") { + let referrerDomain = ""; + try { + if (referrer) + referrerDomain = new URL(referrer).hostname.toLowerCase().slice(0, 253); + } catch { + /* Direct or malformed referrer. */ + } + const isBot = /bot|crawler|spider|preview|slurp|facebookexternalhit/i.test( + userAgent, + ); + const device = /ipad|tablet/i.test(userAgent) + ? "Tablet" + : /mobile|iphone|android/i.test(userAgent) + ? "Mobile" + : userAgent + ? "Desktop" + : "Unknown"; + const browser = /edg\//i.test(userAgent) + ? "Edge" + : /firefox\//i.test(userAgent) + ? "Firefox" + : /chrome\//i.test(userAgent) + ? "Chrome" + : /safari\//i.test(userAgent) + ? "Safari" + : "Unknown"; + return { + referrer_domain: referrerDomain, + device, + browser, + is_bot: Number(isBot), + country: "Unknown", + }; +} diff --git a/applications/shortwave/src/lib/preview.ts b/applications/shortwave/src/lib/preview.ts new file mode 100644 index 00000000..1f61f478 --- /dev/null +++ b/applications/shortwave/src/lib/preview.ts @@ -0,0 +1,8 @@ +export type DestinationMetadata = { + status: "ready" | "unavailable"; + title: string; + description: string; + siteName: string; + image: string | null; + imageAlt: string; +}; diff --git a/applications/shortwave/src/lib/qr-logo.ts b/applications/shortwave/src/lib/qr-logo.ts new file mode 100644 index 00000000..514d041f --- /dev/null +++ b/applications/shortwave/src/lib/qr-logo.ts @@ -0,0 +1,24 @@ +/** Trusted built-in asset; stored styles use this key, never caller-supplied SVG. */ +export const CLICKHOUSE_QR_LOGO = "clickhouse"; + +// Bar geometry from ClickHouse's SVG favicon: https://github.com/ClickHouse/ClickHouse/blob/master/programs/server/jemalloc.html +// Transparent background with monochrome bars; data URLs keep downloads self-contained. +function clickHouseImage(fill: "#000000" | "#ffffff") { + const svg = ``; + return `data:image/svg+xml,${encodeURIComponent(svg)}`; +} +export const CLICKHOUSE_QR_IMAGE = clickHouseImage("#000000"); +const whiteClickHouseImage = clickHouseImage("#ffffff"); + +export function qrLogoImage(logo: string | null | undefined, background = "#ffffff"): string { + if (logo && logo !== CLICKHOUSE_QR_LOGO) return logo; + const color = /^#[0-9a-f]{6}$/i.test(background) ? background : "#ffffff"; + const channels = [1, 3, 5].map((offset) => { + const value = parseInt(color.slice(offset, offset + 2), 16) / 255; + return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4; + }); + const luminance = channels[0]! * 0.2126 + channels[1]! * 0.7152 + channels[2]! * 0.0722; + const blackContrast = (luminance + 0.05) / 0.05; + const whiteContrast = 1.05 / (luminance + 0.05); + return blackContrast >= whiteContrast ? CLICKHOUSE_QR_IMAGE : whiteClickHouseImage; +} diff --git a/applications/shortwave/src/lib/types.ts b/applications/shortwave/src/lib/types.ts new file mode 100644 index 00000000..3267de8f --- /dev/null +++ b/applications/shortwave/src/lib/types.ts @@ -0,0 +1,89 @@ +export type UtmValues = Partial< + Record<"source" | "medium" | "campaign" | "term" | "content", string> +>; + +export type QrStyle = { + foreground: string; + background: string; + dots: "square" | "rounded" | "dots"; + /** "clickhouse" and legacy null values use the bundled SVG. Uploads are raster data URLs only. */ + logo: string | null; +}; + +export type Folder = { id: string; name: string }; + +export type Link = { + id: string; + slug: string; + domainId: string | null; + domainHostname: string | null; + title: string; + destination: string; + resolvedUrl: string; + utm: UtmValues; + tags: string[]; + folderId: string | null; + enabled: boolean; + createdAt: string; + updatedAt: string; + qrStyle: QrStyle; +}; + +export type LinkInput = { + destination: string; + title?: string; + slug?: string; + domainId?: string | null; + utm?: UtmValues; + tags?: string[]; + folderId?: string | null; + enabled?: boolean; +}; + +export type UtmTemplate = { + id: string; + name: string; + values: UtmValues; + createdAt: string; +}; + +export type AnalyticsFilter = { + days?: 7 | 30 | 90; + linkId?: string; + campaign?: string; + tag?: string; +}; +export type Breakdown = { name: string; clicks: number }; +export type Analytics = { + status: "ready" | "no-data" | "delayed" | "unavailable"; + message: string | null; + totalClicks: number; + previousClicks: number; + daily: { date: string; clicks: number }[]; + topLinks: { linkId: string; title: string; slug: string; clicks: number }[]; + referrers: Breakdown[]; + countries: Breakdown[]; + devices: Breakdown[]; + browsers: Breakdown[]; + campaigns: Breakdown[]; + lastEventAt: string | null; + pendingEvents: number; +}; + +export type ClickEvent = { + event_id: string; + account_id: string; + link_id: string; + occurred_at: string; + utm_source: string; + utm_medium: string; + utm_campaign: string; + utm_term: string; + utm_content: string; + referrer_domain: string; + country: string; + device: string; + browser: string; + is_bot: number; + is_demo: number; +}; diff --git a/applications/shortwave/src/routeTree.gen.ts b/applications/shortwave/src/routeTree.gen.ts new file mode 100644 index 00000000..787b2ec8 --- /dev/null +++ b/applications/shortwave/src/routeTree.gen.ts @@ -0,0 +1,286 @@ +/* eslint-disable */ + +// @ts-nocheck + +// noinspection JSUnusedGlobalSymbols + +// This file was automatically generated by TanStack Router. +// You should NOT make any changes in this file as it will be overwritten. +// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. + +import { Route as rootRouteImport } from './routes/__root' +import { Route as IndexRouteImport } from './routes/index' +import { Route as AppRouteImport } from './routes/_app' +import { Route as AppAccountRouteImport } from './routes/_app.account' +import { Route as AppAnalyticsRouteImport } from './routes/_app.analytics' +import { Route as AppDomainsRouteImport } from './routes/_app.domains' +import { Route as AppFoldersRouteImport } from './routes/_app.folders' +import { Route as AppLinksRouteImport } from './routes/_app.links' +import { Route as AppTemplatesRouteImport } from './routes/_app.templates' +import { Route as RSlugRouteImport } from './routes/r.$slug' +import { Route as SignInSplatRouteImport } from './routes/sign-in.$' +import { Route as SignUpSplatRouteImport } from './routes/sign-up.$' + +const IndexRoute = IndexRouteImport.update({ + id: '/', + path: '/', + getParentRoute: () => rootRouteImport, +} as any) +const AppRoute = AppRouteImport.update({ + id: '/_app', + getParentRoute: () => rootRouteImport, +} as any) +const AppAccountRoute = AppAccountRouteImport.update({ + id: '/account', + path: '/account', + getParentRoute: () => AppRoute, +} as any) +const AppAnalyticsRoute = AppAnalyticsRouteImport.update({ + id: '/analytics', + path: '/analytics', + getParentRoute: () => AppRoute, +} as any) +const AppDomainsRoute = AppDomainsRouteImport.update({ + id: '/domains', + path: '/domains', + getParentRoute: () => AppRoute, +} as any) +const AppFoldersRoute = AppFoldersRouteImport.update({ + id: '/folders', + path: '/folders', + getParentRoute: () => AppRoute, +} as any) +const AppLinksRoute = AppLinksRouteImport.update({ + id: '/links', + path: '/links', + getParentRoute: () => AppRoute, +} as any) +const AppTemplatesRoute = AppTemplatesRouteImport.update({ + id: '/templates', + path: '/templates', + getParentRoute: () => AppRoute, +} as any) +const RSlugRoute = RSlugRouteImport.update({ + id: '/r/$slug', + path: '/r/$slug', + getParentRoute: () => rootRouteImport, +} as any) +const SignInSplatRoute = SignInSplatRouteImport.update({ + id: '/sign-in/$', + path: '/sign-in/$', + getParentRoute: () => rootRouteImport, +} as any) +const SignUpSplatRoute = SignUpSplatRouteImport.update({ + id: '/sign-up/$', + path: '/sign-up/$', + getParentRoute: () => rootRouteImport, +} as any) + +export interface FileRoutesByFullPath { + '/': typeof IndexRoute + '/account': typeof AppAccountRoute + '/analytics': typeof AppAnalyticsRoute + '/domains': typeof AppDomainsRoute + '/folders': typeof AppFoldersRoute + '/links': typeof AppLinksRoute + '/templates': typeof AppTemplatesRoute + '/r/$slug': typeof RSlugRoute + '/sign-in/$': typeof SignInSplatRoute + '/sign-up/$': typeof SignUpSplatRoute +} +export interface FileRoutesByTo { + '/': typeof IndexRoute + '/account': typeof AppAccountRoute + '/analytics': typeof AppAnalyticsRoute + '/domains': typeof AppDomainsRoute + '/folders': typeof AppFoldersRoute + '/links': typeof AppLinksRoute + '/templates': typeof AppTemplatesRoute + '/r/$slug': typeof RSlugRoute + '/sign-in/$': typeof SignInSplatRoute + '/sign-up/$': typeof SignUpSplatRoute +} +export interface FileRoutesById { + __root__: typeof rootRouteImport + '/': typeof IndexRoute + '/_app': typeof AppRouteWithChildren + '/_app/account': typeof AppAccountRoute + '/_app/analytics': typeof AppAnalyticsRoute + '/_app/domains': typeof AppDomainsRoute + '/_app/folders': typeof AppFoldersRoute + '/_app/links': typeof AppLinksRoute + '/_app/templates': typeof AppTemplatesRoute + '/r/$slug': typeof RSlugRoute + '/sign-in/$': typeof SignInSplatRoute + '/sign-up/$': typeof SignUpSplatRoute +} +export interface FileRouteTypes { + fileRoutesByFullPath: FileRoutesByFullPath + fullPaths: + | '/' + | '/account' + | '/analytics' + | '/domains' + | '/folders' + | '/links' + | '/templates' + | '/r/$slug' + | '/sign-in/$' + | '/sign-up/$' + fileRoutesByTo: FileRoutesByTo + to: + | '/' + | '/account' + | '/analytics' + | '/domains' + | '/folders' + | '/links' + | '/templates' + | '/r/$slug' + | '/sign-in/$' + | '/sign-up/$' + id: + | '__root__' + | '/' + | '/_app' + | '/_app/account' + | '/_app/analytics' + | '/_app/domains' + | '/_app/folders' + | '/_app/links' + | '/_app/templates' + | '/r/$slug' + | '/sign-in/$' + | '/sign-up/$' + fileRoutesById: FileRoutesById +} +export interface RootRouteChildren { + IndexRoute: typeof IndexRoute + AppRoute: typeof AppRouteWithChildren + RSlugRoute: typeof RSlugRoute + SignInSplatRoute: typeof SignInSplatRoute + SignUpSplatRoute: typeof SignUpSplatRoute +} + +declare module '@tanstack/react-router' { + interface FileRoutesByPath { + '/': { + id: '/' + path: '/' + fullPath: '/' + preLoaderRoute: typeof IndexRouteImport + parentRoute: typeof rootRouteImport + } + '/_app': { + id: '/_app' + path: '' + fullPath: '/' + preLoaderRoute: typeof AppRouteImport + parentRoute: typeof rootRouteImport + } + '/_app/account': { + id: '/_app/account' + path: '/account' + fullPath: '/account' + preLoaderRoute: typeof AppAccountRouteImport + parentRoute: typeof AppRoute + } + '/_app/analytics': { + id: '/_app/analytics' + path: '/analytics' + fullPath: '/analytics' + preLoaderRoute: typeof AppAnalyticsRouteImport + parentRoute: typeof AppRoute + } + '/_app/domains': { + id: '/_app/domains' + path: '/domains' + fullPath: '/domains' + preLoaderRoute: typeof AppDomainsRouteImport + parentRoute: typeof AppRoute + } + '/_app/folders': { + id: '/_app/folders' + path: '/folders' + fullPath: '/folders' + preLoaderRoute: typeof AppFoldersRouteImport + parentRoute: typeof AppRoute + } + '/_app/links': { + id: '/_app/links' + path: '/links' + fullPath: '/links' + preLoaderRoute: typeof AppLinksRouteImport + parentRoute: typeof AppRoute + } + '/_app/templates': { + id: '/_app/templates' + path: '/templates' + fullPath: '/templates' + preLoaderRoute: typeof AppTemplatesRouteImport + parentRoute: typeof AppRoute + } + '/r/$slug': { + id: '/r/$slug' + path: '/r/$slug' + fullPath: '/r/$slug' + preLoaderRoute: typeof RSlugRouteImport + parentRoute: typeof rootRouteImport + } + '/sign-in/$': { + id: '/sign-in/$' + path: '/sign-in/$' + fullPath: '/sign-in/$' + preLoaderRoute: typeof SignInSplatRouteImport + parentRoute: typeof rootRouteImport + } + '/sign-up/$': { + id: '/sign-up/$' + path: '/sign-up/$' + fullPath: '/sign-up/$' + preLoaderRoute: typeof SignUpSplatRouteImport + parentRoute: typeof rootRouteImport + } + } +} + +interface AppRouteChildren { + AppAccountRoute: typeof AppAccountRoute + AppAnalyticsRoute: typeof AppAnalyticsRoute + AppDomainsRoute: typeof AppDomainsRoute + AppFoldersRoute: typeof AppFoldersRoute + AppLinksRoute: typeof AppLinksRoute + AppTemplatesRoute: typeof AppTemplatesRoute +} + +const AppRouteChildren: AppRouteChildren = { + AppAccountRoute: AppAccountRoute, + AppAnalyticsRoute: AppAnalyticsRoute, + AppDomainsRoute: AppDomainsRoute, + AppFoldersRoute: AppFoldersRoute, + AppLinksRoute: AppLinksRoute, + AppTemplatesRoute: AppTemplatesRoute, +} + +const AppRouteWithChildren = AppRoute._addFileChildren(AppRouteChildren) + +const rootRouteChildren: RootRouteChildren = { + IndexRoute: IndexRoute, + AppRoute: AppRouteWithChildren, + RSlugRoute: RSlugRoute, + SignInSplatRoute: SignInSplatRoute, + SignUpSplatRoute: SignUpSplatRoute, +} +export const routeTree = rootRouteImport + ._addFileChildren(rootRouteChildren) + ._addFileTypes() + +import type { getRouter } from './router.tsx' +import type { startInstance } from './start.ts' +declare module '@tanstack/react-start' { + interface Register { + ssr: true + router: Awaited> + config: Awaited> + } +} diff --git a/applications/shortwave/src/router.tsx b/applications/shortwave/src/router.tsx new file mode 100644 index 00000000..0cdf139c --- /dev/null +++ b/applications/shortwave/src/router.tsx @@ -0,0 +1,16 @@ +import { createRouter } from "@tanstack/react-router"; +import { routeTree } from "./routeTree.gen"; + +export function getRouter() { + return createRouter({ + routeTree, + scrollRestoration: true, + defaultPreload: "intent", + }); +} + +declare module "@tanstack/react-router" { + interface Register { + router: ReturnType; + } +} diff --git a/applications/shortwave/src/routes/-api.ts b/applications/shortwave/src/routes/-api.ts new file mode 100644 index 00000000..e1f1677e --- /dev/null +++ b/applications/shortwave/src/routes/-api.ts @@ -0,0 +1,111 @@ +import { createServerFn } from "@tanstack/react-start"; +import type { + AnalyticsFilter, + LinkInput, + QrStyle, + UtmValues, +} from "../lib/types"; + +async function user() { + const { auth } = await import("@clerk/tanstack-react-start/server"); + const { userId } = await auth(); + if (!userId) throw new Error("Please sign in to continue."); + return userId; +} + +export const checkSession = createServerFn({ method: "GET" }).handler( + async () => { + const { auth } = await import("@clerk/tanstack-react-start/server"); + return Boolean((await auth()).userId); + }, +); + +export const fetchLinks = createServerFn({ method: "GET" }) + .validator((data: { search?: string; tag?: string; folderId?: string | null }) => data) + .handler(async ({ data }) => { + const userId = await user(); + const service = await import("../server/service"); + return service.listLinks(userId, data); + }); +export const fetchLink = createServerFn({ method: "GET" }) + .validator((id: string) => id) + .handler(async ({ data }) => { + const userId = await user(); + return (await import("../server/service")).getLink(userId, data); + }); +export const fetchTags = createServerFn({ method: "GET" }) + .validator((query: string) => query) + .handler(async ({ data }) => { + const userId = await user(); + return (await import("../server/service")).listTags(userId, data); + }); +export const saveLink = createServerFn({ method: "POST" }) + .validator((data: { id?: string; input: LinkInput }) => data) + .handler(async ({ data }) => { + const userId = await user(); + const service = await import("../server/service"); + return data.id + ? service.updateLink(userId, data.id, data.input) + : service.createLink(userId, data.input); + }); +export const fetchTemplates = createServerFn({ method: "GET" }).handler( + async () => { + const userId = await user(); + return (await import("../server/service")).listTemplates(userId); + }, +); +export const saveTemplate = createServerFn({ method: "POST" }) + .validator((data: { id?: string; name: string; values: UtmValues }) => data) + .handler(async ({ data }) => { + const userId = await user(); + const service = await import("../server/service"); + return data.id + ? service.updateTemplate(userId, data.id, { + name: data.name, + values: data.values, + }) + : service.createTemplate(userId, { + name: data.name, + values: data.values, + }); + }); +export const removeTemplate = createServerFn({ method: "POST" }) + .validator((id: string) => id) + .handler(async ({ data }) => { + const userId = await user(); + return (await import("../server/service")).deleteTemplate(userId, data); + }); +export const saveQr = createServerFn({ method: "POST" }) + .validator((data: { linkId: string; style: QrStyle }) => data) + .handler(async ({ data }) => { + const userId = await user(); + return (await import("../server/service")).saveQrStyle( + userId, + data.linkId, + data.style, + ); + }); +export const fetchAnalytics = createServerFn({ method: "GET" }) + .validator((data: AnalyticsFilter) => data) + .handler(async ({ data }) => { + const userId = await user(); + return (await import("../server/analytics")).getAnalytics(userId, data); + }); + +export const fetchFolders = createServerFn({ method: "GET" }).handler(async () => { + const userId = await user(); + return (await import("../server/service")).listFolders(userId); +}); +export const saveFolder = createServerFn({ method: "POST" }) + .validator((data: { id?: string; name: string }) => data) + .handler(async ({ data }) => { + const userId = await user(); + const service = await import("../server/service"); + return data.id ? service.updateFolder(userId, data.id, data.name) : service.createFolder(userId, data.name); + }); +export const removeFolder = createServerFn({ method: "POST" }) + .validator((id: string) => id) + .handler(async ({ data }) => { + const userId = await user(); + return (await import("../server/service")).deleteFolder(userId, data); + }); diff --git a/applications/shortwave/src/routes/-domains-api.ts b/applications/shortwave/src/routes/-domains-api.ts new file mode 100644 index 00000000..2d8123ff --- /dev/null +++ b/applications/shortwave/src/routes/-domains-api.ts @@ -0,0 +1,46 @@ +import { createServerFn } from "@tanstack/react-start"; + +async function user() { + const { auth } = await import("@clerk/tanstack-react-start/server"); + const { userId } = await auth(); + if (!userId) throw new Error("Please sign in to continue."); + return userId; +} + +function domainId(value: string) { + if (typeof value !== "string" || !/^[0-9a-f-]{36}$/i.test(value)) { + throw new Error("Invalid domain."); + } + return value; +} + +export const fetchDomains = createServerFn({ method: "GET" }).handler(async () => { + const userId = await user(); + return (await import("../server/custom-domains")).listDomains(userId); +}); + +export const addDomain = createServerFn({ method: "POST" }) + .validator((hostname: string) => { + if (typeof hostname !== "string" || hostname.length > 1024) { + throw new Error("Enter a valid domain name."); + } + return hostname; + }) + .handler(async ({ data }) => { + const userId = await user(); + return (await import("../server/custom-domains")).addDomain(userId, data); + }); + +export const checkDomainDns = createServerFn({ method: "POST" }) + .validator(domainId) + .handler(async ({ data }) => { + const userId = await user(); + return (await import("../server/custom-domains")).verifyDomain(userId, data); + }); + +export const removeDomain = createServerFn({ method: "POST" }) + .validator(domainId) + .handler(async ({ data }) => { + const userId = await user(); + return (await import("../server/custom-domains")).removeDomain(userId, data); + }); diff --git a/applications/shortwave/src/routes/-preview-api.ts b/applications/shortwave/src/routes/-preview-api.ts new file mode 100644 index 00000000..ad719a3f --- /dev/null +++ b/applications/shortwave/src/routes/-preview-api.ts @@ -0,0 +1,14 @@ +import { createServerFn } from "@tanstack/react-start"; +import { validateDestination } from "../lib/domain"; + +export const fetchDestinationPreview = createServerFn({ method: "POST" }) + .validator((destination: string) => { + if (typeof destination !== "string" || destination.length > 4096) throw new Error("Invalid destination URL."); + return validateDestination(destination); + }) + .handler(async ({ data }) => { + const { auth } = await import("@clerk/tanstack-react-start/server"); + const { userId } = await auth(); + if (!userId) throw new Error("Please sign in to continue."); + return (await import("../server/preview")).destinationPreview(userId, data); + }); diff --git a/applications/shortwave/src/routes/__root.tsx b/applications/shortwave/src/routes/__root.tsx new file mode 100644 index 00000000..a771c9da --- /dev/null +++ b/applications/shortwave/src/routes/__root.tsx @@ -0,0 +1,100 @@ +import { ClerkProvider } from "@clerk/tanstack-react-start"; +import { ClickUIProvider, InitCUIThemeScript } from "@clickhouse/click-ui"; +import { createRootRoute, HeadContent, Scripts } from "@tanstack/react-router"; +import type { ReactNode } from "react"; +import appCss from "../styles.css?url"; + +export const Route = createRootRoute({ + head: () => ({ + meta: [ + { charSet: "utf-8" }, + { name: "viewport", content: "width=device-width, initial-scale=1" }, + { title: "Shortwave" }, + { + name: "description", + content: + "Create and manage short links, QR codes, and click analytics.", + }, + ], + links: [ + { rel: "stylesheet", href: appCss }, + { rel: "icon", type: "image/svg+xml", href: "/favicon.svg" }, + ], + }), + shellComponent: RootDocument, + notFoundComponent: () => ( +
+

This link went off air.

+

The page you’re looking for doesn’t exist.

+ + Back to Shortwave + +
+ ), + errorComponent: () => ( +
+

Something interrupted the signal.

+

Please reload and try again.

+ + Back to Shortwave + +
+ ), +}); + +function RootDocument({ children }: { children: ReactNode }) { + const content = ( + + {children} + + ); + return ( + + + + + + + {import.meta.env.VITE_CLERK_PUBLISHABLE_KEY ? ( + + {content} + + ) : ( + content + )} + + + + ); +} diff --git a/applications/shortwave/src/routes/_app.account.tsx b/applications/shortwave/src/routes/_app.account.tsx new file mode 100644 index 00000000..c3820d9b --- /dev/null +++ b/applications/shortwave/src/routes/_app.account.tsx @@ -0,0 +1,13 @@ +import { createFileRoute } from "@tanstack/react-router"; +import { UserProfile } from "@clerk/tanstack-react-start"; +import { SectionHeading } from "../components/ui"; +export const Route = createFileRoute("/_app/account")({ + component: () => ( + <> + +
+ +
+ + ), +}); diff --git a/applications/shortwave/src/routes/_app.analytics.tsx b/applications/shortwave/src/routes/_app.analytics.tsx new file mode 100644 index 00000000..b2fea6f4 --- /dev/null +++ b/applications/shortwave/src/routes/_app.analytics.tsx @@ -0,0 +1,376 @@ +import { createFileRoute } from "@tanstack/react-router"; +import { useEffect, useState } from "react"; +import { + Activity, + ArrowUpRight, + BarChart3, + Globe2, + Link2, + RefreshCw, +} from "lucide-react"; +import type { Analytics, AnalyticsFilter, Breakdown, Link } from "../lib/types"; +import { fetchAnalytics, fetchLinks } from "./-api"; +import { AppSelect } from "../components/app-select"; +import { + EmptyState, + ErrorNotice, + Loading, + message, + SectionHeading, +} from "../components/ui"; +export const Route = createFileRoute("/_app/analytics")({ + validateSearch: (search: Record): { linkId?: string } => ({ + ...(typeof search.linkId === "string" ? { linkId: search.linkId } : {}), + }), + component: AnalyticsPage, +}); +function AnalyticsPage() { + const search = Route.useSearch(); + const [filter, setFilter] = useState({ + days: 30, + linkId: search.linkId, + }); + const [links, setLinks] = useState([]); + const [data, setData] = useState(null); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(""); + const [refresh, setRefresh] = useState(0); + useEffect(() => { + fetchLinks({ data: {} }) + .then(setLinks) + .catch(() => {}); + }, []); + useEffect(() => { + setFilter((current) => ({ ...current, linkId: search.linkId })); + }, [search.linkId]); + useEffect(() => { + let active = true; + setLoading(true); + setError(""); + fetchAnalytics({ data: filter }) + .then((value) => { + if (active) setData(value); + }) + .catch((err) => { + if (active) { + setError(message(err)); + setData(null); + } + }) + .finally(() => { + if (active) setLoading(false); + }); + return () => { + active = false; + }; + }, [filter, refresh]); + const tags = [...new Set(links.flatMap((link) => link.tags))].sort(); + const campaigns = [ + ...new Set([ + ...(links.map((link) => link.utm.campaign).filter(Boolean) as string[]), + ...(data?.campaigns.map((item) => item.name).filter(Boolean) || []), + ]), + ].sort(); + const change = + data && data.previousClicks > 0 + ? Math.round( + ((data.totalClicks - data.previousClicks) / data.previousClicks) * + 100, + ) + : null; + return ( + <> + setRefresh((n) => n + 1)} + > + + Refresh + + } + /> +
+ + setFilter({ + ...filter, + days: Number(value) as 7 | 30 | 90, + }) + } + options={[7, 30, 90].map((days) => ({ value: String(days), label: `Last ${days} days` }))} + /> + + setFilter({ ...filter, linkId: value || undefined }) + } + options={[{ value: "", label: "All links" }, ...links.map((link) => ({ value: link.id, label: link.title || link.slug }))]} + /> + + setFilter({ ...filter, tag: value || undefined }) + } + options={[{ value: "", label: "All tags" }, ...tags.map((tag) => ({ value: tag, label: tag }))]} + /> + + setFilter({ ...filter, campaign: value || undefined }) + } + options={[{ value: "", label: "All campaigns" }, ...campaigns.map((campaign) => ({ value: campaign, label: campaign }))]} + /> +
+ {loading ? ( + + ) : error ? ( + + ) : ( + data && ( + <> + {data.status !== "ready" && ( +
+ +
+ + { + { + "no-data": "No clicks recorded", + delayed: "Analytics are syncing", + unavailable: "Analytics unavailable", + ready: "", + }[data.status] + } + +

+ {data.message || + (data.status === "no-data" + ? "Share a short link to record clicks." + : "Please check back in a moment.")} +

+
+
+ )} + {data.status !== "unavailable" && ( + <> +
+ } + detail={ + change === null + ? "Recorded redirects in this period" + : `${change >= 0 ? "+" : ""}${change}% vs previous period` + } + /> + } + detail="Among your top links" + /> + } + detail="Among reported sources" + /> +
+
+
+
+

Clicks over time

+

Clicks by day · UTC

+
+ + + Clicks + +
+ {data.daily.some((day) => day.clicks > 0) ? ( + + ) : ( + } + title="No clicks in this period" + > +

+ Once your links are opened, their clicks will appear + here. +

+
+ )} +
+
+
+

+ Top links +

+ {data.topLinks.length ? ( +
+ {data.topLinks.map((item) => ( +
+ + {item.title || item.slug} + /r/{item.slug} + + {item.clicks.toLocaleString()} +
+ ))} +
+ ) : ( +

No link traffic in this period.

+ )} +
+ + + + + +
+ + )} + + ) + )} + + ); +} +function Stat({ + label, + value, + detail, + icon, +}: { + label: string; + value: string; + detail: string; + icon: React.ReactNode; +}) { + return ( +
+
+ {label} + {icon} +
+ {value} +

{detail}

+
+ ); +} +function BreakdownCard({ + title, + items, +}: { + title: string; + items: Breakdown[]; +}) { + const max = Math.max(...items.map((item) => item.clicks), 1); + return ( +
+

+ {title} + +

+ {items.length ? ( +
+ {items.slice(0, 8).map((item) => ( +
+
+ {item.name || "Unknown"} + {item.clicks.toLocaleString()} +
+ + + +
+ ))} +
+ ) : ( +

No {title.toLowerCase()} data in this period.

+ )} +
+ ); +} +function TrafficChart({ daily }: { daily: Analytics["daily"] }) { + const max = Math.max(...daily.map((day) => day.clicks), 1); + const coordinates = daily.map( + (day, i) => + `${50 + (i / Math.max(daily.length - 1, 1)) * 900},${210 - (day.clicks / max) * 165}`, + ); + return ( +
+ `${day.date}: ${day.clicks}`).join(", ")}`} + > + + + + + + + {[0, 0.5, 1].map((fraction) => ( + + + + {Math.round(max * fraction)} + + + ))} + + + {[0, Math.floor((daily.length - 1) / 2), daily.length - 1].map( + (index, i) => ( + + {daily[index]?.date} + + ), + )} + +
+ ); +} diff --git a/applications/shortwave/src/routes/_app.domains.tsx b/applications/shortwave/src/routes/_app.domains.tsx new file mode 100644 index 00000000..c88ceba3 --- /dev/null +++ b/applications/shortwave/src/routes/_app.domains.tsx @@ -0,0 +1,177 @@ +import { createFileRoute } from "@tanstack/react-router"; +import { useCallback, useEffect, useRef, useState } from "react"; +import { Check, Copy, Globe, LoaderCircle, Plus, RefreshCw, Trash2 } from "lucide-react"; +import type { CustomDomain } from "../lib/custom-domains"; +import { addDomain, checkDomainDns, fetchDomains, removeDomain } from "./-domains-api"; +import { EmptyState, ErrorNotice, Loading, Modal, PrimaryButton, SectionHeading, message } from "../components/ui"; +import "../components/domains.css"; + +export const Route = createFileRoute("/_app/domains")({ component: DomainsPage }); + +function DomainsPage() { + const [domains, setDomains] = useState([]); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(""); + const [adding, setAdding] = useState(false); + const [deleting, setDeleting] = useState(null); + const addTrigger = useRef(null); + const load = useCallback(async () => { + setLoading(true); + setError(""); + try { setDomains(await fetchDomains()); } + catch (err) { setError(message(err)); } + finally { setLoading(false); } + }, []); + useEffect(() => { void load(); }, [load]); + const closeAdd = useCallback(() => setAdding(false), []); + const closeDelete = useCallback(() => setDeleting(null), []); + return <> + + setAdding(true)}>Add domain +
} /> + {loading ? : error ? <> + + + : <> + {!domains.length ? }>{null} : +
{domains.map((domain) => setDomains((items) => items.map((item) => item.id === saved.id ? saved : item))} + onRemove={() => setDeleting(domain)} />)}
} + } + {adding && { + setDomains((items) => [saved, ...items.filter((item) => item.id !== saved.id)]); + setAdding(false); + }} />} + {deleting && { + setDomains((items) => items.filter((item) => item.id !== deleting.id)); + setDeleting(null); + requestAnimationFrame(() => addTrigger.current?.querySelector("button")?.focus()); + }} />} + ; +} + +function DomainCard({ domain, onChange, onRemove }: { + domain: CustomDomain; + onChange: (domain: CustomDomain) => void; + onRemove: () => void; +}) { + const [busy, setBusy] = useState(false); + const checking = useRef(false); + const [error, setError] = useState(""); + const [notice, setNotice] = useState(""); + async function check() { + if (checking.current) return; + checking.current = true; setBusy(true); setError(""); setNotice(""); + try { + const saved = await checkDomainDns({ data: domain.id }); + onChange(saved); + if (saved.status === "verified" && !saved.verificationError) setNotice("Ownership verified."); + } catch (err) { setError(message(err)); } + finally { checking.current = false; setBusy(false); } + } + return
+
+
+
+ {domain.status === "verified" && !domain.routingReady &&

Ownership verified. Hosting setup is required before creating links on this domain.

} +

{domain.status === "verified" ? "Keep this TXT record in your DNS settings to allow ownership rechecks." : "Add this TXT record in your domain’s DNS settings, then check DNS."}

+ + + + + + + + + +
Ownership verification record for {domain.hostname}
TypeNameValueTTL
TXTAuto
+

In Cloudflare, paste the full Name above. If your DNS provider appends the zone name, enter only the part before it.

+ {error && } + {domain.verificationError && } +
+ + {domain.lastCheckedAt && Last checked } +
+ {notice &&

{notice}

} +
+
; +} + +function DnsValue({ label, value }: { label: string; value: string }) { + const [feedback, setFeedback] = useState<"copied" | "error" | null>(null); + useEffect(() => { + if (feedback !== "copied") return; + const timer = setTimeout(() => setFeedback(null), 2500); + return () => clearTimeout(timer); + }, [feedback]); + return
+
{value}
+ {feedback && {feedback === "copied" ? "Copied" : "Copy failed. Select the text and copy it."}} +
; +} + +function AddDomainDialog({ onClose, onSaved }: { onClose: () => void; onSaved: (domain: CustomDomain) => void }) { + const [hostname, setHostname] = useState(""); + const hostnameInput = useRef(null); + // Run after Modal records the trigger and applies its initial focus. + useEffect(() => { hostnameInput.current?.focus(); }, []); + const [busy, setBusy] = useState(false); + const saving = useRef(false); + const [error, setError] = useState(""); + const close = useCallback(() => { if (!saving.current) onClose(); }, [onClose]); + return +
{ + event.preventDefault(); + if (saving.current) return; + saving.current = true; setBusy(true); setError(""); + try { onSaved(await addDomain({ data: hostname })); } + catch (err) { setError(message(err)); } + finally { saving.current = false; setBusy(false); } + }}> +
+ {error && } + +

Enter a domain or subdomain you own, without a protocol or path.

+
+
+ {busy ? "Adding…" : "Add domain"} +
+
+
; +} + +function RemoveDomainDialog({ domain, onClose, onRemoved }: { domain: CustomDomain; onClose: () => void; onRemoved: () => void }) { + const [busy, setBusy] = useState(false); + const saving = useRef(false); + const [error, setError] = useState(""); + const close = useCallback(() => { if (!saving.current) onClose(); }, [onClose]); + return +
+ {error && } +

Remove {domain.hostname} from your account?

+

You can delete its verification TXT record from your DNS settings afterward. Adding the domain again requires a new record.

+
+
+ { + if (saving.current) return; + saving.current = true; setBusy(true); setError(""); + try { await removeDomain({ data: domain.id }); onRemoved(); } + catch (err) { setError(message(err)); } + finally { saving.current = false; setBusy(false); } + }}>{busy ? "Removing…" : "Remove domain"} +
+
; +} diff --git a/applications/shortwave/src/routes/_app.folders.tsx b/applications/shortwave/src/routes/_app.folders.tsx new file mode 100644 index 00000000..b34d34a4 --- /dev/null +++ b/applications/shortwave/src/routes/_app.folders.tsx @@ -0,0 +1,29 @@ +import { createFileRoute } from "@tanstack/react-router"; +import { useCallback, useEffect, useState } from "react"; +import type { Folder } from "../lib/types"; +import { fetchFolders } from "./-api"; +import { FolderManager } from "../components/folder-manager"; +import { ErrorNotice, Loading, SectionHeading, message } from "../components/ui"; + +export const Route = createFileRoute("/_app/folders")({ component: FoldersPage }); + +function FoldersPage() { + const [folders, setFolders] = useState([]); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(""); + const load = useCallback(async () => { + setLoading(true); + setError(""); + try { setFolders(await fetchFolders()); } + catch (err) { setError(message(err)); } + finally { setLoading(false); } + }, []); + useEffect(() => { void load(); }, [load]); + return <> + + {loading ? : error ? <> + + + : } + ; +} diff --git a/applications/shortwave/src/routes/_app.links.tsx b/applications/shortwave/src/routes/_app.links.tsx new file mode 100644 index 00000000..6269132b --- /dev/null +++ b/applications/shortwave/src/routes/_app.links.tsx @@ -0,0 +1,275 @@ +import { createFileRoute, Link as RouterLink } from "@tanstack/react-router"; +import { useCallback, useEffect, useMemo, useState } from "react"; +import { + ArrowUpRight, + Folder, + Link2, + Plus, + QrCode, + Search, + Settings2, + Tag, + BarChart3, +} from "lucide-react"; +import type { Link, Folder as FolderValue } from "../lib/types"; +import { fetchLinks, fetchFolders } from "./-api"; +import { + CopyButton, + EmptyState, + ErrorNotice, + Loading, + message, + PrimaryButton, + SectionHeading, + shortUrl, +} from "../components/ui"; +import { LinkEditor } from "../components/link-editor"; +import { QrEditor } from "../components/qr-editor"; +import { AppSelect } from "../components/app-select"; +import { useLinkShortcuts } from "../components/workspace-shortcuts"; +import "../components/folders.css"; +export const Route = createFileRoute("/_app/links")({ + validateSearch: (search: Record): { folderId?: string } => { + const folderId = search.folderId; + return typeof folderId === "string" && (folderId === "unfiled" || /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(folderId)) + ? { folderId: folderId.toLowerCase() } : {}; + }, + component: LinksPage, +}); +function LinksPage() { + const [folders, setFolders] = useState([]); + const folderId = Route.useSearch().folderId ?? ""; + const navigate = Route.useNavigate(); + const setFolderId = useCallback((value: string) => { + void navigate({ search: value ? { folderId: value } : {}, resetScroll: false }); + }, [navigate]); + const [links, setLinks] = useState([]); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(""); + const [search, setSearch] = useState(""); + const [tag, setTag] = useState(""); + const [editor, setEditor] = useState(null); + const [qr, setQr] = useState(null); + const closeEditor = useCallback(() => setEditor(null), []); + const closeQr = useCallback(() => setQr(null), []); + const createLink = useCallback(() => setEditor("new"), []); + const focusSearch = useCallback(() => document.querySelector('[aria-label="Search links"]')?.focus(), []); + useLinkShortcuts(createLink, focusSearch); + const load = useCallback(async () => { + setLoading(true); + setError(""); + try { + const [loadedLinks, loadedFolders] = await Promise.all([fetchLinks({ data: {} }), fetchFolders()]); + setLinks(loadedLinks); setFolders(loadedFolders); + } catch (err) { + setError(message(err)); + } finally { + setLoading(false); + } + }, []); + useEffect(() => { + void load(); + }, [load]); + const tags = useMemo( + () => [...new Set(links.flatMap((link) => link.tags))].sort(), + [links], + ); + const missingFolder = !loading && !error && !!folderId && folderId !== "unfiled" && !folders.some((folder) => folder.id === folderId); + const filtered = links.filter( + (link) => + (!tag || link.tags.includes(tag)) && + (!folderId || (folderId === "unfiled" ? !link.folderId : link.folderId === folderId)) && + `${link.title} ${link.destination} ${link.slug} ${link.tags.join(" ")}` + .toLowerCase() + .includes(search.toLowerCase()), + ); + return ( + <> + setEditor("new")} aria-keyshortcuts="C" title="Create a link (C)"> + + Create a link + + } + /> +
+

+ All links {links.length} +

+
+
+ + } + aria-label="Filter links by folder" + value={folderId} + onValueChange={setFolderId} + disabled={loading} + options={[{ value: "", label: "All folders" }, { value: "unfiled", label: "No folder" }, ...folders.map((folder) => ({ value: folder.id, label: folder.name })), ...(folderId && folderId !== "unfiled" && !folders.some((folder) => folder.id === folderId) ? [{ value: folderId, label: loading ? "Loading folder…" : "Unavailable folder" }] : [])]} + /> + } + aria-label="Filter links by tag" + value={tag} + onValueChange={setTag} + options={[{ value: "", label: "All tags" }, ...tags.map((item) => ({ value: item, label: item }))]} + /> +
+ {loading ? ( + + ) : error ? ( + <> + + + + ) : !missingFolder && filtered.length ? ( +
+ {filtered.map((link) => ( +
+
+ +
+
+
+ + {!link.enabled && ( + Disabled + )} +
+ + {shortUrl(link.slug, link.domainHostname).replace(/^https?:\/\//, "")} + + +

+ {link.resolvedUrl} +

+
+ {link.folderId && folders.find((folder) => folder.id === link.folderId) && } + {link.tags.map((item) => ( + + ))} + + {new Date(link.createdAt).toLocaleDateString(undefined, { + month: "short", + day: "numeric", + year: "numeric", + })} + +
+
+
+ + + + + + +
+
+ ))} +
+ ) : ( + } + title={ + missingFolder ? "Folder unavailable" : search || tag || folderId + ? "No matching links" + : "No links yet" + } + > + {(search || tag || folderId) && ( + + )} + + )} + {editor && ( + { + setLinks((items) => [ + saved, + ...items.filter((item) => item.id !== saved.id), + ]); + setEditor(null); + void fetchFolders().then(setFolders).catch((err) => setError(message(err))); + }} + /> + )} + {qr && ( + + setLinks((items) => + items.map((item) => + item.id === qr.id ? { ...item, qrStyle: style } : item, + ), + ) + } + /> + )} + + ); +} diff --git a/applications/shortwave/src/routes/_app.templates.tsx b/applications/shortwave/src/routes/_app.templates.tsx new file mode 100644 index 00000000..4820de5a --- /dev/null +++ b/applications/shortwave/src/routes/_app.templates.tsx @@ -0,0 +1,229 @@ +import { createFileRoute } from "@tanstack/react-router"; +import { useCallback, useEffect, useState, type FormEvent } from "react"; +import { + ArrowUpRight, + Plus, + SlidersHorizontal, + Trash2, + Pencil, +} from "lucide-react"; +import type { UtmTemplate, UtmValues } from "../lib/types"; +import { fetchTemplates, removeTemplate, saveTemplate } from "./-api"; +import { + EmptyState, + ErrorNotice, + Loading, + message, + Modal, + PrimaryButton, + SectionHeading, +} from "../components/ui"; +import { UtmFields } from "../components/link-editor"; +export const Route = createFileRoute("/_app/templates")({ + component: TemplatesPage, +}); +function TemplatesPage() { + const [templates, setTemplates] = useState([]); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(""); + const [editor, setEditor] = useState(null); + const [deleting, setDeleting] = useState(null); + const [busy, setBusy] = useState(false); + const close = useCallback(() => setEditor(null), []); + const closeDelete = useCallback(() => setDeleting(null), []); + const load = useCallback(async () => { + setLoading(true); + setError(""); + try { + setTemplates(await fetchTemplates()); + } catch (err) { + setError(message(err)); + } finally { + setLoading(false); + } + }, []); + useEffect(() => { + void load(); + }, [load]); + async function remove() { + if (!deleting) return; + setBusy(true); + try { + await removeTemplate({ data: deleting.id }); + setTemplates((items) => items.filter((item) => item.id !== deleting.id)); + setDeleting(null); + } catch (err) { + setError(message(err)); + setDeleting(null); + } finally { + setBusy(false); + } + } + return ( + <> + setEditor("new")}> + + New template + + } + /> + {error && } + {loading ? ( + + ) : !templates.length ? ( + } + title="No templates yet" + > + {null} + + ) : ( +
+ {templates.map((template) => ( +
+
+ +
+

{template.name}

+
+ {Object.entries(template.values) + .filter(([, value]) => value) + .map(([key, value]) => ( +
+
utm_{key}
+
{value}
+
+ ))} +
+
+ + +
+
+ ))} +
+ )} + {editor && ( + { + setTemplates((items) => [ + saved, + ...items.filter((item) => item.id !== saved.id), + ]); + setEditor(null); + }} + /> + )} + {deleting && ( + +
+

+ “{deleting.name}” will be removed. Links you’ve already created + will keep their parameters. +

+
+
+ + void remove()} + > + {busy ? "Deleting…" : "Delete template"} + +
+
+ )} + + ); +} +function TemplateEditor({ + template, + onClose, + onSaved, +}: { + template?: UtmTemplate; + onClose: () => void; + onSaved: (value: UtmTemplate) => void; +}) { + const [name, setName] = useState(template?.name || ""); + const [values, setValues] = useState(template?.values || {}); + const [error, setError] = useState(""); + const [busy, setBusy] = useState(false); + async function submit(event: FormEvent) { + event.preventDefault(); + setBusy(true); + setError(""); + try { + onSaved(await saveTemplate({ data: { id: template?.id, name, values } })); + } catch (err) { + setError(message(err)); + } finally { + setBusy(false); + } + } + return ( + +
+
+ {error && } + + +
+
+ + + {busy ? "Saving…" : "Save template"} + + +
+
+
+ ); +} diff --git a/applications/shortwave/src/routes/_app.tsx b/applications/shortwave/src/routes/_app.tsx new file mode 100644 index 00000000..57d68738 --- /dev/null +++ b/applications/shortwave/src/routes/_app.tsx @@ -0,0 +1,9 @@ +import { createFileRoute, redirect } from "@tanstack/react-router"; +import { AppShell } from "../components/shell"; +import { checkSession } from "./-api"; +export const Route = createFileRoute("/_app")({ + beforeLoad: async () => { + if (!(await checkSession())) throw redirect({ to: "/sign-in/$" }); + }, + component: AppShell, +}); diff --git a/applications/shortwave/src/routes/index.tsx b/applications/shortwave/src/routes/index.tsx new file mode 100644 index 00000000..b15e9a5e --- /dev/null +++ b/applications/shortwave/src/routes/index.tsx @@ -0,0 +1,129 @@ +import { useUser } from "@clerk/tanstack-react-start"; +import { createFileRoute } from "@tanstack/react-router"; +import { + ArrowUpRight, + BarChart3, + Link2, + QrCode, + ScanLine, +} from "lucide-react"; +import { Brand } from "../components/ui"; +export const Route = createFileRoute("/")({ component: Landing }); + +function NavigationAction() { + if (!import.meta.env.VITE_CLERK_PUBLISHABLE_KEY) { + return ; + } + return ; +} + +function SessionNavigationAction() { + const { isLoaded, isSignedIn } = useUser(); + if (!isLoaded) { + return ( + + ); + } + return ; +} + +function AccountAction({ signedIn }: { signedIn: boolean }) { + return ( + + {signedIn ? "Dashboard" : "Get started"} + + ); +} + +function Landing() { + return ( +
+
+ + +
+
+
+
+

+ Small links. +
+ Big energy. +

+

+ Turn a long URL into your next great connection. +
Memorable links, custom QR codes, + and a clearer +
picture of what’s working. All in + one place. +

+ + Make your first link + +
+
+
+ {[ + { + icon: Link2, + title: "Make it yours.", + text: "Shorten, customize, and organize. Give every destination a link worth sharing.", + }, + { + icon: QrCode, + title: "Go beyond the screen.", + text: "Create a QR code with your colors and logo. Print it, share it, take it anywhere.", + }, + { + icon: BarChart3, + title: "Find your signal.", + text: "See the clicks, campaigns, and connections that move your story forward.", + }, + ].map(({ icon: Icon, title, text }) => ( +
+
+ +
+

{title}

+

{text}

+
+ ))} +
+
+
+ + © {new Date().getFullYear()} Shortwave +
+
+ ); +} diff --git a/applications/shortwave/src/routes/r.$slug.ts b/applications/shortwave/src/routes/r.$slug.ts new file mode 100644 index 00000000..8d86bb4e --- /dev/null +++ b/applications/shortwave/src/routes/r.$slug.ts @@ -0,0 +1,50 @@ +import { createFileRoute } from "@tanstack/react-router"; + +async function resolve(slug: string, request: Request, head = false) { + try { + const { resolveRedirect } = await import("../server/service"); + const result = await resolveRedirect( + slug, + { + referrer: request.headers.get("referer"), + userAgent: request.headers.get("user-agent") || "", + }, + !head, + new URL(request.url).hostname, + ); + const headers = { + "Cache-Control": "no-store", + "X-Robots-Tag": "noindex", + "Referrer-Policy": "no-referrer", + }; + if (result.status === 302) + return new Response(null, { + status: 302, + headers: { ...headers, Location: result.location }, + }); + return new Response( + head + ? null + : result.status === 410 + ? "This link has been disabled." + : "This short link does not exist.", + { status: result.status, headers }, + ); + } catch { + return new Response( + head ? null : "This link is temporarily unavailable. Please try again.", + { + status: 503, + headers: { "Cache-Control": "no-store", "Retry-After": "30" }, + }, + ); + } +} +export const Route = createFileRoute("/r/$slug")({ + server: { + handlers: { + GET: ({ params, request }) => resolve(params.slug, request), + HEAD: ({ params, request }) => resolve(params.slug, request, true), + }, + }, +}); diff --git a/applications/shortwave/src/routes/sign-in.$.tsx b/applications/shortwave/src/routes/sign-in.$.tsx new file mode 100644 index 00000000..e529941b --- /dev/null +++ b/applications/shortwave/src/routes/sign-in.$.tsx @@ -0,0 +1,15 @@ +import { createFileRoute } from "@tanstack/react-router"; +import { SignIn } from "@clerk/tanstack-react-start"; +import { Brand } from "../components/ui"; +import { AuthUnavailable } from "../components/shell"; +export const Route = createFileRoute("/sign-in/$")({ + component: () => + import.meta.env.VITE_CLERK_PUBLISHABLE_KEY ? ( +
+ + +
+ ) : ( + + ), +}); diff --git a/applications/shortwave/src/routes/sign-up.$.tsx b/applications/shortwave/src/routes/sign-up.$.tsx new file mode 100644 index 00000000..11cd06fe --- /dev/null +++ b/applications/shortwave/src/routes/sign-up.$.tsx @@ -0,0 +1,15 @@ +import { createFileRoute } from "@tanstack/react-router"; +import { SignUp } from "@clerk/tanstack-react-start"; +import { Brand } from "../components/ui"; +import { AuthUnavailable } from "../components/shell"; +export const Route = createFileRoute("/sign-up/$")({ + component: () => + import.meta.env.VITE_CLERK_PUBLISHABLE_KEY ? ( +
+ + +
+ ) : ( + + ), +}); diff --git a/applications/shortwave/src/server/analytics.ts b/applications/shortwave/src/server/analytics.ts new file mode 100644 index 00000000..c90eac5f --- /dev/null +++ b/applications/shortwave/src/server/analytics.ts @@ -0,0 +1,216 @@ +import { z } from "zod"; +import type { Analytics, AnalyticsFilter, Breakdown } from "../lib/types"; +import { getClickHouse, getPostgres } from "./db"; +import { getAccountId, getLink } from "./service"; +import { runtimeEnvironment } from "./runtime"; + +const filterSchema = z + .object({ + days: z.union([z.literal(7), z.literal(30), z.literal(90)]).default(30), + linkId: z.string().uuid().optional(), + campaign: z.string().max(200).optional(), + tag: z.string().max(40).optional(), + }) + .strict(); + +export async function getAnalytics( + clerkUserId: string, + input: AnalyticsFilter = {}, +): Promise { + const filter = filterSchema.parse(input); + const accountId = await getAccountId(clerkUserId); + if (filter.linkId) await getLink(clerkUserId, filter.linkId); + const pending = await getPostgres().query( + "SELECT count(*)::int AS count FROM click_outbox WHERE account_id = $1", + [accountId], + ); + const pendingEvents = pending.rows[0].count as number; + const empty: Analytics = { + status: "unavailable", + message: null, + totalClicks: 0, + previousClicks: 0, + daily: [], + topLinks: [], + referrers: [], + countries: [], + devices: [], + browsers: [], + campaigns: [], + lastEventAt: null, + pendingEvents, + }; + try { + const client = getClickHouse(); + const cdcDatabase = + runtimeEnvironment("CLICKHOUSE_CDC_DATABASE") || + runtimeEnvironment("CLICKHOUSE_DATABASE") || + "default"; + if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(cdcDatabase)) + throw new Error("Invalid CDC database name."); + const now = new Date(); + // Complete UTC days plus today, and a preceding interval of the same length. + const end = new Date( + Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate() + 1), + ); + const start = new Date(end.getTime() - filter.days * 86400_000); + const previous = new Date(start.getTime() - filter.days * 86400_000); + const timestamp = (date: Date) => + date.toISOString().replace("T", " ").replace("Z", ""); + const params = { + account: accountId, + start: timestamp(start), + end: timestamp(end), + previous: timestamp(previous), + link: filter.linkId ?? "", + campaign: filter.campaign ?? "", + tag: filter.tag ?? "", + }; + // Filter by current replicated tags. FINAL is essential before replacement merges complete. + // Membership avoids multiplying a click when a link has more than one matching tag. + const scope = `account_id = {account:UUID} AND is_demo = 0 + ${filter.linkId ? "AND link_id = {link:UUID}" : ""} + ${filter.campaign !== undefined ? "AND utm_campaign = {campaign:String}" : ""} + ${ + filter.tag + ? `AND link_id IN (SELECT id FROM ${cdcDatabase}.cdc_links FINAL + WHERE account_id = {account:UUID} AND _peerdb_is_deleted = 0 AND has(tags, {tag:String}))` + : "" + }`; + const current = `${scope} AND occurred_at >= {start:DateTime64(3)} AND occurred_at < {end:DateTime64(3)}`; + const query = async (sql: string): Promise => { + const result = await client.query({ + query: sql, + query_params: params, + format: "JSONEachRow", + }); + return result.json(); + }; + const breakdown = async ( + column: + "referrer_domain" | "country" | "device" | "browser" | "utm_campaign", + ): Promise => { + const rows = await query<{ + name: string; + clicks: string; + }>(`SELECT ${column} AS name, uniqExact(event_id) AS clicks + FROM click_events WHERE ${current} GROUP BY name ORDER BY clicks DESC LIMIT 10`); + return rows.map((row) => ({ + name: + row.name || + (column === "referrer_domain" ? "Direct / unknown" : "Not set"), + clicks: Number(row.clicks), + })); + }; + const tagMetadataCurrent = filter.tag + ? Promise.all([ + getPostgres().query( + "SELECT id, revision FROM links WHERE account_id = $1", + [accountId], + ), + query<{ id: string; revision: string }>(`SELECT + toString(id) AS id, toString(revision) AS revision + FROM ${cdcDatabase}.cdc_links FINAL + WHERE account_id = {account:UUID} AND _peerdb_is_deleted = 0`), + ]).then(([postgresLinks, cdcLinks]) => { + if (postgresLinks.rows.length !== cdcLinks.length) return false; + const cdcRevisions = new Map( + cdcLinks.map((link) => [link.id, link.revision]), + ); + return postgresLinks.rows.every( + (link) => + cdcRevisions.get(link.id) === String(link.revision), + ); + }) + : Promise.resolve(true); + const [ + totals, + daily, + top, + referrers, + countries, + devices, + browsers, + campaigns, + tagsCurrent, + ] = await Promise.all([ + query<{ total: string; previous: string; last: string | null }>(`SELECT + uniqExactIf(event_id, occurred_at >= {start:DateTime64(3)}) AS total, + uniqExactIf(event_id, occurred_at < {start:DateTime64(3)}) AS previous, + maxOrNull(occurred_at) AS last FROM click_events WHERE ${scope} + AND occurred_at >= {previous:DateTime64(3)} AND occurred_at < {end:DateTime64(3)}`), + query<{ + date: string; + clicks: string; + }>(`SELECT toString(toDate(occurred_at, 'UTC')) AS date, uniqExact(event_id) AS clicks + FROM click_events WHERE ${current} GROUP BY date ORDER BY date`), + query<{ + link_id: string; + clicks: string; + }>(`SELECT link_id, uniqExact(event_id) AS clicks + FROM click_events WHERE ${current} GROUP BY link_id ORDER BY clicks DESC LIMIT 10`), + breakdown("referrer_domain"), + breakdown("country"), + breakdown("device"), + breakdown("browser"), + breakdown("utm_campaign"), + tagMetadataCurrent, + ]); + const linkIds = top.map((row) => row.link_id); + const metadata = linkIds.length + ? await getPostgres().query( + "SELECT id, title, slug FROM links WHERE account_id = $1 AND id = ANY($2::uuid[])", + [accountId, linkIds], + ) + : { rows: [] }; + const links = new Map(metadata.rows.map((row) => [row.id, row])); + const dailyMap = new Map( + daily.map((row) => [row.date, Number(row.clicks)]), + ); + const totalClicks = Number(totals[0]?.total || 0); + return { + ...empty, + status: pendingEvents + ? "delayed" + : !tagsCurrent + ? "delayed" + : totalClicks + ? "ready" + : "no-data", + message: pendingEvents + ? `${pendingEvents} recorded requests are waiting to appear in analytics.` + : !tagsCurrent + ? "Tags are still syncing to analytics. Refresh in a moment." + : null, + totalClicks, + previousClicks: Number(totals[0]?.previous || 0), + lastEventAt: totals[0]?.last + ? `${totals[0].last.replace(" ", "T")}Z` + : null, + daily: Array.from({ length: filter.days }, (_, i) => { + const date = new Date(start.getTime() + i * 86400_000) + .toISOString() + .slice(0, 10); + return { date, clicks: dailyMap.get(date) ?? 0 }; + }), + topLinks: top.map((row) => ({ + linkId: row.link_id, + title: links.get(row.link_id)?.title || "Link", + slug: links.get(row.link_id)?.slug || "", + clicks: Number(row.clicks), + })), + referrers, + countries, + devices, + browsers, + campaigns, + }; + } catch { + return { + ...empty, + message: filter.tag + ? "Analytics or replicated tag metadata is unavailable. Try again shortly." + : "Analytics is temporarily unavailable. Your links still work.", + }; + } +} diff --git a/applications/shortwave/src/server/custom-domains.ts b/applications/shortwave/src/server/custom-domains.ts new file mode 100644 index 00000000..a880f3cc --- /dev/null +++ b/applications/shortwave/src/server/custom-domains.ts @@ -0,0 +1,188 @@ +import { randomBytes, randomUUID } from "node:crypto"; +import { Resolver } from "node:dns/promises"; +import { isIP } from "node:net"; +import { domainToASCII } from "node:url"; +import { z } from "zod"; +import { + DOMAIN_CHECK_INTERVAL_MS, + DOMAIN_VERIFICATION_LABEL, + DOMAIN_VERIFICATION_PREFIX, + MAX_CUSTOM_DOMAIN_LENGTH, + MAX_CUSTOM_DOMAINS, + type CustomDomain, +} from "../lib/custom-domains"; +import { getPostgres, transaction } from "./db"; +import { getAccountId, NotFoundError } from "./service"; +import { isCustomDomainHosted } from "./domain-routing"; + +const uuid = z.string().uuid(); +const DNS_TIMEOUT_MS = 5_000; +const DNS_CONCURRENCY = 8; +const missingMessage = "TXT record not found. Add the record shown, allow DNS changes to propagate, then check again."; +const mismatchMessage = "TXT value does not match. Copy the exact value shown, allow DNS changes to propagate, then check again."; +const unavailableMessage = "DNS lookup is temporarily unavailable. Try again shortly."; +const conflictMessage = "This domain cannot be verified for this account. Remove its existing verified claim or use another domain."; + +export function normalizeCustomDomain(input: string): string { + const invalid = () => new Error("Enter a public domain or subdomain, without a URL, path, or port."); + if (typeof input !== "string" || input.length > 1024) throw invalid(); + const value = input.trim().replace(/\.$/, ""); + if (!value || /[\s\u0000-\u001f\u007f/:?#@\\%*_\[\]]/.test(value)) throw invalid(); + const hostname = domainToASCII(value).toLowerCase(); + const labels = hostname.split("."); + // Leave room for the challenge label in the 253-byte DNS hostname limit. + if (!hostname || hostname.length > MAX_CUSTOM_DOMAIN_LENGTH || isIP(hostname) || + labels.length < 2 || labels.some((label) => !/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(label)) || + !/[a-z]/.test(labels.at(-1)!)) throw invalid(); + // IANA special-use names plus common private-network suffixes. + const reserved = ["localhost", "local", "test", "invalid", "example", "alt", "internal", "home", "lan", "onion", "arpa", "example.com", "example.net", "example.org"]; + if (reserved.some((suffix) => hostname === suffix || hostname.endsWith(`.${suffix}`))) throw invalid(); + return hostname; +} + +type DomainRow = { + id: string; + hostname: string; + verification_token: string; + status: CustomDomain["status"]; + verified_at: Date | null; + last_checked_at: Date | null; + verification_error: string | null; + verification_attempt: string | null; + created_at: Date; +}; + +function toDomain(row: DomainRow): CustomDomain { + return { + id: row.id, hostname: row.hostname, status: row.status, + routingReady: row.status === "verified" && isCustomDomainHosted(row.hostname), + verificationName: `${DOMAIN_VERIFICATION_LABEL}.${row.hostname}`, + verificationValue: `${DOMAIN_VERIFICATION_PREFIX}${row.verification_token}`, + verifiedAt: row.verified_at ? new Date(row.verified_at).toISOString() : null, + lastCheckedAt: row.last_checked_at ? new Date(row.last_checked_at).toISOString() : null, + verificationError: row.verification_error, + createdAt: new Date(row.created_at).toISOString(), + }; +} + +export type TxtResolver = { resolveTxt: (hostname: string) => Promise; cancel: () => void }; +export type TxtCheckDependencies = { createResolver?: () => TxtResolver; timeoutMs?: number }; +export type TxtCheckResult = { outcome: "match" | "missing" | "mismatch" | "unavailable"; error: string | null }; + +/** Each check owns its resolver, so timeout cancellation cannot cancel other checks. */ +export async function checkDomainTxt(name: string, value: string, dependencies: TxtCheckDependencies = {}): Promise { + const timeoutMs = Math.min(DNS_TIMEOUT_MS, Math.max(1, dependencies.timeoutMs ?? DNS_TIMEOUT_MS)); + const resolver = dependencies.createResolver?.() ?? new Resolver({ timeout: timeoutMs, tries: 1 }); + let timer: ReturnType | undefined; + try { + const answers = await Promise.race([ + resolver.resolveTxt(`${name}.`), // Absolute name avoids resolver search suffixes. + new Promise((_, reject) => { + timer = setTimeout(() => { + reject(Object.assign(new Error("DNS deadline exceeded"), { code: "ETIMEOUT" })); + resolver.cancel(); + }, timeoutMs); + }), + ]); + // Join chunks within one record, never concatenate separate TXT records. + if (answers.some((chunks) => chunks.join("") === value)) return { outcome: "match", error: null }; + return answers.length ? { outcome: "mismatch", error: mismatchMessage } : { outcome: "missing", error: missingMessage }; + } catch (error) { + if (["ENODATA", "ENOTFOUND"].includes((error as { code?: string }).code || "")) + return { outcome: "missing", error: missingMessage }; + return { outcome: "unavailable", error: unavailableMessage }; + } finally { clearTimeout(timer); } +} + +export async function listDomains(clerkUserId: string): Promise { + const accountId = await getAccountId(clerkUserId); + const result = await getPostgres().query("SELECT * FROM custom_domains WHERE account_id = $1 ORDER BY created_at DESC, id", [accountId]); + return result.rows.map(toDomain); +} + +export async function addDomain(clerkUserId: string, input: string): Promise { + const hostname = normalizeCustomDomain(input); + return transaction(async (db) => { + const accountId = await getAccountId(clerkUserId, db); + // The account upsert holds a row lock, serializing the per-account limit. + const existing = await db.query("SELECT * FROM custom_domains WHERE account_id = $1 AND hostname = $2", [accountId, hostname]); + if (existing.rows[0]) return toDomain(existing.rows[0]); + const count = await db.query("SELECT count(*)::int AS count FROM custom_domains WHERE account_id = $1", [accountId]); + if (count.rows[0].count >= MAX_CUSTOM_DOMAINS) throw new Error(`You can add up to ${MAX_CUSTOM_DOMAINS} domains. Remove one before adding another.`); + const result = await db.query( + "INSERT INTO custom_domains (account_id, hostname, verification_token) VALUES ($1, $2, $3) RETURNING *", + [accountId, hostname, randomBytes(32).toString("hex")], + ); + return toDomain(result.rows[0]); + }); +} + +let checksInFlight = 0; +export async function verifyDomain(clerkUserId: string, id: string, dependencies: TxtCheckDependencies = {}): Promise { + uuid.parse(id); + if (checksInFlight >= DNS_CONCURRENCY) throw new Error("DNS checks are busy. Try again shortly."); + checksInFlight++; + try { + const accountId = await getAccountId(clerkUserId); + const attempt = randomUUID(); + const row = await transaction(async (db) => { + const result = await db.query( + `UPDATE custom_domains SET last_checked_at = clock_timestamp(), verification_attempt = $3 + WHERE account_id = $1 AND id = $2 + AND (last_checked_at IS NULL OR last_checked_at <= clock_timestamp() - ($4::int * interval '1 millisecond')) + RETURNING *`, [accountId, id, attempt, DOMAIN_CHECK_INTERVAL_MS], + ); + if (result.rows[0]) return result.rows[0]; + const owned = await db.query("SELECT id FROM custom_domains WHERE account_id = $1 AND id = $2", [accountId, id]); + if (!owned.rows[0]) throw new NotFoundError(); + throw new Error("Wait 10 seconds between DNS checks."); + }); + const domain = toDomain(row); + // DNS runs after the reservation commits; no database lock is held during I/O. + const result = await checkDomainTxt(domain.verificationName, domain.verificationValue, dependencies); + return await transaction(async (db) => { + await db.query("SAVEPOINT domain_verification"); + let updated; + try { + updated = await db.query( + `UPDATE custom_domains SET + status = CASE WHEN $4 = 'unavailable' THEN status WHEN $4 = 'match' THEN 'verified' ELSE 'pending' END, + verified_at = CASE WHEN $4 = 'unavailable' THEN verified_at WHEN $4 = 'match' THEN COALESCE(verified_at, clock_timestamp()) ELSE NULL END, + verification_error = $5 + WHERE account_id = $1 AND id = $2 AND verification_attempt = $3 RETURNING *`, + [accountId, id, attempt, result.outcome, result.error], + ); + } catch (error) { + if ((error as { code?: string }).code !== "23505") throw error; + await db.query("ROLLBACK TO SAVEPOINT domain_verification"); + updated = await db.query( + "UPDATE custom_domains SET verification_error = $4 WHERE account_id = $1 AND id = $2 AND verification_attempt = $3 RETURNING *", + [accountId, id, attempt, conflictMessage], + ); + } + if (updated.rows[0]) return toDomain(updated.rows[0]); + // A later attempt wins, and deletion must never be undone by an old check. + const current = await db.query("SELECT * FROM custom_domains WHERE account_id = $1 AND id = $2", [accountId, id]); + if (!current.rows[0]) throw new NotFoundError(); + return toDomain(current.rows[0]); + }); + } finally { checksInFlight--; } +} + +export async function removeDomain(clerkUserId: string, id: string): Promise { + uuid.parse(id); + const accountId = await getAccountId(clerkUserId); + try { + const result = await getPostgres().query("DELETE FROM custom_domains WHERE account_id = $1 AND id = $2 RETURNING id", [accountId, id]); + if (!result.rows[0]) throw new NotFoundError(); + } catch (error) { + const constraintError = error as { code?: string; constraint?: string }; + // RESTRICT may report restrict_violation, while FK checks report + // foreign_key_violation. Only translate this domain-link constraint. + if (["23001", "23503"].includes(constraintError.code || "") && + constraintError.constraint === "links_owned_domain_fk") { + throw new Error("This domain has links and cannot be removed, including when its links are disabled."); + } + throw error; + } +} diff --git a/applications/shortwave/src/server/db.ts b/applications/shortwave/src/server/db.ts new file mode 100644 index 00000000..542b66ac --- /dev/null +++ b/applications/shortwave/src/server/db.ts @@ -0,0 +1,101 @@ +import { readFileSync } from "node:fs"; +import { Pool, type PoolClient } from "pg"; +import { ClickHouseLogLevel, createClient } from "@clickhouse/client-web"; +import { getWorkersRuntime, runtimeEnvironment } from "./runtime"; + +let postgres: Pool | undefined; +let clickhouse: ReturnType | undefined; + +export function getPostgres(): Pool { + const runtime = getWorkersRuntime(); + if (runtime) { + if (!runtime.postgres) { + runtime.postgres = new Pool({ + connectionString: runtime.env.HYPERDRIVE.connectionString, + // Hyperdrive maintains the origin pool and TLS connection. These + // lightweight clients are scoped to this invocation only. + max: 5, + connectionTimeoutMillis: 5000, + idleTimeoutMillis: 10_000, + statement_timeout: 10_000, + }); + runtime.postgres.on("error", () => + console.error("An idle Postgres connection failed."), + ); + } + return runtime.postgres; + } + if (postgres) return postgres; + const value = process.env.DATABASE_URL; + if (!value) throw new Error("DATABASE_URL is not configured."); + const connection = new URL(value); + const caPath = process.env.PG_CA_CERT_PATH; + const local = ["localhost", "127.0.0.1", "::1", "[::1]"].includes( + connection.hostname, + ); + // pg's URL SSL arguments replace explicit SSL options, including a supplied CA. + // Remote connections always verify the server; local development can be plain TCP. + for (const key of ["sslmode", "sslcert", "sslkey", "sslrootcert"]) + connection.searchParams.delete(key); + postgres = new Pool({ + connectionString: connection.toString(), + ssl: caPath + ? { ca: readFileSync(caPath, "utf8"), rejectUnauthorized: true } + : local + ? false + : { rejectUnauthorized: true }, + max: 10, + connectionTimeoutMillis: 5000, + idleTimeoutMillis: 30_000, + statement_timeout: 10_000, + }); + postgres.on("error", () => + console.error("An idle Postgres connection failed."), + ); + return postgres; +} + +export function getClickHouse() { + const runtime = getWorkersRuntime(); + const existing = runtime ? runtime.clickhouse : clickhouse; + if (existing) return existing; + const url = runtimeEnvironment("CLICKHOUSE_URL"); + if (!url) + throw new Error("ClickHouse analytics is not configured."); + const client = createClient({ + url, + username: runtimeEnvironment("CLICKHOUSE_USERNAME") || "default", + password: runtimeEnvironment("CLICKHOUSE_PASSWORD") || "", + database: runtimeEnvironment("CLICKHOUSE_DATABASE") || "default", + request_timeout: 10_000, + // Driver errors can include query or event values. Callers emit safe status + // messages instead of sending raw server responses to application logs. + log: { level: ClickHouseLogLevel.OFF }, + }); + if (runtime) runtime.clickhouse = client; + else clickhouse = client; + return client; +} + +export async function transaction( + fn: (client: PoolClient) => Promise, +): Promise { + const client = await getPostgres().connect(); + try { + await client.query("BEGIN"); + const result = await fn(client); + await client.query("COMMIT"); + return result; + } catch (error) { + await client.query("ROLLBACK"); + throw error; + } finally { + client.release(); + } +} + +export async function closeDatabases() { + await Promise.all([postgres?.end(), clickhouse?.close()]); + postgres = undefined; + clickhouse = undefined; +} diff --git a/applications/shortwave/src/server/domain-routing.ts b/applications/shortwave/src/server/domain-routing.ts new file mode 100644 index 00000000..a44c7a30 --- /dev/null +++ b/applications/shortwave/src/server/domain-routing.ts @@ -0,0 +1,11 @@ +import { runtimeEnvironment } from "./runtime"; + +/** Hosting configuration is trusted server state, separate from DNS ownership. */ +export function isCustomDomainHosted(hostname: string): boolean { + return (runtimeEnvironment("PUBLIC_CUSTOM_DOMAINS") || "").split(",") + .some((value) => value.trim().toLowerCase() === hostname); +} + +export function defaultLinkHostname(): string { + return new URL(runtimeEnvironment("APP_URL") || "http://localhost:4317").hostname.toLowerCase(); +} diff --git a/applications/shortwave/src/server/outbox.ts b/applications/shortwave/src/server/outbox.ts new file mode 100644 index 00000000..90554183 --- /dev/null +++ b/applications/shortwave/src/server/outbox.ts @@ -0,0 +1,49 @@ +import { getClickHouse, transaction } from "./db"; +import type { ClickEvent } from "../lib/types"; +import { z } from "zod"; + +/** Run from a persistent worker/scheduler. It is safe for several workers to overlap. */ +export async function flushOutbox( + batchSize = 500, + accountId?: string, +): Promise<{ delivered: number; failed: number }> { + if (!Number.isInteger(batchSize) || batchSize < 1 || batchSize > 1000) + throw new Error("Batch size must be between 1 and 1,000."); + // Trusted maintenance callers may drain one account without touching others. + if (accountId !== undefined) z.string().uuid().parse(accountId); + const client = getClickHouse(); + return transaction(async (db) => { + const batch = await db.query( + `SELECT event_id, event FROM click_outbox WHERE next_attempt_at <= now() + AND ($2::uuid IS NULL OR account_id = $2) + ORDER BY created_at LIMIT $1 FOR UPDATE SKIP LOCKED`, + [batchSize, accountId ?? null], + ); + if (!batch.rows.length) return { delivered: 0, failed: 0 }; + const ids = batch.rows.map((row) => row.event_id as string); + try { + await client.insert({ + table: "click_events", + values: batch.rows.map((row) => row.event as ClickEvent), + format: "JSONEachRow", + clickhouse_settings: { async_insert: 1, wait_for_async_insert: 1 }, + }); + } catch { + await db.query( + `UPDATE click_outbox SET attempts = attempts + 1, + next_attempt_at = now() + make_interval(secs => LEAST(300, power(2, LEAST(attempts + 1, 8))::integer)) + WHERE event_id = ANY($1::uuid[])`, + [ids], + ); + // Never log payloads or raw driver errors: destination campaign values may be sensitive. + console.error("Click event delivery failed; durable events will retry."); + return { delivered: 0, failed: ids.length }; + } + await db.query( + "DELETE FROM click_outbox WHERE event_id = ANY($1::uuid[])", + [ids], + ); + // If acknowledgement or commit is lost, the immutable event is retried. Reports use uniqExact. + return { delivered: ids.length, failed: 0 }; + }); +} diff --git a/applications/shortwave/src/server/preview-workers.ts b/applications/shortwave/src/server/preview-workers.ts new file mode 100644 index 00000000..33315576 --- /dev/null +++ b/applications/shortwave/src/server/preview-workers.ts @@ -0,0 +1,85 @@ +import { resolve4, resolve6 } from "node:dns/promises"; +import { beforeDeadline, previewTarget, resolvePreviewAddress } from "./preview"; +import { isWorkersRuntime } from "./runtime"; + +type Address = { address: string; family: number }; +type Kind = "html" | "image"; +type PreviewFetch = (url: string, init: RequestInit) => Promise; + +// Workers implements resolve4/6 through DNS over HTTPS, but not dns.lookup. +export async function resolveWorkersPreviewAddresses(host: string): Promise { + const answers = await Promise.all([resolve4(host), resolve6(host)].map(async (query, index) => { + try { return (await query).map((address) => ({ address, family: index === 0 ? 4 : 6 })); } + catch (error) { + if (error && typeof error === "object" && "code" in error && ["ENODATA", "ENOTFOUND"].includes(String(error.code))) return []; + throw error; + } + })); + return answers.flat(); +} + +/** + * Workers only: requires global_fetch_strictly_public and public global fetch. + * Cloudflare's network boundary prevents private-network access even if DNS + * changes after our additional A/AAAA check. That check is not IP pinning. + * Never substitute Node fetch or a private-network/service binding here. + * https://developers.cloudflare.com/workers/configuration/compatibility-flags/#global-fetch-strictly-public + * https://blog.cloudflare.com/workers-environment-live-object-bindings/ + */ +export async function readWorkersPublicResource( + value: string, kind: Kind, deadline: number, + dependencies: { + resolve?: (host: string) => Promise; + fetch?: PreviewFetch; + } = {}, +) { + if (!dependencies.fetch && !isWorkersRuntime()) throw new Error("Workers preview transport requires Workers runtime"); + const request = dependencies.fetch || ((url: string, init: RequestInit) => globalThis.fetch(url, init)); + const limit = kind === "html" ? 1024 * 1024 : 512 * 1024; + let url = previewTarget(value); + for (let redirect = 0; redirect <= 3; redirect++) { + if (Date.now() >= deadline) throw new Error("Preview timed out"); + // Reject mixed public/private answers and recheck every redirect hostname. + await beforeDeadline(resolvePreviewAddress(url, dependencies.resolve || resolveWorkersPreviewAddresses), deadline); + const controller = new AbortController(); + const timer = setTimeout(() => controller.abort(new Error("Preview timed out")), Math.max(1, deadline - Date.now())); + let response: Response | undefined; + let reader: ReadableStreamDefaultReader | undefined; + try { + response = await beforeDeadline(request(url.href, { + method: "GET", redirect: "manual", credentials: "omit", cache: "no-store", signal: controller.signal, + headers: { + "user-agent": "Shortwave-Preview/1.0", + accept: kind === "html" ? "text/html,application/xhtml+xml" : "image/png,image/jpeg,image/gif,image/webp", + "accept-encoding": "identity", + }, + }), deadline); + const location = response.headers.get("location"); + if ([301, 302, 303, 307, 308].includes(response.status) && location) { + url = previewTarget(new URL(location, url).href); + continue; + } + const type = (response.headers.get("content-type") || "").split(";")[0].trim().toLowerCase(); + const allowed = kind === "html" ? ["text/html", "application/xhtml+xml"] : ["image/png", "image/jpeg", "image/gif", "image/webp"]; + if (!response.ok || !allowed.includes(type) || !response.body || Number(response.headers.get("content-length") || 0) > limit) throw new Error("Unsupported preview response"); + // Reading a fetched body makes Workers decode its content encoding. + // Count actual decoded bytes; Content-Length alone is not a size limit. + const body = Buffer.alloc(limit); + let size = 0; + reader = response.body.getReader(); + while (true) { + const chunk = await beforeDeadline(reader.read(), deadline); + if (chunk.done) return { body: Buffer.from(body.subarray(0, size)), type, url }; + if (size + chunk.value.byteLength > limit) throw new Error("Preview response too large"); + body.set(chunk.value, size); + size += chunk.value.byteLength; + } + } finally { + clearTimeout(timer); + controller.abort(); + if (reader) await reader.cancel().catch(() => {}); + else await response?.body?.cancel().catch(() => {}); + } + } + throw new Error("Too many preview redirects"); +} diff --git a/applications/shortwave/src/server/preview.ts b/applications/shortwave/src/server/preview.ts new file mode 100644 index 00000000..30f25088 --- /dev/null +++ b/applications/shortwave/src/server/preview.ts @@ -0,0 +1,199 @@ +import { lookup } from "node:dns/promises"; +import { request as httpRequest } from "node:http"; +import { request as httpsRequest } from "node:https"; +import { isIP } from "node:net"; +import type { DestinationMetadata } from "../lib/preview"; +import { isWorkersRuntime } from "./runtime"; + +const HTML_LIMIT = 1024 * 1024; +const IMAGE_LIMIT = 512 * 1024; +const unavailable: DestinationMetadata = { status: "unavailable", title: "", description: "", siteName: "", image: null, imageAlt: "" }; + +// Conservative public-address allowlist: mapped/translated IPv4, local, +// multicast, documentation and special-purpose ranges are never fetched. +export function isPublicAddress(address: string): boolean { + const family = isIP(address); + if (family === 4) { + const [a, b, c] = address.split(".").map(Number); + return !(a === 0 || a === 10 || a === 127 || a >= 224 || + (a === 100 && b >= 64 && b <= 127) || (a === 169 && b === 254) || + (a === 172 && b >= 16 && b <= 31) || (a === 192 && b === 168) || + (a === 192 && b === 0 && (c === 0 || c === 2)) || + (a === 192 && b === 88 && c === 99) || + (a === 198 && (b === 18 || b === 19 || (b === 51 && c === 100))) || + (a === 203 && b === 0 && c === 113)); + } + if (family !== 6 || address.includes("%")) return false; + const [first, second = "0"] = address.toLowerCase().split(":"); + const prefix = parseInt(first, 16); + return prefix >= 0x2000 && prefix <= 0x3fff && prefix !== 0x2002 && + prefix !== 0x3fff && !(prefix === 0x2001 && + (parseInt(second || "0", 16) < 0x200 || parseInt(second, 16) === 0xdb8)); +} + +export function previewTarget(value: string): URL { + if (typeof value !== "string" || value.length > 4096 || /[\u0000-\u0020\u007f]/.test(value)) throw new Error("Invalid preview URL"); + const url = new URL(value); + if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.port) throw new Error("Unsupported preview URL"); + const host = url.hostname.replace(/^\[|\]$/g, ""); + if (!host || (isIP(host) && !isPublicAddress(host))) throw new Error("Private preview URL"); + url.hash = ""; + return url; +} + +type ResolvedAddress = { address: string; family: number }; +export async function resolvePreviewAddress(url: URL, resolve: (host: string) => Promise = (host) => lookup(host, { all: true })): Promise { + const host = url.hostname.replace(/^\[|\]$/g, ""); + const addresses = isIP(host) ? [{ address: host, family: isIP(host) }] : await resolve(host); + if (!addresses.length || addresses.some(({ address }) => !isPublicAddress(address))) throw new Error("Private preview address"); + return addresses[0]; +} + +export async function beforeDeadline(promise: Promise, deadline: number): Promise { + let timer: ReturnType | undefined; + try { + return await Promise.race([promise, new Promise((_, reject) => { + timer = setTimeout(() => reject(new Error("Preview timed out")), Math.max(1, deadline - Date.now())); + })]); + } finally { clearTimeout(timer); } +} + +type Page = { body: Buffer; url: URL; type: string }; +export async function readPublicResource( + value: string, + kind: "html" | "image", + deadline: number, + dependencies: { resolve?: (host: string) => Promise; request?: typeof httpRequest } = {}, +): Promise { + if (isWorkersRuntime() && !dependencies.request) { + const { readWorkersPublicResource } = await import("./preview-workers"); + return readWorkersPublicResource(value, kind, deadline, dependencies); + } + let url = previewTarget(value); + for (let redirect = 0; redirect <= 3; redirect++) { + if (Date.now() >= deadline) throw new Error("Preview timed out"); + const address = await beforeDeadline(resolvePreviewAddress(url, dependencies.resolve), deadline); + const result: Page | { location: string } = await new Promise((resolve, reject) => { + const limit = kind === "html" ? HTML_LIMIT : IMAGE_LIMIT; + const request = dependencies.request || (url.protocol === "https:" ? httpsRequest : httpRequest); + const req = request(url, { + method: "GET", agent: false, + // The checked address is pinned to this connection. Keep the original + // hostname for Host/SNI and normal TLS certificate verification. + family: address.family, + lookup: (_hostname, _options, callback) => callback(null, address.address, address.family), + headers: { "user-agent": "Shortwave-Preview/1.0", accept: kind === "html" ? "text/html,application/xhtml+xml" : "image/png,image/jpeg,image/gif,image/webp", "accept-encoding": "identity" }, + }, (response) => { + const status = response.statusCode || 0; + if ([301, 302, 303, 307, 308].includes(status) && response.headers.location) { + resolve({ location: response.headers.location }); + response.destroy(); + return; + } + const type = (response.headers["content-type"] || "").split(";")[0].trim().toLowerCase(); + const validType = kind === "html" ? ["text/html", "application/xhtml+xml"].includes(type) : ["image/png", "image/jpeg", "image/gif", "image/webp"].includes(type); + if (status < 200 || status >= 300 || !validType || (response.headers["content-encoding"] && response.headers["content-encoding"] !== "identity") || Number(response.headers["content-length"] || 0) > limit) { + reject(new Error("Unsupported preview response")); + response.destroy(); + return; + } + const chunks: Buffer[] = []; + let size = 0; + response.on("data", (chunk: Buffer) => { + size += chunk.length; + if (size > limit) { reject(new Error("Preview response too large")); response.destroy(); } + else chunks.push(chunk); + }); + response.on("end", () => resolve({ body: Buffer.concat(chunks), type, url })); + response.on("error", reject); + response.on("aborted", () => reject(new Error("Preview response interrupted"))); + }); + const timer = setTimeout(() => req.destroy(new Error("Preview timed out")), Math.max(1, deadline - Date.now())); + req.on("close", () => clearTimeout(timer)); + req.on("error", reject); + req.end(); + }); + if ("body" in result) return result; + // Resolve and validate *every* redirect, including protocol-relative URLs. + url = previewTarget(new URL(result.location, url).href); + } + throw new Error("Too many preview redirects"); +} + +function decode(value: string): string { + return value.replace(/&(#x[0-9a-f]+|#\d+|amp|quot|apos|lt|gt|nbsp);/gi, (entity, key: string) => { + if (key[0] !== "#") return ({ amp: "&", quot: '"', apos: "'", lt: "<", gt: ">", nbsp: " " } as Record)[key.toLowerCase()] || entity; + const point = key[1].toLowerCase() === "x" ? parseInt(key.slice(2), 16) : Number(key.slice(1)); + return point > 0 && point <= 0x10ffff && !(point >= 0xd800 && point <= 0xdfff) ? String.fromCodePoint(point) : ""; + }).replace(/[\u0000-\u001f\u007f]/g, " ").trim(); +} + +export function parsePreviewMetadata(html: string, base: URL) { + const head = html.split(/<\/head\s*>/i)[0].replace(/|]*>[\s\S]*?<\/script\s*>|]*>[\s\S]*?<\/style\s*>/gi, ""); + const values = new Map(); + for (const match of head.matchAll(/"']|"[^"]*"|'[^']*')*>/gi)) { + const attributes = new Map(); + for (const attribute of match[0].matchAll(/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g)) attributes.set(attribute[1].toLowerCase(), decode(attribute[2] ?? attribute[3] ?? attribute[4])); + const key = (attributes.get("property") || attributes.get("name") || "").toLowerCase(); + if (!values.has(key) && attributes.has("content")) values.set(key, attributes.get("content")!); + } + const title = (values.get("og:title") || values.get("twitter:title") || decode(head.match(/]*>([\s\S]*?)<\/title\s*>/i)?.[1] || "")).slice(0, 300); + const description = (values.get("og:description") || values.get("twitter:description") || values.get("description") || "").slice(0, 600); + let imageUrl: string | null = null; + const candidate = values.get("og:image:secure_url") || values.get("og:image") || values.get("twitter:image"); + if (candidate) { try { imageUrl = previewTarget(new URL(candidate, base).href).href; } catch { /* Text preview remains useful. */ } } + return { title, description, imageUrl, siteName: (values.get("og:site_name") || base.hostname).slice(0, 120), imageAlt: (values.get("og:image:alt") || "").slice(0, 300) }; +} + +export function imageData(body: Buffer, type: string): string | null { + if (body.length > IMAGE_LIMIT) return null; + const valid = (type === "image/png" && body.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]))) || + (type === "image/jpeg" && body[0] === 0xff && body[1] === 0xd8 && body[2] === 0xff) || + (type === "image/gif" && ["GIF87a", "GIF89a"].includes(body.subarray(0, 6).toString())) || + (type === "image/webp" && body.subarray(0, 4).toString() === "RIFF" && body.subarray(8, 12).toString() === "WEBP"); + return valid ? `data:${type};base64,${body.toString("base64")}` : null; +} + +const cache = new Map(); +const pending = new Map>(); +const usersPending = new Map(); +let activePreviews = 0; +export async function destinationPreview(userId: string, destination: string): Promise { + if (!userId) throw new Error("Please sign in to continue."); + let url: URL; + try { url = previewTarget(destination); } catch { return unavailable; } + const key = JSON.stringify([userId, url.href]); + const cached = cache.get(key); + if (cached && cached.expires > Date.now()) return cached.value; + // workerd forbids awaiting another request's in-flight I/O. Completed data + // can be cached, but pending promises are shared only by the Node server. + const sharePending = !isWorkersRuntime(); + const existing = sharePending ? pending.get(key) : undefined; + if (existing) return existing; + if (activePreviews >= 6 || (usersPending.get(userId) || 0) >= 2) return unavailable; + const task = (async () => { + let value = unavailable; + try { + const deadline = Date.now() + 10_000; + const page = await readPublicResource(url.href, "html", deadline); + const { imageUrl, ...metadata } = parsePreviewMetadata(page.body.toString("utf8"), page.url); + let image: string | null = null; + if (imageUrl) { + try { const result = await readPublicResource(imageUrl, "image", deadline); image = imageData(result.body, result.type); } catch { /* Preserve metadata if its image fails. */ } + } + value = { ...metadata, image, status: "ready" }; + } catch { /* Never return network/internal details or fetched markup. */ } + if (cache.size >= 32) cache.delete(cache.keys().next().value!); + cache.set(key, { value, expires: Date.now() + (value.status === "ready" ? 10 * 60_000 : 30_000) }); + return value; + })(); + if (sharePending) pending.set(key, task); + activePreviews++; + usersPending.set(userId, (usersPending.get(userId) || 0) + 1); + try { return await task; } finally { + if (sharePending) pending.delete(key); + activePreviews--; + const remaining = (usersPending.get(userId) || 1) - 1; + if (remaining) usersPending.set(userId, remaining); else usersPending.delete(userId); + } +} diff --git a/applications/shortwave/src/server/runtime.ts b/applications/shortwave/src/server/runtime.ts new file mode 100644 index 00000000..fe5a9dcf --- /dev/null +++ b/applications/shortwave/src/server/runtime.ts @@ -0,0 +1,40 @@ +import { AsyncLocalStorage } from "node:async_hooks"; +import type { Pool } from "pg"; +import type { createClient } from "@clickhouse/client-web"; + +type WorkersRuntime = { + env: Env; + postgres?: Pool; + clickhouse?: ReturnType; +}; + +// Only the context carrier is global. Database sockets and credentials belong +// to one fetch/scheduled invocation and are never reused by another request. +const workersRuntime = new AsyncLocalStorage(); + +export function createWorkersRuntime(env: Env): WorkersRuntime { + return { env }; +} + +export function runWorkersRuntime(runtime: WorkersRuntime, work: () => T): T { + return workersRuntime.run(runtime, work); +} + +export function getWorkersRuntime() { + return workersRuntime.getStore(); +} + +export function isWorkersRuntime(): boolean { + return getWorkersRuntime() !== undefined; +} + +export function runtimeEnvironment(key: string): string | undefined { + const runtime = getWorkersRuntime(); + if (!runtime) return process.env[key]; + const value: unknown = Reflect.get(runtime.env, key); + return typeof value === "string" ? value : undefined; +} + +export async function closeWorkersRuntime(runtime: WorkersRuntime) { + await Promise.all([runtime.postgres?.end(), runtime.clickhouse?.close()]); +} diff --git a/applications/shortwave/src/server/service.ts b/applications/shortwave/src/server/service.ts new file mode 100644 index 00000000..a63e9457 --- /dev/null +++ b/applications/shortwave/src/server/service.ts @@ -0,0 +1,460 @@ +import { randomBytes, randomUUID } from "node:crypto"; +import { z } from "zod"; +import type { Pool, PoolClient } from "pg"; +import { + defaultQrStyle, + linkInputSchema, + mergeUtm, + qrStyleSchema, + requestDimensions, + utmSchema, +} from "../lib/domain"; +import type { + ClickEvent, + Folder, + Link, + LinkInput, + QrStyle, + UtmTemplate, + UtmValues, +} from "../lib/types"; +import { getPostgres, transaction } from "./db"; +import { defaultLinkHostname, isCustomDomainHosted } from "./domain-routing"; + +export { flushOutbox } from "./outbox"; + +type Queryable = Pick; +export class NotFoundError extends Error { + constructor() { + super("This item was not found."); + this.name = "NotFoundError"; + } +} +const uuid = z.string().uuid(); + +/** The caller must obtain clerkUserId from Clerk's verified server session. */ +export async function getAccountId( + clerkUserId: string, + db: Queryable = getPostgres(), +): Promise { + if (!clerkUserId || clerkUserId.length > 255) + throw new Error("Sign in to continue."); + const result = await db.query( + `INSERT INTO accounts (clerk_user_id) VALUES ($1) + ON CONFLICT (clerk_user_id) DO UPDATE SET clerk_user_id = EXCLUDED.clerk_user_id RETURNING id`, + [clerkUserId], + ); + return result.rows[0].id; +} + +function toLink(row: Record): Link { + return { + id: row.id, + slug: row.slug, + domainId: row.domain_id ?? null, + domainHostname: row.domain_hostname ?? null, + title: row.title, + destination: row.destination, + resolvedUrl: row.resolved_url, + utm: row.utm, + tags: row.tags, + folderId: row.folder_id ?? null, + enabled: row.enabled, + createdAt: new Date(row.created_at).toISOString(), + updatedAt: new Date(row.updated_at).toISOString(), + qrStyle: row.qr_style ?? { ...defaultQrStyle }, + }; +} +const linkSelect = + "SELECT l.*, q.style AS qr_style, lf.folder_id, d.hostname AS domain_hostname FROM links l LEFT JOIN qr_styles q ON q.link_id = l.id AND q.account_id = l.account_id LEFT JOIN link_folders lf ON lf.link_id = l.id AND lf.account_id = l.account_id LEFT JOIN custom_domains d ON d.id = l.domain_id AND d.account_id = l.account_id"; + +export async function listLinks( + clerkUserId: string, + filter: { search?: string; tag?: string; folderId?: string | null } = {}, +): Promise { + const accountId = await getAccountId(clerkUserId); + const search = z + .string() + .max(200) + .parse(filter.search ?? ""); + const tag = z + .string() + .max(40) + .parse(filter.tag ?? ""); + const folderId = uuid.nullable().optional().parse(filter.folderId); + const result = await getPostgres().query( + `${linkSelect} WHERE l.account_id = $1 AND ($2 = '' OR l.title ILIKE '%' || $2 || '%' OR l.slug ILIKE '%' || $2 || '%' OR l.destination ILIKE '%' || $2 || '%') + AND ($3 = '' OR $3 = ANY(l.tags)) + AND ($4::boolean OR ($5::uuid IS NULL AND lf.folder_id IS NULL) OR lf.folder_id = $5::uuid) + ORDER BY l.created_at DESC LIMIT 500`, + [accountId, search, tag, folderId === undefined, folderId ?? null], + ); + return result.rows.map(toLink); +} + +export async function getLink(clerkUserId: string, id: string): Promise { + uuid.parse(id); + const accountId = await getAccountId(clerkUserId); + const result = await getPostgres().query( + `${linkSelect} WHERE l.account_id = $1 AND l.id = $2`, + [accountId, id], + ); + if (!result.rows[0]) throw new NotFoundError(); + return toLink(result.rows[0]); +} + +export async function listTags( + clerkUserId: string, + query = "", +): Promise { + const search = z.string().trim().max(40).parse(query); + const accountId = await getAccountId(clerkUserId); + const result = await getPostgres().query( + `SELECT name FROM account_tags + WHERE account_id = $1 AND strpos(lower(name), lower($2)) > 0 + ORDER BY lower(name), name LIMIT 20`, + [accountId, search], + ); + return result.rows.map((row) => row.name); +} + +const folderName = z.string().trim().min(1).max(80); + +export async function listFolders(clerkUserId: string): Promise { + const accountId = await getAccountId(clerkUserId); + const result = await getPostgres().query( + "SELECT id, name FROM folders WHERE account_id = $1 ORDER BY lower(name), name", + [accountId], + ); + return result.rows; +} + +export async function createFolder(clerkUserId: string, name: string): Promise { + const parsed = folderName.parse(name); + const accountId = await getAccountId(clerkUserId); + try { + return await transaction(async (db) => { + await db.query("SELECT id FROM accounts WHERE id = $1 FOR UPDATE", [accountId]); + const count = await db.query("SELECT count(*)::int AS count FROM folders WHERE account_id = $1", [accountId]); + if (count.rows[0].count >= 100) throw new Error("You can have up to 100 folders."); + const result = await db.query( + "INSERT INTO folders (account_id, name) VALUES ($1, $2) RETURNING id, name", + [accountId, parsed], + ); + return result.rows[0]; + }); + } catch (error) { + if ((error as { code?: string }).code === "23505") throw new Error("That folder name is already in use. Choose another."); + throw error; + } +} + +export async function updateFolder(clerkUserId: string, id: string, name: string): Promise { + uuid.parse(id); + const parsed = folderName.parse(name); + const accountId = await getAccountId(clerkUserId); + try { + const result = await getPostgres().query( + "UPDATE folders SET name = $3 WHERE account_id = $1 AND id = $2 RETURNING id, name", + [accountId, id, parsed], + ); + if (!result.rows[0]) throw new NotFoundError(); + return result.rows[0]; + } catch (error) { + if ((error as { code?: string }).code === "23505") throw new Error("That folder name is already in use. Choose another."); + throw error; + } +} + +export async function deleteFolder(clerkUserId: string, id: string): Promise { + uuid.parse(id); + const accountId = await getAccountId(clerkUserId); + const result = await getPostgres().query( + "DELETE FROM folders WHERE account_id = $1 AND id = $2 RETURNING id", [accountId, id], + ); + if (!result.rows[0]) throw new NotFoundError(); +} + +async function assignFolder(db: Queryable, accountId: string, linkId: string, folderId: string | null) { + if (folderId) { + // Hold the folder through the assignment; deletion then safely unfiles links. + const owned = await db.query("SELECT id FROM folders WHERE account_id = $1 AND id = $2 FOR KEY SHARE", [accountId, folderId]); + if (!owned.rows[0]) throw new NotFoundError(); + await db.query( + `INSERT INTO link_folders (account_id, link_id, folder_id) VALUES ($1, $2, $3) + ON CONFLICT (link_id) DO UPDATE SET folder_id = EXCLUDED.folder_id WHERE link_folders.account_id = $1`, + [accountId, linkId, folderId], + ); + } else { + await db.query("DELETE FROM link_folders WHERE account_id = $1 AND link_id = $2", [accountId, linkId]); + } +} + +async function rememberTags(db: Queryable, accountId: string, tags: string[]) { + if (!tags.length) return; + await db.query( + `INSERT INTO account_tags (account_id, name) + SELECT $1, unnest($2::text[]) ON CONFLICT DO NOTHING`, + [accountId, tags], + ); +} + +function translateConstraint(error: unknown): never { + if ((error as { code?: string }).code === "23505") + throw new Error("That slug or name is already in use. Choose another."); + throw error; +} + +export async function createLink( + clerkUserId: string, + input: LinkInput, +): Promise { + const parsed = linkInputSchema.parse(input); + const accountId = await getAccountId(clerkUserId); + const { resolvedUrl, utm } = mergeUtm(parsed.destination, parsed.utm); + const slug = parsed.slug || `l${randomBytes(7).toString("base64url")}`; + try { + const result = await transaction(async (db) => { + // Serialize account creation limits across multiple app processes. + await db.query("SELECT id FROM accounts WHERE id = $1 FOR UPDATE", [ + accountId, + ]); + const count = await db.query( + "SELECT count(*)::int AS count FROM links WHERE account_id = $1 AND created_at > now() - interval '1 day'", + [accountId], + ); + if (count.rows[0].count >= 100) + throw new Error( + "You can create up to 100 links per day. Please try again tomorrow.", + ); + let domainHostname: string | null = null; + if (parsed.domainId) { + // Hold ownership and verification stable through link insertion. + const domain = await db.query( + "SELECT hostname, status FROM custom_domains WHERE account_id = $1 AND id = $2 FOR SHARE", + [accountId, parsed.domainId], + ); + if (!domain.rows[0]) throw new NotFoundError(); + if (domain.rows[0].status !== "verified" || !isCustomDomainHosted(domain.rows[0].hostname)) { + throw new Error("This domain is not ready for links. Verify its ownership and connect hosting first."); + } + domainHostname = domain.rows[0].hostname; + } + const inserted = await db.query( + `INSERT INTO links (account_id, slug, title, destination, resolved_url, utm, tags, enabled, domain_id) + VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9) RETURNING *`, + [ + accountId, + slug, + parsed.title || new URL(parsed.destination).hostname, + parsed.destination, + resolvedUrl, + JSON.stringify(utm), + parsed.tags, + parsed.enabled, + parsed.domainId ?? null, + ], + ); + await rememberTags(db, accountId, parsed.tags); + await assignFolder(db, accountId, inserted.rows[0].id, parsed.folderId ?? null); + inserted.rows[0].folder_id = parsed.folderId; + inserted.rows[0].domain_hostname = domainHostname; + return inserted; + }); + return toLink(result.rows[0]); + } catch (error) { + return translateConstraint(error); + } +} + +/** Replaces editable fields; omitted folderId preserves membership. Public slug and domain are immutable. */ +export async function updateLink( + clerkUserId: string, + id: string, + input: LinkInput, +): Promise { + uuid.parse(id); + const parsed = linkInputSchema.parse(input); + const accountId = await getAccountId(clerkUserId); + const { resolvedUrl, utm } = mergeUtm(parsed.destination, parsed.utm); + await transaction(async (db) => { + const result = await db.query( + `UPDATE links SET title = $3, destination = $4, resolved_url = $5, + utm = $6, tags = $7, enabled = $8, revision = revision + 1, updated_at = now() + WHERE account_id = $1 AND id = $2 RETURNING *`, + [ + accountId, + id, + parsed.title || new URL(parsed.destination).hostname, + parsed.destination, + resolvedUrl, + JSON.stringify(utm), + parsed.tags, + parsed.enabled, + ], + ); + if (!result.rows[0]) throw new NotFoundError(); + if (parsed.domainId !== undefined && parsed.domainId !== result.rows[0].domain_id) { + throw new Error("A link's domain cannot be changed. Create a new link to use another domain."); + } + await rememberTags(db, accountId, parsed.tags); + if (parsed.folderId !== undefined) await assignFolder(db, accountId, id, parsed.folderId); + }); + return getLink(clerkUserId, id); +} + +export async function saveQrStyle( + clerkUserId: string, + linkId: string, + input: QrStyle, +): Promise { + uuid.parse(linkId); + const style = qrStyleSchema.parse(input); + const accountId = await getAccountId(clerkUserId); + const result = await getPostgres().query( + `INSERT INTO qr_styles (account_id, link_id, style) + SELECT account_id, id, $3::jsonb FROM links WHERE account_id = $1 AND id = $2 + ON CONFLICT (link_id) DO UPDATE SET style = EXCLUDED.style WHERE qr_styles.account_id = $1 RETURNING style`, + [accountId, linkId, JSON.stringify(style)], + ); + if (!result.rows[0]) throw new NotFoundError(); + return result.rows[0].style; +} + +function toTemplate(row: Record): UtmTemplate { + return { + id: row.id, + name: row.name, + values: row.values, + createdAt: new Date(row.created_at).toISOString(), + }; +} +const templateSchema = z + .object({ name: z.string().trim().min(1).max(80), values: utmSchema }) + .strict(); + +export async function listTemplates( + clerkUserId: string, +): Promise { + const accountId = await getAccountId(clerkUserId); + const result = await getPostgres().query( + "SELECT * FROM utm_templates WHERE account_id = $1 ORDER BY name", + [accountId], + ); + return result.rows.map(toTemplate); +} + +export async function createTemplate( + clerkUserId: string, + input: { name: string; values: UtmValues }, +): Promise { + const parsed = templateSchema.parse(input); + const accountId = await getAccountId(clerkUserId); + try { + const result = await getPostgres().query( + "INSERT INTO utm_templates (account_id, name, values) VALUES ($1,$2,$3) RETURNING *", + [accountId, parsed.name, JSON.stringify(parsed.values)], + ); + return toTemplate(result.rows[0]); + } catch (error) { + return translateConstraint(error); + } +} + +export async function updateTemplate( + clerkUserId: string, + id: string, + input: { name: string; values: UtmValues }, +): Promise { + uuid.parse(id); + const parsed = templateSchema.parse(input); + const accountId = await getAccountId(clerkUserId); + try { + const result = await getPostgres().query( + "UPDATE utm_templates SET name = $3, values = $4, updated_at = now() WHERE account_id = $1 AND id = $2 RETURNING *", + [accountId, id, parsed.name, JSON.stringify(parsed.values)], + ); + if (!result.rows[0]) throw new NotFoundError(); + return toTemplate(result.rows[0]); + } catch (error) { + return translateConstraint(error); + } +} + +export async function deleteTemplate( + clerkUserId: string, + id: string, +): Promise { + uuid.parse(id); + const accountId = await getAccountId(clerkUserId); + const result = await getPostgres().query( + "DELETE FROM utm_templates WHERE account_id = $1 AND id = $2 RETURNING id", + [accountId, id], + ); + if (!result.rows[0]) throw new NotFoundError(); +} + +export type RedirectResult = + { status: 302; location: string } | { status: 404 | 410 }; +export async function resolveRedirect( + slug: string, + metadata: { referrer?: string | null; userAgent?: string } = {}, + recordEvent = true, + hostname?: string, +): Promise { + if (!/^[a-zA-Z0-9][a-zA-Z0-9_-]{2,47}$/.test(slug)) return { status: 404 }; + // HTTP callers always supply the URL hostname, never forwarded headers. + const host = hostname?.toLowerCase() ?? defaultLinkHostname(); + const isDefault = host === defaultLinkHostname(); + if (!isDefault && !isCustomDomainHosted(host)) return { status: 404 }; + return transaction(async (db) => { + let domainId: string | null = null; + let accountId: string | null = null; + if (!isDefault) { + // Prevent revocation/deletion racing the redirect's state snapshot. + const domain = await db.query( + "SELECT id, account_id FROM custom_domains WHERE hostname = $1 AND status = 'verified' FOR SHARE", + [host], + ); + if (!domain.rows[0]) return { status: 404 }; + domainId = domain.rows[0].id; + accountId = domain.rows[0].account_id; + } + // Shared lock makes the redirect's state/event snapshot atomic with link edits. + const result = await db.query( + `SELECT * FROM links WHERE slug = $1 + AND (($2::uuid IS NULL AND domain_id IS NULL) OR (domain_id = $2::uuid AND account_id = $3::uuid)) FOR SHARE`, + [slug, domainId, accountId], + ); + const row = result.rows[0]; + if (!row) return { status: 404 }; + if (!row.enabled) return { status: 410 }; + if (recordEvent) { + const utm = row.utm as UtmValues; + const event: ClickEvent = { + event_id: randomUUID(), + account_id: row.account_id, + link_id: row.id, + occurred_at: new Date() + .toISOString() + .replace("T", " ") + .replace("Z", ""), + utm_source: utm.source || "", + utm_medium: utm.medium || "", + utm_campaign: utm.campaign || "", + utm_term: utm.term || "", + utm_content: utm.content || "", + ...requestDimensions( + metadata.referrer, + metadata.userAgent?.slice(0, 2048), + ), + is_demo: 0, + }; + await db.query( + "INSERT INTO click_outbox (event_id, account_id, event) VALUES ($1,$2,$3)", + [event.event_id, event.account_id, JSON.stringify(event)], + ); + } + return { status: 302, location: row.resolved_url }; + }); +} diff --git a/applications/shortwave/src/start.ts b/applications/shortwave/src/start.ts new file mode 100644 index 00000000..dfb429c5 --- /dev/null +++ b/applications/shortwave/src/start.ts @@ -0,0 +1,18 @@ +import { createStart, createCsrfMiddleware, createServerOnlyFn } from "@tanstack/react-start"; +import { clerkMiddleware } from "@clerk/tanstack-react-start/server"; +import { runtimeEnvironment } from "./server/runtime"; + +const clerkOptions = createServerOnlyFn(() => ({ + // Read trusted configuration per request. This server-only boundary also + // removes the Workers/Node request runtime from the browser bundle. + authorizedParties: [ + new URL(runtimeEnvironment("APP_URL") || "http://localhost:4317").origin, + ], +})); + +export const startInstance = createStart(() => ({ + requestMiddleware: [ + createCsrfMiddleware({ filter: (ctx) => ctx.handlerType === "serverFn" }), + clerkMiddleware(clerkOptions), + ], +})); diff --git a/applications/shortwave/src/styles.css b/applications/shortwave/src/styles.css new file mode 100644 index 00000000..673d6b91 --- /dev/null +++ b/applications/shortwave/src/styles.css @@ -0,0 +1,1914 @@ +@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;450;500;550;600;650;700&family=Manrope:wght@400;500;600;650;700;750;800&display=swap"); +:root { + font-family: "DM Sans", sans-serif; + color: #f1f1f3; + background: #111214; + font-synthesis: none; + --bg: #111214; + --surface: #191a1d; + --border: #303136; + --muted: #999ba4; + --yellow: #faff69; + --yellow-muted: #faff6912; +} +* { + box-sizing: border-box; +} +body { + margin: 0; + min-width: 320px; + font-family: "DM Sans", sans-serif !important; +} +button, +input, +select, +textarea { + font: inherit; +} +button, +a, +input, +select { + touch-action: manipulation; +} +a { + color: inherit; + text-decoration: none; +} +button { + cursor: pointer; +} +button:disabled { + cursor: not-allowed; + opacity: 0.5; +} +button:focus-visible, +a:focus-visible, +input:focus-visible, +select:focus-visible { + outline: 2px solid var(--yellow); + outline-offset: 4px; +} +h1, +h2, +h3, +p { + margin: 0; +} +h1, +h2, +h3, +.brand { + font-family: Manrope, "DM Sans", sans-serif; +} +h1 { + font-size: 36px; + line-height: 1.24; + letter-spacing: -1.4px; + font-weight: 650; +} +h2 { + font-size: 19px; + font-weight: 650; + letter-spacing: -0.3px; +} +h3 { + font-size: 16px; + font-weight: 600; +} +p { + line-height: 1.65; +} +.muted { + color: var(--muted); +} +.small { + font-size: 12px; +} +.eyebrow { + font-size: 10px; + font-weight: 650; + letter-spacing: 1.8px; + color: var(--yellow); + margin-bottom: 15px; + display: flex; + align-items: center; + gap: 9px; +} +.brand { + display: inline-flex; + align-items: center; + font-size: 27px; + letter-spacing: -1px; + font-weight: 800; + white-space: nowrap; +} +.brand-mark { + width: 34px; + height: 34px; + color: var(--yellow); + display: grid; + place-items: center; + margin-right: 7px; +} +.brand-dot { + color: var(--yellow); +} +.button-primary, +.button-secondary { + min-height: 42px; + padding: 11px 18px; + border-radius: 7px; + display: inline-flex; + align-items: center; + justify-content: center; + gap: 10px; + font-size: 13px; + font-weight: 650; + line-height: 1.3; + border: 1px solid transparent; + transition: + background 0.2s, + transform 0.2s; +} +.button-primary { + background: var(--yellow); + color: #181910; +} +.button-primary:hover { + background: #e9ef4c; + transform: translateY(-1px); +} +.button-secondary { + background: #202125; + border-color: #3b3c42; + color: #e6e6e9; +} +.button-secondary:hover { + background: #2b2c31; +} +.button-small { + min-height: 37px; + padding: 9px 14px; +} +.plain-button { + padding: 0; + border: 0; + background: none; + color: inherit; + text-align: left; +} +.icon-button { + border: 1px solid transparent; + background: transparent; + color: #a6a8b0; + padding: 8px; + border-radius: 6px; + display: inline-flex; + align-items: center; + justify-content: center; + position: relative; +} +.icon-button:hover { + background: #2b2c30; + color: #fff; + border-color: #3b3d42; +} +.text-link { + color: var(--yellow); + font-size: 13px; +} +.external-link { + display: inline-flex; + gap: 6px; + align-items: center; +} +.page-message { + min-height: 100vh; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + gap: 24px; + padding: 30px; + text-align: center; +} +.loading { + min-height: 220px; + display: flex; + align-items: center; + justify-content: center; + gap: 12px; + color: var(--muted); + font-size: 14px; +} +.spin { + animation: spin 1.3s linear infinite; +} +@keyframes spin { + to { + transform: rotate(360deg); + } +} +.error-notice { + background: #c3514a16; + border: 1px solid #a44e4e77; + color: #ffb8b1; + border-radius: 7px; + font-size: 13px; + line-height: 1.6; + padding: 14px 17px; + margin-bottom: 20px; +} +.skip-link { + position: fixed; + left: 20px; + top: -60px; + z-index: 100; + background: var(--yellow); + color: #111; + padding: 12px; +} +.skip-link:focus { + top: 12px; +} +.copy-error { + position: absolute; + top: 35px; + white-space: nowrap; + background: #242529; + padding: 5px; + font-size: 10px; + z-index: 2; +} +/* Public pages */ +.landing { + max-width: 1440px; + margin: auto; + padding: 0 7%; + background: radial-gradient(ellipse at 75% 26%, #dce75907, transparent 42%); +} +.landing-nav { + height: 114px; + display: flex; + justify-content: space-between; + align-items: center; +} +.landing-nav nav { + display: flex; + align-items: center; + gap: 35px; + font-size: 13px; + color: #b2b3ba; +} +.hero { + display: grid; + grid-template-columns: 1.12fr 1fr; + min-height: 600px; + align-items: center; + gap: 50px; + padding: 66px 0 80px; +} +.hero .eyebrow { + font-size: 10px; +} +.live-dot { + height: 6px; + width: 6px; + display: inline-block; + border-radius: 50%; + background: var(--yellow); + box-shadow: 0 0 0 4px #faff6912; +} +.hero h1 { + font-size: clamp(54px, 5.5vw, 78px); + line-height: 1.09; + font-weight: 650; + letter-spacing: -4.5px; + margin: 22px 0 25px; +} +.hero h1 span { + color: var(--yellow); +} +.hero-copy > p { + color: #a4a5ad; + font-size: 15px; + line-height: 1.85; +} +.hero-cta { + margin-top: 31px; + min-height: 46px; +} +.hero-footnote { + font-size: 10px; + color: #72747d; + margin-top: 19px; +} +.hero-art { + position: relative; + height: 430px; + display: flex; + align-items: center; + justify-content: center; +} +.orbital { + position: absolute; + width: 380px; + height: 380px; + border: 1px solid #d8e57224; + border-radius: 50%; + transform: rotate(-28deg) scaleX(1.08); +} +.orbital-two { + width: 295px; + height: 295px; + transform: rotate(28deg) scaleX(1.18); + border-style: dashed; + border-color: #d8e57218; +} +.link-token { + background: var(--yellow); + height: 170px; + width: 170px; + border-radius: 39px; + display: grid; + place-items: center; + color: #23261a; + transform: rotate(-16deg); + box-shadow: + 18px 28px 80px #faff6912, + inset -7px -9px #cbd139; +} +.link-token svg { + transform: rotate(-18deg); +} +.signal-point { + position: absolute; + width: 9px; + height: 9px; + background: var(--yellow); + border-radius: 50%; + box-shadow: 0 0 20px #faff6980; +} +.point-one { + top: 38px; + right: 95px; +} +.point-two { + left: 22px; + bottom: 120px; + width: 6px; + height: 6px; +} +.floating-card { + position: absolute; + display: flex; + align-items: center; + gap: 15px; + background: #202124; + border: 1px solid #424338; + border-radius: 11px; + padding: 17px 20px; + box-shadow: 0 18px 40px #0003; +} +.card-url { + left: -17px; + bottom: 70px; + transform: rotate(-5deg); +} +.card-url .card-icon { + display: grid; + place-items: center; + background: #faff6910; + color: var(--yellow); + border-radius: 8px; + width: 40px; + height: 40px; +} +.card-url small { + display: block; + font-size: 8px; + color: #94968b; + letter-spacing: 1.3px; + margin-bottom: 6px; +} +.card-url strong { + font-size: 15px; + letter-spacing: -0.3px; +} +.card-qr { + right: -20px; + top: 53px; + transform: rotate(8deg); + font-size: 12px; +} +.card-qr > svg:first-child { + color: var(--yellow); +} +.art-caption { + position: absolute; + bottom: 3px; + right: 22px; + letter-spacing: 1.9px; + font-size: 8px; + color: #6b6e67; +} +.features { + display: grid; + grid-template-columns: repeat(3, 1fr); + padding: 40px 0 50px; + gap: 40px; +} +.feature { + padding-right: 25px; +} +.feature + .feature { + border-left: 1px solid #ffffff12; + padding-left: 38px; +} +.feature-top { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 28px; + color: var(--yellow); +} +.feature-top span { + font-size: 10px; + color: #62646e; +} +.feature h2 { + font-size: 20px; + margin-bottom: 13px; +} +.feature p { + font-size: 13px; + color: #9698a1; + max-width: 300px; +} +.landing-callout { + border: 1px solid #383a2f; + background: #faff6905; + border-radius: 9px; + padding: 24px; + display: flex; + align-items: center; + gap: 24px; + margin-bottom: 55px; +} +.landing-callout > svg { + color: var(--yellow); +} +.landing-callout p { + font-size: 13px; + color: #999c93; +} +.landing-callout strong { + color: #dadcd2; + font-weight: 500; +} +.landing-callout a { + margin-left: auto; + color: var(--yellow); +} +.landing-footer { + display: flex; + justify-content: space-between; + align-items: center; + border-top: 1px solid #ffffff12; + padding: 28px 0 35px; + font-size: 10px; + color: #767982; +} +.landing-footer .brand { + font-size: 21px; + color: #fff; +} +.landing-footer .brand-mark { + transform: scale(0.8); + margin-right: 0; +} +.auth-screen { + min-height: 100vh; + display: flex; + flex-direction: column; + align-items: center; + gap: 64px; + padding: 45px 20px; + background: radial-gradient(ellipse at center, #faff6906, transparent 65%); +} +.auth-prompt { + text-align: center; + max-width: 540px; + padding-top: 40px; +} +.auth-prompt h1 { + font-size: 40px; +} +.auth-prompt .eyebrow { + justify-content: center; +} +.auth-prompt p { + color: var(--muted); + margin: 22px 0; +} +.auth-prompt .button-primary { + margin-top: 7px; +} +/* Workspace */ +.app-shell { + display: flex; + min-height: 100vh; +} +.sidebar { + width: 238px; + position: fixed; + top: 0; + left: 0; + bottom: 0; + border-right: 1px solid #2a2b2f; + background: #17181b; + padding: 30px 19px 0; + display: flex; + flex-direction: column; + overflow-y: auto; + z-index: 20; +} +.sidebar > .brand { + padding-left: 8px; + font-size: 25px; +} +.workspace-label { + display: flex; + align-items: center; + gap: 10px; + padding: 23px 5px; + margin: 26px 0; + font-size: 11px; + font-weight: 550; +} +.workspace-avatar { + background: #34362a; + color: var(--yellow); + font-family: Manrope; + font-size: 14px; + width: 30px; + height: 30px; + border-radius: 7px; + display: grid; + place-items: center; +} +.workspace-label small { + display: block; + font-size: 8px; + color: #858892; + font-weight: 400; + margin-top: 5px; +} +.sidebar nav { + display: flex; + flex-direction: column; + gap: 7px; +} +.nav-item { + display: flex; + align-items: center; + gap: 13px; + padding: 13px 14px; + color: #9fa1ad; + font-size: 12px; + border-radius: 7px; +} +.nav-item.active { + background: #faff6910; + color: var(--yellow); +} +.nav-item:hover { + background: #ffffff05; +} +.nav-item.active:hover { + background: #faff6917; +} +.sidebar-note { + margin-top: auto; + padding: 38px 14px 35px; +} +.signal-bars { + display: flex; + align-items: end; + gap: 4px; + height: 25px; + margin-bottom: 17px; +} +.signal-bars i { + width: 5px; + border-radius: 2px; + background: #faff6944; + height: 8px; +} +.signal-bars i:nth-child(2) { + height: 13px; +} +.signal-bars i:nth-child(3) { + height: 19px; +} +.signal-bars i:nth-child(4) { + height: 25px; + background: var(--yellow); +} +.sidebar-note strong { + font-size: 15px; + font-weight: 500; + line-height: 1.6; + letter-spacing: -0.2px; +} +.sidebar-note p { + font-size: 10px; + color: #797c86; + margin-top: 10px; + line-height: 1.75; +} +.sidebar-shortcuts { + margin-top: auto; + padding-top: 24px; + padding-bottom: 12px; +} +.sidebar-account { + display: flex; + align-items: center; + gap: 10px; + padding: 20px 4px; + font-size: 10px; + min-height: 79px; +} +.sidebar-account > div { + min-width: 0; +} +.sidebar-credits { + padding: 0 14px 8px; + color: var(--muted); + font-size: 10px; + line-height: 1.7; +} +.sidebar-credits p { margin: 0 0 9px; } +.sidebar-credits a { color: var(--text); white-space: nowrap; } +.sidebar-credits a:hover { text-decoration: underline; } +.sidebar-github { display: inline-flex; align-items: center; gap: 7px; } +.sidebar-github-status { font-size: 9px; } +.sidebar-account small { + display: block; + color: #858792; + font-size: 9px; + overflow: hidden; + text-overflow: ellipsis; + max-width: 145px; + margin-top: 5px; +} +.app-content { + margin-left: 238px; + width: calc(100% - 238px); + min-height: 100vh; + display: flex; + flex-direction: column; +} +main#main { + max-width: 1540px; + width: 100%; + margin: 0 auto; + padding: 42px 45px 50px; + flex: 1; +} +.section-heading { + display: flex; + justify-content: space-between; + align-items: center; + gap: 24px; + margin-bottom: 31px; +} +.section-heading .eyebrow { + font-size: 9px; + letter-spacing: 1.6px; + margin-bottom: 12px; +} +.section-heading h1 { + font-size: 30px; + letter-spacing: -1.1px; +} +.section-heading p { + font-size: 12px; + color: #9295a0; + margin-top: 12px; +} +.section-heading > button { + flex-shrink: 0; + font-size: 12px; +} +.collection-heading { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 20px; +} +.collection-heading h2 { + font-size: 17px; + display: flex; + gap: 11px; + align-items: center; +} +.count-badge { + font-family: "DM Sans"; + font-size: 10px; + color: #a6a8b0; + background: #2b2c30; + border: 1px solid #393a3f; + border-radius: 5px; + padding: 3px 7px; + font-weight: 400; +} +.filter-bar { + display: flex; + gap: 12px; + margin-bottom: 17px; +} +.search-field { + position: relative; + display: flex; + align-items: center; + flex: 1; + max-width: 460px; +} +.search-field svg { + position: absolute; + left: 13px; + color: #7e818c; +} +.search-field input { + width: 100%; + height: 41px; + padding: 0 15px 0 39px; + border: 1px solid #34363d; + background: #191a1d; + border-radius: 7px; + color: #eee; + font-size: 11px; +} +.links-filter-bar .filter-select { flex: 0 1 180px; min-width: 150px; max-width: 100%; } +.links-filter-bar .filter-select .app-select-trigger { min-height: 40px; font-size: 12px; } +.folders-page { + max-width: 760px; + padding: 24px; + border: 1px solid var(--border); + border-radius: 10px; + background: var(--surface); +} +.folders-page .folder-manager > form { align-items: end; gap: 12px; } +@media (max-width: 540px) { + .folders-page { padding: 18px; } + .folders-page .folder-manager > form { flex-wrap: wrap; } + .folders-page .folder-manager > form .field { flex-basis: 100%; } +} +.link-list { + display: flex; + flex-direction: column; + border: 1px solid var(--border); + border-radius: 10px; + overflow: hidden; +} +.link-row { + display: flex; + align-items: flex-start; + gap: 17px; + padding: 25px; + background: #18191c; +} +.link-row + .link-row { + border-top: 1px solid var(--border); +} +.link-avatar { + height: 44px; + width: 44px; + background: #24262b; + border: 1px solid #33353c; + border-radius: 10px; + flex-shrink: 0; + display: grid; + place-items: center; + color: #b8bbc5; +} +.link-info { + min-width: 0; + flex: 1; +} +.link-title-line { + display: flex; + align-items: center; + gap: 10px; +} +.link-title { + font-size: 13px; + font-weight: 550; + line-height: 1.5; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.link-title:hover { + color: var(--yellow); +} +.short-link { + display: inline-flex; + align-items: center; + gap: 5px; + font-size: 11px; + color: var(--yellow); + margin-top: 6px; + max-width: 100%; + overflow-wrap: anywhere; +} +.destination { + font-size: 10px; + color: #7d818d; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + margin-top: 6px; +} +.link-meta { + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 6px; + margin-top: 13px; +} +.link-meta > span { + font-size: 9px; + color: #727580; + margin-left: 3px; +} +.tag { + font-size: 9px; + color: #b0b5a5; + background: #b0bc8310; + border: 1px solid #b0bc8320; + padding: 4px 7px; + border-radius: 4px; +} +.tag:hover { + border-color: #9ea76f; +} +.link-actions { + display: flex; + gap: 3px; + align-self: center; +} +.disabled-badge { + font-size: 8px; + color: #e8a891; + border: 1px solid #8d645755; + padding: 3px 6px; + border-radius: 4px; +} +.app-footer { + display: flex; + justify-content: space-between; + font-size: 9px; + color: #676b77; + margin: 0 45px; + padding: 22px 0; +} +.app-footer > span:last-child { + display: flex; + align-items: center; + gap: 7px; +} +.empty-state { + padding: 65px 25px; + text-align: center; + border: 1px dashed #36383f; + border-radius: 10px; + margin: 15px 0; + background: #18191c55; + display: flex; + align-items: center; + flex-direction: column; +} +.empty-icon { + width: 66px; + height: 66px; + border: 1px solid #414439; + background: #faff6908; + color: var(--yellow); + border-radius: 16px; + display: grid; + place-items: center; + margin-bottom: 23px; + transform: rotate(-6deg); +} +.empty-state h2 { + font-size: 21px; + margin-bottom: 12px; +} +.empty-state p { + font-size: 12px; + max-width: 400px; + margin: 0 auto 23px; +} +.mobile-header { + display: none; +} +.page-note { + font-size: 10px; + color: #777b88; + line-height: 1.8; + margin-top: 25px; +} +/* Forms */ +.modal-backdrop { + position: fixed; + inset: 0; + background: #000a; + backdrop-filter: blur(5px); + z-index: 60; + display: flex; + align-items: center; + justify-content: center; + padding: 24px; +} +.modal { + position: relative; + inset: auto; + margin: 0; + width: 480px; + max-width: 100%; + max-height: 92vh; + background: #1b1c20; + color: #f3f3f5; + border: 1px solid #41434a; + border-radius: 13px; + padding: 0; + overflow: auto; + box-shadow: 0 30px 100px #0006; +} +.modal-wide { + width: 720px; +} +.modal-heading { + display: flex; + align-items: center; + justify-content: space-between; + padding: 23px 27px; + border-bottom: 1px solid #33353b; +} +.modal-heading h2 { + font-size: 20px; +} +.modal-body { + padding: 24px 27px; +} +.modal-body > p { + font-size: 12px; + margin-bottom: 22px; +} +.modal-actions { + display: flex; + gap: 10px; + justify-content: flex-end; + padding: 20px 27px; + border-top: 1px solid #33353b; + background: #191a1e; + position: sticky; + bottom: 0; +} +.modal-actions button { + font-size: 12px; +} +.field { + display: flex; + flex-direction: column; + gap: 8px; + margin-bottom: 20px; + font-size: 11px; + color: #d4d6dd; + min-width: 0; +} +.field > span:first-child { + font-weight: 550; +} +.field small { + color: #767b88; + font-size: 9px; + font-weight: 400; +} +.field > span small { + margin-left: 5px; +} +.field em { + font-style: normal; + color: var(--yellow); +} +.field input:not([type="color"]):not([type="file"]), +.field select { + width: 100%; + border: 1px solid #3a3d46; + border-radius: 6px; + background: #131417; + color: #e3e5ec; + font-size: 12px; + height: 42px; + padding: 0 12px; +} +.field input::placeholder, +.search-field input::placeholder { + color: #646a78; +} +.field input:disabled { + color: #747987; + opacity: 0.8; +} +.input-icon { + position: relative; +} +.input-icon > svg { + position: absolute; + left: 12px; + top: 12px; + color: #777f8c; +} +.input-icon input { + padding-left: 38px !important; +} +.input-prefix { + display: flex; + align-items: center; +} +.input-prefix > span { + background: #292c32; + height: 42px; + display: flex; + align-items: center; + padding: 0 12px; + border: 1px solid #3a3d46; + border-right: 0; + border-radius: 6px 0 0 6px; + color: #8d94a0; +} +.input-prefix input { + border-radius: 0 6px 6px 0 !important; +} +.form-grid { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 0 18px; +} +.form-section-title { + display: flex; + align-items: center; + justify-content: space-between; + border-top: 1px solid #33363e; + padding-top: 23px; + margin: 7px 0 23px; +} +.form-section-title h3 { + font-size: 14px; +} +.badge { + font-size: 8px; + letter-spacing: 1px; + color: #7f8793; +} + +.checkbox-field { + display: flex; + align-items: flex-start; + gap: 10px; + font-size: 12px; + margin-top: 22px; +} +.checkbox-field input { + accent-color: var(--yellow); + height: 17px; + width: 17px; + margin: 0; +} +.checkbox-field small { + display: block; + font-size: 10px; + color: #9198a3; + margin-top: 6px; +} +.qr-layout { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 27px; +} +.qr-preview { + min-height: 280px; + display: flex; + justify-content: center; + align-items: center; + background: #fff; + border-radius: 9px; + overflow: hidden; +} +.qr-preview canvas, +.qr-preview svg { + max-width: 100%; + height: auto !important; +} +.qr-link { + font-size: 11px; + word-break: break-all; + text-align: center; + color: var(--yellow); + margin: 15px 0; +} +.qr-layout .small { + font-size: 10px; +} +.qr-logo-actions { display: flex; flex-wrap: wrap; gap: 12px; } +.qr-controls h3 { + margin-bottom: 22px; +} +.color-fields { + display: flex; + gap: 30px; +} +.field input[type="color"] { + width: 74px; + height: 38px; + border: 1px solid #49505c; + background: none; + padding: 3px; + border-radius: 5px; + cursor: pointer; +} +.upload-label { + display: flex; + align-items: center; + justify-content: center; + gap: 9px; + height: 43px; + border: 1px dashed #525964; + border-radius: 6px; + position: relative; + cursor: pointer; + font-size: 11px; +} +.upload-label input { + position: absolute; + inset: 0; + opacity: 0; + cursor: pointer; + width: 100%; +} +.qr-actions { + justify-content: space-between; +} +.qr-actions > div { + display: flex; + gap: 7px; +} +.template-grid { + display: grid; + grid-template-columns: repeat(3, 1fr); + gap: 19px; +} +.template-card { + background: #191b1f; + border: 1px solid #34373e; + border-radius: 10px; + padding: 23px; + display: flex; + flex-direction: column; +} +.template-icon { + width: 41px; + height: 41px; + border-radius: 10px; + background: #faff690c; + color: var(--yellow); + display: grid; + place-items: center; + margin-bottom: 20px; +} +.template-card h2 { + font-size: 17px; + margin-bottom: 18px; + overflow-wrap: anywhere; +} +.template-card dl { + margin: 0 0 25px; + font-size: 10px; + flex: 1; +} +.template-card dl > div { + display: flex; + justify-content: space-between; + gap: 15px; + padding: 9px 0; + border-bottom: 1px solid #292d33; +} +.template-card dt { + color: #747e8d; +} +.template-card dd { + margin: 0; + color: #bdc5cc; + text-align: right; + overflow-wrap: anywhere; + min-width: 0; +} +.template-actions { + display: flex; + justify-content: space-between; + gap: 10px; +} +.template-actions .button-secondary { + font-size: 10px; + padding: 8px 10px; + min-height: 35px; +} +.account-profile { + max-width: 100%; + overflow: auto; +} +/* Analytics */ +.analytics-filters { + display: flex; + flex-wrap: wrap; + gap: 10px; + margin-bottom: 25px; +} +.analytics-filters > select, +.analytics-filters > label { + height: 39px; + border: 1px solid #383d45; + border-radius: 6px; + background: #191b1f; + color: #bdc4ce; + font-size: 11px; + padding: 0 12px; + max-width: 230px; +} +.analytics-filters > label { + display: flex; + gap: 9px; + align-items: center; +} +.analytics-filters > label select { + border: 0; + background: none; + color: inherit; + font: inherit; +} +.analytics-notice { + border: 1px solid #575b3c; + background: #faff6908; + color: #c6cc92; + display: flex; + align-items: center; + gap: 14px; + padding: 16px 19px; + border-radius: 8px; + margin-bottom: 22px; +} +.analytics-notice strong { + font-size: 12px; + font-weight: 550; +} +.analytics-notice p { + font-size: 10px; + color: #a2a789; + margin-top: 5px; +} +.notice-unavailable { + border-color: #745241; + background: #704b2910; + color: #dfb697; +} +.stat-grid { + display: grid; + grid-template-columns: repeat(3, 1fr); + gap: 17px; + margin-bottom: 23px; +} +.stat-card { + padding: 22px; + border: 1px solid #35393f; + border-radius: 9px; + background: #191b1f; +} +.stat-card > div { + display: flex; + justify-content: space-between; + font-size: 11px; + color: #919ba7; +} +.stat-card > div svg { + color: #9a9f70; +} +.stat-card > strong { + display: block; + font-family: Manrope; + font-weight: 550; + font-size: 37px; + letter-spacing: -1px; + margin: 13px 0 8px; +} +.stat-card > p { + font-size: 9px; + color: #717d8a; +} +.chart-card { + background: #191b1f; + border: 1px solid #35393f; + border-radius: 9px; + padding: 24px; + margin-bottom: 23px; +} +.card-heading { + display: flex; + justify-content: space-between; + align-items: center; +} +.card-heading h2 { + font-size: 15px; +} +.card-heading p { + font-size: 10px; + color: #828c98; + margin-top: 7px; +} +.chart-legend { + font-size: 10px; + color: #c3c7c4; + display: flex; + gap: 7px; + align-items: center; +} +.chart-legend i { + width: 6px; + height: 6px; + border-radius: 50%; + background: var(--yellow); +} +.traffic-chart { + margin-top: 25px; +} +.traffic-chart svg { + display: block; + width: 100%; + height: auto; + min-height: 160px; +} +.chart-card .empty-state { + border: 0; + background: none; + padding: 30px 20px; + margin-bottom: 0; +} +.chart-card .empty-state h2 { + font-size: 17px; +} +.chart-card .empty-state p { + margin-bottom: 0; +} +.breakdown-grid { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 22px; +} +.breakdown-card { + border: 1px solid #35393f; + background: #191b1f; + border-radius: 9px; + padding: 23px; + min-height: 190px; +} +.breakdown-card h2 { + font-size: 14px; + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 24px; +} +.breakdown-card h2 svg { + color: #6c7887; +} +.breakdown-card > p { + font-size: 11px; + padding: 13px 0; +} +.breakdown-row { + margin-bottom: 17px; +} +.breakdown-row > div { + display: flex; + justify-content: space-between; + gap: 20px; + font-size: 11px; + margin-bottom: 8px; +} +.breakdown-row strong { + font-weight: 500; +} +.breakdown-row > div > span { + color: #abb6c2; + overflow-wrap: anywhere; +} +.bar-track { + display: block; + height: 4px; + background: #2b3139; + border-radius: 3px; + overflow: hidden; +} +.bar-track i { + display: block; + height: 100%; + background: #dbe46a; + border-radius: 3px; +} +.top-links > div { + display: flex; + align-items: center; + justify-content: space-between; + font-size: 11px; + gap: 20px; + padding: 13px 0; + border-bottom: 1px solid #2d333c; +} +.top-links strong { + font-weight: 500; +} +.top-links small { + display: block; + font-size: 9px; + color: #828f9e; + margin-top: 6px; +} +.top-links b { + font-size: 11px; + font-weight: 500; +} +.top-links span { + min-width: 0; + overflow-wrap: anywhere; +} +@media (min-width: 1600px) { + .hero { + min-height: 680px; + } + .landing { + max-width: 1500px; + } +} +@media (max-width: 1150px) { + .sidebar { + width: 212px; + padding-left: 14px; + padding-right: 14px; + } + .app-content { + margin-left: 212px; + width: calc(100% - 212px); + } + main#main { + padding: 35px 28px; + } + .section-heading h1 { + font-size: 26px; + } + .app-footer { + margin: 0 28px; + } + .template-grid { + grid-template-columns: 1fr 1fr; + } + .hero { + gap: 15px; + } + .hero h1 { + font-size: 64px; + } + .hero-art { + transform: scale(0.85); + } + .hero { + grid-template-columns: 1.05fr 1fr; + } + .landing { + padding: 0 5%; + } + .link-row { + padding: 21px 18px; + } + .link-actions { + gap: 0; + } + .link-avatar { + width: 37px; + height: 37px; + } +} +@media (max-width: 850px) { + .section-heading { + flex-wrap: wrap; + gap: 16px; + } + .link-actions { + display: grid; + grid-template-columns: 1fr 1fr; + } + .link-row { + gap: 12px; + } + .hero { + grid-template-columns: 1fr; + gap: 0; + padding: 60px 0 35px; + } + .hero-copy { + text-align: center; + } + .hero .eyebrow { + justify-content: center; + } + .hero h1 { + font-size: 70px; + } + .hero-art { + height: 370px; + width: 440px; + max-width: 100%; + margin: auto; + transform: scale(0.9); + } + .features { + gap: 20px; + } + .feature + .feature { + padding-left: 22px; + } + .feature { + padding-right: 0; + } + .feature h2 { + font-size: 17px; + } + .landing-nav nav { + gap: 22px; + } + .template-grid { + grid-template-columns: 1fr; + } + .stat-grid { + gap: 10px; + } + .stat-card { + padding: 16px; + } + .stat-card > strong { + font-size: 30px; + } + .stat-card > div { + font-size: 10px; + } + .stat-card > div svg { + display: none; + } + .breakdown-grid { + gap: 14px; + } + .breakdown-card { + padding: 18px; + } + .qr-layout { + grid-template-columns: 1fr 1fr; + } + .qr-preview { + min-height: 220px; + } +} +@media (max-width: 650px) { + .mobile-header { + height: 68px; + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 19px; + border-bottom: 1px solid #2b2e35; + position: sticky; + top: 0; + background: #16181bf5; + z-index: 30; + width: 100%; + } + .mobile-header .brand { + font-size: 24px; + } + .app-shell { + display: block; + } + .sidebar { + display: none; + top: 68px; + width: 260px; + box-shadow: 30px 0 80px #000a; + } + .sidebar-open { + display: flex; + } + .sidebar > .brand { + display: none; + } + .sidebar .workspace-label { + margin-top: 0; + border-top: 0; + } + .app-content { + margin-left: 0; + width: 100%; + } + main#main { + padding: 30px 19px; + } + .section-heading { + margin-bottom: 24px; + } + .section-heading h1 { + font-size: 28px; + } + .section-heading p { + font-size: 11px; + } + .section-heading .eyebrow { + font-size: 8px; + } + .search-field { + min-width: 0; + } + .search-field input { + font-size: 10px; + } + .links-filter-bar .filter-select { flex: 1 1 150px; } + .link-row { + padding: 19px 13px; + gap: 10px; + } + .link-avatar { + display: none; + } + .link-actions { + align-self: flex-start; + } + .link-info { + width: calc(100% - 78px); + } + .link-title { + font-size: 12px; + } + .link-meta { + gap: 5px; + } + .app-footer { + margin: 0 19px; + font-size: 8px; + } + .empty-state { + padding: 45px 18px; + } + .empty-state h2 { + font-size: 19px; + } + .empty-state p { + font-size: 11px; + } + .modal-backdrop { + padding: 12px; + } + .modal { + max-height: 94vh; + } + .modal-heading { + padding: 19px; + } + .modal-heading h2 { + font-size: 18px; + } + .modal-body { + padding: 20px; + } + .modal-actions { + padding: 17px 20px; + } + .form-grid { + grid-template-columns: 1fr; + gap: 0; + } + .qr-layout { + grid-template-columns: 1fr; + gap: 22px; + } + .qr-preview { + max-width: 280px; + margin: auto; + } + .qr-controls h3 { + margin-bottom: 15px; + } + .qr-layout > div > p { + text-align: center; + } + .color-fields { + gap: 35px; + } + .qr-actions { + padding: 16px 12px; + gap: 6px; + } + .qr-actions button { + font-size: 10px; + } + .qr-actions .button-secondary { + padding: 9px 10px; + } + .stat-grid { + grid-template-columns: 1fr; + } + .stat-card { + display: grid; + grid-template-columns: 1fr auto; + gap: 2px; + align-items: center; + padding: 18px; + } + .stat-card > strong { + grid-column: 2; + grid-row: 1/3; + margin: 0; + } + .stat-card > div { + font-size: 11px; + } + .stat-card > p { + grid-column: 1; + } + .chart-card { + padding: 20px 14px; + } + .breakdown-grid { + grid-template-columns: 1fr; + } + .analytics-filters { + gap: 8px; + } + .analytics-filters > select, + .analytics-filters > label { + max-width: calc(50% - 4px); + flex: 1; + min-width: calc(50% - 4px); + font-size: 10px; + } + .analytics-notice { + align-items: flex-start; + padding: 15px; + } + .analytics-notice > svg { + flex-shrink: 0; + } + .analytics-notice p { + font-size: 10px; + } + .landing { + padding: 0 6%; + } + .landing-nav { + height: 83px; + } + .landing-nav .brand { + font-size: 24px; + } + .landing-nav nav { + gap: 15px; + } + .landing-nav nav > a { + font-size: 11px; + } + .landing-nav .button-small { + padding: 9px 11px; + font-size: 10px; + } + .landing-nav .button-small svg { + display: none; + } + .hero { + padding-top: 44px; + } + .hero h1 { + font-size: 58px; + letter-spacing: -3px; + } + .hero-copy > p { + font-size: 13px; + } + .hero-footnote { + font-size: 9px; + } + .hero-art { + transform: scale(0.82); + height: 330px; + } + .hero-cta { + margin-top: 25px; + } + .card-url { + left: 0; + } + .card-qr { + right: 0; + } + .orbital { + width: 350px; + height: 350px; + } + .orbital-two { + width: 275px; + height: 275px; + } + .features { + grid-template-columns: 1fr; + padding: 30px 0; + gap: 25px; + } + .feature { + padding: 0; + display: grid; + grid-template-columns: 45px 1fr; + gap: 0 14px; + } + .feature + .feature { + border-left: 0; + padding: 0; + } + .feature-top { + grid-row: 1/3; + margin: 0; + display: block; + } + .feature-top span { + display: none; + } + .feature h2 { + font-size: 18px; + } + .feature p { + font-size: 12px; + max-width: none; + } + .landing-callout { + padding: 18px; + gap: 13px; + margin-bottom: 30px; + } + .landing-callout > svg { + display: none; + } + .landing-callout p { + font-size: 11px; + } + .landing-footer { + flex-wrap: wrap; + gap: 18px; + padding-top: 20px; + } + .auth-prompt h1 { + font-size: 32px; + } + .auth-screen { + gap: 40px; + } + .auth-prompt p { + font-size: 14px; + } +} +@media (prefers-reduced-motion: reduce) { + * { + animation: none !important; + transition: none !important; + scroll-behavior: auto !important; + } +} +/* Prevent the artwork's intrinsic width from enlarging the mobile grid track. */ +@media (max-width: 850px) { + .hero { + grid-template-columns: minmax(0, 1fr); + } + .hero-copy, + .hero-art { + min-width: 0; + } + .landing { + overflow-x: clip; + } +} diff --git a/applications/shortwave/src/worker.ts b/applications/shortwave/src/worker.ts new file mode 100644 index 00000000..2091446b --- /dev/null +++ b/applications/shortwave/src/worker.ts @@ -0,0 +1,68 @@ +import handler from "@tanstack/react-start/server-entry"; +import { flushOutbox } from "./server/outbox"; +import { + closeWorkersRuntime, + createWorkersRuntime, + runWorkersRuntime, + runtimeEnvironment, +} from "./server/runtime"; + +export default { + async fetch(request, env, ctx) { + const runtime = createWorkersRuntime(env); + return runWorkersRuntime(runtime, async () => { + try { + const url = new URL(request.url); + const customDomains = (runtimeEnvironment("PUBLIC_CUSTOM_DOMAINS") || "") + .split(",").map((hostname) => hostname.trim().toLowerCase()).filter(Boolean); + if (customDomains.includes(url.hostname.toLowerCase())) { + const readable = request.method === "GET" || request.method === "HEAD"; + if (readable && url.pathname === "/") { + return Response.redirect(runtimeEnvironment("APP_URL")!, 302); + } + if (!readable || !/^\/r\/[^/]+$/.test(url.pathname)) { + return new Response("Not found", { status: 404 }); + } + } + + const response = await handler.fetch(request); + if (!response.body) { + await closeWorkersRuntime(runtime); + return response; + } + // SSR can continue loading while its body streams. Keep its scoped + // connections alive through completion/cancellation, then release them. + const { readable, writable } = new TransformStream(); + ctx.waitUntil((async () => { + try { + await response.body!.pipeTo(writable); + } catch { + // A disconnected browser cancels the stream. Do not log response data. + } finally { + await closeWorkersRuntime(runtime); + } + })()); + return new Response(readable, response); + } catch { + await closeWorkersRuntime(runtime); + console.error(JSON.stringify({ event: "request_failed" })); + return new Response("Internal server error", { status: 500 }); + } + }); + }, + + async scheduled(_event, env, _ctx) { + const runtime = createWorkersRuntime(env); + await runWorkersRuntime(runtime, async () => { + try { + // Bounded work per tick; SKIP LOCKED makes overlapping ticks safe. + for (let batch = 0; batch < 5; batch++) { + const result = await flushOutbox(500); + if (result.failed || result.delivered < 500) break; + } + } finally { + await closeWorkersRuntime(runtime); + } + }); + }, +} satisfies ExportedHandler; diff --git a/applications/shortwave/tests/browser/app.spec.ts b/applications/shortwave/tests/browser/app.spec.ts new file mode 100644 index 00000000..69fee014 --- /dev/null +++ b/applications/shortwave/tests/browser/app.spec.ts @@ -0,0 +1,466 @@ +import { test, expect, type Page } from "@playwright/test"; +import { + clerk, + clerkSetup, + setupClerkTestingToken, +} from "@clerk/testing/playwright"; +import { randomUUID } from "node:crypto"; +import { readFile } from "node:fs/promises"; +import { PNG } from "pngjs"; +import jsQR from "jsqr"; +import { closeDatabases, getPostgres } from "../../src/server/db"; +import { flushOutbox, getAccountId } from "../../src/server/service"; +import { verifyUserMenu } from "./user-menu"; +import { verifyFolders } from "./folders"; +import { chooseOption, verifyEditorControls, verifyScrollableFolderPicker } from "./controls"; +import { verifyDropdowns } from "./dropdowns"; +import { verifyStablePreview } from "./layout"; +import { verifyUtmTransactions } from "./utms"; +import { verifyDomains } from "./domains"; + +let clerkUserId: string | undefined; +async function verifyTagOverlay(page: Page, size: string) { + await expect(page.locator(".destination-preview-card")).toHaveAttribute("aria-busy", "false"); + const input = page.getByRole("combobox", { name: "Tags", exact: true }); + const list = page.getByRole("listbox", { name: "Saved tags" }); + const toggle = page.getByRole("button", { name: /^UTMs/ }); + await input.fill("lau"); + await expect(list.getByRole("option", { name: "launch", exact: true })).toBeVisible(); + await input.press("Escape"); + const before = await toggle.boundingBox(); + await input.fill("laun"); + await expect(list).toBeVisible(); + expect((await toggle.boundingBox())!.y).toBeCloseTo(before!.y, 0); + await input.press("ArrowDown"); + expect((await toggle.boundingBox())!.y).toBeCloseTo(before!.y, 0); + await input.press("ArrowUp"); + const last = list.getByRole("option").last(); + await expect(last).toHaveAttribute("aria-selected", "true"); + expect(await last.evaluate((option) => { + const box = option.getBoundingClientRect(); + const menu = option.parentElement!.getBoundingClientRect(); + return box.top >= menu.top && box.bottom <= menu.bottom; + })).toBe(true); + expect((await toggle.boundingBox())!.y).toBeCloseTo(before!.y, 0); + await input.press("ArrowDown"); + const bounds = await list.boundingBox(); + expect(bounds!.x).toBeGreaterThanOrEqual(0); + expect(bounds!.x + bounds!.width).toBeLessThanOrEqual(page.viewportSize()!.width); + expect(bounds!.y).toBeGreaterThanOrEqual(0); + expect(bounds!.y + bounds!.height).toBeLessThanOrEqual(page.viewportSize()!.height); + // Visible geometry alone misses lists painted behind the dialog/footer. + expect(await list.getByRole("option", { name: "launch", exact: true }).evaluate((option) => { + const box = option.getBoundingClientRect(); + return option.contains(document.elementFromPoint(box.x + box.width / 2, box.y + box.height / 2)); + })).toBe(true); + const dialog = page.locator(".link-editor-form"); + const scrollTop = await dialog.evaluate((element) => element.scrollTop); + await dialog.evaluate((element) => { element.scrollTop += 24; }); + await expect.poll(async () => { + const anchor = await page.locator(".tag-input-anchor").boundingBox(); + const menu = await list.boundingBox(); + if (!anchor || !menu) return false; + return Math.min( + Math.abs(menu.y - (anchor.y + anchor.height + 6)), + Math.abs(anchor.y - (menu.y + menu.height + 6)), + ) < 1; + }).toBe(true); + await dialog.evaluate((element, value) => { element.scrollTop = value; }, scrollTop); + await page.screenshot({ path: `test-results/tag-overlay-${size}.png`, fullPage: true }); + await input.press("Escape"); + await expect(list).not.toBeVisible(); + expect((await toggle.boundingBox())!.y).toBeCloseTo(before!.y, 0); + await expect(page.locator("dialog.modal[open]")).toBeVisible(); + await input.fill(""); + await input.press("Escape"); +} + +const email = `shortwave-${randomUUID()}+clerk_test@example.com`; +async function clerkApi(path: string, method: string, body?: object) { + const response = await fetch(`https://api.clerk.com/v1${path}`, { + method, + headers: { + Authorization: `Bearer ${process.env.CLERK_SECRET_KEY}`, + "Content-Type": "application/json", + }, + ...(body ? { body: JSON.stringify(body) } : {}), + }); + if (!response.ok) { + const result = (await response.json()) as { + errors?: { + code?: string; + long_message?: string; + meta?: { param_name?: string }; + }[]; + }; + throw new Error( + `Clerk test fixture operation failed (HTTP ${response.status}): ${result.errors?.map((e) => `${e.code}:${e.meta?.param_name || ""}${response.status === 422 ? ` ${e.long_message}` : ""}`).join(", ")}`, + ); + } + return response.json() as Promise<{ id: string }>; +} + +test.beforeAll(async () => { + if (!process.env.CLERK_SECRET_KEY?.startsWith("sk_test_")) + throw new Error("Browser tests require a Clerk development instance."); + await clerkSetup({ dotenv: false }); + const user = await clerkApi("/users", "POST", { + email_address: [email], + username: `shortwave_${randomUUID().replaceAll("-", "").slice(0, 16)}`, + password: `${randomUUID()}!Aa9`, + first_name: "Shortwave", + last_name: "Test", + }); + clerkUserId = user.id; +}); + +test.afterAll(async () => { + try { + if (clerkUserId) { + const db = getPostgres(); + const result = await db.query( + "SELECT id FROM accounts WHERE clerk_user_id = $1", + [clerkUserId], + ); + const accountId = result.rows[0]?.id; + if (accountId) { + for (const table of [ + "click_outbox", + "qr_styles", + "utm_templates", + "links", + ]) + await db.query(`DELETE FROM ${table} WHERE account_id = $1`, [ + accountId, + ]); + await db.query("DELETE FROM accounts WHERE id = $1", [accountId]); + } + await clerkApi(`/users/${clerkUserId}`, "DELETE"); + } + } finally { + await closeDatabases(); + } +}); + +test("public landing, responsive layout, and protected collection", async ({ + page, +}) => { + await setupClerkTestingToken({ page }); + await page.goto("/"); + await expect( + page.getByRole("heading", { name: /Small links/ }), + ).toBeVisible(); + const navigation = page.getByRole("navigation"); + await expect(navigation.getByRole("link", { name: "Get started" })).toHaveAttribute("href", /sign-up/); + await expect(navigation.getByRole("link", { name: /Sign in|The possibilities|Dashboard/ })).toHaveCount(0); + await expect(page.locator('link[rel="icon"]')).toHaveAttribute("href", "/favicon.svg"); + const favicon = await page.request.get("/favicon.svg"); + expect(favicon.status()).toBe(200); + expect(favicon.headers()["content-type"]).toContain("image/svg+xml"); + await expect(page.locator(".landing-footer .brand")).toHaveCSS("color", "rgb(255, 255, 255)"); + await page.screenshot({ + path: "test-results/landing-desktop.png", + fullPage: true, + }); + await page.setViewportSize({ width: 390, height: 844 }); + await expect(navigation.getByRole("link", { name: "Get started" })).toBeVisible(); + await expect + .poll(() => + page.evaluate( + () => document.documentElement.scrollWidth <= window.innerWidth, + ), + ) + .toBe(true); + await page.screenshot({ + path: "test-results/landing-mobile.png", + fullPage: true, + }); + await page.goto("/links"); + await expect( + page.getByRole("heading", { name: "Your links", exact: true }), + ).not.toBeVisible(); + await expect(page.getByText(/Sign in/i).first()).toBeVisible(); + await page.goto("/domains"); + await expect(page.getByRole("heading", { name: "Domains", exact: true })).not.toBeVisible(); + await expect(page.getByText(/Sign in/i).first()).toBeVisible(); +}); + +test("Clerk account creates, edits, tracks and disables a link with a decodable QR", async ({ + page, + request, +}) => { + const errors: string[] = []; + page.on("pageerror", (error) => errors.push(error.message)); + await page.goto("/"); + await clerk.signIn({ page, emailAddress: email }); + await page.reload(); + await expect(page.getByRole("navigation").getByRole("link", { name: "Dashboard" })).toHaveAttribute("href", "/links"); + await expect(page.getByRole("navigation").getByRole("link", { name: "Get started" })).toHaveCount(0); + await page.setViewportSize({ width: 390, height: 844 }); + await expect(page.getByRole("navigation").getByRole("link", { name: "Dashboard" })).toBeVisible(); + await page.setViewportSize({ width: 1440, height: 1000 }); + await page.goto("/links"); + await expect( + page.getByRole("heading", { name: "Your links", exact: true }), + ).toBeVisible(); + await verifyUserMenu(page); + await verifyDropdowns(page); + await verifyStablePreview(page); + await page.getByRole("combobox", { name: "Filter links by folder", exact: true }).blur(); + await expect(page.getByText("WORKSPACE", { exact: true })).toHaveCount(0); + await expect(page.getByText("Your personal collection", { exact: true })).toHaveCount(0); + await expect(page.locator(".links-banner")).toHaveCount(0); + const credits = page.locator(".sidebar-credits"); + await expect(credits.getByRole("link", { name: "ClickHouse Cloud", exact: true })).toHaveAttribute("href", "https://clickhouse.com/cloud"); + await expect(credits.getByRole("link", { name: /GitHub/ })).toHaveCount(0); + expect(await credits.evaluate((element) => element.nextElementSibling?.classList.contains("sidebar-account"))).toBe(true); + for (const selector of [".workspace-label", ".sidebar-account", ".app-footer"]) { + expect(await page.locator(selector).evaluate((element) => { + const style = getComputedStyle(element); + return style.borderTopWidth === "0px" && style.borderBottomWidth === "0px"; + })).toBe(true); + } + await page.keyboard.press("?"); + await expect(page.getByRole("heading", { name: "Keyboard shortcuts", exact: true })).toBeVisible(); + await page.keyboard.press("Escape"); + await expect(page.getByRole("heading", { name: "Keyboard shortcuts", exact: true })).not.toBeVisible(); + await page.keyboard.press("/"); + await expect(page.locator(".search-field input")).toBeFocused(); + await page.keyboard.type("c?"); + await expect(page.locator("dialog.modal[open]")).not.toBeVisible(); + await page.locator(".search-field input").fill(""); + await page.locator(".search-field input").blur(); + await page.keyboard.press("c"); + await expect(page.locator("dialog.modal[open]")).toBeVisible(); + await page.getByLabel("Destination URL").press("Shift+Enter"); + await expect(page.locator("dialog.modal[open]")).toBeVisible(); + expect(await page.getByLabel("Destination URL").evaluate((element: HTMLInputElement) => element.validity.valueMissing)).toBe(true); + await page + .getByLabel("Destination URL") + .fill("example.com/launch?keep=yes&utm_source=old#section"); + await page.getByLabel("Link title").fill("Browser verification"); + await expect(page.getByLabel("Destination URL")).toHaveValue("https://example.com/launch?keep=yes&utm_source=old#section"); + const fieldsBox = (await page.locator(".link-editor-fields").boundingBox())!; + const previewBox = (await page.locator(".link-editor-preview").boundingBox())!; + expect(previewBox.x).toBeGreaterThan(fieldsBox.x + fieldsBox.width); + await page.getByLabel("Link title").dispatchEvent("keydown", { key: "Enter", shiftKey: true, isComposing: true }); + await page.getByLabel("Link title").dispatchEvent("keydown", { key: "Enter", shiftKey: true, repeat: true }); + await expect(page.locator("dialog.modal[open]")).toBeVisible(); + const slug = `browser-${randomUUID().slice(0, 8)}`; + await page.getByLabel("Short link ending").fill(slug); + const tagInput = page.getByRole("combobox", { name: "Tags", exact: true }); + const savedTags = page.getByRole("listbox", { name: "Saved tags" }); + await tagInput.fill("verification"); + await tagInput.press("Shift+Enter"); + await expect(page.locator("dialog.modal[open]")).toBeVisible(); + await expect(page.getByRole("button", { name: "Remove tag verification", exact: true })).toBeVisible(); + await tagInput.fill("launch"); + await tagInput.press("Enter"); + await tagInput.press("Backspace"); + await expect(tagInput).toHaveValue("launch"); + await tagInput.press("Enter"); + await tagInput.fill("launch"); + await tagInput.press("Enter"); + await expect(page.getByRole("button", { name: "Remove tag launch", exact: true })).toHaveCount(1); + await expect(page.getByLabel("Source utm_source")).not.toBeVisible(); + await verifyUtmTransactions(page, "desktop", true); + await verifyEditorControls(page); + await page.screenshot({ path: "test-results/link-editor-desktop.png", fullPage: true }); + await page.getByLabel("Destination URL").press("Shift+Enter"); + await expect(page.locator("dialog.modal[open]")).not.toBeVisible(); + await expect( + page.getByRole("button", { name: "Browser verification", exact: true }), + ).toBeVisible(); + const redirect = await request.get(`/r/${slug}`, { maxRedirects: 0 }); + expect(redirect.status()).toBe(302); + expect(redirect.headers()["cache-control"]).toContain("no-store"); + expect(redirect.headers().location).toContain("utm_source=newsletter"); + const accountId = await getAccountId(clerkUserId!); + expect((await getPostgres().query("SELECT count(*)::int AS count FROM links WHERE account_id = $1 AND title = $2", [accountId, "Browser verification"])).rows[0].count).toBe(1); + await flushOutbox(500, accountId); + + await page + .getByRole("button", { + name: "QR code for Browser verification", + exact: true, + }) + .click(); + page.setDefaultTimeout(15_000); + await expect(page.getByRole("button", { name: "Remove logo", exact: true })).toHaveCount(0); + await expect(page.getByRole("button", { name: "Remove custom logo", exact: true })).toHaveCount(0); + await chooseOption(page, page.getByLabel("Dot style"), "Soft corners"); + await page.getByRole("button", { name: "Save style", exact: true }).click(); + await expect( + page.getByRole("button", { name: "Style saved", exact: true }), + ).toBeVisible(); + expect((await getPostgres().query("SELECT style FROM qr_styles WHERE account_id = $1 AND link_id = (SELECT id FROM links WHERE account_id = $1 AND slug = $2)", [accountId, slug])).rows[0].style.logo).toBe("clickhouse"); + const downloadPromise = page.waitForEvent("download"); + await page.getByRole("button", { name: "PNG", exact: true }).click(); + const download = await downloadPromise; + const png = PNG.sync.read(await readFile((await download.path())!)); + const decoded = jsQR(new Uint8ClampedArray(png.data), png.width, png.height); + expect(decoded?.data).toBe(`${process.env.BROWSER_BASE_URL || "http://localhost:4317"}/r/${slug}`); + const svgDownloadPromise = page.waitForEvent("download"); + await page.getByRole("button", { name: "SVG", exact: true }).click(); + const svgDownload = await svgDownloadPromise; + const svg = await readFile((await svgDownload.path())!, "utf8"); + expect(svg).toContain(" page.evaluate((source) => { + const doc = new DOMParser().parseFromString(source, "image/svg+xml"); + const image = doc.querySelector("image")!; + const uri = image.getAttribute("href") || image.getAttributeNS("http://www.w3.org/1999/xlink", "href")!; + return decodeURIComponent(uri.slice(uri.indexOf(",") + 1)); + }, source); + const lightLogo = await exportedLogo(svg); + expect(lightLogo).toContain('fill="#000000"'); + expect(lightLogo).not.toContain(" `launch-check-${String(index).padStart(2, "0")}`)], + ); + await page.getByRole("button", { name: "Create a link", exact: true }).click(); + await page.getByLabel("Destination URL").fill("https://example.com/reuse"); + await page.getByLabel("Link title").fill("Reused tags"); + await verifyTagOverlay(page, "desktop"); + await page.setViewportSize({ width: 390, height: 844 }); + await verifyTagOverlay(page, "mobile"); + await page.setViewportSize({ width: 390, height: 600 }); + await verifyTagOverlay(page, "mobile-compact"); + await page.setViewportSize({ width: 390, height: 844 }); + await verifyUtmTransactions(page, "mobile"); + await page.setViewportSize({ width: 1440, height: 1000 }); + await tagInput.fill("lau"); + await expect(tagInput).toBeFocused(); + await expect(savedTags.getByRole("option", { name: "launch", exact: true })).toBeVisible(); + await tagInput.press("Escape"); + await expect(page.locator("dialog.modal[open]")).toBeVisible(); + await expect(savedTags.getByRole("option", { name: "launch", exact: true })).not.toBeVisible(); + await tagInput.fill("laun"); + await expect(savedTags.getByRole("option", { name: "launch", exact: true })).toBeVisible(); + await tagInput.press("ArrowDown"); + await tagInput.press("Enter"); + await expect(page.getByRole("button", { name: "Remove tag launch", exact: true })).toBeVisible(); + await tagInput.fill("ver"); + await savedTags.getByRole("option", { name: "verification", exact: true }).click(); + await page.setViewportSize({ width: 390, height: 844 }); + await expect.poll(() => page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)).toBe(true); + const mobileFields = (await page.locator(".link-editor-fields").boundingBox())!; + const mobilePreview = (await page.locator(".link-editor-preview").boundingBox())!; + expect(mobilePreview.y).toBeGreaterThan(mobileFields.y + mobileFields.height); + await verifyEditorControls(page); + await page.screenshot({ path: "test-results/link-editor-mobile.png", fullPage: true }); + await page.getByRole("button", { name: "Create link", exact: true }).click(); + await expect(page.locator("dialog.modal[open]")).not.toBeVisible(); + await page.setViewportSize({ width: 1440, height: 1000 }); + await page.reload(); + await page.getByRole("button", { name: "Edit Reused tags", exact: true }).click(); + await expect(page.getByRole("button", { name: "Remove tag launch", exact: true })).toBeVisible(); + await expect(page.getByRole("button", { name: "Remove tag verification", exact: true })).toBeVisible(); + await page.getByRole("button", { name: "Cancel", exact: true }).click(); + const edited = await request.get(`/r/${slug}`, { maxRedirects: 0 }); + expect(edited.headers().location).toContain("https://example.com/updated"); + await page + .getByRole("button", { name: "Edit Browser verification", exact: true }) + .click(); + await page.getByRole("checkbox", { name: /Link is active/ }).uncheck(); + await page.getByRole("button", { name: "Save changes", exact: true }).click(); + await expect(page.locator("dialog.modal[open]")).not.toBeVisible(); + expect((await request.get(`/r/${slug}`, { maxRedirects: 0 })).status()).toBe( + 410, + ); + await flushOutbox(500, accountId); + const pickerFolders = await getPostgres().query( + "INSERT INTO folders (account_id, name) SELECT $1, unnest($2::text[]) RETURNING id", + [accountId, Array.from({ length: 12 }, (_, index) => `Picker folder ${String(index + 1).padStart(2, "0")}`)], + ); + try { + await verifyScrollableFolderPicker(page); + } finally { + await getPostgres().query("DELETE FROM folders WHERE account_id = $1 AND id = ANY($2::uuid[])", [accountId, pickerFolders.rows.map((row) => row.id)]); + } + await verifyFolders(page); + await verifyDomains(page); + await page.goto("/analytics"); + await expect(page.getByRole("heading", { name: "Link analytics", exact: true })).toBeVisible(); + const total = page + .locator(".stat-card") + .filter({ hasText: "Total clicks" }) + .locator("strong"); + await expect(total).toHaveText("2"); + await chooseOption(page, page.getByRole("combobox", { name: "Filter by tag", exact: true }), "verification"); + // ClickPipes is asynchronous. Exercise the user's Refresh action until the + // newly created link's metadata arrives, rather than assuming immediate CDC. + await expect.poll(async () => { + await page.getByRole("button", { name: "Refresh", exact: true }).click(); + await expect(page.getByRole("button", { name: "Refresh", exact: true })).toBeEnabled(); + return total.textContent(); + }, { timeout: 60_000, intervals: [2_000, 3_000, 5_000] }).toBe("2"); + await page.screenshot({ + path: "test-results/analytics-desktop.png", + fullPage: true, + }); + expect(errors).toEqual([]); +}); diff --git a/applications/shortwave/tests/browser/controls.ts b/applications/shortwave/tests/browser/controls.ts new file mode 100644 index 00000000..003e15a0 --- /dev/null +++ b/applications/shortwave/tests/browser/controls.ts @@ -0,0 +1,233 @@ +import { expect, type Locator, type Page } from "@playwright/test"; +import { editorContent, editorFrame } from "./layout"; + +export async function chooseOption(page: Page, control: Locator, label: string) { + await control.click(); + const option = page.getByRole("option", { name: label, exact: true }); + await option.scrollIntoViewIfNeeded(); + expect(await option.evaluate((element) => { + const box = element.getBoundingClientRect(); + return element.contains(document.elementFromPoint(box.x + box.width / 2, box.y + box.height / 2)); + })).toBe(true); + const box = (await page.locator(".app-select-options:visible").boundingBox())!; + expect(box.x).toBeGreaterThanOrEqual(0); + expect(box.y).toBeGreaterThanOrEqual(0); + expect(box.x + box.width).toBeLessThanOrEqual(page.viewportSize()!.width); + expect(box.y + box.height).toBeLessThanOrEqual(page.viewportSize()!.height); + await option.click(); + await expect(control).toContainText(label); +} + +export async function verifyEditorControls(page: Page) { + const actions = page.locator(".link-editor-actions"); + const buttons = [ + actions.getByRole("button", { name: /^UTMs/ }), + actions.getByRole("button", { name: "Cancel", exact: true }), + actions.getByRole("button", { name: /^(Create link|Save changes)$/ }), + ]; + const boxes = await Promise.all(buttons.map((button) => button.boundingBox())); + for (const box of boxes) { + expect(box).not.toBeNull(); + expect(box!.height).toBeCloseTo(boxes[0]!.height, 0); + expect(box!.y).toBeCloseTo(boxes[0]!.y, 0); + expect(box!.x).toBeGreaterThanOrEqual(0); + expect(box!.x + box!.width).toBeLessThanOrEqual(page.viewportSize()!.width); + } + expect(boxes[1]!.x - boxes[0]!.x - boxes[0]!.width).toBeGreaterThanOrEqual(7); + expect(boxes[2]!.x - boxes[1]!.x - boxes[1]!.width).toBeGreaterThanOrEqual(7); + await expect(page.locator("dialog[open] select")).toHaveCount(0); +} + +export async function verifyFolderDisclosure(page: Page) { + const trigger = page.locator(".folder-trigger"); + const popup = page.locator(".folder-popup"); + await expect(popup).toBeVisible(); + // The floating menu must stay anchored without contributing layout height. + const { anchor, panel } = await popup.evaluate((element) => { + const dialog = element.closest("dialog")!; + return { + anchor: dialog.querySelector(".folder-trigger")!.getBoundingClientRect().toJSON(), + panel: element.getBoundingClientRect().toJSON(), + }; + }); + expect(panel.y).toBeGreaterThanOrEqual(anchor.y + anchor.height + 5); + expect(panel.x).toBeCloseTo(anchor.x, 0); + expect(panel.width).toBeCloseTo(anchor.width, 0); + expect(panel.y + panel.height).toBeLessThanOrEqual(page.viewportSize()!.height - 7); + expect(anchor.y).toBeGreaterThanOrEqual(0); + for (const field of [page.getByLabel("Link title"), page.getByRole("combobox", { name: "Tags", exact: true })]) { + const bounds = (await field.boundingBox())!; + expect(bounds.y + bounds.height).toBeLessThanOrEqual(anchor.y); + } + expect(await trigger.evaluate((element) => { + const rect = element.getBoundingClientRect(); + return element.contains(document.elementFromPoint(rect.x + rect.width / 2, rect.y + rect.height / 2)); + })).toBe(true); +} + +export async function verifyScrollableFolderPicker(page: Page) { + for (const viewport of [{ width: 1440, height: 1000 }, { width: 390, height: 600 }]) { + await page.setViewportSize(viewport); + await page.getByRole("button", { name: "Create a link", exact: true }).click(); + await page.locator(".folder-trigger").evaluate((element) => element.scrollIntoView({ block: "center" })); + const frame = await editorFrame(page); + const content = await editorContent(page); + await page.locator(".folder-trigger").click(); + expect(await editorFrame(page)).toEqual(frame); + expect(await editorContent(page)).toEqual(content); + const search = page.getByRole("textbox", { name: "Search or create a folder" }); + await expect(page.locator(".folder-options button")).toHaveCount(13); + const list = page.locator(".folder-options"); + const listHeight = await list.evaluate((element) => element.clientHeight); + const visibleRows = await list.evaluate((element) => { + const bounds = element.getBoundingClientRect(); + return [...element.querySelectorAll("button")].filter((button) => { + const box = button.getBoundingClientRect(); + return box.top >= bounds.top && box.bottom <= bounds.bottom + 1; + }).length; + }); + expect(visibleRows).toBeGreaterThanOrEqual(2); + expect(visibleRows).toBeLessThanOrEqual(3); + await search.fill("Picker folder 11"); + await expect(page.locator(".folder-options button")).toHaveCount(2); + expect(await list.evaluate((element) => element.clientHeight)).toBe(listHeight); + expect(await editorFrame(page)).toEqual(frame); + expect(await editorContent(page)).toEqual(content); + await search.fill(""); + await expect(page.locator(".folder-options button")).toHaveCount(13); + await verifyFolderDisclosure(page); + const dialog = page.locator(".link-editor-form"); + const scrollBefore = await dialog.evaluate((element) => element.scrollTop); + await search.press("ArrowUp"); + const last = page.locator(".folder-options button").last(); + await expect(last).toBeFocused(); + expect(await page.locator(".folder-options").evaluate((element) => element.scrollTop)).toBeGreaterThan(0); + expect(await dialog.evaluate((element) => element.scrollTop)).toBeCloseTo(scrollBefore, 0); + await verifyFolderDisclosure(page); + await page.screenshot({ path: `test-results/folder-selector-scroll-${viewport.width}.png` }); + await page.locator(".folder-trigger").focus(); + await page.locator(".folder-trigger").press("ArrowUp"); + await expect(last).toBeFocused(); + const selectedName = (await last.textContent())!.trim(); + await page.keyboard.press("Enter"); + await expect(page.locator(".folder-trigger")).toContainText(selectedName); + expect(await editorFrame(page)).toEqual(frame); + expect(await editorContent(page)).toEqual(content); + await expect(page.locator(".folder-trigger")).toBeFocused(); + await page.getByRole("button", { name: "Cancel", exact: true }).click(); + } + await page.setViewportSize({ width: 1440, height: 1000 }); +} + +/** Existing folder + saved template: each control must retain its own state. */ +export async function verifyFolderTemplateIsolation(page: Page, folderName: string, size: string) { + page.setDefaultTimeout(15_000); + const trigger = page.locator(".folder-trigger"); + const toggle = page.getByRole("button", { name: /^UTMs/ }); + const panel = page.getByRole("dialog", { name: "UTM parameters", exact: true }); + const templates = panel.getByRole("button", { name: "Templates", exact: true }); + const menu = page.getByRole("dialog", { name: "UTM templates", exact: true }); + const source = page.getByLabel("Source utm_source"); + let frame = await editorFrame(page); + let content = await editorContent(page); + async function openUtms() { + await toggle.scrollIntoViewIfNeeded(); + frame = await editorFrame(page); + content = await editorContent(page); + await toggle.click(); + await expect(panel).toBeVisible(); + expect(await panel.evaluate((element) => element instanceof HTMLDialogElement && element.matches(":modal"))).toBe(true); + expect(await editorFrame(page)).toEqual(frame); + expect(await editorContent(page)).toEqual(content); + await expect(panel.getByLabel("Destination URL", { exact: true })).toHaveCount(0); + await expect(panel.locator(".folder-trigger")).toHaveCount(0); + } + async function verifyClosedUtms() { + await expect(panel).not.toBeVisible(); + await expect(toggle).toBeFocused(); + expect(await editorFrame(page)).toEqual(frame); + expect(await editorContent(page)).toEqual(content); + } + await openUtms(); + await templates.click(); + await menu.getByRole("button", { name: "Verification newsletter", exact: true }).click(); + if (await menu.isVisible()) await menu.getByLabel("Template name", { exact: true }).press("Escape"); + await expect(source).toHaveValue("newsletter"); + await panel.getByRole("button", { name: "Save", exact: true }).click(); + await verifyClosedUtms(); + await openUtms(); + await templates.click(); + await expect(menu).toBeVisible(); + await page.screenshot({ path: `test-results/themed-template-${size}.png`, fullPage: false }); + await menu.getByLabel("Template name", { exact: true }).press("Escape"); + await expect(menu).not.toBeVisible(); + await expect(templates).toBeFocused(); + await expect(panel).toBeVisible(); + await templates.press("Escape"); + await verifyClosedUtms(); + // The creator is inert while the modal UTM overlay is open. Close it + // before choosing a folder, then reopen it to inspect its retained state. + await trigger.evaluate((element) => element.scrollIntoView({ block: "center" })); + expect(await trigger.evaluate((element) => { + const box = element.getBoundingClientRect(); + return element.contains(document.elementFromPoint(box.x + box.width / 2, box.y + box.height / 2)); + })).toBe(true); + const folderFrame = await editorFrame(page); + const folderContent = await editorContent(page); + await trigger.click(); + await expect(panel).not.toBeVisible(); + expect(await editorFrame(page)).toEqual(folderFrame); + expect(await editorContent(page)).toEqual(folderContent); + const search = page.getByRole("textbox", { name: "Search or create a folder" }); + await expect(search).toBeFocused(); + await verifyFolderDisclosure(page); + const option = page.locator(".folder-popup").getByRole("button", { name: folderName, exact: true }); + await expect(option).toBeVisible(); + expect(await option.evaluate((element) => { + const box = element.getBoundingClientRect(); + return element.contains(document.elementFromPoint(box.x + box.width / 2, box.y + box.height / 2)); + })).toBe(true); + await page.screenshot({ path: `test-results/folder-template-${size}.png`, fullPage: false }); + await page.locator(".folder-popup").getByRole("button", { name: "No folder", exact: true }).click(); + await expect(trigger).toBeFocused(); + await openUtms(); + await expect(source).toHaveValue("newsletter"); + await source.fill(`discarded-${size}`); + await panel.getByRole("button", { name: "Cancel", exact: true }).click(); + await verifyClosedUtms(); + await openUtms(); + await expect(source).toHaveValue("newsletter"); + await source.fill(`draft-${size}`); + await panel.getByRole("button", { name: "Save", exact: true }).click(); + await verifyClosedUtms(); + // Folder selection must preserve parameters explicitly saved to the creator. + await trigger.focus(); + await trigger.press("Enter"); + await expect(panel).not.toBeVisible(); + await search.fill(folderName); + await search.press("ArrowDown"); + await page.keyboard.press("ArrowDown"); + await expect(option).toBeFocused(); + await page.keyboard.press("Enter"); + await expect(trigger).toContainText(folderName); + await openUtms(); + await expect(source).toHaveValue(`draft-${size}`); + await templates.click(); + await expect(menu.getByRole("button", { name: "Verification newsletter", exact: true })).toBeVisible(); + await menu.getByLabel("Template name", { exact: true }).press("Escape"); + await panel.getByRole("button", { name: "Cancel", exact: true }).click(); + await verifyClosedUtms(); + await trigger.click(); + await search.press("Escape"); + await openUtms(); + await expect(search).not.toBeVisible(); + await expect(source).toHaveValue(`draft-${size}`); + await panel.getByRole("button", { name: "Close UTMs", exact: true }).click(); + await verifyClosedUtms(); + await trigger.click(); + await page.getByLabel("Link title").click(); + await expect(search).not.toBeVisible(); + await expect(page.getByLabel("Link title")).toBeFocused(); + await verifyEditorControls(page); + page.setDefaultTimeout(0); +} diff --git a/applications/shortwave/tests/browser/domains.ts b/applications/shortwave/tests/browser/domains.ts new file mode 100644 index 00000000..7fbecb2d --- /dev/null +++ b/applications/shortwave/tests/browser/domains.ts @@ -0,0 +1,88 @@ +import { randomUUID } from "node:crypto"; +import { expect, type Page } from "@playwright/test"; + +/** Uses a real absent TXT lookup; creates no external DNS records. Leaves Links open. */ +export async function verifyDomains(page: Page) { + const hostname = `browser-${randomUUID()}.shortwave.dev`; + await page.setViewportSize({ width: 1440, height: 1000 }); + await page.getByRole("navigation", { name: "Main navigation" }).getByRole("link", { name: "Domains", exact: true }).click(); + await expect(page.getByRole("heading", { name: "Domains", exact: true })).toBeVisible(); + await expect(page.getByRole("heading", { name: "No domains yet", exact: true })).toBeVisible(); + + async function add(value: string) { + await page.getByRole("button", { name: "Add domain", exact: true }).click(); + const dialog = page.getByRole("dialog"); + await expect(dialog.getByLabel("Domain", { exact: true })).toBeFocused(); + await dialog.getByLabel("Domain", { exact: true }).fill(value); + await dialog.getByRole("button", { name: "Add domain", exact: true }).click(); + await expect(dialog).not.toBeVisible(); + } + + await add(`${hostname.toUpperCase()}.`); + const card = page.getByRole("article", { name: hostname, exact: true }); + await expect(card).toBeVisible(); + await expect(card.getByText("Pending verification", { exact: true })).toBeVisible(); + const codes = card.locator(".domain-dns-value code"); + const recordName = (await codes.nth(0).textContent())!; + const recordValue = (await codes.nth(1).textContent())!; + expect(recordName).toBe(`_shortwave-verification.${hostname}`); + expect(recordValue).toMatch(/^shortwave-verification=[a-f0-9]{64}$/); + + await page.context().grantPermissions(["clipboard-read", "clipboard-write"]); + for (const [label, expected] of [["Copy record name", recordName], ["Copy record value", recordValue]]) { + const copy = card.getByRole("button", { name: label, exact: true }); + await copy.click(); + await expect(copy.locator("xpath=../..").getByRole("status")).toHaveText("Copied"); + await expect.poll(() => page.evaluate(() => navigator.clipboard.readText())).toBe(expected); + } + await page.screenshot({ path: "test-results/domains-desktop.png", fullPage: true }); + + await card.getByRole("button", { name: "Check DNS", exact: true }).click(); + await expect(card.getByRole("alert")).toContainText("TXT record not found", { timeout: 15_000 }); + await expect(card.getByText("Pending verification", { exact: true })).toBeVisible(); + await expect(card.locator("time")).toHaveAttribute("datetime", /\d{4}-\d{2}-\d{2}T/); + await page.reload(); + await expect(card).toBeVisible(); + await expect(codes.nth(0)).toHaveText(recordName); + await expect(codes.nth(1)).toHaveText(recordValue); + await expect(card.getByRole("alert")).toContainText("TXT record not found"); + await expect(card.locator("time")).toBeVisible(); + + for (const width of [390, 320]) { + await page.setViewportSize({ width, height: 700 }); + await expect.poll(() => page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)).toBe(true); + for (const element of [codes.nth(0), codes.nth(1), card.getByRole("button", { name: "Copy record value", exact: true })]) { + const bounds = (await element.boundingBox())!; + expect(bounds.x).toBeGreaterThanOrEqual(0); + expect(bounds.x + bounds.width).toBeLessThanOrEqual(width); + } + await page.screenshot({ path: `test-results/domains-mobile-${width}.png`, fullPage: true }); + } + const remove = card.getByRole("button", { name: `Remove ${hostname}`, exact: true }); + await remove.click(); + await expect(page.getByRole("heading", { name: "Remove domain?", exact: true })).toBeVisible(); + await page.keyboard.press("Escape"); + await expect(page.getByRole("dialog")).not.toBeVisible(); + await expect(remove).toBeFocused(); + await expect(card).toBeVisible(); + + async function removeClaim() { + await remove.click(); + await page.getByRole("dialog").getByRole("button", { name: "Remove domain", exact: true }).click(); + await expect(card).not.toBeVisible(); + await expect(page.getByRole("heading", { name: "No domains yet", exact: true })).toBeVisible(); + } + await removeClaim(); + await page.reload(); + await expect(card).not.toBeVisible(); + await add(hostname); + await expect(card).toBeVisible(); + await expect(codes.nth(0)).toHaveText(recordName); + await expect(codes.nth(1)).not.toHaveText(recordValue); + await expect(card.getByText("Pending verification", { exact: true })).toBeVisible(); + await expect(card.locator("time")).toHaveCount(0); + await removeClaim(); + await page.setViewportSize({ width: 1440, height: 1000 }); + await page.goto("/links"); + await expect(page.getByRole("heading", { name: "Your links", exact: true })).toBeVisible(); +} diff --git a/applications/shortwave/tests/browser/dropdowns.ts b/applications/shortwave/tests/browser/dropdowns.ts new file mode 100644 index 00000000..48afe51f --- /dev/null +++ b/applications/shortwave/tests/browser/dropdowns.ts @@ -0,0 +1,59 @@ +import { expect, type Page } from "@playwright/test"; + +/** Signed-in Links page. Verifies compact filters keep readable, full-width menus. */ +export async function verifyDropdowns(page: Page) { + const originalViewport = page.viewportSize(); + for (const viewport of [{ width: 1440, height: 1000 }, { width: 390, height: 600 }, { width: 320, height: 640 }]) { + await page.setViewportSize(viewport); + for (const [name, label] of [["Filter links by folder", "All folders"], ["Filter links by tag", "All tags"]]) { + const trigger = page.getByRole("combobox", { name, exact: true }); + await trigger.focus(); + await trigger.press("Home"); + await trigger.press("Enter"); + await expect(trigger).toContainText(label); + await trigger.click(); + const menu = page.getByRole("listbox", { name, exact: true }); + const option = menu.getByRole("option", { name: label, exact: true }); + await expect(option).toBeVisible(); + const triggerBox = (await trigger.boundingBox())!; + const menuBox = (await menu.boundingBox())!; + expect(menuBox.width).toBeCloseTo(triggerBox.width, 0); + expect(menuBox.x).toBeCloseTo(triggerBox.x, 0); + expect(menuBox.width).toBeGreaterThanOrEqual(150); + expect(menuBox.x).toBeGreaterThanOrEqual(0); + expect(menuBox.x + menuBox.width).toBeLessThanOrEqual(viewport.width); + const geometry = await option.evaluate((element) => { + const text = element.querySelector("span")!; + const check = element.querySelector("svg")!; + const range = document.createRange(); + range.selectNodeContents(text); + const textBox = range.getBoundingClientRect(); + const checkBox = check.getBoundingClientRect(); + const box = element.getBoundingClientRect(); + return { + lines: range.getClientRects().length, + textFits: text.scrollWidth <= text.clientWidth, + checkGap: checkBox.left - textBox.right, + hit: element.contains(document.elementFromPoint(box.x + box.width / 2, box.y + box.height / 2)), + }; + }); + expect(geometry.lines).toBe(1); + expect(geometry.textFits).toBe(true); + expect(geometry.checkGap).toBeGreaterThanOrEqual(10); + expect(geometry.hit).toBe(true); + if (label === "All folders") await page.screenshot({ path: `test-results/dropdown-folders-${viewport.width}.png`, fullPage: false }); + await trigger.press("Escape"); + await expect(menu).not.toBeVisible(); + await expect(trigger).toBeFocused(); + } + const folders = page.getByRole("combobox", { name: "Filter links by folder", exact: true }); + await folders.press("ArrowDown"); + await folders.press("ArrowDown"); + await folders.press("Enter"); + await expect(folders).toContainText("No folder"); + await folders.press("Home"); + await folders.press("Enter"); + await expect(folders).toContainText("All folders"); + } + if (originalViewport) await page.setViewportSize(originalViewport); +} diff --git a/applications/shortwave/tests/browser/folders.ts b/applications/shortwave/tests/browser/folders.ts new file mode 100644 index 00000000..fa6a6d85 --- /dev/null +++ b/applications/shortwave/tests/browser/folders.ts @@ -0,0 +1,187 @@ +import { expect, type Page } from "@playwright/test"; +import { chooseOption, verifyFolderDisclosure, verifyFolderTemplateIsolation } from "./controls"; + +/** Signed-in links workspace, no dialog open. Leaves filters clear and links intact. */ +export async function verifyFolders(page: Page) { + const folderName = "Browser launch folder"; + const renamed = "Browser release folder"; + const title = "Folder verification"; + await page.getByRole("button", { name: "Create a link", exact: true }).click(); + await page.getByLabel("Destination URL").fill("https://example.com/folder-verification"); + await page.getByLabel("Link title").fill(title); + await page.locator(".folder-trigger").click(); + const search = page.getByRole("textbox", { name: "Search or create a folder" }); + await expect(search).toBeFocused(); + await verifyFolderDisclosure(page); + await page.screenshot({ path: "test-results/create-folder-selector.png" }); + await search.fill(folderName); + await search.press("Shift+Enter"); + await expect(page.locator("dialog[open]")).toBeVisible(); + await expect(page.getByLabel("Link title")).toHaveValue(title); + await search.press("Escape"); + await expect(search).not.toBeVisible(); + await expect(page.locator(".folder-trigger")).toBeFocused(); + await expect(page.locator("dialog[open]")).toBeVisible(); + await page.locator(".folder-trigger").click(); + await page.getByRole("button", { name: `Create “${folderName}”`, exact: true }).click(); + await expect(page.locator(".folder-trigger")).toContainText(folderName); + await page.getByRole("button", { name: "Create link", exact: true }).click(); + await expect(page.locator("dialog[open]")).not.toBeVisible(); + await expect(page.getByRole("button", { name: title, exact: true })).toBeVisible(); + await page.reload(); + await chooseOption(page, page.getByRole("combobox", { name: "Filter links by folder" }), folderName); + await expect(page.locator(".link-row")).toHaveCount(1); + await page.getByRole("button", { name: `Edit ${title}`, exact: true }).click(); + await expect(page.locator(".folder-trigger")).toContainText(folderName); + await verifyFolderTemplateIsolation(page, folderName, "desktop"); + // Exercise the picker in a compact editor and use its keyboard selection. + await page.setViewportSize({ width: 390, height: 600 }); + await verifyFolderTemplateIsolation(page, folderName, "mobile"); + await page.locator(".folder-trigger").click(); + await search.fill("browser launch"); + await expect(page.locator(".folder-popup").getByRole("button", { name: folderName, exact: true })).toBeVisible(); + const popup = (await page.locator(".folder-popup").boundingBox())!; + expect(popup.x).toBeGreaterThanOrEqual(0); + expect(popup.x + popup.width).toBeLessThanOrEqual(391); + expect(popup.y).toBeGreaterThanOrEqual(0); + expect(popup.y + popup.height).toBeLessThanOrEqual(601); + await search.press("ArrowDown"); + await expect(page.locator(".folder-popup").getByRole("button", { name: "No folder", exact: true })).toBeFocused(); + await page.keyboard.press("Enter"); + await expect(page.locator(".folder-trigger")).toContainText("No folder"); + await page.getByRole("button", { name: "Save changes", exact: true }).click(); + await expect(page.locator("dialog[open]")).not.toBeVisible(); + await page.setViewportSize({ width: 1440, height: 1000 }); + await chooseOption(page, page.getByRole("combobox", { name: "Filter links by folder" }), "No folder"); + await page.getByRole("button", { name: `Edit ${title}`, exact: true }).click(); + await page.locator(".folder-trigger").click(); + await page.locator(".folder-popup").getByRole("button", { name: folderName, exact: true }).click(); + await page.getByRole("button", { name: "Save changes", exact: true }).click(); + await expect(page.locator("dialog[open]")).not.toBeVisible(); + await page.getByRole("navigation", { name: "Main navigation" }).getByRole("link", { name: "Folders", exact: true }).click(); + await expect(page.getByRole("heading", { name: "Folders", exact: true })).toBeVisible(); + await page.reload(); + const extraFolders = ["Page-created folder", "Campaign reports and saved links from the summer launch"]; + for (const name of extraFolders) { + await page.getByLabel("New folder", { exact: true }).fill(name); + await page.getByRole("button", { name: "Create folder", exact: true }).click(); + await expect(page.getByRole("article", { name, exact: true })).toBeVisible(); + } + await expect(page.locator(".folder-grid .folder-tile")).toHaveCount(3); + const folderLink = page.getByRole("link", { name: folderName, exact: true }); + await expect(folderLink).toHaveAttribute("href", /^\/links\?folderId=/); + await folderLink.click(); + await expect(page).toHaveURL(/\/links\?folderId=/); + const filteredUrl = page.url(); + expect(new URL(filteredUrl).searchParams.get("folderId")).toMatch(/^[0-9a-f-]{36}$/i); + const folderFilter = page.getByRole("combobox", { name: "Filter links by folder", exact: true }); + await expect(folderFilter).toContainText(folderName); + await expect(page.locator(".link-row")).toHaveCount(1); + await expect(page.getByRole("button", { name: title, exact: true })).toBeVisible(); + await page.reload(); + await expect(folderFilter).toContainText(folderName); + await expect(page.locator(".link-row")).toHaveCount(1); + await chooseOption(page, folderFilter, "All folders"); + await expect.poll(() => new URL(page.url()).searchParams.has("folderId")).toBe(false); + await page.goBack(); + await expect(folderFilter).toContainText(folderName); + await expect(page.locator(".link-row")).toHaveCount(1); + await page.goBack(); + await expect(page.getByRole("heading", { name: "Folders", exact: true })).toBeVisible(); + await page.goForward(); + await expect(folderFilter).toContainText(folderName); + await expect(page.locator(".link-row")).toHaveCount(1); + await page.getByRole("textbox", { name: "Search links", exact: true }).fill("No matching folder link"); + await page.getByRole("button", { name: "Clear filters", exact: true }).click(); + await expect(folderFilter).toContainText("All folders"); + await expect(page.getByRole("textbox", { name: "Search links", exact: true })).toHaveValue(""); + await expect.poll(() => new URL(page.url()).searchParams.has("folderId")).toBe(false); + await page.getByRole("navigation", { name: "Main navigation" }).getByRole("link", { name: "Folders", exact: true }).click(); + const folderActions = page.getByRole("button", { name: `Actions for ${folderName}`, exact: true }); + await folderActions.focus(); + await folderActions.press("ArrowDown"); + await expect(page.getByRole("menuitem", { name: "Rename", exact: true })).toBeFocused(); + await expect(page).toHaveURL(/\/folders$/); + await page.keyboard.press("ArrowDown"); + await expect(page.getByRole("menuitem", { name: "Delete", exact: true })).toBeFocused(); + await page.keyboard.press("Home"); + await expect(page.getByRole("menuitem", { name: "Rename", exact: true })).toBeFocused(); + await page.keyboard.press("Escape"); + await expect(page.getByRole("menu")).not.toBeVisible(); + await expect(folderActions).toBeFocused(); + await folderActions.click(); + await page.getByRole("heading", { name: "Folders", exact: true }).click(); + await expect(page.getByRole("menu")).not.toBeVisible(); + await page.screenshot({ path: "test-results/folders-desktop.png", fullPage: false }); + await page.setViewportSize({ width: 390, height: 600 }); + await page.getByRole("button", { name: "Open navigation", exact: true }).click(); + const help = page.getByRole("button", { name: "Keyboard shortcuts", exact: true }); + await expect(help).toBeVisible(); + expect(await help.evaluate((button) => button.parentElement?.nextElementSibling?.classList.contains("sidebar-credits"))).toBe(true); + await page.screenshot({ path: "test-results/sidebar-mobile.png", fullPage: false }); + await help.click(); + await expect(page.getByRole("heading", { name: "Keyboard shortcuts", exact: true })).toBeVisible(); + await page.keyboard.press("Escape"); + await expect(help).toBeFocused(); + await page.getByRole("button", { name: "Close navigation", exact: true }).click(); + await page.screenshot({ path: "test-results/folders-mobile.png", fullPage: false }); + await folderActions.click(); + const menuBox = (await page.getByRole("menu").boundingBox())!; + expect(menuBox.x).toBeGreaterThanOrEqual(0); + expect(menuBox.x + menuBox.width).toBeLessThanOrEqual(390); + expect(menuBox.y).toBeGreaterThanOrEqual(0); + expect(menuBox.y + menuBox.height).toBeLessThanOrEqual(600); + await page.screenshot({ path: "test-results/folder-actions-mobile.png", fullPage: false }); + await page.getByRole("menuitem", { name: "Rename", exact: true }).click(); + await expect(page.getByRole("dialog")).toBeVisible(); + await expect(page.getByLabel("Folder name", { exact: true })).toBeFocused(); + await page.getByLabel("Folder name", { exact: true }).fill("Canceled rename"); + await page.keyboard.press("Escape"); + await expect(page.getByRole("dialog")).not.toBeVisible(); + await expect(folderActions).toBeFocused(); + await expect(page.getByRole("article", { name: folderName, exact: true })).toBeVisible(); + await page.setViewportSize({ width: 320, height: 600 }); + await folderActions.click(); + const narrowMenu = (await page.getByRole("menu").boundingBox())!; + expect(narrowMenu.x).toBeGreaterThanOrEqual(0); + expect(narrowMenu.x + narrowMenu.width).toBeLessThanOrEqual(320); + expect(narrowMenu.y).toBeGreaterThanOrEqual(0); + expect(narrowMenu.y + narrowMenu.height).toBeLessThanOrEqual(600); + await page.keyboard.press("Escape"); + await page.setViewportSize({ width: 1440, height: 1000 }); + await folderActions.click(); + await page.getByRole("menuitem", { name: "Rename", exact: true }).click(); + await page.getByLabel("Folder name", { exact: true }).fill(renamed); + await page.getByRole("button", { name: "Save name", exact: true }).click(); + await expect(page.getByRole("article", { name: renamed, exact: true })).toBeVisible(); + await expect(page.getByRole("button", { name: `Actions for ${renamed}`, exact: true })).toBeFocused(); + await page.getByRole("link", { name: renamed, exact: true }).click(); + await expect(folderFilter).toContainText(renamed); + await expect(page.getByRole("button", { name: title, exact: true })).toBeVisible(); + await page.getByRole("navigation", { name: "Main navigation" }).getByRole("link", { name: "Folders", exact: true }).click(); + await expect(page.getByRole("heading", { name: "Folders", exact: true })).toBeVisible(); + for (const name of extraFolders) { + await page.getByRole("button", { name: `Actions for ${name}`, exact: true }).click(); + await page.getByRole("menuitem", { name: "Delete", exact: true }).click(); + await page.getByRole("button", { name: "Delete folder", exact: true }).click(); + await expect(page.getByRole("article", { name, exact: true })).not.toBeVisible(); + } + await page.getByRole("button", { name: `Actions for ${renamed}`, exact: true }).click(); + await page.getByRole("menuitem", { name: "Delete", exact: true }).click(); + await expect(page.getByText("Links will move to No folder.", { exact: true })).toBeVisible(); + await page.getByRole("button", { name: "Delete folder", exact: true }).click(); + await expect(page.getByRole("article", { name: renamed, exact: true })).not.toBeVisible(); + await expect(page.getByLabel("New folder", { exact: true })).toBeFocused(); + await page.goto(filteredUrl); + await expect(page.getByRole("heading", { name: "Folder unavailable", exact: true })).toBeVisible(); + await expect(folderFilter).toContainText("Unavailable folder"); + await expect(page.locator(".link-row")).toHaveCount(0); + await page.getByRole("button", { name: "Clear filters", exact: true }).click(); + await expect.poll(() => new URL(page.url()).searchParams.has("folderId")).toBe(false); + await page.reload(); + await chooseOption(page, page.getByRole("combobox", { name: "Filter links by folder" }), "No folder"); + await expect(page.getByRole("button", { name: title, exact: true })).toBeVisible(); + await page.getByRole("combobox", { name: "Filter links by folder" }).click(); + await expect(page.getByRole("option", { name: renamed, exact: true })).toHaveCount(0); + await page.getByRole("option", { name: "All folders", exact: true }).click(); +} diff --git a/applications/shortwave/tests/browser/layout.ts b/applications/shortwave/tests/browser/layout.ts new file mode 100644 index 00000000..62127206 --- /dev/null +++ b/applications/shortwave/tests/browser/layout.ts @@ -0,0 +1,102 @@ +import { expect, type Page, type Route } from "@playwright/test"; + +export async function editorFrame(page: Page) { + return page.locator("dialog.modal[open]").evaluate((dialog) => + [dialog, dialog.querySelector(".modal-heading")!, dialog.querySelector(".link-editor-actions")!] + .map((element) => { + const { x, y, width, height } = element.getBoundingClientRect(); + return { x, y, width, height }; + }), + ); +} + +export async function editorContent(page: Page) { + return page.locator(".link-editor-form").evaluate((form) => ({ + scrollTop: form.scrollTop, + scrollHeight: form.scrollHeight, + boxes: [...form.querySelectorAll(".link-editor-layout, .link-editor-preview, .folder-trigger, .link-editor-actions")].map((element) => element.getBoundingClientRect().toJSON()), + })); +} + +export async function verifyStablePreview(page: Page) { + page.setDefaultTimeout(15_000); + let release: (() => void) | undefined; + let mode: "ready" | "broken" | "unavailable" = "ready"; + const handler = async (route: Route) => { + if (!route.request().postData()?.includes("preview-layout.example")) return route.continue(); + const responseMode = mode; + await new Promise((resolve) => { release = resolve; }); + await route.fulfill({ contentType: "application/json", body: JSON.stringify({ result: { + status: responseMode === "unavailable" ? "unavailable" : "ready", + title: "A long preview title that spans several lines and must stay within its reserved space ".repeat(4), + description: "A detailed destination description that must not push the other fields or creator footer down. ".repeat(8), + siteName: "Preview fixture", + image: responseMode === "unavailable" ? null : `https://preview-layout.example/${responseMode}.svg`, + imageAlt: "Preview fixture image", + } }) }); + }; + await page.route("**/_serverFn/**", handler); + await page.route("https://preview-layout.example/*.svg", async (route) => { + if (route.request().url().endsWith("broken.svg")) return route.abort(); + await route.fulfill({ contentType: "image/svg+xml", body: '' }); + }); + try { + for (const viewport of [{ width: 1440, height: 1000 }, { width: 390, height: 600 }]) { + await page.setViewportSize(viewport); + await page.getByRole("button", { name: "Create a link", exact: true }).click(); + const frame = await editorFrame(page); + if (viewport.width > 760) { + const gap = await page.locator(".link-editor-actions").evaluate((footer) => { + const card = document.querySelector(".destination-preview-card")!.getBoundingClientRect(); + const fields = document.querySelector(".link-editor-fields")!.getBoundingClientRect(); + return footer.getBoundingClientRect().top - Math.max(card.bottom, fields.bottom); + }); + expect(gap).toBeLessThanOrEqual(25); + } + const slots = () => page.locator(".destination-preview").evaluate((preview) => { + const origin = preview.getBoundingClientRect(); + return [...preview.querySelectorAll(".destination-preview-media, .destination-preview-copy > *")].map((element) => { + const box = element.getBoundingClientRect(); + return { x: box.x - origin.x, y: box.y - origin.y, width: box.width, height: box.height }; + }); + }); + const empty = await slots(); + for (mode of ["ready", "broken", "unavailable"] as const) { + release = undefined; + await page.getByLabel("Destination URL").fill(`preview-layout.example/${mode}?long=${"value".repeat(80)}`); + await expect(page.locator(".destination-preview-card")).toHaveAttribute("aria-busy", "true"); + expect(await slots()).toEqual(empty); + expect(await editorFrame(page)).toEqual(frame); + await expect.poll(() => Boolean(release)).toBe(true); + release!(); + await expect(page.locator(".destination-preview-card")).toHaveAttribute("aria-busy", "false"); + if (mode === "ready") { + await expect(page.locator(".destination-preview-image")).toBeVisible(); + await expect.poll(() => page.locator(".destination-preview-image").evaluate((image: HTMLImageElement) => image.complete && image.naturalHeight > 0)).toBe(true); + } else if (mode === "broken") { + await expect(page.locator(".destination-preview-placeholder")).toBeVisible(); + } else { + await expect(page.getByRole("status")).toContainText("Preview unavailable"); + } + expect(await slots()).toEqual(empty); + expect(await editorFrame(page)).toEqual(frame); + } + await page.getByLabel("Destination URL").fill(""); + expect(await slots()).toEqual(empty); + expect(await editorFrame(page)).toEqual(frame); + await page.screenshot({ path: `test-results/stable-preview-${viewport.width}.png` }); + await page.getByRole("button", { name: "Cancel", exact: true }).click(); + } + } catch (error) { + if (!page.isClosed()) await page.screenshot({ path: "test-results/stable-preview-failure.png" }); + throw error; + } finally { + release?.(); + if (!page.isClosed()) { + await page.unroute("**/_serverFn/**", handler); + await page.unroute("https://preview-layout.example/*.svg"); + await page.setViewportSize({ width: 1440, height: 1000 }); + page.setDefaultTimeout(0); + } + } +} diff --git a/applications/shortwave/tests/browser/user-menu.ts b/applications/shortwave/tests/browser/user-menu.ts new file mode 100644 index 00000000..310d1341 --- /dev/null +++ b/applications/shortwave/tests/browser/user-menu.ts @@ -0,0 +1,95 @@ +import { expect, type Locator, type Page } from "@playwright/test"; + +async function actionContrast(action: Locator): Promise { + return action.evaluate((element) => { + // Canvas resolves browser color formats, including color-mix and alpha. + const canvas = document.createElement("canvas"); + canvas.width = canvas.height = 1; + const context = canvas.getContext("2d", { willReadFrequently: true })!; + const rgba = (color: string) => { + context.clearRect(0, 0, 1, 1); + context.fillStyle = color; + context.fillRect(0, 0, 1, 1); + return Array.from(context.getImageData(0, 0, 1, 1).data); + }; + const composite = (front: number[], back: number[]) => + front.slice(0, 3).map((channel, index) => + channel * (front[3] / 255) + back[index] * (1 - front[3] / 255), + ); + const ancestors: Element[] = []; + for (let ancestor: Element | null = element; ancestor; ancestor = ancestor.parentElement) + ancestors.unshift(ancestor); + let background = [255, 255, 255]; + for (const ancestor of ancestors) + background = composite(rgba(getComputedStyle(ancestor).backgroundColor), background); + const foreground = composite(rgba(getComputedStyle(element).color), background); + const luminance = (rgb: number[]) => { + const linear = rgb.map((channel) => { + const normalized = channel / 255; + return normalized <= 0.04045 + ? normalized / 12.92 + : ((normalized + 0.055) / 1.055) ** 2.4; + }); + return linear[0] * 0.2126 + linear[1] * 0.7152 + linear[2] * 0.0722; + }; + const light = luminance(foreground); + const dark = luminance(background); + return (Math.max(light, dark) + 0.05) / (Math.min(light, dark) + 0.05); + }); +} + +export async function verifyUserMenu(page: Page) { + const trigger = page.locator(".sidebar-account .cl-userButtonTrigger"); + const popup = page.locator(".cl-userButtonPopoverCard"); + await trigger.click(); + await expect(popup).toBeVisible(); + await page.mouse.move(0, 0); + + const actions = [ + { name: "Manage account", filename: "manage-account" }, + { name: "Sign out", filename: "sign-out" }, + ].map(({ name, filename }) => ({ + name, + filename, + button: popup.locator(".cl-userButtonPopoverActionButton").filter({ + hasText: new RegExp(`^\\s*${name}\\s*$`), + }), + })); + + for (const { name, button } of actions) { + await expect(button).toBeVisible(); + await expect.poll(() => actionContrast(button), { + message: `${name} normal text contrast`, + }).toBeGreaterThanOrEqual(4.5); + } + await popup.screenshot({ path: "test-results/user-menu-normal.png" }); + + for (const { name, filename, button } of actions) { + await button.hover(); + await expect.poll(() => actionContrast(button), { + message: `${name} hovered text contrast`, + }).toBeGreaterThanOrEqual(4.5); + await popup.screenshot({ path: `test-results/user-menu-${filename}-hover.png` }); + } + + await page.mouse.move(0, 0); + for (const { name, filename, button } of actions) { + // Traverse with real keyboard input, so :focus-visible is exercised. + let focused = false; + for (let step = 0; step < 12; step++) { + await page.keyboard.press("Tab"); + focused = await button.evaluate((element) => + element === document.activeElement && element.matches(":focus-visible"), + ); + if (focused) break; + } + expect(focused, `${name} can receive visible keyboard focus`).toBe(true); + await expect.poll(() => actionContrast(button), { + message: `${name} keyboard-focused text contrast`, + }).toBeGreaterThanOrEqual(4.5); + await popup.screenshot({ path: `test-results/user-menu-${filename}-focus.png` }); + } + + await page.keyboard.press("Escape"); + await expect(popup).not.toBeVisible(); +} diff --git a/applications/shortwave/tests/browser/utms.ts b/applications/shortwave/tests/browser/utms.ts new file mode 100644 index 00000000..a244d46c --- /dev/null +++ b/applications/shortwave/tests/browser/utms.ts @@ -0,0 +1,127 @@ +import { expect, type Locator, type Page } from "@playwright/test"; +import { editorContent, editorFrame } from "./layout"; + +async function visibleControl(page: Page, control: Locator) { + const box = (await control.boundingBox())!; + expect(box.x).toBeGreaterThanOrEqual(0); + expect(box.y).toBeGreaterThanOrEqual(0); + expect(box.x + box.width).toBeLessThanOrEqual(page.viewportSize()!.width); + expect(box.y + box.height).toBeLessThanOrEqual(page.viewportSize()!.height); + if (await control.isEnabled()) { + expect(await control.evaluate((element) => { + const bounds = element.getBoundingClientRect(); + return element.contains(document.elementFromPoint(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2)); + })).toBe(true); + } +} + +/** An open creator. Leaves newsletter parameters applied to its draft, UTMs closed. */ +export async function verifyUtmTransactions(page: Page, size: "desktop" | "mobile", createTemplate = false) { + page.setDefaultTimeout(15_000); + const popup = page.getByRole("dialog", { name: "UTM parameters", exact: true }); + const menu = page.getByRole("dialog", { name: "UTM templates", exact: true }); + const toggle = page.getByRole("button", { name: /^UTMs/ }); + const source = popup.getByLabel("Source utm_source"); + const templates = popup.getByRole("button", { name: "Templates", exact: true }); + const preview = popup.getByRole("textbox", { name: "Destination URL preview", exact: true }); + let frame = await editorFrame(page); + let content = await editorContent(page); + async function open() { + await toggle.scrollIntoViewIfNeeded(); + frame = await editorFrame(page); + content = await editorContent(page); + await toggle.click(); + await expect(popup).toBeVisible(); + expect(await popup.evaluate((element) => element.matches(":modal"))).toBe(true); + expect(await editorFrame(page)).toEqual(frame); + expect(await editorContent(page)).toEqual(content); + } + async function closed() { + await expect(popup).not.toBeVisible(); + await expect(toggle).toBeFocused(); + expect(await editorFrame(page)).toEqual(frame); + expect(await editorContent(page)).toEqual(content); + } + await open(); + const initial = await source.inputValue(); + await expect(preview).toHaveAttribute("readonly", ""); + // Native modality keeps the creator inert while the transaction is open. + await page.locator(".folder-trigger").evaluate((element: HTMLElement) => element.focus({ preventScroll: true })); + expect(await popup.evaluate((element) => element.contains(document.activeElement))).toBe(true); + await expect(popup.locator(".folder-trigger, .link-editor-preview, .link-editor-actions")).toHaveCount(0); + const footer = [templates, popup.getByRole("button", { name: "Cancel", exact: true }), popup.getByRole("button", { name: "Save", exact: true })]; + for (const control of footer) await visibleControl(page, control); + const boxes = await Promise.all(footer.map((control) => control.boundingBox())); + expect(boxes[0]!.x + boxes[0]!.width).toBeLessThan(boxes[1]!.x); + expect(boxes[1]!.x + boxes[1]!.width).toBeLessThan(boxes[2]!.x); + expect(boxes[0]!.y + boxes[0]!.height / 2).toBeCloseTo(boxes[2]!.y + boxes[2]!.height / 2, 0); + const beforeUrl = new URL(await preview.inputValue()); + await source.fill("clear-this-parameter"); + await source.fill(""); + const cleared = new URL(await preview.inputValue()); + expect(cleared.searchParams.has("utm_source")).toBe(false); + expect(cleared.hash).toBe(beforeUrl.hash); + expect(cleared.searchParams.get("keep")).toBe(beforeUrl.searchParams.get("keep")); + await source.fill("newsletter with spaces"); + expect(new URL(await preview.inputValue()).searchParams.get("utm_source")).toBe("newsletter with spaces"); + await source.press("Shift+Enter"); + await expect(popup).toBeVisible(); + await popup.getByRole("button", { name: "Cancel", exact: true }).click(); + await closed(); + for (const dismissal of ["close", "escape", "backdrop"] as const) { + await open(); + await expect(source).toHaveValue(initial); + await source.fill(`discard-${dismissal}`); + if (dismissal === "close") await popup.getByRole("button", { name: "Close UTMs", exact: true }).click(); + else if (dismissal === "escape") await source.press("Escape"); + else await page.mouse.click(2, 2); + await closed(); + } + await open(); + await expect(source).toHaveValue(initial); + if (createTemplate) { + await source.fill("newsletter"); + await templates.click(); + await menu.getByRole("textbox", { name: "Template name", exact: true }).fill("Verification newsletter"); + await menu.getByRole("button", { name: "Save new template", exact: true }).click(); + await expect(menu.getByRole("button", { name: "Verification newsletter", exact: true })).toBeVisible(); + await expect(menu.getByRole("textbox", { name: "Template name", exact: true })).toHaveValue(""); + await menu.getByRole("textbox", { name: "Template name", exact: true }).press("Escape"); + await expect(menu).not.toBeVisible(); + await expect(templates).toBeFocused(); + await expect(popup).toBeVisible(); + await templates.press("Escape"); + await closed(); + await open(); + // Saving a reusable template persists it, but cannot commit this UTM draft. + await expect(source).toHaveValue(initial); + } + await templates.click(); + await expect(menu).toBeVisible(); + await visibleControl(page, menu.getByRole("button", { name: "Verification newsletter", exact: true })); + await visibleControl(page, menu.getByRole("textbox", { name: "Template name", exact: true })); + await visibleControl(page, menu.getByRole("button", { name: "Save new template", exact: true })); + const menuBounds = (await menu.boundingBox())!; + expect(menuBounds.y).toBeGreaterThanOrEqual(0); + expect(menuBounds.y + menuBounds.height).toBeLessThanOrEqual(page.viewportSize()!.height); + await page.screenshot({ path: `test-results/utm-template-menu-${size}.png` }); + await menu.getByRole("button", { name: "Verification newsletter", exact: true }).click(); + await expect(source).toHaveValue("newsletter"); + if (await menu.isVisible()) await menu.getByRole("textbox", { name: "Template name", exact: true }).press("Escape"); + await popup.getByRole("button", { name: "Cancel", exact: true }).click(); + await closed(); + await open(); + await expect(source).toHaveValue(initial); + await templates.click(); + await menu.getByRole("button", { name: "Verification newsletter", exact: true }).click(); + if (await menu.isVisible()) await menu.getByRole("textbox", { name: "Template name", exact: true }).press("Escape"); + await page.screenshot({ path: `test-results/utm-popup-${size}.png` }); + await popup.getByRole("button", { name: "Save", exact: true }).click(); + await closed(); + await open(); + await expect(source).toHaveValue("newsletter"); + expect(new URL(await preview.inputValue()).searchParams.get("utm_source")).toBe("newsletter"); + await popup.getByRole("button", { name: "Cancel", exact: true }).click(); + await closed(); + page.setDefaultTimeout(0); +} diff --git a/applications/shortwave/tests/cdc-verification.test.ts b/applications/shortwave/tests/cdc-verification.test.ts new file mode 100644 index 00000000..e19ae7a3 --- /dev/null +++ b/applications/shortwave/tests/cdc-verification.test.ts @@ -0,0 +1,24 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { mkdtemp, mkdir, writeFile, readFile, readdir, rm } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { spawnSync } from 'node:child_process'; + +test('snapshot verification refuses a held fixture lock before creating a fixture or connecting', async () => { + const directory = await mkdtemp(join(tmpdir(), 'shortwave-cdc-lock-')); + try { + const deployment = join(directory, '.deployment'); + await mkdir(deployment); + await writeFile(join(deployment, 'cdc-snapshot.lock'), 'held-by-another-process\n'); + const result = spawnSync(process.execPath, [fileURLToPath(new URL('../scripts/verify-cdc.mjs', import.meta.url)), '--await-snapshot'], { + cwd: directory, encoding: 'utf8', timeout: 10_000, + env: { ...process.env, DATABASE_URL: 'postgresql://unused:unused@db.example.com/postgres', PG_CA_CERT_PATH: 'must-not-be-read.pem', CLICKHOUSE_URL: 'https://unused.example.com', CLICKHOUSE_USERNAME: 'unused', CLICKHOUSE_PASSWORD: 'unused' }, + }); + assert.equal(result.status, 1); + assert.match(result.stderr, /CDC verification failed/); + assert.deepEqual(await readdir(deployment), ['cdc-snapshot.lock']); + assert.equal(await readFile(join(deployment, 'cdc-snapshot.lock'), 'utf8'), 'held-by-another-process\n'); + } finally { await rm(directory, { recursive: true, force: true }); } +}); diff --git a/applications/shortwave/tests/custom-domains.integration.test.ts b/applications/shortwave/tests/custom-domains.integration.test.ts new file mode 100644 index 00000000..336d840d --- /dev/null +++ b/applications/shortwave/tests/custom-domains.integration.test.ts @@ -0,0 +1,238 @@ +import assert from "node:assert/strict"; +import { randomUUID } from "node:crypto"; +import { loadEnvFile } from "node:process"; +import { test } from "node:test"; +import { addDomain, listDomains, removeDomain, verifyDomain as verifyDomainService } from "../src/server/custom-domains"; +import { closeDatabases, getPostgres } from "../src/server/db"; +import { getAccountId, NotFoundError } from "../src/server/service"; + +function verifyDomain(user: string, id: string, resolver: { resolveTxt: (name: string) => Promise }) { + return verifyDomainService(user, id, { createResolver: () => ({ ...resolver, cancel() {} }) }); +} + +async function allowRecheck(id: string) { + await getPostgres().query("UPDATE custom_domains SET last_checked_at = now() - interval '1 minute' WHERE id = $1", [id]); +} + +// DNS answers are controlled here; the browser journey separately exercises a +// real missing public TXT record. All database fixtures belong to this run. +test("custom-domain claims isolate accounts and require fresh ownership proof", { + skip: process.env.RUN_INTEGRATION !== "1", + timeout: 60_000, +}, async (t) => { + try { + loadEnvFile(".env"); + } catch (error) { + if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error; + } + const runId = randomUUID(); + const owner = `domains_${runId}_a`; + const outsider = `domains_${runId}_b`; + const accounts: string[] = []; + const hostname = (label: string) => `${label}-${runId}.shortwave.dev`; + try { + accounts.push(await getAccountId(owner), await getAccountId(outsider)); + + await t.test("claims and tokens are private, and tenant checks precede DNS", async () => { + const domain = await addDomain(owner, hostname("private")); + assert.equal(domain.status, "pending"); + assert.equal(domain.verifiedAt, null); + assert.equal(domain.lastCheckedAt, null); + assert.equal(domain.verificationError, null); + assert.ok(domain.verificationName.endsWith(`.${domain.hostname}`)); + assert.ok(domain.verificationValue.length >= 43); + assert.deepEqual(await listDomains(owner), [domain]); + assert.deepEqual(await listDomains(outsider), []); + let lookups = 0; + await assert.rejects(verifyDomain(outsider, domain.id, { + resolveTxt: async () => { lookups++; return [[domain.verificationValue]]; }, + }), NotFoundError); + assert.equal(lookups, 0); + await assert.rejects(removeDomain(outsider, domain.id), NotFoundError); + assert.deepEqual(await addDomain(owner, domain.hostname.toUpperCase()), domain); + await closeDatabases(); + assert.deepEqual(await listDomains(owner), [domain]); + await removeDomain(owner, domain.id); + }); + + await t.test("another account's pending claim cannot reserve a hostname", async () => { + const first = await addDomain(owner, hostname("shared")); + const second = await addDomain(outsider, first.hostname); + assert.notEqual(first.id, second.id); + assert.notEqual(first.verificationValue, second.verificationValue); + assert.equal(first.verificationName, second.verificationName); + const verified = await verifyDomain(outsider, second.id, { + resolveTxt: async (name: string) => { + assert.equal(name, `${second.verificationName}.`); + // TXT character-string chunks form one record; unrelated records do + // not prevent an exact match elsewhere in the response. + const value = second.verificationValue; + return [["unrelated=value"], [value.slice(0, 17), value.slice(17)]]; + }, + }); + assert.equal(verified.status, "verified"); + assert.ok(verified.verifiedAt); + assert.ok(verified.lastCheckedAt); + assert.equal(verified.verificationError, null); + assert.equal((await listDomains(owner))[0]!.status, "pending"); + const conflict = await verifyDomain(owner, first.id, { + resolveTxt: async () => [[first.verificationValue]], + }); + assert.equal(conflict.status, "pending"); + assert.ok(conflict.verificationError); + assert.equal((await listDomains(outsider))[0]!.status, "verified"); + await removeDomain(owner, first.id); + await removeDomain(outsider, second.id); + }); + + await t.test("only a complete exact token verifies ownership", async () => { + for (const variant of ["wrong", "substring", "separate-records"]) { + const domain = await addDomain(owner, hostname(variant)); + const value = domain.verificationValue; + const records = variant === "wrong" ? [["wrong-value"]] + : variant === "substring" ? [[`prefix${value}suffix`]] + : [[value.slice(0, 17)], [value.slice(17)]]; + const checked = await verifyDomain(owner, domain.id, { resolveTxt: async () => records }); + assert.equal(checked.status, "pending", variant); + assert.equal(checked.verifiedAt, null, variant); + assert.ok(checked.lastCheckedAt, variant); + assert.ok(checked.verificationError, variant); + await removeDomain(owner, domain.id); + } + }); + + await t.test("missing and failed DNS checks persist actionable pending state", async () => { + for (const code of ["ENOTFOUND", "ENODATA", "ETIMEOUT", "ESERVFAIL"]) { + const domain = await addDomain(owner, hostname(code.toLowerCase())); + const checked = await verifyDomain(owner, domain.id, { + resolveTxt: async () => { throw Object.assign(new Error("private resolver detail"), { code }); }, + }); + assert.equal(checked.status, "pending", code); + assert.equal(checked.verifiedAt, null, code); + assert.ok(checked.lastCheckedAt, code); + assert.ok(checked.verificationError, code); + assert.ok(!checked.verificationError!.includes("private resolver detail")); + assert.deepEqual((await listDomains(owner)).find((item) => item.id === domain.id), checked); + await removeDomain(owner, domain.id); + } + }); + + await t.test("cooldown prevents new lookups and rechecks distinguish outages from missing proof", async () => { + const domain = await addDomain(owner, hostname("recheck")); + const verified = await verifyDomain(owner, domain.id, { resolveTxt: async () => [[domain.verificationValue]] }); + let lookups = 0; + await assert.rejects(verifyDomain(owner, domain.id, { + resolveTxt: async () => { lookups++; return []; }, + }), /10 seconds/); + assert.equal(lookups, 0); + await allowRecheck(domain.id); + const unavailable = await verifyDomain(owner, domain.id, { + resolveTxt: async () => { throw Object.assign(new Error("timeout"), { code: "ETIMEOUT" }); }, + }); + assert.equal(unavailable.status, "verified"); + assert.equal(unavailable.verifiedAt, verified.verifiedAt); + assert.ok(unavailable.verificationError); + await allowRecheck(domain.id); + const missing = await verifyDomain(owner, domain.id, { resolveTxt: async () => [] }); + assert.equal(missing.status, "pending"); + assert.equal(missing.verifiedAt, null); + assert.ok(missing.verificationError); + await removeDomain(owner, domain.id); + }); + + await t.test("simultaneous valid proofs produce only one verified owner", async () => { + const first = await addDomain(owner, hostname("concurrent")); + const second = await addDomain(outsider, first.hostname); + let arrivals = 0; + let release!: () => void; + const bothResolving = new Promise((resolve) => { release = resolve; }); + const contenders = [[owner, first], [outsider, second]] as const; + const results = await Promise.all(contenders.map(async ([user, claim]) => { + return verifyDomain(user, claim.id, { + resolveTxt: async () => { + if (++arrivals === 2) release(); + await bothResolving; + return [[claim.verificationValue]]; + }, + }); + })); + assert.equal(results.filter((item) => item.status === "verified").length, 1); + assert.equal(results.filter((item) => item.status === "pending" && item.verificationError).length, 1); + const saved = [...await listDomains(owner), ...await listDomains(outsider)]; + assert.equal(saved.filter((item) => item.hostname === first.hostname && item.status === "verified").length, 1); + await removeDomain(owner, first.id); + await removeDomain(outsider, second.id); + }); + + await t.test("an older DNS failure cannot overwrite a newer successful check", async () => { + const domain = await addDomain(owner, hostname("stale-check")); + let started!: () => void; + let finish!: (records: string[][]) => void; + const resolving = new Promise((resolve) => { started = resolve; }); + const answer = new Promise((resolve) => { finish = resolve; }); + const older = verifyDomain(owner, domain.id, { resolveTxt: async () => { started(); return answer; } }); + try { + await resolving; + await allowRecheck(domain.id); + const newer = await verifyDomain(owner, domain.id, { resolveTxt: async () => [[domain.verificationValue]] }); + assert.equal(newer.status, "verified"); + finish([]); + assert.deepEqual(await older, newer); + assert.deepEqual((await listDomains(owner)).find((item) => item.id === domain.id), newer); + } finally { + finish([]); + await older; + await removeDomain(owner, domain.id); + } + }); + + await t.test("removing and adding a hostname again requires a new token", async () => { + const original = await addDomain(owner, hostname("readded")); + await verifyDomain(owner, original.id, { resolveTxt: async () => [[original.verificationValue]] }); + await removeDomain(owner, original.id); + const replacement = await addDomain(owner, original.hostname); + assert.notEqual(replacement.id, original.id); + assert.notEqual(replacement.verificationValue, original.verificationValue); + assert.equal(replacement.status, "pending"); + assert.equal(replacement.verifiedAt, null); + const checked = await verifyDomain(owner, replacement.id, { resolveTxt: async () => [[original.verificationValue]] }); + assert.equal(checked.status, "pending"); + await removeDomain(owner, replacement.id); + }); + + await t.test("deletion during DNS cannot recreate a claim or verify its replacement", async () => { + const original = await addDomain(owner, hostname("deleted-during-check")); + let started!: () => void; + let finish!: (records: string[][]) => void; + const resolving = new Promise((resolve) => { started = resolve; }); + const answer = new Promise((resolve) => { finish = resolve; }); + const check = verifyDomain(owner, original.id, { + resolveTxt: async () => { started(); return answer; }, + }); + // Attach the rejection assertion before releasing the deferred lookup. + const rejected = assert.rejects(check, NotFoundError); + try { + await resolving; + await removeDomain(owner, original.id); + const replacement = await addDomain(owner, original.hostname); + finish([[original.verificationValue]]); + await rejected; + const saved = (await listDomains(owner)).find((item) => item.id === replacement.id)!; + assert.equal(saved.status, "pending"); + assert.equal(saved.lastCheckedAt, null); + assert.equal(saved.verificationValue, replacement.verificationValue); + await removeDomain(owner, replacement.id); + } finally { + finish([]); + await rejected; + } + }); + } finally { + try { + await getPostgres().query("DELETE FROM custom_domains WHERE account_id = ANY($1::uuid[])", [accounts]); + await getPostgres().query("DELETE FROM accounts WHERE id = ANY($1::uuid[])", [accounts]); + } finally { + await closeDatabases(); + } + } +}); diff --git a/applications/shortwave/tests/custom-domains.test.ts b/applications/shortwave/tests/custom-domains.test.ts new file mode 100644 index 00000000..678eea43 --- /dev/null +++ b/applications/shortwave/tests/custom-domains.test.ts @@ -0,0 +1,61 @@ +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { MAX_CUSTOM_DOMAIN_LENGTH } from "../src/lib/custom-domains"; +import { checkDomainTxt, normalizeCustomDomain, type TxtResolver } from "../src/server/custom-domains"; + +const name = "_shortwave-verification.links.shortwave.dev"; +const value = "shortwave-verification=0123456789"; +const resolver = (resolveTxt: TxtResolver["resolveTxt"]) => ({ createResolver: () => ({ resolveTxt, cancel() {} }) }); + +test("custom domains normalize case, IDNs and a trailing root dot", () => { + assert.equal(normalizeCustomDomain(" Links.Shortwave.Dev. "), "links.shortwave.dev"); + assert.equal(normalizeCustomDomain("bücher.de"), "xn--bcher-kva.de"); + assert.equal(normalizeCustomDomain("xn--bcher-kva.de"), "xn--bcher-kva.de"); + assert.equal(normalizeCustomDomain("a.b"), "a.b"); + const boundary = `${"a".repeat(63)}.${"b".repeat(63)}.${"c".repeat(63)}.${"d".repeat(33)}.dev`; + assert.equal(boundary.length, MAX_CUSTOM_DOMAIN_LENGTH); + assert.equal(normalizeCustomDomain(boundary), boundary); + assert.throws(() => normalizeCustomDomain(boundary.replace(".dev", "d.dev"))); +}); + +test("custom domains reject URL syntax, malformed labels, addresses and reserved names", () => { + assert.throws(() => normalizeCustomDomain("foo.alt")); + for (const hostname of ["", "https://shortwave.dev", "shortwave.dev/path", "shortwave.dev:443", "shortwave.dev?x", "shortwave.dev#x", "me@shortwave.dev", "*.shortwave.dev", "_test.shortwave.dev", "shortwave..dev", "-links.shortwave.dev", "links-.shortwave.dev", "shortwave.dev..", "shortwave. dev", "shortwave.dev\n/path", "shortwave\\dev", "shortwave%2edev", "127.0.0.1", "127.1", "0x7f.1", "2130706433", "[::1]", "::1", "localhost", "foo.localhost", "foo.local", "foo.internal", "foo.test", "foo.invalid", "foo.example", "foo.onion", "foo.arpa", "example.com", "a.example.net", "example.org", "foo.123", `${"a".repeat(64)}.dev`, `${"a".repeat(63)}.${"b".repeat(63)}.${"c".repeat(63)}.${"d".repeat(35)}.com`]) { + assert.throws(() => normalizeCustomDomain(hostname), Error, hostname); + } +}); + +test("DNS ownership joins chunks within a record and matches the exact value", async () => { + let queried = ""; + assert.deepEqual(await checkDomainTxt(name, value, resolver(async (hostname) => { + queried = hostname; + return [["unrelated"], ["shortwave-verification=", "0123456789"]]; + })), { outcome: "match", error: null }); + assert.equal(queried, `${name}.`); + for (const answers of [[["shortwave-verification="], ["0123456789"]], [[`${value} `]], [[`"${value}"`]], [[value.toUpperCase()]], [[`prefix${value}`]]]) { + assert.equal((await checkDomainTxt(name, value, resolver(async () => answers))).outcome, "mismatch"); + } +}); + +test("DNS absence is definitive while server and transport errors remain temporary", async () => { + assert.equal((await checkDomainTxt(name, value, resolver(async () => []))).outcome, "missing"); + for (const code of ["ENOTFOUND", "ENODATA", "ESERVFAIL", "ETIMEOUT", "ECONNREFUSED", "ECANCELLED", "EREFUSED"]) { + const result = await checkDomainTxt(name, value, resolver(async () => { throw Object.assign(new Error("internal details"), { code }); })); + assert.equal(result.outcome, ["ENOTFOUND", "ENODATA"].includes(code) ? "missing" : "unavailable"); + assert.doesNotMatch(result.error!, /internal details/); + } +}); + +test("DNS deadline cancels only its own resolver and returns a temporary error", async () => { + let canceled = 0; + const result = await checkDomainTxt(name, value, { + timeoutMs: 5, + createResolver: () => ({ resolveTxt: () => new Promise(() => {}), cancel: () => { canceled++; } }), + }); + assert.equal(result.outcome, "unavailable"); + assert.equal(canceled, 1); + let successCanceled = false; + await checkDomainTxt(name, value, { timeoutMs: 5, createResolver: () => ({ resolveTxt: async () => [[value]], cancel: () => { successCanceled = true; } }) }); + await new Promise((resolve) => setTimeout(resolve, 10)); + assert.equal(successCanceled, false); +}); diff --git a/applications/shortwave/tests/domain-links.integration.test.ts b/applications/shortwave/tests/domain-links.integration.test.ts new file mode 100644 index 00000000..cc866fd1 --- /dev/null +++ b/applications/shortwave/tests/domain-links.integration.test.ts @@ -0,0 +1,135 @@ +import assert from "node:assert/strict"; +import { randomUUID } from "node:crypto"; +import { loadEnvFile } from "node:process"; +import { test } from "node:test"; +import { addDomain, listDomains, removeDomain, verifyDomain } from "../src/server/custom-domains"; +import { closeDatabases, getPostgres } from "../src/server/db"; +import { createLink, getAccountId, getLink, listLinks, NotFoundError, resolveRedirect, updateLink } from "../src/server/service"; + +test("domain links preserve URL namespaces and verified tenant ownership", { + skip: process.env.RUN_INTEGRATION !== "1", + timeout: 60_000, +}, async (t) => { + try { loadEnvFile(".env"); } + catch (error) { if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error; } + const originalAppUrl = process.env.APP_URL; + const originalHosted = process.env.PUBLIC_CUSTOM_DOMAINS; + const run = randomUUID(); + const owner = `domain_links_${run}_a`, outsider = `domain_links_${run}_b`; + const accounts: string[] = []; + process.env.APP_URL = "https://dashboard.shortwave.dev"; + try { + accounts.push(await getAccountId(owner), await getAccountId(outsider)); + const first = await addDomain(owner, `a-${run}.shortwave.dev`); + const second = await addDomain(outsider, `b-${run}.shortwave.dev`); + const unhosted = await addDomain(owner, `c-${run}.shortwave.dev`); + process.env.PUBLIC_CUSTOM_DOMAINS = `${first.hostname}, ${second.hostname}`; + const input = { slug: `dl-${run}`, destination: "https://example.com/default" }; + + await t.test("hosting and ownership are separate prerequisites", async () => { + assert.equal((await listDomains(owner)).find((d) => d.id === first.id)!.routingReady, false); + await assert.rejects(createLink(owner, { ...input, domainId: first.id }), /not ready/); + for (const [user, domain] of [[owner, first], [outsider, second], [owner, unhosted]] as const) { + const verified = await verifyDomain(user, domain.id, { + createResolver: () => ({ resolveTxt: async () => [[domain.verificationValue]], cancel() {} }), + }); + assert.equal(verified.status, "verified"); + assert.equal(verified.routingReady, domain.id !== unhosted.id); + } + await assert.rejects(createLink(owner, { ...input, domainId: unhosted.id }), /not ready/); + await assert.rejects(createLink(outsider, { ...input, domainId: first.id }), NotFoundError); + }); + + const standard = await createLink(owner, input); + const custom = await createLink(owner, { ...input, domainId: first.id, destination: "https://example.com/custom" }); + const other = await createLink(outsider, { ...input, domainId: second.id, destination: "https://example.com/other" }); + + await t.test("same slug works across domains, while each namespace remains unique", async () => { + assert.equal(standard.domainId, null); + assert.equal(standard.domainHostname, null); + assert.equal(custom.domainId, first.id); + assert.equal(custom.domainHostname, first.hostname); + assert.deepEqual(await getLink(owner, custom.id), custom); + assert.equal((await listLinks(owner)).find((l) => l.id === custom.id)!.domainHostname, first.hostname); + await assert.rejects(createLink(outsider, input), /already in use/); + await assert.rejects(createLink(owner, { ...input, domainId: first.id }), /already in use/); + await assert.rejects(getLink(outsider, custom.id), NotFoundError); + const foreignAssignment = await createLink(outsider, { destination: "https://example.com/foreign-assignment" }); + await assert.rejects(getPostgres().query( + "UPDATE links SET domain_id = $1 WHERE id = $2", [first.id, foreignAssignment.id], + ), (error: unknown) => (error as { code?: string }).code === "23503"); + }); + + await t.test("trusted request hostname selects exactly one link and unknown hosts fail", async () => { + assert.deepEqual(await resolveRedirect(input.slug, {}, false), { status: 302, location: standard.resolvedUrl }); + assert.deepEqual(await resolveRedirect(input.slug, {}, false, "dashboard.shortwave.dev"), { status: 302, location: standard.resolvedUrl }); + assert.deepEqual(await resolveRedirect(input.slug, {}, false, first.hostname), { status: 302, location: custom.resolvedUrl }); + assert.deepEqual(await resolveRedirect(input.slug, {}, false, second.hostname), { status: 302, location: other.resolvedUrl }); + assert.deepEqual(await resolveRedirect(input.slug, {}, false, "unknown.shortwave.dev"), { status: 404 }); + const defaultOnly = await createLink(owner, { destination: "https://example.com/default-only" }); + assert.deepEqual(await resolveRedirect(defaultOnly.slug, {}, false, first.hostname), { status: 404 }); + }); + + await t.test("redirect events belong to the selected link and HEAD does not add events", async () => { + await resolveRedirect(input.slug, {}, true, first.hostname); + await resolveRedirect(input.slug, {}, false, second.hostname); + const events = await getPostgres().query("SELECT event FROM click_outbox WHERE account_id = ANY($1::uuid[])", [accounts]); + assert.equal(events.rows.length, 1); + assert.equal(events.rows[0].event.link_id, custom.id); + assert.equal(events.rows[0].event.account_id, accounts[0]); + }); + + await t.test("domain is immutable and failed reassignment rolls back other edits", async () => { + await assert.rejects(updateLink(owner, custom.id, { destination: "https://example.com/changed", domainId: null }), /cannot be changed/); + assert.deepEqual(await getLink(owner, custom.id), custom); + await assert.rejects(updateLink(owner, standard.id, { ...input, domainId: first.id }), /cannot be changed/); + const edited = await updateLink(owner, custom.id, { destination: "https://example.com/edited" }); + assert.equal(edited.domainId, first.id); + assert.equal(edited.domainHostname, first.hostname); + assert.equal(edited.slug, custom.slug); + }); + + await t.test("domains with live or disabled links cannot be removed", async () => { + await assert.rejects(removeDomain(outsider, first.id), NotFoundError); + await assert.rejects(removeDomain(owner, first.id), /has links/); + await updateLink(owner, custom.id, { destination: custom.destination, domainId: first.id, enabled: false }); + assert.deepEqual(await resolveRedirect(input.slug, {}, false, first.hostname), { status: 410 }); + await assert.rejects(removeDomain(owner, first.id), /has links/); + await updateLink(owner, custom.id, { destination: custom.destination, enabled: true }); + }); + + await t.test("hosting removal and missing ownership proof stop routing immediately", async () => { + process.env.PUBLIC_CUSTOM_DOMAINS = second.hostname; + assert.deepEqual(await resolveRedirect(input.slug, {}, false, first.hostname), { status: 404 }); + assert.equal((await listDomains(owner)).find((d) => d.id === first.id)!.routingReady, false); + process.env.PUBLIC_CUSTOM_DOMAINS = `${first.hostname},${second.hostname}`; + await getPostgres().query("UPDATE custom_domains SET last_checked_at = now() - interval '1 minute' WHERE id = $1", [first.id]); + const revoked = await verifyDomain(owner, first.id, { createResolver: () => ({ resolveTxt: async () => [], cancel() {} }) }); + assert.equal(revoked.status, "pending"); + assert.equal(revoked.routingReady, false); + assert.deepEqual(await resolveRedirect(input.slug, {}, false, first.hostname), { status: 404 }); + assert.deepEqual(await resolveRedirect(input.slug, {}, false), { status: 302, location: standard.resolvedUrl }); + await assert.rejects(removeDomain(owner, first.id), /has links/); + }); + await t.test("a newly verified owner cannot inherit a previous owner's links", async () => { + const replacement = await addDomain(outsider, first.hostname); + await verifyDomain(outsider, replacement.id, { + createResolver: () => ({ resolveTxt: async () => [[replacement.verificationValue]], cancel() {} }), + }); + assert.deepEqual(await resolveRedirect(input.slug, {}, false, first.hostname), { status: 404 }); + const replacementLink = await createLink(outsider, { ...input, domainId: replacement.id, destination: "https://example.com/new-owner" }); + assert.deepEqual(await resolveRedirect(input.slug, {}, false, first.hostname), { status: 302, location: replacementLink.resolvedUrl }); + assert.equal((await getLink(owner, custom.id)).domainId, first.id); + }); + } finally { + if (originalAppUrl === undefined) Reflect.deleteProperty(process.env, "APP_URL"); else process.env.APP_URL = originalAppUrl; + if (originalHosted === undefined) Reflect.deleteProperty(process.env, "PUBLIC_CUSTOM_DOMAINS"); else process.env.PUBLIC_CUSTOM_DOMAINS = originalHosted; + try { + await getPostgres().query("DELETE FROM click_outbox WHERE account_id = ANY($1::uuid[])", [accounts]); + await getPostgres().query("DELETE FROM links WHERE account_id = ANY($1::uuid[])", [accounts]); + await getPostgres().query("DELETE FROM account_tags WHERE account_id = ANY($1::uuid[])", [accounts]); + await getPostgres().query("DELETE FROM custom_domains WHERE account_id = ANY($1::uuid[])", [accounts]); + await getPostgres().query("DELETE FROM accounts WHERE id = ANY($1::uuid[])", [accounts]); + } finally { await closeDatabases(); } + } +}); diff --git a/applications/shortwave/tests/domain.test.ts b/applications/shortwave/tests/domain.test.ts new file mode 100644 index 00000000..116fa361 --- /dev/null +++ b/applications/shortwave/tests/domain.test.ts @@ -0,0 +1,193 @@ +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { + contrastRatio, + defaultQrStyle, + linkInputSchema, + mergeUtm, + qrStyleSchema, + requestDimensions, + validateDestination, + validateSlug, +} from "../src/lib/domain"; +import { CLICKHOUSE_QR_IMAGE, CLICKHOUSE_QR_LOGO, qrLogoImage } from "../src/lib/qr-logo"; + +test("destinations permit web URLs and reject executable schemes, credentials and controls", () => { + assert.equal( + validateDestination("https://example.com/path?q=1#anchor"), + "https://example.com/path?q=1#anchor", + ); + for (const invalid of [ + "javascript:alert(1)", + "data:text/html,x", + "file:///etc/passwd", + "https://user:secret@example.com", + "/relative", + "https://example.com/\npath", + ]) { + assert.throws(() => validateDestination(invalid), Error, invalid); + } +}); + +test("destinations default omitted protocols to HTTPS while preserving explicit web protocols", () => { + for (const [input, expected] of [ + ["example.com", "https://example.com/"], + ["example.com/path?q=1#anchor", "https://example.com/path?q=1#anchor"], + [" www.example.com/path ", "https://www.example.com/path"], + ["example.com:8443/path", "https://example.com:8443/path"], + ["//example.com/path", "https://example.com/path"], + ["//example.com:8443/path", "https://example.com:8443/path"], + ["localhost:4317/path", "https://localhost:4317/path"], + ["127.0.0.1:4317/path", "https://127.0.0.1:4317/path"], + ["[::1]:4317/path", "https://[::1]:4317/path"], + ["http://example.com/path", "http://example.com/path"], + ["HTTPS://EXAMPLE.COM/path", "https://example.com/path"], + ]) assert.equal(validateDestination(input!), expected, input); + assert.equal(linkInputSchema.parse({ destination: "example.com/path" }).destination, "https://example.com/path"); + assert.equal(mergeUtm("example.com/path?x=1#here", { source: "newsletter" }).resolvedUrl, + "https://example.com/path?x=1&utm_source=newsletter#here"); +}); + +test("omitted-protocol handling rejects ambiguous schemes, credentials and relative paths", () => { + for (const invalid of [ + "", " ", "/relative", "./relative", "../relative", "docs/setup", "?query=1", "#anchor", "///example.com", + "javascript:443", "javascript://example.com", "data:443", "file:443", "ftp://example.com", "mailto:user@example.com", + "https:example.com", "intranet:443", "example.com:invalid/path", "example.com:99999/path", + "user:secret@example.com", "user@example.com", "//user:secret@example.com", + "example.com/\npath", "example.com/\tpath", "example.com/\u0000path", "example.com\\path", + `example.com/${"x".repeat(4096)}`, + ]) assert.throws(() => validateDestination(invalid), Error, invalid); +}); + +test("UTMs replace explicitly supplied keys, preserve other params and fragments, and snapshot existing UTMs", () => { + const result = mergeUtm( + "https://example.com/?utm_source=old&utm_medium=email&x=a%26b#here", + { source: "new campaign", campaign: "launch" }, + ); + const url = new URL(result.resolvedUrl); + assert.equal(url.searchParams.get("utm_source"), "new campaign"); + assert.equal(url.searchParams.get("x"), "a&b"); + assert.equal(url.hash, "#here"); + assert.deepEqual(result.utm, { + source: "new campaign", + medium: "email", + campaign: "launch", + }); +}); + +test("empty UTM values remove preexisting values and applied template copies do not mutate", () => { + const template = { source: "email", campaign: "spring" }; + const result = mergeUtm("https://example.com/?utm_content=old", { + ...template, + content: "", + }); + template.campaign = "summer"; + assert.equal(result.utm.campaign, "spring"); + assert.equal( + new URL(result.resolvedUrl).searchParams.has("utm_content"), + false, + ); +}); + +test("inherited UTM values respect editable limits and may be replaced or removed", () => { + const destination = `https://example.com/?utm_campaign=${"x".repeat(201)}`; + assert.throws(() => mergeUtm(destination)); + assert.equal( + mergeUtm(destination, { campaign: "replacement" }).utm.campaign, + "replacement", + ); + assert.deepEqual(mergeUtm(destination, { campaign: "" }).utm, {}); +}); + +test("custom slug rules exclude path separators, short names and encoded routing escapes", () => { + assert.equal(validateSlug("launch-2026_X"), "launch-2026_X"); + for (const slug of [ + "ab", + "../admin", + "a/b", + "%2fadmin", + "has space", + "-first", + "a".repeat(49), + ]) + assert.throws(() => validateSlug(slug)); +}); + +test("link inputs discard duplicate tags and reject browser-supplied account scope", () => { + assert.deepEqual( + linkInputSchema.parse({ + destination: "https://example.com", + tags: ["launch", "launch", "web"], + }).tags, + ["launch", "web"], + ); + assert.throws(() => + linkInputSchema.parse({ + destination: "https://example.com", + accountId: "another-account", + }), + ); +}); + +test("QR styles enforce contrast and raster-only logo data", () => { + assert.equal(contrastRatio("#000000", "#ffffff"), 21); + const good = { + foreground: "#000000", + background: "#ffffff", + dots: "square", + logo: null, + }; + assert.doesNotThrow(() => qrStyleSchema.parse(good)); + assert.throws(() => qrStyleSchema.parse({ ...good, foreground: "#eeeeee" })); + assert.throws(() => + qrStyleSchema.parse({ + ...good, + logo: "data:image/svg+xml;base64,PHN2Zz4=", + }), + ); + assert.throws(() => + qrStyleSchema.parse({ ...good, logo: "https://example.com/logo.png" }), + ); +}); + +test("QR defaults and legacy missing logos use the trusted ClickHouse SVG while custom rasters survive", () => { + assert.equal(defaultQrStyle.logo, CLICKHOUSE_QR_LOGO); + assert.equal(qrStyleSchema.parse(defaultQrStyle).logo, CLICKHOUSE_QR_LOGO); + assert.equal(qrLogoImage(CLICKHOUSE_QR_LOGO), CLICKHOUSE_QR_IMAGE); + assert.match(CLICKHOUSE_QR_IMAGE, /^data:image\/svg\+xml,/); + assert.match(decodeURIComponent(CLICKHOUSE_QR_IMAGE.split(",")[1]!), / qrStyleSchema.parse({ ...defaultQrStyle, logo })); + } +}); + +test("built-in QR logo stays transparent and chooses the higher-contrast black or white bars", () => { + for (const background of ["#ffffff", "#000000", "#171717", "#777777", "#757575", "#faff69", "#ff0000", "#0000ff"]) { + const svg = decodeURIComponent(qrLogoImage(CLICKHOUSE_QR_LOGO, background)!.split(",")[1]!); + assert.doesNotMatch(svg, /= contrastRatio("#ffffff", background) ? "#000000" : "#ffffff"; + assert.match(svg, new RegExp(`fill="${expected}"`)); + assert.equal((svg.match(/ { + const dimensions = requestDimensions( + "https://example.com/private?token=secret", + "ExampleBot/1.0", + ); + assert.equal(dimensions.referrer_domain, "example.com"); + assert.equal(dimensions.is_bot, 1); + assert.equal(dimensions.country, "Unknown"); + assert.equal(requestDimensions("not a URL").referrer_domain, ""); +}); diff --git a/applications/shortwave/tests/hosted-smoke-config.test.ts b/applications/shortwave/tests/hosted-smoke-config.test.ts new file mode 100644 index 00000000..6f1382cb --- /dev/null +++ b/applications/shortwave/tests/hosted-smoke-config.test.ts @@ -0,0 +1,69 @@ +import assert from "node:assert/strict"; +import test from "node:test"; +import { httpsOrigin, smokeAccountId, smokeServices, receiptLinkIds } from "../scripts/hosted-smoke-config"; + +function withEnvironment(values: Record, check: () => void) { + const previous = Object.fromEntries(Object.keys(values).map((key) => [key, process.env[key]])); + try { + for (const [key, value] of Object.entries(values)) { + if (value === undefined) delete process.env[key]; + else process.env[key] = value; + } + check(); + } finally { + for (const [key, value] of Object.entries(previous)) { + if (value === undefined) delete process.env[key]; + else process.env[key] = value; + } + } +} + +test("hosted smoke requires an explicitly selected account", () => { + for (const account of [undefined, "", "all", "account-id"]) { + withEnvironment({ SMOKE_ACCOUNT_ID: account }, () => assert.throws(smokeAccountId)); + } + const account = "9533d080-9b85-43c1-92ad-660d2cf84e63"; + withEnvironment({ SMOKE_ACCOUNT_ID: account }, () => assert.equal(smokeAccountId(), account)); +}); + +test("hosted smoke only accepts HTTPS origins without URL credentials or paths", () => { + for (const origin of [undefined, "http://example.com", "https://user:secret@example.com", "https://example.com/path", "https://example.com:8443", "https://example.com/?token=secret", "https://example.com/#fragment"]) { + withEnvironment({ SMOKE_CUSTOM_ORIGIN: origin }, () => assert.throws(() => httpsOrigin("SMOKE_CUSTOM_ORIGIN"))); + } + withEnvironment({ SMOKE_CUSTOM_ORIGIN: "https://example.com/" }, () => { + assert.equal(httpsOrigin("SMOKE_CUSTOM_ORIGIN"), "https://example.com"); + }); +}); + +test("receipt service scope includes databases and excludes connection credentials", () => { + withEnvironment({ + DATABASE_URL: "postgresql://runtime:private-password@pg.example.com:5432/shortwave?sslmode=verify-full", + CLICKHOUSE_URL: "https://default:private-password@ch.example.com:8443/", + CLICKHOUSE_DATABASE: "events", + }, () => { + assert.deepEqual(smokeServices(), { + postgres: "pg.example.com:5432/shortwave", + clickhouse: "https://ch.example.com:8443", + database: "events", + }); + assert.equal(JSON.stringify(smokeServices()).includes("private-password"), false); + }); +}); + +test("cleanup requires receipt account and every service field to match", () => { + const account = "9533d080-9b85-43c1-92ad-660d2cf84e63"; + const link = "da4ab17f-428d-4f1e-bc2e-e1ea2d9609c4"; + const services = { postgres: "pg.example.com/app", clickhouse: "https://ch.example.com", database: "events" }; + const receipt = { kind: "shortwave-hosted-smoke", accountId: account, services, linkIds: [link] }; + assert.deepEqual(receiptLinkIds(receipt, account, services), [link]); + assert.deepEqual(receiptLinkIds({ ...receipt, linkIds: [] }, account, services), []); + for (const invalid of [ + null, + { ...receipt, accountId: link }, + { ...receipt, kind: "other" }, + { ...receipt, services: undefined }, + ...Object.keys(services).map((key) => ({ ...receipt, services: { ...services, [key]: "other" } })), + { ...receipt, linkIds: [link, link] }, + { ...receipt, linkIds: ["not-a-uuid"] }, + ]) assert.throws(() => receiptLinkIds(invalid, account, services)); +}); diff --git a/applications/shortwave/tests/integration.test.ts b/applications/shortwave/tests/integration.test.ts new file mode 100644 index 00000000..25edfd99 --- /dev/null +++ b/applications/shortwave/tests/integration.test.ts @@ -0,0 +1,436 @@ +import assert from "node:assert/strict"; +import { randomUUID } from "node:crypto"; +import { loadEnvFile } from "node:process"; +import { test } from "node:test"; +import { defaultQrStyle } from "../src/lib/domain"; +import type { ClickEvent } from "../src/lib/types"; +import { getAnalytics } from "../src/server/analytics"; +import { closeDatabases, getClickHouse, getPostgres } from "../src/server/db"; +import { flushOutbox } from "../src/server/outbox"; +import { + createLink, + createFolder, + listFolders, + updateFolder, + deleteFolder, + createTemplate, + deleteTemplate, + getAccountId, + getLink, + listLinks, + listTags, + listTemplates, + NotFoundError, + resolveRedirect, + saveQrStyle, + updateLink, + updateTemplate, +} from "../src/server/service"; + +// Uses configured databases and unique synthetic accounts. Never run alongside +// the global outbox worker. Only these accounts' Postgres records are removed; +// their ClickHouse events expire under the event table's normal TTL. +test( + "real Postgres and ClickHouse: ownership, redirects, durable retries and deduplication", + { + skip: process.env.RUN_INTEGRATION !== "1", + timeout: 120_000, + }, + async (t) => { + try { + loadEnvFile(".env"); + } catch (error) { + if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error; + } + const runId = randomUUID(); + const owner = `integration_${runId}_a`; + const outsider = `integration_${runId}_b`; + const accountIds: string[] = []; + const originalDatabase = process.env.CLICKHOUSE_DATABASE; + try { + const account = await getAccountId(owner); + accountIds.push(account); + const otherAccount = await getAccountId(outsider); + accountIds.push(otherAccount); + assert.equal(await getAccountId(owner), account); + const slug = `it-${runId}`; + const link = await createLink(owner, { + slug, + destination: "https://example.com/first?keep=1#anchor", + title: "Integration A", + tags: ["integration"], + utm: { campaign: "before" }, + }); + const otherLink = await createLink(outsider, { + slug: `ib-${runId}`, + destination: "https://example.org/other", + title: "Integration B", + }); + + await t.test( + "link, QR and template operations enforce account ownership", + async () => { + assert.deepEqual( + (await listLinks(owner)).map((row) => row.id), + [link.id], + ); + assert.deepEqual( + (await listLinks(outsider)).map((row) => row.id), + [otherLink.id], + ); + assert.deepEqual(await listLinks(outsider, { search: slug }), []); + assert.equal( + (await listLinks(owner, { tag: "integration" })).length, + 1, + ); + await assert.rejects(getLink(outsider, link.id), NotFoundError); + await assert.rejects( + updateLink(outsider, link.id, { + destination: "https://example.org/stolen", + }), + NotFoundError, + ); + await assert.rejects( + saveQrStyle(outsider, link.id, defaultQrStyle), + NotFoundError, + ); + const style = { ...defaultQrStyle, dots: "rounded" as const }; + assert.deepEqual(await saveQrStyle(owner, link.id, style), style); + assert.deepEqual((await getLink(owner, link.id)).qrStyle, style); + assert.equal( + (await getLink(outsider, otherLink.id)).qrStyle.dots, + "square", + ); + await assert.rejects( + createLink(outsider, { + slug, + destination: "https://example.org/duplicate", + }), + /already in use/, + ); + + const template = await createTemplate(owner, { + name: "Integration campaign", + values: { campaign: "copied" }, + }); + assert.deepEqual(await listTemplates(outsider), []); + await assert.rejects( + updateTemplate(outsider, template.id, { + name: "Stolen", + values: {}, + }), + NotFoundError, + ); + await assert.rejects( + deleteTemplate(outsider, template.id), + NotFoundError, + ); + const copied = await createLink(owner, { + destination: "https://example.com/template", + utm: template.values, + }); + await updateTemplate(owner, template.id, { + name: "Renamed", + values: { campaign: "changed" }, + }); + assert.equal( + (await getLink(owner, copied.id)).utm.campaign, + "copied", + ); + assert.equal((await listTemplates(owner))[0]?.name, "Renamed"); + await deleteTemplate(owner, template.id); + assert.deepEqual(await listTemplates(owner), []); + }, + ); + + await t.test( + "saved tags persist across link edits and connections, with account-scoped literal matching", + async () => { + const tagged = await createLink(owner, { + destination: "https://example.com/tags", + tags: ["Launch", "news_100%", "Launch"], + }); + assert.deepEqual(tagged.tags, ["Launch", "news_100%"]); + assert.deepEqual(await listTags(owner, "laun"), ["Launch"]); + assert.deepEqual(await listTags(owner, "%"), ["news_100%"]); + assert.deepEqual(await listTags(outsider, "Launch"), []); + await updateLink(owner, tagged.id, { + destination: tagged.destination, + tags: ["Edited"], + }); + await closeDatabases(); + assert.deepEqual(await listTags(owner, "Launch"), ["Launch"]); + assert.deepEqual(await listTags(owner, "edited"), ["Edited"]); + const reused = await createLink(owner, { + destination: "https://example.com/reused", + tags: ["Launch"], + }); + assert.deepEqual(reused.tags, ["Launch"]); + await assert.rejects(updateLink(outsider, tagged.id, { + destination: tagged.destination, + tags: ["unauthorized-tag"], + }), NotFoundError); + assert.deepEqual(await listTags(outsider, "unauthorized-tag"), []); + await assert.rejects(createLink(owner, { + slug: tagged.slug, + destination: tagged.destination, + tags: ["failed-save-tag"], + }), /already in use/); + assert.deepEqual(await listTags(owner, "failed-save-tag"), []); + await createLink(outsider, { + destination: "https://example.org/private-tags", + tags: ["outsider-only"], + }); + assert.deepEqual(await listTags(owner, "outsider-only"), []); + }, + ); + + await t.test("folders isolate accounts, assign atomically, and delete without deleting links", async () => { + const folder = await createFolder(owner, "Launch"); + const privateFolder = await createFolder(outsider, "Private"); + assert.deepEqual(await listFolders(owner), [folder]); + assert.deepEqual(await listFolders(outsider), [privateFolder]); + await assert.rejects(createFolder(owner, "launch"), /folder name is already/); + await assert.rejects(updateFolder(outsider, folder.id, "Stolen"), NotFoundError); + await assert.rejects(deleteFolder(outsider, folder.id), NotFoundError); + const filed = await createLink(owner, { + destination: "https://example.com/filed", tags: ["folder-test"], folderId: folder.id, + }); + assert.equal(filed.folderId, folder.id); + assert.deepEqual((await listLinks(owner, { folderId: folder.id })).map((item) => item.id), [filed.id]); + assert.deepEqual(await listLinks(outsider, { folderId: folder.id }), []); + assert.ok(!(await listLinks(owner, { folderId: null })).some((item) => item.id === filed.id)); + await assert.rejects(createLink(owner, { + destination: "https://example.com/invalid-folder", folderId: privateFolder.id, tags: ["invalid-folder-save"], + }), NotFoundError); + assert.deepEqual(await listTags(owner, "invalid-folder-save"), []); + assert.deepEqual(await listLinks(owner, { search: "invalid-folder" }), []); + await assert.rejects(updateLink(owner, filed.id, { + destination: "https://example.com/unauthorized-edit", folderId: privateFolder.id, + }), NotFoundError); + assert.equal((await getLink(owner, filed.id)).destination, filed.destination); + assert.equal((await getLink(owner, filed.id)).folderId, folder.id); + await assert.rejects(updateLink(outsider, filed.id, { + destination: filed.destination, folderId: privateFolder.id, + }), NotFoundError); + // Composite foreign keys also reject a cross-account membership directly. + await assert.rejects(getPostgres().query( + "UPDATE link_folders SET folder_id = $1 WHERE link_id = $2", [privateFolder.id, filed.id], + ), (error: unknown) => (error as { code?: string }).code === "23503"); + await updateLink(owner, filed.id, { destination: filed.destination, tags: filed.tags }); + assert.equal((await getLink(owner, filed.id)).folderId, folder.id); + const renamed = await updateFolder(owner, folder.id, "Release"); + assert.equal(renamed.name, "Release"); + assert.equal((await getLink(owner, filed.id)).folderId, folder.id); + const unfiled = await updateLink(owner, filed.id, { destination: filed.destination, tags: filed.tags, folderId: null }); + assert.equal(unfiled.folderId, null); + await updateLink(owner, filed.id, { destination: filed.destination, tags: filed.tags, folderId: folder.id }); + await deleteFolder(owner, folder.id); + assert.deepEqual(await listFolders(owner), []); + const retained = await getLink(owner, filed.id); + assert.equal(retained.folderId, null); + assert.deepEqual(retained.tags, ["folder-test"]); + assert.ok((await listLinks(owner, { folderId: null })).some((item) => item.id === filed.id)); + }); + + await t.test( + "redirects immediately observe edits and disabled state; HEAD does not count", + async () => { + assert.deepEqual( + await resolveRedirect(slug, { + referrer: "https://news.example.org/private?token=private", + userAgent: "Firefox/130.0", + }), + { status: 302, location: link.resolvedUrl }, + ); + const edited = await updateLink(owner, link.id, { + slug: "ignored-new-slug", + destination: "https://example.com/edited", + utm: { campaign: "after" }, + tags: ["integration"], + }); + assert.equal(edited.slug, slug); + assert.deepEqual(await resolveRedirect(slug), { + status: 302, + location: edited.resolvedUrl, + }); + assert.deepEqual(await resolveRedirect(slug, {}, false), { + status: 302, + location: edited.resolvedUrl, + }); + await updateLink(owner, link.id, { + destination: edited.destination, + enabled: false, + }); + assert.deepEqual(await resolveRedirect(slug), { status: 410 }); + assert.deepEqual(await resolveRedirect(`missing-${runId}`), { + status: 404, + }); + assert.deepEqual(await resolveRedirect("../invalid"), { + status: 404, + }); + const rows = await getPostgres().query( + "SELECT event FROM click_outbox WHERE account_id = $1 ORDER BY created_at", + [account], + ); + assert.equal(rows.rows.length, 2); + assert.equal(rows.rows[0].event.utm_campaign, "before"); + assert.equal(rows.rows[1].event.utm_campaign, "after"); + assert.equal(rows.rows[0].event.referrer_domain, "news.example.org"); + assert.equal(JSON.stringify(rows.rows).includes("private"), false); + await resolveRedirect(otherLink.slug); + }, + ); + + await t.test( + "failed delivery survives client restart and retries without losing events", + async () => { + const queued = await getPostgres().query( + "SELECT event FROM click_outbox WHERE account_id = $1", + [account], + ); + assert.equal(queued.rows.length, 2); + const snapshot = queued.rows.map((row) => row.event as ClickEvent); + const initial = await getAnalytics(owner); + assert.equal(initial.status, "delayed"); + assert.equal(initial.pendingEvents, 2); + await closeDatabases(); + process.env.CLICKHOUSE_DATABASE = `missing_integration_${runId.replaceAll("-", "")}`; + assert.deepEqual(await flushOutbox(500, account), { + delivered: 0, + failed: 2, + }); + const failed = await getPostgres().query( + "SELECT attempts, next_attempt_at > now() AS deferred FROM click_outbox WHERE account_id = $1", + [account], + ); + assert.equal(failed.rows.length, 2); + assert.ok( + failed.rows.every((row) => row.attempts === 1 && row.deferred), + ); + await closeDatabases(); + if (originalDatabase === undefined) + Reflect.deleteProperty(process.env, "CLICKHOUSE_DATABASE"); + else process.env.CLICKHOUSE_DATABASE = originalDatabase; + const persisted = await getPostgres().query( + "SELECT event FROM click_outbox WHERE account_id = $1 ORDER BY event_id", + [account], + ); + assert.deepEqual( + persisted.rows + .map((row) => row.event) + .sort((a, b) => a.event_id.localeCompare(b.event_id)), + snapshot.sort((a, b) => a.event_id.localeCompare(b.event_id)), + ); + // Make only this test account's backoff due; no arbitrary wall-clock sleep. + await getPostgres().query( + "UPDATE click_outbox SET next_attempt_at = now() - interval '1 second' WHERE account_id = $1", + [account], + ); + assert.deepEqual(await flushOutbox(500, account), { + delivered: 2, + failed: 0, + }); + assert.deepEqual(await flushOutbox(500, otherAccount), { + delivered: 1, + failed: 0, + }); + assert.deepEqual(await flushOutbox(500, account), { + delivered: 0, + failed: 0, + }); + // Simulate an insert acknowledged by ClickHouse but lost before the queue + // commit. A durable copy is delivered again with the same immutable ID. + const repeated = snapshot[0]!; + await getPostgres().query( + "INSERT INTO click_outbox (event_id, account_id, event) VALUES ($1,$2,$3)", + [repeated.event_id, account, JSON.stringify(repeated)], + ); + assert.deepEqual(await flushOutbox(500, account), { + delivered: 1, + failed: 0, + }); + const counts = await getClickHouse().query({ + query: + "SELECT count() AS physical, uniqExact(event_id) AS distinct_events FROM click_events WHERE account_id = {account:UUID}", + query_params: { account }, + format: "JSONEachRow", + }); + const [count] = await counts.json<{ + physical: string; + distinct_events: string; + }>(); + assert.equal(Number(count?.physical), 3); + assert.equal(Number(count?.distinct_events), 2); + }, + ); + + await t.test( + "analytics count immutable event IDs and isolate accounts and filters", + async () => { + const analytics = await getAnalytics(owner, { days: 7 }); + assert.equal(analytics.status, "ready"); + assert.equal(analytics.totalClicks, 2); + assert.equal(analytics.pendingEvents, 0); + assert.equal(analytics.daily.length, 7); + assert.equal( + analytics.daily.reduce((sum, row) => sum + row.clicks, 0), + 2, + ); + assert.deepEqual( + analytics.topLinks.map((row) => row.linkId), + [link.id], + ); + assert.equal( + analytics.campaigns.find((row) => row.name === "before")?.clicks, + 1, + ); + assert.equal( + analytics.campaigns.find((row) => row.name === "after")?.clicks, + 1, + ); + assert.equal( + (await getAnalytics(owner, { campaign: "before" })).totalClicks, + 1, + ); + assert.equal( + (await getAnalytics(owner, { linkId: link.id })).totalClicks, + 2, + ); + const other = await getAnalytics(outsider); + assert.equal(other.status, "ready"); + assert.equal(other.totalClicks, 1); + assert.deepEqual( + other.topLinks.map((row) => row.linkId), + [otherLink.id], + ); + await assert.rejects( + getAnalytics(outsider, { linkId: link.id }), + NotFoundError, + ); + }, + ); + } finally { + await closeDatabases(); + if (originalDatabase === undefined) + Reflect.deleteProperty(process.env, "CLICKHOUSE_DATABASE"); + else process.env.CLICKHOUSE_DATABASE = originalDatabase; + try { + for (const table of [ + "click_outbox", + "utm_templates", + "links", + "accounts", + ]) { + const column = table === "accounts" ? "id" : "account_id"; + await getPostgres().query( + `DELETE FROM ${table} WHERE ${column} = ANY($1::uuid[])`, + [accountIds], + ); + } + } finally { + await closeDatabases(); + } + } + }, +); diff --git a/applications/shortwave/tests/preview-workers.test.ts b/applications/shortwave/tests/preview-workers.test.ts new file mode 100644 index 00000000..430d777a --- /dev/null +++ b/applications/shortwave/tests/preview-workers.test.ts @@ -0,0 +1,105 @@ +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { readWorkersPublicResource } from "../src/server/preview-workers"; + +const resolve = async () => [{ address: "8.8.8.8", family: 4 }]; +const html = (body = "Hello") => new Response(body, { headers: { "content-type": "text/html; charset=utf-8" } }); + +test("Workers preview fetch is runtime-scoped and sends only explicit unauthenticated request fields", async () => { + await assert.rejects(readWorkersPublicResource("https://example.com", "html", Date.now() + 1000), /requires Workers runtime/); + const result = await readWorkersPublicResource("https://example.com/path#fragment", "html", Date.now() + 1000, { + resolve, + fetch: async (url, options) => { + assert.equal(url, "https://example.com/path"); + assert.equal(options.redirect, "manual"); + assert.equal(options.credentials, "omit"); + assert.equal(options.cache, "no-store"); + assert.equal(options.method, "GET"); + const headers = new Headers(options.headers); + assert.equal(headers.has("cookie"), false); + assert.equal(headers.has("authorization"), false); + assert.equal(headers.has("referer"), false); + assert.ok(options.signal); + return html(); + }, + }); + assert.equal(result.body.toString(), "Hello"); + assert.equal(result.type, "text/html"); +}); + +test("Workers DNS validation rejects private and mixed-family answers before fetch", async () => { + let fetched = false; + for (const addresses of [[], [{ address: "127.0.0.1", family: 4 }], [{ address: "8.8.8.8", family: 4 }, { address: "::1", family: 6 }]]) { + await assert.rejects(readWorkersPublicResource("https://example.com", "html", Date.now() + 1000, { + resolve: async () => addresses, + fetch: async () => { fetched = true; return html(); }, + }), /Private preview address/); + } + assert.equal(fetched, false); +}); + +test("Workers redirects are manual, cancel unused bodies, recheck DNS and reject private targets", async () => { + let canceled = 0; + let calls = 0; + let resolutions = 0; + const redirect = (location: string) => new Response(new ReadableStream({ cancel() { canceled++; } }), { status: 302, headers: { location } }); + await assert.rejects(readWorkersPublicResource("https://example.com", "html", Date.now() + 1000, { + resolve: async () => [{ address: ++resolutions === 1 ? "8.8.8.8" : "127.0.0.1", family: 4 }], + fetch: async () => { calls++; return redirect("/again"); }, + }), /Private preview address/); + assert.equal(calls, 1); + assert.equal(resolutions, 2); + assert.equal(canceled, 1); + for (const location of ["//169.254.169.254/secret", "file:///etc/passwd", "https://user:password@example.com/"]) { + await assert.rejects(readWorkersPublicResource("https://example.com", "html", Date.now() + 1000, { + resolve, fetch: async () => redirect(location), + })); + } + calls = 0; + await assert.rejects(readWorkersPublicResource("https://example.com", "html", Date.now() + 1000, { + resolve, fetch: async () => { calls++; return redirect("/again"); }, + }), /Too many preview redirects/); + assert.equal(calls, 4); +}); + +test("Workers response checks MIME/status and bounds actual decoded bytes despite misleading length", async () => { + for (const response of [new Response("error", { status: 500 }), new Response("", { headers: { "content-type": "image/svg+xml" } }), new Response("small", { headers: { "content-type": "text/html", "content-length": "1048577" } })]) { + await assert.rejects(readWorkersPublicResource("https://example.com", "html", Date.now() + 1000, { resolve, fetch: async () => response }), /Unsupported preview response/); + } + for (const kind of ["html", "image"] as const) { + let canceled = false; + const response = new Response(new ReadableStream({ + start(controller) { controller.enqueue(new Uint8Array((kind === "html" ? 1024 : 512) * 1024 + 1)); }, + cancel() { canceled = true; }, + }), { headers: { "content-type": kind === "html" ? "text/html" : "image/png", "content-length": "1", "content-encoding": "gzip" } }); + // The injected stream represents the decoded body exposed by Workers. + await assert.rejects(readWorkersPublicResource("https://example.com", kind, Date.now() + 1000, { resolve, fetch: async () => response }), /too large/); + assert.equal(canceled, true); + } +}); + +test("Workers total deadline aborts stalled headers, body and DNS without another fetch", async () => { + let signal: AbortSignal | null | undefined; + await assert.rejects(readWorkersPublicResource("https://example.com", "html", Date.now() + 30, { + resolve, fetch: async (_url, options) => { signal = options.signal; return new Promise(() => {}); }, + }), /timed out/); + assert.equal(signal?.aborted, true); + let canceled = false; + await assert.rejects(readWorkersPublicResource("https://example.com", "html", Date.now() + 30, { + resolve, fetch: async () => new Response(new ReadableStream({ cancel() { canceled = true; } }), { headers: { "content-type": "text/html" } }), + }), /timed out/); + assert.equal(canceled, true); + let fetched = false; + await assert.rejects(readWorkersPublicResource("https://example.com", "html", Date.now() + 30, { + resolve: () => new Promise(() => {}), fetch: async () => { fetched = true; return html(); }, + }), /timed out/); + assert.equal(fetched, false); +}); + +test("Workers transport preserves platform TLS failure without retrying an unsafe transport", async () => { + let calls = 0; + await assert.rejects(readWorkersPublicResource("https://example.com", "html", Date.now() + 1000, { + resolve, fetch: async () => { calls++; throw new Error("TLS certificate verification failed"); }, + }), /TLS certificate verification failed/); + assert.equal(calls, 1); +}); diff --git a/applications/shortwave/tests/preview.test.ts b/applications/shortwave/tests/preview.test.ts new file mode 100644 index 00000000..156a58d1 --- /dev/null +++ b/applications/shortwave/tests/preview.test.ts @@ -0,0 +1,120 @@ +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { EventEmitter } from "node:events"; +import { PassThrough } from "node:stream"; +import type { ClientRequest, IncomingMessage, RequestOptions, request } from "node:http"; +import { destinationPreview, imageData, isPublicAddress, parsePreviewMetadata, previewTarget, readPublicResource, resolvePreviewAddress } from "../src/server/preview"; + +test("preview fetching rejects local, mapped, reserved and non-web destinations", () => { + for (const address of ["127.0.0.1", "0.0.0.0", "10.1.2.3", "169.254.169.254", "172.16.0.1", "192.168.1.1", "100.64.0.1", "198.19.0.1", "192.0.2.1", "224.0.0.1", "::1", "::ffff:127.0.0.1", "64:ff9b::7f00:1", "fc00::1", "fe80::1", "2001:db8::1", "2002:7f00:1::", "3fff::1"]) assert.equal(isPublicAddress(address), false, address); + for (const address of ["8.8.8.8", "1.1.1.1", "2606:4700:4700::1111", "2001:4860:4860::8888"]) assert.equal(isPublicAddress(address), true, address); + for (const url of ["file:///etc/passwd", "https://user:secret@example.com", "http://2130706433", "http://0x7f000001", "https://[::ffff:127.0.0.1]", "https://example.com:444/", "https://example.com/\npath"]) assert.throws(() => previewTarget(url), Error, url); + assert.equal(previewTarget("https://example.com:443/path#fragment").href, "https://example.com/path"); +}); + +test("preview DNS validation rejects mixed public/private answers and pins checked address", async () => { + const url = previewTarget("https://example.com"); + await assert.rejects(resolvePreviewAddress(url, async () => [{ address: "8.8.8.8", family: 4 }, { address: "127.0.0.1", family: 4 }])); + await assert.rejects(resolvePreviewAddress(url, async () => [])); + assert.deepEqual(await resolvePreviewAddress(url, async () => [{ address: "1.1.1.1", family: 4 }]), { address: "1.1.1.1", family: 4 }); + await assert.rejects(destinationPreview("", "https://example.com"), /sign in/); + assert.equal((await destinationPreview("test-user", "http://127.0.0.1")).status, "unavailable"); +}); + +test("OG metadata keeps first values, decodes entities, resolves images and ignores script/comment decoys", () => { + const metadata = parsePreviewMetadata(`Fallback`, new URL("https://example.com/blog/page")); + assert.equal(metadata.title, "Launch & learn 🚀"); + assert.equal(metadata.description, 'A "preview" > a URL'); + assert.equal(metadata.imageUrl, "https://example.com/image.png?a=1&b=2"); + assert.equal(metadata.imageAlt, "The launch"); + assert.equal(parsePreviewMetadata('Fallback & title', new URL("https://example.com")).imageUrl, null); + assert.equal(parsePreviewMetadata('Fallback & title', new URL("https://example.com")).title, "Fallback & title"); +}); + +test("preview images allow bounded raster data with matching signatures and never SVG or external URLs", () => { + const png = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]); + assert.match(imageData(png, "image/png")!, /^data:image\/png;base64,/); + assert.equal(imageData(png, "image/jpeg"), null); + assert.equal(imageData(Buffer.from(''), "image/svg+xml"), null); + assert.equal(imageData(Buffer.from(''), "image/png"), null); + assert.equal(imageData(Buffer.alloc(512 * 1024 + 1), "image/png"), null); +}); + +function transport(reply: (url: URL, options: RequestOptions, response: IncomingMessage & PassThrough) => void) { + const calls: URL[] = []; + const mock = ((url: URL, options: RequestOptions, callback: (response: IncomingMessage) => void) => { + calls.push(url); + const emitter = new EventEmitter(); + const req = Object.assign(emitter, { + end() { + queueMicrotask(() => { + const response = Object.assign(new PassThrough(), { statusCode: 200, headers: { "content-type": "text/html" } }) as IncomingMessage & PassThrough; + response.on("close", () => emitter.emit("close")); + // Configure headers before the response callback; body arrives later. + reply(url, options, response); + callback(response); + }); + return req; + }, + destroy(error?: Error) { if (error) emitter.emit("error", error); emitter.emit("close"); return req; }, + }); + return req as unknown as ClientRequest; + }) as unknown as typeof request; + return { calls, request: mock, resolve: async () => [{ address: "1.1.1.1", family: 4 }] }; +} + +test("request boundary pins DNS and rechecks same-host redirects against rebinding", async () => { + let resolutions = 0; + let pinned = false; + const mock = transport((_url, options, response) => { + assert.equal(options.agent, false); + assert.equal(options.family, 4); + assert.equal((options.headers as Record)["accept-encoding"], "identity"); + options.lookup!("example.com", { family: 4 }, (error, address, family) => { + assert.equal(error, null); + assert.equal(address, "1.1.1.1"); + assert.equal(family, 4); + pinned = true; + }); + response.statusCode = 302; + response.headers.location = "/redirect"; + }); + await assert.rejects(readPublicResource("https://example.com", "html", Date.now() + 1000, { + ...mock, resolve: async () => [{ address: ++resolutions === 1 ? "1.1.1.1" : "127.0.0.1", family: 4 }], + }), /Private preview address/); + assert.equal(pinned, true); + assert.equal(mock.calls.length, 1); + assert.equal(resolutions, 2); +}); + +test("private redirects are rejected before opening another connection and public redirects are bounded", async () => { + const privateRedirect = transport((_url, _options, response) => { + response.statusCode = 302; + response.headers.location = "http://169.254.169.254/latest/meta-data"; + }); + await assert.rejects(readPublicResource("https://example.com", "html", Date.now() + 1000, privateRedirect), /Private preview URL/); + assert.equal(privateRedirect.calls.length, 1); + const loop = transport((_url, _options, response) => { + response.statusCode = 301; + response.headers.location = "/again"; + }); + await assert.rejects(readPublicResource("https://example.com", "html", Date.now() + 1000, loop), /Too many preview redirects/); + assert.equal(loop.calls.length, 4); +}); + +test("request boundary enforces response bytes, content types and total deadline", async () => { + const oversized = transport((_url, _options, response) => { queueMicrotask(() => response.end(Buffer.alloc(1024 * 1024 + 1))); }); + await assert.rejects(readPublicResource("https://example.com", "html", Date.now() + 1000, oversized), /too large/); + const svg = transport((_url, _options, response) => { response.headers["content-type"] = "image/svg+xml"; }); + await assert.rejects(readPublicResource("https://example.com/image", "image", Date.now() + 1000, svg), /Unsupported preview response/); + const oversizedImage = transport((_url, _options, response) => { + response.headers["content-type"] = "image/png"; + queueMicrotask(() => response.end(Buffer.alloc(512 * 1024 + 1))); + }); + await assert.rejects(readPublicResource("https://example.com/image", "image", Date.now() + 1000, oversizedImage), /too large/); + const stalled = transport(() => {}); + await assert.rejects(readPublicResource("https://example.com", "html", Date.now() + 30, stalled), /timed out/); + const stalledDns = transport(() => {}); + await assert.rejects(readPublicResource("https://example.com", "html", Date.now() + 30, { ...stalledDns, resolve: () => new Promise(() => {}) }), /timed out/); + assert.equal(stalledDns.calls.length, 0); +}); diff --git a/applications/shortwave/tests/workers-connectivity-check.test.ts b/applications/shortwave/tests/workers-connectivity-check.test.ts new file mode 100644 index 00000000..30c3e2df --- /dev/null +++ b/applications/shortwave/tests/workers-connectivity-check.test.ts @@ -0,0 +1,22 @@ +import assert from "node:assert/strict"; +import test from "node:test"; +import diagnostic from "../scripts/workers-connectivity-check"; + +test("diagnostic refuses absent, incorrect and unset bearer tokens before accessing databases", async () => { + for (const [token, authorization] of [["fixture-secret", ""], ["fixture-secret", "Bearer incorrect"], ["", "Bearer "]] as const) { + const env = { DIAGNOSTIC_TOKEN: token } as Env & { DIAGNOSTIC_TOKEN: string }; + const response = await diagnostic.fetch(new Request("https://example.com/", { headers: { authorization } }), env); + assert.equal(response.status, 401); + assert.equal(await response.text(), "Unauthorized"); + assert.equal(response.headers.get("Cache-Control"), "no-store"); + } +}); + +test("diagnostic refuses non-GET methods and arbitrary port overrides", async () => { + const env = { DIAGNOSTIC_TOKEN: "fixture-secret" } as Env & { DIAGNOSTIC_TOKEN: string }; + const headers = { authorization: "Bearer fixture-secret" }; + const method = await diagnostic.fetch(new Request("https://example.com/", { method: "POST", headers }), env); + assert.equal(method.status, 401); + const port = await diagnostic.fetch(new Request("https://example.com/?port=22", { headers }), env); + assert.equal(port.status, 400); +}); diff --git a/applications/shortwave/tests/workers-runtime.test.ts b/applications/shortwave/tests/workers-runtime.test.ts new file mode 100644 index 00000000..04babcdf --- /dev/null +++ b/applications/shortwave/tests/workers-runtime.test.ts @@ -0,0 +1,49 @@ +import assert from "node:assert/strict"; +import { test } from "node:test"; +import { + createWorkersRuntime, + getWorkersRuntime, + isWorkersRuntime, + runWorkersRuntime, + runtimeEnvironment, +} from "../src/server/runtime"; + +test("Workers invocations keep environment and resources isolated across awaits", async () => { + // Binding methods are intentionally absent: this checks context propagation + // without opening network connections or requiring deployment credentials. + const first = createWorkersRuntime({ APP_URL: "https://first.example" } as Env); + const second = createWorkersRuntime({ APP_URL: "https://second.example" } as Env); + let releaseFirst!: () => void; + const firstCanFinish = new Promise((resolve) => { releaseFirst = resolve; }); + + assert.equal(isWorkersRuntime(), false); + await Promise.all([ + runWorkersRuntime(first, async () => { + assert.equal(runtimeEnvironment("APP_URL"), "https://first.example"); + await firstCanFinish; + assert.equal(getWorkersRuntime(), first); + assert.equal(runtimeEnvironment("APP_URL"), "https://first.example"); + }), + runWorkersRuntime(second, async () => { + await Promise.resolve(); + assert.equal(getWorkersRuntime(), second); + assert.equal(runtimeEnvironment("APP_URL"), "https://second.example"); + releaseFirst(); + }), + ]); + assert.equal(isWorkersRuntime(), false); + assert.equal(runtimeEnvironment("APP_URL"), process.env.APP_URL); +}); + +test("Workers missing bindings do not fall back to a Node process credential", () => { + const key = "SHORTWAVE_RUNTIME_ISOLATION_TEST"; + process.env[key] = "node-only"; + try { + assert.equal(runtimeEnvironment(key), "node-only"); + runWorkersRuntime(createWorkersRuntime({} as Env), () => { + assert.equal(runtimeEnvironment(key), undefined); + }); + } finally { + delete process.env[key]; + } +}); diff --git a/applications/shortwave/tsconfig.json b/applications/shortwave/tsconfig.json new file mode 100644 index 00000000..1b34b30d --- /dev/null +++ b/applications/shortwave/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2022", + "lib": ["ES2022", "DOM", "DOM.Iterable"], + "module": "ESNext", + "moduleResolution": "Bundler", + "jsx": "react-jsx", + "strict": true, + "skipLibCheck": true, + "esModuleInterop": true, + "resolveJsonModule": true, + "noEmit": true, + "types": ["vite/client", "node"], + "allowImportingTsExtensions": true + }, + "include": ["src", "scripts", "tests", "vite.config.ts", "worker-configuration.d.ts"] +} diff --git a/applications/shortwave/vite.config.ts b/applications/shortwave/vite.config.ts new file mode 100644 index 00000000..6e488ff4 --- /dev/null +++ b/applications/shortwave/vite.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from "vite"; +import { tanstackStart } from "@tanstack/react-start/plugin/vite"; +import viteReact from "@vitejs/plugin-react"; +import { nitro } from "nitro/vite"; +import { cloudflare } from "@cloudflare/vite-plugin"; + +export default defineConfig(({ mode }) => ({ + plugins: mode === "workers" + ? [cloudflare({ viteEnvironment: { name: "ssr" } }), tanstackStart(), viteReact()] + : [tanstackStart(), nitro(), viteReact()], + // Click UI's ESM entry imports CSS; Vite must transform it during SSR in dev. + ssr: { noExternal: ["@clickhouse/click-ui"] }, +})); diff --git a/applications/shortwave/worker-configuration.d.ts b/applications/shortwave/worker-configuration.d.ts new file mode 100644 index 00000000..ce738d5e --- /dev/null +++ b/applications/shortwave/worker-configuration.d.ts @@ -0,0 +1,15402 @@ +/* eslint-disable */ +// Generated by Wrangler by running `wrangler types --strict-vars=false` (hash: 5e7db79e6f39abdbf8ece792ac5b441e) +// Runtime types generated with workerd@1.20260911.1 2026-09-06 global_fetch_strictly_public,nodejs_compat +interface __BaseEnv_Env { + HYPERDRIVE: Hyperdrive; + APP_URL: string; + PUBLIC_CUSTOM_DOMAINS: string; + CLERK_SECRET_KEY: string; + CLICKHOUSE_URL: string; + CLICKHOUSE_USERNAME: string; + CLICKHOUSE_PASSWORD: string; + CLICKHOUSE_DATABASE: string; + CLICKHOUSE_CDC_DATABASE: string; +} +declare namespace Cloudflare { + interface GlobalProps { + mainModule: typeof import("./src/worker"); + } + interface Env extends __BaseEnv_Env {} +} +interface Env extends __BaseEnv_Env {} +type StringifyValues> = { + [Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string; +}; +declare namespace NodeJS { + interface ProcessEnv extends StringifyValues> {} +} + +// Begin runtime types +/*! ***************************************************************************** +Copyright (c) Cloudflare. All rights reserved. +Copyright (c) Microsoft Corporation. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +/* eslint-disable */ +// noinspection JSUnusedGlobalSymbols +declare var onmessage: never; +/** + * The **`DOMException`** interface represents an abnormal event (called an exception) that occurs as a result of calling a method or accessing a property of a web API. This is how error conditions are described in web APIs. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException) + */ +declare class DOMException extends Error { + constructor(message?: string, name?: string); + /** + * The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) + */ + readonly message: string; + /** + * The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) + */ + readonly name: string; + /** + * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code) + */ + readonly code: number; + static readonly INDEX_SIZE_ERR: number; + static readonly DOMSTRING_SIZE_ERR: number; + static readonly HIERARCHY_REQUEST_ERR: number; + static readonly WRONG_DOCUMENT_ERR: number; + static readonly INVALID_CHARACTER_ERR: number; + static readonly NO_DATA_ALLOWED_ERR: number; + static readonly NO_MODIFICATION_ALLOWED_ERR: number; + static readonly NOT_FOUND_ERR: number; + static readonly NOT_SUPPORTED_ERR: number; + static readonly INUSE_ATTRIBUTE_ERR: number; + static readonly INVALID_STATE_ERR: number; + static readonly SYNTAX_ERR: number; + static readonly INVALID_MODIFICATION_ERR: number; + static readonly NAMESPACE_ERR: number; + static readonly INVALID_ACCESS_ERR: number; + static readonly VALIDATION_ERR: number; + static readonly TYPE_MISMATCH_ERR: number; + static readonly SECURITY_ERR: number; + static readonly NETWORK_ERR: number; + static readonly ABORT_ERR: number; + static readonly URL_MISMATCH_ERR: number; + static readonly QUOTA_EXCEEDED_ERR: number; + static readonly TIMEOUT_ERR: number; + static readonly INVALID_NODE_TYPE_ERR: number; + static readonly DATA_CLONE_ERR: number; + get stack(): any; + set stack(value: any); +} +type WorkerGlobalScopeEventMap = { + fetch: FetchEvent; + scheduled: ScheduledEvent; + queue: QueueEvent; + unhandledrejection: PromiseRejectionEvent; + rejectionhandled: PromiseRejectionEvent; +}; +declare abstract class WorkerGlobalScope extends EventTarget { + EventTarget: typeof EventTarget; +} +/* The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). * + * The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console) + */ +interface Console { + "assert"(condition?: boolean, ...data: any[]): void; + /** + * The **`console.clear()`** static method clears the console if possible. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static) + */ + clear(): void; + /** + * The **`console.count()`** static method logs the number of times that this particular call to count() has been called. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static) + */ + count(label?: string): void; + /** + * The **`console.countReset()`** static method resets counter used with console.count(). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static) + */ + countReset(label?: string): void; + /** + * The **`console.debug()`** static method outputs a message to the console at the "debug" log level. The message is only displayed to the user if the console is configured to display debug output. In most cases, the log level is configured within the console UI. This log level might correspond to the Debug or Verbose log level. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) + */ + debug(...data: any[]): void; + /** + * The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object. In browser consoles, the output is presented as a hierarchical listing with disclosure triangles that let you see the contents of child objects. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static) + */ + dir(item?: any, options?: any): void; + /** + * The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element. If it is not possible to display as an element the JavaScript Object view is shown instead. The output is presented as a hierarchical listing of expandable nodes that let you see the contents of child nodes. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static) + */ + dirxml(...data: any[]): void; + /** + * The **`console.error()`** static method outputs a message to the console at the "error" log level. The message is only displayed to the user if the console is configured to display error output. In most cases, the log level is configured within the console UI. The message may be formatted as an error, with red colors and call stack information. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static) + */ + error(...data: any[]): void; + /** + * The **`console.group()`** static method creates a new inline group in the Web console log, causing any subsequent console messages to be indented by an additional level, until console.groupEnd() is called. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static) + */ + group(...data: any[]): void; + /** + * The **`console.groupCollapsed()`** static method creates a new inline group in the console. Unlike console.group(), however, the new group is created collapsed. The user will need to use the disclosure button next to it to expand it, revealing the entries created in the group. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static) + */ + groupCollapsed(...data: any[]): void; + /** + * The **`console.groupEnd()`** static method exits the current inline group in the console. See Using groups in the console in the console documentation for details and examples. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static) + */ + groupEnd(): void; + /** + * The **`console.info()`** static method outputs a message to the console at the "info" log level. The message is only displayed to the user if the console is configured to display info output. In most cases, the log level is configured within the console UI. The message may receive special formatting, such as a small "i" icon next to it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) + */ + info(...data: any[]): void; + /** + * The **`console.log()`** static method outputs a message to the console. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static) + */ + log(...data: any[]): void; + /** + * The **`console.table()`** static method displays tabular data as a table. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static) + */ + table(tabularData?: any, properties?: string[]): void; + /** + * The **`console.time()`** static method starts a timer you can use to track how long an operation takes. You give each timer a unique name, and may have up to 10,000 timers running on a given page. When you call console.timeEnd() with the same name, the browser will output the time, in milliseconds, that elapsed since the timer was started. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static) + */ + time(label?: string): void; + /** + * The **`console.timeEnd()`** static method stops a timer that was previously started by calling console.time(). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static) + */ + timeEnd(label?: string): void; + /** + * The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console.time(). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static) + */ + timeLog(label?: string, ...data: any[]): void; + /* The **`console.timeStamp()`** static method adds a single marker to the browser's Performance tool (Firefox bug 1387528, Chrome). This lets you correlate a point in your code with the other events recorded in the timeline, such as layout and paint events. */ + timeStamp(label?: string): void; + /** + * The **`console.trace()`** static method outputs a stack trace to the console. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) + */ + trace(...data: any[]): void; + /** + * The **`console.warn()`** static method outputs a warning message to the console at the "warning" log level. The message is only displayed to the user if the console is configured to display warning output. In most cases, the log level is configured within the console UI. The message may receive special formatting, such as yellow colors and a warning icon. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static) + */ + warn(...data: any[]): void; +} +declare const console: Console; +type BufferSource = ArrayBufferView | ArrayBuffer; +type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array; +declare namespace WebAssembly { + class CompileError extends Error { + constructor(message?: string); + } + class RuntimeError extends Error { + constructor(message?: string); + } + type ValueType = "anyfunc" | "externref" | "f32" | "f64" | "i32" | "i64" | "v128"; + interface GlobalDescriptor { + value: ValueType; + mutable?: boolean; + } + class Global { + constructor(descriptor: GlobalDescriptor, value?: any); + value: any; + valueOf(): any; + } + type ImportValue = ExportValue | number; + type ModuleImports = Record; + type Imports = Record; + type ExportValue = Function | Global | Memory | Table; + type Exports = Record; + class Instance { + constructor(module: Module, imports?: Imports); + readonly exports: Exports; + } + interface MemoryDescriptor { + initial: number; + maximum?: number; + shared?: boolean; + } + class Memory { + constructor(descriptor: MemoryDescriptor); + readonly buffer: ArrayBuffer; + grow(delta: number): number; + } + type ImportExportKind = "function" | "global" | "memory" | "table"; + interface ModuleExportDescriptor { + kind: ImportExportKind; + name: string; + } + interface ModuleImportDescriptor { + kind: ImportExportKind; + module: string; + name: string; + } + abstract class Module { + static customSections(module: Module, sectionName: string): ArrayBuffer[]; + static exports(module: Module): ModuleExportDescriptor[]; + static imports(module: Module): ModuleImportDescriptor[]; + } + type TableKind = "anyfunc" | "externref"; + interface TableDescriptor { + element: TableKind; + initial: number; + maximum?: number; + } + class Table { + constructor(descriptor: TableDescriptor, value?: any); + readonly length: number; + get(index: number): any; + grow(delta: number, value?: any): number; + set(index: number, value?: any): void; + } + function instantiate(module: Module, imports?: Imports): Promise; + function validate(bytes: BufferSource): boolean; +} +/** + * The **`ServiceWorkerGlobalScope`** interface of the Service Worker API represents the global execution context of a service worker. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope) + */ +interface ServiceWorkerGlobalScope extends WorkerGlobalScope { + DOMException: typeof DOMException; + WorkerGlobalScope: typeof WorkerGlobalScope; + btoa(data: string): string; + atob(data: string): string; + setTimeout(callback: (...args: any[]) => void, msDelay?: number): number; + setTimeout(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number; + clearTimeout(timeoutId: number | null): void; + setInterval(callback: (...args: any[]) => void, msDelay?: number): number; + setInterval(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number; + clearInterval(timeoutId: number | null): void; + queueMicrotask(task: Function): void; + structuredClone(value: T, options?: StructuredSerializeOptions): T; + reportError(error: any): void; + fetch(input: RequestInfo | URL, init?: RequestInit): Promise; + self: ServiceWorkerGlobalScope; + crypto: Crypto; + caches: CacheStorage; + scheduler: Scheduler; + performance: Performance; + Cloudflare: Cloudflare; + readonly origin: string; + Event: typeof Event; + ExtendableEvent: typeof ExtendableEvent; + CustomEvent: typeof CustomEvent; + PromiseRejectionEvent: typeof PromiseRejectionEvent; + FetchEvent: typeof FetchEvent; + TailEvent: typeof TailEvent; + TraceEvent: typeof TailEvent; + ScheduledEvent: typeof ScheduledEvent; + MessageEvent: typeof MessageEvent; + CloseEvent: typeof CloseEvent; + ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader; + ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader; + ReadableStream: typeof ReadableStream; + WritableStream: typeof WritableStream; + WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter; + TransformStream: typeof TransformStream; + ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy; + CountQueuingStrategy: typeof CountQueuingStrategy; + ErrorEvent: typeof ErrorEvent; + MessageChannel: typeof MessageChannel; + MessagePort: typeof MessagePort; + EventSource: typeof EventSource; + ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest; + ReadableStreamDefaultController: typeof ReadableStreamDefaultController; + ReadableByteStreamController: typeof ReadableByteStreamController; + WritableStreamDefaultController: typeof WritableStreamDefaultController; + TransformStreamDefaultController: typeof TransformStreamDefaultController; + CompressionStream: typeof CompressionStream; + DecompressionStream: typeof DecompressionStream; + TextEncoderStream: typeof TextEncoderStream; + TextDecoderStream: typeof TextDecoderStream; + Headers: typeof Headers; + Body: typeof Body; + Request: typeof Request; + Response: typeof Response; + WebSocket: typeof WebSocket; + WebSocketPair: typeof WebSocketPair; + WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair; + AbortController: typeof AbortController; + AbortSignal: typeof AbortSignal; + TextDecoder: typeof TextDecoder; + TextEncoder: typeof TextEncoder; + navigator: Navigator; + Navigator: typeof Navigator; + URL: typeof URL; + URLSearchParams: typeof URLSearchParams; + URLPattern: typeof URLPattern; + Blob: typeof Blob; + File: typeof File; + FormData: typeof FormData; + Crypto: typeof Crypto; + SubtleCrypto: typeof SubtleCrypto; + CryptoKey: typeof CryptoKey; + CacheStorage: typeof CacheStorage; + Cache: typeof Cache; + FixedLengthStream: typeof FixedLengthStream; + IdentityTransformStream: typeof IdentityTransformStream; + HTMLRewriter: typeof HTMLRewriter; +} +declare function addEventListener(type: Type, handler: EventListenerOrEventListenerObject, options?: EventTargetAddEventListenerOptions | boolean): void; +declare function removeEventListener(type: Type, handler: EventListenerOrEventListenerObject, options?: EventTargetEventListenerOptions | boolean): void; +/** + * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent(). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent) + */ +declare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean; +/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */ +declare function btoa(data: string): string; +/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */ +declare function atob(data: string): string; +/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */ +declare function setTimeout(callback: (...args: any[]) => void, msDelay?: number): number; +/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */ +declare function setTimeout(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number; +/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */ +declare function clearTimeout(timeoutId: number | null): void; +/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */ +declare function setInterval(callback: (...args: any[]) => void, msDelay?: number): number; +/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */ +declare function setInterval(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number; +/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearInterval) */ +declare function clearInterval(timeoutId: number | null): void; +/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */ +declare function queueMicrotask(task: Function): void; +/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */ +declare function structuredClone(value: T, options?: StructuredSerializeOptions): T; +/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */ +declare function reportError(error: any): void; +/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */ +declare function fetch(input: RequestInfo | URL, init?: RequestInit): Promise; +declare const self: ServiceWorkerGlobalScope; +/** +* The Web Crypto API provides a set of low-level functions for common cryptographic tasks. +* The Workers runtime implements the full surface of this API, but with some differences in +* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms) +* compared to those implemented in most browsers. +* +* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/) +*/ +declare const crypto: Crypto; +/** +* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache. +* +* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/) +*/ +declare const caches: CacheStorage; +/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scheduler) */ +declare const scheduler: Scheduler; +/** +* The Workers runtime supports a subset of the Performance API, used to measure timing and performance, +* as well as timing of subrequests and other operations. +* +* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/) +*/ +declare const performance: Performance; +declare const Cloudflare: Cloudflare; +declare const origin: string; +declare const navigator: Navigator; +interface TestController { +} +interface ExecutionContext { + waitUntil(promise: Promise): void; + passThroughOnException(): void; + readonly exports: Cloudflare.Exports; + readonly props: Props; + cache?: CacheContext; + readonly access?: CloudflareAccessContext; + tracing: Tracing; + abort(reason?: any): void; +} +type ExportedHandlerFetchHandler = (request: Request>, env: Env, ctx: ExecutionContext) => Response | Promise; +type ExportedHandlerConnectHandler = (socket: Socket, env: Env, ctx: ExecutionContext) => void | Promise; +type ExportedHandlerTailHandler = (events: TraceItem[], env: Env, ctx: ExecutionContext) => void | Promise; +type ExportedHandlerTraceHandler = (traces: TraceItem[], env: Env, ctx: ExecutionContext) => void | Promise; +type ExportedHandlerTailStreamHandler = (event: TailStream.TailEvent, env: Env, ctx: ExecutionContext) => TailStream.TailEventHandlerType | Promise; +type ExportedHandlerScheduledHandler = (controller: ScheduledController, env: Env, ctx: ExecutionContext) => void | Promise; +type ExportedHandlerQueueHandler = (batch: MessageBatch, env: Env, ctx: ExecutionContext) => void | Promise; +type ExportedHandlerTestHandler = (controller: TestController, env: Env, ctx: ExecutionContext) => void | Promise; +interface ExportedHandler { + fetch?: ExportedHandlerFetchHandler; + connect?: ExportedHandlerConnectHandler; + tail?: ExportedHandlerTailHandler; + trace?: ExportedHandlerTraceHandler; + tailStream?: ExportedHandlerTailStreamHandler; + scheduled?: ExportedHandlerScheduledHandler; + test?: ExportedHandlerTestHandler; + email?: EmailExportedHandler; + queue?: ExportedHandlerQueueHandler; +} +interface StructuredSerializeOptions { + transfer?: any[]; +} +declare abstract class Navigator { + sendBeacon(url: string, body?: BodyInit): boolean; + readonly userAgent: string; + readonly hardwareConcurrency: number; + readonly platform: string; + readonly language: string; + readonly languages: string[]; +} +interface AlarmInvocationInfo { + readonly isRetry: boolean; + readonly retryCount: number; + readonly scheduledTime: number; +} +interface Cloudflare { + readonly compatibilityFlags: Record; +} +interface CachePurgeError { + code: number; + message: string; +} +interface CachePurgeResult { + success: boolean; + errors: CachePurgeError[]; +} +interface CachePurgeOptions { + tags?: string[]; + pathPrefixes?: string[]; + purgeEverything?: boolean; +} +interface CacheContext { + purge(options: CachePurgeOptions): Promise; +} +interface CloudflareAccessContext { + readonly aud: string; + getIdentity(): Promise; +} +declare abstract class ColoLocalActorNamespace { + get(actorId: string): Fetcher; +} +interface DurableObject { + fetch(request: Request): Response | Promise; + connect?(socket: Socket): void | Promise; + alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise; + webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise; + webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise; + webSocketError?(ws: WebSocket, error: unknown): void | Promise; +} +type DurableObjectStub = Fetcher & { + readonly id: DurableObjectId; + readonly name?: string; +}; +interface DurableObjectId { + toString(): string; + equals(other: DurableObjectId): boolean; + readonly name?: string; + readonly jurisdiction?: string; +} +declare abstract class DurableObjectNamespace { + newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId; + idFromName(name: string): DurableObjectId; + idFromString(id: string): DurableObjectId; + get(id: DurableObjectId, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub; + getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub; + jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace; +} +type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high" | "us"; +interface DurableObjectNamespaceNewUniqueIdOptions { + jurisdiction?: DurableObjectJurisdiction; +} +type DurableObjectLocationHint = "wnam" | "enam" | "sam" | "weur" | "eeur" | "apac" | "apac-ne" | "apac-se" | "oc" | "afr" | "me"; +type DurableObjectRoutingMode = "primary-only"; +interface DurableObjectNamespaceGetDurableObjectOptions { + locationHint?: DurableObjectLocationHint; + routingMode?: DurableObjectRoutingMode; +} +interface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undefined = undefined> { +} +interface DurableObjectState { + waitUntil(promise: Promise): void; + readonly exports: Cloudflare.Exports; + readonly props: Props; + readonly id: DurableObjectId; + readonly storage: DurableObjectStorage; + container?: Container; + facets: DurableObjectFacets; + blockConcurrencyWhile(callback: () => Promise): Promise; + acceptWebSocket(ws: WebSocket, tags?: string[]): void; + getWebSockets(tag?: string): WebSocket[]; + setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void; + getWebSocketAutoResponse(): WebSocketRequestResponsePair | null; + getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null; + setHibernatableWebSocketEventTimeout(timeoutMs?: number): void; + getHibernatableWebSocketEventTimeout(): number | null; + getTags(ws: WebSocket): string[]; + abort(reason?: string, options?: DurableObjectAbortOptions): void; +} +interface DurableObjectTransaction { + get(key: string, options?: DurableObjectGetOptions): Promise; + get(keys: string[], options?: DurableObjectGetOptions): Promise>; + list(options?: DurableObjectListOptions): Promise>; + put(key: string, value: T, options?: DurableObjectPutOptions): Promise; + put(entries: Record, options?: DurableObjectPutOptions): Promise; + delete(key: string, options?: DurableObjectPutOptions): Promise; + delete(keys: string[], options?: DurableObjectPutOptions): Promise; + rollback(): void; + getAlarm(options?: DurableObjectGetAlarmOptions): Promise; + setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise; + deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; +} +interface DurableObjectStorage { + get(key: string, options?: DurableObjectGetOptions): Promise; + get(keys: string[], options?: DurableObjectGetOptions): Promise>; + list(options?: DurableObjectListOptions): Promise>; + put(key: string, value: T, options?: DurableObjectPutOptions): Promise; + put(entries: Record, options?: DurableObjectPutOptions): Promise; + delete(key: string, options?: DurableObjectPutOptions): Promise; + delete(keys: string[], options?: DurableObjectPutOptions): Promise; + deleteAll(options?: DurableObjectPutOptions): Promise; + transaction(closure: (txn: DurableObjectTransaction) => Promise): Promise; + getAlarm(options?: DurableObjectGetAlarmOptions): Promise; + setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise; + deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; + sync(): Promise; + sql: SqlStorage; + kv: SyncKvStorage; + transactionSync(closure: () => T): T; + getCurrentBookmark(): Promise; + getBookmarkForTime(timestamp: number | Date): Promise; + onNextSessionRestoreBookmark(bookmark: string): Promise; +} +interface DurableObjectAbortOptions { + retryAlarm?: boolean; +} +interface DurableObjectListOptions { + start?: string; + startAfter?: string; + end?: string; + prefix?: string; + reverse?: boolean; + limit?: number; + allowConcurrency?: boolean; + noCache?: boolean; +} +interface DurableObjectGetOptions { + allowConcurrency?: boolean; + noCache?: boolean; +} +interface DurableObjectGetAlarmOptions { + allowConcurrency?: boolean; +} +interface DurableObjectPutOptions { + allowConcurrency?: boolean; + allowUnconfirmed?: boolean; + noCache?: boolean; +} +interface DurableObjectSetAlarmOptions { + allowConcurrency?: boolean; + allowUnconfirmed?: boolean; +} +declare class WebSocketRequestResponsePair { + constructor(request: string, response: string); + get request(): string; + get response(): string; +} +interface DurableObjectFacets { + get(name: string, getStartupOptions: () => FacetStartupOptions | Promise>): Fetcher; + abort(name: string, reason: any): void; + delete(name: string): void; + clone(src: string, dst: string): void; +} +interface FacetStartupOptions { + id?: DurableObjectId | string; + class: DurableObjectClass; +} +interface AnalyticsEngineDataset { + writeDataPoint(event?: AnalyticsEngineDataPoint): void; +} +interface AnalyticsEngineDataPoint { + indexes?: ((ArrayBuffer | string) | null)[]; + doubles?: number[]; + blobs?: ((ArrayBuffer | string) | null)[]; +} +/** + * The **`Event`** interface represents an event which takes place on an EventTarget. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event) + */ +declare class Event { + constructor(type: string, init?: EventInit); + /** + * The **`type`** read-only property of the Event interface returns a string containing the event's type. It is set when the event is constructed and is the name commonly used to refer to the specific event, such as click, load, or error. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type) + */ + get type(): string; + /** + * The **`eventPhase`** read-only property of the Event interface indicates which phase of the event flow is currently being evaluated. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase) + */ + get eventPhase(): number; + /** + * The read-only **`composed`** property of the Event interface returns a boolean value which indicates whether or not the event will propagate across the shadow DOM boundary into the standard DOM. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed) + */ + get composed(): boolean; + /** + * The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles) + */ + get bubbles(): boolean; + /** + * The **`cancelable`** read-only property of the Event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable) + */ + get cancelable(): boolean; + /** + * The **`defaultPrevented`** read-only property of the Event interface returns a boolean value indicating whether or not the call to Event.preventDefault() canceled the event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented) + */ + get defaultPrevented(): boolean; + /** + * The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue) + */ + get returnValue(): boolean; + /** + * The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget) + */ + get currentTarget(): EventTarget | undefined; + /** + * The read-only **`target`** property of the Event interface is a reference to the object onto which the event was dispatched. It is different from Event.currentTarget when the event handler is called during the bubbling or capturing phase of the event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target) + */ + get target(): EventTarget | undefined; + /** + * The deprecated **`Event.srcElement`** is an alias for the Event.target property. Use Event.target instead. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement) + */ + get srcElement(): EventTarget | undefined; + /** + * The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp) + */ + get timeStamp(): number; + /** + * The **`isTrusted`** read-only property of the Event interface is a boolean value that is true when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and false when the event was dispatched via EventTarget.dispatchEvent(). The only exception is the click event, which initializes the isTrusted property to false in user agents. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted) + */ + get isTrusted(): boolean; + /** + * The **`cancelBubble`** property of the Event interface is deprecated. Use Event.stopPropagation() instead. Setting its value to true before returning from an event handler prevents propagation of the event. In later implementations, setting this to false does nothing. See Browser compatibility for details. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble) + */ + get cancelBubble(): boolean; + /** + * The **`cancelBubble`** property of the Event interface is deprecated. Use Event.stopPropagation() instead. Setting its value to true before returning from an event handler prevents propagation of the event. In later implementations, setting this to false does nothing. See Browser compatibility for details. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble) + */ + set cancelBubble(value: boolean); + /** + * The **`stopImmediatePropagation()`** method of the Event interface prevents other listeners of the same event from being called. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation) + */ + stopImmediatePropagation(): void; + /** + * The **`preventDefault()`** method of the Event interface tells the user agent that the event is being explicitly handled, so its default action, such as page scrolling, link navigation, or pasting text, should not be taken. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault) + */ + preventDefault(): void; + /** + * The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases. It does not, however, prevent any default behaviors from occurring; for instance, clicks on links are still processed. If you want to stop those behaviors, see the preventDefault() method. It also does not prevent propagation to other event-handlers of the current element. If you want to stop those, see stopImmediatePropagation(). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation) + */ + stopPropagation(): void; + /** + * The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked. This does not include nodes in shadow trees if the shadow root was created with its ShadowRoot.mode closed. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath) + */ + composedPath(): EventTarget[]; + static readonly NONE: number; + static readonly CAPTURING_PHASE: number; + static readonly AT_TARGET: number; + static readonly BUBBLING_PHASE: number; +} +interface EventInit { + bubbles?: boolean; + cancelable?: boolean; + composed?: boolean; +} +type EventListener = (event: EventType) => void; +interface EventListenerObject { + handleEvent(event: EventType): void; +} +type EventListenerOrEventListenerObject = EventListener | EventListenerObject; +/** + * The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them. In other words, any target of events implements the three methods associated with this interface. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget) + */ +declare class EventTarget = Record> { + constructor(); + /** + * The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener) + */ + addEventListener(type: Type, handler: EventListenerOrEventListenerObject, options?: EventTargetAddEventListenerOptions | boolean): void; + /** + * The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener) + */ + removeEventListener(type: Type, handler: EventListenerOrEventListenerObject, options?: EventTargetEventListenerOptions | boolean): void; + /** + * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent(). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent) + */ + dispatchEvent(event: EventMap[keyof EventMap]): boolean; +} +interface EventTargetEventListenerOptions { + capture?: boolean; +} +interface EventTargetAddEventListenerOptions { + capture?: boolean; + passive?: boolean; + once?: boolean; + signal?: AbortSignal; +} +interface EventTargetHandlerObject { + handleEvent: (event: Event) => any | undefined; +} +/** + * The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController) + */ +declare class AbortController { + constructor(); + /** + * The **`signal`** read-only property of the AbortController interface returns an AbortSignal object instance, which can be used to communicate with/abort an asynchronous operation as desired. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal) + */ + get signal(): AbortSignal; + /** + * The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed. This is able to abort fetch requests, the consumption of any response bodies, or streams. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort) + */ + abort(reason?: any): void; +} +/** + * The **`AbortSignal`** interface represents a signal object that allows you to communicate with an asynchronous operation (such as a fetch request) and abort it if required via an AbortController object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal) + */ +declare abstract class AbortSignal extends EventTarget { + /** + * The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an abort event). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) + */ + static abort(reason?: any): AbortSignal; + /** + * The **`AbortSignal.timeout()`** static method returns an AbortSignal that will automatically abort after a specified time. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) + */ + static timeout(delay: number): AbortSignal; + /** + * The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal. The returned abort signal is aborted when any of the input iterable abort signals are aborted. The abort reason will be set to the reason of the first signal that is aborted. If any of the given abort signals are already aborted then so will be the returned AbortSignal. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static) + */ + static any(signals: AbortSignal[]): AbortSignal; + /** + * The **`aborted`** read-only property returns a value that indicates whether the asynchronous operations the signal is communicating with are aborted (true) or not (false). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted) + */ + get aborted(): boolean; + /** + * The **`reason`** read-only property returns a JavaScript value that indicates the abort reason. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) + */ + get reason(): any; + /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */ + get onabort(): any | null; + /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */ + set onabort(value: any | null); + /** + * The **`throwIfAborted()`** method throws the signal's abort reason if the signal has been aborted; otherwise it does nothing. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) + */ + throwIfAborted(): void; +} +/** + * The **`Scheduler`** interface of the Prioritized Task Scheduling API provides methods for scheduling prioritized tasks. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Scheduler) + */ +interface Scheduler { + wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; +} +interface SchedulerWaitOptions { + signal?: AbortSignal; +} +/** + * The **`ExtendableEvent`** interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent) + */ +declare abstract class ExtendableEvent extends Event { + /** + * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing. It can also be used to detect whether that work was successful. In service workers, waitUntil() tells the browser that work is ongoing until the promise settles, and it shouldn't terminate the service worker if it wants that work to complete. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil) + */ + waitUntil(promise: Promise): void; +} +/** + * The **`CustomEvent`** interface can be used to attach custom data to an event generated by an application. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent) + */ +declare class CustomEvent extends Event { + constructor(type: string, init?: CustomEventCustomEventInit); + /** + * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail) + */ + get detail(): T; +} +interface CustomEventCustomEventInit { + bubbles?: boolean; + cancelable?: boolean; + composed?: boolean; + detail?: any; +} +/** + * The **`Blob`** interface represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob) + */ +declare class Blob { + constructor(bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions); + /** + * The **`size`** read-only property of the Blob interface returns the size of the Blob or File in bytes. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) + */ + get size(): number; + /** + * The **`type`** read-only property of the Blob interface returns the MIME type of the file. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) + */ + get type(): string; + /** + * The **`slice()`** method of the Blob interface creates and returns a new Blob object which contains data from a subset of the blob on which it's called. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) + */ + slice(start?: number, end?: number, type?: string): Blob; + /** + * The **`arrayBuffer()`** method of the Blob interface returns a Promise that resolves with the contents of the blob as binary data contained in an ArrayBuffer. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) + */ + arrayBuffer(): Promise; + /** + * The **`bytes()`** method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes) + */ + bytes(): Promise; + /** + * The **`text()`** method of the Blob interface returns a Promise that resolves with a string containing the contents of the blob, interpreted as UTF-8. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) + */ + text(): Promise; + /** + * The **`stream()`** method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the Blob. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) + */ + stream(): ReadableStream; +} +interface BlobOptions { + type?: string; +} +/** + * The **`File`** interface provides information about files and allows JavaScript in a web page to access their content. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File) + */ +declare class File extends Blob { + constructor(bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, name: string, options?: FileOptions); + /** + * The **`name`** read-only property of the File interface returns the name of the file represented by a File object. For security reasons, the path is excluded from this property. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) + */ + get name(): string; + /** + * The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) + */ + get lastModified(): number; +} +interface FileOptions { + type?: string; + lastModified?: number; +} +/** +* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache. +* +* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/) +*/ +declare abstract class CacheStorage { + /** + * The **`open()`** method of the CacheStorage interface returns a Promise that resolves to the Cache object matching the cacheName. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open) + */ + open(cacheName: string): Promise; + readonly default: Cache; +} +/** +* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache. +* +* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/) +*/ +declare abstract class Cache { + /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */ + delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise; + /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */ + match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise; + /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */ + put(request: RequestInfo | URL, response: Response): Promise; +} +interface CacheQueryOptions { + ignoreMethod?: boolean; +} +/** +* The Web Crypto API provides a set of low-level functions for common cryptographic tasks. +* The Workers runtime implements the full surface of this API, but with some differences in +* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms) +* compared to those implemented in most browsers. +* +* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/) +*/ +declare abstract class Crypto { + /** + * The **`Crypto.subtle`** read-only property returns a SubtleCrypto which can then be used to perform low-level cryptographic operations. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle) + */ + get subtle(): SubtleCrypto; + /** + * The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values. The array given as the parameter is filled with random numbers (random in its cryptographic meaning). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) + */ + getRandomValues(buffer: T): T; + /** + * The **`randomUUID()`** method of the Crypto interface is used to generate a v4 UUID using a cryptographically secure random number generator. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID) + */ + randomUUID(): string; + DigestStream: typeof DigestStream; +} +/** + * The **`SubtleCrypto`** interface of the Web Crypto API provides a number of low-level cryptographic functions. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto) + */ +declare abstract class SubtleCrypto { + /** + * The **`encrypt()`** method of the SubtleCrypto interface encrypts data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt) + */ + encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise; + /** + * The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data. It takes as arguments a key to decrypt with, some optional extra parameters, and the data to decrypt (also known as "ciphertext"). It returns a Promise which will be fulfilled with the decrypted data (also known as "plaintext"). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt) + */ + decrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, cipherText: ArrayBuffer | ArrayBufferView): Promise; + /** + * The **`sign()`** method of the SubtleCrypto interface generates a digital signature. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign) + */ + sign(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, data: ArrayBuffer | ArrayBufferView): Promise; + /** + * The **`verify()`** method of the SubtleCrypto interface verifies a digital signature. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify) + */ + verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise; + /** + * The **`digest()`** method of the SubtleCrypto interface generates a digest of the given data, using the specified hash function. A digest is a short fixed-length value derived from some variable-length input. Cryptographic digests should exhibit collision-resistance, meaning that it's hard to come up with two different inputs that have the same digest value. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest) + */ + digest(algorithm: string | SubtleCryptoHashAlgorithm, data: ArrayBuffer | ArrayBufferView): Promise; + /** + * The **`generateKey()`** method of the SubtleCrypto interface is used to generate a new key (for symmetric algorithms) or key pair (for public-key algorithms). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) + */ + generateKey(algorithm: string | SubtleCryptoGenerateKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise; + /** + * The **`deriveKey()`** method of the SubtleCrypto interface can be used to derive a secret key from a master key. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey) + */ + deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise; + /** + * The **`deriveBits()`** method of the SubtleCrypto interface can be used to derive an array of bits from a base key. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits) + */ + deriveBits(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, length?: number | null): Promise; + /** + * The **`importKey()`** method of the SubtleCrypto interface imports a key: that is, it takes as input a key in an external, portable format and gives you a CryptoKey object that you can use in the Web Crypto API. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) + */ + importKey(format: string, keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, algorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise; + /** + * The **`exportKey()`** method of the SubtleCrypto interface exports a key: that is, it takes as input a CryptoKey object and gives you the key in an external, portable format. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey) + */ + exportKey(format: string, key: CryptoKey): Promise; + /** + * The **`wrapKey()`** method of the SubtleCrypto interface "wraps" a key. This means that it exports the key in an external, portable format, then encrypts the exported key. Wrapping a key helps protect it in untrusted environments, such as inside an otherwise unprotected data store or in transmission over an unprotected network. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey) + */ + wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise; + /** + * The **`unwrapKey()`** method of the SubtleCrypto interface "unwraps" a key. This means that it takes as its input a key that has been exported and then encrypted (also called "wrapped"). It decrypts the key and then imports it, returning a CryptoKey object that can be used in the Web Crypto API. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) + */ + unwrapKey(format: string, wrappedKey: ArrayBuffer | ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise; + timingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuffer | ArrayBufferView): boolean; +} +/** + * The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods generateKey(), deriveKey(), importKey(), or unwrapKey(). + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey) + */ +declare abstract class CryptoKey { + /** + * The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object. It can have the following values: + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) + */ + readonly type: string; + /** + * The read-only **`extractable`** property of the CryptoKey interface indicates whether or not the key may be extracted using SubtleCrypto.exportKey() or SubtleCrypto.wrapKey(). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) + */ + readonly extractable: boolean; + /** + * The read-only **`algorithm`** property of the CryptoKey interface returns an object describing the algorithm for which this key can be used, and any associated extra parameters. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) + */ + readonly algorithm: CryptoKeyKeyAlgorithm | CryptoKeyAesKeyAlgorithm | CryptoKeyHmacKeyAlgorithm | CryptoKeyRsaKeyAlgorithm | CryptoKeyEllipticKeyAlgorithm | CryptoKeyArbitraryKeyAlgorithm; + /** + * The read-only **`usages`** property of the CryptoKey interface indicates what can be done with the key. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) + */ + readonly usages: string[]; +} +interface CryptoKeyPair { + publicKey: CryptoKey; + privateKey: CryptoKey; +} +interface JsonWebKey { + kty: string; + use?: string; + key_ops?: string[]; + alg?: string; + ext?: boolean; + crv?: string; + x?: string; + y?: string; + d?: string; + n?: string; + e?: string; + p?: string; + q?: string; + dp?: string; + dq?: string; + qi?: string; + oth?: RsaOtherPrimesInfo[]; + k?: string; +} +interface RsaOtherPrimesInfo { + r?: string; + d?: string; + t?: string; +} +interface SubtleCryptoDeriveKeyAlgorithm { + name: string; + salt?: (ArrayBuffer | ArrayBufferView); + iterations?: number; + hash?: (string | SubtleCryptoHashAlgorithm); + $public?: CryptoKey; + info?: (ArrayBuffer | ArrayBufferView); +} +interface SubtleCryptoEncryptAlgorithm { + name: string; + iv?: (ArrayBuffer | ArrayBufferView); + additionalData?: (ArrayBuffer | ArrayBufferView); + tagLength?: number; + counter?: (ArrayBuffer | ArrayBufferView); + length?: number; + label?: (ArrayBuffer | ArrayBufferView); +} +interface SubtleCryptoGenerateKeyAlgorithm { + name: string; + hash?: (string | SubtleCryptoHashAlgorithm); + modulusLength?: number; + publicExponent?: (ArrayBuffer | ArrayBufferView); + length?: number; + namedCurve?: string; +} +interface SubtleCryptoHashAlgorithm { + name: string; +} +interface SubtleCryptoImportKeyAlgorithm { + name: string; + hash?: (string | SubtleCryptoHashAlgorithm); + length?: number; + namedCurve?: string; + compressed?: boolean; +} +interface SubtleCryptoSignAlgorithm { + name: string; + hash?: (string | SubtleCryptoHashAlgorithm); + dataLength?: number; + saltLength?: number; +} +interface CryptoKeyKeyAlgorithm { + name: string; +} +interface CryptoKeyAesKeyAlgorithm { + name: string; + length: number; +} +interface CryptoKeyHmacKeyAlgorithm { + name: string; + hash: CryptoKeyKeyAlgorithm; + length: number; +} +interface CryptoKeyRsaKeyAlgorithm { + name: string; + modulusLength: number; + publicExponent: ArrayBuffer | ArrayBufferView; + hash?: CryptoKeyKeyAlgorithm; +} +interface CryptoKeyEllipticKeyAlgorithm { + name: string; + namedCurve: string; +} +interface CryptoKeyArbitraryKeyAlgorithm { + name: string; + hash?: CryptoKeyKeyAlgorithm; + namedCurve?: string; + length?: number; +} +declare class DigestStream extends WritableStream { + constructor(algorithm: string | SubtleCryptoHashAlgorithm, options?: DigestStreamOptions); + readonly digest: Promise; + get bytesWritten(): number | bigint; +} +interface DigestStreamOptions { + toWellFormed?: boolean; +} +/** + * The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as UTF-8, ISO-8859-2, or GBK. A decoder takes an array of bytes as input and returns a JavaScript string. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder) + */ +declare class TextDecoder { + constructor(label?: string, options?: TextDecoderConstructorOptions); + /** + * The **`TextDecoder.decode()`** method returns a string containing text decoded from the buffer passed as a parameter. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode) + */ + decode(input?: (ArrayBuffer | ArrayBufferView), options?: TextDecoderDecodeOptions): string; + get encoding(): string; + get fatal(): boolean; + get ignoreBOM(): boolean; +} +/** + * The **`TextEncoder`** interface enables you to encode a JavaScript string using UTF-8. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder) + */ +declare class TextEncoder { + constructor(); + /** + * The **`TextEncoder.encode()`** method takes a string as input, and returns a Uint8Array containing the string encoded using UTF-8. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode) + */ + encode(input?: string): Uint8Array; + /** + * The **`TextEncoder.encodeInto()`** method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns an object indicating the progress of the encoding. This is potentially more performant than the encode() method — especially when the target buffer is a view into a Wasm heap. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto) + */ + encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; + get encoding(): string; +} +interface TextDecoderConstructorOptions { + fatal: boolean; + ignoreBOM: boolean; +} +interface TextDecoderDecodeOptions { + stream: boolean; +} +interface TextEncoderEncodeIntoResult { + read: number; + written: number; +} +/** + * The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent) + */ +declare class ErrorEvent extends Event { + constructor(type: string, init?: ErrorEventErrorEventInit); + /** + * The **`filename`** read-only property of the ErrorEvent interface returns a string containing the name of the script file in which the error occurred. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) + */ + get filename(): string; + /** + * The **`message`** read-only property of the ErrorEvent interface returns a string containing a human-readable error message describing the problem. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) + */ + get message(): string; + /** + * The **`lineno`** read-only property of the ErrorEvent interface returns an integer containing the line number of the script file on which the error occurred. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) + */ + get lineno(): number; + /** + * The **`colno`** read-only property of the ErrorEvent interface returns an integer containing the column number of the script file on which the error occurred. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) + */ + get colno(): number; + /** + * The **`error`** read-only property of the ErrorEvent interface returns a JavaScript value, such as an Error or DOMException, representing the error associated with this event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) + */ + get error(): any; +} +interface ErrorEventErrorEventInit { + bubbles?: boolean; + cancelable?: boolean; + composed?: boolean; + message?: string; + filename?: string; + lineno?: number; + colno?: number; + error?: any; +} +/** + * The **`MessageEvent`** interface represents a message received by a target object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent) + */ +declare class MessageEvent extends Event { + constructor(type: string, initializer?: MessageEventInit); + /** + * The **`data`** read-only property of the MessageEvent interface represents the data sent by the message emitter. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data) + */ + readonly data: any; + /** + * The **`origin`** read-only property of the MessageEvent interface is a string representing the origin of the message emitter. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin) + */ + readonly origin: string | null; + /** + * The **`lastEventId`** read-only property of the MessageEvent interface is a string representing a unique ID for the event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId) + */ + readonly lastEventId: string; + /** + * The **`source`** read-only property of the MessageEvent interface is a MessageEventSource (which can be a WindowProxy, MessagePort, or ServiceWorker object) representing the message emitter. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source) + */ + readonly source: MessagePort | null; + /** + * The **`ports`** read-only property of the MessageEvent interface is an array of MessagePort objects containing all MessagePort objects sent with the message, in order. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports) + */ + readonly ports: MessagePort[]; +} +interface MessageEventInit { + bubbles?: boolean; + cancelable?: boolean; + composed?: boolean; + data?: any; + origin?: string; + lastEventId?: string; + source?: MessagePort; + ports?: MessagePort[]; +} +/** + * The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected. These events are particularly useful for telemetry and debugging purposes. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent) + */ +declare abstract class PromiseRejectionEvent extends Event { + /** + * The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript Promise which was rejected. You can examine the event's PromiseRejectionEvent.reason property to learn why the promise was rejected. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise) + */ + readonly promise: Promise; + /** + * The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject(). This in theory provides information about why the promise was rejected. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason) + */ + readonly reason: any; +} +/** + * The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the fetch(), XMLHttpRequest.send() or navigator.sendBeacon() methods. It uses the same format a form would use if the encoding type were set to "multipart/form-data". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData) + */ +declare class FormData { + constructor(); + /** + * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) + */ + append(name: string, value: string | Blob): void; + /** + * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) + */ + append(name: string, value: string): void; + /** + * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) + */ + append(name: string, value: Blob, filename?: string): void; + /** + * The **`delete()`** method of the FormData interface deletes a key and its value(s) from a FormData object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete) + */ + delete(name: string): void; + /** + * The **`get()`** method of the FormData interface returns the first value associated with a given key from within a FormData object. If you expect multiple values and want all of them, use the getAll() method instead. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get) + */ + get(name: string): (File | string) | null; + /** + * The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a FormData object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll) + */ + getAll(name: string): (File | string)[]; + /** + * The **`has()`** method of the FormData interface returns whether a FormData object contains a certain key. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has) + */ + has(name: string): boolean; + /** + * The **`set()`** method of the FormData interface sets a new value for an existing key inside a FormData object, or adds the key/value if it does not already exist. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) + */ + set(name: string, value: string | Blob): void; + /** + * The **`set()`** method of the FormData interface sets a new value for an existing key inside a FormData object, or adds the key/value if it does not already exist. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) + */ + set(name: string, value: string): void; + /** + * The **`set()`** method of the FormData interface sets a new value for an existing key inside a FormData object, or adds the key/value if it does not already exist. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) + */ + set(name: string, value: Blob, filename?: string): void; + entries(): IterableIterator<[ + key: string, + value: File | string + ]>; + keys(): IterableIterator; + values(): IterableIterator<(File | string)>; + forEach(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void; + [Symbol.iterator](): IterableIterator<[ + key: string, + value: File | string + ]>; +} +interface ContentOptions { + html?: boolean; +} +declare class HTMLRewriter { + constructor(); + on(selector: string, handlers: HTMLRewriterElementContentHandlers): HTMLRewriter; + onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; + transform(response: Response): Response; +} +interface HTMLRewriterElementContentHandlers { + element?(element: Element): void | Promise; + comments?(comment: Comment): void | Promise; + text?(element: Text): void | Promise; +} +interface HTMLRewriterDocumentContentHandlers { + doctype?(doctype: Doctype): void | Promise; + comments?(comment: Comment): void | Promise; + text?(text: Text): void | Promise; + end?(end: DocumentEnd): void | Promise; +} +interface Doctype { + readonly name: string | null; + readonly publicId: string | null; + readonly systemId: string | null; +} +interface Element { + tagName: string; + readonly attributes: IterableIterator; + readonly removed: boolean; + readonly namespaceURI: string; + getAttribute(name: string): string | null; + hasAttribute(name: string): boolean; + setAttribute(name: string, value: string): Element; + removeAttribute(name: string): Element; + before(content: string | ReadableStream | Response, options?: ContentOptions): Element; + after(content: string | ReadableStream | Response, options?: ContentOptions): Element; + prepend(content: string | ReadableStream | Response, options?: ContentOptions): Element; + append(content: string | ReadableStream | Response, options?: ContentOptions): Element; + replace(content: string | ReadableStream | Response, options?: ContentOptions): Element; + remove(): Element; + removeAndKeepContent(): Element; + setInnerContent(content: string | ReadableStream | Response, options?: ContentOptions): Element; + onEndTag(handler: (tag: EndTag) => void | Promise): void; +} +interface EndTag { + name: string; + before(content: string | ReadableStream | Response, options?: ContentOptions): EndTag; + after(content: string | ReadableStream | Response, options?: ContentOptions): EndTag; + remove(): EndTag; +} +interface Comment { + text: string; + readonly removed: boolean; + before(content: string, options?: ContentOptions): Comment; + after(content: string, options?: ContentOptions): Comment; + replace(content: string, options?: ContentOptions): Comment; + remove(): Comment; +} +interface Text { + readonly text: string; + readonly lastInTextNode: boolean; + readonly removed: boolean; + before(content: string | ReadableStream | Response, options?: ContentOptions): Text; + after(content: string | ReadableStream | Response, options?: ContentOptions): Text; + replace(content: string | ReadableStream | Response, options?: ContentOptions): Text; + remove(): Text; +} +interface DocumentEnd { + append(content: string, options?: ContentOptions): DocumentEnd; +} +/** + * This is the event type for fetch events dispatched on the service worker global scope. It contains information about the fetch, including the request and how the receiver will treat the response. It provides the event.respondWith() method, which allows us to provide a response to this fetch. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent) + */ +declare abstract class FetchEvent extends ExtendableEvent { + /** + * The **`request`** read-only property of the FetchEvent interface returns the Request that triggered the event handler. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request) + */ + readonly request: Request; + /** + * The **`respondWith()`** method of FetchEvent prevents the browser's default fetch handling, and allows you to provide a promise for a Response yourself. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith) + */ + respondWith(promise: Response | Promise): void; + passThroughOnException(): void; +} +type HeadersInit = Headers | Iterable> | Record; +/** + * The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing headers from the list of the request's headers. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers) + */ +declare class Headers { + constructor(init?: HeadersInit); + /** + * The **`get()`** method of the Headers interface returns a byte string of all the values of a header within a Headers object with a given name. If the requested header doesn't exist in the Headers object, it returns null. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get) + */ + get(name: string): string | null; + getAll(name: string): string[]; + /** + * The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response. This allows Headers objects to handle having multiple Set-Cookie headers, which wasn't possible prior to its implementation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie) + */ + getSetCookie(): string[]; + /** + * The **`has()`** method of the Headers interface returns a boolean stating whether a Headers object contains a certain header. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has) + */ + has(name: string): boolean; + /** + * The **`set()`** method of the Headers interface sets a new value for an existing header inside a Headers object, or adds the header if it does not already exist. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set) + */ + set(name: string, value: string): void; + /** + * The **`append()`** method of the Headers interface appends a new value onto an existing header inside a Headers object, or adds the header if it does not already exist. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append) + */ + append(name: string, value: string): void; + /** + * The **`delete()`** method of the Headers interface deletes a header from the current Headers object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete) + */ + delete(name: string): void; + forEach(callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This): void; + entries(): IterableIterator<[ + key: string, + value: string + ]>; + keys(): IterableIterator; + values(): IterableIterator; + [Symbol.iterator](): IterableIterator<[ + key: string, + value: string + ]>; +} +type BodyInit = ReadableStream | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData | Iterable | AsyncIterable; +declare abstract class Body { + /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */ + get body(): ReadableStream | null; + /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */ + get bodyUsed(): boolean; + /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */ + arrayBuffer(): Promise; + /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */ + bytes(): Promise; + /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */ + text(): Promise; + /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */ + json(): Promise; + /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */ + formData(): Promise; + /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */ + blob(): Promise; +} +/** + * The **`Response`** interface of the Fetch API represents the response to a request. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response) + */ +declare var Response: { + prototype: Response; + new (body?: BodyInit | null, init?: ResponseInit): Response; + error(): Response; + redirect(url: string, status?: number): Response; + json(any: any, maybeInit?: (ResponseInit | Response)): Response; +}; +/** + * The **`Response`** interface of the Fetch API represents the response to a request. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response) + */ +interface Response extends Body { + /** + * The **`clone()`** method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) + */ + clone(): Response; + /** + * The **`status`** read-only property of the Response interface contains the HTTP status codes of the response. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) + */ + status: number; + /** + * The **`statusText`** read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) + */ + statusText: string; + /** + * The **`headers`** read-only property of the Response interface contains the Headers object associated with the response. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) + */ + headers: Headers; + /** + * The **`ok`** read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) + */ + ok: boolean; + /** + * The **`redirected`** read-only property of the Response interface indicates whether or not the response is the result of a request you made which was redirected. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) + */ + redirected: boolean; + /** + * The **`url`** read-only property of the Response interface contains the URL of the response. The value of the url property will be the final URL obtained after any redirects. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) + */ + url: string; + webSocket: WebSocket | null; + cf: any | undefined; + /** + * The **`type`** read-only property of the Response interface contains the type of the response. The type determines whether scripts are able to access the response body and headers. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type) + */ + type: "default" | "error"; +} +interface ResponseInit { + status?: number; + statusText?: string; + headers?: HeadersInit; + cf?: any; + webSocket?: (WebSocket | null); + encodeBody?: "automatic" | "manual"; +} +type RequestInfo> = Request | string; +/** + * The **`Request`** interface of the Fetch API represents a resource request. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request) + */ +declare var Request: { + prototype: Request; + new >(input: RequestInfo | URL, init?: RequestInit): Request; +}; +/** + * The **`Request`** interface of the Fetch API represents a resource request. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request) + */ +interface Request> extends Body { + /** + * The **`clone()`** method of the Request interface creates a copy of the current Request object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) + */ + clone(): Request; + /** + * The **`method`** read-only property of the Request interface contains the request's method (GET, POST, etc.) + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method) + */ + method: string; + /** + * The **`url`** read-only property of the Request interface contains the URL of the request. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url) + */ + url: string; + /** + * The **`headers`** read-only property of the Request interface contains the Headers object associated with the request. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers) + */ + headers: Headers; + /** + * The **`redirect`** read-only property of the Request interface contains the mode for how redirects are handled. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect) + */ + redirect: string; + fetcher: Fetcher | null; + /** + * The read-only **`signal`** property of the Request interface returns the AbortSignal associated with the request. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal) + */ + signal: AbortSignal; + cf?: Cf; + /** + * The **`integrity`** read-only property of the Request interface contains the subresource integrity value of the request. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity) + */ + integrity: string; + /** + * The **`keepalive`** read-only property of the Request interface contains the request's keepalive setting (true or false), which indicates whether the browser will keep the associated request alive if the page that initiated it is unloaded before the request is complete. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive) + */ + keepalive: boolean; + /** + * The **`cache`** read-only property of the Request interface contains the cache mode of the request. It controls how the request will interact with the browser's HTTP cache. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache) + */ + cache?: "no-store" | "no-cache"; +} +interface RequestInit { + /* A string to set request's method. */ + method?: string; + /* A Headers object, an object literal, or an array of two-item arrays to set request's headers. */ + headers?: HeadersInit; + /* A BodyInit object or null to set request's body. */ + body?: BodyInit | null; + /* A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */ + redirect?: string; + fetcher?: (Fetcher | null); + cf?: Cf; + /* A string indicating how the request will interact with the browser's cache to set request's cache. */ + cache?: "no-store" | "no-cache"; + /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */ + integrity?: string; + /* An AbortSignal to set request's signal. */ + signal?: (AbortSignal | null); + encodeResponseBody?: "automatic" | "manual"; +} +type Service Rpc.WorkerEntrypointBranded) | Rpc.WorkerEntrypointBranded | ExportedHandler | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? Fetcher> : T extends Rpc.WorkerEntrypointBranded ? Fetcher : T extends Exclude ? never : Fetcher; +type Fetcher = (T extends Rpc.EntrypointBranded ? Rpc.Provider : unknown) & { + fetch(input: RequestInfo | URL, init?: RequestInit): Promise; + connect(address: SocketAddress | string, options?: SocketOptions): Socket; +}; +interface KVNamespaceListKey { + name: Key; + expiration?: number; + metadata?: Metadata; +} +type KVNamespaceListResult = { + list_complete: false; + keys: KVNamespaceListKey[]; + cursor: string; + cacheStatus: string | null; +} | { + list_complete: true; + keys: KVNamespaceListKey[]; + cacheStatus: string | null; +}; +interface KVNamespace { + get(key: Key, options?: Partial>): Promise; + get(key: Key, type: "text"): Promise; + get(key: Key, type: "json"): Promise; + get(key: Key, type: "arrayBuffer"): Promise; + get(key: Key, type: "stream"): Promise; + get(key: Key, options?: KVNamespaceGetOptions<"text">): Promise; + get(key: Key, options?: KVNamespaceGetOptions<"json">): Promise; + get(key: Key, options?: KVNamespaceGetOptions<"arrayBuffer">): Promise; + get(key: Key, options?: KVNamespaceGetOptions<"stream">): Promise; + get(key: Array, type: "text"): Promise>; + get(key: Array, type: "json"): Promise>; + get(key: Array, options?: Partial>): Promise>; + get(key: Array, options?: KVNamespaceGetOptions<"text">): Promise>; + get(key: Array, options?: KVNamespaceGetOptions<"json">): Promise>; + list(options?: KVNamespaceListOptions): Promise>; + put(key: Key, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: KVNamespacePutOptions): Promise; + getWithMetadata(key: Key, options?: Partial>): Promise>; + getWithMetadata(key: Key, type: "text"): Promise>; + getWithMetadata(key: Key, type: "json"): Promise>; + getWithMetadata(key: Key, type: "arrayBuffer"): Promise>; + getWithMetadata(key: Key, type: "stream"): Promise>; + getWithMetadata(key: Key, options: KVNamespaceGetOptions<"text">): Promise>; + getWithMetadata(key: Key, options: KVNamespaceGetOptions<"json">): Promise>; + getWithMetadata(key: Key, options: KVNamespaceGetOptions<"arrayBuffer">): Promise>; + getWithMetadata(key: Key, options: KVNamespaceGetOptions<"stream">): Promise>; + getWithMetadata(key: Array, type: "text"): Promise>>; + getWithMetadata(key: Array, type: "json"): Promise>>; + getWithMetadata(key: Array, options?: Partial>): Promise>>; + getWithMetadata(key: Array, options?: KVNamespaceGetOptions<"text">): Promise>>; + getWithMetadata(key: Array, options?: KVNamespaceGetOptions<"json">): Promise>>; + delete(key: Key): Promise; +} +interface KVNamespaceListOptions { + limit?: number; + prefix?: (string | null); + cursor?: (string | null); +} +interface KVNamespaceGetOptions { + type: Type; + cacheTtl?: number; +} +interface KVNamespacePutOptions { + expiration?: number; + expirationTtl?: number; + metadata?: (any | null); +} +interface KVNamespaceGetWithMetadataResult { + value: Value | null; + metadata: Metadata | null; + cacheStatus: string | null; +} +type QueueContentType = "text" | "bytes" | "json" | "v8"; +interface Queue { + metrics(): Promise; + send(message: Body, options?: QueueSendOptions): Promise; + sendBatch(messages: Iterable>, options?: QueueSendBatchOptions): Promise; +} +interface QueueSendMetrics { + backlogCount: number; + backlogBytes: number; + oldestMessageTimestamp?: Date; +} +interface QueueSendMetadata { + metrics: QueueSendMetrics; +} +interface QueueSendResponse { + metadata: QueueSendMetadata; +} +interface QueueSendBatchMetrics { + backlogCount: number; + backlogBytes: number; + oldestMessageTimestamp?: Date; +} +interface QueueSendBatchMetadata { + metrics: QueueSendBatchMetrics; +} +interface QueueSendBatchResponse { + metadata: QueueSendBatchMetadata; +} +interface QueueSendOptions { + contentType?: QueueContentType; + delaySeconds?: number; +} +interface QueueSendBatchOptions { + delaySeconds?: number; +} +interface MessageSendRequest { + body: Body; + contentType?: QueueContentType; + delaySeconds?: number; +} +interface QueueMetrics { + backlogCount: number; + backlogBytes: number; + oldestMessageTimestamp?: Date; +} +interface MessageBatchMetrics { + backlogCount: number; + backlogBytes: number; + oldestMessageTimestamp?: Date; +} +interface MessageBatchMetadata { + metrics: MessageBatchMetrics; +} +interface QueueRetryOptions { + delaySeconds?: number; +} +interface Message { + readonly id: string; + readonly timestamp: Date; + readonly body: Body; + readonly attempts: number; + retry(options?: QueueRetryOptions): void; + ack(): void; +} +interface QueueEvent extends ExtendableEvent { + readonly messages: readonly Message[]; + readonly queue: string; + readonly metadata: MessageBatchMetadata; + retryAll(options?: QueueRetryOptions): void; + ackAll(): void; +} +interface MessageBatch { + readonly messages: readonly Message[]; + readonly queue: string; + readonly metadata: MessageBatchMetadata; + retryAll(options?: QueueRetryOptions): void; + ackAll(): void; +} +interface R2Error extends Error { + readonly name: string; + readonly code: number; + readonly message: string; + readonly action: string; + readonly stack: any; +} +interface R2ListOptions { + limit?: number; + prefix?: string; + cursor?: string; + delimiter?: string; + startAfter?: string; + include?: ("httpMetadata" | "customMetadata")[]; +} +interface R2Bucket { + head(key: string): Promise; + get(key: string, options: R2GetOptions & { + onlyIf: R2Conditional | Headers; + }): Promise; + get(key: string, options?: R2GetOptions): Promise; + put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions & { + onlyIf: R2Conditional | Headers; + }): Promise; + put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions): Promise; + createMultipartUpload(key: string, options?: R2MultipartOptions): Promise; + resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; + delete(keys: string | string[]): Promise; + list(options?: R2ListOptions): Promise; +} +interface R2MultipartUpload { + readonly key: string; + readonly uploadId: string; + uploadPart(partNumber: number, value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob, options?: R2UploadPartOptions): Promise; + abort(): Promise; + complete(uploadedParts: R2UploadedPart[]): Promise; +} +interface R2UploadedPart { + partNumber: number; + etag: string; +} +declare abstract class R2Object { + readonly key: string; + readonly version: string; + readonly size: number; + readonly etag: string; + readonly httpEtag: string; + readonly checksums: R2Checksums; + readonly uploaded: Date; + readonly httpMetadata?: R2HTTPMetadata; + readonly customMetadata?: Record; + readonly range?: R2Range; + readonly storageClass: string; + readonly ssecKeyMd5?: string; + writeHttpMetadata(headers: Headers): void; +} +interface R2ObjectBody extends R2Object { + get body(): ReadableStream; + get bodyUsed(): boolean; + arrayBuffer(): Promise; + bytes(): Promise; + text(): Promise; + json(): Promise; + blob(): Promise; +} +type R2Range = { + offset: number; + length?: number; +} | { + offset?: number; + length: number; +} | { + suffix: number; +}; +interface R2Conditional { + etagMatches?: string; + etagDoesNotMatch?: string; + uploadedBefore?: Date; + uploadedAfter?: Date; + secondsGranularity?: boolean; +} +interface R2GetOptions { + onlyIf?: (R2Conditional | Headers); + range?: (R2Range | Headers); + ssecKey?: (ArrayBuffer | string); +} +interface R2PutOptions { + onlyIf?: (R2Conditional | Headers); + httpMetadata?: (R2HTTPMetadata | Headers); + customMetadata?: Record; + md5?: ((ArrayBuffer | ArrayBufferView) | string); + sha1?: ((ArrayBuffer | ArrayBufferView) | string); + sha256?: ((ArrayBuffer | ArrayBufferView) | string); + sha384?: ((ArrayBuffer | ArrayBufferView) | string); + sha512?: ((ArrayBuffer | ArrayBufferView) | string); + storageClass?: string; + ssecKey?: (ArrayBuffer | string); +} +interface R2MultipartOptions { + httpMetadata?: (R2HTTPMetadata | Headers); + customMetadata?: Record; + storageClass?: string; + ssecKey?: (ArrayBuffer | string); +} +interface R2Checksums { + readonly md5?: ArrayBuffer; + readonly sha1?: ArrayBuffer; + readonly sha256?: ArrayBuffer; + readonly sha384?: ArrayBuffer; + readonly sha512?: ArrayBuffer; + toJSON(): R2StringChecksums; +} +interface R2StringChecksums { + md5?: string; + sha1?: string; + sha256?: string; + sha384?: string; + sha512?: string; +} +interface R2HTTPMetadata { + contentType?: string; + contentLanguage?: string; + contentDisposition?: string; + contentEncoding?: string; + cacheControl?: string; + cacheExpiry?: Date; +} +type R2Objects = { + objects: R2Object[]; + delimitedPrefixes: string[]; +} & ({ + truncated: true; + cursor: string; +} | { + truncated: false; +}); +interface R2UploadPartOptions { + ssecKey?: (ArrayBuffer | string); +} +declare abstract class ScheduledEvent extends ExtendableEvent { + readonly scheduledTime: number; + readonly cron: string; + noRetry(): void; +} +interface ScheduledController { + readonly scheduledTime: number; + readonly cron: string; + noRetry(): void; +} +interface QueuingStrategy { + highWaterMark?: (number | bigint); + size?: (chunk: T) => number | bigint; +} +interface UnderlyingSink { + type?: string; + start?: (controller: WritableStreamDefaultController) => void | Promise; + write?: (chunk: W, controller: WritableStreamDefaultController) => void | Promise; + abort?: (reason: any) => void | Promise; + close?: () => void | Promise; +} +interface UnderlyingByteSource { + type: "bytes"; + autoAllocateChunkSize?: number; + start?: (controller: ReadableByteStreamController) => void | Promise; + pull?: (controller: ReadableByteStreamController) => void | Promise; + cancel?: (reason: any) => void | Promise; +} +interface UnderlyingSource { + type?: "" | undefined; + start?: (controller: ReadableStreamDefaultController) => void | Promise; + pull?: (controller: ReadableStreamDefaultController) => void | Promise; + cancel?: (reason: any) => void | Promise; + expectedLength?: (number | bigint); +} +interface Transformer { + readableType?: string; + writableType?: string; + start?: (controller: TransformStreamDefaultController) => void | Promise; + transform?: (chunk: I, controller: TransformStreamDefaultController) => void | Promise; + flush?: (controller: TransformStreamDefaultController) => void | Promise; + cancel?: (reason: any) => void | Promise; + expectedLength?: number; +} +interface StreamPipeOptions { + preventAbort?: boolean; + preventCancel?: boolean; + /** + * Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered. + * + * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. + * + * Errors and closures of the source and destination streams propagate as follows: + * + * An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination. + * + * An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source. + * + * When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error. + * + * If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source. + * + * The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set. + */ + preventClose?: boolean; + signal?: AbortSignal; +} +type ReadableStreamReadResult = { + done: false; + value: R; +} | { + done: true; + value?: undefined; +}; +/** + * The **`ReadableStream`** interface of the Streams API represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream) + */ +interface ReadableStream { + /** + * The **`locked`** read-only property of the ReadableStream interface returns whether or not the readable stream is locked to a reader. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked) + */ + get locked(): boolean; + /** + * The **`cancel()`** method of the ReadableStream interface returns a Promise that resolves when the stream is canceled. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel) + */ + cancel(reason?: any): Promise; + /** + * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it. While the stream is locked, no other reader can be acquired until this one is released. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) + */ + getReader(): ReadableStreamDefaultReader; + /** + * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it. While the stream is locked, no other reader can be acquired until this one is released. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) + */ + getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; + /** + * The **`pipeThrough()`** method of the ReadableStream interface provides a chainable way of piping the current stream through a transform stream or any other writable/readable pair. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough) + */ + pipeThrough(transform: ReadableWritablePair, options?: StreamPipeOptions): ReadableStream; + /** + * The **`pipeTo()`** method of the ReadableStream interface pipes the current ReadableStream to a given WritableStream and returns a Promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo) + */ + pipeTo(destination: WritableStream, options?: StreamPipeOptions): Promise; + /** + * The **`tee()`** method of the ReadableStream interface tees the current readable stream, returning a two-element array containing the two resulting branches as new ReadableStream instances. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee) + */ + tee(): [ + ReadableStream, + ReadableStream + ]; + values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; + [Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator; +} +/** + * The **`ReadableStream`** interface of the Streams API represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream) + */ +declare const ReadableStream: { + prototype: ReadableStream; + new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy): ReadableStream; + new (underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream; +}; +/** + * The **`ReadableStreamDefaultReader`** interface of the Streams API represents a default reader that can be used to read stream data supplied from a network (such as a fetch request). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader) + */ +declare class ReadableStreamDefaultReader { + constructor(stream: ReadableStream); + get closed(): Promise; + cancel(reason?: any): Promise; + /** + * The **`read()`** method of the ReadableStreamDefaultReader interface returns a Promise providing access to the next chunk in the stream's internal queue. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read) + */ + read(): Promise>; + /** + * The **`releaseLock()`** method of the ReadableStreamDefaultReader interface releases the reader's lock on the stream. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock) + */ + releaseLock(): void; +} +/** + * The **`ReadableStreamBYOBReader`** interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source. It is used for efficient copying from underlying sources where the data is delivered as an "anonymous" sequence of bytes, such as files. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader) + */ +declare class ReadableStreamBYOBReader { + constructor(stream: ReadableStream); + get closed(): Promise; + cancel(reason?: any): Promise; + /** + * The **`read()`** method of the ReadableStreamBYOBReader interface is used to read data into a view on a user-supplied buffer from an associated readable byte stream. A request for data will be satisfied from the stream's internal queues if there is any data present. If the stream queues are empty, the request may be supplied as a zero-copy transfer from the underlying byte source. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) + */ + read(view: T): Promise>; + /** + * The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream. After the lock is released, the reader is no longer active. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) + */ + releaseLock(): void; + readAtLeast(minElements: number, view: T): Promise>; +} +interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions { + min?: number; +} +interface ReadableStreamGetReaderOptions { + /** + * Creates a ReadableStreamBYOBReader and locks the stream to the new reader. + * + * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation. + */ + mode: "byob"; +} +/** + * The **`ReadableStreamBYOBRequest`** interface of the Streams API represents a "pull request" for data from an underlying source that will made as a zero-copy transfer to a consumer (bypassing the stream's internal queues). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) + */ +declare abstract class ReadableStreamBYOBRequest { + /** + * The **`view`** getter property of the ReadableStreamBYOBRequest interface returns the current view. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) + */ + get view(): Uint8Array | null; + /** + * The **`respond()`** method of the ReadableStreamBYOBRequest interface is used to signal to the associated readable byte stream that the specified number of bytes were written into the ReadableStreamBYOBRequest.view. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) + */ + respond(bytesWritten: number): void; + /** + * The **`respondWithNewView()`** method of the ReadableStreamBYOBRequest interface specifies a new view that the consumer of the associated readable byte stream should write to instead of ReadableStreamBYOBRequest.view. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) + */ + respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; + get atLeast(): number | null; +} +/** + * The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue. Default controllers are for streams that are not byte streams. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController) + */ +declare abstract class ReadableStreamDefaultController { + /** + * The **`desiredSize`** read-only property of the ReadableStreamDefaultController interface returns the desired size required to fill the stream's internal queue. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize) + */ + get desiredSize(): number | null; + /** + * The **`close()`** method of the ReadableStreamDefaultController interface closes the associated stream. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close) + */ + close(): void; + /** + * The **`enqueue()`** method of the ReadableStreamDefaultController interface enqueues a given chunk in the associated stream. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue) + */ + enqueue(chunk?: R): void; + /** + * The **`error()`** method of the ReadableStreamDefaultController interface causes any future interactions with the associated stream to error. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error) + */ + error(reason: any): void; +} +/** + * The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream. It allows control of the state and internal queue of a ReadableStream with an underlying byte source, and enables efficient zero-copy transfer of data from the underlying source to a consumer when the stream's internal queue is empty. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController) + */ +declare abstract class ReadableByteStreamController { + /** + * The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or null if there are no pending requests. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest) + */ + get byobRequest(): ReadableStreamBYOBRequest | null; + /** + * The **`desiredSize`** read-only property of the ReadableByteStreamController interface returns the number of bytes required to fill the stream's internal queue to its "desired size". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize) + */ + get desiredSize(): number | null; + /** + * The **`close()`** method of the ReadableByteStreamController interface closes the associated stream. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close) + */ + close(): void; + /** + * The **`enqueue()`** method of the ReadableByteStreamController interface enqueues a given chunk on the associated readable byte stream (the chunk is transferred into the stream's internal queues). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue) + */ + enqueue(chunk: ArrayBuffer | ArrayBufferView): void; + /** + * The **`error()`** method of the ReadableByteStreamController interface causes any future interactions with the associated stream to error with the specified reason. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error) + */ + error(reason: any): void; +} +/** + * The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController) + */ +declare abstract class WritableStreamDefaultController { + /** + * The read-only **`signal`** property of the WritableStreamDefaultController interface returns the AbortSignal associated with the controller. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal) + */ + get signal(): AbortSignal; + /** + * The **`error()`** method of the WritableStreamDefaultController interface causes any future interactions with the associated stream to error. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error) + */ + error(reason?: any): void; +} +/** + * The **`TransformStreamDefaultController`** interface of the Streams API provides methods to manipulate the associated ReadableStream and WritableStream. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController) + */ +declare abstract class TransformStreamDefaultController { + /** + * The **`desiredSize`** read-only property of the TransformStreamDefaultController interface returns the desired size to fill the queue of the associated ReadableStream. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize) + */ + get desiredSize(): number | null; + /** + * The **`enqueue()`** method of the TransformStreamDefaultController interface enqueues the given chunk in the readable side of the stream. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue) + */ + enqueue(chunk?: O): void; + /** + * The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream. Any further interactions with it will fail with the given error message, and any chunks in the queue will be discarded. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error) + */ + error(reason: any): void; + /** + * The **`terminate()`** method of the TransformStreamDefaultController interface closes the readable side and errors the writable side of the stream. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate) + */ + terminate(): void; +} +interface ReadableWritablePair { + readable: ReadableStream; + /** + * Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use. + * + * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. + */ + writable: WritableStream; +} +/** + * The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream) + */ +declare class WritableStream { + constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy); + /** + * The **`locked`** read-only property of the WritableStream interface returns a boolean indicating whether the WritableStream is locked to a writer. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked) + */ + get locked(): boolean; + /** + * The **`abort()`** method of the WritableStream interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort) + */ + abort(reason?: any): Promise; + /** + * The **`close()`** method of the WritableStream interface closes the associated stream. All chunks written before this method is called are sent before the returned promise is fulfilled. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close) + */ + close(): Promise; + /** + * The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance. While the stream is locked, no other writer can be acquired until this one is released. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter) + */ + getWriter(): WritableStreamDefaultWriter; +} +/** + * The **`WritableStreamDefaultWriter`** interface of the Streams API is the object returned by WritableStream.getWriter() and once created locks the writer to the WritableStream ensuring that no other streams can write to the underlying sink. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter) + */ +declare class WritableStreamDefaultWriter { + constructor(stream: WritableStream); + /** + * The **`closed`** read-only property of the WritableStreamDefaultWriter interface returns a Promise that fulfills if the stream becomes closed, or rejects if the stream errors or the writer's lock is released. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed) + */ + get closed(): Promise; + /** + * The **`ready`** read-only property of the WritableStreamDefaultWriter interface returns a Promise that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready) + */ + get ready(): Promise; + /** + * The **`desiredSize`** read-only property of the WritableStreamDefaultWriter interface returns the desired size required to fill the stream's internal queue. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize) + */ + get desiredSize(): number | null; + /** + * The **`abort()`** method of the WritableStreamDefaultWriter interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort) + */ + abort(reason?: any): Promise; + /** + * The **`close()`** method of the WritableStreamDefaultWriter interface closes the associated writable stream. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close) + */ + close(): Promise; + /** + * The **`write()`** method of the WritableStreamDefaultWriter interface writes a passed chunk of data to a WritableStream and its underlying sink, then returns a Promise that resolves to indicate the success or failure of the write operation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write) + */ + write(chunk?: W): Promise; + /** + * The **`releaseLock()`** method of the WritableStreamDefaultWriter interface releases the writer's lock on the corresponding stream. After the lock is released, the writer is no longer active. If the associated stream is errored when the lock is released, the writer will appear errored in the same way from now on; otherwise, the writer will appear closed. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock) + */ + releaseLock(): void; +} +/** + * The **`TransformStream`** interface of the Streams API represents a concrete implementation of the pipe chain transform stream concept. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream) + */ +declare class TransformStream { + constructor(transformer?: Transformer, writableStrategy?: QueuingStrategy, readableStrategy?: QueuingStrategy); + /** + * The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this TransformStream. This stream emits the transformed output data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable) + */ + get readable(): ReadableStream; + /** + * The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this TransformStream. This stream accepts input data that will be transformed and emitted to the readable stream. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable) + */ + get writable(): WritableStream; +} +declare class FixedLengthStream extends IdentityTransformStream { + constructor(expectedLength: number | bigint, queuingStrategy?: IdentityTransformStreamQueuingStrategy); +} +declare class IdentityTransformStream extends TransformStream { + constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy); +} +interface IdentityTransformStreamQueuingStrategy { + highWaterMark?: (number | bigint); +} +interface ReadableStreamValuesOptions { + preventCancel?: boolean; +} +/** + * The **`CompressionStream`** interface of the Compression Streams API compresses a stream of data. It implements the same shape as a TransformStream, allowing it to be used in ReadableStream.pipeThrough() and similar methods. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream) + */ +declare class CompressionStream extends TransformStream { + constructor(format: "gzip" | "deflate" | "deflate-raw"); +} +/** + * The **`DecompressionStream`** interface of the Compression Streams API decompresses a stream of data. It implements the same shape as a TransformStream, allowing it to be used in ReadableStream.pipeThrough() and similar methods. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream) + */ +declare class DecompressionStream extends TransformStream { + constructor(format: "gzip" | "deflate" | "deflate-raw"); +} +/** + * The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding. It is the streaming equivalent of TextEncoder. It implements the same shape as a TransformStream, allowing it to be used in ReadableStream.pipeThrough() and similar methods. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream) + */ +declare class TextEncoderStream extends TransformStream { + constructor(); + get encoding(): string; +} +/** + * The **`TextDecoderStream`** interface of the Encoding API converts a stream of text in a binary encoding, such as UTF-8 etc., to a stream of strings. It is the streaming equivalent of TextDecoder. It implements the same shape as a TransformStream, allowing it to be used in ReadableStream.pipeThrough() and similar methods. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream) + */ +declare class TextDecoderStream extends TransformStream { + constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); + get encoding(): string; + get fatal(): boolean; + get ignoreBOM(): boolean; +} +interface TextDecoderStreamTextDecoderStreamInit { + fatal?: boolean; + ignoreBOM?: boolean; +} +/** + * The **`ByteLengthQueuingStrategy`** interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy) + */ +declare class ByteLengthQueuingStrategy implements QueuingStrategy { + constructor(init: QueuingStrategyInit); + /** + * The read-only **`ByteLengthQueuingStrategy.highWaterMark`** property returns the total number of bytes that can be contained in the internal queue before backpressure is applied. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark) + */ + get highWaterMark(): number; + /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */ + get size(): (chunk?: any) => number; +} +/** + * The **`CountQueuingStrategy`** interface of the Streams API provides a built-in chunk counting queuing strategy that can be used when constructing streams. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy) + */ +declare class CountQueuingStrategy implements QueuingStrategy { + constructor(init: QueuingStrategyInit); + /** + * The read-only **`CountQueuingStrategy.highWaterMark`** property returns the total number of chunks that can be contained in the internal queue before backpressure is applied. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark) + */ + get highWaterMark(): number; + /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */ + get size(): (chunk?: any) => number; +} +interface QueuingStrategyInit { + /** + * Creates a new ByteLengthQueuingStrategy with the provided high water mark. + * + * Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw. + */ + highWaterMark: number; +} +interface TracePreviewInfo { + id: string; + slug: string; + name: string; +} +interface ScriptVersion { + id?: string; + tag?: string; + message?: string; +} +declare abstract class TailEvent extends ExtendableEvent { + readonly events: TraceItem[]; + readonly traces: TraceItem[]; +} +interface TraceItem { + readonly event: (TraceItemFetchEventInfo | TraceItemJsRpcEventInfo | TraceItemConnectEventInfo | TraceItemScheduledEventInfo | TraceItemAlarmEventInfo | TraceItemQueueEventInfo | TraceItemEmailEventInfo | TraceItemTailEventInfo | TraceItemCustomEventInfo | TraceItemHibernatableWebSocketEventInfo) | null; + readonly eventTimestamp: number | null; + readonly logs: TraceLog[]; + readonly exceptions: TraceException[]; + readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[]; + readonly scriptName: string | null; + readonly entrypoint?: string; + readonly scriptVersion?: ScriptVersion; + readonly dispatchNamespace?: string; + readonly scriptTags?: string[]; + readonly tailAttributes?: Record; + readonly preview?: TracePreviewInfo; + readonly durableObjectId?: string; + readonly outcome: string; + readonly executionModel: string; + readonly truncated: boolean; + readonly cpuTime: number; + readonly wallTime: number; +} +interface TraceItemAlarmEventInfo { + readonly scheduledTime: Date; +} +interface TraceItemConnectEventInfo { +} +interface TraceItemCustomEventInfo { +} +interface TraceItemScheduledEventInfo { + readonly scheduledTime: number; + readonly cron: string; +} +interface TraceItemQueueEventInfo { + readonly queue: string; + readonly batchSize: number; +} +interface TraceItemEmailEventInfo { + readonly mailFrom: string; + readonly rcptTo: string; + readonly rawSize: number; +} +interface TraceItemTailEventInfo { + readonly consumedEvents: TraceItemTailEventInfoTailItem[]; +} +interface TraceItemTailEventInfoTailItem { + readonly scriptName: string | null; +} +interface TraceItemFetchEventInfo { + readonly response?: TraceItemFetchEventInfoResponse; + readonly request: TraceItemFetchEventInfoRequest; +} +interface TraceItemFetchEventInfoRequest { + readonly cf?: any; + readonly headers: Record; + readonly method: string; + readonly url: string; + getUnredacted(): TraceItemFetchEventInfoRequest; +} +interface TraceItemFetchEventInfoResponse { + readonly status: number; +} +interface TraceItemJsRpcEventInfo { + readonly rpcMethod: string; +} +interface TraceItemHibernatableWebSocketEventInfo { + readonly getWebSocketEvent: TraceItemHibernatableWebSocketEventInfoMessage | TraceItemHibernatableWebSocketEventInfoClose | TraceItemHibernatableWebSocketEventInfoError; +} +interface TraceItemHibernatableWebSocketEventInfoMessage { + readonly webSocketEventType: string; +} +interface TraceItemHibernatableWebSocketEventInfoClose { + readonly webSocketEventType: string; + readonly code: number; + readonly wasClean: boolean; +} +interface TraceItemHibernatableWebSocketEventInfoError { + readonly webSocketEventType: string; +} +interface TraceLog { + readonly timestamp: number; + readonly level: string; + readonly message: any; + readonly errorInfo?: (TraceLogErrorInfo | null)[]; +} +interface TraceLogErrorInfo { + name: string; + message: string; + stack?: string; +} +interface TraceException { + readonly timestamp: number; + readonly message: string; + readonly name: string; + readonly stack?: string; +} +interface TraceDiagnosticChannelEvent { + readonly timestamp: number; + readonly channel: string; + readonly message: any; +} +interface TraceMetrics { + readonly cpuTime: number; + readonly wallTime: number; +} +interface UnsafeTraceMetrics { + fromTrace(item: TraceItem): TraceMetrics; +} +/** + * The **`URL`** interface is used to parse, construct, normalize, and encode URLs. It works by providing properties which allow you to easily read and modify the components of a URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL) + */ +declare class URL { + constructor(url: string | URL, base?: string | URL); + /** + * The **`origin`** read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin) + */ + get origin(): string; + /** + * The **`href`** property of the URL interface is a string containing the whole URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) + */ + get href(): string; + /** + * The **`href`** property of the URL interface is a string containing the whole URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) + */ + set href(value: string); + /** + * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final ":". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) + */ + get protocol(): string; + /** + * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final ":". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) + */ + set protocol(value: string); + /** + * The **`username`** property of the URL interface is a string containing the username component of the URL. If the URL does not have a username, this property contains an empty string, "". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) + */ + get username(): string; + /** + * The **`username`** property of the URL interface is a string containing the username component of the URL. If the URL does not have a username, this property contains an empty string, "". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) + */ + set username(value: string); + /** + * The **`password`** property of the URL interface is a string containing the password component of the URL. If the URL does not have a password, this property contains an empty string, "". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) + */ + get password(): string; + /** + * The **`password`** property of the URL interface is a string containing the password component of the URL. If the URL does not have a password, this property contains an empty string, "". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) + */ + set password(value: string); + /** + * The **`host`** property of the URL interface is a string containing the host, which is the hostname, and then, if the port of the URL is nonempty, a ":", followed by the port of the URL. If the URL does not have a hostname, this property contains an empty string, "". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) + */ + get host(): string; + /** + * The **`host`** property of the URL interface is a string containing the host, which is the hostname, and then, if the port of the URL is nonempty, a ":", followed by the port of the URL. If the URL does not have a hostname, this property contains an empty string, "". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) + */ + set host(value: string); + /** + * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL. If the URL does not have a hostname, this property contains an empty string, "". IPv4 and IPv6 addresses are normalized, such as stripping leading zeros, and domain names are converted to IDN. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) + */ + get hostname(): string; + /** + * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL. If the URL does not have a hostname, this property contains an empty string, "". IPv4 and IPv6 addresses are normalized, such as stripping leading zeros, and domain names are converted to IDN. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) + */ + set hostname(value: string); + /** + * The **`port`** property of the URL interface is a string containing the port number of the URL. If the port is the default for the protocol (80 for ws: and http:, 443 for wss: and https:, and 21 for ftp:), this property contains an empty string, "". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) + */ + get port(): string; + /** + * The **`port`** property of the URL interface is a string containing the port number of the URL. If the port is the default for the protocol (80 for ws: and http:, 443 for wss: and https:, and 21 for ftp:), this property contains an empty string, "". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) + */ + set port(value: string); + /** + * The **`pathname`** property of the URL interface represents a location in a hierarchical structure. It is a string constructed from a list of path segments, each of which is prefixed by a / character. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) + */ + get pathname(): string; + /** + * The **`pathname`** property of the URL interface represents a location in a hierarchical structure. It is a string constructed from a list of path segments, each of which is prefixed by a / character. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) + */ + set pathname(value: string); + /** + * The **`search`** property of the URL interface is a search string, also called a query string, that is a string containing a "?" followed by the parameters of the URL. If the URL does not have a search query, this property contains an empty string, "". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) + */ + get search(): string; + /** + * The **`search`** property of the URL interface is a search string, also called a query string, that is a string containing a "?" followed by the parameters of the URL. If the URL does not have a search query, this property contains an empty string, "". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) + */ + set search(value: string); + /** + * The **`hash`** property of the URL interface is a string containing a "#" followed by the fragment identifier of the URL. If the URL does not have a fragment identifier, this property contains an empty string, "". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) + */ + get hash(): string; + /** + * The **`hash`** property of the URL interface is a string containing a "#" followed by the fragment identifier of the URL. If the URL does not have a fragment identifier, this property contains an empty string, "". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) + */ + set hash(value: string); + /** + * The **`searchParams`** read-only property of the URL interface returns a URLSearchParams object allowing access to the GET decoded query arguments contained in the URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams) + */ + get searchParams(): URLSearchParams; + /** + * The **`toJSON()`** method of the URL interface returns a string containing a serialized version of the URL, although in practice it seems to have the same effect as URL.toString(). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON) + */ + toJSON(): string; + /*function toString() { [native code] }*/ + toString(): string; + /** + * The **`URL.canParse()`** static method of the URL interface returns a boolean indicating whether or not an absolute URL, or a relative URL combined with a base URL, are parsable and valid. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) + */ + static canParse(url: string, base?: string): boolean; + /** + * The **`URL.parse()`** static method of the URL interface returns a newly created URL object representing the URL defined by the parameters. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static) + */ + static parse(url: string, base?: string): URL | null; + /** + * The **`createObjectURL()`** static method of the URL interface creates a string containing a blob URL pointing to the object given in the parameter. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static) + */ + static createObjectURL(object: File | Blob): string; + /** + * The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling URL.createObjectURL(). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static) + */ + static revokeObjectURL(object_url: string): void; +} +/** + * The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) + */ +declare class URLSearchParams { + constructor(init?: (Iterable> | Record | string)); + /** + * The **`size`** read-only property of the URLSearchParams interface indicates the total number of search parameter entries. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size) + */ + get size(): number; + /** + * The **`append()`** method of the URLSearchParams interface appends a specified key/value pair as a new search parameter. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append) + */ + append(name: string, value: string): void; + /** + * The **`delete()`** method of the URLSearchParams interface deletes specified parameters and their associated value(s) from the list of all search parameters. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete) + */ + delete(name: string, value?: string): void; + /** + * The **`get()`** method of the URLSearchParams interface returns the first value associated to the given search parameter. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get) + */ + get(name: string): string | null; + /** + * The **`getAll()`** method of the URLSearchParams interface returns all the values associated with a given search parameter as an array. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll) + */ + getAll(name: string): string[]; + /** + * The **`has()`** method of the URLSearchParams interface returns a boolean value that indicates whether the specified parameter is in the search parameters. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has) + */ + has(name: string, value?: string): boolean; + /** + * The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value. If there were several matching values, this method deletes the others. If the search parameter doesn't exist, this method creates it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set) + */ + set(name: string, value: string): void; + /** + * The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns undefined. Key/value pairs are sorted by the values of the UTF-16 code units of the keys. This method uses a stable sorting algorithm (i.e., the relative order between key/value pairs with equal keys will be preserved). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort) + */ + sort(): void; + entries(): IterableIterator<[ + key: string, + value: string + ]>; + keys(): IterableIterator; + values(): IterableIterator; + forEach(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void; + /*function toString() { [native code] }*/ + toString(): string; + [Symbol.iterator](): IterableIterator<[ + key: string, + value: string + ]>; +} +/** + * The **`URLPattern`** interface of the URL Pattern API matches URLs or parts of URLs against a pattern. The pattern can contain capturing groups that extract parts of the matched URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern) + */ +declare class URLPattern { + constructor(input?: (string | URLPatternInit), baseURL?: (string | URLPatternOptions), patternOptions?: URLPatternOptions); + /** + * The **`protocol`** read-only property of the URLPattern interface is a string containing the pattern used to match the protocol part of a URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/protocol) + */ + get protocol(): string; + /** + * The **`username`** read-only property of the URLPattern interface is a string containing the pattern used to match the username part of a URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/username) + */ + get username(): string; + /** + * The **`password`** read-only property of the URLPattern interface is a string containing the pattern used to match the password part of a URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/password) + */ + get password(): string; + /** + * The **`hostname`** read-only property of the URLPattern interface is a string containing the pattern used to match the hostname part of a URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hostname) + */ + get hostname(): string; + /** + * The **`port`** read-only property of the URLPattern interface is a string containing the pattern used to match the port part of a URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/port) + */ + get port(): string; + /** + * The **`pathname`** read-only property of the URLPattern interface is a string containing the pattern used to match the pathname part of a URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/pathname) + */ + get pathname(): string; + /** + * The **`search`** read-only property of the URLPattern interface is a string containing the pattern used to match the search part of a URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/search) + */ + get search(): string; + /** + * The **`hash`** read-only property of the URLPattern interface is a string containing the pattern used to match the fragment part of a URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hash) + */ + get hash(): string; + /** + * The **`hasRegExpGroups`** read-only property of the URLPattern interface is a boolean indicating whether or not any of the URLPattern components contain regular expression capturing groups. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hasRegExpGroups) + */ + get hasRegExpGroups(): boolean; + /** + * The **`test()`** method of the URLPattern interface takes a URL string or object of URL parts, and returns a boolean indicating if the given input matches the current pattern. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/test) + */ + test(input?: (string | URLPatternInit), baseURL?: string): boolean; + /** + * The **`exec()`** method of the URLPattern interface takes a URL or object of URL parts, and returns either an object containing the results of matching the URL to the pattern, or null if the URL does not match the pattern. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/exec) + */ + exec(input?: (string | URLPatternInit), baseURL?: string): URLPatternResult | null; +} +interface URLPatternInit { + protocol?: string; + username?: string; + password?: string; + hostname?: string; + port?: string; + pathname?: string; + search?: string; + hash?: string; + baseURL?: string; +} +interface URLPatternComponentResult { + input: string; + groups: Record; +} +interface URLPatternResult { + inputs: (string | URLPatternInit)[]; + protocol: URLPatternComponentResult; + username: URLPatternComponentResult; + password: URLPatternComponentResult; + hostname: URLPatternComponentResult; + port: URLPatternComponentResult; + pathname: URLPatternComponentResult; + search: URLPatternComponentResult; + hash: URLPatternComponentResult; +} +interface URLPatternOptions { + ignoreCase?: boolean; +} +/** + * A **`CloseEvent`** is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent) + */ +declare class CloseEvent extends Event { + constructor(type: string, initializer?: CloseEventInit); + /** + * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code) + */ + readonly code: number; + /** + * The **`reason`** read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason) + */ + readonly reason: string; + /** + * The **`wasClean`** read-only property of the CloseEvent interface returns true if the connection closed cleanly. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean) + */ + readonly wasClean: boolean; +} +interface CloseEventInit { + bubbles?: boolean; + cancelable?: boolean; + composed?: boolean; + code?: number; + reason?: string; + wasClean?: boolean; +} +type WebSocketEventMap = { + close: CloseEvent; + message: MessageEvent; + open: Event; + error: ErrorEvent; +}; +/** + * The **`WebSocket`** object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket) + */ +declare var WebSocket: { + prototype: WebSocket; + new (url: string, protocols?: (string[] | string)): WebSocket; + readonly READY_STATE_CONNECTING: number; + readonly CONNECTING: number; + readonly READY_STATE_OPEN: number; + readonly OPEN: number; + readonly READY_STATE_CLOSING: number; + readonly CLOSING: number; + readonly READY_STATE_CLOSED: number; + readonly CLOSED: number; +}; +/** + * The **`WebSocket`** object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket) + */ +interface WebSocket extends EventTarget { + accept(options?: WebSocketAcceptOptions): void; + /** + * The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of bufferedAmount by the number of bytes needed to contain the data. If the data can't be sent (for example, because it needs to be buffered but the buffer is full), the socket is closed automatically. The browser will throw an exception if you call send() when the connection is in the CONNECTING state. If you call send() when the connection is in the CLOSING or CLOSED states, the browser will silently discard the data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send) + */ + send(message: (ArrayBuffer | ArrayBufferView) | string): void; + /** + * The **`WebSocket.close()`** method closes the WebSocket connection or connection attempt, if any. If the connection is already CLOSED, this method does nothing. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close) + */ + close(code?: number, reason?: string): void; + serializeAttachment(attachment: any): void; + deserializeAttachment(): any | null; + /** + * The **`WebSocket.readyState`** read-only property returns the current state of the WebSocket connection. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState) + */ + readyState: number; + /** + * The **`WebSocket.url`** read-only property returns the absolute URL of the WebSocket as resolved by the constructor. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url) + */ + url: string | null; + /** + * The **`WebSocket.protocol`** read-only property returns the name of the sub-protocol the server selected; this will be one of the strings specified in the protocols parameter when creating the WebSocket object, or the empty string if no connection is established. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol) + */ + protocol: string | null; + /** + * The **`WebSocket.extensions`** read-only property returns the extensions selected by the server. This is currently only the empty string or a list of extensions as negotiated by the connection. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions) + */ + extensions: string | null; + /** + * The **`WebSocket.binaryType`** property controls the type of binary data being received over the WebSocket connection. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/binaryType) + */ + binaryType: "blob" | "arraybuffer"; +} +interface WebSocketAcceptOptions { + /** + * When set to `true`, receiving a server-initiated WebSocket Close frame will not + * automatically send a reciprocal Close frame, leaving the connection in a half-open + * state. This is useful for proxying scenarios where you need to coordinate closing + * both sides independently. Defaults to `false` when the + * `no_web_socket_half_open_by_default` compatibility flag is enabled. + */ + allowHalfOpen?: boolean; +} +declare const WebSocketPair: { + new (): { + 0: WebSocket; + 1: WebSocket; + }; +}; +interface SqlStorage { + exec>(query: string, ...bindings: any[]): SqlStorageCursor; + get databaseSize(): number; + Cursor: typeof SqlStorageCursor; + Statement: typeof SqlStorageStatement; +} +declare abstract class SqlStorageStatement { +} +type SqlStorageValue = ArrayBuffer | string | number | null; +declare abstract class SqlStorageCursor> { + next(): { + done?: false; + value: T; + } | { + done: true; + value?: never; + }; + toArray(): T[]; + one(): T; + raw(): IterableIterator; + columnNames: string[]; + get rowsRead(): number; + get rowsWritten(): number; + [Symbol.iterator](): IterableIterator; +} +interface Socket { + get readable(): ReadableStream; + get writable(): WritableStream; + get closed(): Promise; + get opened(): Promise; + get upgraded(): boolean; + get secureTransport(): "on" | "off" | "starttls"; + close(): Promise; + startTls(options?: TlsOptions): Socket; +} +interface SocketOptions { + secureTransport?: string; + allowHalfOpen: boolean; + highWaterMark?: (number | bigint); +} +interface SocketAddress { + hostname: string; + port: number; +} +interface TlsOptions { + expectedServerHostname?: string; +} +interface SocketInfo { + remoteAddress?: string; + localAddress?: string; +} +/** + * The **`EventSource`** interface is web content's interface to server-sent events. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) + */ +declare class EventSource extends EventTarget { + constructor(url: string, init?: EventSourceEventSourceInit); + /** + * The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the EventSource.readyState attribute to 2 (closed). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close) + */ + close(): void; + /** + * The **`url`** read-only property of the EventSource interface returns a string representing the URL of the source. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url) + */ + get url(): string; + /** + * The **`withCredentials`** read-only property of the EventSource interface returns a boolean value indicating whether the EventSource object was instantiated with CORS credentials set. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials) + */ + get withCredentials(): boolean; + /** + * The **`readyState`** read-only property of the EventSource interface returns a number representing the state of the connection. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState) + */ + get readyState(): number; + /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */ + get onopen(): any | null; + /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */ + set onopen(value: any | null); + /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */ + get onmessage(): any | null; + /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */ + set onmessage(value: any | null); + /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */ + get onerror(): any | null; + /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */ + set onerror(value: any | null); + static readonly CONNECTING: number; + static readonly OPEN: number; + static readonly CLOSED: number; + static from(stream: ReadableStream): EventSource; +} +interface EventSourceEventSourceInit { + withCredentials?: boolean; + fetcher?: Fetcher; +} +interface ExecOutput { + readonly stdout: ArrayBuffer; + readonly stderr: ArrayBuffer; + readonly exitCode: number; +} +interface ContainerExecOptions { + cwd?: string; + env?: Record; + user?: string; + signal?: AbortSignal; + pty?: boolean | ContainerExecPtyOptions; + stdin?: ReadableStream | "pipe"; + stdout?: "pipe" | "ignore"; + stderr?: "pipe" | "ignore" | "combined"; +} +interface ContainerExecPtyOptions { + cols?: number; + rows?: number; +} +interface ExecProcess { + readonly stdin: WritableStream | null; + readonly stdout: ReadableStream | null; + readonly stderr: ReadableStream | null; + readonly pid: number; + readonly isPty: boolean; + readonly exitCode: Promise; + output(): Promise; + kill(signal?: number): void; + resize(cols: number, rows: number): void; +} +interface Container { + get running(): boolean; + get images(): Record; + start(options?: ContainerStartupOptions): void; + monitor(): Promise; + destroy(error?: any): Promise; + signal(signo: number): void; + getTcpPort(port: number): Fetcher; + setInactivityTimeout(durationMs: number | bigint): Promise; + interceptOutboundHttp(addr: string, binding: Fetcher): Promise; + interceptAllOutboundHttp(binding: Fetcher): Promise; + snapshotContainer(options: ContainerSnapshotOptions): Promise; + interceptOutboundHttps(addr: string, binding: Fetcher): Promise; + exec(cmd: string[], options?: ContainerExecOptions): Promise; + inspect(): Promise; +} +interface ContainerDirectorySnapshot { + id: string; + size: number; + dir: string; + name?: string; +} +type ContainerDirectorySnapshotRestoreParams = { + snapshot: ContainerDirectorySnapshot; + mountPoint?: string; +} | { + snapshot?: undefined; + mountPoint: string; +}; +interface ContainerSnapshot { + id: string; + size: number; + name?: string; +} +interface ContainerSnapshotRestoreParams { + id: string; +} +interface ContainerSnapshotOptions { + name?: string; +} +type ContainerStartupOptions = { + entrypoint?: string[]; + enableInternet: boolean; + env?: Record; + instance?: "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | ContainerStartResources; + labels?: Record; + directorySnapshots?: ContainerDirectorySnapshotRestoreParams[]; +} & ({ + image: string; + containerSnapshot?: never; +} | { + image?: never; + containerSnapshot?: ContainerSnapshotRestoreParams; +}); +interface ContainerInfo { + labels: Record; + image: string; +} +interface ContainerStartResources { + vcpu: number; + memoryMib: number; + diskMb: number; +} +/** + * The **`MessagePort`** interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort) + */ +declare abstract class MessagePort extends EventTarget { + /** + * The **`postMessage()`** method of the MessagePort interface sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage) + */ + postMessage(data?: any, options?: (any[] | MessagePortPostMessageOptions)): void; + /** + * The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active. This stops the flow of messages to that port. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close) + */ + close(): void; + /** + * The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port. This method is only needed when using EventTarget.addEventListener; it is implied when using onmessage. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start) + */ + start(): void; + get onmessage(): any | null; + set onmessage(value: any | null); +} +/** + * The **`MessageChannel`** interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel) + */ +declare class MessageChannel { + constructor(); + /** + * The **`port1`** read-only property of the MessageChannel interface returns the first port of the message channel — the port attached to the context that originated the channel. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1) + */ + readonly port1: MessagePort; + /** + * The **`port2`** read-only property of the MessageChannel interface returns the second port of the message channel — the port attached to the context at the other end of the channel, which the message is initially sent to. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2) + */ + readonly port2: MessagePort; +} +interface MessagePortPostMessageOptions { + transfer?: any[]; +} +type LoopbackForExport Rpc.EntrypointBranded) | ExportedHandler | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? LoopbackServiceStub> : T extends new (...args: any[]) => Rpc.DurableObjectBranded ? LoopbackDurableObjectClass> : T extends ExportedHandler ? LoopbackServiceStub : undefined; +type LoopbackServiceStub = Fetcher & (T extends CloudflareWorkersModule.WorkerEntrypoint ? (opts: { + props?: Props; +}) => Fetcher : (opts: { + props?: any; +}) => Fetcher); +type LoopbackDurableObjectClass = DurableObjectClass & (T extends CloudflareWorkersModule.DurableObject ? (opts: { + props?: Props; +}) => DurableObjectClass : (opts: { + props?: any; +}) => DurableObjectClass); +interface LoopbackDurableObjectNamespace extends DurableObjectNamespace { +} +interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace { +} +interface SyncKvStorage { + get(key: string): T | undefined; + list(options?: SyncKvListOptions): Iterable<[ + string, + T + ]>; + put(key: string, value: T): void; + delete(key: string): boolean; +} +interface SyncKvListOptions { + start?: string; + startAfter?: string; + end?: string; + prefix?: string; + reverse?: boolean; + limit?: number; +} +interface WorkerStub { + getEntrypoint(name?: string, options?: WorkerStubEntrypointOptions): Fetcher; + getDurableObjectClass(name?: string, options?: WorkerStubEntrypointOptions): DurableObjectClass; +} +interface WorkerStubEntrypointOptions { + props?: any; + limits?: workerdResourceLimits; +} +interface WorkerLoader { + get(name: string | null, getCode: () => WorkerLoaderWorkerCode | Promise): WorkerStub; + load(code: WorkerLoaderWorkerCode): WorkerStub; +} +interface WorkerLoaderModule { + js?: string; + cjs?: string; + text?: string; + data?: ArrayBuffer; + json?: any; + py?: string; + wasm?: ArrayBuffer | ArrayBufferView | WebAssembly.Module; +} +interface WorkerLoaderWorkerCode { + compatibilityDate: string; + compatibilityFlags?: string[]; + allowExperimental?: boolean; + limits?: workerdResourceLimits; + mainModule: string; + modules: Record; + env?: any; + globalOutbound?: (Fetcher | null); + tails?: Fetcher[]; + streamingTails?: Fetcher[]; +} +interface workerdResourceLimits { + cpuMs?: number; + subRequests?: number; +} +/** +* The Workers runtime supports a subset of the Performance API, used to measure timing and performance, +* as well as timing of subrequests and other operations. +* +* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/) +*/ +declare abstract class Performance { + /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */ + get timeOrigin(): number; + /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */ + now(): number; + /** + * The **`toJSON()`** method of the Performance interface is a serializer; it returns a JSON representation of the Performance object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON) + */ + toJSON(): object; +} +interface Tracing { + enterSpan(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T; + startActiveSpan(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T; + startSpan(name: string): Span; + getActiveSpan(): Span | undefined; + Span: typeof Span; +} +declare abstract class Span { + get isTraced(): boolean; + setAttribute(key: string, value: boolean | number | string): this; + setAttributes(attributes: Record): this; + recordException(exception: string | { + code: string | number; + name?: string; + message?: string; + stack?: string; + } | { + code?: string | number; + name: string; + message?: string; + stack?: string; + } | { + code?: string | number; + name?: string; + message: string; + stack?: string; + }): void; + end(): void; +} +/** + * Represents the identity of a user authenticated via Cloudflare Access. + * This matches the result of calling /cdn-cgi/access/get-identity. + * + * The exact structure of the returned object depends on the identity provider + * configuration for the Access application. The fields below represent commonly + * available properties, but additional provider-specific fields may be present. + */ +interface CloudflareAccessIdentity extends Record { + /** The user's email address, if available from the identity provider. */ + email?: string; + /** The user's display name. */ + name?: string; + /** The user's unique identifier. */ + user_uuid?: string; + /** The Cloudflare account ID. */ + account_id?: string; + /** Login timestamp (Unix epoch seconds). */ + iat?: number; + /** The user's IP address at authentication time. */ + ip?: string; + /** Authentication methods used (e.g., "pwd"). */ + amr?: string[]; + /** Identity provider information. */ + idp?: { + id: string; + type: string; + }; + /** Geographic information about where the user authenticated. */ + geo?: { + country: string; + }; + /** Group memberships from the identity provider. */ + groups?: Array<{ + id: string; + name: string; + email?: string; + }>; + /** Device posture check results, keyed by check ID. */ + devicePosture?: Record; + /** True if the user connected via Cloudflare WARP. */ + is_warp?: boolean; + /** True if the user is authenticated via Cloudflare Gateway. */ + is_gateway?: boolean; +} +// ============================================================================ +// Agent Memory +// +// Public type surface for user Workers binding to an Agent Memory namespace. +// ============================================================================ +/** Memory type — every memory is classified into exactly one. */ +type AgentMemoryMemoryType = "fact" | "event" | "instruction" | "task"; +/** Search intensity for recall. */ +type AgentMemoryThinkingLevel = "low" | "medium" | "high"; +/** Response verbosity for recall. */ +type AgentMemoryResponseLength = "short" | "medium" | "long"; +/** A conversation message passed to ingest(). */ +interface AgentMemoryMessage { + role: "system" | "user" | "assistant"; + content: string; + /** Optional message timestamp. */ + timestamp?: Date; +} +/** Raw memory content passed to remember(). */ +interface AgentMemoryIncomingMemory { + /** Raw memory content. The service classifies and summarizes automatically. */ + content: string; + /** Optional session identifier to associate with this memory. */ + sessionId?: string | null | undefined; +} +/** A stored memory returned from remember(), get(), and delete(). */ +interface AgentMemoryMemory { + /** Memory ID. */ + id: string; + /** Memory type. */ + type: AgentMemoryMemoryType; + /** Text summary. */ + summary: string; + /** Memory text. */ + content: string; + /** Session that created this memory. */ + sessionId: string | null; + /** Memory creation time. */ + createdAt: Date; + /** Memory last-update time. */ + updatedAt: Date; +} +/** Single entry in a list() response. Same shape as Memory minus full content. */ +type AgentMemoryMemoryListEntry = Omit; +/** A scored memory candidate in a recall result. */ +interface AgentMemoryScoredCandidate { + /** Candidate ID. */ + id: string; + /** Text summary. */ + summary: string; + /** Session that created this candidate, when known. */ + sessionId: string | null; + /** Relevance score (higher is better). Comparable only within a single query. */ + score: number; +} +/** Options for the ingest() method. */ +interface AgentMemoryIngestOptions { + /** Session identifier to associate with memories created during ingestion. */ + sessionId?: string | null | undefined; +} +/** Options for the getSummary() method. */ +interface AgentMemoryGetSummaryOptions { + /** Session identifier to retrieve session summary for. */ + sessionId?: string | null | undefined; +} +/** Response from the getSummary() method. */ +interface AgentMemoryGetSummaryResponse { + /** Markdown summary. */ + summary: string; +} +/** + * Options for the recall() method. + * + * `referenceDate` accepts a Date object, an ISO-8601 date string + * (YYYY-MM-DD), or a full ISO-8601 datetime string. When provided, this + * date is used as "today" for resolving relative time references + * ("how many days ago", "last week") instead of the server's wall-clock time. + */ +interface AgentMemoryRecallOptions { + /** Recall intensity: "low" (default), "medium", or "high". */ + thinkingLevel?: AgentMemoryThinkingLevel; + /** Response verbosity: "short", "medium" (default), or "long". */ + responseLength?: AgentMemoryResponseLength; + /** Temporal anchor for date arithmetic. */ + referenceDate?: Date | string; +} +/** Response from the recall() method. */ +interface AgentMemoryRecallResult { + /** Number of memories retrieved. */ + count: number; + /** LLM-generated answer synthesizing the matching memories. */ + answer: string; + /** Matching memories ranked by relevance. */ + candidates: AgentMemoryScoredCandidate[]; +} +/** + * Options for the list() method. + * + * `cursor` is the opaque continuation token returned by the previous page; + * pass it back unchanged to fetch the next page. `sessionId` and `type` + * are exact-match filters; combining them is allowed. + */ +interface AgentMemoryListMemoriesOptions { + /** Maximum number of memories to return. Default 20, max 500. */ + limit?: number; + /** Opaque cursor from a previous page. */ + cursor?: string; + /** Exact-match session filter. */ + sessionId?: string; + /** Exact-match memory-type filter. */ + type?: AgentMemoryMemoryType; +} +/** Response from the list() method. */ +interface AgentMemoryListMemoriesResult { + memories: AgentMemoryMemoryListEntry[]; + /** Continuation cursor; absent when this page exhausted the result set. */ + cursor?: string; +} +/** + * A single Agent Memory profile, scoped to a profile name. + * + * Returned by {@link AgentMemoryNamespace.getProfile}. + */ +declare abstract class AgentMemoryProfile { + /** + * Retrieve a memory by ID. + * + * @param memoryId - ULID of the memory to retrieve. + * @throws if the memory does not exist. + */ + get(memoryId: string): Promise; + /** + * Delete a memory by ID. + * + * Removes the memory and any source messages linked by the memory's + * source message IDs. + * + * @param memoryId - ULID of the memory to delete. + * @throws if the memory does not exist. + */ + delete(memoryId: string): Promise; + /** + * Store a memory in this profile. The content is automatically classified, + * summarized, and indexed. + * + * @param memory - Raw memory content to persist. + */ + remember(memory: AgentMemoryIncomingMemory): Promise; + /** + * Extract memories from a conversation. + * + * @param messages - Conversation messages to extract memories from. + * @param options - Optional ingest options. + */ + ingest(messages: Iterable, options?: AgentMemoryIngestOptions): Promise; + /** + * Get a profile summary. + * + * @param options - Optional getSummary options. + */ + getSummary(options?: AgentMemoryGetSummaryOptions): Promise; + /** + * Recall memories in this profile. + * + * @param query - Recall query matched against memory content and keywords. + * @param options - Optional recall parameters. + * @returns Matching memories with relevance scores and a synthesized answer. + */ + recall(query: string, options?: AgentMemoryRecallOptions): Promise; + /** + * List active memories in this profile. + * + * Returns a paginated, filterable view of stored memories. Superseded + * versions are excluded. Use the returned `cursor` (when present) to + * fetch the next page. + * + * @param options - Optional pagination and filter options. + */ + list(options?: AgentMemoryListMemoriesOptions): Promise; + /** + * Soft-delete every memory and message in this profile that is tagged + * with `sessionId`. + * + * Idempotent: deleting a sessionId that has no rows is a no-op. + * + * @param sessionId - Session to delete. + */ + deleteSession(sessionId: string): Promise; +} +/** + * Namespace-level Agent Memory binding. + * + * Used as the type of an `env.MEMORY`-style binding backed by the Agent + * Memory product. + * + * @example + * ```ts + * export default { + * async fetch(_request: Request, env: Env): Promise { + * const profile = await env.MEMORY.getProfile("wrangler-e2e"); + * const summary = await profile.getSummary(); + * return Response.json(summary); + * }, + * }; + * ``` + */ +declare abstract class AgentMemoryNamespace { + /** + * Get a memory profile by name. Profiles are isolated by namespace and + * addressed by a compound key (namespaceId:profileName). + * + * @param profileName - Profile name (validated against naming rules). + * @returns RPC target for interacting with the profile. + */ + getProfile(profileName: string): Promise; + /** + * Soft-delete a profile and schedule deferred purge. Marks all + * memories and messages as deleted. + * + * @param profileName - Name of the profile to delete. + */ + deleteProfile(profileName: string): Promise; +} +// ============ AI Search Error Interfaces ============ +interface AiSearchInternalError extends Error { +} +interface AiSearchNotFoundError extends Error { +} +// ============ AI Search Common Types ============ +/** A single message in a conversation-style search or chat request. */ +type AiSearchMessage = { + role: 'system' | 'developer' | 'user' | 'assistant' | 'tool'; + content: string | null; +}; +/** + * Common shape for `ai_search_options` used by both single-instance and multi-instance requests. + * Contains retrieval, query rewrite, reranking, and cache sub-options. + */ +type AiSearchOptions = { + retrieval?: { + /** Which retrieval backend to use. Defaults to the instance's configured index_method. */ + retrieval_type?: 'vector' | 'keyword' | 'hybrid'; + /** Fusion method for combining vector + keyword results. */ + fusion_method?: 'max' | 'rrf'; + /** How keyword terms are combined: "and" = all terms must match, "or" = any term matches. */ + keyword_match_mode?: 'and' | 'or'; + /** Minimum similarity score (0-1) for a result to be included. Default 0.4. */ + match_threshold?: number; + /** Maximum number of results to return (1-50). Default 10. */ + max_num_results?: number; + /** Vectorize metadata filters applied to the search. */ + filters?: VectorizeVectorMetadataFilter; + /** Number of surrounding chunks to include for context (0-3). Default 0. */ + context_expansion?: number; + /** If true, return only item metadata without chunk text. */ + metadata_only?: boolean; + /** If true (default), return empty results on retrieval failure instead of throwing. */ + return_on_failure?: boolean; + /** Boost results by metadata field values. Max 3 entries. */ + boost_by?: Array<{ + field: string; + direction?: 'asc' | 'desc' | 'exists' | 'not_exists'; + }>; + [key: string]: unknown; + }; + query_rewrite?: { + enabled?: boolean; + model?: string; + rewrite_prompt?: string; + [key: string]: unknown; + }; + reranking?: { + enabled?: boolean; + model?: string; + /** Match threshold (0-1, default 0.4) */ + match_threshold?: number; + [key: string]: unknown; + }; + cache?: { + enabled?: boolean; + cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes'; + }; + [key: string]: unknown; +}; +// ============ AI Search Request Types ============ +/** + * Request body for single-instance search. + * Exactly one of `query` or `messages` must be provided. + */ +type AiSearchSearchRequest = { + /** Simple query string. */ + query: string; + messages?: never; + ai_search_options?: AiSearchOptions; +} | { + query?: never; + /** Conversation-style input. At least one user message with non-empty content is required. */ + messages: AiSearchMessage[]; + ai_search_options?: AiSearchOptions; +}; +type AiSearchChatCompletionsRequest = { + messages: AiSearchMessage[]; + model?: string; + stream?: boolean; + ai_search_options?: AiSearchOptions; + [key: string]: unknown; +}; +// ============ AI Search Multi-Instance Types (Namespace-Scoped) ============ +/** `ai_search_options` shape for multi-instance requests — requires `instance_ids`. */ +type AiSearchMultiSearchOptions = AiSearchOptions & { + /** Instance IDs to search across (1-10). */ + instance_ids: string[]; +}; +/** + * Request for searching across multiple instances within a namespace. + * `ai_search_options` is required and must include `instance_ids`. + * Exactly one of `query` or `messages` must be provided. + */ +type AiSearchMultiSearchRequest = { + /** Simple query string. */ + query: string; + messages?: never; + ai_search_options: AiSearchMultiSearchOptions; +} | { + query?: never; + /** Conversation-style input. */ + messages: AiSearchMessage[]; + ai_search_options: AiSearchMultiSearchOptions; +}; +/** A search result chunk tagged with the instance it originated from. */ +type AiSearchMultiSearchChunk = AiSearchSearchResponse['chunks'][number] & { + instance_id: string; +}; +/** Describes a per-instance error during a multi-instance operation. */ +type AiSearchMultiSearchError = { + instance_id: string; + message: string; +}; +/** Response from a multi-instance search, with chunks tagged by instance and optional partial-failure errors. */ +type AiSearchMultiSearchResponse = { + search_query: string; + chunks: AiSearchMultiSearchChunk[]; + errors?: AiSearchMultiSearchError[]; +}; +/** Request for chat completions across multiple instances within a namespace. `ai_search_options` is required and must include `instance_ids`. */ +type AiSearchMultiChatCompletionsRequest = Omit & { + ai_search_options: AiSearchMultiSearchOptions; +}; +/** Response from multi-instance chat completions, with chunks tagged by instance and optional partial-failure errors. */ +type AiSearchMultiChatCompletionsResponse = Omit & { + chunks: AiSearchMultiSearchChunk[]; + errors?: AiSearchMultiSearchError[]; +}; +// ============ AI Search Response Types ============ +type AiSearchSearchResponse = { + search_query: string; + chunks: Array<{ + id: string; + type: string; + /** Match score (0-1) */ + score: number; + text: string; + item: { + timestamp?: number; + key: string; + metadata?: Record; + }; + scoring_details?: { + /** Keyword match score (0-1) */ + keyword_score?: number; + /** Vector similarity score (0-1) */ + vector_score?: number; + /** Keyword rank position */ + keyword_rank?: number; + /** Vector rank position */ + vector_rank?: number; + /** Reranking model score */ + reranking_score?: number; + /** Fusion method used to combine results */ + fusion_method?: 'rrf' | 'max'; + [key: string]: unknown; + }; + }>; +}; +type AiSearchChatCompletionsResponse = { + id?: string; + object?: string; + model?: string; + choices: Array<{ + index?: number; + message: { + role: 'system' | 'developer' | 'user' | 'assistant' | 'tool'; + content: string | null; + [key: string]: unknown; + }; + [key: string]: unknown; + }>; + chunks: AiSearchSearchResponse['chunks']; + [key: string]: unknown; +}; +type AiSearchStatsResponse = { + queued?: number; + running?: number; + completed?: number; + error?: number; + skipped?: number; + outdated?: number; + last_activity?: string; + /** Storage engine statistics. */ + engine?: { + vectorize?: { + vectorsCount: number; + dimensions: number; + }; + r2?: { + payloadSizeBytes: number; + metadataSizeBytes: number; + objectCount: number; + }; + }; +}; +// ============ AI Search Instance Info Types ============ +type AiSearchInstanceInfo = { + id: string; + type?: 'r2' | 'web-crawler' | string; + source?: string; + source_params?: unknown; + paused?: boolean; + status?: string; + namespace?: string; + created_at?: string; + modified_at?: string; + token_id?: string; + ai_gateway_id?: string; + rewrite_query?: boolean; + reranking?: boolean; + embedding_model?: string; + ai_search_model?: string; + rewrite_model?: string; + reranking_model?: string; + /** @deprecated Use index_method instead. */ + hybrid_search_enabled?: boolean; + /** Controls which storage backends are active. */ + index_method?: { + vector?: boolean; + keyword?: boolean; + }; + /** Fusion method for combining vector and keyword results. */ + fusion_method?: 'max' | 'rrf'; + indexing_options?: { + keyword_tokenizer?: 'porter' | 'trigram'; + } | null; + retrieval_options?: { + keyword_match_mode?: 'and' | 'or'; + boost_by?: Array<{ + field: string; + direction?: 'asc' | 'desc' | 'exists' | 'not_exists'; + }>; + } | null; + chunk?: boolean; + chunk_size?: number; + chunk_overlap?: number; + score_threshold?: number; + max_num_results?: number; + cache?: boolean; + cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes'; + custom_metadata?: Array<{ + field_name: string; + data_type: 'text' | 'number' | 'boolean' | 'datetime'; + }>; + /** Sync interval in seconds. */ + sync_interval?: 3600 | 7200 | 14400 | 21600 | 43200 | 86400; + metadata?: Record; + [key: string]: unknown; +}; +/** Pagination, search, and ordering parameters for listing instances within a namespace. */ +type AiSearchListInstancesParams = { + page?: number; + per_page?: number; + /** Search instances by ID. */ + search?: string; + /** Field to sort by. */ + order_by?: 'created_at'; + /** Sort direction. */ + order_by_direction?: 'asc' | 'desc'; +}; +type AiSearchListResponse = { + result: AiSearchInstanceInfo[]; + result_info?: { + count: number; + page: number; + per_page: number; + total_count: number; + }; +}; +// ============ AI Search Config Types ============ +type AiSearchConfig = { + /** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */ + id: string; + /** Instance type. Omit to create with built-in storage. */ + type?: 'r2' | 'web-crawler' | string; + /** Source URL (required for web-crawler type). */ + source?: string; + source_params?: unknown; + /** Token ID (UUID format) */ + token_id?: string; + ai_gateway_id?: string; + /** Enable query rewriting (default false) */ + rewrite_query?: boolean; + /** Enable reranking (default false) */ + reranking?: boolean; + embedding_model?: string; + ai_search_model?: string; + rewrite_model?: string; + reranking_model?: string; + /** @deprecated Use index_method instead. */ + hybrid_search_enabled?: boolean; + /** Controls which storage backends are used during indexing. Defaults to vector-only. */ + index_method?: { + vector?: boolean; + keyword?: boolean; + }; + /** Fusion method for combining vector and keyword results. "rrf" = reciprocal rank fusion (default), "max" = maximum score. */ + fusion_method?: 'max' | 'rrf'; + indexing_options?: { + keyword_tokenizer?: 'porter' | 'trigram'; + } | null; + retrieval_options?: { + keyword_match_mode?: 'and' | 'or'; + boost_by?: Array<{ + field: string; + direction?: 'asc' | 'desc' | 'exists' | 'not_exists'; + }>; + } | null; + chunk?: boolean; + chunk_size?: number; + chunk_overlap?: number; + /** Minimum similarity score (0-1) for a result to be included. */ + score_threshold?: number; + max_num_results?: number; + cache?: boolean; + /** Similarity threshold for cache hits. Stricter = fewer cache hits but higher relevance. */ + cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes'; + custom_metadata?: Array<{ + field_name: string; + data_type: 'text' | 'number' | 'boolean' | 'datetime'; + }>; + namespace?: string; + /** Sync interval in seconds. 3600=1h, 7200=2h, 14400=4h, 21600=6h, 43200=12h, 86400=24h. */ + sync_interval?: 3600 | 7200 | 14400 | 21600 | 43200 | 86400; + metadata?: Record; + [key: string]: unknown; +}; +// ============ AI Search Item Types ============ +type AiSearchItemInfo = { + id: string; + key: string; + status: 'completed' | 'error' | 'skipped' | 'queued' | 'running' | 'outdated'; + next_action?: 'INDEX' | 'DELETE' | null; + error?: string; + checksum?: string; + namespace?: string; + chunks_count?: number | null; + file_size?: number | null; + source_id?: string | null; + last_seen_at?: string; + created_at?: string; + metadata?: Record; + [key: string]: unknown; +}; +type AiSearchItemContentResult = { + body: ReadableStream; + contentType: string; + filename: string; + size: number; +}; +type AiSearchUploadItemOptions = { + metadata?: Record; +}; +type AiSearchListItemsParams = { + page?: number; + per_page?: number; + /** Search items by key name. */ + search?: string; + /** Sort order for results. */ + sort_by?: 'status' | 'modified_at'; + /** Filter items by processing status. */ + status?: 'queued' | 'running' | 'completed' | 'error' | 'skipped' | 'outdated'; + /** Filter items by source (e.g. "builtin" or "web-crawler:https://example.com"). */ + source?: string; + /** JSON-encoded Vectorize filter for metadata filtering. */ + metadata_filter?: string; + /** Filter items by their unique ID. Returns at most one item. */ + item_id?: string; + /** + * Filter items by their exact key (object key / filename). Keys are unique + * per source, so combine with `source` to disambiguate across data sources. + */ + key?: string; +}; +type AiSearchListItemsResponse = { + result: AiSearchItemInfo[]; + result_info?: { + count: number; + page: number; + per_page: number; + total_count: number; + }; +}; +// ============ AI Search Item Logs Types ============ +type AiSearchItemLogsParams = { + /** Maximum number of log entries to return (1-100, default 50). */ + limit?: number; + /** Opaque cursor for pagination. Pass the `cursor` value from a previous response. */ + cursor?: string; +}; +type AiSearchItemLog = { + timestamp: string; + action: string; + message: string; + fileKey?: string; + chunkCount?: number; + processingTimeMs?: number; + errorType?: string; +}; +/** Paginated response for item processing logs (cursor-based). */ +type AiSearchItemLogsResponse = { + result: AiSearchItemLog[]; + result_info: { + count: number; + per_page: number; + cursor: string | null; + truncated: boolean; + }; +}; +// ============ AI Search Item Chunks Types ============ +type AiSearchItemChunksParams = { + /** Maximum number of chunks to return (1-100, default 20). */ + limit?: number; + /** Offset into the chunks list (default 0). */ + offset?: number; +}; +/** A single indexed chunk belonging to an item, including its text content and byte range. */ +type AiSearchItemChunk = { + id: string; + text: string; + start_byte: number; + end_byte: number; + item?: { + timestamp?: number; + key: string; + metadata?: Record; + }; +}; +/** Paginated response for item chunks (offset-based). */ +type AiSearchItemChunksResponse = { + result: AiSearchItemChunk[]; + result_info: { + count: number; + total: number; + limit: number; + offset: number; + }; +}; +// ============ AI Search Job Types ============ +type AiSearchJobInfo = { + id: string; + source: 'user' | 'schedule'; + description?: string; + last_seen_at?: string; + started_at?: string; + ended_at?: string; + end_reason?: string; +}; +type AiSearchJobLog = { + id: number; + message: string; + message_type: number; + created_at: number; +}; +type AiSearchCreateJobParams = { + description?: string; +}; +type AiSearchListJobsParams = { + page?: number; + per_page?: number; +}; +type AiSearchListJobsResponse = { + result: AiSearchJobInfo[]; + result_info?: { + count: number; + page: number; + per_page: number; + total_count: number; + }; +}; +type AiSearchJobLogsParams = { + page?: number; + per_page?: number; +}; +type AiSearchJobLogsResponse = { + result: AiSearchJobLog[]; + result_info?: { + count: number; + page: number; + per_page: number; + total_count: number; + }; +}; +// ============ AI Search Sub-Service Classes ============ +/** + * Single item service for an AI Search instance. + * Provides info, download, sync, logs, and chunks operations on a specific item. + */ +declare abstract class AiSearchItem { + /** Get metadata about this item. */ + info(): Promise; + /** + * Download the item's content. + * @returns Object with body stream, content type, filename, and size. + */ + download(): Promise; + /** + * Trigger re-indexing of this item. + * @returns The updated item info. + */ + sync(): Promise; + /** + * Retrieve processing logs for this item (cursor-based pagination). + * @param params Optional pagination parameters (limit, cursor). + * @returns Paginated log entries for this item. + */ + logs(params?: AiSearchItemLogsParams): Promise; + /** + * List indexed chunks for this item (offset-based pagination). + * @param params Optional pagination parameters (limit, offset). + * @returns Paginated chunk entries for this item. + */ + chunks(params?: AiSearchItemChunksParams): Promise; +} +/** + * Items collection service for an AI Search instance. + * Provides list, upload, and access to individual items. + */ +declare abstract class AiSearchItems { + /** List items in this instance. */ + list(params?: AiSearchListItemsParams): Promise; + /** + * Upload a file as an item. Behaves as an upsert: if an item with the same + * filename already exists, it is overwritten and re-indexed. + * @param name Filename for the uploaded item. + * @param content File content as a ReadableStream, Blob, or string. + * @param options Optional metadata to attach to the item. + * @returns The created item info. + */ + upload(name: string, content: ReadableStream | Blob | string, options?: AiSearchUploadItemOptions): Promise; + /** + * Upload a file and poll until processing completes. + * Behaves as an upsert: if an item with the same filename already exists, + * it is overwritten and re-indexed. + * @param name Filename for the uploaded item. + * @param content File content as a ReadableStream, Blob, or string. + * @param options Optional metadata and polling configuration. + * @returns The item info after processing completes (or timeout). + */ + uploadAndPoll(name: string, content: ReadableStream | Blob | string, options?: AiSearchUploadItemOptions & { + /** Polling interval in milliseconds (default 1000). */ + pollIntervalMs?: number; + /** Maximum time to wait in milliseconds (default 30000). */ + timeoutMs?: number; + }): Promise; + /** + * Get an item by ID. + * @param itemId The item identifier. + * @returns Item service for info, download, sync, logs, and chunks operations. + */ + get(itemId: string): AiSearchItem; + /** + * Delete an item from the instance. + * @param itemId The item identifier. + */ + delete(itemId: string): Promise; +} +/** + * Single job service for an AI Search instance. + * Provides info, logs, and cancel operations for a specific job. + */ +declare abstract class AiSearchJob { + /** Get metadata about this job. */ + info(): Promise; + /** Get logs for this job. */ + logs(params?: AiSearchJobLogsParams): Promise; + /** + * Cancel a running job. + * @returns The updated job info. + * @throws AiSearchNotFoundError if the job does not exist. + */ + cancel(): Promise; +} +/** + * Jobs collection service for an AI Search instance. + * Provides list, create, and access to individual jobs. + */ +declare abstract class AiSearchJobs { + /** List jobs for this instance. */ + list(params?: AiSearchListJobsParams): Promise; + /** + * Create a new indexing job. + * @param params Optional job parameters. + * @returns The created job info. + */ + create(params?: AiSearchCreateJobParams): Promise; + /** + * Get a job by ID. + * @param jobId The job identifier. + * @returns Job service for info, logs, and cancel operations. + */ + get(jobId: string): AiSearchJob; +} +// ============ AI Search Binding Classes ============ +/** + * Instance-level AI Search service. + * + * Used as: + * - The return type of `AiSearchNamespace.get(name)` (namespace binding) + * - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`) + * + * Provides search, chat, update, stats, items, and jobs operations. + * + * @example + * ```ts + * // Via namespace binding + * const instance = env.AI_SEARCH.get("blog"); + * const results = await instance.search({ + * query: "How does caching work?", + * }); + * + * // Via single instance binding + * const results = await env.BLOG_SEARCH.search({ + * messages: [{ role: "user", content: "How does caching work?" }], + * }); + * ``` + */ +declare abstract class AiSearchInstance { + /** + * Search the AI Search instance for relevant chunks. + * @param params Search request with query or messages and optional AI search options. + * @returns Search response with matching chunks and search query. + */ + search(params: AiSearchSearchRequest): Promise; + /** + * Generate chat completions with AI Search context (streaming). + * @param params Chat completions request with stream: true. + * @returns ReadableStream of server-sent events. + */ + chatCompletions(params: AiSearchChatCompletionsRequest & { + stream: true; + }): Promise; + /** + * Generate chat completions with AI Search context. + * @param params Chat completions request. + * @returns Chat completion response with choices and RAG chunks. + */ + chatCompletions(params: AiSearchChatCompletionsRequest): Promise; + /** + * Update the instance configuration. + * @param config Partial configuration to update. + * @returns Updated instance info. + */ + update(config: Partial): Promise; + /** Get metadata about this instance. */ + info(): Promise; + /** + * Get instance statistics (item count, indexing status, etc.). + * @returns Statistics with counts per status, last activity time, and engine details. + */ + stats(): Promise; + /** Items collection — list, upload, and manage items in this instance. */ + get items(): AiSearchItems; + /** Jobs collection — list, create, and inspect indexing jobs. */ + get jobs(): AiSearchJobs; +} +/** + * Namespace-level AI Search service. + * + * Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`). + * Scoped to a single namespace. Provides dynamic instance access, creation, deletion, + * and multi-instance search/chat operations. + * + * @example + * ```ts + * // Access an instance within the namespace + * const blog = env.AI_SEARCH.get("blog"); + * const results = await blog.search({ query: "How does caching work?" }); + * + * // List all instances in the namespace + * const instances = await env.AI_SEARCH.list(); + * + * // Create a new instance with built-in storage + * const tenant = await env.AI_SEARCH.create({ id: "tenant-123" }); + * + * // Upload items into the instance + * await tenant.items.upload("doc.pdf", fileContent); + * + * // Search across multiple instances + * const multi = await env.AI_SEARCH.search({ + * query: "caching", + * ai_search_options: { instance_ids: ["blog", "docs"] }, + * }); + * + * // Delete an instance + * await env.AI_SEARCH.delete("tenant-123"); + * ``` + */ +declare abstract class AiSearchNamespace { + /** + * Get an instance by name within the bound namespace. + * @param name Instance name. + * @returns Instance service for search, chat, update, stats, items, and jobs. + */ + get(name: string): AiSearchInstance; + /** + * List instances in the bound namespace. + * @param params Optional pagination, search, and ordering parameters. + * @returns Array of instance metadata with pagination info. + */ + list(params?: AiSearchListInstancesParams): Promise; + /** + * Create a new instance within the bound namespace. + * @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage. + * @returns Instance service for the newly created instance. + * + * @example + * ```ts + * // Create with built-in storage (upload items manually) + * const instance = await env.AI_SEARCH.create({ id: "my-search" }); + * + * // Create with web crawler source + * const instance = await env.AI_SEARCH.create({ + * id: "docs-search", + * type: "web-crawler", + * source: "https://developers.cloudflare.com", + * }); + * ``` + */ + create(config: AiSearchConfig): Promise; + /** + * Delete an instance from the bound namespace. + * @param name Instance name to delete. + */ + delete(name: string): Promise; + /** + * Search across multiple instances within the bound namespace. + * Fans out to the specified instance_ids and merges results. + * @param params Search request with required `ai_search_options.instance_ids`. + * @returns Search response with chunks tagged by instance_id and optional partial-failure errors. + */ + search(params: AiSearchMultiSearchRequest): Promise; + /** + * Generate chat completions across multiple instances within the bound namespace (streaming). + * Fans out to the specified instance_ids, merges context, and generates a response. + * @param params Chat completions request with stream: true and required `ai_search_options.instance_ids`. + * @returns ReadableStream of server-sent events. + */ + chatCompletions(params: AiSearchMultiChatCompletionsRequest & { + stream: true; + }): Promise; + /** + * Generate chat completions across multiple instances within the bound namespace. + * Fans out to the specified instance_ids, merges context, and generates a response. + * @param params Chat completions request with required `ai_search_options.instance_ids`. + * @returns Chat completion response with choices, chunks tagged by instance_id, and optional partial-failure errors. + */ + chatCompletions(params: AiSearchMultiChatCompletionsRequest): Promise; +} +type AiImageClassificationInput = { + image: number[]; +}; +type AiImageClassificationOutput = { + score?: number; + label?: string; +}[]; +declare abstract class BaseAiImageClassification { + inputs: AiImageClassificationInput; + postProcessedOutputs: AiImageClassificationOutput; +} +type AiImageToTextInput = { + image: number[]; + prompt?: string; + max_tokens?: number; + temperature?: number; + top_p?: number; + top_k?: number; + seed?: number; + repetition_penalty?: number; + frequency_penalty?: number; + presence_penalty?: number; + raw?: boolean; + messages?: RoleScopedChatInput[]; +}; +type AiImageToTextOutput = { + description: string; +}; +declare abstract class BaseAiImageToText { + inputs: AiImageToTextInput; + postProcessedOutputs: AiImageToTextOutput; +} +type AiImageTextToTextInput = { + image: string; + prompt?: string; + max_tokens?: number; + temperature?: number; + ignore_eos?: boolean; + top_p?: number; + top_k?: number; + seed?: number; + repetition_penalty?: number; + frequency_penalty?: number; + presence_penalty?: number; + raw?: boolean; + messages?: RoleScopedChatInput[]; +}; +type AiImageTextToTextOutput = { + description: string; +}; +declare abstract class BaseAiImageTextToText { + inputs: AiImageTextToTextInput; + postProcessedOutputs: AiImageTextToTextOutput; +} +type AiMultimodalEmbeddingsInput = { + image: string; + text: string[]; +}; +type AiIMultimodalEmbeddingsOutput = { + data: number[][]; + shape: number[]; +}; +declare abstract class BaseAiMultimodalEmbeddings { + inputs: AiImageTextToTextInput; + postProcessedOutputs: AiImageTextToTextOutput; +} +type AiObjectDetectionInput = { + image: number[]; +}; +type AiObjectDetectionOutput = { + score?: number; + label?: string; +}[]; +declare abstract class BaseAiObjectDetection { + inputs: AiObjectDetectionInput; + postProcessedOutputs: AiObjectDetectionOutput; +} +type AiSentenceSimilarityInput = { + source: string; + sentences: string[]; +}; +type AiSentenceSimilarityOutput = number[]; +declare abstract class BaseAiSentenceSimilarity { + inputs: AiSentenceSimilarityInput; + postProcessedOutputs: AiSentenceSimilarityOutput; +} +type AiAutomaticSpeechRecognitionInput = { + audio: number[]; +}; +type AiAutomaticSpeechRecognitionOutput = { + text?: string; + words?: { + word: string; + start: number; + end: number; + }[]; + vtt?: string; +}; +declare abstract class BaseAiAutomaticSpeechRecognition { + inputs: AiAutomaticSpeechRecognitionInput; + postProcessedOutputs: AiAutomaticSpeechRecognitionOutput; +} +type AiSummarizationInput = { + input_text: string; + max_length?: number; +}; +type AiSummarizationOutput = { + summary: string; +}; +declare abstract class BaseAiSummarization { + inputs: AiSummarizationInput; + postProcessedOutputs: AiSummarizationOutput; +} +type AiTextClassificationInput = { + text: string; +}; +type AiTextClassificationOutput = { + score?: number; + label?: string; +}[]; +declare abstract class BaseAiTextClassification { + inputs: AiTextClassificationInput; + postProcessedOutputs: AiTextClassificationOutput; +} +type AiTextEmbeddingsInput = { + text: string | string[]; +}; +type AiTextEmbeddingsOutput = { + shape: number[]; + data: number[][]; +}; +declare abstract class BaseAiTextEmbeddings { + inputs: AiTextEmbeddingsInput; + postProcessedOutputs: AiTextEmbeddingsOutput; +} +type RoleScopedChatInput = { + role: "user" | "assistant" | "system" | "tool" | (string & NonNullable); + content: string; + name?: string; +}; +type AiTextGenerationToolLegacyInput = { + name: string; + description: string; + parameters?: { + type: "object" | (string & NonNullable); + properties: { + [key: string]: { + type: string; + description?: string; + }; + }; + required: string[]; + }; +}; +type AiTextGenerationToolInput = { + type: "function" | (string & NonNullable); + function: { + name: string; + description: string; + parameters?: { + type: "object" | (string & NonNullable); + properties: { + [key: string]: { + type: string; + description?: string; + }; + }; + required: string[]; + }; + }; +}; +type AiTextGenerationFunctionsInput = { + name: string; + code: string; +}; +type AiTextGenerationResponseFormat = { + type: string; + json_schema?: any; +}; +type AiTextGenerationInput = { + prompt?: string; + raw?: boolean; + stream?: boolean; + max_tokens?: number; + temperature?: number; + top_p?: number; + top_k?: number; + seed?: number; + repetition_penalty?: number; + frequency_penalty?: number; + presence_penalty?: number; + messages?: RoleScopedChatInput[]; + response_format?: AiTextGenerationResponseFormat; + tools?: AiTextGenerationToolInput[] | AiTextGenerationToolLegacyInput[] | (object & NonNullable); + functions?: AiTextGenerationFunctionsInput[]; +}; +type AiTextGenerationToolLegacyOutput = { + name: string; + arguments: unknown; +}; +type AiTextGenerationToolOutput = { + id: string; + type: "function"; + function: { + name: string; + arguments: string; + }; +}; +type UsageTags = { + prompt_tokens: number; + completion_tokens: number; + total_tokens: number; +}; +type AiTextGenerationOutput = { + response?: string; + tool_calls?: AiTextGenerationToolLegacyOutput[] & AiTextGenerationToolOutput[]; + usage?: UsageTags; +}; +declare abstract class BaseAiTextGeneration { + inputs: AiTextGenerationInput; + postProcessedOutputs: AiTextGenerationOutput; +} +type AiTextToSpeechInput = { + prompt: string; + lang?: string; +}; +type AiTextToSpeechOutput = Uint8Array | { + audio: string; +}; +declare abstract class BaseAiTextToSpeech { + inputs: AiTextToSpeechInput; + postProcessedOutputs: AiTextToSpeechOutput; +} +type AiTextToImageInput = { + prompt: string; + negative_prompt?: string; + height?: number; + width?: number; + image?: number[]; + image_b64?: string; + mask?: number[]; + num_steps?: number; + strength?: number; + guidance?: number; + seed?: number; +}; +type AiTextToImageOutput = ReadableStream; +declare abstract class BaseAiTextToImage { + inputs: AiTextToImageInput; + postProcessedOutputs: AiTextToImageOutput; +} +type AiTranslationInput = { + text: string; + target_lang: string; + source_lang?: string; +}; +type AiTranslationOutput = { + translated_text?: string; +}; +declare abstract class BaseAiTranslation { + inputs: AiTranslationInput; + postProcessedOutputs: AiTranslationOutput; +} +/** + * Workers AI support for OpenAI's Chat Completions API + */ +type ChatCompletionContentPartText = { + type: "text"; + text: string; +}; +type ChatCompletionContentPartImage = { + type: "image_url"; + image_url: { + url: string; + detail?: "auto" | "low" | "high"; + }; +}; +type ChatCompletionContentPartInputAudio = { + type: "input_audio"; + input_audio: { + /** Base64 encoded audio data. */ + data: string; + format: "wav" | "mp3"; + }; +}; +type ChatCompletionContentPartFile = { + type: "file"; + file: { + /** Base64 encoded file data. */ + file_data?: string; + /** The ID of an uploaded file. */ + file_id?: string; + filename?: string; + }; +}; +type ChatCompletionContentPartRefusal = { + type: "refusal"; + refusal: string; +}; +type ChatCompletionContentPart = ChatCompletionContentPartText | ChatCompletionContentPartImage | ChatCompletionContentPartInputAudio | ChatCompletionContentPartFile; +type FunctionDefinition = { + name: string; + description?: string; + parameters?: Record; + strict?: boolean | null; +}; +type ChatCompletionFunctionTool = { + type: "function"; + function: FunctionDefinition; +}; +type ChatCompletionCustomToolGrammarFormat = { + type: "grammar"; + grammar: { + definition: string; + syntax: "lark" | "regex"; + }; +}; +type ChatCompletionCustomToolTextFormat = { + type: "text"; +}; +type ChatCompletionCustomToolFormat = ChatCompletionCustomToolTextFormat | ChatCompletionCustomToolGrammarFormat; +type ChatCompletionCustomTool = { + type: "custom"; + custom: { + name: string; + description?: string; + format?: ChatCompletionCustomToolFormat; + }; +}; +type ChatCompletionTool = ChatCompletionFunctionTool | ChatCompletionCustomTool; +type ChatCompletionMessageFunctionToolCall = { + id: string; + type: "function"; + function: { + name: string; + /** JSON-encoded arguments string. */ + arguments: string; + }; +}; +type ChatCompletionMessageCustomToolCall = { + id: string; + type: "custom"; + custom: { + name: string; + input: string; + }; +}; +type ChatCompletionMessageToolCall = ChatCompletionMessageFunctionToolCall | ChatCompletionMessageCustomToolCall; +type ChatCompletionToolChoiceFunction = { + type: "function"; + function: { + name: string; + }; +}; +type ChatCompletionToolChoiceCustom = { + type: "custom"; + custom: { + name: string; + }; +}; +type ChatCompletionToolChoiceAllowedTools = { + type: "allowed_tools"; + allowed_tools: { + mode: "auto" | "required"; + tools: Array>; + }; +}; +type ChatCompletionToolChoiceOption = "none" | "auto" | "required" | ChatCompletionToolChoiceFunction | ChatCompletionToolChoiceCustom | ChatCompletionToolChoiceAllowedTools; +type DeveloperMessage = { + role: "developer"; + content: string | Array<{ + type: "text"; + text: string; + }>; + name?: string; +}; +type SystemMessage = { + role: "system"; + content: string | Array<{ + type: "text"; + text: string; + }>; + name?: string; +}; +/** + * Permissive merged content part used inside UserMessage arrays. + * + * Cabidela has a limitation where anyOf/oneOf with enum-based discrimination + * inside nested array items does not correctly match different branches for + * different array elements, so the schema uses a single merged object. + */ +type UserMessageContentPart = { + type: "text" | "image_url" | "input_audio" | "file"; + text?: string; + image_url?: { + url?: string; + detail?: "auto" | "low" | "high"; + }; + input_audio?: { + data?: string; + format?: "wav" | "mp3"; + }; + file?: { + file_data?: string; + file_id?: string; + filename?: string; + }; +}; +type UserMessage = { + role: "user"; + content: string | Array; + name?: string; +}; +type AssistantMessageContentPart = { + type: "text" | "refusal"; + text?: string; + refusal?: string; +}; +type AssistantMessage = { + role: "assistant"; + content?: string | null | Array; + refusal?: string | null; + name?: string; + audio?: { + id: string; + }; + tool_calls?: Array; + function_call?: { + name: string; + arguments: string; + }; +}; +type ToolMessage = { + role: "tool"; + content: string | Array<{ + type: "text"; + text: string; + }>; + tool_call_id: string; +}; +type FunctionMessage = { + role: "function"; + content: string; + name: string; +}; +type ChatCompletionMessageParam = DeveloperMessage | SystemMessage | UserMessage | AssistantMessage | ToolMessage | FunctionMessage; +type ChatCompletionsResponseFormatText = { + type: "text"; +}; +type ChatCompletionsResponseFormatJSONObject = { + type: "json_object"; +}; +type ResponseFormatJSONSchema = { + type: "json_schema"; + json_schema: { + name: string; + description?: string; + schema?: Record; + strict?: boolean | null; + }; +}; +type ResponseFormat = ChatCompletionsResponseFormatText | ChatCompletionsResponseFormatJSONObject | ResponseFormatJSONSchema; +type ChatCompletionsStreamOptions = { + include_usage?: boolean; + include_obfuscation?: boolean; +}; +type PredictionContent = { + type: "content"; + content: string | Array<{ + type: "text"; + text: string; + }>; +}; +type AudioParams = { + voice: string | { + id: string; + }; + format: "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16"; +}; +type WebSearchUserLocation = { + type: "approximate"; + approximate: { + city?: string; + country?: string; + region?: string; + timezone?: string; + }; +}; +type WebSearchOptions = { + search_context_size?: "low" | "medium" | "high"; + user_location?: WebSearchUserLocation; +}; +type ChatTemplateKwargs = { + /** Whether to enable reasoning, enabled by default. */ + enable_thinking?: boolean; + /** If false, preserves reasoning context between turns. */ + clear_thinking?: boolean; +}; +/** Shared optional properties used by both Prompt and Messages input branches. */ +type ChatCompletionsCommonOptions = { + model?: string; + audio?: AudioParams; + frequency_penalty?: number | null; + logit_bias?: Record | null; + logprobs?: boolean | null; + top_logprobs?: number | null; + max_tokens?: number | null; + max_completion_tokens?: number | null; + metadata?: Record | null; + modalities?: Array<"text" | "audio"> | null; + n?: number | null; + parallel_tool_calls?: boolean; + prediction?: PredictionContent; + presence_penalty?: number | null; + reasoning_effort?: "low" | "medium" | "high" | null; + chat_template_kwargs?: ChatTemplateKwargs; + response_format?: ResponseFormat; + seed?: number | null; + service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; + stop?: string | Array | null; + store?: boolean | null; + stream?: boolean | null; + stream_options?: ChatCompletionsStreamOptions; + temperature?: number | null; + tool_choice?: ChatCompletionToolChoiceOption; + tools?: Array; + top_p?: number | null; + user?: string; + web_search_options?: WebSearchOptions; + function_call?: "none" | "auto" | { + name: string; + }; + functions?: Array; +}; +type PromptTokensDetails = { + cached_tokens?: number; + audio_tokens?: number; +}; +type CompletionTokensDetails = { + reasoning_tokens?: number; + audio_tokens?: number; + accepted_prediction_tokens?: number; + rejected_prediction_tokens?: number; +}; +type CompletionUsage = { + prompt_tokens: number; + completion_tokens: number; + total_tokens: number; + prompt_tokens_details?: PromptTokensDetails; + completion_tokens_details?: CompletionTokensDetails; +}; +type ChatCompletionTopLogprob = { + token: string; + logprob: number; + bytes: Array | null; +}; +type ChatCompletionTokenLogprob = { + token: string; + logprob: number; + bytes: Array | null; + top_logprobs: Array; +}; +type ChatCompletionAudio = { + id: string; + /** Base64 encoded audio bytes. */ + data: string; + expires_at: number; + transcript: string; +}; +type ChatCompletionUrlCitation = { + type: "url_citation"; + url_citation: { + url: string; + title: string; + start_index: number; + end_index: number; + }; +}; +type ChatCompletionResponseMessage = { + role: "assistant"; + content: string | null; + refusal: string | null; + annotations?: Array; + audio?: ChatCompletionAudio; + tool_calls?: Array; + function_call?: { + name: string; + arguments: string; + } | null; +}; +type ChatCompletionLogprobs = { + content: Array | null; + refusal?: Array | null; +}; +type ChatCompletionChoice = { + index: number; + message: ChatCompletionResponseMessage; + finish_reason: "stop" | "length" | "tool_calls" | "content_filter" | "function_call"; + logprobs: ChatCompletionLogprobs | null; +}; +type ChatCompletionsMessagesInput = { + messages: Array; +} & ChatCompletionsCommonOptions; +type ChatCompletionsOutput = { + id: string; + object: string; + created: number; + model: string; + choices: Array; + usage?: CompletionUsage; + system_fingerprint?: string | null; + service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; +}; +/** + * Workers AI support for OpenAI's Responses API + * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts + * + * It's a stripped down version from its source. + * It currently supports basic function calling, json mode and accepts images as input. + * + * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools. + * We plan to add those incrementally as model + platform capabilities evolve. + */ +type ResponsesInput = { + background?: boolean | null; + conversation?: string | ResponseConversationParam | null; + include?: Array | null; + input?: string | ResponseInput; + instructions?: string | null; + max_output_tokens?: number | null; + parallel_tool_calls?: boolean | null; + previous_response_id?: string | null; + prompt_cache_key?: string; + reasoning?: Reasoning | null; + safety_identifier?: string; + service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; + stream?: boolean | null; + stream_options?: StreamOptions | null; + temperature?: number | null; + text?: ResponseTextConfig; + tool_choice?: ToolChoiceOptions | ToolChoiceFunction; + tools?: Array; + top_p?: number | null; + truncation?: "auto" | "disabled" | null; +}; +type ResponsesOutput = { + id?: string; + created_at?: number; + output_text?: string; + error?: ResponseError | null; + incomplete_details?: ResponseIncompleteDetails | null; + instructions?: string | Array | null; + object?: "response"; + output?: Array; + parallel_tool_calls?: boolean; + temperature?: number | null; + tool_choice?: ToolChoiceOptions | ToolChoiceFunction; + tools?: Array; + top_p?: number | null; + max_output_tokens?: number | null; + previous_response_id?: string | null; + prompt?: ResponsePrompt | null; + reasoning?: Reasoning | null; + safety_identifier?: string; + service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; + status?: ResponseStatus; + text?: ResponseTextConfig; + truncation?: "auto" | "disabled" | null; + usage?: ResponseUsage; +}; +type EasyInputMessage = { + content: string | ResponseInputMessageContentList; + role: "user" | "assistant" | "system" | "developer"; + type?: "message"; +}; +type ResponsesFunctionTool = { + name: string; + parameters: { + [key: string]: unknown; + } | null; + strict: boolean | null; + type: "function"; + description?: string | null; +}; +type ResponseIncompleteDetails = { + reason?: "max_output_tokens" | "content_filter"; +}; +type ResponsePrompt = { + id: string; + variables?: { + [key: string]: string | ResponseInputText | ResponseInputImage; + } | null; + version?: string | null; +}; +type Reasoning = { + effort?: ReasoningEffort | null; + generate_summary?: "auto" | "concise" | "detailed" | null; + summary?: "auto" | "concise" | "detailed" | null; +}; +type ResponseContent = ResponseInputText | ResponseInputImage | ResponseOutputText | ResponseOutputRefusal | ResponseContentReasoningText; +type ResponseContentReasoningText = { + text: string; + type: "reasoning_text"; +}; +type ResponseConversationParam = { + id: string; +}; +type ResponseCreatedEvent = { + response: Response; + sequence_number: number; + type: "response.created"; +}; +type ResponseCustomToolCallOutput = { + call_id: string; + output: string | Array; + type: "custom_tool_call_output"; + id?: string; +}; +type ResponseError = { + code: "server_error" | "rate_limit_exceeded" | "invalid_prompt" | "vector_store_timeout" | "invalid_image" | "invalid_image_format" | "invalid_base64_image" | "invalid_image_url" | "image_too_large" | "image_too_small" | "image_parse_error" | "image_content_policy_violation" | "invalid_image_mode" | "image_file_too_large" | "unsupported_image_media_type" | "empty_image_file" | "failed_to_download_image" | "image_file_not_found"; + message: string; +}; +type ResponseErrorEvent = { + code: string | null; + message: string; + param: string | null; + sequence_number: number; + type: "error"; +}; +type ResponseFailedEvent = { + response: Response; + sequence_number: number; + type: "response.failed"; +}; +type ResponseFormatText = { + type: "text"; +}; +type ResponseFormatJSONObject = { + type: "json_object"; +}; +type ResponseFormatTextConfig = ResponseFormatText | ResponseFormatTextJSONSchemaConfig | ResponseFormatJSONObject; +type ResponseFormatTextJSONSchemaConfig = { + name: string; + schema: { + [key: string]: unknown; + }; + type: "json_schema"; + description?: string; + strict?: boolean | null; +}; +type ResponseFunctionCallArgumentsDeltaEvent = { + delta: string; + item_id: string; + output_index: number; + sequence_number: number; + type: "response.function_call_arguments.delta"; +}; +type ResponseFunctionCallArgumentsDoneEvent = { + arguments: string; + item_id: string; + name: string; + output_index: number; + sequence_number: number; + type: "response.function_call_arguments.done"; +}; +type ResponseFunctionCallOutputItem = ResponseInputTextContent | ResponseInputImageContent; +type ResponseFunctionCallOutputItemList = Array; +type ResponseFunctionToolCall = { + arguments: string; + call_id: string; + name: string; + type: "function_call"; + id?: string; + status?: "in_progress" | "completed" | "incomplete"; +}; +interface ResponseFunctionToolCallItem extends ResponseFunctionToolCall { + id: string; +} +type ResponseFunctionToolCallOutputItem = { + id: string; + call_id: string; + output: string | Array; + type: "function_call_output"; + status?: "in_progress" | "completed" | "incomplete"; +}; +type ResponseIncludable = "message.input_image.image_url" | "message.output_text.logprobs"; +type ResponseIncompleteEvent = { + response: Response; + sequence_number: number; + type: "response.incomplete"; +}; +type ResponseInput = Array; +type ResponseInputContent = ResponseInputText | ResponseInputImage; +type ResponseInputImage = { + detail: "low" | "high" | "auto"; + type: "input_image"; + /** + * Base64 encoded image + */ + image_url?: string | null; +}; +type ResponseInputImageContent = { + type: "input_image"; + detail?: "low" | "high" | "auto" | null; + /** + * Base64 encoded image + */ + image_url?: string | null; +}; +type ResponseInputItem = EasyInputMessage | ResponseInputItemMessage | ResponseOutputMessage | ResponseFunctionToolCall | ResponseInputItemFunctionCallOutput | ResponseReasoningItem; +type ResponseInputItemFunctionCallOutput = { + call_id: string; + output: string | ResponseFunctionCallOutputItemList; + type: "function_call_output"; + id?: string | null; + status?: "in_progress" | "completed" | "incomplete" | null; +}; +type ResponseInputItemMessage = { + content: ResponseInputMessageContentList; + role: "user" | "system" | "developer"; + status?: "in_progress" | "completed" | "incomplete"; + type?: "message"; +}; +type ResponseInputMessageContentList = Array; +type ResponseInputMessageItem = { + id: string; + content: ResponseInputMessageContentList; + role: "user" | "system" | "developer"; + status?: "in_progress" | "completed" | "incomplete"; + type?: "message"; +}; +type ResponseInputText = { + text: string; + type: "input_text"; +}; +type ResponseInputTextContent = { + text: string; + type: "input_text"; +}; +type ResponseItem = ResponseInputMessageItem | ResponseOutputMessage | ResponseFunctionToolCallItem | ResponseFunctionToolCallOutputItem; +type ResponseOutputItem = ResponseOutputMessage | ResponseFunctionToolCall | ResponseReasoningItem; +type ResponseOutputItemAddedEvent = { + item: ResponseOutputItem; + output_index: number; + sequence_number: number; + type: "response.output_item.added"; +}; +type ResponseOutputItemDoneEvent = { + item: ResponseOutputItem; + output_index: number; + sequence_number: number; + type: "response.output_item.done"; +}; +type ResponseOutputMessage = { + id: string; + content: Array; + role: "assistant"; + status: "in_progress" | "completed" | "incomplete"; + type: "message"; +}; +type ResponseOutputRefusal = { + refusal: string; + type: "refusal"; +}; +type ResponseOutputText = { + text: string; + type: "output_text"; + logprobs?: Array; +}; +type ResponseReasoningItem = { + id: string; + summary: Array; + type: "reasoning"; + content?: Array; + encrypted_content?: string | null; + status?: "in_progress" | "completed" | "incomplete"; +}; +type ResponseReasoningSummaryItem = { + text: string; + type: "summary_text"; +}; +type ResponseReasoningContentItem = { + text: string; + type: "reasoning_text"; +}; +type ResponseReasoningTextDeltaEvent = { + content_index: number; + delta: string; + item_id: string; + output_index: number; + sequence_number: number; + type: "response.reasoning_text.delta"; +}; +type ResponseReasoningTextDoneEvent = { + content_index: number; + item_id: string; + output_index: number; + sequence_number: number; + text: string; + type: "response.reasoning_text.done"; +}; +type ResponseRefusalDeltaEvent = { + content_index: number; + delta: string; + item_id: string; + output_index: number; + sequence_number: number; + type: "response.refusal.delta"; +}; +type ResponseRefusalDoneEvent = { + content_index: number; + item_id: string; + output_index: number; + refusal: string; + sequence_number: number; + type: "response.refusal.done"; +}; +type ResponseStatus = "completed" | "failed" | "in_progress" | "cancelled" | "queued" | "incomplete"; +type ResponseStreamEvent = ResponseCompletedEvent | ResponseCreatedEvent | ResponseErrorEvent | ResponseFunctionCallArgumentsDeltaEvent | ResponseFunctionCallArgumentsDoneEvent | ResponseFailedEvent | ResponseIncompleteEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent | ResponseReasoningTextDeltaEvent | ResponseReasoningTextDoneEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent; +type ResponseCompletedEvent = { + response: Response; + sequence_number: number; + type: "response.completed"; +}; +type ResponseTextConfig = { + format?: ResponseFormatTextConfig; + verbosity?: "low" | "medium" | "high" | null; +}; +type ResponseTextDeltaEvent = { + content_index: number; + delta: string; + item_id: string; + logprobs: Array; + output_index: number; + sequence_number: number; + type: "response.output_text.delta"; +}; +type ResponseTextDoneEvent = { + content_index: number; + item_id: string; + logprobs: Array; + output_index: number; + sequence_number: number; + text: string; + type: "response.output_text.done"; +}; +type Logprob = { + token: string; + logprob: number; + top_logprobs?: Array; +}; +type TopLogprob = { + token?: string; + logprob?: number; +}; +type ResponseUsage = { + input_tokens: number; + output_tokens: number; + total_tokens: number; +}; +type Tool = ResponsesFunctionTool; +type ToolChoiceFunction = { + name: string; + type: "function"; +}; +type ToolChoiceOptions = "none"; +type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null; +type StreamOptions = { + include_obfuscation?: boolean; +}; +/** Marks keys from T that aren't in U as optional never */ +type Without = { + [P in Exclude]?: never; +}; +/** Either T or U, but not both (mutually exclusive) */ +type XOR = (T & Without) | (U & Without); +type Ai_Cf_Baai_Bge_Base_En_V1_5_Input = { + text: string | string[]; + /** + * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy. + */ + pooling?: "mean" | "cls"; +} | { + /** + * Batch of the embeddings requests to run using async-queue + */ + requests: { + text: string | string[]; + /** + * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy. + */ + pooling?: "mean" | "cls"; + }[]; +}; +type Ai_Cf_Baai_Bge_Base_En_V1_5_Output = { + shape?: number[]; + /** + * Embeddings of the requested text values + */ + data?: number[][]; + /** + * The pooling method used in the embedding process. + */ + pooling?: "mean" | "cls"; +} | Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse; +interface Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse { + /** + * The async request id that can be used to obtain the results. + */ + request_id?: string; +} +declare abstract class Base_Ai_Cf_Baai_Bge_Base_En_V1_5 { + inputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Input; + postProcessedOutputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Output; +} +type Ai_Cf_Openai_Whisper_Input = string | { + /** + * An array of integers that represent the audio data constrained to 8-bit unsigned integer values + */ + audio: number[]; +}; +interface Ai_Cf_Openai_Whisper_Output { + /** + * The transcription + */ + text: string; + word_count?: number; + words?: { + word?: string; + /** + * The second this word begins in the recording + */ + start?: number; + /** + * The ending second when the word completes + */ + end?: number; + }[]; + vtt?: string; +} +declare abstract class Base_Ai_Cf_Openai_Whisper { + inputs: Ai_Cf_Openai_Whisper_Input; + postProcessedOutputs: Ai_Cf_Openai_Whisper_Output; +} +type Ai_Cf_Meta_M2M100_1_2B_Input = { + /** + * The text to be translated + */ + text: string; + /** + * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified + */ + source_lang?: string; + /** + * The language code to translate the text into (e.g., 'es' for Spanish) + */ + target_lang: string; +} | { + /** + * Batch of the embeddings requests to run using async-queue + */ + requests: { + /** + * The text to be translated + */ + text: string; + /** + * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified + */ + source_lang?: string; + /** + * The language code to translate the text into (e.g., 'es' for Spanish) + */ + target_lang: string; + }[]; +}; +type Ai_Cf_Meta_M2M100_1_2B_Output = { + /** + * The translated text in the target language + */ + translated_text?: string; +} | Ai_Cf_Meta_M2M100_1_2B_AsyncResponse; +interface Ai_Cf_Meta_M2M100_1_2B_AsyncResponse { + /** + * The async request id that can be used to obtain the results. + */ + request_id?: string; +} +declare abstract class Base_Ai_Cf_Meta_M2M100_1_2B { + inputs: Ai_Cf_Meta_M2M100_1_2B_Input; + postProcessedOutputs: Ai_Cf_Meta_M2M100_1_2B_Output; +} +type Ai_Cf_Baai_Bge_Small_En_V1_5_Input = { + text: string | string[]; + /** + * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy. + */ + pooling?: "mean" | "cls"; +} | { + /** + * Batch of the embeddings requests to run using async-queue + */ + requests: { + text: string | string[]; + /** + * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy. + */ + pooling?: "mean" | "cls"; + }[]; +}; +type Ai_Cf_Baai_Bge_Small_En_V1_5_Output = { + shape?: number[]; + /** + * Embeddings of the requested text values + */ + data?: number[][]; + /** + * The pooling method used in the embedding process. + */ + pooling?: "mean" | "cls"; +} | Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse; +interface Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse { + /** + * The async request id that can be used to obtain the results. + */ + request_id?: string; +} +declare abstract class Base_Ai_Cf_Baai_Bge_Small_En_V1_5 { + inputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Input; + postProcessedOutputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Output; +} +type Ai_Cf_Baai_Bge_Large_En_V1_5_Input = { + text: string | string[]; + /** + * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy. + */ + pooling?: "mean" | "cls"; +} | { + /** + * Batch of the embeddings requests to run using async-queue + */ + requests: { + text: string | string[]; + /** + * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy. + */ + pooling?: "mean" | "cls"; + }[]; +}; +type Ai_Cf_Baai_Bge_Large_En_V1_5_Output = { + shape?: number[]; + /** + * Embeddings of the requested text values + */ + data?: number[][]; + /** + * The pooling method used in the embedding process. + */ + pooling?: "mean" | "cls"; +} | Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse; +interface Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse { + /** + * The async request id that can be used to obtain the results. + */ + request_id?: string; +} +declare abstract class Base_Ai_Cf_Baai_Bge_Large_En_V1_5 { + inputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Input; + postProcessedOutputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Output; +} +type Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input = string | { + /** + * The input text prompt for the model to generate a response. + */ + prompt?: string; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; + image: number[] | (string & NonNullable); + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; +}; +interface Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output { + description?: string; +} +declare abstract class Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M { + inputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input; + postProcessedOutputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output; +} +type Ai_Cf_Openai_Whisper_Tiny_En_Input = string | { + /** + * An array of integers that represent the audio data constrained to 8-bit unsigned integer values + */ + audio: number[]; +}; +interface Ai_Cf_Openai_Whisper_Tiny_En_Output { + /** + * The transcription + */ + text: string; + word_count?: number; + words?: { + word?: string; + /** + * The second this word begins in the recording + */ + start?: number; + /** + * The ending second when the word completes + */ + end?: number; + }[]; + vtt?: string; +} +declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En { + inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input; + postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output; +} +interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input { + audio: string | { + body?: object; + contentType?: string; + }; + /** + * Supported tasks are 'translate' or 'transcribe'. + */ + task?: string; + /** + * The language of the audio being transcribed or translated. + */ + language?: string; + /** + * Preprocess the audio with a voice activity detection model. + */ + vad_filter?: boolean; + /** + * A text prompt to help provide context to the model on the contents of the audio. + */ + initial_prompt?: string; + /** + * The prefix appended to the beginning of the output of the transcription and can guide the transcription result. + */ + prefix?: string; + /** + * The number of beams to use in beam search decoding. Higher values may improve accuracy at the cost of speed. + */ + beam_size?: number; + /** + * Whether to condition on previous text during transcription. Setting to false may help prevent hallucination loops. + */ + condition_on_previous_text?: boolean; + /** + * Threshold for detecting no-speech segments. Segments with no-speech probability above this value are skipped. + */ + no_speech_threshold?: number; + /** + * Threshold for filtering out segments with high compression ratio, which often indicate repetitive or hallucinated text. + */ + compression_ratio_threshold?: number; + /** + * Threshold for filtering out segments with low average log probability, indicating low confidence. + */ + log_prob_threshold?: number; + /** + * Optional threshold (in seconds) to skip silent periods that may cause hallucinations. + */ + hallucination_silence_threshold?: number; +} +interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output { + transcription_info?: { + /** + * The language of the audio being transcribed or translated. + */ + language?: string; + /** + * The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1. + */ + language_probability?: number; + /** + * The total duration of the original audio file, in seconds. + */ + duration?: number; + /** + * The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds. + */ + duration_after_vad?: number; + }; + /** + * The complete transcription of the audio. + */ + text: string; + /** + * The total number of words in the transcription. + */ + word_count?: number; + segments?: { + /** + * The starting time of the segment within the audio, in seconds. + */ + start?: number; + /** + * The ending time of the segment within the audio, in seconds. + */ + end?: number; + /** + * The transcription of the segment. + */ + text?: string; + /** + * The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs. + */ + temperature?: number; + /** + * The average log probability of the predictions for the words in this segment, indicating overall confidence. + */ + avg_logprob?: number; + /** + * The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process. + */ + compression_ratio?: number; + /** + * The probability that the segment contains no speech, represented as a decimal between 0 and 1. + */ + no_speech_prob?: number; + words?: { + /** + * The individual word transcribed from the audio. + */ + word?: string; + /** + * The starting time of the word within the audio, in seconds. + */ + start?: number; + /** + * The ending time of the word within the audio, in seconds. + */ + end?: number; + }[]; + }[]; + /** + * The transcription in WebVTT format, which includes timing and text information for use in subtitles. + */ + vtt?: string; +} +declare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo { + inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input; + postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output; +} +type Ai_Cf_Baai_Bge_M3_Input = Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts | Ai_Cf_Baai_Bge_M3_Input_Embedding | { + /** + * Batch of the embeddings requests to run using async-queue + */ + requests: (Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 | Ai_Cf_Baai_Bge_M3_Input_Embedding_1)[]; +}; +interface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts { + /** + * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts + */ + query?: string; + /** + * List of provided contexts. Note that the index in this array is important, as the response will refer to it. + */ + contexts: { + /** + * One of the provided context content + */ + text?: string; + }[]; + /** + * When provided with too long context should the model error out or truncate the context to fit? + */ + truncate_inputs?: boolean; +} +interface Ai_Cf_Baai_Bge_M3_Input_Embedding { + text: string | string[]; + /** + * When provided with too long context should the model error out or truncate the context to fit? + */ + truncate_inputs?: boolean; +} +interface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 { + /** + * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts + */ + query?: string; + /** + * List of provided contexts. Note that the index in this array is important, as the response will refer to it. + */ + contexts: { + /** + * One of the provided context content + */ + text?: string; + }[]; + /** + * When provided with too long context should the model error out or truncate the context to fit? + */ + truncate_inputs?: boolean; +} +interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 { + text: string | string[]; + /** + * When provided with too long context should the model error out or truncate the context to fit? + */ + truncate_inputs?: boolean; +} +type Ai_Cf_Baai_Bge_M3_Output = Ai_Cf_Baai_Bge_M3_Output_Query | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts | Ai_Cf_Baai_Bge_M3_Output_Embedding | Ai_Cf_Baai_Bge_M3_AsyncResponse; +interface Ai_Cf_Baai_Bge_M3_Output_Query { + response?: { + /** + * Index of the context in the request + */ + id?: number; + /** + * Score of the context under the index. + */ + score?: number; + }[]; +} +interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts { + response?: number[][]; + shape?: number[]; + /** + * The pooling method used in the embedding process. + */ + pooling?: "mean" | "cls"; +} +interface Ai_Cf_Baai_Bge_M3_Output_Embedding { + shape?: number[]; + /** + * Embeddings of the requested text values + */ + data?: number[][]; + /** + * The pooling method used in the embedding process. + */ + pooling?: "mean" | "cls"; +} +interface Ai_Cf_Baai_Bge_M3_AsyncResponse { + /** + * The async request id that can be used to obtain the results. + */ + request_id?: string; +} +declare abstract class Base_Ai_Cf_Baai_Bge_M3 { + inputs: Ai_Cf_Baai_Bge_M3_Input; + postProcessedOutputs: Ai_Cf_Baai_Bge_M3_Output; +} +interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input { + /** + * A text description of the image you want to generate. + */ + prompt: string; + /** + * The number of diffusion steps; higher values can improve quality but take longer. + */ + steps?: number; +} +interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output { + /** + * The generated image in Base64 format. + */ + image?: string; +} +declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell { + inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input; + postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output; +} +type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt | Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages; +interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt { + /** + * The input text prompt for the model to generate a response. + */ + prompt: string; + image?: number[] | (string & NonNullable); + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; + /** + * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. + */ + lora?: string; +} +interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages { + /** + * An array of message objects representing the conversation history. + */ + messages: { + /** + * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). + */ + role?: string; + /** + * The tool call id. If you don't know what to put here you can fall back to 000000001 + */ + tool_call_id?: string; + content?: string | { + /** + * Type of the content provided + */ + type?: string; + text?: string; + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string; + }; + }[] | { + /** + * Type of the content provided + */ + type?: string; + text?: string; + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string; + }; + }; + }[]; + image?: number[] | (string & NonNullable); + functions?: { + name: string; + code: string; + }[]; + /** + * A list of tools available for the assistant to use. + */ + tools?: ({ + /** + * The name of the tool. More descriptive the better. + */ + name: string; + /** + * A brief description of what the tool does. + */ + description: string; + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + } | { + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string; + /** + * Details of the function tool. + */ + function: { + /** + * The name of the function. + */ + name: string; + /** + * A brief description of what the function does. + */ + description: string; + /** + * Schema defining the parameters accepted by the function. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + }; + })[]; + /** + * If true, the response will be streamed back incrementally. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output = { + /** + * The generated text response from the model + */ + response?: string; + /** + * An array of tool calls requests made during the response generation + */ + tool_calls?: { + /** + * The arguments passed to be passed to the tool call request + */ + arguments?: object; + /** + * The name of the tool to be called + */ + name?: string; + }[]; +}; +declare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct { + inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input; + postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output; +} +type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input = Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch; +interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt { + /** + * The input text prompt for the model to generate a response. + */ + prompt: string; + /** + * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. + */ + lora?: string; + response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode { + type?: "json_object" | "json_schema"; + json_schema?: unknown; +} +interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages { + /** + * An array of message objects representing the conversation history. + */ + messages: { + /** + * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). + */ + role: string; + content: string | { + /** + * Type of the content (text) + */ + type?: string; + /** + * Text content + */ + text?: string; + }[]; + }[]; + functions?: { + name: string; + code: string; + }[]; + /** + * A list of tools available for the assistant to use. + */ + tools?: ({ + /** + * The name of the tool. More descriptive the better. + */ + name: string; + /** + * A brief description of what the tool does. + */ + description: string; + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + } | { + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string; + /** + * Details of the function tool. + */ + function: { + /** + * The name of the function. + */ + name: string; + /** + * A brief description of what the function does. + */ + description: string; + /** + * Schema defining the parameters accepted by the function. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + }; + })[]; + response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1 { + type?: "json_object" | "json_schema"; + json_schema?: unknown; +} +interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch { + requests?: { + /** + * User-supplied reference. This field will be present in the response as well it can be used to reference the request and response. It's NOT validated to be unique. + */ + external_reference?: string; + /** + * Prompt for the text generation model + */ + prompt?: string; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; + response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2; + }[]; +} +interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2 { + type?: "json_object" | "json_schema"; + json_schema?: unknown; +} +type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output = { + /** + * The generated text response from the model + */ + response: string; + /** + * Usage statistics for the inference request + */ + usage?: { + /** + * Total number of tokens in input + */ + prompt_tokens?: number; + /** + * Total number of tokens in output + */ + completion_tokens?: number; + /** + * Total number of input and output tokens + */ + total_tokens?: number; + }; + /** + * An array of tool calls requests made during the response generation + */ + tool_calls?: { + /** + * The arguments passed to be passed to the tool call request + */ + arguments?: object; + /** + * The name of the tool to be called + */ + name?: string; + }[]; +} | string | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse; +interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse { + /** + * The async request id that can be used to obtain the results. + */ + request_id?: string; +} +declare abstract class Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast { + inputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input; + postProcessedOutputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output; +} +interface Ai_Cf_Meta_Llama_Guard_3_8B_Input { + /** + * An array of message objects representing the conversation history. + */ + messages: { + /** + * The role of the message sender must alternate between 'user' and 'assistant'. + */ + role: "user" | "assistant"; + /** + * The content of the message as a string. + */ + content: string; + }[]; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Dictate the output format of the generated response. + */ + response_format?: { + /** + * Set to json_object to process and output generated text as JSON. + */ + type?: string; + }; +} +interface Ai_Cf_Meta_Llama_Guard_3_8B_Output { + response?: string | { + /** + * Whether the conversation is safe or not. + */ + safe?: boolean; + /** + * A list of what hazard categories predicted for the conversation, if the conversation is deemed unsafe. + */ + categories?: string[]; + }; + /** + * Usage statistics for the inference request + */ + usage?: { + /** + * Total number of tokens in input + */ + prompt_tokens?: number; + /** + * Total number of tokens in output + */ + completion_tokens?: number; + /** + * Total number of input and output tokens + */ + total_tokens?: number; + }; +} +declare abstract class Base_Ai_Cf_Meta_Llama_Guard_3_8B { + inputs: Ai_Cf_Meta_Llama_Guard_3_8B_Input; + postProcessedOutputs: Ai_Cf_Meta_Llama_Guard_3_8B_Output; +} +interface Ai_Cf_Baai_Bge_Reranker_Base_Input { + /** + * A query you wish to perform against the provided contexts. + */ + /** + * Number of returned results starting with the best score. + */ + top_k?: number; + /** + * List of provided contexts. Note that the index in this array is important, as the response will refer to it. + */ + contexts: { + /** + * One of the provided context content + */ + text?: string; + }[]; +} +interface Ai_Cf_Baai_Bge_Reranker_Base_Output { + response?: { + /** + * Index of the context in the request + */ + id?: number; + /** + * Score of the context under the index. + */ + score?: number; + }[]; +} +declare abstract class Base_Ai_Cf_Baai_Bge_Reranker_Base { + inputs: Ai_Cf_Baai_Bge_Reranker_Base_Input; + postProcessedOutputs: Ai_Cf_Baai_Bge_Reranker_Base_Output; +} +type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input = Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt | Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages; +interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt { + /** + * The input text prompt for the model to generate a response. + */ + prompt: string; + /** + * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. + */ + lora?: string; + response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode { + type?: "json_object" | "json_schema"; + json_schema?: unknown; +} +interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages { + /** + * An array of message objects representing the conversation history. + */ + messages: { + /** + * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). + */ + role: string; + /** + * The content of the message as a string. + */ + content: string; + }[]; + functions?: { + name: string; + code: string; + }[]; + /** + * A list of tools available for the assistant to use. + */ + tools?: ({ + /** + * The name of the tool. More descriptive the better. + */ + name: string; + /** + * A brief description of what the tool does. + */ + description: string; + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + } | { + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string; + /** + * Details of the function tool. + */ + function: { + /** + * The name of the function. + */ + name: string; + /** + * A brief description of what the function does. + */ + description: string; + /** + * Schema defining the parameters accepted by the function. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + }; + })[]; + response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1 { + type?: "json_object" | "json_schema"; + json_schema?: unknown; +} +type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output = { + /** + * The generated text response from the model + */ + response: string; + /** + * Usage statistics for the inference request + */ + usage?: { + /** + * Total number of tokens in input + */ + prompt_tokens?: number; + /** + * Total number of tokens in output + */ + completion_tokens?: number; + /** + * Total number of input and output tokens + */ + total_tokens?: number; + }; + /** + * An array of tool calls requests made during the response generation + */ + tool_calls?: { + /** + * The arguments passed to be passed to the tool call request + */ + arguments?: object; + /** + * The name of the tool to be called + */ + name?: string; + }[]; +}; +declare abstract class Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct { + inputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input; + postProcessedOutputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output; +} +type Ai_Cf_Qwen_Qwq_32B_Input = Ai_Cf_Qwen_Qwq_32B_Prompt | Ai_Cf_Qwen_Qwq_32B_Messages; +interface Ai_Cf_Qwen_Qwq_32B_Prompt { + /** + * The input text prompt for the model to generate a response. + */ + prompt: string; + /** + * JSON schema that should be fulfilled for the response. + */ + guided_json?: object; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +interface Ai_Cf_Qwen_Qwq_32B_Messages { + /** + * An array of message objects representing the conversation history. + */ + messages: { + /** + * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). + */ + role?: string; + /** + * The tool call id. If you don't know what to put here you can fall back to 000000001 + */ + tool_call_id?: string; + content?: string | { + /** + * Type of the content provided + */ + type?: string; + text?: string; + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string; + }; + }[] | { + /** + * Type of the content provided + */ + type?: string; + text?: string; + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string; + }; + }; + }[]; + functions?: { + name: string; + code: string; + }[]; + /** + * A list of tools available for the assistant to use. + */ + tools?: ({ + /** + * The name of the tool. More descriptive the better. + */ + name: string; + /** + * A brief description of what the tool does. + */ + description: string; + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + } | { + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string; + /** + * Details of the function tool. + */ + function: { + /** + * The name of the function. + */ + name: string; + /** + * A brief description of what the function does. + */ + description: string; + /** + * Schema defining the parameters accepted by the function. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + }; + })[]; + /** + * JSON schema that should be fufilled for the response. + */ + guided_json?: object; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +type Ai_Cf_Qwen_Qwq_32B_Output = { + /** + * The generated text response from the model + */ + response: string; + /** + * Usage statistics for the inference request + */ + usage?: { + /** + * Total number of tokens in input + */ + prompt_tokens?: number; + /** + * Total number of tokens in output + */ + completion_tokens?: number; + /** + * Total number of input and output tokens + */ + total_tokens?: number; + }; + /** + * An array of tool calls requests made during the response generation + */ + tool_calls?: { + /** + * The arguments passed to be passed to the tool call request + */ + arguments?: object; + /** + * The name of the tool to be called + */ + name?: string; + }[]; +}; +declare abstract class Base_Ai_Cf_Qwen_Qwq_32B { + inputs: Ai_Cf_Qwen_Qwq_32B_Input; + postProcessedOutputs: Ai_Cf_Qwen_Qwq_32B_Output; +} +type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input = Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt | Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages; +interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt { + /** + * The input text prompt for the model to generate a response. + */ + prompt: string; + /** + * JSON schema that should be fulfilled for the response. + */ + guided_json?: object; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages { + /** + * An array of message objects representing the conversation history. + */ + messages: { + /** + * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). + */ + role?: string; + /** + * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001 + */ + tool_call_id?: string; + content?: string | { + /** + * Type of the content provided + */ + type?: string; + text?: string; + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string; + }; + }[] | { + /** + * Type of the content provided + */ + type?: string; + text?: string; + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string; + }; + }; + }[]; + functions?: { + name: string; + code: string; + }[]; + /** + * A list of tools available for the assistant to use. + */ + tools?: ({ + /** + * The name of the tool. More descriptive the better. + */ + name: string; + /** + * A brief description of what the tool does. + */ + description: string; + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + } | { + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string; + /** + * Details of the function tool. + */ + function: { + /** + * The name of the function. + */ + name: string; + /** + * A brief description of what the function does. + */ + description: string; + /** + * Schema defining the parameters accepted by the function. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + }; + })[]; + /** + * JSON schema that should be fufilled for the response. + */ + guided_json?: object; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output = { + /** + * The generated text response from the model + */ + response: string; + /** + * Usage statistics for the inference request + */ + usage?: { + /** + * Total number of tokens in input + */ + prompt_tokens?: number; + /** + * Total number of tokens in output + */ + completion_tokens?: number; + /** + * Total number of input and output tokens + */ + total_tokens?: number; + }; + /** + * An array of tool calls requests made during the response generation + */ + tool_calls?: { + /** + * The arguments passed to be passed to the tool call request + */ + arguments?: object; + /** + * The name of the tool to be called + */ + name?: string; + }[]; +}; +declare abstract class Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct { + inputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input; + postProcessedOutputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output; +} +type Ai_Cf_Google_Gemma_3_12B_It_Input = Ai_Cf_Google_Gemma_3_12B_It_Prompt | Ai_Cf_Google_Gemma_3_12B_It_Messages; +interface Ai_Cf_Google_Gemma_3_12B_It_Prompt { + /** + * The input text prompt for the model to generate a response. + */ + prompt: string; + /** + * JSON schema that should be fufilled for the response. + */ + guided_json?: object; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +interface Ai_Cf_Google_Gemma_3_12B_It_Messages { + /** + * An array of message objects representing the conversation history. + */ + messages: { + /** + * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). + */ + role?: string; + content?: string | { + /** + * Type of the content provided + */ + type?: string; + text?: string; + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string; + }; + }[]; + }[]; + functions?: { + name: string; + code: string; + }[]; + /** + * A list of tools available for the assistant to use. + */ + tools?: ({ + /** + * The name of the tool. More descriptive the better. + */ + name: string; + /** + * A brief description of what the tool does. + */ + description: string; + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + } | { + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string; + /** + * Details of the function tool. + */ + function: { + /** + * The name of the function. + */ + name: string; + /** + * A brief description of what the function does. + */ + description: string; + /** + * Schema defining the parameters accepted by the function. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + }; + })[]; + /** + * JSON schema that should be fufilled for the response. + */ + guided_json?: object; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +type Ai_Cf_Google_Gemma_3_12B_It_Output = { + /** + * The generated text response from the model + */ + response: string; + /** + * Usage statistics for the inference request + */ + usage?: { + /** + * Total number of tokens in input + */ + prompt_tokens?: number; + /** + * Total number of tokens in output + */ + completion_tokens?: number; + /** + * Total number of input and output tokens + */ + total_tokens?: number; + }; + /** + * An array of tool calls requests made during the response generation + */ + tool_calls?: { + /** + * The arguments passed to be passed to the tool call request + */ + arguments?: object; + /** + * The name of the tool to be called + */ + name?: string; + }[]; +}; +declare abstract class Base_Ai_Cf_Google_Gemma_3_12B_It { + inputs: Ai_Cf_Google_Gemma_3_12B_It_Input; + postProcessedOutputs: Ai_Cf_Google_Gemma_3_12B_It_Output; +} +type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input = Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch; +interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt { + /** + * The input text prompt for the model to generate a response. + */ + prompt: string; + /** + * JSON schema that should be fulfilled for the response. + */ + guided_json?: object; + response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode { + type?: "json_object" | "json_schema"; + json_schema?: unknown; +} +interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages { + /** + * An array of message objects representing the conversation history. + */ + messages: { + /** + * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). + */ + role?: string; + /** + * The tool call id. If you don't know what to put here you can fall back to 000000001 + */ + tool_call_id?: string; + content?: string | { + /** + * Type of the content provided + */ + type?: string; + text?: string; + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string; + }; + }[] | { + /** + * Type of the content provided + */ + type?: string; + text?: string; + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string; + }; + }; + }[]; + functions?: { + name: string; + code: string; + }[]; + /** + * A list of tools available for the assistant to use. + */ + tools?: ({ + /** + * The name of the tool. More descriptive the better. + */ + name: string; + /** + * A brief description of what the tool does. + */ + description: string; + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + } | { + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string; + /** + * Details of the function tool. + */ + function: { + /** + * The name of the function. + */ + name: string; + /** + * A brief description of what the function does. + */ + description: string; + /** + * Schema defining the parameters accepted by the function. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + }; + })[]; + response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode; + /** + * JSON schema that should be fufilled for the response. + */ + guided_json?: object; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch { + requests: (Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner)[]; +} +interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner { + /** + * The input text prompt for the model to generate a response. + */ + prompt: string; + /** + * JSON schema that should be fulfilled for the response. + */ + guided_json?: object; + response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner { + /** + * An array of message objects representing the conversation history. + */ + messages: { + /** + * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). + */ + role?: string; + /** + * The tool call id. If you don't know what to put here you can fall back to 000000001 + */ + tool_call_id?: string; + content?: string | { + /** + * Type of the content provided + */ + type?: string; + text?: string; + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string; + }; + }[] | { + /** + * Type of the content provided + */ + type?: string; + text?: string; + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string; + }; + }; + }[]; + functions?: { + name: string; + code: string; + }[]; + /** + * A list of tools available for the assistant to use. + */ + tools?: ({ + /** + * The name of the tool. More descriptive the better. + */ + name: string; + /** + * A brief description of what the tool does. + */ + description: string; + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + } | { + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string; + /** + * Details of the function tool. + */ + function: { + /** + * The name of the function. + */ + name: string; + /** + * A brief description of what the function does. + */ + description: string; + /** + * Schema defining the parameters accepted by the function. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + }; + })[]; + response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode; + /** + * JSON schema that should be fufilled for the response. + */ + guided_json?: object; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = { + /** + * The generated text response from the model + */ + response: string; + /** + * Usage statistics for the inference request + */ + usage?: { + /** + * Total number of tokens in input + */ + prompt_tokens?: number; + /** + * Total number of tokens in output + */ + completion_tokens?: number; + /** + * Total number of input and output tokens + */ + total_tokens?: number; + }; + /** + * An array of tool calls requests made during the response generation + */ + tool_calls?: { + /** + * The tool call id. + */ + id?: string; + /** + * Specifies the type of tool (e.g., 'function'). + */ + type?: string; + /** + * Details of the function tool. + */ + function?: { + /** + * The name of the tool to be called + */ + name?: string; + /** + * The arguments passed to be passed to the tool call request + */ + arguments?: object; + }; + }[]; +}; +declare abstract class Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct { + inputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input; + postProcessedOutputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output; +} +type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input = Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch; +interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt { + /** + * The input text prompt for the model to generate a response. + */ + prompt: string; + /** + * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. + */ + lora?: string; + response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode { + type?: "json_object" | "json_schema"; + json_schema?: unknown; +} +interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages { + /** + * An array of message objects representing the conversation history. + */ + messages: { + /** + * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). + */ + role: string; + content: string | { + /** + * Type of the content (text) + */ + type?: string; + /** + * Text content + */ + text?: string; + }[]; + }[]; + functions?: { + name: string; + code: string; + }[]; + /** + * A list of tools available for the assistant to use. + */ + tools?: ({ + /** + * The name of the tool. More descriptive the better. + */ + name: string; + /** + * A brief description of what the tool does. + */ + description: string; + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + } | { + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string; + /** + * Details of the function tool. + */ + function: { + /** + * The name of the function. + */ + name: string; + /** + * A brief description of what the function does. + */ + description: string; + /** + * Schema defining the parameters accepted by the function. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + }; + })[]; + response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1 { + type?: "json_object" | "json_schema"; + json_schema?: unknown; +} +interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch { + requests: (Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1)[]; +} +interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 { + /** + * The input text prompt for the model to generate a response. + */ + prompt: string; + /** + * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. + */ + lora?: string; + response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2 { + type?: "json_object" | "json_schema"; + json_schema?: unknown; +} +interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 { + /** + * An array of message objects representing the conversation history. + */ + messages: { + /** + * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). + */ + role: string; + content: string | { + /** + * Type of the content (text) + */ + type?: string; + /** + * Text content + */ + text?: string; + }[]; + }[]; + functions?: { + name: string; + code: string; + }[]; + /** + * A list of tools available for the assistant to use. + */ + tools?: ({ + /** + * The name of the tool. More descriptive the better. + */ + name: string; + /** + * A brief description of what the tool does. + */ + description: string; + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + } | { + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string; + /** + * Details of the function tool. + */ + function: { + /** + * The name of the function. + */ + name: string; + /** + * A brief description of what the function does. + */ + description: string; + /** + * Schema defining the parameters accepted by the function. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + }; + })[]; + response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3 { + type?: "json_object" | "json_schema"; + json_schema?: unknown; +} +type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output = Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response | string | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse; +interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response { + /** + * Unique identifier for the completion + */ + id?: string; + /** + * Object type identifier + */ + object?: "chat.completion"; + /** + * Unix timestamp of when the completion was created + */ + created?: number; + /** + * Model used for the completion + */ + model?: string; + /** + * List of completion choices + */ + choices?: { + /** + * Index of the choice in the list + */ + index?: number; + /** + * The message generated by the model + */ + message?: { + /** + * Role of the message author + */ + role: string; + /** + * The content of the message + */ + content: string; + /** + * Internal reasoning content (if available) + */ + reasoning_content?: string; + /** + * Tool calls made by the assistant + */ + tool_calls?: { + /** + * Unique identifier for the tool call + */ + id: string; + /** + * Type of tool call + */ + type: "function"; + function: { + /** + * Name of the function to call + */ + name: string; + /** + * JSON string of arguments for the function + */ + arguments: string; + }; + }[]; + }; + /** + * Reason why the model stopped generating + */ + finish_reason?: string; + /** + * Stop reason (may be null) + */ + stop_reason?: string | null; + /** + * Log probabilities (if requested) + */ + logprobs?: {} | null; + }[]; + /** + * Usage statistics for the inference request + */ + usage?: { + /** + * Total number of tokens in input + */ + prompt_tokens?: number; + /** + * Total number of tokens in output + */ + completion_tokens?: number; + /** + * Total number of input and output tokens + */ + total_tokens?: number; + }; + /** + * Log probabilities for the prompt (if requested) + */ + prompt_logprobs?: {} | null; +} +interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response { + /** + * Unique identifier for the completion + */ + id?: string; + /** + * Object type identifier + */ + object?: "text_completion"; + /** + * Unix timestamp of when the completion was created + */ + created?: number; + /** + * Model used for the completion + */ + model?: string; + /** + * List of completion choices + */ + choices?: { + /** + * Index of the choice in the list + */ + index: number; + /** + * The generated text completion + */ + text: string; + /** + * Reason why the model stopped generating + */ + finish_reason: string; + /** + * Stop reason (may be null) + */ + stop_reason?: string | null; + /** + * Log probabilities (if requested) + */ + logprobs?: {} | null; + /** + * Log probabilities for the prompt (if requested) + */ + prompt_logprobs?: {} | null; + }[]; + /** + * Usage statistics for the inference request + */ + usage?: { + /** + * Total number of tokens in input + */ + prompt_tokens?: number; + /** + * Total number of tokens in output + */ + completion_tokens?: number; + /** + * Total number of input and output tokens + */ + total_tokens?: number; + }; +} +interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse { + /** + * The async request id that can be used to obtain the results. + */ + request_id?: string; +} +declare abstract class Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8 { + inputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input; + postProcessedOutputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output; +} +interface Ai_Cf_Deepgram_Nova_3_Input { + audio: { + body: object; + contentType: string; + }; + /** + * Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param. + */ + custom_topic_mode?: "extended" | "strict"; + /** + * Custom topics you want the model to detect within your input audio or text if present Submit up to 100 + */ + custom_topic?: string; + /** + * Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in addition those submitted using the custom_intents param + */ + custom_intent_mode?: "extended" | "strict"; + /** + * Custom intents you want the model to detect within your input audio if present + */ + custom_intent?: string; + /** + * Identifies and extracts key entities from content in submitted audio + */ + detect_entities?: boolean; + /** + * Identifies the dominant language spoken in submitted audio + */ + detect_language?: boolean; + /** + * Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0 + */ + diarize?: boolean; + /** + * Identify and extract key entities from content in submitted audio + */ + dictation?: boolean; + /** + * Specify the expected encoding of your submitted audio + */ + encoding?: "linear16" | "flac" | "mulaw" | "amr-nb" | "amr-wb" | "opus" | "speex" | "g729"; + /** + * Arbitrary key-value pairs that are attached to the API response for usage in downstream processing + */ + extra?: string; + /** + * Filler Words can help transcribe interruptions in your audio, like 'uh' and 'um' + */ + filler_words?: boolean; + /** + * Key term prompting can boost or suppress specialized terminology and brands. + */ + keyterm?: string; + /** + * Keywords can boost or suppress specialized terminology and brands. + */ + keywords?: string; + /** + * The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available. + */ + language?: string; + /** + * Spoken measurements will be converted to their corresponding abbreviations. + */ + measurements?: boolean; + /** + * Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip. + */ + mip_opt_out?: boolean; + /** + * Mode of operation for the model representing broad area of topic that will be talked about in the supplied audio + */ + mode?: "general" | "medical" | "finance"; + /** + * Transcribe each audio channel independently. + */ + multichannel?: boolean; + /** + * Numerals converts numbers from written format to numerical format. + */ + numerals?: boolean; + /** + * Splits audio into paragraphs to improve transcript readability. + */ + paragraphs?: boolean; + /** + * Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely. + */ + profanity_filter?: boolean; + /** + * Add punctuation and capitalization to the transcript. + */ + punctuate?: boolean; + /** + * Redaction removes sensitive information from your transcripts. + */ + redact?: string; + /** + * Search for terms or phrases in submitted audio and replaces them. + */ + replace?: string; + /** + * Search for terms or phrases in submitted audio. + */ + search?: string; + /** + * Recognizes the sentiment throughout a transcript or text. + */ + sentiment?: boolean; + /** + * Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability. + */ + smart_format?: boolean; + /** + * Detect topics throughout a transcript or text. + */ + topics?: boolean; + /** + * Segments speech into meaningful semantic units. + */ + utterances?: boolean; + /** + * Seconds to wait before detecting a pause between words in submitted audio. + */ + utt_split?: number; + /** + * The number of channels in the submitted audio + */ + channels?: number; + /** + * Specifies whether the streaming endpoint should provide ongoing transcription updates as more audio is received. When set to true, the endpoint sends continuous updates, meaning transcription results may evolve over time. Note: Supported only for webosockets. + */ + interim_results?: boolean; + /** + * Indicates how long model will wait to detect whether a speaker has finished speaking or pauses for a significant period of time. When set to a value, the streaming endpoint immediately finalizes the transcription for the processed time range and returns the transcript with a speech_final parameter set to true. Can also be set to false to disable endpointing + */ + endpointing?: string; + /** + * Indicates that speech has started. You'll begin receiving Speech Started messages upon speech starting. Note: Supported only for webosockets. + */ + vad_events?: boolean; + /** + * Indicates how long model will wait to send an UtteranceEnd message after a word has been transcribed. Use with interim_results. Note: Supported only for webosockets. + */ + utterance_end_ms?: boolean; +} +interface Ai_Cf_Deepgram_Nova_3_Output { + results?: { + channels?: { + alternatives?: { + confidence?: number; + transcript?: string; + words?: { + confidence?: number; + end?: number; + start?: number; + word?: string; + }[]; + }[]; + }[]; + summary?: { + result?: string; + short?: string; + }; + sentiments?: { + segments?: { + text?: string; + start_word?: number; + end_word?: number; + sentiment?: string; + sentiment_score?: number; + }[]; + average?: { + sentiment?: string; + sentiment_score?: number; + }; + }; + }; +} +declare abstract class Base_Ai_Cf_Deepgram_Nova_3 { + inputs: Ai_Cf_Deepgram_Nova_3_Input; + postProcessedOutputs: Ai_Cf_Deepgram_Nova_3_Output; +} +interface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input { + queries?: string | string[]; + /** + * Optional instruction for the task + */ + instruction?: string; + documents?: string | string[]; + text?: string | string[]; +} +interface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output { + data?: number[][]; + shape?: number[]; +} +declare abstract class Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B { + inputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input; + postProcessedOutputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output; +} +type Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input = { + /** + * readable stream with audio data and content-type specified for that data + */ + audio: { + body: object; + contentType: string; + }; + /** + * type of data PCM data that's sent to the inference server as raw array + */ + dtype?: "uint8" | "float32" | "float64"; +} | { + /** + * base64 encoded audio data + */ + audio: string; + /** + * type of data PCM data that's sent to the inference server as raw array + */ + dtype?: "uint8" | "float32" | "float64"; +}; +interface Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output { + /** + * if true, end-of-turn was detected + */ + is_complete?: boolean; + /** + * probability of the end-of-turn detection + */ + probability?: number; +} +declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 { + inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input; + postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output; +} +declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { + inputs: XOR; + postProcessedOutputs: XOR; +} +declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { + inputs: XOR; + postProcessedOutputs: XOR; +} +interface Ai_Cf_Leonardo_Phoenix_1_0_Input { + /** + * A text description of the image you want to generate. + */ + prompt: string; + /** + * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt + */ + guidance?: number; + /** + * Random seed for reproducibility of the image generation + */ + seed?: number; + /** + * The height of the generated image in pixels + */ + height?: number; + /** + * The width of the generated image in pixels + */ + width?: number; + /** + * The number of diffusion steps; higher values can improve quality but take longer + */ + num_steps?: number; + /** + * Specify what to exclude from the generated images + */ + negative_prompt?: string; +} +/** + * The generated image in JPEG format + */ +type Ai_Cf_Leonardo_Phoenix_1_0_Output = string; +declare abstract class Base_Ai_Cf_Leonardo_Phoenix_1_0 { + inputs: Ai_Cf_Leonardo_Phoenix_1_0_Input; + postProcessedOutputs: Ai_Cf_Leonardo_Phoenix_1_0_Output; +} +interface Ai_Cf_Leonardo_Lucid_Origin_Input { + /** + * A text description of the image you want to generate. + */ + prompt: string; + /** + * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt + */ + guidance?: number; + /** + * Random seed for reproducibility of the image generation + */ + seed?: number; + /** + * The height of the generated image in pixels + */ + height?: number; + /** + * The width of the generated image in pixels + */ + width?: number; + /** + * The number of diffusion steps; higher values can improve quality but take longer + */ + num_steps?: number; + /** + * The number of diffusion steps; higher values can improve quality but take longer + */ + steps?: number; +} +interface Ai_Cf_Leonardo_Lucid_Origin_Output { + /** + * The generated image in Base64 format. + */ + image?: string; +} +declare abstract class Base_Ai_Cf_Leonardo_Lucid_Origin { + inputs: Ai_Cf_Leonardo_Lucid_Origin_Input; + postProcessedOutputs: Ai_Cf_Leonardo_Lucid_Origin_Output; +} +interface Ai_Cf_Deepgram_Aura_1_Input { + /** + * Speaker used to produce the audio. + */ + speaker?: "angus" | "asteria" | "arcas" | "orion" | "orpheus" | "athena" | "luna" | "zeus" | "perseus" | "helios" | "hera" | "stella"; + /** + * Encoding of the output audio. + */ + encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac"; + /** + * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type.. + */ + container?: "none" | "wav" | "ogg"; + /** + * The text content to be converted to speech + */ + text: string; + /** + * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable + */ + sample_rate?: number; + /** + * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type. + */ + bit_rate?: number; +} +/** + * The generated audio in MP3 format + */ +type Ai_Cf_Deepgram_Aura_1_Output = string; +declare abstract class Base_Ai_Cf_Deepgram_Aura_1 { + inputs: Ai_Cf_Deepgram_Aura_1_Input; + postProcessedOutputs: Ai_Cf_Deepgram_Aura_1_Output; +} +interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input { + /** + * Input text to translate. Can be a single string or a list of strings. + */ + text: string | string[]; + /** + * Target langauge to translate to + */ + target_language: "asm_Beng" | "awa_Deva" | "ben_Beng" | "bho_Deva" | "brx_Deva" | "doi_Deva" | "eng_Latn" | "gom_Deva" | "gon_Deva" | "guj_Gujr" | "hin_Deva" | "hne_Deva" | "kan_Knda" | "kas_Arab" | "kas_Deva" | "kha_Latn" | "lus_Latn" | "mag_Deva" | "mai_Deva" | "mal_Mlym" | "mar_Deva" | "mni_Beng" | "mni_Mtei" | "npi_Deva" | "ory_Orya" | "pan_Guru" | "san_Deva" | "sat_Olck" | "snd_Arab" | "snd_Deva" | "tam_Taml" | "tel_Telu" | "urd_Arab" | "unr_Deva"; +} +interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output { + /** + * Translated texts + */ + translations: string[]; +} +declare abstract class Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B { + inputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input; + postProcessedOutputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output; +} +type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input = Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch; +interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt { + /** + * The input text prompt for the model to generate a response. + */ + prompt: string; + /** + * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. + */ + lora?: string; + response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode { + type?: "json_object" | "json_schema"; + json_schema?: unknown; +} +interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages { + /** + * An array of message objects representing the conversation history. + */ + messages: { + /** + * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). + */ + role: string; + content: string | { + /** + * Type of the content (text) + */ + type?: string; + /** + * Text content + */ + text?: string; + }[]; + }[]; + functions?: { + name: string; + code: string; + }[]; + /** + * A list of tools available for the assistant to use. + */ + tools?: ({ + /** + * The name of the tool. More descriptive the better. + */ + name: string; + /** + * A brief description of what the tool does. + */ + description: string; + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + } | { + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string; + /** + * Details of the function tool. + */ + function: { + /** + * The name of the function. + */ + name: string; + /** + * A brief description of what the function does. + */ + description: string; + /** + * Schema defining the parameters accepted by the function. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + }; + })[]; + response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1 { + type?: "json_object" | "json_schema"; + json_schema?: unknown; +} +interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch { + requests: (Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1)[]; +} +interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 { + /** + * The input text prompt for the model to generate a response. + */ + prompt: string; + /** + * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. + */ + lora?: string; + response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2 { + type?: "json_object" | "json_schema"; + json_schema?: unknown; +} +interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 { + /** + * An array of message objects representing the conversation history. + */ + messages: { + /** + * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). + */ + role: string; + content: string | { + /** + * Type of the content (text) + */ + type?: string; + /** + * Text content + */ + text?: string; + }[]; + }[]; + functions?: { + name: string; + code: string; + }[]; + /** + * A list of tools available for the assistant to use. + */ + tools?: ({ + /** + * The name of the tool. More descriptive the better. + */ + name: string; + /** + * A brief description of what the tool does. + */ + description: string; + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + } | { + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string; + /** + * Details of the function tool. + */ + function: { + /** + * The name of the function. + */ + name: string; + /** + * A brief description of what the function does. + */ + description: string; + /** + * Schema defining the parameters accepted by the function. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + /** + * List of required parameter names. + */ + required?: string[]; + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string; + /** + * A description of the expected parameter. + */ + description: string; + }; + }; + }; + }; + })[]; + response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3; + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean; + /** + * If true, the response will be streamed back incrementally using SSE, Server Sent Events. + */ + stream?: boolean; + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + /** + * Controls the randomness of the output; higher values produce more random results. + */ + temperature?: number; + /** + * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. + */ + top_p?: number; + /** + * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. + */ + top_k?: number; + /** + * Random seed for reproducibility of the generation. + */ + seed?: number; + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number; + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; +} +interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3 { + type?: "json_object" | "json_schema"; + json_schema?: unknown; +} +type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output = Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response | string | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse; +interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response { + /** + * Unique identifier for the completion + */ + id?: string; + /** + * Object type identifier + */ + object?: "chat.completion"; + /** + * Unix timestamp of when the completion was created + */ + created?: number; + /** + * Model used for the completion + */ + model?: string; + /** + * List of completion choices + */ + choices?: { + /** + * Index of the choice in the list + */ + index?: number; + /** + * The message generated by the model + */ + message?: { + /** + * Role of the message author + */ + role: string; + /** + * The content of the message + */ + content: string; + /** + * Internal reasoning content (if available) + */ + reasoning_content?: string; + /** + * Tool calls made by the assistant + */ + tool_calls?: { + /** + * Unique identifier for the tool call + */ + id: string; + /** + * Type of tool call + */ + type: "function"; + function: { + /** + * Name of the function to call + */ + name: string; + /** + * JSON string of arguments for the function + */ + arguments: string; + }; + }[]; + }; + /** + * Reason why the model stopped generating + */ + finish_reason?: string; + /** + * Stop reason (may be null) + */ + stop_reason?: string | null; + /** + * Log probabilities (if requested) + */ + logprobs?: {} | null; + }[]; + /** + * Usage statistics for the inference request + */ + usage?: { + /** + * Total number of tokens in input + */ + prompt_tokens?: number; + /** + * Total number of tokens in output + */ + completion_tokens?: number; + /** + * Total number of input and output tokens + */ + total_tokens?: number; + }; + /** + * Log probabilities for the prompt (if requested) + */ + prompt_logprobs?: {} | null; +} +interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response { + /** + * Unique identifier for the completion + */ + id?: string; + /** + * Object type identifier + */ + object?: "text_completion"; + /** + * Unix timestamp of when the completion was created + */ + created?: number; + /** + * Model used for the completion + */ + model?: string; + /** + * List of completion choices + */ + choices?: { + /** + * Index of the choice in the list + */ + index: number; + /** + * The generated text completion + */ + text: string; + /** + * Reason why the model stopped generating + */ + finish_reason: string; + /** + * Stop reason (may be null) + */ + stop_reason?: string | null; + /** + * Log probabilities (if requested) + */ + logprobs?: {} | null; + /** + * Log probabilities for the prompt (if requested) + */ + prompt_logprobs?: {} | null; + }[]; + /** + * Usage statistics for the inference request + */ + usage?: { + /** + * Total number of tokens in input + */ + prompt_tokens?: number; + /** + * Total number of tokens in output + */ + completion_tokens?: number; + /** + * Total number of input and output tokens + */ + total_tokens?: number; + }; +} +interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse { + /** + * The async request id that can be used to obtain the results. + */ + request_id?: string; +} +declare abstract class Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It { + inputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input; + postProcessedOutputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output; +} +interface Ai_Cf_Pfnet_Plamo_Embedding_1B_Input { + /** + * Input text to embed. Can be a single string or a list of strings. + */ + text: string | string[]; +} +interface Ai_Cf_Pfnet_Plamo_Embedding_1B_Output { + /** + * Embedding vectors, where each vector is a list of floats. + */ + data: number[][]; + /** + * Shape of the embedding data as [number_of_embeddings, embedding_dimension]. + * + * @minItems 2 + * @maxItems 2 + */ + shape: [ + number, + number + ]; +} +declare abstract class Base_Ai_Cf_Pfnet_Plamo_Embedding_1B { + inputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Input; + postProcessedOutputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Output; +} +interface Ai_Cf_Deepgram_Flux_Input { + /** + * Encoding of the audio stream. Currently only supports raw signed little-endian 16-bit PCM. + */ + encoding: "linear16"; + /** + * Sample rate of the audio stream in Hz. + */ + sample_rate: string; + /** + * End-of-turn confidence required to fire an eager end-of-turn event. When set, enables EagerEndOfTurn and TurnResumed events. Valid Values 0.3 - 0.9. + */ + eager_eot_threshold?: string; + /** + * End-of-turn confidence required to finish a turn. Valid Values 0.5 - 0.9. + */ + eot_threshold?: string; + /** + * A turn will be finished when this much time has passed after speech, regardless of EOT confidence. + */ + eot_timeout_ms?: string; + /** + * Keyterm prompting can improve recognition of specialized terminology. Pass multiple keyterm query parameters to boost multiple keyterms. + */ + keyterm?: string; + /** + * Opts out requests from the Deepgram Model Improvement Program. Refer to Deepgram Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip + */ + mip_opt_out?: "true" | "false"; + /** + * Label your requests for the purpose of identification during usage reporting + */ + tag?: string; +} +/** + * Output will be returned as websocket messages. + */ +interface Ai_Cf_Deepgram_Flux_Output { + /** + * The unique identifier of the request (uuid) + */ + request_id?: string; + /** + * Starts at 0 and increments for each message the server sends to the client. + */ + sequence_id?: number; + /** + * The type of event being reported. + */ + event?: "Update" | "StartOfTurn" | "EagerEndOfTurn" | "TurnResumed" | "EndOfTurn"; + /** + * The index of the current turn + */ + turn_index?: number; + /** + * Start time in seconds of the audio range that was transcribed + */ + audio_window_start?: number; + /** + * End time in seconds of the audio range that was transcribed + */ + audio_window_end?: number; + /** + * Text that was said over the course of the current turn + */ + transcript?: string; + /** + * The words in the transcript + */ + words?: { + /** + * The individual punctuated, properly-cased word from the transcript + */ + word: string; + /** + * Confidence that this word was transcribed correctly + */ + confidence: number; + }[]; + /** + * Confidence that no more speech is coming in this turn + */ + end_of_turn_confidence?: number; +} +declare abstract class Base_Ai_Cf_Deepgram_Flux { + inputs: Ai_Cf_Deepgram_Flux_Input; + postProcessedOutputs: Ai_Cf_Deepgram_Flux_Output; +} +interface Ai_Cf_Deepgram_Aura_2_En_Input { + /** + * Speaker used to produce the audio. + */ + speaker?: "amalthea" | "andromeda" | "apollo" | "arcas" | "aries" | "asteria" | "athena" | "atlas" | "aurora" | "callista" | "cora" | "cordelia" | "delia" | "draco" | "electra" | "harmonia" | "helena" | "hera" | "hermes" | "hyperion" | "iris" | "janus" | "juno" | "jupiter" | "luna" | "mars" | "minerva" | "neptune" | "odysseus" | "ophelia" | "orion" | "orpheus" | "pandora" | "phoebe" | "pluto" | "saturn" | "thalia" | "theia" | "vesta" | "zeus"; + /** + * Encoding of the output audio. + */ + encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac"; + /** + * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type.. + */ + container?: "none" | "wav" | "ogg"; + /** + * The text content to be converted to speech + */ + text: string; + /** + * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable + */ + sample_rate?: number; + /** + * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type. + */ + bit_rate?: number; +} +/** + * The generated audio in MP3 format + */ +type Ai_Cf_Deepgram_Aura_2_En_Output = string; +declare abstract class Base_Ai_Cf_Deepgram_Aura_2_En { + inputs: Ai_Cf_Deepgram_Aura_2_En_Input; + postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_En_Output; +} +interface Ai_Cf_Deepgram_Aura_2_Es_Input { + /** + * Speaker used to produce the audio. + */ + speaker?: "sirio" | "nestor" | "carina" | "celeste" | "alvaro" | "diana" | "aquila" | "selena" | "estrella" | "javier"; + /** + * Encoding of the output audio. + */ + encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac"; + /** + * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type.. + */ + container?: "none" | "wav" | "ogg"; + /** + * The text content to be converted to speech + */ + text: string; + /** + * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable + */ + sample_rate?: number; + /** + * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type. + */ + bit_rate?: number; +} +/** + * The generated audio in MP3 format + */ +type Ai_Cf_Deepgram_Aura_2_Es_Output = string; +declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es { + inputs: Ai_Cf_Deepgram_Aura_2_Es_Input; + postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output; +} +interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input { + multipart: { + body?: object; + contentType?: string; + }; +} +interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output { + /** + * Generated image as Base64 string. + */ + image?: string; +} +declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev { + inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input; + postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output; +} +interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input { + multipart: { + body?: object; + contentType?: string; + }; +} +interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output { + /** + * Generated image as Base64 string. + */ + image?: string; +} +declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B { + inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input; + postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output; +} +interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input { + multipart: { + body?: object; + contentType?: string; + }; +} +interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output { + /** + * Generated image as Base64 string. + */ + image?: string; +} +declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B { + inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input; + postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output; +} +declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { + inputs: ChatCompletionsInput; + postProcessedOutputs: ChatCompletionsOutput; +} +declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { + inputs: ChatCompletionsInput; + postProcessedOutputs: ChatCompletionsOutput; +} +declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 { + inputs: ChatCompletionsInput; + postProcessedOutputs: ChatCompletionsOutput; +} +declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { + inputs: ChatCompletionsInput; + postProcessedOutputs: ChatCompletionsOutput; +} +declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { + inputs: ChatCompletionsInput; + postProcessedOutputs: ChatCompletionsOutput; +} +declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { + inputs: ChatCompletionsInput; + postProcessedOutputs: ChatCompletionsOutput; +} +declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { + inputs: ChatCompletionsInput; + postProcessedOutputs: ChatCompletionsOutput; +} +interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input { + /** + * Which Moondream skill to run. + */ + task?: "query" | "caption" | "point" | "detect"; + /** + * Input image as a public HTTPS URL or base64 data URI. Optional for `query`; required for `caption`, `point`, and `detect`. + */ + image?: string; + /** + * Question for the `query` task. + */ + question?: string; + /** + * Caption length for the `caption` task. + */ + caption_length?: "short" | "normal" | "long"; + /** + * Object phrase to locate for `point` and `detect` tasks (e.g. 'person wearing a red shirt'). + */ + target?: string; + /** + * Enable reasoning trace for the `query` task. + */ + reasoning?: boolean; + /** + * Sampling temperature. + */ + temperature?: number; + /** + * Top-p (nucleus) sampling. + */ + top_p?: number; + /** + * Max tokens to generate for `query` and `caption`. + */ + max_tokens?: number; + /** + * Max objects to return for `point` and `detect`. + */ + max_objects?: number; + /** + * Return incremental tokens for `query` and `caption`. `point` and `detect` do not support streaming. + */ + stream?: boolean; +} +interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output { + /** + * Reason the generation finished. + */ + finish_reason: string; + metrics: { + /** + * Number of input tokens consumed. + */ + input_tokens: number; + /** + * Number of output tokens generated. + */ + output_tokens: number; + /** + * Prefill time in milliseconds. + */ + prefill_time_ms: number; + /** + * Decode time in milliseconds. + */ + decode_time_ms: number; + /** + * Time to first token in milliseconds. + */ + ttft_ms: number; + }; + /** + * Answer text for the `query` task. Null for other tasks. + */ + answer?: string; + /** + * Caption text for the `caption` task. Null for other tasks. + */ + caption?: string; + /** + * Located points for the `point` task. Null for other tasks. + */ + points?: { + /** + * X coordinate. + */ + x: number; + /** + * Y coordinate. + */ + y: number; + }[]; + /** + * Detected bounding boxes for the `detect` task. Null for other tasks. + */ + objects?: { + /** + * Minimum X coordinate. + */ + x_min: number; + /** + * Minimum Y coordinate. + */ + y_min: number; + /** + * Maximum X coordinate. + */ + x_max: number; + /** + * Maximum Y coordinate. + */ + y_max: number; + }[]; + /** + * Reasoning trace for the `query` task when reasoning=true. Null otherwise. + */ + reasoning?: { + /** + * Reasoning text. + */ + text: string; + /** + * Grounding information. + */ + grounding?: {}[]; + }; +} +declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B { + inputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input; + postProcessedOutputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output; +} +declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { + inputs: ChatCompletionsInput; + postProcessedOutputs: ChatCompletionsOutput; +} +declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { + inputs: ChatCompletionsInput; + postProcessedOutputs: ChatCompletionsOutput; +} +declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { + inputs: ChatCompletionsInput; + postProcessedOutputs: ChatCompletionsOutput; +} +declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { + inputs: ChatCompletionsInput; + postProcessedOutputs: ChatCompletionsOutput; +} +interface AiModels { + "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification; + "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage; + "@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage; + "@cf/runwayml/stable-diffusion-v1-5-img2img": BaseAiTextToImage; + "@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage; + "@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage; + "@cf/myshell-ai/melotts": BaseAiTextToSpeech; + "@cf/google/embeddinggemma-300m": BaseAiTextEmbeddings; + "@cf/microsoft/resnet-50": BaseAiImageClassification; + "@cf/meta/llama-2-7b-chat-int8": BaseAiTextGeneration; + "@cf/mistral/mistral-7b-instruct-v0.1": BaseAiTextGeneration; + "@cf/meta/llama-2-7b-chat-fp16": BaseAiTextGeneration; + "@hf/thebloke/llama-2-13b-chat-awq": BaseAiTextGeneration; + "@hf/thebloke/mistral-7b-instruct-v0.1-awq": BaseAiTextGeneration; + "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration; + "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration; + "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration; + "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration; + "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration; + "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration; + "@cf/defog/sqlcoder-7b-2": BaseAiTextGeneration; + "@cf/openchat/openchat-3.5-0106": BaseAiTextGeneration; + "@cf/tiiuae/falcon-7b-instruct": BaseAiTextGeneration; + "@cf/thebloke/discolm-german-7b-v1-awq": BaseAiTextGeneration; + "@cf/qwen/qwen1.5-0.5b-chat": BaseAiTextGeneration; + "@cf/qwen/qwen1.5-7b-chat-awq": BaseAiTextGeneration; + "@cf/qwen/qwen1.5-14b-chat-awq": BaseAiTextGeneration; + "@cf/tinyllama/tinyllama-1.1b-chat-v1.0": BaseAiTextGeneration; + "@cf/microsoft/phi-2": BaseAiTextGeneration; + "@cf/qwen/qwen1.5-1.8b-chat": BaseAiTextGeneration; + "@cf/mistral/mistral-7b-instruct-v0.2-lora": BaseAiTextGeneration; + "@hf/nousresearch/hermes-2-pro-mistral-7b": BaseAiTextGeneration; + "@hf/nexusflow/starling-lm-7b-beta": BaseAiTextGeneration; + "@hf/google/gemma-7b-it": BaseAiTextGeneration; + "@cf/meta-llama/llama-2-7b-chat-hf-lora": BaseAiTextGeneration; + "@cf/google/gemma-2b-it-lora": BaseAiTextGeneration; + "@cf/google/gemma-7b-it-lora": BaseAiTextGeneration; + "@hf/mistral/mistral-7b-instruct-v0.2": BaseAiTextGeneration; + "@cf/meta/llama-3-8b-instruct": BaseAiTextGeneration; + "@cf/fblgit/una-cybertron-7b-v2-bf16": BaseAiTextGeneration; + "@cf/meta/llama-3-8b-instruct-awq": BaseAiTextGeneration; + "@cf/meta/llama-3.1-8b-instruct-fp8": BaseAiTextGeneration; + "@cf/meta/llama-3.1-8b-instruct-awq": BaseAiTextGeneration; + "@cf/meta/llama-3.2-3b-instruct": BaseAiTextGeneration; + "@cf/meta/llama-3.2-1b-instruct": BaseAiTextGeneration; + "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b": BaseAiTextGeneration; + "@cf/ibm-granite/granite-4.0-h-micro": BaseAiTextGeneration; + "@cf/facebook/bart-large-cnn": BaseAiSummarization; + "@cf/llava-hf/llava-1.5-7b-hf": BaseAiImageToText; + "@cf/baai/bge-base-en-v1.5": Base_Ai_Cf_Baai_Bge_Base_En_V1_5; + "@cf/openai/whisper": Base_Ai_Cf_Openai_Whisper; + "@cf/meta/m2m100-1.2b": Base_Ai_Cf_Meta_M2M100_1_2B; + "@cf/baai/bge-small-en-v1.5": Base_Ai_Cf_Baai_Bge_Small_En_V1_5; + "@cf/baai/bge-large-en-v1.5": Base_Ai_Cf_Baai_Bge_Large_En_V1_5; + "@cf/unum/uform-gen2-qwen-500m": Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M; + "@cf/openai/whisper-tiny-en": Base_Ai_Cf_Openai_Whisper_Tiny_En; + "@cf/openai/whisper-large-v3-turbo": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo; + "@cf/baai/bge-m3": Base_Ai_Cf_Baai_Bge_M3; + "@cf/black-forest-labs/flux-1-schnell": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell; + "@cf/meta/llama-3.2-11b-vision-instruct": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct; + "@cf/meta/llama-3.3-70b-instruct-fp8-fast": Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast; + "@cf/meta/llama-guard-3-8b": Base_Ai_Cf_Meta_Llama_Guard_3_8B; + "@cf/baai/bge-reranker-base": Base_Ai_Cf_Baai_Bge_Reranker_Base; + "@cf/qwen/qwen2.5-coder-32b-instruct": Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct; + "@cf/qwen/qwq-32b": Base_Ai_Cf_Qwen_Qwq_32B; + "@cf/mistralai/mistral-small-3.1-24b-instruct": Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct; + "@cf/google/gemma-3-12b-it": Base_Ai_Cf_Google_Gemma_3_12B_It; + "@cf/meta/llama-4-scout-17b-16e-instruct": Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct; + "@cf/qwen/qwen3-30b-a3b-fp8": Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8; + "@cf/deepgram/nova-3": Base_Ai_Cf_Deepgram_Nova_3; + "@cf/qwen/qwen3-embedding-0.6b": Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B; + "@cf/pipecat-ai/smart-turn-v2": Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2; + "@cf/openai/gpt-oss-120b": Base_Ai_Cf_Openai_Gpt_Oss_120B; + "@cf/openai/gpt-oss-20b": Base_Ai_Cf_Openai_Gpt_Oss_20B; + "@cf/leonardo/phoenix-1.0": Base_Ai_Cf_Leonardo_Phoenix_1_0; + "@cf/leonardo/lucid-origin": Base_Ai_Cf_Leonardo_Lucid_Origin; + "@cf/deepgram/aura-1": Base_Ai_Cf_Deepgram_Aura_1; + "@cf/ai4bharat/indictrans2-en-indic-1B": Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B; + "@cf/aisingapore/gemma-sea-lion-v4-27b-it": Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It; + "@cf/pfnet/plamo-embedding-1b": Base_Ai_Cf_Pfnet_Plamo_Embedding_1B; + "@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux; + "@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En; + "@cf/deepgram/aura-2-es": Base_Ai_Cf_Deepgram_Aura_2_Es; + "@cf/black-forest-labs/flux-2-dev": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev; + "@cf/black-forest-labs/flux-2-klein-4b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B; + "@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B; + "@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash; + "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5; + "@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6; + "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B; + "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT; + "@cf/moonshotai/kimi-k2.7-code": Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code; + "@cf/zai-org/glm-5.2": Base_Ai_Cf_Zai_Org_Glm_5_2; + "@cf/moondream/moondream3.1-9B-A2B": Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B; + "@cf/deepseek-ai/deepseek-v4-flash-0731": Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731; + "@cf/deepseek-ai/deepseek-v4-pro-0813": Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813; + "@cf/qwen/qwen3.8-27b": Base_Ai_Cf_Qwen_Qwen3_8_27B; + "@cf/zai-org/glm-5.3-flash": Base_Ai_Cf_Zai_Org_Glm_5_3_Flash; +} +type AiOptions = { + /** + * Send requests as an asynchronous batch job, only works for supported models + * https://developers.cloudflare.com/workers-ai/features/batch-api + */ + queueRequest?: boolean; + /** + * Establish websocket connections, only works for supported models + */ + websocket?: boolean; + /** + * Tag your requests to group and view them in Cloudflare dashboard. + * + * Rules: + * Tags must only contain letters, numbers, and the symbols: : - . / @ + * Each tag can have maximum 50 characters. + * Maximum 5 tags are allowed each request. + * Duplicate tags will removed. + */ + tags?: string[]; + gateway?: GatewayOptions; + returnRawResponse?: boolean; + prefix?: string; + extraHeaders?: object; + signal?: AbortSignal; +}; +type AiModelsSearchParams = { + author?: string; + hide_experimental?: boolean; + page?: number; + per_page?: number; + search?: string; + source?: number; + task?: string; +}; +type AiModelsSearchObject = { + id: string; + source: number; + name: string; + description: string; + task: { + id: string; + name: string; + description: string; + }; + tags: string[]; + properties: { + property_id: string; + value: string; + }[]; +}; +type ChatCompletionsBase = ChatCompletionsMessagesInput; +type ChatCompletionsInput = ChatCompletionsMessagesInput; +interface InferenceUpstreamError extends Error { +} +interface AiInternalError extends Error { +} +type AiModelListType = Record; +type AiAsyncBatchResponse = { + request_id: string; +}; +declare abstract class Ai { + aiGatewayLogId: string | null; + gateway(gatewayId: string): AiGateway; + /** + * @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead. + * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ + */ + aiSearch(): AiSearchNamespace; + /** + * @deprecated AutoRAG has been replaced by AI Search. + * Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead. + * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ + * + * @param autoragId Instance ID + */ + autorag(autoragId: string): AutoRAG; + // Batch request + run(model: Name, inputs: { + requests: AiModelList[Name]['inputs'][]; + }, options: AiOptions & { + queueRequest: true; + }): Promise; + // Raw response + run(model: Name, inputs: AiModelList[Name]['inputs'], options: AiOptions & { + returnRawResponse: true; + }): Promise; + // WebSocket + run(model: Name, inputs: AiModelList[Name]['inputs'], options: AiOptions & { + websocket: true; + }): Promise; + // Streaming + run(model: Name, inputs: AiModelList[Name]['inputs'] & { + stream: true; + }, options?: AiOptions): Promise; + // Normal (default) - known model + run(model: Name, inputs: AiModelList[Name]['inputs'], options?: AiOptions): Promise; + // Unknown model (fallback). + // + // The `Exclude<..., keyof AiModelList>` constraint forces TypeScript to + // route any model name that is a literal key of `AiModelList` to one of + // the known-model overloads above (so input/output mismatches surface as + // type errors rather than silently falling back to `Record`). + // Names that aren't in `AiModelList` — e.g. third-party gateway models + // like `"google/nano-banana"` — still hit this overload. + run(model: Model extends keyof AiModelList ? never : Model, inputs: Record, options?: AiOptions): Promise>; + models(params?: AiModelsSearchParams): Promise; + toMarkdown(): ToMarkdownService; + toMarkdown(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise; + toMarkdown(files: MarkdownDocument, options?: ConversionRequestOptions): Promise; +} +type GatewayRetries = { + maxAttempts?: 1 | 2 | 3 | 4 | 5; + retryDelayMs?: number; + backoff?: 'constant' | 'linear' | 'exponential'; +}; +type GatewayOptions = { + id: string; + cacheKey?: string; + cacheTtl?: number; + skipCache?: boolean; + metadata?: Record; + collectLog?: boolean; + eventId?: string; + requestTimeoutMs?: number; + retries?: GatewayRetries; +}; +type UniversalGatewayOptions = Exclude & { + /** + ** @deprecated + */ + id?: string; +}; +type AiGatewayPatchLog = { + score?: number | null; + feedback?: -1 | 1 | null; + metadata?: Record | null; +}; +type AiGatewayLog = { + id: string; + provider: string; + model: string; + model_type?: string; + path: string; + duration: number; + request_type?: string; + request_content_type?: string; + status_code: number; + response_content_type?: string; + success: boolean; + cached: boolean; + tokens_in?: number; + tokens_out?: number; + metadata?: Record; + step?: number; + cost?: number; + custom_cost?: boolean; + request_size: number; + request_head?: string; + request_head_complete: boolean; + response_size: number; + response_head?: string; + response_head_complete: boolean; + created_at: Date; +}; +type AIGatewayProviders = 'workers-ai' | 'anthropic' | 'aws-bedrock' | 'azure-openai' | 'google-vertex-ai' | 'huggingface' | 'openai' | 'perplexity-ai' | 'replicate' | 'groq' | 'cohere' | 'google-ai-studio' | 'mistral' | 'grok' | 'openrouter' | 'deepseek' | 'cerebras' | 'cartesia' | 'elevenlabs' | 'adobe-firefly'; +type AIGatewayHeaders = { + 'cf-aig-metadata': Record | string; + 'cf-aig-custom-cost': { + per_token_in?: number; + per_token_out?: number; + } | { + total_cost?: number; + } | string; + 'cf-aig-cache-ttl': number | string; + 'cf-aig-skip-cache': boolean | string; + 'cf-aig-cache-key': string; + 'cf-aig-event-id': string; + 'cf-aig-request-timeout': number | string; + 'cf-aig-max-attempts': number | string; + 'cf-aig-retry-delay': number | string; + 'cf-aig-backoff': string; + 'cf-aig-collect-log': boolean | string; + Authorization: string; + 'Content-Type': string; + [key: string]: string | number | boolean | object; +}; +type AIGatewayUniversalRequest = { + provider: AIGatewayProviders | string; // eslint-disable-line + endpoint: string; + headers: Partial; + query: unknown; +}; +interface AiGatewayInternalError extends Error { +} +interface AiGatewayLogNotFound extends Error { +} +declare abstract class AiGateway { + patchLog(logId: string, data: AiGatewayPatchLog): Promise; + getLog(logId: string): Promise; + run(data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[], options?: { + gateway?: UniversalGatewayOptions; + extraHeaders?: object; + signal?: AbortSignal; + }): Promise; + getUrl(provider?: AIGatewayProviders | string): Promise; // eslint-disable-line +} +// Copyright (c) 2022-2025 Cloudflare, Inc. +// Licensed under the Apache 2.0 license found in the LICENSE file or at: +// https://opensource.org/licenses/Apache-2.0 +/** + * Artifacts — Git-compatible file storage on Cloudflare Workers. + * + * Provides programmatic access to create, manage, and fork repositories, + * and to issue and revoke scoped access tokens. + */ +/** Information about a repository. */ +interface ArtifactsRepoInfo { + /** Unique repository ID. */ + id: string; + /** Repository name. */ + name: string; + /** Repository description, or null if not set. */ + description: string | null; + /** Default branch name (e.g. "main"). */ + defaultBranch: string; + /** ISO 8601 creation timestamp. */ + createdAt: string; + /** ISO 8601 last-updated timestamp. */ + updatedAt: string; + /** ISO 8601 timestamp of the last push, or null if never pushed. */ + lastPushAt: string | null; + /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */ + source: string | null; + /** Whether the repository is read-only. */ + readOnly: boolean; + /** HTTPS git remote URL. */ + remote: string; +} +/** Result of creating a repository — includes the initial access token. */ +interface ArtifactsCreateRepoResult { + /** Unique repository ID. */ + id: string; + /** Repository name. */ + name: string; + /** Repository description, or null if not set. */ + description: string | null; + /** Default branch name. */ + defaultBranch: string; + /** HTTPS git remote URL. */ + remote: string; + /** Plaintext access token (only returned at creation time). */ + token: string; + /** ISO 8601 token expiry timestamp. */ + tokenExpiresAt: string; +} +/** Paginated list of repositories. */ +interface ArtifactsRepoListResult { + /** Repositories in this page (without the `remote` field). */ + repos: Omit[]; + /** Total number of repositories in the namespace. */ + total: number; + /** Cursor for the next page, if there are more results. */ + cursor?: string; +} +/** Result of creating an access token. */ +interface ArtifactsCreateTokenResult { + /** Unique token ID. */ + id: string; + /** Plaintext token (only returned at creation time). */ + plaintext: string; + /** Token scope: "read" or "write". */ + scope: 'read' | 'write'; + /** ISO 8601 token expiry timestamp. */ + expiresAt: string; +} +/** Token metadata (no plaintext). */ +interface ArtifactsTokenInfo { + /** Unique token ID. */ + id: string; + /** Token scope: "read" or "write". */ + scope: 'read' | 'write'; + /** Token state: "active", "expired", or "revoked". */ + state: 'active' | 'expired' | 'revoked'; + /** ISO 8601 creation timestamp. */ + createdAt: string; + /** ISO 8601 expiry timestamp. */ + expiresAt: string; +} +/** Paginated list of tokens for a repository. */ +interface ArtifactsTokenListResult { + /** Tokens in this page. */ + tokens: ArtifactsTokenInfo[]; + /** Total number of tokens for the repository. */ + total: number; +} +/** + * Handle for a single repository. Returned by Artifacts.get(). + * + * Methods may throw `ArtifactsError` with code `INTERNAL_ERROR` if an unexpected service error occurs. + */ +interface ArtifactsRepo extends ArtifactsRepoInfo { + /** + * Create an access token for this repo. + * @param scope Token scope: "write" (default) or "read". + * @param ttl Time-to-live in seconds (default 86400, min 60, max 31536000). + * @throws {ArtifactsError} with code `INVALID_TTL` if ttl is out of range. + */ + createToken(scope?: 'write' | 'read', ttl?: number): Promise; + /** List tokens for this repo (metadata only, no plaintext). */ + listTokens(): Promise; + /** + * Revoke a token by plaintext or ID. + * @param tokenOrId Plaintext token or token ID. + * @returns true if revoked, false if not found. + * @throws {ArtifactsError} with code `INVALID_INPUT` if tokenOrId is empty. + */ + revokeToken(tokenOrId: string): Promise; + // ── Fork ── + /** + * Fork this repo to a new repo. + * @param name Target repository name. + * @param opts Optional: description, readOnly flag, defaultBranchOnly (default true). + * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if name is invalid. + * @throws {ArtifactsError} with code `ALREADY_EXISTS` if the target repo already exists. + * @throws {ArtifactsError} with code `FORK_IN_PROGRESS` if a fork is already running. + */ + fork(name: string, opts?: { + description?: string; + readOnly?: boolean; + defaultBranchOnly?: boolean; + }): Promise; +} +// ── Error types ────────────────────────────────────────────────────────────── +/** + * Error codes returned by Artifacts binding operations. + * + * Each code maps to a numeric code available on `ArtifactsError.numericCode`. + */ +type ArtifactsErrorCode = 'ALREADY_EXISTS' | 'NOT_FOUND' | 'IMPORT_IN_PROGRESS' | 'FORK_IN_PROGRESS' | 'INVALID_INPUT' | 'INVALID_REPO_NAME' | 'INVALID_TTL' | 'INVALID_URL' | 'REMOTE_AUTH_REQUIRED' | 'UPSTREAM_UNAVAILABLE' | 'MEMORY_LIMIT' | 'INTERNAL_ERROR'; +/** + * Error thrown by Artifacts binding operations. + * + * Uses a string `.code` discriminator following the Cloudflare platform + * convention (StreamError, ImagesError, etc.). The `.numericCode` matches + * the REST API `errors[].code` values. + */ +interface ArtifactsError extends Error { + readonly name: 'ArtifactsError'; + /** String error code for programmatic matching. */ + readonly code: ArtifactsErrorCode; + /** Numeric error code matching the REST API. */ + readonly numericCode: number; +} +// ── Binding ────────────────────────────────────────────────────────────────── +/** + * Artifacts binding — namespace-level operations. + * + * Methods may throw `ArtifactsError` with code `INTERNAL_ERROR` if an unexpected service error occurs. + */ +interface Artifacts { + /** + * Create a new repository with an initial access token. + * @param name Repository name (alphanumeric, dots, hyphens, underscores). + * @param opts Optional: readOnly flag, description, default branch name. + * @returns Repo metadata with initial token. + * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if name is invalid. + * @throws {ArtifactsError} with code `ALREADY_EXISTS` if the repo already exists. + */ + create(name: string, opts?: { + readOnly?: boolean; + description?: string; + setDefaultBranch?: string; + }): Promise; + /** + * Get a handle to an existing repository. + * @param name Repository name. + * @returns Repo handle. + * @throws {ArtifactsError} with code `NOT_FOUND` if the repo does not exist. + * @throws {ArtifactsError} with code `IMPORT_IN_PROGRESS` if the repo is still importing. + * @throws {ArtifactsError} with code `FORK_IN_PROGRESS` if the repo is still forking. + */ + get(name: string): Promise; + /** + * Import a repository from an external git remote. + * @param params Source URL and optional branch/depth, plus target name and options. + * @returns Repo metadata with initial token. + * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if the target name is invalid. + * @throws {ArtifactsError} with code `INVALID_INPUT` if the source URL is not valid HTTPS. + * @throws {ArtifactsError} with code `INVALID_URL` if the source URL does not point to a git repository. + * @throws {ArtifactsError} with code `REMOTE_AUTH_REQUIRED` if the remote requires authentication. + * @throws {ArtifactsError} with code `NOT_FOUND` if the remote repository does not exist. + * @throws {ArtifactsError} with code `UPSTREAM_UNAVAILABLE` if the remote cannot be reached. + * @throws {ArtifactsError} with code `MEMORY_LIMIT` if the import exceeds service memory limits. + * @throws {ArtifactsError} with code `ALREADY_EXISTS` if the target repo already exists. + */ + import(params: { + source: { + url: string; + branch?: string; + depth?: number; + }; + target: { + name: string; + opts?: { + description?: string; + readOnly?: boolean; + }; + }; + }): Promise; + /** + * List repositories with cursor-based pagination. + * @param opts Optional: limit (1–200, default 50), cursor for next page. + */ + list(opts?: { + limit?: number; + cursor?: string; + }): Promise; + /** + * Delete a repository and all associated tokens. + * @param name Repository name. + * @returns true if deleted, false if not found. + * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if name is invalid. + */ + delete(name: string): Promise; +} +/** + * @deprecated Use the standalone AI Search Workers binding instead. + * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ + */ +interface AutoRAGInternalError extends Error { +} +/** + * @deprecated Use the standalone AI Search Workers binding instead. + * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ + */ +interface AutoRAGNotFoundError extends Error { +} +/** + * @deprecated Use the standalone AI Search Workers binding instead. + * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ + */ +interface AutoRAGUnauthorizedError extends Error { +} +/** + * @deprecated Use the standalone AI Search Workers binding instead. + * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ + */ +interface AutoRAGNameNotSetError extends Error { +} +type ComparisonFilter = { + key: string; + type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte'; + value: string | number | boolean; +}; +type CompoundFilter = { + type: 'and' | 'or'; + filters: ComparisonFilter[]; +}; +/** + * @deprecated Use the standalone AI Search Workers binding instead. + * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ + */ +type AutoRagSearchRequest = { + query: string; + filters?: CompoundFilter | ComparisonFilter; + max_num_results?: number; + ranking_options?: { + ranker?: string; + score_threshold?: number; + }; + reranking?: { + enabled?: boolean; + model?: string; + }; + rewrite_query?: boolean; +}; +/** + * @deprecated Use the standalone AI Search Workers binding instead. + * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ + */ +type AutoRagAiSearchRequest = AutoRagSearchRequest & { + stream?: boolean; + system_prompt?: string; +}; +/** + * @deprecated Use the standalone AI Search Workers binding instead. + * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ + */ +type AutoRagAiSearchRequestStreaming = Omit & { + stream: true; +}; +/** + * @deprecated Use the standalone AI Search Workers binding instead. + * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ + */ +type AutoRagSearchResponse = { + object: 'vector_store.search_results.page'; + search_query: string; + data: { + file_id: string; + filename: string; + score: number; + attributes: Record; + content: { + type: 'text'; + text: string; + }[]; + }[]; + has_more: boolean; + next_page: string | null; +}; +/** + * @deprecated Use the standalone AI Search Workers binding instead. + * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ + */ +type AutoRagListResponse = { + id: string; + enable: boolean; + type: string; + source: string; + vectorize_name: string; + paused: boolean; + status: string; +}[]; +/** + * @deprecated Use the standalone AI Search Workers binding instead. + * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ + */ +type AutoRagAiSearchResponse = AutoRagSearchResponse & { + response: string; +}; +/** + * @deprecated Use the standalone AI Search Workers binding instead. + * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ + */ +declare abstract class AutoRAG { + /** + * @deprecated Use the standalone AI Search Workers binding instead. + * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ + */ + list(): Promise; + /** + * @deprecated Use the standalone AI Search Workers binding instead. + * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ + */ + search(params: AutoRagSearchRequest): Promise; + /** + * @deprecated Use the standalone AI Search Workers binding instead. + * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ + */ + aiSearch(params: AutoRagAiSearchRequestStreaming): Promise; + /** + * @deprecated Use the standalone AI Search Workers binding instead. + * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ + */ + aiSearch(params: AutoRagAiSearchRequest): Promise; + /** + * @deprecated Use the standalone AI Search Workers binding instead. + * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ + */ + aiSearch(params: AutoRagAiSearchRequest): Promise; +} +type BrowserRunLifecycleEvent = 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2'; +type BrowserRunResourceType = 'document' | 'stylesheet' | 'image' | 'media' | 'font' | 'script' | 'texttrack' | 'xhr' | 'fetch' | 'prefetch' | 'eventsource' | 'websocket' | 'manifest' | 'signedexchange' | 'ping' | 'cspviolationreport' | 'preflight' | 'other'; +/** Options fields shared by all quick actions. */ +interface BrowserRunBaseOptions { + /** Adds `