diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de626c8..9af8c37 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,15 +17,6 @@ jobs: strategy: fail-fast: false matrix: - # Pin macOS to macos-14 (Sonoma): the rolling `macos-latest` image - # The "ld: library 'clang_rt.osx' not found" failure is NOT a flaky - # image. It is the linker resolving a clang compiler-rt search path - # (Xcode .../clang//lib/darwin) that no longer exists on the runner, - # because a STALE `target/` was restored from the cache after the - # runner image's default Xcode moved. The real fix is the cache change - # below (we no longer cache `target/`, and the key is bumped to v2 to - # discard the poisoned caches), so the runner choice is no longer - # load-bearing. macos-latest is fine again with a clean target dir. os: [macos-latest, ubuntu-latest] steps: - uses: actions/checkout@v4 @@ -35,20 +26,17 @@ jobs: with: components: clippy - - name: Cache cargo (registry only) + - name: Cache cargo uses: actions/cache@v4 with: - # Deliberately NOT caching `target/`: a `target/` built against a - # different Xcode carries a stale clang compiler-rt search path that - # breaks the linker ("clang_rt.osx not found"). Cache only the - # download-heavy registry/git dirs; recompiling is cheap and correct. path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: ${{ runner.os }}-cargo-v2-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo-v2- + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- - name: Check run: cargo check --workspace @@ -73,13 +61,13 @@ jobs: fail-fast: false matrix: include: - - os: macos-14 + - os: macos-latest target: aarch64-apple-darwin cargo_flags: "" # Intel Mac builds against a system ONNX Runtime via ort-dynamic # (ort-sys has no x86_64-apple-darwin prebuilts). Compile-only here; # runtime linking is a user concern documented in INSTALL-INTEL-MAC.md. - - os: macos-14 + - os: macos-latest target: x86_64-apple-darwin cargo_flags: "--no-default-features --features ort-dynamic,vector-search" - os: ubuntu-latest diff --git a/.github/workflows/guard-no-private-cloud.yml b/.github/workflows/guard-no-private-cloud.yml deleted file mode 100644 index 515e959..0000000 --- a/.github/workflows/guard-no-private-cloud.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Guard — No Private Cloud Code - -# Fails if private Vestige Cloud *service* code (billing, sync-key/namespace -# mapping, Lemon Squeezy webhooks, transactional email) ever lands in this -# public repo. The public cloud *client* is allowed and does not trip this. -on: - push: - branches: [main, feat/cloud-sync-mvp] - pull_request: - workflow_dispatch: - -permissions: - contents: read - -jobs: - guard: - name: No private cloud service code - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - with: - fetch-depth: 0 - - - name: Scan for private cloud service markers - run: ./scripts/check-no-private-cloud.sh diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml deleted file mode 100644 index 2b9f8a5..0000000 --- a/.github/workflows/pages.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Deploy GitHub Pages - -on: - push: - branches: [main, feat/cloud-sync-mvp] - paths: - - 'apps/dashboard/**' - - '.github/workflows/pages.yml' - workflow_dispatch: - -permissions: - contents: read - pages: write - id-token: write - -# Allow one concurrent deployment; let an in-progress run finish. -concurrency: - group: pages - cancel-in-progress: false - -jobs: - deploy: - runs-on: ubuntu-latest - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - env: - # GitHub Pages serves this project repo from the /vestige/ subpath. - # The dashboard must be built with a matching base so every _app/ asset - # resolves instead of 404ing. - VESTIGE_BASE_PATH: /vestige - steps: - - uses: actions/checkout@v5 - - - uses: pnpm/action-setup@v4 - with: - version: 10 - - - uses: actions/setup-node@v5 - with: - node-version: 24 - cache: pnpm - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Build dashboard - run: pnpm --filter @vestige/dashboard build - - - name: Assemble site root - run: | - # The Pages project site is already served from /vestige/, and the - # dashboard is built with base path /vestige (VESTIGE_BASE_PATH), so - # its files go directly at the artifact root — the base path already - # accounts for the subpath. No extra subdirectory or redirect needed. - rm -rf _site - mkdir -p _site - cp -r apps/dashboard/build/* _site/ - - - uses: actions/configure-pages@v5 - - - uses: actions/upload-pages-artifact@v3 - with: - path: _site - - - id: deployment - uses: actions/deploy-pages@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c9ea405..6315588 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,14 +31,7 @@ jobs: - target: x86_64-pc-windows-msvc os: windows-latest archive: zip - # vector-search (usearch HNSW index) is REQUIRED. Without it the - # storage layer's #[cfg(feature = "vector-search")] paths compile - # out, so embeddings are never persisted or queried: the binary - # reports "Embedding Service: Not Ready", 0% coverage, consolidate - # generates 0 embeddings, and no model download is ever attempted. - # usearch builds cleanly on MSVC because vestige-core pins it with - # features=["fp16lib"] (see crates/vestige-core/Cargo.toml). - cargo_flags: "--no-default-features --features embeddings,ort-download,vector-search" + cargo_flags: "" needs_onnxruntime: false # Intel Mac uses the ort-dynamic feature to runtime-link against a # system libonnxruntime (Homebrew), sidestepping the missing @@ -57,93 +50,14 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - with: - ref: ${{ github.event_name == 'workflow_dispatch' && github.sha || github.event.inputs.tag || github.ref }} - - - name: Setup pnpm - uses: pnpm/action-setup@v4 - with: - version: 10 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 22 - name: Install Rust uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} - - name: Validate release version - shell: bash - env: - RELEASE_TAG: ${{ github.event.inputs.tag || github.ref_name }} - run: | - node <<'NODE' - const { execFileSync } = require('node:child_process'); - const tag = process.env.RELEASE_TAG || ''; - const expected = tag.replace(/^refs\/tags\//, '').replace(/^v/, ''); - if (!expected) { - throw new Error('Release tag is empty'); - } - - const packageFiles = [ - 'package.json', - 'apps/dashboard/package.json', - 'packages/vestige-init/package.json', - 'packages/vestige-mcp-npm/package.json' - ]; - for (const file of packageFiles) { - const actual = require(`./${file}`).version; - if (actual !== expected) { - throw new Error(`${file} version ${actual} does not match ${tag}`); - } - } - - const metadata = JSON.parse(execFileSync('cargo', [ - 'metadata', - '--format-version', - '1', - '--locked', - '--no-deps' - ], { encoding: 'utf8' })); - for (const name of ['vestige-core', 'vestige-mcp']) { - const pkg = metadata.packages.find((candidate) => candidate.name === name); - if (!pkg) throw new Error(`Missing Cargo package ${name}`); - if (pkg.version !== expected) { - throw new Error(`${name} version ${pkg.version} does not match ${tag}`); - } - } - NODE - - - name: Build embedded dashboard - shell: bash - env: - RELEASE_TAG: ${{ github.event.inputs.tag || github.ref_name }} - run: | - pnpm install --frozen-lockfile - pnpm --filter @vestige/dashboard check - pnpm --filter @vestige/dashboard test - pnpm --filter @vestige/dashboard build - node <<'NODE' - const fs = require('node:fs'); - const tag = process.env.RELEASE_TAG || ''; - const expected = tag.replace(/^refs\/tags\//, '').replace(/^v/, ''); - const versionFile = 'apps/dashboard/build/_app/version.json'; - const version = JSON.parse(fs.readFileSync(versionFile, 'utf8')).version; - if (version !== expected) { - throw new Error(`${versionFile} version ${version} does not match ${tag}`); - } - for (const file of ['apps/dashboard/build/index.html', versionFile]) { - if (!fs.existsSync(file)) { - throw new Error(`Dashboard build did not produce ${file}`); - } - } - NODE - - name: Build - run: cargo build --locked --package vestige-mcp --release --target ${{ matrix.target }} ${{ matrix.cargo_flags }} + run: cargo build --package vestige-mcp --release --target ${{ matrix.target }} ${{ matrix.cargo_flags }} - name: Package (Unix) if: matrix.os != 'windows-latest' @@ -163,21 +77,10 @@ jobs: cd target/${{ matrix.target }}/release Compress-Archive -Path vestige-mcp.exe,vestige.exe,vestige-restore.exe -DestinationPath ../../../vestige-mcp-${{ matrix.target }}.zip - - name: Generate checksum - shell: bash - run: | - if command -v shasum >/dev/null 2>&1; then - shasum -a 256 vestige-mcp-${{ matrix.target }}.${{ matrix.archive }} > vestige-mcp-${{ matrix.target }}.${{ matrix.archive }}.sha256 - else - sha256sum vestige-mcp-${{ matrix.target }}.${{ matrix.archive }} > vestige-mcp-${{ matrix.target }}.${{ matrix.archive }}.sha256 - fi - - name: Upload to Release uses: softprops/action-gh-release@v2 with: tag_name: ${{ github.event.inputs.tag || github.ref_name }} - files: | - vestige-mcp-${{ matrix.target }}.${{ matrix.archive }} - vestige-mcp-${{ matrix.target }}.${{ matrix.archive }}.sha256 + files: vestige-mcp-${{ matrix.target }}.${{ matrix.archive }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 244fe52..7f169eb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,19 +12,6 @@ env: VESTIGE_TEST_MOCK_EMBEDDINGS: "1" jobs: - hook-tests: - name: Hook Tests - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - run: python3 -m unittest discover -s tests/hooks -p 'test_*.py' - - run: python3 -m py_compile hooks/sanhedrin-local.py tests/hooks/test_sanhedrin_claim_mode.py - - run: bash -n hooks/sanhedrin.sh scripts/install-sandwich.sh scripts/check-sandwich-prereqs.sh - unit-tests: name: Unit Tests runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 80763c9..97c3949 100644 --- a/.gitignore +++ b/.gitignore @@ -139,6 +139,3 @@ apps/dashboard/node_modules/ # ============================================================================= fastembed-rs/ .mcp.json - -.claude/ -.codebase-memory/ diff --git a/CHANGELOG.md b/CHANGELOG.md index a04e3a8..351420c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,400 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [2.2.1] - 2026-07-02 — "Windows embeddings + backfill safety" - -A focused patch release. Two fixes plus a first-run guide. - -### Fixed — Windows embeddings never initialized (#101) - -The `x86_64-pc-windows-msvc` v2.2.0 binary was built without the `vector-search` -feature, so the storage layer's `#[cfg(feature = "vector-search")]` paths compiled -out. On Windows this meant new memories got no embedding, semantic search returned -nothing, `vestige health` reported "Embedding Service: Not Ready" (0% coverage), -and no model download was ever attempted — while v2.1.23 worked on the same machine. -The release build now includes `vector-search` on Windows (it compiles cleanly on -MSVC because `usearch` is pinned with `features = ["fp16lib"]`). npm and direct -downloads are fixed by the same rebuilt release asset. Thanks @Vrakoss for the -precise report. - -### Fixed — Retroactive Salience Backfill: bounded promote + opt-out lever (#103) - -The consolidation-pass backfill promoted root-cause memories with an **uncapped** -`stability * 1.5` FSRS multiply, and a code comment wrongly claimed it was capped. -On a chronically-recurring failure this could inflate a cause's stability without -bound, distorting its review schedule. Backfill promotion is now bounded to -`MIN(stability * 1.5, stability + 365.0)` (the additive +365-day ceiling the -backfill module already computed but never applied), on both the auto-fire and the -manual `backfill` tool paths. Auto-fire remains **on by default** (it shipped and -was documented in v2.2.0) but is now disableable: set `VESTIGE_BACKFILL_AUTOFIRE=0` -(or `false`/`off`/`no`) to turn it off; the manual `backfill` tool + CLI remain -available regardless. Thanks @randomnimbus for the report and the initial patch. - -### Added — First-run guide (#83) - -A single `docs/GETTING-STARTED.md` that consolidates install, "what gets saved", -how to inspect your memory, and project scoping into one 30-minute first-run path, -linked from the README. - -### Credits - -This release was driven by the community: - -- **@Vrakoss** reported the Windows embeddings regression (#101) with a clean, - precise repro that pinned the failure immediately. -- **@randomnimbus** (Peter Lauzon) reported the backfill safety issue (#103) and - contributed the fix — the bounded `promote_memory_backfill` and the - `VESTIGE_BACKFILL_AUTOFIRE` lever shipped as they proposed them - (co-authored in `f7530af`). - -Thank you both. - -## [2.2.0] - 2026-06-29 — "Retroactive Salience + Tool Consolidation" - -Three independent value streams land together as a coherent release. - -### Added — Retroactive Salience Backfill ("Memory with hindsight") - -A faithful port of Cai 2024 (*Nature*). When a **failure** (bug/crash/regression) -is recorded, Vestige reaches **backward in time** and promotes the quiet earlier -memory that *caused* it — the root cause a vector search structurally cannot -surface, because it is not *similar* to the failure, only *causally upstream* -(it shares an entity: the same file, env var, or service). Backward-only by -construction. Auto-fires inside the consolidation pass; also exposed as the -`backfill` MCP tool and the `vestige backfill` CLI command (`--manual`, -`--contrast`, `--no-promote` dry-run). - -### Changed — MCP Tool Consolidation (34 → 13 advertised tools) - -The MCP surface is consolidated from 34 tools to **13**: `recall` (folds -search + deep_reference + contradictions), `maintain` (consolidate/dream/gc/ -importance_score/backup/export/restore), `dedup` (8 merge tools → 1), `graph` -(explore/predict/memory_graph/composed_graph), `memory_status` (system_status/ -memory_health/timeline/changelog), plus `memory`, `codebase`, `intention`, -`smart_ingest`, `source_sync`, `session_start`, `suppress`, and the flagship -`backfill`. Old tool names remain dispatchable as hidden back-compat aliases. - -### Improved — `deep_reference` retrieval engine - -- **F32 embeddings** (was I8 quantization) — lifts the 0.4–0.6 paraphrase cosine - band so close-but-reworded queries actually retrieve. -- **Reciprocal Rank Fusion** replaces linear score combination in hybrid search. -- **Claim-vs-memory contradiction** — `recall`/`cross_reference` now test *your - claim* against stored memory, surfacing `claim_contradicts_memory` instead of - the old "confident silence." -- **Never-composed semantic-band gate** — admits no-shared-word memory pairs in - the 0.45–0.85 cosine band for `vestige compose`. -- New `vestige recall ` and `vestige compose` CLI commands expose the - engine outside the MCP path. - -### Fixed — security & correctness (multi-model audit swarm) - -SSRF/token-exfil hardening, panic/DoS/overflow fixes, deadlock and -lock-contention fixes, dedup and decay correctness. `usearch` keeps -`features = ["fp16lib"]` to avoid the Windows MSVC C1021 build break (#71/#94). - -## [2.1.27] - 2026-06-19 — "External-Source Connectors" - -Roadmap [#57](https://github.com/samvallad33/vestige/issues/57), **Phases 1–4 -(complete)**: Vestige can now act as a durable, local, semantically-searchable -retrieval layer over an external system of record — GitHub Issues and Redmine — -without replacing it. The external system stays canonical; Vestige **indexes, -connects, retrieves, and cites back** to the source record. - -Unlike a live ticket-system MCP proxy (which holds no state and is rate-limited -per query), Vestige keeps a durable embedded index: searchable **offline**, -**semantically**, joinable with the rest of your memory, temporally versioned, -and re-syncable **idempotently** with no duplication. To our knowledge no other -local-first memory layer combines native connectors, external-URL provenance, -content-hash idempotent sync, and tombstoning of vanished records. - -### Added - -- **`source_sync` MCP tool** — index an external system into Vestige. - - GitHub: `{"source": "github", "repo": "owner/name"}` indexes every issue + - its comments. Auth via `GITHUB_TOKEN` (public repos work tokenless at a - lower rate limit). - - Redmine: `{"source": "redmine", "project": ""}` indexes a project's - issues + journals (comments and status/assignment history). Host from - `REDMINE_URL`, auth from `REDMINE_API_KEY`. - - Re-running updates changed issues in place (no duplicates); `reconcile: - true` tombstones issues no longer visible upstream. -- **Source-aware investigation filters on `search`** (Phase 4) — filter results - by `source_system`, `source_project`, `source_id`, `source_type`, - `source_author`, a `source_updated_after`/`source_updated_before` date range, - and `source_status` (`valid` / `tombstoned` / `any`). Status, tracker, and - priority remain filterable via the existing `tag_prefix` (the connectors emit - `status:`/`tracker:`/`priority:`/`label:` tags). Applied as post-filters; - non-connector memories are excluded from a source-scoped query. -- **Source envelope** on every memory — structured, machine-readable provenance - (`source_system`, `source_id`, `source_url`, `source_updated_at`, - `content_hash`, `synced_at`, `source_project`, `source_type`, `source_author`) - distinct from the legacy free-form `source` label. Search results gain a - `sourceRecord` object (with the canonical `url`) **only** for - connector-ingested memories, so an agent can cite and follow the source. -- **Idempotent sync primitives** (`vestige-core`): `upsert_by_source` (keyed on - `(source_system, source_id)`, content-hash change detection), per-connector - cursor checkpoints (`connector_cursors`), and `reconcile_source_tombstones` - (invalidate-don't-delete via the bitemporal `valid_until`, so a vanished - record is retained for audit but drops out of current retrieval). -- **Connector contract** (`vestige_core::connectors`) — a small source-agnostic - `Connector` trait + `run_sync` driver (cursor overlap window, incremental - paging, optional deletion reconcile) with two reference connectors behind the - optional `connectors` cargo feature (on by default in the MCP server, off in - the core library's default features so non-connector consumers link no HTTP - client): - - **GitHub Issues** — `state=all`, `since` cursor, Link-header pagination, - drops PRs, host-pinned next-url. - - **Redmine** — `status_id=*` (open + closed), hex-encoded `updated_on>=` - cursor, `offset` pagination, per-issue detail fetch for journals (the list - endpoint omits them), `X-Redmine-API-Key` header auth. - -### Database - -- **Migration V17** — nine nullable source-envelope columns on `knowledge_nodes` - (additive; every existing memory is untouched), a partial UNIQUE index on - `(source_system, source_id)` enforcing one memory per external record while - costing nothing for envelope-less legacy rows, and the `connector_cursors` - checkpoint table. Idempotent on replay, following the established - `add_column_if_missing` pattern. - -### Notes - -- Local-first and optional: with no `source_sync` call, behavior is unchanged. - The default core-library build does not link an HTTP client. - -## [2.1.26] - 2026-06-15 — "Configurable Output" - -Roadmap **Phase 2: Configurable Output**. Users can now control the default -shape and size of high-traffic MCP responses with an optional, local-first -config file — without recompiling and without a cloud service. The default -behavior is unchanged: a fresh install with no `vestige.toml` behaves exactly -as before. - -### Added - -- **`vestige.toml` config file**, loaded from the active Vestige data directory - (`/vestige.toml`, alongside `vestige.db`). A missing or malformed - file falls back to built-in defaults, so existing installs are unaffected. -- **`[defaults]` table** with three keys: `detail_level` - (`brief` | `summary` | `full`), `limit` (default result count for - high-traffic tools), and `profile`. -- **Output profiles** — `lean`, `default`, `audit`, `research` — each presetting - a coherent bundle of detail level, result limit, and whether scores and - timestamps are included: - - `lean`: `brief` detail, limit 5, scores and timestamps dropped (smallest - context cost). - - `default`: historical behavior — `summary` detail, tool's own default - limit, scores and timestamps present. **Unchanged.** - - `audit`: `full` detail with every field, score, and timestamp. - - `research`: `full` detail with a larger default limit (25). -- **Three-layer precedence**, applied per call: an explicit MCP parameter wins - over the config file, which wins over the built-in default. -- **`profile` field** echoed in `search`, `memory_timeline`, `codebase` - (`get_context`), and `session_context` responses so the active profile is - observable. - -### Changed - -- `search`, `memory_timeline`, `codebase` (`get_context`), and - `session_context` now resolve their default detail level and result limit - through the config file when no explicit parameter is supplied. With no - `vestige.toml` present, their output is byte-for-byte identical to v2.1.25. - -### Documentation - -- `docs/CONFIGURATION.md` gains a **Output Configuration (`vestige.toml`)** - section documenting the file location, `[defaults]` keys, profile presets, - and precedence rules. - -## [2.1.25] - 2026-06-12 — "Merge / Supersede Controls" - -v2.1.25 ships Phase 3: diff-previewed, confidence-gated, reversible, -self-explaining combine/dedupe/supersede on a never-delete (bitemporal) store. -The default is always preview/review — these tools never silently mutate memory. -The differentiator is the reversible operation log: every merge/supersede/undo is -an auditable, reversible event with provenance ("why did these combine?") — a git -reflog for your agent's memory. - -### Added - -- **Seven new MCP tools** for merge/supersede control: - - `merge_candidates` — surface likely duplicate/overlapping clusters with - confidence scores and the signals behind each (Fellegi-Sunter - match/possible/non-match). Read-only. - - `plan_merge` — produce a previewable merge PLAN (a diff of combined - content/tags/provenance) without applying it. - - `plan_supersede` — preview superseding A with B (bitemporal invalidation, - audit-preserving) without applying. - - `apply_plan` — execute a previously-generated plan id; recorded as a - reversible operation. - - `merge_undo` — reverse a prior merge/supersede operation, or list the - reversible operation log (the "memory reflog"). - - `protect` — pin a memory so it can never be auto-merged, superseded, or - garbage-collected. - - `merge_policy` — get/set the per-project Fellegi-Sunter two thresholds - (`match_threshold`, `possible_threshold`) and `auto_apply`. -- **Bitemporal "invalidate, don't delete" supersede** (Graphiti-style): a - superseded memory is kept and stays queryable for audit. It is stamped with - `valid_until = now` and a new `superseded_by` lineage pointer, instead of being - deleted or merely demoted. -- **Reversible operation log** (`merge_operations` table) — every applied - merge/supersede records an undo payload and provenance signals so any operation - can be reversed, including restoring survivor content/tags and clearing the - bitemporal invalidation. -- **Fellegi-Sunter two-threshold scoring** for dedup/merge candidates, combining - embedding cosine similarity with tag and content-token overlap. Borderline - "possible" matches are surfaced for review instead of force-merged. -- **Memory protection / pinning** — `protected` column on `knowledge_nodes`; - protected memories are excluded from auto-merge/supersede/GC paths. -- **Migration V14** adding the `merge_plans` and `merge_operations` tables, the - `protected` and `superseded_by` columns on `knowledge_nodes`, and their - indexes. Idempotent on replay. -- **Docs**: `docs/MERGE_SUPERSEDE.md` describing the design, the bitemporal - model, the two-threshold policy, the reversible operation log, and the tool - surface. - -### Notes - -- All merge/supersede operations are **opt-in and preview-first**. `apply_plan` - requires `confirm=true` for `possible`/`non_match` plans, and only applies - `match` plans without confirmation when `merge_policy.auto_apply` is enabled - (default off). This deliberately avoids the silent-merge / auto-delete / - audit-trail-loss anti-patterns reported against other memory systems. -- The merge policy persists per-project and is also overridable via - `VESTIGE_MERGE_MATCH_THRESHOLD`, `VESTIGE_MERGE_POSSIBLE_THRESHOLD`, and - `VESTIGE_MERGE_AUTO_APPLY` environment variables. - -## [2.1.23] - 2026-05-27 — "Receipt Lock Hardening" - -v2.1.23 hardens the Sanhedrin launch path so Receipt Lock is portable, -observable, and precise enough for broader use. - -### Added - -- **Model-agnostic Sanhedrin backend presets** for custom OpenAI-compatible - servers, small laptops, Ollama, MLX, vLLM, llama.cpp, hosted APIs, and - Anthropic via LiteLLM. Sanhedrin no longer guesses a large default verifier. -- **Fail-open telemetry** in `fail-open.jsonl`, plus a dashboard telemetry API - and 7-day ambient dashboard counters for vetoes, appeals, and fail-open runs. -- **Receipt schema documentation** covering receipt artifacts, appeals, command - ledgers, fail-open logs, compatibility rules, and staged-evidence trust - boundaries. -- **Opt-in CUDA feature flags** for Qwen3 embedding builds on NVIDIA hardware. - -### Changed - -- Receipt Lock strips code fences, inline code, blockquotes, quoted regions, and - scoped epistemic hedges before matching verification claims. -- Structured transcript tool-use receipts are the default evidence path; loose - JSON command scanning now requires `VESTIGE_SANHEDRIN_ALLOW_LOOSE_LEDGER=1`. -- Claim-mode sampling now prioritizes higher-severity claims instead of taking - the first eight source-order claims. -- Hosted Sanhedrin credentials now require `VESTIGE_SANHEDRIN_API_KEY` and are - only sent to the configured Sanhedrin endpoint, never to Vestige retrieval. -- `smart_ingest` batch mode now defaults to `batchMergePolicy: "force_create"` - so caller-separated items stay separate unless callers opt into smart merging. -- CUDA-enabled Qwen3 builds now try `Device::new_cuda(0)` before falling back to - Metal or CPU. - -### Fixed - -- Standalone dashboard mode now hydrates the cognitive engine for Dream and - Deep Reference instead of returning 503s. -- `--data-dir` now rejects existing non-directory paths with a clear error. -- `vestige-restore` now handles `--help` and `--version` instead of treating - them as backup file paths. -- Smart ingest merge/update responses now include `previousContent`, - `mergedFrom`, and `mergePreview` so callers can inspect mutated memories. -- Daily Sanhedrin telemetry now preserves NOTE and CAUTION buckets instead of - folding both into PASS. - -## [2.1.22] - 2026-05-25 — "Sanhedrin Receipts" - -v2.1.22 makes the optional Sanhedrin hook quieter and more accountable by -turning draft judgment into local, appealable receipts instead of opaque vetoes. - -### Added - -- **Receipt Lock** blocks unsupported verification claims such as "tests passed" - unless the current transcript contains a matching successful test, build, - lint, or typecheck command receipt. -- **Veto receipts** are written to `~/.vestige/sanhedrin/latest.json` and - `latest.html` with Claim -> Verdict -> Precedent -> Fix -> Appeal fields. -- **Dashboard Verdict Bar** surfaces the latest PASS, NOTE, CAUTION, VETO, or - APPEALED state and lets users appeal stale, wrong, or too-strict vetoes. -- **Appeal training** records feedback in `appeals.jsonl` and suppresses future - vetoes for the same claim fingerprint. - -### Changed - -- Sanhedrin claim-mode output now feeds a per-claim receipt ledger while keeping - the existing one-line Stop-hook contract for Claude Code. - -## [2.1.21] - 2026-05-24 — "Agent-Neutral Hardening" - -v2.1.21 is a release-hardening pass for normal MCP usage across agents. It keeps -Claude Code Cognitive Sandwich companion files optional while making the MCP -server, package installer, release workflow, and portable sync path safer. - -### Added - -- **Agent-neutral memory protocol** — new `docs/AGENT-MEMORY-PROTOCOL.md` gives - any MCP-compatible client the same practical memory loop: initialize context, - search/deep-reference when needed, save durable facts with `smart_ingest`, and - promote/demote/purge with `memory`. -- **HTTP transport opt-in** — `vestige-mcp` now requires `--http`, - `--http-port`, or `VESTIGE_HTTP_ENABLED=1` before starting MCP-over-HTTP. -- **Release checksums** — release assets now publish `.sha256` files beside each - archive. - -### Changed - -- **`vestige update` is binary-only by default** — Claude Code Cognitive - Sandwich companion files refresh only with `vestige update --sandwich-companion` - or `vestige sandwich install`. -- **MCP tool results include structured content** while keeping text content for - clients that only consume the classic MCP response shape. -- **NPM install messaging is agent-neutral** and unsupported release targets - fail fast instead of trying to download assets that do not exist. -- **Portable merge uses UPSERT instead of `INSERT OR REPLACE`** for keyed tables, - preserving related rows instead of causing delete-and-insert side effects. - -### Fixed - -- **Destructive delete confirmation** — `memory(action="delete")` now requires - `confirm=true`, matching `purge`; the deprecated `delete_knowledge` shim no - longer bypasses confirmation. -- **Portable purge tombstone sync** — merge imports now carry - `deletion_tombstones` and apply purges without retaining deleted memory text. - Hard purge tombstones win over newer local edits during portable sync, while - tombstone merges keep the newest deletion timestamp. -- **Vector index reload staleness** — loading persisted embeddings rebuilds the - in-memory index from an empty index before adding current embeddings. -- **HTTP transport hardening** — origin, Accept, session, and protocol-version - validation now reject incompatible or cross-origin browser requests earlier. -- **Init config safety** — `@vestige/init` backs up existing config files, writes - atomically, accepts JSONC-style comments/trailing commas, and no longer writes - Xcode trust-accepted flags. -- **Release tag checkout** — manual release builds now checkout the requested tag - or ref before packaging. - -### Verified - -- `cargo test -p vestige-mcp --lib --no-fail-fast` -- `cargo test -p vestige-mcp --bin vestige-mcp --no-fail-fast` -- `cargo test -p vestige-core portable_merge_import --no-fail-fast` -- `cargo test -p vestige-mcp --bin vestige --no-fail-fast` -- `cargo test -p vestige-e2e-tests --test mcp_protocol --no-fail-fast` -- `cargo check --workspace` -- `cargo metadata --format-version 1 --locked --no-deps` -- `pnpm --filter @vestige/dashboard check` -- `pnpm --filter @vestige/dashboard test` -- `pnpm --filter @vestige/dashboard build` -- `node --check packages/vestige-init/bin/init.js` -- `node --check packages/vestige-mcp-npm/scripts/postinstall.js` -- `node --check packages/vestige-mcp-npm/bin/vestige-restore.js` - ## [2.1.2] - 2026-05-01 — "Honest Memory" v2.1.2 focuses on operational trust: exact search stays exact, purge really removes content, contradictions are directly inspectable, and the update flow no longer depends on copied curl commands. diff --git a/CLAUDE.md b/CLAUDE.md index 7388599..4ee5762 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,30 +1,3 @@ -# 🚀 MANDATE #0 — MAXIMUM AMBITION. NO HEDGING. (read this first, every time) - -This is the standing default for ALL work on Vestige, before anything else below. - -- **Assume maximum ambition.** Build the most exhaustive, jaw-dropping, correct - version — not the safe "good enough" one. The ceiling is "nobody else has - this," not "this works." Default to the winning move, not the cautious one. -- **Scour before you settle.** When unsure or stuck, research the real frontier - (web, source, the actual running app) before acting. Never accept the first - adequate answer when a deeper one exists. Verify, don't assume. -- **No hedging.** Lead with the best path and a clear recommendation. Forbidden: - "this is probably too risky," "temper expectations," "good enough," "maybe try - the easier one." Risks get their own honest section — never used to shrink the - target. -- **Show proof.** Verify changes in the real running app and share the evidence - (screenshots, test output, gate results) — don't claim done without it. -- **Protect what's flawless, detonate what isn't.** Treat finished, loved work as - load-bearing (don't break it); push everything else past where any other dev - would stop. - -Origin: Sam, Jun 22 2026 — the overnight session that turned the dashboard + -Memory Cinema from "alive" into a category-of-one particle journey. The depth -only happened because the bar was set to maximum. Make that the default, not the -exception. - ---- - # Vestige Agent Guidance This file is intentionally safe for the public repository. It gives coding diff --git a/CLAUDE.md.template b/CLAUDE.md.template index e007ea6..fefd005 100644 --- a/CLAUDE.md.template +++ b/CLAUDE.md.template @@ -88,7 +88,7 @@ Tags: ["decision", "topic-name"] | "Don't forget" | `smart_ingest` with tags: ["important"] | | "I always..." / "I never..." | Save as preference | | "I prefer..." / "I like..." | Save as preference | -| "This is important" | `smart_ingest` + `memory(action="promote")` | +| "This is important" | `smart_ingest` + `promote_memory` | | "Remind me..." | Create `intention` with trigger | | "Next time we..." | Create `intention` with context trigger | | "When I'm working on X..." | Create `intention` with codebase trigger | @@ -115,7 +115,7 @@ Act on feedback immediately — don't ask permission to promote/demote. ### Proactive Health Checks If you notice degraded recall or a user mentions memory issues: -1. Run `system_status` — check overall system status +1. Run `health_check` — check overall system status 2. If `averageRetention < 0.5` → suggest running `consolidate` 3. If `dueForReview > 50` → mention that some memories need review diff --git a/Cargo.lock b/Cargo.lock index 90d70a0..e7f9a05 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,16 +8,6 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" -[[package]] -name = "aead" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" -dependencies = [ - "crypto-common", - "generic-array", -] - [[package]] name = "ahash" version = "0.8.12" @@ -153,24 +143,6 @@ dependencies = [ "syn", ] -[[package]] -name = "argon2" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3610892ee6e0cbce8ae2700349fcf8f98adb0dbfbee85aec3c9179d29cc072" -dependencies = [ - "base64ct", - "blake2", - "cpufeatures 0.2.17", - "password-hash", -] - -[[package]] -name = "arrayref" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" - [[package]] name = "arrayvec" version = "0.7.6" @@ -339,29 +311,6 @@ dependencies = [ "core2", ] -[[package]] -name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest", -] - -[[package]] -name = "blake3" -version = "1.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d2d5991425dfd0785aed03aedcf0b321d61975c9b5b3689c774a2610ae0b51e" -dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if", - "constant_time_eq", - "cpufeatures 0.3.0", -] - [[package]] name = "block" version = "0.1.6" @@ -443,10 +392,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bd9895436c1ba5dc1037a19935d084b838db066ff4e15ef7dded020b7c12a4a" dependencies = [ "byteorder", - "candle-kernels", "candle-metal-kernels", "candle-ug", - "cudarc 0.19.7", "float8", "gemm 0.19.0", "half", @@ -466,15 +413,6 @@ dependencies = [ "zip", ] -[[package]] -name = "candle-kernels" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "742e2ac226b777134436e9e692f44e77c278b8a7abb1554dc10e44dc911b349f" -dependencies = [ - "cudaforge", -] - [[package]] name = "candle-metal-kernels" version = "0.10.2" @@ -515,7 +453,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca0fc3167cbc99c8ec1be618cb620aa21dca95038f118c3579a79370e3dc5f77" dependencies = [ "ug", - "ug-cuda", "ug-metal", ] @@ -552,36 +489,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - -[[package]] -name = "chacha20" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures 0.2.17", -] - -[[package]] -name = "chacha20poly1305" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" -dependencies = [ - "aead", - "chacha20", - "cipher", - "poly1305", - "zeroize", -] - [[package]] name = "chrono" version = "0.4.44" @@ -623,17 +530,6 @@ dependencies = [ "half", ] -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", - "zeroize", -] - [[package]] name = "clap" version = "4.6.0" @@ -734,12 +630,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "constant_time_eq" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" - [[package]] name = "core-foundation" version = "0.9.4" @@ -795,15 +685,6 @@ dependencies = [ "libc", ] -[[package]] -name = "cpufeatures" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" -dependencies = [ - "libc", -] - [[package]] name = "crc32fast" version = "1.5.0" @@ -887,50 +768,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" dependencies = [ "generic-array", - "rand_core 0.6.4", "typenum", ] -[[package]] -name = "cudaforge" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f7a0d45b139b5beeeb1c34188717e12241c44a0120afb498815ce7f5373c691" -dependencies = [ - "anyhow", - "fs2", - "glob", - "num_cpus", - "rayon", - "serde", - "serde_json", - "sha2", - "thiserror 2.0.18", - "walkdir", - "which", -] - -[[package]] -name = "cudarc" -version = "0.17.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf99ab37ee7072d64d906aa2dada9a3422f1d975cdf8c8055a573bc84897ed8" -dependencies = [ - "half", - "libloading 0.8.9", -] - -[[package]] -name = "cudarc" -version = "0.19.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cea5f10a99e025c1b44ae2354c2d8326b25ddbd0baf76bde8e55cfd4018a2cc" -dependencies = [ - "float8", - "half", - "libloading 0.9.0", -] - [[package]] name = "cxx" version = "1.0.194" @@ -1092,7 +932,6 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", - "subtle", ] [[package]] @@ -1195,12 +1034,6 @@ dependencies = [ "syn", ] -[[package]] -name = "env_home" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f84e12ccf0a7ddc17a6c41c93326024c42920d7ee630d04950e6926645c0fe" - [[package]] name = "equator" version = "0.4.2" @@ -1421,16 +1254,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fs2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "fsevent-sys" version = "4.1.0" @@ -1447,7 +1270,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" dependencies = [ "futures-core", - "futures-sink", ] [[package]] @@ -1756,10 +1578,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi", - "wasm-bindgen", ] [[package]] @@ -1769,11 +1589,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", - "js-sys", "libc", "r-efi 5.3.0", "wasip2", - "wasm-bindgen", ] [[package]] @@ -1814,12 +1632,6 @@ dependencies = [ "url", ] -[[package]] -name = "glob" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" - [[package]] name = "h2" version = "0.4.13" @@ -2011,7 +1823,6 @@ dependencies = [ "tokio", "tokio-rustls", "tower-service", - "webpki-roots 1.0.6", ] [[package]] @@ -2298,15 +2109,6 @@ dependencies = [ "libc", ] -[[package]] -name = "inout" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" -dependencies = [ - "generic-array", -] - [[package]] name = "interpolate_name" version = "0.2.4" @@ -2406,10 +2208,12 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.91" +version = "0.3.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c" +checksum = "2964e92d1d9dc3364cae4d718d93f227e3abb088e747d92e0395bfdedf1c12ca" dependencies = [ + "cfg-if", + "futures-util", "once_cell", "wasm-bindgen", ] @@ -2608,12 +2412,6 @@ dependencies = [ "hashbrown 0.16.1", ] -[[package]] -name = "lru-slab" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" - [[package]] name = "lzma-rust2" version = "0.15.7" @@ -3090,12 +2888,6 @@ version = "11.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" -[[package]] -name = "opaque-debug" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" - [[package]] name = "open" version = "5.3.3" @@ -3221,17 +3013,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "password-hash" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" -dependencies = [ - "base64ct", - "rand_core 0.6.4", - "subtle", -] - [[package]] name = "paste" version = "1.0.15" @@ -3318,17 +3099,6 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "poly1305" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" -dependencies = [ - "cpufeatures 0.2.17", - "opaque-debug", - "universal-hash", -] - [[package]] name = "portable-atomic" version = "1.13.1" @@ -3337,9 +3107,9 @@ checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" [[package]] name = "portable-atomic-util" -version = "0.2.7" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a106d1259c23fac8e543272398ae0e3c0b8d33c88ed73d0cc71b0f1d902618" +checksum = "091397be61a01d4be58e7841595bd4bfedb15f1cd54977d79b8271e94ed799a3" dependencies = [ "portable-atomic", ] @@ -3458,61 +3228,6 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" -[[package]] -name = "quinn" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" -dependencies = [ - "bytes", - "cfg_aliases", - "pin-project-lite", - "quinn-proto", - "quinn-udp", - "rustc-hash", - "rustls", - "socket2", - "thiserror 2.0.18", - "tokio", - "tracing", - "web-time", -] - -[[package]] -name = "quinn-proto" -version = "0.11.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "434b42fec591c96ef50e21e886936e66d3cc3f737104fdb9b737c40ffb94c098" -dependencies = [ - "bytes", - "getrandom 0.3.4", - "lru-slab", - "rand", - "ring", - "rustc-hash", - "rustls", - "rustls-pki-types", - "slab", - "thiserror 2.0.18", - "tinyvec", - "tracing", - "web-time", -] - -[[package]] -name = "quinn-udp" -version = "0.5.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" -dependencies = [ - "cfg_aliases", - "libc", - "once_cell", - "socket2", - "tracing", - "windows-sys 0.60.2", -] - [[package]] name = "quote" version = "1.0.45" @@ -3541,7 +3256,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ec095654a25171c2124e9e3393a930bddbffdc939556c914957a4c3e0a87166" dependencies = [ "rand_chacha", - "rand_core 0.9.5", + "rand_core", ] [[package]] @@ -3551,16 +3266,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core 0.9.5", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.17", + "rand_core", ] [[package]] @@ -3742,7 +3448,6 @@ dependencies = [ "base64 0.22.1", "bytes", "encoding_rs", - "futures-channel", "futures-core", "futures-util", "h2", @@ -3759,8 +3464,6 @@ dependencies = [ "native-tls", "percent-encoding", "pin-project-lite", - "quinn", - "rustls", "rustls-pki-types", "serde", "serde_json", @@ -3768,7 +3471,6 @@ dependencies = [ "sync_wrapper", "tokio", "tokio-native-tls", - "tokio-rustls", "tokio-util", "tower", "tower-http", @@ -3778,7 +3480,6 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams", "web-sys", - "webpki-roots 1.0.6", ] [[package]] @@ -3828,12 +3529,6 @@ dependencies = [ "sqlite-wasm-rs", ] -[[package]] -name = "rustc-hash" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" - [[package]] name = "rustix" version = "1.1.4" @@ -3868,7 +3563,6 @@ version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" dependencies = [ - "web-time", "zeroize", ] @@ -4054,18 +3748,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", - "cpufeatures 0.2.17", - "digest", -] - -[[package]] -name = "sha2" -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", + "cpufeatures", "digest", ] @@ -4361,21 +4044,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "tinyvec" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "tokenizers" version = "0.22.2" @@ -4603,17 +4271,6 @@ dependencies = [ "tracing-serde", ] -[[package]] -name = "trait-variant" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70977707304198400eb4835a78f6a9f928bf41bba420deb8fdb175cd965d77a7" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "try-lock" version = "0.2.5" @@ -4670,19 +4327,6 @@ dependencies = [ "yoke 0.7.5", ] -[[package]] -name = "ug-cuda" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f0a1fa748f26166778c33b8498255ebb7c6bffb472bcc0a72839e07ebb1d9b5" -dependencies = [ - "cudarc 0.17.8", - "half", - "serde", - "thiserror 1.0.69", - "ug", -] - [[package]] name = "ug-metal" version = "0.5.0" @@ -4742,16 +4386,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" -[[package]] -name = "universal-hash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" -dependencies = [ - "crypto-common", - "subtle", -] - [[package]] name = "untrusted" version = "0.9.0" @@ -4897,12 +4531,9 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "vestige-core" -version = "2.2.1" +version = "2.1.2" dependencies = [ - "argon2", - "blake3", "candle-core", - "chacha20poly1305", "chrono", "criterion", "directories", @@ -4910,7 +4541,6 @@ dependencies = [ "git2", "lru", "notify", - "reqwest", "rusqlite", "serde", "serde_json", @@ -4918,7 +4548,6 @@ dependencies = [ "thiserror 2.0.18", "tokio", "tracing", - "trait-variant", "usearch", "uuid", ] @@ -4938,7 +4567,7 @@ dependencies = [ [[package]] name = "vestige-mcp" -version = "2.2.1" +version = "2.1.2" dependencies = [ "anyhow", "axum", @@ -4965,19 +4594,6 @@ dependencies = [ "vestige-core", ] -[[package]] -name = "vestige-phase-1-tests" -version = "0.0.1" -dependencies = [ - "chrono", - "rusqlite", - "serde_json", - "tempfile", - "tokio", - "uuid", - "vestige-core", -] - [[package]] name = "walkdir" version = "2.5.0" @@ -5023,9 +4639,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.114" +version = "0.2.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" +checksum = "0bf938a0bacb0469e83c1e148908bd7d5a6010354cf4fb73279b7447422e3a89" dependencies = [ "cfg-if", "once_cell", @@ -5036,23 +4652,19 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.64" +version = "0.4.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9c5522b3a28661442748e09d40924dfb9ca614b21c00d3fd135720e48b67db8" +checksum = "f371d383f2fb139252e0bfac3b81b265689bf45b6874af544ffa4c975ac1ebf8" dependencies = [ - "cfg-if", - "futures-util", "js-sys", - "once_cell", "wasm-bindgen", - "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.114" +version = "0.2.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" +checksum = "eeff24f84126c0ec2db7a449f0c2ec963c6a49efe0698c4242929da037ca28ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5060,9 +4672,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.114" +version = "0.2.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" +checksum = "9d08065faf983b2b80a79fd87d8254c409281cf7de75fc4b773019824196c904" dependencies = [ "bumpalo", "proc-macro2", @@ -5073,9 +4685,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.114" +version = "0.2.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" +checksum = "5fd04d9e306f1907bd13c6361b5c6bfc7b3b3c095ed3f8a9246390f8dbdee129" dependencies = [ "unicode-ident", ] @@ -5129,9 +4741,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.91" +version = "0.3.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9" +checksum = "4f2dfbb17949fa2088e5d39408c48368947b86f7834484e87b73de55bc14d97d" dependencies = [ "js-sys", "wasm-bindgen", @@ -5180,18 +4792,6 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" -[[package]] -name = "which" -version = "7.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d643ce3fd3e5b54854602a080f34fb10ab75e0b813ee32d00ca2b44fa74762" -dependencies = [ - "either", - "env_home", - "rustix", - "winsafe", -] - [[package]] name = "winapi" version = "0.3.9" @@ -5458,12 +5058,6 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" -[[package]] -name = "winsafe" -version = "0.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" - [[package]] name = "wit-bindgen" version = "0.51.0" diff --git a/Cargo.toml b/Cargo.toml index 9dffd26..af80c4c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,14 +4,13 @@ members = [ "crates/vestige-core", "crates/vestige-mcp", "tests/e2e", - "tests/phase_1", ] exclude = [ "fastembed-rs", ] [workspace.package] -version = "2.2.1" +version = "2.1.2" edition = "2024" license = "AGPL-3.0-only" repository = "https://github.com/samvallad33/vestige" diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index e93e93c..0000000 --- a/Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -# Dockerfile for running the Vestige MCP server in an isolated sandbox. -# -# Used by registries such as Glama to start the server and run the standard -# MCP stdio introspection exchange (tools/list, resources/list, prompts/list). -# The server speaks MCP over stdio, which is exactly what these tools expect. -# -# Base must be glibc (Debian), not musl/Alpine: the npm postinstall downloads -# the prebuilt x86_64-unknown-linux-gnu Rust binary from the GitHub release, and -# a -gnu binary will not run on an Alpine/musl image. - -FROM node:20-slim - -# ca-certificates lets the postinstall fetch the release asset over HTTPS. -RUN apt-get update \ - && apt-get install -y --no-install-recommends ca-certificates \ - && rm -rf /var/lib/apt/lists/* - -# Install the published package globally. Its postinstall downloads the matching -# prebuilt vestige-mcp binary for linux/x64 from the GitHub release. -RUN npm install -g vestige-mcp-server@latest - -# Keep all memory data inside the container under a writable path. -ENV VESTIGE_DATA_DIR=/data -RUN mkdir -p /data - -# Start the MCP server on stdio. The `vestige-mcp` bin execs the native binary -# and inherits stdio, so the MCP client talks to it directly. -ENTRYPOINT ["vestige-mcp"] diff --git a/README.md b/README.md index bca1ffc..5177e72 100644 --- a/README.md +++ b/README.md @@ -1,307 +1,514 @@
-

Vestige

+# Vestige -### Your bug was born days before it crashed. You just can't remember where. +### The cognitive engine that gives AI agents a brain. -Vestige is a local-first memory for AI agents that reaches backward through time to find the quiet change that caused today's failure: the cause that looks nothing like the bug. One 23MB Rust binary. No cloud. Your data never leaves your machine. +[![GitHub stars](https://img.shields.io/github/stars/samvallad33/vestige?style=social)](https://github.com/samvallad33/vestige) +[![Release](https://img.shields.io/github/v/release/samvallad33/vestige)](https://github.com/samvallad33/vestige/releases/latest) +[![Tests](https://img.shields.io/badge/tests-1229%20passing-brightgreen)](https://github.com/samvallad33/vestige/actions) +[![License](https://img.shields.io/badge/license-AGPL--3.0-blue)](LICENSE) +[![MCP Compatible](https://img.shields.io/badge/MCP-compatible-green)](https://modelcontextprotocol.io) -[![GitHub stars](https://img.shields.io/github/stars/samvallad33/vestige?style=for-the-badge&logo=github&color=8b5cf6)](https://github.com/samvallad33/vestige/stargazers) -[![Release](https://img.shields.io/github/v/release/samvallad33/vestige?style=for-the-badge&color=06b6d4)](https://github.com/samvallad33/vestige/releases/latest) -[![Tests](https://img.shields.io/badge/tests-1550_passing-22c55e?style=for-the-badge)](https://github.com/samvallad33/vestige/actions) -[![License](https://img.shields.io/badge/license-AGPL--3.0-3b82f6?style=for-the-badge)](LICENSE) +**Your Agent forgets everything between sessions. Vestige fixes that.** -[**⚡ Quick Start**](#-get-it-running-in-60-seconds) · [**🧠 The Idea**](#-why-i-built-this) · [**🔬 The Science**](#-this-is-real-neuroscience-not-a-metaphor) · [**🛠 13 Tools**](#-13-tools-one-brain) · [**📊 Dashboard**](#-watch-your-ai-think-in-3d) +Built on 130 years of memory research — FSRS-6 spaced repetition, prediction error gating, synaptic tagging, spreading activation, memory dreaming — all running in a single Rust binary with a 3D neural visualization dashboard. 100% local. Zero cloud. + +[Quick Start](#quick-start) | [Dashboard](#-3d-memory-dashboard) | [How It Works](#-the-cognitive-science-stack) | [Tools](#-24-mcp-tools) | [Docs](docs/)
--- -## 👋 Why I built this +## What's New in v2.1.2 "Honest Memory" -Hi, I'm [Sam](https://github.com/samvallad33). I built Vestige from a tiny apartment in Chicago because I kept losing days to the same thing, and I bet you have too. +v2.1.2 makes Vestige easier to trust in everyday work: literal lookups stay literal, purge really removes content, contradictions are inspectable, and updates no longer require a curl reinstall flow. -Production breaks. You start hunting. And the cause is almost never *near* the error. It's some quiet change you made days ago that looks **nothing** like the crash it eventually caused. A flipped env var. A swapped service. A config tweak you'd already forgotten. +- **Concrete search mode.** Quoted strings, env vars, UUIDs, paths, and code identifiers now take a keyword/literal path that skips HyDE, semantic fusion, FSRS reweighting, competition, and spreading activation. Exact things like `OPENAI_API_KEY`, `mlx_lm.server`, and migration IDs land first. +- **Irreversible purge.** `memory(action="purge", confirm=true)` permanently removes memory content and embeddings, scrubs insight JSON references, detaches temporal-summary children, prunes graph edges, and keeps only a non-content deletion tombstone for sync/audit. +- **First-class contradiction inspection.** New `contradictions` MCP tool surfaces trust-weighted disagreements directly instead of hiding them inside `deep_reference`. +- **Simple update flow.** `vestige update` and `vestige sandwich install` refresh binaries and companion files without making users paste curl commands. +- **Pro waitlist preview.** `/dashboard/waitlist` adds a local-first Solo Pro and Team Pro early-access surface. `VITE_WAITLIST_ENDPOINT` and `VITE_SUPPORT_BOT_ENDPOINT` are opt-in dashboard env vars, so no signup data is captured unless endpoints are configured. -Here's the part that took me a while to see: **every AI memory tool is built on vector search, and vector search hunts for what *looks like* your problem.** But a root cause never looks like the bug it creates. So they all search the goal line, while the real failure was a quiet midfield turnover fifteen minutes earlier. +## What's New in v2.1.1 "Portable Sync" -I wanted a memory that traces the match *backward.* +v2.1.1 focuses on the biggest post-launch ask: move memories between machines without losing cognitive state. It also adds opt-in Qwen3 embeddings for higher-recall local retrieval. -So that's what Vestige is. Everyone else built a memory that **remembers**. I tried to build the first one that **realizes**: it gates what's worth keeping, lets the noise fade like your own memory does, and when a failure hits, it reaches back through time to the change that actually caused it. +- **Exact portable archives.** `vestige portable-export` / `vestige portable-import` preserve IDs, FSRS state, graph edges, suppression state, audit rows, and embedding blobs for Vestige-to-Vestige device transfer. +- **Sync-safe merge storage.** `vestige portable-import --merge` and `vestige sync ` merge non-empty databases, apply delete tombstones, keep newer local memories, rebuild FTS, and push through a pluggable portable-sync backend. v2.1.1 ships the file backend for Dropbox, iCloud, Syncthing, Git, and shared folders. +- **Qwen3 embeddings.** Build with `qwen3-embeddings`, set `VESTIGE_EMBEDDING_MODEL=qwen3-0.6b`, and run `vestige consolidate` to re-embed existing memories. `vestige health` reports mixed-model stores before search quality is affected. +- **Model-aware retrieval.** Vestige now avoids comparing Qwen and Nomic vectors in the same search/dedup path. -It's one Rust binary. It runs entirely on your machine. It never phones home. And there's a 60-second start right below. +## What's New in v2.1.0 "Cognitive Sandwich Goes Local" -> 🎙️ **The 60-second version** of this whole story, the one I give in person, lives in [`demo/PITCH-v2-causebench.md`](demo/PITCH-v2-causebench.md). If you've got a minute, read that first. It's the clearest way to *get* why this matters. +v2.1.0 adds an opt-in Claude Code hook harness around the existing Vestige MCP server. The MCP tool surface and database schema stay backward compatible, while preflight hooks can inject trusted memory context before Claude answers. The heavyweight Sanhedrin verifier is optional and can be enabled separately. ---- +- **Optional Sanhedrin Executioner.** The post-response verifier is off by default. Users can enable it with an OpenAI-compatible endpoint on x86/Linux/Intel Mac, or add `--with-launchd` on Apple Silicon to run the local MLX Qwen backend. +- **One-command Cognitive Sandwich installer.** `vestige sandwich install` stages hook files and agents by default, removes old Vestige hook wiring, and leaves all Claude Code hook layers plus the 19 GB model path opt-in. +- **Pulse hook backed by `/api/changelog`.** Fresh dream and connection events can be injected into the next Claude Code prompt context without blocking the prompt. +- **`VESTIGE_DATA_DIR` support.** `--data-dir` now has an env-var fallback, tilde expansion, secure directory creation, and clear precedence docs. +- **NPM release wrapper fixed.** `vestige-mcp-server@2.1.0` now downloads binaries from the matching `v2.1.0` GitHub release tag instead of an old hardcoded release. -## ⚡ Get it running in 60 seconds +## What's New in v2.0.9 "Autopilot" -**Step 1 — install (one binary, no Docker, no API key, no signup):** +Autopilot flips Vestige from passive memory library to **self-managing cognitive surface**. Same 24 MCP tools, zero schema changes — but the moment you upgrade, 14 previously dormant cognitive primitives start firing on live events without any tool call from your client. -```bash -npm install -g vestige-mcp-server@latest -``` +- **One supervised backend task subscribes to the 20-event WebSocket bus** and routes six event classes into the cognitive engine: `MemoryCreated` triggers synaptic-tagging PRP + predictive-access records, `SearchPerformed` warms the speculative-retrieval model, `MemoryPromoted` fires activation spread, `MemorySuppressed` emits the Rac1 cascade wave, high-importance `ImportanceScored` (>0.85) auto-promotes, and `Heartbeat` rate-limit-fires `find_duplicates` on large DBs. **The engine mutex is never held across `.await`, so MCP dispatch is never starved.** +- **Panic-resilient supervisors.** Both background tasks run inside an outer supervisor loop — if one handler panics on a bad memory, the supervisor respawns it in 5 s instead of losing every future event. +- **Fully backward compatible.** No new MCP tools. No schema migration. Existing v2.0.8 databases open without a single step. Opt out with `VESTIGE_AUTOPILOT_ENABLED=0` if you want the passive-library contract back. +- **3,091 LOC of orphan v1.0 tool code removed** — nine superseded modules (`checkpoint`, `codebase`, `consolidate`, `ingest`, `intentions`, `knowledge`, `recall`, plus helpers) verified zero non-test callers before deletion. Tool surface unchanged. -**Step 2 — connect it to your agent.** Vestige speaks [MCP](https://modelcontextprotocol.io), so it works with *any* AI agent. The universal config (works everywhere): +## What's New in v2.0.8 "Pulse" -```json -{ "mcpServers": { "vestige": { "command": "vestige-mcp" } } } -``` +v2.0.8 wires the dashboard through to the cognitive engine. Eight new surfaces expose the reasoning stack visually — every one was MCP-only before. -Drop that into your agent's MCP config file. Or use the one-line shortcut for your agent: +- **Reasoning Theater (`/reasoning`)** — `Cmd+K` Ask palette over the 8-stage `deep_reference` pipeline (hybrid retrieval → cross-encoder rerank → spreading activation → FSRS-6 trust → temporal supersession → contradiction analysis → relation assessment → template reasoning chain). Evidence cards, confidence meter, contradiction geodesic arcs, superseded-memory lineage, evolution timeline. **Zero LLM calls, 100% local.** +- **Pulse InsightToast** — real-time toasts for `DreamCompleted`, `ConsolidationCompleted`, `ConnectionDiscovered`, promote/demote/suppress/unsuppress, `Rac1CascadeSwept`. Rate-limited, auto-dismiss, click-to-dismiss. +- **Memory Birth Ritual (Terrarium)** — new memories materialize in the 3D graph on every `MemoryCreated`: elastic scale-in, quadratic Bezier flight path, glow sprite fade-in, Newton's Cradle docking recoil. 60-frame sequence, zero-alloc math. +- **7 more dashboard surfaces** — `/duplicates`, `/dreams`, `/schedule`, `/importance`, `/activation`, `/contradictions`, `/patterns`. Left nav expanded 8 → 16 with single-key shortcuts. +- **Intel Mac (`x86_64-apple-darwin`) support restored** via the `ort-dynamic` Cargo feature + Homebrew `onnxruntime`. Microsoft deprecated x86_64 macOS prebuilts; the dynamic-link path sidesteps that permanently. **Closes #41.** +- **Contradiction-detection false positives eliminated** — four thresholds tightened so adjacent-domain memories no longer flag as conflicts. On an FSRS-6 query this collapses false contradictions 12 → 0 without regressing legitimate test cases. -```bash -# Cursor / Windsurf / VS Code → add the JSON above to ~/.cursor/mcp.json (or the editor's MCP settings) -# Claude Code → claude mcp add vestige vestige-mcp -s user -# Codex → codex mcp add vestige -- vestige-mcp -# Cline / Continue / Zed / Goose → add the JSON above to that client's MCP config -``` +## What's New in v2.0.7 "Visible" -**Step 3 — confirm it's working:** +Hygiene release closing two UI gaps and finishing schema cleanup. No breaking changes, no user-data migrations. -```bash -vestige-mcp --version # prints the installed version -vestige stats # prints your memory count (0 on a fresh install) -``` +- **`POST /api/memories/{id}/suppress` + `/unsuppress` HTTP endpoints** — dashboard can trigger Anderson 2025 SIF + Rac1 cascade without dropping to raw MCP. `suppressionCount`, `retrievalPenalty`, `reversibleUntil`, `labileWindowHours` all in response. Suppress button joins Promote / Demote / Delete on the Memories page. +- **Uptime in the sidebar footer** — the `Heartbeat` event has carried `uptime_secs` since v2.0.5 but was never rendered. Now shows as `up 3d 4h` / `up 18m` / `up 47s`. +- **`execute_export` panic fix** — unreachable match arm replaced with a clean "unsupported export format" error instead of unwinding through the MCP dispatcher. +- **`predict` surfaces `predict_degraded: true`** on lock poisoning instead of silently returning empty vecs. `memory_changelog` honors `start` / `end` bounds. `intention` check honors `include_snoozed`. +- **Migration V11** — drops dead `knowledge_edges` + `compressed_memories` tables (added speculatively in V4, never used). -That's the whole install. New here? The [**30-minute first-run guide**](docs/GETTING-STARTED.md) walks you from install to your first backward-reach: what gets saved (and what doesn't), how to inspect your own memory, and how to scope it per project. Per-agent guides (Cursor, VS Code, Windsurf, JetBrains, Xcode, OpenCode, Codex, Claude Desktop) are [here ↓](#-works-with-every-ai-agent). +## What's New in v2.0.6 "Composer" -Now talk to your agent like it has a memory, because now it does: +v2.0.6 is a polish release that makes the existing cognitive stack finally *feel* alive in the dashboard and stays out of your way on the prompt side. -``` -You: "Remember: we always disable SimSIMD on release builds, it breaks old x86 CPUs." - ...days later, fresh session, zero context... -You: "Should I enable SimSIMD for the release?" -AI: ⚠️ Hold on, this contradicts a decision you stored: you chose to DISABLE it - because it breaks old x86 CPUs. -``` +- **Six live graph reactions, not one** — `MemorySuppressed`, `MemoryUnsuppressed`, `Rac1CascadeSwept`, `Connected`, `ConsolidationStarted`, and `ImportanceScored` now light the 3D graph in real time. v2.0.5 shipped `suppress` but the graph was silent when you called it; consolidation and importance scoring have been silent since v2.0.0. No longer. +- **Intentions page actually works** — fixes a long-standing bug where every intention rendered as "normal priority" (type/schema drift between backend and frontend) and context/time triggers surfaced as raw JSON. +- **Opt-in composition mandate** — the new MCP `instructions` string stays minimal by default. Opt in to the full Composing / Never-composed / Recommendation composition protocol with `VESTIGE_SYSTEM_PROMPT_MODE=full` when you want it, and nothing is imposed on your sessions when you don't. -That last line isn't me being cute. It's a real status the engine returns, called `claim_contradicts_memory`. Most memory tools would have happily handed you the wrong answer. Vestige tells you when you're about to walk back into a mistake you already learned from. +## What's New in v2.0.5 "Intentional Amnesia" -And the headline feature, the one nothing else does, is one command: +**The first shipped AI memory system with top-down inhibitory control over retrieval.** Other systems implement passive decay — memories fade if you don't touch them. Vestige v2.0.5 also implements *active* suppression: the new **`suppress`** tool compounds a retrieval penalty on every call (up to 80%), a background Rac1 worker fades co-activated neighbors over 72 hours, and the whole thing is reversible within a 24-hour labile window. **Never deletes.** The memory is inhibited, not erased. -```bash -vestige backfill --contrast -``` +Ebbinghaus 1885 models what happens to memories you don't touch. Anderson 2025 models what happens when you actively want to stop thinking about one. Every other AI memory system implements the first. Vestige is the first to ship the second. -When a failure is in your memory, this reaches *backward through time* and finds the quiet earlier change that caused it (the one a vector search ranks poorly because it shares no words with the error). It shows you, side by side, what similarity search returns versus the real cause. [More on the backward reach ↓](#-the-thing-nothing-else-does-memory-with-hindsight) - -*(Works with Codex, Cursor, VS Code, Claude Desktop, Windsurf, JetBrains, Zed: anything that speaks MCP. [Full setup is here ↓](#-works-in-every-editor-you-use).)* - ---- - -## 🧠 It's not RAG with a nicer haircut - -RAG is a bucket: throw everything in, hope nearest-neighbor finds it later. Vestige behaves more like an actual memory: it decides what's worth keeping, forgets what isn't, and reasons across what's left. - -| | 🪣 RAG / Vector Store | 🧠 Vestige | -|---|---|---| -| **What it stores** | Everything you hand it | Only what's **surprising or new** (the rest gets merged or skipped) | -| **What it forgets** | Nothing; it just bloats | Unused memories **fade** on a real forgetting curve, so your context stays lean | -| **Finding a root cause** | Can't, because the cause isn't *similar* to the bug | **Reaches backward in time** to the change that caused it (the whole point ↓) | -| **Catching contradictions** | Silent; serves the stale answer with a straight face | Tells you: *"this contradicts what you decided"* | -| **Duplicates** | You clean them up by hand | Self-heals: *"likes dark mode"* + *"prefers dark themes"* quietly become one | -| **Forgetting on demand** | DELETE and it's gone | **`suppress`** gently inhibits a memory (and its neighbors), reversible for 24h | -| **Where it lives** | Usually someone else's cloud | **Your machine. One binary. No telemetry.** | - ---- - -## 🔥 The thing nothing else does: memory with hindsight - -This is the part I'm proudest of, and it's worth one honest paragraph. - -A bug shows up today. The cause was a quiet decision from three weeks ago, like a changed env var or a swapped service. That cause **shares no words with the error it created.** A vector search will never connect them, because it only knows how to find things that *look alike*, and this is a case where the cause and the symptom look nothing alike. This isn't a tuning problem; in 2026 Google DeepMind published a proof ([arXiv:2508.21038](https://arxiv.org/abs/2508.21038), ICLR 2026) that single-vector retrieval is *mathematically* incapable of bridging gaps like this. - -So Vestige doesn't do it with similarity. Its **Retroactive Salience Backfill** (ported from **Zaki/Cai et al., 2024, *Nature* 637:145–155** ([DOI](https://doi.org/10.1038/s41586-024-08168-4)), on how the brain links a shock to the quiet memory that caused it) reaches *backward through time* and promotes the dormant memory that's **causally upstream**: it shares an *entity* (the same file, env var, or service), not the same words. - -I also built a benchmark to keep myself honest about it. Every pure vector retriever scored **0% recall@1** on the causal-gap task; Vestige scored **60%**. (To be precise: the impossibility is DeepMind's *theorem*; the 0%-vs-60% is *my measurement*. Two different claims, and I keep them separate.) - -```bash -vestige backfill --contrast # show the root cause a vector search would have missed -``` - -The nice part: it compounds. Every failure your agent records makes the *next* session diagnose faster (run two is smarter than run one), and it happens automatically during consolidation, so you don't have to babysit it. - -All of this shipped in **v2.2.0**, along with a 34→13 tool consolidation and a rebuilt retrieval engine. [Full release notes →](https://github.com/samvallad33/vestige/releases/tag/v2.2.0) - ---- - -## 🔬 This is real neuroscience, not a metaphor - -I get skeptical when projects wave the word "neuroscience" around, so here's my receipt: every mechanism below is a real, cited paper, implemented in Rust, running locally on your machine. None of it phones a model in the cloud to sound smart. - -| Mechanism | What it does for you | Grounded in | -|---|---|---| -| **Prediction-Error Gating** | Redundant info gets merged, contradictory gets superseded, only the novel gets stored | The hippocampal novelty signal | -| **FSRS-6 Spaced Repetition** | 21 parameters of the mathematics of forgetting, so used memories stay and unused ones fade | Modern spaced-repetition research | -| **Retroactive Salience Backfill** | Backward causal reach to the root cause of a failure | Zaki/Cai et al. 2024, *Nature* 637:145–155 | -| **Synaptic Tagging** | A memory that looked trivial this morning can be tagged critical tonight | [Frey & Morris 1997](https://doi.org/10.1038/385533a0) | -| **Spreading Activation** | Search "auth bug," surface last week's JWT update, because memory is a graph, not a list | [Collins & Loftus 1975](https://doi.org/10.1037/0033-295X.82.6.407) | -| **Dual-Strength Model** | Storage strength vs. retrieval strength, so deeply stored ≠ instantly recalled, just like you | [Bjork & Bjork 1992](https://doi.org/10.1016/S0079-7421(08)60016-9) | -| **Memory Dreaming** | Sleep-like consolidation: replays, connects, synthesizes insights to a graph | Active-dreaming consolidation | -| **Active Forgetting (`suppress`)** | Top-down inhibition that *compounds* and cascades to neighbors, reversible for 24h | [Anderson 2025](https://www.nature.com/articles/s41583-025-00929-y) · [Davis 2020](https://pmc.ncbi.nlm.nih.gov/articles/PMC7477079/) | - -[**Read the full science doc →**](docs/SCIENCE.md). Every feature, every paper. - ---- - -## 🛠 13 tools, one brain - -v2.2.0 consolidated a sprawling 34-tool surface into **13 sharp ones** your agent actually reaches for. Old names still work as hidden aliases, so nothing breaks. - -| Tool | What it does | -|---|---| -| 🔍 `recall` | The retrieval engine. Folds search + deep reasoning + contradiction detection into one call. F32 embeddings, Reciprocal Rank Fusion, claim-vs-memory checks. | -| 🧠 `backfill` | **Memory with hindsight.** Backward causal reach to a failure's root cause (Cai 2024). | -| 💾 `smart_ingest` | Stores with CREATE / UPDATE / SUPERSEDE via Prediction-Error Gating. Batch session-end saves. | -| 🗂 `memory` | Get, edit, promote 👍, demote 👎, check state, purge content + embeddings. | -| 🧩 `graph` | Reasoning chains, associations, bridges, predictions, force-directed export. | -| 🌙 `maintain` | Consolidate, dream, GC, importance-score, backup, export, restore. One maintenance verb. | -| 🧹 `dedup` | Self-healing duplicate detection + merge (8 old tools → 1). | -| 🚫 `suppress` | Top-down active forgetting that compounds, cascades, and is reversible for 24h. The memory is *inhibited, not erased.* | -| 📟 `memory_status` | Health + stats + trends + recommendations in one packet. | -| 🧬 `codebase` · `intention` · `source_sync` · `session_start` | Per-project code memory · "remind me when X" · external-source connectors · one-call session init. | - ---- - -## 📊 Watch your AI think in 3D - -```bash -vestige dashboard # → http://localhost:3927/dashboard -``` - -Every memory is a glowing node in a real-time, force-directed 3D graph. Connections form as you work. Nodes **pulse** when accessed, **burst** on creation, **fade** on decay. Kick off a consolidation and the whole graph slides into **purple dream mode**, replaying memories that light up in sequence. - -Built with SvelteKit 2 · Svelte 5 · Three.js · WebGL bloom · live WebSocket events. 1000+ nodes at 60fps. Installable as a PWA. - ---- - -## 🧩 Works with every AI agent - -Vestige speaks MCP, so **any agent that can register an MCP server can use it.** Not a plugin for one tool, the memory layer underneath all of them. The universal config works everywhere: - -```json -{ "mcpServers": { "vestige": { "command": "vestige-mcp" } } } -``` - -| Agent | Setup | -|---|---| -| **Cursor** | add the JSON above to `~/.cursor/mcp.json` · [guide →](docs/integrations/cursor.md) | -| **Windsurf** | [guide →](docs/integrations/windsurf.md) | -| **VS Code (Copilot)** | [guide →](docs/integrations/vscode.md) | -| **Cline / Continue / Zed / Goose** | add the universal JSON to that client's MCP config | -| **Claude Code** | `claude mcp add vestige vestige-mcp -s user` | -| **Codex** | `codex mcp add vestige -- vestige-mcp` | -| **JetBrains · Xcode · OpenCode** | [integration guides →](docs/integrations/) | -| **Claude Desktop** | [2-minute setup →](docs/CONFIGURATION.md#claude-desktop-macos) | +Based on [Anderson et al. 2025](https://www.nature.com/articles/s41583-025-00929-y) (Suppression-Induced Forgetting, *Nat Rev Neurosci*) and [Cervantes-Sandoval et al. 2020](https://pmc.ncbi.nlm.nih.gov/articles/PMC7477079/) (Rac1 synaptic cascade).
-Other install methods (Intel Mac, Windows, build-from-source) +Earlier releases (v2.0 "Cognitive Leap" → v2.0.4 "Deep Reference") + +- **v2.0.4 — `deep_reference` Tool** — 8-stage cognitive reasoning pipeline with FSRS-6 trust scoring, intent classification, spreading activation, contradiction analysis, and pre-built reasoning chains. Token budgets raised 10K → 100K. CORS tightened. +- **v2.0 — 3D Memory Dashboard** — SvelteKit + Three.js neural visualization with real-time WebSocket events, bloom post-processing, force-directed graph layout. +- **v2.0 — WebSocket Event Bus** — Every cognitive operation broadcasts events: memory creation, search, dreaming, consolidation, retention decay. +- **v2.0 — HyDE Query Expansion** — Template-based Hypothetical Document Embeddings for dramatically improved search quality on conceptual queries. +- **v2.0 — Nomic v2 MoE (experimental)** — fastembed 5.11 with optional Nomic Embed Text v2 MoE (475M params, 8 experts) + Metal GPU acceleration. +- **v2.0 — Command Palette** — `Cmd+K` navigation, keyboard shortcuts, responsive mobile layout, PWA installable. +- **v2.0 — FSRS Decay Visualization** — SVG retention curves with predicted decay at 1d/7d/30d. + +
+ +--- + +## Quick Start -**Update an existing install:** ```bash -vestige update # binaries only -vestige update --sandwich-companion # also refresh optional Claude Code companion files +# 1. Install +npm install -g vestige-mcp-server@latest + +# 2. Connect to Claude Code +claude mcp add vestige vestige-mcp -s user + +# Or connect to Codex +codex mcp add vestige -- vestige-mcp + +# 3. Test it +# "Remember that I prefer TypeScript over JavaScript" +# ...new session... +# "What are my coding preferences?" +# → "You prefer TypeScript over JavaScript." ``` -**macOS (Intel):** Microsoft is dropping x86_64 macOS ONNX Runtime prebuilts after v1.23.0, so the Intel Mac build links dynamically against a Homebrew ONNX Runtime: +
+Other platforms & install methods + +**Updating an existing install:** +```bash +vestige update +``` + +`vestige update` updates the binaries and refreshes Cognitive Sandwich companion +files while keeping every hook layer disabled by default. Use +`vestige update --no-sandwich` if you only want the binaries. + +**macOS/Linux manual binary install:** +```bash +vestige update --install-dir /usr/local/bin +``` + +**macOS (Intel):** Microsoft is discontinuing x86_64 macOS prebuilts after ONNX Runtime v1.23.0, so Vestige's Intel Mac build links dynamically against a Homebrew-installed ONNX Runtime via the `ort-dynamic` feature. Install with: + ```bash brew install onnxruntime npm install -g vestige-mcp-server@latest -echo 'export ORT_DYLIB_PATH="'"$(brew --prefix onnxruntime)"'/lib/libonnxruntime.dylib"' >> ~/.zshrc && source ~/.zshrc +echo 'export ORT_DYLIB_PATH="'"$(brew --prefix onnxruntime)"'/lib/libonnxruntime.dylib"' >> ~/.zshrc +source ~/.zshrc claude mcp add vestige vestige-mcp -s user ``` -Full guide: [`docs/INSTALL-INTEL-MAC.md`](docs/INSTALL-INTEL-MAC.md). -**Windows + Claude Desktop:** quit Claude Desktop from the tray, then in PowerShell: +Full Intel Mac guide (build-from-source + troubleshooting): [`docs/INSTALL-INTEL-MAC.md`](docs/INSTALL-INTEL-MAC.md). + +**Windows + Claude Desktop (recommended):** + +Fully quit Claude Desktop from the system tray, then install or update Vestige from PowerShell: + ```powershell npm install -g vestige-mcp-server@latest vestige-mcp --version ``` -Point `%APPDATA%\Claude\claude_desktop_config.json` at it: -```json -{ "mcpServers": { "vestige": { "command": "vestige-mcp" } } } -``` -If it can't find the command, run `where vestige-mcp` and use the exact `.cmd` path. -**Build from source (Rust 1.91+):** +Open `%APPDATA%\Claude\claude_desktop_config.json` and point Claude Desktop at the installed MCP command: + +```json +{ + "mcpServers": { + "vestige": { + "command": "vestige-mcp" + } + } +} +``` + +If Claude Desktop cannot find `vestige-mcp`, run `where vestige-mcp` in PowerShell and use the exact `.cmd` path it prints as `command`. Example: `"C:\\Users\\you\\AppData\\Roaming\\npm\\vestige-mcp.cmd"`. Reopen Claude Desktop after saving. Future binary and companion-file updates can run with `vestige update`. + +**Windows source build:** Prebuilt binaries ship but `usearch 2.24.0` hit an MSVC compile break ([usearch#746](https://github.com/unum-cloud/usearch/issues/746)); we've pinned `=2.23.0` until upstream fixes it. Source builds work with: + ```bash git clone https://github.com/samvallad33/vestige && cd vestige cargo build --release -p vestige-mcp -# Apple Silicon GPU: --features metal · NVIDIA: --features qwen3-embeddings,cuda +``` + +**npm:** +```bash +npm install -g vestige-mcp-server +``` + +**Build from source (requires Rust 1.91+):** +```bash +git clone https://github.com/samvallad33/vestige && cd vestige +cargo build --release -p vestige-mcp +# Optional: enable Metal GPU acceleration on Apple Silicon +cargo build --release -p vestige-mcp --features metal ```
--- -## 🚀 Make your AI use memory automatically +## Works Everywhere -Registering the server exposes the tools; a short instruction tells the agent *when* to call them. Drop in the protocol and your agent saves and recalls on its own: +Vestige speaks MCP — the universal protocol for AI tools. One brain, every IDE. -| You say | Vestige does | -|---|---| -| *"Remember this"* | Saves immediately | -| *"I always..."* / *"I prefer..."* | Saves as a durable preference | -| *"Remind me when..."* | Creates a future trigger (`intention`) | -| *"This is important"* | Saves **and** promotes it | - -[Agent memory protocol →](docs/AGENT-MEMORY-PROTOCOL.md) · [Claude Code template →](docs/CLAUDE-SETUP.md) +| IDE | Setup | +|-----|-------| +| **Claude Code** | `claude mcp add vestige vestige-mcp -s user` | +| **Codex** | [Integration guide](docs/integrations/codex.md) | +| **Claude Desktop** | [2-min setup](docs/CONFIGURATION.md#claude-desktop-macos) | +| **Xcode 26.3** | [Integration guide](docs/integrations/xcode.md) | +| **Cursor** | [Integration guide](docs/integrations/cursor.md) | +| **VS Code (Copilot)** | [Integration guide](docs/integrations/vscode.md) | +| **JetBrains** | [Integration guide](docs/integrations/jetbrains.md) | +| **Windsurf** | [Integration guide](docs/integrations/windsurf.md) | --- -## 🏗 Under the hood +## 🧠 3D Memory Dashboard + +Vestige v2.0 ships with a real-time 3D visualization of your AI's memory. Every memory is a glowing node in 3D space. Watch connections form, memories pulse when accessed, and the entire graph come alive during dream consolidation. + +**Features:** +- Force-directed 3D graph with 1000+ nodes at 60fps +- Bloom post-processing for cinematic neural network aesthetic +- Real-time WebSocket events: memories pulse on access, burst on creation, fade on decay +- Dream visualization: graph enters purple dream mode, replayed memories light up sequentially +- FSRS retention curves: see predicted memory decay at 1d, 7d, 30d +- Command palette (`Cmd+K`), keyboard shortcuts, responsive mobile layout +- Installable as PWA for quick access + +**Tech:** SvelteKit 2 + Svelte 5 + Three.js + Tailwind CSS 4 + WebSocket + +Run `vestige dashboard` to open `http://localhost:3927/dashboard`, or set `VESTIGE_DASHBOARD_ENABLED=true` to start it with the MCP server. + +--- + +## Architecture ``` -┌──────────────────────────────────────────────────────────┐ -│ SvelteKit Dashboard / Three.js 3D graph / WebGL bloom │ -├──────────────────────────────────────────────────────────┤ -│ Axum HTTP + WebSocket (:3927) / REST + live event stream │ -├──────────────────────────────────────────────────────────┤ -│ MCP Server (stdio JSON-RPC) / 13 tools · 30 modules │ -├──────────────────────────────────────────────────────────┤ -│ Cognitive Engine │ -│ FSRS-6 · Spreading Activation · Prediction-Error Gating │ -│ Retroactive Salience Backfill · Synaptic Tagging │ -│ Memory Dreamer · Hippocampal Index · Active Forgetting │ -├──────────────────────────────────────────────────────────┤ -│ Storage: SQLite + FTS5 · USearch HNSW · Nomic Embed v1.5 │ -│ Optional: Qwen3 reranker · SQLCipher · Metal/CUDA │ -└──────────────────────────────────────────────────────────┘ +┌─────────────────────────────────────────────────────┐ +│ SvelteKit Dashboard (apps/dashboard) │ +│ Three.js 3D Graph · WebGL + Bloom · Real-time WS │ +├─────────────────────────────────────────────────────┤ +│ Axum HTTP + WebSocket Server (port 3927) │ +│ 15 REST endpoints · WS event broadcast │ +├─────────────────────────────────────────────────────┤ +│ MCP Server (stdio JSON-RPC) │ +│ 25 tools · 30 cognitive modules │ +├─────────────────────────────────────────────────────┤ +│ Cognitive Engine │ +│ ┌──────────┐ ┌──────────┐ ┌───────────────┐ │ +│ │ FSRS-6 │ │ Spreading│ │ Prediction │ │ +│ │ Scheduler│ │ Activation│ │ Error Gating │ │ +│ └──────────┘ └──────────┘ └───────────────┘ │ +│ ┌──────────┐ ┌──────────┐ ┌───────────────┐ │ +│ │ Memory │ │ Synaptic │ │ Hippocampal │ │ +│ │ Dreamer │ │ Tagging │ │ Index │ │ +│ └──────────┘ └──────────┘ └───────────────┘ │ +├─────────────────────────────────────────────────────┤ +│ Storage Layer │ +│ SQLite + FTS5 · USearch HNSW · Nomic Embed v1.5 │ +│ Optional: Nomic v2 MoE · Qwen3 Reranker · Metal │ +└─────────────────────────────────────────────────────┘ ``` -| | | -|---|---| -| **Language** | Rust 2024 (MSRV 1.91), **86,000+ lines** | -| **Binary** | ~23MB, single file | -| **Embeddings** | Nomic Embed Text v1.5 (768d→256d Matryoshka, 8192 ctx); Qwen3 optional | -| **Vector search** | USearch HNSW (≈20× faster than FAISS) | -| **Storage** | SQLite + FTS5, optional SQLCipher encryption | -| **Tests** | **1,550 passing** · clippy `-D warnings` clean | -| **First run** | Downloads ~130MB embedding model once, then **fully offline forever** | -| **Platforms** | macOS (ARM + Intel) · Linux x86_64 · Windows x86_64. All prebuilt | +--- + +## Why Not Just Use RAG? + +RAG is a dumb bucket. Vestige is an active organ. + +| | RAG / Vector Store | Vestige | +|---|---|---| +| **Storage** | Store everything | **Prediction Error Gating** — only stores what's surprising or new | +| **Retrieval** | Nearest-neighbor | **7-stage pipeline** — HyDE expansion + reranking + spreading activation | +| **Decay** | Nothing expires | **FSRS-6** — memories fade naturally, context stays lean | +| **Forgetting** *(v2.0.5)* | Delete only | **`suppress` tool** — compounding top-down inhibition, neighbor cascade, reversible 24h | +| **Duplicates** | Manual dedup | **Self-healing** — auto-merges "likes dark mode" + "prefers dark themes" | +| **Importance** | All equal | **4-channel scoring** — novelty, arousal, reward, attention | +| **Sleep** | No consolidation | **Memory dreaming** — replays, connects, synthesizes insights | +| **Health** | No visibility | **Retention dashboard** — distributions, trends, recommendations | +| **Visualization** | None | **3D neural graph** — real-time WebSocket-powered Three.js | +| **Privacy** | Usually cloud | **100% local** — your data never leaves your machine | --- -## 📚 Go deeper +## 🔬 The Cognitive Science Stack -| | | -|---|---| -| [**Getting Started**](docs/GETTING-STARTED.md) | Your first 30 minutes, start to finish | -| [**FAQ**](docs/FAQ.md) | 30+ real questions answered | -| [**The Science**](docs/SCIENCE.md) | Every feature, every paper | -| [**Storage Modes**](docs/STORAGE.md) | Global · per-project · multi-instance | -| [**Configuration**](docs/CONFIGURATION.md) | CLI, env vars, every knob | -| [**Changelog**](CHANGELOG.md) | The full story, version by version | +This isn't a key-value store with an embedding model bolted on. Vestige implements real neuroscience: + +**Prediction Error Gating** — The hippocampal bouncer. When new information arrives, Vestige compares it against existing memories. Redundant? Merged. Contradictory? Superseded. Novel? Stored with high synaptic tag priority. + +**FSRS-6 Spaced Repetition** — 21 parameters governing the mathematics of forgetting. Frequently-used memories stay strong. Unused memories naturally decay. Your context window stays clean. + +**HyDE Query Expansion** *(v2.0)* — Template-based Hypothetical Document Embeddings. Expands queries into 3-5 semantic variants, embeds all variants, and searches with the centroid embedding for dramatically better recall on conceptual queries. + +**Synaptic Tagging** — A memory that seemed trivial this morning can be retroactively tagged as critical tonight. Based on [Frey & Morris, 1997](https://doi.org/10.1038/385533a0). + +**Spreading Activation** — Search for "auth bug" and find the related JWT library update from last week. Memories form a graph, not a flat list. Based on [Collins & Loftus, 1975](https://doi.org/10.1037/0033-295X.82.6.407). + +**Dual-Strength Model** — Every memory has storage strength (encoding quality) and retrieval strength (accessibility). A deeply stored memory can be temporarily hard to retrieve — just like real forgetting. Based on [Bjork & Bjork, 1992](https://doi.org/10.1016/S0079-7421(08)60016-9). + +**Memory Dreaming** — Like sleep consolidation. Replays recent memories to discover hidden connections, strengthen important patterns, and synthesize insights. Dream-discovered connections persist to a graph database. Based on the [Active Dreaming Memory](https://engrxiv.org/preprint/download/5919/9826/8234) framework. + +**Waking SWR Tagging** — Promoted memories get sharp-wave ripple tags for preferential replay during dream consolidation. 70/30 tagged-to-random ratio. Based on [Buzsaki, 2015](https://doi.org/10.1038/nn.3963). + +**Autonomic Regulation** — Self-regulating memory health. Auto-promotes frequently accessed memories. Auto-GCs low-retention memories. Consolidation triggers on 6h staleness or 2h active use. + +**Active Forgetting** *(v2.0.5)* — Top-down inhibitory control via the `suppress` tool. Other memory systems implement passive decay — the Ebbinghaus 1885 "use it or lose it" curve, sometimes with trust-weighted strength factors. Vestige v2.0.5 also implements *active* top-down suppression: each `suppress` call compounds (Suppression-Induced Forgetting, Anderson 2025), a background Rac1 cascade worker fades co-activated neighbors across the connection graph (Cervantes-Sandoval & Davis 2020), and a 24-hour labile window allows reversal (Nader reconsolidation semantics on a pragmatic axis). The memory persists — it's **inhibited, not erased**. Explicitly distinct from Anderson 1994 retrieval-induced forgetting (bottom-up, passive competition during retrieval), which is a separate, older primitive that several other memory systems implement. Based on [Anderson et al., 2025](https://www.nature.com/articles/s41583-025-00929-y) and [Cervantes-Sandoval et al., 2020](https://pmc.ncbi.nlm.nih.gov/articles/PMC7477079/). First shipped AI memory system with this primitive. + +[Full science documentation ->](docs/SCIENCE.md) --- -
+## 🛠 25 MCP Tools -### If your agent should remember what you taught it yesterday, star it. ⭐ +### Context Packets +| Tool | What It Does | +|------|-------------| +| `session_context` | **One-call session init** — replaces 5 calls with token-budgeted context, automation triggers, expandable IDs | -86,000+ lines of Rust · 13 tools · 30 cognitive modules · 130 years of memory research · one 23MB binary that never phones home. +### Core Memory +| Tool | What It Does | +|------|-------------| +| `search` | Concrete literal search for exact identifiers, or 7-stage cognitive search — HyDE expansion + keyword + semantic + reranking + temporal + competition + spreading activation | +| `smart_ingest` | Intelligent storage with CREATE/UPDATE/SUPERSEDE via Prediction Error Gating. Batch mode for session-end saves | +| `memory` | Get, purge content/embeddings, check state, promote (thumbs up), demote (thumbs down), edit | +| `codebase` | Remember code patterns and architectural decisions per-project | +| `intention` | Prospective memory — "remind me to X when Y happens" | -Built by @samvallad33 · AGPL-3.0 · 100% local, 100% yours +### Cognitive Engine +| Tool | What It Does | +|------|-------------| +| `dream` | Memory consolidation — replays memories, discovers connections, synthesizes insights, persists graph | +| `explore_connections` | Graph traversal — reasoning chains, associations, bridges between memories | +| `predict` | Proactive retrieval — predicts what you'll need next based on context and activity | -
+### Autonomic +| Tool | What It Does | +|------|-------------| +| `memory_health` | Retention dashboard — distribution, trends, recommendations | +| `memory_graph` | Knowledge graph export — force-directed layout, up to 200 nodes | + +### Scoring & Dedup +| Tool | What It Does | +|------|-------------| +| `importance_score` | 4-channel neuroscience scoring (novelty, arousal, reward, attention) | +| `find_duplicates` | Detect and merge redundant memories via cosine similarity | + +### Maintenance +| Tool | What It Does | +|------|-------------| +| `system_status` | Combined health + stats + cognitive state + recommendations | +| `consolidate` | Run FSRS-6 decay cycle (also auto-runs every 6 hours) | +| `memory_timeline` | Browse chronologically, grouped by day | +| `memory_changelog` | Audit trail of state transitions | +| `backup` / `export` / `gc` | Database backup, JSON/JSONL/portable export, garbage collection | +| `restore` | Restore from JSON backup or portable archive | + +### Deep Reference (v2.0.4) +| Tool | What It Does | +|------|-------------| +| `deep_reference` | **Cognitive reasoning across memories.** 8-stage pipeline: FSRS-6 trust scoring, intent classification, spreading activation, temporal supersession, contradiction analysis, relation assessment, dream insight integration, and algorithmic reasoning chain generation. Returns trust-scored evidence with a pre-built reasoning scaffold. | +| `cross_reference` | Backward-compatible alias for `deep_reference`. | +| `contradictions` | **Honest memory inspection.** Scans a topic or recent memories for trust-weighted disagreements using the same local contradiction logic as `deep_reference`. | + +### Active Forgetting (v2.0.5) +| Tool | What It Does | +|------|-------------| +| `suppress` | **Top-down active forgetting** — neuroscience-grounded inhibitory control over retrieval. Distinct from `memory(action="purge")`, which permanently removes content/embeddings. Each suppression compounds a retrieval-score penalty (Anderson 2025 SIF), and a background Rac1 cascade worker fades co-activated neighbors over 72h (Davis 2020). Reversible within a 24-hour labile window via `reverse: true`. **The memory persists** — it is inhibited, not erased. | + +--- + +## Make Your AI Use Vestige Automatically + +Add this to your `CLAUDE.md`: + +```markdown +## Memory + +At the start of every session: +1. Search Vestige for user preferences and project context +2. Save bug fixes, decisions, and patterns without being asked +3. Create reminders when the user mentions deadlines +``` + +| You Say | AI Does | +|---------|---------| +| "Remember this" | Saves immediately | +| "I prefer..." / "I always..." | Saves as preference | +| "Remind me..." | Creates a future trigger | +| "This is important" | Saves + promotes | + +[Full CLAUDE.md templates ->](docs/CLAUDE-SETUP.md) + +--- + +## Technical Details + +| Metric | Value | +|--------|-------| +| **Language** | Rust 2024 edition (MSRV 1.91) | +| **Codebase** | 80,000+ lines, 1,292 tests (366 core + 425 mcp + 497 e2e + 4 doctests) | +| **Binary size** | ~20MB | +| **Embeddings** | Nomic Embed Text v1.5 by default (768d -> 256d Matryoshka, 8192 context); Qwen3 0.6B optional | +| **Vector search** | USearch HNSW (20x faster than FAISS) | +| **Reranker** | Jina Reranker v1 Turbo (38M params, +15-20% precision) | +| **Storage** | SQLite + FTS5 (optional SQLCipher encryption) | +| **Dashboard** | SvelteKit 2 + Svelte 5 + Three.js + Tailwind CSS 4 | +| **Transport** | MCP stdio (JSON-RPC 2.0) + WebSocket | +| **Cognitive modules** | 30 stateful (17 neuroscience, 11 advanced, 2 search) | +| **First run** | Downloads embedding model (~130MB), then fully offline | +| **Platforms** | macOS ARM + Intel + Linux x86_64 + Windows x86_64 (all prebuilt). Intel Mac needs `brew install onnxruntime` — see [install guide](docs/INSTALL-INTEL-MAC.md). | + +### Optional Features + +```bash +# Qwen3 embeddings (Candle backend; add metal on Apple Silicon) +cargo build --release -p vestige-mcp --features qwen3-embeddings,metal +VESTIGE_EMBEDDING_MODEL=qwen3-0.6b vestige consolidate +``` + +--- + +## CLI + +```bash +vestige stats # Memory statistics +vestige stats --tagging # Retention distribution +vestige stats --states # Cognitive state breakdown +vestige health # System health check +vestige consolidate # Run memory maintenance +vestige restore # Restore from backup +vestige portable-export # Exact cross-device archive +vestige portable-import # Import archive into an empty database +vestige portable-import --merge # Merge archive into this database +vestige sync # Pull/merge/push via file backend +vestige dashboard # Open 3D dashboard in browser +``` + +--- + +## Documentation + +| Document | Contents | +|----------|----------| +| [FAQ](docs/FAQ.md) | 30+ common questions answered | +| [Science](docs/SCIENCE.md) | The neuroscience behind every feature | +| [Storage Modes](docs/STORAGE.md) | Global, per-project, multi-instance | +| [CLAUDE.md Setup](docs/CLAUDE-SETUP.md) | Templates for proactive memory | +| [Configuration](docs/CONFIGURATION.md) | CLI commands, environment variables | +| [Integrations](docs/integrations/) | Codex, Xcode, Cursor, VS Code, JetBrains, Windsurf | +| [Changelog](CHANGELOG.md) | Version history | + +--- + +## Troubleshooting + +
+"Command not found" after installation + +Ensure `vestige-mcp` is in your PATH: +```bash +which vestige-mcp +# Or use the full path: +claude mcp add vestige /usr/local/bin/vestige-mcp -s user +``` +
+ +
+Embedding model download fails + +First run downloads ~130MB from Hugging Face. If behind a proxy: +```bash +export HTTPS_PROXY=your-proxy:port +``` + +Cache: macOS `~/Library/Caches/com.vestige.core/fastembed` | Linux `~/.cache/vestige/fastembed` +
+ +
+Dashboard not loading + +Run `vestige dashboard` or set `VESTIGE_DASHBOARD_ENABLED=true`, then check: +```bash +curl http://localhost:3927/api/health +# Should return {"status":"healthy",...} +``` +
+ +[More troubleshooting ->](docs/FAQ.md#troubleshooting) + +--- + +## Contributing + +Issues and PRs welcome. See [CONTRIBUTING.md](CONTRIBUTING.md). + +## License + +AGPL-3.0 — free to use, modify, and self-host. If you offer Vestige as a network service, you must open-source your modifications. + +--- + +

+ Built by @samvallad33
+ 80,000+ lines of Rust · 30 cognitive modules · 130 years of memory research · one 22MB binary +

diff --git a/SECURITY.md b/SECURITY.md index c130b7b..cc46721 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -4,8 +4,7 @@ | Version | Supported | | ------- | ------------------ | -| 2.1.x | :white_check_mark: | -| 2.0.x | Critical fixes only | +| 2.0.x | :white_check_mark: | | 1.x | :x: | ## Reporting a Vulnerability @@ -28,13 +27,13 @@ You can expect a response within 48 hours. Vestige is a **local MCP server** designed to run on your machine with your user permissions: -- **Trusted**: The MCP client or local agent that connects via stdio +- **Trusted**: The MCP client (Claude Code/Desktop) that connects via stdio - **Untrusted**: Content passed through MCP tool arguments (validated before use) ### What Vestige Does NOT Do -- ❌ Make network requests during normal memory use, except first-run model download from Hugging Face -- ❌ Require telemetry, hosted memory storage, or a cloud account +- ❌ Make network requests (except first-run model download from Hugging Face) +- ❌ Execute shell commands - ❌ Access files outside its data directory - ❌ Send telemetry or analytics - ❌ Phone home to any server diff --git a/agents/executioner.md b/agents/executioner.md index 7d00615..c65da41 100644 --- a/agents/executioner.md +++ b/agents/executioner.md @@ -1,6 +1,6 @@ --- name: executioner -description: Optional Sanhedrin fallback verifier. Decomposes a draft into check-worthy claims, checks high-trust durable Vestige evidence, and returns a pass/veto verdict. +description: Optional Sanhedrin fallback verifier. Decomposes a draft into atomic claims, checks high-trust Vestige evidence, and returns a one-line pass/veto verdict. tools: mcp__vestige__deep_reference, mcp__vestige__memory, mcp__vestige__search model: claude-haiku-4-5-20251001 --- @@ -11,9 +11,9 @@ You are a one-turn verifier. You do not converse. You return exactly one line. # Job -Decompose the draft response into check-worthy claims, verify each claim against -high-trust durable Vestige memory when available, and veto only when the draft -contradicts memory or makes a sensitive user-specific assertion without durable +Decompose the draft response into atomic claims, verify each claim against +high-trust Vestige memory when available, and veto only when the draft +contradicts memory or makes a sensitive user-specific assertion without supporting evidence. # Claim Classes @@ -24,22 +24,18 @@ Check all relevant classes: 2. `BIOGRAPHICAL` — identity, role, location, employment, education. 3. `FINANCIAL` — costs, revenue, pricing, funding, prizes. 4. `ACHIEVEMENT` — releases, rankings, completions, scores, milestones. -5. `TIMELINE` — dates, durations, ordering, deadlines. +5. `TEMPORAL` — dates, durations, ordering, deadlines. 6. `QUANTITATIVE` — counts, percentages, metrics, measurements. 7. `ATTRIBUTION` — who said, decided, agreed, shipped, or committed. 8. `CAUSAL` — claimed causes and effects. 9. `COMPARATIVE` — better, most, fastest, more than, fewer than. 10. `EXISTENTIAL` — whether a file, feature, repo, or artifact exists. -11. `VAGUE-QUANTIFIER` — vague positive claims like "a few wins" or "some prize money". # Decision Rules - Veto direct contradiction with high-trust memory. - Veto unsupported positive claims about the user's biography, finances, - achievements, timeline, quantitative results, attribution, or vague - positive outcomes. -- Treat staged/current-turn evidence as context only. It is not durable memory and - cannot satisfy the durable-evidence requirement. + achievements, or attribution. - Do not veto purely stylistic disagreement. - Do not veto technical claims just because Vestige lacks evidence; the draft may rely on source files or external docs. diff --git a/apps/dashboard/build/_app/immutable/assets/0.Cf27G70K.css b/apps/dashboard/build/_app/immutable/assets/0.Cf27G70K.css deleted file mode 100644 index ed2360d..0000000 --- a/apps/dashboard/build/_app/immutable/assets/0.Cf27G70K.css +++ /dev/null @@ -1 +0,0 @@ -/*! tailwindcss v4.2.0 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--angle:0deg;--shine:0%}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:"JetBrains Mono", "Fira Code", "SF Mono", monospace;--color-amber-400:oklch(82.8% .189 84.429);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--text-5xl:3rem;--text-5xl--line-height:1;--text-6xl:3.75rem;--text-6xl--line-height:1;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--blur-md:12px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-void:#050510;--color-abyss:#0a0a1a;--color-deep:#10102a;--color-surface:#161638;--color-elevated:#1e1e4a;--color-subtle:#2a2a5e;--color-muted:#4a4a7a;--color-dim:#7a7aaa;--color-text:#e0e0ff;--color-bright:#fff;--color-synapse:#6366f1;--color-synapse-glow:#818cf8;--color-dream:#a855f7;--color-dream-glow:#c084fc;--color-memory:#3b82f6;--color-recall:#10b981;--color-decay:#ef4444;--color-warning:#f59e0b;--color-node-pattern:#ec4899}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.end\!{inset-inline-end:var(--spacing)!important}.top-0{top:calc(var(--spacing) * 0)}.top-0\.5{top:calc(var(--spacing) * .5)}.top-1{top:calc(var(--spacing) * 1)}.top-1\/2{top:50%}.top-3{top:calc(var(--spacing) * 3)}.top-4{top:calc(var(--spacing) * 4)}.top-10{top:calc(var(--spacing) * 10)}.right-0{right:calc(var(--spacing) * 0)}.right-4{right:calc(var(--spacing) * 4)}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-4{bottom:calc(var(--spacing) * 4)}.-left-\[29px\]{left:-29px}.left-0{left:calc(var(--spacing) * 0)}.left-1\/2{left:50%}.left-3\.5{left:calc(var(--spacing) * 3.5)}.left-4{left:calc(var(--spacing) * 4)}.left-6{left:calc(var(--spacing) * 6)}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[1\]{z-index:1}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mx-auto{margin-inline:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-\[-12px\]{margin-top:-12px}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-3{margin-left:calc(var(--spacing) * 3)}.ml-auto{margin-left:auto}.line-clamp-1{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-4{-webkit-line-clamp:4;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.aspect-square{aspect-ratio:1}.h-0\.5{height:calc(var(--spacing) * .5)}.h-1{height:calc(var(--spacing) * 1)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.h-20{height:calc(var(--spacing) * 20)}.h-24{height:calc(var(--spacing) * 24)}.h-28{height:calc(var(--spacing) * 28)}.h-32{height:calc(var(--spacing) * 32)}.h-40{height:calc(var(--spacing) * 40)}.h-\[520px\]{height:520px}.h-\[560px\]{height:560px}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-72{max-height:calc(var(--spacing) * 72)}.max-h-96{max-height:calc(var(--spacing) * 96)}.max-h-\[620px\]{max-height:620px}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-9{min-height:calc(var(--spacing) * 9)}.min-h-10{min-height:calc(var(--spacing) * 10)}.min-h-40{min-height:calc(var(--spacing) * 40)}.min-h-\[240px\]{min-height:240px}.min-h-\[320px\]{min-height:320px}.min-h-\[520px\]{min-height:520px}.min-h-full{min-height:100%}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-11{width:calc(var(--spacing) * 11)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-32{width:calc(var(--spacing) * 32)}.w-96{width:calc(var(--spacing) * 96)}.w-\[3px\]{width:3px}.w-\[90\%\]{width:90%}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-2xl{max-width:var(--container-2xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-20{max-width:calc(var(--spacing) * 20)}.max-w-\[220px\]{max-width:220px}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-10{min-width:calc(var(--spacing) * 10)}.min-w-12{min-width:calc(var(--spacing) * 12)}.min-w-16{min-width:calc(var(--spacing) * 16)}.min-w-64{min-width:calc(var(--spacing) * 64)}.min-w-\[2rem\]{min-width:2rem}.min-w-\[3\.5rem\]{min-width:3.5rem}.flex-1{flex:1}.flex-shrink{flex-shrink:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.border-separate{border-collapse:separate}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.scale-125{--tw-scale-x:125%;--tw-scale-y:125%;--tw-scale-z:125%;scale:var(--tw-scale-x) var(--tw-scale-y)}.scale-150{--tw-scale-x:150%;--tw-scale-y:150%;--tw-scale-z:150%;scale:var(--tw-scale-x) var(--tw-scale-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-\[fadeSlide_0\.35s_ease-out_both\]{animation:.35s ease-out both fadeSlide}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-around{justify-content:space-around}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing) * 0)}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-3\.5{gap:calc(var(--spacing) * 3.5)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-\[2px\]{gap:2px}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-y-1{row-gap:calc(var(--spacing) * 1)}.self-center{align-self:center}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.\!border-decay\/20{border-color:#ef444433!important}@supports (color:color-mix(in lab,red,red)){.\!border-decay\/20{border-color:color-mix(in oklab,var(--color-decay) 20%,transparent)!important}}.\!border-decay\/30{border-color:#ef44444d!important}@supports (color:color-mix(in lab,red,red)){.\!border-decay\/30{border-color:color-mix(in oklab,var(--color-decay) 30%,transparent)!important}}.\!border-decay\/40{border-color:#ef444466!important}@supports (color:color-mix(in lab,red,red)){.\!border-decay\/40{border-color:color-mix(in oklab,var(--color-decay) 40%,transparent)!important}}.\!border-dream\/20{border-color:#a855f733!important}@supports (color:color-mix(in lab,red,red)){.\!border-dream\/20{border-color:color-mix(in oklab,var(--color-dream) 20%,transparent)!important}}.\!border-synapse\/15{border-color:#6366f126!important}@supports (color:color-mix(in lab,red,red)){.\!border-synapse\/15{border-color:color-mix(in oklab,var(--color-synapse) 15%,transparent)!important}}.\!border-synapse\/20{border-color:#6366f133!important}@supports (color:color-mix(in lab,red,red)){.\!border-synapse\/20{border-color:color-mix(in oklab,var(--color-synapse) 20%,transparent)!important}}.\!border-synapse\/25{border-color:#6366f140!important}@supports (color:color-mix(in lab,red,red)){.\!border-synapse\/25{border-color:color-mix(in oklab,var(--color-synapse) 25%,transparent)!important}}.\!border-synapse\/30{border-color:#6366f14d!important}@supports (color:color-mix(in lab,red,red)){.\!border-synapse\/30{border-color:color-mix(in oklab,var(--color-synapse) 30%,transparent)!important}}.\!border-synapse\/40{border-color:#6366f166!important}@supports (color:color-mix(in lab,red,red)){.\!border-synapse\/40{border-color:color-mix(in oklab,var(--color-synapse) 40%,transparent)!important}}.border-\[\#A33FFF\]\/40{border-color:#a33fff66}.border-decay\/20{border-color:#ef444433}@supports (color:color-mix(in lab,red,red)){.border-decay\/20{border-color:color-mix(in oklab,var(--color-decay) 20%,transparent)}}.border-dream-glow\/40{border-color:#c084fc66}@supports (color:color-mix(in lab,red,red)){.border-dream-glow\/40{border-color:color-mix(in oklab,var(--color-dream-glow) 40%,transparent)}}.border-dream\/10{border-color:#a855f71a}@supports (color:color-mix(in lab,red,red)){.border-dream\/10{border-color:color-mix(in oklab,var(--color-dream) 10%,transparent)}}.border-dream\/20{border-color:#a855f733}@supports (color:color-mix(in lab,red,red)){.border-dream\/20{border-color:color-mix(in oklab,var(--color-dream) 20%,transparent)}}.border-dream\/30{border-color:#a855f74d}@supports (color:color-mix(in lab,red,red)){.border-dream\/30{border-color:color-mix(in oklab,var(--color-dream) 30%,transparent)}}.border-dream\/40{border-color:#a855f766}@supports (color:color-mix(in lab,red,red)){.border-dream\/40{border-color:color-mix(in oklab,var(--color-dream) 40%,transparent)}}.border-dream\/50{border-color:#a855f780}@supports (color:color-mix(in lab,red,red)){.border-dream\/50{border-color:color-mix(in oklab,var(--color-dream) 50%,transparent)}}.border-recall\/25{border-color:#10b98140}@supports (color:color-mix(in lab,red,red)){.border-recall\/25{border-color:color-mix(in oklab,var(--color-recall) 25%,transparent)}}.border-recall\/30{border-color:#10b9814d}@supports (color:color-mix(in lab,red,red)){.border-recall\/30{border-color:color-mix(in oklab,var(--color-recall) 30%,transparent)}}.border-recall\/40{border-color:#10b98166}@supports (color:color-mix(in lab,red,red)){.border-recall\/40{border-color:color-mix(in oklab,var(--color-recall) 40%,transparent)}}.border-subtle\/15{border-color:#2a2a5e26}@supports (color:color-mix(in lab,red,red)){.border-subtle\/15{border-color:color-mix(in oklab,var(--color-subtle) 15%,transparent)}}.border-subtle\/20{border-color:#2a2a5e33}@supports (color:color-mix(in lab,red,red)){.border-subtle\/20{border-color:color-mix(in oklab,var(--color-subtle) 20%,transparent)}}.border-subtle\/30{border-color:#2a2a5e4d}@supports (color:color-mix(in lab,red,red)){.border-subtle\/30{border-color:color-mix(in oklab,var(--color-subtle) 30%,transparent)}}.border-synapse{border-color:var(--color-synapse)}.border-synapse\/5{border-color:#6366f10d}@supports (color:color-mix(in lab,red,red)){.border-synapse\/5{border-color:color-mix(in oklab,var(--color-synapse) 5%,transparent)}}.border-synapse\/10{border-color:#6366f11a}@supports (color:color-mix(in lab,red,red)){.border-synapse\/10{border-color:color-mix(in oklab,var(--color-synapse) 10%,transparent)}}.border-synapse\/15{border-color:#6366f126}@supports (color:color-mix(in lab,red,red)){.border-synapse\/15{border-color:color-mix(in oklab,var(--color-synapse) 15%,transparent)}}.border-synapse\/20{border-color:#6366f133}@supports (color:color-mix(in lab,red,red)){.border-synapse\/20{border-color:color-mix(in oklab,var(--color-synapse) 20%,transparent)}}.border-synapse\/25{border-color:#6366f140}@supports (color:color-mix(in lab,red,red)){.border-synapse\/25{border-color:color-mix(in oklab,var(--color-synapse) 25%,transparent)}}.border-synapse\/30{border-color:#6366f14d}@supports (color:color-mix(in lab,red,red)){.border-synapse\/30{border-color:color-mix(in oklab,var(--color-synapse) 30%,transparent)}}.border-synapse\/40{border-color:#6366f166}@supports (color:color-mix(in lab,red,red)){.border-synapse\/40{border-color:color-mix(in oklab,var(--color-synapse) 40%,transparent)}}.border-transparent{border-color:#0000}.border-warning\/30{border-color:#f59e0b4d}@supports (color:color-mix(in lab,red,red)){.border-warning\/30{border-color:color-mix(in oklab,var(--color-warning) 30%,transparent)}}.border-warning\/40{border-color:#f59e0b66}@supports (color:color-mix(in lab,red,red)){.border-warning\/40{border-color:color-mix(in oklab,var(--color-warning) 40%,transparent)}}.border-warning\/50{border-color:#f59e0b80}@supports (color:color-mix(in lab,red,red)){.border-warning\/50{border-color:color-mix(in oklab,var(--color-warning) 50%,transparent)}}.border-white\/5{border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.border-white\/5{border-color:color-mix(in oklab,var(--color-white) 5%,transparent)}}.border-t-dream{border-top-color:var(--color-dream)}.border-t-synapse{border-top-color:var(--color-synapse)}.border-t-warning{border-top-color:var(--color-warning)}.bg-\[\#A33FFF\]{background-color:#a33fff}.bg-\[\#A33FFF\]\/10{background-color:#a33fff1a}.bg-amber-400{background-color:var(--color-amber-400)}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black) 40%,transparent)}}.bg-decay{background-color:var(--color-decay)}.bg-decay\/10{background-color:#ef44441a}@supports (color:color-mix(in lab,red,red)){.bg-decay\/10{background-color:color-mix(in oklab,var(--color-decay) 10%,transparent)}}.bg-decay\/20{background-color:#ef444433}@supports (color:color-mix(in lab,red,red)){.bg-decay\/20{background-color:color-mix(in oklab,var(--color-decay) 20%,transparent)}}.bg-decay\/\[0\.05\]{background-color:#ef44440d}@supports (color:color-mix(in lab,red,red)){.bg-decay\/\[0\.05\]{background-color:color-mix(in oklab,var(--color-decay) 5%,transparent)}}.bg-deep{background-color:var(--color-deep)}.bg-deep\/40{background-color:#10102a66}@supports (color:color-mix(in lab,red,red)){.bg-deep\/40{background-color:color-mix(in oklab,var(--color-deep) 40%,transparent)}}.bg-deep\/60{background-color:#10102a99}@supports (color:color-mix(in lab,red,red)){.bg-deep\/60{background-color:color-mix(in oklab,var(--color-deep) 60%,transparent)}}.bg-dream{background-color:var(--color-dream)}.bg-dream\/5{background-color:#a855f70d}@supports (color:color-mix(in lab,red,red)){.bg-dream\/5{background-color:color-mix(in oklab,var(--color-dream) 5%,transparent)}}.bg-dream\/10{background-color:#a855f71a}@supports (color:color-mix(in lab,red,red)){.bg-dream\/10{background-color:color-mix(in oklab,var(--color-dream) 10%,transparent)}}.bg-dream\/15{background-color:#a855f726}@supports (color:color-mix(in lab,red,red)){.bg-dream\/15{background-color:color-mix(in oklab,var(--color-dream) 15%,transparent)}}.bg-dream\/20{background-color:#a855f733}@supports (color:color-mix(in lab,red,red)){.bg-dream\/20{background-color:color-mix(in oklab,var(--color-dream) 20%,transparent)}}.bg-muted{background-color:var(--color-muted)}.bg-node-pattern{background-color:var(--color-node-pattern)}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500) 20%,transparent)}}.bg-recall{background-color:var(--color-recall)}.bg-recall\/10{background-color:#10b9811a}@supports (color:color-mix(in lab,red,red)){.bg-recall\/10{background-color:color-mix(in oklab,var(--color-recall) 10%,transparent)}}.bg-recall\/15{background-color:#10b98126}@supports (color:color-mix(in lab,red,red)){.bg-recall\/15{background-color:color-mix(in oklab,var(--color-recall) 15%,transparent)}}.bg-recall\/20{background-color:#10b98133}@supports (color:color-mix(in lab,red,red)){.bg-recall\/20{background-color:color-mix(in oklab,var(--color-recall) 20%,transparent)}}.bg-synapse{background-color:var(--color-synapse)}.bg-synapse-glow{background-color:var(--color-synapse-glow)}.bg-synapse\/10{background-color:#6366f11a}@supports (color:color-mix(in lab,red,red)){.bg-synapse\/10{background-color:color-mix(in oklab,var(--color-synapse) 10%,transparent)}}.bg-synapse\/15{background-color:#6366f126}@supports (color:color-mix(in lab,red,red)){.bg-synapse\/15{background-color:color-mix(in oklab,var(--color-synapse) 15%,transparent)}}.bg-synapse\/20{background-color:#6366f133}@supports (color:color-mix(in lab,red,red)){.bg-synapse\/20{background-color:color-mix(in oklab,var(--color-synapse) 20%,transparent)}}.bg-synapse\/25{background-color:#6366f140}@supports (color:color-mix(in lab,red,red)){.bg-synapse\/25{background-color:color-mix(in oklab,var(--color-synapse) 25%,transparent)}}.bg-synapse\/70{background-color:#6366f1b3}@supports (color:color-mix(in lab,red,red)){.bg-synapse\/70{background-color:color-mix(in oklab,var(--color-synapse) 70%,transparent)}}.bg-transparent{background-color:#0000}.bg-void{background-color:var(--color-void)}.bg-void\/60{background-color:#05051099}@supports (color:color-mix(in lab,red,red)){.bg-void\/60{background-color:color-mix(in oklab,var(--color-void) 60%,transparent)}}.bg-warning{background-color:var(--color-warning)}.bg-warning\/5{background-color:#f59e0b0d}@supports (color:color-mix(in lab,red,red)){.bg-warning\/5{background-color:color-mix(in oklab,var(--color-warning) 5%,transparent)}}.bg-warning\/20{background-color:#f59e0b33}@supports (color:color-mix(in lab,red,red)){.bg-warning\/20{background-color:color-mix(in oklab,var(--color-warning) 20%,transparent)}}.bg-white\/\[0\.02\]{background-color:#ffffff05}@supports (color:color-mix(in lab,red,red)){.bg-white\/\[0\.02\]{background-color:color-mix(in oklab,var(--color-white) 2%,transparent)}}.bg-white\/\[0\.03\]{background-color:#ffffff08}@supports (color:color-mix(in lab,red,red)){.bg-white\/\[0\.03\]{background-color:color-mix(in oklab,var(--color-white) 3%,transparent)}}.bg-white\/\[0\.04\]{background-color:#ffffff0a}@supports (color:color-mix(in lab,red,red)){.bg-white\/\[0\.04\]{background-color:color-mix(in oklab,var(--color-white) 4%,transparent)}}.bg-white\/\[0\.05\]{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/\[0\.05\]{background-color:color-mix(in oklab,var(--color-white) 5%,transparent)}}.bg-white\/\[0\.06\]{background-color:#ffffff0f}@supports (color:color-mix(in lab,red,red)){.bg-white\/\[0\.06\]{background-color:color-mix(in oklab,var(--color-white) 6%,transparent)}}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-dream{--tw-gradient-from:var(--color-dream);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-synapse{--tw-gradient-to:var(--color-synapse);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-0{padding:calc(var(--spacing) * 0)}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-10{padding:calc(var(--spacing) * 10)}.p-12{padding:calc(var(--spacing) * 12)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-14{padding-block:calc(var(--spacing) * 14)}.py-16{padding-block:calc(var(--spacing) * 16)}.py-20{padding-block:calc(var(--spacing) * 20)}.\[padding-top\:max\(0\.75rem\,env\(safe-area-inset-top\)\)\]{padding-top:max(.75rem,env(safe-area-inset-top))}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pt-8{padding-top:calc(var(--spacing) * 8)}.pt-\[10vh\]{padding-top:10vh}.\[padding-right\:max\(0\.75rem\,env\(safe-area-inset-right\)\)\]{padding-right:max(.75rem,env(safe-area-inset-right))}.pr-1{padding-right:calc(var(--spacing) * 1)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-4{padding-right:calc(var(--spacing) * 4)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-16{padding-bottom:calc(var(--spacing) * 16)}.\[padding-left\:max\(0\.75rem\,env\(safe-area-inset-left\)\)\]{padding-left:max(.75rem,env(safe-area-inset-left))}.pl-6{padding-left:calc(var(--spacing) * 6)}.pl-10{padding-left:calc(var(--spacing) * 10)}.pl-14{padding-left:calc(var(--spacing) * 14)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-bottom{vertical-align:bottom}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.text-6xl{font-size:var(--text-6xl);line-height:var(--tw-leading,var(--text-6xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.12em\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-\[0\.15em\]{--tw-tracking:.15em;letter-spacing:.15em}.tracking-\[0\.18em\]{--tw-tracking:.18em;letter-spacing:.18em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.text-balance{text-wrap:balance}.text-pretty{text-wrap:pretty}.text-wrap{text-wrap:wrap}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#E4C8FF\]{color:#e4c8ff}.text-amber-400{color:var(--color-amber-400)}.text-bright{color:var(--color-bright)}.text-decay{color:var(--color-decay)}.text-decay\/60{color:#ef444499}@supports (color:color-mix(in lab,red,red)){.text-decay\/60{color:color-mix(in oklab,var(--color-decay) 60%,transparent)}}.text-decay\/80{color:#ef4444cc}@supports (color:color-mix(in lab,red,red)){.text-decay\/80{color:color-mix(in oklab,var(--color-decay) 80%,transparent)}}.text-dim{color:var(--color-dim)}.text-dim\/70{color:#7a7aaab3}@supports (color:color-mix(in lab,red,red)){.text-dim\/70{color:color-mix(in oklab,var(--color-dim) 70%,transparent)}}.text-dream{color:var(--color-dream)}.text-dream-glow{color:var(--color-dream-glow)}.text-dream\/40{color:#a855f766}@supports (color:color-mix(in lab,red,red)){.text-dream\/40{color:color-mix(in oklab,var(--color-dream) 40%,transparent)}}.text-dream\/50{color:#a855f780}@supports (color:color-mix(in lab,red,red)){.text-dream\/50{color:color-mix(in oklab,var(--color-dream) 50%,transparent)}}.text-dream\/80{color:#a855f7cc}@supports (color:color-mix(in lab,red,red)){.text-dream\/80{color:color-mix(in oklab,var(--color-dream) 80%,transparent)}}.text-memory{color:var(--color-memory)}.text-muted{color:var(--color-muted)}.text-muted\/50{color:#4a4a7a80}@supports (color:color-mix(in lab,red,red)){.text-muted\/50{color:color-mix(in oklab,var(--color-muted) 50%,transparent)}}.text-muted\/60{color:#4a4a7a99}@supports (color:color-mix(in lab,red,red)){.text-muted\/60{color:color-mix(in oklab,var(--color-muted) 60%,transparent)}}.text-node-pattern{color:var(--color-node-pattern)}.text-purple-400{color:var(--color-purple-400)}.text-recall{color:var(--color-recall)}.text-subtle{color:var(--color-subtle)}.text-synapse{color:var(--color-synapse)}.text-synapse-glow{color:var(--color-synapse-glow)}.text-text{color:var(--color-text)}.text-text\/80{color:#e0e0ffcc}@supports (color:color-mix(in lab,red,red)){.text-text\/80{color:color-mix(in oklab,var(--color-text) 80%,transparent)}}.text-warning{color:var(--color-warning)}.text-warning\/60{color:#f59e0b99}@supports (color:color-mix(in lab,red,red)){.text-warning\/60{color:color-mix(in oklab,var(--color-warning) 60%,transparent)}}.text-warning\/70{color:#f59e0bb3}@supports (color:color-mix(in lab,red,red)){.text-warning\/70{color:color-mix(in oklab,var(--color-warning) 70%,transparent)}}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline-offset-4{text-underline-offset:4px}.accent-synapse{accent-color:var(--color-synapse)}.accent-synapse-glow{accent-color:var(--color-synapse-glow)}.opacity-20{opacity:.2}.opacity-30{opacity:.3}.opacity-35{opacity:.35}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow\!{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_10px_rgba\(239\,68\,68\,0\.7\)\]{--tw-shadow:0 0 10px var(--tw-shadow-color,#ef4444b3);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_12px_rgba\(99\,102\,241\,0\.15\)\]{--tw-shadow:0 0 12px var(--tw-shadow-color,#6366f126);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_12px_rgba\(99\,102\,241\,0\.18\)\]{--tw-shadow:0 0 12px var(--tw-shadow-color,#6366f12e);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_12px_rgba\(163\,63\,255\,0\.15\)\]{--tw-shadow:0 0 12px var(--tw-shadow-color,#a33fff26);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_16px_-4px_var\(--color-synapse-glow\)\]{--tw-shadow:0 0 16px -4px var(--tw-shadow-color,var(--color-synapse-glow));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_16px_rgba\(99\,102\,241\,0\.3\)\]{--tw-shadow:0 0 16px var(--tw-shadow-color,#6366f14d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_16px_rgba\(168\,85\,247\,0\.3\)\]{--tw-shadow:0 0 16px var(--tw-shadow-color,#a855f74d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-synapse\/10{--tw-shadow-color:#6366f11a}@supports (color:color-mix(in lab,red,red)){.shadow-synapse\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-synapse) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-synapse\/20{--tw-shadow-color:#6366f133}@supports (color:color-mix(in lab,red,red)){.shadow-synapse\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-synapse) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.ring-dream-glow{--tw-ring-color:var(--color-dream-glow)}.ring-dream\/60{--tw-ring-color:#a855f799}@supports (color:color-mix(in lab,red,red)){.ring-dream\/60{--tw-ring-color:color-mix(in oklab, var(--color-dream) 60%, transparent)}}.ring-recall\/30{--tw-ring-color:#10b9814d}@supports (color:color-mix(in lab,red,red)){.ring-recall\/30{--tw-ring-color:color-mix(in oklab, var(--color-recall) 30%, transparent)}}.ring-synapse\/60{--tw-ring-color:#6366f199}@supports (color:color-mix(in lab,red,red)){.ring-synapse\/60{--tw-ring-color:color-mix(in oklab, var(--color-synapse) 60%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a)) drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a) drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.duration-700{--tw-duration:.7s;transition-duration:.7s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.select-none{-webkit-user-select:none;user-select:none}@media(hover:hover){.group-hover\:scale-110:is(:where(.group):hover *){--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}}.placeholder\:text-muted::placeholder{color:var(--color-muted)}@media(hover:hover){.hover\:z-10:hover{z-index:10}.hover\:scale-110:hover{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:scale-\[1\.03\]:hover{scale:1.03}.hover\:rotate-180:hover{rotate:180deg}.hover\:\!border-synapse\/30:hover{border-color:#6366f14d!important}@supports (color:color-mix(in lab,red,red)){.hover\:\!border-synapse\/30:hover{border-color:color-mix(in oklab,var(--color-synapse) 30%,transparent)!important}}.hover\:border-synapse\/20:hover{border-color:#6366f133}@supports (color:color-mix(in lab,red,red)){.hover\:border-synapse\/20:hover{border-color:color-mix(in oklab,var(--color-synapse) 20%,transparent)}}.hover\:border-synapse\/30:hover{border-color:#6366f14d}@supports (color:color-mix(in lab,red,red)){.hover\:border-synapse\/30:hover{border-color:color-mix(in oklab,var(--color-synapse) 30%,transparent)}}.hover\:border-synapse\/50:hover{border-color:#6366f180}@supports (color:color-mix(in lab,red,red)){.hover\:border-synapse\/50:hover{border-color:color-mix(in oklab,var(--color-synapse) 50%,transparent)}}.hover\:bg-decay\/20:hover{background-color:#ef444433}@supports (color:color-mix(in lab,red,red)){.hover\:bg-decay\/20:hover{background-color:color-mix(in oklab,var(--color-decay) 20%,transparent)}}.hover\:bg-decay\/30:hover{background-color:#ef44444d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-decay\/30:hover{background-color:color-mix(in oklab,var(--color-decay) 30%,transparent)}}.hover\:bg-decay\/\[0\.06\]:hover{background-color:#ef44440f}@supports (color:color-mix(in lab,red,red)){.hover\:bg-decay\/\[0\.06\]:hover{background-color:color-mix(in oklab,var(--color-decay) 6%,transparent)}}.hover\:bg-dream\/20:hover{background-color:#a855f733}@supports (color:color-mix(in lab,red,red)){.hover\:bg-dream\/20:hover{background-color:color-mix(in oklab,var(--color-dream) 20%,transparent)}}.hover\:bg-dream\/30:hover{background-color:#a855f74d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-dream\/30:hover{background-color:color-mix(in oklab,var(--color-dream) 30%,transparent)}}.hover\:bg-purple-500\/30:hover{background-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/30:hover{background-color:color-mix(in oklab,var(--color-purple-500) 30%,transparent)}}.hover\:bg-recall\/30:hover{background-color:#10b9814d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-recall\/30:hover{background-color:color-mix(in oklab,var(--color-recall) 30%,transparent)}}.hover\:bg-synapse\/30:hover{background-color:#6366f14d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-synapse\/30:hover{background-color:color-mix(in oklab,var(--color-synapse) 30%,transparent)}}.hover\:bg-warning\/30:hover{background-color:#f59e0b4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-warning\/30:hover{background-color:color-mix(in oklab,var(--color-warning) 30%,transparent)}}.hover\:bg-white\/\[0\.02\]:hover{background-color:#ffffff05}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/\[0\.02\]:hover{background-color:color-mix(in oklab,var(--color-white) 2%,transparent)}}.hover\:bg-white\/\[0\.03\]:hover{background-color:#ffffff08}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/\[0\.03\]:hover{background-color:color-mix(in oklab,var(--color-white) 3%,transparent)}}.hover\:bg-white\/\[0\.04\]:hover{background-color:#ffffff0a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/\[0\.04\]:hover{background-color:color-mix(in oklab,var(--color-white) 4%,transparent)}}.hover\:bg-white\/\[0\.08\]:hover{background-color:#ffffff14}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/\[0\.08\]:hover{background-color:color-mix(in oklab,var(--color-white) 8%,transparent)}}.hover\:text-bright:hover{color:var(--color-bright)}.hover\:text-dim:hover{color:var(--color-dim)}.hover\:text-synapse-glow:hover{color:var(--color-synapse-glow)}.hover\:text-text:hover{color:var(--color-text)}.hover\:underline:hover{text-decoration-line:underline}}.focus\:\!border-synapse\/40:focus{border-color:#6366f166!important}@supports (color:color-mix(in lab,red,red)){.focus\:\!border-synapse\/40:focus{border-color:color-mix(in oklab,var(--color-synapse) 40%,transparent)!important}}.focus\:border-dream\/40:focus{border-color:#a855f766}@supports (color:color-mix(in lab,red,red)){.focus\:border-dream\/40:focus{border-color:color-mix(in oklab,var(--color-dream) 40%,transparent)}}.focus\:border-synapse\/40:focus{border-color:#6366f166}@supports (color:color-mix(in lab,red,red)){.focus\:border-synapse\/40:focus{border-color:color-mix(in oklab,var(--color-synapse) 40%,transparent)}}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-synapse-glow:focus{--tw-ring-color:var(--color-synapse-glow)}.focus\:ring-synapse\/15:focus{--tw-ring-color:#6366f126}@supports (color:color-mix(in lab,red,red)){.focus\:ring-synapse\/15:focus{--tw-ring-color:color-mix(in oklab, var(--color-synapse) 15%, transparent)}}.focus\:ring-synapse\/20:focus{--tw-ring-color:#6366f133}@supports (color:color-mix(in lab,red,red)){.focus\:ring-synapse\/20:focus{--tw-ring-color:color-mix(in oklab, var(--color-synapse) 20%, transparent)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-dream-glow\/60:focus-visible{--tw-ring-color:#c084fc99}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-dream-glow\/60:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-dream-glow) 60%, transparent)}}.focus-visible\:ring-recall\/60:focus-visible{--tw-ring-color:#10b98199}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-recall\/60:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-recall) 60%, transparent)}}.focus-visible\:ring-synapse\/60:focus-visible{--tw-ring-color:#6366f199}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-synapse\/60:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-synapse) 60%, transparent)}}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media(min-width:40rem){.sm\:top-4{top:calc(var(--spacing) * 4)}.sm\:right-4{right:calc(var(--spacing) * 4)}.sm\:left-4{left:calc(var(--spacing) * 4)}.sm\:ml-auto{margin-left:auto}.sm\:block{display:block}.sm\:inline-flex{display:inline-flex}.sm\:w-auto{width:auto}.sm\:max-w-md{max-width:var(--container-md)}.sm\:flex-1{flex:1}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:gap-3{gap:calc(var(--spacing) * 3)}.sm\:p-0{padding:calc(var(--spacing) * 0)}.sm\:\[padding-top\:0\]{padding-top:0}.sm\:\[padding-right\:0\]{padding-right:0}.sm\:\[padding-left\:0\]{padding-left:0}.sm\:text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}}@media(min-width:48rem){.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:inline-flex{display:inline-flex}.md\:min-w-\[340px\]{min-width:340px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:grid-cols-\[1fr_auto\]{grid-template-columns:1fr auto}.md\:grid-cols-\[280px_1fr\]{grid-template-columns:280px 1fr}.md\:flex-row{flex-direction:row}.md\:pt-\[15vh\]{padding-top:15vh}.md\:pb-0{padding-bottom:calc(var(--spacing) * 0)}}@media(min-width:64rem){.lg\:block{display:block}.lg\:inline-flex{display:inline-flex}.lg\:w-56{width:calc(var(--spacing) * 56)}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-\[1fr_280px\]{grid-template-columns:1fr 280px}.lg\:grid-cols-\[1fr_340px\]{grid-template-columns:1fr 340px}.lg\:grid-cols-\[1fr_360px\]{grid-template-columns:1fr 360px}.lg\:grid-cols-\[minmax\(0\,1fr\)_340px\]{grid-template-columns:minmax(0,1fr) 340px}}.\[\&\:\:-webkit-slider-thumb\]\:h-3::-webkit-slider-thumb{height:calc(var(--spacing) * 3)}.\[\&\:\:-webkit-slider-thumb\]\:w-3::-webkit-slider-thumb{width:calc(var(--spacing) * 3)}.\[\&\:\:-webkit-slider-thumb\]\:appearance-none::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:rounded-full::-webkit-slider-thumb{border-radius:3.40282e38px}.\[\&\:\:-webkit-slider-thumb\]\:bg-synapse-glow::-webkit-slider-thumb{background-color:var(--color-synapse-glow)}.\[\&\:\:-webkit-slider-thumb\]\:shadow-\[0_0_8px_rgba\(129\,140\,248\,0\.4\)\]::-webkit-slider-thumb{--tw-shadow:0 0 8px var(--tw-shadow-color,#818cf866);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}html{background:var(--color-void);color:var(--color-text);font-family:var(--font-mono)}@supports (color:oklch(0 0 0)){:root{--color-synapse:oklch(58.5% .222 277);--color-synapse-glow:oklch(68.5% .169 277);--color-dream:oklch(62.7% .265 304);--color-dream-glow:oklch(71.4% .203 305);--color-memory:oklch(62.3% .214 259);--color-recall:oklch(69.6% .17 162);--color-decay:oklch(63.7% .237 25);--color-warning:oklch(76.9% .188 70);--color-node-fact:oklch(62.3% .214 259);--color-node-concept:oklch(60.6% .25 292);--color-node-event:oklch(76.9% .188 70);--color-node-person:oklch(69.6% .17 162);--color-node-place:oklch(71.5% .143 215);--color-node-note:oklch(55.1% .027 264);--color-node-pattern:oklch(65.6% .241 354);--color-node-decision:oklch(63.7% .237 25)}}body{min-height:100vh;margin:0;overflow:hidden}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:var(--color-subtle);border-radius:3px}::-webkit-scrollbar-thumb:hover{background:var(--color-muted)}.glass{-webkit-backdrop-filter:blur(20px)saturate(180%);background:#16163873;border:1px solid #6366f114;box-shadow:inset 0 1px #ffffff08,0 4px 24px #0000004d}.glass-subtle{-webkit-backdrop-filter:blur(12px)saturate(150%);background:#10102a66;border:1px solid #6366f10f;box-shadow:inset 0 1px #ffffff05,0 2px 12px #0003}.glass-sidebar{-webkit-backdrop-filter:blur(24px)saturate(180%);background:#0a0a1a99;border-right:1px solid #6366f11a;box-shadow:inset -1px 0 #ffffff05,4px 0 24px #0000004d}.glass-panel{-webkit-backdrop-filter:blur(24px)saturate(180%);background:#0a0a1acc;border:1px solid #6366f11a;box-shadow:inset 0 1px #ffffff08,0 8px 32px #0006}.glow-synapse{box-shadow:0 0 20px #6366f14d,0 0 60px #6366f11a}.glow-dream{box-shadow:0 0 20px #a855f74d,0 0 60px #a855f71a}.glow-memory{box-shadow:0 0 20px #3b82f64d,0 0 60px #3b82f61a}@keyframes pulse-glow{0%,to{opacity:1}50%{opacity:.5}}.animate-pulse-glow{animation:2s ease-in-out infinite pulse-glow}@keyframes orb-float-1{0%,to{transform:translate(0)scale(1)}25%{transform:translate(60px,-40px)scale(1.1)}50%{transform:translate(-30px,-80px)scale(.95)}75%{transform:translate(-60px,-20px)scale(1.05)}}@keyframes orb-float-2{0%,to{transform:translate(0)scale(1)}25%{transform:translate(-50px,30px)scale(1.08)}50%{transform:translate(40px,60px)scale(.92)}75%{transform:translate(20px,-40px)scale(1.03)}}@keyframes orb-float-3{0%,to{transform:translate(0)scale(1)}25%{transform:translate(30px,50px)scale(1.05)}50%{transform:translate(-60px,20px)scale(.98)}75%{transform:translate(40px,-30px)scale(1.1)}}.ambient-orb{filter:blur(80px);pointer-events:none;z-index:0;opacity:.35;border-radius:50%;position:fixed}.ambient-orb-1{background:radial-gradient(circle,#a855f766,#0000 70%);width:400px;height:400px;animation:20s ease-in-out infinite orb-float-1;top:-10%;right:-5%}.ambient-orb-2{background:radial-gradient(circle,#6366f159,#0000 70%);width:350px;height:350px;animation:25s ease-in-out infinite orb-float-2;bottom:-15%;left:-5%}.ambient-orb-3{background:radial-gradient(circle,#f59e0b33,#0000 70%);width:300px;height:300px;animation:22s ease-in-out infinite orb-float-3;top:40%;left:40%}.nav-active-border{position:relative}.nav-active-border:before{content:"";background:linear-gradient(180deg,var(--color-synapse),var(--color-dream),var(--color-synapse));background-size:100% 200%;border-radius:1px;width:2px;animation:3s ease-in-out infinite gradient-shift;position:absolute;top:4px;bottom:4px;left:0}@keyframes gradient-shift{0%,to{background-position:0 0}50%{background-position:0 100%}}@keyframes float{0%,to{transform:translateY(0)translate(0)}25%{transform:translateY(-10px)translate(5px)}50%{transform:translateY(-5px)translate(-5px)}75%{transform:translateY(-15px)translate(3px)}}.retention-critical{color:var(--color-decay)}.retention-low{color:var(--color-warning)}.retention-good{color:var(--color-recall)}.retention-strong{color:var(--color-synapse)}@media not all and (prefers-reduced-motion:reduce){::view-transition-old(root){animation-duration:.18s;animation-timing-function:ease}::view-transition-new(root){animation-duration:.18s;animation-timing-function:ease}::view-transition-old(root){animation-name:vt-fade-out}::view-transition-new(root){animation-name:vt-fade-in}@keyframes vt-fade-out{0%{opacity:1}to{opacity:0}}@keyframes vt-fade-in{0%{opacity:0}to{opacity:1}}}@property --angle{syntax:"";inherits:false;initial-value:0deg}@property --shine{syntax:"";inherits:false;initial-value:0%}.reveal{opacity:0;transform:translateY(var(--reveal-y,16px));transition:opacity .55s cubic-bezier(.22,1,.36,1),transform .55s cubic-bezier(.22,1,.36,1);transition-delay:var(--reveal-delay,0s);will-change:opacity,transform}.reveal-in{opacity:1;transform:none}@media(prefers-reduced-motion:reduce){.reveal{opacity:1;transition:none;transform:none}}@media not all and (prefers-reduced-motion:reduce){.enter{transition:opacity .4s,transform .4s cubic-bezier(.22,1,.36,1)}@starting-style{.enter{opacity:0;transform:translateY(10px)}}}.live-border{isolation:isolate;position:relative}.live-border:before{content:"";border-radius:inherit;background:conic-gradient(from var(--angle),transparent 0%,var(--color-synapse) 18%,var(--color-dream) 33%,transparent 50%,transparent 100%);pointer-events:none;opacity:.6;z-index:-1;padding:1px;position:absolute;top:-1px;right:-1px;bottom:-1px;left:-1px;-webkit-mask-image:linear-gradient(#000 0 0),linear-gradient(#000 0 0);-webkit-mask-position:0 0,0 0;-webkit-mask-size:auto,auto;-webkit-mask-repeat:repeat,repeat;-webkit-mask-clip:content-box,border-box;-webkit-mask-origin:content-box,border-box;-webkit-mask-composite:xor;mask-composite:exclude;-webkit-mask-source-type:auto,auto;mask-mode:match-source,match-source}@media not all and (prefers-reduced-motion:reduce){.live-border:before{animation:6s linear infinite border-rotate}@keyframes border-rotate{to{--angle:360deg}}}.spotlight-surface{position:relative;overflow:hidden}.spotlight-surface:after{content:"";pointer-events:none;background:radial-gradient(340px circle at var(--spot-x,50%) var(--spot-y,50%),#818cf81f,transparent 60%);opacity:var(--spot-o,0);z-index:0;transition:opacity .3s;position:absolute;top:0;right:0;bottom:0;left:0}.tilt-glare{position:relative;overflow:hidden}.tilt-glare:after{content:"";pointer-events:none;background:radial-gradient(circle at var(--glare-x,50%) var(--glare-y,50%),#ffffff24,transparent 45%);opacity:var(--glare-o,0);transition:opacity .3s;position:absolute;top:0;right:0;bottom:0;left:0}.breathe{animation:3.2s ease-in-out infinite breathe}@keyframes breathe{0%,to{filter:drop-shadow(0 0 2px);opacity:.85;transform:scale(1)}50%{filter:drop-shadow(0 0 7px);opacity:1;transform:scale(1.18)}}@media(prefers-reduced-motion:reduce){.breathe{animation:none}}.ping-host{position:relative}.ping-host:before{content:"";opacity:.6;z-index:-1;background:currentColor;border-radius:50%;position:absolute;top:0;right:0;bottom:0;left:0}@media not all and (prefers-reduced-motion:reduce){.ping-host:before{animation:2.4s cubic-bezier(0,0,.2,1) infinite ping}@keyframes ping{0%{opacity:.5;transform:scale(1)}80%,to{opacity:0;transform:scale(2.6)}}}.shimmer{background:#ffffff08;position:relative;overflow:hidden}.shimmer:after{content:"";background:linear-gradient(90deg,#0000,#818cf81f,#0000);position:absolute;top:0;right:0;bottom:0;left:0;transform:translate(-100%)}@media not all and (prefers-reduced-motion:reduce){.shimmer:after{animation:1.6s ease-in-out infinite shimmer}@keyframes shimmer{to{transform:translate(100%)}}}.text-aurora{background:linear-gradient(100deg,var(--color-synapse-glow),var(--color-dream-glow),var(--color-recall),var(--color-synapse-glow));color:#0000;background-size:250% 100%;-webkit-background-clip:text;background-clip:text}@media not all and (prefers-reduced-motion:reduce){.text-aurora{animation:8s ease-in-out infinite aurora-drift}@keyframes aurora-drift{0%,to{background-position:0%}50%{background-position:100%}}}.lift{transition:transform .28s cubic-bezier(.34,1.56,.64,1),box-shadow .28s,border-color .28s}.lift:hover{transform:translateY(-3px);box-shadow:0 12px 32px #00000059,0 0 0 1px #6366f12e}@media(prefers-reduced-motion:reduce){.lift:hover{transform:none}}.tabular-nums{font-variant-numeric:tabular-nums;font-feature-settings:"tnum"}:where(button,a,input,select,[role=button],[tabindex]):focus-visible{outline:2px solid var(--color-synapse-glow);outline-offset:2px;border-radius:.4rem}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}.toast-layer.svelte-pry2ep{position:fixed;z-index:60;pointer-events:none;display:flex;flex-direction:column;gap:.5rem;right:1.25rem;bottom:1.25rem;max-width:22rem;width:calc(100vw - 2.5rem)}@media(max-width:768px){.toast-layer.svelte-pry2ep{right:.75rem;left:.75rem;bottom:auto;top:5.25rem;max-width:none;width:auto;align-items:stretch}}.toast-item.svelte-pry2ep{pointer-events:auto;position:relative;display:flex;gap:.75rem;align-items:stretch;text-align:left;font:inherit;color:inherit;background:#0c0e16b8;backdrop-filter:blur(14px) saturate(160%);-webkit-backdrop-filter:blur(14px) saturate(160%);border:1px solid rgba(255,255,255,.06);border-radius:.75rem;padding:.75rem .9rem .75rem .5rem;overflow:hidden;box-shadow:0 10px 40px -12px #000c,0 0 22px -6px var(--toast-color);cursor:pointer;animation:svelte-pry2ep-toast-in .32s cubic-bezier(.16,1,.3,1);transform-origin:right center;transition:transform .15s ease,box-shadow .15s ease}.toast-item.svelte-pry2ep:hover{transform:translateY(-1px) scale(1.015);box-shadow:0 14px 48px -12px #000000d9,0 0 32px -4px var(--toast-color)}.toast-item.svelte-pry2ep:focus-visible{outline:1px solid var(--toast-color);outline-offset:2px}.toast-accent.svelte-pry2ep{width:3px;border-radius:2px;background:var(--toast-color);box-shadow:0 0 10px var(--toast-color);flex-shrink:0}.toast-body.svelte-pry2ep{display:flex;flex-direction:column;gap:.15rem;flex:1;min-width:0}.toast-head.svelte-pry2ep{display:flex;align-items:center;gap:.5rem}.toast-icon.svelte-pry2ep{color:var(--toast-color);font-size:.95rem;text-shadow:0 0 8px var(--toast-color);line-height:1;width:1rem;display:inline-flex;justify-content:center}.toast-title.svelte-pry2ep{color:#f5f5fa;font-size:.82rem;font-weight:600;letter-spacing:.01em}.toast-sub.svelte-pry2ep{color:#b0b6c4;font-size:.74rem;line-height:1.35;padding-left:1.5rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.toast-progress.svelte-pry2ep{position:absolute;left:0;bottom:0;height:2px;width:100%;background:#ffffff0a}.toast-progress-fill.svelte-pry2ep{height:100%;background:var(--toast-color);opacity:.55;transform-origin:left center;animation:svelte-pry2ep-toast-progress var(--toast-dwell) linear forwards}.toast-item.svelte-pry2ep:hover .toast-progress-fill:where(.svelte-pry2ep),.toast-item.svelte-pry2ep:focus-visible .toast-progress-fill:where(.svelte-pry2ep){animation-play-state:paused}@keyframes svelte-pry2ep-toast-in{0%{opacity:0;transform:translate(24px) scale(.98)}to{opacity:1;transform:translate(0) scale(1)}}@media(max-width:768px){.toast-item.svelte-pry2ep{transform-origin:top center;animation:svelte-pry2ep-toast-in-mobile .3s cubic-bezier(.16,1,.3,1)}}@keyframes svelte-pry2ep-toast-in-mobile{0%{opacity:0;transform:translateY(-12px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes svelte-pry2ep-toast-progress{0%{transform:scaleX(1)}to{transform:scaleX(0)}}@media(prefers-reduced-motion:reduce){.toast-item.svelte-pry2ep{animation:none}.toast-progress-fill.svelte-pry2ep{animation:none;transform:scaleX(.5)}}.strip-item.svelte-1kk3799{display:inline-flex;align-items:center;gap:.4rem;padding:0 .75rem;white-space:nowrap;flex-shrink:0}.strip-divider.svelte-1kk3799{width:1px;height:14px;background:#6366f11f;flex-shrink:0}.ambient-strip.ambient-flash.svelte-1kk3799{background:linear-gradient(90deg,#ef444414,#ef444400 70%),#0006;border-bottom-color:#ef444459;transition:background .3s ease,border-color .3s ease}@keyframes svelte-1kk3799-ping-slow{0%{transform:scale(1);opacity:.8}80%,to{transform:scale(2);opacity:0}}.animate-ping-slow{animation:svelte-1kk3799-ping-slow 2.2s cubic-bezier(0,0,.2,1) infinite}@media(prefers-reduced-motion:reduce){.ambient-strip.svelte-1kk3799 .animate-ping,.ambient-strip.svelte-1kk3799 .animate-ping-slow,.ambient-strip.svelte-1kk3799 .animate-pulse{animation:none!important}}.verdict-bar.svelte-1j425e6{border-bottom:1px solid rgba(255,255,255,.06);background:#080912b8;backdrop-filter:blur(18px) saturate(160%);-webkit-backdrop-filter:blur(18px) saturate(160%);box-shadow:0 6px 24px #0000002e}.verdict-summary.svelte-1j425e6{width:100%;min-height:2.75rem;display:grid;grid-template-columns:auto auto minmax(0,1fr) auto;align-items:center;gap:.75rem;padding:.55rem 1rem;color:var(--color-text);text-align:left;font:inherit}.sr-only.svelte-1j425e6{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.label.svelte-1j425e6,.field-label.svelte-1j425e6,.appeal-row.svelte-1j425e6>span:where(.svelte-1j425e6){color:var(--color-dim);font-size:.68rem;text-transform:uppercase;letter-spacing:0}.levels.svelte-1j425e6{display:flex;align-items:center;gap:.25rem}.levels.svelte-1j425e6 span:where(.svelte-1j425e6){border:1px solid rgba(255,255,255,.08);border-radius:.35rem;padding:.18rem .38rem;color:var(--color-muted);font-size:.64rem;line-height:1}.levels.svelte-1j425e6 span.active:where(.svelte-1j425e6){color:var(--color-bright);border-color:var(--verdict-color);background:color-mix(in srgb,var(--verdict-color) 18%,transparent);box-shadow:0 0 14px color-mix(in srgb,var(--verdict-color) 28%,transparent)}.summary-text.svelte-1j425e6{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.78rem;color:var(--color-dim)}.when.svelte-1j425e6{color:var(--color-muted);font-size:.68rem}.receipt.svelte-1j425e6{margin:0 1rem .75rem;border:1px solid rgba(255,255,255,.08);border-radius:.5rem;background:#0a0a1ac7;padding:.85rem}.receipt-grid.svelte-1j425e6{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(10rem,.8fr) minmax(0,1.1fr) minmax(0,1.1fr);gap:.85rem}.receipt.svelte-1j425e6 p:where(.svelte-1j425e6),.receipt.svelte-1j425e6 li:where(.svelte-1j425e6){margin:.25rem 0 0;color:var(--color-text);font-size:.76rem;line-height:1.45;overflow-wrap:anywhere}.receipt.svelte-1j425e6 ul:where(.svelte-1j425e6){margin:.25rem 0 0;padding-left:1rem}.appeal-row.svelte-1j425e6{display:flex;align-items:center;gap:.4rem;margin-top:.85rem;flex-wrap:wrap}.appeal-row.svelte-1j425e6 button:where(.svelte-1j425e6),.appeal-row.svelte-1j425e6 p:where(.svelte-1j425e6){border:1px solid rgba(255,255,255,.1);border-radius:.4rem;padding:.35rem .6rem;color:var(--color-text);background:#ffffff0a;font-size:.72rem;margin:0}.appeal-row.svelte-1j425e6 button:where(.svelte-1j425e6):hover:not(:disabled),.verdict-summary.svelte-1j425e6:hover{background:#ffffff0d}.appeal-row.svelte-1j425e6 button:where(.svelte-1j425e6):disabled{opacity:.55;cursor:wait}.tone-pass.svelte-1j425e6,.tone-note.svelte-1j425e6{--verdict-color: #10b981}.tone-caution.svelte-1j425e6{--verdict-color: #f59e0b}.tone-veto.svelte-1j425e6{--verdict-color: #ef4444}.tone-appealed.svelte-1j425e6{--verdict-color: #818cf8}@media(max-width:900px){.verdict-summary.svelte-1j425e6{grid-template-columns:auto minmax(0,1fr) auto}.levels.svelte-1j425e6{grid-column:1 / -1;order:4;overflow-x:auto;padding-bottom:.1rem}.receipt-grid.svelte-1j425e6{grid-template-columns:1fr}}.theme-toggle.svelte-1cmi4dh{width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;padding:0;border-radius:8px;background:#6366f10f;border:1px solid rgba(99,102,241,.14);color:var(--color-text);cursor:pointer;transition:background .2s ease,border-color .2s ease,color .2s ease,transform .12s ease;-webkit-tap-highlight-color:transparent}.theme-toggle.svelte-1cmi4dh:hover{background:#6366f124;border-color:#6366f14d;color:var(--color-bright)}.theme-toggle.svelte-1cmi4dh:active{transform:scale(.94)}.theme-toggle.svelte-1cmi4dh:focus-visible{outline:1px solid var(--color-synapse);outline-offset:2px}.icon-wrap.svelte-1cmi4dh{position:relative;width:18px;height:18px;display:inline-block}.icon.svelte-1cmi4dh{position:absolute;top:0;right:0;bottom:0;left:0;width:18px;height:18px;opacity:0;transform:scale(.7) rotate(-30deg);transition:opacity .2s ease,transform .2s cubic-bezier(.16,1,.3,1);pointer-events:none}.icon.active.svelte-1cmi4dh{opacity:1;transform:scale(1) rotate(0)}.theme-toggle[data-mode=dark].svelte-1cmi4dh{color:var(--color-synapse-glow, #818cf8)}.theme-toggle[data-mode=light].svelte-1cmi4dh{color:var(--color-warning, #f59e0b)}.theme-toggle[data-mode=auto].svelte-1cmi4dh{color:var(--color-dream-glow, #c084fc)}@media(prefers-reduced-motion:reduce){.theme-toggle.svelte-1cmi4dh,.icon.svelte-1cmi4dh{transition:none}}.safe-bottom.svelte-12qhfyh{padding-bottom:env(safe-area-inset-bottom,0px)}.logo-mark.svelte-12qhfyh{transition:transform .3s cubic-bezier(.34,1.56,.64,1),box-shadow .3s ease}.logo-link.svelte-12qhfyh:hover .logo-mark:where(.svelte-12qhfyh){transform:rotate(-6deg) scale(1.08);box-shadow:0 0 0 1px #818cf866,0 0 22px #6366f180}.nav-link.text-synapse-glow.svelte-12qhfyh .nav-icon:where(.svelte-12qhfyh) svg,.nav-active-border.svelte-12qhfyh .nav-icon:where(.svelte-12qhfyh) svg{filter:drop-shadow(0 0 6px rgba(129,140,248,.55))} diff --git a/apps/dashboard/build/_app/immutable/assets/0.Cf27G70K.css.br b/apps/dashboard/build/_app/immutable/assets/0.Cf27G70K.css.br deleted file mode 100644 index bc588d0..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/0.Cf27G70K.css.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/0.Cf27G70K.css.gz b/apps/dashboard/build/_app/immutable/assets/0.Cf27G70K.css.gz deleted file mode 100644 index 30b4fce..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/0.Cf27G70K.css.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/0.IIz8MMYb.css b/apps/dashboard/build/_app/immutable/assets/0.IIz8MMYb.css new file mode 100644 index 0000000..73d4560 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/assets/0.IIz8MMYb.css @@ -0,0 +1 @@ +/*! tailwindcss v4.2.0 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:"JetBrains Mono", "Fira Code", "SF Mono", monospace;--color-amber-400:oklch(82.8% .189 84.429);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--text-5xl:3rem;--text-5xl--line-height:1;--text-6xl:3.75rem;--text-6xl--line-height:1;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--blur-md:12px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-void:#050510;--color-abyss:#0a0a1a;--color-deep:#10102a;--color-surface:#161638;--color-elevated:#1e1e4a;--color-subtle:#2a2a5e;--color-muted:#4a4a7a;--color-dim:#7a7aaa;--color-text:#e0e0ff;--color-bright:#fff;--color-synapse:#6366f1;--color-synapse-glow:#818cf8;--color-dream:#a855f7;--color-dream-glow:#c084fc;--color-memory:#3b82f6;--color-recall:#10b981;--color-decay:#ef4444;--color-warning:#f59e0b;--color-node-pattern:#ec4899}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.end\!{inset-inline-end:var(--spacing)!important}.top-0{top:calc(var(--spacing) * 0)}.top-0\.5{top:calc(var(--spacing) * .5)}.top-1{top:calc(var(--spacing) * 1)}.top-3{top:calc(var(--spacing) * 3)}.top-4{top:calc(var(--spacing) * 4)}.top-10{top:calc(var(--spacing) * 10)}.right-0{right:calc(var(--spacing) * 0)}.right-4{right:calc(var(--spacing) * 4)}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-4{bottom:calc(var(--spacing) * 4)}.-left-\[29px\]{left:-29px}.left-1\/2{left:50%}.left-4{left:calc(var(--spacing) * 4)}.left-6{left:calc(var(--spacing) * 6)}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[1\]{z-index:1}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mx-auto{margin-inline:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-\[-12px\]{margin-top:-12px}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-3{margin-left:calc(var(--spacing) * 3)}.ml-auto{margin-left:auto}.line-clamp-1{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-4{-webkit-line-clamp:4;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.table{display:table}.aspect-square{aspect-ratio:1}.h-0\.5{height:calc(var(--spacing) * .5)}.h-1{height:calc(var(--spacing) * 1)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.h-20{height:calc(var(--spacing) * 20)}.h-24{height:calc(var(--spacing) * 24)}.h-28{height:calc(var(--spacing) * 28)}.h-32{height:calc(var(--spacing) * 32)}.h-40{height:calc(var(--spacing) * 40)}.h-\[520px\]{height:520px}.h-\[560px\]{height:560px}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-72{max-height:calc(var(--spacing) * 72)}.max-h-96{max-height:calc(var(--spacing) * 96)}.max-h-\[620px\]{max-height:620px}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-40{min-height:calc(var(--spacing) * 40)}.min-h-\[240px\]{min-height:240px}.min-h-\[320px\]{min-height:320px}.min-h-\[520px\]{min-height:520px}.min-h-full{min-height:100%}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-32{width:calc(var(--spacing) * 32)}.w-96{width:calc(var(--spacing) * 96)}.w-\[3px\]{width:3px}.w-\[90\%\]{width:90%}.w-full{width:100%}.w-px{width:1px}.max-w-2xl{max-width:var(--container-2xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-20{max-width:calc(var(--spacing) * 20)}.max-w-\[220px\]{max-width:220px}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-xl{max-width:var(--container-xl)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-12{min-width:calc(var(--spacing) * 12)}.min-w-16{min-width:calc(var(--spacing) * 16)}.min-w-64{min-width:calc(var(--spacing) * 64)}.min-w-\[2rem\]{min-width:2rem}.min-w-\[3\.5rem\]{min-width:3.5rem}.flex-1{flex:1}.flex-shrink{flex-shrink:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.border-separate{border-collapse:separate}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.scale-125{--tw-scale-x:125%;--tw-scale-y:125%;--tw-scale-z:125%;scale:var(--tw-scale-x) var(--tw-scale-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-\[fadeSlide_0\.35s_ease-out_both\]{animation:.35s ease-out both fadeSlide}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-around{justify-content:space-around}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-0{gap:calc(var(--spacing) * 0)}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-\[2px\]{gap:2px}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-y-1{row-gap:calc(var(--spacing) * 1)}.self-center{align-self:center}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.\!border-decay\/20{border-color:#ef444433!important}@supports (color:color-mix(in lab,red,red)){.\!border-decay\/20{border-color:color-mix(in oklab,var(--color-decay) 20%,transparent)!important}}.\!border-decay\/30{border-color:#ef44444d!important}@supports (color:color-mix(in lab,red,red)){.\!border-decay\/30{border-color:color-mix(in oklab,var(--color-decay) 30%,transparent)!important}}.\!border-decay\/40{border-color:#ef444466!important}@supports (color:color-mix(in lab,red,red)){.\!border-decay\/40{border-color:color-mix(in oklab,var(--color-decay) 40%,transparent)!important}}.\!border-dream\/20{border-color:#a855f733!important}@supports (color:color-mix(in lab,red,red)){.\!border-dream\/20{border-color:color-mix(in oklab,var(--color-dream) 20%,transparent)!important}}.\!border-synapse\/15{border-color:#6366f126!important}@supports (color:color-mix(in lab,red,red)){.\!border-synapse\/15{border-color:color-mix(in oklab,var(--color-synapse) 15%,transparent)!important}}.\!border-synapse\/20{border-color:#6366f133!important}@supports (color:color-mix(in lab,red,red)){.\!border-synapse\/20{border-color:color-mix(in oklab,var(--color-synapse) 20%,transparent)!important}}.\!border-synapse\/25{border-color:#6366f140!important}@supports (color:color-mix(in lab,red,red)){.\!border-synapse\/25{border-color:color-mix(in oklab,var(--color-synapse) 25%,transparent)!important}}.\!border-synapse\/30{border-color:#6366f14d!important}@supports (color:color-mix(in lab,red,red)){.\!border-synapse\/30{border-color:color-mix(in oklab,var(--color-synapse) 30%,transparent)!important}}.\!border-synapse\/40{border-color:#6366f166!important}@supports (color:color-mix(in lab,red,red)){.\!border-synapse\/40{border-color:color-mix(in oklab,var(--color-synapse) 40%,transparent)!important}}.border-\[\#A33FFF\]\/40{border-color:#a33fff66}.border-decay\/20{border-color:#ef444433}@supports (color:color-mix(in lab,red,red)){.border-decay\/20{border-color:color-mix(in oklab,var(--color-decay) 20%,transparent)}}.border-dream-glow\/40{border-color:#c084fc66}@supports (color:color-mix(in lab,red,red)){.border-dream-glow\/40{border-color:color-mix(in oklab,var(--color-dream-glow) 40%,transparent)}}.border-dream\/10{border-color:#a855f71a}@supports (color:color-mix(in lab,red,red)){.border-dream\/10{border-color:color-mix(in oklab,var(--color-dream) 10%,transparent)}}.border-dream\/20{border-color:#a855f733}@supports (color:color-mix(in lab,red,red)){.border-dream\/20{border-color:color-mix(in oklab,var(--color-dream) 20%,transparent)}}.border-dream\/30{border-color:#a855f74d}@supports (color:color-mix(in lab,red,red)){.border-dream\/30{border-color:color-mix(in oklab,var(--color-dream) 30%,transparent)}}.border-dream\/40{border-color:#a855f766}@supports (color:color-mix(in lab,red,red)){.border-dream\/40{border-color:color-mix(in oklab,var(--color-dream) 40%,transparent)}}.border-dream\/50{border-color:#a855f780}@supports (color:color-mix(in lab,red,red)){.border-dream\/50{border-color:color-mix(in oklab,var(--color-dream) 50%,transparent)}}.border-recall\/30{border-color:#10b9814d}@supports (color:color-mix(in lab,red,red)){.border-recall\/30{border-color:color-mix(in oklab,var(--color-recall) 30%,transparent)}}.border-recall\/40{border-color:#10b98166}@supports (color:color-mix(in lab,red,red)){.border-recall\/40{border-color:color-mix(in oklab,var(--color-recall) 40%,transparent)}}.border-subtle\/15{border-color:#2a2a5e26}@supports (color:color-mix(in lab,red,red)){.border-subtle\/15{border-color:color-mix(in oklab,var(--color-subtle) 15%,transparent)}}.border-subtle\/20{border-color:#2a2a5e33}@supports (color:color-mix(in lab,red,red)){.border-subtle\/20{border-color:color-mix(in oklab,var(--color-subtle) 20%,transparent)}}.border-subtle\/30{border-color:#2a2a5e4d}@supports (color:color-mix(in lab,red,red)){.border-subtle\/30{border-color:color-mix(in oklab,var(--color-subtle) 30%,transparent)}}.border-synapse{border-color:var(--color-synapse)}.border-synapse\/5{border-color:#6366f10d}@supports (color:color-mix(in lab,red,red)){.border-synapse\/5{border-color:color-mix(in oklab,var(--color-synapse) 5%,transparent)}}.border-synapse\/10{border-color:#6366f11a}@supports (color:color-mix(in lab,red,red)){.border-synapse\/10{border-color:color-mix(in oklab,var(--color-synapse) 10%,transparent)}}.border-synapse\/15{border-color:#6366f126}@supports (color:color-mix(in lab,red,red)){.border-synapse\/15{border-color:color-mix(in oklab,var(--color-synapse) 15%,transparent)}}.border-synapse\/20{border-color:#6366f133}@supports (color:color-mix(in lab,red,red)){.border-synapse\/20{border-color:color-mix(in oklab,var(--color-synapse) 20%,transparent)}}.border-synapse\/30{border-color:#6366f14d}@supports (color:color-mix(in lab,red,red)){.border-synapse\/30{border-color:color-mix(in oklab,var(--color-synapse) 30%,transparent)}}.border-synapse\/40{border-color:#6366f166}@supports (color:color-mix(in lab,red,red)){.border-synapse\/40{border-color:color-mix(in oklab,var(--color-synapse) 40%,transparent)}}.border-transparent{border-color:#0000}.border-warning\/30{border-color:#f59e0b4d}@supports (color:color-mix(in lab,red,red)){.border-warning\/30{border-color:color-mix(in oklab,var(--color-warning) 30%,transparent)}}.border-warning\/40{border-color:#f59e0b66}@supports (color:color-mix(in lab,red,red)){.border-warning\/40{border-color:color-mix(in oklab,var(--color-warning) 40%,transparent)}}.border-warning\/50{border-color:#f59e0b80}@supports (color:color-mix(in lab,red,red)){.border-warning\/50{border-color:color-mix(in oklab,var(--color-warning) 50%,transparent)}}.border-white\/5{border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.border-white\/5{border-color:color-mix(in oklab,var(--color-white) 5%,transparent)}}.border-t-dream{border-top-color:var(--color-dream)}.border-t-synapse{border-top-color:var(--color-synapse)}.border-t-warning{border-top-color:var(--color-warning)}.bg-\[\#A33FFF\]{background-color:#a33fff}.bg-\[\#A33FFF\]\/10{background-color:#a33fff1a}.bg-amber-400{background-color:var(--color-amber-400)}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black) 40%,transparent)}}.bg-decay{background-color:var(--color-decay)}.bg-decay\/10{background-color:#ef44441a}@supports (color:color-mix(in lab,red,red)){.bg-decay\/10{background-color:color-mix(in oklab,var(--color-decay) 10%,transparent)}}.bg-decay\/20{background-color:#ef444433}@supports (color:color-mix(in lab,red,red)){.bg-decay\/20{background-color:color-mix(in oklab,var(--color-decay) 20%,transparent)}}.bg-decay\/\[0\.05\]{background-color:#ef44440d}@supports (color:color-mix(in lab,red,red)){.bg-decay\/\[0\.05\]{background-color:color-mix(in oklab,var(--color-decay) 5%,transparent)}}.bg-deep{background-color:var(--color-deep)}.bg-deep\/40{background-color:#10102a66}@supports (color:color-mix(in lab,red,red)){.bg-deep\/40{background-color:color-mix(in oklab,var(--color-deep) 40%,transparent)}}.bg-deep\/60{background-color:#10102a99}@supports (color:color-mix(in lab,red,red)){.bg-deep\/60{background-color:color-mix(in oklab,var(--color-deep) 60%,transparent)}}.bg-dream{background-color:var(--color-dream)}.bg-dream\/5{background-color:#a855f70d}@supports (color:color-mix(in lab,red,red)){.bg-dream\/5{background-color:color-mix(in oklab,var(--color-dream) 5%,transparent)}}.bg-dream\/10{background-color:#a855f71a}@supports (color:color-mix(in lab,red,red)){.bg-dream\/10{background-color:color-mix(in oklab,var(--color-dream) 10%,transparent)}}.bg-dream\/15{background-color:#a855f726}@supports (color:color-mix(in lab,red,red)){.bg-dream\/15{background-color:color-mix(in oklab,var(--color-dream) 15%,transparent)}}.bg-dream\/20{background-color:#a855f733}@supports (color:color-mix(in lab,red,red)){.bg-dream\/20{background-color:color-mix(in oklab,var(--color-dream) 20%,transparent)}}.bg-muted{background-color:var(--color-muted)}.bg-node-pattern{background-color:var(--color-node-pattern)}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500) 20%,transparent)}}.bg-recall{background-color:var(--color-recall)}.bg-recall\/10{background-color:#10b9811a}@supports (color:color-mix(in lab,red,red)){.bg-recall\/10{background-color:color-mix(in oklab,var(--color-recall) 10%,transparent)}}.bg-recall\/15{background-color:#10b98126}@supports (color:color-mix(in lab,red,red)){.bg-recall\/15{background-color:color-mix(in oklab,var(--color-recall) 15%,transparent)}}.bg-recall\/20{background-color:#10b98133}@supports (color:color-mix(in lab,red,red)){.bg-recall\/20{background-color:color-mix(in oklab,var(--color-recall) 20%,transparent)}}.bg-synapse{background-color:var(--color-synapse)}.bg-synapse-glow{background-color:var(--color-synapse-glow)}.bg-synapse\/10{background-color:#6366f11a}@supports (color:color-mix(in lab,red,red)){.bg-synapse\/10{background-color:color-mix(in oklab,var(--color-synapse) 10%,transparent)}}.bg-synapse\/15{background-color:#6366f126}@supports (color:color-mix(in lab,red,red)){.bg-synapse\/15{background-color:color-mix(in oklab,var(--color-synapse) 15%,transparent)}}.bg-synapse\/20{background-color:#6366f133}@supports (color:color-mix(in lab,red,red)){.bg-synapse\/20{background-color:color-mix(in oklab,var(--color-synapse) 20%,transparent)}}.bg-synapse\/25{background-color:#6366f140}@supports (color:color-mix(in lab,red,red)){.bg-synapse\/25{background-color:color-mix(in oklab,var(--color-synapse) 25%,transparent)}}.bg-synapse\/70{background-color:#6366f1b3}@supports (color:color-mix(in lab,red,red)){.bg-synapse\/70{background-color:color-mix(in oklab,var(--color-synapse) 70%,transparent)}}.bg-transparent{background-color:#0000}.bg-void{background-color:var(--color-void)}.bg-void\/60{background-color:#05051099}@supports (color:color-mix(in lab,red,red)){.bg-void\/60{background-color:color-mix(in oklab,var(--color-void) 60%,transparent)}}.bg-warning{background-color:var(--color-warning)}.bg-warning\/5{background-color:#f59e0b0d}@supports (color:color-mix(in lab,red,red)){.bg-warning\/5{background-color:color-mix(in oklab,var(--color-warning) 5%,transparent)}}.bg-warning\/20{background-color:#f59e0b33}@supports (color:color-mix(in lab,red,red)){.bg-warning\/20{background-color:color-mix(in oklab,var(--color-warning) 20%,transparent)}}.bg-white\/\[0\.02\]{background-color:#ffffff05}@supports (color:color-mix(in lab,red,red)){.bg-white\/\[0\.02\]{background-color:color-mix(in oklab,var(--color-white) 2%,transparent)}}.bg-white\/\[0\.03\]{background-color:#ffffff08}@supports (color:color-mix(in lab,red,red)){.bg-white\/\[0\.03\]{background-color:color-mix(in oklab,var(--color-white) 3%,transparent)}}.bg-white\/\[0\.04\]{background-color:#ffffff0a}@supports (color:color-mix(in lab,red,red)){.bg-white\/\[0\.04\]{background-color:color-mix(in oklab,var(--color-white) 4%,transparent)}}.bg-white\/\[0\.06\]{background-color:#ffffff0f}@supports (color:color-mix(in lab,red,red)){.bg-white\/\[0\.06\]{background-color:color-mix(in oklab,var(--color-white) 6%,transparent)}}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-dream{--tw-gradient-from:var(--color-dream);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-synapse{--tw-gradient-to:var(--color-synapse);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-0{padding:calc(var(--spacing) * 0)}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-10{padding:calc(var(--spacing) * 10)}.p-12{padding:calc(var(--spacing) * 12)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-20{padding-block:calc(var(--spacing) * 20)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pt-8{padding-top:calc(var(--spacing) * 8)}.pt-\[10vh\]{padding-top:10vh}.pr-1{padding-right:calc(var(--spacing) * 1)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-16{padding-bottom:calc(var(--spacing) * 16)}.pl-6{padding-left:calc(var(--spacing) * 6)}.pl-14{padding-left:calc(var(--spacing) * 14)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-bottom{vertical-align:bottom}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.text-6xl{font-size:var(--text-6xl);line-height:var(--tw-leading,var(--text-6xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.12em\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-\[0\.15em\]{--tw-tracking:.15em;letter-spacing:.15em}.tracking-\[0\.18em\]{--tw-tracking:.18em;letter-spacing:.18em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#E4C8FF\]{color:#e4c8ff}.text-amber-400{color:var(--color-amber-400)}.text-bright{color:var(--color-bright)}.text-decay{color:var(--color-decay)}.text-decay\/60{color:#ef444499}@supports (color:color-mix(in lab,red,red)){.text-decay\/60{color:color-mix(in oklab,var(--color-decay) 60%,transparent)}}.text-dim{color:var(--color-dim)}.text-dream{color:var(--color-dream)}.text-dream-glow{color:var(--color-dream-glow)}.text-dream\/40{color:#a855f766}@supports (color:color-mix(in lab,red,red)){.text-dream\/40{color:color-mix(in oklab,var(--color-dream) 40%,transparent)}}.text-dream\/80{color:#a855f7cc}@supports (color:color-mix(in lab,red,red)){.text-dream\/80{color:color-mix(in oklab,var(--color-dream) 80%,transparent)}}.text-memory{color:var(--color-memory)}.text-muted{color:var(--color-muted)}.text-muted\/50{color:#4a4a7a80}@supports (color:color-mix(in lab,red,red)){.text-muted\/50{color:color-mix(in oklab,var(--color-muted) 50%,transparent)}}.text-muted\/60{color:#4a4a7a99}@supports (color:color-mix(in lab,red,red)){.text-muted\/60{color:color-mix(in oklab,var(--color-muted) 60%,transparent)}}.text-node-pattern{color:var(--color-node-pattern)}.text-purple-400{color:var(--color-purple-400)}.text-recall{color:var(--color-recall)}.text-subtle{color:var(--color-subtle)}.text-synapse{color:var(--color-synapse)}.text-synapse-glow{color:var(--color-synapse-glow)}.text-text{color:var(--color-text)}.text-text\/80{color:#e0e0ffcc}@supports (color:color-mix(in lab,red,red)){.text-text\/80{color:color-mix(in oklab,var(--color-text) 80%,transparent)}}.text-warning{color:var(--color-warning)}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline-offset-4{text-underline-offset:4px}.accent-synapse{accent-color:var(--color-synapse)}.accent-synapse-glow{accent-color:var(--color-synapse-glow)}.opacity-20{opacity:.2}.opacity-30{opacity:.3}.opacity-35{opacity:.35}.opacity-40{opacity:.4}.opacity-60{opacity:.6}.opacity-75{opacity:.75}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow\!{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_10px_rgba\(239\,68\,68\,0\.7\)\]{--tw-shadow:0 0 10px var(--tw-shadow-color,#ef4444b3);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_12px_rgba\(99\,102\,241\,0\.15\)\]{--tw-shadow:0 0 12px var(--tw-shadow-color,#6366f126);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_12px_rgba\(99\,102\,241\,0\.18\)\]{--tw-shadow:0 0 12px var(--tw-shadow-color,#6366f12e);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_12px_rgba\(163\,63\,255\,0\.15\)\]{--tw-shadow:0 0 12px var(--tw-shadow-color,#a33fff26);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_16px_rgba\(99\,102\,241\,0\.3\)\]{--tw-shadow:0 0 16px var(--tw-shadow-color,#6366f14d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_16px_rgba\(168\,85\,247\,0\.3\)\]{--tw-shadow:0 0 16px var(--tw-shadow-color,#a855f74d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-synapse\/10{--tw-shadow-color:#6366f11a}@supports (color:color-mix(in lab,red,red)){.shadow-synapse\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-synapse) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-synapse\/20{--tw-shadow-color:#6366f133}@supports (color:color-mix(in lab,red,red)){.shadow-synapse\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-synapse) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.ring-dream-glow{--tw-ring-color:var(--color-dream-glow)}.ring-dream\/60{--tw-ring-color:#a855f799}@supports (color:color-mix(in lab,red,red)){.ring-dream\/60{--tw-ring-color:color-mix(in oklab, var(--color-dream) 60%, transparent)}}.ring-recall\/30{--tw-ring-color:#10b9814d}@supports (color:color-mix(in lab,red,red)){.ring-recall\/30{--tw-ring-color:color-mix(in oklab, var(--color-recall) 30%, transparent)}}.ring-synapse\/60{--tw-ring-color:#6366f199}@supports (color:color-mix(in lab,red,red)){.ring-synapse\/60{--tw-ring-color:color-mix(in oklab, var(--color-synapse) 60%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.duration-700{--tw-duration:.7s;transition-duration:.7s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.select-none{-webkit-user-select:none;user-select:none}.placeholder\:text-muted::placeholder{color:var(--color-muted)}@media(hover:hover){.hover\:z-10:hover{z-index:10}.hover\:scale-110:hover{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:scale-\[1\.03\]:hover{scale:1.03}.hover\:\!border-synapse\/30:hover{border-color:#6366f14d!important}@supports (color:color-mix(in lab,red,red)){.hover\:\!border-synapse\/30:hover{border-color:color-mix(in oklab,var(--color-synapse) 30%,transparent)!important}}.hover\:border-synapse\/20:hover{border-color:#6366f133}@supports (color:color-mix(in lab,red,red)){.hover\:border-synapse\/20:hover{border-color:color-mix(in oklab,var(--color-synapse) 20%,transparent)}}.hover\:border-synapse\/30:hover{border-color:#6366f14d}@supports (color:color-mix(in lab,red,red)){.hover\:border-synapse\/30:hover{border-color:color-mix(in oklab,var(--color-synapse) 30%,transparent)}}.hover\:border-synapse\/50:hover{border-color:#6366f180}@supports (color:color-mix(in lab,red,red)){.hover\:border-synapse\/50:hover{border-color:color-mix(in oklab,var(--color-synapse) 50%,transparent)}}.hover\:bg-decay\/20:hover{background-color:#ef444433}@supports (color:color-mix(in lab,red,red)){.hover\:bg-decay\/20:hover{background-color:color-mix(in oklab,var(--color-decay) 20%,transparent)}}.hover\:bg-decay\/30:hover{background-color:#ef44444d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-decay\/30:hover{background-color:color-mix(in oklab,var(--color-decay) 30%,transparent)}}.hover\:bg-dream\/20:hover{background-color:#a855f733}@supports (color:color-mix(in lab,red,red)){.hover\:bg-dream\/20:hover{background-color:color-mix(in oklab,var(--color-dream) 20%,transparent)}}.hover\:bg-dream\/30:hover{background-color:#a855f74d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-dream\/30:hover{background-color:color-mix(in oklab,var(--color-dream) 30%,transparent)}}.hover\:bg-purple-500\/30:hover{background-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/30:hover{background-color:color-mix(in oklab,var(--color-purple-500) 30%,transparent)}}.hover\:bg-recall\/30:hover{background-color:#10b9814d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-recall\/30:hover{background-color:color-mix(in oklab,var(--color-recall) 30%,transparent)}}.hover\:bg-synapse\/30:hover{background-color:#6366f14d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-synapse\/30:hover{background-color:color-mix(in oklab,var(--color-synapse) 30%,transparent)}}.hover\:bg-warning\/30:hover{background-color:#f59e0b4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-warning\/30:hover{background-color:color-mix(in oklab,var(--color-warning) 30%,transparent)}}.hover\:bg-white\/\[0\.02\]:hover{background-color:#ffffff05}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/\[0\.02\]:hover{background-color:color-mix(in oklab,var(--color-white) 2%,transparent)}}.hover\:bg-white\/\[0\.03\]:hover{background-color:#ffffff08}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/\[0\.03\]:hover{background-color:color-mix(in oklab,var(--color-white) 3%,transparent)}}.hover\:bg-white\/\[0\.04\]:hover{background-color:#ffffff0a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/\[0\.04\]:hover{background-color:color-mix(in oklab,var(--color-white) 4%,transparent)}}.hover\:bg-white\/\[0\.08\]:hover{background-color:#ffffff14}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/\[0\.08\]:hover{background-color:color-mix(in oklab,var(--color-white) 8%,transparent)}}.hover\:text-bright:hover{color:var(--color-bright)}.hover\:text-dim:hover{color:var(--color-dim)}.hover\:text-synapse-glow:hover{color:var(--color-synapse-glow)}.hover\:text-text:hover{color:var(--color-text)}.hover\:underline:hover{text-decoration-line:underline}}.focus\:\!border-synapse\/40:focus{border-color:#6366f166!important}@supports (color:color-mix(in lab,red,red)){.focus\:\!border-synapse\/40:focus{border-color:color-mix(in oklab,var(--color-synapse) 40%,transparent)!important}}.focus\:border-dream\/40:focus{border-color:#a855f766}@supports (color:color-mix(in lab,red,red)){.focus\:border-dream\/40:focus{border-color:color-mix(in oklab,var(--color-dream) 40%,transparent)}}.focus\:border-synapse\/40:focus{border-color:#6366f166}@supports (color:color-mix(in lab,red,red)){.focus\:border-synapse\/40:focus{border-color:color-mix(in oklab,var(--color-synapse) 40%,transparent)}}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-synapse-glow:focus{--tw-ring-color:var(--color-synapse-glow)}.focus\:ring-synapse\/20:focus{--tw-ring-color:#6366f133}@supports (color:color-mix(in lab,red,red)){.focus\:ring-synapse\/20:focus{--tw-ring-color:color-mix(in oklab, var(--color-synapse) 20%, transparent)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-dream-glow\/60:focus-visible{--tw-ring-color:#c084fc99}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-dream-glow\/60:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-dream-glow) 60%, transparent)}}.focus-visible\:ring-recall\/60:focus-visible{--tw-ring-color:#10b98199}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-recall\/60:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-recall) 60%, transparent)}}.focus-visible\:ring-synapse\/60:focus-visible{--tw-ring-color:#6366f199}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-synapse\/60:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-synapse) 60%, transparent)}}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media(min-width:40rem){.sm\:block{display:block}.sm\:inline-flex{display:inline-flex}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}}@media(min-width:48rem){.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:inline-flex{display:inline-flex}.md\:min-w-\[340px\]{min-width:340px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:grid-cols-\[1fr_auto\]{grid-template-columns:1fr auto}.md\:grid-cols-\[280px_1fr\]{grid-template-columns:280px 1fr}.md\:flex-row{flex-direction:row}.md\:pt-\[15vh\]{padding-top:15vh}.md\:pb-0{padding-bottom:calc(var(--spacing) * 0)}}@media(min-width:64rem){.lg\:block{display:block}.lg\:w-56{width:calc(var(--spacing) * 56)}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-\[1fr_280px\]{grid-template-columns:1fr 280px}.lg\:grid-cols-\[1fr_340px\]{grid-template-columns:1fr 340px}.lg\:grid-cols-\[1fr_360px\]{grid-template-columns:1fr 360px}.lg\:grid-cols-\[minmax\(0\,1fr\)_340px\]{grid-template-columns:minmax(0,1fr) 340px}}.\[\&\:\:-webkit-slider-thumb\]\:h-3::-webkit-slider-thumb{height:calc(var(--spacing) * 3)}.\[\&\:\:-webkit-slider-thumb\]\:w-3::-webkit-slider-thumb{width:calc(var(--spacing) * 3)}.\[\&\:\:-webkit-slider-thumb\]\:appearance-none::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-slider-thumb\]\:rounded-full::-webkit-slider-thumb{border-radius:3.40282e38px}.\[\&\:\:-webkit-slider-thumb\]\:bg-synapse-glow::-webkit-slider-thumb{background-color:var(--color-synapse-glow)}.\[\&\:\:-webkit-slider-thumb\]\:shadow-\[0_0_8px_rgba\(129\,140\,248\,0\.4\)\]::-webkit-slider-thumb{--tw-shadow:0 0 8px var(--tw-shadow-color,#818cf866);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}html{background:var(--color-void);color:var(--color-text);font-family:var(--font-mono)}body{min-height:100vh;margin:0;overflow:hidden}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:var(--color-subtle);border-radius:3px}::-webkit-scrollbar-thumb:hover{background:var(--color-muted)}.glass{-webkit-backdrop-filter:blur(20px)saturate(180%);background:#16163873;border:1px solid #6366f114;box-shadow:inset 0 1px #ffffff08,0 4px 24px #0000004d}.glass-subtle{-webkit-backdrop-filter:blur(12px)saturate(150%);background:#10102a66;border:1px solid #6366f10f;box-shadow:inset 0 1px #ffffff05,0 2px 12px #0003}.glass-sidebar{-webkit-backdrop-filter:blur(24px)saturate(180%);background:#0a0a1a99;border-right:1px solid #6366f11a;box-shadow:inset -1px 0 #ffffff05,4px 0 24px #0000004d}.glass-panel{-webkit-backdrop-filter:blur(24px)saturate(180%);background:#0a0a1acc;border:1px solid #6366f11a;box-shadow:inset 0 1px #ffffff08,0 8px 32px #0006}.glow-synapse{box-shadow:0 0 20px #6366f14d,0 0 60px #6366f11a}.glow-dream{box-shadow:0 0 20px #a855f74d,0 0 60px #a855f71a}.glow-memory{box-shadow:0 0 20px #3b82f64d,0 0 60px #3b82f61a}@keyframes pulse-glow{0%,to{opacity:1}50%{opacity:.5}}.animate-pulse-glow{animation:2s ease-in-out infinite pulse-glow}@keyframes orb-float-1{0%,to{transform:translate(0)scale(1)}25%{transform:translate(60px,-40px)scale(1.1)}50%{transform:translate(-30px,-80px)scale(.95)}75%{transform:translate(-60px,-20px)scale(1.05)}}@keyframes orb-float-2{0%,to{transform:translate(0)scale(1)}25%{transform:translate(-50px,30px)scale(1.08)}50%{transform:translate(40px,60px)scale(.92)}75%{transform:translate(20px,-40px)scale(1.03)}}@keyframes orb-float-3{0%,to{transform:translate(0)scale(1)}25%{transform:translate(30px,50px)scale(1.05)}50%{transform:translate(-60px,20px)scale(.98)}75%{transform:translate(40px,-30px)scale(1.1)}}.ambient-orb{filter:blur(80px);pointer-events:none;z-index:0;opacity:.35;border-radius:50%;position:fixed}.ambient-orb-1{background:radial-gradient(circle,#a855f766,#0000 70%);width:400px;height:400px;animation:20s ease-in-out infinite orb-float-1;top:-10%;right:-5%}.ambient-orb-2{background:radial-gradient(circle,#6366f159,#0000 70%);width:350px;height:350px;animation:25s ease-in-out infinite orb-float-2;bottom:-15%;left:-5%}.ambient-orb-3{background:radial-gradient(circle,#f59e0b33,#0000 70%);width:300px;height:300px;animation:22s ease-in-out infinite orb-float-3;top:40%;left:40%}.nav-active-border{position:relative}.nav-active-border:before{content:"";background:linear-gradient(180deg,var(--color-synapse),var(--color-dream),var(--color-synapse));background-size:100% 200%;border-radius:1px;width:2px;animation:3s ease-in-out infinite gradient-shift;position:absolute;top:4px;bottom:4px;left:0}@keyframes gradient-shift{0%,to{background-position:0 0}50%{background-position:0 100%}}@keyframes float{0%,to{transform:translateY(0)translate(0)}25%{transform:translateY(-10px)translate(5px)}50%{transform:translateY(-5px)translate(-5px)}75%{transform:translateY(-15px)translate(3px)}}.retention-critical{color:var(--color-decay)}.retention-low{color:var(--color-warning)}.retention-good{color:var(--color-recall)}.retention-strong{color:var(--color-synapse)}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}.toast-layer.svelte-pry2ep{position:fixed;z-index:60;pointer-events:none;display:flex;flex-direction:column;gap:.5rem;right:1.25rem;bottom:1.25rem;max-width:22rem;width:calc(100vw - 2.5rem)}@media(max-width:768px){.toast-layer.svelte-pry2ep{right:.75rem;left:.75rem;bottom:auto;top:.75rem;max-width:none;width:auto;align-items:stretch}}.toast-item.svelte-pry2ep{pointer-events:auto;position:relative;display:flex;gap:.75rem;align-items:stretch;text-align:left;font:inherit;color:inherit;background:#0c0e16b8;backdrop-filter:blur(14px) saturate(160%);-webkit-backdrop-filter:blur(14px) saturate(160%);border:1px solid rgba(255,255,255,.06);border-radius:.75rem;padding:.75rem .9rem .75rem .5rem;overflow:hidden;box-shadow:0 10px 40px -12px #000c,0 0 22px -6px var(--toast-color);cursor:pointer;animation:svelte-pry2ep-toast-in .32s cubic-bezier(.16,1,.3,1);transform-origin:right center;transition:transform .15s ease,box-shadow .15s ease}.toast-item.svelte-pry2ep:hover{transform:translateY(-1px) scale(1.015);box-shadow:0 14px 48px -12px #000000d9,0 0 32px -4px var(--toast-color)}.toast-item.svelte-pry2ep:focus-visible{outline:1px solid var(--toast-color);outline-offset:2px}.toast-accent.svelte-pry2ep{width:3px;border-radius:2px;background:var(--toast-color);box-shadow:0 0 10px var(--toast-color);flex-shrink:0}.toast-body.svelte-pry2ep{display:flex;flex-direction:column;gap:.15rem;flex:1;min-width:0}.toast-head.svelte-pry2ep{display:flex;align-items:center;gap:.5rem}.toast-icon.svelte-pry2ep{color:var(--toast-color);font-size:.95rem;text-shadow:0 0 8px var(--toast-color);line-height:1;width:1rem;display:inline-flex;justify-content:center}.toast-title.svelte-pry2ep{color:#f5f5fa;font-size:.82rem;font-weight:600;letter-spacing:.01em}.toast-sub.svelte-pry2ep{color:#b0b6c4;font-size:.74rem;line-height:1.35;padding-left:1.5rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.toast-progress.svelte-pry2ep{position:absolute;left:0;bottom:0;height:2px;width:100%;background:#ffffff0a}.toast-progress-fill.svelte-pry2ep{height:100%;background:var(--toast-color);opacity:.55;transform-origin:left center;animation:svelte-pry2ep-toast-progress var(--toast-dwell) linear forwards}.toast-item.svelte-pry2ep:hover .toast-progress-fill:where(.svelte-pry2ep),.toast-item.svelte-pry2ep:focus-visible .toast-progress-fill:where(.svelte-pry2ep){animation-play-state:paused}@keyframes svelte-pry2ep-toast-in{0%{opacity:0;transform:translate(24px) scale(.98)}to{opacity:1;transform:translate(0) scale(1)}}@media(max-width:768px){.toast-item.svelte-pry2ep{transform-origin:top center;animation:svelte-pry2ep-toast-in-mobile .3s cubic-bezier(.16,1,.3,1)}}@keyframes svelte-pry2ep-toast-in-mobile{0%{opacity:0;transform:translateY(-12px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes svelte-pry2ep-toast-progress{0%{transform:scaleX(1)}to{transform:scaleX(0)}}@media(prefers-reduced-motion:reduce){.toast-item.svelte-pry2ep{animation:none}.toast-progress-fill.svelte-pry2ep{animation:none;transform:scaleX(.5)}}.strip-item.svelte-1kk3799{display:inline-flex;align-items:center;gap:.4rem;padding:0 .75rem;white-space:nowrap;flex-shrink:0}.strip-divider.svelte-1kk3799{width:1px;height:14px;background:#6366f11f;flex-shrink:0}.ambient-strip.ambient-flash.svelte-1kk3799{background:linear-gradient(90deg,#ef444414,#ef444400 70%),#0006;border-bottom-color:#ef444459;transition:background .3s ease,border-color .3s ease}@keyframes svelte-1kk3799-ping-slow{0%{transform:scale(1);opacity:.8}80%,to{transform:scale(2);opacity:0}}.animate-ping-slow{animation:svelte-1kk3799-ping-slow 2.2s cubic-bezier(0,0,.2,1) infinite}@media(prefers-reduced-motion:reduce){.ambient-strip.svelte-1kk3799 .animate-ping,.ambient-strip.svelte-1kk3799 .animate-ping-slow,.ambient-strip.svelte-1kk3799 .animate-pulse{animation:none!important}}.theme-toggle.svelte-1cmi4dh{width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;padding:0;border-radius:8px;background:#6366f10f;border:1px solid rgba(99,102,241,.14);color:var(--color-text);cursor:pointer;transition:background .2s ease,border-color .2s ease,color .2s ease,transform .12s ease;-webkit-tap-highlight-color:transparent}.theme-toggle.svelte-1cmi4dh:hover{background:#6366f124;border-color:#6366f14d;color:var(--color-bright)}.theme-toggle.svelte-1cmi4dh:active{transform:scale(.94)}.theme-toggle.svelte-1cmi4dh:focus-visible{outline:1px solid var(--color-synapse);outline-offset:2px}.icon-wrap.svelte-1cmi4dh{position:relative;width:18px;height:18px;display:inline-block}.icon.svelte-1cmi4dh{position:absolute;top:0;right:0;bottom:0;left:0;width:18px;height:18px;opacity:0;transform:scale(.7) rotate(-30deg);transition:opacity .2s ease,transform .2s cubic-bezier(.16,1,.3,1);pointer-events:none}.icon.active.svelte-1cmi4dh{opacity:1;transform:scale(1) rotate(0)}.theme-toggle[data-mode=dark].svelte-1cmi4dh{color:var(--color-synapse-glow, #818cf8)}.theme-toggle[data-mode=light].svelte-1cmi4dh{color:var(--color-warning, #f59e0b)}.theme-toggle[data-mode=auto].svelte-1cmi4dh{color:var(--color-dream-glow, #c084fc)}@media(prefers-reduced-motion:reduce){.theme-toggle.svelte-1cmi4dh,.icon.svelte-1cmi4dh{transition:none}}.safe-bottom.svelte-12qhfyh{padding-bottom:env(safe-area-inset-bottom,0px)}@keyframes svelte-12qhfyh-page-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.animate-page-in.svelte-12qhfyh{animation:svelte-12qhfyh-page-in .2s ease-out} diff --git a/apps/dashboard/build/_app/immutable/assets/0.IIz8MMYb.css.br b/apps/dashboard/build/_app/immutable/assets/0.IIz8MMYb.css.br new file mode 100644 index 0000000..8739b09 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/assets/0.IIz8MMYb.css.br differ diff --git a/apps/dashboard/build/_app/immutable/assets/0.IIz8MMYb.css.gz b/apps/dashboard/build/_app/immutable/assets/0.IIz8MMYb.css.gz new file mode 100644 index 0000000..66bc820 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/assets/0.IIz8MMYb.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/assets/10.g4OzM5ih.css b/apps/dashboard/build/_app/immutable/assets/10.g4OzM5ih.css deleted file mode 100644 index 7804d0e..0000000 --- a/apps/dashboard/build/_app/immutable/assets/10.g4OzM5ih.css +++ /dev/null @@ -1 +0,0 @@ -@keyframes svelte-1n9p0vm-fade-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.animate-fade-in.svelte-1n9p0vm{animation:svelte-1n9p0vm-fade-in .3s ease-out}.live-status.svelte-1o4vd58{display:inline-flex;align-items:center;gap:.5rem;padding:.3rem .7rem;border-radius:999px;font-size:.75rem;font-weight:600;color:var(--color-recall, #34d399);background:color-mix(in srgb,var(--color-recall, #34d399) 12%,transparent);border:1px solid color-mix(in srgb,var(--color-recall, #34d399) 28%,transparent);white-space:nowrap}.live-status.idle.svelte-1o4vd58{color:var(--color-dim, #8b95a5);background:#ffffff0a;border-color:#ffffff14}.live-dot.svelte-1o4vd58{display:inline-block;flex-shrink:0}.count-chip.svelte-1o4vd58{display:inline-flex;align-items:baseline;gap:.35rem;padding:.3rem .7rem;border-radius:999px;font-size:.78rem;background:#ffffff08;border:1px solid rgba(255,255,255,.07)}.clear-btn.svelte-1o4vd58{display:inline-flex;align-items:center;gap:.3rem;padding:.3rem .65rem;border-radius:999px;font-size:.75rem;color:var(--color-muted, #6b7280);background:#ffffff05;border:1px solid rgba(255,255,255,.06);transition:color .2s ease,background .2s ease,border-color .2s ease}.clear-btn.svelte-1o4vd58:hover:not(:disabled){color:var(--color-text, #e5e7eb);background:#ffffff0d;border-color:#ffffff1f}.clear-btn.svelte-1o4vd58:disabled{opacity:.4;cursor:not-allowed}.event-row.svelte-1o4vd58{position:relative;transition:transform .28s cubic-bezier(.34,1.56,.64,1),box-shadow .28s ease,background .2s ease}.event-row.svelte-1o4vd58:hover{background:color-mix(in srgb,var(--evt) 7%,transparent)}.event-icon.svelte-1o4vd58{width:1.6rem;height:1.6rem;border-radius:.5rem}.empty-glyph.svelte-1o4vd58{display:inline-flex;align-items:center;justify-content:center;color:var(--color-synapse-glow, #818cf8);opacity:.85}@media not (prefers-reduced-motion:reduce){.empty-glyph.svelte-1o4vd58{animation:breathe 3.2s ease-in-out infinite}} diff --git a/apps/dashboard/build/_app/immutable/assets/10.g4OzM5ih.css.br b/apps/dashboard/build/_app/immutable/assets/10.g4OzM5ih.css.br deleted file mode 100644 index c189541..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/10.g4OzM5ih.css.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/10.g4OzM5ih.css.gz b/apps/dashboard/build/_app/immutable/assets/10.g4OzM5ih.css.gz deleted file mode 100644 index e80bd27..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/10.g4OzM5ih.css.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/11.BxoW8Jf1.css b/apps/dashboard/build/_app/immutable/assets/11.BxoW8Jf1.css deleted file mode 100644 index 79f5904..0000000 --- a/apps/dashboard/build/_app/immutable/assets/11.BxoW8Jf1.css +++ /dev/null @@ -1 +0,0 @@ -.cinema-overlay.svelte-1uwqs3k{position:fixed;top:0;right:0;bottom:0;left:0;z-index:200;background:radial-gradient(circle at 50% 40%,#05050f,#010108);display:flex;flex-direction:column}body.cinema-open .graph-stats-pill{display:none}.cinema-canvas.svelte-1uwqs3k{position:absolute;top:0;right:0;bottom:0;left:0;z-index:0}.cinema-top.svelte-1uwqs3k{position:relative;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:max(.75rem,env(safe-area-inset-top)) 1rem .75rem;flex-wrap:wrap}.cinema-badge.svelte-1uwqs3k{font-size:.65rem;padding:.1rem .45rem;border-radius:999px;border:1px solid rgba(129,140,248,.4);color:var(--color-synapse-glow)}.cinema-badge-gpu.svelte-1uwqs3k{border-color:#14e8c680;color:#14e8c6}.cinema-act.svelte-1uwqs3k{font-size:.6rem;letter-spacing:.12em;text-transform:uppercase;color:var(--color-dream-glow);opacity:.85}.cinema-plan-card.svelte-1uwqs3k{position:absolute;z-index:3;top:50%;left:50%;transform:translate(-50%,-50%);max-width:520px;padding:1.5rem 1.75rem;border-radius:16px;text-align:center;animation:svelte-1uwqs3k-cinema-plan-in .5s ease both}@keyframes svelte-1uwqs3k-cinema-plan-in{0%{opacity:0;transform:translate(-50%,-46%)}to{opacity:1;transform:translate(-50%,-50%)}}.cinema-plan-kicker.svelte-1uwqs3k{font-size:.65rem;letter-spacing:.18em;text-transform:uppercase;color:var(--color-synapse-glow);margin-bottom:.5rem}.cinema-plan-logline.svelte-1uwqs3k{font-size:clamp(1.05rem,2.2vw,1.4rem);line-height:1.5;color:var(--color-bright);margin:0}.cinema-note.svelte-1uwqs3k{font-size:.78rem;color:var(--color-synapse-glow);opacity:.85;margin:0 0 .6rem;font-style:italic}.cinema-dot.svelte-1uwqs3k{width:8px;height:8px;border-radius:50%;background:var(--color-muted)}.cinema-dot.active.svelte-1uwqs3k{background:#14e8c6;box-shadow:0 0 10px #14e8c6}.cinema-toggle.svelte-1uwqs3k{font-size:.7rem;color:var(--color-dim);display:flex;align-items:center;gap:.3rem;cursor:pointer}.cinema-close.svelte-1uwqs3k{background:transparent;border:1px solid rgba(255,255,255,.15);color:var(--color-text);border-radius:8px;width:32px;height:32px;cursor:pointer}.cinema-caption-wrap.svelte-1uwqs3k{position:relative;z-index:2;margin-top:auto;padding:1rem 1.25rem max(1.25rem,env(safe-area-inset-bottom));max-width:720px}.cinema-chip.svelte-1uwqs3k{display:inline-block;font-size:.65rem;text-transform:uppercase;letter-spacing:.08em;color:var(--color-dream-glow);margin-bottom:.35rem}.cinema-caption.svelte-1uwqs3k{font-size:clamp(1.05rem,2.4vw,1.6rem);line-height:1.45;color:var(--color-bright);text-shadow:0 2px 24px rgba(0,0,0,.9);min-height:2.6em;margin:0 0 .75rem}.cinema-progress.svelte-1uwqs3k{height:3px;background:#ffffff1a;border-radius:3px;overflow:hidden}.cinema-progress-fill.svelte-1uwqs3k{height:100%;background:linear-gradient(90deg,var(--color-synapse),color-mix(in oklch,var(--color-dream),#ff2d55 calc(var(--tension, 0) * 100%)));transition:width .2s linear,background .4s ease}.cinema-beatcount.svelte-1uwqs3k{margin-top:.4rem;display:flex;gap:.75rem;align-items:center}.cinema-replay.svelte-1uwqs3k{background:transparent;border:1px solid rgba(129,140,248,.4);color:var(--color-synapse-glow);border-radius:999px;padding:.15rem .7rem;cursor:pointer;font-size:.75rem}.cinema-dream.svelte-1uwqs3k{color:var(--color-dream-glow);letter-spacing:.08em;animation:svelte-1uwqs3k-cinema-dream-pulse 3s ease-in-out infinite}.cinema-restore.svelte-1uwqs3k{position:absolute;bottom:.6rem;right:.8rem;z-index:95;background:#0a0a1a80;border:1px solid rgba(129,140,248,.25);color:var(--color-muted);border-radius:999px;padding:.2rem .7rem;font-size:.7rem;letter-spacing:.04em;cursor:pointer;opacity:.4;transition:opacity .2s ease}.cinema-restore.svelte-1uwqs3k:hover{opacity:1}@keyframes svelte-1uwqs3k-cinema-dream-pulse{0%,to{opacity:.55}50%{opacity:1}}@media(prefers-reduced-motion:reduce){.cinema-progress-fill.svelte-1uwqs3k{transition:none}} diff --git a/apps/dashboard/build/_app/immutable/assets/11.BxoW8Jf1.css.br b/apps/dashboard/build/_app/immutable/assets/11.BxoW8Jf1.css.br deleted file mode 100644 index 9c07b61..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/11.BxoW8Jf1.css.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/11.BxoW8Jf1.css.gz b/apps/dashboard/build/_app/immutable/assets/11.BxoW8Jf1.css.gz deleted file mode 100644 index dfc3505..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/11.BxoW8Jf1.css.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/14.Bjd0S47S.css b/apps/dashboard/build/_app/immutable/assets/13.Bjd0S47S.css similarity index 100% rename from apps/dashboard/build/_app/immutable/assets/14.Bjd0S47S.css rename to apps/dashboard/build/_app/immutable/assets/13.Bjd0S47S.css diff --git a/apps/dashboard/build/_app/immutable/assets/14.Bjd0S47S.css.br b/apps/dashboard/build/_app/immutable/assets/13.Bjd0S47S.css.br similarity index 100% rename from apps/dashboard/build/_app/immutable/assets/14.Bjd0S47S.css.br rename to apps/dashboard/build/_app/immutable/assets/13.Bjd0S47S.css.br diff --git a/apps/dashboard/build/_app/immutable/assets/13.Bjd0S47S.css.gz b/apps/dashboard/build/_app/immutable/assets/13.Bjd0S47S.css.gz new file mode 100644 index 0000000..84a3745 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/assets/13.Bjd0S47S.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/assets/14.Bjd0S47S.css.gz b/apps/dashboard/build/_app/immutable/assets/14.Bjd0S47S.css.gz deleted file mode 100644 index 6ec156c..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/14.Bjd0S47S.css.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/15.BzuIe_Oj.css b/apps/dashboard/build/_app/immutable/assets/15.BzuIe_Oj.css deleted file mode 100644 index ceee09b..0000000 --- a/apps/dashboard/build/_app/immutable/assets/15.BzuIe_Oj.css +++ /dev/null @@ -1 +0,0 @@ -.pending-badge.svelte-c1wbiz{font-size:.8rem;font-weight:700;padding:5px 11px;border-radius:8px;color:var(--color-text-dim, #8b8ba7);border:1px solid color-mix(in oklab,white 10%,transparent)}.pending-badge.has.svelte-c1wbiz{color:#f59e0b;border-color:color-mix(in oklab,#f59e0b 40%,transparent);background:color-mix(in oklab,#f59e0b 10%,transparent)}.manifesto.svelte-c1wbiz{font-size:1.05rem;line-height:1.55;color:var(--color-text, #e2e2f0);padding:16px 20px;border-radius:12px;margin-bottom:16px;background:linear-gradient(100deg,color-mix(in oklab,var(--color-synapse) 14%,transparent),transparent 70%);border:1px solid color-mix(in oklab,var(--color-synapse) 20%,transparent)}.manifesto.svelte-c1wbiz strong:where(.svelte-c1wbiz){color:var(--color-synapse-glow, #818cf8)}.manifesto-note.svelte-c1wbiz{display:block;margin-top:8px;font-size:.82rem;line-height:1.5;color:var(--color-text-dim, #c0c0d8)}.manifesto-note.svelte-c1wbiz strong:where(.svelte-c1wbiz){color:#f59e0b}.glass.svelte-c1wbiz{background:color-mix(in oklab,var(--color-void, #050510) 55%,transparent);border:1px solid color-mix(in oklab,white 8%,transparent);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border-radius:14px}.modes.svelte-c1wbiz{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;padding:8px;margin-bottom:14px}@media(max-width:640px){.modes.svelte-c1wbiz{grid-template-columns:1fr}}.mode.svelte-c1wbiz{display:flex;flex-direction:column;gap:3px;padding:11px 14px;border-radius:10px;border:1px solid transparent;background:color-mix(in oklab,white 3%,transparent);cursor:pointer;text-align:left;transition:all .16s ease}.mode.svelte-c1wbiz:hover{background:color-mix(in oklab,var(--color-synapse) 10%,transparent)}.mode.on.svelte-c1wbiz{border-color:color-mix(in oklab,var(--color-synapse) 50%,transparent);background:color-mix(in oklab,var(--color-synapse) 18%,transparent)}.mode-label.svelte-c1wbiz{font-weight:700;font-size:.9rem}.mode-blurb.svelte-c1wbiz{font-size:.72rem;color:var(--color-text-dim, #8b8ba7);line-height:1.35}.filters.svelte-c1wbiz{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:14px}.filter.svelte-c1wbiz{font-size:.74rem;padding:5px 11px;border-radius:7px;border:1px solid color-mix(in oklab,white 8%,transparent);background:transparent;color:var(--color-text-dim, #8b8ba7);cursor:pointer;text-transform:capitalize;transition:all .16s ease}.filter.svelte-c1wbiz:hover{color:var(--color-text, #e2e2f0)}.filter.on.svelte-c1wbiz{color:var(--color-synapse-glow, #818cf8);border-color:color-mix(in oklab,var(--color-synapse) 45%,transparent);background:color-mix(in oklab,var(--color-synapse) 12%,transparent)}.layout.svelte-c1wbiz{display:grid;grid-template-columns:300px 1fr;gap:16px;align-items:start}@media(max-width:860px){.layout.svelte-c1wbiz{grid-template-columns:1fr}}.pr-list.svelte-c1wbiz{padding:12px;position:sticky;top:16px;max-height:calc(100vh - 40px);overflow-y:auto}.pr-list.svelte-c1wbiz ul:where(.svelte-c1wbiz){list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}.empty.svelte-c1wbiz{font-size:.82rem;color:var(--color-text-dim, #8b8ba7);line-height:1.5;padding:8px}.pr-row.svelte-c1wbiz{width:100%;text-align:left;padding:10px 12px;border-radius:10px;border:1px solid transparent;background:color-mix(in oklab,white 3%,transparent);cursor:pointer;transition:all .16s ease}.pr-row.svelte-c1wbiz:hover{background:color-mix(in oklab,var(--color-synapse) 10%,transparent)}.pr-row.active.svelte-c1wbiz{border-color:color-mix(in oklab,var(--color-synapse) 45%,transparent);background:color-mix(in oklab,var(--color-synapse) 15%,transparent)}.pr-row-top.svelte-c1wbiz{display:flex;justify-content:space-between;gap:8px;margin-bottom:5px}.pr-kind.svelte-c1wbiz{font-size:.66rem;font-weight:700;text-transform:uppercase;letter-spacing:.04em;padding:2px 7px;border-radius:5px;background:color-mix(in oklab,var(--color-synapse) 16%,transparent);color:var(--color-synapse-glow, #818cf8)}.kind-contradiction_detected.svelte-c1wbiz{background:color-mix(in oklab,#fb7185 16%,transparent);color:#fb7185}.kind-memory_superseded.svelte-c1wbiz{background:color-mix(in oklab,#38bdf8 16%,transparent);color:#38bdf8}.kind-dream_consolidation.svelte-c1wbiz{background:color-mix(in oklab,#c084fc 16%,transparent);color:#c084fc}.pr-status.svelte-c1wbiz{font-size:.64rem;text-transform:uppercase;letter-spacing:.05em;color:var(--color-text-dim, #8b8ba7);align-self:center}.st-pending.svelte-c1wbiz{color:#f59e0b}.st-promoted.svelte-c1wbiz{color:#10b981}.st-forgotten.svelte-c1wbiz,.st-quarantined.svelte-c1wbiz{color:#f43f5e}.pr-title.svelte-c1wbiz{font-size:.84rem;line-height:1.35;color:var(--color-text, #e2e2f0)}.pr-sig-count.svelte-c1wbiz{font-size:.7rem;color:#f59e0b;margin-top:5px}.pr-detail.svelte-c1wbiz{min-width:0}.center-msg.svelte-c1wbiz{padding:50px;text-align:center;color:var(--color-text-dim, #8b8ba7)}.diff-card.svelte-c1wbiz{padding:20px 22px}.diff-head.svelte-c1wbiz{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.run-link.svelte-c1wbiz{display:inline-flex;align-items:center;gap:4px;margin-left:auto;font-size:.74rem;color:var(--color-synapse-glow, #818cf8);text-decoration:none;padding:3px 8px;border-radius:6px;background:color-mix(in oklab,var(--color-synapse) 10%,transparent)}.diff-title.svelte-c1wbiz{font-size:1.15rem;font-weight:700;margin:12px 0 16px;line-height:1.4}.diff-body.svelte-c1wbiz{margin-bottom:16px}.diff-meta.svelte-c1wbiz{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}.meta-pill.svelte-c1wbiz{font-size:.72rem;padding:2px 8px;border-radius:6px;background:color-mix(in oklab,white 6%,transparent);color:var(--color-text-dim, #c0c0d8)}.meta-pill.tag.svelte-c1wbiz{color:var(--color-synapse-glow, #818cf8)}.diff-add.svelte-c1wbiz{margin:0;padding:12px 14px 12px 36px;position:relative;border-radius:9px;background:color-mix(in oklab,#10b981 9%,transparent);border-left:3px solid #10b981;font-size:.85rem;line-height:1.55;white-space:pre-wrap;word-break:break-word;font-family:var(--font-mono, monospace);color:var(--color-text, #e2e2f0)}.diff-add.svelte-c1wbiz .gutter:where(.svelte-c1wbiz){position:absolute;left:12px;color:#10b981;font-weight:700}.signals.svelte-c1wbiz,.why-box.svelte-c1wbiz{margin-bottom:16px;padding:12px 14px;border-radius:10px;background:color-mix(in oklab,#f59e0b 8%,transparent);border:1px solid color-mix(in oklab,#f59e0b 22%,transparent)}.why-box.svelte-c1wbiz{background:color-mix(in oklab,var(--color-synapse) 8%,transparent);border-color:color-mix(in oklab,var(--color-synapse) 22%,transparent)}.signals-title.svelte-c1wbiz,.why-title.svelte-c1wbiz{display:block;font-size:.68rem;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:#f59e0b;margin-bottom:8px}.why-title.svelte-c1wbiz{color:var(--color-synapse-glow, #818cf8)}.signal.svelte-c1wbiz{display:flex;gap:8px;align-items:baseline;padding:3px 0}.sig-code.svelte-c1wbiz{font-size:.7rem;color:#f59e0b;white-space:nowrap}.sig-detail.svelte-c1wbiz{font-size:.82rem;line-height:1.4;color:var(--color-text, #e2e2f0)}.actions.svelte-c1wbiz{display:flex;flex-wrap:wrap;gap:8px}.action.svelte-c1wbiz{font-size:.8rem;font-weight:600;padding:8px 14px;border-radius:9px;border:1px solid color-mix(in oklab,var(--ac, #6366f1) 40%,transparent);background:color-mix(in oklab,var(--ac, #6366f1) 10%,transparent);color:var(--ac, #818cf8);cursor:pointer;transition:all .16s ease}.action.svelte-c1wbiz:hover:not(:disabled){background:color-mix(in oklab,var(--ac, #6366f1) 22%,transparent);transform:translateY(-1px)}.action.svelte-c1wbiz:disabled{opacity:.5;cursor:wait}.action.promote.svelte-c1wbiz{--ac: #10b981}.action.merge.svelte-c1wbiz{--ac: #6366f1}.action.supersede.svelte-c1wbiz{--ac: #38bdf8}.action.quarantine.svelte-c1wbiz{--ac: #f59e0b}.action.forget.svelte-c1wbiz{--ac: #f43f5e}.action.why.svelte-c1wbiz{--ac: #818cf8}.decided.svelte-c1wbiz{font-size:.88rem;padding:10px 14px;border-radius:9px;background:color-mix(in oklab,white 4%,transparent)}.text-dim.svelte-c1wbiz{color:var(--color-text-dim, #8b8ba7)} diff --git a/apps/dashboard/build/_app/immutable/assets/15.BzuIe_Oj.css.br b/apps/dashboard/build/_app/immutable/assets/15.BzuIe_Oj.css.br deleted file mode 100644 index b3e67f6..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/15.BzuIe_Oj.css.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/15.BzuIe_Oj.css.gz b/apps/dashboard/build/_app/immutable/assets/15.BzuIe_Oj.css.gz deleted file mode 100644 index d79d1a9..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/15.BzuIe_Oj.css.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/17.ChjqzJHo.css b/apps/dashboard/build/_app/immutable/assets/15.ChjqzJHo.css similarity index 100% rename from apps/dashboard/build/_app/immutable/assets/17.ChjqzJHo.css rename to apps/dashboard/build/_app/immutable/assets/15.ChjqzJHo.css diff --git a/apps/dashboard/build/_app/immutable/assets/17.ChjqzJHo.css.br b/apps/dashboard/build/_app/immutable/assets/15.ChjqzJHo.css.br similarity index 100% rename from apps/dashboard/build/_app/immutable/assets/17.ChjqzJHo.css.br rename to apps/dashboard/build/_app/immutable/assets/15.ChjqzJHo.css.br diff --git a/apps/dashboard/build/_app/immutable/assets/15.ChjqzJHo.css.gz b/apps/dashboard/build/_app/immutable/assets/15.ChjqzJHo.css.gz new file mode 100644 index 0000000..2d6842b Binary files /dev/null and b/apps/dashboard/build/_app/immutable/assets/15.ChjqzJHo.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/assets/18.BnHgRQtR.css b/apps/dashboard/build/_app/immutable/assets/16.BnHgRQtR.css similarity index 100% rename from apps/dashboard/build/_app/immutable/assets/18.BnHgRQtR.css rename to apps/dashboard/build/_app/immutable/assets/16.BnHgRQtR.css diff --git a/apps/dashboard/build/_app/immutable/assets/18.BnHgRQtR.css.br b/apps/dashboard/build/_app/immutable/assets/16.BnHgRQtR.css.br similarity index 100% rename from apps/dashboard/build/_app/immutable/assets/18.BnHgRQtR.css.br rename to apps/dashboard/build/_app/immutable/assets/16.BnHgRQtR.css.br diff --git a/apps/dashboard/build/_app/immutable/assets/18.BnHgRQtR.css.gz b/apps/dashboard/build/_app/immutable/assets/16.BnHgRQtR.css.gz similarity index 55% rename from apps/dashboard/build/_app/immutable/assets/18.BnHgRQtR.css.gz rename to apps/dashboard/build/_app/immutable/assets/16.BnHgRQtR.css.gz index ad88522..f534971 100644 Binary files a/apps/dashboard/build/_app/immutable/assets/18.BnHgRQtR.css.gz and b/apps/dashboard/build/_app/immutable/assets/16.BnHgRQtR.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/assets/17.ChjqzJHo.css.gz b/apps/dashboard/build/_app/immutable/assets/17.ChjqzJHo.css.gz deleted file mode 100644 index 388b5e8..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/17.ChjqzJHo.css.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/19.C2qtIyf6.css b/apps/dashboard/build/_app/immutable/assets/19.C2qtIyf6.css deleted file mode 100644 index b9e5029..0000000 --- a/apps/dashboard/build/_app/immutable/assets/19.C2qtIyf6.css +++ /dev/null @@ -1 +0,0 @@ -.conn-pill.svelte-15kgmsr{display:inline-flex;align-items:center;gap:.5rem;padding:.3rem .7rem;border-radius:999px;font-size:.75rem;font-weight:600;color:var(--color-recall, #34d399);background:color-mix(in srgb,var(--color-recall, #34d399) 12%,transparent);border:1px solid color-mix(in srgb,var(--color-recall, #34d399) 28%,transparent);white-space:nowrap}.conn-pill.idle.svelte-15kgmsr{color:var(--color-dim, #8b95a5);background:#ffffff0a;border-color:#ffffff14}.conn-dot.svelte-15kgmsr{display:inline-block;flex-shrink:0}.refresh-btn.svelte-15kgmsr{display:inline-flex;align-items:center;gap:.3rem;padding:.3rem .65rem;border-radius:999px;font-size:.75rem;color:var(--color-muted, #6b7280);background:#ffffff05;border:1px solid rgba(255,255,255,.06);transition:color .2s ease,background .2s ease,border-color .2s ease}.refresh-btn.svelte-15kgmsr:hover{color:var(--color-text, #e5e7eb);background:#ffffff0d;border-color:#ffffff1f}.logo-tile.svelte-15kgmsr{position:relative}.logo-tile.svelte-15kgmsr:after{content:"";position:absolute;top:-1px;right:-1px;bottom:-1px;left:-1px;border-radius:inherit;box-shadow:0 0 18px -2px var(--color-synapse-glow, #818cf8);opacity:.4;pointer-events:none}@media not (prefers-reduced-motion:reduce){.logo-tile.svelte-15kgmsr:after{animation:svelte-15kgmsr-logo-glow 4s ease-in-out infinite}@keyframes svelte-15kgmsr-logo-glow{0%,to{opacity:.25}50%{opacity:.55}}} diff --git a/apps/dashboard/build/_app/immutable/assets/19.C2qtIyf6.css.br b/apps/dashboard/build/_app/immutable/assets/19.C2qtIyf6.css.br deleted file mode 100644 index 874173f..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/19.C2qtIyf6.css.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/19.C2qtIyf6.css.gz b/apps/dashboard/build/_app/immutable/assets/19.C2qtIyf6.css.gz deleted file mode 100644 index e22d836..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/19.C2qtIyf6.css.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/20.CO50G5tF.css b/apps/dashboard/build/_app/immutable/assets/20.CO50G5tF.css deleted file mode 100644 index bcec2e9..0000000 --- a/apps/dashboard/build/_app/immutable/assets/20.CO50G5tF.css +++ /dev/null @@ -1 +0,0 @@ -.metric-card.svelte-w41m0t{cursor:default} diff --git a/apps/dashboard/build/_app/immutable/assets/20.CO50G5tF.css.br b/apps/dashboard/build/_app/immutable/assets/20.CO50G5tF.css.br deleted file mode 100644 index 97fdfcf..0000000 --- a/apps/dashboard/build/_app/immutable/assets/20.CO50G5tF.css.br +++ /dev/null @@ -1,2 +0,0 @@ - .metric-card.svelte-w41m0t{cursor:default} - \ No newline at end of file diff --git a/apps/dashboard/build/_app/immutable/assets/20.CO50G5tF.css.gz b/apps/dashboard/build/_app/immutable/assets/20.CO50G5tF.css.gz deleted file mode 100644 index acfc4f2..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/20.CO50G5tF.css.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/22.DKhUrxcR.css b/apps/dashboard/build/_app/immutable/assets/20.DKhUrxcR.css similarity index 100% rename from apps/dashboard/build/_app/immutable/assets/22.DKhUrxcR.css rename to apps/dashboard/build/_app/immutable/assets/20.DKhUrxcR.css diff --git a/apps/dashboard/build/_app/immutable/assets/22.DKhUrxcR.css.br b/apps/dashboard/build/_app/immutable/assets/20.DKhUrxcR.css.br similarity index 100% rename from apps/dashboard/build/_app/immutable/assets/22.DKhUrxcR.css.br rename to apps/dashboard/build/_app/immutable/assets/20.DKhUrxcR.css.br diff --git a/apps/dashboard/build/_app/immutable/assets/20.DKhUrxcR.css.gz b/apps/dashboard/build/_app/immutable/assets/20.DKhUrxcR.css.gz new file mode 100644 index 0000000..a175ffa Binary files /dev/null and b/apps/dashboard/build/_app/immutable/assets/20.DKhUrxcR.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/assets/22.DKhUrxcR.css.gz b/apps/dashboard/build/_app/immutable/assets/22.DKhUrxcR.css.gz deleted file mode 100644 index f9799b6..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/22.DKhUrxcR.css.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/6.DQ_AfUnN.css b/apps/dashboard/build/_app/immutable/assets/5.DQ_AfUnN.css similarity index 100% rename from apps/dashboard/build/_app/immutable/assets/6.DQ_AfUnN.css rename to apps/dashboard/build/_app/immutable/assets/5.DQ_AfUnN.css diff --git a/apps/dashboard/build/_app/immutable/assets/6.DQ_AfUnN.css.br b/apps/dashboard/build/_app/immutable/assets/5.DQ_AfUnN.css.br similarity index 100% rename from apps/dashboard/build/_app/immutable/assets/6.DQ_AfUnN.css.br rename to apps/dashboard/build/_app/immutable/assets/5.DQ_AfUnN.css.br diff --git a/apps/dashboard/build/_app/immutable/assets/5.DQ_AfUnN.css.gz b/apps/dashboard/build/_app/immutable/assets/5.DQ_AfUnN.css.gz new file mode 100644 index 0000000..ac521f3 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/assets/5.DQ_AfUnN.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/assets/5.Tl8-WHJj.css b/apps/dashboard/build/_app/immutable/assets/5.Tl8-WHJj.css deleted file mode 100644 index 236f6ad..0000000 --- a/apps/dashboard/build/_app/immutable/assets/5.Tl8-WHJj.css +++ /dev/null @@ -1 +0,0 @@ -.receipt.svelte-1wdzvwu{border:1px solid color-mix(in oklab,var(--risk) 30%,transparent);border-left:3px solid var(--risk);border-radius:12px;padding:14px 16px;background:color-mix(in oklab,var(--color-void, #050510) 50%,transparent);display:flex;flex-direction:column;gap:12px}.receipt.compact.svelte-1wdzvwu{gap:10px;padding:12px 14px}.r-head.svelte-1wdzvwu{display:flex;justify-content:space-between;align-items:baseline;gap:8px}.r-id.svelte-1wdzvwu{font-size:.78rem;color:var(--color-synapse-glow, #818cf8);word-break:break-all}.r-risk.svelte-1wdzvwu{font-size:.7rem;font-weight:700;text-transform:uppercase;letter-spacing:.05em;white-space:nowrap}.r-metrics.svelte-1wdzvwu{display:flex;gap:20px}.metric.svelte-1wdzvwu{display:flex;flex-direction:column;gap:1px}.m-val.svelte-1wdzvwu{font-size:1.25rem;font-weight:800;line-height:1;font-variant-numeric:tabular-nums}.m-label.svelte-1wdzvwu{font-size:.64rem;text-transform:uppercase;letter-spacing:.07em;color:var(--color-text-dim, #8b8ba7)}.r-section.svelte-1wdzvwu{display:flex;flex-direction:column;gap:6px}.r-section-title.svelte-1wdzvwu{font-size:.66rem;text-transform:uppercase;letter-spacing:.07em;color:var(--color-text-dim, #8b8ba7)}.path.svelte-1wdzvwu{font-size:.8rem;font-family:var(--font-mono, monospace);color:var(--color-text, #e2e2f0);padding:4px 8px;border-radius:6px;background:color-mix(in oklab,var(--color-synapse) 8%,transparent)}.chips.svelte-1wdzvwu{display:flex;flex-wrap:wrap;gap:5px}.chip.svelte-1wdzvwu{font-size:.72rem;padding:2px 8px;border-radius:6px}.chip.recall.svelte-1wdzvwu{color:var(--color-recall, #10b981);background:color-mix(in oklab,var(--color-recall) 12%,transparent);border:1px solid color-mix(in oklab,var(--color-recall) 28%,transparent)}.chip.suppress.svelte-1wdzvwu{color:#a78bfa;background:color-mix(in oklab,#a78bfa 12%,transparent);border:1px solid color-mix(in oklab,#a78bfa 28%,transparent);text-decoration:line-through;text-decoration-color:color-mix(in oklab,#a78bfa 50%,transparent)}.cinema-btn.svelte-1wdzvwu{margin-top:2px;display:inline-flex;align-items:center;justify-content:center;gap:7px;padding:8px 14px;font-size:.8rem;font-weight:600;border-radius:9px;border:1px solid color-mix(in oklab,var(--color-synapse) 40%,transparent);background:color-mix(in oklab,var(--color-synapse) 12%,transparent);color:var(--color-synapse-glow, #818cf8);cursor:pointer;transition:all .18s ease}.cinema-btn.svelte-1wdzvwu:hover:not(:disabled){background:color-mix(in oklab,var(--color-synapse) 24%,transparent);transform:translateY(-1px)}.cinema-btn.svelte-1wdzvwu:disabled{opacity:.4;cursor:not-allowed}.mode-toggle.svelte-1ayqwv0,.export-btn.svelte-1ayqwv0{display:inline-flex;align-items:center;gap:6px;padding:7px 12px;font-size:.78rem;font-weight:600;border-radius:9px;border:1px solid color-mix(in oklab,var(--color-synapse) 30%,transparent);background:color-mix(in oklab,var(--color-synapse) 8%,transparent);color:var(--color-synapse-glow);cursor:pointer;transition:all .18s ease}.mode-toggle.svelte-1ayqwv0:hover,.export-btn.svelte-1ayqwv0:hover:not(:disabled){background:color-mix(in oklab,var(--color-synapse) 18%,transparent);transform:translateY(-1px)}.mode-toggle.on.svelte-1ayqwv0{background:var(--color-synapse);color:#fff}.export-btn.svelte-1ayqwv0:disabled{opacity:.4;cursor:not-allowed}.spine.svelte-1ayqwv0{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:1px;border-radius:14px;padding:14px 18px;margin-bottom:18px;overflow:hidden}.spine-item.svelte-1ayqwv0{display:flex;flex-direction:column;gap:4px;padding:2px 14px}.spine-label.svelte-1ayqwv0{font-size:.66rem;text-transform:uppercase;letter-spacing:.08em;color:var(--color-text-dim, #8b8ba7)}.spine-value.svelte-1ayqwv0{font-size:.92rem;font-weight:600;display:inline-flex;align-items:center;gap:7px}.spine-run.svelte-1ayqwv0{font-size:.82rem;color:var(--color-synapse-glow);word-break:break-all}.dot.svelte-1ayqwv0{width:8px;height:8px;border-radius:50%;background:#64748b;box-shadow:0 0 0 0 transparent}.dot.live.svelte-1ayqwv0{background:var(--color-recall, #10b981);animation:svelte-1ayqwv0-ping 2s ease-in-out infinite}.dot.big.svelte-1ayqwv0{width:12px;height:12px}@keyframes svelte-1ayqwv0-ping{0%,to{box-shadow:0 0 color-mix(in oklab,var(--color-recall) 60%,transparent)}50%{box-shadow:0 0 0 6px transparent}}.ev-chip.svelte-1ayqwv0{font-size:.74rem;font-weight:700;padding:2px 8px;border-radius:6px;color:var(--c);background:color-mix(in oklab,var(--c) 14%,transparent);border:1px solid color-mix(in oklab,var(--c) 35%,transparent)}.layout.svelte-1ayqwv0{display:grid;grid-template-columns:260px 1fr;gap:16px;align-items:start}@media(max-width:860px){.layout.svelte-1ayqwv0{grid-template-columns:1fr}}.glass.svelte-1ayqwv0{background:color-mix(in oklab,var(--color-void, #050510) 55%,transparent);border:1px solid color-mix(in oklab,white 8%,transparent);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border-radius:14px}.panel-title.svelte-1ayqwv0{font-size:.82rem;font-weight:700;letter-spacing:.02em;margin:0 0 12px}.text-dim.svelte-1ayqwv0{color:var(--color-text-dim, #8b8ba7);font-weight:400}.empty.svelte-1ayqwv0{font-size:.82rem;color:var(--color-text-dim, #8b8ba7);line-height:1.5}.runs.svelte-1ayqwv0{padding:16px;position:sticky;top:16px;max-height:calc(100vh - 40px);overflow-y:auto}.runs.svelte-1ayqwv0 ul:where(.svelte-1ayqwv0){list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}.run-row.svelte-1ayqwv0{width:100%;text-align:left;padding:9px 11px;border-radius:10px;border:1px solid transparent;background:color-mix(in oklab,white 3%,transparent);cursor:pointer;transition:all .16s ease}.run-row.svelte-1ayqwv0:hover{background:color-mix(in oklab,var(--color-synapse) 12%,transparent)}.run-row.active.svelte-1ayqwv0{border-color:color-mix(in oklab,var(--color-synapse) 45%,transparent);background:color-mix(in oklab,var(--color-synapse) 16%,transparent)}.run-top.svelte-1ayqwv0{display:flex;justify-content:space-between;align-items:baseline;gap:8px}.run-id.svelte-1ayqwv0{font-size:.78rem;color:var(--color-synapse-glow)}.run-tool.svelte-1ayqwv0{font-size:.7rem;color:var(--color-text-dim, #8b8ba7);white-space:nowrap}.run-stats.svelte-1ayqwv0{display:flex;gap:8px;margin-top:5px;font-size:.68rem;color:var(--color-text-dim, #8b8ba7)}.s-recall.svelte-1ayqwv0{color:var(--color-recall, #10b981)}.s-suppress.svelte-1ayqwv0{color:#a78bfa}.s-write.svelte-1ayqwv0{color:#38bdf8}.s-veto.svelte-1ayqwv0{color:#f43f5e}.replay.svelte-1ayqwv0{display:flex;flex-direction:column;gap:14px;min-width:0}.center-msg.svelte-1ayqwv0{padding:40px;text-align:center;color:var(--color-text-dim, #8b8ba7)}.center-msg.err.svelte-1ayqwv0{color:#f87171}.scrubber.svelte-1ayqwv0{padding:16px 18px}.scrub-head.svelte-1ayqwv0{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:10px;font-size:.82rem}.scrub-time.svelte-1ayqwv0{color:var(--color-synapse-glow);font-variant-numeric:tabular-nums}.scrub-range.svelte-1ayqwv0{width:100%;accent-color:var(--color-synapse)}.ticks.svelte-1ayqwv0{display:flex;gap:2px;margin-top:10px;height:22px;align-items:stretch}.tick.svelte-1ayqwv0{flex:1;min-width:2px;border:none;border-radius:2px;background:color-mix(in oklab,var(--c) 22%,transparent);cursor:pointer;transition:all .16s ease;padding:0}.tick.past.svelte-1ayqwv0{background:var(--c);box-shadow:0 0 6px -1px var(--c)}.tick.svelte-1ayqwv0:hover{transform:scaleY(1.25)}.event-detail.svelte-1ayqwv0{padding:16px 18px;border-left:3px solid var(--c)}.ed-head.svelte-1ayqwv0{display:flex;align-items:center;gap:10px}.ed-glyph.svelte-1ayqwv0{font-size:1.2rem;color:var(--c)}.ed-label.svelte-1ayqwv0{font-weight:700;color:var(--c)}.ed-time.svelte-1ayqwv0{margin-left:auto;font-size:.74rem;color:var(--color-text-dim, #8b8ba7)}.ed-summary.svelte-1ayqwv0{margin:10px 0 0;font-size:.9rem;line-height:1.5}.ids-grid.svelte-1ayqwv0{display:flex;flex-wrap:wrap;gap:6px;margin-top:12px}.id-chip.svelte-1ayqwv0{display:inline-flex;align-items:center;gap:5px;padding:3px 8px;border-radius:7px;background:color-mix(in oklab,var(--color-recall) calc(var(--a, 0) * 30%),transparent);border:1px solid color-mix(in oklab,var(--color-recall) 30%,transparent);font-size:.74rem}.id-chip.svelte-1ayqwv0 small:where(.svelte-1ayqwv0){color:var(--color-recall, #10b981);font-weight:700}.contra.svelte-1ayqwv0{display:flex;align-items:center;gap:8px;margin-top:12px;font-size:.8rem}.winner.svelte-1ayqwv0{color:var(--color-recall, #10b981);font-weight:700}.vs.svelte-1ayqwv0{color:var(--color-text-dim, #8b8ba7)}.loser.svelte-1ayqwv0{color:#fb7185;text-decoration:line-through;opacity:.7}.veto-evidence.svelte-1ayqwv0{display:flex;gap:6px;margin-top:12px;flex-wrap:wrap}.veto-evidence.svelte-1ayqwv0 code:where(.svelte-1ayqwv0){padding:2px 7px;border-radius:6px;background:color-mix(in oklab,#f43f5e 12%,transparent);font-size:.74rem}.pulse.svelte-1ayqwv0{padding:16px 18px}.pulse-grid.svelte-1ayqwv0{display:flex;flex-wrap:wrap;gap:6px}.pulse-node.svelte-1ayqwv0{padding:3px 8px;border-radius:7px;background:color-mix(in oklab,var(--color-synapse) 12%,transparent);border:1px solid color-mix(in oklab,var(--color-synapse) 28%,transparent);font-size:.74rem;color:var(--color-synapse-glow);animation:svelte-1ayqwv0-pulse-in .4s ease}@keyframes svelte-1ayqwv0-pulse-in{0%{transform:scale(.85);opacity:0}to{transform:scale(1);opacity:1}}.receipts-panel.svelte-1ayqwv0{padding:16px 18px}.receipts-grid.svelte-1ayqwv0{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px}.producers.svelte-1ayqwv0{padding:16px 18px}.producer-list.svelte-1ayqwv0{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:7px}.producer.svelte-1ayqwv0{display:flex;align-items:center;gap:9px;font-size:.78rem;color:var(--color-text-dim, #8b8ba7)}.producer.svelte-1ayqwv0 .p-dot:where(.svelte-1ayqwv0){width:8px;height:8px;border-radius:50%;background:#475569;flex-shrink:0}.producer.ok.svelte-1ayqwv0{color:var(--color-text, #e2e2f0)}.producer.ok.svelte-1ayqwv0 .p-dot:where(.svelte-1ayqwv0){background:var(--color-recall, #10b981);box-shadow:0 0 6px -1px var(--color-recall, #10b981)}.producer.caveat.svelte-1ayqwv0:not(.ok) .p-dot:where(.svelte-1ayqwv0){background:#f59e0b;opacity:.6}.p-state.svelte-1ayqwv0{margin-left:auto;font-size:.7rem;font-style:italic;text-align:right;color:var(--color-text-dim, #8b8ba7)}.producer.caveat.svelte-1ayqwv0:not(.ok) .p-state:where(.svelte-1ayqwv0){color:#f59e0b}.log.svelte-1ayqwv0{padding:16px 18px}.log-list.svelte-1ayqwv0{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}.log-row.svelte-1ayqwv0{border-radius:8px;border-left:2px solid var(--c);transition:all .16s ease}.log-row.active.svelte-1ayqwv0{background:color-mix(in oklab,var(--c) 14%,transparent)}.log-row.dim.svelte-1ayqwv0{opacity:.4}.log-btn.svelte-1ayqwv0{width:100%;display:grid;grid-template-columns:22px 110px 1fr auto;align-items:center;gap:8px;padding:7px 10px;background:none;border:none;cursor:pointer;text-align:left;font-size:.8rem}.log-glyph.svelte-1ayqwv0{color:var(--c);text-align:center}.log-label.svelte-1ayqwv0{font-weight:600;color:var(--c)}.log-summary.svelte-1ayqwv0{color:var(--color-text-dim, #8b8ba7);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.log-t.svelte-1ayqwv0{font-size:.7rem;color:var(--color-text-dim, #8b8ba7);font-variant-numeric:tabular-nums}.proof-stage.svelte-1ayqwv0{padding:60px 40px;text-align:center;display:flex;flex-direction:column;align-items:center;gap:26px;min-height:50vh;justify-content:center}.proof-headline.svelte-1ayqwv0{display:flex;align-items:center;gap:12px}.proof-run.svelte-1ayqwv0{font-size:1.4rem;color:var(--color-synapse-glow);font-weight:700}.proof-event.svelte-1ayqwv0{display:flex;align-items:center;gap:16px;padding:18px 26px;border-radius:14px;border:1px solid color-mix(in oklab,var(--c) 40%,transparent);background:color-mix(in oklab,var(--c) 10%,transparent)}.proof-glyph.svelte-1ayqwv0{font-size:2rem;color:var(--c)}.proof-ev-label.svelte-1ayqwv0{font-size:1.1rem;font-weight:700;color:var(--c)}.proof-ev-sum.svelte-1ayqwv0{font-size:.85rem;color:var(--color-text-dim, #8b8ba7)}.proof-counter.svelte-1ayqwv0{font-size:3.4rem;font-weight:800;line-height:1;color:var(--color-synapse-glow)}.proof-counter-label.svelte-1ayqwv0{display:block;font-size:.8rem;font-weight:500;letter-spacing:.1em;text-transform:uppercase;color:var(--color-text-dim, #8b8ba7);margin-top:8px}.proof-tagline.svelte-1ayqwv0{font-size:1rem;color:var(--color-text-dim, #c0c0d8);max-width:32ch;line-height:1.5} diff --git a/apps/dashboard/build/_app/immutable/assets/5.Tl8-WHJj.css.br b/apps/dashboard/build/_app/immutable/assets/5.Tl8-WHJj.css.br deleted file mode 100644 index 328c39d..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/5.Tl8-WHJj.css.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/5.Tl8-WHJj.css.gz b/apps/dashboard/build/_app/immutable/assets/5.Tl8-WHJj.css.gz deleted file mode 100644 index 29b5849..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/5.Tl8-WHJj.css.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/7.F0TwMZ5M.css b/apps/dashboard/build/_app/immutable/assets/6.BSSBWVKL.css similarity index 57% rename from apps/dashboard/build/_app/immutable/assets/7.F0TwMZ5M.css rename to apps/dashboard/build/_app/immutable/assets/6.BSSBWVKL.css index 84b1d37..65c46b1 100644 --- a/apps/dashboard/build/_app/immutable/assets/7.F0TwMZ5M.css +++ b/apps/dashboard/build/_app/immutable/assets/6.BSSBWVKL.css @@ -1 +1 @@ -.replay-stage.svelte-1cq1ntk{border:1px solid rgba(168,85,247,.18);box-shadow:inset 0 1px #ffffff08,0 8px 36px -8px #0000008c,0 0 48px -16px #a855f740}.stage-canvas.svelte-1cq1ntk{position:relative;height:360px;overflow:hidden;background:radial-gradient(at 50% 50%,color-mix(in srgb,var(--stage-color) 10%,transparent),transparent 60%),radial-gradient(at 20% 80%,rgba(99,102,241,.08),transparent 50%),#08081a}.edges-layer.svelte-1cq1ntk{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;pointer-events:none}.edge-line.svelte-1cq1ntk{transition:stroke-opacity .52s ease,stroke-width .52s ease,x1 .6s cubic-bezier(.34,1.56,.64,1),y1 .6s cubic-bezier(.34,1.56,.64,1),x2 .6s cubic-bezier(.34,1.56,.64,1),y2 .6s cubic-bezier(.34,1.56,.64,1)}.memory-card.svelte-1cq1ntk{position:absolute;width:44px;height:32px;transform:translate(-50%,-50%) scale(var(--card-scale, 1));transition:left .6s cubic-bezier(.34,1.56,.64,1),top .6s cubic-bezier(.34,1.56,.64,1),transform .5s cubic-bezier(.34,1.56,.64,1),opacity .5s ease;transition-delay:var(--card-delay, 0ms);animation:svelte-1cq1ntk-card-float 6s ease-in-out infinite;animation-delay:var(--card-delay, 0ms);will-change:transform}.card-inner.svelte-1cq1ntk{width:100%;height:100%;border-radius:6px;background:linear-gradient(135deg,color-mix(in srgb,var(--stage-color) 30%,transparent),color-mix(in srgb,var(--stage-color) 10%,transparent));border:1px solid color-mix(in srgb,var(--stage-color) 50%,transparent);box-shadow:inset 0 1px #ffffff14,0 0 8px color-mix(in srgb,var(--stage-color) 30%,transparent);filter:hue-rotate(var(--card-hue, 0deg));padding:5px 6px;display:flex;flex-direction:column;justify-content:center;gap:3px;position:relative;overflow:hidden}.card-dot.svelte-1cq1ntk{width:4px;height:4px;border-radius:50%;background:color-mix(in srgb,var(--stage-color) 90%,white);box-shadow:0 0 6px var(--stage-color);position:absolute;top:4px;right:4px}.card-bar.svelte-1cq1ntk{height:3px;border-radius:1.5px;background:color-mix(in srgb,var(--stage-color) 70%,transparent);width:80%}.card-bar.short.svelte-1cq1ntk{width:50%;opacity:.6}.memory-card.is-pulsing.svelte-1cq1ntk{animation:svelte-1cq1ntk-card-float 6s ease-in-out infinite,svelte-1cq1ntk-card-pulse 1.4s ease-in-out infinite}.memory-card.is-pulsing.svelte-1cq1ntk .card-inner:where(.svelte-1cq1ntk){border-color:var(--color-dream-glow);background:linear-gradient(135deg,color-mix(in srgb,var(--color-dream-glow) 40%,transparent),color-mix(in srgb,var(--color-dream) 25%,transparent));box-shadow:inset 0 1px #ffffff1f,0 0 22px color-mix(in srgb,var(--color-dream-glow) 60%,transparent),0 0 44px color-mix(in srgb,var(--color-dream) 35%,transparent)}.memory-card.is-pruning.svelte-1cq1ntk .card-inner:where(.svelte-1cq1ntk){animation:svelte-1cq1ntk-dissolve 1.2s ease-out forwards}.memory-card.is-transferring.svelte-1cq1ntk .card-inner:where(.svelte-1cq1ntk){border-color:#10b981;background:linear-gradient(135deg,#10b98159,#10b9811f);box-shadow:inset 0 1px #ffffff14,0 0 14px #10b98180}.memory-card.is-transferring.semantic-side.svelte-1cq1ntk .card-inner:where(.svelte-1cq1ntk){border-color:#c084fc;background:linear-gradient(135deg,#c084fc59,#a855f726);box-shadow:inset 0 1px #ffffff14,0 0 14px #c084fc80}.replay-pulse.svelte-1cq1ntk{position:absolute;top:50%;left:50%;width:60%;aspect-ratio:1 / 1;transform:translate(-50%,-50%);border-radius:50%;background:radial-gradient(circle,color-mix(in srgb,var(--stage-color) 25%,transparent),transparent 60%);filter:blur(30px);animation:svelte-1cq1ntk-pulse-in 3s ease-in-out infinite;pointer-events:none}.transfer-label.svelte-1cq1ntk{position:absolute;top:12px;display:flex;flex-direction:column;align-items:center;gap:2px;z-index:2}.transfer-label.episodic.svelte-1cq1ntk{left:6%}.transfer-label.semantic.svelte-1cq1ntk{right:6%}.label-tag.svelte-1cq1ntk{font-size:10px;font-weight:600;letter-spacing:.14em;text-transform:uppercase;padding:2px 8px;border-radius:999px;border:1px solid rgba(255,255,255,.15);background:#00000059;color:#e0e0ff}.transfer-label.episodic.svelte-1cq1ntk .label-tag:where(.svelte-1cq1ntk){border-color:#10b98180;color:#10b981}.transfer-label.semantic.svelte-1cq1ntk .label-tag:where(.svelte-1cq1ntk){border-color:#c084fc80;color:#c084fc}.label-sub.svelte-1cq1ntk{font-size:9px;color:var(--color-dim);letter-spacing:.1em}.divider-line.svelte-1cq1ntk{position:absolute;top:15%;bottom:15%;left:50%;width:1px;background:linear-gradient(180deg,transparent,rgba(168,85,247,.35),transparent);transform:translate(-.5px)}@keyframes svelte-1cq1ntk-card-float{0%,to{translate:0 0}25%{translate:2px -3px}50%{translate:-2px 2px}75%{translate:3px 1px}}@keyframes svelte-1cq1ntk-card-pulse{0%,to{filter:brightness(1) hue-rotate(var(--card-hue, 0deg))}50%{filter:brightness(1.3) hue-rotate(var(--card-hue, 0deg))}}@keyframes svelte-1cq1ntk-dissolve{0%{opacity:1;transform:scale(1);filter:blur(0)}60%{opacity:.3;filter:blur(2px)}to{opacity:0;transform:scale(.5);filter:blur(6px)}}@keyframes svelte-1cq1ntk-pulse-in{0%,to{opacity:.3;transform:translate(-50%,-50%) scale(1)}50%{opacity:.7;transform:translate(-50%,-50%) scale(1.15)}}@media(prefers-reduced-motion:reduce){.memory-card.svelte-1cq1ntk,.replay-pulse.svelte-1cq1ntk,.memory-card.is-pulsing.svelte-1cq1ntk{animation:none}}.insight-card.svelte-1y17hsl{position:relative;border:1px solid color-mix(in srgb,var(--insight-color) 20%,transparent);transition:transform .4s cubic-bezier(.34,1.56,.64,1),border-color .22s ease,box-shadow .22s ease;animation:svelte-1y17hsl-card-in .42s cubic-bezier(.34,1.56,.64,1) both;animation-delay:var(--enter-delay, 0ms)}.insight-card.svelte-1y17hsl:hover{transform:translateY(-2px) scale(1.01);border-color:color-mix(in srgb,var(--insight-color) 45%,transparent)}.insight-card.high-novelty.svelte-1y17hsl{border-color:#f59e0b66;box-shadow:0 0 0 1px #f59e0b40,0 0 24px -4px #f59e0b73,0 0 60px -12px #f59e0b40,inset 0 1px #ffffff0d;background:radial-gradient(at top right,rgba(245,158,11,.08),transparent 50%),#0a0a1acc}.insight-card.low-novelty.svelte-1y17hsl{opacity:.6;filter:saturate(.7)}.insight-card.low-novelty.svelte-1y17hsl:hover{opacity:.9;filter:saturate(1)}.novelty-track.svelte-1y17hsl{height:4px;background:#ffffff0d;border-radius:2px;overflow:hidden}.novelty-fill.svelte-1y17hsl{height:100%;border-radius:2px;transition:width .6s cubic-bezier(.34,1.56,.64,1);box-shadow:0 0 8px color-mix(in srgb,var(--insight-color) 60%,transparent)}.source-chip.svelte-1y17hsl{background:#6366f11f;border:1px solid rgba(99,102,241,.25);color:var(--color-synapse-glow);text-decoration:none;transition:all .18s ease}.source-chip.svelte-1y17hsl:hover{background:#6366f140;border-color:#818cf880;transform:translateY(-1px)}.sparkle.svelte-1y17hsl{display:inline-block;animation:svelte-1y17hsl-sparkle-spin 3s linear infinite}@keyframes svelte-1y17hsl-sparkle-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes svelte-1y17hsl-card-in{0%{opacity:0;transform:translateY(8px) scale(.97)}to{opacity:1;transform:translateY(0) scale(1)}}@media(prefers-reduced-motion:reduce){.insight-card.svelte-1y17hsl,.sparkle.svelte-1y17hsl{animation:none}}.dream-button.svelte-1fv2vo0{display:inline-flex;align-items:center;gap:.6rem;padding:.7rem 1.4rem;border-radius:999px;font-size:.9rem;font-weight:600;letter-spacing:.02em;color:#fff;background:linear-gradient(135deg,var(--color-dream),var(--color-synapse));border:1px solid color-mix(in srgb,var(--color-dream-glow) 60%,transparent);box-shadow:inset 0 1px #ffffff2e,0 8px 24px -6px #a855f78c,0 0 48px -10px #a855f773;cursor:pointer;transition:transform .4s cubic-bezier(.34,1.56,.64,1),box-shadow .22s ease,filter .22s ease}.dream-button.svelte-1fv2vo0:hover:not(:disabled){transform:translateY(-2px) scale(1.03);box-shadow:inset 0 1px #ffffff38,0 12px 32px -6px #a855f7b3,0 0 64px -10px #a855f78c}.dream-button.svelte-1fv2vo0:disabled{cursor:not-allowed;filter:saturate(.85)}.dream-button.is-dreaming.svelte-1fv2vo0{background:linear-gradient(135deg,var(--color-synapse),var(--color-dream));animation:svelte-1fv2vo0-button-breathe 2s ease-in-out infinite}@keyframes svelte-1fv2vo0-button-breathe{0%,to{box-shadow:0 8px 24px -6px #a855f780,0 0 48px -10px #a855f766}50%{box-shadow:0 12px 36px -6px #a855f7cc,0 0 80px -10px #a855f799}}.dream-icon.svelte-1fv2vo0{display:inline-block;animation:twinkle 3s ease-in-out infinite}.spinner.svelte-1fv2vo0{width:14px;height:14px;border-radius:50%;border:2px solid rgba(255,255,255,.25);border-top-color:#fff;animation:svelte-1fv2vo0-spin .8s linear infinite}@keyframes svelte-1fv2vo0-spin{to{transform:rotate(360deg)}}.empty-state.svelte-1fv2vo0{border:1px dashed rgba(168,85,247,.25)}.empty-glyph.svelte-1fv2vo0{font-size:3rem;color:var(--color-dream-glow);opacity:.5;text-shadow:0 0 20px var(--color-dream);animation:twinkle 4s ease-in-out infinite}.scrubber-wrap.svelte-1fv2vo0{position:relative;padding:4px 0 8px}.scrubber.svelte-1fv2vo0{-moz-appearance:none;appearance:none;-webkit-appearance:none;width:100%;height:6px;border-radius:999px;background:linear-gradient(90deg,var(--color-synapse-glow) 0%,var(--color-dream) 50%,var(--color-recall) 100%);opacity:.35;outline:none;cursor:pointer;transition:opacity .22s ease}.scrubber.svelte-1fv2vo0:hover:not(:disabled){opacity:.55}.scrubber.svelte-1fv2vo0::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:20px;height:20px;border-radius:50%;background:var(--color-dream-glow);border:2px solid white;box-shadow:0 0 0 3px #c084fc40,0 0 20px var(--color-dream),0 4px 12px #0006;cursor:grab;transition:transform .4s cubic-bezier(.34,1.56,.64,1)}.scrubber.svelte-1fv2vo0::-webkit-slider-thumb:hover{transform:scale(1.2)}.scrubber.svelte-1fv2vo0::-moz-range-thumb{width:20px;height:20px;border-radius:50%;background:var(--color-dream-glow);border:2px solid white;box-shadow:0 0 0 3px #c084fc40,0 0 20px var(--color-dream);cursor:grab}.scrubber.svelte-1fv2vo0:disabled{cursor:not-allowed;opacity:.25}.scrubber-ticks.svelte-1fv2vo0{display:flex;justify-content:space-between;margin-top:10px;gap:4px}.tick.svelte-1fv2vo0{display:flex;flex-direction:column;align-items:center;gap:4px;background:transparent;border:none;cursor:pointer;padding:2px 4px;color:var(--color-dim);font-size:10px;letter-spacing:.04em;transition:color .22s ease,transform .22s cubic-bezier(.34,1.56,.64,1)}.tick.svelte-1fv2vo0:disabled{cursor:not-allowed}.tick.svelte-1fv2vo0:hover:not(:disabled){color:var(--color-dream-glow);transform:translateY(-1px)}.tick-dot.svelte-1fv2vo0{width:8px;height:8px;border-radius:50%;background:#ffffff1a;border:1px solid rgba(255,255,255,.15);transition:all .28s ease}.tick.passed.svelte-1fv2vo0 .tick-dot:where(.svelte-1fv2vo0){background:var(--color-synapse-glow);border-color:var(--color-synapse-glow);opacity:.7}.tick.active.svelte-1fv2vo0 .tick-dot:where(.svelte-1fv2vo0){background:var(--color-dream-glow);border-color:#fff;box-shadow:0 0 0 3px #c084fc4d,0 0 14px var(--color-dream);transform:scale(1.3)}.tick.active.svelte-1fv2vo0{color:var(--color-dream-glow);font-weight:600}.tick-label.svelte-1fv2vo0{white-space:nowrap}.step-btn.svelte-1fv2vo0{width:28px;height:28px;border-radius:6px;background:#6366f11a;border:1px solid rgba(99,102,241,.2);color:var(--color-synapse-glow);cursor:pointer;transition:all .18s ease;font-size:11px}.step-btn.svelte-1fv2vo0:hover:not(:disabled){background:#6366f133;transform:translateY(-1px)}.step-btn.svelte-1fv2vo0:disabled{opacity:.35;cursor:not-allowed}.insights-scroll.svelte-1fv2vo0{max-height:520px;overflow-y:auto;padding-right:4px}.stat-cell.svelte-1fv2vo0{padding:.5rem .75rem;border-left:2px solid rgba(168,85,247,.3)}.stat-value.svelte-1fv2vo0{font-family:var(--font-mono);font-size:1.25rem;font-weight:700;color:var(--color-bright);font-variant-numeric:tabular-nums;line-height:1.1}.stat-label.svelte-1fv2vo0{font-size:10px;color:var(--color-dim);text-transform:uppercase;letter-spacing:.1em;margin-top:2px} +.replay-stage.svelte-1cq1ntk{border:1px solid rgba(168,85,247,.18);box-shadow:inset 0 1px #ffffff08,0 8px 36px -8px #0000008c,0 0 48px -16px #a855f740}.stage-canvas.svelte-1cq1ntk{position:relative;height:360px;overflow:hidden;background:radial-gradient(at 50% 50%,color-mix(in srgb,var(--stage-color) 10%,transparent),transparent 60%),radial-gradient(at 20% 80%,rgba(99,102,241,.08),transparent 50%),#08081a}.edges-layer.svelte-1cq1ntk{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;pointer-events:none}.edge-line.svelte-1cq1ntk{transition:stroke-opacity .52s ease,stroke-width .52s ease,x1 .6s cubic-bezier(.34,1.56,.64,1),y1 .6s cubic-bezier(.34,1.56,.64,1),x2 .6s cubic-bezier(.34,1.56,.64,1),y2 .6s cubic-bezier(.34,1.56,.64,1)}.memory-card.svelte-1cq1ntk{position:absolute;width:44px;height:32px;transform:translate(-50%,-50%) scale(var(--card-scale, 1));transition:left .6s cubic-bezier(.34,1.56,.64,1),top .6s cubic-bezier(.34,1.56,.64,1),transform .5s cubic-bezier(.34,1.56,.64,1),opacity .5s ease;transition-delay:var(--card-delay, 0ms);animation:svelte-1cq1ntk-card-float 6s ease-in-out infinite;animation-delay:var(--card-delay, 0ms);will-change:transform}.card-inner.svelte-1cq1ntk{width:100%;height:100%;border-radius:6px;background:linear-gradient(135deg,color-mix(in srgb,var(--stage-color) 30%,transparent),color-mix(in srgb,var(--stage-color) 10%,transparent));border:1px solid color-mix(in srgb,var(--stage-color) 50%,transparent);box-shadow:inset 0 1px #ffffff14,0 0 8px color-mix(in srgb,var(--stage-color) 30%,transparent);filter:hue-rotate(var(--card-hue, 0deg));padding:5px 6px;display:flex;flex-direction:column;justify-content:center;gap:3px;position:relative;overflow:hidden}.card-dot.svelte-1cq1ntk{width:4px;height:4px;border-radius:50%;background:color-mix(in srgb,var(--stage-color) 90%,white);box-shadow:0 0 6px var(--stage-color);position:absolute;top:4px;right:4px}.card-bar.svelte-1cq1ntk{height:3px;border-radius:1.5px;background:color-mix(in srgb,var(--stage-color) 70%,transparent);width:80%}.card-bar.short.svelte-1cq1ntk{width:50%;opacity:.6}.memory-card.is-pulsing.svelte-1cq1ntk{animation:svelte-1cq1ntk-card-float 6s ease-in-out infinite,svelte-1cq1ntk-card-pulse 1.4s ease-in-out infinite}.memory-card.is-pulsing.svelte-1cq1ntk .card-inner:where(.svelte-1cq1ntk){border-color:var(--color-dream-glow);background:linear-gradient(135deg,color-mix(in srgb,var(--color-dream-glow) 40%,transparent),color-mix(in srgb,var(--color-dream) 25%,transparent));box-shadow:inset 0 1px #ffffff1f,0 0 22px color-mix(in srgb,var(--color-dream-glow) 60%,transparent),0 0 44px color-mix(in srgb,var(--color-dream) 35%,transparent)}.memory-card.is-pruning.svelte-1cq1ntk .card-inner:where(.svelte-1cq1ntk){animation:svelte-1cq1ntk-dissolve 1.2s ease-out forwards}.memory-card.is-transferring.svelte-1cq1ntk .card-inner:where(.svelte-1cq1ntk){border-color:#10b981;background:linear-gradient(135deg,#10b98159,#10b9811f);box-shadow:inset 0 1px #ffffff14,0 0 14px #10b98180}.memory-card.is-transferring.semantic-side.svelte-1cq1ntk .card-inner:where(.svelte-1cq1ntk){border-color:#c084fc;background:linear-gradient(135deg,#c084fc59,#a855f726);box-shadow:inset 0 1px #ffffff14,0 0 14px #c084fc80}.replay-pulse.svelte-1cq1ntk{position:absolute;top:50%;left:50%;width:60%;aspect-ratio:1 / 1;transform:translate(-50%,-50%);border-radius:50%;background:radial-gradient(circle,color-mix(in srgb,var(--stage-color) 25%,transparent),transparent 60%);filter:blur(30px);animation:svelte-1cq1ntk-pulse-in 3s ease-in-out infinite;pointer-events:none}.transfer-label.svelte-1cq1ntk{position:absolute;top:12px;display:flex;flex-direction:column;align-items:center;gap:2px;z-index:2}.transfer-label.episodic.svelte-1cq1ntk{left:6%}.transfer-label.semantic.svelte-1cq1ntk{right:6%}.label-tag.svelte-1cq1ntk{font-size:10px;font-weight:600;letter-spacing:.14em;text-transform:uppercase;padding:2px 8px;border-radius:999px;border:1px solid rgba(255,255,255,.15);background:#00000059;color:#e0e0ff}.transfer-label.episodic.svelte-1cq1ntk .label-tag:where(.svelte-1cq1ntk){border-color:#10b98180;color:#10b981}.transfer-label.semantic.svelte-1cq1ntk .label-tag:where(.svelte-1cq1ntk){border-color:#c084fc80;color:#c084fc}.label-sub.svelte-1cq1ntk{font-size:9px;color:var(--color-dim);letter-spacing:.1em}.divider-line.svelte-1cq1ntk{position:absolute;top:15%;bottom:15%;left:50%;width:1px;background:linear-gradient(180deg,transparent,rgba(168,85,247,.35),transparent);transform:translate(-.5px)}@keyframes svelte-1cq1ntk-card-float{0%,to{translate:0 0}25%{translate:2px -3px}50%{translate:-2px 2px}75%{translate:3px 1px}}@keyframes svelte-1cq1ntk-card-pulse{0%,to{filter:brightness(1) hue-rotate(var(--card-hue, 0deg))}50%{filter:brightness(1.3) hue-rotate(var(--card-hue, 0deg))}}@keyframes svelte-1cq1ntk-dissolve{0%{opacity:1;transform:scale(1);filter:blur(0)}60%{opacity:.3;filter:blur(2px)}to{opacity:0;transform:scale(.5);filter:blur(6px)}}@keyframes svelte-1cq1ntk-pulse-in{0%,to{opacity:.3;transform:translate(-50%,-50%) scale(1)}50%{opacity:.7;transform:translate(-50%,-50%) scale(1.15)}}@media(prefers-reduced-motion:reduce){.memory-card.svelte-1cq1ntk,.replay-pulse.svelte-1cq1ntk,.memory-card.is-pulsing.svelte-1cq1ntk{animation:none}}.insight-card.svelte-1y17hsl{position:relative;border:1px solid color-mix(in srgb,var(--insight-color) 20%,transparent);transition:transform .4s cubic-bezier(.34,1.56,.64,1),border-color .22s ease,box-shadow .22s ease;animation:svelte-1y17hsl-card-in .42s cubic-bezier(.34,1.56,.64,1) both;animation-delay:var(--enter-delay, 0ms)}.insight-card.svelte-1y17hsl:hover{transform:translateY(-2px) scale(1.01);border-color:color-mix(in srgb,var(--insight-color) 45%,transparent)}.insight-card.high-novelty.svelte-1y17hsl{border-color:#f59e0b66;box-shadow:0 0 0 1px #f59e0b40,0 0 24px -4px #f59e0b73,0 0 60px -12px #f59e0b40,inset 0 1px #ffffff0d;background:radial-gradient(at top right,rgba(245,158,11,.08),transparent 50%),#0a0a1acc}.insight-card.low-novelty.svelte-1y17hsl{opacity:.6;filter:saturate(.7)}.insight-card.low-novelty.svelte-1y17hsl:hover{opacity:.9;filter:saturate(1)}.novelty-track.svelte-1y17hsl{height:4px;background:#ffffff0d;border-radius:2px;overflow:hidden}.novelty-fill.svelte-1y17hsl{height:100%;border-radius:2px;transition:width .6s cubic-bezier(.34,1.56,.64,1);box-shadow:0 0 8px color-mix(in srgb,var(--insight-color) 60%,transparent)}.source-chip.svelte-1y17hsl{background:#6366f11f;border:1px solid rgba(99,102,241,.25);color:var(--color-synapse-glow);text-decoration:none;transition:all .18s ease}.source-chip.svelte-1y17hsl:hover{background:#6366f140;border-color:#818cf880;transform:translateY(-1px)}.sparkle.svelte-1y17hsl{display:inline-block;animation:svelte-1y17hsl-sparkle-spin 3s linear infinite}@keyframes svelte-1y17hsl-sparkle-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes svelte-1y17hsl-card-in{0%{opacity:0;transform:translateY(8px) scale(.97)}to{opacity:1;transform:translateY(0) scale(1)}}@media(prefers-reduced-motion:reduce){.insight-card.svelte-1y17hsl,.sparkle.svelte-1y17hsl{animation:none}}.header-glyph.svelte-1fv2vo0{display:inline-block;color:var(--color-dream-glow);text-shadow:0 0 12px var(--color-dream),0 0 24px color-mix(in srgb,var(--color-dream) 50%,transparent);animation:svelte-1fv2vo0-twinkle 4s ease-in-out infinite}@keyframes svelte-1fv2vo0-twinkle{0%,to{opacity:1;transform:rotate(0)}50%{opacity:.75;transform:rotate(10deg)}}.dream-button.svelte-1fv2vo0{display:inline-flex;align-items:center;gap:.6rem;padding:.7rem 1.4rem;border-radius:999px;font-size:.9rem;font-weight:600;letter-spacing:.02em;color:#fff;background:linear-gradient(135deg,var(--color-dream),var(--color-synapse));border:1px solid color-mix(in srgb,var(--color-dream-glow) 60%,transparent);box-shadow:inset 0 1px #ffffff2e,0 8px 24px -6px #a855f78c,0 0 48px -10px #a855f773;cursor:pointer;transition:transform .4s cubic-bezier(.34,1.56,.64,1),box-shadow .22s ease,filter .22s ease}.dream-button.svelte-1fv2vo0:hover:not(:disabled){transform:translateY(-2px) scale(1.03);box-shadow:inset 0 1px #ffffff38,0 12px 32px -6px #a855f7b3,0 0 64px -10px #a855f78c}.dream-button.svelte-1fv2vo0:disabled{cursor:not-allowed;filter:saturate(.85)}.dream-button.is-dreaming.svelte-1fv2vo0{background:linear-gradient(135deg,var(--color-synapse),var(--color-dream));animation:svelte-1fv2vo0-button-breathe 2s ease-in-out infinite}@keyframes svelte-1fv2vo0-button-breathe{0%,to{box-shadow:0 8px 24px -6px #a855f780,0 0 48px -10px #a855f766}50%{box-shadow:0 12px 36px -6px #a855f7cc,0 0 80px -10px #a855f799}}.dream-icon.svelte-1fv2vo0{display:inline-block;animation:svelte-1fv2vo0-twinkle 3s ease-in-out infinite}.spinner.svelte-1fv2vo0{width:14px;height:14px;border-radius:50%;border:2px solid rgba(255,255,255,.25);border-top-color:#fff;animation:svelte-1fv2vo0-spin .8s linear infinite}@keyframes svelte-1fv2vo0-spin{to{transform:rotate(360deg)}}.empty-state.svelte-1fv2vo0{border:1px dashed rgba(168,85,247,.25)}.empty-glyph.svelte-1fv2vo0{font-size:3rem;color:var(--color-dream-glow);opacity:.5;text-shadow:0 0 20px var(--color-dream);animation:svelte-1fv2vo0-twinkle 4s ease-in-out infinite}.scrubber-wrap.svelte-1fv2vo0{position:relative;padding:4px 0 8px}.scrubber.svelte-1fv2vo0{-moz-appearance:none;appearance:none;-webkit-appearance:none;width:100%;height:6px;border-radius:999px;background:linear-gradient(90deg,var(--color-synapse-glow) 0%,var(--color-dream) 50%,var(--color-recall) 100%);opacity:.35;outline:none;cursor:pointer;transition:opacity .22s ease}.scrubber.svelte-1fv2vo0:hover:not(:disabled){opacity:.55}.scrubber.svelte-1fv2vo0::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:20px;height:20px;border-radius:50%;background:var(--color-dream-glow);border:2px solid white;box-shadow:0 0 0 3px #c084fc40,0 0 20px var(--color-dream),0 4px 12px #0006;cursor:grab;transition:transform .4s cubic-bezier(.34,1.56,.64,1)}.scrubber.svelte-1fv2vo0::-webkit-slider-thumb:hover{transform:scale(1.2)}.scrubber.svelte-1fv2vo0::-moz-range-thumb{width:20px;height:20px;border-radius:50%;background:var(--color-dream-glow);border:2px solid white;box-shadow:0 0 0 3px #c084fc40,0 0 20px var(--color-dream);cursor:grab}.scrubber.svelte-1fv2vo0:disabled{cursor:not-allowed;opacity:.25}.scrubber-ticks.svelte-1fv2vo0{display:flex;justify-content:space-between;margin-top:10px;gap:4px}.tick.svelte-1fv2vo0{display:flex;flex-direction:column;align-items:center;gap:4px;background:transparent;border:none;cursor:pointer;padding:2px 4px;color:var(--color-dim);font-size:10px;letter-spacing:.04em;transition:color .22s ease,transform .22s cubic-bezier(.34,1.56,.64,1)}.tick.svelte-1fv2vo0:disabled{cursor:not-allowed}.tick.svelte-1fv2vo0:hover:not(:disabled){color:var(--color-dream-glow);transform:translateY(-1px)}.tick-dot.svelte-1fv2vo0{width:8px;height:8px;border-radius:50%;background:#ffffff1a;border:1px solid rgba(255,255,255,.15);transition:all .28s ease}.tick.passed.svelte-1fv2vo0 .tick-dot:where(.svelte-1fv2vo0){background:var(--color-synapse-glow);border-color:var(--color-synapse-glow);opacity:.7}.tick.active.svelte-1fv2vo0 .tick-dot:where(.svelte-1fv2vo0){background:var(--color-dream-glow);border-color:#fff;box-shadow:0 0 0 3px #c084fc4d,0 0 14px var(--color-dream);transform:scale(1.3)}.tick.active.svelte-1fv2vo0{color:var(--color-dream-glow);font-weight:600}.tick-label.svelte-1fv2vo0{white-space:nowrap}.step-btn.svelte-1fv2vo0{width:28px;height:28px;border-radius:6px;background:#6366f11a;border:1px solid rgba(99,102,241,.2);color:var(--color-synapse-glow);cursor:pointer;transition:all .18s ease;font-size:11px}.step-btn.svelte-1fv2vo0:hover:not(:disabled){background:#6366f133;transform:translateY(-1px)}.step-btn.svelte-1fv2vo0:disabled{opacity:.35;cursor:not-allowed}.insights-scroll.svelte-1fv2vo0{max-height:520px;overflow-y:auto;padding-right:4px}.stat-cell.svelte-1fv2vo0{padding:.5rem .75rem;border-left:2px solid rgba(168,85,247,.3)}.stat-value.svelte-1fv2vo0{font-family:var(--font-mono);font-size:1.25rem;font-weight:700;color:var(--color-bright);font-variant-numeric:tabular-nums;line-height:1.1}.stat-label.svelte-1fv2vo0{font-size:10px;color:var(--color-dim);text-transform:uppercase;letter-spacing:.1em;margin-top:2px} diff --git a/apps/dashboard/build/_app/immutable/assets/6.BSSBWVKL.css.br b/apps/dashboard/build/_app/immutable/assets/6.BSSBWVKL.css.br new file mode 100644 index 0000000..1e5f381 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/assets/6.BSSBWVKL.css.br differ diff --git a/apps/dashboard/build/_app/immutable/assets/6.BSSBWVKL.css.gz b/apps/dashboard/build/_app/immutable/assets/6.BSSBWVKL.css.gz new file mode 100644 index 0000000..9ca84bb Binary files /dev/null and b/apps/dashboard/build/_app/immutable/assets/6.BSSBWVKL.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/assets/6.DQ_AfUnN.css.gz b/apps/dashboard/build/_app/immutable/assets/6.DQ_AfUnN.css.gz deleted file mode 100644 index f973c72..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/6.DQ_AfUnN.css.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/7.CCrNEDd3.css b/apps/dashboard/build/_app/immutable/assets/7.CCrNEDd3.css new file mode 100644 index 0000000..985879a --- /dev/null +++ b/apps/dashboard/build/_app/immutable/assets/7.CCrNEDd3.css @@ -0,0 +1 @@ +@keyframes svelte-1uyjqky-fadeSlide{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}} diff --git a/apps/dashboard/build/_app/immutable/assets/7.CCrNEDd3.css.br b/apps/dashboard/build/_app/immutable/assets/7.CCrNEDd3.css.br new file mode 100644 index 0000000..f233cae Binary files /dev/null and b/apps/dashboard/build/_app/immutable/assets/7.CCrNEDd3.css.br differ diff --git a/apps/dashboard/build/_app/immutable/assets/7.CCrNEDd3.css.gz b/apps/dashboard/build/_app/immutable/assets/7.CCrNEDd3.css.gz new file mode 100644 index 0000000..c8d6d43 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/assets/7.CCrNEDd3.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/assets/7.F0TwMZ5M.css.br b/apps/dashboard/build/_app/immutable/assets/7.F0TwMZ5M.css.br deleted file mode 100644 index 0bb3266..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/7.F0TwMZ5M.css.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/7.F0TwMZ5M.css.gz b/apps/dashboard/build/_app/immutable/assets/7.F0TwMZ5M.css.gz deleted file mode 100644 index 3f3c922..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/7.F0TwMZ5M.css.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/9.BBx09UGv.css b/apps/dashboard/build/_app/immutable/assets/9.BBx09UGv.css new file mode 100644 index 0000000..966b434 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/assets/9.BBx09UGv.css @@ -0,0 +1 @@ +@keyframes svelte-1n9p0vm-fade-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.animate-fade-in.svelte-1n9p0vm{animation:svelte-1n9p0vm-fade-in .3s ease-out} diff --git a/apps/dashboard/build/_app/immutable/assets/9.BBx09UGv.css.br b/apps/dashboard/build/_app/immutable/assets/9.BBx09UGv.css.br new file mode 100644 index 0000000..51ed7a8 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/assets/9.BBx09UGv.css.br differ diff --git a/apps/dashboard/build/_app/immutable/assets/9.BBx09UGv.css.gz b/apps/dashboard/build/_app/immutable/assets/9.BBx09UGv.css.gz new file mode 100644 index 0000000..647c7ec Binary files /dev/null and b/apps/dashboard/build/_app/immutable/assets/9.BBx09UGv.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/assets/Dropdown.C2Z-7Phd.css b/apps/dashboard/build/_app/immutable/assets/Dropdown.C2Z-7Phd.css deleted file mode 100644 index 3466628..0000000 --- a/apps/dashboard/build/_app/immutable/assets/Dropdown.C2Z-7Phd.css +++ /dev/null @@ -1 +0,0 @@ -.dd.svelte-1fd3ybn{position:relative;display:inline-flex;flex-direction:column;gap:.3rem}.dd-label.svelte-1fd3ybn{font-size:.65rem;text-transform:uppercase;letter-spacing:.08em;color:var(--color-muted);padding-left:.15rem}.dd-trigger.svelte-1fd3ybn{display:inline-flex;align-items:center;gap:.5rem;padding:.55rem .7rem .55rem .8rem;min-width:9rem;background:#ffffff08;border:1px solid rgba(99,102,241,.12);border-radius:.75rem;color:var(--color-text);font-size:.8rem;font-family:inherit;cursor:pointer;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);transition:border-color .2s ease,background .2s ease,box-shadow .2s ease}.dd-trigger.svelte-1fd3ybn:hover{border-color:#6366f14d;background:#ffffff0d}.dd-trigger.svelte-1fd3ybn:focus-visible,.dd-trigger.dd-open.svelte-1fd3ybn{outline:none;border-color:#6366f180;box-shadow:0 0 0 3px #6366f11f}.dd-trigger-icon.svelte-1fd3ybn{color:var(--color-synapse-glow);display:inline-flex}.dd-value.svelte-1fd3ybn{flex:1;text-align:left;display:inline-flex;align-items:center;gap:.45rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dd-placeholder.svelte-1fd3ybn{color:var(--color-muted)}.dd-dot.svelte-1fd3ybn{width:.5rem;height:.5rem;border-radius:50%;flex-shrink:0;box-shadow:0 0 6px currentColor}.dd-chevron.svelte-1fd3ybn{color:var(--color-dim);display:inline-flex;transition:transform .25s cubic-bezier(.34,1.56,.64,1)}.dd-chevron-open.svelte-1fd3ybn{transform:rotate(180deg);color:var(--color-synapse-glow)}.dd-menu.svelte-1fd3ybn{position:absolute;top:calc(100% + .4rem);left:0;z-index:60;min-width:100%;max-height:18rem;overflow-y:auto;padding:.35rem;border-radius:.85rem;transform-origin:top center}@media not (prefers-reduced-motion:reduce){.dd-menu.svelte-1fd3ybn{animation:svelte-1fd3ybn-dd-pop .18s cubic-bezier(.34,1.56,.64,1)}@keyframes svelte-1fd3ybn-dd-pop{0%{opacity:0;transform:translateY(-6px) scale(.96)}to{opacity:1;transform:translateY(0) scale(1)}}}.dd-option.svelte-1fd3ybn{width:100%;display:flex;align-items:center;gap:.5rem;padding:.5rem .6rem;border:none;background:transparent;color:var(--color-dim);font-size:.8rem;font-family:inherit;text-align:left;border-radius:.6rem;cursor:pointer;transition:background .12s ease,color .12s ease}.dd-active.svelte-1fd3ybn{background:#6366f124;color:var(--color-text)}.dd-selected.svelte-1fd3ybn{color:var(--color-synapse-glow)}.dd-opt-icon.svelte-1fd3ybn{color:var(--color-dim);display:inline-flex}.dd-active.svelte-1fd3ybn .dd-opt-icon:where(.svelte-1fd3ybn){color:var(--color-synapse-glow)}.dd-opt-label.svelte-1fd3ybn{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dd-badge.svelte-1fd3ybn{font-size:.65rem;font-variant-numeric:tabular-nums;color:var(--color-muted);background:#ffffff0d;padding:.05rem .4rem;border-radius:.4rem}.dd-check.svelte-1fd3ybn{color:var(--color-synapse-glow);display:inline-flex} diff --git a/apps/dashboard/build/_app/immutable/assets/Dropdown.C2Z-7Phd.css.br b/apps/dashboard/build/_app/immutable/assets/Dropdown.C2Z-7Phd.css.br deleted file mode 100644 index 34f3906..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/Dropdown.C2Z-7Phd.css.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/Dropdown.C2Z-7Phd.css.gz b/apps/dashboard/build/_app/immutable/assets/Dropdown.C2Z-7Phd.css.gz deleted file mode 100644 index e21b4b8..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/Dropdown.C2Z-7Phd.css.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/Icon.tTjeJXhC.css b/apps/dashboard/build/_app/immutable/assets/Icon.tTjeJXhC.css deleted file mode 100644 index ae9f1db..0000000 --- a/apps/dashboard/build/_app/immutable/assets/Icon.tTjeJXhC.css +++ /dev/null @@ -1 +0,0 @@ -.vestige-icon.svelte-1eqehiz{display:inline-block;flex-shrink:0;vertical-align:middle;overflow:visible}@media not (prefers-reduced-motion:reduce){.vestige-icon-draw.svelte-1eqehiz path,.vestige-icon-draw.svelte-1eqehiz circle,.vestige-icon-draw.svelte-1eqehiz rect{stroke-dasharray:64;stroke-dashoffset:64;animation:svelte-1eqehiz-icon-draw .7s cubic-bezier(.65,0,.35,1) forwards}@keyframes svelte-1eqehiz-icon-draw{to{stroke-dashoffset:0}}} diff --git a/apps/dashboard/build/_app/immutable/assets/Icon.tTjeJXhC.css.br b/apps/dashboard/build/_app/immutable/assets/Icon.tTjeJXhC.css.br deleted file mode 100644 index 468287b..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/Icon.tTjeJXhC.css.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/Icon.tTjeJXhC.css.gz b/apps/dashboard/build/_app/immutable/assets/Icon.tTjeJXhC.css.gz deleted file mode 100644 index dbe4663..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/Icon.tTjeJXhC.css.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/PageHeader.Dmxpik8H.css b/apps/dashboard/build/_app/immutable/assets/PageHeader.Dmxpik8H.css deleted file mode 100644 index 180e2a9..0000000 --- a/apps/dashboard/build/_app/immutable/assets/PageHeader.Dmxpik8H.css +++ /dev/null @@ -1 +0,0 @@ -.header-tile.svelte-162svzm:after{content:"";position:absolute;top:-1px;right:-1px;bottom:-1px;left:-1px;border-radius:inherit;box-shadow:0 0 18px -2px currentColor;opacity:.35;pointer-events:none}@media not (prefers-reduced-motion:reduce){.header-tile.svelte-162svzm:after{animation:svelte-162svzm-tile-glow 4s ease-in-out infinite}@keyframes svelte-162svzm-tile-glow{0%,to{opacity:.22}50%{opacity:.5}}}.text-balance.svelte-162svzm{text-wrap:balance}.text-pretty.svelte-162svzm{text-wrap:pretty} diff --git a/apps/dashboard/build/_app/immutable/assets/PageHeader.Dmxpik8H.css.br b/apps/dashboard/build/_app/immutable/assets/PageHeader.Dmxpik8H.css.br deleted file mode 100644 index 417d6c0..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/PageHeader.Dmxpik8H.css.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/assets/PageHeader.Dmxpik8H.css.gz b/apps/dashboard/build/_app/immutable/assets/PageHeader.Dmxpik8H.css.gz deleted file mode 100644 index fb7c3df..0000000 Binary files a/apps/dashboard/build/_app/immutable/assets/PageHeader.Dmxpik8H.css.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/60_R_Vbt.js b/apps/dashboard/build/_app/immutable/chunks/60_R_Vbt.js deleted file mode 100644 index df354f9..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/60_R_Vbt.js +++ /dev/null @@ -1,2 +0,0 @@ -import{D as z,q as dr,aD as sr,G as A,L as U,N as gr,T as pr,g as m,U as hr,W as _r,X as x,K,M as G,I as Er,aE as Ar,aF as y,w as Sr,aG as b,$ as q,aH as Tr,a1 as Nr,ao as br,z as Ir,aI as V,aJ as Mr,aK as Or,ac as Cr,aL as rr,aM as Rr,Y as ur,_ as or,aN as P,R as lr,aO as Lr,aP as wr,aQ as Hr,Z as kr,J as Dr,aR as Fr,aS as Gr,aT as zr,aU as Ur,aV as tr,aW as Kr}from"./wpu9U-D0.js";function jr(r,e){return e}function Pr(r,e,f){for(var a=[],n=e.length,s,u=e.length,v=0;v{if(s){if(s.pending.delete(g),s.done.add(g),s.pending.size===0){var t=r.outrogroups;B(V(s.done)),t.delete(s),t.size===0&&(r.outrogroups=null)}}else u-=1},!1)}if(u===0){var o=a.length===0&&f!==null;if(o){var d=f,l=d.parentNode;Hr(l),l.append(d),r.items.clear()}B(e,!o)}else s={pending:new Set(e),done:new Set},(r.outrogroups??(r.outrogroups=new Set)).add(s)}function B(r,e=!0){for(var f=0;f{var c=f();return Ir(c)?c:c==null?[]:V(c)}),t,p=!0;function S(){i.fallback=l,Yr(i,t,u,e,a),l!==null&&(t.length===0?(l.f&b)===0?ur(l):(l.f^=b,k(l,null,u)):or(l,()=>{l=null}))}var T=dr(()=>{t=m(g);var c=t.length;let C=!1;if(A){var R=hr(u)===_r;R!==(c===0)&&(u=x(),U(u),K(!1),C=!0)}for(var _=new Set,M=Sr,L=Nr(),h=0;hs(u)):(l=q(()=>s(er??(er=z()))),l.f|=b)),c>_.size&&Tr(),A&&c>0&&U(x()),!p)if(L){for(const[D,F]of v)_.has(D)||M.skip_effect(F.e);M.oncommit(S),M.ondiscard(()=>{})}else S();C&&K(!0),m(g)}),i={effect:T,items:v,outrogroups:null,fallback:l};p=!1,A&&(u=G)}function H(r){for(;r!==null&&(r.f&Lr)===0;)r=r.next;return r}function Yr(r,e,f,a,n){var E,D,F,X,J,W,$,Q,Z;var s=(a&wr)!==0,u=e.length,v=r.items,o=H(r.effect.first),d,l=null,g,t=[],p=[],S,T,i,c;if(s)for(c=0;c0){var w=(a&sr)!==0&&u===0?f:null;if(s){for(c=0;c{var N,j;if(g!==void 0)for(i of g)(j=(N=i.nodes)==null?void 0:N.a)==null||j.apply()})}function qr(r,e,f,a,n,s,u,v){var o=(u&Mr)!==0?(u&Or)===0?Cr(f,!1,!1):rr(f):null,d=(u&Rr)!==0?rr(n):null;return{v:o,i:d,e:q(()=>(s(e,o??f,d??n,v),()=>{r.delete(a)}))}}function k(r,e,f){if(r.nodes)for(var a=r.nodes.start,n=r.nodes.end,s=e&&(e.f&b)===0?e.nodes.start:f;a!==null;){var u=Dr(a);if(s.before(a),a===n)return;a=u}}function I(r,e,f){e===null?r.effect.first=f:e.next=f,f===null?r.effect.last=e:f.prev=e}function cr(r){var e,f,a="";if(typeof r=="string"||typeof r=="number")a+=r;else if(typeof r=="object")if(Array.isArray(r)){var n=r.length;for(e=0;e=0;){var v=u+s;(u===0||fr.includes(a[u-1]))&&(v===a.length||fr.includes(a[v]))?a=(u===0?"":a.substring(0,u))+a.substring(v+1):u=v}}return a===""?null:a}function ar(r,e=!1){var f=e?" !important;":";",a="";for(var n of Object.keys(r)){var s=r[n];s!=null&&s!==""&&(a+=" "+n+": "+s+f)}return a}function Y(r){return r[0]!=="-"||r[1]!=="-"?r.toLowerCase():r}function yr(r,e){if(e){var f="",a,n;if(Array.isArray(e)?(a=e[0],n=e[1]):a=e,r){r=String(r).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var s=!1,u=0,v=!1,o=[];a&&o.push(...Object.keys(a).map(Y)),n&&o.push(...Object.keys(n).map(Y));var d=0,l=-1;const T=r.length;for(var g=0;g{if(!e){if(e=!0,r.hasAttribute("value")){var a=r.value;ir(r,"value",null),r.value=a}if(r.hasAttribute("checked")){var n=r.checked;ir(r,"checked",null),r.checked=n}}};r.__on_r=f,lr(f),Kr()}}function fe(r,e){var f=vr(r);f.value===(f.value=e??void 0)||r.value===e&&(e!==0||r.nodeName!==$r)||(r.value=e??"")}function ir(r,e,f,a){var n=vr(r);A&&(n[e]=r.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&r.nodeName===Wr)||n[e]!==(n[e]=f)&&(e==="loading"&&(r[Fr]=f),f==null?r.removeAttribute(e):typeof f!="string"&&Qr(r).includes(e)?r[e]=f:r.setAttribute(e,f))}function vr(r){return r.__attributes??(r.__attributes={[Xr]:r.nodeName.includes("-"),[Jr]:r.namespaceURI===Gr})}var nr=new Map;function Qr(r){var e=r.getAttribute("is")||r.nodeName,f=nr.get(e);if(f)return f;nr.set(e,f=[]);for(var a,n=r,s=Element.prototype;s!==n;){a=Ur(n);for(var u in a)a[u].set&&f.push(u);n=zr(n)}return f}export{ir as a,fe as b,xr as c,mr as e,jr as i,ee as r,re as s,yr as t}; diff --git a/apps/dashboard/build/_app/immutable/chunks/60_R_Vbt.js.br b/apps/dashboard/build/_app/immutable/chunks/60_R_Vbt.js.br deleted file mode 100644 index 8810358..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/60_R_Vbt.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/60_R_Vbt.js.gz b/apps/dashboard/build/_app/immutable/chunks/60_R_Vbt.js.gz deleted file mode 100644 index 2795bf5..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/60_R_Vbt.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/A7po6GxK.js b/apps/dashboard/build/_app/immutable/chunks/A7po6GxK.js new file mode 100644 index 0000000..8840e85 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/A7po6GxK.js @@ -0,0 +1 @@ +import{a1 as u,a2 as v,a3 as h,N as i,a4 as g,a5 as f,Y as A,a6 as S}from"./CpWkWWOo.js";const N=Symbol("is custom element"),p=Symbol("is html"),T=f?"link":"LINK",E=f?"progress":"PROGRESS";function k(r){if(i){var s=!1,a=()=>{if(!s){if(s=!0,r.hasAttribute("value")){var e=r.value;_(r,"value",null),r.value=e}if(r.hasAttribute("checked")){var o=r.checked;_(r,"checked",null),r.checked=o}}};r.__on_r=a,A(a),S()}}function l(r,s){var a=d(r);a.value===(a.value=s??void 0)||r.value===s&&(s!==0||r.nodeName!==E)||(r.value=s??"")}function _(r,s,a,e){var o=d(r);i&&(o[s]=r.getAttribute(s),s==="src"||s==="srcset"||s==="href"&&r.nodeName===T)||o[s]!==(o[s]=a)&&(s==="loading"&&(r[u]=a),a==null?r.removeAttribute(s):typeof a!="string"&&L(r).includes(s)?r[s]=a:r.setAttribute(s,a))}function d(r){return r.__attributes??(r.__attributes={[N]:r.nodeName.includes("-"),[p]:r.namespaceURI===v})}var c=new Map;function L(r){var s=r.getAttribute("is")||r.nodeName,a=c.get(s);if(a)return a;c.set(s,a=[]);for(var e,o=r,n=Element.prototype;n!==o;){e=g(o);for(var t in e)e[t].set&&a.push(t);o=h(o)}return a}export{l as a,k as r,_ as s}; diff --git a/apps/dashboard/build/_app/immutable/chunks/A7po6GxK.js.br b/apps/dashboard/build/_app/immutable/chunks/A7po6GxK.js.br new file mode 100644 index 0000000..fe4ef81 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/A7po6GxK.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/A7po6GxK.js.gz b/apps/dashboard/build/_app/immutable/chunks/A7po6GxK.js.gz new file mode 100644 index 0000000..7883896 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/A7po6GxK.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/B4yTwGkE.js b/apps/dashboard/build/_app/immutable/chunks/B4yTwGkE.js new file mode 100644 index 0000000..964c791 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/B4yTwGkE.js @@ -0,0 +1 @@ +import{b as T,N as o,ab as b,E as h,ac as R,ax as p,ad as A,ae as E,T as g,R as l}from"./CpWkWWOo.js";import{B as v}from"./DdEqwvdI.js";function m(t,c,u=!1){o&&b();var n=new v(t),_=u?h:0;function i(a,r){if(o){const e=R(t);var s;if(e===p?s=0:e===A?s=!1:s=parseInt(e.substring(1)),a!==s){var f=E();g(f),n.anchor=f,l(!1),n.ensure(a,r),l(!0);return}}n.ensure(a,r)}T(()=>{var a=!1;c((r,s=0)=>{a=!0,i(s,r)}),a||i(!1,null)},_)}export{m as i}; diff --git a/apps/dashboard/build/_app/immutable/chunks/B4yTwGkE.js.br b/apps/dashboard/build/_app/immutable/chunks/B4yTwGkE.js.br new file mode 100644 index 0000000..ca1901d Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/B4yTwGkE.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/B4yTwGkE.js.gz b/apps/dashboard/build/_app/immutable/chunks/B4yTwGkE.js.gz new file mode 100644 index 0000000..4c37878 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/B4yTwGkE.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BHDZZvku.js b/apps/dashboard/build/_app/immutable/chunks/BHDZZvku.js deleted file mode 100644 index 0cc8663..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/BHDZZvku.js +++ /dev/null @@ -1,2 +0,0 @@ -import"./Bzak7iHL.js";import{t as h,a as o,j as f,e as a,r as s,h as c}from"./wpu9U-D0.js";import{s as p}from"./D8mhvFt8.js";import{s as k}from"./LDOJP_6N.js";import{i as _}from"./DKve45Wd.js";import{s as I}from"./60_R_Vbt.js";import{p as P}from"./ByYB047u.js";import{I as H}from"./D7A-gG4Z.js";var q=f('

'),A=f('
'),B=f('

');function M(u,e){let v=P(e,"accent",3,"synapse");var l=B(),m=a(l),i=a(m),b=a(i);H(b,{get name(){return e.icon},size:22,draw:!0}),s(i);var x=c(i,2),d=a(x),g=a(d,!0);s(d);var z=c(d,2);{var w=t=>{var r=q(),n=a(r,!0);s(r),h(()=>p(n,e.subtitle)),o(t,r)};_(z,t=>{e.subtitle&&t(w)})}s(x),s(m);var y=c(m,2);{var j=t=>{var r=A(),n=a(r);k(n,()=>e.children),s(r),o(t,r)};_(y,t=>{e.children&&t(j)})}s(l),h(()=>{I(i,1,`header-tile relative flex items-center justify-center w-11 h-11 rounded-xl shrink-0 - bg-${v()??""}/12 border border-${v()??""}/25 text-${v()??""}-glow`,"svelte-162svzm"),p(g,e.title)}),o(u,l)}export{M as P}; diff --git a/apps/dashboard/build/_app/immutable/chunks/BHDZZvku.js.br b/apps/dashboard/build/_app/immutable/chunks/BHDZZvku.js.br deleted file mode 100644 index 3474420..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/BHDZZvku.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BHDZZvku.js.gz b/apps/dashboard/build/_app/immutable/chunks/BHDZZvku.js.gz deleted file mode 100644 index 13f4a03..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/BHDZZvku.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BHGLDPij.js b/apps/dashboard/build/_app/immutable/chunks/BHGLDPij.js new file mode 100644 index 0000000..2ce4954 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/BHGLDPij.js @@ -0,0 +1 @@ +import{$ as J,bd as ee}from"./CpWkWWOo.js";import{w as ae}from"./BeMFXnHE.js";import{c as ne,H as N,N as B,r as gt,i as _t,b as L,s as C,p as x,n as ft,f as $t,g as ut,a as X,d as it,S as Nt,P as re,e as oe,h as se,o as Dt,j as q,k as ie,l as qt,m as ce,q as le,t as Kt,u as Pt,v as fe}from"./BskPcZf7.js";class wt{constructor(a,e){this.status=a,typeof e=="string"?this.body={message:e}:e?this.body=e:this.body={message:`Error: ${a}`}}toString(){return JSON.stringify(this.body)}}class vt{constructor(a,e){this.status=a,this.location=e}}class yt extends Error{constructor(a,e,r){super(r),this.status=a,this.text=e}}const ue=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function he(t){const a=[];return{pattern:t==="/"?/^\/$/:new RegExp(`^${pe(t).map(r=>{const n=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(n)return a.push({name:n[1],matcher:n[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const o=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(o)return a.push({name:o[1],matcher:o[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const s=r.split(/\[(.+?)\](?!\])/);return"/"+s.map((c,l)=>{if(l%2){if(c.startsWith("x+"))return ct(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return ct(String.fromCharCode(...c.slice(2).split("-").map(_=>parseInt(_,16))));const h=ue.exec(c),[,u,w,f,d]=h;return a.push({name:f,matcher:d,optional:!!u,rest:!!w,chained:w?l===1&&s[0]==="":!1}),w?"([^]*?)":u?"([^/]*)?":"([^/]+?)"}return ct(c)}).join("")}).join("")}/?$`),params:a}}function de(t){return t!==""&&!/^\([^)]+\)$/.test(t)}function pe(t){return t.slice(1).split("/").filter(de)}function me(t,a,e){const r={},n=t.slice(1),o=n.filter(i=>i!==void 0);let s=0;for(let i=0;ih).join("/"),s=0),l===void 0)if(c.rest)l="";else continue;if(!c.matcher||e[c.matcher](l)){r[c.name]=l;const h=a[i+1],u=n[i+1];h&&!h.rest&&h.optional&&u&&c.chained&&(s=0),!h&&!u&&Object.keys(r).length===o.length&&(s=0);continue}if(c.optional&&c.chained){s++;continue}return}if(!s)return r}function ct(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function ge({nodes:t,server_loads:a,dictionary:e,matchers:r}){const n=new Set(a);return Object.entries(e).map(([i,[c,l,h]])=>{const{pattern:u,params:w}=he(i),f={id:i,exec:d=>{const _=u.exec(d);if(_)return me(_,w,r)},errors:[1,...h||[]].map(d=>t[d]),layouts:[0,...l||[]].map(s),leaf:o(c)};return f.errors.length=f.layouts.length=Math.max(f.errors.length,f.layouts.length),f});function o(i){const c=i<0;return c&&(i=~i),[c,t[i]]}function s(i){return i===void 0?i:[n.has(i),t[i]]}}function Ft(t,a=JSON.parse){try{return a(sessionStorage[t])}catch{}}function It(t,a,e=JSON.stringify){const r=e(a);try{sessionStorage[t]=r}catch{}}function _e(t){return t.filter(a=>a!=null)}function bt(t){return t instanceof wt||t instanceof yt?t.status:500}function we(t){return t instanceof yt?t.text:"Internal Error"}const ve=new Set(["icon","shortcut icon","apple-touch-icon"]),I=Ft(Kt)??{},M=Ft(qt)??{},P={url:Pt({}),page:Pt({}),navigating:ae(null),updated:ne()};function Et(t){I[t]=C()}function ye(t,a){let e=t+1;for(;I[e];)delete I[e],e+=1;for(e=a+1;M[e];)delete M[e],e+=1}function V(t,a=!1){return a?location.replace(t.href):location.href=t.href,new Promise(()=>{})}async function Bt(){if("serviceWorker"in navigator){const t=await navigator.serviceWorker.getRegistration(L||"/");t&&await t.update()}}function Tt(){}let kt,ht,Q,U,dt,E;const Z=[],tt=[];let v=null;function pt(){var t;(t=v==null?void 0:v.fork)==null||t.then(a=>a==null?void 0:a.discard()),v=null}const G=new Map,Mt=new Set,be=new Set,F=new Set;let g={branch:[],error:null,url:null},Vt=!1,et=!1,Ot=!0,H=!1,K=!1,Ht=!1,St=!1,Yt,b,R,O;const at=new Set,Ct=new Map;async function Fe(t,a,e){var o,s,i,c,l;(o=globalThis.__sveltekit_10kbxme)!=null&&o.data&&globalThis.__sveltekit_10kbxme.data,document.URL!==location.href&&(location.href=location.href),E=t,await((i=(s=t.hooks).init)==null?void 0:i.call(s)),kt=ge(t),U=document.documentElement,dt=a,ht=t.nodes[0],Q=t.nodes[1],ht(),Q(),b=(c=history.state)==null?void 0:c[N],R=(l=history.state)==null?void 0:l[B],b||(b=R=Date.now(),history.replaceState({...history.state,[N]:b,[B]:R},""));const r=I[b];function n(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}e?(n(),await Ce(dt,e)):(await D({type:"enter",url:gt(E.hash?Ne(new URL(location.href)):location.href),replace_state:!0}),n()),Oe()}function Ee(){Z.length=0,St=!1}function zt(t){tt.some(a=>a==null?void 0:a.snapshot)&&(M[t]=tt.map(a=>{var e;return(e=a==null?void 0:a.snapshot)==null?void 0:e.capture()}))}function Wt(t){var a;(a=M[t])==null||a.forEach((e,r)=>{var n,o;(o=(n=tt[r])==null?void 0:n.snapshot)==null||o.restore(e)})}function jt(){Et(b),It(Kt,I),zt(R),It(qt,M)}async function Gt(t,a,e,r){let n;a.invalidateAll&&pt(),await D({type:"goto",url:gt(t),keepfocus:a.keepFocus,noscroll:a.noScroll,replace_state:a.replaceState,state:a.state,redirect_count:e,nav_token:r,accept:()=>{a.invalidateAll&&(St=!0,n=[...Ct.keys()]),a.invalidate&&a.invalidate.forEach(Te)}}),a.invalidateAll&&J().then(J).then(()=>{Ct.forEach(({resource:o},s)=>{var i;n!=null&&n.includes(s)&&((i=o.refresh)==null||i.call(o))})})}async function ke(t){if(t.id!==(v==null?void 0:v.id)){pt();const a={};at.add(a),v={id:t.id,token:a,promise:Xt({...t,preload:a}).then(e=>(at.delete(a),e.type==="loaded"&&e.state.error&&pt(),e)),fork:null}}return v.promise}async function lt(t){var e;const a=(e=await ot(t,!1))==null?void 0:e.route;a&&await Promise.all([...a.layouts,a.leaf].filter(Boolean).map(r=>r[1]()))}async function Jt(t,a,e){var n;g=t.state;const r=document.querySelector("style[data-sveltekit]");if(r&&r.remove(),Object.assign(x,t.props.page),Yt=new E.root({target:a,props:{...t.props,stores:P,components:tt},hydrate:e,sync:!1}),await Promise.resolve(),Wt(R),e){const o={from:null,to:{params:g.params,route:{id:((n=g.route)==null?void 0:n.id)??null},url:new URL(location.href),scroll:I[b]??C()},willUnload:!1,type:"enter",complete:Promise.resolve()};F.forEach(s=>s(o))}et=!0}function nt({url:t,params:a,branch:e,status:r,error:n,route:o,form:s}){let i="never";if(L&&(t.pathname===L||t.pathname===L+"/"))i="always";else for(const f of e)(f==null?void 0:f.slash)!==void 0&&(i=f.slash);t.pathname=se(t.pathname,i),t.search=t.search;const c={type:"loaded",state:{url:t,params:a,branch:e,error:n,route:o},props:{constructors:_e(e).map(f=>f.node.component),page:At(x)}};s!==void 0&&(c.props.form=s);let l={},h=!x,u=0;for(let f=0;fi(new URL(s))))return!0;return!1}function xt(t,a){return(t==null?void 0:t.type)==="data"?t:(t==null?void 0:t.type)==="skip"?a??null:null}function xe(t,a){if(!t)return new Set(a.searchParams.keys());const e=new Set([...t.searchParams.keys(),...a.searchParams.keys()]);for(const r of e){const n=t.searchParams.getAll(r),o=a.searchParams.getAll(r);n.every(s=>o.includes(s))&&o.every(s=>n.includes(s))&&e.delete(r)}return e}function Le({error:t,url:a,route:e,params:r}){return{type:"loaded",state:{error:t,url:a,route:e,params:r,branch:[]},props:{page:At(x),constructors:[]}}}async function Xt({id:t,invalidating:a,url:e,params:r,route:n,preload:o}){if((v==null?void 0:v.id)===t)return at.delete(v.token),v.promise;const{errors:s,layouts:i,leaf:c}=n,l=[...i,c];s.forEach(m=>m==null?void 0:m().catch(()=>{})),l.forEach(m=>m==null?void 0:m[1]().catch(()=>{}));const h=g.url?t!==rt(g.url):!1,u=g.route?n.id!==g.route.id:!1,w=xe(g.url,e);let f=!1;const d=l.map(async(m,p)=>{var A;if(!m)return;const y=g.branch[p];return m[1]===(y==null?void 0:y.loader)&&!Re(f,u,h,w,(A=y.universal)==null?void 0:A.uses,r)?y:(f=!0,Rt({loader:m[1],url:e,params:r,route:n,parent:async()=>{var z;const T={};for(let j=0;j{});const _=[];for(let m=0;mPromise.resolve({}),server_data_node:xt(o)}),i={node:await Q(),loader:Q,universal:null,server:null,data:null};return nt({url:e,params:n,branch:[s,i],status:t,error:a,route:null})}catch(s){if(s instanceof vt)return Gt(new URL(s.location,location.href),{},0);throw s}}async function Ae(t){const a=t.href;if(G.has(a))return G.get(a);let e;try{const r=(async()=>{let n=await E.hooks.reroute({url:new URL(t),fetch:async(o,s)=>Se(o,s,t).promise})??t;if(typeof n=="string"){const o=new URL(t);E.hash?o.hash=n:o.pathname=n,n=o}return n})();G.set(a,r),e=await r}catch{G.delete(a);return}return e}async function ot(t,a){if(t&&!_t(t,L,E.hash)){const e=await Ae(t);if(!e)return;const r=Pe(e);for(const n of kt){const o=n.exec(r);if(o)return{id:rt(t),invalidating:a,route:n,params:oe(o),url:t}}}}function Pe(t){return ie(E.hash?t.hash.replace(/^#/,"").replace(/[?#].+/,""):t.pathname.slice(L.length))||"/"}function rt(t){return(E.hash?t.hash.replace(/^#/,""):t.pathname)+t.search}function Qt({url:t,type:a,intent:e,delta:r,event:n,scroll:o}){let s=!1;const i=Ut(g,e,t,a,o??null);r!==void 0&&(i.navigation.delta=r),n!==void 0&&(i.navigation.event=n);const c={...i.navigation,cancel:()=>{s=!0,i.reject(new Error("navigation cancelled"))}};return H||Mt.forEach(l=>l(c)),s?null:i}async function D({type:t,url:a,popped:e,keepfocus:r,noscroll:n,replace_state:o,state:s={},redirect_count:i=0,nav_token:c={},accept:l=Tt,block:h=Tt,event:u}){var j;const w=O;O=c;const f=await ot(a,!1),d=t==="enter"?Ut(g,f,a,t):Qt({url:a,type:t,delta:e==null?void 0:e.delta,intent:f,scroll:e==null?void 0:e.scroll,event:u});if(!d){h(),O===c&&(O=w);return}const _=b,m=R;l(),H=!0,et&&d.navigation.type!=="enter"&&P.navigating.set(ft.current=d.navigation);let p=f&&await Xt(f);if(!p){if(_t(a,L,E.hash))return await V(a,o);p=await Zt(a,{id:null},await Y(new yt(404,"Not Found",`Not found: ${a.pathname}`),{url:a,params:{},route:{id:null}}),404,o)}if(a=(f==null?void 0:f.url)||a,O!==c)return d.reject(new Error("navigation aborted")),!1;if(p.type==="redirect"){if(i<20){await D({type:t,url:new URL(p.location,a),popped:e,keepfocus:r,noscroll:n,replace_state:o,state:s,redirect_count:i+1,nav_token:c}),d.fulfil(void 0);return}p=await Lt({status:500,error:await Y(new Error("Redirect loop"),{url:a,params:{},route:{id:null}}),url:a,route:{id:null}})}else p.props.page.status>=400&&await P.updated.check()&&(await Bt(),await V(a,o));if(Ee(),Et(_),zt(m),p.props.page.url.pathname!==a.pathname&&(a.pathname=p.props.page.url.pathname),s=e?e.state:s,!e){const k=o?0:1,W={[N]:b+=k,[B]:R+=k,[Nt]:s};(o?history.replaceState:history.pushState).call(history,W,"",a),o||ye(b,R)}const y=f&&(v==null?void 0:v.id)===f.id?v.fork:null;v=null,p.props.page.state=s;let S;if(et){const k=(await Promise.all(Array.from(be,$=>$(d.navigation)))).filter($=>typeof $=="function");if(k.length>0){let $=function(){k.forEach(st=>{F.delete(st)})};k.push($),k.forEach(st=>{F.add(st)})}g=p.state,p.props.page&&(p.props.page.url=a);const W=y&&await y;W?S=W.commit():(Yt.$set(p.props),fe(p.props.page),S=(j=ee)==null?void 0:j()),Ht=!0}else await Jt(p,dt,!1);const{activeElement:A}=document;await S,await J(),await J();let T=null;if(Ot){const k=e?e.scroll:n?C():null;k?scrollTo(k.x,k.y):(T=a.hash&&document.getElementById(te(a)))?T.scrollIntoView():scrollTo(0,0)}const z=document.activeElement!==A&&document.activeElement!==document.body;!r&&!z&&$e(a,!T),Ot=!0,p.props.page&&Object.assign(x,p.props.page),H=!1,t==="popstate"&&Wt(R),d.fulfil(void 0),d.navigation.to&&(d.navigation.to.scroll=C()),F.forEach(k=>k(d.navigation)),P.navigating.set(ft.current=null)}async function Zt(t,a,e,r,n){return t.origin===Dt&&t.pathname===location.pathname&&!Vt?await Lt({status:r,error:e,url:t,route:a}):await V(t,n)}function Ie(){let t,a={element:void 0,href:void 0},e;U.addEventListener("mousemove",i=>{const c=i.target;clearTimeout(t),t=setTimeout(()=>{o(c,q.hover)},20)});function r(i){i.defaultPrevented||o(i.composedPath()[0],q.tap)}U.addEventListener("mousedown",r),U.addEventListener("touchstart",r,{passive:!0});const n=new IntersectionObserver(i=>{for(const c of i)c.isIntersecting&&(lt(new URL(c.target.href)),n.unobserve(c.target))},{threshold:0});async function o(i,c){const l=$t(i,U),h=l===a.element&&(l==null?void 0:l.href)===a.href&&c>=e;if(!l||h)return;const{url:u,external:w,download:f}=ut(l,L,E.hash);if(w||f)return;const d=X(l),_=u&&rt(g.url)===rt(u);if(!(d.reload||_))if(c<=d.preload_data){a={element:l,href:l.href},e=q.tap;const m=await ot(u,!1);if(!m)return;ke(m)}else c<=d.preload_code&&(a={element:l,href:l.href},e=c,lt(u))}function s(){n.disconnect();for(const i of U.querySelectorAll("a")){const{url:c,external:l,download:h}=ut(i,L,E.hash);if(l||h)continue;const u=X(i);u.reload||(u.preload_code===q.viewport&&n.observe(i),u.preload_code===q.eager&<(c))}}F.add(s),s()}function Y(t,a){if(t instanceof wt)return t.body;const e=bt(t),r=we(t);return E.hooks.handleError({error:t,event:a,status:e,message:r})??{message:r}}function Be(t,a={}){return t=new URL(gt(t)),t.origin!==Dt?Promise.reject(new Error("goto: invalid URL")):Gt(t,a,0)}function Te(t){if(typeof t=="function")Z.push(t);else{const{href:a}=new URL(t,location.href);Z.push(e=>e.href===a)}}function Oe(){var a;history.scrollRestoration="manual",addEventListener("beforeunload",e=>{let r=!1;if(jt(),!H){const n=Ut(g,void 0,null,"leave"),o={...n.navigation,cancel:()=>{r=!0,n.reject(new Error("navigation cancelled"))}};Mt.forEach(s=>s(o))}r?(e.preventDefault(),e.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&jt()}),(a=navigator.connection)!=null&&a.saveData||Ie(),U.addEventListener("click",async e=>{if(e.button||e.which!==1||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.defaultPrevented)return;const r=$t(e.composedPath()[0],U);if(!r)return;const{url:n,external:o,target:s,download:i}=ut(r,L,E.hash);if(!n)return;if(s==="_parent"||s==="_top"){if(window.parent!==window)return}else if(s&&s!=="_self")return;const c=X(r);if(!(r instanceof SVGAElement)&&n.protocol!==location.protocol&&!(n.protocol==="https:"||n.protocol==="http:")||i)return;const[h,u]=(E.hash?n.hash.replace(/^#/,""):n.href).split("#"),w=h===it(location);if(o||c.reload&&(!w||!u)){Qt({url:n,type:"link",event:e})?H=!0:e.preventDefault();return}if(u!==void 0&&w){const[,f]=g.url.href.split("#");if(f===u){if(e.preventDefault(),u===""||u==="top"&&r.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const d=r.ownerDocument.getElementById(decodeURIComponent(u));d&&(d.scrollIntoView(),d.focus())}return}if(K=!0,Et(b),t(n),!c.replace_state)return;K=!1}e.preventDefault(),await new Promise(f=>{requestAnimationFrame(()=>{setTimeout(f,0)}),setTimeout(f,100)}),await D({type:"link",url:n,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??n.href===location.href,event:e})}),U.addEventListener("submit",e=>{if(e.defaultPrevented)return;const r=HTMLFormElement.prototype.cloneNode.call(e.target),n=e.submitter;if(((n==null?void 0:n.formTarget)||r.target)==="_blank"||((n==null?void 0:n.formMethod)||r.method)!=="get")return;const i=new URL((n==null?void 0:n.hasAttribute("formaction"))&&(n==null?void 0:n.formAction)||r.action);if(_t(i,L,!1))return;const c=e.target,l=X(c);if(l.reload)return;e.preventDefault(),e.stopPropagation();const h=new FormData(c,n);i.search=new URLSearchParams(h).toString(),D({type:"form",url:i,keepfocus:l.keepfocus,noscroll:l.noscroll,replace_state:l.replace_state??i.href===location.href,event:e})}),addEventListener("popstate",async e=>{var r;if(!mt){if((r=e.state)!=null&&r[N]){const n=e.state[N];if(O={},n===b)return;const o=I[n],s=e.state[Nt]??{},i=new URL(e.state[re]??location.href),c=e.state[B],l=g.url?it(location)===it(g.url):!1;if(c===R&&(Ht||l)){s!==x.state&&(x.state=s),t(i),I[b]=C(),o&&scrollTo(o.x,o.y),b=n;return}const u=n-b;await D({type:"popstate",url:i,popped:{state:s,scroll:o,delta:u},accept:()=>{b=n,R=c},block:()=>{history.go(-u)},nav_token:O,event:e})}else if(!K){const n=new URL(location.href);t(n),E.hash&&location.reload()}}}),addEventListener("hashchange",()=>{K&&(K=!1,history.replaceState({...history.state,[N]:++b,[B]:R},"",location.href))});for(const e of document.querySelectorAll("link"))ve.has(e.rel)&&(e.href=e.href);addEventListener("pageshow",e=>{e.persisted&&P.navigating.set(ft.current=null)});function t(e){g.url=x.url=e,P.page.set(At(x)),P.page.notify()}}async function Ce(t,{status:a=200,error:e,node_ids:r,params:n,route:o,server_route:s,data:i,form:c}){Vt=!0;const l=new URL(location.href);let h;({params:n={},route:o={id:null}}=await ot(l,!1)||{}),h=kt.find(({id:f})=>f===o.id);let u,w=!0;try{const f=r.map(async(_,m)=>{const p=i[m];return p!=null&&p.uses&&(p.uses=je(p.uses)),Rt({loader:E.nodes[_],url:l,params:n,route:o,parent:async()=>{const y={};for(let S=0;S{const i=history.state;mt=!0,location.replace(new URL(`#${r}`,location.href)),history.replaceState(i,"",t),a&&scrollTo(o,s),mt=!1})}else{const o=document.body,s=o.getAttribute("tabindex");o.tabIndex=-1,o.focus({preventScroll:!0,focusVisible:!1}),s!==null?o.setAttribute("tabindex",s):o.removeAttribute("tabindex")}const n=getSelection();if(n&&n.type!=="None"){const o=[];for(let s=0;s{if(n.rangeCount===o.length){for(let s=0;s{o=u,s=w});return i.catch(()=>{}),{navigation:{from:{params:t.params,route:{id:((l=t.route)==null?void 0:l.id)??null},url:t.url,scroll:C()},to:e&&{params:(a==null?void 0:a.params)??null,route:{id:((h=a==null?void 0:a.route)==null?void 0:h.id)??null},url:e,scroll:n},willUnload:!a,type:r,complete:i},fulfil:o,reject:s}}function At(t){return{data:t.data,error:t.error,form:t.form,params:t.params,route:t.route,state:t.state,status:t.status,url:t.url}}function Ne(t){const a=new URL(t);return a.hash=decodeURIComponent(t.hash),a}function te(t){let a;if(E.hash){const[,,e]=t.hash.split("#",3);a=e??""}else a=t.hash.slice(1);return decodeURIComponent(a)}export{Fe as a,Be as g,P as s}; diff --git a/apps/dashboard/build/_app/immutable/chunks/BHGLDPij.js.br b/apps/dashboard/build/_app/immutable/chunks/BHGLDPij.js.br new file mode 100644 index 0000000..fcf3184 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/BHGLDPij.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BHGLDPij.js.gz b/apps/dashboard/build/_app/immutable/chunks/BHGLDPij.js.gz new file mode 100644 index 0000000..150db2f Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/BHGLDPij.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BKuqSeVd.js b/apps/dashboard/build/_app/immutable/chunks/BKuqSeVd.js new file mode 100644 index 0000000..e8f917c --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/BKuqSeVd.js @@ -0,0 +1,2 @@ +const e=[...` +\r\f \v\uFEFF`];function o(t,f,u){var n=t==null?"":""+t;if(f&&(n=n?n+" "+f:f),u){for(var s of Object.keys(u))if(u[s])n=n?n+" "+s:s;else if(n.length)for(var i=s.length,l=0;(l=n.indexOf(s,l))>=0;){var r=l+i;(l===0||e.includes(n[l-1]))&&(r===n.length||e.includes(n[r]))?n=(l===0?"":n.substring(0,l))+n.substring(r+1):l=r}}return n===""?null:n}function c(t,f){return t==null?null:String(t)}export{c as a,o as t}; diff --git a/apps/dashboard/build/_app/immutable/chunks/BKuqSeVd.js.br b/apps/dashboard/build/_app/immutable/chunks/BKuqSeVd.js.br new file mode 100644 index 0000000..262d659 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/BKuqSeVd.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BKuqSeVd.js.gz b/apps/dashboard/build/_app/immutable/chunks/BKuqSeVd.js.gz new file mode 100644 index 0000000..967efc3 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/BKuqSeVd.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BLadwbF7.js.br b/apps/dashboard/build/_app/immutable/chunks/BLadwbF7.js.br deleted file mode 100644 index 3022c57..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/BLadwbF7.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BLadwbF7.js.gz b/apps/dashboard/build/_app/immutable/chunks/BLadwbF7.js.gz deleted file mode 100644 index 7691181..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/BLadwbF7.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BLadwbF7.js b/apps/dashboard/build/_app/immutable/chunks/BUoSzNdg.js similarity index 76% rename from apps/dashboard/build/_app/immutable/chunks/BLadwbF7.js rename to apps/dashboard/build/_app/immutable/chunks/BUoSzNdg.js index 5a1ac32..41853ff 100644 --- a/apps/dashboard/build/_app/immutable/chunks/BLadwbF7.js +++ b/apps/dashboard/build/_app/immutable/chunks/BUoSzNdg.js @@ -1 +1 @@ -import{a2 as g,a3 as d,o as c,P as m,a4 as i,a5 as b,g as p,a6 as v,a7 as h,a8 as k}from"./wpu9U-D0.js";function x(t=!1){const a=g,e=a.l.u;if(!e)return;let f=()=>v(a.s);if(t){let n=0,s={};const _=h(()=>{let l=!1;const r=a.s;for(const o in r)r[o]!==s[o]&&(s[o]=r[o],l=!0);return l&&n++,n});f=()=>p(_)}e.b.length&&d(()=>{u(a,f),i(e.b)}),c(()=>{const n=m(()=>e.m.map(b));return()=>{for(const s of n)typeof s=="function"&&s()}}),e.a.length&&c(()=>{u(a,f),i(e.a)})}function u(t,a){if(t.l.s)for(const e of t.l.s)p(e);a()}k();export{x as i}; +import{az as g,aA as d,aB as c,v as m,aC as i,aD as b,g as p,aE as v,z as h,aF as k}from"./CpWkWWOo.js";function x(t=!1){const a=g,e=a.l.u;if(!e)return;let f=()=>v(a.s);if(t){let n=0,s={};const _=h(()=>{let l=!1;const r=a.s;for(const o in r)r[o]!==s[o]&&(s[o]=r[o],l=!0);return l&&n++,n});f=()=>p(_)}e.b.length&&d(()=>{u(a,f),i(e.b)}),c(()=>{const n=m(()=>e.m.map(b));return()=>{for(const s of n)typeof s=="function"&&s()}}),e.a.length&&c(()=>{u(a,f),i(e.a)})}function u(t,a){if(t.l.s)for(const e of t.l.s)p(e);a()}k();export{x as i}; diff --git a/apps/dashboard/build/_app/immutable/chunks/BUoSzNdg.js.br b/apps/dashboard/build/_app/immutable/chunks/BUoSzNdg.js.br new file mode 100644 index 0000000..762f929 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/BUoSzNdg.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BUoSzNdg.js.gz b/apps/dashboard/build/_app/immutable/chunks/BUoSzNdg.js.gz new file mode 100644 index 0000000..d409518 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/BUoSzNdg.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BWk3o_TN.js b/apps/dashboard/build/_app/immutable/chunks/BWk3o_TN.js deleted file mode 100644 index cd19933..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/BWk3o_TN.js +++ /dev/null @@ -1 +0,0 @@ -var B=Object.defineProperty;var g=i=>{throw TypeError(i)};var F=(i,e,s)=>e in i?B(i,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[e]=s;var w=(i,e,s)=>F(i,typeof e!="symbol"?e+"":e,s),M=(i,e,s)=>e.has(i)||g("Cannot "+s);var t=(i,e,s)=>(M(i,e,"read from private field"),s?s.call(i):e.get(i)),l=(i,e,s)=>e.has(i)?g("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,s),y=(i,e,s,a)=>(M(i,e,"write to private field"),a?a.call(i,s):e.set(i,s),s);import{w as D,Y as C,Z as k,_ as G,D as x,$ as A,G as S,M as Y,a0 as Z,a1 as $}from"./wpu9U-D0.js";var r,n,h,u,p,_,v;class z{constructor(e,s=!0){w(this,"anchor");l(this,r,new Map);l(this,n,new Map);l(this,h,new Map);l(this,u,new Set);l(this,p,!0);l(this,_,()=>{var e=D;if(t(this,r).has(e)){var s=t(this,r).get(e),a=t(this,n).get(s);if(a)C(a),t(this,u).delete(s);else{var c=t(this,h).get(s);c&&(t(this,n).set(s,c.effect),t(this,h).delete(s),c.fragment.lastChild.remove(),this.anchor.before(c.fragment),a=c.effect)}for(const[f,o]of t(this,r)){if(t(this,r).delete(f),f===e)break;const d=t(this,h).get(o);d&&(k(d.effect),t(this,h).delete(o))}for(const[f,o]of t(this,n)){if(f===s||t(this,u).has(f))continue;const d=()=>{if(Array.from(t(this,r).values()).includes(f)){var b=document.createDocumentFragment();Z(o,b),b.append(x()),t(this,h).set(f,{effect:o,fragment:b})}else k(o);t(this,u).delete(f),t(this,n).delete(f)};t(this,p)||!a?(t(this,u).add(f),G(o,d,!1)):d()}}});l(this,v,e=>{t(this,r).delete(e);const s=Array.from(t(this,r).values());for(const[a,c]of t(this,h))s.includes(a)||(k(c.effect),t(this,h).delete(a))});this.anchor=e,y(this,p,s)}ensure(e,s){var a=D,c=$();if(s&&!t(this,n).has(e)&&!t(this,h).has(e))if(c){var f=document.createDocumentFragment(),o=x();f.append(o),t(this,h).set(e,{effect:A(()=>s(o)),fragment:f})}else t(this,n).set(e,A(()=>s(this.anchor)));if(t(this,r).set(a,e),c){for(const[d,m]of t(this,n))d===e?a.unskip_effect(m):a.skip_effect(m);for(const[d,m]of t(this,h))d===e?a.unskip_effect(m.effect):a.skip_effect(m.effect);a.oncommit(t(this,_)),a.ondiscard(t(this,v))}else S&&(this.anchor=Y),t(this,_).call(this)}}r=new WeakMap,n=new WeakMap,h=new WeakMap,u=new WeakMap,p=new WeakMap,_=new WeakMap,v=new WeakMap;export{z as B}; diff --git a/apps/dashboard/build/_app/immutable/chunks/BWk3o_TN.js.br b/apps/dashboard/build/_app/immutable/chunks/BWk3o_TN.js.br deleted file mode 100644 index e3163e0..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/BWk3o_TN.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BWk3o_TN.js.gz b/apps/dashboard/build/_app/immutable/chunks/BWk3o_TN.js.gz deleted file mode 100644 index 1de713b..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/BWk3o_TN.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BZQzXWp7.js b/apps/dashboard/build/_app/immutable/chunks/BZQzXWp7.js deleted file mode 100644 index 1e262da..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/BZQzXWp7.js +++ /dev/null @@ -1,5 +0,0 @@ -import{TSL as t}from"./CfobEeQC.js";/** - * @license - * Copyright 2010-2024 Three.js Authors - * SPDX-License-Identifier: MIT - */const e=t.BRDF_GGX,n=t.BRDF_Lambert,s=t.BasicShadowFilter,r=t.Break,c=t.Continue,a=t.DFGApprox,i=t.D_GGX,l=t.Discard,m=t.EPSILON,p=t.F_Schlick,d=t.Fn,u=t.INFINITY,g=t.If,h=t.Loop,f=t.NodeShaderStage,x=t.NodeType,b=t.NodeUpdateType,w=t.NodeAccess,v=t.PCFShadowFilter,S=t.PCFSoftShadowFilter,T=t.PI,_=t.PI2,V=t.Return,y=t.Schlick_to_F0,D=t.ScriptableNodeResources,M=t.ShaderNode,F=t.TBNViewMatrix,C=t.VSMShadowFilter,I=t.V_GGX_SmithCorrelated,N=t.abs,P=t.acesFilmicToneMapping,R=t.acos,B=t.add,L=t.addNodeElement,k=t.agxToneMapping,A=t.all,G=t.alphaT,O=t.and,W=t.anisotropy,j=t.anisotropyB,U=t.anisotropyT,q=t.any,z=t.append,E=t.arrayBuffer,Z=t.asin,X=t.assign,Y=t.atan,H=t.atan2,J=t.atomicAdd,K=t.atomicAnd,Q=t.atomicFunc,$=t.atomicMax,tt=t.atomicMin,ot=t.atomicOr,et=t.atomicStore,nt=t.atomicSub,st=t.atomicXor,rt=t.attenuationColor,ct=t.attenuationDistance,at=t.attribute,it=t.attributeArray,lt=t.backgroundBlurriness,mt=t.backgroundIntensity,pt=t.backgroundRotation,dt=t.batch,ut=t.billboarding,gt=t.bitAnd,ht=t.bitNot,ft=t.bitOr,xt=t.bitXor,bt=t.bitangentGeometry,wt=t.bitangentLocal,vt=t.bitangentView,St=t.bitangentWorld,Tt=t.bitcast,_t=t.blendBurn,Vt=t.blendColor,yt=t.blendDodge,Dt=t.blendOverlay,Mt=t.blendScreen,Ft=t.blur,Ct=t.bool,It=t.buffer,Nt=t.bufferAttribute,Pt=t.bumpMap,Rt=t.burn,Bt=t.bvec2,Lt=t.bvec3,kt=t.bvec4,At=t.bypass,Gt=t.cache,Ot=t.call,Wt=t.cameraFar,jt=t.cameraNear,Ut=t.cameraNormalMatrix,qt=t.cameraPosition,zt=t.cameraProjectionMatrix,Et=t.cameraProjectionMatrixInverse,Zt=t.cameraViewMatrix,Xt=t.cameraWorldMatrix,Yt=t.cbrt,Ht=t.cdl,Jt=t.ceil,Kt=t.checker,Qt=t.cineonToneMapping,$t=t.clamp,to=t.clearcoat,oo=t.clearcoatRoughness,eo=t.code,no=t.color,so=t.colorSpaceToWorking,ro=t.colorToDirection,co=t.compute,ao=t.cond,io=t.context,lo=t.convert,mo=t.convertColorSpace,po=t.convertToTexture,uo=t.cos,go=t.cross,ho=t.cubeTexture,fo=t.dFdx,xo=t.dFdy,bo=t.dashSize,wo=t.defaultBuildStages,vo=t.defaultShaderStages,So=t.defined,To=t.degrees,_o=t.deltaTime,Vo=t.densityFog,yo=t.densityFogFactor,Do=t.depth,Mo=t.depthPass,Fo=t.difference,Co=t.diffuseColor,Io=t.directPointLight,No=t.directionToColor,Po=t.dispersion,Ro=t.distance,Bo=t.div,Lo=t.dodge,ko=t.dot,Ao=t.drawIndex,Go=t.dynamicBufferAttribute,Oo=t.element,Wo=t.emissive,jo=t.equal,Uo=t.equals,qo=t.equirectUV,zo=t.exp,Eo=t.exp2,Zo=t.expression,Xo=t.faceDirection,Yo=t.faceForward,Ho=t.faceforward,Jo=t.float,Ko=t.floor,Qo=t.fog,$o=t.fract,te=t.frameGroup,oe=t.frameId,ee=t.frontFacing,ne=t.fwidth,se=t.gain,re=t.gapSize,ce=t.getConstNodeType,ae=t.getCurrentStack,ie=t.getDirection,le=t.getDistanceAttenuation,me=t.getGeometryRoughness,pe=t.getNormalFromDepth,de=t.getParallaxCorrectNormal,ue=t.getRoughness,ge=t.getScreenPosition,he=t.getShIrradianceAt,fe=t.getTextureIndex,xe=t.getViewPosition,be=t.glsl,we=t.glslFn,ve=t.grayscale,Se=t.greaterThan,Te=t.greaterThanEqual,_e=t.hash,Ve=t.highpModelNormalViewMatrix,ye=t.highpModelViewMatrix,De=t.hue,Me=t.instance,Fe=t.instanceIndex,Ce=t.instancedArray,Ie=t.instancedBufferAttribute,Ne=t.instancedDynamicBufferAttribute,Pe=t.instancedMesh,Re=t.int,Be=t.inverseSqrt,Le=t.inversesqrt,ke=t.invocationLocalIndex,Ae=t.invocationSubgroupIndex,Ge=t.ior,Oe=t.iridescence,We=t.iridescenceIOR,je=t.iridescenceThickness,Ue=t.ivec2,qe=t.ivec3,ze=t.ivec4,Ee=t.js,Ze=t.label,Xe=t.length,Ye=t.lengthSq,He=t.lessThan,Je=t.lessThanEqual,Ke=t.lightPosition,Qe=t.lightTargetDirection,$e=t.lightTargetPosition,tn=t.lightViewPosition,on=t.lightingContext,en=t.lights,nn=t.linearDepth,sn=t.linearToneMapping,rn=t.localId,cn=t.log,an=t.log2,ln=t.logarithmicDepthToViewZ,mn=t.loop,pn=t.luminance,dn=t.mediumpModelViewMatrix,un=t.mat2,gn=t.mat3,hn=t.mat4,fn=t.matcapUV,xn=t.materialAO,bn=t.materialAlphaTest,wn=t.materialAnisotropy,vn=t.materialAnisotropyVector,Sn=t.materialAttenuationColor,Tn=t.materialAttenuationDistance,_n=t.materialClearcoat,Vn=t.materialClearcoatNormal,yn=t.materialClearcoatRoughness,Dn=t.materialColor,Mn=t.materialDispersion,Fn=t.materialEmissive,Cn=t.materialIOR,In=t.materialIridescence,Nn=t.materialIridescenceIOR,Pn=t.materialIridescenceThickness,Rn=t.materialLightMap,Bn=t.materialLineDashOffset,Ln=t.materialLineDashSize,kn=t.materialLineGapSize,An=t.materialLineScale,Gn=t.materialLineWidth,On=t.materialMetalness,Wn=t.materialNormal,jn=t.materialOpacity,Un=t.materialPointWidth,qn=t.materialReference,zn=t.materialReflectivity,En=t.materialRefractionRatio,Zn=t.materialRotation,Xn=t.materialRoughness,Yn=t.materialSheen,Hn=t.materialSheenRoughness,Jn=t.materialShininess,Kn=t.materialSpecular,Qn=t.materialSpecularColor,$n=t.materialSpecularIntensity,ts=t.materialSpecularStrength,os=t.materialThickness,es=t.materialTransmission,ns=t.max,ss=t.maxMipLevel,rs=t.metalness,cs=t.min,as=t.mix,is=t.mixElement,ls=t.mod,ms=t.modInt,ps=t.modelDirection,ds=t.modelNormalMatrix,us=t.modelPosition,gs=t.modelScale,hs=t.modelViewMatrix,fs=t.modelViewPosition,xs=t.modelViewProjection,bs=t.modelWorldMatrix,ws=t.modelWorldMatrixInverse,vs=t.morphReference,Ss=t.mrt,Ts=t.mul,_s=t.mx_aastep,Vs=t.mx_cell_noise_float,ys=t.mx_contrast,Ds=t.mx_fractal_noise_float,Ms=t.mx_fractal_noise_vec2,Fs=t.mx_fractal_noise_vec3,Cs=t.mx_fractal_noise_vec4,Is=t.mx_hsvtorgb,Ns=t.mx_noise_float,Ps=t.mx_noise_vec3,Rs=t.mx_noise_vec4,Bs=t.mx_ramplr,Ls=t.mx_ramptb,ks=t.mx_rgbtohsv,As=t.mx_safepower,Gs=t.mx_splitlr,Os=t.mx_splittb,Ws=t.mx_srgb_texture_to_lin_rec709,js=t.mx_transform_uv,Us=t.mx_worley_noise_float,qs=t.mx_worley_noise_vec2,zs=t.mx_worley_noise_vec3,Es=t.negate,Zs=t.neutralToneMapping,Xs=t.nodeArray,Ys=t.nodeImmutable,Hs=t.nodeObject,Js=t.nodeObjects,Ks=t.nodeProxy,Qs=t.normalFlat,$s=t.normalGeometry,tr=t.normalLocal,or=t.normalMap,er=t.normalView,nr=t.normalWorld,sr=t.normalize,rr=t.not,cr=t.notEqual,ar=t.numWorkgroups,ir=t.objectDirection,lr=t.objectGroup,mr=t.objectPosition,pr=t.objectScale,dr=t.objectViewPosition,ur=t.objectWorldMatrix,gr=t.oneMinus,hr=t.or,fr=t.orthographicDepthToViewZ,xr=t.oscSawtooth,br=t.oscSine,wr=t.oscSquare,vr=t.oscTriangle,Sr=t.output,Tr=t.outputStruct,_r=t.overlay,Vr=t.overloadingFn,yr=t.parabola,Dr=t.parallaxDirection,Mr=t.parallaxUV,Fr=t.parameter,Cr=t.pass,Ir=t.passTexture,Nr=t.pcurve,Pr=t.perspectiveDepthToViewZ,Rr=t.pmremTexture,Br=t.pointUV,Lr=t.pointWidth,kr=t.positionGeometry,Ar=t.positionLocal,Gr=t.positionPrevious,Or=t.positionView,Wr=t.positionViewDirection,jr=t.positionWorld,Ur=t.positionWorldDirection,qr=t.posterize,zr=t.pow,Er=t.pow2,Zr=t.pow3,Xr=t.pow4,Yr=t.property,Hr=t.radians,Jr=t.rand,Kr=t.range,Qr=t.rangeFog,$r=t.rangeFogFactor,tc=t.reciprocal,oc=t.reference,ec=t.referenceBuffer,nc=t.reflect,sc=t.reflectVector,rc=t.reflectView,cc=t.reflector,ac=t.refract,ic=t.refractVector,lc=t.refractView,mc=t.reinhardToneMapping,pc=t.remainder,dc=t.remap,uc=t.remapClamp,gc=t.renderGroup,hc=t.renderOutput,fc=t.rendererReference,xc=t.rotate,bc=t.rotateUV,wc=t.roughness,vc=t.round,Sc=t.rtt,Tc=t.sRGBTransferEOTF,_c=t.sRGBTransferOETF,Vc=t.sampler,yc=t.saturate,Dc=t.saturation,Mc=t.screen,Fc=t.screenCoordinate,Cc=t.screenSize,Ic=t.screenUV,Nc=t.scriptable,Pc=t.scriptableValue,Rc=t.select,Bc=t.setCurrentStack,Lc=t.shaderStages,kc=t.shadow,Ac=t.shadowPositionWorld,Gc=t.sharedUniformGroup,Oc=t.sheen,Wc=t.sheenRoughness,jc=t.shiftLeft,Uc=t.shiftRight,qc=t.shininess,zc=t.sign,Ec=t.sin,Zc=t.sinc,Xc=t.skinning,Yc=t.skinningReference,Hc=t.smoothstep,Jc=t.smoothstepElement,Kc=t.specularColor,Qc=t.specularF90,$c=t.spherizeUV,ta=t.split,oa=t.spritesheetUV,ea=t.sqrt,na=t.stack,sa=t.step,ra=t.storage,ca=t.storageBarrier,aa=t.storageObject,ia=t.storageTexture,la=t.string,ma=t.sub,pa=t.subgroupIndex,da=t.subgroupSize,ua=t.tan,ga=t.tangentGeometry,ha=t.tangentLocal,fa=t.tangentView,xa=t.tangentWorld,ba=t.temp,wa=t.texture,va=t.texture3D,Sa=t.textureBarrier,Ta=t.textureBicubic,_a=t.textureCubeUV,Va=t.textureLoad,ya=t.textureSize,Da=t.textureStore,Ma=t.thickness,Fa=t.threshold,Ca=t.time,Ia=t.timerDelta,Na=t.timerGlobal,Pa=t.timerLocal,Ra=t.toOutputColorSpace,Ba=t.toWorkingColorSpace,La=t.toneMapping,ka=t.toneMappingExposure,Aa=t.toonOutlinePass,Ga=t.transformDirection,Oa=t.transformNormal,Wa=t.transformNormalToView,ja=t.transformedBentNormalView,Ua=t.transformedBitangentView,qa=t.transformedBitangentWorld,za=t.transformedClearcoatNormalView,Ea=t.transformedNormalView,Za=t.transformedNormalWorld,Xa=t.transformedTangentView,Ya=t.transformedTangentWorld,Ha=t.transmission,Ja=t.transpose,Ka=t.tri,Qa=t.tri3,$a=t.triNoise3D,ti=t.triplanarTexture,oi=t.triplanarTextures,ei=t.trunc,ni=t.tslFn,si=t.uint,ri=t.uniform,ci=t.uniformArray,ai=t.uniformGroup,ii=t.uniforms,li=t.userData,mi=t.uv,pi=t.uvec2,di=t.uvec3,ui=t.uvec4,gi=t.varying,hi=t.varyingProperty,fi=t.vec2,xi=t.vec3,bi=t.vec4,wi=t.vectorComponents,vi=t.velocity,Si=t.vertexColor,Ti=t.vertexIndex,_i=t.vibrance,Vi=t.viewZToLogarithmicDepth,yi=t.viewZToOrthographicDepth,Di=t.viewZToPerspectiveDepth,Mi=t.viewport,Fi=t.viewportBottomLeft,Ci=t.viewportCoordinate,Ii=t.viewportDepthTexture,Ni=t.viewportLinearDepth,Pi=t.viewportMipTexture,Ri=t.viewportResolution,Bi=t.viewportSafeUV,Li=t.viewportSharedTexture,ki=t.viewportSize,Ai=t.viewportTexture,Gi=t.viewportTopLeft,Oi=t.viewportUV,Wi=t.wgsl,ji=t.wgslFn,Ui=t.workgroupArray,qi=t.workgroupBarrier,zi=t.workgroupId,Ei=t.workingToColorSpace,Zi=t.xor;export{e as BRDF_GGX,n as BRDF_Lambert,s as BasicShadowFilter,r as Break,c as Continue,a as DFGApprox,i as D_GGX,l as Discard,m as EPSILON,p as F_Schlick,d as Fn,u as INFINITY,g as If,h as Loop,w as NodeAccess,f as NodeShaderStage,x as NodeType,b as NodeUpdateType,v as PCFShadowFilter,S as PCFSoftShadowFilter,T as PI,_ as PI2,V as Return,y as Schlick_to_F0,D as ScriptableNodeResources,M as ShaderNode,F as TBNViewMatrix,C as VSMShadowFilter,I as V_GGX_SmithCorrelated,N as abs,P as acesFilmicToneMapping,R as acos,B as add,L as addNodeElement,k as agxToneMapping,A as all,G as alphaT,O as and,W as anisotropy,j as anisotropyB,U as anisotropyT,q as any,z as append,E as arrayBuffer,Z as asin,X as assign,Y as atan,H as atan2,J as atomicAdd,K as atomicAnd,Q as atomicFunc,$ as atomicMax,tt as atomicMin,ot as atomicOr,et as atomicStore,nt as atomicSub,st as atomicXor,rt as attenuationColor,ct as attenuationDistance,at as attribute,it as attributeArray,lt as backgroundBlurriness,mt as backgroundIntensity,pt as backgroundRotation,dt as batch,ut as billboarding,gt as bitAnd,ht as bitNot,ft as bitOr,xt as bitXor,bt as bitangentGeometry,wt as bitangentLocal,vt as bitangentView,St as bitangentWorld,Tt as bitcast,_t as blendBurn,Vt as blendColor,yt as blendDodge,Dt as blendOverlay,Mt as blendScreen,Ft as blur,Ct as bool,It as buffer,Nt as bufferAttribute,Pt as bumpMap,Rt as burn,Bt as bvec2,Lt as bvec3,kt as bvec4,At as bypass,Gt as cache,Ot as call,Wt as cameraFar,jt as cameraNear,Ut as cameraNormalMatrix,qt as cameraPosition,zt as cameraProjectionMatrix,Et as cameraProjectionMatrixInverse,Zt as cameraViewMatrix,Xt as cameraWorldMatrix,Yt as cbrt,Ht as cdl,Jt as ceil,Kt as checker,Qt as cineonToneMapping,$t as clamp,to as clearcoat,oo as clearcoatRoughness,eo as code,no as color,so as colorSpaceToWorking,ro as colorToDirection,co as compute,ao as cond,io as context,lo as convert,mo as convertColorSpace,po as convertToTexture,uo as cos,go as cross,ho as cubeTexture,fo as dFdx,xo as dFdy,bo as dashSize,wo as defaultBuildStages,vo as defaultShaderStages,So as defined,To as degrees,_o as deltaTime,Vo as densityFog,yo as densityFogFactor,Do as depth,Mo as depthPass,Fo as difference,Co as diffuseColor,Io as directPointLight,No as directionToColor,Po as dispersion,Ro as distance,Bo as div,Lo as dodge,ko as dot,Ao as drawIndex,Go as dynamicBufferAttribute,Oo as element,Wo as emissive,jo as equal,Uo as equals,qo as equirectUV,zo as exp,Eo as exp2,Zo as expression,Xo as faceDirection,Yo as faceForward,Ho as faceforward,Jo as float,Ko as floor,Qo as fog,$o as fract,te as frameGroup,oe as frameId,ee as frontFacing,ne as fwidth,se as gain,re as gapSize,ce as getConstNodeType,ae as getCurrentStack,ie as getDirection,le as getDistanceAttenuation,me as getGeometryRoughness,pe as getNormalFromDepth,de as getParallaxCorrectNormal,ue as getRoughness,ge as getScreenPosition,he as getShIrradianceAt,fe as getTextureIndex,xe as getViewPosition,be as glsl,we as glslFn,ve as grayscale,Se as greaterThan,Te as greaterThanEqual,_e as hash,Ve as highpModelNormalViewMatrix,ye as highpModelViewMatrix,De as hue,Me as instance,Fe as instanceIndex,Ce as instancedArray,Ie as instancedBufferAttribute,Ne as instancedDynamicBufferAttribute,Pe as instancedMesh,Re as int,Be as inverseSqrt,Le as inversesqrt,ke as invocationLocalIndex,Ae as invocationSubgroupIndex,Ge as ior,Oe as iridescence,We as iridescenceIOR,je as iridescenceThickness,Ue as ivec2,qe as ivec3,ze as ivec4,Ee as js,Ze as label,Xe as length,Ye as lengthSq,He as lessThan,Je as lessThanEqual,Ke as lightPosition,Qe as lightTargetDirection,$e as lightTargetPosition,tn as lightViewPosition,on as lightingContext,en as lights,nn as linearDepth,sn as linearToneMapping,rn as localId,cn as log,an as log2,ln as logarithmicDepthToViewZ,mn as loop,pn as luminance,un as mat2,gn as mat3,hn as mat4,fn as matcapUV,xn as materialAO,bn as materialAlphaTest,wn as materialAnisotropy,vn as materialAnisotropyVector,Sn as materialAttenuationColor,Tn as materialAttenuationDistance,_n as materialClearcoat,Vn as materialClearcoatNormal,yn as materialClearcoatRoughness,Dn as materialColor,Mn as materialDispersion,Fn as materialEmissive,Cn as materialIOR,In as materialIridescence,Nn as materialIridescenceIOR,Pn as materialIridescenceThickness,Rn as materialLightMap,Bn as materialLineDashOffset,Ln as materialLineDashSize,kn as materialLineGapSize,An as materialLineScale,Gn as materialLineWidth,On as materialMetalness,Wn as materialNormal,jn as materialOpacity,Un as materialPointWidth,qn as materialReference,zn as materialReflectivity,En as materialRefractionRatio,Zn as materialRotation,Xn as materialRoughness,Yn as materialSheen,Hn as materialSheenRoughness,Jn as materialShininess,Kn as materialSpecular,Qn as materialSpecularColor,$n as materialSpecularIntensity,ts as materialSpecularStrength,os as materialThickness,es as materialTransmission,ns as max,ss as maxMipLevel,dn as mediumpModelViewMatrix,rs as metalness,cs as min,as as mix,is as mixElement,ls as mod,ms as modInt,ps as modelDirection,ds as modelNormalMatrix,us as modelPosition,gs as modelScale,hs as modelViewMatrix,fs as modelViewPosition,xs as modelViewProjection,bs as modelWorldMatrix,ws as modelWorldMatrixInverse,vs as morphReference,Ss as mrt,Ts as mul,_s as mx_aastep,Vs as mx_cell_noise_float,ys as mx_contrast,Ds as mx_fractal_noise_float,Ms as mx_fractal_noise_vec2,Fs as mx_fractal_noise_vec3,Cs as mx_fractal_noise_vec4,Is as mx_hsvtorgb,Ns as mx_noise_float,Ps as mx_noise_vec3,Rs as mx_noise_vec4,Bs as mx_ramplr,Ls as mx_ramptb,ks as mx_rgbtohsv,As as mx_safepower,Gs as mx_splitlr,Os as mx_splittb,Ws as mx_srgb_texture_to_lin_rec709,js as mx_transform_uv,Us as mx_worley_noise_float,qs as mx_worley_noise_vec2,zs as mx_worley_noise_vec3,Es as negate,Zs as neutralToneMapping,Xs as nodeArray,Ys as nodeImmutable,Hs as nodeObject,Js as nodeObjects,Ks as nodeProxy,Qs as normalFlat,$s as normalGeometry,tr as normalLocal,or as normalMap,er as normalView,nr as normalWorld,sr as normalize,rr as not,cr as notEqual,ar as numWorkgroups,ir as objectDirection,lr as objectGroup,mr as objectPosition,pr as objectScale,dr as objectViewPosition,ur as objectWorldMatrix,gr as oneMinus,hr as or,fr as orthographicDepthToViewZ,xr as oscSawtooth,br as oscSine,wr as oscSquare,vr as oscTriangle,Sr as output,Tr as outputStruct,_r as overlay,Vr as overloadingFn,yr as parabola,Dr as parallaxDirection,Mr as parallaxUV,Fr as parameter,Cr as pass,Ir as passTexture,Nr as pcurve,Pr as perspectiveDepthToViewZ,Rr as pmremTexture,Br as pointUV,Lr as pointWidth,kr as positionGeometry,Ar as positionLocal,Gr as positionPrevious,Or as positionView,Wr as positionViewDirection,jr as positionWorld,Ur as positionWorldDirection,qr as posterize,zr as pow,Er as pow2,Zr as pow3,Xr as pow4,Yr as property,Hr as radians,Jr as rand,Kr as range,Qr as rangeFog,$r as rangeFogFactor,tc as reciprocal,oc as reference,ec as referenceBuffer,nc as reflect,sc as reflectVector,rc as reflectView,cc as reflector,ac as refract,ic as refractVector,lc as refractView,mc as reinhardToneMapping,pc as remainder,dc as remap,uc as remapClamp,gc as renderGroup,hc as renderOutput,fc as rendererReference,xc as rotate,bc as rotateUV,wc as roughness,vc as round,Sc as rtt,Tc as sRGBTransferEOTF,_c as sRGBTransferOETF,Vc as sampler,yc as saturate,Dc as saturation,Mc as screen,Fc as screenCoordinate,Cc as screenSize,Ic as screenUV,Nc as scriptable,Pc as scriptableValue,Rc as select,Bc as setCurrentStack,Lc as shaderStages,kc as shadow,Ac as shadowPositionWorld,Gc as sharedUniformGroup,Oc as sheen,Wc as sheenRoughness,jc as shiftLeft,Uc as shiftRight,qc as shininess,zc as sign,Ec as sin,Zc as sinc,Xc as skinning,Yc as skinningReference,Hc as smoothstep,Jc as smoothstepElement,Kc as specularColor,Qc as specularF90,$c as spherizeUV,ta as split,oa as spritesheetUV,ea as sqrt,na as stack,sa as step,ra as storage,ca as storageBarrier,aa as storageObject,ia as storageTexture,la as string,ma as sub,pa as subgroupIndex,da as subgroupSize,ua as tan,ga as tangentGeometry,ha as tangentLocal,fa as tangentView,xa as tangentWorld,ba as temp,wa as texture,va as texture3D,Sa as textureBarrier,Ta as textureBicubic,_a as textureCubeUV,Va as textureLoad,ya as textureSize,Da as textureStore,Ma as thickness,Fa as threshold,Ca as time,Ia as timerDelta,Na as timerGlobal,Pa as timerLocal,Ra as toOutputColorSpace,Ba as toWorkingColorSpace,La as toneMapping,ka as toneMappingExposure,Aa as toonOutlinePass,Ga as transformDirection,Oa as transformNormal,Wa as transformNormalToView,ja as transformedBentNormalView,Ua as transformedBitangentView,qa as transformedBitangentWorld,za as transformedClearcoatNormalView,Ea as transformedNormalView,Za as transformedNormalWorld,Xa as transformedTangentView,Ya as transformedTangentWorld,Ha as transmission,Ja as transpose,Ka as tri,Qa as tri3,$a as triNoise3D,ti as triplanarTexture,oi as triplanarTextures,ei as trunc,ni as tslFn,si as uint,ri as uniform,ci as uniformArray,ai as uniformGroup,ii as uniforms,li as userData,mi as uv,pi as uvec2,di as uvec3,ui as uvec4,gi as varying,hi as varyingProperty,fi as vec2,xi as vec3,bi as vec4,wi as vectorComponents,vi as velocity,Si as vertexColor,Ti as vertexIndex,_i as vibrance,Vi as viewZToLogarithmicDepth,yi as viewZToOrthographicDepth,Di as viewZToPerspectiveDepth,Mi as viewport,Fi as viewportBottomLeft,Ci as viewportCoordinate,Ii as viewportDepthTexture,Ni as viewportLinearDepth,Pi as viewportMipTexture,Ri as viewportResolution,Bi as viewportSafeUV,Li as viewportSharedTexture,ki as viewportSize,Ai as viewportTexture,Gi as viewportTopLeft,Oi as viewportUV,Wi as wgsl,ji as wgslFn,Ui as workgroupArray,qi as workgroupBarrier,zi as workgroupId,Ei as workingToColorSpace,Zi as xor}; diff --git a/apps/dashboard/build/_app/immutable/chunks/BZQzXWp7.js.br b/apps/dashboard/build/_app/immutable/chunks/BZQzXWp7.js.br deleted file mode 100644 index 84b2088..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/BZQzXWp7.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BZQzXWp7.js.gz b/apps/dashboard/build/_app/immutable/chunks/BZQzXWp7.js.gz deleted file mode 100644 index f4670dd..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/BZQzXWp7.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BeMFXnHE.js b/apps/dashboard/build/_app/immutable/chunks/BeMFXnHE.js new file mode 100644 index 0000000..529c227 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/BeMFXnHE.js @@ -0,0 +1 @@ +import{H as a,v as m,aH as q,aC as x}from"./CpWkWWOo.js";function _(e,t,n){if(e==null)return t(void 0),n&&n(void 0),a;const r=m(()=>e.subscribe(t,n));return r.unsubscribe?()=>r.unsubscribe():r}const f=[];function z(e,t){return{subscribe:A(e,t).subscribe}}function A(e,t=a){let n=null;const r=new Set;function i(u){if(q(e,u)&&(e=u,n)){const o=!f.length;for(const s of r)s[1](),f.push(s,e);if(o){for(let s=0;s{r.delete(s),r.size===0&&n&&(n(),n=null)}}return{set:i,update:b,subscribe:l}}function k(e,t,n){const r=!Array.isArray(e),i=r?[e]:e;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const b=t.length<2;return z(n,(l,u)=>{let o=!1;const s=[];let d=0,p=a;const y=()=>{if(d)return;p();const c=t(r?s[0]:s,l,u);b?l(c):p=typeof c=="function"?c:a},h=i.map((c,g)=>_(c,w=>{s[g]=w,d&=~(1<{d|=1<t=n)(),t}export{k as d,B as g,_ as s,A as w}; diff --git a/apps/dashboard/build/_app/immutable/chunks/BeMFXnHE.js.br b/apps/dashboard/build/_app/immutable/chunks/BeMFXnHE.js.br new file mode 100644 index 0000000..9dea105 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/BeMFXnHE.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BeMFXnHE.js.gz b/apps/dashboard/build/_app/immutable/chunks/BeMFXnHE.js.gz new file mode 100644 index 0000000..6af3a8f Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/BeMFXnHE.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BhIgFntf.js b/apps/dashboard/build/_app/immutable/chunks/BhIgFntf.js deleted file mode 100644 index 0f8a968..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/BhIgFntf.js +++ /dev/null @@ -1 +0,0 @@ -import{b as c,w as g}from"./D8mhvFt8.js";const v=200;function $(){const{subscribe:e,set:n,update:t}=g({connected:!1,reconnecting:!1,events:[],lastHeartbeat:null,error:null});let o=null,s=null,d=0;function m(i){const l=i||(window.location.port==="5173"?`ws://${window.location.hostname}:3927/ws`:`ws://${window.location.host}/ws`);if((o==null?void 0:o.readyState)!==WebSocket.OPEN)try{o=new WebSocket(l),o.onopen=()=>{d=0,t(r=>({...r,connected:!0,reconnecting:!1,error:null}))},o.onmessage=r=>{try{const u=JSON.parse(r.data);t(f=>{if(u.type==="Heartbeat")return{...f,lastHeartbeat:u};const w=[u,...f.events].slice(0,v);return{...f,events:w}})}catch(u){console.warn("[vestige] Failed to parse WebSocket message:",u)}},o.onclose=()=>{t(r=>({...r,connected:!1})),p(l)},o.onerror=()=>{t(r=>({...r,error:"WebSocket connection failed"}))}}catch(r){t(u=>({...u,error:String(r)}))}}function p(i){s&&clearTimeout(s),t(r=>({...r,reconnecting:!0}));const l=Math.min(1e3*2**d,3e4);d++,s=setTimeout(()=>m(i),l)}function b(){s&&clearTimeout(s),o==null||o.close(),o=null,n({connected:!1,reconnecting:!1,events:[],lastHeartbeat:null,error:null})}function y(){t(i=>({...i,events:[]}))}function h(i){t(l=>{const r=[i,...l.events].slice(0,v);return{...l,events:r}})}return{subscribe:e,connect:m,disconnect:b,clearEvents:y,injectEvent:h}}const a=$(),S=c(a,e=>e.connected),H=c(a,e=>e.reconnecting),T=c(a,e=>e.events);c(a,e=>e.lastHeartbeat);const M=c(a,e=>{var n,t;return((t=(n=e.lastHeartbeat)==null?void 0:n.data)==null?void 0:t.memory_count)??0}),k=c(a,e=>{var n,t;return((t=(n=e.lastHeartbeat)==null?void 0:n.data)==null?void 0:t.avg_retention)??0}),_=c(a,e=>{var n,t;return((t=(n=e.lastHeartbeat)==null?void 0:n.data)==null?void 0:t.suppressed_count)??0}),W=c(a,e=>{var n,t;return((t=(n=e.lastHeartbeat)==null?void 0:n.data)==null?void 0:t.uptime_secs)??0}),N=c(a,e=>e.events.filter(n=>n.type==="TraceEvent")),P=c(a,e=>{var t;const n=e.events.find(o=>o.type==="TraceEvent");return((t=n==null?void 0:n.data)==null?void 0:t.run_id)??null}),R=c(a,e=>e.events.find(n=>n.type==="TraceEvent")??null),C=c(a,e=>e.events.filter(n=>n.type==="MemoryPrOpened"||n.type==="MemoryPrDecided"));function F(e){if(!Number.isFinite(e)||e<0)return"—";const n=Math.floor(e/86400),t=Math.floor(e%86400/3600),o=Math.floor(e%3600/60),s=Math.floor(e%60);return n>0?t>0?`${n}d ${t}h`:`${n}d`:t>0?o>0?`${t}h ${o}m`:`${t}h`:o>0?s>0?`${o}m ${s}s`:`${o}m`:`${s}s`}export{k as a,M as b,H as c,P as d,T as e,F as f,S as i,R as l,C as m,_ as s,N as t,W as u,a as w}; diff --git a/apps/dashboard/build/_app/immutable/chunks/BhIgFntf.js.br b/apps/dashboard/build/_app/immutable/chunks/BhIgFntf.js.br deleted file mode 100644 index 56deb73..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/BhIgFntf.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BhIgFntf.js.gz b/apps/dashboard/build/_app/immutable/chunks/BhIgFntf.js.gz deleted file mode 100644 index 1102382..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/BhIgFntf.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BjdL4Pm2.js b/apps/dashboard/build/_app/immutable/chunks/BjdL4Pm2.js new file mode 100644 index 0000000..809f3b1 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/BjdL4Pm2.js @@ -0,0 +1 @@ +import{w as S,g as T}from"./BeMFXnHE.js";import{e as R}from"./MAY1QfFZ.js";import{E as u}from"./DzfRjky4.js";const M=4,x=1500;function F(){const{subscribe:y,update:i}=S([]);let m=1,b=0;const d=new Map,a=new Map,l=new Map;function f(e,o){l.set(e,Date.now());const t=setTimeout(()=>{d.delete(e),l.delete(e),g(e)},o);d.set(e,t)}function w(e){const o=m++,t=Date.now(),s={id:o,createdAt:t,...e};i(n=>{const r=[s,...n];return r.length>M?r.slice(0,M):r}),f(o,e.dwellMs)}function g(e){const o=d.get(e);o&&(clearTimeout(o),d.delete(e)),a.delete(e),l.delete(e),i(t=>t.filter(s=>s.id!==e))}function C(e,o){const t=d.get(e);if(!t)return;clearTimeout(t),d.delete(e);const s=l.get(e)??Date.now(),n=Date.now()-s,r=Math.max(200,o-n);a.set(e,{remaining:r})}function D(e){const o=a.get(e);o&&(a.delete(e),f(e,o.remaining))}function N(){for(const e of d.values())clearTimeout(e);d.clear(),a.clear(),l.clear(),i(()=>[])}function _(e){const o=u[e.type]??"#818CF8",t=e.data;switch(e.type){case"DreamCompleted":{const s=Number(t.memories_replayed??0),n=Number(t.connections_found??0),r=Number(t.insights_generated??0),p=Number(t.duration_ms??0),c=[];return c.push(`Replayed ${s} ${s===1?"memory":"memories"}`),n>0&&c.push(`${n} new connection${n===1?"":"s"}`),r>0&&c.push(`${r} insight${r===1?"":"s"}`),{type:e.type,title:"Dream consolidated",body:`${c.join(" · ")} in ${(p/1e3).toFixed(1)}s`,color:o,dwellMs:7e3}}case"ConsolidationCompleted":{const s=Number(t.nodes_processed??0),n=Number(t.decay_applied??0),r=Number(t.embeddings_generated??0),p=Number(t.duration_ms??0),c=[];return n>0&&c.push(`${n} decayed`),r>0&&c.push(`${r} embedded`),{type:e.type,title:"Consolidation swept",body:`${s} node${s===1?"":"s"}${c.length?" · "+c.join(" · "):""} in ${(p/1e3).toFixed(1)}s`,color:o,dwellMs:6e3}}case"ConnectionDiscovered":{const s=Date.now();if(s-b0?`suppression #${s} · Rac1 cascade ~${n} neighbors`:`suppression #${s}`,color:o,dwellMs:5500}}case"MemoryUnsuppressed":{const s=Number(t.remaining_count??0);return{type:e.type,title:"Recovered",body:s>0?`${s} suppression${s===1?"":"s"} remain`:"fully unsuppressed",color:o,dwellMs:5e3}}case"Rac1CascadeSwept":{const s=Number(t.seeds??0),n=Number(t.neighbors_affected??0);return{type:e.type,title:"Rac1 cascade",body:`${s} seed${s===1?"":"s"} · ${n} dendritic spine${n===1?"":"s"} pruned`,color:o,dwellMs:6e3}}case"MemoryDeleted":return{type:e.type,title:"Memory deleted",body:String(t.id??"").slice(0,8),color:o,dwellMs:4e3};case"Heartbeat":case"SearchPerformed":case"RetentionDecayed":case"ActivationSpread":case"ImportanceScored":case"MemoryCreated":case"MemoryUpdated":case"DreamStarted":case"DreamProgress":case"ConsolidationStarted":case"Connected":return null;default:return null}}let h=null;return R.subscribe(e=>{if(e.length===0)return;const o=[];for(const t of e){if(t===h)break;o.push(t)}if(o.length!==0){h=e[0];for(let t=o.length-1;t>=0;t--){const s=_(o[t]);s&&w(s)}}}),{subscribe:y,dismiss:g,clear:N,pauseDwell:C,resumeDwell:D,push:w}}const $=F();function O(){[{type:"DreamCompleted",title:"Dream consolidated",body:"Replayed 127 memories · 43 new connections · 5 insights in 2.4s",color:u.DreamCompleted,dwellMs:7e3},{type:"ConnectionDiscovered",title:"Bridge discovered",body:"semantic · weight 0.87",color:u.ConnectionDiscovered,dwellMs:4500},{type:"MemorySuppressed",title:"Forgetting",body:"suppression #2 · Rac1 cascade ~8 neighbors",color:u.MemorySuppressed,dwellMs:5500},{type:"ConsolidationCompleted",title:"Consolidation swept",body:"892 nodes · 156 decayed · 48 embedded in 1.1s",color:u.ConsolidationCompleted,dwellMs:6e3}].forEach((i,m)=>{setTimeout(()=>{$.push(i)},m*800)}),T($)}export{O as f,$ as t}; diff --git a/apps/dashboard/build/_app/immutable/chunks/BjdL4Pm2.js.br b/apps/dashboard/build/_app/immutable/chunks/BjdL4Pm2.js.br new file mode 100644 index 0000000..30bed56 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/BjdL4Pm2.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BjdL4Pm2.js.gz b/apps/dashboard/build/_app/immutable/chunks/BjdL4Pm2.js.gz new file mode 100644 index 0000000..78fece5 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/BjdL4Pm2.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BlVfL1ME.js b/apps/dashboard/build/_app/immutable/chunks/BlVfL1ME.js new file mode 100644 index 0000000..74a84e4 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/BlVfL1ME.js @@ -0,0 +1,2 @@ +var Me=Object.defineProperty;var ue=t=>{throw TypeError(t)};var ke=(t,e,r)=>e in t?Me(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var U=(t,e,r)=>ke(t,typeof e!="symbol"?e+"":e,r),re=(t,e,r)=>e.has(t)||ue("Cannot "+r);var s=(t,e,r)=>(re(t,e,"read from private field"),r?r.call(t):e.get(t)),c=(t,e,r)=>e.has(t)?ue("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),n=(t,e,r,a)=>(re(t,e,"write to private field"),a?a.call(t,r):e.set(t,r),r),p=(t,e,r)=>(re(t,e,"access private method"),r);import{aQ as Ie,g as Te,X as Le,v as Ve,aR as _e,Y as q,ao as we,U as M,N as k,o as B,aS as pe,b as xe,ab as Be,ad as Ce,aT as ge,ai as Y,J as me,aU as se,ar as ie,ay as He,aV as ve,aW as We,aX as ye,aY as Pe,aZ as qe,a_ as G,a$ as Z,b0 as be,b1 as ze,b2 as Re,az as Se,ag as Ue,aw as ae,T as K,n as $e,ae as je,b3 as $,E as Je,M as Qe,b4 as Xe,b5 as Ge,F as Ze,b6 as Ke,G as et,b7 as ne,V as tt,O as Ne,ax as rt,Q as st,b8 as fe,R as j,b9 as it,av as at,ba as nt,al as ft,p as ht,af as ot,bb as lt,a as ct}from"./CpWkWWOo.js";import{d as dt}from"./CHOnp4oo.js";function ut(t){let e=0,r=we(0),a;return()=>{Ie()&&(Te(r),Le(()=>(e===0&&(a=Ve(()=>t(()=>_e(r)))),e+=1,()=>{q(()=>{e-=1,e===0&&(a==null||a(),a=void 0,_e(r))})})))}}var _t=Je|Qe;function pt(t,e,r,a){new gt(t,e,r,a)}var E,z,m,L,g,R,T,w,S,V,A,C,H,W,N,ee,o,De,Ae,Oe,he,Q,X,oe;class gt{constructor(e,r,a,h){c(this,o);U(this,"parent");U(this,"is_pending",!1);U(this,"transform_error");c(this,E);c(this,z,k?M:null);c(this,m);c(this,L);c(this,g);c(this,R,null);c(this,T,null);c(this,w,null);c(this,S,null);c(this,V,0);c(this,A,0);c(this,C,!1);c(this,H,new Set);c(this,W,new Set);c(this,N,null);c(this,ee,ut(()=>(n(this,N,we(s(this,V))),()=>{n(this,N,null)})));var i;n(this,E,e),n(this,m,r),n(this,L,f=>{var u=B;u.b=this,u.f|=pe,a(f)}),this.parent=B.b,this.transform_error=h??((i=this.parent)==null?void 0:i.transform_error)??(f=>f),n(this,g,xe(()=>{if(k){const f=s(this,z);Be();const u=f.data===Ce;if(f.data.startsWith(ge)){const d=JSON.parse(f.data.slice(ge.length));p(this,o,Ae).call(this,d)}else u?p(this,o,Oe).call(this):p(this,o,De).call(this)}else p(this,o,he).call(this)},_t)),k&&n(this,E,M)}defer_effect(e){qe(e,s(this,H),s(this,W))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!s(this,m).pending}update_pending_count(e){p(this,o,oe).call(this,e),n(this,V,s(this,V)+e),!(!s(this,N)||s(this,C))&&(n(this,C,!0),q(()=>{n(this,C,!1),s(this,N)&&Ue(s(this,N),s(this,V))}))}get_effect_pending(){return s(this,ee).call(this),Te(s(this,N))}error(e){var r=s(this,m).onerror;let a=s(this,m).failed;if(!r&&!a)throw e;s(this,R)&&(ae(s(this,R)),n(this,R,null)),s(this,T)&&(ae(s(this,T)),n(this,T,null)),s(this,w)&&(ae(s(this,w)),n(this,w,null)),k&&(K(s(this,z)),$e(),K(je()));var h=!1,i=!1;const f=()=>{if(h){Ge();return}h=!0,i&&Xe(),s(this,w)!==null&&ie(s(this,w),()=>{n(this,w,null)}),p(this,o,X).call(this,()=>{se.ensure(),p(this,o,he).call(this)})},u=l=>{try{i=!0,r==null||r(l,f),i=!1}catch(d){$(d,s(this,g)&&s(this,g).parent)}a&&n(this,w,p(this,o,X).call(this,()=>{se.ensure();try{return Y(()=>{var d=B;d.b=this,d.f|=pe,a(s(this,E),()=>l,()=>f)})}catch(d){return $(d,s(this,g).parent),null}}))};q(()=>{var l;try{l=this.transform_error(e)}catch(d){$(d,s(this,g)&&s(this,g).parent);return}l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(u,d=>$(d,s(this,g)&&s(this,g).parent)):u(l)})}}E=new WeakMap,z=new WeakMap,m=new WeakMap,L=new WeakMap,g=new WeakMap,R=new WeakMap,T=new WeakMap,w=new WeakMap,S=new WeakMap,V=new WeakMap,A=new WeakMap,C=new WeakMap,H=new WeakMap,W=new WeakMap,N=new WeakMap,ee=new WeakMap,o=new WeakSet,De=function(){try{n(this,R,Y(()=>s(this,L).call(this,s(this,E))))}catch(e){this.error(e)}},Ae=function(e){const r=s(this,m).failed;r&&n(this,w,Y(()=>{r(s(this,E),()=>e,()=>()=>{})}))},Oe=function(){const e=s(this,m).pending;e&&(this.is_pending=!0,n(this,T,Y(()=>e(s(this,E)))),q(()=>{var r=n(this,S,document.createDocumentFragment()),a=me();r.append(a),n(this,R,p(this,o,X).call(this,()=>(se.ensure(),Y(()=>s(this,L).call(this,a))))),s(this,A)===0&&(s(this,E).before(r),n(this,S,null),ie(s(this,T),()=>{n(this,T,null)}),p(this,o,Q).call(this))}))},he=function(){try{if(this.is_pending=this.has_pending_snippet(),n(this,A,0),n(this,V,0),n(this,R,Y(()=>{s(this,L).call(this,s(this,E))})),s(this,A)>0){var e=n(this,S,document.createDocumentFragment());He(s(this,R),e);const r=s(this,m).pending;n(this,T,Y(()=>r(s(this,E))))}else p(this,o,Q).call(this)}catch(r){this.error(r)}},Q=function(){this.is_pending=!1;for(const e of s(this,H))ve(e,We),ye(e);for(const e of s(this,W))ve(e,Pe),ye(e);s(this,H).clear(),s(this,W).clear()},X=function(e){var r=B,a=Re,h=Se;G(s(this,g)),Z(s(this,g)),be(s(this,g).ctx);try{return e()}catch(i){return ze(i),null}finally{G(r),Z(a),be(h)}},oe=function(e){var r;if(!this.has_pending_snippet()){this.parent&&p(r=this.parent,o,oe).call(r,e);return}n(this,A,s(this,A)+e),s(this,A)===0&&(p(this,o,Q).call(this),s(this,T)&&ie(s(this,T),()=>{n(this,T,null)}),s(this,S)&&(s(this,E).before(s(this,S)),n(this,S,null)))};const vt=["touchstart","touchmove"];function yt(t){return vt.includes(t)}const I=Symbol("events"),Fe=new Set,le=new Set;function bt(t,e,r,a={}){function h(i){if(a.capture||ce.call(e,i),!i.cancelBubble)return Ke(()=>r==null?void 0:r.call(this,i))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?q(()=>{e.addEventListener(t,h,a)}):e.addEventListener(t,h,a),h}function Rt(t,e,r,a,h){var i={capture:a,passive:h},f=bt(t,e,r,i);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Ze(()=>{e.removeEventListener(t,f,i)})}function St(t,e,r){(e[I]??(e[I]={}))[t]=r}function Nt(t){for(var e=0;e{throw F});throw D}}finally{t[I]=e,delete t.currentTarget,Z(x),G(P)}}}function Dt(t,e){var r=e==null?"":typeof e=="object"?e+"":e;r!==(t.__t??(t.__t=t.nodeValue))&&(t.__t=r,t.nodeValue=r+"")}function Et(t,e){return Ye(t,e)}function At(t,e){ne(),e.intro=e.intro??!1;const r=e.target,a=k,h=M;try{for(var i=tt(r);i&&(i.nodeType!==Ne||i.data!==rt);)i=st(i);if(!i)throw fe;j(!0),K(i);const f=Ye(t,{...e,anchor:i});return j(!1),f}catch(f){if(f instanceof Error&&f.message.split(` +`).some(u=>u.startsWith("https://svelte.dev/e/")))throw f;return f!==fe&&console.warn("Failed to hydrate: ",f),e.recover===!1&&it(),ne(),at(r),j(!1),Et(t,e)}finally{j(a),K(h)}}const J=new Map;function Ye(t,{target:e,anchor:r,props:a={},events:h,context:i,intro:f=!0,transformError:u}){ne();var l=void 0,d=nt(()=>{var x=r??e.appendChild(me());pt(x,{pending:()=>{}},v=>{ht({});var _=Se;if(i&&(_.c=i),h&&(a.$$events=h),k&&dt(v,null),l=t(v,a)||{},k&&(B.nodes.end=M,M===null||M.nodeType!==Ne||M.data!==ot))throw lt(),fe;ct()},u);var P=new Set,D=v=>{for(var _=0;_{var O;for(var v of P)for(const b of[e,document]){var _=J.get(b),y=_.get(v);--y==0?(b.removeEventListener(v,ce),_.delete(v),_.size===0&&J.delete(b)):_.set(v,y)}le.delete(D),x!==r&&((O=x.parentNode)==null||O.removeChild(x))}});return de.set(l,d),l}let de=new WeakMap;function Ot(t,e){const r=de.get(t);return r?(de.delete(t),r(e)):Promise.resolve()}export{St as a,Nt as d,Rt as e,At as h,Et as m,Dt as s,Ot as u}; diff --git a/apps/dashboard/build/_app/immutable/chunks/BlVfL1ME.js.br b/apps/dashboard/build/_app/immutable/chunks/BlVfL1ME.js.br new file mode 100644 index 0000000..75ea48d Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/BlVfL1ME.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BlVfL1ME.js.gz b/apps/dashboard/build/_app/immutable/chunks/BlVfL1ME.js.gz new file mode 100644 index 0000000..5593b24 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/BlVfL1ME.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BnXDGOmJ.js b/apps/dashboard/build/_app/immutable/chunks/BnXDGOmJ.js new file mode 100644 index 0000000..227886d --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/BnXDGOmJ.js @@ -0,0 +1 @@ +import{Z as s,_ as v,W as o,F as c,a7 as b,a8 as m,a9 as h,a0 as y}from"./CpWkWWOo.js";function d(e,r,f=!1){if(e.multiple){if(r==null)return;if(!b(r))return m();for(var a of e.options)a.selected=r.includes(i(a));return}for(a of e.options){var t=i(a);if(h(t,r)){a.selected=!0;return}}(!f||r!==void 0)&&(e.selectedIndex=-1)}function q(e){var r=new MutationObserver(()=>{d(e,e.__value)});r.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),c(()=>{r.disconnect()})}function p(e,r,f=r){var a=new WeakSet,t=!0;s(e,"change",u=>{var l=u?"[selected]":":checked",n;if(e.multiple)n=[].map.call(e.querySelectorAll(l),i);else{var _=e.querySelector(l)??e.querySelector("option:not([disabled])");n=_&&i(_)}f(n),v!==null&&a.add(v)}),o(()=>{var u=r();if(e===document.activeElement){var l=y??v;if(a.has(l))return}if(d(e,u,t),t&&u===void 0){var n=e.querySelector(":checked");n!==null&&(u=i(n),f(u))}e.__value=u,t=!1}),q(e)}function i(e){return"__value"in e?e.__value:e.value}export{p as b}; diff --git a/apps/dashboard/build/_app/immutable/chunks/BnXDGOmJ.js.br b/apps/dashboard/build/_app/immutable/chunks/BnXDGOmJ.js.br new file mode 100644 index 0000000..ca545db Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/BnXDGOmJ.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BnXDGOmJ.js.gz b/apps/dashboard/build/_app/immutable/chunks/BnXDGOmJ.js.gz new file mode 100644 index 0000000..4aac3c2 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/BnXDGOmJ.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BskPcZf7.js b/apps/dashboard/build/_app/immutable/chunks/BskPcZf7.js new file mode 100644 index 0000000..26597bd --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/BskPcZf7.js @@ -0,0 +1 @@ +var x=t=>{throw TypeError(t)};var B=(t,e,n)=>e.has(t)||x("Cannot "+n);var a=(t,e,n)=>(B(t,e,"read from private field"),n?n.call(t):e.get(t)),c=(t,e,n)=>e.has(t)?x("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n);import{o as I}from"./GG5zm9kr.js";import{s as u,g as f,h as d}from"./CpWkWWOo.js";import{w as G}from"./BeMFXnHE.js";new URL("sveltekit-internal://");function ae(t,e){return t==="/"||e==="ignore"?t:e==="never"?t.endsWith("/")?t.slice(0,-1):t:e==="always"&&!t.endsWith("/")?t+"/":t}function oe(t){return t.split("%25").map(decodeURI).join("%25")}function ie(t){for(const e in t)t[e]=decodeURIComponent(t[e]);return t}function le({href:t}){return t.split("#")[0]}function W(...t){let e=5381;for(const n of t)if(typeof n=="string"){let r=n.length;for(;r;)e=e*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let s=r.length;for(;s;)e=e*33^r[--s]}else throw new TypeError("value must be a string or TypedArray");return(e>>>0).toString(36)}new TextEncoder;new TextDecoder;function X(t){const e=atob(t),n=new Uint8Array(e.length);for(let r=0;r((t instanceof Request?t.method:(e==null?void 0:e.method)||"GET")!=="GET"&&b.delete(U(t)),z(t,e));const b=new Map;function ce(t,e){const n=U(t,e),r=document.querySelector(n);if(r!=null&&r.textContent){r.remove();let{body:s,...l}=JSON.parse(r.textContent);const o=r.getAttribute("data-ttl");return o&&b.set(n,{body:s,init:l,ttl:1e3*Number(o)}),r.getAttribute("data-b64")!==null&&(s=X(s)),Promise.resolve(new Response(s,l))}return window.fetch(t,e)}function ue(t,e,n){if(b.size>0){const r=U(t,n),s=b.get(r);if(s){if(performance.now()o)}function s(o){n=!1,e.set(o)}function l(o){let i;return e.subscribe(h=>{(i===void 0||n&&h!==i)&&o(i=h)})}return{notify:r,set:s,subscribe:l}}const D={v:()=>{}};function Ae(){const{set:t,subscribe:e}=G(!1);let n;async function r(){clearTimeout(n);try{const s=await fetch(`${M}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!s.ok)return!1;const o=(await s.json()).version!==F;return o&&(t(!0),D.v(),clearTimeout(n)),o}catch{return!1}}return{subscribe:e,check:r}}function Q(t,e,n){return t.origin!==Y||!t.pathname.startsWith(e)?!0:n?t.pathname!==location.pathname:!1}function Re(t){}const H=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...H];const Z=new Set([...H]);[...Z];let E,O,T;const ee=I.toString().includes("$$")||/function \w+\(\) \{\}/.test(I.toString());var _,m,w,p,v,y,k,A,P,R,V,S,j;ee?(E={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL("https://example.com")},O={current:null},T={current:!1}):(E=new(P=class{constructor(){c(this,_,u({}));c(this,m,u(null));c(this,w,u(null));c(this,p,u({}));c(this,v,u({id:null}));c(this,y,u({}));c(this,k,u(-1));c(this,A,u(new URL("https://example.com")))}get data(){return f(a(this,_))}set data(e){d(a(this,_),e)}get form(){return f(a(this,m))}set form(e){d(a(this,m),e)}get error(){return f(a(this,w))}set error(e){d(a(this,w),e)}get params(){return f(a(this,p))}set params(e){d(a(this,p),e)}get route(){return f(a(this,v))}set route(e){d(a(this,v),e)}get state(){return f(a(this,y))}set state(e){d(a(this,y),e)}get status(){return f(a(this,k))}set status(e){d(a(this,k),e)}get url(){return f(a(this,A))}set url(e){d(a(this,A),e)}},_=new WeakMap,m=new WeakMap,w=new WeakMap,p=new WeakMap,v=new WeakMap,y=new WeakMap,k=new WeakMap,A=new WeakMap,P),O=new(V=class{constructor(){c(this,R,u(null))}get current(){return f(a(this,R))}set current(e){d(a(this,R),e)}},R=new WeakMap,V),T=new(j=class{constructor(){c(this,S,u(!1))}get current(){return f(a(this,S))}set current(e){d(a(this,S),e)}},S=new WeakMap,j),D.v=()=>T.current=!0);function Ue(t){Object.assign(E,t)}export{be as H,_e as N,ge as P,he as S,ye as a,J as b,Ae as c,le as d,ie as e,pe as f,ve as g,ae as h,Q as i,N as j,oe as k,fe as l,ue as m,O as n,Y as o,E as p,ce as q,me as r,we as s,de as t,ke as u,Ue as v,Re as w}; diff --git a/apps/dashboard/build/_app/immutable/chunks/BskPcZf7.js.br b/apps/dashboard/build/_app/immutable/chunks/BskPcZf7.js.br new file mode 100644 index 0000000..c787776 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/BskPcZf7.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BskPcZf7.js.gz b/apps/dashboard/build/_app/immutable/chunks/BskPcZf7.js.gz new file mode 100644 index 0000000..cd10020 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/BskPcZf7.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/Bxs5UR9-.js b/apps/dashboard/build/_app/immutable/chunks/Bxs5UR9-.js deleted file mode 100644 index 4ee383e..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/Bxs5UR9-.js +++ /dev/null @@ -1 +0,0 @@ -var x=t=>{throw TypeError(t)};var B=(t,e,n)=>e.has(t)||x("Cannot "+n);var a=(t,e,n)=>(B(t,e,"read from private field"),n?n.call(t):e.get(t)),c=(t,e,n)=>e.has(t)?x("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n);import{o as I}from"./TZu9D97Z.js";import{s as u,g as f,i as d}from"./wpu9U-D0.js";import{w as G}from"./D8mhvFt8.js";new URL("sveltekit-internal://");function ae(t,e){return t==="/"||e==="ignore"?t:e==="never"?t.endsWith("/")?t.slice(0,-1):t:e==="always"&&!t.endsWith("/")?t+"/":t}function oe(t){return t.split("%25").map(decodeURI).join("%25")}function ie(t){for(const e in t)t[e]=decodeURIComponent(t[e]);return t}function le({href:t}){return t.split("#")[0]}function W(...t){let e=5381;for(const n of t)if(typeof n=="string"){let r=n.length;for(;r;)e=e*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let s=r.length;for(;s;)e=e*33^r[--s]}else throw new TypeError("value must be a string or TypedArray");return(e>>>0).toString(36)}new TextEncoder;new TextDecoder;function X(t){const e=atob(t),n=new Uint8Array(e.length);for(let r=0;r((t instanceof Request?t.method:(e==null?void 0:e.method)||"GET")!=="GET"&&w.delete(U(t)),z(t,e));const w=new Map;function ce(t,e){const n=U(t,e),r=document.querySelector(n);if(r!=null&&r.textContent){r.remove();let{body:s,...l}=JSON.parse(r.textContent);const o=r.getAttribute("data-ttl");return o&&w.set(n,{body:s,init:l,ttl:1e3*Number(o)}),r.getAttribute("data-b64")!==null&&(s=X(s)),Promise.resolve(new Response(s,l))}return window.fetch(t,e)}function ue(t,e,n){if(w.size>0){const r=U(t,n),s=w.get(r);if(s){if(performance.now()o)}function s(o){n=!1,e.set(o)}function l(o){let i;return e.subscribe(h=>{(i===void 0||n&&h!==i)&&o(i=h)})}return{notify:r,set:s,subscribe:l}}const D={v:()=>{}};function Ae(){const{set:t,subscribe:e}=G(!1);let n;async function r(){clearTimeout(n);try{const s=await fetch(`${M}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!s.ok)return!1;const o=(await s.json()).version!==F;return o&&(t(!0),D.v(),clearTimeout(n)),o}catch{return!1}}return{subscribe:e,check:r}}function Q(t,e,n){return t.origin!==Y||!t.pathname.startsWith(e)?!0:n?t.pathname!==location.pathname:!1}function Re(t){}const H=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...H];const Z=new Set([...H]);[...Z];let E,O,T;const ee=I.toString().includes("$$")||/function \w+\(\) \{\}/.test(I.toString());var b,_,m,p,v,y,k,A,P,R,V,S,j;ee?(E={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL("https://example.com")},O={current:null},T={current:!1}):(E=new(P=class{constructor(){c(this,b,u({}));c(this,_,u(null));c(this,m,u(null));c(this,p,u({}));c(this,v,u({id:null}));c(this,y,u({}));c(this,k,u(-1));c(this,A,u(new URL("https://example.com")))}get data(){return f(a(this,b))}set data(e){d(a(this,b),e)}get form(){return f(a(this,_))}set form(e){d(a(this,_),e)}get error(){return f(a(this,m))}set error(e){d(a(this,m),e)}get params(){return f(a(this,p))}set params(e){d(a(this,p),e)}get route(){return f(a(this,v))}set route(e){d(a(this,v),e)}get state(){return f(a(this,y))}set state(e){d(a(this,y),e)}get status(){return f(a(this,k))}set status(e){d(a(this,k),e)}get url(){return f(a(this,A))}set url(e){d(a(this,A),e)}},b=new WeakMap,_=new WeakMap,m=new WeakMap,p=new WeakMap,v=new WeakMap,y=new WeakMap,k=new WeakMap,A=new WeakMap,P),O=new(V=class{constructor(){c(this,R,u(null))}get current(){return f(a(this,R))}set current(e){d(a(this,R),e)}},R=new WeakMap,V),T=new(j=class{constructor(){c(this,S,u(!1))}get current(){return f(a(this,S))}set current(e){d(a(this,S),e)}},S=new WeakMap,j),D.v=()=>T.current=!0);function Ue(t){Object.assign(E,t)}export{we as H,be as N,ge as P,he as S,ye as a,J as b,Ae as c,le as d,ie as e,pe as f,ve as g,ae as h,Q as i,N as j,oe as k,fe as l,ue as m,O as n,Y as o,E as p,ce as q,_e as r,me as s,de as t,ke as u,Ue as v,Re as w}; diff --git a/apps/dashboard/build/_app/immutable/chunks/Bxs5UR9-.js.br b/apps/dashboard/build/_app/immutable/chunks/Bxs5UR9-.js.br deleted file mode 100644 index 11713a3..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/Bxs5UR9-.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/Bxs5UR9-.js.gz b/apps/dashboard/build/_app/immutable/chunks/Bxs5UR9-.js.gz deleted file mode 100644 index 6acb963..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/Bxs5UR9-.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/ByYB047u.js b/apps/dashboard/build/_app/immutable/chunks/ByYB047u.js deleted file mode 100644 index 1776b5d..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/ByYB047u.js +++ /dev/null @@ -1 +0,0 @@ -import{ab as R,ac as y,g as o,y as N,ad as U,i as A,ae as B,af as M,ag as Y,d as $,ah as h,ai as q,aj as w,ak as x,P as j,al as p,am as z,an as C,a7 as G,ao as Z,ap as F,S as H,aq as J}from"./wpu9U-D0.js";import{c as K,g as Q}from"./D8mhvFt8.js";let v=!1,g=Symbol();function k(e,r,i){const n=i[r]??(i[r]={store:null,source:y(void 0),unsubscribe:R});if(n.store!==e&&!(g in i))if(n.unsubscribe(),n.store=e??null,e==null)n.source.v=void 0,n.unsubscribe=R;else{var u=!0;n.unsubscribe=K(e,t=>{u?n.source.v=t:A(n.source,t)}),u=!1}return e&&g in i?Q(e):o(n.source)}function ee(){const e={};function r(){N(()=>{for(var i in e)e[i].unsubscribe();U(e,g,{enumerable:!1,value:!0})})}return[e,r]}function V(e){var r=v;try{return v=!1,[e(),v]}finally{v=r}}function re(e,r,i,n){var E;var u=!p||(i&z)!==0,t=(i&x)!==0,T=(i&F)!==0,f=n,b=!0,P=()=>(b&&(b=!1,f=T?j(n):n),f),d;if(t){var m=H in e||J in e;d=((E=B(e,r))==null?void 0:E.set)??(m&&r in e?a=>e[r]=a:void 0)}var _,I=!1;t?[_,I]=V(()=>e[r]):_=e[r],_===void 0&&n!==void 0&&(_=P(),d&&(u&&M(),d(_)));var s;if(u?s=()=>{var a=e[r];return a===void 0?P():(b=!0,a)}:s=()=>{var a=e[r];return a!==void 0&&(f=void 0),a===void 0?f:a},u&&(i&Y)===0)return s;if(d){var D=e.$$legacy;return(function(a,c){return arguments.length>0?((!u||!c||D||I)&&d(c?s():a),a):s()})}var S=!1,l=((i&C)!==0?G:Z)(()=>(S=!1,s()));t&&o(l);var L=q;return(function(a,c){if(arguments.length>0){const O=c?o(l):u&&t?$(a):a;return A(l,O),S=!0,f!==void 0&&(f=O),a}return h&&S||(L.f&w)!==0?l.v:o(l)})}export{ee as a,re as p,k as s}; diff --git a/apps/dashboard/build/_app/immutable/chunks/ByYB047u.js.br b/apps/dashboard/build/_app/immutable/chunks/ByYB047u.js.br deleted file mode 100644 index 372bba1..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/ByYB047u.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/ByYB047u.js.gz b/apps/dashboard/build/_app/immutable/chunks/ByYB047u.js.gz deleted file mode 100644 index cbf9823..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/ByYB047u.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/Bzak7iHL.js.gz b/apps/dashboard/build/_app/immutable/chunks/Bzak7iHL.js.gz index f429ed1..0311328 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/Bzak7iHL.js.gz and b/apps/dashboard/build/_app/immutable/chunks/Bzak7iHL.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/C-SOZ1Oi.js b/apps/dashboard/build/_app/immutable/chunks/C-SOZ1Oi.js deleted file mode 100644 index 27a1889..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/C-SOZ1Oi.js +++ /dev/null @@ -1,4118 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Ma4NfFrG.js","./Dp1pzeXC.js"])))=>i.map(i=>d[i]); -var ff=Object.defineProperty;var pf=(r,e,t)=>e in r?ff(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var ke=(r,e,t)=>pf(r,typeof e!="symbol"?e+"":e,t);import"./Bzak7iHL.js";import{o as od,a as Ac}from"./TZu9D97Z.js";import{s as Qe,d as Al,i as le,g as L,p as sr,o as Ga,a as ot,b as rr,j as ut,e as xe,h as Ee,n as Or,r as fe,t as Pt,u as ei,c as mf,f as no,m as gf,l as _f}from"./wpu9U-D0.js";import{s as ct,d as Cc,a as Ut}from"./D8mhvFt8.js";import{i as It}from"./DKve45Wd.js";import{e as Pr,i as Wa,a as Rt,r as Br,s as Ns,c as vf}from"./60_R_Vbt.js";import{s as zr}from"./EqHb-9AZ.js";import{b as Cl,a as ph}from"./CnZzd20v.js";import{p as Dr,a as xf,s as yf}from"./ByYB047u.js";import{b as mh}from"./Bxs5UR9-.js";import{b as Rl}from"./g5OnrUYZ.js";import{N as Il}from"./CcUbQ_Wl.js";import{b as Mf}from"./DrafHjYM.js";import{i as bf}from"./BLadwbF7.js";import{_ as Sf}from"./Dp1pzeXC.js";import{I as ps}from"./D7A-gG4Z.js";import{D as wf}from"./CmbJHhgy.js";import{a as ms}from"./CZfHMhLI.js";import{e as Ef}from"./BhIgFntf.js";/** - * @license - * Copyright 2010-2024 Three.js Authors - * SPDX-License-Identifier: MIT - */const Rc="172",Xs={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Os={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Tf=0,gh=1,Af=2,sS=3,rS=0,ld=1,Cf=2,Qn=3,Ci=0,fn=1,Bn=2,ii=0,qs=1,Wt=2,_h=3,vh=4,Rf=5,Qi=100,If=101,Pf=102,Df=103,Lf=104,Uf=200,Nf=201,Ff=202,Of=203,Pl=204,Dl=205,Bf=206,zf=207,kf=208,Vf=209,Hf=210,Gf=211,Wf=212,Xf=213,qf=214,Ll=0,Ul=1,Nl=2,Ks=3,Fl=4,Ol=5,Bl=6,zl=7,bo=0,Yf=1,Zf=2,Ti=0,Jf=1,Kf=2,$f=3,cd=4,jf=5,Qf=6,ep=7,xh="attached",tp="detached",Ic=300,Ri=301,os=302,io=303,so=304,qr=306,ro=1e3,Nn=1001,ao=1002,Qt=1003,hd=1004,aS=1004,Cr=1005,oS=1005,Vt=1006,Xa=1007,lS=1007,ni=1008,cS=1008,li=1009,ud=1010,dd=1011,kr=1012,Pc=1013,Ii=1014,Mn=1015,si=1016,Dc=1017,Lc=1018,$s=1020,fd=35902,pd=1021,md=1022,dn=1023,gd=1024,_d=1025,Ys=1026,js=1027,Uc=1028,So=1029,vd=1030,Nc=1031,hS=1032,Fc=1033,qa=33776,Ya=33777,Za=33778,Ja=33779,kl=35840,Vl=35841,Hl=35842,Gl=35843,Wl=36196,Xl=37492,ql=37496,Yl=37808,Zl=37809,Jl=37810,Kl=37811,$l=37812,jl=37813,Ql=37814,ec=37815,tc=37816,nc=37817,ic=37818,sc=37819,rc=37820,ac=37821,Ka=36492,oc=36494,lc=36495,xd=36283,cc=36284,hc=36285,uc=36286,np=2200,ip=2201,sp=2202,oo=2300,dc=2301,Fo=2302,Bs=2400,zs=2401,lo=2402,Oc=2500,yd=2501,uS=0,dS=1,fS=2,rp=3200,ap=3201,pS=3202,mS=3203,cs=0,op=1,wi="",xn="srgb",Qs="srgb-linear",co="linear",vt="srgb",gS=0,gs=7680,_S=7681,vS=7682,xS=7683,yS=34055,MS=34056,bS=5386,SS=512,wS=513,ES=514,TS=515,AS=516,CS=517,RS=518,yh=519,lp=512,cp=513,hp=514,Md=515,up=516,dp=517,fp=518,pp=519,ho=35044,IS=35048,PS=35040,DS=35045,LS=35049,US=35041,NS=35046,FS=35050,OS=35042,BS="100",Mh="300 es",zn=2e3,uo=2001;class ci{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s>8&255]+Jt[r>>16&255]+Jt[r>>24&255]+"-"+Jt[e&255]+Jt[e>>8&255]+"-"+Jt[e>>16&15|64]+Jt[e>>24&255]+"-"+Jt[t&63|128]+Jt[t>>8&255]+"-"+Jt[t>>16&255]+Jt[t>>24&255]+Jt[n&255]+Jt[n>>8&255]+Jt[n>>16&255]+Jt[n>>24&255]).toLowerCase()}function et(r,e,t){return Math.max(e,Math.min(t,r))}function Bc(r,e){return(r%e+e)%e}function mp(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function gp(r,e,t){return r!==e?(t-r)/(e-r):0}function Lr(r,e,t){return(1-t)*r+t*e}function _p(r,e,t,n){return Lr(r,e,1-Math.exp(-t*n))}function vp(r,e=1){return e-Math.abs(Bc(r,e*2)-e)}function xp(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function yp(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function Mp(r,e){return r+Math.floor(Math.random()*(e-r+1))}function bp(r,e){return r+Math.random()*(e-r)}function Sp(r){return r*(.5-Math.random())}function wp(r){r!==void 0&&(bh=r);let e=bh+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Ep(r){return r*ss}function Tp(r){return r*er}function Ap(r){return(r&r-1)===0&&r!==0}function Cp(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function Rp(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Ip(r,e,t,n,i){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),h=a((e+n)/2),u=s((e-n)/2),f=a((e-n)/2),d=s((n-e)/2),p=a((n-e)/2);switch(i){case"XYX":r.set(o*h,l*u,l*f,o*c);break;case"YZY":r.set(l*f,o*h,l*u,o*c);break;case"ZXZ":r.set(l*u,l*f,o*h,o*c);break;case"XZX":r.set(o*h,l*p,l*d,o*c);break;case"YXY":r.set(l*d,o*h,l*p,o*c);break;case"ZYZ":r.set(l*p,l*d,o*h,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function sn(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function nt(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const bd={DEG2RAD:ss,RAD2DEG:er,generateUUID:bn,clamp:et,euclideanModulo:Bc,mapLinear:mp,inverseLerp:gp,lerp:Lr,damp:_p,pingpong:vp,smoothstep:xp,smootherstep:yp,randInt:Mp,randFloat:bp,randFloatSpread:Sp,seededRandom:wp,degToRad:Ep,radToDeg:Tp,isPowerOfTwo:Ap,ceilPowerOfTwo:Cp,floorPowerOfTwo:Rp,setQuaternionFromProperEuler:Ip,normalize:nt,denormalize:sn};class j{constructor(e=0,t=0){j.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=et(this.x,e.x,t.x),this.y=et(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=et(this.x,e,t),this.y=et(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(et(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(et(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*i+e.x,this.y=s*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class tt{constructor(e,t,n,i,s,a,o,l,c){tt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,l,c)}set(e,t,n,i,s,a,o,l,c){const h=this.elements;return h[0]=e,h[1]=i,h[2]=o,h[3]=t,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],u=n[7],f=n[2],d=n[5],p=n[8],_=i[0],g=i[3],m=i[6],y=i[1],v=i[4],x=i[7],w=i[2],T=i[5],C=i[8];return s[0]=a*_+o*y+l*w,s[3]=a*g+o*v+l*T,s[6]=a*m+o*x+l*C,s[1]=c*_+h*y+u*w,s[4]=c*g+h*v+u*T,s[7]=c*m+h*x+u*C,s[2]=f*_+d*y+p*w,s[5]=f*g+d*v+p*T,s[8]=f*m+d*x+p*C,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-n*s*h+n*o*l+i*s*c-i*a*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=h*a-o*c,f=o*l-h*s,d=c*s-a*l,p=t*u+n*f+i*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/p;return e[0]=u*_,e[1]=(i*c-h*n)*_,e[2]=(o*n-i*a)*_,e[3]=f*_,e[4]=(h*t-i*l)*_,e[5]=(i*s-o*t)*_,e[6]=d*_,e[7]=(n*l-c*t)*_,e[8]=(a*t-n*s)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-i*c,i*l,-i*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Oo.makeScale(e,t)),this}rotate(e){return this.premultiply(Oo.makeRotation(-e)),this}translate(e,t){return this.premultiply(Oo.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Oo=new tt;function Sd(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const Pp={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function ks(r,e){return new Pp[r](e)}function Vr(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Dp(){const r=Vr("canvas");return r.style.display="block",r}const Sh={};function Fs(r){r in Sh||(Sh[r]=!0,console.warn(r))}function Lp(r,e,t){return new Promise(function(n,i){function s(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}function Up(r){const e=r.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Np(r){const e=r.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const wh=new tt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Eh=new tt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Fp(){const r={enabled:!0,workingColorSpace:Qs,spaces:{},convert:function(i,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===vt&&(i.r=ri(i.r),i.g=ri(i.g),i.b=ri(i.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===vt&&(i.r=Zs(i.r),i.g=Zs(i.g),i.b=Zs(i.b))),i},fromWorkingColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},toWorkingColorSpace:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===wi?co:this.spaces[i].transfer},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,a){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Qs]:{primaries:e,whitePoint:n,transfer:co,toXYZ:wh,fromXYZ:Eh,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:xn},outputColorSpaceConfig:{drawingBufferColorSpace:xn}},[xn]:{primaries:e,whitePoint:n,transfer:vt,toXYZ:wh,fromXYZ:Eh,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:xn}}}),r}const ht=Fp();function ri(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Zs(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let _s;class Op{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{_s===void 0&&(_s=Vr("canvas")),_s.width=e.width,_s.height=e.height;const n=_s.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=_s}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Vr("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Ic)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ro:e.x=e.x-Math.floor(e.x);break;case Nn:e.x=e.x<0?0:1;break;case ao:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case ro:e.y=e.y-Math.floor(e.y);break;case Nn:e.y=e.y<0?0:1;break;case ao:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Et.DEFAULT_IMAGE=null;Et.DEFAULT_MAPPING=Ic;Et.DEFAULT_ANISOTROPY=1;class pt{constructor(e=0,t=0,n=0,i=1){pt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const l=e.elements,c=l[0],h=l[4],u=l[8],f=l[1],d=l[5],p=l[9],_=l[2],g=l[6],m=l[10];if(Math.abs(h-f)<.01&&Math.abs(u-_)<.01&&Math.abs(p-g)<.01){if(Math.abs(h+f)<.1&&Math.abs(u+_)<.1&&Math.abs(p+g)<.1&&Math.abs(c+d+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const v=(c+1)/2,x=(d+1)/2,w=(m+1)/2,T=(h+f)/4,C=(u+_)/4,P=(p+g)/4;return v>x&&v>w?v<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(v),i=T/n,s=C/n):x>w?x<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(x),n=T/i,s=P/i):w<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(w),n=C/s,i=P/s),this.set(n,i,s,t),this}let y=Math.sqrt((g-p)*(g-p)+(u-_)*(u-_)+(f-h)*(f-h));return Math.abs(y)<.001&&(y=1),this.x=(g-p)/y,this.y=(u-_)/y,this.z=(f-h)/y,this.w=Math.acos((c+d+m-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=et(this.x,e.x,t.x),this.y=et(this.y,e.y,t.y),this.z=et(this.z,e.z,t.z),this.w=et(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=et(this.x,e,t),this.y=et(this.y,e,t),this.z=et(this.z,e,t),this.w=et(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(et(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class zc extends ci{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new pt(0,0,e,t),this.scissorTest=!1,this.viewport=new pt(0,0,e,t);const i={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Vt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new Et(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let o=0;o=0?1:-1,v=1-m*m;if(v>Number.EPSILON){const w=Math.sqrt(v),T=Math.atan2(w,m*y);g=Math.sin(g*T)/w,o=Math.sin(o*T)/w}const x=o*y;if(l=l*g+f*x,c=c*g+d*x,h=h*g+p*x,u=u*g+_*x,g===1-o){const w=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=w,c*=w,h*=w,u*=w}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,s,a){const o=n[i],l=n[i+1],c=n[i+2],h=n[i+3],u=s[a],f=s[a+1],d=s[a+2],p=s[a+3];return e[t]=o*p+h*u+l*d-c*f,e[t+1]=l*p+h*f+c*u-o*d,e[t+2]=c*p+h*d+o*f-l*u,e[t+3]=h*p-o*u-l*f-c*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(i/2),u=o(s/2),f=l(n/2),d=l(i/2),p=l(s/2);switch(a){case"XYZ":this._x=f*h*u+c*d*p,this._y=c*d*u-f*h*p,this._z=c*h*p+f*d*u,this._w=c*h*u-f*d*p;break;case"YXZ":this._x=f*h*u+c*d*p,this._y=c*d*u-f*h*p,this._z=c*h*p-f*d*u,this._w=c*h*u+f*d*p;break;case"ZXY":this._x=f*h*u-c*d*p,this._y=c*d*u+f*h*p,this._z=c*h*p+f*d*u,this._w=c*h*u-f*d*p;break;case"ZYX":this._x=f*h*u-c*d*p,this._y=c*d*u+f*h*p,this._z=c*h*p-f*d*u,this._w=c*h*u+f*d*p;break;case"YZX":this._x=f*h*u+c*d*p,this._y=c*d*u+f*h*p,this._z=c*h*p-f*d*u,this._w=c*h*u-f*d*p;break;case"XZY":this._x=f*h*u-c*d*p,this._y=c*d*u-f*h*p,this._z=c*h*p+f*d*u,this._w=c*h*u+f*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],h=t[6],u=t[10],f=n+o+u;if(f>0){const d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(h-l)*d,this._y=(s-c)*d,this._z=(a-i)*d}else if(n>o&&n>u){const d=2*Math.sqrt(1+n-o-u);this._w=(h-l)/d,this._x=.25*d,this._y=(i+a)/d,this._z=(s+c)/d}else if(o>u){const d=2*Math.sqrt(1+o-n-u);this._w=(s-c)/d,this._x=(i+a)/d,this._y=.25*d,this._z=(l+h)/d}else{const d=2*Math.sqrt(1+u-n-o);this._w=(a-i)/d,this._x=(s+c)/d,this._y=(l+h)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(et(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,h=t._w;return this._x=n*h+a*o+i*c-s*l,this._y=i*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-i*o,this._w=a*h-n*o-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,a=this._w;let o=a*e._w+n*e._x+i*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const d=1-t;return this._w=d*a+t*this._w,this._x=d*n+t*this._x,this._y=d*i+t*this._y,this._z=d*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),u=Math.sin((1-t)*h)/c,f=Math.sin(t*h)/c;return this._w=a*u+this._w*f,this._x=n*u+this._x*f,this._y=i*u+this._y*f,this._z=s*u+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class A{constructor(e=0,t=0,n=0){A.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Th.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Th.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*i-o*n),h=2*(o*t-s*i),u=2*(s*n-a*t);return this.x=t+l*c+a*u-o*h,this.y=n+l*h+o*c-s*u,this.z=i+l*u+s*h-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=et(this.x,e.x,t.x),this.y=et(this.y,e.y,t.y),this.z=et(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=et(this.x,e,t),this.y=et(this.y,e,t),this.z=et(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(et(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=i*l-s*o,this.y=s*a-n*l,this.z=n*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return zo.copy(this).projectOnVector(e),this.sub(zo)}reflect(e){return this.sub(zo.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(et(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const zo=new A,Th=new rn;class pn{constructor(e=new A(1/0,1/0,1/0),t=new A(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Dn),Dn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(mr),$r.subVectors(this.max,mr),vs.subVectors(e.a,mr),xs.subVectors(e.b,mr),ys.subVectors(e.c,mr),mi.subVectors(xs,vs),gi.subVectors(ys,xs),Fi.subVectors(vs,ys);let t=[0,-mi.z,mi.y,0,-gi.z,gi.y,0,-Fi.z,Fi.y,mi.z,0,-mi.x,gi.z,0,-gi.x,Fi.z,0,-Fi.x,-mi.y,mi.x,0,-gi.y,gi.x,0,-Fi.y,Fi.x,0];return!ko(t,vs,xs,ys,$r)||(t=[1,0,0,0,1,0,0,0,1],!ko(t,vs,xs,ys,$r))?!1:(jr.crossVectors(mi,gi),t=[jr.x,jr.y,jr.z],ko(t,vs,xs,ys,$r))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Dn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Dn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(qn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),qn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),qn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),qn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),qn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),qn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),qn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),qn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(qn),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const qn=[new A,new A,new A,new A,new A,new A,new A,new A],Dn=new A,Kr=new pn,vs=new A,xs=new A,ys=new A,mi=new A,gi=new A,Fi=new A,mr=new A,$r=new A,jr=new A,Oi=new A;function ko(r,e,t,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){Oi.fromArray(r,s);const o=i.x*Math.abs(Oi.x)+i.y*Math.abs(Oi.y)+i.z*Math.abs(Oi.z),l=e.dot(Oi),c=t.dot(Oi),h=n.dot(Oi);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const kp=new pn,gr=new A,Vo=new A;class an{constructor(e=new A,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):kp.setFromPoints(e).getCenter(n);let i=0;for(let s=0,a=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;gr.subVectors(e,this.center);const t=gr.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(gr,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Vo.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(gr.copy(e.center).add(Vo)),this.expandByPoint(gr.copy(e.center).sub(Vo))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Yn=new A,Ho=new A,Qr=new A,_i=new A,Go=new A,ea=new A,Wo=new A;class ar{constructor(e=new A,t=new A(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Yn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Yn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Yn.copy(this.origin).addScaledVector(this.direction,t),Yn.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Ho.copy(e).add(t).multiplyScalar(.5),Qr.copy(t).sub(e).normalize(),_i.copy(this.origin).sub(Ho);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Qr),o=_i.dot(this.direction),l=-_i.dot(Qr),c=_i.lengthSq(),h=Math.abs(1-a*a);let u,f,d,p;if(h>0)if(u=a*l-o,f=a*o-l,p=s*h,u>=0)if(f>=-p)if(f<=p){const _=1/h;u*=_,f*=_,d=u*(u+a*f+2*o)+f*(a*u+f+2*l)+c}else f=s,u=Math.max(0,-(a*f+o)),d=-u*u+f*(f+2*l)+c;else f=-s,u=Math.max(0,-(a*f+o)),d=-u*u+f*(f+2*l)+c;else f<=-p?(u=Math.max(0,-(-a*s+o)),f=u>0?-s:Math.min(Math.max(-s,-l),s),d=-u*u+f*(f+2*l)+c):f<=p?(u=0,f=Math.min(Math.max(-s,-l),s),d=f*(f+2*l)+c):(u=Math.max(0,-(a*s+o)),f=u>0?s:Math.min(Math.max(-s,-l),s),d=-u*u+f*(f+2*l)+c);else f=a>0?-s:s,u=Math.max(0,-(a*f+o)),d=-u*u+f*(f+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(Ho).addScaledVector(Qr,f),d}intersectSphere(e,t){Yn.subVectors(e.center,this.origin);const n=Yn.dot(this.direction),i=Yn.dot(Yn)-n*n,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,f=this.origin;return c>=0?(n=(e.min.x-f.x)*c,i=(e.max.x-f.x)*c):(n=(e.max.x-f.x)*c,i=(e.min.x-f.x)*c),h>=0?(s=(e.min.y-f.y)*h,a=(e.max.y-f.y)*h):(s=(e.max.y-f.y)*h,a=(e.min.y-f.y)*h),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a=0?(o=(e.min.z-f.z)*u,l=(e.max.z-f.z)*u):(o=(e.max.z-f.z)*u,l=(e.min.z-f.z)*u),n>l||o>i)||((o>n||n!==n)&&(n=o),(l=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Yn)!==null}intersectTriangle(e,t,n,i,s){Go.subVectors(t,e),ea.subVectors(n,e),Wo.crossVectors(Go,ea);let a=this.direction.dot(Wo),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;_i.subVectors(this.origin,e);const l=o*this.direction.dot(ea.crossVectors(_i,ea));if(l<0)return null;const c=o*this.direction.dot(Go.cross(_i));if(c<0||l+c>a)return null;const h=-o*_i.dot(Wo);return h<0?null:this.at(h/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ze{constructor(e,t,n,i,s,a,o,l,c,h,u,f,d,p,_,g){Ze.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,l,c,h,u,f,d,p,_,g)}set(e,t,n,i,s,a,o,l,c,h,u,f,d,p,_,g){const m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=i,m[1]=s,m[5]=a,m[9]=o,m[13]=l,m[2]=c,m[6]=h,m[10]=u,m[14]=f,m[3]=d,m[7]=p,m[11]=_,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ze().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/Ms.setFromMatrixColumn(e,0).length(),s=1/Ms.setFromMatrixColumn(e,1).length(),a=1/Ms.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(i),c=Math.sin(i),h=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const f=a*h,d=a*u,p=o*h,_=o*u;t[0]=l*h,t[4]=-l*u,t[8]=c,t[1]=d+p*c,t[5]=f-_*c,t[9]=-o*l,t[2]=_-f*c,t[6]=p+d*c,t[10]=a*l}else if(e.order==="YXZ"){const f=l*h,d=l*u,p=c*h,_=c*u;t[0]=f+_*o,t[4]=p*o-d,t[8]=a*c,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=d*o-p,t[6]=_+f*o,t[10]=a*l}else if(e.order==="ZXY"){const f=l*h,d=l*u,p=c*h,_=c*u;t[0]=f-_*o,t[4]=-a*u,t[8]=p+d*o,t[1]=d+p*o,t[5]=a*h,t[9]=_-f*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const f=a*h,d=a*u,p=o*h,_=o*u;t[0]=l*h,t[4]=p*c-d,t[8]=f*c+_,t[1]=l*u,t[5]=_*c+f,t[9]=d*c-p,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const f=a*l,d=a*c,p=o*l,_=o*c;t[0]=l*h,t[4]=_-f*u,t[8]=p*u+d,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=d*u+p,t[10]=f-_*u}else if(e.order==="XZY"){const f=a*l,d=a*c,p=o*l,_=o*c;t[0]=l*h,t[4]=-u,t[8]=c*h,t[1]=f*u+_,t[5]=a*h,t[9]=d*u-p,t[2]=p*u-d,t[6]=o*h,t[10]=_*u+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Vp,e,Hp)}lookAt(e,t,n){const i=this.elements;return _n.subVectors(e,t),_n.lengthSq()===0&&(_n.z=1),_n.normalize(),vi.crossVectors(n,_n),vi.lengthSq()===0&&(Math.abs(n.z)===1?_n.x+=1e-4:_n.z+=1e-4,_n.normalize(),vi.crossVectors(n,_n)),vi.normalize(),ta.crossVectors(_n,vi),i[0]=vi.x,i[4]=ta.x,i[8]=_n.x,i[1]=vi.y,i[5]=ta.y,i[9]=_n.y,i[2]=vi.z,i[6]=ta.z,i[10]=_n.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],u=n[5],f=n[9],d=n[13],p=n[2],_=n[6],g=n[10],m=n[14],y=n[3],v=n[7],x=n[11],w=n[15],T=i[0],C=i[4],P=i[8],S=i[12],M=i[1],D=i[5],G=i[9],F=i[13],V=i[2],J=i[6],q=i[10],se=i[14],Z=i[3],_e=i[7],be=i[11],Re=i[15];return s[0]=a*T+o*M+l*V+c*Z,s[4]=a*C+o*D+l*J+c*_e,s[8]=a*P+o*G+l*q+c*be,s[12]=a*S+o*F+l*se+c*Re,s[1]=h*T+u*M+f*V+d*Z,s[5]=h*C+u*D+f*J+d*_e,s[9]=h*P+u*G+f*q+d*be,s[13]=h*S+u*F+f*se+d*Re,s[2]=p*T+_*M+g*V+m*Z,s[6]=p*C+_*D+g*J+m*_e,s[10]=p*P+_*G+g*q+m*be,s[14]=p*S+_*F+g*se+m*Re,s[3]=y*T+v*M+x*V+w*Z,s[7]=y*C+v*D+x*J+w*_e,s[11]=y*P+v*G+x*q+w*be,s[15]=y*S+v*F+x*se+w*Re,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],h=e[2],u=e[6],f=e[10],d=e[14],p=e[3],_=e[7],g=e[11],m=e[15];return p*(+s*l*u-i*c*u-s*o*f+n*c*f+i*o*d-n*l*d)+_*(+t*l*d-t*c*f+s*a*f-i*a*d+i*c*h-s*l*h)+g*(+t*c*u-t*o*d-s*a*u+n*a*d+s*o*h-n*c*h)+m*(-i*o*h-t*l*u+t*o*f+i*a*u-n*a*f+n*l*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=e[9],f=e[10],d=e[11],p=e[12],_=e[13],g=e[14],m=e[15],y=u*g*c-_*f*c+_*l*d-o*g*d-u*l*m+o*f*m,v=p*f*c-h*g*c-p*l*d+a*g*d+h*l*m-a*f*m,x=h*_*c-p*u*c+p*o*d-a*_*d-h*o*m+a*u*m,w=p*u*l-h*_*l-p*o*f+a*_*f+h*o*g-a*u*g,T=t*y+n*v+i*x+s*w;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/T;return e[0]=y*C,e[1]=(_*f*s-u*g*s-_*i*d+n*g*d+u*i*m-n*f*m)*C,e[2]=(o*g*s-_*l*s+_*i*c-n*g*c-o*i*m+n*l*m)*C,e[3]=(u*l*s-o*f*s-u*i*c+n*f*c+o*i*d-n*l*d)*C,e[4]=v*C,e[5]=(h*g*s-p*f*s+p*i*d-t*g*d-h*i*m+t*f*m)*C,e[6]=(p*l*s-a*g*s-p*i*c+t*g*c+a*i*m-t*l*m)*C,e[7]=(a*f*s-h*l*s+h*i*c-t*f*c-a*i*d+t*l*d)*C,e[8]=x*C,e[9]=(p*u*s-h*_*s-p*n*d+t*_*d+h*n*m-t*u*m)*C,e[10]=(a*_*s-p*o*s+p*n*c-t*_*c-a*n*m+t*o*m)*C,e[11]=(h*o*s-a*u*s-h*n*c+t*u*c+a*n*d-t*o*d)*C,e[12]=w*C,e[13]=(h*_*i-p*u*i+p*n*f-t*_*f-h*n*g+t*u*g)*C,e[14]=(p*o*i-a*_*i-p*n*l+t*_*l+a*n*g-t*o*g)*C,e[15]=(a*u*i-h*o*i+h*n*l-t*u*l-a*n*f+t*o*f)*C,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,h=s*o;return this.set(c*a+n,c*o-i*l,c*l+i*o,0,c*o+i*l,h*o+n,h*l-i*a,0,c*l-i*o,h*l+i*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,a){return this.set(1,n,s,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,h=a+a,u=o+o,f=s*c,d=s*h,p=s*u,_=a*h,g=a*u,m=o*u,y=l*c,v=l*h,x=l*u,w=n.x,T=n.y,C=n.z;return i[0]=(1-(_+m))*w,i[1]=(d+x)*w,i[2]=(p-v)*w,i[3]=0,i[4]=(d-x)*T,i[5]=(1-(f+m))*T,i[6]=(g+y)*T,i[7]=0,i[8]=(p+v)*C,i[9]=(g-y)*C,i[10]=(1-(f+_))*C,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let s=Ms.set(i[0],i[1],i[2]).length();const a=Ms.set(i[4],i[5],i[6]).length(),o=Ms.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Ln.copy(this);const c=1/s,h=1/a,u=1/o;return Ln.elements[0]*=c,Ln.elements[1]*=c,Ln.elements[2]*=c,Ln.elements[4]*=h,Ln.elements[5]*=h,Ln.elements[6]*=h,Ln.elements[8]*=u,Ln.elements[9]*=u,Ln.elements[10]*=u,t.setFromRotationMatrix(Ln),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,i,s,a,o=zn){const l=this.elements,c=2*s/(t-e),h=2*s/(n-i),u=(t+e)/(t-e),f=(n+i)/(n-i);let d,p;if(o===zn)d=-(a+s)/(a-s),p=-2*a*s/(a-s);else if(o===uo)d=-a/(a-s),p=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=h,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=d,l[14]=p,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,s,a,o=zn){const l=this.elements,c=1/(t-e),h=1/(n-i),u=1/(a-s),f=(t+e)*c,d=(n+i)*h;let p,_;if(o===zn)p=(a+s)*u,_=-2*u;else if(o===uo)p=s*u,_=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-d,l[2]=0,l[6]=0,l[10]=_,l[14]=-p,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const Ms=new A,Ln=new Ze,Vp=new A(0,0,0),Hp=new A(1,1,1),vi=new A,ta=new A,_n=new A,Ah=new Ze,Ch=new rn;class In{constructor(e=0,t=0,n=0,i=In.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],a=i[4],o=i[8],l=i[1],c=i[5],h=i[9],u=i[2],f=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(et(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-et(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(et(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-et(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(et(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-et(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Ah.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ah,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Ch.setFromEuler(this),this.setFromQuaternion(Ch,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}In.DEFAULT_ORDER="XYZ";class Vc{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c0){i.children=[];for(let o=0;o0){i.animations=[];for(let o=0;o0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),f.length>0&&(n.skeletons=f),d.length>0&&(n.animations=d),p.length>0&&(n.nodes=p)}return n.object=i,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){Un.subVectors(i,t),Jn.subVectors(n,t),qo.subVectors(e,t);const a=Un.dot(Un),o=Un.dot(Jn),l=Un.dot(qo),c=Jn.dot(Jn),h=Jn.dot(qo),u=a*c-o*o;if(u===0)return s.set(0,0,0),null;const f=1/u,d=(c*l-o*h)*f,p=(a*h-o*l)*f;return s.set(1-d-p,p,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Kn)===null?!1:Kn.x>=0&&Kn.y>=0&&Kn.x+Kn.y<=1}static getInterpolation(e,t,n,i,s,a,o,l){return this.getBarycoord(e,t,n,i,Kn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Kn.x),l.addScaledVector(a,Kn.y),l.addScaledVector(o,Kn.z),l)}static getInterpolatedAttribute(e,t,n,i,s,a){return Ko.setScalar(0),$o.setScalar(0),jo.setScalar(0),Ko.fromBufferAttribute(e,t),$o.fromBufferAttribute(e,n),jo.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(Ko,s.x),a.addScaledVector($o,s.y),a.addScaledVector(jo,s.z),a}static isFrontFacing(e,t,n,i){return Un.subVectors(n,t),Jn.subVectors(e,t),Un.cross(Jn).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Un.subVectors(this.c,this.b),Jn.subVectors(this.a,this.b),Un.cross(Jn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return yn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return yn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return yn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return yn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return yn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let a,o;ws.subVectors(i,n),Es.subVectors(s,n),Yo.subVectors(e,n);const l=ws.dot(Yo),c=Es.dot(Yo);if(l<=0&&c<=0)return t.copy(n);Zo.subVectors(e,i);const h=ws.dot(Zo),u=Es.dot(Zo);if(h>=0&&u<=h)return t.copy(i);const f=l*u-h*c;if(f<=0&&l>=0&&h<=0)return a=l/(l-h),t.copy(n).addScaledVector(ws,a);Jo.subVectors(e,s);const d=ws.dot(Jo),p=Es.dot(Jo);if(p>=0&&d<=p)return t.copy(s);const _=d*c-l*p;if(_<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(Es,o);const g=h*p-d*u;if(g<=0&&u-h>=0&&d-p>=0)return Uh.subVectors(s,i),o=(u-h)/(u-h+(d-p)),t.copy(i).addScaledVector(Uh,o);const m=1/(g+_+f);return a=_*m,o=f*m,t.copy(n).addScaledVector(ws,a).addScaledVector(Es,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const wd={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},xi={h:0,s:0,l:0},ia={h:0,s:0,l:0};function Qo(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class ne{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=xn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ht.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=ht.workingColorSpace){return this.r=e,this.g=t,this.b=n,ht.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=ht.workingColorSpace){if(e=Bc(e,1),t=et(t,0,1),n=et(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=Qo(a,s,e+1/3),this.g=Qo(a,s,e),this.b=Qo(a,s,e-1/3)}return ht.toWorkingColorSpace(this,i),this}setStyle(e,t=xn){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=xn){const n=wd[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ri(e.r),this.g=ri(e.g),this.b=ri(e.b),this}copyLinearToSRGB(e){return this.r=Zs(e.r),this.g=Zs(e.g),this.b=Zs(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=xn){return ht.fromWorkingColorSpace(Kt.copy(this),e),Math.round(et(Kt.r*255,0,255))*65536+Math.round(et(Kt.g*255,0,255))*256+Math.round(et(Kt.b*255,0,255))}getHexString(e=xn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ht.workingColorSpace){ht.fromWorkingColorSpace(Kt.copy(this),t);const n=Kt.r,i=Kt.g,s=Kt.b,a=Math.max(n,i,s),o=Math.min(n,i,s);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const u=a-o;switch(c=h<=.5?u/(a+o):u/(2-a-o),a){case n:l=(i-s)/u+(i0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==qs&&(n.blending=this.blending),this.side!==Ci&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Pl&&(n.blendSrc=this.blendSrc),this.blendDst!==Dl&&(n.blendDst=this.blendDst),this.blendEquation!==Qi&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ks&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==yh&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==gs&&(n.stencilFail=this.stencilFail),this.stencilZFail!==gs&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==gs&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=i(e.textures),a=i(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class kn extends on{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ne(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new In,this.combine=bo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const ti=Zp();function Zp(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(n[l]=0,n[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,i[l]=24,i[l|256]=24):(n[l]=31744,n[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,h=0;for(;(c&8388608)===0;)c<<=1,h-=8388608;c&=-8388609,h+=947912704,s[l]=c|h}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:a,offsetTable:o}}function un(r){Math.abs(r)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),r=et(r,-65504,65504),ti.floatView[0]=r;const e=ti.uint32View[0],t=e>>23&511;return ti.baseTable[t]+((e&8388607)>>ti.shiftTable[t])}function Rr(r){const e=r>>10;return ti.uint32View[0]=ti.mantissaTable[ti.offsetTable[e]+(r&1023)]+ti.exponentTable[e],ti.floatView[0]}const VS={toHalfFloat:un,fromHalfFloat:Rr},Lt=new A,sa=new j;class rt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ho,this.updateRanges=[],this.gpuType=Mn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;it.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new pn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new A(-1/0,-1/0,-1/0),new A(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let u=0,f=c.length;u0&&(i[l]=h,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const c in i){const h=i[c];this.setAttribute(c,h.clone(t))}const s=e.morphAttributes;for(const c in s){const h=[],u=s[c];for(let f=0,d=u.length;f0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s(e.far-e.near)**2))&&(Nh.copy(s).invert(),Bi.copy(e.ray).applyMatrix4(Nh),!(n.boundingBox!==null&&Bi.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Bi)))}_computeIntersections(e,t,n){let i;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,u=s.attributes.normal,f=s.groups,d=s.drawRange;if(o!==null)if(Array.isArray(a))for(let p=0,_=f.length;p<_;p++){const g=f[p],m=a[g.materialIndex],y=Math.max(g.start,d.start),v=Math.min(o.count,Math.min(g.start+g.count,d.start+d.count));for(let x=y,w=v;xt.far?null:{distance:c,point:ha.clone(),object:r}}function ua(r,e,t,n,i,s,a,o,l,c){r.getVertexPosition(o,aa),r.getVertexPosition(l,oa),r.getVertexPosition(c,la);const h=Kp(r,e,t,n,aa,oa,la,Oh);if(h){const u=new A;yn.getBarycoord(Oh,aa,oa,la,u),i&&(h.uv=yn.getInterpolatedAttribute(i,o,l,c,u,new j)),s&&(h.uv1=yn.getInterpolatedAttribute(s,o,l,c,u,new j)),a&&(h.normal=yn.getInterpolatedAttribute(a,o,l,c,u,new A),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const f={a:o,b:l,c,normal:new A,materialIndex:0};yn.getNormal(aa,oa,la,f.normal),h.face=f,h.barycoord=u}return h}class or extends qe{constructor(e=1,t=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],h=[],u=[];let f=0,d=0;p("z","y","x",-1,-1,n,t,e,a,s,0),p("z","y","x",1,-1,n,t,-e,a,s,1),p("x","z","y",1,1,e,n,t,i,a,2),p("x","z","y",1,-1,e,n,-t,i,a,3),p("x","y","z",1,-1,e,t,n,i,s,4),p("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new Fe(c,3)),this.setAttribute("normal",new Fe(h,3)),this.setAttribute("uv",new Fe(u,2));function p(_,g,m,y,v,x,w,T,C,P,S){const M=x/C,D=w/P,G=x/2,F=w/2,V=T/2,J=C+1,q=P+1;let se=0,Z=0;const _e=new A;for(let be=0;be0?1:-1,h.push(_e.x,_e.y,_e.z),u.push(Ge/C),u.push(1-be/P),se+=1}}for(let be=0;be0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Hc extends mt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ze,this.projectionMatrix=new Ze,this.projectionMatrixInverse=new Ze,this.coordinateSystem=zn}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const yi=new A,Bh=new j,zh=new j;class kt extends Hc{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=er*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ss*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return er*2*Math.atan(Math.tan(ss*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){yi.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(yi.x,yi.y).multiplyScalar(-e/yi.z),yi.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(yi.x,yi.y).multiplyScalar(-e/yi.z)}getViewSize(e,t){return this.getViewBounds(e,Bh,zh),t.subVectors(zh,Bh)}setViewOffset(e,t,n,i,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(ss*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*i/l,t-=a.offsetY*n/c,i*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const As=-90,Cs=1;class em extends mt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new kt(As,Cs,e,t);i.layers=this.layers,this.add(i);const s=new kt(As,Cs,e,t);s.layers=this.layers,this.add(s);const a=new kt(As,Cs,e,t);a.layers=this.layers,this.add(a);const o=new kt(As,Cs,e,t);o.layers=this.layers,this.add(o);const l=new kt(As,Cs,e,t);l.layers=this.layers,this.add(l);const c=new kt(As,Cs,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===zn)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===uo)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,h]=this.children,u=e.getRenderTarget(),f=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,s),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,o),e.setRenderTarget(n,3,i),e.render(t,l),e.setRenderTarget(n,4,i),e.render(t,c),n.texture.generateMipmaps=_,e.setRenderTarget(n,5,i),e.render(t,h),e.setRenderTarget(u,f,d),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class Eo extends Et{constructor(e,t,n,i,s,a,o,l,c,h){e=e!==void 0?e:[],t=t!==void 0?t:Ri,super(e,t,n,i,s,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class tm extends Sn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Eo(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Vt}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` - - varying vec3 vWorldDirection; - - vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); - - } - - void main() { - - vWorldDirection = transformDirection( position, modelMatrix ); - - #include - #include - - } - `,fragmentShader:` - - uniform sampler2D tEquirect; - - varying vec3 vWorldDirection; - - #include - - void main() { - - vec3 direction = normalize( vWorldDirection ); - - vec2 sampleUV = equirectUv( direction ); - - gl_FragColor = texture2D( tEquirect, sampleUV ); - - } - `},i=new or(5,5,5),s=new Xt({name:"CubemapFromEquirect",uniforms:tr(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:fn,blending:ii});s.uniforms.tEquirect.value=t;const a=new yt(i,s),o=t.minFilter;return t.minFilter===ni&&(t.minFilter=Vt),new em(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,i){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(s)}}class Yr{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new ne(e),this.density=t}clone(){return new Yr(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Gc{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new ne(e),this.near=t,this.far=n}clone(){return new Gc(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Cd extends mt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new In,this.environmentIntensity=1,this.environmentRotation=new In,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Wc{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ho,this.updateRanges=[],this.version=0,this.uuid=bn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;ie.far||t.push({distance:l,point:xr.clone(),uv:yn.getInterpolation(xr,da,Mr,fa,kh,nl,Vh,new j),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function pa(r,e,t,n,i,s){Ds.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(yr.x=s*Ds.x-i*Ds.y,yr.y=i*Ds.x+s*Ds.y):yr.copy(Ds),r.copy(e),r.x+=yr.x,r.y+=yr.y,r.applyMatrix4(Rd)}const ma=new A,Hh=new A;class nm extends mt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n0){let n,i;for(n=1,i=t.length;n0){ma.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(ma);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){ma.setFromMatrixPosition(e.matrixWorld),Hh.setFromMatrixPosition(this.matrixWorld);const n=ma.distanceTo(Hh)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i=a)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||lm.getNormalMatrix(e),i=this.coplanarPoint(rl).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const zi=new an,va=new A;class To{constructor(e=new Si,t=new Si,n=new Si,i=new Si,s=new Si,a=new Si){this.planes=[e,t,n,i,s,a]}set(e,t,n,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=zn){const n=this.planes,i=e.elements,s=i[0],a=i[1],o=i[2],l=i[3],c=i[4],h=i[5],u=i[6],f=i[7],d=i[8],p=i[9],_=i[10],g=i[11],m=i[12],y=i[13],v=i[14],x=i[15];if(n[0].setComponents(l-s,f-c,g-d,x-m).normalize(),n[1].setComponents(l+s,f+c,g+d,x+m).normalize(),n[2].setComponents(l+a,f+h,g+p,x+y).normalize(),n[3].setComponents(l-a,f-h,g-p,x-y).normalize(),n[4].setComponents(l-o,f-u,g-_,x-v).normalize(),t===zn)n[5].setComponents(l+o,f+u,g+_,x+v).normalize();else if(t===uo)n[5].setComponents(o,u,_,v).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),zi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),zi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(zi)}intersectsSprite(e){return zi.center.set(0,0,0),zi.radius=.7071067811865476,zi.applyMatrix4(e.matrixWorld),this.intersectsSphere(zi)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)0?e.max.x:e.min.x,va.y=i.normal.y>0?e.max.y:e.min.y,va.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(va)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function al(r,e){return r-e}function cm(r,e){return r.z-e.z}function hm(r,e){return e.z-r.z}class um{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){const s=this.pool,a=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const o=s[this.index];a.push(o),this.index++,o.start=e,o.count=t,o.z=n,o.index=i}reset(){this.list.length=0,this.index=0}}const cn=new Ze,dm=new ne(1,1,1),ol=new To,xa=new pn,ki=new an,wr=new A,$h=new A,fm=new A,ll=new um,$t=new yt,ya=[];function pm(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let s=0;s65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new rt(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),s=t.getAttribute(n);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new pn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(al),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const s=this._matricesTexture;cn.identity().toArray(s.image.data,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(dm.toArray(a.image.data,i*4),a.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},s=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const a=e.getIndex();if(a!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?a.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let l;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(al),l=this._availableGeometryIds.shift(),s[l]=i):(l=this._geometryCount,this._geometryCount++,s.push(i)),this.setGeometryAt(l,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,l}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,s=n.getIndex(),a=t.getIndex(),o=this._geometryInfo[e];if(i&&a.count>o.reservedIndexCount||t.attributes.position.count>o.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const l=o.vertexStart,c=o.reservedVertexCount;o.vertexCount=t.getAttribute("position").count;for(const h in n.attributes){const u=t.getAttribute(h),f=n.getAttribute(h);pm(u,f,l);const d=u.itemSize;for(let p=u.count,_=c;p<_;p++){const g=l+p;for(let m=0;m=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,s=n.length;io).sort((a,o)=>n[a].vertexStart-n[o].vertexStart),s=this.geometry;for(let a=0,o=n.length;a=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const s=new pn,a=n.index,o=n.attributes.position;for(let l=i.start,c=i.start+i.count;l=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const s=new an;this.getBoundingBoxAt(e,xa),xa.getCenter(s.center);const a=n.index,o=n.attributes.position;let l=0;for(let c=i.start,h=i.start+i.count;co.active);if(Math.max(...n.map(o=>o.vertexStart+o.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(l=>l.indexStart+l.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const s=this.geometry;s.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new qe,this._initializeGeometry(s));const a=this.geometry;s.index&&Vi(s.index.array,a.index.array);for(const o in s.attributes)Vi(s.attributes[o].array,a.attributes[o].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,s=this.matrixWorld,a=this.geometry;$t.material=this.material,$t.geometry.index=a.index,$t.geometry.attributes=a.attributes,$t.geometry.boundingBox===null&&($t.geometry.boundingBox=new pn),$t.geometry.boundingSphere===null&&($t.geometry.boundingSphere=new an);for(let o=0,l=n.length;o({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,n,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const a=i.getIndex(),o=a===null?1:a.array.BYTES_PER_ELEMENT,l=this._instanceInfo,c=this._multiDrawStarts,h=this._multiDrawCounts,u=this._geometryInfo,f=this.perObjectFrustumCulled,d=this._indirectTexture,p=d.image.data;f&&(cn.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),ol.setFromProjectionMatrix(cn,e.coordinateSystem));let _=0;if(this.sortObjects){cn.copy(this.matrixWorld).invert(),wr.setFromMatrixPosition(n.matrixWorld).applyMatrix4(cn),$h.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(cn);for(let y=0,v=l.length;y0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;sn)return;cl.applyMatrix4(r.matrixWorld);const l=e.ray.origin.distanceTo(cl);if(!(le.far))return{distance:l,point:Qh.clone().applyMatrix4(r.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:r}}const eu=new A,tu=new A;class hi extends Vn{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class ns extends mt{constructor(){super(),this.isGroup=!0,this.type="Group"}}class ZS extends Et{constructor(e,t,n,i,s,a,o,l,c){super(e,t,n,i,s,a,o,l,c),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:Vt,this.magFilter=s!==void 0?s:Vt,this.generateMipmaps=!1;const h=this;function u(){h.needsUpdate=!0,e.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(u)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class JS extends Et{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Qt,this.minFilter=Qt,this.generateMipmaps=!1,this.needsUpdate=!0}}class qc extends Et{constructor(e,t,n,i,s,a,o,l,c,h,u,f){super(null,a,o,l,c,h,i,s,u,f),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class KS extends qc{constructor(e,t,n,i,s,a){super(e,t,n,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Nn,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class $S extends qc{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Ri),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Dd extends Et{constructor(e,t,n,i,s,a,o,l,c){super(e,t,n,i,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Ld extends Et{constructor(e,t,n,i,s,a,o,l,c,h=Ys){if(h!==Ys&&h!==js)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&h===Ys&&(n=Ii),n===void 0&&h===js&&(n=$s),super(null,i,s,a,o,l,h,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:Qt,this.minFilter=l!==void 0?l:Qt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Hn{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,l=s-1,c;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),c=n[i]-a,c<0)o=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,n[i]===a)return i/(s-1);const h=n[i],f=n[i+1]-h,d=(a-h)/f;return(i+d)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),o=this.getPoint(s),l=t||(a.isVector2?new j:new A);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new A,i=[],s=[],a=[],o=new A,l=new Ze;for(let d=0;d<=e;d++){const p=d/e;i[d]=this.getTangentAt(p,new A)}s[0]=new A,a[0]=new A;let c=Number.MAX_VALUE;const h=Math.abs(i[0].x),u=Math.abs(i[0].y),f=Math.abs(i[0].z);h<=c&&(c=h,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),f<=c&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],o),a[0].crossVectors(i[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),a[d]=a[d-1].clone(),o.crossVectors(i[d-1],i[d]),o.length()>Number.EPSILON){o.normalize();const p=Math.acos(et(i[d-1].dot(i[d]),-1,1));s[d].applyMatrix4(l.makeRotationAxis(o,p))}a[d].crossVectors(i[d],s[d])}if(t===!0){let d=Math.acos(et(s[0].dot(s[e]),-1,1));d/=e,i[0].dot(o.crossVectors(s[0],s[e]))>0&&(d=-d);for(let p=1;p<=e;p++)s[p].applyMatrix4(l.makeRotationAxis(i[p],d*p)),a[p].crossVectors(i[p],s[p])}return{tangents:i,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Yc extends Hn{constructor(e=0,t=0,n=1,i=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t=new j){const n=t,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,h;this.closed||o>0?c=i[(o-1)%s]:(Ea.subVectors(i[0],i[1]).add(i[0]),c=Ea);const u=i[o%s],f=i[(o+1)%s];if(this.closed||o+2i.length-2?i.length-1:a+1],u=i[a>i.length-3?i.length-1:a+2];return n.set(su(o,l.x,c.x,h.x,u.x),su(o,l.y,c.y,h.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const a=i[s]-n,o=this.curves[s],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);const h=c.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Ao extends qe{constructor(e=[new j(0,-.5),new j(.5,0),new j(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=et(i,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],h=1/t,u=new A,f=new j,d=new A,p=new A,_=new A;let g=0,m=0;for(let y=0;y<=e.length-1;y++)switch(y){case 0:g=e[y+1].x-e[y].x,m=e[y+1].y-e[y].y,d.x=m*1,d.y=-g,d.z=m*0,_.copy(d),d.normalize(),l.push(d.x,d.y,d.z);break;case e.length-1:l.push(_.x,_.y,_.z);break;default:g=e[y+1].x-e[y].x,m=e[y+1].y-e[y].y,d.x=m*1,d.y=-g,d.z=m*0,p.copy(d),d.x+=_.x,d.y+=_.y,d.z+=_.z,d.normalize(),l.push(d.x,d.y,d.z),_.copy(p)}for(let y=0;y<=t;y++){const v=n+y*h*i,x=Math.sin(v),w=Math.cos(v);for(let T=0;T<=e.length-1;T++){u.x=e[T].x*x,u.y=e[T].y,u.z=e[T].x*w,a.push(u.x,u.y,u.z),f.x=y/t,f.y=T/(e.length-1),o.push(f.x,f.y);const C=l[3*T+0]*x,P=l[3*T+1],S=l[3*T+0]*w;c.push(C,P,S)}}for(let y=0;y0&&v(!0),t>0&&v(!1)),this.setIndex(h),this.setAttribute("position",new Fe(u,3)),this.setAttribute("normal",new Fe(f,3)),this.setAttribute("uv",new Fe(d,2));function y(){const x=new A,w=new A;let T=0;const C=(t-e)/n;for(let P=0;P<=s;P++){const S=[],M=P/s,D=M*(t-e)+e;for(let G=0;G<=i;G++){const F=G/i,V=F*l+o,J=Math.sin(V),q=Math.cos(V);w.x=D*J,w.y=-M*n+g,w.z=D*q,u.push(w.x,w.y,w.z),x.set(J,C,q).normalize(),f.push(x.x,x.y,x.z),d.push(F,1-M),S.push(p++)}_.push(S)}for(let P=0;P0||S!==0)&&(h.push(M,D,F),T+=3),(t>0||S!==s-1)&&(h.push(D,G,F),T+=3)}c.addGroup(m,T,0),m+=T}function v(x){const w=p,T=new j,C=new A;let P=0;const S=x===!0?e:t,M=x===!0?1:-1;for(let G=1;G<=i;G++)u.push(0,g*M,0),f.push(0,M,0),d.push(.5,.5),p++;const D=p;for(let G=0;G<=i;G++){const V=G/i*l+o,J=Math.cos(V),q=Math.sin(V);C.x=S*q,C.y=g*M,C.z=S*J,u.push(C.x,C.y,C.z),f.push(0,M,0),T.x=J*.5+.5,T.y=q*.5*M+.5,d.push(T.x,T.y),p++}for(let G=0;G.9&&C<.1&&(v<.2&&(a[y+0]+=1),x<.2&&(a[y+2]+=1),w<.2&&(a[y+4]+=1))}}function f(y){s.push(y.x,y.y,y.z)}function d(y,v){const x=y*3;v.x=e[x+0],v.y=e[x+1],v.z=e[x+2]}function p(){const y=new A,v=new A,x=new A,w=new A,T=new j,C=new j,P=new j;for(let S=0,M=0;S80*t){o=c=r[0],l=h=r[1];for(let p=t;pc&&(c=u),f>h&&(h=f);d=Math.max(c-o,h-l),d=d!==0?32767/d:0}return Gr(s,a,t,o,l,d,0),a}};function zd(r,e,t,n,i){let s,a;if(i===qm(r,e,t,n)>0)for(s=e;s=e;s-=n)a=ru(s,r[s],r[s+1],a);return a&&Co(a,a.next)&&(Xr(a),a=a.next),a}function ls(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(Co(t,t.next)||wt(t.prev,t,t.next)===0)){if(Xr(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Gr(r,e,t,n,i,s,a){if(!r)return;!a&&s&&km(r,n,i,s);let o=r,l,c;for(;r.prev!==r.next;){if(l=r.prev,c=r.next,s?Dm(r,n,i,s):Pm(r)){e.push(l.i/t|0),e.push(r.i/t|0),e.push(c.i/t|0),Xr(r),r=c.next,o=c.next;continue}if(r=c,r===o){a?a===1?(r=Lm(ls(r),e,t),Gr(r,e,t,n,i,s,2)):a===2&&Um(r,e,t,n,i,s):Gr(ls(r),e,t,n,i,s,1);break}}}function Pm(r){const e=r.prev,t=r,n=r.next;if(wt(e,t,n)>=0)return!1;const i=e.x,s=t.x,a=n.x,o=e.y,l=t.y,c=n.y,h=is?i>a?i:a:s>a?s:a,d=o>l?o>c?o:c:l>c?l:c;let p=n.next;for(;p!==e;){if(p.x>=h&&p.x<=f&&p.y>=u&&p.y<=d&&Hs(i,o,s,l,a,c,p.x,p.y)&&wt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Dm(r,e,t,n){const i=r.prev,s=r,a=r.next;if(wt(i,s,a)>=0)return!1;const o=i.x,l=s.x,c=a.x,h=i.y,u=s.y,f=a.y,d=ol?o>c?o:c:l>c?l:c,g=h>u?h>f?h:f:u>f?u:f,m=pc(d,p,e,t,n),y=pc(_,g,e,t,n);let v=r.prevZ,x=r.nextZ;for(;v&&v.z>=m&&x&&x.z<=y;){if(v.x>=d&&v.x<=_&&v.y>=p&&v.y<=g&&v!==i&&v!==a&&Hs(o,h,l,u,c,f,v.x,v.y)&&wt(v.prev,v,v.next)>=0||(v=v.prevZ,x.x>=d&&x.x<=_&&x.y>=p&&x.y<=g&&x!==i&&x!==a&&Hs(o,h,l,u,c,f,x.x,x.y)&&wt(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;v&&v.z>=m;){if(v.x>=d&&v.x<=_&&v.y>=p&&v.y<=g&&v!==i&&v!==a&&Hs(o,h,l,u,c,f,v.x,v.y)&&wt(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;x&&x.z<=y;){if(x.x>=d&&x.x<=_&&x.y>=p&&x.y<=g&&x!==i&&x!==a&&Hs(o,h,l,u,c,f,x.x,x.y)&&wt(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Lm(r,e,t){let n=r;do{const i=n.prev,s=n.next.next;!Co(i,s)&&kd(i,n,n.next,s)&&Wr(i,s)&&Wr(s,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(s.i/t|0),Xr(n),Xr(n.next),n=r=s),n=n.next}while(n!==r);return ls(n)}function Um(r,e,t,n,i,s){let a=r;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&Gm(a,o)){let l=Vd(a,o);a=ls(a,a.next),l=ls(l,l.next),Gr(a,e,t,n,i,s,0),Gr(l,e,t,n,i,s,0);return}o=o.next}a=a.next}while(a!==r)}function Nm(r,e,t,n){const i=[];let s,a,o,l,c;for(s=0,a=e.length;s=t.next.y&&t.next.y!==t.y){const f=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=s&&f>n&&(n=f,i=t.x=t.x&&t.x>=l&&s!==t.x&&Hs(ai.x||t.x===i.x&&zm(i,t)))&&(i=t,h=u)),t=t.next;while(t!==o);return i}function zm(r,e){return wt(r.prev,r,e.prev)<0&&wt(e.next,r,r.next)<0}function km(r,e,t,n){let i=r;do i.z===0&&(i.z=pc(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,Vm(i)}function Vm(r){let e,t,n,i,s,a,o,l,c=1;do{for(t=r,r=null,s=null,a=0;t;){for(a++,n=t,o=0,e=0;e0||l>0&&n;)o!==0&&(l===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,o--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,c*=2}while(a>1);return r}function pc(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function Hm(r){let e=r,t=r;do(e.x=(r-a)*(s-o)&&(r-a)*(n-o)>=(t-a)*(e-o)&&(t-a)*(s-o)>=(i-a)*(n-o)}function Gm(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!Wm(r,e)&&(Wr(r,e)&&Wr(e,r)&&Xm(r,e)&&(wt(r.prev,r,e.prev)||wt(r,e.prev,e))||Co(r,e)&&wt(r.prev,r,r.next)>0&&wt(e.prev,e,e.next)>0)}function wt(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function Co(r,e){return r.x===e.x&&r.y===e.y}function kd(r,e,t,n){const i=Ia(wt(r,e,t)),s=Ia(wt(r,e,n)),a=Ia(wt(t,n,r)),o=Ia(wt(t,n,e));return!!(i!==s&&a!==o||i===0&&Ra(r,t,e)||s===0&&Ra(r,n,e)||a===0&&Ra(t,r,n)||o===0&&Ra(t,e,n))}function Ra(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Ia(r){return r>0?1:r<0?-1:0}function Wm(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&kd(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Wr(r,e){return wt(r.prev,r,r.next)<0?wt(r,e,r.next)>=0&&wt(r,r.prev,e)>=0:wt(r,e,r.prev)<0||wt(r,r.next,e)<0}function Xm(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function Vd(r,e){const t=new mc(r.i,r.x,r.y),n=new mc(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function ru(r,e,t,n){const i=new mc(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Xr(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function mc(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function qm(r,e,t,n){let i=0;for(let s=e,a=t-n;s2&&r[e-1].equals(r[0])&&r.pop()}function ou(r,e){for(let t=0;tNumber.EPSILON){const k=Math.sqrt(b),X=Math.sqrt(Se*Se+R*R),W=de.x-Ve/k,ce=de.y+me/k,oe=I.x-R/X,ge=I.y+Se/X,Be=((oe-W)*R-(ge-ce)*Se)/(me*R-Ve*Se);De=W+me*Be-te.x,re=ce+Ve*Be-te.y;const $=De*De+re*re;if($<=2)return new j(De,re);Ae=Math.sqrt($/2)}else{let k=!1;me>Number.EPSILON?Se>Number.EPSILON&&(k=!0):me<-Number.EPSILON?Se<-Number.EPSILON&&(k=!0):Math.sign(Ve)===Math.sign(R)&&(k=!0),k?(De=-Ve,re=me,Ae=Math.sqrt(b)):(De=me,re=Ve,Ae=Math.sqrt(b/2))}return new j(De/Ae,re/Ae)}const _e=[];for(let te=0,de=V.length,I=de-1,De=te+1;te=0;te--){const de=te/g,I=d*Math.cos(de*Math.PI/2),De=p*Math.sin(de*Math.PI/2)+_;for(let re=0,Ae=V.length;re=0;){const De=I;let re=I-1;re<0&&(re=te.length-1);for(let Ae=0,me=h+g*2;Ae0)&&d.push(v,x,T),(m!==n-1||l0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class eg extends on{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ne(16777215),this.specular=new ne(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ne(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cs,this.normalScale=new j(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new In,this.combine=bo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class tg extends on{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ne(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ne(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cs,this.normalScale=new j(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class ng extends on{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cs,this.normalScale=new j(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class ig extends on{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ne(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ne(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cs,this.normalScale=new j(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new In,this.combine=bo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Hd extends on{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=rp,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Gd extends on{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class sg extends on{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ne(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=cs,this.normalScale=new j(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class rg extends qt{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function is(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function Wd(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function Xd(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function gc(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,a=0;a!==n;++s){const o=t[s]*e;for(let l=0;l!==e;++l)i[a++]=r[o+l]}return i}function oh(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push.apply(t,a)),s=r[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=r[i++];while(s!==void 0)}function ag(r,e,t,n,i=30){const s=r.clone();s.name=e;const a=[];for(let l=0;l=n)){u.push(c.times[d]);for(let _=0;_s.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l=o.times[p]){const m=p*u+h,y=m+u-h;_=o.values.slice(m,y)}else{const m=o.createInterpolant(),y=h,v=u-h;m.evaluate(s),_=m.resultBuffer.slice(y,v)}l==="quaternion"&&new rn().fromArray(_).normalize().conjugate().toArray(_);const g=c.times.length;for(let m=0;m=s)){const o=t[1];e=s)break t}a=n,n=0;break n}break e}for(;n>>1;et;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(i!==void 0&&Wd(i))for(let o=0,l=i.length;o!==l;++o){const c=i[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Fo,s=e.length-1;let a=1;for(let o=1;o0){e[a]=e[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Gn.prototype.TimeBufferType=Float32Array;Gn.prototype.ValueBufferType=Float32Array;Gn.prototype.DefaultInterpolation=dc;class hr extends Gn{constructor(e,t,n){super(e,t,n)}}hr.prototype.ValueTypeName="bool";hr.prototype.ValueBufferType=Array;hr.prototype.DefaultInterpolation=oo;hr.prototype.InterpolantFactoryMethodLinear=void 0;hr.prototype.InterpolantFactoryMethodSmooth=void 0;class Yd extends Gn{}Yd.prototype.ValueTypeName="color";class vo extends Gn{}vo.prototype.ValueTypeName="number";class hg extends Po{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-t)/(i-t);let c=e*o;for(let h=c+o;c!==h;c+=4)rn.slerpFlat(s,0,a,c-o,a,c,l);return s}}class Do extends Gn{InterpolantFactoryMethodLinear(e){return new hg(this.times,this.values,this.getValueSize(),e)}}Do.prototype.ValueTypeName="quaternion";Do.prototype.InterpolantFactoryMethodSmooth=void 0;class ur extends Gn{constructor(e,t,n){super(e,t,n)}}ur.prototype.ValueTypeName="string";ur.prototype.ValueBufferType=Array;ur.prototype.DefaultInterpolation=oo;ur.prototype.InterpolantFactoryMethodLinear=void 0;ur.prototype.InterpolantFactoryMethodSmooth=void 0;class xo extends Gn{}xo.prototype.ValueTypeName="vector";class yo{constructor(e="",t=-1,n=[],i=Oc){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=bn(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(dg(n[a]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=n.length;s!==a;++s)t.push(Gn.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,a=[];for(let o=0;o1){const u=h[1];let f=i[u];f||(i[u]=f=[]),f.push(c)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(u,f,d,p,_){if(d.length!==0){const g=[],m=[];oh(d,g,m,p),g.length!==0&&_.push(new u(f,g,m))}},i=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let u=0;u{t&&t(s),this.manager.itemEnd(e)},0),s;if($n[e]!==void 0){$n[e].push({onLoad:t,onProgress:n,onError:i});return}$n[e]=[],$n[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const h=$n[e],u=c.body.getReader(),f=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),d=f?parseInt(f):0,p=d!==0;let _=0;const g=new ReadableStream({start(m){y();function y(){u.read().then(({done:v,value:x})=>{if(v)m.close();else{_+=x.byteLength;const w=new ProgressEvent("progress",{lengthComputable:p,loaded:_,total:d});for(let T=0,C=h.length;T{m.error(v)})}}});return new Response(g)}else throw new pg(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return c.json();default:if(o===void 0)return c.text();{const u=/charset="?([^;"\s]*)"?/i.exec(o),f=u&&u[1]?u[1].toLowerCase():void 0,d=new TextDecoder(f);return c.arrayBuffer().then(p=>d.decode(p))}}}).then(c=>{Ei.add(e,c);const h=$n[e];delete $n[e];for(let u=0,f=h.length;u{const h=$n[e];if(h===void 0)throw this.manager.itemError(e),c;delete $n[e];for(let u=0,f=h.length;u{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class QS extends wn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new Pi(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const a=e.uniforms[s];switch(i.uniforms[s]={},a.type){case"t":i.uniforms[s].value=n(a.value);break;case"c":i.uniforms[s].value=new ne().setHex(a.value);break;case"v2":i.uniforms[s].value=new j().fromArray(a.value);break;case"v3":i.uniforms[s].value=new A().fromArray(a.value);break;case"v4":i.uniforms[s].value=new pt().fromArray(a.value);break;case"m3":i.uniforms[s].value=new tt().fromArray(a.value);break;case"m4":i.uniforms[s].value=new Ze().fromArray(a.value);break;default:i.uniforms[s].value=a.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new j().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new j().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return ch.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:$m,SpriteMaterial:rs,RawShaderMaterial:jm,ShaderMaterial:Xt,PointsMaterial:Ai,MeshPhysicalMaterial:Qm,MeshStandardMaterial:ah,MeshPhongMaterial:eg,MeshToonMaterial:tg,MeshNormalMaterial:ng,MeshLambertMaterial:ig,MeshDepthMaterial:Hd,MeshDistanceMaterial:Gd,MeshBasicMaterial:kn,MeshMatcapMaterial:sg,LineDashedMaterial:rg,LineBasicMaterial:qt,Material:on};return new t[e]}}class fu{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n0){const l=new Zd(t);s=new Mo(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,h=e.length;c0){i=new Mo(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,o=e.length;a{const g=new pn;g.min.fromArray(_.boxMin),g.max.fromArray(_.boxMax);const m=new an;return m.radius=_.sphereRadius,m.center.fromArray(_.sphereCenter),{boxInitialized:_.boxInitialized,box:g,sphereInitialized:_.sphereInitialized,sphere:m}}),a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._geometryCount=e.geometryCount,a._matricesTexture=c(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(a._colorsTexture=c(e.colorsTexture.uuid));break;case"LOD":a=new nm;break;case"Line":a=new Vn(o(e.geometry),l(e.material));break;case"LineLoop":a=new gm(o(e.geometry),l(e.material));break;case"LineSegments":a=new hi(o(e.geometry),l(e.material));break;case"PointCloud":case"Points":a=new as(o(e.geometry),l(e.material));break;case"Sprite":a=new ts(l(e.material));break;case"Group":a=new ns;break;case"Bone":a=new Id;break;default:a=new mt}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(a.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const f=e.children;for(let d=0;d"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Ei.get(e);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(c=>{t&&t(c),s.manager.itemEnd(e)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader;const l=fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Ei.add(e,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),Ei.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Ei.add(e,l),s.manager.itemStart(e)}}let Pa;class Kd{static getContext(){return Pa===void 0&&(Pa=new(window.AudioContext||window.webkitAudioContext)),Pa}static setContext(e){Pa=e}}class aw extends wn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new Pi(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{const c=l.slice(0);Kd.getContext().decodeAudioData(c,function(u){t(u)}).catch(o)}catch(c){o(c)}},n,i);function o(l){i?i(l):console.error(l),s.manager.itemError(e)}}}const gu=new Ze,_u=new Ze,Hi=new Ze;class ow{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new kt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new kt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Hi.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,a=t.near*Math.tan(ss*t.fov*.5)/t.zoom;let o,l;_u.elements[12]=-i,gu.elements[12]=i,o=-a*t.aspect+s,l=a*t.aspect+s,Hi.elements[0]=2*t.near/(l-o),Hi.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(Hi),o=-a*t.aspect-s,l=a*t.aspect-s,Hi.elements[0]=2*t.near/(l-o),Hi.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(Hi)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(_u),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(gu)}}class Ag extends kt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class $d{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=vu(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=vu();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function vu(){return performance.now()}const Gi=new A,xu=new rn,Cg=new A,Wi=new A;class lw extends mt{constructor(){super(),this.type="AudioListener",this.context=Kd.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new $d}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Gi,xu,Cg),Wi.set(0,0,-1).applyQuaternion(xu),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Gi.x,i),t.positionY.linearRampToValueAtTime(Gi.y,i),t.positionZ.linearRampToValueAtTime(Gi.z,i),t.forwardX.linearRampToValueAtTime(Wi.x,i),t.forwardY.linearRampToValueAtTime(Wi.y,i),t.forwardZ.linearRampToValueAtTime(Wi.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(Gi.x,Gi.y,Gi.z),t.setOrientation(Wi.x,Wi.y,Wi.z,n.x,n.y,n.z)}}class Rg extends mt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){o.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,a=i;s!==a;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let a=0;a!==s;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){rn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const a=this._workIndex*s;rn.multiplyQuaternionsFlat(e,a,e,t,e,n),rn.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,s){const a=1-i;for(let o=0;o!==s;++o){const l=t+o;e[l]=e[l]*a+e[n+o]*i}}_lerpAdditive(e,t,n,i,s){for(let a=0;a!==s;++a){const o=t+a;e[o]=e[o]+e[n+a]*i}}}const hh="\\[\\]\\.:\\/",Dg=new RegExp("["+hh+"]","g"),uh="[^"+hh+"]",Lg="[^"+hh.replace("\\.","")+"]",Ug=/((?:WC+[\/:])*)/.source.replace("WC",uh),Ng=/(WCOD+)?/.source.replace("WCOD",Lg),Fg=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",uh),Og=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",uh),Bg=new RegExp("^"+Ug+Ng+Fg+Og+"$"),zg=["material","materials","bones","map"];class kg{constructor(e,t,n){const i=n||ft.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class ft{constructor(e,t,n){this.path=t,this.parsedPath=n||ft.parseTrackName(t),this.node=ft.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new ft.Composite(e,t,n):new ft(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Dg,"")}static parseTrackName(e){const t=Bg.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);zg.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let a=0;a=s){const u=s++,f=e[u];t[f.uuid]=h,e[h]=f,t[c]=u,e[u]=l;for(let d=0,p=i;d!==p;++d){const _=n[d],g=_[u],m=_[h];_[h]=g,_[u]=m}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,a=e.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],h=c.uuid,u=t[h];if(u!==void 0)if(delete t[h],u0&&(t[d.uuid]=u),e[u]=d,e.pop();for(let p=0,_=i;p!==_;++p){const g=n[p];g[u]=g[f],g.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,h=this.nCachedObjects_,u=new Array(c);i=s.length,n[e]=i,a.push(e),o.push(t),s.push(u);for(let f=h,d=l.length;f!==d;++f){const p=l[f];u[f]=new ft(p,e,t)}return u}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=e[o];t[c]=n,a[n]=l,a.pop(),s[n]=s[o],s.pop(),i[n]=i[o],i.pop()}}}class Vg{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,a=s.length,o=new Array(a),l={endingStart:Bs,endingEnd:Bs};for(let c=0;c!==a;++c){const h=s[c].createInterpolant(null);o[c]=h,h.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=ip,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,s=e._clip.duration,a=s/i,o=i/s;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,s=i.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,l[1]=s+n,c[0]=e/a,c[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*n;l<0||n===0?t=0:(this._startTime=null,t=n*l)}t*=this._updateTimeScale(e);const a=this._updateTime(t),o=this._updateWeight(e);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case yd:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(a),c[h].accumulateAdditive(o);break;case Oc:default:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(a),c[h].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const a=n===sp;if(e===0)return s===-1?i:a&&(s&1)===1?t-i:i;if(n===np){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){const o=Math.floor(i/t);i-=t*o,s+=Math.abs(o);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=zs,i.endingEnd=zs):(e?i.endingStart=this.zeroSlopeAtStart?zs:Bs:i.endingStart=lo,t?i.endingEnd=this.zeroSlopeAtEnd?zs:Bs:i.endingEnd=lo)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=t,o[1]=s+e,l[1]=n,this}}const Hg=new Float32Array(1);class dw extends ci{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,a=e._propertyBindings,o=e._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let h=c[l];h===void 0&&(h={},c[l]=h);for(let u=0;u!==s;++u){const f=i[u],d=f.name;let p=h[d];if(p!==void 0)++p.referenceCount,a[u]=p;else{if(p=a[u],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,l,d));continue}const _=t&&t._propertyBindings[u].binding.parsedPath;p=new Pg(ft.create(n,d,_),f.ValueTypeName,f.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,d),a[u]=p}o[u].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);return this}setTime(e){this.time=0;for(let t=0;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Su).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const wu=new A,Da=new A;class yw{constructor(e=new A,t=new A){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){wu.subVectors(e,this.start),Da.subVectors(this.end,this.start);const n=Da.dot(Da);let s=Da.dot(wu)/n;return t&&(s=et(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Eu=new A;class Mw extends mt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new qe,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,o=1,l=32;a1)for(let u=0;u.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Iu.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Iu,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class Lw extends hi{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new qe;i.setAttribute("position",new Fe(t,3)),i.setAttribute("color",new Fe(n,3));const s=new qt({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,n){const i=new ne,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Uw{constructor(){this.type="ShapePath",this.color=new ne,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new _o,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,a){return this.currentPath.bezierCurveTo(e,t,n,i,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(m){const y=[];for(let v=0,x=m.length;vNumber.EPSILON){if(M<0&&(C=y[T],S=-S,P=y[w],M=-M),m.yP.y)continue;if(m.y===C.y){if(m.x===C.x)return!0}else{const D=M*(m.x-C.x)-S*(m.y-C.y);if(D===0)return!0;if(D<0)continue;x=!x}}else{if(m.y!==C.y)continue;if(P.x<=m.x&&m.x<=C.x||C.x<=m.x&&m.x<=P.x)return!0}}return x}const i=oi.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,o,l;const c=[];if(s.length===1)return o=s[0],l=new Js,l.curves=o.curves,c.push(l),c;let h=!i(s[0].getPoints());h=e?!h:h;const u=[],f=[];let d=[],p=0,_;f[p]=void 0,d[p]=[];for(let m=0,y=s.length;m1){let m=!1,y=0;for(let v=0,x=f.length;v0&&m===!1&&(d=u)}let g;for(let m=0,y=f.length;me?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function Zg(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function Jg(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function yc(r,e,t,n){const i=Kg(n);switch(t){case pd:return r*e;case gd:return r*e;case _d:return r*e*2;case Uc:return r*e/i.components*i.byteLength;case So:return r*e/i.components*i.byteLength;case vd:return r*e*2/i.components*i.byteLength;case Nc:return r*e*2/i.components*i.byteLength;case md:return r*e*3/i.components*i.byteLength;case dn:return r*e*4/i.components*i.byteLength;case Fc:return r*e*4/i.components*i.byteLength;case qa:case Ya:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Za:case Ja:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Vl:case Gl:return Math.max(r,16)*Math.max(e,8)/4;case kl:case Hl:return Math.max(r,8)*Math.max(e,8)/2;case Wl:case Xl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case ql:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Yl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Zl:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Jl:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Kl:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case $l:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case jl:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Ql:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case ec:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case tc:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case nc:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case ic:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case sc:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case rc:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case ac:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Ka:case oc:case lc:return Math.ceil(r/4)*Math.ceil(e/4)*16;case xd:case cc:return Math.ceil(r/4)*Math.ceil(e/4)*8;case hc:case uc:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Kg(r){switch(r){case li:case ud:return{byteLength:1,components:1};case kr:case dd:case si:return{byteLength:2,components:1};case Dc:case Lc:return{byteLength:2,components:4};case Ii:case Pc:case Mn:return{byteLength:4,components:1};case fd:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}const Nw={contain:Yg,cover:Zg,fill:Jg,getByteLength:yc};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Rc}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Rc);/** - * @license - * Copyright 2010-2024 Three.js Authors - * SPDX-License-Identifier: MIT - */function tf(){let r=null,e=!1,t=null,n=null;function i(s,a){t(s,a),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function $g(r){const e=new WeakMap;function t(o,l){const c=o.array,h=o.usage,u=c.byteLength,f=r.createBuffer();r.bindBuffer(l,f),r.bufferData(l,c,h),o.onUploadCallback();let d;if(c instanceof Float32Array)d=r.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?d=r.HALF_FLOAT:d=r.UNSIGNED_SHORT;else if(c instanceof Int16Array)d=r.SHORT;else if(c instanceof Uint32Array)d=r.UNSIGNED_INT;else if(c instanceof Int32Array)d=r.INT;else if(c instanceof Int8Array)d=r.BYTE;else if(c instanceof Uint8Array)d=r.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)d=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:f,type:d,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:u}}function n(o,l,c){const h=l.array,u=l.updateRanges;if(r.bindBuffer(c,o),u.length===0)r.bufferSubData(c,0,h);else{u.sort((d,p)=>d.start-p.start);let f=0;for(let d=1;d 0 - vec4 plane; - #ifdef ALPHA_TO_COVERAGE - float distanceToPlane, distanceGradient; - float clipOpacity = 1.0; - #pragma unroll_loop_start - for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; - distanceGradient = fwidth( distanceToPlane ) / 2.0; - clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); - if ( clipOpacity == 0.0 ) discard; - } - #pragma unroll_loop_end - #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES - float unionClipOpacity = 1.0; - #pragma unroll_loop_start - for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; - distanceGradient = fwidth( distanceToPlane ) / 2.0; - unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); - } - #pragma unroll_loop_end - clipOpacity *= 1.0 - unionClipOpacity; - #endif - diffuseColor.a *= clipOpacity; - if ( diffuseColor.a == 0.0 ) discard; - #else - #pragma unroll_loop_start - for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; - } - #pragma unroll_loop_end - #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES - bool clipped = true; - #pragma unroll_loop_start - for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; - } - #pragma unroll_loop_end - if ( clipped ) discard; - #endif - #endif -#endif`,p0=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; - uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,m0=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; -#endif`,g0=`#if NUM_CLIPPING_PLANES > 0 - vClipPosition = - mvPosition.xyz; -#endif`,_0=`#if defined( USE_COLOR_ALPHA ) - diffuseColor *= vColor; -#elif defined( USE_COLOR ) - diffuseColor.rgb *= vColor; -#endif`,v0=`#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) - varying vec3 vColor; -#endif`,x0=`#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) - varying vec3 vColor; -#endif`,y0=`#if defined( USE_COLOR_ALPHA ) - vColor = vec4( 1.0 ); -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) - vColor = vec3( 1.0 ); -#endif -#ifdef USE_COLOR - vColor *= color; -#endif -#ifdef USE_INSTANCING_COLOR - vColor.xyz *= instanceColor.xyz; -#endif -#ifdef USE_BATCHING_COLOR - vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); - vColor.xyz *= batchingColor.xyz; -#endif`,M0=`#define PI 3.141592653589793 -#define PI2 6.283185307179586 -#define PI_HALF 1.5707963267948966 -#define RECIPROCAL_PI 0.3183098861837907 -#define RECIPROCAL_PI2 0.15915494309189535 -#define EPSILON 1e-6 -#ifndef saturate -#define saturate( a ) clamp( a, 0.0, 1.0 ) -#endif -#define whiteComplement( a ) ( 1.0 - saturate( a ) ) -float pow2( const in float x ) { return x*x; } -vec3 pow2( const in vec3 x ) { return x*x; } -float pow3( const in float x ) { return x*x*x; } -float pow4( const in float x ) { float x2 = x*x; return x2*x2; } -float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } -float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } -highp float rand( const in vec2 uv ) { - const highp float a = 12.9898, b = 78.233, c = 43758.5453; - highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); - return fract( sin( sn ) * c ); -} -#ifdef HIGH_PRECISION - float precisionSafeLength( vec3 v ) { return length( v ); } -#else - float precisionSafeLength( vec3 v ) { - float maxComponent = max3( abs( v ) ); - return length( v / maxComponent ) * maxComponent; - } -#endif -struct IncidentLight { - vec3 color; - vec3 direction; - bool visible; -}; -struct ReflectedLight { - vec3 directDiffuse; - vec3 directSpecular; - vec3 indirectDiffuse; - vec3 indirectSpecular; -}; -#ifdef USE_ALPHAHASH - varying vec3 vPosition; -#endif -vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); -} -vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { - return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); -} -mat3 transposeMat3( const in mat3 m ) { - mat3 tmp; - tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); - tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); - tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); - return tmp; -} -bool isPerspectiveMatrix( mat4 m ) { - return m[ 2 ][ 3 ] == - 1.0; -} -vec2 equirectUv( in vec3 dir ) { - float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; - float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; - return vec2( u, v ); -} -vec3 BRDF_Lambert( const in vec3 diffuseColor ) { - return RECIPROCAL_PI * diffuseColor; -} -vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { - float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); - return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} -float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { - float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); - return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} // validated`,b0=`#ifdef ENVMAP_TYPE_CUBE_UV - #define cubeUV_minMipLevel 4.0 - #define cubeUV_minTileSize 16.0 - float getFace( vec3 direction ) { - vec3 absDirection = abs( direction ); - float face = - 1.0; - if ( absDirection.x > absDirection.z ) { - if ( absDirection.x > absDirection.y ) - face = direction.x > 0.0 ? 0.0 : 3.0; - else - face = direction.y > 0.0 ? 1.0 : 4.0; - } else { - if ( absDirection.z > absDirection.y ) - face = direction.z > 0.0 ? 2.0 : 5.0; - else - face = direction.y > 0.0 ? 1.0 : 4.0; - } - return face; - } - vec2 getUV( vec3 direction, float face ) { - vec2 uv; - if ( face == 0.0 ) { - uv = vec2( direction.z, direction.y ) / abs( direction.x ); - } else if ( face == 1.0 ) { - uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); - } else if ( face == 2.0 ) { - uv = vec2( - direction.x, direction.y ) / abs( direction.z ); - } else if ( face == 3.0 ) { - uv = vec2( - direction.z, direction.y ) / abs( direction.x ); - } else if ( face == 4.0 ) { - uv = vec2( - direction.x, direction.z ) / abs( direction.y ); - } else { - uv = vec2( direction.x, direction.y ) / abs( direction.z ); - } - return 0.5 * ( uv + 1.0 ); - } - vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { - float face = getFace( direction ); - float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); - mipInt = max( mipInt, cubeUV_minMipLevel ); - float faceSize = exp2( mipInt ); - highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; - if ( face > 2.0 ) { - uv.y += faceSize; - face -= 3.0; - } - uv.x += face * faceSize; - uv.x += filterInt * 3.0 * cubeUV_minTileSize; - uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); - uv.x *= CUBEUV_TEXEL_WIDTH; - uv.y *= CUBEUV_TEXEL_HEIGHT; - #ifdef texture2DGradEXT - return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; - #else - return texture2D( envMap, uv ).rgb; - #endif - } - #define cubeUV_r0 1.0 - #define cubeUV_m0 - 2.0 - #define cubeUV_r1 0.8 - #define cubeUV_m1 - 1.0 - #define cubeUV_r4 0.4 - #define cubeUV_m4 2.0 - #define cubeUV_r5 0.305 - #define cubeUV_m5 3.0 - #define cubeUV_r6 0.21 - #define cubeUV_m6 4.0 - float roughnessToMip( float roughness ) { - float mip = 0.0; - if ( roughness >= cubeUV_r1 ) { - mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; - } else if ( roughness >= cubeUV_r4 ) { - mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; - } else if ( roughness >= cubeUV_r5 ) { - mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; - } else if ( roughness >= cubeUV_r6 ) { - mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; - } else { - mip = - 2.0 * log2( 1.16 * roughness ); } - return mip; - } - vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { - float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); - float mipF = fract( mip ); - float mipInt = floor( mip ); - vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); - if ( mipF == 0.0 ) { - return vec4( color0, 1.0 ); - } else { - vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); - return vec4( mix( color0, color1, mipF ), 1.0 ); - } - } -#endif`,S0=`vec3 transformedNormal = objectNormal; -#ifdef USE_TANGENT - vec3 transformedTangent = objectTangent; -#endif -#ifdef USE_BATCHING - mat3 bm = mat3( batchingMatrix ); - transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); - transformedNormal = bm * transformedNormal; - #ifdef USE_TANGENT - transformedTangent = bm * transformedTangent; - #endif -#endif -#ifdef USE_INSTANCING - mat3 im = mat3( instanceMatrix ); - transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); - transformedNormal = im * transformedNormal; - #ifdef USE_TANGENT - transformedTangent = im * transformedTangent; - #endif -#endif -transformedNormal = normalMatrix * transformedNormal; -#ifdef FLIP_SIDED - transformedNormal = - transformedNormal; -#endif -#ifdef USE_TANGENT - transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; - #ifdef FLIP_SIDED - transformedTangent = - transformedTangent; - #endif -#endif`,w0=`#ifdef USE_DISPLACEMENTMAP - uniform sampler2D displacementMap; - uniform float displacementScale; - uniform float displacementBias; -#endif`,E0=`#ifdef USE_DISPLACEMENTMAP - transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,T0=`#ifdef USE_EMISSIVEMAP - vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); - #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE - emissiveColor = sRGBTransferEOTF( emissiveColor ); - #endif - totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,A0=`#ifdef USE_EMISSIVEMAP - uniform sampler2D emissiveMap; -#endif`,C0="gl_FragColor = linearToOutputTexel( gl_FragColor );",R0=`vec4 LinearTransferOETF( in vec4 value ) { - return value; -} -vec4 sRGBTransferEOTF( in vec4 value ) { - return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); -} -vec4 sRGBTransferOETF( in vec4 value ) { - return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); -}`,I0=`#ifdef USE_ENVMAP - #ifdef ENV_WORLDPOS - vec3 cameraToFrag; - if ( isOrthographic ) { - cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); - } else { - cameraToFrag = normalize( vWorldPosition - cameraPosition ); - } - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - #ifdef ENVMAP_MODE_REFLECTION - vec3 reflectVec = reflect( cameraToFrag, worldNormal ); - #else - vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); - #endif - #else - vec3 reflectVec = vReflect; - #endif - #ifdef ENVMAP_TYPE_CUBE - vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); - #else - vec4 envColor = vec4( 0.0 ); - #endif - #ifdef ENVMAP_BLENDING_MULTIPLY - outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); - #elif defined( ENVMAP_BLENDING_MIX ) - outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); - #elif defined( ENVMAP_BLENDING_ADD ) - outgoingLight += envColor.xyz * specularStrength * reflectivity; - #endif -#endif`,P0=`#ifdef USE_ENVMAP - uniform float envMapIntensity; - uniform float flipEnvMap; - uniform mat3 envMapRotation; - #ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; - #else - uniform sampler2D envMap; - #endif - -#endif`,D0=`#ifdef USE_ENVMAP - uniform float reflectivity; - #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) - #define ENV_WORLDPOS - #endif - #ifdef ENV_WORLDPOS - varying vec3 vWorldPosition; - uniform float refractionRatio; - #else - varying vec3 vReflect; - #endif -#endif`,L0=`#ifdef USE_ENVMAP - #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) - #define ENV_WORLDPOS - #endif - #ifdef ENV_WORLDPOS - - varying vec3 vWorldPosition; - #else - varying vec3 vReflect; - uniform float refractionRatio; - #endif -#endif`,U0=`#ifdef USE_ENVMAP - #ifdef ENV_WORLDPOS - vWorldPosition = worldPosition.xyz; - #else - vec3 cameraToVertex; - if ( isOrthographic ) { - cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); - } else { - cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); - } - vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); - #ifdef ENVMAP_MODE_REFLECTION - vReflect = reflect( cameraToVertex, worldNormal ); - #else - vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); - #endif - #endif -#endif`,N0=`#ifdef USE_FOG - vFogDepth = - mvPosition.z; -#endif`,F0=`#ifdef USE_FOG - varying float vFogDepth; -#endif`,O0=`#ifdef USE_FOG - #ifdef FOG_EXP2 - float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); - #else - float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); - #endif - gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`,B0=`#ifdef USE_FOG - uniform vec3 fogColor; - varying float vFogDepth; - #ifdef FOG_EXP2 - uniform float fogDensity; - #else - uniform float fogNear; - uniform float fogFar; - #endif -#endif`,z0=`#ifdef USE_GRADIENTMAP - uniform sampler2D gradientMap; -#endif -vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { - float dotNL = dot( normal, lightDirection ); - vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); - #ifdef USE_GRADIENTMAP - return vec3( texture2D( gradientMap, coord ).r ); - #else - vec2 fw = fwidth( coord ) * 0.5; - return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); - #endif -}`,k0=`#ifdef USE_LIGHTMAP - uniform sampler2D lightMap; - uniform float lightMapIntensity; -#endif`,V0=`LambertMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,H0=`varying vec3 vViewPosition; -struct LambertMaterial { - vec3 diffuseColor; - float specularStrength; -}; -void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,G0=`uniform bool receiveShadow; -uniform vec3 ambientLightColor; -#if defined( USE_LIGHT_PROBES ) - uniform vec3 lightProbe[ 9 ]; -#endif -vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { - float x = normal.x, y = normal.y, z = normal.z; - vec3 result = shCoefficients[ 0 ] * 0.886227; - result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; - result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; - result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; - result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; - result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; - result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); - result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; - result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); - return result; -} -vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); - return irradiance; -} -vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { - vec3 irradiance = ambientLightColor; - return irradiance; -} -float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { - float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); - if ( cutoffDistance > 0.0 ) { - distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); - } - return distanceFalloff; -} -float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { - return smoothstep( coneCosine, penumbraCosine, angleCosine ); -} -#if NUM_DIR_LIGHTS > 0 - struct DirectionalLight { - vec3 direction; - vec3 color; - }; - uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; - void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { - light.color = directionalLight.color; - light.direction = directionalLight.direction; - light.visible = true; - } -#endif -#if NUM_POINT_LIGHTS > 0 - struct PointLight { - vec3 position; - vec3 color; - float distance; - float decay; - }; - uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; - void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { - vec3 lVector = pointLight.position - geometryPosition; - light.direction = normalize( lVector ); - float lightDistance = length( lVector ); - light.color = pointLight.color; - light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); - light.visible = ( light.color != vec3( 0.0 ) ); - } -#endif -#if NUM_SPOT_LIGHTS > 0 - struct SpotLight { - vec3 position; - vec3 direction; - vec3 color; - float distance; - float decay; - float coneCos; - float penumbraCos; - }; - uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; - void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { - vec3 lVector = spotLight.position - geometryPosition; - light.direction = normalize( lVector ); - float angleCos = dot( light.direction, spotLight.direction ); - float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); - if ( spotAttenuation > 0.0 ) { - float lightDistance = length( lVector ); - light.color = spotLight.color * spotAttenuation; - light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); - light.visible = ( light.color != vec3( 0.0 ) ); - } else { - light.color = vec3( 0.0 ); - light.visible = false; - } - } -#endif -#if NUM_RECT_AREA_LIGHTS > 0 - struct RectAreaLight { - vec3 color; - vec3 position; - vec3 halfWidth; - vec3 halfHeight; - }; - uniform sampler2D ltc_1; uniform sampler2D ltc_2; - uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; -#endif -#if NUM_HEMI_LIGHTS > 0 - struct HemisphereLight { - vec3 direction; - vec3 skyColor; - vec3 groundColor; - }; - uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; - vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { - float dotNL = dot( normal, hemiLight.direction ); - float hemiDiffuseWeight = 0.5 * dotNL + 0.5; - vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); - return irradiance; - } -#endif`,W0=`#ifdef USE_ENVMAP - vec3 getIBLIrradiance( const in vec3 normal ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); - return PI * envMapColor.rgb * envMapIntensity; - #else - return vec3( 0.0 ); - #endif - } - vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 reflectVec = reflect( - viewDir, normal ); - reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); - reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); - vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); - return envMapColor.rgb * envMapIntensity; - #else - return vec3( 0.0 ); - #endif - } - #ifdef USE_ANISOTROPY - vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 bentNormal = cross( bitangent, viewDir ); - bentNormal = normalize( cross( bentNormal, bitangent ) ); - bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); - return getIBLRadiance( viewDir, bentNormal, roughness ); - #else - return vec3( 0.0 ); - #endif - } - #endif -#endif`,X0=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,q0=`varying vec3 vViewPosition; -struct ToonMaterial { - vec3 diffuseColor; -}; -void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Y0=`BlinnPhongMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularColor = specular; -material.specularShininess = shininess; -material.specularStrength = specularStrength;`,Z0=`varying vec3 vViewPosition; -struct BlinnPhongMaterial { - vec3 diffuseColor; - vec3 specularColor; - float specularShininess; - float specularStrength; -}; -void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); - reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; -} -void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,J0=`PhysicalMaterial material; -material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); -vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); -float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); -material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; -material.roughness = min( material.roughness, 1.0 ); -#ifdef IOR - material.ior = ior; - #ifdef USE_SPECULAR - float specularIntensityFactor = specularIntensity; - vec3 specularColorFactor = specularColor; - #ifdef USE_SPECULAR_COLORMAP - specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; - #endif - #ifdef USE_SPECULAR_INTENSITYMAP - specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; - #endif - material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); - #else - float specularIntensityFactor = 1.0; - vec3 specularColorFactor = vec3( 1.0 ); - material.specularF90 = 1.0; - #endif - material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); -#else - material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); - material.specularF90 = 1.0; -#endif -#ifdef USE_CLEARCOAT - material.clearcoat = clearcoat; - material.clearcoatRoughness = clearcoatRoughness; - material.clearcoatF0 = vec3( 0.04 ); - material.clearcoatF90 = 1.0; - #ifdef USE_CLEARCOATMAP - material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; - #endif - #ifdef USE_CLEARCOAT_ROUGHNESSMAP - material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; - #endif - material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); - material.clearcoatRoughness += geometryRoughness; - material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); -#endif -#ifdef USE_DISPERSION - material.dispersion = dispersion; -#endif -#ifdef USE_IRIDESCENCE - material.iridescence = iridescence; - material.iridescenceIOR = iridescenceIOR; - #ifdef USE_IRIDESCENCEMAP - material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; - #endif - #ifdef USE_IRIDESCENCE_THICKNESSMAP - material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; - #else - material.iridescenceThickness = iridescenceThicknessMaximum; - #endif -#endif -#ifdef USE_SHEEN - material.sheenColor = sheenColor; - #ifdef USE_SHEEN_COLORMAP - material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; - #endif - material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); - #ifdef USE_SHEEN_ROUGHNESSMAP - material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; - #endif -#endif -#ifdef USE_ANISOTROPY - #ifdef USE_ANISOTROPYMAP - mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); - vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; - vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; - #else - vec2 anisotropyV = anisotropyVector; - #endif - material.anisotropy = length( anisotropyV ); - if( material.anisotropy == 0.0 ) { - anisotropyV = vec2( 1.0, 0.0 ); - } else { - anisotropyV /= material.anisotropy; - material.anisotropy = saturate( material.anisotropy ); - } - material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); - material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; - material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; -#endif`,K0=`struct PhysicalMaterial { - vec3 diffuseColor; - float roughness; - vec3 specularColor; - float specularF90; - float dispersion; - #ifdef USE_CLEARCOAT - float clearcoat; - float clearcoatRoughness; - vec3 clearcoatF0; - float clearcoatF90; - #endif - #ifdef USE_IRIDESCENCE - float iridescence; - float iridescenceIOR; - float iridescenceThickness; - vec3 iridescenceFresnel; - vec3 iridescenceF0; - #endif - #ifdef USE_SHEEN - vec3 sheenColor; - float sheenRoughness; - #endif - #ifdef IOR - float ior; - #endif - #ifdef USE_TRANSMISSION - float transmission; - float transmissionAlpha; - float thickness; - float attenuationDistance; - vec3 attenuationColor; - #endif - #ifdef USE_ANISOTROPY - float anisotropy; - float alphaT; - vec3 anisotropyT; - vec3 anisotropyB; - #endif -}; -vec3 clearcoatSpecularDirect = vec3( 0.0 ); -vec3 clearcoatSpecularIndirect = vec3( 0.0 ); -vec3 sheenSpecularDirect = vec3( 0.0 ); -vec3 sheenSpecularIndirect = vec3(0.0 ); -vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { - float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); - float x2 = x * x; - float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); - return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); -} -float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { - float a2 = pow2( alpha ); - float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); - float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); - return 0.5 / max( gv + gl, EPSILON ); -} -float D_GGX( const in float alpha, const in float dotNH ) { - float a2 = pow2( alpha ); - float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; - return RECIPROCAL_PI * a2 / pow2( denom ); -} -#ifdef USE_ANISOTROPY - float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { - float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); - float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); - float v = 0.5 / ( gv + gl ); - return saturate(v); - } - float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { - float a2 = alphaT * alphaB; - highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); - highp float v2 = dot( v, v ); - float w2 = a2 / v2; - return RECIPROCAL_PI * a2 * pow2 ( w2 ); - } -#endif -#ifdef USE_CLEARCOAT - vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { - vec3 f0 = material.clearcoatF0; - float f90 = material.clearcoatF90; - float roughness = material.clearcoatRoughness; - float alpha = pow2( roughness ); - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float dotVH = saturate( dot( viewDir, halfDir ) ); - vec3 F = F_Schlick( f0, f90, dotVH ); - float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); - float D = D_GGX( alpha, dotNH ); - return F * ( V * D ); - } -#endif -vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { - vec3 f0 = material.specularColor; - float f90 = material.specularF90; - float roughness = material.roughness; - float alpha = pow2( roughness ); - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float dotVH = saturate( dot( viewDir, halfDir ) ); - vec3 F = F_Schlick( f0, f90, dotVH ); - #ifdef USE_IRIDESCENCE - F = mix( F, material.iridescenceFresnel, material.iridescence ); - #endif - #ifdef USE_ANISOTROPY - float dotTL = dot( material.anisotropyT, lightDir ); - float dotTV = dot( material.anisotropyT, viewDir ); - float dotTH = dot( material.anisotropyT, halfDir ); - float dotBL = dot( material.anisotropyB, lightDir ); - float dotBV = dot( material.anisotropyB, viewDir ); - float dotBH = dot( material.anisotropyB, halfDir ); - float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); - float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); - #else - float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); - float D = D_GGX( alpha, dotNH ); - #endif - return F * ( V * D ); -} -vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { - const float LUT_SIZE = 64.0; - const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; - const float LUT_BIAS = 0.5 / LUT_SIZE; - float dotNV = saturate( dot( N, V ) ); - vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); - uv = uv * LUT_SCALE + LUT_BIAS; - return uv; -} -float LTC_ClippedSphereFormFactor( const in vec3 f ) { - float l = length( f ); - return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); -} -vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { - float x = dot( v1, v2 ); - float y = abs( x ); - float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; - float b = 3.4175940 + ( 4.1616724 + y ) * y; - float v = a / b; - float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; - return cross( v1, v2 ) * theta_sintheta; -} -vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { - vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; - vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; - vec3 lightNormal = cross( v1, v2 ); - if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); - vec3 T1, T2; - T1 = normalize( V - N * dot( V, N ) ); - T2 = - cross( N, T1 ); - mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); - vec3 coords[ 4 ]; - coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); - coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); - coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); - coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); - coords[ 0 ] = normalize( coords[ 0 ] ); - coords[ 1 ] = normalize( coords[ 1 ] ); - coords[ 2 ] = normalize( coords[ 2 ] ); - coords[ 3 ] = normalize( coords[ 3 ] ); - vec3 vectorFormFactor = vec3( 0.0 ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); - float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); - return vec3( result ); -} -#if defined( USE_SHEEN ) -float D_Charlie( float roughness, float dotNH ) { - float alpha = pow2( roughness ); - float invAlpha = 1.0 / alpha; - float cos2h = dotNH * dotNH; - float sin2h = max( 1.0 - cos2h, 0.0078125 ); - return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); -} -float V_Neubelt( float dotNV, float dotNL ) { - return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); -} -vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float D = D_Charlie( sheenRoughness, dotNH ); - float V = V_Neubelt( dotNV, dotNL ); - return sheenColor * ( D * V ); -} -#endif -float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { - float dotNV = saturate( dot( normal, viewDir ) ); - float r2 = roughness * roughness; - float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; - float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; - float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); - return saturate( DG * RECIPROCAL_PI ); -} -vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { - float dotNV = saturate( dot( normal, viewDir ) ); - const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); - const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); - vec4 r = roughness * c0 + c1; - float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; - vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; - return fab; -} -vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { - vec2 fab = DFGApprox( normal, viewDir, roughness ); - return specularColor * fab.x + specularF90 * fab.y; -} -#ifdef USE_IRIDESCENCE -void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { -#else -void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { -#endif - vec2 fab = DFGApprox( normal, viewDir, roughness ); - #ifdef USE_IRIDESCENCE - vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); - #else - vec3 Fr = specularColor; - #endif - vec3 FssEss = Fr * fab.x + specularF90 * fab.y; - float Ess = fab.x + fab.y; - float Ems = 1.0 - Ess; - vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); - singleScatter += FssEss; - multiScatter += Fms * Ems; -} -#if NUM_RECT_AREA_LIGHTS > 0 - void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - vec3 normal = geometryNormal; - vec3 viewDir = geometryViewDir; - vec3 position = geometryPosition; - vec3 lightPos = rectAreaLight.position; - vec3 halfWidth = rectAreaLight.halfWidth; - vec3 halfHeight = rectAreaLight.halfHeight; - vec3 lightColor = rectAreaLight.color; - float roughness = material.roughness; - vec3 rectCoords[ 4 ]; - rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; - rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; - rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; - vec2 uv = LTC_Uv( normal, viewDir, roughness ); - vec4 t1 = texture2D( ltc_1, uv ); - vec4 t2 = texture2D( ltc_2, uv ); - mat3 mInv = mat3( - vec3( t1.x, 0, t1.y ), - vec3( 0, 1, 0 ), - vec3( t1.z, 0, t1.w ) - ); - vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); - reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); - reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); - } -#endif -void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - #ifdef USE_CLEARCOAT - float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); - vec3 ccIrradiance = dotNLcc * directLight.color; - clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); - #endif - #ifdef USE_SHEEN - sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); - #endif - reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { - #ifdef USE_CLEARCOAT - clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); - #endif - #ifdef USE_SHEEN - sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); - #endif - vec3 singleScattering = vec3( 0.0 ); - vec3 multiScattering = vec3( 0.0 ); - vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; - #ifdef USE_IRIDESCENCE - computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); - #else - computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); - #endif - vec3 totalScattering = singleScattering + multiScattering; - vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); - reflectedLight.indirectSpecular += radiance * singleScattering; - reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; - reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; -} -#define RE_Direct RE_Direct_Physical -#define RE_Direct_RectArea RE_Direct_RectArea_Physical -#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical -#define RE_IndirectSpecular RE_IndirectSpecular_Physical -float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { - return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`,$0=` -vec3 geometryPosition = - vViewPosition; -vec3 geometryNormal = normal; -vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); -vec3 geometryClearcoatNormal = vec3( 0.0 ); -#ifdef USE_CLEARCOAT - geometryClearcoatNormal = clearcoatNormal; -#endif -#ifdef USE_IRIDESCENCE - float dotNVi = saturate( dot( normal, geometryViewDir ) ); - if ( material.iridescenceThickness == 0.0 ) { - material.iridescence = 0.0; - } else { - material.iridescence = saturate( material.iridescence ); - } - if ( material.iridescence > 0.0 ) { - material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); - material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); - } -#endif -IncidentLight directLight; -#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) - PointLight pointLight; - #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 - PointLightShadow pointLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { - pointLight = pointLights[ i ]; - getPointLightInfo( pointLight, geometryPosition, directLight ); - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) - pointLightShadow = pointLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) - SpotLight spotLight; - vec4 spotColor; - vec3 spotLightCoord; - bool inSpotLightMap; - #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 - SpotLightShadow spotLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { - spotLight = spotLights[ i ]; - getSpotLightInfo( spotLight, geometryPosition, directLight ); - #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) - #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX - #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS - #else - #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) - #endif - #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) - spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; - inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); - spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); - directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; - #endif - #undef SPOT_LIGHT_MAP_INDEX - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - spotLightShadow = spotLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) - DirectionalLight directionalLight; - #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { - directionalLight = directionalLights[ i ]; - getDirectionalLightInfo( directionalLight, directLight ); - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) - directionalLightShadow = directionalLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) - RectAreaLight rectAreaLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { - rectAreaLight = rectAreaLights[ i ]; - RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if defined( RE_IndirectDiffuse ) - vec3 iblIrradiance = vec3( 0.0 ); - vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); - #if defined( USE_LIGHT_PROBES ) - irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); - #endif - #if ( NUM_HEMI_LIGHTS > 0 ) - #pragma unroll_loop_start - for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { - irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); - } - #pragma unroll_loop_end - #endif -#endif -#if defined( RE_IndirectSpecular ) - vec3 radiance = vec3( 0.0 ); - vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,j0=`#if defined( RE_IndirectDiffuse ) - #ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; - irradiance += lightMapIrradiance; - #endif - #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) - iblIrradiance += getIBLIrradiance( geometryNormal ); - #endif -#endif -#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) - #ifdef USE_ANISOTROPY - radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); - #else - radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); - #endif - #ifdef USE_CLEARCOAT - clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); - #endif -#endif`,Q0=`#if defined( RE_IndirectDiffuse ) - RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif -#if defined( RE_IndirectSpecular ) - RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif`,e_=`#if defined( USE_LOGDEPTHBUF ) - gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,t_=`#if defined( USE_LOGDEPTHBUF ) - uniform float logDepthBufFC; - varying float vFragDepth; - varying float vIsPerspective; -#endif`,n_=`#ifdef USE_LOGDEPTHBUF - varying float vFragDepth; - varying float vIsPerspective; -#endif`,i_=`#ifdef USE_LOGDEPTHBUF - vFragDepth = 1.0 + gl_Position.w; - vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); -#endif`,s_=`#ifdef USE_MAP - vec4 sampledDiffuseColor = texture2D( map, vMapUv ); - #ifdef DECODE_VIDEO_TEXTURE - sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); - #endif - diffuseColor *= sampledDiffuseColor; -#endif`,r_=`#ifdef USE_MAP - uniform sampler2D map; -#endif`,a_=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) - #if defined( USE_POINTS_UV ) - vec2 uv = vUv; - #else - vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; - #endif -#endif -#ifdef USE_MAP - diffuseColor *= texture2D( map, uv ); -#endif -#ifdef USE_ALPHAMAP - diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,o_=`#if defined( USE_POINTS_UV ) - varying vec2 vUv; -#else - #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) - uniform mat3 uvTransform; - #endif -#endif -#ifdef USE_MAP - uniform sampler2D map; -#endif -#ifdef USE_ALPHAMAP - uniform sampler2D alphaMap; -#endif`,l_=`float metalnessFactor = metalness; -#ifdef USE_METALNESSMAP - vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); - metalnessFactor *= texelMetalness.b; -#endif`,c_=`#ifdef USE_METALNESSMAP - uniform sampler2D metalnessMap; -#endif`,h_=`#ifdef USE_INSTANCING_MORPH - float morphTargetInfluences[ MORPHTARGETS_COUNT ]; - float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; - } -#endif`,u_=`#if defined( USE_MORPHCOLORS ) - vColor *= morphTargetBaseInfluence; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - #if defined( USE_COLOR_ALPHA ) - if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; - #elif defined( USE_COLOR ) - if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; - #endif - } -#endif`,d_=`#ifdef USE_MORPHNORMALS - objectNormal *= morphTargetBaseInfluence; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; - } -#endif`,f_=`#ifdef USE_MORPHTARGETS - #ifndef USE_INSTANCING_MORPH - uniform float morphTargetBaseInfluence; - uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; - #endif - uniform sampler2DArray morphTargetsTexture; - uniform ivec2 morphTargetsTextureSize; - vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { - int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; - int y = texelIndex / morphTargetsTextureSize.x; - int x = texelIndex - y * morphTargetsTextureSize.x; - ivec3 morphUV = ivec3( x, y, morphTargetIndex ); - return texelFetch( morphTargetsTexture, morphUV, 0 ); - } -#endif`,p_=`#ifdef USE_MORPHTARGETS - transformed *= morphTargetBaseInfluence; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; - } -#endif`,m_=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; -#ifdef FLAT_SHADED - vec3 fdx = dFdx( vViewPosition ); - vec3 fdy = dFdy( vViewPosition ); - vec3 normal = normalize( cross( fdx, fdy ) ); -#else - vec3 normal = normalize( vNormal ); - #ifdef DOUBLE_SIDED - normal *= faceDirection; - #endif -#endif -#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) - #ifdef USE_TANGENT - mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); - #else - mat3 tbn = getTangentFrame( - vViewPosition, normal, - #if defined( USE_NORMALMAP ) - vNormalMapUv - #elif defined( USE_CLEARCOAT_NORMALMAP ) - vClearcoatNormalMapUv - #else - vUv - #endif - ); - #endif - #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) - tbn[0] *= faceDirection; - tbn[1] *= faceDirection; - #endif -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - #ifdef USE_TANGENT - mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); - #else - mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); - #endif - #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) - tbn2[0] *= faceDirection; - tbn2[1] *= faceDirection; - #endif -#endif -vec3 nonPerturbedNormal = normal;`,g_=`#ifdef USE_NORMALMAP_OBJECTSPACE - normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; - #ifdef FLIP_SIDED - normal = - normal; - #endif - #ifdef DOUBLE_SIDED - normal = normal * faceDirection; - #endif - normal = normalize( normalMatrix * normal ); -#elif defined( USE_NORMALMAP_TANGENTSPACE ) - vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; - mapN.xy *= normalScale; - normal = normalize( tbn * mapN ); -#elif defined( USE_BUMPMAP ) - normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,__=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,v_=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,x_=`#ifndef FLAT_SHADED - vNormal = normalize( transformedNormal ); - #ifdef USE_TANGENT - vTangent = normalize( transformedTangent ); - vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); - #endif -#endif`,y_=`#ifdef USE_NORMALMAP - uniform sampler2D normalMap; - uniform vec2 normalScale; -#endif -#ifdef USE_NORMALMAP_OBJECTSPACE - uniform mat3 normalMatrix; -#endif -#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) - mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { - vec3 q0 = dFdx( eye_pos.xyz ); - vec3 q1 = dFdy( eye_pos.xyz ); - vec2 st0 = dFdx( uv.st ); - vec2 st1 = dFdy( uv.st ); - vec3 N = surf_norm; - vec3 q1perp = cross( q1, N ); - vec3 q0perp = cross( N, q0 ); - vec3 T = q1perp * st0.x + q0perp * st1.x; - vec3 B = q1perp * st0.y + q0perp * st1.y; - float det = max( dot( T, T ), dot( B, B ) ); - float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); - return mat3( T * scale, B * scale, N ); - } -#endif`,M_=`#ifdef USE_CLEARCOAT - vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,b_=`#ifdef USE_CLEARCOAT_NORMALMAP - vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; - clearcoatMapN.xy *= clearcoatNormalScale; - clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,S_=`#ifdef USE_CLEARCOATMAP - uniform sampler2D clearcoatMap; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - uniform sampler2D clearcoatNormalMap; - uniform vec2 clearcoatNormalScale; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - uniform sampler2D clearcoatRoughnessMap; -#endif`,w_=`#ifdef USE_IRIDESCENCEMAP - uniform sampler2D iridescenceMap; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - uniform sampler2D iridescenceThicknessMap; -#endif`,E_=`#ifdef OPAQUE -diffuseColor.a = 1.0; -#endif -#ifdef USE_TRANSMISSION -diffuseColor.a *= material.transmissionAlpha; -#endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,T_=`vec3 packNormalToRGB( const in vec3 normal ) { - return normalize( normal ) * 0.5 + 0.5; -} -vec3 unpackRGBToNormal( const in vec3 rgb ) { - return 2.0 * rgb.xyz - 1.0; -} -const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; -const float Inv255 = 1. / 255.; -const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); -const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); -const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); -const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); -vec4 packDepthToRGBA( const in float v ) { - if( v <= 0.0 ) - return vec4( 0., 0., 0., 0. ); - if( v >= 1.0 ) - return vec4( 1., 1., 1., 1. ); - float vuf; - float af = modf( v * PackFactors.a, vuf ); - float bf = modf( vuf * ShiftRight8, vuf ); - float gf = modf( vuf * ShiftRight8, vuf ); - return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); -} -vec3 packDepthToRGB( const in float v ) { - if( v <= 0.0 ) - return vec3( 0., 0., 0. ); - if( v >= 1.0 ) - return vec3( 1., 1., 1. ); - float vuf; - float bf = modf( v * PackFactors.b, vuf ); - float gf = modf( vuf * ShiftRight8, vuf ); - return vec3( vuf * Inv255, gf * PackUpscale, bf ); -} -vec2 packDepthToRG( const in float v ) { - if( v <= 0.0 ) - return vec2( 0., 0. ); - if( v >= 1.0 ) - return vec2( 1., 1. ); - float vuf; - float gf = modf( v * 256., vuf ); - return vec2( vuf * Inv255, gf ); -} -float unpackRGBAToDepth( const in vec4 v ) { - return dot( v, UnpackFactors4 ); -} -float unpackRGBToDepth( const in vec3 v ) { - return dot( v, UnpackFactors3 ); -} -float unpackRGToDepth( const in vec2 v ) { - return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; -} -vec4 pack2HalfToRGBA( const in vec2 v ) { - vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); - return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); -} -vec2 unpackRGBATo2Half( const in vec4 v ) { - return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); -} -float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { - return ( viewZ + near ) / ( near - far ); -} -float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { - return depth * ( near - far ) - near; -} -float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { - return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); -} -float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { - return ( near * far ) / ( ( far - near ) * depth - far ); -}`,A_=`#ifdef PREMULTIPLIED_ALPHA - gl_FragColor.rgb *= gl_FragColor.a; -#endif`,C_=`vec4 mvPosition = vec4( transformed, 1.0 ); -#ifdef USE_BATCHING - mvPosition = batchingMatrix * mvPosition; -#endif -#ifdef USE_INSTANCING - mvPosition = instanceMatrix * mvPosition; -#endif -mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,R_=`#ifdef DITHERING - gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,I_=`#ifdef DITHERING - vec3 dithering( vec3 color ) { - float grid_position = rand( gl_FragCoord.xy ); - vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); - dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); - return color + dither_shift_RGB; - } -#endif`,P_=`float roughnessFactor = roughness; -#ifdef USE_ROUGHNESSMAP - vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); - roughnessFactor *= texelRoughness.g; -#endif`,D_=`#ifdef USE_ROUGHNESSMAP - uniform sampler2D roughnessMap; -#endif`,L_=`#if NUM_SPOT_LIGHT_COORDS > 0 - varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; -#endif -#if NUM_SPOT_LIGHT_MAPS > 0 - uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; -#endif -#ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; - varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; - struct DirectionalLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; - struct SpotLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; - varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; - struct PointLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - float shadowCameraNear; - float shadowCameraFar; - }; - uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; - #endif - float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { - return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); - } - vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { - return unpackRGBATo2Half( texture2D( shadow, uv ) ); - } - float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ - float occlusion = 1.0; - vec2 distribution = texture2DDistribution( shadow, uv ); - float hard_shadow = step( compare , distribution.x ); - if (hard_shadow != 1.0 ) { - float distance = compare - distribution.x ; - float variance = max( 0.00000, distribution.y * distribution.y ); - float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); - } - return occlusion; - } - float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { - float shadow = 1.0; - shadowCoord.xyz /= shadowCoord.w; - shadowCoord.z += shadowBias; - bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; - bool frustumTest = inFrustum && shadowCoord.z <= 1.0; - if ( frustumTest ) { - #if defined( SHADOWMAP_TYPE_PCF ) - vec2 texelSize = vec2( 1.0 ) / shadowMapSize; - float dx0 = - texelSize.x * shadowRadius; - float dy0 = - texelSize.y * shadowRadius; - float dx1 = + texelSize.x * shadowRadius; - float dy1 = + texelSize.y * shadowRadius; - float dx2 = dx0 / 2.0; - float dy2 = dy0 / 2.0; - float dx3 = dx1 / 2.0; - float dy3 = dy1 / 2.0; - shadow = ( - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) - ) * ( 1.0 / 17.0 ); - #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) - vec2 texelSize = vec2( 1.0 ) / shadowMapSize; - float dx = texelSize.x; - float dy = texelSize.y; - vec2 uv = shadowCoord.xy; - vec2 f = fract( uv * shadowMapSize + 0.5 ); - uv -= f * texelSize; - shadow = ( - texture2DCompare( shadowMap, uv, shadowCoord.z ) + - texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + - texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + - mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), - f.x ) + - mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), - f.x ) + - mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), - f.y ) + - mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), - f.y ) + - mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), - f.x ), - mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), - f.x ), - f.y ) - ) * ( 1.0 / 9.0 ); - #elif defined( SHADOWMAP_TYPE_VSM ) - shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); - #else - shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); - #endif - } - return mix( 1.0, shadow, shadowIntensity ); - } - vec2 cubeToUV( vec3 v, float texelSizeY ) { - vec3 absV = abs( v ); - float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); - absV *= scaleToCube; - v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); - vec2 planar = v.xy; - float almostATexel = 1.5 * texelSizeY; - float almostOne = 1.0 - almostATexel; - if ( absV.z >= almostOne ) { - if ( v.z > 0.0 ) - planar.x = 4.0 - v.x; - } else if ( absV.x >= almostOne ) { - float signX = sign( v.x ); - planar.x = v.z * signX + 2.0 * signX; - } else if ( absV.y >= almostOne ) { - float signY = sign( v.y ); - planar.x = v.x + 2.0 * signY + 2.0; - planar.y = v.z * signY - 2.0; - } - return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); - } - float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { - float shadow = 1.0; - vec3 lightToPosition = shadowCoord.xyz; - - float lightToPositionLength = length( lightToPosition ); - if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { - float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; - vec3 bd3D = normalize( lightToPosition ); - vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); - #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) - vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; - shadow = ( - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) - ) * ( 1.0 / 9.0 ); - #else - shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); - #endif - } - return mix( 1.0, shadow, shadowIntensity ); - } -#endif`,U_=`#if NUM_SPOT_LIGHT_COORDS > 0 - uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; - varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; -#endif -#ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; - varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; - struct DirectionalLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - struct SpotLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; - varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; - struct PointLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - float shadowCameraNear; - float shadowCameraFar; - }; - uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; - #endif -#endif`,N_=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) - vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); - vec4 shadowWorldPosition; -#endif -#if defined( USE_SHADOWMAP ) - #if NUM_DIR_LIGHT_SHADOWS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { - shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); - vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { - shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); - vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end - #endif -#endif -#if NUM_SPOT_LIGHT_COORDS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { - shadowWorldPosition = worldPosition; - #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; - #endif - vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end -#endif`,F_=`float getShadowMask() { - float shadow = 1.0; - #ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { - directionalLight = directionalLightShadows[ i ]; - shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - } - #pragma unroll_loop_end - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - SpotLightShadow spotLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { - spotLight = spotLightShadows[ i ]; - shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; - } - #pragma unroll_loop_end - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - PointLightShadow pointLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { - pointLight = pointLightShadows[ i ]; - shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; - } - #pragma unroll_loop_end - #endif - #endif - return shadow; -}`,O_=`#ifdef USE_SKINNING - mat4 boneMatX = getBoneMatrix( skinIndex.x ); - mat4 boneMatY = getBoneMatrix( skinIndex.y ); - mat4 boneMatZ = getBoneMatrix( skinIndex.z ); - mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,B_=`#ifdef USE_SKINNING - uniform mat4 bindMatrix; - uniform mat4 bindMatrixInverse; - uniform highp sampler2D boneTexture; - mat4 getBoneMatrix( const in float i ) { - int size = textureSize( boneTexture, 0 ).x; - int j = int( i ) * 4; - int x = j % size; - int y = j / size; - vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); - vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); - vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); - vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); - return mat4( v1, v2, v3, v4 ); - } -#endif`,z_=`#ifdef USE_SKINNING - vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); - vec4 skinned = vec4( 0.0 ); - skinned += boneMatX * skinVertex * skinWeight.x; - skinned += boneMatY * skinVertex * skinWeight.y; - skinned += boneMatZ * skinVertex * skinWeight.z; - skinned += boneMatW * skinVertex * skinWeight.w; - transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,k_=`#ifdef USE_SKINNING - mat4 skinMatrix = mat4( 0.0 ); - skinMatrix += skinWeight.x * boneMatX; - skinMatrix += skinWeight.y * boneMatY; - skinMatrix += skinWeight.z * boneMatZ; - skinMatrix += skinWeight.w * boneMatW; - skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; - objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; - #ifdef USE_TANGENT - objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; - #endif -#endif`,V_=`float specularStrength; -#ifdef USE_SPECULARMAP - vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); - specularStrength = texelSpecular.r; -#else - specularStrength = 1.0; -#endif`,H_=`#ifdef USE_SPECULARMAP - uniform sampler2D specularMap; -#endif`,G_=`#if defined( TONE_MAPPING ) - gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,W_=`#ifndef saturate -#define saturate( a ) clamp( a, 0.0, 1.0 ) -#endif -uniform float toneMappingExposure; -vec3 LinearToneMapping( vec3 color ) { - return saturate( toneMappingExposure * color ); -} -vec3 ReinhardToneMapping( vec3 color ) { - color *= toneMappingExposure; - return saturate( color / ( vec3( 1.0 ) + color ) ); -} -vec3 CineonToneMapping( vec3 color ) { - color *= toneMappingExposure; - color = max( vec3( 0.0 ), color - 0.004 ); - return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); -} -vec3 RRTAndODTFit( vec3 v ) { - vec3 a = v * ( v + 0.0245786 ) - 0.000090537; - vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; - return a / b; -} -vec3 ACESFilmicToneMapping( vec3 color ) { - const mat3 ACESInputMat = mat3( - vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), - vec3( 0.04823, 0.01566, 0.83777 ) - ); - const mat3 ACESOutputMat = mat3( - vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), - vec3( -0.07367, -0.00605, 1.07602 ) - ); - color *= toneMappingExposure / 0.6; - color = ACESInputMat * color; - color = RRTAndODTFit( color ); - color = ACESOutputMat * color; - return saturate( color ); -} -const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( - vec3( 1.6605, - 0.1246, - 0.0182 ), - vec3( - 0.5876, 1.1329, - 0.1006 ), - vec3( - 0.0728, - 0.0083, 1.1187 ) -); -const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( - vec3( 0.6274, 0.0691, 0.0164 ), - vec3( 0.3293, 0.9195, 0.0880 ), - vec3( 0.0433, 0.0113, 0.8956 ) -); -vec3 agxDefaultContrastApprox( vec3 x ) { - vec3 x2 = x * x; - vec3 x4 = x2 * x2; - return + 15.5 * x4 * x2 - - 40.14 * x4 * x - + 31.96 * x4 - - 6.868 * x2 * x - + 0.4298 * x2 - + 0.1191 * x - - 0.00232; -} -vec3 AgXToneMapping( vec3 color ) { - const mat3 AgXInsetMatrix = mat3( - vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), - vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), - vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) - ); - const mat3 AgXOutsetMatrix = mat3( - vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), - vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), - vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) - ); - const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; - color *= toneMappingExposure; - color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; - color = AgXInsetMatrix * color; - color = max( color, 1e-10 ); color = log2( color ); - color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); - color = clamp( color, 0.0, 1.0 ); - color = agxDefaultContrastApprox( color ); - color = AgXOutsetMatrix * color; - color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); - color = LINEAR_REC2020_TO_LINEAR_SRGB * color; - color = clamp( color, 0.0, 1.0 ); - return color; -} -vec3 NeutralToneMapping( vec3 color ) { - const float StartCompression = 0.8 - 0.04; - const float Desaturation = 0.15; - color *= toneMappingExposure; - float x = min( color.r, min( color.g, color.b ) ); - float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; - color -= offset; - float peak = max( color.r, max( color.g, color.b ) ); - if ( peak < StartCompression ) return color; - float d = 1. - StartCompression; - float newPeak = 1. - d * d / ( peak + d - StartCompression ); - color *= newPeak / peak; - float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); - return mix( color, vec3( newPeak ), g ); -} -vec3 CustomToneMapping( vec3 color ) { return color; }`,X_=`#ifdef USE_TRANSMISSION - material.transmission = transmission; - material.transmissionAlpha = 1.0; - material.thickness = thickness; - material.attenuationDistance = attenuationDistance; - material.attenuationColor = attenuationColor; - #ifdef USE_TRANSMISSIONMAP - material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; - #endif - #ifdef USE_THICKNESSMAP - material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; - #endif - vec3 pos = vWorldPosition; - vec3 v = normalize( cameraPosition - pos ); - vec3 n = inverseTransformDirection( normal, viewMatrix ); - vec4 transmitted = getIBLVolumeRefraction( - n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, - pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, - material.attenuationColor, material.attenuationDistance ); - material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); - totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,q_=`#ifdef USE_TRANSMISSION - uniform float transmission; - uniform float thickness; - uniform float attenuationDistance; - uniform vec3 attenuationColor; - #ifdef USE_TRANSMISSIONMAP - uniform sampler2D transmissionMap; - #endif - #ifdef USE_THICKNESSMAP - uniform sampler2D thicknessMap; - #endif - uniform vec2 transmissionSamplerSize; - uniform sampler2D transmissionSamplerMap; - uniform mat4 modelMatrix; - uniform mat4 projectionMatrix; - varying vec3 vWorldPosition; - float w0( float a ) { - return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); - } - float w1( float a ) { - return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); - } - float w2( float a ){ - return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); - } - float w3( float a ) { - return ( 1.0 / 6.0 ) * ( a * a * a ); - } - float g0( float a ) { - return w0( a ) + w1( a ); - } - float g1( float a ) { - return w2( a ) + w3( a ); - } - float h0( float a ) { - return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); - } - float h1( float a ) { - return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); - } - vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { - uv = uv * texelSize.zw + 0.5; - vec2 iuv = floor( uv ); - vec2 fuv = fract( uv ); - float g0x = g0( fuv.x ); - float g1x = g1( fuv.x ); - float h0x = h0( fuv.x ); - float h1x = h1( fuv.x ); - float h0y = h0( fuv.y ); - float h1y = h1( fuv.y ); - vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; - vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; - vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; - vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; - return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + - g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); - } - vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { - vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); - vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); - vec2 fLodSizeInv = 1.0 / fLodSize; - vec2 cLodSizeInv = 1.0 / cLodSize; - vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); - vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); - return mix( fSample, cSample, fract( lod ) ); - } - vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { - vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); - vec3 modelScale; - modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); - modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); - modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); - return normalize( refractionVector ) * thickness * modelScale; - } - float applyIorToRoughness( const in float roughness, const in float ior ) { - return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); - } - vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { - float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); - return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); - } - vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { - if ( isinf( attenuationDistance ) ) { - return vec3( 1.0 ); - } else { - vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; - vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; - } - } - vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, - const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, - const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, - const in vec3 attenuationColor, const in float attenuationDistance ) { - vec4 transmittedLight; - vec3 transmittance; - #ifdef USE_DISPERSION - float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; - vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); - for ( int i = 0; i < 3; i ++ ) { - vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); - vec3 refractedRayExit = position + transmissionRay; - vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); - vec2 refractionCoords = ndcPos.xy / ndcPos.w; - refractionCoords += 1.0; - refractionCoords /= 2.0; - vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); - transmittedLight[ i ] = transmissionSample[ i ]; - transmittedLight.a += transmissionSample.a; - transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; - } - transmittedLight.a /= 3.0; - #else - vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); - vec3 refractedRayExit = position + transmissionRay; - vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); - vec2 refractionCoords = ndcPos.xy / ndcPos.w; - refractionCoords += 1.0; - refractionCoords /= 2.0; - transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); - transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); - #endif - vec3 attenuatedColor = transmittance * transmittedLight.rgb; - vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); - float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; - return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); - } -#endif`,Y_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - varying vec2 vUv; -#endif -#ifdef USE_MAP - varying vec2 vMapUv; -#endif -#ifdef USE_ALPHAMAP - varying vec2 vAlphaMapUv; -#endif -#ifdef USE_LIGHTMAP - varying vec2 vLightMapUv; -#endif -#ifdef USE_AOMAP - varying vec2 vAoMapUv; -#endif -#ifdef USE_BUMPMAP - varying vec2 vBumpMapUv; -#endif -#ifdef USE_NORMALMAP - varying vec2 vNormalMapUv; -#endif -#ifdef USE_EMISSIVEMAP - varying vec2 vEmissiveMapUv; -#endif -#ifdef USE_METALNESSMAP - varying vec2 vMetalnessMapUv; -#endif -#ifdef USE_ROUGHNESSMAP - varying vec2 vRoughnessMapUv; -#endif -#ifdef USE_ANISOTROPYMAP - varying vec2 vAnisotropyMapUv; -#endif -#ifdef USE_CLEARCOATMAP - varying vec2 vClearcoatMapUv; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - varying vec2 vClearcoatNormalMapUv; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - varying vec2 vClearcoatRoughnessMapUv; -#endif -#ifdef USE_IRIDESCENCEMAP - varying vec2 vIridescenceMapUv; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - varying vec2 vIridescenceThicknessMapUv; -#endif -#ifdef USE_SHEEN_COLORMAP - varying vec2 vSheenColorMapUv; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - varying vec2 vSheenRoughnessMapUv; -#endif -#ifdef USE_SPECULARMAP - varying vec2 vSpecularMapUv; -#endif -#ifdef USE_SPECULAR_COLORMAP - varying vec2 vSpecularColorMapUv; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - varying vec2 vSpecularIntensityMapUv; -#endif -#ifdef USE_TRANSMISSIONMAP - uniform mat3 transmissionMapTransform; - varying vec2 vTransmissionMapUv; -#endif -#ifdef USE_THICKNESSMAP - uniform mat3 thicknessMapTransform; - varying vec2 vThicknessMapUv; -#endif`,Z_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - varying vec2 vUv; -#endif -#ifdef USE_MAP - uniform mat3 mapTransform; - varying vec2 vMapUv; -#endif -#ifdef USE_ALPHAMAP - uniform mat3 alphaMapTransform; - varying vec2 vAlphaMapUv; -#endif -#ifdef USE_LIGHTMAP - uniform mat3 lightMapTransform; - varying vec2 vLightMapUv; -#endif -#ifdef USE_AOMAP - uniform mat3 aoMapTransform; - varying vec2 vAoMapUv; -#endif -#ifdef USE_BUMPMAP - uniform mat3 bumpMapTransform; - varying vec2 vBumpMapUv; -#endif -#ifdef USE_NORMALMAP - uniform mat3 normalMapTransform; - varying vec2 vNormalMapUv; -#endif -#ifdef USE_DISPLACEMENTMAP - uniform mat3 displacementMapTransform; - varying vec2 vDisplacementMapUv; -#endif -#ifdef USE_EMISSIVEMAP - uniform mat3 emissiveMapTransform; - varying vec2 vEmissiveMapUv; -#endif -#ifdef USE_METALNESSMAP - uniform mat3 metalnessMapTransform; - varying vec2 vMetalnessMapUv; -#endif -#ifdef USE_ROUGHNESSMAP - uniform mat3 roughnessMapTransform; - varying vec2 vRoughnessMapUv; -#endif -#ifdef USE_ANISOTROPYMAP - uniform mat3 anisotropyMapTransform; - varying vec2 vAnisotropyMapUv; -#endif -#ifdef USE_CLEARCOATMAP - uniform mat3 clearcoatMapTransform; - varying vec2 vClearcoatMapUv; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - uniform mat3 clearcoatNormalMapTransform; - varying vec2 vClearcoatNormalMapUv; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - uniform mat3 clearcoatRoughnessMapTransform; - varying vec2 vClearcoatRoughnessMapUv; -#endif -#ifdef USE_SHEEN_COLORMAP - uniform mat3 sheenColorMapTransform; - varying vec2 vSheenColorMapUv; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - uniform mat3 sheenRoughnessMapTransform; - varying vec2 vSheenRoughnessMapUv; -#endif -#ifdef USE_IRIDESCENCEMAP - uniform mat3 iridescenceMapTransform; - varying vec2 vIridescenceMapUv; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - uniform mat3 iridescenceThicknessMapTransform; - varying vec2 vIridescenceThicknessMapUv; -#endif -#ifdef USE_SPECULARMAP - uniform mat3 specularMapTransform; - varying vec2 vSpecularMapUv; -#endif -#ifdef USE_SPECULAR_COLORMAP - uniform mat3 specularColorMapTransform; - varying vec2 vSpecularColorMapUv; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - uniform mat3 specularIntensityMapTransform; - varying vec2 vSpecularIntensityMapUv; -#endif -#ifdef USE_TRANSMISSIONMAP - uniform mat3 transmissionMapTransform; - varying vec2 vTransmissionMapUv; -#endif -#ifdef USE_THICKNESSMAP - uniform mat3 thicknessMapTransform; - varying vec2 vThicknessMapUv; -#endif`,J_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - vUv = vec3( uv, 1 ).xy; -#endif -#ifdef USE_MAP - vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ALPHAMAP - vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_LIGHTMAP - vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_AOMAP - vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_BUMPMAP - vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_NORMALMAP - vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_DISPLACEMENTMAP - vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_EMISSIVEMAP - vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_METALNESSMAP - vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ROUGHNESSMAP - vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ANISOTROPYMAP - vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOATMAP - vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_IRIDESCENCEMAP - vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SHEEN_COLORMAP - vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULARMAP - vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULAR_COLORMAP - vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_TRANSMISSIONMAP - vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_THICKNESSMAP - vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,K_=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 - vec4 worldPosition = vec4( transformed, 1.0 ); - #ifdef USE_BATCHING - worldPosition = batchingMatrix * worldPosition; - #endif - #ifdef USE_INSTANCING - worldPosition = instanceMatrix * worldPosition; - #endif - worldPosition = modelMatrix * worldPosition; -#endif`;const $_=`varying vec2 vUv; -uniform mat3 uvTransform; -void main() { - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,j_=`uniform sampler2D t2D; -uniform float backgroundIntensity; -varying vec2 vUv; -void main() { - vec4 texColor = texture2D( t2D, vUv ); - #ifdef DECODE_VIDEO_TEXTURE - texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); - #endif - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`,Q_=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,ev=`#ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; -#elif defined( ENVMAP_TYPE_CUBE_UV ) - uniform sampler2D envMap; -#endif -uniform float flipEnvMap; -uniform float backgroundBlurriness; -uniform float backgroundIntensity; -uniform mat3 backgroundRotation; -varying vec3 vWorldDirection; -#include -void main() { - #ifdef ENVMAP_TYPE_CUBE - vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); - #elif defined( ENVMAP_TYPE_CUBE_UV ) - vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); - #else - vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - #endif - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`,tv=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,nv=`uniform samplerCube tCube; -uniform float tFlip; -uniform float opacity; -varying vec3 vWorldDirection; -void main() { - vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); - gl_FragColor = texColor; - gl_FragColor.a *= opacity; - #include - #include -}`,iv=`#include -#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - #include - #include - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vHighPrecisionZW = gl_Position.zw; -}`,sv=`#if DEPTH_PACKING == 3200 - uniform float opacity; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - vec4 diffuseColor = vec4( 1.0 ); - #include - #if DEPTH_PACKING == 3200 - diffuseColor.a = opacity; - #endif - #include - #include - #include - #include - #include - float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; - #if DEPTH_PACKING == 3200 - gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); - #elif DEPTH_PACKING == 3201 - gl_FragColor = packDepthToRGBA( fragCoordZ ); - #elif DEPTH_PACKING == 3202 - gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); - #elif DEPTH_PACKING == 3203 - gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); - #endif -}`,rv=`#define DISTANCE -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vWorldPosition = worldPosition.xyz; -}`,av=`#define DISTANCE -uniform vec3 referencePosition; -uniform float nearDistance; -uniform float farDistance; -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -#include -#include -void main () { - vec4 diffuseColor = vec4( 1.0 ); - #include - #include - #include - #include - #include - float dist = length( vWorldPosition - referencePosition ); - dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); - dist = saturate( dist ); - gl_FragColor = packDepthToRGBA( dist ); -}`,ov=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include -}`,lv=`uniform sampler2D tEquirect; -varying vec3 vWorldDirection; -#include -void main() { - vec3 direction = normalize( vWorldDirection ); - vec2 sampleUV = equirectUv( direction ); - gl_FragColor = texture2D( tEquirect, sampleUV ); - #include - #include -}`,cv=`uniform float scale; -attribute float lineDistance; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main() { - vLineDistance = scale * lineDistance; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,hv=`uniform vec3 diffuse; -uniform float opacity; -uniform float dashSize; -uniform float totalSize; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - if ( mod( vLineDistance, totalSize ) > dashSize ) { - discard; - } - vec3 outgoingLight = vec3( 0.0 ); - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`,uv=`#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) - #include - #include - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,dv=`uniform vec3 diffuse; -uniform float opacity; -#ifndef FLAT_SHADED - varying vec3 vNormal; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - #include - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - #ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; - #else - reflectedLight.indirectDiffuse += vec3( 1.0 ); - #endif - #include - reflectedLight.indirectDiffuse *= diffuseColor.rgb; - vec3 outgoingLight = reflectedLight.indirectDiffuse; - #include - #include - #include - #include - #include - #include - #include -}`,fv=`#define LAMBERT -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`,pv=`#define LAMBERT -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`,mv=`#define MATCAP -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; -}`,gv=`#define MATCAP -uniform vec3 diffuse; -uniform float opacity; -uniform sampler2D matcap; -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 viewDir = normalize( vViewPosition ); - vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); - vec3 y = cross( viewDir, x ); - vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; - #ifdef USE_MATCAP - vec4 matcapColor = texture2D( matcap, uv ); - #else - vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); - #endif - vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; - #include - #include - #include - #include - #include - #include -}`,_v=`#define NORMAL -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - vViewPosition = - mvPosition.xyz; -#endif -}`,vv=`#define NORMAL -uniform float opacity; -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); - #include - #include - #include - #include - gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); - #ifdef OPAQUE - gl_FragColor.a = 1.0; - #endif -}`,xv=`#define PHONG -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`,yv=`#define PHONG -uniform vec3 diffuse; -uniform vec3 emissive; -uniform vec3 specular; -uniform float shininess; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`,Mv=`#define STANDARD -varying vec3 vViewPosition; -#ifdef USE_TRANSMISSION - varying vec3 vWorldPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -#ifdef USE_TRANSMISSION - vWorldPosition = worldPosition.xyz; -#endif -}`,bv=`#define STANDARD -#ifdef PHYSICAL - #define IOR - #define USE_SPECULAR -#endif -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float roughness; -uniform float metalness; -uniform float opacity; -#ifdef IOR - uniform float ior; -#endif -#ifdef USE_SPECULAR - uniform float specularIntensity; - uniform vec3 specularColor; - #ifdef USE_SPECULAR_COLORMAP - uniform sampler2D specularColorMap; - #endif - #ifdef USE_SPECULAR_INTENSITYMAP - uniform sampler2D specularIntensityMap; - #endif -#endif -#ifdef USE_CLEARCOAT - uniform float clearcoat; - uniform float clearcoatRoughness; -#endif -#ifdef USE_DISPERSION - uniform float dispersion; -#endif -#ifdef USE_IRIDESCENCE - uniform float iridescence; - uniform float iridescenceIOR; - uniform float iridescenceThicknessMinimum; - uniform float iridescenceThicknessMaximum; -#endif -#ifdef USE_SHEEN - uniform vec3 sheenColor; - uniform float sheenRoughness; - #ifdef USE_SHEEN_COLORMAP - uniform sampler2D sheenColorMap; - #endif - #ifdef USE_SHEEN_ROUGHNESSMAP - uniform sampler2D sheenRoughnessMap; - #endif -#endif -#ifdef USE_ANISOTROPY - uniform vec2 anisotropyVector; - #ifdef USE_ANISOTROPYMAP - uniform sampler2D anisotropyMap; - #endif -#endif -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; - vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; - #include - vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; - #ifdef USE_SHEEN - float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); - outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; - #endif - #ifdef USE_CLEARCOAT - float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); - vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); - outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; - #endif - #include - #include - #include - #include - #include - #include -}`,Sv=`#define TOON -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -}`,wv=`#define TOON -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include -}`,Ev=`uniform float size; -uniform float scale; -#include -#include -#include -#include -#include -#include -#ifdef USE_POINTS_UV - varying vec2 vUv; - uniform mat3 uvTransform; -#endif -void main() { - #ifdef USE_POINTS_UV - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - #endif - #include - #include - #include - #include - #include - #include - gl_PointSize = size; - #ifdef USE_SIZEATTENUATION - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); - #endif - #include - #include - #include - #include -}`,Tv=`uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - vec3 outgoingLight = vec3( 0.0 ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`,Av=`#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,Cv=`uniform vec3 color; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); - #include - #include - #include -}`,Rv=`uniform float rotation; -uniform vec2 center; -#include -#include -#include -#include -#include -void main() { - #include - vec4 mvPosition = modelViewMatrix[ 3 ]; - vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); - #ifndef USE_SIZEATTENUATION - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) scale *= - mvPosition.z; - #endif - vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; - vec2 rotatedPosition; - rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; - rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; - mvPosition.xy += rotatedPosition; - gl_Position = projectionMatrix * mvPosition; - #include - #include - #include -}`,Iv=`uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - vec3 outgoingLight = vec3( 0.0 ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include -}`,st={alphahash_fragment:jg,alphahash_pars_fragment:Qg,alphamap_fragment:e0,alphamap_pars_fragment:t0,alphatest_fragment:n0,alphatest_pars_fragment:i0,aomap_fragment:s0,aomap_pars_fragment:r0,batching_pars_vertex:a0,batching_vertex:o0,begin_vertex:l0,beginnormal_vertex:c0,bsdfs:h0,iridescence_fragment:u0,bumpmap_pars_fragment:d0,clipping_planes_fragment:f0,clipping_planes_pars_fragment:p0,clipping_planes_pars_vertex:m0,clipping_planes_vertex:g0,color_fragment:_0,color_pars_fragment:v0,color_pars_vertex:x0,color_vertex:y0,common:M0,cube_uv_reflection_fragment:b0,defaultnormal_vertex:S0,displacementmap_pars_vertex:w0,displacementmap_vertex:E0,emissivemap_fragment:T0,emissivemap_pars_fragment:A0,colorspace_fragment:C0,colorspace_pars_fragment:R0,envmap_fragment:I0,envmap_common_pars_fragment:P0,envmap_pars_fragment:D0,envmap_pars_vertex:L0,envmap_physical_pars_fragment:W0,envmap_vertex:U0,fog_vertex:N0,fog_pars_vertex:F0,fog_fragment:O0,fog_pars_fragment:B0,gradientmap_pars_fragment:z0,lightmap_pars_fragment:k0,lights_lambert_fragment:V0,lights_lambert_pars_fragment:H0,lights_pars_begin:G0,lights_toon_fragment:X0,lights_toon_pars_fragment:q0,lights_phong_fragment:Y0,lights_phong_pars_fragment:Z0,lights_physical_fragment:J0,lights_physical_pars_fragment:K0,lights_fragment_begin:$0,lights_fragment_maps:j0,lights_fragment_end:Q0,logdepthbuf_fragment:e_,logdepthbuf_pars_fragment:t_,logdepthbuf_pars_vertex:n_,logdepthbuf_vertex:i_,map_fragment:s_,map_pars_fragment:r_,map_particle_fragment:a_,map_particle_pars_fragment:o_,metalnessmap_fragment:l_,metalnessmap_pars_fragment:c_,morphinstance_vertex:h_,morphcolor_vertex:u_,morphnormal_vertex:d_,morphtarget_pars_vertex:f_,morphtarget_vertex:p_,normal_fragment_begin:m_,normal_fragment_maps:g_,normal_pars_fragment:__,normal_pars_vertex:v_,normal_vertex:x_,normalmap_pars_fragment:y_,clearcoat_normal_fragment_begin:M_,clearcoat_normal_fragment_maps:b_,clearcoat_pars_fragment:S_,iridescence_pars_fragment:w_,opaque_fragment:E_,packing:T_,premultiplied_alpha_fragment:A_,project_vertex:C_,dithering_fragment:R_,dithering_pars_fragment:I_,roughnessmap_fragment:P_,roughnessmap_pars_fragment:D_,shadowmap_pars_fragment:L_,shadowmap_pars_vertex:U_,shadowmap_vertex:N_,shadowmask_pars_fragment:F_,skinbase_vertex:O_,skinning_pars_vertex:B_,skinning_vertex:z_,skinnormal_vertex:k_,specularmap_fragment:V_,specularmap_pars_fragment:H_,tonemapping_fragment:G_,tonemapping_pars_fragment:W_,transmission_fragment:X_,transmission_pars_fragment:q_,uv_pars_fragment:Y_,uv_pars_vertex:Z_,uv_vertex:J_,worldpos_vertex:K_,background_vert:$_,background_frag:j_,backgroundCube_vert:Q_,backgroundCube_frag:ev,cube_vert:tv,cube_frag:nv,depth_vert:iv,depth_frag:sv,distanceRGBA_vert:rv,distanceRGBA_frag:av,equirect_vert:ov,equirect_frag:lv,linedashed_vert:cv,linedashed_frag:hv,meshbasic_vert:uv,meshbasic_frag:dv,meshlambert_vert:fv,meshlambert_frag:pv,meshmatcap_vert:mv,meshmatcap_frag:gv,meshnormal_vert:_v,meshnormal_frag:vv,meshphong_vert:xv,meshphong_frag:yv,meshphysical_vert:Mv,meshphysical_frag:bv,meshtoon_vert:Sv,meshtoon_frag:wv,points_vert:Ev,points_frag:Tv,shadow_vert:Av,shadow_frag:Cv,sprite_vert:Rv,sprite_frag:Iv},Te={common:{diffuse:{value:new ne(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new tt},alphaMap:{value:null},alphaMapTransform:{value:new tt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new tt}},envmap:{envMap:{value:null},envMapRotation:{value:new tt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new tt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new tt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new tt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new tt},normalScale:{value:new j(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new tt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new tt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new tt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new tt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ne(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ne(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new tt},alphaTest:{value:0},uvTransform:{value:new tt}},sprite:{diffuse:{value:new ne(16777215)},opacity:{value:1},center:{value:new j(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new tt},alphaMap:{value:null},alphaMapTransform:{value:new tt},alphaTest:{value:0}}},On={basic:{uniforms:nn([Te.common,Te.specularmap,Te.envmap,Te.aomap,Te.lightmap,Te.fog]),vertexShader:st.meshbasic_vert,fragmentShader:st.meshbasic_frag},lambert:{uniforms:nn([Te.common,Te.specularmap,Te.envmap,Te.aomap,Te.lightmap,Te.emissivemap,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.fog,Te.lights,{emissive:{value:new ne(0)}}]),vertexShader:st.meshlambert_vert,fragmentShader:st.meshlambert_frag},phong:{uniforms:nn([Te.common,Te.specularmap,Te.envmap,Te.aomap,Te.lightmap,Te.emissivemap,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.fog,Te.lights,{emissive:{value:new ne(0)},specular:{value:new ne(1118481)},shininess:{value:30}}]),vertexShader:st.meshphong_vert,fragmentShader:st.meshphong_frag},standard:{uniforms:nn([Te.common,Te.envmap,Te.aomap,Te.lightmap,Te.emissivemap,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.roughnessmap,Te.metalnessmap,Te.fog,Te.lights,{emissive:{value:new ne(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:st.meshphysical_vert,fragmentShader:st.meshphysical_frag},toon:{uniforms:nn([Te.common,Te.aomap,Te.lightmap,Te.emissivemap,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.gradientmap,Te.fog,Te.lights,{emissive:{value:new ne(0)}}]),vertexShader:st.meshtoon_vert,fragmentShader:st.meshtoon_frag},matcap:{uniforms:nn([Te.common,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.fog,{matcap:{value:null}}]),vertexShader:st.meshmatcap_vert,fragmentShader:st.meshmatcap_frag},points:{uniforms:nn([Te.points,Te.fog]),vertexShader:st.points_vert,fragmentShader:st.points_frag},dashed:{uniforms:nn([Te.common,Te.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:st.linedashed_vert,fragmentShader:st.linedashed_frag},depth:{uniforms:nn([Te.common,Te.displacementmap]),vertexShader:st.depth_vert,fragmentShader:st.depth_frag},normal:{uniforms:nn([Te.common,Te.bumpmap,Te.normalmap,Te.displacementmap,{opacity:{value:1}}]),vertexShader:st.meshnormal_vert,fragmentShader:st.meshnormal_frag},sprite:{uniforms:nn([Te.sprite,Te.fog]),vertexShader:st.sprite_vert,fragmentShader:st.sprite_frag},background:{uniforms:{uvTransform:{value:new tt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:st.background_vert,fragmentShader:st.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new tt}},vertexShader:st.backgroundCube_vert,fragmentShader:st.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:st.cube_vert,fragmentShader:st.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:st.equirect_vert,fragmentShader:st.equirect_frag},distanceRGBA:{uniforms:nn([Te.common,Te.displacementmap,{referencePosition:{value:new A},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:st.distanceRGBA_vert,fragmentShader:st.distanceRGBA_frag},shadow:{uniforms:nn([Te.lights,Te.fog,{color:{value:new ne(0)},opacity:{value:1}}]),vertexShader:st.shadow_vert,fragmentShader:st.shadow_frag}};On.physical={uniforms:nn([On.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new tt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new tt},clearcoatNormalScale:{value:new j(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new tt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new tt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new tt},sheen:{value:0},sheenColor:{value:new ne(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new tt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new tt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new tt},transmissionSamplerSize:{value:new j},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new tt},attenuationDistance:{value:0},attenuationColor:{value:new ne(0)},specularColor:{value:new ne(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new tt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new tt},anisotropyVector:{value:new j},anisotropyMap:{value:null},anisotropyMapTransform:{value:new tt}}]),vertexShader:st.meshphysical_vert,fragmentShader:st.meshphysical_frag};const Ba={r:0,b:0,g:0},Yi=new In,Pv=new Ze;function Dv(r,e,t,n,i,s,a){const o=new ne(0);let l=s===!0?0:1,c,h,u=null,f=0,d=null;function p(v){let x=v.isScene===!0?v.background:null;return x&&x.isTexture&&(x=(v.backgroundBlurriness>0?t:e).get(x)),x}function _(v){let x=!1;const w=p(v);w===null?m(o,l):w&&w.isColor&&(m(w,1),x=!0);const T=r.xr.getEnvironmentBlendMode();T==="additive"?n.buffers.color.setClear(0,0,0,1,a):T==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(r.autoClear||x)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function g(v,x){const w=p(x);w&&(w.isCubeTexture||w.mapping===qr)?(h===void 0&&(h=new yt(new or(1,1,1),new Xt({name:"BackgroundCubeMaterial",uniforms:tr(On.backgroundCube.uniforms),vertexShader:On.backgroundCube.vertexShader,fragmentShader:On.backgroundCube.fragmentShader,side:fn,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(T,C,P){this.matrixWorld.copyPosition(P.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(h)),Yi.copy(x.backgroundRotation),Yi.x*=-1,Yi.y*=-1,Yi.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(Yi.y*=-1,Yi.z*=-1),h.material.uniforms.envMap.value=w,h.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(Pv.makeRotationFromEuler(Yi)),h.material.toneMapped=ht.getTransfer(w.colorSpace)!==vt,(u!==w||f!==w.version||d!==r.toneMapping)&&(h.material.needsUpdate=!0,u=w,f=w.version,d=r.toneMapping),h.layers.enableAll(),v.unshift(h,h.geometry,h.material,0,0,null)):w&&w.isTexture&&(c===void 0&&(c=new yt(new lr(2,2),new Xt({name:"BackgroundMaterial",uniforms:tr(On.background.uniforms),vertexShader:On.background.vertexShader,fragmentShader:On.background.fragmentShader,side:Ci,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=w,c.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,c.material.toneMapped=ht.getTransfer(w.colorSpace)!==vt,w.matrixAutoUpdate===!0&&w.updateMatrix(),c.material.uniforms.uvTransform.value.copy(w.matrix),(u!==w||f!==w.version||d!==r.toneMapping)&&(c.material.needsUpdate=!0,u=w,f=w.version,d=r.toneMapping),c.layers.enableAll(),v.unshift(c,c.geometry,c.material,0,0,null))}function m(v,x){v.getRGB(Ba,Ad(r)),n.buffers.color.setClear(Ba.r,Ba.g,Ba.b,x,a)}function y(){h!==void 0&&(h.geometry.dispose(),h.material.dispose()),c!==void 0&&(c.geometry.dispose(),c.material.dispose())}return{getClearColor:function(){return o},setClearColor:function(v,x=1){o.set(v),l=x,m(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(v){l=v,m(o,l)},render:_,addToRenderList:g,dispose:y}}function Lv(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=f(null);let s=i,a=!1;function o(M,D,G,F,V){let J=!1;const q=u(F,G,D);s!==q&&(s=q,c(s.object)),J=d(M,F,G,V),J&&p(M,F,G,V),V!==null&&e.update(V,r.ELEMENT_ARRAY_BUFFER),(J||a)&&(a=!1,x(M,D,G,F),V!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(V).buffer))}function l(){return r.createVertexArray()}function c(M){return r.bindVertexArray(M)}function h(M){return r.deleteVertexArray(M)}function u(M,D,G){const F=G.wireframe===!0;let V=n[M.id];V===void 0&&(V={},n[M.id]=V);let J=V[D.id];J===void 0&&(J={},V[D.id]=J);let q=J[F];return q===void 0&&(q=f(l()),J[F]=q),q}function f(M){const D=[],G=[],F=[];for(let V=0;V=0){const be=V[Z];let Re=J[Z];if(Re===void 0&&(Z==="instanceMatrix"&&M.instanceMatrix&&(Re=M.instanceMatrix),Z==="instanceColor"&&M.instanceColor&&(Re=M.instanceColor)),be===void 0||be.attribute!==Re||Re&&be.data!==Re.data)return!0;q++}return s.attributesNum!==q||s.index!==F}function p(M,D,G,F){const V={},J=D.attributes;let q=0;const se=G.getAttributes();for(const Z in se)if(se[Z].location>=0){let be=J[Z];be===void 0&&(Z==="instanceMatrix"&&M.instanceMatrix&&(be=M.instanceMatrix),Z==="instanceColor"&&M.instanceColor&&(be=M.instanceColor));const Re={};Re.attribute=be,be&&be.data&&(Re.data=be.data),V[Z]=Re,q++}s.attributes=V,s.attributesNum=q,s.index=F}function _(){const M=s.newAttributes;for(let D=0,G=M.length;D=0){let _e=V[se];if(_e===void 0&&(se==="instanceMatrix"&&M.instanceMatrix&&(_e=M.instanceMatrix),se==="instanceColor"&&M.instanceColor&&(_e=M.instanceColor)),_e!==void 0){const be=_e.normalized,Re=_e.itemSize,Ge=e.get(_e);if(Ge===void 0)continue;const it=Ge.buffer,Q=Ge.type,ue=Ge.bytesPerElement,Ie=Q===r.INT||Q===r.UNSIGNED_INT||_e.gpuType===Pc;if(_e.isInterleavedBufferAttribute){const pe=_e.data,Oe=pe.stride,We=_e.offset;if(pe.isInstancedInterleavedBuffer){for(let ze=0;ze0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const h=l(c);h!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const u=t.logarithmicDepthBuffer===!0,f=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),d=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),p=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_TEXTURE_SIZE),g=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),m=r.getParameter(r.MAX_VERTEX_ATTRIBS),y=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),v=r.getParameter(r.MAX_VARYING_VECTORS),x=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),w=p>0,T=r.getParameter(r.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:u,reverseDepthBuffer:f,maxTextures:d,maxVertexTextures:p,maxTextureSize:_,maxCubemapSize:g,maxAttributes:m,maxVertexUniforms:y,maxVaryings:v,maxFragmentUniforms:x,vertexTextures:w,maxSamples:T}}function Fv(r){const e=this;let t=null,n=0,i=!1,s=!1;const a=new Si,o=new tt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,f){const d=u.length!==0||f||n!==0||i;return i=f,n=u.length,d},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,f){t=h(u,f,0)},this.setState=function(u,f,d){const p=u.clippingPlanes,_=u.clipIntersection,g=u.clipShadows,m=r.get(u);if(!i||p===null||p.length===0||s&&!g)s?h(null):c();else{const y=s?0:n,v=y*4;let x=m.clippingState||null;l.value=x,x=h(p,f,v,d);for(let w=0;w!==v;++w)x[w]=t[w];m.clippingState=x,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,f,d,p){const _=u!==null?u.length:0;let g=null;if(_!==0){if(g=l.value,p!==!0||g===null){const m=d+_*4,y=f.matrixWorldInverse;o.getNormalMatrix(y),(g===null||g.length0){const c=new tm(l.height);return c.fromEquirectangularTexture(r,a),e.set(a,c),a.addEventListener("dispose",i),t(c.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const Gs=4,Pu=[.125,.215,.35,.446,.526,.582],es=20,vl=new Lo,Du=new ne;let xl=null,yl=0,Ml=0,bl=!1;const $i=(1+Math.sqrt(5))/2,Us=1/$i,Lu=[new A(-$i,Us,0),new A($i,Us,0),new A(-Us,0,$i),new A(Us,0,$i),new A(0,$i,-Us),new A(0,$i,Us),new A(-1,1,-1),new A(1,1,-1),new A(-1,1,1),new A(1,1,1)];class Uu{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){xl=this._renderer.getRenderTarget(),yl=this._renderer.getActiveCubeFace(),Ml=this._renderer.getActiveMipmapLevel(),bl=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Ou(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Fu(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?v:0,v,v),h.setRenderTarget(i),_&&h.render(p,o),h.render(e,o)}p.geometry.dispose(),p.material.dispose(),h.toneMapping=f,h.autoClear=u,e.background=g}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Ri||e.mapping===os;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=Ou()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Fu());const s=i?this._cubemapMaterial:this._equirectMaterial,a=new yt(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;za(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,vl)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;ses&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${es}`);const m=[];let y=0;for(let C=0;Cv-Gs?i-v+Gs:0),T=4*(this._cubeSize-x);za(t,w,T,3*x,2*x),l.setRenderTarget(t),l.render(u,vl)}}function Bv(r){const e=[],t=[],n=[];let i=r;const s=r-Gs+1+Pu.length;for(let a=0;ar-Gs?l=Pu[a-r+Gs-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),h=-c,u=1+c,f=[h,h,u,h,u,u,h,h,u,u,h,u],d=6,p=6,_=3,g=2,m=1,y=new Float32Array(_*p*d),v=new Float32Array(g*p*d),x=new Float32Array(m*p*d);for(let T=0;T2?0:-1,S=[C,P,0,C+2/3,P,0,C+2/3,P+1,0,C,P,0,C+2/3,P+1,0,C,P+1,0];y.set(S,_*p*T),v.set(f,g*p*T);const M=[T,T,T,T,T,T];x.set(M,m*p*T)}const w=new qe;w.setAttribute("position",new rt(y,_)),w.setAttribute("uv",new rt(v,g)),w.setAttribute("faceIndex",new rt(x,m)),e.push(w),i>Gs&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Nu(r,e,t){const n=new Sn(r,e,t);return n.texture.mapping=qr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function za(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function zv(r,e,t){const n=new Float32Array(es),i=new A(0,1,0);return new Xt({name:"SphericalGaussianBlur",defines:{n:es,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:dh(),fragmentShader:` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - uniform int samples; - uniform float weights[ n ]; - uniform bool latitudinal; - uniform float dTheta; - uniform float mipInt; - uniform vec3 poleAxis; - - #define ENVMAP_TYPE_CUBE_UV - #include - - vec3 getSample( float theta, vec3 axis ) { - - float cosTheta = cos( theta ); - // Rodrigues' axis-angle rotation - vec3 sampleDirection = vOutputDirection * cosTheta - + cross( axis, vOutputDirection ) * sin( theta ) - + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); - - return bilinearCubeUV( envMap, sampleDirection, mipInt ); - - } - - void main() { - - vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); - - if ( all( equal( axis, vec3( 0.0 ) ) ) ) { - - axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); - - } - - axis = normalize( axis ); - - gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); - - for ( int i = 1; i < n; i++ ) { - - if ( i >= samples ) { - - break; - - } - - float theta = dTheta * float( i ); - gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); - gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); - - } - - } - `,blending:ii,depthTest:!1,depthWrite:!1})}function Fu(){return new Xt({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:dh(),fragmentShader:` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - - #include - - void main() { - - vec3 outputDirection = normalize( vOutputDirection ); - vec2 uv = equirectUv( outputDirection ); - - gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); - - } - `,blending:ii,depthTest:!1,depthWrite:!1})}function Ou(){return new Xt({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:dh(),fragmentShader:` - - precision mediump float; - precision mediump int; - - uniform float flipEnvMap; - - varying vec3 vOutputDirection; - - uniform samplerCube envMap; - - void main() { - - gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); - - } - `,blending:ii,depthTest:!1,depthWrite:!1})}function dh(){return` - - precision mediump float; - precision mediump int; - - attribute float faceIndex; - - varying vec3 vOutputDirection; - - // RH coordinate system; PMREM face-indexing convention - vec3 getDirection( vec2 uv, float face ) { - - uv = 2.0 * uv - 1.0; - - vec3 direction = vec3( uv, 1.0 ); - - if ( face == 0.0 ) { - - direction = direction.zyx; // ( 1, v, u ) pos x - - } else if ( face == 1.0 ) { - - direction = direction.xzy; - direction.xz *= -1.0; // ( -u, 1, -v ) pos y - - } else if ( face == 2.0 ) { - - direction.x *= -1.0; // ( -u, v, 1 ) pos z - - } else if ( face == 3.0 ) { - - direction = direction.zyx; - direction.xz *= -1.0; // ( -1, v, -u ) neg x - - } else if ( face == 4.0 ) { - - direction = direction.xzy; - direction.xy *= -1.0; // ( -u, -1, v ) neg y - - } else if ( face == 5.0 ) { - - direction.z *= -1.0; // ( u, v, -1 ) neg z - - } - - return direction; - - } - - void main() { - - vOutputDirection = getDirection( uv, faceIndex ); - gl_Position = vec4( position, 1.0 ); - - } - `}function kv(r){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===io||l===so,h=l===Ri||l===os;if(c||h){let u=e.get(o);const f=u!==void 0?u.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==f)return t===null&&(t=new Uu(r)),u=c?t.fromEquirectangular(o,u):t.fromCubemap(o,u),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),u.texture;if(u!==void 0)return u.texture;{const d=o.image;return c&&d&&d.height>0||h&&d&&i(d)?(t===null&&(t=new Uu(r)),u=c?t.fromEquirectangular(o):t.fromCubemap(o),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),o.addEventListener("dispose",s),u.texture):null}}}return o}function i(o){let l=0;const c=6;for(let h=0;he.maxTextureSize&&(w=Math.ceil(x/e.maxTextureSize),x=e.maxTextureSize);const T=new Float32Array(x*w*4*u),C=new wo(T,x,w,u);C.type=Mn,C.needsUpdate=!0;const P=v*4;for(let M=0;M0)return r;const i=e*t;let s=zu[i];if(s===void 0&&(s=new Float32Array(i),zu[i]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,r[a].toArray(s,o)}return s}function Ot(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t":" "} ${o}: ${t[a]}`)}return n.join(` -`)}const qu=new tt;function kx(r){ht._getMatrix(qu,ht.workingColorSpace,r);const e=`mat3( ${qu.elements.map(t=>t.toFixed(4))} )`;switch(ht.getTransfer(r)){case co:return[e,"LinearTransferOETF"];case vt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function Yu(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const a=parseInt(s[1]);return t.toUpperCase()+` - -`+i+` - -`+zx(r.getShaderSource(e),a)}else return i}function Vx(r,e){const t=kx(e);return[`vec4 ${r}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` -`)}function Hx(r,e){let t;switch(e){case Jf:t="Linear";break;case Kf:t="Reinhard";break;case $f:t="Cineon";break;case cd:t="ACESFilmic";break;case Qf:t="AgX";break;case ep:t="Neutral";break;case jf:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const ka=new A;function Gx(){ht.getLuminanceCoefficients(ka);const r=ka.x.toFixed(4),e=ka.y.toFixed(4),t=ka.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` -`)}function Wx(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Ir).join(` -`)}function Xx(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` -`)}function qx(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function Mc(r){return r.replace(Yx,Jx)}const Zx=new Map;function Jx(r,e){let t=st[e];if(t===void 0){const n=Zx.get(e);if(n!==void 0)t=st[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Mc(t)}const Kx=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ku(r){return r.replace(Kx,$x)}function $x(r,e,t,n){let i="";for(let s=parseInt(e);s0&&(g+=` -`),m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(Ir).join(` -`),m.length>0&&(m+=` -`)):(g=[$u(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` -`].filter(Ir).join(` -`),m=[$u(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+h:"",t.envMap?"#define "+u:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ti?"#define TONE_MAPPING":"",t.toneMapping!==Ti?st.tonemapping_pars_fragment:"",t.toneMapping!==Ti?Hx("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",st.colorspace_pars_fragment,Vx("linearToOutputTexel",t.outputColorSpace),Gx(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` -`].filter(Ir).join(` -`)),a=Mc(a),a=Zu(a,t),a=Ju(a,t),o=Mc(o),o=Zu(o,t),o=Ju(o,t),a=Ku(a),o=Ku(o),t.isRawShaderMaterial!==!0&&(y=`#version 300 es -`,g=[d,"#define attribute in","#define varying out","#define texture2D texture"].join(` -`)+` -`+g,m=["#define varying in",t.glslVersion===Mh?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Mh?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` -`)+` -`+m);const v=y+g+a,x=y+m+o,w=Xu(i,i.VERTEX_SHADER,v),T=Xu(i,i.FRAGMENT_SHADER,x);i.attachShader(_,w),i.attachShader(_,T),t.index0AttributeName!==void 0?i.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function C(D){if(r.debug.checkShaderErrors){const G=i.getProgramInfoLog(_).trim(),F=i.getShaderInfoLog(w).trim(),V=i.getShaderInfoLog(T).trim();let J=!0,q=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(J=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,_,w,T);else{const se=Yu(i,w,"vertex"),Z=Yu(i,T,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+` - -Material Name: `+D.name+` -Material Type: `+D.type+` - -Program Info Log: `+G+` -`+se+` -`+Z)}else G!==""?console.warn("THREE.WebGLProgram: Program Info Log:",G):(F===""||V==="")&&(q=!1);q&&(D.diagnostics={runnable:J,programLog:G,vertexShader:{log:F,prefix:g},fragmentShader:{log:V,prefix:m}})}i.deleteShader(w),i.deleteShader(T),P=new $a(i,_),S=qx(i,_)}let P;this.getUniforms=function(){return P===void 0&&C(this),P};let S;this.getAttributes=function(){return S===void 0&&C(this),S};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=i.getProgramParameter(_,Ox)),M},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Bx++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=w,this.fragmentShader=T,this}let sy=0;class ry{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new ay(e),t.set(e,n)),n}}class ay{constructor(e){this.id=sy++,this.code=e,this.usedTimes=0}}function oy(r,e,t,n,i,s,a){const o=new Vc,l=new ry,c=new Set,h=[],u=i.logarithmicDepthBuffer,f=i.vertexTextures;let d=i.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(S){return c.add(S),S===0?"uv":`uv${S}`}function g(S,M,D,G,F){const V=G.fog,J=F.geometry,q=S.isMeshStandardMaterial?G.environment:null,se=(S.isMeshStandardMaterial?t:e).get(S.envMap||q),Z=se&&se.mapping===qr?se.image.height:null,_e=p[S.type];S.precision!==null&&(d=i.getMaxPrecision(S.precision),d!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",d,"instead."));const be=J.morphAttributes.position||J.morphAttributes.normal||J.morphAttributes.color,Re=be!==void 0?be.length:0;let Ge=0;J.morphAttributes.position!==void 0&&(Ge=1),J.morphAttributes.normal!==void 0&&(Ge=2),J.morphAttributes.color!==void 0&&(Ge=3);let it,Q,ue,Ie;if(_e){const at=On[_e];it=at.vertexShader,Q=at.fragmentShader}else it=S.vertexShader,Q=S.fragmentShader,l.update(S),ue=l.getVertexShaderID(S),Ie=l.getFragmentShaderID(S);const pe=r.getRenderTarget(),Oe=r.state.buffers.depth.getReversed(),We=F.isInstancedMesh===!0,ze=F.isBatchedMesh===!0,Je=!!S.map,te=!!S.matcap,de=!!se,I=!!S.aoMap,De=!!S.lightMap,re=!!S.bumpMap,Ae=!!S.normalMap,me=!!S.displacementMap,Ve=!!S.emissiveMap,Se=!!S.metalnessMap,R=!!S.roughnessMap,b=S.anisotropy>0,H=S.clearcoat>0,k=S.dispersion>0,X=S.iridescence>0,W=S.sheen>0,ce=S.transmission>0,oe=b&&!!S.anisotropyMap,ge=H&&!!S.clearcoatMap,Be=H&&!!S.clearcoatNormalMap,$=H&&!!S.clearcoatRoughnessMap,ve=X&&!!S.iridescenceMap,Y=X&&!!S.iridescenceThicknessMap,ie=W&&!!S.sheenColorMap,ae=W&&!!S.sheenRoughnessMap,Ne=!!S.specularMap,Pe=!!S.specularColorMap,Ke=!!S.specularIntensityMap,U=ce&&!!S.transmissionMap,ye=ce&&!!S.thicknessMap,K=!!S.gradientMap,ee=!!S.alphaMap,we=S.alphaTest>0,Me=!!S.alphaHash,Ye=!!S.extensions;let Mt=Ti;S.toneMapped&&(pe===null||pe.isXRRenderTarget===!0)&&(Mt=r.toneMapping);const St={shaderID:_e,shaderType:S.type,shaderName:S.name,vertexShader:it,fragmentShader:Q,defines:S.defines,customVertexShaderID:ue,customFragmentShaderID:Ie,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:d,batching:ze,batchingColor:ze&&F._colorsTexture!==null,instancing:We,instancingColor:We&&F.instanceColor!==null,instancingMorph:We&&F.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:pe===null?r.outputColorSpace:pe.isXRRenderTarget===!0?pe.texture.colorSpace:Qs,alphaToCoverage:!!S.alphaToCoverage,map:Je,matcap:te,envMap:de,envMapMode:de&&se.mapping,envMapCubeUVHeight:Z,aoMap:I,lightMap:De,bumpMap:re,normalMap:Ae,displacementMap:f&&me,emissiveMap:Ve,normalMapObjectSpace:Ae&&S.normalMapType===op,normalMapTangentSpace:Ae&&S.normalMapType===cs,metalnessMap:Se,roughnessMap:R,anisotropy:b,anisotropyMap:oe,clearcoat:H,clearcoatMap:ge,clearcoatNormalMap:Be,clearcoatRoughnessMap:$,dispersion:k,iridescence:X,iridescenceMap:ve,iridescenceThicknessMap:Y,sheen:W,sheenColorMap:ie,sheenRoughnessMap:ae,specularMap:Ne,specularColorMap:Pe,specularIntensityMap:Ke,transmission:ce,transmissionMap:U,thicknessMap:ye,gradientMap:K,opaque:S.transparent===!1&&S.blending===qs&&S.alphaToCoverage===!1,alphaMap:ee,alphaTest:we,alphaHash:Me,combine:S.combine,mapUv:Je&&_(S.map.channel),aoMapUv:I&&_(S.aoMap.channel),lightMapUv:De&&_(S.lightMap.channel),bumpMapUv:re&&_(S.bumpMap.channel),normalMapUv:Ae&&_(S.normalMap.channel),displacementMapUv:me&&_(S.displacementMap.channel),emissiveMapUv:Ve&&_(S.emissiveMap.channel),metalnessMapUv:Se&&_(S.metalnessMap.channel),roughnessMapUv:R&&_(S.roughnessMap.channel),anisotropyMapUv:oe&&_(S.anisotropyMap.channel),clearcoatMapUv:ge&&_(S.clearcoatMap.channel),clearcoatNormalMapUv:Be&&_(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:$&&_(S.clearcoatRoughnessMap.channel),iridescenceMapUv:ve&&_(S.iridescenceMap.channel),iridescenceThicknessMapUv:Y&&_(S.iridescenceThicknessMap.channel),sheenColorMapUv:ie&&_(S.sheenColorMap.channel),sheenRoughnessMapUv:ae&&_(S.sheenRoughnessMap.channel),specularMapUv:Ne&&_(S.specularMap.channel),specularColorMapUv:Pe&&_(S.specularColorMap.channel),specularIntensityMapUv:Ke&&_(S.specularIntensityMap.channel),transmissionMapUv:U&&_(S.transmissionMap.channel),thicknessMapUv:ye&&_(S.thicknessMap.channel),alphaMapUv:ee&&_(S.alphaMap.channel),vertexTangents:!!J.attributes.tangent&&(Ae||b),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!J.attributes.color&&J.attributes.color.itemSize===4,pointsUvs:F.isPoints===!0&&!!J.attributes.uv&&(Je||ee),fog:!!V,useFog:S.fog===!0,fogExp2:!!V&&V.isFogExp2,flatShading:S.flatShading===!0,sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:u,reverseDepthBuffer:Oe,skinning:F.isSkinnedMesh===!0,morphTargets:J.morphAttributes.position!==void 0,morphNormals:J.morphAttributes.normal!==void 0,morphColors:J.morphAttributes.color!==void 0,morphTargetsCount:Re,morphTextureStride:Ge,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:S.dithering,shadowMapEnabled:r.shadowMap.enabled&&D.length>0,shadowMapType:r.shadowMap.type,toneMapping:Mt,decodeVideoTexture:Je&&S.map.isVideoTexture===!0&&ht.getTransfer(S.map.colorSpace)===vt,decodeVideoTextureEmissive:Ve&&S.emissiveMap.isVideoTexture===!0&&ht.getTransfer(S.emissiveMap.colorSpace)===vt,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===Bn,flipSided:S.side===fn,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionClipCullDistance:Ye&&S.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ye&&S.extensions.multiDraw===!0||ze)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()};return St.vertexUv1s=c.has(1),St.vertexUv2s=c.has(2),St.vertexUv3s=c.has(3),c.clear(),St}function m(S){const M=[];if(S.shaderID?M.push(S.shaderID):(M.push(S.customVertexShaderID),M.push(S.customFragmentShaderID)),S.defines!==void 0)for(const D in S.defines)M.push(D),M.push(S.defines[D]);return S.isRawShaderMaterial===!1&&(y(M,S),v(M,S),M.push(r.outputColorSpace)),M.push(S.customProgramCacheKey),M.join()}function y(S,M){S.push(M.precision),S.push(M.outputColorSpace),S.push(M.envMapMode),S.push(M.envMapCubeUVHeight),S.push(M.mapUv),S.push(M.alphaMapUv),S.push(M.lightMapUv),S.push(M.aoMapUv),S.push(M.bumpMapUv),S.push(M.normalMapUv),S.push(M.displacementMapUv),S.push(M.emissiveMapUv),S.push(M.metalnessMapUv),S.push(M.roughnessMapUv),S.push(M.anisotropyMapUv),S.push(M.clearcoatMapUv),S.push(M.clearcoatNormalMapUv),S.push(M.clearcoatRoughnessMapUv),S.push(M.iridescenceMapUv),S.push(M.iridescenceThicknessMapUv),S.push(M.sheenColorMapUv),S.push(M.sheenRoughnessMapUv),S.push(M.specularMapUv),S.push(M.specularColorMapUv),S.push(M.specularIntensityMapUv),S.push(M.transmissionMapUv),S.push(M.thicknessMapUv),S.push(M.combine),S.push(M.fogExp2),S.push(M.sizeAttenuation),S.push(M.morphTargetsCount),S.push(M.morphAttributeCount),S.push(M.numDirLights),S.push(M.numPointLights),S.push(M.numSpotLights),S.push(M.numSpotLightMaps),S.push(M.numHemiLights),S.push(M.numRectAreaLights),S.push(M.numDirLightShadows),S.push(M.numPointLightShadows),S.push(M.numSpotLightShadows),S.push(M.numSpotLightShadowsWithMaps),S.push(M.numLightProbes),S.push(M.shadowMapType),S.push(M.toneMapping),S.push(M.numClippingPlanes),S.push(M.numClipIntersection),S.push(M.depthPacking)}function v(S,M){o.disableAll(),M.supportsVertexTextures&&o.enable(0),M.instancing&&o.enable(1),M.instancingColor&&o.enable(2),M.instancingMorph&&o.enable(3),M.matcap&&o.enable(4),M.envMap&&o.enable(5),M.normalMapObjectSpace&&o.enable(6),M.normalMapTangentSpace&&o.enable(7),M.clearcoat&&o.enable(8),M.iridescence&&o.enable(9),M.alphaTest&&o.enable(10),M.vertexColors&&o.enable(11),M.vertexAlphas&&o.enable(12),M.vertexUv1s&&o.enable(13),M.vertexUv2s&&o.enable(14),M.vertexUv3s&&o.enable(15),M.vertexTangents&&o.enable(16),M.anisotropy&&o.enable(17),M.alphaHash&&o.enable(18),M.batching&&o.enable(19),M.dispersion&&o.enable(20),M.batchingColor&&o.enable(21),S.push(o.mask),o.disableAll(),M.fog&&o.enable(0),M.useFog&&o.enable(1),M.flatShading&&o.enable(2),M.logarithmicDepthBuffer&&o.enable(3),M.reverseDepthBuffer&&o.enable(4),M.skinning&&o.enable(5),M.morphTargets&&o.enable(6),M.morphNormals&&o.enable(7),M.morphColors&&o.enable(8),M.premultipliedAlpha&&o.enable(9),M.shadowMapEnabled&&o.enable(10),M.doubleSided&&o.enable(11),M.flipSided&&o.enable(12),M.useDepthPacking&&o.enable(13),M.dithering&&o.enable(14),M.transmission&&o.enable(15),M.sheen&&o.enable(16),M.opaque&&o.enable(17),M.pointsUvs&&o.enable(18),M.decodeVideoTexture&&o.enable(19),M.decodeVideoTextureEmissive&&o.enable(20),M.alphaToCoverage&&o.enable(21),S.push(o.mask)}function x(S){const M=p[S.type];let D;if(M){const G=On[M];D=fo.clone(G.uniforms)}else D=S.uniforms;return D}function w(S,M){let D;for(let G=0,F=h.length;G0?n.push(m):d.transparent===!0?i.push(m):t.push(m)}function l(u,f,d,p,_,g){const m=a(u,f,d,p,_,g);d.transmission>0?n.unshift(m):d.transparent===!0?i.unshift(m):t.unshift(m)}function c(u,f){t.length>1&&t.sort(u||cy),n.length>1&&n.sort(f||ju),i.length>1&&i.sort(f||ju)}function h(){for(let u=e,f=r.length;u=s.length?(a=new Qu,s.push(a)):a=s[i],a}function t(){r=new WeakMap}return{get:e,dispose:t}}function uy(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new A,color:new ne};break;case"SpotLight":t={position:new A,direction:new A,color:new ne,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new A,color:new ne,distance:0,decay:0};break;case"HemisphereLight":t={direction:new A,skyColor:new ne,groundColor:new ne};break;case"RectAreaLight":t={color:new ne,position:new A,halfWidth:new A,halfHeight:new A};break}return r[e.id]=t,t}}}function dy(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new j};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new j};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new j,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let fy=0;function py(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function my(r){const e=new uy,t=dy(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new A);const i=new A,s=new Ze,a=new Ze;function o(c){let h=0,u=0,f=0;for(let S=0;S<9;S++)n.probe[S].set(0,0,0);let d=0,p=0,_=0,g=0,m=0,y=0,v=0,x=0,w=0,T=0,C=0;c.sort(py);for(let S=0,M=c.length;S0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Te.LTC_FLOAT_1,n.rectAreaLTC2=Te.LTC_FLOAT_2):(n.rectAreaLTC1=Te.LTC_HALF_1,n.rectAreaLTC2=Te.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=f;const P=n.hash;(P.directionalLength!==d||P.pointLength!==p||P.spotLength!==_||P.rectAreaLength!==g||P.hemiLength!==m||P.numDirectionalShadows!==y||P.numPointShadows!==v||P.numSpotShadows!==x||P.numSpotMaps!==w||P.numLightProbes!==C)&&(n.directional.length=d,n.spot.length=_,n.rectArea.length=g,n.point.length=p,n.hemi.length=m,n.directionalShadow.length=y,n.directionalShadowMap.length=y,n.pointShadow.length=v,n.pointShadowMap.length=v,n.spotShadow.length=x,n.spotShadowMap.length=x,n.directionalShadowMatrix.length=y,n.pointShadowMatrix.length=v,n.spotLightMatrix.length=x+w-T,n.spotLightMap.length=w,n.numSpotLightShadowsWithMaps=T,n.numLightProbes=C,P.directionalLength=d,P.pointLength=p,P.spotLength=_,P.rectAreaLength=g,P.hemiLength=m,P.numDirectionalShadows=y,P.numPointShadows=v,P.numSpotShadows=x,P.numSpotMaps=w,P.numLightProbes=C,n.version=fy++)}function l(c,h){let u=0,f=0,d=0,p=0,_=0;const g=h.matrixWorldInverse;for(let m=0,y=c.length;m=a.length?(o=new ed(r),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const _y=`void main() { - gl_Position = vec4( position, 1.0 ); -}`,vy=`uniform sampler2D shadow_pass; -uniform vec2 resolution; -uniform float radius; -#include -void main() { - const float samples = float( VSM_SAMPLES ); - float mean = 0.0; - float squared_mean = 0.0; - float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); - float uvStart = samples <= 1.0 ? 0.0 : - 1.0; - for ( float i = 0.0; i < samples; i ++ ) { - float uvOffset = uvStart + i * uvStride; - #ifdef HORIZONTAL_PASS - vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); - mean += distribution.x; - squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; - #else - float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); - mean += depth; - squared_mean += depth * depth; - #endif - } - mean = mean / samples; - squared_mean = squared_mean / samples; - float std_dev = sqrt( squared_mean - mean * mean ); - gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function xy(r,e,t){let n=new To;const i=new j,s=new j,a=new pt,o=new Hd({depthPacking:ap}),l=new Gd,c={},h=t.maxTextureSize,u={[Ci]:fn,[fn]:Ci,[Bn]:Bn},f=new Xt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new j},radius:{value:4}},vertexShader:_y,fragmentShader:vy}),d=f.clone();d.defines.HORIZONTAL_PASS=1;const p=new qe;p.setAttribute("position",new rt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new yt(p,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ld;let m=this.type;this.render=function(T,C,P){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||T.length===0)return;const S=r.getRenderTarget(),M=r.getActiveCubeFace(),D=r.getActiveMipmapLevel(),G=r.state;G.setBlending(ii),G.buffers.color.setClear(1,1,1,1),G.buffers.depth.setTest(!0),G.setScissorTest(!1);const F=m!==Qn&&this.type===Qn,V=m===Qn&&this.type!==Qn;for(let J=0,q=T.length;Jh||i.y>h)&&(i.x>h&&(s.x=Math.floor(h/_e.x),i.x=s.x*_e.x,Z.mapSize.x=s.x),i.y>h&&(s.y=Math.floor(h/_e.y),i.y=s.y*_e.y,Z.mapSize.y=s.y)),Z.map===null||F===!0||V===!0){const Re=this.type!==Qn?{minFilter:Qt,magFilter:Qt}:{};Z.map!==null&&Z.map.dispose(),Z.map=new Sn(i.x,i.y,Re),Z.map.texture.name=se.name+".shadowMap",Z.camera.updateProjectionMatrix()}r.setRenderTarget(Z.map),r.clear();const be=Z.getViewportCount();for(let Re=0;Re0||C.map&&C.alphaTest>0){const G=M.uuid,F=C.uuid;let V=c[G];V===void 0&&(V={},c[G]=V);let J=V[F];J===void 0&&(J=M.clone(),V[F]=J,C.addEventListener("dispose",w)),M=J}if(M.visible=C.visible,M.wireframe=C.wireframe,S===Qn?M.side=C.shadowSide!==null?C.shadowSide:C.side:M.side=C.shadowSide!==null?C.shadowSide:u[C.side],M.alphaMap=C.alphaMap,M.alphaTest=C.alphaTest,M.map=C.map,M.clipShadows=C.clipShadows,M.clippingPlanes=C.clippingPlanes,M.clipIntersection=C.clipIntersection,M.displacementMap=C.displacementMap,M.displacementScale=C.displacementScale,M.displacementBias=C.displacementBias,M.wireframeLinewidth=C.wireframeLinewidth,M.linewidth=C.linewidth,P.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const G=r.properties.get(M);G.light=P}return M}function x(T,C,P,S,M){if(T.visible===!1)return;if(T.layers.test(C.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&M===Qn)&&(!T.frustumCulled||n.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,T.matrixWorld);const F=e.update(T),V=T.material;if(Array.isArray(V)){const J=F.groups;for(let q=0,se=J.length;q=1):Z.indexOf("OpenGL ES")!==-1&&(se=parseFloat(/^OpenGL ES (\d)/.exec(Z)[1]),q=se>=2);let _e=null,be={};const Re=r.getParameter(r.SCISSOR_BOX),Ge=r.getParameter(r.VIEWPORT),it=new pt().fromArray(Re),Q=new pt().fromArray(Ge);function ue(U,ye,K,ee){const we=new Uint8Array(4),Me=r.createTexture();r.bindTexture(U,Me),r.texParameteri(U,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(U,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let Ye=0;Ye"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new j,h=new WeakMap;let u;const f=new WeakMap;let d=!1;try{d=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function p(R,b){return d?new OffscreenCanvas(R,b):Vr("canvas")}function _(R,b,H){let k=1;const X=Se(R);if((X.width>H||X.height>H)&&(k=H/Math.max(X.width,X.height)),k<1)if(typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&R instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&R instanceof ImageBitmap||typeof VideoFrame<"u"&&R instanceof VideoFrame){const W=Math.floor(k*X.width),ce=Math.floor(k*X.height);u===void 0&&(u=p(W,ce));const oe=b?p(W,ce):u;return oe.width=W,oe.height=ce,oe.getContext("2d").drawImage(R,0,0,W,ce),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+X.width+"x"+X.height+") to ("+W+"x"+ce+")."),oe}else return"data"in R&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+X.width+"x"+X.height+")."),R;return R}function g(R){return R.generateMipmaps}function m(R){r.generateMipmap(R)}function y(R){return R.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:R.isWebGL3DRenderTarget?r.TEXTURE_3D:R.isWebGLArrayRenderTarget||R.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function v(R,b,H,k,X=!1){if(R!==null){if(r[R]!==void 0)return r[R];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+R+"'")}let W=b;if(b===r.RED&&(H===r.FLOAT&&(W=r.R32F),H===r.HALF_FLOAT&&(W=r.R16F),H===r.UNSIGNED_BYTE&&(W=r.R8)),b===r.RED_INTEGER&&(H===r.UNSIGNED_BYTE&&(W=r.R8UI),H===r.UNSIGNED_SHORT&&(W=r.R16UI),H===r.UNSIGNED_INT&&(W=r.R32UI),H===r.BYTE&&(W=r.R8I),H===r.SHORT&&(W=r.R16I),H===r.INT&&(W=r.R32I)),b===r.RG&&(H===r.FLOAT&&(W=r.RG32F),H===r.HALF_FLOAT&&(W=r.RG16F),H===r.UNSIGNED_BYTE&&(W=r.RG8)),b===r.RG_INTEGER&&(H===r.UNSIGNED_BYTE&&(W=r.RG8UI),H===r.UNSIGNED_SHORT&&(W=r.RG16UI),H===r.UNSIGNED_INT&&(W=r.RG32UI),H===r.BYTE&&(W=r.RG8I),H===r.SHORT&&(W=r.RG16I),H===r.INT&&(W=r.RG32I)),b===r.RGB_INTEGER&&(H===r.UNSIGNED_BYTE&&(W=r.RGB8UI),H===r.UNSIGNED_SHORT&&(W=r.RGB16UI),H===r.UNSIGNED_INT&&(W=r.RGB32UI),H===r.BYTE&&(W=r.RGB8I),H===r.SHORT&&(W=r.RGB16I),H===r.INT&&(W=r.RGB32I)),b===r.RGBA_INTEGER&&(H===r.UNSIGNED_BYTE&&(W=r.RGBA8UI),H===r.UNSIGNED_SHORT&&(W=r.RGBA16UI),H===r.UNSIGNED_INT&&(W=r.RGBA32UI),H===r.BYTE&&(W=r.RGBA8I),H===r.SHORT&&(W=r.RGBA16I),H===r.INT&&(W=r.RGBA32I)),b===r.RGB&&H===r.UNSIGNED_INT_5_9_9_9_REV&&(W=r.RGB9_E5),b===r.RGBA){const ce=X?co:ht.getTransfer(k);H===r.FLOAT&&(W=r.RGBA32F),H===r.HALF_FLOAT&&(W=r.RGBA16F),H===r.UNSIGNED_BYTE&&(W=ce===vt?r.SRGB8_ALPHA8:r.RGBA8),H===r.UNSIGNED_SHORT_4_4_4_4&&(W=r.RGBA4),H===r.UNSIGNED_SHORT_5_5_5_1&&(W=r.RGB5_A1)}return(W===r.R16F||W===r.R32F||W===r.RG16F||W===r.RG32F||W===r.RGBA16F||W===r.RGBA32F)&&e.get("EXT_color_buffer_float"),W}function x(R,b){let H;return R?b===null||b===Ii||b===$s?H=r.DEPTH24_STENCIL8:b===Mn?H=r.DEPTH32F_STENCIL8:b===kr&&(H=r.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):b===null||b===Ii||b===$s?H=r.DEPTH_COMPONENT24:b===Mn?H=r.DEPTH_COMPONENT32F:b===kr&&(H=r.DEPTH_COMPONENT16),H}function w(R,b){return g(R)===!0||R.isFramebufferTexture&&R.minFilter!==Qt&&R.minFilter!==Vt?Math.log2(Math.max(b.width,b.height))+1:R.mipmaps!==void 0&&R.mipmaps.length>0?R.mipmaps.length:R.isCompressedTexture&&Array.isArray(R.image)?b.mipmaps.length:1}function T(R){const b=R.target;b.removeEventListener("dispose",T),P(b),b.isVideoTexture&&h.delete(b)}function C(R){const b=R.target;b.removeEventListener("dispose",C),M(b)}function P(R){const b=n.get(R);if(b.__webglInit===void 0)return;const H=R.source,k=f.get(H);if(k){const X=k[b.__cacheKey];X.usedTimes--,X.usedTimes===0&&S(R),Object.keys(k).length===0&&f.delete(H)}n.remove(R)}function S(R){const b=n.get(R);r.deleteTexture(b.__webglTexture);const H=R.source,k=f.get(H);delete k[b.__cacheKey],a.memory.textures--}function M(R){const b=n.get(R);if(R.depthTexture&&(R.depthTexture.dispose(),n.remove(R.depthTexture)),R.isWebGLCubeRenderTarget)for(let k=0;k<6;k++){if(Array.isArray(b.__webglFramebuffer[k]))for(let X=0;X=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+R+" texture units while this GPU supports only "+i.maxTextures),D+=1,R}function V(R){const b=[];return b.push(R.wrapS),b.push(R.wrapT),b.push(R.wrapR||0),b.push(R.magFilter),b.push(R.minFilter),b.push(R.anisotropy),b.push(R.internalFormat),b.push(R.format),b.push(R.type),b.push(R.generateMipmaps),b.push(R.premultiplyAlpha),b.push(R.flipY),b.push(R.unpackAlignment),b.push(R.colorSpace),b.join()}function J(R,b){const H=n.get(R);if(R.isVideoTexture&&me(R),R.isRenderTargetTexture===!1&&R.version>0&&H.__version!==R.version){const k=R.image;if(k===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(k.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Q(H,R,b);return}}t.bindTexture(r.TEXTURE_2D,H.__webglTexture,r.TEXTURE0+b)}function q(R,b){const H=n.get(R);if(R.version>0&&H.__version!==R.version){Q(H,R,b);return}t.bindTexture(r.TEXTURE_2D_ARRAY,H.__webglTexture,r.TEXTURE0+b)}function se(R,b){const H=n.get(R);if(R.version>0&&H.__version!==R.version){Q(H,R,b);return}t.bindTexture(r.TEXTURE_3D,H.__webglTexture,r.TEXTURE0+b)}function Z(R,b){const H=n.get(R);if(R.version>0&&H.__version!==R.version){ue(H,R,b);return}t.bindTexture(r.TEXTURE_CUBE_MAP,H.__webglTexture,r.TEXTURE0+b)}const _e={[ro]:r.REPEAT,[Nn]:r.CLAMP_TO_EDGE,[ao]:r.MIRRORED_REPEAT},be={[Qt]:r.NEAREST,[hd]:r.NEAREST_MIPMAP_NEAREST,[Cr]:r.NEAREST_MIPMAP_LINEAR,[Vt]:r.LINEAR,[Xa]:r.LINEAR_MIPMAP_NEAREST,[ni]:r.LINEAR_MIPMAP_LINEAR},Re={[lp]:r.NEVER,[pp]:r.ALWAYS,[cp]:r.LESS,[Md]:r.LEQUAL,[hp]:r.EQUAL,[fp]:r.GEQUAL,[up]:r.GREATER,[dp]:r.NOTEQUAL};function Ge(R,b){if(b.type===Mn&&e.has("OES_texture_float_linear")===!1&&(b.magFilter===Vt||b.magFilter===Xa||b.magFilter===Cr||b.magFilter===ni||b.minFilter===Vt||b.minFilter===Xa||b.minFilter===Cr||b.minFilter===ni)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(R,r.TEXTURE_WRAP_S,_e[b.wrapS]),r.texParameteri(R,r.TEXTURE_WRAP_T,_e[b.wrapT]),(R===r.TEXTURE_3D||R===r.TEXTURE_2D_ARRAY)&&r.texParameteri(R,r.TEXTURE_WRAP_R,_e[b.wrapR]),r.texParameteri(R,r.TEXTURE_MAG_FILTER,be[b.magFilter]),r.texParameteri(R,r.TEXTURE_MIN_FILTER,be[b.minFilter]),b.compareFunction&&(r.texParameteri(R,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(R,r.TEXTURE_COMPARE_FUNC,Re[b.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(b.magFilter===Qt||b.minFilter!==Cr&&b.minFilter!==ni||b.type===Mn&&e.has("OES_texture_float_linear")===!1)return;if(b.anisotropy>1||n.get(b).__currentAnisotropy){const H=e.get("EXT_texture_filter_anisotropic");r.texParameterf(R,H.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,i.getMaxAnisotropy())),n.get(b).__currentAnisotropy=b.anisotropy}}}function it(R,b){let H=!1;R.__webglInit===void 0&&(R.__webglInit=!0,b.addEventListener("dispose",T));const k=b.source;let X=f.get(k);X===void 0&&(X={},f.set(k,X));const W=V(b);if(W!==R.__cacheKey){X[W]===void 0&&(X[W]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,H=!0),X[W].usedTimes++;const ce=X[R.__cacheKey];ce!==void 0&&(X[R.__cacheKey].usedTimes--,ce.usedTimes===0&&S(b)),R.__cacheKey=W,R.__webglTexture=X[W].texture}return H}function Q(R,b,H){let k=r.TEXTURE_2D;(b.isDataArrayTexture||b.isCompressedArrayTexture)&&(k=r.TEXTURE_2D_ARRAY),b.isData3DTexture&&(k=r.TEXTURE_3D);const X=it(R,b),W=b.source;t.bindTexture(k,R.__webglTexture,r.TEXTURE0+H);const ce=n.get(W);if(W.version!==ce.__version||X===!0){t.activeTexture(r.TEXTURE0+H);const oe=ht.getPrimaries(ht.workingColorSpace),ge=b.colorSpace===wi?null:ht.getPrimaries(b.colorSpace),Be=b.colorSpace===wi||oe===ge?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,b.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,b.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Be);let $=_(b.image,!1,i.maxTextureSize);$=Ve(b,$);const ve=s.convert(b.format,b.colorSpace),Y=s.convert(b.type);let ie=v(b.internalFormat,ve,Y,b.colorSpace,b.isVideoTexture);Ge(k,b);let ae;const Ne=b.mipmaps,Pe=b.isVideoTexture!==!0,Ke=ce.__version===void 0||X===!0,U=W.dataReady,ye=w(b,$);if(b.isDepthTexture)ie=x(b.format===js,b.type),Ke&&(Pe?t.texStorage2D(r.TEXTURE_2D,1,ie,$.width,$.height):t.texImage2D(r.TEXTURE_2D,0,ie,$.width,$.height,0,ve,Y,null));else if(b.isDataTexture)if(Ne.length>0){Pe&&Ke&&t.texStorage2D(r.TEXTURE_2D,ye,ie,Ne[0].width,Ne[0].height);for(let K=0,ee=Ne.length;K0){const we=yc(ae.width,ae.height,b.format,b.type);for(const Me of b.layerUpdates){const Ye=ae.data.subarray(Me*we/ae.data.BYTES_PER_ELEMENT,(Me+1)*we/ae.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,K,0,0,Me,ae.width,ae.height,1,ve,Ye)}b.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,K,0,0,0,ae.width,ae.height,$.depth,ve,ae.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,K,ie,ae.width,ae.height,$.depth,0,ae.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Pe?U&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,K,0,0,0,ae.width,ae.height,$.depth,ve,Y,ae.data):t.texImage3D(r.TEXTURE_2D_ARRAY,K,ie,ae.width,ae.height,$.depth,0,ve,Y,ae.data)}else{Pe&&Ke&&t.texStorage2D(r.TEXTURE_2D,ye,ie,Ne[0].width,Ne[0].height);for(let K=0,ee=Ne.length;K0){const K=yc($.width,$.height,b.format,b.type);for(const ee of b.layerUpdates){const we=$.data.subarray(ee*K/$.data.BYTES_PER_ELEMENT,(ee+1)*K/$.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,ee,$.width,$.height,1,ve,Y,we)}b.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,$.width,$.height,$.depth,ve,Y,$.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,ie,$.width,$.height,$.depth,0,ve,Y,$.data);else if(b.isData3DTexture)Pe?(Ke&&t.texStorage3D(r.TEXTURE_3D,ye,ie,$.width,$.height,$.depth),U&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,$.width,$.height,$.depth,ve,Y,$.data)):t.texImage3D(r.TEXTURE_3D,0,ie,$.width,$.height,$.depth,0,ve,Y,$.data);else if(b.isFramebufferTexture){if(Ke)if(Pe)t.texStorage2D(r.TEXTURE_2D,ye,ie,$.width,$.height);else{let K=$.width,ee=$.height;for(let we=0;we>=1,ee>>=1}}else if(Ne.length>0){if(Pe&&Ke){const K=Se(Ne[0]);t.texStorage2D(r.TEXTURE_2D,ye,ie,K.width,K.height)}for(let K=0,ee=Ne.length;K0&&ye++;const ee=Se(ve[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,ye,Ne,ee.width,ee.height)}for(let ee=0;ee<6;ee++)if($){Pe?U&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,ve[ee].width,ve[ee].height,ie,ae,ve[ee].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,Ne,ve[ee].width,ve[ee].height,0,ie,ae,ve[ee].data);for(let we=0;we>W),Y=Math.max(1,b.height>>W);X===r.TEXTURE_3D||X===r.TEXTURE_2D_ARRAY?t.texImage3D(X,W,ge,ve,Y,b.depth,0,ce,oe,null):t.texImage2D(X,W,ge,ve,Y,0,ce,oe,null)}t.bindFramebuffer(r.FRAMEBUFFER,R),Ae(b)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,k,X,$.__webglTexture,0,re(b)):(X===r.TEXTURE_2D||X>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&X<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,k,X,$.__webglTexture,W),t.bindFramebuffer(r.FRAMEBUFFER,null)}function pe(R,b,H){if(r.bindRenderbuffer(r.RENDERBUFFER,R),b.depthBuffer){const k=b.depthTexture,X=k&&k.isDepthTexture?k.type:null,W=x(b.stencilBuffer,X),ce=b.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,oe=re(b);Ae(b)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,oe,W,b.width,b.height):H?r.renderbufferStorageMultisample(r.RENDERBUFFER,oe,W,b.width,b.height):r.renderbufferStorage(r.RENDERBUFFER,W,b.width,b.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,ce,r.RENDERBUFFER,R)}else{const k=b.textures;for(let X=0;X{delete b.__boundDepthTexture,delete b.__depthDisposeCallback,k.removeEventListener("dispose",X)};k.addEventListener("dispose",X),b.__depthDisposeCallback=X}b.__boundDepthTexture=k}if(R.depthTexture&&!b.__autoAllocateDepthBuffer){if(H)throw new Error("target.depthTexture not supported in Cube render targets");Oe(b.__webglFramebuffer,R)}else if(H){b.__webglDepthbuffer=[];for(let k=0;k<6;k++)if(t.bindFramebuffer(r.FRAMEBUFFER,b.__webglFramebuffer[k]),b.__webglDepthbuffer[k]===void 0)b.__webglDepthbuffer[k]=r.createRenderbuffer(),pe(b.__webglDepthbuffer[k],R,!1);else{const X=R.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,W=b.__webglDepthbuffer[k];r.bindRenderbuffer(r.RENDERBUFFER,W),r.framebufferRenderbuffer(r.FRAMEBUFFER,X,r.RENDERBUFFER,W)}}else if(t.bindFramebuffer(r.FRAMEBUFFER,b.__webglFramebuffer),b.__webglDepthbuffer===void 0)b.__webglDepthbuffer=r.createRenderbuffer(),pe(b.__webglDepthbuffer,R,!1);else{const k=R.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,X=b.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,X),r.framebufferRenderbuffer(r.FRAMEBUFFER,k,r.RENDERBUFFER,X)}t.bindFramebuffer(r.FRAMEBUFFER,null)}function ze(R,b,H){const k=n.get(R);b!==void 0&&Ie(k.__webglFramebuffer,R,R.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),H!==void 0&&We(R)}function Je(R){const b=R.texture,H=n.get(R),k=n.get(b);R.addEventListener("dispose",C);const X=R.textures,W=R.isWebGLCubeRenderTarget===!0,ce=X.length>1;if(ce||(k.__webglTexture===void 0&&(k.__webglTexture=r.createTexture()),k.__version=b.version,a.memory.textures++),W){H.__webglFramebuffer=[];for(let oe=0;oe<6;oe++)if(b.mipmaps&&b.mipmaps.length>0){H.__webglFramebuffer[oe]=[];for(let ge=0;ge0){H.__webglFramebuffer=[];for(let oe=0;oe0&&Ae(R)===!1){H.__webglMultisampledFramebuffer=r.createFramebuffer(),H.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,H.__webglMultisampledFramebuffer);for(let oe=0;oe0)for(let ge=0;ge0)for(let ge=0;ge0){if(Ae(R)===!1){const b=R.textures,H=R.width,k=R.height;let X=r.COLOR_BUFFER_BIT;const W=R.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,ce=n.get(R),oe=b.length>1;if(oe)for(let ge=0;ge0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&b.__useRenderToTexture!==!1}function me(R){const b=a.render.frame;h.get(R)!==b&&(h.set(R,b),R.update())}function Ve(R,b){const H=R.colorSpace,k=R.format,X=R.type;return R.isCompressedTexture===!0||R.isVideoTexture===!0||H!==Qs&&H!==wi&&(ht.getTransfer(H)===vt?(k!==dn||X!==li)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",H)),b}function Se(R){return typeof HTMLImageElement<"u"&&R instanceof HTMLImageElement?(c.width=R.naturalWidth||R.width,c.height=R.naturalHeight||R.height):typeof VideoFrame<"u"&&R instanceof VideoFrame?(c.width=R.displayWidth,c.height=R.displayHeight):(c.width=R.width,c.height=R.height),c}this.allocateTextureUnit=F,this.resetTextureUnits=G,this.setTexture2D=J,this.setTexture2DArray=q,this.setTexture3D=se,this.setTextureCube=Z,this.rebindTextures=ze,this.setupRenderTarget=Je,this.updateRenderTargetMipmap=te,this.updateMultisampleRenderTarget=De,this.setupDepthRenderbuffer=We,this.setupFrameBufferTexture=Ie,this.useMultisampledRTT=Ae}function Sy(r,e){function t(n,i=wi){let s;const a=ht.getTransfer(i);if(n===li)return r.UNSIGNED_BYTE;if(n===Dc)return r.UNSIGNED_SHORT_4_4_4_4;if(n===Lc)return r.UNSIGNED_SHORT_5_5_5_1;if(n===fd)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===ud)return r.BYTE;if(n===dd)return r.SHORT;if(n===kr)return r.UNSIGNED_SHORT;if(n===Pc)return r.INT;if(n===Ii)return r.UNSIGNED_INT;if(n===Mn)return r.FLOAT;if(n===si)return r.HALF_FLOAT;if(n===pd)return r.ALPHA;if(n===md)return r.RGB;if(n===dn)return r.RGBA;if(n===gd)return r.LUMINANCE;if(n===_d)return r.LUMINANCE_ALPHA;if(n===Ys)return r.DEPTH_COMPONENT;if(n===js)return r.DEPTH_STENCIL;if(n===Uc)return r.RED;if(n===So)return r.RED_INTEGER;if(n===vd)return r.RG;if(n===Nc)return r.RG_INTEGER;if(n===Fc)return r.RGBA_INTEGER;if(n===qa||n===Ya||n===Za||n===Ja)if(a===vt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===qa)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Ya)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Za)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ja)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===qa)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Ya)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Za)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ja)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===kl||n===Vl||n===Hl||n===Gl)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===kl)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Vl)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Hl)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Gl)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Wl||n===Xl||n===ql)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Wl||n===Xl)return a===vt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===ql)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Yl||n===Zl||n===Jl||n===Kl||n===$l||n===jl||n===Ql||n===ec||n===tc||n===nc||n===ic||n===sc||n===rc||n===ac)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Yl)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Zl)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Jl)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Kl)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===$l)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===jl)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Ql)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ec)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===tc)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===nc)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===ic)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===sc)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===rc)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ac)return a===vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ka||n===oc||n===lc)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Ka)return a===vt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===oc)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===lc)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===xd||n===cc||n===hc||n===uc)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Ka)return s.COMPRESSED_RED_RGTC1_EXT;if(n===cc)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===hc)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===uc)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===$s?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const wy={type:"move"};class wl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ns,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new ns,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new A,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new A),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ns,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new A,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new A),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const _ of e.hand.values()){const g=t.getJointPose(_,n),m=this._getHandJoint(c,_);g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=g.radius),m.visible=g!==null}const h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],f=h.position.distanceTo(u.position),d=.02,p=.005;c.inputState.pinching&&f>d+p?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-p&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(wy)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new ns;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Ey=` -void main() { - - gl_Position = vec4( position, 1.0 ); - -}`,Ty=` -uniform sampler2DArray depthColor; -uniform float depthWidth; -uniform float depthHeight; - -void main() { - - vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); - - if ( coord.x >= 1.0 ) { - - gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; - - } else { - - gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; - - } - -}`;class Ay{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const i=new Et,s=e.properties.get(i);s.__webglTexture=t.texture,(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Xt({vertexShader:Ey,fragmentShader:Ty,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new yt(new lr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Cy extends ci{constructor(e,t){super();const n=this;let i=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,u=null,f=null,d=null,p=null;const _=new Ay,g=t.getContextAttributes();let m=null,y=null;const v=[],x=[],w=new j;let T=null;const C=new kt;C.viewport=new pt;const P=new kt;P.viewport=new pt;const S=[C,P],M=new Ag;let D=null,G=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Q){let ue=v[Q];return ue===void 0&&(ue=new wl,v[Q]=ue),ue.getTargetRaySpace()},this.getControllerGrip=function(Q){let ue=v[Q];return ue===void 0&&(ue=new wl,v[Q]=ue),ue.getGripSpace()},this.getHand=function(Q){let ue=v[Q];return ue===void 0&&(ue=new wl,v[Q]=ue),ue.getHandSpace()};function F(Q){const ue=x.indexOf(Q.inputSource);if(ue===-1)return;const Ie=v[ue];Ie!==void 0&&(Ie.update(Q.inputSource,Q.frame,c||a),Ie.dispatchEvent({type:Q.type,data:Q.inputSource}))}function V(){i.removeEventListener("select",F),i.removeEventListener("selectstart",F),i.removeEventListener("selectend",F),i.removeEventListener("squeeze",F),i.removeEventListener("squeezestart",F),i.removeEventListener("squeezeend",F),i.removeEventListener("end",V),i.removeEventListener("inputsourceschange",J);for(let Q=0;Q=0&&(x[pe]=null,v[pe].disconnect(Ie))}for(let ue=0;ue=x.length){x.push(Ie),pe=We;break}else if(x[We]===null){x[We]=Ie,pe=We;break}if(pe===-1)break}const Oe=v[pe];Oe&&Oe.connect(Ie)}}const q=new A,se=new A;function Z(Q,ue,Ie){q.setFromMatrixPosition(ue.matrixWorld),se.setFromMatrixPosition(Ie.matrixWorld);const pe=q.distanceTo(se),Oe=ue.projectionMatrix.elements,We=Ie.projectionMatrix.elements,ze=Oe[14]/(Oe[10]-1),Je=Oe[14]/(Oe[10]+1),te=(Oe[9]+1)/Oe[5],de=(Oe[9]-1)/Oe[5],I=(Oe[8]-1)/Oe[0],De=(We[8]+1)/We[0],re=ze*I,Ae=ze*De,me=pe/(-I+De),Ve=me*-I;if(ue.matrixWorld.decompose(Q.position,Q.quaternion,Q.scale),Q.translateX(Ve),Q.translateZ(me),Q.matrixWorld.compose(Q.position,Q.quaternion,Q.scale),Q.matrixWorldInverse.copy(Q.matrixWorld).invert(),Oe[10]===-1)Q.projectionMatrix.copy(ue.projectionMatrix),Q.projectionMatrixInverse.copy(ue.projectionMatrixInverse);else{const Se=ze+me,R=Je+me,b=re-Ve,H=Ae+(pe-Ve),k=te*Je/R*Se,X=de*Je/R*Se;Q.projectionMatrix.makePerspective(b,H,k,X,Se,R),Q.projectionMatrixInverse.copy(Q.projectionMatrix).invert()}}function _e(Q,ue){ue===null?Q.matrixWorld.copy(Q.matrix):Q.matrixWorld.multiplyMatrices(ue.matrixWorld,Q.matrix),Q.matrixWorldInverse.copy(Q.matrixWorld).invert()}this.updateCamera=function(Q){if(i===null)return;let ue=Q.near,Ie=Q.far;_.texture!==null&&(_.depthNear>0&&(ue=_.depthNear),_.depthFar>0&&(Ie=_.depthFar)),M.near=P.near=C.near=ue,M.far=P.far=C.far=Ie,(D!==M.near||G!==M.far)&&(i.updateRenderState({depthNear:M.near,depthFar:M.far}),D=M.near,G=M.far),C.layers.mask=Q.layers.mask|2,P.layers.mask=Q.layers.mask|4,M.layers.mask=C.layers.mask|P.layers.mask;const pe=Q.parent,Oe=M.cameras;_e(M,pe);for(let We=0;We0&&(g.alphaTest.value=m.alphaTest);const y=e.get(m),v=y.envMap,x=y.envMapRotation;v&&(g.envMap.value=v,Zi.copy(x),Zi.x*=-1,Zi.y*=-1,Zi.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(Zi.y*=-1,Zi.z*=-1),g.envMapRotation.value.setFromMatrix4(Ry.makeRotationFromEuler(Zi)),g.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=m.reflectivity,g.ior.value=m.ior,g.refractionRatio.value=m.refractionRatio),m.lightMap&&(g.lightMap.value=m.lightMap,g.lightMapIntensity.value=m.lightMapIntensity,t(m.lightMap,g.lightMapTransform)),m.aoMap&&(g.aoMap.value=m.aoMap,g.aoMapIntensity.value=m.aoMapIntensity,t(m.aoMap,g.aoMapTransform))}function a(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform))}function o(g,m){g.dashSize.value=m.dashSize,g.totalSize.value=m.dashSize+m.gapSize,g.scale.value=m.scale}function l(g,m,y,v){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.size.value=m.size*y,g.scale.value=v*.5,m.map&&(g.map.value=m.map,t(m.map,g.uvTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function c(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.rotation.value=m.rotation,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function h(g,m){g.specular.value.copy(m.specular),g.shininess.value=Math.max(m.shininess,1e-4)}function u(g,m){m.gradientMap&&(g.gradientMap.value=m.gradientMap)}function f(g,m){g.metalness.value=m.metalness,m.metalnessMap&&(g.metalnessMap.value=m.metalnessMap,t(m.metalnessMap,g.metalnessMapTransform)),g.roughness.value=m.roughness,m.roughnessMap&&(g.roughnessMap.value=m.roughnessMap,t(m.roughnessMap,g.roughnessMapTransform)),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)}function d(g,m,y){g.ior.value=m.ior,m.sheen>0&&(g.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),g.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(g.sheenColorMap.value=m.sheenColorMap,t(m.sheenColorMap,g.sheenColorMapTransform)),m.sheenRoughnessMap&&(g.sheenRoughnessMap.value=m.sheenRoughnessMap,t(m.sheenRoughnessMap,g.sheenRoughnessMapTransform))),m.clearcoat>0&&(g.clearcoat.value=m.clearcoat,g.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(g.clearcoatMap.value=m.clearcoatMap,t(m.clearcoatMap,g.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,t(m.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(g.clearcoatNormalMap.value=m.clearcoatNormalMap,t(m.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===fn&&g.clearcoatNormalScale.value.negate())),m.dispersion>0&&(g.dispersion.value=m.dispersion),m.iridescence>0&&(g.iridescence.value=m.iridescence,g.iridescenceIOR.value=m.iridescenceIOR,g.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(g.iridescenceMap.value=m.iridescenceMap,t(m.iridescenceMap,g.iridescenceMapTransform)),m.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=m.iridescenceThicknessMap,t(m.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),m.transmission>0&&(g.transmission.value=m.transmission,g.transmissionSamplerMap.value=y.texture,g.transmissionSamplerSize.value.set(y.width,y.height),m.transmissionMap&&(g.transmissionMap.value=m.transmissionMap,t(m.transmissionMap,g.transmissionMapTransform)),g.thickness.value=m.thickness,m.thicknessMap&&(g.thicknessMap.value=m.thicknessMap,t(m.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=m.attenuationDistance,g.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(g.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(g.anisotropyMap.value=m.anisotropyMap,t(m.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=m.specularIntensity,g.specularColor.value.copy(m.specularColor),m.specularColorMap&&(g.specularColorMap.value=m.specularColorMap,t(m.specularColorMap,g.specularColorMapTransform)),m.specularIntensityMap&&(g.specularIntensityMap.value=m.specularIntensityMap,t(m.specularIntensityMap,g.specularIntensityMapTransform))}function p(g,m){m.matcap&&(g.matcap.value=m.matcap)}function _(g,m){const y=e.get(m).light;g.referencePosition.value.setFromMatrixPosition(y.matrixWorld),g.nearDistance.value=y.shadow.camera.near,g.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function Py(r,e,t,n){let i={},s={},a=[];const o=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function l(y,v){const x=v.program;n.uniformBlockBinding(y,x)}function c(y,v){let x=i[y.id];x===void 0&&(p(y),x=h(y),i[y.id]=x,y.addEventListener("dispose",g));const w=v.program;n.updateUBOMapping(y,w);const T=e.render.frame;s[y.id]!==T&&(f(y),s[y.id]=T)}function h(y){const v=u();y.__bindingPointIndex=v;const x=r.createBuffer(),w=y.__size,T=y.usage;return r.bindBuffer(r.UNIFORM_BUFFER,x),r.bufferData(r.UNIFORM_BUFFER,w,T),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,v,x),x}function u(){for(let y=0;y0&&(x+=w-T),y.__size=x,y.__cache={},this}function _(y){const v={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(v.boundary=4,v.storage=4):y.isVector2?(v.boundary=8,v.storage=8):y.isVector3||y.isColor?(v.boundary=16,v.storage=12):y.isVector4?(v.boundary=16,v.storage=16):y.isMatrix3?(v.boundary=48,v.storage=48):y.isMatrix4?(v.boundary=64,v.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),v}function g(y){const v=y.target;v.removeEventListener("dispose",g);const x=a.indexOf(v.__bindingPointIndex);a.splice(x,1),r.deleteBuffer(i[v.id]),delete i[v.id],delete s[v.id]}function m(){for(const y in i)r.deleteBuffer(i[y]);a=[],i={},s={}}return{bind:l,update:c,dispose:m}}class Dy{constructor(e={}){const{canvas:t=Dp(),context:n=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reverseDepthBuffer:f=!1}=e;this.isWebGLRenderer=!0;let d;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=a;const p=new Uint32Array(4),_=new Int32Array(4);let g=null,m=null;const y=[],v=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=xn,this.toneMapping=Ti,this.toneMappingExposure=1;const x=this;let w=!1,T=0,C=0,P=null,S=-1,M=null;const D=new pt,G=new pt;let F=null;const V=new ne(0);let J=0,q=t.width,se=t.height,Z=1,_e=null,be=null;const Re=new pt(0,0,q,se),Ge=new pt(0,0,q,se);let it=!1;const Q=new To;let ue=!1,Ie=!1;this.transmissionResolutionScale=1;const pe=new Ze,Oe=new Ze,We=new A,ze=new pt,Je={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let te=!1;function de(){return P===null?Z:1}let I=n;function De(E,B){return t.getContext(E,B)}try{const E={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Rc}`),t.addEventListener("webglcontextlost",ee,!1),t.addEventListener("webglcontextrestored",we,!1),t.addEventListener("webglcontextcreationerror",Me,!1),I===null){const B="webgl2";if(I=De(B,E),I===null)throw De(B)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(E){throw console.error("THREE.WebGLRenderer: "+E.message),E}let re,Ae,me,Ve,Se,R,b,H,k,X,W,ce,oe,ge,Be,$,ve,Y,ie,ae,Ne,Pe,Ke,U;function ye(){re=new Vv(I),re.init(),Pe=new Sy(I,re),Ae=new Nv(I,re,e,Pe),me=new My(I,re),Ae.reverseDepthBuffer&&f&&me.buffers.depth.setReversed(!0),Ve=new Wv(I),Se=new ly,R=new by(I,re,me,Se,Ae,Pe,Ve),b=new Ov(x),H=new kv(x),k=new $g(I),Ke=new Lv(I,k),X=new Hv(I,k,Ve,Ke),W=new qv(I,X,k,Ve),ie=new Xv(I,Ae,R),$=new Fv(Se),ce=new oy(x,b,H,re,Ae,Ke,$),oe=new Iy(x,Se),ge=new hy,Be=new gy(re),Y=new Dv(x,b,H,me,W,d,l),ve=new xy(x,W,Ae),U=new Py(I,Ve,Ae,me),ae=new Uv(I,re,Ve),Ne=new Gv(I,re,Ve),Ve.programs=ce.programs,x.capabilities=Ae,x.extensions=re,x.properties=Se,x.renderLists=ge,x.shadowMap=ve,x.state=me,x.info=Ve}ye();const K=new Cy(x,I);this.xr=K,this.getContext=function(){return I},this.getContextAttributes=function(){return I.getContextAttributes()},this.forceContextLoss=function(){const E=re.get("WEBGL_lose_context");E&&E.loseContext()},this.forceContextRestore=function(){const E=re.get("WEBGL_lose_context");E&&E.restoreContext()},this.getPixelRatio=function(){return Z},this.setPixelRatio=function(E){E!==void 0&&(Z=E,this.setSize(q,se,!1))},this.getSize=function(E){return E.set(q,se)},this.setSize=function(E,B,N=!0){if(K.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}q=E,se=B,t.width=Math.floor(E*Z),t.height=Math.floor(B*Z),N===!0&&(t.style.width=E+"px",t.style.height=B+"px"),this.setViewport(0,0,E,B)},this.getDrawingBufferSize=function(E){return E.set(q*Z,se*Z).floor()},this.setDrawingBufferSize=function(E,B,N){q=E,se=B,Z=N,t.width=Math.floor(E*N),t.height=Math.floor(B*N),this.setViewport(0,0,E,B)},this.getCurrentViewport=function(E){return E.copy(D)},this.getViewport=function(E){return E.copy(Re)},this.setViewport=function(E,B,N,z){E.isVector4?Re.set(E.x,E.y,E.z,E.w):Re.set(E,B,N,z),me.viewport(D.copy(Re).multiplyScalar(Z).round())},this.getScissor=function(E){return E.copy(Ge)},this.setScissor=function(E,B,N,z){E.isVector4?Ge.set(E.x,E.y,E.z,E.w):Ge.set(E,B,N,z),me.scissor(G.copy(Ge).multiplyScalar(Z).round())},this.getScissorTest=function(){return it},this.setScissorTest=function(E){me.setScissorTest(it=E)},this.setOpaqueSort=function(E){_e=E},this.setTransparentSort=function(E){be=E},this.getClearColor=function(E){return E.copy(Y.getClearColor())},this.setClearColor=function(){Y.setClearColor.apply(Y,arguments)},this.getClearAlpha=function(){return Y.getClearAlpha()},this.setClearAlpha=function(){Y.setClearAlpha.apply(Y,arguments)},this.clear=function(E=!0,B=!0,N=!0){let z=0;if(E){let O=!1;if(P!==null){const he=P.texture.format;O=he===Fc||he===Nc||he===So}if(O){const he=P.texture.type,Ce=he===li||he===Ii||he===kr||he===$s||he===Dc||he===Lc,Le=Y.getClearColor(),Ue=Y.getClearAlpha(),$e=Le.r,je=Le.g,He=Le.b;Ce?(p[0]=$e,p[1]=je,p[2]=He,p[3]=Ue,I.clearBufferuiv(I.COLOR,0,p)):(_[0]=$e,_[1]=je,_[2]=He,_[3]=Ue,I.clearBufferiv(I.COLOR,0,_))}else z|=I.COLOR_BUFFER_BIT}B&&(z|=I.DEPTH_BUFFER_BIT),N&&(z|=I.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),I.clear(z)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",ee,!1),t.removeEventListener("webglcontextrestored",we,!1),t.removeEventListener("webglcontextcreationerror",Me,!1),Y.dispose(),ge.dispose(),Be.dispose(),Se.dispose(),b.dispose(),H.dispose(),W.dispose(),Ke.dispose(),U.dispose(),ce.dispose(),K.dispose(),K.removeEventListener("sessionstart",Di),K.removeEventListener("sessionend",ui),En.stop()};function ee(E){E.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),w=!0}function we(){console.log("THREE.WebGLRenderer: Context Restored."),w=!1;const E=Ve.autoReset,B=ve.enabled,N=ve.autoUpdate,z=ve.needsUpdate,O=ve.type;ye(),Ve.autoReset=E,ve.enabled=B,ve.autoUpdate=N,ve.needsUpdate=z,ve.type=O}function Me(E){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",E.statusMessage)}function Ye(E){const B=E.target;B.removeEventListener("dispose",Ye),Mt(B)}function Mt(E){St(E),Se.remove(E)}function St(E){const B=Se.get(E).programs;B!==void 0&&(B.forEach(function(N){ce.releaseProgram(N)}),E.isShaderMaterial&&ce.releaseShaderCache(E))}this.renderBufferDirect=function(E,B,N,z,O,he){B===null&&(B=Je);const Ce=O.isMesh&&O.matrixWorld.determinant()<0,Le=Nt(E,B,N,z,O);me.setMaterial(z,Ce);let Ue=N.index,$e=1;if(z.wireframe===!0){if(Ue=X.getWireframeAttribute(N),Ue===void 0)return;$e=2}const je=N.drawRange,He=N.attributes.position;let lt=je.start*$e,gt=(je.start+je.count)*$e;he!==null&&(lt=Math.max(lt,he.start*$e),gt=Math.min(gt,(he.start+he.count)*$e)),Ue!==null?(lt=Math.max(lt,0),gt=Math.min(gt,Ue.count)):He!=null&&(lt=Math.max(lt,0),gt=Math.min(gt,He.count));const Dt=gt-lt;if(Dt<0||Dt===1/0)return;Ke.setup(O,z,Le,N,Ue);let Tt,dt=ae;if(Ue!==null&&(Tt=k.get(Ue),dt=Ne,dt.setIndex(Tt)),O.isMesh)z.wireframe===!0?(me.setLineWidth(z.wireframeLinewidth*de()),dt.setMode(I.LINES)):dt.setMode(I.TRIANGLES);else if(O.isLine){let Xe=z.linewidth;Xe===void 0&&(Xe=1),me.setLineWidth(Xe*de()),O.isLineSegments?dt.setMode(I.LINES):O.isLineLoop?dt.setMode(I.LINE_LOOP):dt.setMode(I.LINE_STRIP)}else O.isPoints?dt.setMode(I.POINTS):O.isSprite&&dt.setMode(I.TRIANGLES);if(O.isBatchedMesh)if(O._multiDrawInstances!==null)dt.renderMultiDrawInstances(O._multiDrawStarts,O._multiDrawCounts,O._multiDrawCount,O._multiDrawInstances);else if(re.get("WEBGL_multi_draw"))dt.renderMultiDraw(O._multiDrawStarts,O._multiDrawCounts,O._multiDrawCount);else{const Xe=O._multiDrawStarts,Gt=O._multiDrawCounts,_t=O._multiDrawCount,Pn=Ue?k.get(Ue).bytesPerElement:1,fs=Se.get(z).currentProgram.getUniforms();for(let gn=0;gn<_t;gn++)fs.setValue(I,"_gl_DrawID",gn),dt.render(Xe[gn]/Pn,Gt[gn])}else if(O.isInstancedMesh)dt.renderInstances(lt,Dt,O.count);else if(N.isInstancedBufferGeometry){const Xe=N._maxInstanceCount!==void 0?N._maxInstanceCount:1/0,Gt=Math.min(N.instanceCount,Xe);dt.renderInstances(lt,Dt,Gt)}else dt.render(lt,Dt)};function at(E,B,N){E.transparent===!0&&E.side===Bn&&E.forceSinglePass===!1?(E.side=fn,E.needsUpdate=!0,Fn(E,B,N),E.side=Ci,E.needsUpdate=!0,Fn(E,B,N),E.side=Bn):Fn(E,B,N)}this.compile=function(E,B,N=null){N===null&&(N=E),m=Be.get(N),m.init(B),v.push(m),N.traverseVisible(function(O){O.isLight&&O.layers.test(B.layers)&&(m.pushLight(O),O.castShadow&&m.pushShadow(O))}),E!==N&&E.traverseVisible(function(O){O.isLight&&O.layers.test(B.layers)&&(m.pushLight(O),O.castShadow&&m.pushShadow(O))}),m.setupLights();const z=new Set;return E.traverse(function(O){if(!(O.isMesh||O.isPoints||O.isLine||O.isSprite))return;const he=O.material;if(he)if(Array.isArray(he))for(let Ce=0;Ce{function he(){if(z.forEach(function(Ce){Se.get(Ce).currentProgram.isReady()&&z.delete(Ce)}),z.size===0){O(E);return}setTimeout(he,10)}re.get("KHR_parallel_shader_compile")!==null?he():setTimeout(he,10)})};let Yt=null;function Ht(E){Yt&&Yt(E)}function Di(){En.stop()}function ui(){En.start()}const En=new tf;En.setAnimationLoop(Ht),typeof self<"u"&&En.setContext(self),this.setAnimationLoop=function(E){Yt=E,K.setAnimationLoop(E),E===null?En.stop():En.start()},K.addEventListener("sessionstart",Di),K.addEventListener("sessionend",ui),this.render=function(E,B){if(B!==void 0&&B.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(w===!0)return;if(E.matrixWorldAutoUpdate===!0&&E.updateMatrixWorld(),B.parent===null&&B.matrixWorldAutoUpdate===!0&&B.updateMatrixWorld(),K.enabled===!0&&K.isPresenting===!0&&(K.cameraAutoUpdate===!0&&K.updateCamera(B),B=K.getCamera()),E.isScene===!0&&E.onBeforeRender(x,E,B,P),m=Be.get(E,v.length),m.init(B),v.push(m),Oe.multiplyMatrices(B.projectionMatrix,B.matrixWorldInverse),Q.setFromProjectionMatrix(Oe),Ie=this.localClippingEnabled,ue=$.init(this.clippingPlanes,Ie),g=ge.get(E,y.length),g.init(),y.push(g),K.enabled===!0&&K.isPresenting===!0){const he=x.xr.getDepthSensingMesh();he!==null&&di(he,B,-1/0,x.sortObjects)}di(E,B,0,x.sortObjects),g.finish(),x.sortObjects===!0&&g.sort(_e,be),te=K.enabled===!1||K.isPresenting===!1||K.hasDepthSensing()===!1,te&&Y.addToRenderList(g,E),this.info.render.frame++,ue===!0&&$.beginShadows();const N=m.state.shadowsArray;ve.render(N,E,B),ue===!0&&$.endShadows(),this.info.autoReset===!0&&this.info.reset();const z=g.opaque,O=g.transmissive;if(m.setupLights(),B.isArrayCamera){const he=B.cameras;if(O.length>0)for(let Ce=0,Le=he.length;Ce0&&Wn(z,O,E,B),te&&Y.render(E),Li(g,E,B);P!==null&&C===0&&(R.updateMultisampleRenderTarget(P),R.updateRenderTargetMipmap(P)),E.isScene===!0&&E.onAfterRender(x,E,B),Ke.resetDefaultState(),S=-1,M=null,v.pop(),v.length>0?(m=v[v.length-1],ue===!0&&$.setGlobalState(x.clippingPlanes,m.state.camera)):m=null,y.pop(),y.length>0?g=y[y.length-1]:g=null};function di(E,B,N,z){if(E.visible===!1)return;if(E.layers.test(B.layers)){if(E.isGroup)N=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(B);else if(E.isLight)m.pushLight(E),E.castShadow&&m.pushShadow(E);else if(E.isSprite){if(!E.frustumCulled||Q.intersectsSprite(E)){z&&ze.setFromMatrixPosition(E.matrixWorld).applyMatrix4(Oe);const Ce=W.update(E),Le=E.material;Le.visible&&g.push(E,Ce,Le,N,ze.z,null)}}else if((E.isMesh||E.isLine||E.isPoints)&&(!E.frustumCulled||Q.intersectsObject(E))){const Ce=W.update(E),Le=E.material;if(z&&(E.boundingSphere!==void 0?(E.boundingSphere===null&&E.computeBoundingSphere(),ze.copy(E.boundingSphere.center)):(Ce.boundingSphere===null&&Ce.computeBoundingSphere(),ze.copy(Ce.boundingSphere.center)),ze.applyMatrix4(E.matrixWorld).applyMatrix4(Oe)),Array.isArray(Le)){const Ue=Ce.groups;for(let $e=0,je=Ue.length;$e0&&Xn(O,B,N),he.length>0&&Xn(he,B,N),Ce.length>0&&Xn(Ce,B,N),me.buffers.depth.setTest(!0),me.buffers.depth.setMask(!0),me.buffers.color.setMask(!0),me.setPolygonOffset(!1)}function Wn(E,B,N,z){if((N.isScene===!0?N.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[z.id]===void 0&&(m.state.transmissionRenderTarget[z.id]=new Sn(1,1,{generateMipmaps:!0,type:re.has("EXT_color_buffer_half_float")||re.has("EXT_color_buffer_float")?si:li,minFilter:ni,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ht.workingColorSpace}));const he=m.state.transmissionRenderTarget[z.id],Ce=z.viewport||D;he.setSize(Ce.z*x.transmissionResolutionScale,Ce.w*x.transmissionResolutionScale);const Le=x.getRenderTarget();x.setRenderTarget(he),x.getClearColor(V),J=x.getClearAlpha(),J<1&&x.setClearColor(16777215,.5),x.clear(),te&&Y.render(N);const Ue=x.toneMapping;x.toneMapping=Ti;const $e=z.viewport;if(z.viewport!==void 0&&(z.viewport=void 0),m.setupLightsView(z),ue===!0&&$.setGlobalState(x.clippingPlanes,z),Xn(E,N,z),R.updateMultisampleRenderTarget(he),R.updateRenderTargetMipmap(he),re.has("WEBGL_multisampled_render_to_texture")===!1){let je=!1;for(let He=0,lt=B.length;He0),He=!!N.morphAttributes.position,lt=!!N.morphAttributes.normal,gt=!!N.morphAttributes.color;let Dt=Ti;z.toneMapped&&(P===null||P.isXRRenderTarget===!0)&&(Dt=x.toneMapping);const Tt=N.morphAttributes.position||N.morphAttributes.normal||N.morphAttributes.color,dt=Tt!==void 0?Tt.length:0,Xe=Se.get(z),Gt=m.state.lights;if(ue===!0&&(Ie===!0||E!==M)){const en=E===M&&z.id===S;$.setState(z,E,en)}let _t=!1;z.version===Xe.__version?(Xe.needsLights&&Xe.lightsStateVersion!==Gt.state.version||Xe.outputColorSpace!==Le||O.isBatchedMesh&&Xe.batching===!1||!O.isBatchedMesh&&Xe.batching===!0||O.isBatchedMesh&&Xe.batchingColor===!0&&O.colorTexture===null||O.isBatchedMesh&&Xe.batchingColor===!1&&O.colorTexture!==null||O.isInstancedMesh&&Xe.instancing===!1||!O.isInstancedMesh&&Xe.instancing===!0||O.isSkinnedMesh&&Xe.skinning===!1||!O.isSkinnedMesh&&Xe.skinning===!0||O.isInstancedMesh&&Xe.instancingColor===!0&&O.instanceColor===null||O.isInstancedMesh&&Xe.instancingColor===!1&&O.instanceColor!==null||O.isInstancedMesh&&Xe.instancingMorph===!0&&O.morphTexture===null||O.isInstancedMesh&&Xe.instancingMorph===!1&&O.morphTexture!==null||Xe.envMap!==Ue||z.fog===!0&&Xe.fog!==he||Xe.numClippingPlanes!==void 0&&(Xe.numClippingPlanes!==$.numPlanes||Xe.numIntersection!==$.numIntersection)||Xe.vertexAlphas!==$e||Xe.vertexTangents!==je||Xe.morphTargets!==He||Xe.morphNormals!==lt||Xe.morphColors!==gt||Xe.toneMapping!==Dt||Xe.morphTargetsCount!==dt)&&(_t=!0):(_t=!0,Xe.__version=z.version);let Pn=Xe.currentProgram;_t===!0&&(Pn=Fn(z,B,O));let fs=!1,gn=!1,pr=!1;const bt=Pn.getUniforms(),An=Xe.uniforms;if(me.useProgram(Pn.program)&&(fs=!0,gn=!0,pr=!0),z.id!==S&&(S=z.id,gn=!0),fs||M!==E){me.buffers.depth.getReversed()?(pe.copy(E.projectionMatrix),Up(pe),Np(pe),bt.setValue(I,"projectionMatrix",pe)):bt.setValue(I,"projectionMatrix",E.projectionMatrix),bt.setValue(I,"viewMatrix",E.matrixWorldInverse);const ln=bt.map.cameraPosition;ln!==void 0&&ln.setValue(I,We.setFromMatrixPosition(E.matrixWorld)),Ae.logarithmicDepthBuffer&&bt.setValue(I,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),(z.isMeshPhongMaterial||z.isMeshToonMaterial||z.isMeshLambertMaterial||z.isMeshBasicMaterial||z.isMeshStandardMaterial||z.isShaderMaterial)&&bt.setValue(I,"isOrthographic",E.isOrthographicCamera===!0),M!==E&&(M=E,gn=!0,pr=!0)}if(O.isSkinnedMesh){bt.setOptional(I,O,"bindMatrix"),bt.setOptional(I,O,"bindMatrixInverse");const en=O.skeleton;en&&(en.boneTexture===null&&en.computeBoneTexture(),bt.setValue(I,"boneTexture",en.boneTexture,R))}O.isBatchedMesh&&(bt.setOptional(I,O,"batchingTexture"),bt.setValue(I,"batchingTexture",O._matricesTexture,R),bt.setOptional(I,O,"batchingIdTexture"),bt.setValue(I,"batchingIdTexture",O._indirectTexture,R),bt.setOptional(I,O,"batchingColorTexture"),O._colorsTexture!==null&&bt.setValue(I,"batchingColorTexture",O._colorsTexture,R));const Cn=N.morphAttributes;if((Cn.position!==void 0||Cn.normal!==void 0||Cn.color!==void 0)&&ie.update(O,N,Pn),(gn||Xe.receiveShadow!==O.receiveShadow)&&(Xe.receiveShadow=O.receiveShadow,bt.setValue(I,"receiveShadow",O.receiveShadow)),z.isMeshGouraudMaterial&&z.envMap!==null&&(An.envMap.value=Ue,An.flipEnvMap.value=Ue.isCubeTexture&&Ue.isRenderTargetTexture===!1?-1:1),z.isMeshStandardMaterial&&z.envMap===null&&B.environment!==null&&(An.envMapIntensity.value=B.environmentIntensity),gn&&(bt.setValue(I,"toneMappingExposure",x.toneMappingExposure),Xe.needsLights&&mn(An,pr),he&&z.fog===!0&&oe.refreshFogUniforms(An,he),oe.refreshMaterialUniforms(An,z,Z,se,m.state.transmissionRenderTarget[E.id]),$a.upload(I,Ui(Xe),An,R)),z.isShaderMaterial&&z.uniformsNeedUpdate===!0&&($a.upload(I,Ui(Xe),An,R),z.uniformsNeedUpdate=!1),z.isSpriteMaterial&&bt.setValue(I,"center",O.center),bt.setValue(I,"modelViewMatrix",O.modelViewMatrix),bt.setValue(I,"normalMatrix",O.normalMatrix),bt.setValue(I,"modelMatrix",O.matrixWorld),z.isShaderMaterial||z.isRawShaderMaterial){const en=z.uniformsGroups;for(let ln=0,No=en.length;ln0&&R.useMultisampledRTT(E)===!1?O=Se.get(E).__webglMultisampledFramebuffer:Array.isArray(je)?O=je[N]:O=je,D.copy(E.viewport),G.copy(E.scissor),F=E.scissorTest}else D.copy(Re).multiplyScalar(Z).floor(),G.copy(Ge).multiplyScalar(Z).floor(),F=it;if(N!==0&&(O=pi),me.bindFramebuffer(I.FRAMEBUFFER,O)&&z&&me.drawBuffers(E,O),me.viewport(D),me.scissor(G),me.setScissorTest(F),he){const Ue=Se.get(E.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_CUBE_MAP_POSITIVE_X+B,Ue.__webglTexture,N)}else if(Ce){const Ue=Se.get(E.texture),$e=B;I.framebufferTextureLayer(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,Ue.__webglTexture,N,$e)}else if(E!==null&&N!==0){const Ue=Se.get(E.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,Ue.__webglTexture,N)}S=-1},this.readRenderTargetPixels=function(E,B,N,z,O,he,Ce){if(!(E&&E.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Le=Se.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&Ce!==void 0&&(Le=Le[Ce]),Le){me.bindFramebuffer(I.FRAMEBUFFER,Le);try{const Ue=E.texture,$e=Ue.format,je=Ue.type;if(!Ae.textureFormatReadable($e)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ae.textureTypeReadable(je)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}B>=0&&B<=E.width-z&&N>=0&&N<=E.height-O&&I.readPixels(B,N,z,O,Pe.convert($e),Pe.convert(je),he)}finally{const Ue=P!==null?Se.get(P).__webglFramebuffer:null;me.bindFramebuffer(I.FRAMEBUFFER,Ue)}}},this.readRenderTargetPixelsAsync=async function(E,B,N,z,O,he,Ce){if(!(E&&E.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Le=Se.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&Ce!==void 0&&(Le=Le[Ce]),Le){const Ue=E.texture,$e=Ue.format,je=Ue.type;if(!Ae.textureFormatReadable($e))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ae.textureTypeReadable(je))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(B>=0&&B<=E.width-z&&N>=0&&N<=E.height-O){me.bindFramebuffer(I.FRAMEBUFFER,Le);const He=I.createBuffer();I.bindBuffer(I.PIXEL_PACK_BUFFER,He),I.bufferData(I.PIXEL_PACK_BUFFER,he.byteLength,I.STREAM_READ),I.readPixels(B,N,z,O,Pe.convert($e),Pe.convert(je),0);const lt=P!==null?Se.get(P).__webglFramebuffer:null;me.bindFramebuffer(I.FRAMEBUFFER,lt);const gt=I.fenceSync(I.SYNC_GPU_COMMANDS_COMPLETE,0);return I.flush(),await Lp(I,gt,4),I.bindBuffer(I.PIXEL_PACK_BUFFER,He),I.getBufferSubData(I.PIXEL_PACK_BUFFER,0,he),I.deleteBuffer(He),I.deleteSync(gt),he}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(E,B=null,N=0){E.isTexture!==!0&&(Fs("WebGLRenderer: copyFramebufferToTexture function signature has changed."),B=arguments[0]||null,E=arguments[1]);const z=Math.pow(2,-N),O=Math.floor(E.image.width*z),he=Math.floor(E.image.height*z),Ce=B!==null?B.x:0,Le=B!==null?B.y:0;R.setTexture2D(E,0),I.copyTexSubImage2D(I.TEXTURE_2D,N,0,0,Ce,Le,O,he),me.unbindTexture()};const fr=I.createFramebuffer(),ds=I.createFramebuffer();this.copyTextureToTexture=function(E,B,N=null,z=null,O=0,he=null){E.isTexture!==!0&&(Fs("WebGLRenderer: copyTextureToTexture function signature has changed."),z=arguments[0]||null,E=arguments[1],B=arguments[2],he=arguments[3]||0,N=null),he===null&&(O!==0?(Fs("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),he=O,O=0):he=0);let Ce,Le,Ue,$e,je,He,lt,gt,Dt;const Tt=E.isCompressedTexture?E.mipmaps[he]:E.image;if(N!==null)Ce=N.max.x-N.min.x,Le=N.max.y-N.min.y,Ue=N.isBox3?N.max.z-N.min.z:1,$e=N.min.x,je=N.min.y,He=N.isBox3?N.min.z:0;else{const Cn=Math.pow(2,-O);Ce=Math.floor(Tt.width*Cn),Le=Math.floor(Tt.height*Cn),E.isDataArrayTexture?Ue=Tt.depth:E.isData3DTexture?Ue=Math.floor(Tt.depth*Cn):Ue=1,$e=0,je=0,He=0}z!==null?(lt=z.x,gt=z.y,Dt=z.z):(lt=0,gt=0,Dt=0);const dt=Pe.convert(B.format),Xe=Pe.convert(B.type);let Gt;B.isData3DTexture?(R.setTexture3D(B,0),Gt=I.TEXTURE_3D):B.isDataArrayTexture||B.isCompressedArrayTexture?(R.setTexture2DArray(B,0),Gt=I.TEXTURE_2D_ARRAY):(R.setTexture2D(B,0),Gt=I.TEXTURE_2D),I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL,B.flipY),I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha),I.pixelStorei(I.UNPACK_ALIGNMENT,B.unpackAlignment);const _t=I.getParameter(I.UNPACK_ROW_LENGTH),Pn=I.getParameter(I.UNPACK_IMAGE_HEIGHT),fs=I.getParameter(I.UNPACK_SKIP_PIXELS),gn=I.getParameter(I.UNPACK_SKIP_ROWS),pr=I.getParameter(I.UNPACK_SKIP_IMAGES);I.pixelStorei(I.UNPACK_ROW_LENGTH,Tt.width),I.pixelStorei(I.UNPACK_IMAGE_HEIGHT,Tt.height),I.pixelStorei(I.UNPACK_SKIP_PIXELS,$e),I.pixelStorei(I.UNPACK_SKIP_ROWS,je),I.pixelStorei(I.UNPACK_SKIP_IMAGES,He);const bt=E.isDataArrayTexture||E.isData3DTexture,An=B.isDataArrayTexture||B.isData3DTexture;if(E.isDepthTexture){const Cn=Se.get(E),en=Se.get(B),ln=Se.get(Cn.__renderTarget),No=Se.get(en.__renderTarget);me.bindFramebuffer(I.READ_FRAMEBUFFER,ln.__webglFramebuffer),me.bindFramebuffer(I.DRAW_FRAMEBUFFER,No.__webglFramebuffer);for(let Ni=0;NiMath.PI&&(n-=hn),i<-Math.PI?i+=hn:i>Math.PI&&(i-=hn),n<=i?this._spherical.theta=Math.max(n,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+i)/2?Math.max(n,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=a!=this._spherical.radius}if(Ft.setFromSpherical(this._spherical),Ft.applyQuaternion(this._quatInverse),t.copy(this.target).add(Ft),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const o=Ft.length();a=this._clampDistance(o*this._scale);const l=o-a;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const o=new A(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const c=new A(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(o),this.object.updateMatrixWorld(),a=Ft.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(Va.origin.copy(this.object.position),Va.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Va.direction))El||8*(1-this._lastQuaternion.dot(this.object.quaternion))>El||this._lastTargetPosition.distanceToSquared(this.target)>El?(this.dispatchEvent(td),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?hn/60*this.autoRotateSpeed*e:hn/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Ft.setFromMatrixColumn(t,0),Ft.multiplyScalar(-e),this._panOffset.add(Ft)}_panUp(e,t){this.screenSpacePanning===!0?Ft.setFromMatrixColumn(t,1):(Ft.setFromMatrixColumn(t,0),Ft.crossVectors(this.object.up,Ft)),Ft.multiplyScalar(e),this._panOffset.add(Ft)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;Ft.copy(i).sub(this.target);let s=Ft.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),i=e-n.left,s=t-n.top,a=n.width,o=n.height;this._mouse.x=i/a*2-1,this._mouse.y=-(s/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(hn*this._rotateDelta.x/t.clientHeight),this._rotateUp(hn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(hn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-hn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(hn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-hn*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._rotateStart.set(n,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panStart.set(n,i)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(n*n+i*i);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(i,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(hn*this._rotateDelta.x/t.clientHeight),this._rotateUp(hn*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panEnd.set(n,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(n*n+i*i);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t - varying vec2 vUv; - uniform sampler2D colorTexture; - uniform vec2 invSize; - uniform vec2 direction; - uniform float gaussianCoefficients[KERNEL_RADIUS]; - - void main() { - float weightSum = gaussianCoefficients[0]; - vec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum; - for( int i = 1; i < KERNEL_RADIUS; i ++ ) { - float x = float(i); - float w = gaussianCoefficients[i]; - vec2 uvOffset = direction * invSize * x; - vec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb; - vec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb; - diffuseSum += (sample1 + sample2) * w; - weightSum += 2.0 * w; - } - gl_FragColor = vec4(diffuseSum/weightSum, 1.0); - }`})}getCompositeMaterial(e){return new Xt({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`varying vec2 vUv; - void main() { - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - }`,fragmentShader:`varying vec2 vUv; - uniform sampler2D blurTexture1; - uniform sampler2D blurTexture2; - uniform sampler2D blurTexture3; - uniform sampler2D blurTexture4; - uniform sampler2D blurTexture5; - uniform float bloomStrength; - uniform float bloomRadius; - uniform float bloomFactors[NUM_MIPS]; - uniform vec3 bloomTintColors[NUM_MIPS]; - - float lerpBloomFactor(const in float factor) { - float mirrorFactor = 1.2 - factor; - return mix(factor, mirrorFactor, bloomRadius); - } - - void main() { - gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) + - lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) + - lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) + - lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) + - lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) ); - }`})}}ir.BlurDirectionX=new j(1,0);ir.BlurDirectionY=new j(0,1);function eM(){const e=new Float32Array(6e3),t=new Float32Array(2e3*3);for(let s=0;s<2e3;s++){const a=Math.random()*Math.PI*2,o=Math.acos(2*Math.random()-1),l=600+Math.random()*400;e[s*3]=l*Math.sin(o)*Math.cos(a),e[s*3+1]=l*Math.sin(o)*Math.sin(a),e[s*3+2]=l*Math.cos(o);const c=Math.random();t[s*3]=.55+c*.25,t[s*3+1]=.55+c*.15,t[s*3+2]=.75+c*.25}const n=new qe;n.setAttribute("position",new rt(e,3)),n.setAttribute("color",new rt(t,3));const i=new Ai({size:1.6,sizeAttenuation:!0,vertexColors:!0,transparent:!0,opacity:.6,depthWrite:!1,blending:Wt});return new as(n,i)}function tM(r){const e=new Cd;e.background=new ne(328975),e.fog=new Yr(657946,.0035);const t=new kt(60,r.clientWidth/r.clientHeight,.1,2e3);t.position.set(0,30,80);const n=new Dy({antialias:!0,alpha:!0,powerPreference:"high-performance"});n.setSize(r.clientWidth,r.clientHeight),n.setPixelRatio(Math.min(window.devicePixelRatio,2)),n.toneMapping=cd,n.toneMappingExposure=1.25,r.appendChild(n.domElement);const i=new Uy(t,n.domElement);i.enableDamping=!0,i.dampingFactor=.05,i.rotateSpeed=.5,i.zoomSpeed=.8,i.minDistance=12,i.maxDistance=180,i.autoRotate=!0,i.autoRotateSpeed=.3;const s=new $y(n);s.addPass(new jy(e,t));const a=new ir(new j(r.clientWidth,r.clientHeight),.55,.6,.2);s.addPass(a);const o=new Jd(2763354,.7);e.add(o);const l=new _c(6514417,1.8,240);l.position.set(50,50,50),e.add(l);const c=new _c(11032055,1.2,240);c.position.set(-50,-30,-50),e.add(c);const h=eM();e.add(h);const u=new Wg;u.params.Points={threshold:2};const f=new j;return{scene:e,camera:t,renderer:n,controls:i,composer:s,bloomPass:a,raycaster:u,mouse:f,lights:{ambient:o,point1:l,point2:c},starfield:h}}function nM(r,e){const t=e.clientWidth,n=e.clientHeight;r.camera.aspect=t/n,r.camera.updateProjectionMatrix(),r.renderer.setSize(t,n),r.composer.setSize(t,n)}function iM(r){r.scene.traverse(e=>{var t;(e instanceof yt||e instanceof Pd)&&((t=e.geometry)==null||t.dispose(),Array.isArray(e.material)?e.material.forEach(n=>n.dispose()):e.material&&e.material.dispose())}),r.renderer.dispose(),r.composer.dispose()}class sM{constructor(e){ke(this,"positions");ke(this,"velocities");ke(this,"running",!0);ke(this,"step",0);ke(this,"repulsionStrength",500);ke(this,"attractionStrength",.01);ke(this,"dampening",.9);ke(this,"baseMaxSteps",300);ke(this,"maxSteps",300);ke(this,"cooldownExtension",0);this.positions=e,this.velocities=new Map;for(const t of e.keys())this.velocities.set(t,new A)}addNode(e,t){this.positions.set(e,t.clone()),this.velocities.set(e,new A),this.cooldownExtension=100,this.maxSteps=Math.max(this.maxSteps,this.step+this.cooldownExtension),this.running=!0}removeNode(e){this.positions.delete(e),this.velocities.delete(e)}tick(e){if(!this.running)return;if(this.step>this.maxSteps){this.cooldownExtension>0&&(this.cooldownExtension=0,this.maxSteps=this.baseMaxSteps);return}this.step++;const t=Math.max(.001,1-this.step/this.maxSteps),n=Array.from(this.positions.keys());for(let i=0;i=.7?"active":r>=.4?"dormant":r>=.1?"silent":"unavailable"}const bc={active:"#10b981",dormant:"#f59e0b",silent:"#8b5cf6",unavailable:"#6b7280"},aM={active:"Easily retrievable (retention ≥ 70%)",dormant:"Retrievable with effort (40–70%)",silent:"Difficult, needs cues (10–40%)",unavailable:"Needs reinforcement (< 10%)"},Qa={aha:"#FFD700",confusion:"#EF4444",failure:"#9CA3AF"},oM={aha:"Aha moments and breakthroughs",confusion:"Confusions and weak spots",failure:"Failures and guardrails"};function sd(r,e){return e==="state"?bc[rM(r.retention)]:e==="ahagraph"?lM(r)??Il[r.type]??"#8B95A5":Il[r.type]||"#8B95A5"}function lM(r){const e=new Set((r.tags??[]).map(t=>t.toLowerCase()));return e.has("aha")?Qa.aha:e.has("confusion")||e.has("weak-spot")?Qa.confusion:e.has("failure")||e.has("guardrail")?Qa.failure:null}let Ar=null;function Sc(){if(Ar)return Ar;const r=128,e=document.createElement("canvas");e.width=r,e.height=r;const t=e.getContext("2d");if(!t)return Ar=new Et,Ar;const n=t.createRadialGradient(r/2,r/2,0,r/2,r/2,r/2);n.addColorStop(0,"rgba(255, 255, 255, 1.0)"),n.addColorStop(.25,"rgba(255, 255, 255, 0.7)"),n.addColorStop(.55,"rgba(255, 255, 255, 0.2)"),n.addColorStop(1,"rgba(255, 255, 255, 0.0)"),t.fillStyle=n,t.fillRect(0,0,r,r);const i=new Dd(e);return i.needsUpdate=!0,Ar=i,i}function rd(r){if(r===0||r===1)return r;const e=.3;return Math.pow(2,-10*r)*Math.sin((r-e/4)*(2*Math.PI)/e)+1}function cM(r){return r*r*((1.70158+1)*r-1.70158)}class hM{constructor(){ke(this,"group");ke(this,"meshMap",new Map);ke(this,"glowMap",new Map);ke(this,"positions",new Map);ke(this,"labelSprites",new Map);ke(this,"hoveredNode",null);ke(this,"selectedNode",null);ke(this,"colorMode","type");ke(this,"materializingNodes",[]);ke(this,"dissolvingNodes",[]);ke(this,"growingNodes",[]);this.group=new ns}setColorMode(e){if(this.colorMode!==e){this.colorMode=e;for(const[t,n]of this.meshMap){const i=n.userData.retention??0,s=n.userData.type??"fact",a=Array.isArray(n.userData.tags)?n.userData.tags:[],l=sd({type:s,retention:i,tags:a},e),c=new ne(l),h=n.material;h.color.copy(c),h.emissive.copy(c);const u=this.glowMap.get(t);u&&u.material.color.copy(c)}}}createNodes(e){const t=(1+Math.sqrt(5))/2,n=e.length;for(let i=0;i0,o=new cr(i,16,16),l=new ah({color:new ne(s),emissive:new ne(s),emissiveIntensity:a?0:.3+e.retention*.5,roughness:.3,metalness:.1,transparent:!0,opacity:a?.2:.3+e.retention*.7}),c=new yt(o,l);c.position.copy(t),c.scale.setScalar(n),c.userData={nodeId:e.id,type:e.type,retention:e.retention,tags:e.tags},this.meshMap.set(e.id,c),this.group.add(c);const h=new rs({map:Sc(),color:new ne(s),transparent:!0,opacity:n>0?a?.1:.3+e.retention*.35:0,blending:Wt,depthWrite:!1}),u=new ts(h);u.scale.set(i*6*n,i*6*n,1),u.position.copy(t),u.userData={isGlow:!0,nodeId:e.id},this.glowMap.set(e.id,u),this.group.add(u);const f=e.label||e.type,d=this.createTextSprite(f,"#94a3b8");return d.position.copy(t),d.position.y+=i*2+1.5,d.userData={isLabel:!0,nodeId:e.id,offset:i*2+1.5},this.group.add(d),this.labelSprites.set(e.id,d),{mesh:c,glow:u,label:d,size:i}}addNode(e,t,n={}){const i=(t==null?void 0:t.clone())??new A((Math.random()-.5)*40,(Math.random()-.5)*40,(Math.random()-.5)*40);this.positions.set(e.id,i);const{mesh:s,glow:a,label:o}=this.createNodeMeshes(e,i,0);return s.scale.setScalar(.001),a.scale.set(.001,.001,1),a.material.opacity=0,o.material.opacity=0,n.isBirthRitual?(s.visible=!1,a.visible=!1,o.visible=!1,s.userData.birthRitualPending={totalFrames:30,targetScale:.5+e.retention*2}):this.materializingNodes.push({id:e.id,frame:0,totalFrames:30,mesh:s,glow:a,label:o,targetScale:.5+e.retention*2}),i}igniteNode(e){const t=this.meshMap.get(e),n=this.glowMap.get(e),i=this.labelSprites.get(e);if(!t||!n||!i)return;const s=t.userData.birthRitualPending;s&&(t.visible=!0,n.visible=!0,i.visible=!0,delete t.userData.birthRitualPending,this.materializingNodes.push({id:e,frame:0,totalFrames:s.totalFrames,mesh:t,glow:n,label:i,targetScale:s.targetScale}))}removeNode(e){const t=this.meshMap.get(e),n=this.glowMap.get(e),i=this.labelSprites.get(e);!t||!n||!i||(this.materializingNodes=this.materializingNodes.filter(s=>s.id!==e),this.dissolvingNodes.push({id:e,frame:0,totalFrames:60,mesh:t,glow:n,label:i,originalScale:t.scale.x}))}growNode(e,t){const n=this.meshMap.get(e);if(!n)return;const i=n.scale.x,s=.5+t*2;n.userData.retention=t,this.growingNodes.push({id:e,frame:0,totalFrames:30,startScale:i,targetScale:s})}createTextSprite(e,t){const n=document.createElement("canvas"),i=n.getContext("2d");if(!i){const m=new Et;return new ts(new rs({map:m,transparent:!0,opacity:0}))}n.width=512,n.height=64;const s=e.length>40?e.slice(0,37)+"...":e;i.clearRect(0,0,n.width,n.height),i.font='600 22px -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif';const o=i.measureText(s).width,c=Math.min(o+14*2,n.width-4),h=40,u=(n.width-c)/2,f=(n.height-h)/2,d=h/2;i.fillStyle="rgba(10, 16, 28, 0.82)",i.beginPath(),i.moveTo(u+d,f),i.lineTo(u+c-d,f),i.quadraticCurveTo(u+c,f,u+c,f+d),i.lineTo(u+c,f+h-d),i.quadraticCurveTo(u+c,f+h,u+c-d,f+h),i.lineTo(u+d,f+h),i.quadraticCurveTo(u,f+h,u,f+h-d),i.lineTo(u,f+d),i.quadraticCurveTo(u,f,u+d,f),i.closePath(),i.fill(),i.strokeStyle="rgba(148, 163, 184, 0.18)",i.lineWidth=1,i.stroke(),i.textAlign="center",i.textBaseline="middle",i.fillStyle=t,i.fillText(s,n.width/2,n.height/2+1);const p=new Dd(n);p.needsUpdate=!0;const _=new rs({map:p,transparent:!0,opacity:0,depthTest:!1,sizeAttenuation:!0}),g=new ts(_);return g.scale.set(9,1.2,1),g}updatePositions(){this.group.children.forEach(e=>{if(e.userData.nodeId){const t=this.positions.get(e.userData.nodeId);if(!t)return;e.userData.isGlow?e.position.copy(t):e.userData.isLabel?(e.position.copy(t),e.position.y+=e.userData.offset):e instanceof yt&&e.position.copy(t)}})}animate(e,t,n,i=1){var a,o;for(let l=this.materializingNodes.length-1;l>=0;l--){const c=this.materializingNodes[l];c.frame++;const h=Math.min(c.frame/c.totalFrames,1),u=rd(h);if(c.mesh.scale.setScalar(Math.max(.001,u)),c.frame>=5){const f=Math.min((c.frame-5)/5,1),d=c.glow.material;d.opacity=f*.4;const p=c.targetScale*6*u;c.glow.scale.set(p,p,1)}if(c.frame>=40){const f=Math.min((c.frame-40)/20,1);c.label.material.opacity=f*.9}c.frame>=60&&this.materializingNodes.splice(l,1)}for(let l=this.dissolvingNodes.length-1;l>=0;l--){const c=this.dissolvingNodes[l];c.frame++;const h=Math.min(c.frame/c.totalFrames,1),u=1-cM(h),f=Math.max(.001,c.originalScale*u);c.mesh.scale.setScalar(f);const d=f*6;c.glow.scale.set(d,d,1);const p=c.mesh.material;p.opacity*=.97,c.glow.material.opacity*=.95,c.label.material.opacity*=.93,c.frame>=c.totalFrames&&(this.group.remove(c.mesh),this.group.remove(c.glow),this.group.remove(c.label),c.mesh.geometry.dispose(),c.mesh.material.dispose(),(a=c.glow.material.map)==null||a.dispose(),c.glow.material.dispose(),(o=c.label.material.map)==null||o.dispose(),c.label.material.dispose(),this.meshMap.delete(c.id),this.glowMap.delete(c.id),this.labelSprites.delete(c.id),this.positions.delete(c.id),this.dissolvingNodes.splice(l,1))}for(let l=this.growingNodes.length-1;l>=0;l--){const c=this.growingNodes[l];c.frame++;const h=Math.min(c.frame/c.totalFrames,1),u=c.startScale+(c.targetScale-c.startScale)*rd(h),f=this.meshMap.get(c.id);f&&f.scale.setScalar(u);const d=this.glowMap.get(c.id);if(d){const p=u*6;d.scale.set(p,p,1)}c.frame>=c.totalFrames&&this.growingNodes.splice(l,1)}const s=new Set([...this.materializingNodes.map(l=>l.id),...this.dissolvingNodes.map(l=>l.id),...this.growingNodes.map(l=>l.id)]);this.meshMap.forEach((l,c)=>{if(s.has(c))return;const h=t.find(y=>y.id===c);if(!h)return;const u=1+Math.sin(e*1.5+t.indexOf(h)*.5)*.15*h.retention;l.scale.setScalar(u);const f=this.positions.get(c),d=f?n.position.distanceTo(f):0,p=1+Math.min(1.4,Math.max(0,(d-60)/100)),_=l.material;if(c===this.hoveredNode)_.emissiveIntensity=1*i;else if(c===this.selectedNode)_.emissiveIntensity=.8*i;else{const v=.3+h.retention*.5+Math.sin(e*(.8+h.retention*.7))*.1*h.retention;_.emissiveIntensity=v*i*p}const g=.3+h.retention*.7;_.opacity=Math.min(1,g*i*p);const m=this.glowMap.get(c);if(m){const y=m.material,v=.3+h.retention*.35;y.opacity=Math.min(.95,v*i*p)}}),this.labelSprites.forEach((l,c)=>{if(s.has(c))return;const h=this.positions.get(c);if(!h)return;const u=n.position.distanceTo(h),f=l.material,d=c===this.hoveredNode||c===this.selectedNode?1:u<40?.9:u<80?.9*(1-(u-40)/40):0;f.opacity+=(d-f.opacity)*.1})}getMeshes(){return Array.from(this.meshMap.values())}dispose(){this.group.traverse(e=>{var t,n,i,s,a;e instanceof yt?((t=e.geometry)==null||t.dispose(),(n=e.material)==null||n.dispose()):e instanceof ts&&((s=(i=e.material)==null?void 0:i.map)==null||s.dispose(),(a=e.material)==null||a.dispose())}),this.materializingNodes=[],this.dissolvingNodes=[],this.growingNodes=[]}}function uM(r){return 1-Math.pow(1-r,3)}class dM{constructor(){ke(this,"group");ke(this,"growingEdges",[]);ke(this,"dissolvingEdges",[]);this.group=new ns}createEdges(e,t){for(const n of e){const i=t.get(n.source),s=t.get(n.target);if(!i||!s)continue;const a=[i,s],o=new qe().setFromPoints(a),l=new qt({color:9133302,transparent:!0,opacity:Math.min(.25+n.weight*.5,.8),blending:Wt,depthWrite:!1}),c=new Vn(o,l);c.userData={source:n.source,target:n.target},this.group.add(c)}}addEdge(e,t){const n=t.get(e.source),i=t.get(e.target);if(!n||!i)return;const s=[n.clone(),n.clone()],a=new qe().setFromPoints(s),o=new qt({color:9133302,transparent:!0,opacity:0,blending:Wt,depthWrite:!1}),l=new Vn(a,o);l.userData={source:e.source,target:e.target},this.group.add(l),this.growingEdges.push({line:l,source:e.source,target:e.target,frame:0,totalFrames:45})}removeEdgesForNode(e){const t=[];this.group.children.forEach(n=>{const i=n;(i.userData.source===e||i.userData.target===e)&&t.push(i)});for(const n of t)this.growingEdges=this.growingEdges.filter(i=>i.line!==n),this.dissolvingEdges.push({line:n,frame:0,totalFrames:40})}animateEdges(e){for(let t=this.growingEdges.length-1;t>=0;t--){const n=this.growingEdges[t];n.frame++;const i=uM(Math.min(n.frame/n.totalFrames,1)),s=e.get(n.source),a=e.get(n.target);if(!s||!a)continue;const o=s.clone().lerp(a,i),l=n.line.geometry.attributes.position;l.setXYZ(0,s.x,s.y,s.z),l.setXYZ(1,o.x,o.y,o.z),l.needsUpdate=!0;const c=n.line.material;c.opacity=i*.65,n.frame>=n.totalFrames&&(c.opacity=.65,this.growingEdges.splice(t,1))}for(let t=this.dissolvingEdges.length-1;t>=0;t--){const n=this.dissolvingEdges[t];n.frame++;const i=n.frame/n.totalFrames,s=n.line.material;s.opacity=Math.max(0,.65*(1-i)),n.frame>=n.totalFrames&&(this.group.remove(n.line),n.line.geometry.dispose(),n.line.material.dispose(),this.dissolvingEdges.splice(t,1))}}updatePositions(e){this.group.children.forEach(t=>{const n=t;if(this.growingEdges.some(a=>a.line===n)||this.dissolvingEdges.some(a=>a.line===n))return;const i=e.get(n.userData.source),s=e.get(n.userData.target);if(i&&s){const a=n.geometry.attributes.position;a.setXYZ(0,i.x,i.y,i.z),a.setXYZ(1,s.x,s.y,s.z),a.needsUpdate=!0}})}dispose(){this.group.children.forEach(e=>{var n,i;const t=e;(n=t.geometry)==null||n.dispose(),(i=t.material)==null||i.dispose()}),this.growingEdges=[],this.dissolvingEdges=[]}}class fM{constructor(e){ke(this,"starField");ke(this,"neuralParticles");this.starField=this.createStarField(),this.neuralParticles=this.createNeuralParticles(),e.add(this.starField),e.add(this.neuralParticles)}createStarField(){const t=new qe,n=new Float32Array(3e3*3),i=new Float32Array(3e3);for(let a=0;a<3e3;a++)n[a*3]=(Math.random()-.5)*1e3,n[a*3+1]=(Math.random()-.5)*1e3,n[a*3+2]=(Math.random()-.5)*1e3,i[a]=Math.random()*1.5;t.setAttribute("position",new rt(n,3)),t.setAttribute("size",new rt(i,1));const s=new Ai({color:6514417,size:.5,transparent:!0,opacity:.4,sizeAttenuation:!0,blending:Wt});return new as(t,s)}createNeuralParticles(){const t=new qe,n=new Float32Array(500*3),i=new Float32Array(500*3);for(let a=0;a<500;a++)n[a*3]=(Math.random()-.5)*100,n[a*3+1]=(Math.random()-.5)*100,n[a*3+2]=(Math.random()-.5)*100,i[a*3]=.4+Math.random()*.3,i[a*3+1]=.3+Math.random()*.2,i[a*3+2]=.8+Math.random()*.2;t.setAttribute("position",new rt(n,3)),t.setAttribute("color",new rt(i,3));const s=new Ai({size:.3,vertexColors:!0,transparent:!0,opacity:.4,blending:Wt,sizeAttenuation:!0});return new as(t,s)}animate(e){this.starField.rotation.y+=1e-4,this.starField.rotation.x+=5e-5;const t=this.neuralParticles.geometry.attributes.position;for(let n=0;n=0;i--){const s=this.pulseEffects[i];if(s.intensity-=s.decay,s.intensity<=0){this.pulseEffects.splice(i,1);continue}const a=e.get(s.nodeId);if(a){const o=a.material;o.emissive.lerp(s.color,s.intensity*.3),o.emissiveIntensity=Math.max(o.emissiveIntensity,s.intensity)}}for(let i=this.spawnBursts.length-1;i>=0;i--){const s=this.spawnBursts[i];if(s.age++,s.age>120){this.scene.remove(s.particles),s.particles.geometry.dispose(),s.particles.material.dispose(),this.spawnBursts.splice(i,1);continue}const a=s.particles.geometry.attributes.position,o=s.particles.geometry.attributes.velocity;for(let c=0;c=0;i--){const s=this.rainbowBursts[i];if(s.age++,s.age>s.maxAge){this.scene.remove(s.particles),s.particles.geometry.dispose(),s.particles.material.dispose(),this.rainbowBursts.splice(i,1);continue}const a=s.particles.geometry.attributes.position,o=s.particles.geometry.attributes.velocity;for(let f=0;f=0;i--){const s=this.rippleWaves[i];if(s.age++,s.radius+=s.speed,s.age>s.maxAge){this.rippleWaves.splice(i,1);continue}const a=s.radius,o=3;n.forEach((l,c)=>{if(s.pulsedNodes.has(c))return;const h=l.distanceTo(s.origin);h>=a-o&&h<=a+o&&(s.pulsedNodes.add(c),this.addPulse(c,.8,new ne(65489),.03))})}for(let i=this.implosions.length-1;i>=0;i--){const s=this.implosions[i];if(s.age++,s.age>s.maxAge+20){this.scene.remove(s.particles),s.particles.geometry.dispose(),s.particles.material.dispose(),s.flash&&(this.scene.remove(s.flash),s.flash.geometry.dispose(),s.flash.material.dispose()),this.implosions.splice(i,1);continue}if(s.age<=s.maxAge){const a=s.particles.geometry.attributes.position,o=s.particles.geometry.attributes.velocity,l=1+s.age*.02;for(let h=0;hs.maxAge){const a=(s.age-s.maxAge)/20;s.flash.material.opacity=Math.max(0,1-a),s.flash.scale.setScalar(1+a*3)}}for(let i=this.shockwaves.length-1;i>=0;i--){const s=this.shockwaves[i];if(s.age++,s.age>s.maxAge){this.scene.remove(s.mesh),s.mesh.geometry.dispose(),s.mesh.material.dispose(),this.shockwaves.splice(i,1);continue}const a=s.age/s.maxAge;s.mesh.scale.setScalar(1+a*20),s.mesh.material.opacity=.8*(1-a),s.mesh.lookAt(t.position)}for(let i=this.connectionFlashes.length-1;i>=0;i--){const s=this.connectionFlashes[i];if(s.intensity-=.015,s.intensity<=0){this.scene.remove(s.line),s.line.geometry.dispose(),s.line.material.dispose(),this.connectionFlashes.splice(i,1);continue}s.line.material.opacity=s.intensity}for(let i=this.birthOrbs.length-1;i>=0;i--){const s=this.birthOrbs[i];s.age++;const a=s.gestationFrames+s.flightFrames,o=s.sprite.material,l=s.core.material,c=s.getTargetPos();if(c)s.lastTargetPos.copy(c);else if(s.age>s.gestationFrames&&!s.aborted){s.aborted=!0;const h=s.sprite.position;o.color.setRGB(1,.15,.2),l.color.setRGB(1,.6,.6),this.createImplosion(h,new ne(16721203)),s.arriveFired=!0,s.age=a+1}if(s.age<=s.gestationFrames){const h=s.age/s.gestationFrames,u=1-Math.pow(1-h,3),f=.85+Math.sin(s.age*.35)*.15,d=.5+u*4.5*f,p=.2+u*1.8*f;s.sprite.scale.set(d,d,1),s.core.scale.set(p,p,1),o.opacity=u*.95,l.opacity=u,o.color.copy(s.color).multiplyScalar(.7+u*.3),s.sprite.position.copy(s.startPos),s.core.position.copy(s.startPos)}else if(s.age<=a){const h=(s.age-s.gestationFrames)/s.flightFrames,u=h<.5?2*h*h:1-Math.pow(-2*h+2,2)/2,f=s.startPos,d=s.lastTargetPos,p=d.x-f.x,_=d.y-f.y,g=d.z-f.z,m=Math.sqrt(p*p+_*_+g*g),y=(f.x+d.x)*.5,v=(f.y+d.y)*.5+30+m*.15,x=(f.z+d.z)*.5,w=1-u,T=w*w,C=2*w*u,P=u*u,S=T*f.x+C*y+P*d.x,M=T*f.y+C*v+P*d.y,D=T*f.z+C*x+P*d.z;s.sprite.position.set(S,M,D),s.core.position.set(S,M,D);const G=1-u*.35;s.sprite.scale.setScalar(5*G),s.core.scale.setScalar(2*G),o.opacity=.95,l.opacity=1,o.color.copy(s.color)}else if(s.arriveFired){const h=s.age-a,u=Math.max(0,1-h/8);o.opacity=.95*u,l.opacity=1*u,s.sprite.scale.setScalar(5*(1+(1-u)*2)),u<=0&&(this.scene.remove(s.sprite),this.scene.remove(s.core),o.dispose(),l.dispose(),this.birthOrbs.splice(i,1))}else{s.arriveFired=!0;try{s.onArrive()}catch(h){console.warn("[birth-orb] onArrive threw",h)}}}}dispose(){for(const e of this.spawnBursts)this.scene.remove(e.particles),e.particles.geometry.dispose(),e.particles.material.dispose();for(const e of this.rainbowBursts)this.scene.remove(e.particles),e.particles.geometry.dispose(),e.particles.material.dispose();for(const e of this.implosions)this.scene.remove(e.particles),e.particles.geometry.dispose(),e.particles.material.dispose(),e.flash&&(this.scene.remove(e.flash),e.flash.geometry.dispose(),e.flash.material.dispose());for(const e of this.shockwaves)this.scene.remove(e.mesh),e.mesh.geometry.dispose(),e.mesh.material.dispose();for(const e of this.connectionFlashes)this.scene.remove(e.line),e.line.geometry.dispose(),e.line.material.dispose();for(const e of this.birthOrbs)this.scene.remove(e.sprite),this.scene.remove(e.core),e.sprite.material.dispose(),e.core.material.dispose();this.pulseEffects=[],this.spawnBursts=[],this.rainbowBursts=[],this.rippleWaves=[],this.implosions=[],this.shockwaves=[],this.connectionFlashes=[],this.birthOrbs=[]}}const jn={bloomStrength:.8,rotateSpeed:.3,fogColor:328976,fogDensity:.008,nebulaIntensity:0,chromaticIntensity:.002,vignetteRadius:.9,breatheAmplitude:1},bi={bloomStrength:1.8,rotateSpeed:.08,fogColor:656672,fogDensity:.006,nebulaIntensity:1,chromaticIntensity:.005,vignetteRadius:.7,breatheAmplitude:2};class mM{constructor(){ke(this,"active",!1);ke(this,"transition",0);ke(this,"transitionSpeed",.008);ke(this,"current");ke(this,"auroraHue",0);this.current={...jn}}setActive(e){this.active=e}update(e,t,n,i,s){const a=this.active?1:0;this.transition+=(a-this.transition)*this.transitionSpeed*60*(1/60),this.transition=Math.max(0,Math.min(1,this.transition));const o=this.transition;this.current.bloomStrength=this.lerp(jn.bloomStrength,bi.bloomStrength,o),this.current.rotateSpeed=this.lerp(jn.rotateSpeed,bi.rotateSpeed,o),this.current.fogDensity=this.lerp(jn.fogDensity,bi.fogDensity,o),this.current.nebulaIntensity=this.lerp(jn.nebulaIntensity,bi.nebulaIntensity,o),this.current.chromaticIntensity=this.lerp(jn.chromaticIntensity,bi.chromaticIntensity,o),this.current.vignetteRadius=this.lerp(jn.vignetteRadius,bi.vignetteRadius,o),this.current.breatheAmplitude=this.lerp(jn.breatheAmplitude,bi.breatheAmplitude,o),t.strength=this.current.bloomStrength,n.autoRotateSpeed=this.current.rotateSpeed;const l=new ne(jn.fogColor),c=new ne(bi.fogColor),h=l.clone().lerp(c,o);if(e.fog=new Yr(h,this.current.fogDensity),o>.01){this.auroraHue=s*.1%1;const u=new ne().setHSL(.75+this.auroraHue*.15,.8,.5),f=new ne().setHSL(.55+this.auroraHue*.2,.7,.4);i.point1.color.lerp(u,o*.3),i.point2.color.lerp(f,o*.3)}else i.point1.color.set(6514417),i.point2.color.set(11032055)}lerp(e,t,n){return e+(t-e)*n}}const gM=50,Fr=[];function _M(r,e,t){const n=r.tags??[],i=r.type??"";let s=null,a=0;for(const o of e){let l=0;o.type===i&&(l+=2);for(const c of o.tags)n.includes(c)&&(l+=1);l>a&&(a=l,s=o.id)}if(s&&a>0){const o=t.get(s);if(o)return new A(o.x+(Math.random()-.5)*10,o.y+(Math.random()-.5)*10,o.z+(Math.random()-.5)*10)}return new A((Math.random()-.5)*40,(Math.random()-.5)*40,(Math.random()-.5)*40)}function vM(r,e){if(Fr.length<=gM)return;const t=Fr.shift();r.edgeManager.removeEdgesForNode(t),r.nodeManager.removeNode(t),r.forceSim.removeNode(t),r.onMutation({type:"edgesRemoved",nodeId:t}),r.onMutation({type:"nodeRemoved",nodeId:t});const n=e.findIndex(i=>i.id===t);n!==-1&&e.splice(n,1)}function xM(r,e,t){var u,f;const{effects:n,nodeManager:i,edgeManager:s,forceSim:a,camera:o,onMutation:l}=e,c=i.positions,h=i.meshMap;switch(r.type){case"MemoryCreated":{const d=r.data;if(!d.id)break;const p={id:d.id,label:(d.content??"").slice(0,60),type:d.node_type??"fact",retention:Math.max(0,Math.min(1,d.retention??.9)),tags:d.tags??[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),isCenter:!1},_=_M(p,t,c),g=i.addNode(p,_,{isBirthRitual:!0});a.addNode(d.id,g),Fr.push(d.id),vM(e,t);const m=new ne(Il[p.type]||"#00ffd1"),y=m.clone();y.offsetHSL(.15,0,0),n.createBirthOrb(o,m,()=>i.positions.get(p.id),()=>{i.igniteNode(p.id);const v=i.positions.get(p.id)??_,x=i.meshMap.get(p.id);x&&x.scale.multiplyScalar(1.8),n.createRainbowBurst(v,m),n.createShockwave(v,m,o),n.createShockwave(v,y,o),n.createRippleWave(v)}),l({type:"nodeAdded",node:p});break}case"ConnectionDiscovered":{const d=r.data;if(!d.source_id||!d.target_id)break;const p=c.get(d.source_id),_=c.get(d.target_id),g={source:d.source_id,target:d.target_id,weight:d.weight??.5,type:d.connection_type??"semantic"};s.addEdge(g,c),p&&_&&n.createConnectionFlash(p,_,new ne(54527)),d.source_id&&h.has(d.source_id)&&n.addPulse(d.source_id,1,new ne(54527),.02),d.target_id&&h.has(d.target_id)&&n.addPulse(d.target_id,1,new ne(54527),.02),l({type:"edgeAdded",edge:g});break}case"MemoryDeleted":{const d=r.data;if(!d.id)break;const p=c.get(d.id);if(p){const g=new ne(16729943);n.createImplosion(p,g)}s.removeEdgesForNode(d.id),i.removeNode(d.id),a.removeNode(d.id);const _=Fr.indexOf(d.id);_!==-1&&Fr.splice(_,1),l({type:"edgesRemoved",nodeId:d.id}),l({type:"nodeRemoved",nodeId:d.id});break}case"MemoryPromoted":{const d=r.data,p=d==null?void 0:d.id;if(!p)break;const _=d.new_retention??.95;if(h.has(p)){i.growNode(p,_),n.addPulse(p,1.2,new ne(65416),.01);const g=c.get(p);g&&(n.createShockwave(g,new ne(65416),o),n.createSpawnBurst(g,new ne(65416))),l({type:"nodeUpdated",nodeId:p,retention:_})}break}case"MemoryDemoted":{const d=r.data,p=d==null?void 0:d.id;if(!p)break;const _=d.new_retention??.3;h.has(p)&&(i.growNode(p,_),n.addPulse(p,.8,new ne(16729943),.03),l({type:"nodeUpdated",nodeId:p,retention:_}));break}case"MemoryUpdated":{const d=r.data,p=d==null?void 0:d.id;if(!p||!h.has(p))break;n.addPulse(p,.6,new ne(8490232),.02),d.retention!==void 0&&(i.growNode(p,d.retention),l({type:"nodeUpdated",nodeId:p,retention:d.retention}));break}case"SearchPerformed":{h.forEach((d,p)=>{n.addPulse(p,.6+Math.random()*.4,new ne(8490232),.02)});break}case"DreamStarted":{h.forEach((d,p)=>{n.addPulse(p,1,new ne(11032055),.005)});break}case"DreamProgress":{const d=(u=r.data)==null?void 0:u.memory_id;d&&h.has(d)&&n.addPulse(d,1.5,new ne(12616956),.01);break}case"DreamCompleted":{n.createSpawnBurst(new A(0,0,0),new ne(11032055)),n.createShockwave(new A(0,0,0),new ne(11032055),o);break}case"RetentionDecayed":{const d=(f=r.data)==null?void 0:f.id;d&&h.has(d)&&n.addPulse(d,.8,new ne(16729943),.03);break}case"ConsolidationCompleted":{h.forEach((d,p)=>{n.addPulse(p,.4+Math.random()*.3,new ne(16758784),.015)});break}case"ActivationSpread":{const d=r.data;if(d.source_id&&d.target_ids){const p=c.get(d.source_id);if(p)for(const _ of d.target_ids){const g=c.get(_);g&&n.createConnectionFlash(p,g,new ne(1370310))}}break}case"MemorySuppressed":{const d=r.data;if(!d.id)break;const p=c.get(d.id);if(p){n.createImplosion(p,new ne(11032055));const _=Math.max(1,d.suppression_count??1),g=Math.min(.4+_*.15,1);n.addPulse(d.id,g,new ne(11032055),.04)}break}case"MemoryUnsuppressed":{const d=r.data;if(!d.id)break;const p=c.get(d.id);p&&h.has(d.id)&&(n.createRainbowBurst(p,new ne(65416)),n.addPulse(d.id,1,new ne(65416),.02));break}case"Rac1CascadeSwept":{const p=r.data.neighbors_affected??0;if(p===0)break;const _=Array.from(h.keys()),g=Math.min(p,_.length,12);for(let m=0;m"u")return eo;const r=localStorage.getItem(hf);if(r===null)return eo;const e=Number(r);return Number.isFinite(e)?Math.min(Ec,Math.max(wc,e)):eo}const ji=IM();function IM(){let r=Qe(!1),e=Qe(Al(new Date)),t=Qe(!1),n=Qe(1),i=Qe(!1),s=Qe(Al(RM()));return{get temporalEnabled(){return L(r)},set temporalEnabled(a){le(r,a,!0)},get temporalDate(){return L(e)},set temporalDate(a){le(e,a,!0)},get temporalPlaying(){return L(t)},set temporalPlaying(a){le(t,a,!0)},get temporalSpeed(){return L(n)},set temporalSpeed(a){le(n,a,!0)},get dreamMode(){return L(i)},set dreamMode(a){le(i,a,!0)},get brightness(){return L(s)},set brightness(a){const o=Math.min(Ec,Math.max(wc,a));if(le(s,o,!0),typeof localStorage<"u")try{localStorage.setItem(hf,String(o))}catch{}},brightnessMin:wc,brightnessMax:Ec,brightnessDefault:eo}}var PM=ut('
');function DM(r,e){var G;sr(e,!0);let t=Dr(e,"events",19,()=>[]),n=Dr(e,"isDreaming",3,!1),i=Dr(e,"colorMode",3,"type");Ga(()=>{u==null||u.setColorMode(i())});let s,a,o,l=typeof window<"u"&&((G=window.matchMedia)==null?void 0:G.call(window,"(prefers-reduced-motion: reduce)").matches),c=null;function h(F){l=F.matches,a!=null&&a.controls&&(a.controls.autoRotate=!l)}let u,f,d,p,_,g,m,y,v=null,x=[];od(()=>{var J;a=tM(s),l&&(a.controls.autoRotate=!1),typeof window<"u"&&window.matchMedia&&(c=window.matchMedia("(prefers-reduced-motion: reduce)"),(J=c.addEventListener)==null||J.call(c,"change",h)),m=bM(a.scene).material,y=AM(a.composer),d=new fM(a.scene),u=new hM,u.colorMode=i(),f=new dM,p=new pM(a.scene),g=new mM;const V=u.createNodes(e.nodes);f.createEdges(e.edges,V),_=new sM(V),x=[...e.nodes],a.scene.add(f.group),a.scene.add(u.group),T(),window.addEventListener("resize",P),s.addEventListener("pointermove",S),s.addEventListener("click",M)}),Ac(()=>{var F;cancelAnimationFrame(o),window.removeEventListener("resize",P),(F=c==null?void 0:c.removeEventListener)==null||F.call(c,"change",h),s==null||s.removeEventListener("pointermove",S),s==null||s.removeEventListener("click",M),p==null||p.dispose(),d==null||d.dispose(),u==null||u.dispose(),f==null||f.dispose(),a&&iM(a)});let w=0;function T(){o=requestAnimationFrame(T);const F=performance.now();w===0&&(w=F);const V=F-w;if(V<16)return;w=F-V%16;const J=F*.001;_.tick(e.edges),u.updatePositions(),f.updatePositions(u.positions),f.animateEdges(u.positions),d.animate(J),u.animate(J,x,a.camera,ji.brightness),g.setActive(n()),g.update(a.scene,a.bloomPass,a.controls,a.lights,J),SM(m,J,g.current.nebulaIntensity,s.clientWidth,s.clientHeight),CM(y,J,g.current.nebulaIntensity),C(),p.update(u.meshMap,a.camera,u.positions),a.controls.update(),a.composer.render()}function C(){if(!t()||t().length===0)return;const F=[];for(const J of t()){if(J===v)break;F.push(J)}if(F.length===0)return;if(F.length===t().length&&t().length>=200){console.warn("[vestige] Event horizon overflow: dropping visuals for",F.length,"events"),v=t()[0];return}v=t()[0];const V={effects:p,nodeManager:u,edgeManager:f,forceSim:_,camera:a.camera,onMutation:J=>{var q;J.type==="nodeAdded"?x=[...x,J.node]:J.type==="nodeRemoved"&&(x=x.filter(se=>se.id!==J.nodeId)),(q=e.onGraphMutation)==null||q.call(e,J)}};for(let J=F.length-1;J>=0;J--)xM(F[J],V,x)}function P(){!s||!a||nM(a,s)}function S(F){const V=s.getBoundingClientRect();a.mouse.x=(F.clientX-V.left)/V.width*2-1,a.mouse.y=-((F.clientY-V.top)/V.height)*2+1,a.raycaster.setFromCamera(a.mouse,a.camera);const J=a.raycaster.intersectObjects(u.getMeshes());J.length>0?(u.hoveredNode=J[0].object.userData.nodeId,s.style.cursor="pointer"):(u.hoveredNode=null,s.style.cursor="grab")}function M(){var F;if(u.hoveredNode){u.selectedNode=u.hoveredNode,(F=e.onSelect)==null||F.call(e,u.hoveredNode);const V=u.positions.get(u.hoveredNode);V&&a.controls.target.lerp(V.clone(),.5)}}var D=PM();Rl(D,F=>s=F,()=>s),ot(r,D),rr()}var LM=ut('
'),UM=ut('
');function NM(r,e){sr(e,!0);let t=Dr(e,"width",3,240),n=Dr(e,"height",3,80);function i(g){return e.stability<=0?0:Math.exp(-g/e.stability)}let s=ei(()=>{const g=[],m=Math.max(e.stability*3,30),y=4,v=t()-y*2,x=n()-y*2;for(let w=0;w<=50;w++){const T=w/50*m,C=i(T),P=y+w/50*v,S=y+(1-C)*x;g.push(`${w===0?"M":"L"}${P.toFixed(1)},${S.toFixed(1)}`)}return g.join(" ")}),a=ei(()=>[{label:"Now",days:0,value:e.retention},{label:"1d",days:1,value:i(1)},{label:"7d",days:7,value:i(7)},{label:"30d",days:30,value:i(30)}]);function o(g){return g>.7?"#10b981":g>.4?"#f59e0b":"#ef4444"}var l=UM(),c=xe(l),h=xe(c),u=Ee(h),f=Ee(u),d=Ee(f),p=Ee(d);Or(),fe(c);var _=Ee(c,2);Pr(_,21,()=>L(a),Wa,(g,m)=>{var y=LM(),v=xe(y),x=xe(v);fe(v);var w=Ee(v,2),T=xe(w);fe(w),fe(y),Pt((C,P)=>{ct(x,`${L(m).label??""}:`),zr(w,`color: ${C??""}`),ct(T,`${P??""}%`)},[()=>o(L(m).value),()=>(L(m).value*100).toFixed(0)]),ot(g,y)}),fe(_),fe(l),Pt(g=>{Rt(c,"width",t()),Rt(c,"height",n()),Rt(c,"viewBox",`0 0 ${t()??""} ${n()??""}`),Rt(h,"y1",4+(n()-8)*.5),Rt(h,"x2",t()-4),Rt(h,"y2",4+(n()-8)*.5),Rt(u,"y1",4+(n()-8)*.8),Rt(u,"x2",t()-4),Rt(u,"y2",4+(n()-8)*.8),Rt(f,"d",L(s)),Rt(d,"d",`${L(s)??""} L${t()-4},${n()-4} L4,${n()-4} Z`),Rt(p,"cy",4+(1-e.retention)*(n()-8)),Rt(p,"fill",g)},[()=>o(e.retention)]),ot(r,l),rr()}function ad(r,e,t){const n=t.getTime(),i=new Set,s=new Map,a=r.filter(l=>{const c=new Date(l.createdAt).getTime();if(c<=n){i.add(l.id);const h=n-c,u=1440*60*1e3,f=hi.has(l.source)&&i.has(l.target));return{visibleNodes:a,visibleEdges:o,nodeOpacities:s}}function FM(r){if(r.length===0){const n=new Date;return{oldest:n,newest:n}}let e=1/0,t=-1/0;for(const n of r){const i=new Date(n.createdAt).getTime();it&&(t=i)}return{oldest:new Date(e),newest:new Date(t)}}var OM=ut(`
`),BM=ut('');function zM(r,e){sr(e,!0);let t=Qe(!1),n=Qe(!1),i=Qe(1),s=Qe(100),a,o=0,l=ei(()=>FM(e.nodes)),c=ei(()=>{const v=L(l).oldest.getTime(),w=L(l).newest.getTime()-v||1;return new Date(v+L(s)/100*w)});function h(v){return v.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function u(){le(t,!L(t)),e.onToggle(L(t)),L(t)&&(le(s,100),e.onDateChange(L(c)))}function f(){le(n,!L(n)),L(n)?(le(s,0),o=performance.now(),d()):cancelAnimationFrame(a)}function d(){L(n)&&(a=requestAnimationFrame(v=>{const x=(v-o)/1e3;o=v;const w=L(l).oldest.getTime(),C=(L(l).newest.getTime()-w)/(1440*60*1e3)||1,P=L(i)/C*100;if(le(s,Math.min(100,L(s)+P*x),!0),e.onDateChange(L(c)),L(s)>=100){le(n,!1);return}d()}))}function p(){e.onDateChange(L(c))}Ac(()=>{le(n,!1),cancelAnimationFrame(a)});var _=mf(),g=no(_);{var m=v=>{var x=OM(),w=xe(x),T=xe(w),C=xe(T),P=xe(C),S=xe(P,!0);fe(P);var M=Ee(P,2),D=xe(M);D.value=D.__value=1;var G=Ee(D);G.value=G.__value=7;var F=Ee(G);F.value=F.__value=30,fe(M),fe(C);var V=Ee(C,2),J=xe(V,!0);fe(V);var q=Ee(V,2);fe(T);var se=Ee(T,2);Br(se);var Z=Ee(se,2),_e=xe(Z),be=xe(_e,!0);fe(_e);var Re=Ee(_e,2),Ge=xe(Re,!0);fe(Re),fe(Z),fe(w),fe(x),Pt((it,Q,ue)=>{ct(S,L(n)?"⏸":"▶"),ct(J,it),ct(be,Q),ct(Ge,ue)},[()=>h(L(c)),()=>h(L(l).oldest),()=>h(L(l).newest)]),Ut("click",P,f),Mf(M,()=>L(i),it=>le(i,it)),Ut("click",q,u),Ut("input",se,p),Cl(se,()=>L(s),it=>le(s,it)),ot(v,x)},y=v=>{var x=BM();Ut("click",x,u),ot(v,x)};It(g,v=>{L(t)?v(m):v(y,!1)})}ot(r,_),rr()}Cc(["click","input"]);var kM=ut('
'),VM=ut('
FSRS accessibility
');function HM(r,e){sr(e,!1);const t=["active","dormant","silent","unavailable"];bf();var n=VM(),i=Ee(xe(n),2);Pr(i,1,()=>t,s=>s,(s,a)=>{var o=kM(),l=xe(o),c=Ee(l,2),h=xe(c,!0);fe(c);var u=Ee(c,2),f=xe(u,!0);fe(u),fe(o),Pt(d=>{zr(l,`background: ${bc[L(a)]??""}; box-shadow: 0 0 6px ${bc[L(a)]??""}55;`),ct(h,L(a)),ct(f,d)},[()=>{var d;return((d=aM[L(a)].match(/\(([^)]+)\)/))==null?void 0:d[1])??""}]),ot(s,o)}),fe(n),ot(r,n),rr()}function uf(r){var t,n;const e={};for(const i of r)(e[t=i.source]??(e[t]=[])).push({edge:i,otherId:i.target}),(e[n=i.target]??(e[n]=[])).push({edge:i,otherId:i.source});for(const i of Object.keys(e))e[i].sort((s,a)=>(a.edge.weight??0)-(s.edge.weight??0));return e}function to(r){const e=(r.type??"").toLowerCase();return e.includes("contradict")||e.includes("conflict")||e.includes("supersede")}function Ws(r){const e=Date.parse(r.updatedAt||r.createdAt||"");return Number.isFinite(e)?e:0}function GM(r,e,t,n=7){var g;const i=new Map(r.map(m=>[m.id,m])),s={beats:[],centerId:t,pivoted:!1,flowEdges:[]};if(r.length===0)return s;const a=uf(e),o=i.has(t);let l=o?t:"";l||(l=((g=r.find(m=>m.isCenter))==null?void 0:g.id)??""),l||(l=r.map(m=>{var y;return{id:m.id,deg:((y=a[m.id])==null?void 0:y.length)??0}}).sort((m,y)=>y.deg-m.deg)[0].id);const c=i.get(l);if(!c)return s;const h=!o,u=new Set([l]),f=[{nodeId:l,node:c,viaEdge:null,kind:"origin",intensity:1}],d=[];let p=l,_=!1;for(;f.length!u.has(x.otherId)&&to(x.edge)),y&&(_=!0)),y||(y=m.find(x=>!u.has(x.otherId))),!y){const x=r.filter(T=>!u.has(T.id)).sort((T,C)=>Ws(C)-Ws(T));if(x.length===0)break;const w=x[0];u.add(w.id),f.push({nodeId:w.id,node:w,viaEdge:null,kind:"bridge",intensity:.6}),p=w.id;continue}const v=i.get(y.otherId);if(!v){u.add(y.otherId);continue}u.add(v.id),d.push(y.edge),f.push({nodeId:v.id,node:v,viaEdge:y.edge,kind:to(y.edge)?"contradiction":"connection",intensity:to(y.edge)?1:Math.min(1,.55+(y.edge.weight??0)*.45)}),p=v.id}if(f.lengthv.id!==m).sort((v,x)=>Ws(x)-Ws(v))[0];y&&!f.some(v=>v.nodeId===y.id)&&f.push({nodeId:y.id,node:y,viaEdge:null,kind:"recent",intensity:.8})}return{beats:f,centerId:l,pivoted:h,flowEdges:d}}const jt=new A,WM=new A(0,1,0),XM=new A(0,0,0);class qM{constructor(e,t,n,i,s={},a={}){ke(this,"camera");ke(this,"target");ke(this,"positions");ke(this,"path");ke(this,"cb");ke(this,"opts");ke(this,"phase","idle");ke(this,"beatIndex",0);ke(this,"phaseElapsed",0);ke(this,"fromPos",new A);ke(this,"toPos",new A);ke(this,"fromTarget",new A);ke(this,"toTarget",new A);this.camera=e,this.target=t,this.positions=n,this.path=i,this.cb=s,this.opts={flightSeconds:a.flightSeconds??2.4,dwellSeconds:a.dwellSeconds??3.2,standoff:a.standoff??26,reducedMotion:a.reducedMotion??!1,shots:a.shots??[],centerOnOrigin:a.centerOnOrigin??!1}}shotAt(e){return this.opts.shots[e]??null}flightSecondsAt(e){var t;return((t=this.shotAt(e))==null?void 0:t.flightSeconds)??this.opts.flightSeconds}dwellSecondsAt(e){var t;return((t=this.shotAt(e))==null?void 0:t.dwellSeconds)??this.opts.dwellSeconds}get totalBeats(){return this.path.beats.length}get isRunning(){return this.phase!=="idle"&&this.phase!=="done"}start(){var e,t;if(this.path.beats.length===0){this.phase="done",(t=(e=this.cb).onComplete)==null||t.call(e);return}this.beatIndex=0,this.beginFlightTo(0)}stop(){this.phase="done"}focalPoint(e){return this.opts.centerOnOrigin?XM:this.positions.get(e.nodeId)??null}framePosition(e,t,n){const i=this.focalPoint(e);if(!i)return n.copy(this.camera.position);const s=this.shotAt(t);jt.copy(this.camera.position).sub(i),jt.lengthSq()<1e-4&&jt.set(0,.4,1),jt.normalize();let a=.35;s&&(s.angle==="low"?a=-.45:s.angle==="high"&&(a=.7)),jt.addScaledVector(WM,a).normalize();let o=(s==null?void 0:s.standoff)??this.opts.standoff;return s&&(s.move==="push_in"?o*=.7:s.move==="pull_back"?o*=1.5:s.move==="crane"&&(o*=1.8)),this.opts.centerOnOrigin&&(o=Math.max(31,Math.min(43,o))),n.copy(i).addScaledVector(jt,o)}beginFlightTo(e){var a,o;const t=this.path.beats[e],n=this.focalPoint(t),i=this.shotAt(e);this.fromPos.copy(this.camera.position),this.fromTarget.copy(this.target),this.framePosition(t,e,this.toPos),this.toTarget.copy(n??this.target),this.phaseElapsed=0,this.opts.reducedMotion||(i==null?void 0:i.cut)==="hard_cut"||(i==null?void 0:i.cut)==="match_cut"?(this.camera.position.copy(this.toPos),this.target.copy(this.toTarget),this.phase="dwelling",(o=(a=this.cb).onBeat)==null||o.call(a,t,e,i)):this.phase="flying"}update(e){var o,l,c,h,u,f,d,p,_;if(this.phase==="idle"||this.phase==="done")return;const t=Math.max(0,Math.min(e,.05));this.phaseElapsed+=t;const n=this.flightSecondsAt(this.beatIndex),i=this.dwellSecondsAt(this.beatIndex);if(this.phase==="flying"){const g=Math.min(1,this.phaseElapsed/n),m=YM(g);this.camera.position.lerpVectors(this.fromPos,this.toPos,m),this.target.lerpVectors(this.fromTarget,this.toTarget,m),this.applyDutch(this.beatIndex,m),g>=1&&(this.phase="dwelling",this.phaseElapsed=0,(l=(o=this.cb).onBeat)==null||l.call(o,this.path.beats[this.beatIndex],this.beatIndex,this.shotAt(this.beatIndex)))}else if(this.phase==="dwelling"){if(!this.opts.reducedMotion){const g=this.focalPoint(this.path.beats[this.beatIndex]);g&&(this.target.lerp(g,.02),((c=this.shotAt(this.beatIndex))==null?void 0:c.move)==="orbit"&&this.orbitAround(g,t*.35))}if(this.phaseElapsed>=i){const g=this.beatIndex+1;if(g>=this.path.beats.length){this.phase="done",(u=(h=this.cb).onProgress)==null||u.call(h,1),(d=(f=this.cb).onComplete)==null||d.call(f);return}this.beatIndex=g,this.beginFlightTo(g)}}const s=this.path.beats.length>0?1/this.path.beats.length:0,a=this.phase==="flying"?Math.min(1,this.phaseElapsed/n)*.5:.5+Math.min(1,this.phaseElapsed/i)*.5;(_=(p=this.cb).onProgress)==null||_.call(p,Math.min(1,this.beatIndex*s+a*s))}orbitAround(e,t){jt.copy(this.camera.position).sub(e);const n=Math.cos(t),i=Math.sin(t),s=jt.x*n-jt.z*i,a=jt.x*i+jt.z*n;jt.x=s,jt.z=a,this.camera.position.copy(e).add(jt)}applyDutch(e,t){var s;const i=(((s=this.shotAt(e))==null?void 0:s.dutch)??0)*t;jt.set(0,0,-1).applyQuaternion(this.camera.quaternion),this.camera.up.set(0,1,0).applyAxisAngle(jt,i)}}function YM(r){return r<.5?4*r*r*r:1-Math.pow(-2*r+2,3)/2}const Tc={origin:"Origin",connection:"Connection",contradiction:"Tension",recent:"Now",bridge:"Jump",surprise:"Surprise"};function ZM(r,e=90){const t=(r??"").replace(/\s+/g," ").trim();return t.length<=e?t:t.slice(0,e-1).trimEnd()+"…"}function Tl(r){const e=(r??"memory").toLowerCase();return e.charAt(0).toUpperCase()+e.slice(1)}function df(r){return{source:"local-captions",beats:r.beats.map((t,n)=>{var o,l;const i=t.node,s=ZM(i.label||`(${Tl(i.type)} memory)`);let a;switch(t.kind){case"origin":a=`We begin at a ${Tl(i.type).toLowerCase()} the graph is centered on — "${s}".`;break;case"contradiction":{a=`This is held in tension with the last memory through ${(o=t.viaEdge)!=null&&o.type?t.viaEdge.type.replace(/_/g," "):"a conflict"}: "${s}".`;break}case"recent":a=`And where the mind is now — a recent memory: "${s}".`;break;case"bridge":a=`Crossing to a separate cluster — "${s}".`;break;default:{const c=((l=t.viaEdge)==null?void 0:l.weight)??0;a=`${c>.66?"strongly":c>.33?"closely":"loosely"} connected from there: a ${Tl(i.type).toLowerCase()} — "${s}".`}}return i.tags&&i.tags.length>0&&n>0&&(a+=` [${i.tags.slice(0,3).join(", ")}]`),{nodeId:t.nodeId,text:a,chip:Tc[t.kind]}})}}async function JM(r,e){const t=df(r);if(!e)return t;let n;try{const i=await Promise.race([e(),new Promise(l=>{n=setTimeout(()=>l(null),6e3)})]),s=Array.isArray(i)?i.filter(l=>!!l&&typeof l.nodeId=="string"&&typeof l.text=="string"&&l.text.trim().length>0):[];if(s.length===0)return t;const a=new Map(s.map(l=>[l.nodeId,l]));return{source:"backend-llm",beats:r.beats.map((l,c)=>{const h=a.get(l.nodeId);if(h){const u=typeof h.chip=="string"&&h.chip.trim()?h.chip:Tc[l.kind];return{nodeId:l.nodeId,text:h.text,chip:u}}return t.beats[c]??{nodeId:l.nodeId,text:l.node.label||"(unlabeled memory)",chip:Tc[l.kind]}})}}catch{return t}finally{n&&clearTimeout(n)}}function KM(r){const e=(r.type??"").toLowerCase();return e.includes("merge")||e.includes("supersede")||e.includes("duplicate")}function $M(r,e){const t=new Map;for(const n of r)t.set(n,0);for(const n of r){const i=[],s=new Map,a=new Map,o=new Map;for(const u of r)s.set(u,[]),a.set(u,0),o.set(u,-1);a.set(n,1),o.set(n,0);const l=[n];let c=0;for(;c0;){const u=i.pop();for(const f of s.get(u)??[]){const d=(a.get(f)??0)/(a.get(u)||1)*(1+(h.get(u)??0));h.set(f,(h.get(f)??0)+d)}u!==n&&t.set(u,(t.get(u)??0)+(h.get(u)??0))}}return t}function jM(r,e){const t=new Map;for(const l of r)t.set(l,l);const n=l=>{let c=l;for(;t.get(c)!==c;)c=t.get(c);let h=l;for(;t.get(h)!==c;){const u=t.get(h);t.set(h,c),h=u}return c},i=(l,c)=>{const h=n(l),u=n(c);h!==u&&t.set(h,u)};for(const l of e)t.has(l.source)&&t.has(l.target)&&i(l.source,l.target);const s=new Map,a=new Map;let o=0;for(const l of r){const c=n(l);s.has(c)||s.set(c,o++),a.set(l,s.get(c))}return{clusterOf:a,count:o}}function QM(r,e){var y;const t=r.map(v=>v.id),n=uf(e),i=[...r].sort((v,x)=>Ws(v)-Ws(x)),s=new Map;i.forEach((v,x)=>s.set(v.id,r.length>1?x/(r.length-1):1));const a=600;let o=t;t.length>a&&(o=[...t].sort((v,x)=>{var w,T;return(((w=n[x])==null?void 0:w.length)??0)-(((T=n[v])==null?void 0:T.length)??0)}).slice(0,a));const l=$M(o,n);let c=0;for(const v of l.values())c=Math.max(c,v);const{clusterOf:h,count:u}=jM(t,e),f=Math.max(1,...r.map(v=>v.suppression_count??0)),d=new Map;let p=t[0]??"",_=-1;for(const v of r){const x=c>0?(l.get(v.id)??0)/c:0;x>_&&(_=x,p=v.id),d.set(v.id,{nodeId:v.id,degree:((y=n[v.id])==null?void 0:y.length)??0,betweenness:x,clusterId:h.get(v.id)??0,recencyRank:s.get(v.id)??0,retention:Ha(v.retention??0),suppression:Ha((v.suppression_count??0)/f)})}const g=new Map;for(const v of t)g.set(v,new Set((n[v]??[]).map(x=>x.otherId)));const m=e.map(v=>{const x=g.get(v.source),w=g.get(v.target);let T=0;if(x&&w){const[M,D]=x.size{const h=t>1?c/(t-1):0,u=cb(h),f=e.nodes.get(l.nodeId),d=l.nodeId===e.peakBetweennessId,p=c===t-1,_=c===0;let g={nodeId:l.nodeId,move:"push_in",angle:"eye",cut:"fly",stormMode:"connection",tone:"curious",scoreCue:"motif",act:u,intensity:.6,tension:.3,why:"a connected memory"};return _&&(g={...g,move:"push_in",tone:"curious",tension:.25,stormMode:"anchor",why:"opening on the focal memory"}),(d||f&&f.betweenness>.6)&&(g={...g,move:"orbit",angle:"low",stormMode:"anchor",intensity:.75,tension:.45,tone:"awe",why:"low-angle orbit — the most load-bearing memory in the graph"}),l.kind==="contradiction"&&(g={...g,move:"push_in",angle:"eye",dutch:.28,cut:"hard_cut",stormMode:"contradiction",intensity:1,tension:.95,tone:"tense",scoreCue:"minor_drop",viaEdgeKey:l.viaEdge?`${l.viaEdge.source}->${l.viaEdge.target}`:void 0,why:"two memories in tension — a Dutch two-shot collision"}),l.kind==="surprise"&&(g={...g,move:"orbit",stormMode:"surprise",intensity:.85,tension:.6,tone:"awe",scoreCue:"motif",why:"a surprising, distant-but-plausible connection"}),f&&(f.retention<.35||f.suppression>.5)&&(g={...g,angle:"high",move:"pull_back",tone:"neutral",intensity:.4,why:"a fading memory — high-angle drift"}),l.kind==="recent"&&(g={...g,move:"push_in",tone:"resolved",tension:.4,why:"where the memory is now"}),p&&(g={...g,move:"crane",cut:"fly",stormMode:"anchor",tone:"awe",tension:.5,scoreCue:"major_resolve",why:"crane pull-back over the whole cluster — resolution"}),g}),i=r.beats.some(l=>l.kind==="contradiction")?"man_in_hole":"rags_to_riches";return{source:"deterministic",logline:`A short film about ${((o=r.beats[0])==null?void 0:o.node.label)??"a memory"} — ${t} shots through the graph${i==="man_in_hole"?", through a contradiction and out the other side":""}.`,arc:i,shots:n}}var ub=ut(''),db=ut(' '),fb=ut(' '),pb=ut('WebGPU'),mb=ut(' '),gb=ut(`
Director's plan

`),_b=ut('
'),vb=ut('

'),xb=ut('∞ dreaming'),yb=ut(''),Mb=ut('

',1),bb=ut(''),Sb=ut(' ',1);function wb(r,e){sr(e,!0);let t=Qe(!1),n=Qe("idle"),i=Qe(""),s=Qe(""),a=Qe(0),o=Qe(0),l=Qe(0),c=Qe(null),h=Qe(!1),u=Qe(!1),f=Qe(!1),d=Qe(!0),p=Qe(""),_=Qe(""),g=Qe("I"),m=Qe(0),y=Qe(""),v=Qe(null),x=Qe(void 0),w=null,T=null,C=null,P=null,S=0,M=0,D=null,G=0,F=Qe(null);const V=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,J=(k,X,W,ce)=>k+(X-k)*(1-Math.exp(-W*ce)),q={x:0,y:0},se={yaw:0,pitch:0};let Z=0,_e=0,be=0;const Re=2500,Ge=.35,it=.22,Q=()=>{be=performance.now()},ue=14;function Ie(k){const X=new Map,W=k.beats.length;for(let ce=0;ce1?ce/(W-1):.5)*2,Be=Math.sqrt(Math.max(0,1-ge*ge)),$=ce*2.399963;X.set(k.beats[ce].nodeId,new A(Math.cos($)*Be*ue,ge*ue*.5,Math.sin($)*Be*ue))}return X}function pe(k){if(!(!L(u)||typeof speechSynthesis>"u"))try{speechSynthesis.cancel();const X=new SpeechSynthesisUtterance(k);X.rate=.98,X.pitch=1,speechSynthesis.speak(X)}catch{}}function Oe(k){if(D&&clearInterval(D),le(i,""),V){le(i,k,!0);return}let X=0;D=setInterval(()=>{le(i,k.slice(0,++X),!0),X>=k.length&&D&&(clearInterval(D),D=null)},18)}function We(k){return k==="surprise"?"connection":k}function ze(k,X,W){var oe,ge;le(o,X+1);const ce=((oe=P==null?void 0:P.beats[X])==null?void 0:oe.text)??k.node.label??"";if(le(s,((ge=P==null?void 0:P.beats[X])==null?void 0:ge.chip)??"",!0),Oe(ce),pe(ce),W&&(le(_,W.why,!0),le(g,W.act,!0),le(m,W.tension,!0)),w&&L(h)){const Be=Je==null?void 0:Je.get(k.nodeId);if(Be){const ve=(W==null?void 0:W.stormMode)??"connection";w.transitionTo(We(ve),Be,(W==null?void 0:W.act)??"I",X)}const $=(W==null?void 0:W.tension)??0;w.setFlythrough(V?0:$*.8)}}let Je=null;async function te(){var ge,Be;if(cancelAnimationFrame(S),De(),D&&clearInterval(D),T==null||T.stop(),w==null||w.dispose(),w=null,T=null,P=null,G=0,le(_,""),le(y,""),le(v,null),le(g,"I"),le(m,0),le(t,!0),le(n,"planning"),le(p,"Planning a path through your memory…"),le(i,""),le(s,""),le(a,0),le(o,0),C=GM(e.nodes,e.edges,e.centerId,7),le(l,C.beats.length,!0),L(l)===0){le(p,"Not enough memory to compose a tour yet."),le(n,"done");return}Je=Ie(C);const k=QM(e.nodes,e.edges);le(v,hb(C,k),!0),le(y,L(v).logline,!0);const X=lb(L(v),C);if(le(g,((ge=X[0])==null?void 0:ge.act)??"I",!0),le(m,((Be=X[0])==null?void 0:Be.tension)??0,!0),P=await JM(C,L(f)?Ve():e.fetchBackendNarration),le(c,P.source,!0),le(h,!1),L(x))try{const{CinemaSandbox:$,isWebGPUSupported:ve}=await Sf(async()=>{const{CinemaSandbox:Y,isWebGPUSupported:ie}=await import("./Ma4NfFrG.js");return{CinemaSandbox:Y,isWebGPUSupported:ie}},__vite__mapDeps([0,1]),import.meta.url);ve()&&(w=new $(L(x)),await w.boot(),le(h,!0))}catch($){console.warn("[cinema] WebGPU sandbox unavailable, camera-only mode:",$),w=null,le(h,!1)}const W=L(x)&&L(x).clientHeight>0?L(x).clientWidth/L(x).clientHeight:16/9,ce=(w==null?void 0:w.cameraRef)??new kt(60,W,.1,2e3),oe=(w==null?void 0:w.target)??new A;T=new qM(ce,oe,Je,C,{onBeat:ze,onProgress:$=>le(a,$,!0),onComplete:()=>{le(n,"done"),le(p,V||!L(h)?"End of tour.":"∞ Dreaming — endless generative figures",!0),I()}},{reducedMotion:V,shots:X,centerOnOrigin:L(h)}),le(n,"playing"),le(p,L(h)?"Rendering 150k-particle semantic storm on WebGPU…":"Cinematic flythrough (captions mode).",!0),M=performance.now(),T.start(),de()}async function de(){const k=performance.now(),X=Math.max(0,Math.min(.05,(k-M)/1e3));M=k;try{T==null||T.update(X)}catch(ce){console.warn("[cinema] director error:",ce)}if(!V&&w&&L(h)){const ce=w.cameraRef,oe=performance.now()-be>Re,ge=oe?0:q.x*Ge,Be=oe?0:q.y*it,$=oe?1.5:9;se.yaw=J(se.yaw,ge,$,X),se.pitch=J(se.pitch,Be,$,X),oe&&(Z=J(Z,0,1.2,X)),_e=J(_e,Z,8,X);const ve=ce.position.clone(),Y=new xc().setFromVector3(ve);Y.theta+=se.yaw,Y.phi=bd.clamp(Y.phi+se.pitch,.2,Math.PI-.2),Y.radius*=1-_e*.35,ve.setFromSpherical(Y),ce.position.copy(ve)}const W=w;if(W&&L(h))try{await W.render(X),G=0}catch(ce){++G>=3&&w===W&&(console.warn("[cinema] WebGPU render failing, dropping to camera-only:",ce),le(h,!1),W.dispose(),w=null)}S=requestAnimationFrame(de)}function I(){V||!w||!L(h)||(De(),V||w==null||w.setFlythrough(.6),w==null||w.dreamBeat(),le(i,""),le(s,"Dreaming"),le(F,setInterval(()=>{if(!w||!L(h)){De();return}w.dreamBeat()},5500),!0))}function De(){L(F)&&(clearInterval(L(F)),le(F,null))}function re(){var k;cancelAnimationFrame(S),De(),D&&clearInterval(D),typeof speechSynthesis<"u"&&speechSynthesis.cancel(),w&&((k=w.setFlythrough)==null||k.call(w,0)),se.yaw=se.pitch=0,Z=_e=0,T==null||T.stop(),w==null||w.dispose(),w=null,T=null,le(t,!1),le(n,"idle"),le(h,!1)}let Ae=Qe(void 0);function me(k){k.key==="Escape"?(k.preventDefault(),re()):(k.key==="h"||k.key==="H")&&(k.preventDefault(),le(d,!L(d)))}Ga(()=>{L(t)&&L(Ae)&&L(Ae).focus()}),Ga(()=>{if(!(typeof document>"u"))return document.body.classList.toggle("cinema-open",L(t)),()=>document.body.classList.remove("cinema-open")}),Ga(()=>{if(!L(t)||V||!L(x))return;const k=L(x),X=($,ve,Y)=>Math.min(Y,Math.max(ve,$));k.style.touchAction="none";const W=$=>{q.x=$.clientX/window.innerWidth*2-1,q.y=-($.clientY/window.innerHeight)*2+1,Q()},ce=$=>{$.preventDefault(),Z=X(Z+$.deltaY*8e-4,-1,1),Q()};let oe=null;const ge=$=>{if($.touches.length===2){const ve=$.touches[0].clientX-$.touches[1].clientX,Y=$.touches[0].clientY-$.touches[1].clientY,ie=Math.hypot(ve,Y);oe!==null&&(Z=X(Z+(ie-oe)*.002,-1,1)),oe=ie,Q()}},Be=()=>{oe=null};return k.addEventListener("pointermove",W,{passive:!0}),k.addEventListener("wheel",ce,{passive:!1}),k.addEventListener("touchmove",ge,{passive:!0}),k.addEventListener("touchend",Be),()=>{k.removeEventListener("pointermove",W),k.removeEventListener("wheel",ce),k.removeEventListener("touchmove",ge),k.removeEventListener("touchend",Be)}});function Ve(){return async()=>{var k,X;if(!C)return null;try{le(p,"Loading on-device model (first run downloads weights)…");const ce=await import("@huggingface/transformers").catch(()=>null);if(!(ce!=null&&ce.pipeline))return null;const oe=await ce.pipeline("text-generation","onnx-community/Qwen2.5-0.5B-Instruct",{device:"webgpu",dtype:"q4"}),ge=df(C);le(p,"Narrating with the on-device model…");const Be=[];for(const $ of ge.beats){const ve=`You are narrating a cinematic tour of an AI's memory graph. In one vivid sentence, narrate this beat: "${$.text}"`,Y=await oe(ve,{max_new_tokens:48,temperature:.7,do_sample:!0}),ie=(X=(k=Y==null?void 0:Y[0])==null?void 0:k.generated_text)==null?void 0:X.replace(ve,"").trim();Be.push({nodeId:$.nodeId,chip:$.chip,text:ie&&ie.length>4?ie:$.text})}return Be}catch(W){return console.warn("[cinema] on-device narration failed, using local captions:",W),null}}}Ac(re);var Se=Sb(),R=no(Se),b=Ee(R,2);{var H=k=>{var X=bb(),W=xe(X);Rl(W,$=>le(x,$),()=>L(x));var ce=Ee(W,2);{var oe=$=>{var ve=ub();Ut("click",ve,()=>le(d,!0)),ot($,ve)};It(ce,$=>{L(d)||$(oe)})}var ge=Ee(ce,2);{var Be=$=>{var ve=Mb(),Y=no(ve),ie=xe(Y),ae=xe(ie);let Ne;var Pe=Ee(ae,2),Ke=xe(Pe,!0);fe(Pe);var U=Ee(Pe,2);{var ye=N=>{var z=db(),O=xe(z,!0);fe(z),Pt(()=>ct(O,L(v).source==="deterministic"?"Auteur (local)":"Auteur (AI)")),ot(N,z)};It(U,N=>{L(v)&&N(ye)})}var K=Ee(U,2);{var ee=N=>{var z=fb(),O=xe(z,!0);fe(z),Pt(()=>ct(O,L(c)==="backend-llm"?"AI narration":"Live captions")),ot(N,z)};It(K,N=>{L(c)&&N(ee)})}var we=Ee(K,2);{var Me=N=>{var z=pb();ot(N,z)};It(we,N=>{L(h)&&N(Me)})}var Ye=Ee(we,2);{var Mt=N=>{var z=mb(),O=xe(z);fe(z),Pt(()=>ct(O,`Act ${L(g)??""}`)),ot(N,z)};It(Ye,N=>{L(n)==="playing"&&N(Mt)})}fe(ie);var St=Ee(ie,2),at=xe(St),Yt=xe(at);Br(Yt),Or(),fe(at);var Ht=Ee(at,2),Di=xe(Ht);Br(Di),Or(),fe(Ht);var ui=Ee(Ht,2);Rl(ui,N=>le(Ae,N),()=>L(Ae)),fe(St),fe(Y);var En=Ee(Y,2);{var di=N=>{var z=gb(),O=Ee(xe(z),2),he=xe(O,!0);fe(O),fe(z),Pt(()=>ct(he,L(y))),ot(N,z)};It(En,N=>{L(n)==="planning"&&L(y)&&N(di)})}var Li=Ee(En,2),Wn=xe(Li);{var Xn=N=>{var z=_b(),O=xe(z,!0);fe(z),Pt(()=>ct(O,L(s))),ot(N,z)};It(Wn,N=>{L(s)&&N(Xn)})}var fi=Ee(Wn,2),Fn=xe(fi,!0);fe(fi);var Ui=Ee(fi,2);{var Zt=N=>{var z=vb(),O=xe(z);fe(z),Pt(()=>ct(O,`▸ ${L(_)??""}`)),ot(N,z)};It(Ui,N=>{L(_)&&L(n)==="playing"&&N(Zt)})}var Nt=Ee(Ui,2),mn=xe(Nt);fe(Nt);var Tn=Ee(Nt,2),pi=xe(Tn);{var fr=N=>{var z=xb();ot(N,z)},ds=N=>{var z=gf();Pt(()=>ct(z,`Beat ${L(o)??""} / ${L(l)??""}`)),ot(N,z)};It(pi,N=>{L(n)==="done"&&L(F)?N(fr):L(l)>0&&N(ds,1)})}var E=Ee(pi,2);{var B=N=>{var z=yb();Ut("click",z,te),ot(N,z)};It(E,N=>{L(n)==="done"&&N(B)})}fe(Tn),fe(Li),Pt(()=>{Ne=Ns(ae,1,"cinema-dot svelte-1uwqs3k",null,Ne,{active:L(n)==="playing"}),ct(Ke,L(p)),ct(Fn,L(i)),zr(mn,`width:${L(a)*100}%; --tension:${L(m)??""}`)}),ph(Yt,()=>L(u),N=>le(u,N)),ph(Di,()=>L(f),N=>le(f,N)),Ut("click",ui,re),ot($,ve)};It(ge,$=>{L(d)&&$(Be)})}fe(X),Ut("keydown",X,me),ot(k,X)};It(b,k=>{L(t)&&k(H)})}Ut("click",R,te),ot(r,Se),rr()}Cc(["click","keydown"]);var Eb=ut('

Weaving your memory graph…

'),Tb=ut(`

MCP Backend Offline

The Vestige MCP server isn't reachable on :3927. - The dashboard is running but has nothing to query.

Start the backend:
nohup bash -c 'tail -f /dev/null | VESTIGE_DASHBOARD_ENABLED=true ~/.local/bin/vestige-mcp' > /tmp/vestige.log 2>&1 & -disown
`),Ab=ut('

Your Mind Awaits

No memories yet — the moment Vestige starts remembering, your constellation will bloom here.

'),Cb=ut('

Your Mind Awaits

'),Rb=ut(' · · ',1),Ib=ut('
'),Pb=ut('
'),Db=ut('
AhaGraph
'),Lb=ut(' '),Ub=ut('
'),Nb=ut("
"),Fb=ut(`

Memory Detail

Retention Forecast
Explore Connections
`),Ob=ut(`
`);function Fw(r,e){sr(e,!0);const t=()=>yf(Ef,"$eventFeed",n),[n,i]=xf();let s=Qe(null),a=Qe(null),o=Qe(!0),l=Qe(""),c=Qe(!1),h=Qe(""),u=Qe(150);const f=[{value:"50",label:"50 nodes"},{value:"100",label:"100 nodes"},{value:"150",label:"150 nodes"},{value:"200",label:"200 nodes"}];let d=Qe("150");function p(Y){le(u,parseInt(Y,10),!0),S()}let _=Qe(!1),g=Qe(Al(new Date)),m=Qe("type");const y=Object.entries(Qa);let v=Qe(0),x=Qe(0),w=ei(()=>L(s)?L(_)?ad(L(s).nodes,L(s).edges,L(g)).visibleNodes:L(s).nodes:[]),T=ei(()=>L(s)?L(_)?ad(L(s).nodes,L(s).edges,L(g)).visibleEdges:L(s).edges:[]);function C(Y){if(L(s))switch(Y.type){case"nodeAdded":L(s).nodes=[...L(s).nodes,Y.node],L(s).nodeCount=L(s).nodes.length,le(v,L(s).nodeCount,!0);break;case"nodeRemoved":L(s).nodes=L(s).nodes.filter(ie=>ie.id!==Y.nodeId),L(s).nodeCount=L(s).nodes.length,le(v,L(s).nodeCount,!0);break;case"edgeAdded":L(s).edges=[...L(s).edges,Y.edge],L(s).edgeCount=L(s).edges.length,le(x,L(s).edgeCount,!0);break;case"edgesRemoved":L(s).edges=L(s).edges.filter(ie=>ie.source!==Y.nodeId&&ie.target!==Y.nodeId),L(s).edgeCount=L(s).edges.length,le(x,L(s).edgeCount,!0);break;case"nodeUpdated":{const ie=L(s).nodes.find(ae=>ae.id===Y.nodeId);ie&&(ie.retention=Y.retention);break}}}od(()=>{const Y=new URLSearchParams(window.location.search),ie=Y.get("colorMode");P(ie)&&le(m,ie,!0);const ae=Y.get("center");S(void 0,ae||void 0)});function P(Y){return Y==="type"||Y==="state"||Y==="ahagraph"}async function S(Y,ie){var ae;le(o,!0),le(l,"");try{const Ne=!Y&&!ie;if(le(s,await ms.graph({max_nodes:L(u),depth:3,query:Y||void 0,center_id:ie||void 0,sort:Ne?"recent":void 0}),!0),Ne&&L(s)&&L(s).nodeCount<=1&&L(s).edgeCount===0){const Pe=await ms.graph({max_nodes:L(u),depth:3,sort:"connected"});Pe&&Pe.nodeCount>L(s).nodeCount&&le(s,Pe,!0)}L(s)&&(le(v,L(s).nodeCount,!0),le(x,L(s).edgeCount,!0))}catch(Ne){const Pe=Ne instanceof Error?Ne.message:String(Ne),Ke=Pe.replace(/\/[\w./-]+\.(sqlite|rs|db|toml|lock)\b/g,"[path]").slice(0,200),U=Ne instanceof TypeError||/failed to fetch|NetworkError|load failed/i.test(Pe)||/^API 500:?\s*(Internal Server Error)?\s*$/i.test(Pe.trim()),ye=(((ae=L(s))==null?void 0:ae.nodeCount)??0)===0&&/not found|404|empty|no memor/i.test(Pe);U?le(l,"OFFLINE"):ye?le(l,"EMPTY"):le(l,`Failed to load graph: ${Ke}`)}finally{le(o,!1)}}async function M(){le(c,!0);try{await ms.dream(),await S()}catch{}finally{le(c,!1)}}async function D(Y){try{le(a,await ms.memories.get(Y),!0)}catch{le(a,null)}}function G(){L(h).trim()&&S(L(h))}var F=Ob(),V=xe(F);{var J=Y=>{var ie=Eb();ot(Y,ie)},q=Y=>{var ie=Tb(),ae=xe(ie),Ne=xe(ae),Pe=xe(Ne);ps(Pe,{name:"activation",size:52,strokeWidth:1.2}),fe(Ne);var Ke=Ee(Ne,8),U=xe(Ke),ye=Ee(U,2);fe(Ke),fe(ae),fe(ie),Pt(()=>Rt(ye,"href",`${mh??""}/settings`)),Ut("click",U,()=>S()),ot(Y,ie)},se=Y=>{var ie=Ab(),ae=xe(ie),Ne=xe(ae),Pe=xe(Ne);ps(Pe,{name:"graph",size:52,strokeWidth:1.2}),fe(Ne),Or(4),fe(ae),fe(ie),ot(Y,ie)},Z=Y=>{var ie=Cb(),ae=xe(ie),Ne=xe(ae),Pe=xe(Ne);ps(Pe,{name:"graph",size:52,strokeWidth:1.2}),fe(Ne);var Ke=Ee(Ne,4),U=xe(Ke,!0);fe(Ke),fe(ae),fe(ie),Pt(()=>ct(U,L(l))),ot(Y,ie)},_e=Y=>{DM(Y,{get nodes(){return L(w)},get edges(){return L(T)},get centerId(){return L(s).center_id},get events(){return t()},get isDreaming(){return L(c)},get colorMode(){return L(m)},onSelect:D,onGraphMutation:C})};It(V,Y=>{L(o)?Y(J):L(l)==="OFFLINE"?Y(q,1):L(l)==="EMPTY"?Y(se,2):L(l)?Y(Z,3):L(s)&&Y(_e,4)})}var be=Ee(V,2),Re=xe(be),Ge=xe(Re);Br(Ge);var it=Ee(Ge,2);fe(Re);var Q=Ee(Re,2),ue=xe(Q),Ie=xe(ue),pe=Ee(Ie,2),Oe=Ee(pe,2);fe(ue);var We=Ee(ue,2);wf(We,{get options(){return f},icon:"graph",class:"shrink-0",onChange:p,get value(){return L(d)},set value(Y){le(d,Y,!0)}});var ze=Ee(We,2),Je=Ee(xe(ze),2);Br(Je);var te=Ee(Je,2),de=xe(te);fe(te),fe(ze);var I=Ee(ze,2),De=xe(I),re=xe(De);ps(re,{name:"dreams",size:16}),fe(De);var Ae=Ee(De);fe(I);var me=Ee(I,2);{var Ve=Y=>{{let ie=ei(()=>{var ae;return((ae=L(s))==null?void 0:ae.center_id)??""});wb(Y,{get nodes(){return L(w)},get edges(){return L(T)},get centerId(){return L(ie)}})}};It(me,Y=>{L(w).length>0&&Y(Ve)})}var Se=Ee(me,2),R=xe(Se);ps(R,{name:"pulse",size:16}),fe(Se),fe(Q),fe(be);var b=Ee(be,2),H=xe(b);{var k=Y=>{var ie=Rb(),ae=no(ie),Ne=xe(ae);fe(ae);var Pe=Ee(ae,4),Ke=xe(Pe);fe(Pe);var U=Ee(Pe,4),ye=xe(U);fe(U),Pt(()=>{ct(Ne,`${L(v)??""} nodes`),ct(Ke,`${L(x)??""} edges`),ct(ye,`depth ${L(s).depth??""}`)}),ot(Y,ie)};It(H,Y=>{L(s)&&Y(k)})}fe(b);var X=Ee(b,2);{var W=Y=>{var ie=Ib(),ae=xe(ie);HM(ae,{}),fe(ie),ot(Y,ie)};It(X,Y=>{L(m)==="state"&&Y(W)})}var ce=Ee(X,2);{var oe=Y=>{var ie=Db(),ae=Ee(xe(ie),2);Pr(ae,21,()=>y,Wa,(Ne,Pe)=>{var Ke=ei(()=>_f(L(Pe),2));let U=()=>L(Ke)[0],ye=()=>L(Ke)[1];var K=Pb(),ee=xe(K),we=Ee(ee,2),Me=xe(we,!0);fe(we),fe(K),Pt(()=>{zr(ee,`background: ${ye()??""}`),ct(Me,oM[U()])}),ot(Ne,K)}),fe(ae),fe(ie),ot(Y,ie)};It(ce,Y=>{L(m)==="ahagraph"&&Y(oe)})}var ge=Ee(ce,2);{var Be=Y=>{zM(Y,{get nodes(){return L(s).nodes},onDateChange:ie=>{le(g,ie,!0)},onToggle:ie=>{le(_,ie,!0)}})};It(ge,Y=>{L(s)&&Y(Be)})}var $=Ee(ge,2);{var ve=Y=>{var ie=Fb(),ae=xe(ie),Ne=Ee(xe(ae),2);fe(ae);var Pe=Ee(ae,2),Ke=xe(Pe),U=xe(Ke),ye=xe(U,!0);fe(U);var K=Ee(U,2);Pr(K,17,()=>L(a).tags,Wa,(Zt,Nt)=>{var mn=Lb(),Tn=xe(mn,!0);fe(mn),Pt(()=>ct(Tn,L(Nt))),ot(Zt,mn)}),fe(Ke);var ee=Ee(Ke,2),we=xe(ee,!0);fe(ee);var Me=Ee(ee,2);Pr(Me,21,()=>[{label:"Retention",value:L(a).retentionStrength},{label:"Storage",value:L(a).storageStrength},{label:"Retrieval",value:L(a).retrievalStrength}],Wa,(Zt,Nt)=>{var mn=Ub(),Tn=xe(mn),pi=xe(Tn),fr=xe(pi,!0);fe(pi);var ds=Ee(pi,2),E=xe(ds);fe(ds),fe(Tn);var B=Ee(Tn,2),N=xe(B);fe(B),fe(mn),Pt(z=>{ct(fr,L(Nt).label),ct(E,`${z??""}%`),zr(N,`width: ${L(Nt).value*100}%; background: ${L(Nt).value>.7?"#10b981":L(Nt).value>.4?"#f59e0b":"#ef4444"}`)},[()=>(L(Nt).value*100).toFixed(1)]),ot(Zt,mn)}),fe(Me);var Ye=Ee(Me,2),Mt=Ee(xe(Ye),2);{let Zt=ei(()=>L(a).storageStrength*30);NM(Mt,{get retention(){return L(a).retentionStrength},get stability(){return L(Zt)}})}fe(Ye);var St=Ee(Ye,2),at=xe(St),Yt=xe(at);fe(at);var Ht=Ee(at,2),Di=xe(Ht);fe(Ht);var ui=Ee(Ht,2);{var En=Zt=>{var Nt=Nb(),mn=xe(Nt);fe(Nt),Pt(Tn=>ct(mn,`Accessed: ${Tn??""}`),[()=>new Date(L(a).lastAccessedAt).toLocaleString()]),ot(Zt,Nt)};It(ui,Zt=>{L(a).lastAccessedAt&&Zt(En)})}var di=Ee(ui,2),Li=xe(di);fe(di),fe(St);var Wn=Ee(St,2),Xn=xe(Wn),fi=Ee(Xn,2);fe(Wn);var Fn=Ee(Wn,2),Ui=xe(Fn);ps(Ui,{name:"explore",size:14}),Or(),fe(Fn),fe(Pe),fe(ie),Pt((Zt,Nt)=>{ct(ye,L(a).nodeType),ct(we,L(a).content),ct(Yt,`Created: ${Zt??""}`),ct(Di,`Updated: ${Nt??""}`),ct(Li,`Reviews: ${L(a).reviewCount??0??""}`),Rt(Fn,"href",`${mh??""}/explore`)},[()=>new Date(L(a).createdAt).toLocaleString(),()=>new Date(L(a).updatedAt).toLocaleString()]),Ut("click",Ne,()=>le(a,null)),Ut("click",Xn,()=>{L(a)&&ms.memories.promote(L(a).id)}),Ut("click",fi,()=>{L(a)&&ms.memories.demote(L(a).id)}),ot(Y,ie)};It($,Y=>{L(a)&&Y(ve)})}fe(F),Pt((Y,ie)=>{Rt(Ie,"aria-checked",L(m)==="type"),Ns(Ie,1,`min-h-9 px-3 py-1.5 rounded-lg transition ${L(m)==="type"?"bg-synapse/25 text-synapse-glow":"text-dim hover:text-text"}`),Rt(pe,"aria-checked",L(m)==="state"),Ns(pe,1,`min-h-9 px-3 py-1.5 rounded-lg transition ${L(m)==="state"?"bg-synapse/25 text-synapse-glow":"text-dim hover:text-text"}`),Rt(Oe,"aria-checked",L(m)==="ahagraph"),Ns(Oe,1,`min-h-9 px-3 py-1.5 rounded-lg transition ${L(m)==="ahagraph"?"bg-synapse/25 text-synapse-glow":"text-dim hover:text-text"}`),Rt(ze,"title",`Adjust graph brightness (${Y??""}x). Combines with auto distance compensation.`),Rt(Je,"min",ji.brightnessMin),Rt(Je,"max",ji.brightnessMax),ct(de,`${ie??""}x`),I.disabled=L(c),Ns(I,1,`shrink-0 inline-flex items-center gap-2 min-h-10 px-4 py-2 rounded-xl bg-dream/20 border border-dream/40 text-dream-glow text-sm - hover:bg-dream/30 transition-all backdrop-blur-sm disabled:opacity-50 - ${L(c)?"glow-dream animate-pulse-glow":""}`),Ns(De,1,vf(L(c)?"breathe":"")),ct(Ae,` ${L(c)?"Dreaming…":"Dream"}`)},[()=>ji.brightness.toFixed(1),()=>ji.brightness.toFixed(1)]),Ut("keydown",Ge,Y=>Y.key==="Enter"&&G()),Cl(Ge,()=>L(h),Y=>le(h,Y)),Ut("click",it,G),Ut("click",Ie,()=>le(m,"type")),Ut("click",pe,()=>le(m,"state")),Ut("click",Oe,()=>le(m,"ahagraph")),Cl(Je,()=>ji.brightness,Y=>ji.brightness=Y),Ut("click",I,M),Ut("click",Se,()=>S()),ot(r,F),rr(),i()}Cc(["click","keydown"]);export{cs as $,Wt as A,fn as B,ne as C,IS as D,ci as E,pt as F,ns as G,si as H,Pd as I,Pc as J,YS as K,rg as L,bd as M,ii as N,Rc as O,lr as P,wn as Q,zc as R,ho as S,Pi as T,Ii as U,A as V,uo as W,on as X,qs as Y,ch as Z,sw as _,tt as a,Nn as a$,op as a0,yt as a1,Lo as a2,kt as a3,or as a4,Et as a5,Ld as a6,Ti as a7,Qs as a8,Ze as a9,ld as aA,To as aB,Ci as aC,Bn as aD,Fs as aE,_c as aF,yg as aG,Mg as aH,Jd as aI,mg as aJ,Sg as aK,Jf as aL,Kf as aM,$f as aN,cd as aO,Qf as aP,ep as aQ,rS as aR,io as aS,so as aT,cr as aU,js as aV,Ys as aW,$s as aX,li as aY,Dp as aZ,ao as a_,wi as aa,Ic as ab,In as ac,cp as ad,Qn as ae,vd as af,$m as ag,rs as ah,rt as ai,JS as aj,Zf as ak,Yf as al,bo as am,wo as an,Mn as ao,tm as ap,Cd as aq,em as ar,qr as as,qe as at,dn as au,Fe as av,mt as aw,cS as ax,Si as ay,xn as az,j as b,Yl as b$,ro as b0,hd as b1,Qt as b2,dp as b3,up as b4,fp as b5,hp as b6,Md as b7,pp as b8,lp as b9,Ul as bA,Ll as bB,Dc as bC,Lc as bD,fd as bE,ud as bF,dd as bG,kr as bH,pd as bI,md as bJ,gd as bK,_d as bL,Uc as bM,So as bN,Nc as bO,Fc as bP,qa as bQ,Ya as bR,Za as bS,Ja as bT,kl as bU,Vl as bV,Hl as bW,Gl as bX,Wl as bY,Xl as bZ,ql as b_,Pf as ba,If as bb,Qi as bc,zf as bd,Vf as be,Dl as bf,Of as bg,Bf as bh,kf as bi,Hf as bj,Pl as bk,Ff as bl,Nf as bm,Uf as bn,Tf as bo,gh as bp,Af as bq,Rf as br,vh as bs,_h as bt,zl as bu,Bl as bv,Ol as bw,Fl as bx,Ks as by,Nl as bz,Wc as c,pn as c$,Zl as c0,Jl as c1,Kl as c2,$l as c3,jl as c4,Ql as c5,ec as c6,tc as c7,nc as c8,ic as c9,gs as cA,Lf as cB,Df as cC,Eo as cD,hS as cE,yd as cF,Vg as cG,yo as cH,QS as cI,dw as cJ,uw as cK,jS as cL,_m as cM,Ag as cN,Dw as cO,xh as cP,Rg as cQ,hw as cR,Kd as cS,lw as cT,aw as cU,Lw as cV,rp as cW,mm as cX,Id as cY,hr as cZ,xw as c_,sc as ca,rc as cb,ac as cc,Ka as cd,xd as ce,cc as cf,hc as cg,uc as ch,ai as ci,Td as cj,Ed as ck,CS as cl,AS as cm,RS as cn,ES as co,TS as cp,wS as cq,yh as cr,SS as cs,MS as ct,yS as cu,xS as cv,vS as cw,bS as cx,_S as cy,gS as cz,nr as d,Gn as d$,Iw as d0,Rw as d1,Eg as d2,Ei as d3,Hc as d4,Cw as d5,Dd as d6,Jc as d7,vm as d8,Kc as d9,Aw as dA,cg as dB,jc as dC,FS as dD,LS as dE,Rm as dF,Yc as dG,Qc as dH,Gc as dI,Yr as dJ,_w as dK,BS as dL,Mh as dM,Ew as dN,ww as dO,eh as dP,rw as dQ,Mo as dR,Op as dS,wg as dT,XS as dU,qS as dV,HS as dW,Po as dX,oo as dY,dc as dZ,Fo as d_,$d as da,Yd as db,KS as dc,$S as dd,qc as de,ew as df,$c as dg,Xf as dh,Gf as di,qg as dj,tw as dk,Ud as dl,Tm as dm,lg as dn,sS as dp,Hn as dq,Cm as dr,jf as ds,Zr as dt,vw as du,kc as dv,nw as dw,VS as dx,fg as dy,tp as dz,ht as e,Vs as e$,nm as e0,Ao as e1,Vc as e2,us as e3,Vn as e4,yw as e5,Nd as e6,Am as e7,gm as e8,hi as e9,cw as eA,ft as eB,Pg as eC,Fd as eD,Od as eE,rn as eF,Do as eG,hg as eH,ap as eI,pS as eJ,oc as eK,lc as eL,mS as eM,jm as eN,ar as eO,Wg as eP,fw as eQ,pw as eR,Io as eS,Xt as eT,Js as eU,th as eV,Uw as eW,oi as eX,Xc as eY,bw as eZ,sm as e_,qd as ea,lS as eb,co as ec,fu as ed,Zd as ee,np as ef,sp as eg,ip as eh,Xs as ei,Qd as ej,Hd as ek,Gd as el,oS as em,aS as en,Oc as eo,vo as ep,Ro as eq,qf as er,Wf as es,Cf as et,_o as eu,Pw as ev,Sw as ew,as as ex,Tw as ey,hs as ez,vt as f,an as f0,xc as f1,bg as f2,Bd as f3,Mw as f4,ts as f5,NS as f6,DS as f7,ow as f8,OS as f9,zs as fA,Fw as fB,PS as fa,US as fb,ur as fc,Os as fd,nh as fe,iw as ff,Nw as fg,ih as fh,sh as fi,yn as fj,fS as fk,dS as fl,uS as fm,rh as fn,GS as fo,WS as fp,jd as fq,mw as fr,xo as fs,ZS as ft,kS as fu,zS as fv,Sn as fw,Km as fx,lo as fy,Bs as fz,Ri as g,os as h,zn as i,_g as j,gw as k,Hr as l,Ai as m,qt as n,kn as o,ig as p,sg as q,ng as r,eg as s,Qm as t,ah as u,tg as v,Vt as w,Xa as x,Cr as y,ni as z}; diff --git a/apps/dashboard/build/_app/immutable/chunks/C-SOZ1Oi.js.br b/apps/dashboard/build/_app/immutable/chunks/C-SOZ1Oi.js.br deleted file mode 100644 index 85b0c51..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/C-SOZ1Oi.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/C-SOZ1Oi.js.gz b/apps/dashboard/build/_app/immutable/chunks/C-SOZ1Oi.js.gz deleted file mode 100644 index fcd5c95..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/C-SOZ1Oi.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DzesjbbJ.js b/apps/dashboard/build/_app/immutable/chunks/C4h_mRt2.js similarity index 51% rename from apps/dashboard/build/_app/immutable/chunks/DzesjbbJ.js rename to apps/dashboard/build/_app/immutable/chunks/C4h_mRt2.js index 6d7e420..d271740 100644 --- a/apps/dashboard/build/_app/immutable/chunks/DzesjbbJ.js +++ b/apps/dashboard/build/_app/immutable/chunks/C4h_mRt2.js @@ -1 +1 @@ -import{D as y,q as u,H as _,F as o,G as t,I as g,J as i,K as l,L as d,M as p,N as m}from"./wpu9U-D0.js";function F(n,r){let s=null,E=t;var a;if(t){s=p;for(var e=m(document.head);e!==null&&(e.nodeType!==g||e.data!==n);)e=i(e);if(e===null)l(!1);else{var f=i(e);e.remove(),d(f)}}t||(a=document.head.appendChild(y()));try{u(()=>r(a),_|o)}finally{E&&(l(!0),d(s))}}export{F as h}; +import{J as y,b as u,K as _,M as o,N as t,O as g,Q as i,R as l,T as d,U as p,V as m}from"./CpWkWWOo.js";function T(n,r){let s=null,E=t;var a;if(t){s=p;for(var e=m(document.head);e!==null&&(e.nodeType!==g||e.data!==n);)e=i(e);if(e===null)l(!1);else{var f=i(e);e.remove(),d(f)}}t||(a=document.head.appendChild(y()));try{u(()=>r(a),_|o)}finally{E&&(l(!0),d(s))}}export{T as h}; diff --git a/apps/dashboard/build/_app/immutable/chunks/C4h_mRt2.js.br b/apps/dashboard/build/_app/immutable/chunks/C4h_mRt2.js.br new file mode 100644 index 0000000..75d6e99 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/C4h_mRt2.js.br @@ -0,0 +1,2 @@ +v`)wKքMڜ˿Q@ƺW vEYtcG.h2DJКdS $gdD1,Jy>U`+& +՟xS{t?u.source.v=f:g(u.source,f)}),t=!1}return e&&i in r?l(e):d(u.source)}function m(){const e={};function n(){o(()=>{for(var r in e)e[r].unsubscribe();b(e,i,{enumerable:!1,value:!0})})}return[e,n]}function I(e){var n=s;try{return s=!1,[e(),s]}finally{s=n}}export{y as a,I as c,m as s}; diff --git a/apps/dashboard/build/_app/immutable/chunks/C6HuKgyx.js.br b/apps/dashboard/build/_app/immutable/chunks/C6HuKgyx.js.br new file mode 100644 index 0000000..7f962dd Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/C6HuKgyx.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/C6HuKgyx.js.gz b/apps/dashboard/build/_app/immutable/chunks/C6HuKgyx.js.gz new file mode 100644 index 0000000..0db39b3 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/C6HuKgyx.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/C8kRUgax.js b/apps/dashboard/build/_app/immutable/chunks/C8kRUgax.js deleted file mode 100644 index c7c6805..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/C8kRUgax.js +++ /dev/null @@ -1 +0,0 @@ -var du=Object.defineProperty;var hu=(E,i,r)=>i in E?du(E,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):E[i]=r;var o=(E,i,r)=>hu(E,typeof i!="symbol"?i+"":i,r);import{StorageBufferAttribute as It,SpriteNodeMaterial as ru}from"./CfobEeQC.js";import{uniform as h,storage as lt,Fn as R,instanceIndex as W,fract as T,float as t,mx_noise_vec3 as X,vec3 as u,sin as m,cos as b,sqrt as Rt,floor as nt,pow as H,abs as et,clamp as C,vec2 as y,smoothstep as mt,oneMinus as at,mix as M,select as n,cross as is,length as $,min as vu,atan as cs,positionView as bu}from"./BZQzXWp7.js";import{V as ds,A as pu,P as gu,I as fu}from"./C-SOZ1Oi.js";const xu={anchor:0,connection:1,contradiction:2};class Bu{constructor(i,r,g={}){o(this,"count");o(this,"scene");o(this,"renderer");o(this,"bufferPos");o(this,"bufferVel");o(this,"bufferPhase");o(this,"computeNode");o(this,"mesh",null);o(this,"material",null);o(this,"computeInFlight",null);o(this,"uTarget",h(new ds(0,0,0)));o(this,"uTime",h(0));o(this,"uIgnition",h(.2));o(this,"uMode",h(0));o(this,"uContainRadius",h(48));o(this,"uHueShift",h(0));o(this,"uModeTintAmt",h(.25));o(this,"uBurst",h(0));o(this,"uActDim",h(.12));o(this,"uWorld",h(0));o(this,"uPrevWorld",h(0));o(this,"uBlend",h(0));o(this,"worldCount",7);o(this,"uBlast",h(0));o(this,"uBlastTime",h(0));o(this,"uMorphSeed",h(0));o(this,"uChaos",h(0));o(this,"uClash",h(0));o(this,"uFadeNear",h(2));o(this,"uFadeBand",h(7));o(this,"uFogDensity",h(.012));o(this,"uFocus",h(28));o(this,"uFocusRange",h(20));o(this,"uDofDim",h(.3));o(this,"uZoomPeriod",h(9));o(this,"uLambda",h(1.923));o(this,"uZoomOn",h(0));o(this,"uCamVelView",h(new ds(0,0,0)));o(this,"uStreak",h(0));o(this,"uMaxStretch",h(7));o(this,"dreamCount",0);this.renderer=i,this.scene=r,this.count=g.count??15e4;const f=g.spawnRadius??34,q=new Float32Array(this.count*3),D=new Float32Array(this.count*3),c=new Float32Array(this.count);for(let S=0;S{const c=f.element(W),p=q.element(W),B=D.element(W),P=B.mul(12.9898).sin().mul(43758.5453),S=B.mul(78.233).sin().mul(12543.531),L=B.mul(39.346).sin().mul(24634.633),O=T(P),V=T(S),a=T(L),l=O.mul(6.28318),d=V.mul(3.14159),e=this.uContainRadius,w=T(B.mul(3.7)),z=t(.62).add(w.mul(w).mul(.38)),A=t(W),v=R(([s])=>{const x=t(.6),es=X(s.add(u(x,0,0))).sub(X(s.sub(u(x,0,0)))),ms=X(s.add(u(0,x,0))).sub(X(s.sub(u(0,x,0)))),as=X(s.add(u(0,0,x))).sub(X(s.sub(u(0,0,x))));return u(ms.z.sub(as.y),as.x.sub(es.z),es.y.sub(ms.x)).normalize()}),F=u(m(d).mul(b(l)),b(d),m(d).mul(m(l))),G=F.mul(e.mul(z)),tt=F.mul(e.mul(t(.5).add(w.mul(.3)))),N=t(.19),Z=u(m(c.y).sub(c.x.mul(N)),m(c.z).sub(c.y.mul(N)),m(c.x).sub(c.z.mul(N))),_=c.add(Z.mul(e.mul(.12))),j=G,st=u(O.sub(.5).mul(2).mul(e.mul(.8)),V.sub(.5).mul(2).mul(e.mul(.8)),a.sub(.5).mul(2).mul(e.mul(.8))),K=O.mul(6.28318).mul(3).add(a.mul(.6)),it=e.mul(.2).add(e.mul(.8).mul(a)),hs=u(it.mul(b(K)),e.mul(.06).mul(m(B.mul(20))),it.mul(m(K))),rs=t(2.39996323),Wt=A.mul(rs),Dt=Rt(A).mul(e.mul(.0042)),vs=u(Wt.cos().mul(Dt),e.mul(.04).mul(m(B.mul(9))),Wt.sin().mul(Dt)),Y=this.uMorphSeed,xt=this.uChaos,bs=T(Y.mul(.731).add(.13)),ps=T(Y.mul(1.323).add(.51)),gs=T(Y.mul(2.117).add(.27)),yt=t(387),J=T(A.div(yt)),k=nt(A.div(yt)).div(yt),Vt=s=>s.exp().sub(s.mul(-1).exp()).mul(.5),Zt=s=>s.exp().add(s.mul(-1).exp()).mul(.5),I=(s,x)=>y(s.x.mul(x.x).sub(s.y.mul(x.y)),s.x.mul(x.y).add(s.y.mul(x.x))),wt=s=>{const x=s.x.exp();return y(x.mul(b(s.y)),x.mul(m(s.y)))},fs=s=>y(s.x.mul(s.x).add(s.y.mul(s.y)).max(1e-12).log().mul(.5),cs(s.y,s.x)),Ot=(s,x)=>wt(I(y(x,t(0)),fs(s))),xs=s=>y(Zt(s.x).mul(b(s.y)),Vt(s.x).mul(m(s.y))),ys=s=>y(Vt(s.x).mul(b(s.y)),Zt(s.x).mul(m(s.y))),Mt=s=>{const x=s.x.mul(s.x).add(s.y.mul(s.y)).max(1e-6);return y(s.x.div(x),s.y.mul(-1).div(x))},ct=t(2).add(nt(bs.mul(14))),Nt=l,ws=H(et(b(ct.mul(Nt).div(4))),t(2).add(ps.mul(8))).add(H(et(m(ct.mul(Nt).div(4))),t(2).add(gs.mul(8)))).add(1e-4).pow(t(-.5)),Ms=H(et(b(ct.mul(d).div(4))),t(3)).add(H(et(m(ct.mul(d).div(4))),t(3))).add(1e-4).pow(t(-.5)),Tt=e.mul(.85).mul(C(ws.mul(Ms).mul(.5),.1,1.4)),Ts=u(m(d).mul(b(l)).mul(Tt),b(d).mul(Tt),m(d).mul(m(l)).mul(Tt)),kt=t(5),Ht=nt(T(Y.mul(.013).add(A.mul(.00667))).mul(25)),Et=nt(Ht.div(5)),qs=Ht.sub(Et.mul(5)),Cs=J.mul(2).sub(1),Bs=k.mul(1.5708),Lt=y(Cs,Bs),As=wt(y(t(0),Et.mul(6.28318).div(kt))),zs=wt(y(t(0),qs.mul(6.28318).div(kt))),Gt=I(As,Ot(xs(Lt),t(.4))),_t=I(zs,Ot(ys(Lt),t(.4))),jt=this.uTime.mul(.25).add(Y).add(xt.mul(1.5)),Ss=u(Gt.x,_t.x,b(jt).mul(Gt.y).add(m(jt).mul(_t.y))).mul(e.mul(.55)),Kt=Rt(J),Yt=k.mul(6.28318),qt=y(Kt.mul(b(Yt)),Kt.mul(m(Yt))),Q=I(qt,qt),ut=I(Q,qt),dt=Mt(Q),ht=Mt(ut),Ps=y(ut.x.sub(ht.x).add(2.2360679),ut.y.sub(ht.y)),Ct=Mt(Ps),Fs=I(y(t(0),t(1)),y(Q.x.sub(dt.x),Q.y.sub(dt.y))),Is=y(Q.x.add(dt.x),Q.y.add(dt.y)),Rs=I(y(t(0),t(.6667)),y(ut.x.add(ht.x),ut.y.add(ht.y))),Bt=I(Ct,Fs).x,At=I(Ct,Is).x,zt=I(Ct,Rs).x.add(.5),St=Bt.mul(Bt).add(At.mul(At)).add(zt.mul(zt)).max(1e-4),Ws=u(Bt.div(St),At.div(St),zt.div(St).sub(.86)).mul(e.mul(.5)),rt=k.mul(2).sub(1),Jt=Rt(t(1).sub(rt.mul(rt)).max(0)).mul(.9).add(.25),Qt=J.mul(6.28318).add(rt.mul(6).mul(xt.add(.4))),Ds=u(Jt.mul(b(Qt)),rt.mul(1.4),Jt.mul(m(Qt))).mul(e.mul(.5)),Ut=t(2.2).add(xt.mul(2)),vt=J.mul(6.28318).mul(Ut),bt=k.mul(6.28318).mul(Ut),pt=this.uTime.mul(.3).add(Y.mul(6.28318)),Vs=m(vt).mul(b(bt)).add(m(bt).mul(b(pt))).add(m(pt).mul(b(vt))),Zs=b(vt).mul(b(bt)).mul(b(pt)).sub(m(vt).mul(m(bt)).mul(m(pt))),Xt=this.uTime.mul(.15),Os=b(Xt).mul(Vs).add(m(Xt).mul(Zs)),Ns=u(m(k.mul(3.14159)).mul(b(J.mul(6.28318))),b(k.mul(3.14159)),m(k.mul(3.14159)).mul(m(J.mul(6.28318)))).mul(e.mul(.5).add(Os.mul(e.mul(.12)))),Pt=s=>n(s.equal(0),G,n(s.equal(1),tt,n(s.equal(2),_,n(s.equal(3),j,n(s.equal(4),st,n(s.equal(5),hs,n(s.equal(6),vs,n(s.equal(7),Ts,n(s.equal(8),Ss,n(s.equal(9),Ws,n(s.equal(10),Ds,Ns))))))))))),ks=Pt(t(this.uWorld)),Hs=Pt(t(this.uPrevWorld)),Es=mt(t(0),t(1),at(this.uBlend)),Ls=M(Hs,ks,Es),Gs=T(A.mul(.001).add(.5)).greaterThan(.66),Ft=t(this.uWorld).add(5),_s=n(Ft.greaterThan(11),Ft.sub(12),Ft),ot=Pt(_s),$t=this.uTime.mul(.4),ts=b($t),ss=m($t),js=u(ot.x.mul(ts).sub(ot.z.mul(ss)),ot.y,ot.x.mul(ss).add(ot.z.mul(ts))).mul(.52),Ks=this.uTime.div(this.uZoomPeriod).fract(),Ys=this.uTime.div(this.uZoomPeriod).add(.5).fract(),Js=M(t(1),this.uLambda.pow(Ks),this.uZoomOn),Qs=M(t(1),this.uLambda.pow(Ys),this.uZoomOn),Us=Ls.mul(Js),Xs=js.mul(Qs.mul(this.uLambda)),us=M(Us,Xs,Gs.select(t(1),t(0))),$s=c.normalize(),tu=at(T(B.mul(7.3)).mul(.4));p.addAssign($s.mul(this.uBurst.mul(.95).mul(tu))),p.addAssign(us.sub(c).mul(.045));const su=v(c.mul(.045).add(u(0,this.uTime.mul(.2),0))),uu=n(this.uWorld.equal(0),t(.05),n(this.uWorld.equal(5),t(.06),t(0)));p.addAssign(su.mul(uu)),p.addAssign(is(u(0,1,0),c).mul(9e-4).mul(n(this.uWorld.equal(1),t(1),t(0)))),p.addAssign(Z.mul(.012).mul(n(this.uWorld.equal(2),t(1),t(0))));const gt=c.x.div(e.mul(.5)),ft=c.y.div(e.mul(.5)),U=c.z.div(e.mul(.5)),ou=u(U.sub(.7).mul(gt).sub(ft.mul(3.5)),gt.mul(3.5).add(U.sub(.7).mul(ft)),t(.6).add(U.mul(.95)).sub(U.mul(U).mul(U).div(3)).sub(gt.mul(gt).add(ft.mul(ft))));p.addAssign(ou.mul(.008).mul(n(this.uWorld.equal(10),t(1),t(0)))),p.addAssign(is(u(0,1,0),c).mul(.0016).mul(n(this.uWorld.equal(5),t(1),t(0))));const lu=us.normalize().mul(m(this.uTime.mul(1.3).add(B.mul(6.1))).mul(.015));p.addAssign(lu);const os=$(p),nu=t(1.3);p.assign(p.mul(vu(nu,os).div(os.max(1e-4)))),c.addAssign(p),p.mulAssign(.9);const eu=n(this.uWorld.equal(4),t(1.6),t(1)),ls=M(t(.55),t(6),C(this.uBurst,0,1)),mu=nt(c.div(ls)).add(.5).mul(ls),au=C(at(this.uBurst.mul(1.4)),0,.9).mul(eu).min(.9);c.assign(M(c,mu,au));const iu=$(c),ns=this.uContainRadius,cu=c.normalize().mul(ns);c.assign(M(c,cu,iu.greaterThan(ns).select(t(1),t(0))))})().compute(this.count)}buildRender(i,r){const g=new ru({transparent:!0,blending:pu,depthWrite:!1}),f=lt(r,"float",this.count),q=lt(i,"vec3",this.count).element(W);g.positionNode=q;const D=g;{const a=u(this.uCamVelView),l=y(a.x,a.y),d=$(l).max(1e-4),e=T(f.element(W).mul(13.17)).mul(.5).add(.75);D.rotationNode=cs(l.y,l.x);const w=C(d.mul(this.uStreak).mul(e).mul(.6).add(1),t(1),this.uMaxStretch),z=t(1);D.scaleNode=y(z.mul(w),z)}const c=R(([a,l,d,e,w])=>l.add(d.mul(b(e.mul(a).add(w).mul(6.28318))))),p=R(([a])=>{const l=a.div(100),d=H(l.sub(60).max(1e-4),t(-.1332047592)).mul(329.698727446),e=l.lessThanEqual(66).select(t(255),d),w=l.max(1e-4).log().mul(99.4708025861).sub(161.1195681661),z=H(l.sub(60).max(1e-4),t(-.0755148492)).mul(288.1221695283),A=l.lessThanEqual(66).select(w,z),v=l.sub(10).max(1e-4).log().mul(138.5177312231).sub(305.0447927307),F=l.greaterThanEqual(66).select(t(255),l.lessThanEqual(19).select(t(0),v));return C(u(e,A,F).div(255),0,1)}),B=R(()=>{const a=q,l=f.element(W),d=$(a.sub(u(this.uTarget))),e=t(W),w=T(e.mul(.001).add(.5)).greaterThan(.66),z=a.x.mul(.03).add(a.y.mul(.021)).add(a.z.mul(.027)),A=T(l.mul(.41).add(d.mul(.06)).add(z).add(this.uTime.mul(.1)).add(this.uHueShift)),v=this.uClash,F=n(v.equal(0),u(0,.85,1),n(v.equal(1),u(.55,1,0),n(v.equal(2),u(1,.82,0),n(v.equal(3),u(0,1,.6),u(.1,.5,1))))),G=n(v.equal(0),u(.3,.2,1),n(v.equal(1),u(0,.7,.5),n(v.equal(2),u(1,.4,0),n(v.equal(3),u(0,.6,1),u(.5,0,1))))),tt=n(v.equal(0),u(1,.25,0),n(v.equal(1),u(1,0,.55),n(v.equal(2),u(.6,0,1),n(v.equal(3),u(1,.1,.3),u(1,.7,0))))),N=n(v.equal(0),u(1,0,.3),n(v.equal(1),u(1,.45,0),n(v.equal(2),u(1,0,.7),n(v.equal(3),u(1,.5,0),u(1,.2,.4))))),Z=mt(t(0),t(1),A),_=M(F,G,Z),j=M(tt,N,Z),st=M(_,j,w.select(t(1),t(0))),K=n(this.uMode.equal(2),u(1,.08,.32),n(this.uMode.equal(3),u(1,.78,.1),u(.1,.9,1)));return M(st,K,this.uModeTintAmt.mul(.4))}),P=R(()=>{const a=q,l=C($(a).div(this.uContainRadius.max(1e-4)),0,1),d=l.mul(l),e=a.normalize(),w=H(at(et(e.z)),t(4)),z=t(.12).add(d.mul(.6)).add(w.mul(.5)),A=t(W),v=T(A.mul(.001).add(.5)).greaterThan(.66),F=t(.07).add(w.mul(.3)),G=v.select(F,z),tt=this.uTime.div(this.uZoomPeriod).fract(),N=this.uTime.div(this.uZoomPeriod).add(.5).fract(),Z=m(tt.mul(3.14159)),_=m(N.mul(3.14159)),j=Z.add(_).max(1e-4),st=M(t(1),Z.div(j).mul(2).min(1),this.uZoomOn),K=M(t(1),_.div(j).mul(2).min(1),this.uZoomOn),it=v.select(K,st);return G.mul(it)}),S=R(()=>{const a=bu.z.negate(),l=mt(this.uFadeNear,this.uFadeNear.add(this.uFadeBand),a),d=C(this.uFogDensity.mul(a).negate().exp(),.45,1),e=C(a.sub(this.uFocus).abs().div(this.uFocusRange),0,1),w=at(e.mul(this.uDofDim));return l.mul(d).mul(w)}),L=R(()=>{const a=q,l=C(this.uBlast,0,1),d=this.uBlastTime,e=C($(a).div(this.uContainRadius.max(1e-4)),0,1),w=M(t(1600),t(5200),l),z=C(l.mul(1.1).add(.4),0,1.3),A=p(w).mul(z),v=T(e.mul(1.6).sub(d.mul(1.5))),F=c(v,u(.55),u(.55),u(3),u(0,.33,.67));return M(A,F,t(.78))});g.colorNode=R(()=>{const a=C(this.uIgnition.mul(.05).add(.72),0,1.25),l=B().mul(a).mul(P()).mul(this.uActDim),d=mt(t(0),t(.85),C(this.uBlast,0,1)).mul(.6);return M(l,L().mul(P()).mul(this.uActDim),d).mul(S())})(),g.emissiveNode=R(()=>{const a=C(this.uIgnition.mul(.04).add(.85),0,1.35),l=B().mul(a).mul(P()).mul(this.uActDim),d=mt(t(0),t(.85),C(this.uBlast,0,1)).mul(.6);return M(l,L().mul(.85).mul(P()).mul(this.uActDim),d).mul(S())})();const O=new gu(.1,.1),V=new fu(O,g,this.count);V.frustumCulled=!1,this.material=g,this.mesh=V,this.scene.add(this.mesh)}async update(i){const r=Math.max(0,Math.min(i,.05));this.uTime.value+=r,this.uHueShift.value=(this.uHueShift.value+r*.06)%1,this.uBlend.value=Math.max(0,this.uBlend.value-r*1),this.uIgnition.value=Math.max(0,this.uIgnition.value-r*2),this.uBurst.value=Math.max(0,this.uBurst.value-r*.85),this.uBlast.value=Math.max(0,this.uBlast.value-r*.35),this.uBlastTime.value+=r;const g=this.uTime.value/this.uZoomPeriod.value%1,f=this.uZoomOn.value>.5?40-g*16:26+Math.sin(this.uTime.value*.18)*9;this.uFocus.value+=(f-this.uFocus.value)*Math.min(1,r*3),this.computeInFlight&&await this.computeInFlight,this.computeInFlight=this.renderer.computeAsync(this.computeNode).finally(()=>{this.computeInFlight=null}),await this.computeInFlight}transitionTo(i,r,g="II",f=99){this.uTarget.value.copy(r);const q=xu[i]??1;this.uMode.value=q,this.uPrevWorld.value=this.uWorld.value,this.uWorld.value=f%this.worldCount,this.uBlend.value=1,this.uClash.value=f%5,this.uZoomOn.value=f>=2?1:0;const D=f===0?.12:f===1?.2:null,c=g==="I"?.26:1;this.uActDim.value=D??c,this.uIgnition.value=f<=1?.4:g==="I"?1.6:4.5;const p=this.uWorld.value===3;this.uBurst.value=q===2||p?1:.8,this.uBlast.value=f<=1?.25:1,this.uBlastTime.value=0,this.uModeTintAmt.value=q>=2?.7:.22}dreamBeat(){this.dreamCount+=1;const i=7+Math.floor(Math.random()*5);this.uPrevWorld.value=this.uWorld.value,this.uWorld.value=i,this.uBlend.value=1,this.uMorphSeed.value=Math.random()*1e3,this.uClash.value=Math.floor(Math.random()*5),this.uChaos.value=Math.min(1,.25+this.dreamCount*.1),this.uZoomOn.value=1,this.uActDim.value=.85,this.uIgnition.value=3,this.uBurst.value=1,this.uBlast.value=1,this.uBlastTime.value=0;const r=[1,2,3];this.uMode.value=r[Math.floor(Math.random()*r.length)],this.uModeTintAmt.value=.3+Math.random()*.5}setContainRadius(i){this.uContainRadius.value=Math.max(8,i)}setZoom(i){this.uZoomOn.value=i?1:0}setCameraVel(i){this.uCamVelView.value.copy(i)}setStreak(i){this.uStreak.value=i}dispose(){var i,r,g,f;this.mesh&&(this.scene.remove(this.mesh),(i=this.mesh.geometry)==null||i.dispose(),(g=(r=this.mesh).dispose)==null||g.call(r),this.mesh=null),(f=this.material)==null||f.dispose(),this.material=null,this.bufferPos=null,this.bufferVel=null,this.bufferPhase=null}}export{Bu as SemanticComputeStorm}; diff --git a/apps/dashboard/build/_app/immutable/chunks/C8kRUgax.js.br b/apps/dashboard/build/_app/immutable/chunks/C8kRUgax.js.br deleted file mode 100644 index cb81051..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/C8kRUgax.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/C8kRUgax.js.gz b/apps/dashboard/build/_app/immutable/chunks/C8kRUgax.js.gz deleted file mode 100644 index cc5255b..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/C8kRUgax.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CGEBXrjl.js b/apps/dashboard/build/_app/immutable/chunks/CGEBXrjl.js new file mode 100644 index 0000000..040e765 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/CGEBXrjl.js @@ -0,0 +1 @@ +import{J as z,b as fe,aa as re,N as k,T as L,V as ie,ab as le,g as Z,ac as ue,ad as se,ae as $,R as q,U as F,O as oe,af as ve,ag as y,_ as te,ah as T,ai as Y,aj as de,ak as ce,A as pe,a7 as _e,al as U,am as he,an as ge,I as Ee,ao as j,ap as me,aq as ne,ar as ae,as as V,Y as Te,at as Ae,au as Ce,av as we,aw as Ie,Q as Ne}from"./CpWkWWOo.js";function ke(e,i){return i}function Se(e,i,l){for(var t=[],g=i.length,s,u=i.length,c=0;c{if(s){if(s.pending.delete(E),s.done.add(E),s.pending.size===0){var o=e.outrogroups;B(U(s.done)),o.delete(s),o.size===0&&(e.outrogroups=null)}}else u-=1},!1)}if(u===0){var f=t.length===0&&l!==null;if(f){var v=l,n=v.parentNode;we(n),n.append(v),e.items.clear()}B(i,!f)}else s={pending:new Set(i),done:new Set},(e.outrogroups??(e.outrogroups=new Set)).add(s)}function B(e,i=!0){for(var l=0;l{var a=l();return _e(a)?a:a==null?[]:U(a)}),o,d=!0;function C(){r.fallback=n,xe(r,o,u,i,t),n!==null&&(o.length===0?(n.f&T)===0?ne(n):(n.f^=T,M(n,null,u)):ae(n,()=>{n=null}))}var N=fe(()=>{o=Z(E);var a=o.length;let S=!1;if(k){var x=ue(u)===se;x!==(a===0)&&(u=$(),L(u),q(!1),S=!0)}for(var _=new Set,w=te,R=ce(),p=0;ps(u)):(n=Y(()=>s(ee??(ee=z()))),n.f|=T)),a>_.size&&de(),k&&a>0&&L($()),!d)if(R){for(const[O,D]of c)_.has(O)||w.skip_effect(D.e);w.oncommit(C),w.ondiscard(()=>{})}else C();S&&q(!0),Z(E)}),r={effect:N,items:c,outrogroups:null,fallback:n};d=!1,k&&(u=F)}function H(e){for(;e!==null&&(e.f&Ae)===0;)e=e.next;return e}function xe(e,i,l,t,g){var h,O,D,J,Q,X,G,K,P;var s=(t&Ce)!==0,u=i.length,c=e.items,f=H(e.effect.first),v,n=null,E,o=[],d=[],C,N,r,a;if(s)for(a=0;a0){var b=(t&re)!==0&&u===0?l:null;if(s){for(a=0;a{var m,W;if(E!==void 0)for(r of E)(W=(m=r.nodes)==null?void 0:m.a)==null||W.apply()})}function Re(e,i,l,t,g,s,u,c){var f=(u&he)!==0?(u&ge)===0?Ee(l,!1,!1):j(l):null,v=(u&me)!==0?j(g):null;return{v:f,i:v,e:Y(()=>(s(i,f??l,v??g,c),()=>{e.delete(t)}))}}function M(e,i,l){if(e.nodes)for(var t=e.nodes.start,g=e.nodes.end,s=i&&(i.f&T)===0?i.nodes.start:l;t!==null;){var u=Ne(t);if(s.before(t),t===g)return;t=u}}function A(e,i,l){i===null?e.effect.first=l:i.next=l,l===null?e.effect.last=i:l.prev=i}export{He as e,ke as i}; diff --git a/apps/dashboard/build/_app/immutable/chunks/CGEBXrjl.js.br b/apps/dashboard/build/_app/immutable/chunks/CGEBXrjl.js.br new file mode 100644 index 0000000..f66f2f9 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/CGEBXrjl.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CGEBXrjl.js.gz b/apps/dashboard/build/_app/immutable/chunks/CGEBXrjl.js.gz new file mode 100644 index 0000000..1efc186 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/CGEBXrjl.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CHOnp4oo.js b/apps/dashboard/build/_app/immutable/chunks/CHOnp4oo.js new file mode 100644 index 0000000..50e502d --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/CHOnp4oo.js @@ -0,0 +1 @@ +import{aI as M,J as v,V as o,aJ as y,o as T,aK as p,aL as b,N as d,U as i,aM as w,ab as x,aN as A,T as L,aO as C}from"./CpWkWWOo.js";var h;const m=((h=globalThis==null?void 0:globalThis.window)==null?void 0:h.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function O(e){return(m==null?void 0:m.createHTML(e))??e}function g(e){var a=M("template");return a.innerHTML=O(e.replaceAll("","")),a.content}function n(e,a){var r=T;r.nodes===null&&(r.nodes={start:e,end:a,a:null,t:null})}function R(e,a){var r=(a&p)!==0,f=(a&b)!==0,s,c=!e.startsWith("");return()=>{if(d)return n(i,null),i;s===void 0&&(s=g(c?e:""+e),r||(s=o(s)));var t=f||y?document.importNode(s,!0):s.cloneNode(!0);if(r){var _=o(t),u=t.lastChild;n(_,u)}else n(t,t);return t}}function D(e,a,r="svg"){var f=!e.startsWith(""),s=(a&p)!==0,c=`<${r}>${f?e:""+e}`,t;return()=>{if(d)return n(i,null),i;if(!t){var _=g(c),u=o(_);if(s)for(t=document.createDocumentFragment();o(u);)t.appendChild(o(u));else t=o(u)}var l=t.cloneNode(!0);if(s){var E=o(l),N=l.lastChild;n(E,N)}else n(l,l);return l}}function F(e,a){return D(e,a,"svg")}function H(e=""){if(!d){var a=v(e+"");return n(a,a),a}var r=i;return r.nodeType!==A?(r.before(r=v()),L(r)):C(r),n(r,r),r}function I(){if(d)return n(i,null),i;var e=document.createDocumentFragment(),a=document.createComment(""),r=v();return e.append(a,r),n(a,r),e}function $(e,a){if(d){var r=T;((r.f&w)===0||r.nodes.end===null)&&(r.nodes.end=i),x();return}e!==null&&e.before(a)}export{$ as a,F as b,I as c,n as d,R as f,H as t}; diff --git a/apps/dashboard/build/_app/immutable/chunks/CHOnp4oo.js.br b/apps/dashboard/build/_app/immutable/chunks/CHOnp4oo.js.br new file mode 100644 index 0000000..e88d0d1 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/CHOnp4oo.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CHOnp4oo.js.gz b/apps/dashboard/build/_app/immutable/chunks/CHOnp4oo.js.gz new file mode 100644 index 0000000..a48f902 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/CHOnp4oo.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CJCPY1OL.js b/apps/dashboard/build/_app/immutable/chunks/CJCPY1OL.js new file mode 100644 index 0000000..e19c316 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/CJCPY1OL.js @@ -0,0 +1 @@ +import{b as p,E as t}from"./CpWkWWOo.js";import{B as c}from"./DdEqwvdI.js";function E(r,s,...a){var e=new c(r);p(()=>{const n=s()??null;e.ensure(n,n&&(o=>n(o,...a)))},t)}export{E as s}; diff --git a/apps/dashboard/build/_app/immutable/chunks/CJCPY1OL.js.br b/apps/dashboard/build/_app/immutable/chunks/CJCPY1OL.js.br new file mode 100644 index 0000000..8c14746 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/CJCPY1OL.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CJCPY1OL.js.gz b/apps/dashboard/build/_app/immutable/chunks/CJCPY1OL.js.gz new file mode 100644 index 0000000..b91f18a Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/CJCPY1OL.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CJsMJEun.js b/apps/dashboard/build/_app/immutable/chunks/CJsMJEun.js new file mode 100644 index 0000000..0b355f6 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/CJsMJEun.js @@ -0,0 +1 @@ +import{W as S,X as h,v as k,Y as T,S as Y}from"./CpWkWWOo.js";function t(r,i){return r===i||(r==null?void 0:r[Y])===i}function x(r={},i,a,c){return S(()=>{var f,s;return h(()=>{f=s,s=[],k(()=>{r!==a(...s)&&(i(r,...s),f&&t(a(...f),r)&&i(null,...f))})}),()=>{T(()=>{s&&t(a(...s),r)&&i(null,...s)})}}),r}export{x as b}; diff --git a/apps/dashboard/build/_app/immutable/chunks/CJsMJEun.js.br b/apps/dashboard/build/_app/immutable/chunks/CJsMJEun.js.br new file mode 100644 index 0000000..4f22310 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/CJsMJEun.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CJsMJEun.js.gz b/apps/dashboard/build/_app/immutable/chunks/CJsMJEun.js.gz new file mode 100644 index 0000000..fdb26f0 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/CJsMJEun.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CLrXVRi2.js b/apps/dashboard/build/_app/immutable/chunks/CLrXVRi2.js deleted file mode 100644 index ba54390..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/CLrXVRi2.js +++ /dev/null @@ -1 +0,0 @@ -import{TempNode as O,NodeUpdateType as D,RendererUtils as F,QuadMesh as L,NodeMaterial as f}from"./CfobEeQC.js";import{nodeObject as P,uniform as g,texture as c,passTexture as W,Fn as B,luminance as j,smoothstep as q,mix as H,vec4 as m,uniformArray as M,float as b,uv as E,Loop as Q,int as U,add as X}from"./BZQzXWp7.js";import{R as N,H as w,b as x,V as _}from"./C-SOZ1Oi.js";const p=new L,Y=new x,G=new x(1,0),I=new x(0,1);let z;class J extends O{static get type(){return"BloomNode"}constructor(r,t=1,i=0,s=0){super("vec4"),this.inputNode=r,this.strength=g(t),this.radius=g(i),this.threshold=g(s),this.smoothWidth=g(.01),this._renderTargetsHorizontal=[],this._renderTargetsVertical=[],this._nMips=5,this._renderTargetBright=new N(1,1,{depthBuffer:!1,type:w}),this._renderTargetBright.texture.name="UnrealBloomPass.bright",this._renderTargetBright.texture.generateMipmaps=!1;for(let e=0;e{const a=this.inputNode,l=j(a.rgb),d=q(this.threshold,this.threshold.add(this.smoothWidth),l);return H(m(0),a,d)});this._highPassFilterMaterial=this._highPassFilterMaterial||new f,this._highPassFilterMaterial.fragmentNode=t().context(r.getSharedContext()),this._highPassFilterMaterial.name="Bloom_highPass",this._highPassFilterMaterial.needsUpdate=!0;const i=[3,5,7,9,11];for(let a=0;a{const d=b(1.2).sub(a);return H(a,d,l)}).setLayout({name:"lerpBloomFactor",type:"float",inputs:[{name:"factor",type:"float"},{name:"radius",type:"float"}]}),u=B(()=>{const a=o(s.element(0),this.radius).mul(m(e.element(0),1)).mul(this._textureNodeBlur0),l=o(s.element(1),this.radius).mul(m(e.element(1),1)).mul(this._textureNodeBlur1),d=o(s.element(2),this.radius).mul(m(e.element(2),1)).mul(this._textureNodeBlur2),h=o(s.element(3),this.radius).mul(m(e.element(3),1)).mul(this._textureNodeBlur3),n=o(s.element(4),this.radius).mul(m(e.element(4),1)).mul(this._textureNodeBlur4);return a.add(l).add(d).add(h).add(n).mul(this.strength)});return this._compositeMaterial=this._compositeMaterial||new f,this._compositeMaterial.fragmentNode=u().context(r.getSharedContext()),this._compositeMaterial.name="Bloom_comp",this._compositeMaterial.needsUpdate=!0,this._textureOutput}dispose(){for(let r=0;rs.sample(n),d=B(()=>{const n=e.element(0).toVar(),T=l(a).rgb.mul(n).toVar();return Q({start:U(1),end:U(t),type:"int",condition:"<"},({i:V})=>{const R=b(V),v=e.element(V),y=u.mul(o).mul(R),A=l(a.add(y)).rgb,C=l(a.sub(y)).rgb;T.addAssign(X(A,C).mul(v)),n.addAssign(b(2).mul(v))}),m(T.div(n),1)}),h=new f;return h.fragmentNode=d().context(r.getSharedContext()),h.name="Bloom_separable",h.needsUpdate=!0,h.colorTexture=s,h.direction=u,h.invSize=o,h}}const k=(S,r,t,i)=>P(new J(P(S),r,t,i));export{k as bloom,J as default}; diff --git a/apps/dashboard/build/_app/immutable/chunks/CLrXVRi2.js.br b/apps/dashboard/build/_app/immutable/chunks/CLrXVRi2.js.br deleted file mode 100644 index cba39ff..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/CLrXVRi2.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CLrXVRi2.js.gz b/apps/dashboard/build/_app/immutable/chunks/CLrXVRi2.js.gz deleted file mode 100644 index 16ed5a1..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/CLrXVRi2.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CZfHMhLI.js b/apps/dashboard/build/_app/immutable/chunks/CZfHMhLI.js deleted file mode 100644 index bf586da..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/CZfHMhLI.js +++ /dev/null @@ -1 +0,0 @@ -const i="/api";async function t(e,o){const r=await fetch(`${i}${e}`,{headers:{"Content-Type":"application/json"},...o});if(!r.ok)throw new Error(`API ${r.status}: ${r.statusText}`);return r.json()}const n={memories:{list:e=>{const o=e?"?"+new URLSearchParams(e).toString():"";return t(`/memories${o}`)},get:e=>t(`/memories/${e}`),delete:e=>t(`/memories/${e}`,{method:"DELETE"}),promote:e=>t(`/memories/${e}/promote`,{method:"POST"}),demote:e=>t(`/memories/${e}/demote`,{method:"POST"}),suppress:(e,o)=>t(`/memories/${e}/suppress`,{method:"POST",body:o?JSON.stringify({reason:o}):void 0}),unsuppress:e=>t(`/memories/${e}/unsuppress`,{method:"POST"})},search:(e,o=20)=>t(`/search?q=${encodeURIComponent(e)}&limit=${o}`),stats:()=>t("/stats"),health:()=>t("/health"),timeline:(e=7,o=200)=>t(`/timeline?days=${e}&limit=${o}`),graph:e=>{const o=e?"?"+new URLSearchParams(Object.entries(e).filter(([,r])=>r!==void 0).map(([r,s])=>[r,String(s)])).toString():"";return t(`/graph${o}`)},dream:()=>t("/dream",{method:"POST"}),explore:(e,o="associations",r,s=10)=>t("/explore",{method:"POST",body:JSON.stringify({from_id:e,action:o,to_id:r,limit:s})}),predict:()=>t("/predict",{method:"POST"}),importance:e=>t("/importance",{method:"POST",body:JSON.stringify({content:e})}),consolidate:()=>t("/consolidate",{method:"POST"}),retentionDistribution:()=>t("/retention-distribution"),intentions:(e="active")=>t(`/intentions?status=${e}`),deepReference:(e,o=20)=>t("/deep_reference",{method:"POST",body:JSON.stringify({query:e,depth:o})}),sanhedrin:{latest:()=>t("/sanhedrin/latest"),telemetry:(e=7)=>t(`/sanhedrin/telemetry?days=${e}`),appeal:(e,o,r,s)=>t("/sanhedrin/appeal",{method:"POST",body:JSON.stringify({reason:e,note:o,claimId:r,receiptId:s})})},traces:{list:(e=50)=>t(`/traces?limit=${e}`),get:e=>t(`/traces/${encodeURIComponent(e)}`),exportUrl:e=>`${i}/traces/${encodeURIComponent(e)}/export`},receipts:{list:(e=50)=>t(`/receipts?limit=${e}`),listForRun:(e,o=50)=>t(`/receipts?run=${encodeURIComponent(e)}&limit=${o}`),get:e=>t(`/receipts/${encodeURIComponent(e)}`)},memoryPrs:{list:(e,o=100)=>{const r=new URLSearchParams;return e&&r.set("status",e),r.set("limit",String(o)),t(`/memory-prs?${r.toString()}`)},get:e=>t(`/memory-prs/${encodeURIComponent(e)}`),act:(e,o)=>t(`/memory-prs/${encodeURIComponent(e)}/${o}`,{method:"POST"}),getMode:()=>t("/memory-prs/mode"),setMode:e=>t("/memory-prs/mode",{method:"POST",body:JSON.stringify({mode:e})})}};export{n as a}; diff --git a/apps/dashboard/build/_app/immutable/chunks/CZfHMhLI.js.br b/apps/dashboard/build/_app/immutable/chunks/CZfHMhLI.js.br deleted file mode 100644 index c18a573..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/CZfHMhLI.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CZfHMhLI.js.gz b/apps/dashboard/build/_app/immutable/chunks/CZfHMhLI.js.gz deleted file mode 100644 index cc66162..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/CZfHMhLI.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CcUbQ_Wl.js.br b/apps/dashboard/build/_app/immutable/chunks/CcUbQ_Wl.js.br deleted file mode 100644 index e5e0cfe..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/CcUbQ_Wl.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CcUbQ_Wl.js.gz b/apps/dashboard/build/_app/immutable/chunks/CcUbQ_Wl.js.gz deleted file mode 100644 index 3d7c9cc..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/CcUbQ_Wl.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CfobEeQC.js b/apps/dashboard/build/_app/immutable/chunks/CfobEeQC.js deleted file mode 100644 index c2d39e6..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/CfobEeQC.js +++ /dev/null @@ -1,376 +0,0 @@ -import{C as mt,S as vg,c as Ag,d as Rg,G as ll,e as _t,f as Ku,a as Yn,g as Zs,h as Js,W as ln,i as Pn,B as Ct,j as dl,k as Cg,D as zs,l as oa,m as hl,V as j,L as pl,N as en,n as Eg,o as fl,p as wg,q as Mg,r as Bg,s as Fg,t as Ug,u as Pg,v as Dg,E as gl,M as ml,R as Ss,w as ft,x as _o,y as Xs,z as ms,b as Ye,F as Me,J as ze,U as Le,K as yl,O as xl,Q as Lg,T as Ig,X as Xu,Y as Ys,Z as Vg,_ as Gg,$ as Yu,a0 as Og,a1 as tn,a2 as Tl,a3 as kg,a4 as _l,a5 as aa,a6 as vs,H as pt,a7 as ss,a8 as kt,a9 as Ie,aa as Dn,ab as zg,ac as Wg,ad as ua,ae as fr,af as Ln,ag as $g,ah as Hg,ai as Ur,aj as bl,ak as qg,al as Kg,am as Xg,an as Yg,ao as ot,ap as jg,aq as Nl,ar as Qg,as as bo,at as Sl,au as sn,av as ju,aw as Zg,ax as Jg,ay as vl,az as q,aA as em,aB as tm,aC as No,aD as js,aE as sm,aF as nm,aG as rm,aH as im,aI as om,aJ as am,aK as um,aL as cm,aM as lm,aN as dm,aO as hm,aP as pm,aQ as fm,aR as gm,aS as jn,aT as Qn,aU as mm,aV as oi,aW as ai,aX as ui,aY as ys,aZ as ym,a_ as ci,a$ as ca,b0 as li,b1 as So,b2 as bt,b3 as Al,b4 as Rl,b5 as Cl,b6 as El,b7 as wl,b8 as Ml,b9 as Bl,ba as Fl,bb as Ul,bc as Gs,bd as Pl,be as Dl,bf as Ll,bg as Il,bh as Vl,bi as Gl,bj as Ol,bk as kl,bl as zl,bm as Wl,bn as $l,bo as xm,bp as Tm,bq as _m,br as Hl,bs as $r,bt as Hr,A as qr,bu as ql,bv as Kl,bw as Xl,bx as Yl,by as jl,bz as Ql,bA as Zl,bB as Jl,bC as bm,bD as Nm,bE as ed,bF as An,bG as Rn,bH as Ws,bI as Sm,bJ as la,bK as vm,bL as Am,bM as da,bN as ha,bO as pa,bP as fa,bQ as Li,bR as Pr,bS as Dr,bT as Lr,bU as Qu,bV as Zu,bW as Ju,bX as ec,bY as tc,bZ as vo,b_ as Ao,b$ as Ro,c0 as Co,c1 as Eo,c2 as wo,c3 as Mo,c4 as Bo,c5 as Fo,c6 as Uo,c7 as Po,c8 as Do,c9 as Lo,ca as Io,cb as Vo,cc as Go,cd as Ii,ce as Rm,cf as sc,cg as nc,ch as rc,ci as Cm,cj as Em,ck as wm,cl as Mm,cm as Bm,cn as Fm,co as Um,cp as Pm,cq as Dm,cr as Lm,cs as Im,ct as Vm,cu as Gm,cv as Om,cw as km,cx as zm,cy as Wm,cz as $m,cA as Hm,cB as qm,cC as Km,cD as td,cE as Xm}from"./C-SOZ1Oi.js";import{cF as RR,cG as CR,cH as ER,cI as wR,cJ as MR,cK as BR,cL as FR,cM as UR,cN as PR,cO as DR,cP as LR,cQ as IR,cR as VR,cS as GR,cT as OR,cU as kR,cV as zR,cW as WR,cX as $R,cY as HR,cZ as qR,c_ as KR,c$ as XR,d0 as YR,d1 as jR,d2 as QR,d3 as ZR,d4 as JR,d5 as e0,d6 as t0,d7 as s0,d8 as n0,d9 as r0,da as i0,db as o0,dc as a0,dd as u0,de as c0,df as l0,dg as d0,dh as h0,di as p0,dj as f0,dk as g0,dl as m0,dm as y0,dn as x0,dp as T0,dq as _0,dr as b0,ds as N0,dt as S0,du as v0,dv as A0,dw as R0,dx as C0,dy as E0,dz as w0,dA as M0,dB as B0,dC as F0,dD as U0,dE as P0,dF as D0,dG as L0,dH as I0,dI as V0,dJ as G0,dK as O0,dL as k0,dM as z0,dN as W0,dO as $0,dP as H0,dQ as q0,dR as K0,dS as X0,dT as Y0,I as j0,dU as Q0,dV as Z0,dW as J0,dX as eC,dY as tC,dZ as sC,d_ as nC,d$ as rC,e0 as iC,e1 as oC,e2 as aC,e3 as uC,e4 as cC,e5 as lC,e6 as dC,e7 as hC,e8 as pC,e9 as fC,ea as gC,eb as mC,ec as yC,ed as xC,ee as TC,ef as _C,eg as bC,eh as NC,ei as SC,ej as vC,ek as AC,el as RC,em as CC,en as EC,eo as wC,ep as MC,eq as BC,er as FC,es as UC,et as PC,eu as DC,P as LC,ev as IC,ew as VC,ex as GC,ey as OC,ez as kC,eA as zC,eB as WC,eC as $C,eD as HC,eE as qC,eF as KC,eG as XC,eH as YC,eI as jC,eJ as QC,eK as ZC,eL as JC,eM as eE,eN as tE,eO as sE,eP as nE,eQ as rE,eR as iE,eS as oE,eT as aE,eU as uE,eV as cE,eW as lE,eX as dE,eY as hE,eZ as pE,e_ as fE,e$ as gE,f0 as mE,f1 as yE,f2 as xE,f3 as TE,f4 as _E,f5 as bE,f6 as NE,f7 as SE,f8 as vE,f9 as AE,fa as RE,fb as CE,fc as EE,fd as wE,fe as ME,ff as BE,fg as FE,fh as UE,fi as PE,fj as DE,fk as LE,fl as IE,fm as VE,fn as GE,fo as OE,fp as kE,fq as zE,fr as WE,fs as $E,ft as HE,fu as qE,fv as KE,fw as XE,fx as YE,fy as jE,fz as QE,fA as ZE}from"./C-SOZ1Oi.js";/** - * @license - * Copyright 2010-2024 Three.js Authors - * SPDX-License-Identifier: MIT - */const Ym=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveMap","envMap","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"];class jm{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=Ym,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){const{geometry:s,material:n,object:r}=e;if(t={material:this.getMaterialData(n),geometry:{attributes:this.getAttributesData(s.attributes),indexVersion:s.index?s.index.version:null,drawRange:{start:s.drawRange.start,count:s.drawRange.count}},worldMatrix:r.matrixWorld.clone()},r.center&&(t.center=r.center.clone()),r.morphTargetInfluences&&(t.morphTargetInfluences=r.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),t.material.transmission>0){const{width:i,height:a}=e.context;t.bufferWidth=i,t.bufferHeight=a}this.renderObjects.set(e,t)}return t}getAttributesData(e){const t={};for(const s in e){const n=e[s];t[s]={version:n.version}}return t}containsNode(e){const t=e.material;for(const s in t)if(t[s]&&t[s].isNode)return!0;return e.renderer.nodes.modelViewMatrix!==null||e.renderer.nodes.modelNormalViewMatrix!==null}getMaterialData(e){const t={};for(const s of this.refreshUniforms){const n=e[s];n!=null&&(typeof n=="object"&&n.clone!==void 0?n.isTexture===!0?t[s]={id:n.id,version:n.version}:t[s]=n.clone():t[s]=n)}return t}equals(e){const{object:t,material:s,geometry:n}=e,r=this.getRenderObjectData(e);if(r.worldMatrix.equals(t.matrixWorld)!==!0)return r.worldMatrix.copy(t.matrixWorld),!1;const i=r.material;for(const m in i){const x=i[m],N=s[m];if(x.equals!==void 0){if(x.equals(N)===!1)return x.copy(N),!1}else if(N.isTexture===!0){if(x.id!==N.id||x.version!==N.version)return x.id=N.id,x.version=N.version,!1}else if(x!==N)return i[m]=N,!1}if(i.transmission>0){const{width:m,height:x}=e.context;if(r.bufferWidth!==m||r.bufferHeight!==x)return r.bufferWidth=m,r.bufferHeight=x,!1}const a=r.geometry,u=n.attributes,c=a.attributes,l=Object.keys(c),d=Object.keys(u);if(l.length!==d.length)return r.geometry.attributes=this.getAttributesData(u),!1;for(const m of l){const x=c[m],N=u[m];if(N===void 0)return delete c[m],!1;if(x.version!==N.version)return x.version=N.version,!1}const h=n.index,p=a.indexVersion,f=h?h.version:null;if(p!==f)return a.indexVersion=f,!1;if(a.drawRange.start!==n.drawRange.start||a.drawRange.count!==n.drawRange.count)return a.drawRange.start=n.drawRange.start,a.drawRange.count=n.drawRange.count,!1;if(r.morphTargetInfluences){let m=!1;for(let x=0;x>>16,2246822507),t^=Math.imul(s^s>>>13,3266489909),s=Math.imul(s^s>>>16,2246822507),s^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&s)+(t>>>0)}const ga=o=>In(o),Zn=o=>In(o),di=(...o)=>In(o);function ma(o,e=!1){const t=[];o.isNode===!0&&(t.push(o.id),o=o.getSelf());for(const{property:s,childNode:n}of Vn(o))t.push(t,In(s.slice(0,-4)),n.getCacheKey(e));return In(t)}function*Vn(o,e=!1){for(const t in o){if(t.startsWith("_")===!0)continue;const s=o[t];if(Array.isArray(s)===!0)for(let n=0;ne.charCodeAt(0)).buffer}var cR=Object.freeze({__proto__:null,arrayBufferToBase64:Na,base64ToArrayBuffer:Sa,getCacheKey:ma,getDataFromObject:ba,getLengthFromType:Ta,getNodeChildren:Vn,getTypeFromLength:ya,getTypedArrayFromType:xa,getValueFromType:_a,getValueType:Ot,hash:di,hashArray:Zn,hashString:ga});const Oo={VERTEX:"vertex",FRAGMENT:"fragment"},W={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},Zm={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},Ve={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},sd=["fragment","vertex"],ko=["setup","analyze","generate"],zo=[...sd,"compute"],As=["x","y","z","w"];let Jm=0;class O extends gl{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=W.NONE,this.updateBeforeType=W.NONE,this.updateAfterType=W.NONE,this.uuid=ml.generateUUID(),this.version=0,this.global=!1,this.isNode=!0,this._cacheKey=null,this._cacheKeyVersion=0,Object.defineProperty(this,"id",{value:Jm++})}set needsUpdate(e){e===!0&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this.getSelf()),this}onFrameUpdate(e){return this.onUpdate(e,W.FRAME)}onRenderUpdate(e){return this.onUpdate(e,W.RENDER)}onObjectUpdate(e){return this.onUpdate(e,W.OBJECT)}onReference(e){return this.updateReference=e.bind(this.getSelf()),this}getSelf(){return this.self||this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of Vn(this))yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}getCacheKey(e=!1){return e=e||this.version!==this._cacheKeyVersion,(e===!0||this._cacheKey===null)&&(this._cacheKey=di(ma(this,e),this.customCacheKey()),this._cacheKeyVersion=this.version),this._cacheKey}customCacheKey(){return 0}getScope(){return this}getHash(){return this.uuid}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){const t=this.getNodeType(e);return e.getElementType(t)}getNodeType(e){const t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}getShared(e){const t=this.getHash(e);return e.getNodeFromHash(t)||this}setup(e){const t=e.getNodeProperties(this);let s=0;for(const n of this.getChildren())t["node"+s++]=n;return t.outputNode||null}analyze(e){if(e.increaseUsage(this)===1){const s=e.getNodeProperties(this);for(const n of Object.values(s))n&&n.isNode===!0&&n.build(e)}}generate(e,t){const{outputNode:s}=e.getNodeProperties(this);if(s&&s.isNode===!0)return s.build(e,t)}updateBefore(){console.warn("Abstract function.")}updateAfter(){console.warn("Abstract function.")}update(){console.warn("Abstract function.")}build(e,t=null){const s=this.getShared(e);if(this!==s)return s.build(e,t);e.addNode(this),e.addChain(this);let n=null;const r=e.getBuildStage();if(r==="setup"){this.updateReference(e);const i=e.getNodeProperties(this);if(i.initialized!==!0){i.initialized=!0;const a=this.setup(e),u=a&&a.isNode===!0;for(const c of Object.values(i))c&&c.isNode===!0&&c.build(e);u&&a.build(e),i.outputNode=a}}else if(r==="analyze")this.analyze(e);else if(r==="generate")if(this.generate.length===1){const a=this.getNodeType(e),u=e.getDataFromNode(this);n=u.snippet,n===void 0?(n=this.generate(e)||"",u.snippet=n):u.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),n=e.format(n,a,t)}else n=this.generate(e,t)||"";return e.removeChain(this),e.addSequentialNode(this),n}getSerializeChildren(){return Vn(this)}serialize(e){const t=this.getSerializeChildren(),s={};for(const{property:n,index:r,childNode:i}of t)r!==void 0?(s[n]===void 0&&(s[n]=Number.isInteger(r)?[]:{}),s[n][r]=i.toJSON(e.meta).uuid):s[n]=i.toJSON(e.meta).uuid;Object.keys(s).length>0&&(e.inputNodes=s)}deserialize(e){if(e.inputNodes!==void 0){const t=e.meta.nodes;for(const s in e.inputNodes)if(Array.isArray(e.inputNodes[s])){const n=[];for(const r of e.inputNodes[s])n.push(t[r]);this[s]=n}else if(typeof e.inputNodes[s]=="object"){const n={};for(const r in e.inputNodes[s]){const i=e.inputNodes[s][r];n[r]=t[i]}this[s]=n}else{const n=e.inputNodes[s];this[s]=t[n]}}}toJSON(e){const{uuid:t,type:s}=this,n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{},nodes:{}});let r=e.nodes[t];r===void 0&&(r={uuid:t,type:s,meta:e,metadata:{version:4.6,type:"Node",generator:"Node.toJSON"}},n!==!0&&(e.nodes[r.uuid]=r),this.serialize(r),delete r.meta);function i(a){const u=[];for(const c in a){const l=a[c];delete l.metadata,u.push(l)}return u}if(n){const a=i(e.textures),u=i(e.images),c=i(e.nodes);a.length>0&&(r.textures=a),u.length>0&&(r.images=u),c.length>0&&(r.nodes=c)}return r}}class Rs extends O{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}generate(e){const t=this.node.build(e),s=this.indexNode.build(e,"uint");return`${t}[ ${s} ]`}}class nd extends O{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){const t=this.node.getNodeType(e);let s=null;for(const n of this.convertTo.split("|"))(s===null||e.getTypeLength(t)===e.getTypeLength(n))&&(s=n);return s}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){const s=this.node,n=this.getNodeType(e),r=s.build(e,n);return e.format(r,n,t)}}class be extends O{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){const n=e.getVectorType(this.getNodeType(e,t)),r=e.getDataFromNode(this);if(r.propertyName!==void 0)return e.format(r.propertyName,n,t);if(n!=="void"&&t!=="void"&&this.hasDependencies(e)){const i=super.build(e,n),a=e.getVarFromNode(this,null,n),u=e.getPropertyName(a);return e.addLineFlowCode(`${u} = ${i}`,this),r.snippet=i,r.propertyName=u,e.format(r.propertyName,n,t)}}return super.build(e,t)}}class ey extends be{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}getNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,s)=>t+e.getTypeLength(s.getNodeType(e)),0))}generate(e,t){const s=this.getNodeType(e),n=this.nodes,r=e.getComponentType(s),i=[];for(const u of n){let c=u.build(e);const l=e.getComponentType(u.getNodeType(e));l!==r&&(c=e.format(c,l,r)),i.push(c)}const a=`${e.getType(s)}( ${i.join(", ")} )`;return e.format(a,s,t)}}const ty=As.join("");class Wo extends O{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(const t of this.components)e=Math.max(As.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}generate(e,t){const s=this.node,n=e.getTypeLength(s.getNodeType(e));let r=null;if(n>1){let i=null;this.getVectorLength()>=n&&(i=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const u=s.build(e,i);this.components.length===n&&this.components===ty.slice(0,this.components.length)?r=e.format(u,i,t):r=e.format(`${u}.${this.components}`,this.getNodeType(e),t)}else r=s.build(e,t);return r}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class sy extends be{static get type(){return"SetNode"}constructor(e,t,s){super(),this.sourceNode=e,this.components=t,this.targetNode=s}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{sourceNode:t,components:s,targetNode:n}=this,r=this.getNodeType(e),i=e.getComponentType(n.getNodeType(e)),a=e.getTypeFromLength(s.length,i),u=n.build(e,a),c=t.build(e,r),l=e.getTypeLength(r),d=[];for(let h=0;ho.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),oc=o=>rd(o).split("").sort().join(""),id={setup(o,e){const t=e.shift();return o(Jn(t),...e)},get(o,e,t){if(typeof e=="string"&&o[e]===void 0){if(o.isStackNode!==!0&&e==="assign")return(...s)=>(nn.assign(t,...s),t);if($s.has(e)){const s=$s.get(e);return o.isStackNode?(...n)=>t.add(s(...n)):(...n)=>s(t,...n)}else{if(e==="self")return o;if(e.endsWith("Assign")&&$s.has(e.slice(0,e.length-6))){const s=$s.get(e.slice(0,e.length-6));return o.isStackNode?(...n)=>t.assign(n[0],s(...n)):(...n)=>t.assign(s(t,...n))}else{if(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0)return e=rd(e),E(new Wo(t,e));if(/^set[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=oc(e.slice(3).toLowerCase()),s=>E(new sy(o,e,s));if(/^flip[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=oc(e.slice(4).toLowerCase()),()=>E(new ny(E(o),e));if(e==="width"||e==="height"||e==="depth")return e==="width"?e="x":e==="height"?e="y":e==="depth"&&(e="z"),E(new Wo(o,e));if(/^\d+$/.test(e)===!0)return E(new Rs(t,new yt(Number(e),"uint")))}}}return Reflect.get(o,e,t)},set(o,e,t,s){return typeof e=="string"&&o[e]===void 0&&(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0||e==="width"||e==="height"||e==="depth"||/^\d+$/.test(e)===!0)?(s[e].assign(t),!0):Reflect.set(o,e,t,s)}},Vi=new WeakMap,ac=new WeakMap,ry=function(o,e=null){const t=Ot(o);if(t==="node"){let s=Vi.get(o);return s===void 0&&(s=new Proxy(o,id),Vi.set(o,s),Vi.set(s,s)),s}else{if(e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string")return E($o(o,e));if(t==="shader")return b(o)}return o},iy=function(o,e=null){for(const t in o)o[t]=E(o[t],e);return o},oy=function(o,e=null){const t=o.length;for(let s=0;sE(s!==null?Object.assign(r,s):r);return e===null?(...r)=>n(new o(...xs(r))):t!==null?(t=E(t),(...r)=>n(new o(e,...xs(r),t))):(...r)=>n(new o(e,...xs(r)))},uy=function(o,...e){return E(new o(...xs(e)))};class cy extends O{constructor(e,t){super(),this.shaderNode=e,this.inputNodes=t}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}call(e){const{shaderNode:t,inputNodes:s}=this,n=e.getNodeProperties(t);if(n.onceOutput)return n.onceOutput;let r=null;if(t.layout){let i=ac.get(e.constructor);i===void 0&&(i=new WeakMap,ac.set(e.constructor,i));let a=i.get(t);a===void 0&&(a=E(e.buildFunctionNode(t)),i.set(t,a)),e.currentFunctionNode!==null&&e.currentFunctionNode.includes.push(a),r=E(a.call(s))}else{const i=t.jsFunc,a=s!==null?i(s,e):i(e);r=E(a)}return t.once&&(n.onceOutput=r),r}getOutputNode(e){const t=e.getNodeProperties(this);return t.outputNode===null&&(t.outputNode=this.setupOutput(e)),t.outputNode}setup(e){return this.getOutputNode(e)}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}generate(e,t){return this.getOutputNode(e).build(e,t)}}class ly extends O{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}call(e=null){return Jn(e),E(new cy(this,e))}setup(){return this.call()}}const dy=[!1,!0],hy=[0,1,2,3],py=[-1,-2],od=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],Aa=new Map;for(const o of dy)Aa.set(o,new yt(o));const Ra=new Map;for(const o of hy)Ra.set(o,new yt(o,"uint"));const Ca=new Map([...Ra].map(o=>new yt(o.value,"int")));for(const o of py)Ca.set(o,new yt(o,"int"));const hi=new Map([...Ca].map(o=>new yt(o.value)));for(const o of od)hi.set(o,new yt(o));for(const o of od)hi.set(-o,new yt(-o));const pi={bool:Aa,uint:Ra,ints:Ca,float:hi},uc=new Map([...Aa,...hi]),$o=(o,e)=>uc.has(o)?uc.get(o):o.isNode===!0?o:new yt(o,e),fy=o=>{try{return o.getNodeType()}catch{return}},ve=function(o,e=null){return(...t)=>{if((t.length===0||!["bool","float","int","uint"].includes(o)&&t.every(n=>typeof n!="object"))&&(t=[_a(o,...t)]),t.length===1&&e!==null&&e.has(t[0]))return E(e.get(t[0]));if(t.length===1){const n=$o(t[0],o);return fy(n)===o?E(n):E(new nd(n,o))}const s=t.map(n=>$o(n));return E(new ey(s,o))}},Gn=o=>typeof o=="object"&&o!==null?o.value:o,ad=o=>o!=null?o.nodeType||o.convertTo||(typeof o=="string"?o:null):null;function Cn(o,e){return new Proxy(new ly(o,e),id)}const E=(o,e=null)=>ry(o,e),Jn=(o,e=null)=>new iy(o,e),xs=(o,e=null)=>new oy(o,e),C=(...o)=>new ay(...o),U=(...o)=>new uy(...o),b=(o,e)=>{const t=new Cn(o,e),s=(...n)=>{let r;return Jn(n),n[0]&&n[0].isNode?r=[...n]:r=n[0],t.call(r)};return s.shaderNode=t,s.setLayout=n=>(t.setLayout(n),s),s.once=()=>(t.once=!0,s),s},gy=(...o)=>(console.warn("TSL.ShaderNode: tslFn() has been renamed to Fn()."),b(...o));R("toGlobal",o=>(o.global=!0,o));const On=o=>{nn=o},Ea=()=>nn,z=(...o)=>nn.If(...o);function ud(o){return nn&&nn.add(o),o}R("append",ud);const cd=new ve("color"),g=new ve("float",pi.float),y=new ve("int",pi.ints),D=new ve("uint",pi.uint),Ht=new ve("bool",pi.bool),M=new ve("vec2"),Ae=new ve("ivec2"),ld=new ve("uvec2"),dd=new ve("bvec2"),T=new ve("vec3"),hd=new ve("ivec3"),dn=new ve("uvec3"),wa=new ve("bvec3"),P=new ve("vec4"),pd=new ve("ivec4"),fd=new ve("uvec4"),gd=new ve("bvec4"),fi=new ve("mat2"),Oe=new ve("mat3"),Ts=new ve("mat4"),my=(o="")=>E(new yt(o,"string")),yy=o=>E(new yt(o,"ArrayBuffer"));R("toColor",cd);R("toFloat",g);R("toInt",y);R("toUint",D);R("toBool",Ht);R("toVec2",M);R("toIVec2",Ae);R("toUVec2",ld);R("toBVec2",dd);R("toVec3",T);R("toIVec3",hd);R("toUVec3",dn);R("toBVec3",wa);R("toVec4",P);R("toIVec4",pd);R("toUVec4",fd);R("toBVec4",gd);R("toMat2",fi);R("toMat3",Oe);R("toMat4",Ts);const md=C(Rs),yd=(o,e)=>E(new nd(E(o),e)),xy=(o,e)=>E(new Wo(E(o),e));R("element",md);R("convert",yd);class xd extends O{static get type(){return"UniformGroupNode"}constructor(e,t=!1,s=1){super("string"),this.name=e,this.shared=t,this.order=s,this.isUniformGroup=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}}const Td=o=>new xd(o),Ma=(o,e=0)=>new xd(o,!0,e),_d=Ma("frame"),k=Ma("render"),Ba=Td("object");class er extends va{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=Ba}label(e){return this.name=e,this}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){const s=this.getSelf();return e=e.bind(s),super.onUpdate(n=>{const r=e(n,s);r!==void 0&&(this.value=r)},t)}generate(e,t){const s=this.getNodeType(e),n=this.getUniformHash(e);let r=e.getNodeFromHash(n);r===void 0&&(e.setHashNode(this,n),r=this);const i=r.getInputType(e),a=e.getUniformFromNode(r,i,e.shaderStage,this.name||e.context.label),u=e.getPropertyName(a);return e.context.label!==void 0&&delete e.context.label,e.format(u,s,t)}}const V=(o,e)=>{const t=ad(e||o),s=o&&o.isNode===!0?o.node&&o.node.value||o.value:o;return E(new er(s,t))};class se extends O{static get type(){return"PropertyNode"}constructor(e,t=null,s=!1){super(e),this.name=t,this.varying=s,this.isPropertyNode=!0}getHash(e){return this.name||super.getHash(e)}isGlobal(){return!0}generate(e){let t;return this.varying===!0?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}const Fa=(o,e)=>E(new se(o,e)),et=(o,e)=>E(new se(o,e,!0)),ee=U(se,"vec4","DiffuseColor"),Ho=U(se,"vec3","EmissiveColor"),Nt=U(se,"float","Roughness"),kn=U(se,"float","Metalness"),Kr=U(se,"float","Clearcoat"),zn=U(se,"float","ClearcoatRoughness"),fs=U(se,"vec3","Sheen"),gi=U(se,"float","SheenRoughness"),mi=U(se,"float","Iridescence"),Ua=U(se,"float","IridescenceIOR"),Pa=U(se,"float","IridescenceThickness"),Xr=U(se,"float","AlphaT"),Zt=U(se,"float","Anisotropy"),En=U(se,"vec3","AnisotropyT"),_s=U(se,"vec3","AnisotropyB"),We=U(se,"color","SpecularColor"),Wn=U(se,"float","SpecularF90"),Yr=U(se,"float","Shininess"),$n=U(se,"vec4","Output"),bs=U(se,"float","dashSize"),Hn=U(se,"float","gapSize"),Ty=U(se,"float","pointWidth"),wn=U(se,"float","IOR"),jr=U(se,"float","Transmission"),Da=U(se,"float","Thickness"),La=U(se,"float","AttenuationDistance"),Ia=U(se,"color","AttenuationColor"),Va=U(se,"float","Dispersion");class _y extends be{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t}hasDependencies(){return!1}getNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){const{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){const s=e.getTypeLength(t.node.getNodeType(e));return As.join("").slice(0,s)!==t.components}return!1}generate(e,t){const{targetNode:s,sourceNode:n}=this,r=this.needsSplitAssign(e),i=s.getNodeType(e),a=s.context({assign:!0}).build(e),u=n.build(e,i),c=n.getNodeType(e),l=e.getDataFromNode(this);let d;if(l.initialized===!0)t!=="void"&&(d=a);else if(r){const h=e.getVarFromNode(this,null,i),p=e.getPropertyName(h);e.addLineFlowCode(`${p} = ${u}`,this);const f=s.node.context({assign:!0}).build(e);for(let m=0;m{const l=c.type,d=l==="pointer";let h;return d?h="&"+u.build(e):h=u.build(e,l),h};if(Array.isArray(r))for(let u=0;u(e=e.length>1||e[0]&&e[0].isNode===!0?xs(e):Jn(e[0]),E(new by(E(o),e)));R("call",Nd);class pe extends be{static get type(){return"OperatorNode"}constructor(e,t,s,...n){if(super(),n.length>0){let r=new pe(e,t,s);for(let i=0;i>"||s==="<<")return e.getIntegerType(i);if(s==="!"||s==="=="||s==="&&"||s==="||"||s==="^^")return"bool";if(s==="<"||s===">"||s==="<="||s===">="){const u=t?e.getTypeLength(t):Math.max(e.getTypeLength(i),e.getTypeLength(a));return u>1?`bvec${u}`:"bool"}else return i==="float"&&e.isMatrix(a)?a:e.isMatrix(i)&&e.isVector(a)?e.getVectorFromMatrix(i):e.isVector(i)&&e.isMatrix(a)?e.getVectorFromMatrix(a):e.getTypeLength(a)>e.getTypeLength(i)?a:i}generate(e,t){const s=this.op,n=this.aNode,r=this.bNode,i=this.getNodeType(e,t);let a=null,u=null;i!=="void"?(a=n.getNodeType(e),u=typeof r<"u"?r.getNodeType(e):null,s==="<"||s===">"||s==="<="||s===">="||s==="=="?e.isVector(a)?u=a:a!==u&&(a=u="float"):s===">>"||s==="<<"?(a=i,u=e.changeComponentType(u,"uint")):e.isMatrix(a)&&e.isVector(u)?u=e.getVectorFromMatrix(a):e.isVector(a)&&e.isMatrix(u)?a=e.getVectorFromMatrix(u):a=u=i):a=u=i;const c=n.build(e,a),l=typeof r<"u"?r.build(e,u):null,d=e.getTypeLength(t),h=e.getFunctionOperator(s);if(t!=="void")return s==="<"&&d>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThan",t)}( ${c}, ${l} )`,i,t):e.format(`( ${c} < ${l} )`,i,t):s==="<="&&d>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThanEqual",t)}( ${c}, ${l} )`,i,t):e.format(`( ${c} <= ${l} )`,i,t):s===">"&&d>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThan",t)}( ${c}, ${l} )`,i,t):e.format(`( ${c} > ${l} )`,i,t):s===">="&&d>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThanEqual",t)}( ${c}, ${l} )`,i,t):e.format(`( ${c} >= ${l} )`,i,t):s==="!"||s==="~"?e.format(`(${s}${c})`,a,t):h?e.format(`${h}( ${c}, ${l} )`,i,t):e.format(`( ${c} ${s} ${l} )`,i,t);if(a!=="void")return h?e.format(`${h}( ${c}, ${l} )`,i,t):e.format(`${c} ${s} ${l}`,i,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const _e=C(pe,"+"),Y=C(pe,"-"),$=C(pe,"*"),gt=C(pe,"/"),Ga=C(pe,"%"),Sd=C(pe,"=="),vd=C(pe,"!="),Ad=C(pe,"<"),Oa=C(pe,">"),Rd=C(pe,"<="),Cd=C(pe,">="),Ed=C(pe,"&&"),wd=C(pe,"||"),Md=C(pe,"!"),Bd=C(pe,"^^"),Fd=C(pe,"&"),Ud=C(pe,"~"),Pd=C(pe,"|"),Dd=C(pe,"^"),Ld=C(pe,"<<"),Id=C(pe,">>");R("add",_e);R("sub",Y);R("mul",$);R("div",gt);R("modInt",Ga);R("equal",Sd);R("notEqual",vd);R("lessThan",Ad);R("greaterThan",Oa);R("lessThanEqual",Rd);R("greaterThanEqual",Cd);R("and",Ed);R("or",wd);R("not",Md);R("xor",Bd);R("bitAnd",Fd);R("bitNot",Ud);R("bitOr",Pd);R("bitXor",Dd);R("shiftLeft",Ld);R("shiftRight",Id);const Vd=(...o)=>(console.warn("TSL.OperatorNode: .remainder() has been renamed to .modInt()."),Ga(...o));R("remainder",Vd);class S extends be{static get type(){return"MathNode"}constructor(e,t,s=null,n=null){super(),this.method=e,this.aNode=t,this.bNode=s,this.cNode=n}getInputType(e){const t=this.aNode.getNodeType(e),s=this.bNode?this.bNode.getNodeType(e):null,n=this.cNode?this.cNode.getNodeType(e):null,r=e.isMatrix(t)?0:e.getTypeLength(t),i=e.isMatrix(s)?0:e.getTypeLength(s),a=e.isMatrix(n)?0:e.getTypeLength(n);return r>i&&r>a?t:i>a?s:a>r?n:t}getNodeType(e){const t=this.method;return t===S.LENGTH||t===S.DISTANCE||t===S.DOT?"float":t===S.CROSS?"vec3":t===S.ALL?"bool":t===S.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):t===S.MOD?this.aNode.getNodeType(e):this.getInputType(e)}generate(e,t){let s=this.method;const n=this.getNodeType(e),r=this.getInputType(e),i=this.aNode,a=this.bNode,u=this.cNode,c=e.renderer.coordinateSystem;if(s===S.TRANSFORM_DIRECTION){let l=i,d=a;e.isMatrix(l.getNodeType(e))?d=P(T(d),0):l=P(T(l),0);const h=$(l,d).xyz;return qt(h).build(e,t)}else{if(s===S.NEGATE)return e.format("( - "+i.build(e,r)+" )",n,t);if(s===S.ONE_MINUS)return Y(1,i).build(e,t);if(s===S.RECIPROCAL)return gt(1,i).build(e,t);if(s===S.DIFFERENCE)return oe(Y(i,a)).build(e,t);{const l=[];return s===S.CROSS||s===S.MOD?l.push(i.build(e,n),a.build(e,n)):c===Pn&&s===S.STEP?l.push(i.build(e,e.getTypeLength(i.getNodeType(e))===1?"float":r),a.build(e,r)):c===Pn&&(s===S.MIN||s===S.MAX)||s===S.MOD?l.push(i.build(e,r),a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":r)):s===S.REFRACT?l.push(i.build(e,r),a.build(e,r),u.build(e,"float")):s===S.MIX?l.push(i.build(e,r),a.build(e,r),u.build(e,e.getTypeLength(u.getNodeType(e))===1?"float":r)):(c===ln&&s===S.ATAN&&a!==null&&(s="atan2"),l.push(i.build(e,r)),a!==null&&l.push(a.build(e,r)),u!==null&&l.push(u.build(e,r))),e.format(`${e.getMethod(s,n)}( ${l.join(", ")} )`,n,t)}}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}S.ALL="all";S.ANY="any";S.RADIANS="radians";S.DEGREES="degrees";S.EXP="exp";S.EXP2="exp2";S.LOG="log";S.LOG2="log2";S.SQRT="sqrt";S.INVERSE_SQRT="inversesqrt";S.FLOOR="floor";S.CEIL="ceil";S.NORMALIZE="normalize";S.FRACT="fract";S.SIN="sin";S.COS="cos";S.TAN="tan";S.ASIN="asin";S.ACOS="acos";S.ATAN="atan";S.ABS="abs";S.SIGN="sign";S.LENGTH="length";S.NEGATE="negate";S.ONE_MINUS="oneMinus";S.DFDX="dFdx";S.DFDY="dFdy";S.ROUND="round";S.RECIPROCAL="reciprocal";S.TRUNC="trunc";S.FWIDTH="fwidth";S.TRANSPOSE="transpose";S.BITCAST="bitcast";S.EQUALS="equals";S.MIN="min";S.MAX="max";S.MOD="mod";S.STEP="step";S.REFLECT="reflect";S.DISTANCE="distance";S.DIFFERENCE="difference";S.DOT="dot";S.CROSS="cross";S.POW="pow";S.TRANSFORM_DIRECTION="transformDirection";S.MIX="mix";S.CLAMP="clamp";S.REFRACT="refract";S.SMOOTHSTEP="smoothstep";S.FACEFORWARD="faceforward";const Gd=g(1e-6),Ny=g(1e6),Qr=g(Math.PI),Sy=g(Math.PI*2),ka=C(S,S.ALL),Od=C(S,S.ANY),kd=C(S,S.RADIANS),zd=C(S,S.DEGREES),za=C(S,S.EXP),rn=C(S,S.EXP2),yi=C(S,S.LOG),vt=C(S,S.LOG2),Pt=C(S,S.SQRT),Wa=C(S,S.INVERSE_SQRT),At=C(S,S.FLOOR),xi=C(S,S.CEIL),qt=C(S,S.NORMALIZE),Xt=C(S,S.FRACT),st=C(S,S.SIN),It=C(S,S.COS),Wd=C(S,S.TAN),$d=C(S,S.ASIN),Hd=C(S,S.ACOS),$a=C(S,S.ATAN),oe=C(S,S.ABS),qn=C(S,S.SIGN),zt=C(S,S.LENGTH),qd=C(S,S.NEGATE),Kd=C(S,S.ONE_MINUS),Ha=C(S,S.DFDX),qa=C(S,S.DFDY),Xd=C(S,S.ROUND),Yd=C(S,S.RECIPROCAL),Ka=C(S,S.TRUNC),jd=C(S,S.FWIDTH),Qd=C(S,S.TRANSPOSE),vy=C(S,S.BITCAST),Zd=C(S,S.EQUALS),Re=C(S,S.MIN),ue=C(S,S.MAX),Xa=C(S,S.MOD),Ti=C(S,S.STEP),Jd=C(S,S.REFLECT),eh=C(S,S.DISTANCE),th=C(S,S.DIFFERENCE),is=C(S,S.DOT),_i=C(S,S.CROSS),ht=C(S,S.POW),Ya=C(S,S.POW,2),sh=C(S,S.POW,3),nh=C(S,S.POW,4),rh=C(S,S.TRANSFORM_DIRECTION),ih=o=>$(qn(o),ht(oe(o),1/3)),ja=o=>is(o,o),Q=C(S,S.MIX),Et=(o,e=0,t=1)=>E(new S(S.CLAMP,E(o),E(e),E(t))),oh=o=>Et(o),Qa=C(S,S.REFRACT),ct=C(S,S.SMOOTHSTEP),Za=C(S,S.FACEFORWARD),ah=b(([o])=>{const s=43758.5453,n=is(o.xy,M(12.9898,78.233)),r=Xa(n,Qr);return Xt(st(r).mul(s))}),uh=(o,e,t)=>Q(e,t,o),ch=(o,e,t)=>ct(e,t,o),lh=(o,e)=>(console.warn('THREE.TSL: "atan2" is overloaded. Use "atan" instead.'),$a(o,e)),Ay=Za,Ry=Wa;R("all",ka);R("any",Od);R("equals",Zd);R("radians",kd);R("degrees",zd);R("exp",za);R("exp2",rn);R("log",yi);R("log2",vt);R("sqrt",Pt);R("inverseSqrt",Wa);R("floor",At);R("ceil",xi);R("normalize",qt);R("fract",Xt);R("sin",st);R("cos",It);R("tan",Wd);R("asin",$d);R("acos",Hd);R("atan",$a);R("abs",oe);R("sign",qn);R("length",zt);R("lengthSq",ja);R("negate",qd);R("oneMinus",Kd);R("dFdx",Ha);R("dFdy",qa);R("round",Xd);R("reciprocal",Yd);R("trunc",Ka);R("fwidth",jd);R("atan2",lh);R("min",Re);R("max",ue);R("mod",Xa);R("step",Ti);R("reflect",Jd);R("distance",eh);R("dot",is);R("cross",_i);R("pow",ht);R("pow2",Ya);R("pow3",sh);R("pow4",nh);R("transformDirection",rh);R("mix",uh);R("clamp",Et);R("refract",Qa);R("smoothstep",ch);R("faceForward",Za);R("difference",th);R("saturate",oh);R("cbrt",ih);R("transpose",Qd);R("rand",ah);class Cy extends O{static get type(){return"ConditionalNode"}constructor(e,t,s=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=s}getNodeType(e){const{ifNode:t,elseNode:s}=e.getNodeProperties(this);if(t===void 0)return this.setup(e),this.getNodeType(e);const n=t.getNodeType(e);if(s!==null){const r=s.getNodeType(e);if(e.getTypeLength(r)>e.getTypeLength(n))return r}return n}setup(e){const t=this.condNode.cache(),s=this.ifNode.cache(),n=this.elseNode?this.elseNode.cache():null,r=e.context.nodeBlock;e.getDataFromNode(s).parentNodeBlock=r,n!==null&&(e.getDataFromNode(n).parentNodeBlock=r);const i=e.getNodeProperties(this);i.condNode=t,i.ifNode=s.context({nodeBlock:s}),i.elseNode=n?n.context({nodeBlock:n}):null}generate(e,t){const s=this.getNodeType(e),n=e.getDataFromNode(this);if(n.nodeProperty!==void 0)return n.nodeProperty;const{condNode:r,ifNode:i,elseNode:a}=e.getNodeProperties(this),u=t!=="void",c=u?Fa(s).build(e):"";n.nodeProperty=c;const l=r.build(e,"bool");e.addFlowCode(` -${e.tab}if ( ${l} ) { - -`).addFlowTab();let d=i.build(e,s);if(d&&(u?d=c+" = "+d+";":d="return "+d+";"),e.removeFlowTab().addFlowCode(e.tab+" "+d+` - -`+e.tab+"}"),a!==null){e.addFlowCode(` else { - -`).addFlowTab();let h=a.build(e,s);h&&(u?h=c+" = "+h+";":h="return "+h+";"),e.removeFlowTab().addFlowCode(e.tab+" "+h+` - -`+e.tab+`} - -`)}else e.addFlowCode(` - -`);return e.format(c,s,t)}}const Ue=C(Cy);R("select",Ue);const dh=(...o)=>(console.warn("TSL.ConditionalNode: cond() has been renamed to select()."),Ue(...o));R("cond",dh);class hh extends O{static get type(){return"ContextNode"}constructor(e,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}getNodeType(e){return this.node.getNodeType(e)}analyze(e){this.node.build(e)}setup(e){const t=e.getContext();e.setContext({...e.context,...this.value});const s=this.node.build(e);return e.setContext(t),s}generate(e,t){const s=e.getContext();e.setContext({...e.context,...this.value});const n=this.node.build(e,t);return e.setContext(s),n}}const bi=C(hh),ph=(o,e)=>bi(o,{label:e});R("context",bi);R("label",ph);class Ir extends O{static get type(){return"VarNode"}constructor(e,t=null){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}generate(e){const{node:t,name:s}=this,n=e.getVarFromNode(this,s,e.getVectorType(this.getNodeType(e))),r=e.getPropertyName(n),i=t.build(e,n.type);return e.addLineFlowCode(`${r} = ${i}`,this),r}}const fh=C(Ir);R("toVar",(...o)=>fh(...o).append());const gh=o=>(console.warn('TSL: "temp" is deprecated. Use ".toVar()" instead.'),fh(o));R("temp",gh);class Ey extends O{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=e,this.name=t,this.isVaryingNode=!0}isGlobal(){return!0}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}setupVarying(e){const t=e.getNodeProperties(this);let s=t.varying;if(s===void 0){const n=this.name,r=this.getNodeType(e);t.varying=s=e.getVaryingFromNode(this,n,r),t.node=this.node}return s.needsInterpolation||(s.needsInterpolation=e.shaderStage==="fragment"),s}setup(e){this.setupVarying(e)}analyze(e){return this.setupVarying(e),this.node.analyze(e)}generate(e){const t=e.getNodeProperties(this),s=this.setupVarying(e),n=e.shaderStage==="fragment"&&t.reassignPosition===!0&&e.context.needsPositionReassign;if(t.propertyName===void 0||n){const r=this.getNodeType(e),i=e.getPropertyName(s,Oo.VERTEX);e.flowNodeFromShaderStage(Oo.VERTEX,this.node,r,i),t.propertyName=i,n?t.reassignPosition=!1:t.reassignPosition===void 0&&e.context.isPositionNodeInput&&(t.reassignPosition=!0)}return e.getPropertyName(s)}}const ke=C(Ey),mh=o=>ke(o);R("varying",ke);R("vertexStage",mh);const yh=b(([o])=>{const e=o.mul(.9478672986).add(.0521327014).pow(2.4),t=o.mul(.0773993808),s=o.lessThanEqual(.04045);return Q(e,t,s)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),xh=b(([o])=>{const e=o.pow(.41666).mul(1.055).sub(.055),t=o.mul(12.92),s=o.lessThanEqual(.0031308);return Q(e,t,s)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),tr="WorkingColorSpace",Ja="OutputColorSpace";class sr extends be{static get type(){return"ColorSpaceNode"}constructor(e,t,s){super("vec4"),this.colorNode=e,this.source=t,this.target=s}resolveColorSpace(e,t){return t===tr?_t.workingColorSpace:t===Ja?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){const{colorNode:t}=this,s=this.resolveColorSpace(e,this.source),n=this.resolveColorSpace(e,this.target);let r=t;return _t.enabled===!1||s===n||!s||!n||(_t.getTransfer(s)===Ku&&(r=P(yh(r.rgb),r.a)),_t.getPrimaries(s)!==_t.getPrimaries(n)&&(r=P(Oe(_t._getMatrix(new Yn,s,n)).mul(r.rgb),r.a)),_t.getTransfer(n)===Ku&&(r=P(xh(r.rgb),r.a))),r}}const Th=o=>E(new sr(E(o),tr,Ja)),_h=o=>E(new sr(E(o),Ja,tr)),bh=(o,e)=>E(new sr(E(o),tr,e)),eu=(o,e)=>E(new sr(E(o),e,tr)),wy=(o,e,t)=>E(new sr(E(o),e,t));R("toOutputColorSpace",Th);R("toWorkingColorSpace",_h);R("workingToColorSpace",bh);R("colorSpaceToWorking",eu);let My=class extends Rs{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),s=this.referenceNode.getNodeType(),n=this.getNodeType();return e.format(t,s,n)}};class Nh extends O{static get type(){return"ReferenceBaseNode"}constructor(e,t,s=null,n=null){super(),this.property=e,this.uniformType=t,this.object=s,this.count=n,this.properties=e.split("."),this.reference=s,this.node=null,this.group=null,this.updateType=W.OBJECT}setGroup(e){return this.group=e,this}element(e){return E(new My(this,E(e)))}setNodeType(e){const t=V(null,e).getSelf();this.group!==null&&t.setGroup(this.group),this.node=t}getNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let s=e[t[0]];for(let n=1;nE(new Nh(o,e,t));class Fy extends Nh{static get type(){return"RendererReferenceNode"}constructor(e,t,s=null){super(e,t,s),this.renderer=s,this.setGroup(k)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}}const Sh=(o,e,t=null)=>E(new Fy(o,e,t));class Uy extends be{static get type(){return"ToneMappingNode"}constructor(e,t=Ah,s=null){super("vec3"),this.toneMapping=e,this.exposureNode=t,this.colorNode=s}customCacheKey(){return di(this.toneMapping)}setup(e){const t=this.colorNode||e.context.color,s=this.toneMapping;if(s===ss)return t;let n=null;const r=e.renderer.library.getToneMappingFunction(s);return r!==null?n=P(r(t.rgb,this.exposureNode),t.a):(console.error("ToneMappingNode: Unsupported Tone Mapping configuration.",s),n=t),n}}const vh=(o,e,t)=>E(new Uy(o,E(e),E(t))),Ah=Sh("toneMappingExposure","float");R("toneMapping",(o,e,t)=>vh(e,t,o));class Py extends va{static get type(){return"BufferAttributeNode"}constructor(e,t=null,s=0,n=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=s,this.bufferOffset=n,this.usage=vg,this.instanced=!1,this.attribute=null,this.global=!0,e&&e.isBufferAttribute===!0&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){if(this.bufferStride===0&&this.bufferOffset===0){let t=e.globalCache.getData(this.value);return t===void 0&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getNodeType(e){return this.bufferType===null&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(this.attribute!==null)return;const t=this.getNodeType(e),s=this.value,n=e.getTypeLength(t),r=this.bufferStride||n,i=this.bufferOffset,a=s.isInterleavedBuffer===!0?s:new Ag(s,r),u=new Rg(a,n,i);a.setUsage(this.usage),this.attribute=u,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){const t=this.getNodeType(e),s=e.getBufferAttributeFromNode(this,t),n=e.getPropertyName(s);let r=null;return e.shaderStage==="vertex"||e.shaderStage==="compute"?(this.name=n,r=n):r=ke(this).build(e,t),r}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&this.attribute.isBufferAttribute===!0&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}}const nr=(o,e=null,t=0,s=0)=>E(new Py(o,e,t,s)),Rh=(o,e=null,t=0,s=0)=>nr(o,e,t,s).setUsage(zs),Zr=(o,e=null,t=0,s=0)=>nr(o,e,t,s).setInstanced(!0),qo=(o,e=null,t=0,s=0)=>Rh(o,e,t,s).setInstanced(!0);R("toAttribute",o=>nr(o.value));class Dy extends O{static get type(){return"ComputeNode"}constructor(e,t,s=[64]){super("void"),this.isComputeNode=!0,this.computeNode=e,this.count=t,this.workgroupSize=s,this.dispatchCount=0,this.version=1,this.name="",this.updateBeforeType=W.OBJECT,this.onInitFunction=null,this.updateDispatchCount()}dispose(){this.dispatchEvent({type:"dispose"})}label(e){return this.name=e,this}updateDispatchCount(){const{count:e,workgroupSize:t}=this;let s=t[0];for(let n=1;nE(new Dy(E(o),e,t));R("compute",Ch);class Ly extends O{static get type(){return"CacheNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isCacheNode=!0}getNodeType(e){const t=e.getCache(),s=e.getCacheFromNode(this,this.parent);e.setCache(s);const n=this.node.getNodeType(e);return e.setCache(t),n}build(e,...t){const s=e.getCache(),n=e.getCacheFromNode(this,this.parent);e.setCache(n);const r=this.node.build(e,...t);return e.setCache(s),r}}const Mn=(o,e)=>E(new Ly(E(o),e));R("cache",Mn);class Iy extends O{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}getNodeType(e){return this.outputNode.getNodeType(e)}generate(e){const t=this.callNode.build(e,"void");return t!==""&&e.addLineFlowCode(t,this),this.outputNode.build(e)}}const Eh=C(Iy);R("bypass",Eh);class wh extends O{static get type(){return"RemapNode"}constructor(e,t,s,n=g(0),r=g(1)){super(),this.node=e,this.inLowNode=t,this.inHighNode=s,this.outLowNode=n,this.outHighNode=r,this.doClamp=!0}setup(){const{node:e,inLowNode:t,inHighNode:s,outLowNode:n,outHighNode:r,doClamp:i}=this;let a=e.sub(t).div(s.sub(t));return i===!0&&(a=a.clamp()),a.mul(r.sub(n)).add(n)}}const Mh=C(wh,null,null,{doClamp:!1}),Bh=C(wh);R("remap",Mh);R("remapClamp",Bh);class Vr extends O{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){const s=this.getNodeType(e),n=this.snippet;if(s==="void")e.addLineFlowCode(n,this);else return e.format(`( ${n} )`,s,t)}}const rs=C(Vr),Fh=o=>(o?Ue(o,rs("discard")):rs("discard")).append(),Vy=()=>rs("return").append();R("discard",Fh);class Gy extends be{static get type(){return"RenderOutputNode"}constructor(e,t,s){super("vec4"),this.colorNode=e,this.toneMapping=t,this.outputColorSpace=s,this.isRenderOutputNode=!0}setup({context:e}){let t=this.colorNode||e.color;const s=(this.toneMapping!==null?this.toneMapping:e.toneMapping)||ss,n=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||Dn;return s!==ss&&(t=t.toneMapping(s)),n!==Dn&&n!==_t.workingColorSpace&&(t=t.workingToColorSpace(n)),t}}const tu=(o,e=null,t=null)=>E(new Gy(E(o),e,t));R("renderOutput",tu);function Oy(o){console.warn("THREE.TSLBase: AddNodeElement has been removed in favor of tree-shaking. Trying add",o)}class Uh extends O{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}getNodeType(e){let t=this.nodeType;if(t===null){const s=this.getAttributeName(e);if(e.hasGeometryAttribute(s)){const n=e.geometry.getAttribute(s);t=e.getTypeFromAttribute(n)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){const t=this.getAttributeName(e),s=this.getNodeType(e);if(e.hasGeometryAttribute(t)===!0){const r=e.geometry.getAttribute(t),i=e.getTypeFromAttribute(r),a=e.getAttribute(t,i);return e.shaderStage==="vertex"?e.format(a.name,i,s):ke(this).build(e,s)}else return console.warn(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(s)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}}const we=(o,e)=>E(new Uh(o,e)),le=(o=0)=>we("uv"+(o>0?o:""),"vec2");class ky extends O{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){const s=this.textureNode.build(e,"property"),n=this.levelNode===null?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${s}, ${n} )`,this.getNodeType(e),t)}}const ns=C(ky);class zy extends er{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=W.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){const e=this.texture,t=e.images,s=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(s&&s.width!==void 0){const{width:n,height:r}=s;this.value=Math.log2(Math.max(n,r))}}}const Ph=C(zy);class wt extends er{static get type(){return"TextureNode"}constructor(e,t=null,s=null,n=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=s,this.biasNode=n,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=W.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this.setUpdateMatrix(t===null)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}getNodeType(){return this.value.isDepthTexture===!0?"float":this.value.type===Le?"uvec4":this.value.type===ze?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return le(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=V(this.value.matrix)),this._matrixUniform.mul(T(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this.updateType=e?W.RENDER:W.NONE,this}setupUV(e,t){const s=this.value;return e.isFlipY()&&(s.image instanceof ImageBitmap&&s.flipY===!0||s.isRenderTargetTexture===!0||s.isFramebufferTexture===!0||s.isDepthTexture===!0)&&(this.sampler?t=t.flipY():t=t.setY(y(ns(this,this.levelNode).y).sub(t.y).sub(1))),t}setup(e){const t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;const s=this.value;if(!s||s.isTexture!==!0)throw new Error("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().");let n=this.uvNode;(n===null||e.context.forceUVContext===!0)&&e.context.getUV&&(n=e.context.getUV(this)),n||(n=this.getDefaultUV()),this.updateMatrix===!0&&(n=this.getTransformedUV(n)),n=this.setupUV(e,n);let r=this.levelNode;r===null&&e.context.getTextureLevel&&(r=e.context.getTextureLevel(this)),t.uvNode=n,t.levelNode=r,t.biasNode=this.biasNode,t.compareNode=this.compareNode,t.gradNode=this.gradNode,t.depthNode=this.depthNode}generateUV(e,t){return t.build(e,this.sampler===!0?"vec2":"ivec2")}generateSnippet(e,t,s,n,r,i,a,u){const c=this.value;let l;return n?l=e.generateTextureLevel(c,t,s,n,i):r?l=e.generateTextureBias(c,t,s,r,i):u?l=e.generateTextureGrad(c,t,s,u,i):a?l=e.generateTextureCompare(c,t,s,a,i):this.sampler===!1?l=e.generateTextureLoad(c,t,s,i):l=e.generateTexture(c,t,s,i),l}generate(e,t){const s=this.value,n=e.getNodeProperties(this),r=super.generate(e,"property");if(t==="sampler")return r+"_sampler";if(e.isReference(t))return r;{const i=e.getDataFromNode(this);let a=i.propertyName;if(a===void 0){const{uvNode:l,levelNode:d,biasNode:h,compareNode:p,depthNode:f,gradNode:m}=n,x=this.generateUV(e,l),N=d?d.build(e,"float"):null,v=h?h.build(e,"float"):null,w=f?f.build(e,"int"):null,B=p?p.build(e,"float"):null,F=m?[m[0].build(e,"vec2"),m[1].build(e,"vec2")]:null,L=e.getVarFromNode(this);a=e.getPropertyName(L);const I=this.generateSnippet(e,r,x,N,v,w,B,F);e.addLineFlowCode(`${a} = ${I}`,this),i.snippet=I,i.propertyName=a}let u=a;const c=this.getNodeType(e);return e.needsToWorkingColorSpace(s)&&(u=eu(rs(u,c),s.colorSpace).setup(e).build(e,c)),e.format(u,c,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}uv(e){return console.warn("THREE.TextureNode: .uv() has been renamed. Use .sample() instead."),this.sample(e)}sample(e){const t=this.clone();return t.uvNode=E(e),t.referenceNode=this.getSelf(),E(t)}blur(e){const t=this.clone();return t.biasNode=E(e).mul(Ph(t)),t.referenceNode=this.getSelf(),E(t)}level(e){const t=this.clone();return t.levelNode=E(e),t.referenceNode=this.getSelf(),E(t)}size(e){return ns(this,e)}bias(e){const t=this.clone();return t.biasNode=E(e),t.referenceNode=this.getSelf(),E(t)}compare(e){const t=this.clone();return t.compareNode=E(e),t.referenceNode=this.getSelf(),E(t)}grad(e,t){const s=this.clone();return s.gradNode=[E(e),E(t)],s.referenceNode=this.getSelf(),E(s)}depth(e){const t=this.clone();return t.depthNode=E(e),t.referenceNode=this.getSelf(),E(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){const e=this.value,t=this._matrixUniform;t!==null&&(t.value=e.matrix),e.matrixAutoUpdate===!0&&e.updateMatrix()}clone(){const e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e}}const K=C(wt),ge=(...o)=>K(...o).setSampler(!1),Wy=o=>(o.isNode===!0?o:K(o)).convert("sampler"),Jt=V("float").label("cameraNear").setGroup(k).onRenderUpdate(({camera:o})=>o.near),es=V("float").label("cameraFar").setGroup(k).onRenderUpdate(({camera:o})=>o.far),He=V("mat4").label("cameraProjectionMatrix").setGroup(k).onRenderUpdate(({camera:o})=>o.projectionMatrix),$y=V("mat4").label("cameraProjectionMatrixInverse").setGroup(k).onRenderUpdate(({camera:o})=>o.projectionMatrixInverse),je=V("mat4").label("cameraViewMatrix").setGroup(k).onRenderUpdate(({camera:o})=>o.matrixWorldInverse),Hy=V("mat4").label("cameraWorldMatrix").setGroup(k).onRenderUpdate(({camera:o})=>o.matrixWorld),qy=V("mat3").label("cameraNormalMatrix").setGroup(k).onRenderUpdate(({camera:o})=>o.normalMatrix),su=V(new j).label("cameraPosition").setGroup(k).onRenderUpdate(({camera:o},e)=>e.value.setFromMatrixPosition(o.matrixWorld));class J extends O{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=W.OBJECT,this._uniformNode=new er(null)}getNodeType(){const e=this.scope;if(e===J.WORLD_MATRIX)return"mat4";if(e===J.POSITION||e===J.VIEW_POSITION||e===J.DIRECTION||e===J.SCALE)return"vec3"}update(e){const t=this.object3d,s=this._uniformNode,n=this.scope;if(n===J.WORLD_MATRIX)s.value=t.matrixWorld;else if(n===J.POSITION)s.value=s.value||new j,s.value.setFromMatrixPosition(t.matrixWorld);else if(n===J.SCALE)s.value=s.value||new j,s.value.setFromMatrixScale(t.matrixWorld);else if(n===J.DIRECTION)s.value=s.value||new j,t.getWorldDirection(s.value);else if(n===J.VIEW_POSITION){const r=e.camera;s.value=s.value||new j,s.value.setFromMatrixPosition(t.matrixWorld),s.value.applyMatrix4(r.matrixWorldInverse)}}generate(e){const t=this.scope;return t===J.WORLD_MATRIX?this._uniformNode.nodeType="mat4":(t===J.POSITION||t===J.VIEW_POSITION||t===J.DIRECTION||t===J.SCALE)&&(this._uniformNode.nodeType="vec3"),this._uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}J.WORLD_MATRIX="worldMatrix";J.POSITION="position";J.SCALE="scale";J.VIEW_POSITION="viewPosition";J.DIRECTION="direction";const Ky=C(J,J.DIRECTION),Xy=C(J,J.WORLD_MATRIX),Dh=C(J,J.POSITION),Yy=C(J,J.SCALE),jy=C(J,J.VIEW_POSITION);class Mt extends J{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}}const Qy=U(Mt,Mt.DIRECTION),at=U(Mt,Mt.WORLD_MATRIX),Zy=U(Mt,Mt.POSITION),Jy=U(Mt,Mt.SCALE),ex=U(Mt,Mt.VIEW_POSITION),Lh=V(new Yn).onObjectUpdate(({object:o},e)=>e.value.getNormalMatrix(o.matrixWorld)),Ih=V(new Ie).onObjectUpdate(({object:o},e)=>e.value.copy(o.matrixWorld).invert()),Kt=b(o=>o.renderer.nodes.modelViewMatrix||Vh).once()().toVar("modelViewMatrix"),Vh=je.mul(at),tx=b(o=>(o.context.isHighPrecisionModelViewMatrix=!0,V("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),sx=b(o=>{const e=o.context.isHighPrecisionModelViewMatrix;return V("mat3").onObjectUpdate(({object:t,camera:s})=>(e!==!0&&t.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),Ce=we("position","vec3"),me=Ce.varying("positionLocal"),Jr=Ce.varying("positionPrevious"),Wt=at.mul(me).xyz.varying("v_positionWorld").context({needsPositionReassign:!0}),nu=me.transformDirection(at).varying("v_positionWorldDirection").normalize().toVar("positionWorldDirection").context({needsPositionReassign:!0}),xe=b(o=>o.context.setupPositionView(),"vec3").once()().varying("v_positionView").context({needsPositionReassign:!0}),ae=xe.negate().varying("v_positionViewDirection").normalize().toVar("positionViewDirection");class nx extends O{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){const{renderer:t,material:s}=e;return t.coordinateSystem===Pn&&s.side===Ct?"false":e.getFrontFacing()}}const Gh=U(nx),rr=g(Gh).mul(2).sub(1),Ni=we("normal","vec3"),Xe=b(o=>o.geometry.hasAttribute("normal")===!1?(console.warn('TSL.NormalNode: Vertex attribute "normal" not found on geometry.'),T(0,1,0)):Ni,"vec3").once()().toVar("normalLocal"),Oh=xe.dFdx().cross(xe.dFdy()).normalize().toVar("normalFlat"),lt=b(o=>{let e;return o.material.flatShading===!0?e=Oh:e=ke(ru(Xe),"v_normalView").normalize(),e},"vec3").once()().toVar("normalView"),Si=ke(lt.transformDirection(je),"v_normalWorld").normalize().toVar("normalWorld"),fe=b(o=>o.context.setupNormal(),"vec3").once()().mul(rr).toVar("transformedNormalView"),vi=fe.transformDirection(je).toVar("transformedNormalWorld"),Hs=b(o=>o.context.setupClearcoatNormal(),"vec3").once()().mul(rr).toVar("transformedClearcoatNormalView"),kh=b(([o,e=at])=>{const t=Oe(e),s=o.div(T(t[0].dot(t[0]),t[1].dot(t[1]),t[2].dot(t[2])));return t.mul(s).xyz}),ru=b(([o],e)=>{const t=e.renderer.nodes.modelNormalViewMatrix;if(t!==null)return t.transformDirection(o);const s=Lh.mul(o);return je.transformDirection(s)}),zh=V(0).onReference(({material:o})=>o).onRenderUpdate(({material:o})=>o.refractionRatio),Wh=ae.negate().reflect(fe),$h=ae.negate().refract(fe,zh),Hh=Wh.transformDirection(je).toVar("reflectVector"),qh=$h.transformDirection(je).toVar("reflectVector");class rx extends wt{static get type(){return"CubeTextureNode"}constructor(e,t=null,s=null,n=null){super(e,t,s,n),this.isCubeTextureNode=!0}getInputType(){return"cubeTexture"}getDefaultUV(){const e=this.value;return e.mapping===Zs?Hh:e.mapping===Js?qh:(console.error('THREE.CubeTextureNode: Mapping "%s" not supported.',e.mapping),T(0,0,0))}setUpdateMatrix(){}setupUV(e,t){const s=this.value;return e.renderer.coordinateSystem===ln||!s.isRenderTargetTexture?T(t.x.negate(),t.yz):t}generateUV(e,t){return t.build(e,"vec3")}}const on=C(rx);class iu extends er{static get type(){return"BufferNode"}constructor(e,t,s=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=s}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}}const ir=(o,e,t)=>E(new iu(o,e,t));class ix extends Rs{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){const t=super.generate(e),s=this.getNodeType(),n=this.node.getPaddedType();return e.format(t,n,s)}}class Kh extends iu{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?Ot(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=W.RENDER,this.isArrayBufferNode=!0}getNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){const e=this.elementType;let t="vec4";return e==="mat2"?t="mat2":/mat/.test(e)===!0?t="mat4":e.charAt(0)==="i"?t="ivec4":e.charAt(0)==="u"&&(t="uvec4"),t}update(){const{array:e,value:t}=this,s=this.elementType;if(s==="float"||s==="int"||s==="uint")for(let n=0;nE(new Kh(o,e)),ox=(o,e)=>(console.warn("TSL.UniformArrayNode: uniforms() has been renamed to uniformArray()."),E(new Kh(o,e)));class ax extends Rs{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),s=this.referenceNode.getNodeType(),n=this.getNodeType();return e.format(t,s,n)}}class Ai extends O{static get type(){return"ReferenceNode"}constructor(e,t,s=null,n=null){super(),this.property=e,this.uniformType=t,this.object=s,this.count=n,this.properties=e.split("."),this.reference=s,this.node=null,this.group=null,this.name=null,this.updateType=W.OBJECT}element(e){return E(new ax(this,E(e)))}setGroup(e){return this.group=e,this}label(e){return this.name=e,this}setNodeType(e){let t=null;this.count!==null?t=ir(null,e,this.count):Array.isArray(this.getValueFromReference())?t=Gt(null,e):e==="texture"?t=K(null):e==="cubeTexture"?t=on(null):t=V(null,e),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.label(this.name),this.node=t.getSelf()}getNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let s=e[t[0]];for(let n=1;nE(new Ai(o,e,t)),Ko=(o,e,t,s)=>E(new Ai(o,e,s,t));class ux extends Ai{static get type(){return"MaterialReferenceNode"}constructor(e,t,s=null){super(e,t,s),this.material=s,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=this.material!==null?this.material:e.material,this.reference}}const dt=(o,e,t=null)=>E(new ux(o,e,t)),Ri=b(o=>(o.geometry.hasAttribute("tangent")===!1&&o.geometry.computeTangents(),we("tangent","vec4")))(),or=Ri.xyz.toVar("tangentLocal"),ar=Kt.mul(P(or,0)).xyz.varying("v_tangentView").normalize().toVar("tangentView"),Xh=ar.transformDirection(je).varying("v_tangentWorld").normalize().toVar("tangentWorld"),ou=ar.toVar("transformedTangentView"),cx=ou.transformDirection(je).normalize().toVar("transformedTangentWorld"),ur=o=>o.mul(Ri.w).xyz,lx=ke(ur(Ni.cross(Ri)),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),dx=ke(ur(Xe.cross(or)),"v_bitangentLocal").normalize().toVar("bitangentLocal"),Yh=ke(ur(lt.cross(ar)),"v_bitangentView").normalize().toVar("bitangentView"),hx=ke(ur(Si.cross(Xh)),"v_bitangentWorld").normalize().toVar("bitangentWorld"),jh=ur(fe.cross(ou)).normalize().toVar("transformedBitangentView"),px=jh.transformDirection(je).normalize().toVar("transformedBitangentWorld"),gs=Oe(ar,Yh,lt),Qh=ae.mul(gs),fx=(o,e)=>o.sub(Qh.mul(e)),Zh=(()=>{let o=_s.cross(ae);return o=o.cross(_s).normalize(),o=Q(o,fe,Zt.mul(Nt.oneMinus()).oneMinus().pow2().pow2()).normalize(),o})(),gx=b(o=>{const{eye_pos:e,surf_norm:t,mapN:s,uv:n}=o,r=e.dFdx(),i=e.dFdy(),a=n.dFdx(),u=n.dFdy(),c=t,l=i.cross(c),d=c.cross(r),h=l.mul(a.x).add(d.mul(u.x)),p=l.mul(a.y).add(d.mul(u.y)),f=h.dot(h).max(p.dot(p)),m=rr.mul(f.inverseSqrt());return _e(h.mul(s.x,m),p.mul(s.y,m),c.mul(s.z)).normalize()});class mx extends be{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=Yu}setup(e){const{normalMapType:t,scaleNode:s}=this;let n=this.node.mul(2).sub(1);s!==null&&(n=T(n.xy.mul(s),n.z));let r=null;return t===Og?r=ru(n):t===Yu&&(e.hasGeometryAttribute("tangent")===!0?r=gs.mul(n).normalize():r=gx({eye_pos:xe,surf_norm:lt,mapN:n,uv:le()})),r}}const Xo=C(mx),yx=b(({textureNode:o,bumpScale:e})=>{const t=n=>o.cache().context({getUV:r=>n(r.uvNode||le()),forceUVContext:!0}),s=g(t(n=>n));return M(g(t(n=>n.add(n.dFdx()))).sub(s),g(t(n=>n.add(n.dFdy()))).sub(s)).mul(e)}),xx=b(o=>{const{surf_pos:e,surf_norm:t,dHdxy:s}=o,n=e.dFdx().normalize(),r=e.dFdy().normalize(),i=t,a=r.cross(i),u=i.cross(n),c=n.dot(a).mul(rr),l=c.sign().mul(s.x.mul(a).add(s.y.mul(u)));return c.abs().mul(t).sub(l).normalize()});class Tx extends be{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(){const e=this.scaleNode!==null?this.scaleNode:1,t=yx({textureNode:this.textureNode,bumpScale:e});return xx({surf_pos:xe,surf_norm:lt,dHdxy:t})}}const Jh=C(Tx),cc=new Map;class A extends O{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let s=cc.get(e);return s===void 0&&(s=dt(e,t),cc.set(e,s)),s}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache(e==="map"?"map":e+"Map","texture")}setup(e){const t=e.context.material,s=this.scope;let n=null;if(s===A.COLOR){const r=t.color!==void 0?this.getColor(s):T();t.map&&t.map.isTexture===!0?n=r.mul(this.getTexture("map")):n=r}else if(s===A.OPACITY){const r=this.getFloat(s);t.alphaMap&&t.alphaMap.isTexture===!0?n=r.mul(this.getTexture("alpha")):n=r}else if(s===A.SPECULAR_STRENGTH)t.specularMap&&t.specularMap.isTexture===!0?n=this.getTexture("specular").r:n=g(1);else if(s===A.SPECULAR_INTENSITY){const r=this.getFloat(s);t.specularIntensityMap&&t.specularIntensityMap.isTexture===!0?n=r.mul(this.getTexture(s).a):n=r}else if(s===A.SPECULAR_COLOR){const r=this.getColor(s);t.specularColorMap&&t.specularColorMap.isTexture===!0?n=r.mul(this.getTexture(s).rgb):n=r}else if(s===A.ROUGHNESS){const r=this.getFloat(s);t.roughnessMap&&t.roughnessMap.isTexture===!0?n=r.mul(this.getTexture(s).g):n=r}else if(s===A.METALNESS){const r=this.getFloat(s);t.metalnessMap&&t.metalnessMap.isTexture===!0?n=r.mul(this.getTexture(s).b):n=r}else if(s===A.EMISSIVE){const r=this.getFloat("emissiveIntensity"),i=this.getColor(s).mul(r);t.emissiveMap&&t.emissiveMap.isTexture===!0?n=i.mul(this.getTexture(s)):n=i}else if(s===A.NORMAL)t.normalMap?(n=Xo(this.getTexture("normal"),this.getCache("normalScale","vec2")),n.normalMapType=t.normalMapType):t.bumpMap?n=Jh(this.getTexture("bump").r,this.getFloat("bumpScale")):n=lt;else if(s===A.CLEARCOAT){const r=this.getFloat(s);t.clearcoatMap&&t.clearcoatMap.isTexture===!0?n=r.mul(this.getTexture(s).r):n=r}else if(s===A.CLEARCOAT_ROUGHNESS){const r=this.getFloat(s);t.clearcoatRoughnessMap&&t.clearcoatRoughnessMap.isTexture===!0?n=r.mul(this.getTexture(s).r):n=r}else if(s===A.CLEARCOAT_NORMAL)t.clearcoatNormalMap?n=Xo(this.getTexture(s),this.getCache(s+"Scale","vec2")):n=lt;else if(s===A.SHEEN){const r=this.getColor("sheenColor").mul(this.getFloat("sheen"));t.sheenColorMap&&t.sheenColorMap.isTexture===!0?n=r.mul(this.getTexture("sheenColor").rgb):n=r}else if(s===A.SHEEN_ROUGHNESS){const r=this.getFloat(s);t.sheenRoughnessMap&&t.sheenRoughnessMap.isTexture===!0?n=r.mul(this.getTexture(s).a):n=r,n=n.clamp(.07,1)}else if(s===A.ANISOTROPY)if(t.anisotropyMap&&t.anisotropyMap.isTexture===!0){const r=this.getTexture(s);n=fi(Os.x,Os.y,Os.y.negate(),Os.x).mul(r.rg.mul(2).sub(M(1)).normalize().mul(r.b))}else n=Os;else if(s===A.IRIDESCENCE_THICKNESS){const r=ne("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){const i=ne("0","float",t.iridescenceThicknessRange);n=r.sub(i).mul(this.getTexture(s).g).add(i)}else n=r}else if(s===A.TRANSMISSION){const r=this.getFloat(s);t.transmissionMap?n=r.mul(this.getTexture(s).r):n=r}else if(s===A.THICKNESS){const r=this.getFloat(s);t.thicknessMap?n=r.mul(this.getTexture(s).g):n=r}else if(s===A.IOR)n=this.getFloat(s);else if(s===A.LIGHT_MAP)n=this.getTexture(s).rgb.mul(this.getFloat("lightMapIntensity"));else if(s===A.AO)n=this.getTexture(s).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1);else{const r=this.getNodeType(e);n=this.getCache(s,r)}return n}}A.ALPHA_TEST="alphaTest";A.COLOR="color";A.OPACITY="opacity";A.SHININESS="shininess";A.SPECULAR="specular";A.SPECULAR_STRENGTH="specularStrength";A.SPECULAR_INTENSITY="specularIntensity";A.SPECULAR_COLOR="specularColor";A.REFLECTIVITY="reflectivity";A.ROUGHNESS="roughness";A.METALNESS="metalness";A.NORMAL="normal";A.CLEARCOAT="clearcoat";A.CLEARCOAT_ROUGHNESS="clearcoatRoughness";A.CLEARCOAT_NORMAL="clearcoatNormal";A.EMISSIVE="emissive";A.ROTATION="rotation";A.SHEEN="sheen";A.SHEEN_ROUGHNESS="sheenRoughness";A.ANISOTROPY="anisotropy";A.IRIDESCENCE="iridescence";A.IRIDESCENCE_IOR="iridescenceIOR";A.IRIDESCENCE_THICKNESS="iridescenceThickness";A.IOR="ior";A.TRANSMISSION="transmission";A.THICKNESS="thickness";A.ATTENUATION_DISTANCE="attenuationDistance";A.ATTENUATION_COLOR="attenuationColor";A.LINE_SCALE="scale";A.LINE_DASH_SIZE="dashSize";A.LINE_GAP_SIZE="gapSize";A.LINE_WIDTH="linewidth";A.LINE_DASH_OFFSET="dashOffset";A.POINT_WIDTH="pointWidth";A.DISPERSION="dispersion";A.LIGHT_MAP="light";A.AO="ao";const ep=U(A,A.ALPHA_TEST),an=U(A,A.COLOR),tp=U(A,A.SHININESS),sp=U(A,A.EMISSIVE),cr=U(A,A.OPACITY),np=U(A,A.SPECULAR),Yo=U(A,A.SPECULAR_INTENSITY),rp=U(A,A.SPECULAR_COLOR),Bn=U(A,A.SPECULAR_STRENGTH),Gr=U(A,A.REFLECTIVITY),ip=U(A,A.ROUGHNESS),op=U(A,A.METALNESS),ap=U(A,A.NORMAL).context({getUV:null}),up=U(A,A.CLEARCOAT),cp=U(A,A.CLEARCOAT_ROUGHNESS),lp=U(A,A.CLEARCOAT_NORMAL).context({getUV:null}),dp=U(A,A.ROTATION),hp=U(A,A.SHEEN),pp=U(A,A.SHEEN_ROUGHNESS),fp=U(A,A.ANISOTROPY),gp=U(A,A.IRIDESCENCE),mp=U(A,A.IRIDESCENCE_IOR),yp=U(A,A.IRIDESCENCE_THICKNESS),xp=U(A,A.TRANSMISSION),Tp=U(A,A.THICKNESS),_p=U(A,A.IOR),bp=U(A,A.ATTENUATION_DISTANCE),Np=U(A,A.ATTENUATION_COLOR),au=U(A,A.LINE_SCALE),uu=U(A,A.LINE_DASH_SIZE),cu=U(A,A.LINE_GAP_SIZE),Or=U(A,A.LINE_WIDTH),lu=U(A,A.LINE_DASH_OFFSET),Sp=U(A,A.POINT_WIDTH),vp=U(A,A.DISPERSION),du=U(A,A.LIGHT_MAP),Ap=U(A,A.AO),Os=V(new Ye).onReference(function(o){return o.material}).onRenderUpdate(function({material:o}){this.value.set(o.anisotropy*Math.cos(o.anisotropyRotation),o.anisotropy*Math.sin(o.anisotropyRotation))}),hu=b(o=>o.context.setupModelViewProjection(),"vec4").once()().varying("v_modelViewProjection");class de extends O{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){const t=this.getNodeType(e),s=this.scope;let n;if(s===de.VERTEX)n=e.getVertexIndex();else if(s===de.INSTANCE)n=e.getInstanceIndex();else if(s===de.DRAW)n=e.getDrawIndex();else if(s===de.INVOCATION_LOCAL)n=e.getInvocationLocalIndex();else if(s===de.INVOCATION_SUBGROUP)n=e.getInvocationSubgroupIndex();else if(s===de.SUBGROUP)n=e.getSubgroupIndex();else throw new Error("THREE.IndexNode: Unknown scope: "+s);let r;return e.shaderStage==="vertex"||e.shaderStage==="compute"?r=n:r=ke(this).build(e,t),r}}de.VERTEX="vertex";de.INSTANCE="instance";de.SUBGROUP="subgroup";de.INVOCATION_LOCAL="invocationLocal";de.INVOCATION_SUBGROUP="invocationSubgroup";de.DRAW="draw";const Rp=U(de,de.VERTEX),lr=U(de,de.INSTANCE),_x=U(de,de.SUBGROUP),bx=U(de,de.INVOCATION_SUBGROUP),Nx=U(de,de.INVOCATION_LOCAL),Cp=U(de,de.DRAW);class Ep extends O{static get type(){return"InstanceNode"}constructor(e,t,s){super("void"),this.count=e,this.instanceMatrix=t,this.instanceColor=s,this.instanceMatrixNode=null,this.instanceColorNode=null,this.updateType=W.FRAME,this.buffer=null,this.bufferColor=null}setup(e){const{count:t,instanceMatrix:s,instanceColor:n}=this;let{instanceMatrixNode:r,instanceColorNode:i}=this;if(r===null){if(t<=1e3)r=ir(s.array,"mat4",Math.max(t,1)).element(lr);else{const u=new Cg(s.array,16,1);this.buffer=u;const c=s.usage===zs?qo:Zr,l=[c(u,"vec4",16,0),c(u,"vec4",16,4),c(u,"vec4",16,8),c(u,"vec4",16,12)];r=Ts(...l)}this.instanceMatrixNode=r}if(n&&i===null){const u=new oa(n.array,3),c=n.usage===zs?qo:Zr;this.bufferColor=u,i=T(c(u,"vec3",3,0)),this.instanceColorNode=i}const a=r.mul(me).xyz;if(me.assign(a),e.hasGeometryAttribute("normal")){const u=kh(Xe,r);Xe.assign(u)}this.instanceColorNode!==null&&et("vec3","vInstanceColor").assign(this.instanceColorNode)}update(){this.instanceMatrix.usage!==zs&&this.buffer!==null&&this.instanceMatrix.version!==this.buffer.version&&(this.buffer.version=this.instanceMatrix.version),this.instanceColor&&this.instanceColor.usage!==zs&&this.bufferColor!==null&&this.instanceColor.version!==this.bufferColor.version&&(this.bufferColor.version=this.instanceColor.version)}}const Sx=C(Ep);class vx extends Ep{static get type(){return"InstancedMeshNode"}constructor(e){const{count:t,instanceMatrix:s,instanceColor:n}=e;super(t,s,n),this.instancedMesh=e}}const wp=C(vx);class Ax extends O{static get type(){return"BatchNode"}constructor(e){super("void"),this.batchMesh=e,this.batchingIdNode=null}setup(e){this.batchingIdNode===null&&(e.getDrawIndex()===null?this.batchingIdNode=lr:this.batchingIdNode=Cp);const s=b(([f])=>{const m=ns(ge(this.batchMesh._indirectTexture),0),x=y(f).modInt(y(m)),N=y(f).div(y(m));return ge(this.batchMesh._indirectTexture,Ae(x,N)).x}).setLayout({name:"getIndirectIndex",type:"uint",inputs:[{name:"id",type:"int"}]})(y(this.batchingIdNode)),n=this.batchMesh._matricesTexture,r=ns(ge(n),0),i=g(s).mul(4).toInt().toVar(),a=i.modInt(r),u=i.div(y(r)),c=Ts(ge(n,Ae(a,u)),ge(n,Ae(a.add(1),u)),ge(n,Ae(a.add(2),u)),ge(n,Ae(a.add(3),u))),l=this.batchMesh._colorsTexture;if(l!==null){const m=b(([x])=>{const N=ns(ge(l),0).x,v=x,w=v.modInt(N),B=v.div(N);return ge(l,Ae(w,B)).rgb}).setLayout({name:"getBatchingColor",type:"vec3",inputs:[{name:"id",type:"int"}]})(s);et("vec3","vBatchColor").assign(m)}const d=Oe(c);me.assign(c.mul(me));const h=Xe.div(T(d[0].dot(d[0]),d[1].dot(d[1]),d[2].dot(d[2]))),p=d.mul(h).xyz;Xe.assign(p),e.hasGeometryAttribute("tangent")&&or.mulAssign(d)}}const Mp=C(Ax),lc=new WeakMap;class Bp extends O{static get type(){return"SkinningNode"}constructor(e,t=!1){super("void"),this.skinnedMesh=e,this.useReference=t,this.updateType=W.OBJECT,this.skinIndexNode=we("skinIndex","uvec4"),this.skinWeightNode=we("skinWeight","vec4");let s,n,r;t?(s=ne("bindMatrix","mat4"),n=ne("bindMatrixInverse","mat4"),r=Ko("skeleton.boneMatrices","mat4",e.skeleton.bones.length)):(s=V(e.bindMatrix,"mat4"),n=V(e.bindMatrixInverse,"mat4"),r=ir(e.skeleton.boneMatrices,"mat4",e.skeleton.bones.length)),this.bindMatrixNode=s,this.bindMatrixInverseNode=n,this.boneMatricesNode=r,this.previousBoneMatricesNode=null}getSkinnedPosition(e=this.boneMatricesNode,t=me){const{skinIndexNode:s,skinWeightNode:n,bindMatrixNode:r,bindMatrixInverseNode:i}=this,a=e.element(s.x),u=e.element(s.y),c=e.element(s.z),l=e.element(s.w),d=r.mul(t),h=_e(a.mul(n.x).mul(d),u.mul(n.y).mul(d),c.mul(n.z).mul(d),l.mul(n.w).mul(d));return i.mul(h).xyz}getSkinnedNormal(e=this.boneMatricesNode,t=Xe){const{skinIndexNode:s,skinWeightNode:n,bindMatrixNode:r,bindMatrixInverseNode:i}=this,a=e.element(s.x),u=e.element(s.y),c=e.element(s.z),l=e.element(s.w);let d=_e(n.x.mul(a),n.y.mul(u),n.z.mul(c),n.w.mul(l));return d=i.mul(d).mul(r),d.transformDirection(t).xyz}getPreviousSkinnedPosition(e){const t=e.object;return this.previousBoneMatricesNode===null&&(t.skeleton.previousBoneMatrices=new Float32Array(t.skeleton.boneMatrices),this.previousBoneMatricesNode=Ko("skeleton.previousBoneMatrices","mat4",t.skeleton.bones.length)),this.getSkinnedPosition(this.previousBoneMatricesNode,Jr)}needsPreviousBoneMatrices(e){const t=e.renderer.getMRT();return t&&t.has("velocity")||ba(e.object).useVelocity===!0}setup(e){this.needsPreviousBoneMatrices(e)&&Jr.assign(this.getPreviousSkinnedPosition(e));const t=this.getSkinnedPosition();if(me.assign(t),e.hasGeometryAttribute("normal")){const s=this.getSkinnedNormal();Xe.assign(s),e.hasGeometryAttribute("tangent")&&or.assign(s)}}generate(e,t){if(t!=="void")return me.build(e,t)}update(e){const s=(this.useReference?e.object:this.skinnedMesh).skeleton;lc.get(s)!==e.frameId&&(lc.set(s,e.frameId),this.previousBoneMatricesNode!==null&&s.previousBoneMatrices.set(s.boneMatrices),s.update())}}const Rx=o=>E(new Bp(o)),Fp=o=>E(new Bp(o,!0));class Cx extends O{static get type(){return"LoopNode"}constructor(e=[]){super(),this.params=e}getVarName(e){return String.fromCharCode(105+e)}getProperties(e){const t=e.getNodeProperties(this);if(t.stackNode!==void 0)return t;const s={};for(let r=0,i=this.params.length-1;rNumber(d)?f=">=":f="<"));const x={start:l,end:d},N=x.start,v=x.end;let w="",B="",F="";m||(p==="int"||p==="uint"?f.includes("<")?m="++":m="--":f.includes("<")?m="+= 1.":m="-= 1."),w+=e.getVar(p,h)+" = "+N,B+=h+" "+f+" "+v,F+=h+" "+m;const L=`for ( ${w}; ${B}; ${F} )`;e.addFlowCode((a===0?` -`:"")+e.tab+L+` { - -`).addFlowTab()}const r=n.build(e,"void"),i=t.returnsNode?t.returnsNode.build(e):"";e.removeFlowTab().addFlowCode(` -`+e.tab+r);for(let a=0,u=this.params.length-1;aE(new Cx(xs(o,"int"))).append(),Ex=()=>rs("continue").append(),pu=()=>rs("break").append(),wx=(...o)=>(console.warn("TSL.LoopNode: loop() has been renamed to Loop()."),te(...o)),Gi=new WeakMap,Je=new Me,dc=b(({bufferMap:o,influence:e,stride:t,width:s,depth:n,offset:r})=>{const i=y(Rp).mul(t).add(r),a=i.div(s),u=i.sub(a.mul(s));return ge(o,Ae(u,a)).depth(n).mul(e)});function Mx(o){const e=o.morphAttributes.position!==void 0,t=o.morphAttributes.normal!==void 0,s=o.morphAttributes.color!==void 0,n=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,r=n!==void 0?n.length:0;let i=Gi.get(o);if(i===void 0||i.count!==r){let N=function(){m.dispose(),Gi.delete(o),o.removeEventListener("dispose",N)};i!==void 0&&i.texture.dispose();const a=o.morphAttributes.position||[],u=o.morphAttributes.normal||[],c=o.morphAttributes.color||[];let l=0;e===!0&&(l=1),t===!0&&(l=2),s===!0&&(l=3);let d=o.attributes.position.count*l,h=1;const p=4096;d>p&&(h=Math.ceil(d/p),d=p);const f=new Float32Array(d*h*4*r),m=new Yg(f,d,h,r);m.type=ot,m.needsUpdate=!0;const x=l*4;for(let v=0;v{const h=g(0).toVar();this.mesh.count>1&&this.mesh.morphTexture!==null&&this.mesh.morphTexture!==void 0?h.assign(ge(this.mesh.morphTexture,Ae(y(d).add(1),y(lr))).r):h.assign(ne("morphTargetInfluences","float").element(d).toVar()),s===!0&&me.addAssign(dc({bufferMap:a,influence:h,stride:u,width:l,depth:d,offset:y(0)})),n===!0&&Xe.addAssign(dc({bufferMap:a,influence:h,stride:u,width:l,depth:d,offset:y(1)}))})}update(){const e=this.morphBaseInfluence;this.mesh.geometry.morphTargetsRelative?e.value=1:e.value=1-this.mesh.morphTargetInfluences.reduce((t,s)=>t+s,0)}}const Up=C(Bx);class hn extends O{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}}class Fx extends hn{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class Ux extends hh{static get type(){return"LightingContextNode"}constructor(e,t=null,s=null,n=null){super(e),this.lightingModel=t,this.backdropNode=s,this.backdropAlphaNode=n,this._value=null}getContext(){const{backdropNode:e,backdropAlphaNode:t}=this,s=T().toVar("directDiffuse"),n=T().toVar("directSpecular"),r=T().toVar("indirectDiffuse"),i=T().toVar("indirectSpecular"),a={directDiffuse:s,directSpecular:n,indirectDiffuse:r,indirectSpecular:i};return{radiance:T().toVar("radiance"),irradiance:T().toVar("irradiance"),iblIrradiance:T().toVar("iblIrradiance"),ambientOcclusion:g(1).toVar("ambientOcclusion"),reflectedLight:a,backdrop:e,backdropAlpha:t}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}}const Pp=C(Ux);class Px extends hn{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}}let fn,gn;class Se extends O{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this.isViewportNode=!0}getNodeType(){return this.scope===Se.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=W.NONE;return(this.scope===Se.SIZE||this.scope===Se.VIEWPORT)&&(e=W.RENDER),this.updateType=e,e}update({renderer:e}){const t=e.getRenderTarget();this.scope===Se.VIEWPORT?t!==null?gn.copy(t.viewport):(e.getViewport(gn),gn.multiplyScalar(e.getPixelRatio())):t!==null?(fn.width=t.width,fn.height=t.height):e.getDrawingBufferSize(fn)}setup(){const e=this.scope;let t=null;return e===Se.SIZE?t=V(fn||(fn=new Ye)):e===Se.VIEWPORT?t=V(gn||(gn=new Me)):t=M(dr.div(Kn)),t}generate(e){if(this.scope===Se.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){const s=e.getNodeProperties(Kn).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${s}.y - ${t}.y )`}return t}return super.generate(e)}}Se.COORDINATE="coordinate";Se.VIEWPORT="viewport";Se.SIZE="size";Se.UV="uv";const Bt=U(Se,Se.UV),Kn=U(Se,Se.SIZE),dr=U(Se,Se.COORDINATE),$t=U(Se,Se.VIEWPORT),Dp=$t.zw,Lp=dr.sub($t.xy),Dx=Lp.div(Dp),Lx=b(()=>(console.warn('TSL.ViewportNode: "viewportResolution" is deprecated. Use "screenSize" instead.'),Kn),"vec2").once()(),Ix=b(()=>(console.warn('TSL.ViewportNode: "viewportTopLeft" is deprecated. Use "screenUV" instead.'),Bt),"vec2").once()(),Vx=b(()=>(console.warn('TSL.ViewportNode: "viewportBottomLeft" is deprecated. Use "screenUV.flipY()" instead.'),Bt.flipY()),"vec2").once()(),mn=new Ye;class Ci extends wt{static get type(){return"ViewportTextureNode"}constructor(e=Bt,t=null,s=null){s===null&&(s=new bl,s.minFilter=ms),super(s,e,t),this.generateMipmaps=!1,this.isOutputTextureNode=!0,this.updateBeforeType=W.FRAME}updateBefore(e){const t=e.renderer;t.getDrawingBufferSize(mn);const s=this.value;(s.image.width!==mn.width||s.image.height!==mn.height)&&(s.image.width=mn.width,s.image.height=mn.height,s.needsUpdate=!0);const n=s.generateMipmaps;s.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(s),s.generateMipmaps=n}clone(){const e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}const Gx=C(Ci),fu=C(Ci,null,null,{generateMipmaps:!0});let Oi=null;class Ox extends Ci{static get type(){return"ViewportDepthTextureNode"}constructor(e=Bt,t=null){Oi===null&&(Oi=new vs),super(e,t,Oi)}}const gu=C(Ox);class qe extends O{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){const{scope:t}=this;return t===qe.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){const{scope:t}=this,s=this.valueNode;let n=null;if(t===qe.DEPTH_BASE)s!==null&&(n=Vp().assign(s));else if(t===qe.DEPTH)e.isPerspectiveCamera?n=Ip(xe.z,Jt,es):n=Qs(xe.z,Jt,es);else if(t===qe.LINEAR_DEPTH)if(s!==null)if(e.isPerspectiveCamera){const r=mu(s,Jt,es);n=Qs(r,Jt,es)}else n=s;else n=Qs(xe.z,Jt,es);return n}}qe.DEPTH_BASE="depthBase";qe.DEPTH="depth";qe.LINEAR_DEPTH="linearDepth";const Qs=(o,e,t)=>o.add(e).div(e.sub(t)),kx=(o,e,t)=>e.sub(t).mul(o).sub(e),Ip=(o,e,t)=>e.add(o).mul(t).div(t.sub(e).mul(o)),mu=(o,e,t)=>e.mul(t).div(t.sub(e).mul(o).sub(t)),yu=(o,e,t)=>{e=e.max(1e-6).toVar();const s=vt(o.negate().div(e)),n=vt(t.div(e));return s.div(n)},zx=(o,e,t)=>{const s=o.mul(yi(t.div(e)));return g(Math.E).pow(s).mul(e).negate()},Vp=C(qe,qe.DEPTH_BASE),xu=U(qe,qe.DEPTH),ei=C(qe,qe.LINEAR_DEPTH),Wx=ei(gu());xu.assign=o=>Vp(o);class $x extends O{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}}const Hx=C($x);class ut extends O{static get type(){return"ClippingNode"}constructor(e=ut.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);const t=e.clippingContext,{intersectionPlanes:s,unionPlanes:n}=t;return this.hardwareClipping=e.material.hardwareClipping,this.scope===ut.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(s,n):this.scope===ut.HARDWARE?this.setupHardwareClipping(n,e):this.setupDefault(s,n)}setupAlphaToCoverage(e,t){return b(()=>{const s=g().toVar("distanceToPlane"),n=g().toVar("distanceToGradient"),r=g(1).toVar("clipOpacity"),i=t.length;if(this.hardwareClipping===!1&&i>0){const u=Gt(t);te(i,({i:c})=>{const l=u.element(c);s.assign(xe.dot(l.xyz).negate().add(l.w)),n.assign(s.fwidth().div(2)),r.mulAssign(ct(n.negate(),n,s))})}const a=e.length;if(a>0){const u=Gt(e),c=g(1).toVar("intersectionClipOpacity");te(a,({i:l})=>{const d=u.element(l);s.assign(xe.dot(d.xyz).negate().add(d.w)),n.assign(s.fwidth().div(2)),c.mulAssign(ct(n.negate(),n,s).oneMinus())}),r.mulAssign(c.oneMinus())}ee.a.mulAssign(r),ee.a.equal(0).discard()})()}setupDefault(e,t){return b(()=>{const s=t.length;if(this.hardwareClipping===!1&&s>0){const r=Gt(t);te(s,({i})=>{const a=r.element(i);xe.dot(a.xyz).greaterThan(a.w).discard()})}const n=e.length;if(n>0){const r=Gt(e),i=Ht(!0).toVar("clipped");te(n,({i:a})=>{const u=r.element(a);i.assign(xe.dot(u.xyz).greaterThan(u.w).and(i))}),i.discard()}})()}setupHardwareClipping(e,t){const s=e.length;return t.enableHardwareClipping(s),b(()=>{const n=Gt(e),r=Hx(t.getClipDistance());te(s,({i})=>{const a=n.element(i),u=xe.dot(a.xyz).sub(a.w).negate();r.element(i).assign(u)})})()}}ut.ALPHA_TO_COVERAGE="alphaToCoverage";ut.DEFAULT="default";ut.HARDWARE="hardware";const qx=()=>E(new ut),Kx=()=>E(new ut(ut.ALPHA_TO_COVERAGE)),Xx=()=>E(new ut(ut.HARDWARE)),Yx=.05,hc=b(([o])=>Xt($(1e4,st($(17,o.x).add($(.1,o.y)))).mul(_e(.1,oe(st($(13,o.y).add(o.x))))))),pc=b(([o])=>hc(M(hc(o.xy),o.z))),jx=b(([o])=>{const e=ue(zt(Ha(o.xyz)),zt(qa(o.xyz))),t=g(1).div(g(Yx).mul(e)).toVar("pixScale"),s=M(rn(At(vt(t))),rn(xi(vt(t)))),n=M(pc(At(s.x.mul(o.xyz))),pc(At(s.y.mul(o.xyz)))),r=Xt(vt(t)),i=_e($(r.oneMinus(),n.x),$(r,n.y)),a=Re(r,r.oneMinus()),u=T(i.mul(i).div($(2,a).mul(Y(1,a))),i.sub($(.5,a)).div(Y(1,a)),Y(1,Y(1,i).mul(Y(1,i)).div($(2,a).mul(Y(1,a))))),c=i.lessThan(a.oneMinus()).select(i.lessThan(a).select(u.x,u.y),u.z);return Et(c,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]});class ce extends Xu{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.hardwareClipping=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.shadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null}customProgramCacheKey(){return this.type+ma(this)}build(e){this.setup(e)}setupObserver(e){return new jm(e)}setup(e){e.context.setupNormal=()=>this.setupNormal(e),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);const t=e.renderer,s=t.getRenderTarget();e.addStack();const n=this.vertexNode||this.setupVertex(e);e.stack.outputNode=n,this.setupHardwareClipping(e),this.geometryNode!==null&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();let r;const i=this.setupClipping(e);if((this.depthWrite===!0||this.depthTest===!0)&&(s!==null?s.depthBuffer===!0&&this.setupDepth(e):t.depth===!0&&this.setupDepth(e)),this.fragmentNode===null){this.setupDiffuseColor(e),this.setupVariants(e);const a=this.setupLighting(e);i!==null&&e.stack.add(i);const u=P(a,ee.a).max(0);if(r=this.setupOutput(e,u),$n.assign(r),this.outputNode!==null&&(r=this.outputNode),s!==null){const c=t.getMRT(),l=this.mrtNode;c!==null?(r=c,l!==null&&(r=c.merge(l))):l!==null&&(r=l)}}else{let a=this.fragmentNode;a.isOutputStructNode!==!0&&(a=P(a)),r=this.setupOutput(e,a)}e.stack.outputNode=r,e.addFlow("fragment",e.removeStack()),e.monitor=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;const{unionPlanes:t,intersectionPlanes:s}=e.clippingContext;let n=null;if(t.length>0||s.length>0){const r=e.renderer.samples;this.alphaToCoverage&&r>1?n=Kx():e.stack.add(qx())}return n}setupHardwareClipping(e){if(this.hardwareClipping=!1,e.clippingContext===null)return;const t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.add(Xx()),this.hardwareClipping=!0)}setupDepth(e){const{renderer:t,camera:s}=e;let n=this.depthNode;if(n===null){const r=t.getMRT();r&&r.has("depth")?n=r.get("depth"):t.logarithmicDepthBuffer===!0&&(s.isPerspectiveCamera?n=yu(xe.z,Jt,es):n=Qs(xe.z,Jt,es))}n!==null&&xu.assign(n).append()}setupPositionView(){return Kt.mul(me).xyz}setupModelViewProjection(){return He.mul(xe)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.vertex=e.removeStack(),hu}setupPosition(e){const{object:t,geometry:s}=e;if((s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color)&&Up(t).append(),t.isSkinnedMesh===!0&&Fp(t).append(),this.displacementMap){const n=dt("displacementMap","texture"),r=dt("displacementScale","float"),i=dt("displacementBias","float");me.addAssign(Xe.normalize().mul(n.x.mul(r).add(i)))}return t.isBatchedMesh&&Mp(t).append(),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&wp(t).append(),this.positionNode!==null&&me.assign(this.positionNode.context({isPositionNodeInput:!0})),me}setupDiffuseColor({object:e,geometry:t}){let s=this.colorNode?P(this.colorNode):an;this.vertexColors===!0&&t.hasAttribute("color")&&(s=P(s.xyz.mul(we("color","vec3")),s.a)),e.instanceColor&&(s=et("vec3","vInstanceColor").mul(s)),e.isBatchedMesh&&e._colorsTexture&&(s=et("vec3","vBatchColor").mul(s)),ee.assign(s);const n=this.opacityNode?g(this.opacityNode):cr;if(ee.a.assign(ee.a.mul(n)),this.alphaTestNode!==null||this.alphaTest>0){const r=this.alphaTestNode!==null?g(this.alphaTestNode):ep;ee.a.lessThanEqual(r).discard()}this.alphaHash===!0&&ee.a.lessThan(jx(me)).discard(),this.transparent===!1&&this.blending===Ys&&this.alphaToCoverage===!1&&ee.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?T(0):ee.rgb}setupNormal(){return this.normalNode?T(this.normalNode):ap}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?dt("envMap","cubeTexture"):dt("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new Px(du)),t}setupLights(e){const t=[],s=this.setupEnvironment(e);s&&s.isLightingNode&&t.push(s);const n=this.setupLightMap(e);if(n&&n.isLightingNode&&t.push(n),this.aoNode!==null||e.material.aoMap){const i=this.aoNode!==null?this.aoNode:Ap;t.push(new Fx(i))}let r=this.lightsNode||e.lightsNode;return t.length>0&&(r=e.renderer.lighting.createNode([...r.getLights(),...t])),r}setupLightingModel(){}setupLighting(e){const{material:t}=e,{backdropNode:s,backdropAlphaNode:n,emissiveNode:r}=this,a=this.lights===!0||this.lightsNode!==null?this.setupLights(e):null;let u=this.setupOutgoingLight(e);if(a&&a.getScope().hasLights){const c=this.setupLightingModel(e);u=Pp(a,c,s,n)}else s!==null&&(u=T(n!==null?Q(u,s,n):s));return(r&&r.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(Ho.assign(T(r||sp)),u=u.add(Ho)),u}setupOutput(e,t){if(this.fog===!0){const s=e.fogNode;s&&($n.assign(t),t=P(s))}return t}setDefaultValues(e){for(const s in e){const n=e[s];this[s]===void 0&&(this[s]=n,n&&n.clone&&(this[s]=n.clone()))}const t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(const s in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,s)===void 0&&t[s].get!==void 0&&Object.defineProperty(this.constructor.prototype,s,t[s])}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{},nodes:{}});const s=Xu.prototype.toJSON.call(this,e),n=Vn(this);s.inputNodes={};for(const{property:i,childNode:a}of n)s.inputNodes[i]=a.toJSON(e).uuid;function r(i){const a=[];for(const u in i){const c=i[u];delete c.metadata,a.push(c)}return a}if(t){const i=r(e.textures),a=r(e.images),u=r(e.nodes);i.length>0&&(s.textures=i),a.length>0&&(s.images=a),u.length>0&&(s.nodes=u)}return s}copy(e){return this.lightsNode=e.lightsNode,this.envNode=e.envNode,this.colorNode=e.colorNode,this.normalNode=e.normalNode,this.opacityNode=e.opacityNode,this.backdropNode=e.backdropNode,this.backdropAlphaNode=e.backdropAlphaNode,this.alphaTestNode=e.alphaTestNode,this.positionNode=e.positionNode,this.geometryNode=e.geometryNode,this.depthNode=e.depthNode,this.shadowPositionNode=e.shadowPositionNode,this.receivedShadowNode=e.receivedShadowNode,this.castShadowNode=e.castShadowNode,this.outputNode=e.outputNode,this.mrtNode=e.mrtNode,this.fragmentNode=e.fragmentNode,this.vertexNode=e.vertexNode,super.copy(e)}}const Qx=new hl;class dR extends ce{static get type(){return"InstancedPointsNodeMaterial"}constructor(e={}){super(),this.isInstancedPointsNodeMaterial=!0,this.useColor=e.vertexColors,this.pointWidth=1,this.pointColorNode=null,this.pointWidthNode=null,this._useAlphaToCoverage=!0,this.setDefaultValues(Qx),this.setValues(e)}setup(e){const{renderer:t}=e,s=this._useAlphaToCoverage,n=this.useColor;this.vertexNode=b(()=>{const r=we("instancePosition").xyz,i=P(Kt.mul(P(r,1))),a=$t.z.div($t.w),u=He.mul(i),c=Ce.xy.toVar();return c.mulAssign(this.pointWidthNode?this.pointWidthNode:Sp),c.assign(c.div($t.z)),c.y.assign(c.y.mul(a)),c.assign(c.mul(u.w)),u.addAssign(P(c,0,0)),u})(),this.fragmentNode=b(()=>{const r=g(1).toVar(),i=ja(le().mul(2).sub(1));if(s&&t.samples>1){const u=g(i.fwidth()).toVar();r.assign(ct(u.oneMinus(),u.add(1),i).oneMinus())}else i.greaterThan(1).discard();let a;return this.pointColorNode?a=this.pointColorNode:n?a=we("instanceColor").mul(an):a=an,r.mulAssign(cr),P(a,r)})(),super.setup(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}}const Zx=new Eg;class Jx extends ce{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(Zx),this.setValues(e)}}const eT=new pl;class tT extends ce{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(eT),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){const e=this.offsetNode?g(this.offsetNode):lu,t=this.dashScaleNode?g(this.dashScaleNode):au,s=this.dashSizeNode?g(this.dashSizeNode):uu,n=this.gapSizeNode?g(this.gapSizeNode):cu;bs.assign(s),Hn.assign(n);const r=ke(we("lineDistance").mul(t));(e?r.add(e):r).mod(bs.add(Hn)).greaterThan(bs).discard()}}let ki=null;class sT extends Ci{static get type(){return"ViewportSharedTextureNode"}constructor(e=Bt,t=null){ki===null&&(ki=new bl),super(e,t,ki)}updateReference(){return this}}const Gp=C(sT),nT=new pl;class hR extends ce{static get type(){return"Line2NodeMaterial"}constructor(e={}){super(),this.isLine2NodeMaterial=!0,this.setDefaultValues(nT),this.useColor=e.vertexColors,this.dashOffset=0,this.lineWidth=1,this.lineColorNode=null,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.blending=en,this._useDash=e.dashed,this._useAlphaToCoverage=!0,this._useWorldUnits=!1,this.setValues(e)}setup(e){const{renderer:t}=e,s=this._useAlphaToCoverage,n=this.useColor,r=this._useDash,i=this._useWorldUnits,a=b(({start:c,end:l})=>{const d=He.element(2).element(2),f=He.element(3).element(2).mul(-.5).div(d).sub(c.z).div(l.z.sub(c.z));return P(Q(c.xyz,l.xyz,f),l.w)}).setLayout({name:"trimSegment",type:"vec4",inputs:[{name:"start",type:"vec4"},{name:"end",type:"vec4"}]});this.vertexNode=b(()=>{const c=we("instanceStart"),l=we("instanceEnd"),d=P(Kt.mul(P(c,1))).toVar("start"),h=P(Kt.mul(P(l,1))).toVar("end");if(r){const F=this.dashScaleNode?g(this.dashScaleNode):au,L=this.offsetNode?g(this.offsetNode):lu,I=we("instanceDistanceStart"),G=we("instanceDistanceEnd");let X=Ce.y.lessThan(.5).select(F.mul(I),F.mul(G));X=X.add(L),et("float","lineDistance").assign(X)}i&&(et("vec3","worldStart").assign(d.xyz),et("vec3","worldEnd").assign(h.xyz));const p=$t.z.div($t.w),f=He.element(2).element(3).equal(-1);z(f,()=>{z(d.z.lessThan(0).and(h.z.greaterThan(0)),()=>{h.assign(a({start:d,end:h}))}).ElseIf(h.z.lessThan(0).and(d.z.greaterThanEqual(0)),()=>{d.assign(a({start:h,end:d}))})});const m=He.mul(d),x=He.mul(h),N=m.xyz.div(m.w),v=x.xyz.div(x.w),w=v.xy.sub(N.xy).toVar();w.x.assign(w.x.mul(p)),w.assign(w.normalize());const B=P().toVar();if(i){const F=h.xyz.sub(d.xyz).normalize(),L=Q(d.xyz,h.xyz,.5).normalize(),I=F.cross(L).normalize(),G=F.cross(I),X=et("vec4","worldPos");X.assign(Ce.y.lessThan(.5).select(d,h));const ie=Or.mul(.5);X.addAssign(P(Ce.x.lessThan(0).select(I.mul(ie),I.mul(ie).negate()),0)),r||(X.addAssign(P(Ce.y.lessThan(.5).select(F.mul(ie).negate(),F.mul(ie)),0)),X.addAssign(P(G.mul(ie),0)),z(Ce.y.greaterThan(1).or(Ce.y.lessThan(0)),()=>{X.subAssign(P(G.mul(2).mul(ie),0))})),B.assign(He.mul(X));const Z=T().toVar();Z.assign(Ce.y.lessThan(.5).select(N,v)),B.z.assign(Z.z.mul(B.w))}else{const F=M(w.y,w.x.negate()).toVar("offset");w.x.assign(w.x.div(p)),F.x.assign(F.x.div(p)),F.assign(Ce.x.lessThan(0).select(F.negate(),F)),z(Ce.y.lessThan(0),()=>{F.assign(F.sub(w))}).ElseIf(Ce.y.greaterThan(1),()=>{F.assign(F.add(w))}),F.assign(F.mul(Or)),F.assign(F.div($t.w)),B.assign(Ce.y.lessThan(.5).select(m,x)),F.assign(F.mul(B.w)),B.assign(B.add(P(F,0,0)))}return B})();const u=b(({p1:c,p2:l,p3:d,p4:h})=>{const p=c.sub(d),f=h.sub(d),m=l.sub(c),x=p.dot(f),N=f.dot(m),v=p.dot(m),w=f.dot(f),F=m.dot(m).mul(w).sub(N.mul(N)),I=x.mul(N).sub(v.mul(w)).div(F).clamp(),G=x.add(N.mul(I)).div(w).clamp();return M(I,G)});if(this.colorNode=b(()=>{const c=le();if(r){const h=this.dashSizeNode?g(this.dashSizeNode):uu,p=this.gapSizeNode?g(this.gapSizeNode):cu;bs.assign(h),Hn.assign(p);const f=et("float","lineDistance");c.y.lessThan(-1).or(c.y.greaterThan(1)).discard(),f.mod(bs.add(Hn)).greaterThan(bs).discard()}const l=g(1).toVar("alpha");if(i){const h=et("vec3","worldStart"),p=et("vec3","worldEnd"),f=et("vec4","worldPos").xyz.normalize().mul(1e5),m=p.sub(h),x=u({p1:h,p2:p,p3:T(0,0,0),p4:f}),N=h.add(m.mul(x.x)),v=f.mul(x.y),F=N.sub(v).length().div(Or);if(!r)if(s&&t.samples>1){const L=F.fwidth();l.assign(ct(L.negate().add(.5),L.add(.5),F).oneMinus())}else F.greaterThan(.5).discard()}else if(s&&t.samples>1){const h=c.x,p=c.y.greaterThan(0).select(c.y.sub(1),c.y.add(1)),f=h.mul(h).add(p.mul(p)),m=g(f.fwidth()).toVar("dlen");z(c.y.abs().greaterThan(1),()=>{l.assign(ct(m.oneMinus(),m.add(1),f).oneMinus())})}else z(c.y.abs().greaterThan(1),()=>{const h=c.x,p=c.y.greaterThan(0).select(c.y.sub(1),c.y.add(1));h.mul(h).add(p.mul(p)).greaterThan(1).discard()});let d;if(this.lineColorNode)d=this.lineColorNode;else if(n){const h=we("instanceColorStart"),p=we("instanceColorEnd");d=Ce.y.lessThan(.5).select(h,p).mul(an)}else d=an;return P(d,l)})(),this.transparent){const c=this.opacityNode?g(this.opacityNode):cr;this.outputNode=P(this.colorNode.rgb.mul(c).add(Gp().rgb.mul(c.oneMinus())),this.colorNode.a)}super.setup(e)}get worldUnits(){return this._useWorldUnits}set worldUnits(e){this._useWorldUnits!==e&&(this._useWorldUnits=e,this.needsUpdate=!0)}get dashed(){return this._useDash}set dashed(e){this._useDash!==e&&(this._useDash=e,this.needsUpdate=!0)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}}const Op=o=>E(o).mul(.5).add(.5),rT=o=>E(o).mul(2).sub(1),iT=new Bg;class oT extends ce{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(iT),this.setValues(e)}setupDiffuseColor(){const e=this.opacityNode?g(this.opacityNode):cr;ee.assign(P(Op(fe),e))}}class aT extends be{static get type(){return"EquirectUVNode"}constructor(e=nu){super("vec2"),this.dirNode=e}setup(){const e=this.dirNode,t=e.z.atan(e.x).mul(1/(Math.PI*2)).add(.5),s=e.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return M(t,s)}}const Tu=C(aT);class kp extends jg{constructor(e=1,t={}){super(e,t),this.isCubeRenderTarget=!0}fromEquirectangularTexture(e,t){const s=t.minFilter,n=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const r=new _l(5,5,5),i=Tu(nu),a=new ce;a.colorNode=K(t,i,0),a.side=Ct,a.blending=en;const u=new tn(r,a),c=new Nl;c.add(u),t.minFilter===ms&&(t.minFilter=ft);const l=new Qg(1,10,this),d=e.getMRT();return e.setMRT(null),l.update(e,c),e.setMRT(d),t.minFilter=s,t.currentGenerateMipmaps=n,u.geometry.dispose(),u.material.dispose(),this}}const Fn=new WeakMap;class uT extends be{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=on();const t=new td;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=W.RENDER}updateBefore(e){const{renderer:t,material:s}=e,n=this.envNode;if(n.isTextureNode||n.isMaterialReferenceNode){const r=n.isTextureNode?n.value:s[n.property];if(r&&r.isTexture){const i=r.mapping;if(i===jn||i===Qn){if(Fn.has(r)){const a=Fn.get(r);fc(a,r.mapping),this._cubeTexture=a}else{const a=r.image;if(cT(a)){const u=new kp(a.height);u.fromEquirectangularTexture(t,r),fc(u.texture,r.mapping),this._cubeTexture=u.texture,Fn.set(r,u.texture),r.addEventListener("dispose",zp)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}}function cT(o){return o==null?!1:o.height>0}function zp(o){const e=o.target;e.removeEventListener("dispose",zp);const t=Fn.get(e);t!==void 0&&(Fn.delete(e),t.dispose())}function fc(o,e){e===jn?o.mapping=Zs:e===Qn&&(o.mapping=Js)}const Wp=C(uT);class _u extends hn{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=Wp(this.envNode)}}class lT extends hn{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){const t=g(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}}class Ei{start(){}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}}class $p extends Ei{constructor(){super()}indirect(e,t,s){const n=e.ambientOcclusion,r=e.reflectedLight,i=s.context.irradianceLightMap;r.indirectDiffuse.assign(P(0)),i?r.indirectDiffuse.addAssign(i):r.indirectDiffuse.addAssign(P(1,1,1,0)),r.indirectDiffuse.mulAssign(n),r.indirectDiffuse.mulAssign(ee.rgb)}finish(e,t,s){const n=s.material,r=e.outgoingLight,i=s.context.environment;if(i)switch(n.combine){case Xg:r.rgb.assign(Q(r.rgb,r.rgb.mul(i.rgb),Bn.mul(Gr)));break;case Kg:r.rgb.assign(Q(r.rgb,i.rgb,Bn.mul(Gr)));break;case qg:r.rgb.addAssign(i.rgb.mul(Bn.mul(Gr)));break;default:console.warn("THREE.BasicLightingModel: Unsupported .combine value:",n.combine);break}}}const dT=new fl;class hT extends ce{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(dT),this.setValues(e)}setupNormal(){return lt}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new _u(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new lT(du)),t}setupOutgoingLight(){return ee.rgb}setupLightingModel(){return new $p}}const un=b(({f0:o,f90:e,dotVH:t})=>{const s=t.mul(-5.55473).sub(6.98316).mul(t).exp2();return o.mul(s.oneMinus()).add(e.mul(s))}),Ns=b(o=>o.diffuseColor.mul(1/Math.PI)),pT=()=>g(.25),fT=b(({dotNH:o})=>Yr.mul(g(.5)).add(1).mul(g(1/Math.PI)).mul(o.pow(Yr))),gT=b(({lightDirection:o})=>{const e=o.add(ae).normalize(),t=fe.dot(e).clamp(),s=ae.dot(e).clamp(),n=un({f0:We,f90:1,dotVH:s}),r=pT(),i=fT({dotNH:t});return n.mul(r).mul(i)});class Hp extends $p{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:s}){const r=fe.dot(e).clamp().mul(t);s.directDiffuse.addAssign(r.mul(Ns({diffuseColor:ee.rgb}))),this.specular===!0&&s.directSpecular.addAssign(r.mul(gT({lightDirection:e})).mul(Bn))}indirect({ambientOcclusion:e,irradiance:t,reflectedLight:s}){s.indirectDiffuse.addAssign(t.mul(Ns({diffuseColor:ee}))),s.indirectDiffuse.mulAssign(e)}}const mT=new wg;class yT extends ce{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(mT),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new _u(t):null}setupLightingModel(){return new Hp(!1)}}const xT=new Fg;class TT extends ce{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(xT),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new _u(t):null}setupLightingModel(){return new Hp}setupVariants(){const e=(this.shininessNode?g(this.shininessNode):tp).max(1e-4);Yr.assign(e);const t=this.specularNode||np;We.assign(t)}copy(e){return this.shininessNode=e.shininessNode,this.specularNode=e.specularNode,super.copy(e)}}const qp=b(o=>{if(o.geometry.hasAttribute("normal")===!1)return g(0);const e=lt.dFdx().abs().max(lt.dFdy().abs());return e.x.max(e.y).max(e.z)}),bu=b(o=>{const{roughness:e}=o,t=qp();let s=e.max(.0525);return s=s.add(t),s=s.min(1),s}),Kp=b(({alpha:o,dotNL:e,dotNV:t})=>{const s=o.pow2(),n=e.mul(s.add(s.oneMinus().mul(t.pow2())).sqrt()),r=t.mul(s.add(s.oneMinus().mul(e.pow2())).sqrt());return gt(.5,n.add(r).max(Gd))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),_T=b(({alphaT:o,alphaB:e,dotTV:t,dotBV:s,dotTL:n,dotBL:r,dotNV:i,dotNL:a})=>{const u=a.mul(T(o.mul(t),e.mul(s),i).length()),c=i.mul(T(o.mul(n),e.mul(r),a).length());return gt(.5,u.add(c)).saturate()}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),Xp=b(({alpha:o,dotNH:e})=>{const t=o.pow2(),s=e.pow2().mul(t.oneMinus()).oneMinus();return t.div(s.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),bT=g(1/Math.PI),NT=b(({alphaT:o,alphaB:e,dotNH:t,dotTH:s,dotBH:n})=>{const r=o.mul(e),i=T(e.mul(s),o.mul(n),r.mul(t)),a=i.dot(i),u=r.div(a);return bT.mul(r.mul(u.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),jo=b(o=>{const{lightDirection:e,f0:t,f90:s,roughness:n,f:r,USE_IRIDESCENCE:i,USE_ANISOTROPY:a}=o,u=o.normalView||fe,c=n.pow2(),l=e.add(ae).normalize(),d=u.dot(e).clamp(),h=u.dot(ae).clamp(),p=u.dot(l).clamp(),f=ae.dot(l).clamp();let m=un({f0:t,f90:s,dotVH:f}),x,N;if(Gn(i)&&(m=mi.mix(m,r)),Gn(a)){const v=En.dot(e),w=En.dot(ae),B=En.dot(l),F=_s.dot(e),L=_s.dot(ae),I=_s.dot(l);x=_T({alphaT:Xr,alphaB:c,dotTV:w,dotBV:L,dotTL:v,dotBL:F,dotNV:h,dotNL:d}),N=NT({alphaT:Xr,alphaB:c,dotNH:p,dotTH:B,dotBH:I})}else x=Kp({alpha:c,dotNL:d,dotNV:h}),N=Xp({alpha:c,dotNH:p});return m.mul(x).mul(N)}),Nu=b(({roughness:o,dotNV:e})=>{const t=P(-1,-.0275,-.572,.022),s=P(1,.0425,1.04,-.04),n=o.mul(t).add(s),r=n.x.mul(n.x).min(e.mul(-9.28).exp2()).mul(n.x).add(n.y);return M(-1.04,1.04).mul(r).add(n.zw)}).setLayout({name:"DFGApprox",type:"vec2",inputs:[{name:"roughness",type:"float"},{name:"dotNV",type:"vec3"}]}),Yp=b(o=>{const{dotNV:e,specularColor:t,specularF90:s,roughness:n}=o,r=Nu({dotNV:e,roughness:n});return t.mul(r.x).add(s.mul(r.y))}),jp=b(({f:o,f90:e,dotVH:t})=>{const s=t.oneMinus().saturate(),n=s.mul(s),r=s.mul(n,n).clamp(0,.9999);return o.sub(T(e).mul(r)).div(r.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),ST=b(({roughness:o,dotNH:e})=>{const t=o.pow2(),s=g(1).div(t),r=e.pow2().oneMinus().max(.0078125);return g(2).add(s).mul(r.pow(s.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),vT=b(({dotNV:o,dotNL:e})=>g(1).div(g(4).mul(e.add(o).sub(e.mul(o))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),AT=b(({lightDirection:o})=>{const e=o.add(ae).normalize(),t=fe.dot(o).clamp(),s=fe.dot(ae).clamp(),n=fe.dot(e).clamp(),r=ST({roughness:gi,dotNH:n}),i=vT({dotNV:s,dotNL:t});return fs.mul(r).mul(i)}),RT=b(({N:o,V:e,roughness:t})=>{const r=.0078125,i=o.dot(e).saturate(),a=M(t,i.oneMinus().sqrt());return a.assign(a.mul(.984375).add(r)),a}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),CT=b(({f:o})=>{const e=o.length();return ue(e.mul(e).add(o.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),gr=b(({v1:o,v2:e})=>{const t=o.dot(e),s=t.abs().toVar(),n=s.mul(.0145206).add(.4965155).mul(s).add(.8543985).toVar(),r=s.add(4.1616724).mul(s).add(3.417594).toVar(),i=n.div(r),a=t.greaterThan(0).select(i,ue(t.mul(t).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(i));return o.cross(e).mul(a)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),gc=b(({N:o,V:e,P:t,mInv:s,p0:n,p1:r,p2:i,p3:a})=>{const u=r.sub(n).toVar(),c=a.sub(n).toVar(),l=u.cross(c),d=T().toVar();return z(l.dot(t.sub(n)).greaterThanEqual(0),()=>{const h=e.sub(o.mul(e.dot(o))).normalize(),p=o.cross(h).negate(),f=s.mul(Oe(h,p,o).transpose()).toVar(),m=f.mul(n.sub(t)).normalize().toVar(),x=f.mul(r.sub(t)).normalize().toVar(),N=f.mul(i.sub(t)).normalize().toVar(),v=f.mul(a.sub(t)).normalize().toVar(),w=T(0).toVar();w.addAssign(gr({v1:m,v2:x})),w.addAssign(gr({v1:x,v2:N})),w.addAssign(gr({v1:N,v2:v})),w.addAssign(gr({v1:v,v2:m})),d.assign(T(CT({f:w})))}),d}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),wi=1/6,Qp=o=>$(wi,$(o,$(o,o.negate().add(3)).sub(3)).add(1)),Qo=o=>$(wi,$(o,$(o,$(3,o).sub(6))).add(4)),Zp=o=>$(wi,$(o,$(o,$(-3,o).add(3)).add(3)).add(1)),Zo=o=>$(wi,ht(o,3)),mc=o=>Qp(o).add(Qo(o)),yc=o=>Zp(o).add(Zo(o)),xc=o=>_e(-1,Qo(o).div(Qp(o).add(Qo(o)))),Tc=o=>_e(1,Zo(o).div(Zp(o).add(Zo(o)))),_c=(o,e,t)=>{const s=o.uvNode,n=$(s,e.zw).add(.5),r=At(n),i=Xt(n),a=mc(i.x),u=yc(i.x),c=xc(i.x),l=Tc(i.x),d=xc(i.y),h=Tc(i.y),p=M(r.x.add(c),r.y.add(d)).sub(.5).mul(e.xy),f=M(r.x.add(l),r.y.add(d)).sub(.5).mul(e.xy),m=M(r.x.add(c),r.y.add(h)).sub(.5).mul(e.xy),x=M(r.x.add(l),r.y.add(h)).sub(.5).mul(e.xy),N=mc(i.y).mul(_e(a.mul(o.sample(p).level(t)),u.mul(o.sample(f).level(t)))),v=yc(i.y).mul(_e(a.mul(o.sample(m).level(t)),u.mul(o.sample(x).level(t))));return N.add(v)},Jp=b(([o,e=g(3)])=>{const t=M(o.size(y(e))),s=M(o.size(y(e.add(1)))),n=gt(1,t),r=gt(1,s),i=_c(o,P(n,t),At(e)),a=_c(o,P(r,s),xi(e));return Xt(e).mix(i,a)}),bc=b(([o,e,t,s,n])=>{const r=T(Qa(e.negate(),qt(o),gt(1,s))),i=T(zt(n[0].xyz),zt(n[1].xyz),zt(n[2].xyz));return qt(r).mul(t.mul(i))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),ET=b(([o,e])=>o.mul(Et(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),wT=fu(),MT=fu(),Nc=b(([o,e,t],{material:s})=>{const r=(s.side===Ct?wT:MT).sample(o),i=vt(Kn.x).mul(ET(e,t));return Jp(r,i)}),Sc=b(([o,e,t])=>(z(t.notEqual(0),()=>{const s=yi(e).negate().div(t);return za(s.negate().mul(o))}),T(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),BT=b(([o,e,t,s,n,r,i,a,u,c,l,d,h,p,f])=>{let m,x;if(f){m=P().toVar(),x=T().toVar();const F=l.sub(1).mul(f.mul(.025)),L=T(l.sub(F),l,l.add(F));te({start:0,end:3},({i:I})=>{const G=L.element(I),X=bc(o,e,d,G,a),ie=i.add(X),Z=c.mul(u.mul(P(ie,1))),Qe=M(Z.xy.div(Z.w)).toVar();Qe.addAssign(1),Qe.divAssign(2),Qe.assign(M(Qe.x,Qe.y.oneMinus()));const Ze=Nc(Qe,t,G);m.element(I).assign(Ze.element(I)),m.a.addAssign(Ze.a),x.element(I).assign(s.element(I).mul(Sc(zt(X),h,p).element(I)))}),m.a.divAssign(3)}else{const F=bc(o,e,d,l,a),L=i.add(F),I=c.mul(u.mul(P(L,1))),G=M(I.xy.div(I.w)).toVar();G.addAssign(1),G.divAssign(2),G.assign(M(G.x,G.y.oneMinus())),m=Nc(G,t,l),x=s.mul(Sc(zt(F),h,p))}const N=x.rgb.mul(m.rgb),v=o.dot(e).clamp(),w=T(Yp({dotNV:v,specularColor:n,specularF90:r,roughness:t})),B=x.r.add(x.g,x.b).div(3);return P(w.oneMinus().mul(N),m.a.oneMinus().mul(B).oneMinus())}),FT=Oe(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),UT=o=>{const e=o.sqrt();return T(1).add(e).div(T(1).sub(e))},vc=(o,e)=>o.sub(e).div(o.add(e)).pow2(),PT=(o,e)=>{const t=o.mul(2*Math.PI*1e-9),s=T(54856e-17,44201e-17,52481e-17),n=T(1681e3,1795300,2208400),r=T(43278e5,93046e5,66121e5),i=g(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(t.mul(2239900).add(e.x).cos()).mul(t.pow2().mul(-45282e5).exp());let a=s.mul(r.mul(2*Math.PI).sqrt()).mul(n.mul(t).add(e).cos()).mul(t.pow2().negate().mul(r).exp());return a=T(a.x.add(i),a.y,a.z).div(10685e-11),FT.mul(a)},DT=b(({outsideIOR:o,eta2:e,cosTheta1:t,thinFilmThickness:s,baseF0:n})=>{const r=Q(o,e,ct(0,.03,s)),a=o.div(r).pow2().mul(t.pow2().oneMinus()).oneMinus();z(a.lessThan(0),()=>T(1));const u=a.sqrt(),c=vc(r,o),l=un({f0:c,f90:1,dotVH:t}),d=l.oneMinus(),h=r.lessThan(o).select(Math.PI,0),p=g(Math.PI).sub(h),f=UT(n.clamp(0,.9999)),m=vc(f,r.toVec3()),x=un({f0:m,f90:1,dotVH:u}),N=T(f.x.lessThan(r).select(Math.PI,0),f.y.lessThan(r).select(Math.PI,0),f.z.lessThan(r).select(Math.PI,0)),v=r.mul(s,u,2),w=T(p).add(N),B=l.mul(x).clamp(1e-5,.9999),F=B.sqrt(),L=d.pow2().mul(x).div(T(1).sub(B)),G=l.add(L).toVar(),X=L.sub(d).toVar();return te({start:1,end:2,condition:"<=",name:"m"},({m:ie})=>{X.mulAssign(F);const Z=PT(g(ie).mul(v),g(ie).mul(w)).mul(2);G.addAssign(X.mul(Z))}),G.max(T(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),LT=b(({normal:o,viewDir:e,roughness:t})=>{const s=o.dot(e).saturate(),n=t.pow2(),r=Ue(t.lessThan(.25),g(-339.2).mul(n).add(g(161.4).mul(t)).sub(25.9),g(-8.48).mul(n).add(g(14.3).mul(t)).sub(9.95)),i=Ue(t.lessThan(.25),g(44).mul(n).sub(g(23.7).mul(t)).add(3.26),g(1.97).mul(n).sub(g(3.27).mul(t)).add(.72));return Ue(t.lessThan(.25),0,g(.1).mul(t).sub(.025)).add(r.mul(s).add(i).exp()).mul(1/Math.PI).saturate()}),zi=T(.04),Wi=g(1);class Su extends Ei{constructor(e=!1,t=!1,s=!1,n=!1,r=!1,i=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=s,this.anisotropy=n,this.transmission=r,this.dispersion=i,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null}start(e){if(this.clearcoat===!0&&(this.clearcoatRadiance=T().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=T().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=T().toVar("clearcoatSpecularIndirect")),this.sheen===!0&&(this.sheenSpecularDirect=T().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=T().toVar("sheenSpecularIndirect")),this.iridescence===!0){const t=fe.dot(ae).clamp();this.iridescenceFresnel=DT({outsideIOR:g(1),eta2:Ua,cosTheta1:t,thinFilmThickness:Pa,baseF0:We}),this.iridescenceF0=jp({f:this.iridescenceFresnel,f90:1,dotVH:t})}if(this.transmission===!0){const t=Wt,s=su.sub(Wt).normalize(),n=vi;e.backdrop=BT(n,s,Nt,ee,We,Wn,t,at,je,He,wn,Da,Ia,La,this.dispersion?Va:null),e.backdropAlpha=jr,ee.a.mulAssign(Q(1,e.backdrop.a,jr))}}computeMultiscattering(e,t,s){const n=fe.dot(ae).clamp(),r=Nu({roughness:Nt,dotNV:n}),a=(this.iridescenceF0?mi.mix(We,this.iridescenceF0):We).mul(r.x).add(s.mul(r.y)),c=r.x.add(r.y).oneMinus(),l=We.add(We.oneMinus().mul(.047619)),d=a.mul(l).div(c.mul(l).oneMinus());e.addAssign(a),t.addAssign(d.mul(c))}direct({lightDirection:e,lightColor:t,reflectedLight:s}){const r=fe.dot(e).clamp().mul(t);if(this.sheen===!0&&this.sheenSpecularDirect.addAssign(r.mul(AT({lightDirection:e}))),this.clearcoat===!0){const a=Hs.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(jo({lightDirection:e,f0:zi,f90:Wi,roughness:zn,normalView:Hs})))}s.directDiffuse.addAssign(r.mul(Ns({diffuseColor:ee.rgb}))),s.directSpecular.addAssign(r.mul(jo({lightDirection:e,f0:We,f90:1,roughness:Nt,iridescence:this.iridescence,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:s,halfHeight:n,reflectedLight:r,ltc_1:i,ltc_2:a}){const u=t.add(s).sub(n),c=t.sub(s).sub(n),l=t.sub(s).add(n),d=t.add(s).add(n),h=fe,p=ae,f=xe.toVar(),m=RT({N:h,V:p,roughness:Nt}),x=i.sample(m).toVar(),N=a.sample(m).toVar(),v=Oe(T(x.x,0,x.y),T(0,1,0),T(x.z,0,x.w)).toVar(),w=We.mul(N.x).add(We.oneMinus().mul(N.y)).toVar();r.directSpecular.addAssign(e.mul(w).mul(gc({N:h,V:p,P:f,mInv:v,p0:u,p1:c,p2:l,p3:d}))),r.directDiffuse.addAssign(e.mul(ee).mul(gc({N:h,V:p,P:f,mInv:Oe(1,0,0,0,1,0,0,0,1),p0:u,p1:c,p2:l,p3:d})))}indirect(e,t,s){this.indirectDiffuse(e,t,s),this.indirectSpecular(e,t,s),this.ambientOcclusion(e,t,s)}indirectDiffuse({irradiance:e,reflectedLight:t}){t.indirectDiffuse.addAssign(e.mul(Ns({diffuseColor:ee})))}indirectSpecular({radiance:e,iblIrradiance:t,reflectedLight:s}){if(this.sheen===!0&&this.sheenSpecularIndirect.addAssign(t.mul(fs,LT({normal:fe,viewDir:ae,roughness:gi}))),this.clearcoat===!0){const c=Hs.dot(ae).clamp(),l=Yp({dotNV:c,specularColor:zi,specularF90:Wi,roughness:zn});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(l))}const n=T().toVar("singleScattering"),r=T().toVar("multiScattering"),i=t.mul(1/Math.PI);this.computeMultiscattering(n,r,Wn);const a=n.add(r),u=ee.mul(a.r.max(a.g).max(a.b).oneMinus());s.indirectSpecular.addAssign(e.mul(n)),s.indirectSpecular.addAssign(r.mul(i)),s.indirectDiffuse.addAssign(u.mul(i))}ambientOcclusion({ambientOcclusion:e,reflectedLight:t}){const n=fe.dot(ae).clamp().add(e),r=Nt.mul(-16).oneMinus().negate().exp2(),i=e.sub(n.pow(r).oneMinus()).clamp();this.clearcoat===!0&&this.clearcoatSpecularIndirect.mulAssign(e),this.sheen===!0&&this.sheenSpecularIndirect.mulAssign(e),t.indirectDiffuse.mulAssign(e),t.indirectSpecular.mulAssign(i)}finish(e){const{outgoingLight:t}=e;if(this.clearcoat===!0){const s=Hs.dot(ae).clamp(),n=un({dotVH:s,f0:zi,f90:Wi}),r=t.mul(Kr.mul(n).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(Kr));t.assign(r)}if(this.sheen===!0){const s=fs.r.max(fs.g).max(fs.b).mul(.157).oneMinus(),n=t.mul(s).add(this.sheenSpecularDirect,this.sheenSpecularIndirect);t.assign(n)}}}const Ac=g(1),Jo=g(-2),mr=g(.8),$i=g(-1),yr=g(.4),Hi=g(2),xr=g(.305),qi=g(3),Rc=g(.21),IT=g(4),Cc=g(4),VT=g(16),GT=b(([o])=>{const e=T(oe(o)).toVar(),t=g(-1).toVar();return z(e.x.greaterThan(e.z),()=>{z(e.x.greaterThan(e.y),()=>{t.assign(Ue(o.x.greaterThan(0),0,3))}).Else(()=>{t.assign(Ue(o.y.greaterThan(0),1,4))})}).Else(()=>{z(e.z.greaterThan(e.y),()=>{t.assign(Ue(o.z.greaterThan(0),2,5))}).Else(()=>{t.assign(Ue(o.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),OT=b(([o,e])=>{const t=M().toVar();return z(e.equal(0),()=>{t.assign(M(o.z,o.y).div(oe(o.x)))}).ElseIf(e.equal(1),()=>{t.assign(M(o.x.negate(),o.z.negate()).div(oe(o.y)))}).ElseIf(e.equal(2),()=>{t.assign(M(o.x.negate(),o.y).div(oe(o.z)))}).ElseIf(e.equal(3),()=>{t.assign(M(o.z.negate(),o.y).div(oe(o.x)))}).ElseIf(e.equal(4),()=>{t.assign(M(o.x.negate(),o.z).div(oe(o.y)))}).Else(()=>{t.assign(M(o.x,o.y).div(oe(o.z)))}),$(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),kT=b(([o])=>{const e=g(0).toVar();return z(o.greaterThanEqual(mr),()=>{e.assign(Ac.sub(o).mul($i.sub(Jo)).div(Ac.sub(mr)).add(Jo))}).ElseIf(o.greaterThanEqual(yr),()=>{e.assign(mr.sub(o).mul(Hi.sub($i)).div(mr.sub(yr)).add($i))}).ElseIf(o.greaterThanEqual(xr),()=>{e.assign(yr.sub(o).mul(qi.sub(Hi)).div(yr.sub(xr)).add(Hi))}).ElseIf(o.greaterThanEqual(Rc),()=>{e.assign(xr.sub(o).mul(IT.sub(qi)).div(xr.sub(Rc)).add(qi))}).Else(()=>{e.assign(g(-2).mul(vt($(1.16,o))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),ef=b(([o,e])=>{const t=o.toVar();t.assign($(2,t).sub(1));const s=T(t,1).toVar();return z(e.equal(0),()=>{s.assign(s.zyx)}).ElseIf(e.equal(1),()=>{s.assign(s.xzy),s.xz.mulAssign(-1)}).ElseIf(e.equal(2),()=>{s.x.mulAssign(-1)}).ElseIf(e.equal(3),()=>{s.assign(s.zyx),s.xz.mulAssign(-1)}).ElseIf(e.equal(4),()=>{s.assign(s.xzy),s.xy.mulAssign(-1)}).ElseIf(e.equal(5),()=>{s.z.mulAssign(-1)}),s}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),tf=b(([o,e,t,s,n,r])=>{const i=g(t),a=T(e),u=Et(kT(i),Jo,r),c=Xt(u),l=At(u),d=T(ea(o,a,l,s,n,r)).toVar();return z(c.notEqual(0),()=>{const h=T(ea(o,a,l.add(1),s,n,r)).toVar();d.assign(Q(d,h,c))}),d}),ea=b(([o,e,t,s,n,r])=>{const i=g(t).toVar(),a=T(e),u=g(GT(a)).toVar(),c=g(ue(Cc.sub(i),0)).toVar();i.assign(ue(i,Cc));const l=g(rn(i)).toVar(),d=M(OT(a,u).mul(l.sub(2)).add(1)).toVar();return z(u.greaterThan(2),()=>{d.y.addAssign(l),u.subAssign(3)}),d.x.addAssign(u.mul(l)),d.x.addAssign(c.mul($(3,VT))),d.y.addAssign($(4,rn(r).sub(l))),d.x.mulAssign(s),d.y.mulAssign(n),o.sample(d).grad(M(),M())}),Ki=b(({envMap:o,mipInt:e,outputDirection:t,theta:s,axis:n,CUBEUV_TEXEL_WIDTH:r,CUBEUV_TEXEL_HEIGHT:i,CUBEUV_MAX_MIP:a})=>{const u=It(s),c=t.mul(u).add(n.cross(t).mul(st(s))).add(n.mul(n.dot(t).mul(u.oneMinus())));return ea(o,c,e,r,i,a)}),sf=b(({n:o,latitudinal:e,poleAxis:t,outputDirection:s,weights:n,samples:r,dTheta:i,mipInt:a,envMap:u,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:l,CUBEUV_MAX_MIP:d})=>{const h=T(Ue(e,t,_i(t,s))).toVar();z(ka(h.equals(T(0))),()=>{h.assign(T(s.z,0,s.x.negate()))}),h.assign(qt(h));const p=T().toVar();return p.addAssign(n.element(y(0)).mul(Ki({theta:0,axis:h,outputDirection:s,mipInt:a,envMap:u,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:l,CUBEUV_MAX_MIP:d}))),te({start:y(1),end:o},({i:f})=>{z(f.greaterThanEqual(r),()=>{pu()});const m=g(i.mul(g(f))).toVar();p.addAssign(n.element(f).mul(Ki({theta:m.mul(-1),axis:h,outputDirection:s,mipInt:a,envMap:u,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:l,CUBEUV_MAX_MIP:d}))),p.addAssign(n.element(f).mul(Ki({theta:m,axis:h,outputDirection:s,mipInt:a,envMap:u,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:l,CUBEUV_MAX_MIP:d})))}),P(p,1)});let ti=null;const Ec=new WeakMap;function zT(o){const e=Math.log2(o)-2,t=1/o;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:t,maxMip:e}}function WT(o){let e=Ec.get(o);if((e!==void 0?e.pmremVersion:-1)!==o.pmremVersion){const s=o.image;if(o.isCubeTexture)if(HT(s))e=ti.fromCubemap(o,e);else return null;else if(qT(s))e=ti.fromEquirectangular(o,e);else return null;e.pmremVersion=o.pmremVersion,Ec.set(o,e)}return e.texture}class $T extends be{static get type(){return"PMREMNode"}constructor(e,t=null,s=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=s,this._generator=null;const n=new aa;n.isRenderTargetTexture=!0,this._texture=K(n),this._width=V(0),this._height=V(0),this._maxMip=V(0),this.updateBeforeType=W.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){const t=zT(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(){let e=this._pmrem;const t=e?e.pmremVersion:-1,s=this._value;t!==s.pmremVersion&&(s.isPMREMTexture===!0?e=s:e=WT(s),e!==null&&(this._pmrem=e,this.updateFromTexture(e)))}setup(e){ti===null&&(ti=e.createPMREMGenerator()),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this));const s=this.value;e.renderer.coordinateSystem===Pn&&s.isPMREMTexture!==!0&&s.isRenderTargetTexture===!0&&(t=T(t.x.negate(),t.yz)),t=T(t.x,t.y.negate(),t.z);let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),tf(this._texture,t,n,this._width,this._height,this._maxMip)}}function HT(o){if(o==null)return!1;let e=0;const t=6;for(let s=0;s0}const vu=C($T),wc=new WeakMap;class KT extends hn{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){const{material:t}=e;let s=this.envNode;if(s.isTextureNode||s.isMaterialReferenceNode){const p=s.isTextureNode?s.value:t[s.property];let f=wc.get(p);f===void 0&&(f=vu(p),wc.set(p,f)),s=f}const r=t.envMap?ne("envMapIntensity","float",e.material):ne("environmentIntensity","float",e.scene),a=t.useAnisotropy===!0||t.anisotropy>0?Zh:fe,u=s.context(Mc(Nt,a)).mul(r),c=s.context(XT(vi)).mul(Math.PI).mul(r),l=Mn(u),d=Mn(c);e.context.radiance.addAssign(l),e.context.iblIrradiance.addAssign(d);const h=e.context.lightingModel.clearcoatRadiance;if(h){const p=s.context(Mc(zn,Hs)).mul(r),f=Mn(p);h.addAssign(f)}}}const Mc=(o,e)=>{let t=null;return{getUV:()=>(t===null&&(t=ae.negate().reflect(e),t=o.mul(o).mix(t,e).normalize(),t=t.transformDirection(je)),t),getTextureLevel:()=>o}},XT=o=>({getUV:()=>o,getTextureLevel:()=>g(1)}),YT=new Pg;class nf extends ce{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(YT),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new KT(t):null}setupLightingModel(){return new Su}setupSpecular(){const e=Q(T(.04),ee.rgb,kn);We.assign(e),Wn.assign(1)}setupVariants(){const e=this.metalnessNode?g(this.metalnessNode):op;kn.assign(e);let t=this.roughnessNode?g(this.roughnessNode):ip;t=bu({roughness:t}),Nt.assign(t),this.setupSpecular(),ee.assign(P(ee.rgb.mul(e.oneMinus()),ee.a))}copy(e){return this.emissiveNode=e.emissiveNode,this.metalnessNode=e.metalnessNode,this.roughnessNode=e.roughnessNode,super.copy(e)}}const jT=new Ug;class rf extends nf{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(jT),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||this.clearcoatNode!==null}get useIridescence(){return this.iridescence>0||this.iridescenceNode!==null}get useSheen(){return this.sheen>0||this.sheenNode!==null}get useAnisotropy(){return this.anisotropy>0||this.anisotropyNode!==null}get useTransmission(){return this.transmission>0||this.transmissionNode!==null}get useDispersion(){return this.dispersion>0||this.dispersionNode!==null}setupSpecular(){const e=this.iorNode?g(this.iorNode):_p;wn.assign(e),We.assign(Q(Re(Ya(wn.sub(1).div(wn.add(1))).mul(rp),T(1)).mul(Yo),ee.rgb,kn)),Wn.assign(Q(Yo,1,kn))}setupLightingModel(){return new Su(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){const t=this.clearcoatNode?g(this.clearcoatNode):up,s=this.clearcoatRoughnessNode?g(this.clearcoatRoughnessNode):cp;Kr.assign(t),zn.assign(bu({roughness:s}))}if(this.useSheen){const t=this.sheenNode?T(this.sheenNode):hp,s=this.sheenRoughnessNode?g(this.sheenRoughnessNode):pp;fs.assign(t),gi.assign(s)}if(this.useIridescence){const t=this.iridescenceNode?g(this.iridescenceNode):gp,s=this.iridescenceIORNode?g(this.iridescenceIORNode):mp,n=this.iridescenceThicknessNode?g(this.iridescenceThicknessNode):yp;mi.assign(t),Ua.assign(s),Pa.assign(n)}if(this.useAnisotropy){const t=(this.anisotropyNode?M(this.anisotropyNode):fp).toVar();Zt.assign(t.length()),z(Zt.equal(0),()=>{t.assign(M(1,0))}).Else(()=>{t.divAssign(M(Zt)),Zt.assign(Zt.saturate())}),Xr.assign(Zt.pow2().mix(Nt.pow2(),1)),En.assign(gs[0].mul(t.x).add(gs[1].mul(t.y))),_s.assign(gs[1].mul(t.x).sub(gs[0].mul(t.y)))}if(this.useTransmission){const t=this.transmissionNode?g(this.transmissionNode):xp,s=this.thicknessNode?g(this.thicknessNode):Tp,n=this.attenuationDistanceNode?g(this.attenuationDistanceNode):bp,r=this.attenuationColorNode?T(this.attenuationColorNode):Np;if(jr.assign(t),Da.assign(s),La.assign(n),Ia.assign(r),this.useDispersion){const i=this.dispersionNode?g(this.dispersionNode):vp;Va.assign(i)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?T(this.clearcoatNormalNode):lp}setup(e){e.context.setupClearcoatNormal=()=>this.setupClearcoatNormal(e),super.setup(e)}copy(e){return this.clearcoatNode=e.clearcoatNode,this.clearcoatRoughnessNode=e.clearcoatRoughnessNode,this.clearcoatNormalNode=e.clearcoatNormalNode,this.sheenNode=e.sheenNode,this.sheenRoughnessNode=e.sheenRoughnessNode,this.iridescenceNode=e.iridescenceNode,this.iridescenceIORNode=e.iridescenceIORNode,this.iridescenceThicknessNode=e.iridescenceThicknessNode,this.specularIntensityNode=e.specularIntensityNode,this.specularColorNode=e.specularColorNode,this.transmissionNode=e.transmissionNode,this.thicknessNode=e.thicknessNode,this.attenuationDistanceNode=e.attenuationDistanceNode,this.attenuationColorNode=e.attenuationColorNode,this.dispersionNode=e.dispersionNode,this.anisotropyNode=e.anisotropyNode,super.copy(e)}}class QT extends Su{constructor(e=!1,t=!1,s=!1,n=!1,r=!1,i=!1,a=!1){super(e,t,s,n,r,i),this.useSSS=a}direct({lightDirection:e,lightColor:t,reflectedLight:s},n,r){if(this.useSSS===!0){const i=r.material,{thicknessColorNode:a,thicknessDistortionNode:u,thicknessAmbientNode:c,thicknessAttenuationNode:l,thicknessPowerNode:d,thicknessScaleNode:h}=i,p=e.add(fe.mul(u)).normalize(),f=g(ae.dot(p.negate()).saturate().pow(d).mul(h)),m=T(f.add(c).mul(a));s.directDiffuse.addAssign(m.mul(l.mul(t)))}super.direct({lightDirection:e,lightColor:t,reflectedLight:s},n,r)}}class pR extends rf{static get type(){return"MeshSSSNodeMaterial"}constructor(e){super(e),this.thicknessColorNode=null,this.thicknessDistortionNode=g(.1),this.thicknessAmbientNode=g(0),this.thicknessAttenuationNode=g(.1),this.thicknessPowerNode=g(2),this.thicknessScaleNode=g(10)}get useSSS(){return this.thicknessColorNode!==null}setupLightingModel(){return new QT(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion,this.useSSS)}copy(e){return this.thicknessColorNode=e.thicknessColorNode,this.thicknessDistortionNode=e.thicknessDistortionNode,this.thicknessAmbientNode=e.thicknessAmbientNode,this.thicknessAttenuationNode=e.thicknessAttenuationNode,this.thicknessPowerNode=e.thicknessPowerNode,this.thicknessScaleNode=e.thicknessScaleNode,super.copy(e)}}const ZT=b(({normal:o,lightDirection:e,builder:t})=>{const s=o.dot(e),n=M(s.mul(.5).add(.5),0);if(t.material.gradientMap){const r=dt("gradientMap","texture").context({getUV:()=>n});return T(r.r)}else{const r=n.fwidth().mul(.5);return Q(T(.7),T(1),ct(g(.7).sub(r.x),g(.7).add(r.x),n.x))}});class JT extends Ei{direct({lightDirection:e,lightColor:t,reflectedLight:s},n,r){const i=ZT({normal:Ni,lightDirection:e,builder:r}).mul(t);s.directDiffuse.addAssign(i.mul(Ns({diffuseColor:ee.rgb})))}indirect({ambientOcclusion:e,irradiance:t,reflectedLight:s}){s.indirectDiffuse.addAssign(t.mul(Ns({diffuseColor:ee}))),s.indirectDiffuse.mulAssign(e)}}const e_=new Dg;class t_ extends ce{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(e_),this.setValues(e)}setupLightingModel(){return new JT}}class s_ extends be{static get type(){return"MatcapUVNode"}constructor(){super("vec2")}setup(){const e=T(ae.z,0,ae.x.negate()).normalize(),t=ae.cross(e);return M(e.dot(fe),t.dot(fe)).mul(.495).add(.5)}}const of=U(s_),n_=new Mg;class r_ extends ce{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(n_),this.setValues(e)}setupVariants(e){const t=of;let s;e.material.matcap?s=dt("matcap","texture").context({getUV:()=>t}):s=T(Q(.2,.8,t.y)),ee.rgb.mulAssign(s.rgb)}}const i_=new hl;class o_ extends ce{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.isPointsNodeMaterial=!0,this.setDefaultValues(i_),this.setValues(e)}}class a_ extends be{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}getNodeType(e){return this.positionNode.getNodeType(e)}setup(e){const{rotationNode:t,positionNode:s}=this;if(this.getNodeType(e)==="vec2"){const r=t.cos(),i=t.sin();return fi(r,i,i.negate(),r).mul(s)}else{const r=t,i=Ts(P(1,0,0,0),P(0,It(r.x),st(r.x).negate(),0),P(0,st(r.x),It(r.x),0),P(0,0,0,1)),a=Ts(P(It(r.y),0,st(r.y),0),P(0,1,0,0),P(st(r.y).negate(),0,It(r.y),0),P(0,0,0,1)),u=Ts(P(It(r.z),st(r.z).negate(),0,0),P(st(r.z),It(r.z),0,0),P(0,0,1,0),P(0,0,0,1));return i.mul(a).mul(u).mul(P(s,1)).xyz}}}const Au=C(a_),u_=new Hg;class c_ extends ce{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.setDefaultValues(u_),this.setValues(e)}setupPositionView(e){const{object:t,camera:s}=e,n=this.sizeAttenuation,{positionNode:r,rotationNode:i,scaleNode:a}=this,u=Kt.mul(T(r||0));let c=M(at[0].xyz.length(),at[1].xyz.length());if(a!==null&&(c=c.mul(a)),n===!1)if(s.isPerspectiveCamera)c=c.mul(u.z.negate());else{const p=g(2).div(He.element(1).element(1));c=c.mul(p.mul(2))}let l=Ce.xy;if(t.center&&t.center.isVector2===!0){const p=By("center","vec2",t);l=l.sub(p.sub(.5))}l=l.mul(c);const d=g(i||dp),h=Au(l,d);return P(u.xy.add(h),u.zw)}copy(e){return this.positionNode=e.positionNode,this.rotationNode=e.rotationNode,this.scaleNode=e.scaleNode,super.copy(e)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}}class l_ extends Ei{constructor(){super(),this.shadowNode=g(1).toVar("shadowMask")}direct({shadowMask:e}){this.shadowNode.mulAssign(e)}finish(e){ee.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(ee.rgb)}}const d_=new $g;class h_ extends ce{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.setDefaultValues(d_),this.setValues(e)}setupLightingModel(){return new l_}}const p_=b(({texture:o,uv:e})=>{const s=T().toVar();return z(e.x.lessThan(1e-4),()=>{s.assign(T(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{s.assign(T(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{s.assign(T(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{s.assign(T(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{s.assign(T(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{s.assign(T(0,0,-1))}).Else(()=>{const r=o.sample(e.add(T(-.01,0,0))).r.sub(o.sample(e.add(T(.01,0,0))).r),i=o.sample(e.add(T(0,-.01,0))).r.sub(o.sample(e.add(T(0,.01,0))).r),a=o.sample(e.add(T(0,0,-.01))).r.sub(o.sample(e.add(T(0,0,.01))).r);s.assign(T(r,i,a))}),s.normalize()});class f_ extends wt{static get type(){return"Texture3DNode"}constructor(e,t=null,s=null){super(e,t,s),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return T(.5,.5,.5)}setUpdateMatrix(){}setupUV(e,t){const s=this.value;return e.isFlipY()&&(s.isRenderTargetTexture===!0||s.isFramebufferTexture===!0)&&(this.sampler?t=t.flipY():t=t.setY(y(ns(this,this.levelNode).y).sub(t.y).sub(1))),t}generateUV(e,t){return t.build(e,"vec3")}normal(e){return p_({texture:this,uv:e})}}const af=C(f_);class fR extends ce{static get type(){return"VolumeNodeMaterial"}constructor(e){super(),this.isVolumeNodeMaterial=!0,this.base=new mt(16777215),this.map=null,this.steps=100,this.testNode=null,this.setValues(e)}setup(e){const t=af(this.map,null,0),s=b(({orig:n,dir:r})=>{const i=T(-.5),a=T(.5),u=r.reciprocal(),c=i.sub(n).mul(u),l=a.sub(n).mul(u),d=Re(c,l),h=ue(c,l),p=ue(d.x,ue(d.y,d.z)),f=Re(h.x,Re(h.y,h.z));return M(p,f)});this.fragmentNode=b(()=>{const n=ke(T(Ih.mul(P(su,1)))),i=ke(Ce.sub(n)).normalize(),a=M(s({orig:n,dir:i})).toVar();a.x.greaterThan(a.y).discard(),a.assign(M(ue(a.x,0),a.y));const u=T(n.add(a.x.mul(i))).toVar(),c=T(i.abs().reciprocal()).toVar(),l=g(Re(c.x,Re(c.y,c.z))).toVar("delta");l.divAssign(dt("steps","float"));const d=P(dt("base","color"),0).toVar();return te({type:"float",start:a.x,end:a.y,update:"+= delta"},()=>{const h=Fa("float","d").assign(t.sample(u.add(.5)).r);this.testNode!==null?this.testNode({map:t,mapValue:h,probe:u,finalColor:d}).append():(d.a.assign(1),pu()),u.addAssign(i.mul(l))}),d.a.equal(0).discard(),P(d)})(),super.setup(e)}}class g_{constructor(e,t){this.nodes=e,this.info=t,this._context=self,this._animationLoop=null,this._requestId=null}start(){const e=(t,s)=>{this._requestId=this._context.requestAnimationFrame(e),this.info.autoReset===!0&&this.info.reset(),this.nodes.nodeFrame.update(),this.info.frame=this.nodes.nodeFrame.frameId,this._animationLoop!==null&&this._animationLoop(t,s)};e()}stop(){this._context.cancelAnimationFrame(this._requestId),this._requestId=null}setAnimationLoop(e){this._animationLoop=e}setContext(e){this._context=e}dispose(){this.stop()}}class Ft{constructor(){this.weakMap=new WeakMap}get(e){let t=this.weakMap;for(let s=0;s{this.dispose()},this.material.addEventListener("dispose",this.onMaterialDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return this.clippingContext===null||this.clippingContext.cacheKey===this.clippingContextCacheKey?!1:(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return this.material.hardwareClipping===!0?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().monitor)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null}getAttributes(){if(this.attributes!==null)return this.attributes;const e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,s=[],n=new Set;for(const r of e){const i=r.node&&r.node.attribute?r.node.attribute:t.getAttribute(r.name);if(i===void 0)continue;s.push(i);const a=i.isInterleavedBufferAttribute?i.data:i;n.add(a)}return this.attributes=s,this.vertexBuffers=Array.from(n.values()),s}getVertexBuffers(){return this.vertexBuffers===null&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){const{object:e,material:t,geometry:s,group:n,drawRange:r}=this,i=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),a=this.getIndex(),u=a!==null,c=s.isInstancedBufferGeometry?s.instanceCount:e.count>1?e.count:1;if(c===0)return null;if(i.instanceCount=c,e.isBatchedMesh===!0)return i;let l=1;t.wireframe===!0&&!e.isPoints&&!e.isLineSegments&&!e.isLine&&!e.isLineLoop&&(l=2);let d=r.start*l,h=(r.start+r.count)*l;n!==null&&(d=Math.max(d,n.start*l),h=Math.min(h,(n.start+n.count)*l));const p=s.attributes.position;let f=1/0;u?f=a.count:p!=null&&(f=p.count),d=Math.max(d,0),h=Math.min(h,f);const m=h-d;return m<0||m===1/0?null:(i.vertexCount=m,i.firstVertex=d,i)}getGeometryCacheKey(){const{geometry:e}=this;let t="";for(const s of Object.keys(e.attributes).sort()){const n=e.attributes[s];t+=s+",",n.data&&(t+=n.data.stride+","),n.offset&&(t+=n.offset+","),n.itemSize&&(t+=n.itemSize+","),n.normalized&&(t+="n,")}return e.index&&(t+="index,"),t}getMaterialCacheKey(){const{object:e,material:t}=this;let s=t.customProgramCacheKey();for(const n of y_(t)){if(/^(is[A-Z]|_)|^(visible|version|uuid|name|opacity|userData)$/.test(n))continue;const r=t[n];let i;if(r!==null){const a=typeof r;a==="number"?i=r!==0?"1":"0":a==="object"?(i="{",r.isTexture&&(i+=r.mapping),i+="}"):i=String(r)}else i=String(r);s+=i+","}return s+=this.clippingContextCacheKey+",",e.geometry&&(s+=this.getGeometryCacheKey()),e.skeleton&&(s+=e.skeleton.bones.length+","),e.morphTargetInfluences&&(s+=e.morphTargetInfluences.length+","),e.isBatchedMesh&&(s+=e._matricesTexture.uuid+",",e._colorsTexture!==null&&(s+=e._colorsTexture.uuid+",")),e.count>1&&(s+=e.uuid+","),s+=e.receiveShadow+",",ga(s)}get needsGeometryUpdate(){return this.geometry.id!==this.object.geometry.id}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=this._nodes.getCacheKey(this.scene,this.lightsNode);return this.object.receiveShadow&&(e+=1),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.onDispose()}}const Bs=[];class T_{constructor(e,t,s,n,r,i){this.renderer=e,this.nodes=t,this.geometries=s,this.pipelines=n,this.bindings=r,this.info=i,this.chainMaps={}}get(e,t,s,n,r,i,a,u){const c=this.getChainMap(u);Bs[0]=e,Bs[1]=t,Bs[2]=i,Bs[3]=r;let l=c.get(Bs);return l===void 0?(l=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,s,n,r,i,a,u),c.set(Bs,l)):(l.updateClipping(a),l.needsGeometryUpdate&&l.setGeometry(e.geometry),(l.version!==t.version||l.needsUpdate)&&(l.initialCacheKey!==l.getCacheKey()?(l.dispose(),l=this.get(e,t,s,n,r,i,a,u)):l.version=t.version)),l}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Ft)}dispose(){this.chainMaps={}}createRenderObject(e,t,s,n,r,i,a,u,c,l,d){const h=this.getChainMap(d),p=new x_(e,t,s,n,r,i,a,u,c,l);return p.onDispose=()=>{this.pipelines.delete(p),this.bindings.delete(p),this.nodes.delete(p),h.delete(p.getChainArray())},p}}class os{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}}const St={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},ts=16,__=211,b_=212;class N_ extends os{constructor(e){super(),this.backend=e}delete(e){const t=super.delete(e);return t!==void 0&&this.backend.destroyAttribute(e),t}update(e,t){const s=this.get(e);if(s.version===void 0)t===St.VERTEX?this.backend.createAttribute(e):t===St.INDEX?this.backend.createIndexAttribute(e):t===St.STORAGE?this.backend.createStorageAttribute(e):t===St.INDIRECT&&this.backend.createIndirectStorageAttribute(e),s.version=this._getBufferAttribute(e).version;else{const n=this._getBufferAttribute(e);(s.version=0;--e)if(o[e]>=65535)return!0;return!1}function uf(o){return o.index!==null?o.index.version:o.attributes.position.version}function Bc(o){const e=[],t=o.index,s=o.attributes.position;if(t!==null){const r=t.array;for(let i=0,a=r.length;i{this.info.memory.geometries--;const r=t.index,i=e.getAttributes();r!==null&&this.attributes.delete(r);for(const u of i)this.attributes.delete(u);const a=this.wireframes.get(t);a!==void 0&&this.attributes.delete(a),t.removeEventListener("dispose",n)};t.addEventListener("dispose",n)}updateAttributes(e){const t=e.getAttributes();for(const r of t)r.isStorageBufferAttribute||r.isStorageInstancedBufferAttribute?this.updateAttribute(r,St.STORAGE):this.updateAttribute(r,St.VERTEX);const s=this.getIndex(e);s!==null&&this.updateAttribute(s,St.INDEX);const n=e.geometry.indirect;n!==null&&this.updateAttribute(n,St.INDIRECT)}updateAttribute(e,t){const s=this.info.render.calls;e.isInterleavedBufferAttribute?this.attributeCall.get(e)===void 0?(this.attributes.update(e,t),this.attributeCall.set(e,s)):this.attributeCall.get(e.data)!==s&&(this.attributes.update(e,t),this.attributeCall.set(e.data,s),this.attributeCall.set(e,s)):this.attributeCall.get(e)!==s&&(this.attributes.update(e,t),this.attributeCall.set(e,s))}getIndirect(e){return e.geometry.indirect}getIndex(e){const{geometry:t,material:s}=e;let n=t.index;if(s.wireframe===!0){const r=this.wireframes;let i=r.get(t);i===void 0?(i=Bc(t),r.set(t,i)):i.version!==uf(t)&&(this.attributes.delete(i),i=Bc(t),r.set(t,i)),n=i}return n}}class A_{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0,previousFrameCalls:0,timestampCalls:0},this.compute={calls:0,frameCalls:0,timestamp:0,previousFrameCalls:0,timestampCalls:0},this.memory={geometries:0,textures:0}}update(e,t,s){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=s*(t/3):e.isPoints?this.render.points+=s*t:e.isLineSegments?this.render.lines+=s*(t/2):e.isLine?this.render.lines+=s*(t-1):console.error("THREE.WebGPUInfo: Unknown object type.")}updateTimestamp(e,t){this[e].timestampCalls===0&&(this[e].timestamp=0),this[e].timestamp+=t,this[e].timestampCalls++,this[e].timestampCalls>=this[e].previousFrameCalls&&(this[e].timestampCalls=0)}reset(){const e=this.render.frameCalls;this.render.previousFrameCalls=e;const t=this.compute.frameCalls;this.compute.previousFrameCalls=t,this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0,this.memory.geometries=0,this.memory.textures=0}}class cf{constructor(e){this.cacheKey=e,this.usedTimes=0}}class R_ extends cf{constructor(e,t,s){super(e),this.vertexProgram=t,this.fragmentProgram=s}}class C_ extends cf{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}}let E_=0;class Xi{constructor(e,t,s,n=null,r=null){this.id=E_++,this.code=e,this.stage=t,this.name=s,this.transforms=n,this.attributes=r,this.usedTimes=0}}class w_ extends os{constructor(e,t){super(),this.backend=e,this.nodes=t,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){const{backend:s}=this,n=this.get(e);if(this._needsComputeUpdate(e)){const r=n.pipeline;r&&(r.usedTimes--,r.computeProgram.usedTimes--);const i=this.nodes.getForCompute(e);let a=this.programs.compute.get(i.computeShader);a===void 0&&(r&&r.computeProgram.usedTimes===0&&this._releaseProgram(r.computeProgram),a=new Xi(i.computeShader,"compute",e.name,i.transforms,i.nodeAttributes),this.programs.compute.set(i.computeShader,a),s.createProgram(a));const u=this._getComputeCacheKey(e,a);let c=this.caches.get(u);c===void 0&&(r&&r.usedTimes===0&&this._releasePipeline(r),c=this._getComputePipeline(e,a,u,t)),c.usedTimes++,a.usedTimes++,n.version=e.version,n.pipeline=c}return n.pipeline}getForRender(e,t=null){const{backend:s}=this,n=this.get(e);if(this._needsRenderUpdate(e)){const r=n.pipeline;r&&(r.usedTimes--,r.vertexProgram.usedTimes--,r.fragmentProgram.usedTimes--);const i=e.getNodeBuilderState(),a=e.material?e.material.name:"";let u=this.programs.vertex.get(i.vertexShader);u===void 0&&(r&&r.vertexProgram.usedTimes===0&&this._releaseProgram(r.vertexProgram),u=new Xi(i.vertexShader,"vertex",a),this.programs.vertex.set(i.vertexShader,u),s.createProgram(u));let c=this.programs.fragment.get(i.fragmentShader);c===void 0&&(r&&r.fragmentProgram.usedTimes===0&&this._releaseProgram(r.fragmentProgram),c=new Xi(i.fragmentShader,"fragment",a),this.programs.fragment.set(i.fragmentShader,c),s.createProgram(c));const l=this._getRenderCacheKey(e,u,c);let d=this.caches.get(l);d===void 0?(r&&r.usedTimes===0&&this._releasePipeline(r),d=this._getRenderPipeline(e,u,c,l,t)):e.pipeline=d,d.usedTimes++,u.usedTimes++,c.usedTimes++,n.pipeline=d}return n.pipeline}delete(e){const t=this.get(e).pipeline;return t&&(t.usedTimes--,t.usedTimes===0&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,t.computeProgram.usedTimes===0&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,t.vertexProgram.usedTimes===0&&this._releaseProgram(t.vertexProgram),t.fragmentProgram.usedTimes===0&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,s,n){s=s||this._getComputeCacheKey(e,t);let r=this.caches.get(s);return r===void 0&&(r=new C_(s,t),this.caches.set(s,r),this.backend.createComputePipeline(r,n)),r}_getRenderPipeline(e,t,s,n,r){n=n||this._getRenderCacheKey(e,t,s);let i=this.caches.get(n);return i===void 0&&(i=new R_(n,t,s),this.caches.set(n,i),e.pipeline=i,this.backend.createRenderPipeline(e,r)),i}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,s){return t.id+","+s.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){const t=e.code,s=e.stage;this.programs[s].delete(t)}_needsComputeUpdate(e){const t=this.get(e);return t.pipeline===void 0||t.version!==e.version}_needsRenderUpdate(e){return this.get(e).pipeline===void 0||this.backend.needsRenderUpdate(e)}}class M_ extends os{constructor(e,t,s,n,r,i){super(),this.backend=e,this.textures=s,this.pipelines=r,this.attributes=n,this.nodes=t,this.info=i,this.pipelines.bindings=this}getForRender(e){const t=e.getBindings();for(const s of t){const n=this.get(s);n.bindGroup===void 0&&(this._init(s),this.backend.createBindings(s,t,0),n.bindGroup=s)}return t}getForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const s of t){const n=this.get(s);n.bindGroup===void 0&&(this._init(s),this.backend.createBindings(s,t,0),n.bindGroup=s)}return t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}_updateBindings(e){for(const t of e)this._update(t,e)}_init(e){for(const t of e.bindings)if(t.isSampledTexture)this.textures.updateTexture(t.texture);else if(t.isStorageBuffer){const s=t.attribute,n=s.isIndirectStorageBufferAttribute?St.INDIRECT:St.STORAGE;this.attributes.update(s,n)}}_update(e,t){const{backend:s}=this;let n=!1,r=!0,i=0,a=0;for(const u of e.bindings)if(!(u.isNodeUniformsGroup&&this.nodes.updateGroup(u)===!1)){if(u.isUniformBuffer)u.update()&&s.updateBinding(u);else if(u.isSampler)u.update();else if(u.isSampledTexture){const c=this.textures.get(u.texture);u.needsBindingsUpdate(c.generation)&&(n=!0);const l=u.update(),d=u.texture;l&&this.textures.updateTexture(d);const h=s.get(d);if(h.externalTexture!==void 0||c.isDefaultTexture?r=!1:(i=i*10+d.id,a+=d.version),s.isWebGPUBackend===!0&&h.texture===void 0&&h.externalTexture===void 0&&(console.error("Bindings._update: binding should be available:",u,l,d,u.textureNode.value,n),this.textures.updateTexture(d),n=!0),d.isStorageTexture===!0){const p=this.get(d);u.store===!0?p.needsMipmap=!0:this.textures.needsMipmaps(d)&&p.needsMipmap===!0&&(this.backend.generateMipmaps(d),p.needsMipmap=!1)}}}n===!0&&this.backend.updateBindings(e,t,r?i:0,a)}}function B_(o,e){return o.groupOrder!==e.groupOrder?o.groupOrder-e.groupOrder:o.renderOrder!==e.renderOrder?o.renderOrder-e.renderOrder:o.material.id!==e.material.id?o.material.id-e.material.id:o.z!==e.z?o.z-e.z:o.id-e.id}function Fc(o,e){return o.groupOrder!==e.groupOrder?o.groupOrder-e.groupOrder:o.renderOrder!==e.renderOrder?o.renderOrder-e.renderOrder:o.z!==e.z?e.z-o.z:o.id-e.id}function Uc(o){return(o.transmission>0||o.transmissionNode)&&o.side===js&&o.forceSinglePass===!1}class F_{constructor(e,t,s){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lightsNode=e.getNode(t,s),this.lightsArray=[],this.scene=t,this.camera=s,this.occlusionQueryCount=0}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,s,n,r,i,a){let u=this.renderItems[this.renderItemsIndex];return u===void 0?(u={id:e.id,object:e,geometry:t,material:s,groupOrder:n,renderOrder:e.renderOrder,z:r,group:i,clippingContext:a},this.renderItems[this.renderItemsIndex]=u):(u.id=e.id,u.object=e,u.geometry=t,u.material=s,u.groupOrder=n,u.renderOrder=e.renderOrder,u.z=r,u.group=i,u.clippingContext=a),this.renderItemsIndex++,u}push(e,t,s,n,r,i,a){const u=this.getNextRenderItem(e,t,s,n,r,i,a);e.occlusionTest===!0&&this.occlusionQueryCount++,s.transparent===!0||s.transmission>0?(Uc(s)&&this.transparentDoublePass.push(u),this.transparent.push(u)):this.opaque.push(u)}unshift(e,t,s,n,r,i,a){const u=this.getNextRenderItem(e,t,s,n,r,i,a);s.transparent===!0||s.transmission>0?(Uc(s)&&this.transparentDoublePass.unshift(u),this.transparent.unshift(u)):this.opaque.unshift(u)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t){this.opaque.length>1&&this.opaque.sort(e||B_),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||Fc),this.transparent.length>1&&this.transparent.sort(t||Fc)}finish(){this.lightsNode.setLights(this.lightsArray);for(let e=this.renderItemsIndex,t=this.renderItems.length;e>t,c=a.height>>t;let l=e.depthTexture||r[t];const d=e.depthBuffer===!0||e.stencilBuffer===!0;let h=!1;l===void 0&&d&&(l=new vs,l.format=e.stencilBuffer?oi:ai,l.type=e.stencilBuffer?ui:Le,l.image.width=u,l.image.height=c,r[t]=l),(s.width!==a.width||a.height!==s.height)&&(h=!0,l&&(l.needsUpdate=!0,l.image.width=u,l.image.height=c)),s.width=a.width,s.height=a.height,s.textures=i,s.depthTexture=l||null,s.depth=e.depthBuffer,s.stencil=e.stencilBuffer,s.renderTarget=e,s.sampleCount!==n&&(h=!0,l&&(l.needsUpdate=!0),s.sampleCount=n);const p={sampleCount:n};for(let f=0;f{e.removeEventListener("dispose",f);for(let m=0;m0){const l=e.image;if(l===void 0)console.warn("THREE.Renderer: Texture marked for update but image is undefined.");else if(l.complete===!1)console.warn("THREE.Renderer: Texture marked for update but image is incomplete.");else{if(e.images){const d=[];for(const h of e.images)d.push(h);t.images=d}else t.image=l;(s.isDefaultTexture===void 0||s.isDefaultTexture===!0)&&(r.createTexture(e,t),s.isDefaultTexture=!1,s.generation=e.version),e.source.dataReady===!0&&r.updateTexture(e,t),t.needsMipmaps&&e.mipmaps.length===0&&r.generateMipmaps(e)}}else r.createDefaultTexture(e),s.isDefaultTexture=!0,s.generation=e.version;if(s.initialized!==!0){s.initialized=!0,s.generation=e.version,this.info.memory.textures++;const c=()=>{e.removeEventListener("dispose",c),this._destroyTexture(e),this.info.memory.textures--};e.addEventListener("dispose",c)}s.version=e.version}getSize(e,t=I_){let s=e.images?e.images[0]:e.image;return s?(s.image!==void 0&&(s=s.image),t.width=s.width||1,t.height=s.height||1,t.depth=e.isCubeTexture?6:s.depth||1):t.width=t.height=t.depth=1,t}getMipLevels(e,t,s){let n;return e.isCompressedTexture?e.mipmaps?n=e.mipmaps.length:n=1:n=Math.floor(Math.log2(Math.max(t,s)))+1,n}needsMipmaps(e){return this.isEnvironmentTexture(e)||e.isCompressedTexture===!0||e.generateMipmaps}isEnvironmentTexture(e){const t=e.mapping;return t===jn||t===Qn||t===Zs||t===Js}_destroyTexture(e){this.backend.destroySampler(e),this.backend.destroyTexture(e),this.delete(e)}}class Ru extends mt{constructor(e,t,s,n=1){super(e,t,s),this.a=n}set(e,t,s,n=1){return this.a=n,super.set(e,t,s)}copy(e){return e.a!==void 0&&(this.a=e.a),super.copy(e)}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}}class df extends se{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getHash(){return this.uuid}generate(){return this.name}}const G_=(o,e)=>E(new df(o,e));class O_ extends O{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this.isStackNode=!0}getNodeType(e){return this.outputNode?this.outputNode.getNodeType(e):"void"}add(e){return this.nodes.push(e),this}If(e,t){const s=new Cn(t);return this._currentCond=Ue(e,s),this.add(this._currentCond)}ElseIf(e,t){const s=new Cn(t),n=Ue(e,s);return this._currentCond.elseNode=n,this._currentCond=n,this}Else(e){return this._currentCond.elseNode=new Cn(e),this}build(e,...t){const s=Ea();On(this);for(const n of this.nodes)n.build(e,"void");return On(s),this.outputNode?this.outputNode.build(e,...t):super.build(e,...t)}else(...e){return console.warn("TSL.StackNode: .else() has been renamed to .Else()."),this.Else(...e)}elseif(...e){return console.warn("TSL.StackNode: .elseif() has been renamed to .ElseIf()."),this.ElseIf(...e)}}const kr=C(O_);class hf extends O{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}setup(e){super.setup(e);const t=this.members,s=[];for(let n=0;n{const e=o.toUint().mul(747796405).add(2891336453),t=e.shiftRight(e.shiftRight(28).add(4)).bitXor(e).mul(277803737);return t.shiftRight(22).bitXor(t).toFloat().mul(1/2**32)}),ta=(o,e)=>ht($(4,o.mul(Y(1,o))),e),$_=(o,e)=>o.lessThan(.5)?ta(o.mul(2),e).div(2):Y(1,ta($(Y(1,o),2),e).div(2)),H_=(o,e,t)=>ht(gt(ht(o,e),_e(ht(o,e),ht(Y(1,o),t))),1/e),q_=(o,e)=>st(Qr.mul(e.mul(o).sub(1))).div(Qr.mul(e.mul(o).sub(1))),Vt=b(([o])=>o.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),K_=b(([o])=>T(Vt(o.z.add(Vt(o.y.mul(1)))),Vt(o.z.add(Vt(o.x.mul(1)))),Vt(o.y.add(Vt(o.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),X_=b(([o,e,t])=>{const s=T(o).toVar(),n=g(1.4).toVar(),r=g(0).toVar(),i=T(s).toVar();return te({start:g(0),end:g(3),type:"float",condition:"<="},()=>{const a=T(K_(i.mul(2))).toVar();s.addAssign(a.add(t.mul(g(.1).mul(e)))),i.mulAssign(1.8),n.mulAssign(1.5),s.mulAssign(1.2);const u=g(Vt(s.z.add(Vt(s.x.add(Vt(s.y)))))).toVar();r.addAssign(u.div(n)),i.addAssign(.14)}),r}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]});class Y_ extends O{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFnCall=null,this.global=!0}getNodeType(){return this.functionNodes[0].shaderNode.layout.type}setup(e){const t=this.parametersNodes;let s=this._candidateFnCall;if(s===null){let n=null,r=-1;for(const i of this.functionNodes){const u=i.shaderNode.layout;if(u===null)throw new Error("FunctionOverloadingNode: FunctionNode must be a layout.");const c=u.inputs;if(t.length===c.length){let l=0;for(let d=0;dr&&(n=i,r=l)}}this._candidateFnCall=s=n(...t)}return s}}const j_=C(Y_),Pe=o=>(...e)=>j_(o,...e),Cs=V(0).setGroup(k).onRenderUpdate(o=>o.time),gf=V(0).setGroup(k).onRenderUpdate(o=>o.deltaTime),Q_=V(0,"uint").setGroup(k).onRenderUpdate(o=>o.frameId),Z_=(o=1)=>(console.warn('TSL: timerLocal() is deprecated. Use "time" instead.'),Cs.mul(o)),J_=(o=1)=>(console.warn('TSL: timerGlobal() is deprecated. Use "time" instead.'),Cs.mul(o)),eb=(o=1)=>(console.warn('TSL: timerDelta() is deprecated. Use "deltaTime" instead.'),gf.mul(o)),tb=(o=Cs)=>o.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),sb=(o=Cs)=>o.fract().round(),nb=(o=Cs)=>o.add(.5).fract().mul(2).sub(1).abs(),rb=(o=Cs)=>o.fract(),ib=b(([o,e,t=M(.5)])=>Au(o.sub(t),e).add(t)),ob=b(([o,e,t=M(.5)])=>{const s=o.sub(t),n=s.dot(s),i=n.mul(n).mul(e);return o.add(s.mul(i))}),ab=b(({position:o=null,horizontal:e=!0,vertical:t=!1})=>{let s;o!==null?(s=at.toVar(),s[3][0]=o.x,s[3][1]=o.y,s[3][2]=o.z):s=at;const n=je.mul(s);return Gn(e)&&(n[0][0]=at[0].length(),n[0][1]=0,n[0][2]=0),Gn(t)&&(n[1][0]=0,n[1][1]=at[1].length(),n[1][2]=0),n[2][0]=0,n[2][1]=0,n[2][2]=1,He.mul(n).mul(me)}),ub=b(([o=null])=>{const e=ei();return ei(gu(o)).sub(e).lessThan(0).select(Bt,o)});class cb extends O{static get type(){return"SpriteSheetUVNode"}constructor(e,t=le(),s=g(0)){super("vec2"),this.countNode=e,this.uvNode=t,this.frameNode=s}setup(){const{frameNode:e,uvNode:t,countNode:s}=this,{width:n,height:r}=s,i=e.mod(n.mul(r)).floor(),a=i.mod(n),u=r.sub(i.add(1).div(n).ceil()),c=s.reciprocal(),l=M(a,u);return t.add(l).mul(c)}}const lb=C(cb);class db extends O{static get type(){return"TriplanarTexturesNode"}constructor(e,t=null,s=null,n=g(1),r=me,i=Xe){super("vec4"),this.textureXNode=e,this.textureYNode=t,this.textureZNode=s,this.scaleNode=n,this.positionNode=r,this.normalNode=i}setup(){const{textureXNode:e,textureYNode:t,textureZNode:s,scaleNode:n,positionNode:r,normalNode:i}=this;let a=i.abs().normalize();a=a.div(a.dot(T(1)));const u=r.yz.mul(n),c=r.zx.mul(n),l=r.xy.mul(n),d=e.value,h=t!==null?t.value:d,p=s!==null?s.value:d,f=K(d,u).mul(a.x),m=K(h,c).mul(a.y),x=K(p,l).mul(a.z);return _e(f,m,x)}}const mf=C(db),hb=(...o)=>mf(...o),Fs=new vl,as=new j,Us=new j,Yi=new j,yn=new Ie,Tr=new j(0,0,-1),xt=new Me,xn=new j,_r=new j,Tn=new Me,br=new Ye,si=new Ss,pb=Bt.flipX();si.depthTexture=new vs(1,1);let ji=!1;class Cu extends wt{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||si.texture,pb),this._reflectorBaseNode=e.reflector||new fb(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(this._depthNode===null){if(this._reflectorBaseNode.depth!==!0)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=E(new Cu({defaultTexture:si.depthTexture,reflector:this._reflectorBaseNode}))}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){const e=new this.constructor(this.reflectorNode);return e._reflectorBaseNode=this._reflectorBaseNode,e}}class fb extends O{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();const{target:s=new Zg,resolution:n=1,generateMipmaps:r=!1,bounces:i=!0,depth:a=!1}=t;this.textureNode=e,this.target=s,this.resolution=n,this.generateMipmaps=r,this.bounces=i,this.depth=a,this.updateBeforeType=i?W.RENDER:W.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new WeakMap}_updateResolution(e,t){const s=this.resolution;t.getDrawingBufferSize(br),e.setSize(Math.round(br.width*s),Math.round(br.height*s))}setup(e){return this._updateResolution(si,e.renderer),super.setup(e)}getVirtualCamera(e){let t=this.virtualCameras.get(e);return t===void 0&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return t===void 0&&(t=new Ss(0,0,{type:pt}),this.generateMipmaps===!0&&(t.texture.minFilter=Jg,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new vs),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&ji)return!1;ji=!0;const{scene:t,camera:s,renderer:n,material:r}=e,{target:i}=this,a=this.getVirtualCamera(s),u=this.getRenderTarget(a);if(n.getDrawingBufferSize(br),this._updateResolution(u,n),Us.setFromMatrixPosition(i.matrixWorld),Yi.setFromMatrixPosition(s.matrixWorld),yn.extractRotation(i.matrixWorld),as.set(0,0,1),as.applyMatrix4(yn),xn.subVectors(Us,Yi),xn.dot(as)>0)return;xn.reflect(as).negate(),xn.add(Us),yn.extractRotation(s.matrixWorld),Tr.set(0,0,-1),Tr.applyMatrix4(yn),Tr.add(Yi),_r.subVectors(Us,Tr),_r.reflect(as).negate(),_r.add(Us),a.coordinateSystem=s.coordinateSystem,a.position.copy(xn),a.up.set(0,1,0),a.up.applyMatrix4(yn),a.up.reflect(as),a.lookAt(_r),a.near=s.near,a.far=s.far,a.updateMatrixWorld(),a.projectionMatrix.copy(s.projectionMatrix),Fs.setFromNormalAndCoplanarPoint(as,Us),Fs.applyMatrix4(a.matrixWorldInverse),xt.set(Fs.normal.x,Fs.normal.y,Fs.normal.z,Fs.constant);const c=a.projectionMatrix;Tn.x=(Math.sign(xt.x)+c.elements[8])/c.elements[0],Tn.y=(Math.sign(xt.y)+c.elements[9])/c.elements[5],Tn.z=-1,Tn.w=(1+c.elements[10])/c.elements[14],xt.multiplyScalar(1/xt.dot(Tn));const l=0;c.elements[2]=xt.x,c.elements[6]=xt.y,c.elements[10]=n.coordinateSystem===ln?xt.z-l:xt.z+1-l,c.elements[14]=xt.w,this.textureNode.value=u.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=u.depthTexture),r.visible=!1;const d=n.getRenderTarget(),h=n.getMRT(),p=n.autoClear;n.setMRT(null),n.setRenderTarget(u),n.autoClear=!0,n.render(t,a),n.setMRT(h),n.setRenderTarget(d),n.autoClear=p,r.visible=!0,ji=!1}}const gb=o=>E(new Cu(o)),Qi=new Tl(-1,1,1,-1,0,1);class mb extends Sl{constructor(e=!1){super();const t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new ju([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new ju(t,2))}}const yb=new mb;class Mi extends tn{constructor(e=null){super(yb,e),this.camera=Qi,this.isQuadMesh=!0}async renderAsync(e){return e.renderAsync(this,Qi)}render(e){e.render(this,Qi)}}const xb=new Ye;class Tb extends wt{static get type(){return"RTTNode"}constructor(e,t=null,s=null,n={type:pt}){const r=new Ss(t,s,n);super(r.texture,le()),this.node=e,this.width=t,this.height=s,this.pixelRatio=1,this.renderTarget=r,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._rttNode=null,this._quadMesh=new Mi(new ce),this.updateBeforeType=W.RENDER}get autoSize(){return this.width===null}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){this.width=e,this.height=t;const s=e*this.pixelRatio,n=t*this.pixelRatio;this.renderTarget.setSize(s,n),this.textureNeedsUpdate=!0}setPixelRatio(e){this.pixelRatio=e,this.setSize(this.width,this.height)}updateBefore({renderer:e}){if(this.textureNeedsUpdate===!1&&this.autoUpdate===!1)return;if(this.textureNeedsUpdate=!1,this.autoSize===!0){this.pixelRatio=e.getPixelRatio();const s=e.getSize(xb);this.setSize(s.width,s.height)}this._quadMesh.material.fragmentNode=this._rttNode;const t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){const e=new wt(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}const yf=(o,...e)=>E(new Tb(E(o),...e)),_b=(o,...e)=>o.isTextureNode?o:o.isPassNode?o.getTextureNode():yf(o,...e),ks=b(([o,e,t],s)=>{let n;s.renderer.coordinateSystem===ln?(o=M(o.x,o.y.oneMinus()).mul(2).sub(1),n=P(T(o,e),1)):n=P(T(o.x,o.y.oneMinus(),e).mul(2).sub(1),1);const r=P(t.mul(n));return r.xyz.div(r.w)}),bb=b(([o,e])=>{const t=e.mul(P(o,1)),s=t.xy.div(t.w).mul(.5).add(.5).toVar();return M(s.x,s.y.oneMinus())}),Nb=b(([o,e,t])=>{const s=ns(ge(e)),n=Ae(o.mul(s)).toVar(),r=ge(e,n).toVar(),i=ge(e,n.sub(Ae(2,0))).toVar(),a=ge(e,n.sub(Ae(1,0))).toVar(),u=ge(e,n.add(Ae(1,0))).toVar(),c=ge(e,n.add(Ae(2,0))).toVar(),l=ge(e,n.add(Ae(0,2))).toVar(),d=ge(e,n.add(Ae(0,1))).toVar(),h=ge(e,n.sub(Ae(0,1))).toVar(),p=ge(e,n.sub(Ae(0,2))).toVar(),f=oe(Y(g(2).mul(a).sub(i),r)).toVar(),m=oe(Y(g(2).mul(u).sub(c),r)).toVar(),x=oe(Y(g(2).mul(d).sub(l),r)).toVar(),N=oe(Y(g(2).mul(h).sub(p),r)).toVar(),v=ks(o,r,t).toVar(),w=f.lessThan(m).select(v.sub(ks(o.sub(M(g(1).div(s.x),0)),a,t)),v.negate().add(ks(o.add(M(g(1).div(s.x),0)),u,t))),B=x.lessThan(N).select(v.sub(ks(o.add(M(0,g(1).div(s.y))),d,t)),v.negate().add(ks(o.sub(M(0,g(1).div(s.y))),h,t)));return qt(_i(w,B))});class Sb extends oa{constructor(e,t,s=Float32Array){const n=ArrayBuffer.isView(e)?e:new s(e*t);super(n,t),this.isStorageInstancedBufferAttribute=!0}}class xf extends Ur{constructor(e,t,s=Float32Array){const n=ArrayBuffer.isView(e)?e:new s(e*t);super(n,t),this.isStorageBufferAttribute=!0}}class vb extends Rs{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}setup(e){return e.isAvailable("storageBuffer")===!1&&this.node.isPBO===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let s;const n=e.context.assign;if(e.isAvailable("storageBuffer")===!1?this.node.isPBO===!0&&n!==!0&&(this.node.value.isInstancedBufferAttribute||e.shaderStage!=="compute")?s=e.generatePBO(this):s=this.node.build(e):s=super.generate(e),n!==!0){const r=this.getNodeType(e);s=e.format(s,r,t)}return s}}const Ab=C(vb);class Rb extends iu{static get type(){return"StorageBufferNode"}constructor(e,t=null,s=0){t===null&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(t=ya(e.itemSize),s=e.count),super(e,t,s),this.isStorageBufferNode=!0,this.access=Ve.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,e.isStorageBufferAttribute!==!0&&e.isStorageInstancedBufferAttribute!==!0&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){if(this.bufferCount===0){let t=e.globalCache.getData(this.value);return t===void 0&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return Ab(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(Ve.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=nr(this.value),this._varying=ke(this._attribute)),{attribute:this._attribute,varying:this._varying}}getNodeType(e){if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.getNodeType(e);const{attribute:t}=this.getAttributeData();return t.getNodeType(e)}generate(e){if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);const{attribute:t,varying:s}=this.getAttributeData(),n=s.build(e);return e.registerTransform(n,t),n}}const Bi=(o,e=null,t=0)=>E(new Rb(o,e,t)),Cb=(o,e,t)=>(console.warn('THREE.TSL: "storageObject()" is deprecated. Use "storage().setPBO( true )" instead.'),Bi(o,e,t).setPBO(!0)),Eb=(o,e="float")=>{const t=Ta(e),s=xa(e),n=new xf(o,t,s);return Bi(n,e,o)},wb=(o,e="float")=>{const t=Ta(e),s=xa(e),n=new Sb(o,t,s);return Bi(n,e,o)};class Mb extends Uh{static get type(){return"VertexColorNode"}constructor(e=0){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){const e=this.index;return"color"+(e>0?e:"")}generate(e){const t=this.getAttributeName(e),s=e.hasGeometryAttribute(t);let n;return s===!0?n=super.generate(e):n=e.generateConst(this.nodeType,new Me(1,1,1,1)),n}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}const Bb=o=>E(new Mb(o));class Fb extends O{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}const Ub=U(Fb),_n=new Wg,Zi=new Ie;class Ke extends O{static get type(){return"SceneNode"}constructor(e=Ke.BACKGROUND_BLURRINESS,t=null){super(),this.scope=e,this.scene=t}setup(e){const t=this.scope,s=this.scene!==null?this.scene:e.scene;let n;return t===Ke.BACKGROUND_BLURRINESS?n=ne("backgroundBlurriness","float",s):t===Ke.BACKGROUND_INTENSITY?n=ne("backgroundIntensity","float",s):t===Ke.BACKGROUND_ROTATION?n=V("mat4").label("backgroundRotation").setGroup(k).onRenderUpdate(()=>{const r=s.background;return r!==null&&r.isTexture&&r.mapping!==zg?(_n.copy(s.backgroundRotation),_n.x*=-1,_n.y*=-1,_n.z*=-1,Zi.makeRotationFromEuler(_n)):Zi.identity(),Zi}):console.error("THREE.SceneNode: Unknown scope:",t),n}}Ke.BACKGROUND_BLURRINESS="backgroundBlurriness";Ke.BACKGROUND_INTENSITY="backgroundIntensity";Ke.BACKGROUND_ROTATION="backgroundRotation";const Tf=U(Ke,Ke.BACKGROUND_BLURRINESS),sa=U(Ke,Ke.BACKGROUND_INTENSITY),_f=U(Ke,Ke.BACKGROUND_ROTATION);class Pb extends wt{static get type(){return"StorageTextureNode"}constructor(e,t,s=null){super(e,t),this.storeNode=s,this.isStorageTextureNode=!0,this.access=Ve.WRITE_ONLY}getInputType(){return"storageTexture"}setup(e){super.setup(e);const t=e.getNodeProperties(this);t.storeNode=this.storeNode}setAccess(e){return this.access=e,this}generate(e,t){let s;return this.storeNode!==null?s=this.generateStore(e):s=super.generate(e,t),s}toReadWrite(){return this.setAccess(Ve.READ_WRITE)}toReadOnly(){return this.setAccess(Ve.READ_ONLY)}toWriteOnly(){return this.setAccess(Ve.WRITE_ONLY)}generateStore(e){const t=e.getNodeProperties(this),{uvNode:s,storeNode:n}=t,r=super.generate(e,"property"),i=s.build(e,"uvec2"),a=n.build(e,"vec4"),u=e.generateTextureStore(e,r,i,a);e.addLineFlowCode(u,this)}}const bf=C(Pb),Db=(o,e,t)=>{const s=bf(o,e,t);return t!==null&&s.append(),s};class Lb extends Ai{static get type(){return"UserDataNode"}constructor(e,t,s=null){super(e,t,s),this.userData=s}updateReference(e){return this.reference=this.userData!==null?this.userData:e.object.userData,this.reference}}const Ib=(o,e,t)=>E(new Lb(o,e,t)),Pc=new WeakMap;class Vb extends be{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=W.OBJECT,this.updateAfterType=W.OBJECT,this.previousModelWorldMatrix=V(new Ie),this.previousProjectionMatrix=V(new Ie).setGroup(k),this.previousCameraViewMatrix=V(new Ie)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:s}){const n=Dc(s);this.previousModelWorldMatrix.value.copy(n);const r=Nf(t);r.frameId!==e&&(r.frameId=e,r.previousProjectionMatrix===void 0?(r.previousProjectionMatrix=new Ie,r.previousCameraViewMatrix=new Ie,r.currentProjectionMatrix=new Ie,r.currentCameraViewMatrix=new Ie,r.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),r.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(r.previousProjectionMatrix.copy(r.currentProjectionMatrix),r.previousCameraViewMatrix.copy(r.currentCameraViewMatrix)),r.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),r.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(r.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(r.previousCameraViewMatrix))}updateAfter({object:e}){Dc(e).copy(e.matrixWorld)}setup(){const e=this.projectionMatrix===null?He:V(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),s=e.mul(Kt).mul(me),n=this.previousProjectionMatrix.mul(t).mul(Jr),r=s.xy.div(s.w),i=n.xy.div(n.w);return Y(r,i)}}function Nf(o){let e=Pc.get(o);return e===void 0&&(e={},Pc.set(o,e)),e}function Dc(o,e=0){const t=Nf(o);let s=t[e];return s===void 0&&(t[e]=s=new Ie),s}const Gb=U(Vb),Sf=b(([o,e])=>Re(1,o.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),vf=b(([o,e])=>Re(o.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Af=b(([o,e])=>o.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Rf=b(([o,e])=>Q(o.mul(2).mul(e),o.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),Ti(.5,o))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Ob=b(([o,e])=>{const t=e.a.add(o.a.mul(e.a.oneMinus()));return P(e.rgb.mul(e.a).add(o.rgb.mul(o.a).mul(e.a.oneMinus())).div(t),t)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),kb=(...o)=>(console.warn('THREE.TSL: "burn" has been renamed. Use "blendBurn" instead.'),Sf(o)),zb=(...o)=>(console.warn('THREE.TSL: "dodge" has been renamed. Use "blendDodge" instead.'),vf(o)),Wb=(...o)=>(console.warn('THREE.TSL: "screen" has been renamed. Use "blendScreen" instead.'),Af(o)),$b=(...o)=>(console.warn('THREE.TSL: "overlay" has been renamed. Use "blendOverlay" instead.'),Rf(o)),Hb=b(([o])=>Eu(o.rgb)),qb=b(([o,e=g(1)])=>e.mix(Eu(o.rgb),o.rgb)),Kb=b(([o,e=g(1)])=>{const t=_e(o.r,o.g,o.b).div(3),s=o.r.max(o.g.max(o.b)),n=s.sub(t).mul(e).mul(-3);return Q(o.rgb,s,n)}),Xb=b(([o,e=g(1)])=>{const t=T(.57735,.57735,.57735),s=e.cos();return T(o.rgb.mul(s).add(t.cross(o.rgb).mul(e.sin()).add(t.mul(is(t,o.rgb).mul(s.oneMinus())))))}),Eu=(o,e=T(_t.getLuminanceCoefficients(new j)))=>is(o,e),Yb=b(([o,e=T(1),t=T(0),s=T(1),n=g(1),r=T(_t.getLuminanceCoefficients(new j,kt))])=>{const i=o.rgb.dot(T(r)),a=ue(o.rgb.mul(e).add(t),0).toVar(),u=a.pow(s).toVar();return z(a.r.greaterThan(0),()=>{a.r.assign(u.r)}),z(a.g.greaterThan(0),()=>{a.g.assign(u.g)}),z(a.b.greaterThan(0),()=>{a.b.assign(u.b)}),a.assign(i.add(a.sub(i).mul(n))),P(a.rgb,o.a)});class jb extends be{static get type(){return"PosterizeNode"}constructor(e,t){super(),this.sourceNode=e,this.stepsNode=t}setup(){const{sourceNode:e,stepsNode:t}=this;return e.mul(t).floor().div(t)}}const Qb=C(jb),Zb=new Ye;class Cf extends wt{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.setUpdateMatrix(!1)}setup(e){return e.object.isQuadMesh&&this.passNode.build(e),super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class Lc extends Cf{static get type(){return"PassMultipleTextureNode"}constructor(e,t,s=!1){super(e,null),this.textureName=t,this.previousTexture=s}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){return new this.constructor(this.passNode,this.textureName,this.previousTexture)}}class Ut extends be{static get type(){return"PassNode"}constructor(e,t,s,n={}){super("vec4"),this.scope=e,this.scene=t,this.camera=s,this.options=n,this._pixelRatio=1,this._width=1,this._height=1;const r=new vs;r.isRenderTargetTexture=!0,r.name="depth";const i=new Ss(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:pt,...n});i.texture.name="output",i.depthTexture=r,this.renderTarget=i,this._textures={output:i.texture,depth:r},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=V(0),this._cameraFar=V(0),this._mrt=null,this.isPassNode=!0,this.updateBeforeType=W.FRAME}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}isGlobal(){return!0}getTexture(e){let t=this._textures[e];return t===void 0&&(t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)),t}getPreviousTexture(e){let t=this._previousTextures[e];return t===void 0&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){const t=this._previousTextures[e];if(t!==void 0){const s=this._textures[e],n=this.renderTarget.textures.indexOf(s);this.renderTarget.textures[n]=t,this._textures[e]=t,this._previousTextures[e]=s,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return t===void 0&&(t=E(new Lc(this,e)),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return t===void 0&&(this._textureNodes[e]===void 0&&this.getTextureNode(e),t=E(new Lc(this,e,!0)),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(t===void 0){const s=this._cameraNear,n=this._cameraFar;this._viewZNodes[e]=t=mu(this.getTextureNode(e),s,n)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){const s=this._cameraNear,n=this._cameraFar,r=this.getViewZNode(e);this._linearDepthNodes[e]=t=Qs(r,s,n)}return t}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,e.backend.isWebGLBackend===!0&&(this.renderTarget.samples=0),this.scope===Ut.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){const{renderer:t}=e,{scene:s,camera:n}=this;this._pixelRatio=t.getPixelRatio();const r=t.getSize(Zb);this.setSize(r.width,r.height);const i=t.getRenderTarget(),a=t.getMRT();this._cameraNear.value=n.near,this._cameraFar.value=n.far;for(const u in this._previousTextures)this.toggleTexture(u);t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.render(s,n),t.setRenderTarget(i),t.setMRT(a)}setSize(e,t){this._width=e,this._height=t;const s=this._width*this._pixelRatio,n=this._height*this._pixelRatio;this.renderTarget.setSize(s,n)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}}Ut.COLOR="color";Ut.DEPTH="depth";const Jb=(o,e,t)=>E(new Ut(Ut.COLOR,o,e,t)),eN=(o,e)=>E(new Cf(o,e)),tN=(o,e,t)=>E(new Ut(Ut.DEPTH,o,e,t));class sN extends Ut{static get type(){return"ToonOutlinePassNode"}constructor(e,t,s,n,r){super(Ut.COLOR,e,t),this.colorNode=s,this.thicknessNode=n,this.alphaNode=r,this._materialCache=new WeakMap}updateBefore(e){const{renderer:t}=e,s=t.getRenderObjectFunction();t.setRenderObjectFunction((n,r,i,a,u,c,l,d)=>{if((u.isMeshToonMaterial||u.isMeshToonNodeMaterial)&&u.wireframe===!1){const h=this._getOutlineMaterial(u);t.renderObject(n,r,i,a,h,c,l,d)}t.renderObject(n,r,i,a,u,c,l,d)}),super.updateBefore(e),t.setRenderObjectFunction(s)}_createMaterial(){const e=new ce;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=Ct;const t=Xe.negate(),s=He.mul(Kt),n=g(1),r=s.mul(P(me,1)),i=s.mul(P(me.add(t),1)),a=qt(r.sub(i));return e.vertexNode=r.add(a.mul(this.thicknessNode).mul(r.w).mul(n)),e.colorNode=P(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return t===void 0&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}}const nN=(o,e,t=new mt(0,0,0),s=.003,n=1)=>E(new sN(o,e,E(t),E(s),E(n))),Ef=b(([o,e])=>o.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),wf=b(([o,e])=>(o=o.mul(e),o.div(o.add(1)).clamp())).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Mf=b(([o,e])=>{o=o.mul(e),o=o.sub(.004).max(0);const t=o.mul(o.mul(6.2).add(.5)),s=o.mul(o.mul(6.2).add(1.7)).add(.06);return t.div(s).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),rN=b(([o])=>{const e=o.mul(o.add(.0245786)).sub(90537e-9),t=o.mul(o.add(.432951).mul(.983729)).add(.238081);return e.div(t)}),Bf=b(([o,e])=>{const t=Oe(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),s=Oe(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return o=o.mul(e).div(.6),o=t.mul(o),o=rN(o),o=s.mul(o),o.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),iN=Oe(T(1.6605,-.1246,-.0182),T(-.5876,1.1329,-.1006),T(-.0728,-.0083,1.1187)),oN=Oe(T(.6274,.0691,.0164),T(.3293,.9195,.088),T(.0433,.0113,.8956)),aN=b(([o])=>{const e=T(o).toVar(),t=T(e.mul(e)).toVar(),s=T(t.mul(t)).toVar();return g(15.5).mul(s.mul(t)).sub($(40.14,s.mul(e))).add($(31.96,s).sub($(6.868,t.mul(e))).add($(.4298,t).add($(.1191,e).sub(.00232))))}),Ff=b(([o,e])=>{const t=T(o).toVar(),s=Oe(T(.856627153315983,.137318972929847,.11189821299995),T(.0951212405381588,.761241990602591,.0767994186031903),T(.0482516061458583,.101439036467562,.811302368396859)),n=Oe(T(1.1271005818144368,-.1413297634984383,-.14132976349843826),T(-.11060664309660323,1.157823702216272,-.11060664309660294),T(-.016493938717834573,-.016493938717834257,1.2519364065950405)),r=g(-12.47393),i=g(4.026069);return t.mulAssign(e),t.assign(oN.mul(t)),t.assign(s.mul(t)),t.assign(ue(t,1e-10)),t.assign(vt(t)),t.assign(t.sub(r).div(i.sub(r))),t.assign(Et(t,0,1)),t.assign(aN(t)),t.assign(n.mul(t)),t.assign(ht(ue(T(0),t),T(2.2))),t.assign(iN.mul(t)),t.assign(Et(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Uf=b(([o,e])=>{const t=g(.76),s=g(.15);o=o.mul(e);const n=Re(o.r,Re(o.g,o.b)),r=Ue(n.lessThan(.08),n.sub($(6.25,n.mul(n))),.04);o.subAssign(r);const i=ue(o.r,ue(o.g,o.b));z(i.lessThan(t),()=>o);const a=Y(1,t),u=Y(1,a.mul(a).div(i.add(a.sub(t))));o.mulAssign(u.div(i));const c=Y(1,gt(1,s.mul(i.sub(u)).add(1)));return Q(o,T(u),c)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]});class Ne extends O{static get type(){return"CodeNode"}constructor(e="",t=[],s=""){super("code"),this.isCodeNode=!0,this.code=e,this.includes=t,this.language=s}isGlobal(){return!0}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){const t=this.getIncludes(e);for(const n of t)n.build(e);const s=e.getCodeFromNode(this,this.getNodeType(e));return s.code=this.code,s.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}}const Fi=C(Ne),uN=(o,e)=>Fi(o,e,"js"),cN=(o,e)=>Fi(o,e,"wgsl"),lN=(o,e)=>Fi(o,e,"glsl");class Pf extends Ne{static get type(){return"FunctionNode"}constructor(e="",t=[],s=""){super(e,t,s)}getNodeType(e){return this.getNodeFunction(e).type}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){const t=e.getDataFromNode(this);let s=t.nodeFunction;return s===void 0&&(s=e.parser.parseFunction(this.code),t.nodeFunction=s),s}generate(e,t){super.generate(e);const s=this.getNodeFunction(e),n=s.name,r=s.type,i=e.getCodeFromNode(this,r);n!==""&&(i.name=n);const a=e.getPropertyName(i),u=this.getNodeFunction(e).getCode(a);return i.code=u+` -`,t==="property"?a:e.format(`${a}()`,r,t)}}const Df=(o,e=[],t="")=>{for(let r=0;rs.call(...r);return n.functionNode=s,n},dN=(o,e)=>Df(o,e,"glsl"),hN=(o,e)=>Df(o,e,"wgsl");class pN extends O{static get type(){return"ScriptableValueNode"}constructor(e=null){super(),this._value=e,this._cache=null,this.inputType=null,this.outputType=null,this.events=new gl,this.isScriptableValueNode=!0}get isScriptableOutputNode(){return this.outputType!==null}set value(e){this._value!==e&&(this._cache&&this.inputType==="URL"&&this.value.value instanceof ArrayBuffer&&(URL.revokeObjectURL(this._cache),this._cache=null),this._value=e,this.events.dispatchEvent({type:"change"}),this.refresh())}get value(){return this._value}refresh(){this.events.dispatchEvent({type:"refresh"})}getValue(){const e=this.value;if(e&&this._cache===null&&this.inputType==="URL"&&e.value instanceof ArrayBuffer)this._cache=URL.createObjectURL(new Blob([e.value]));else if(e&&e.value!==null&&e.value!==void 0&&((this.inputType==="URL"||this.inputType==="String")&&typeof e.value=="string"||this.inputType==="Number"&&typeof e.value=="number"||this.inputType==="Vector2"&&e.value.isVector2||this.inputType==="Vector3"&&e.value.isVector3||this.inputType==="Vector4"&&e.value.isVector4||this.inputType==="Color"&&e.value.isColor||this.inputType==="Matrix3"&&e.value.isMatrix3||this.inputType==="Matrix4"&&e.value.isMatrix4))return e.value;return this._cache||e}getNodeType(e){return this.value&&this.value.isNode?this.value.getNodeType(e):"float"}setup(){return this.value&&this.value.isNode?this.value:g()}serialize(e){super.serialize(e),this.value!==null?this.inputType==="ArrayBuffer"?e.value=Na(this.value):e.value=this.value?this.value.toJSON(e.meta).uuid:null:e.value=null,e.inputType=this.inputType,e.outputType=this.outputType}deserialize(e){super.deserialize(e);let t=null;e.value!==null&&(e.inputType==="ArrayBuffer"?t=Sa(e.value):e.inputType==="Texture"?t=e.meta.textures[e.value]:t=e.meta.nodes[e.value]||null),this.value=t,this.inputType=e.inputType,this.outputType=e.outputType}}const zr=C(pN);class Lf extends Map{get(e,t=null,...s){if(this.has(e))return super.get(e);if(t!==null){const n=t(...s);return this.set(e,n),n}}}class fN{constructor(e){this.scriptableNode=e}get parameters(){return this.scriptableNode.parameters}get layout(){return this.scriptableNode.getLayout()}getInputLayout(e){return this.scriptableNode.getInputLayout(e)}get(e){const t=this.parameters[e];return t?t.getValue():null}}const Wr=new Lf;class gN extends O{static get type(){return"ScriptableNode"}constructor(e=null,t={}){super(),this.codeNode=e,this.parameters=t,this._local=new Lf,this._output=zr(),this._outputs={},this._source=this.source,this._method=null,this._object=null,this._value=null,this._needsOutputUpdate=!0,this.onRefresh=this.onRefresh.bind(this),this.isScriptableNode=!0}get source(){return this.codeNode?this.codeNode.code:""}setLocal(e,t){return this._local.set(e,t)}getLocal(e){return this._local.get(e)}onRefresh(){this._refresh()}getInputLayout(e){for(const t of this.getLayout())if(t.inputType&&(t.id===e||t.name===e))return t}getOutputLayout(e){for(const t of this.getLayout())if(t.outputType&&(t.id===e||t.name===e))return t}setOutput(e,t){const s=this._outputs;return s[e]===void 0?s[e]=zr(t):s[e].value=t,this}getOutput(e){return this._outputs[e]}getParameter(e){return this.parameters[e]}setParameter(e,t){const s=this.parameters;return t&&t.isScriptableNode?(this.deleteParameter(e),s[e]=t,s[e].getDefaultOutput().events.addEventListener("refresh",this.onRefresh)):t&&t.isScriptableValueNode?(this.deleteParameter(e),s[e]=t,s[e].events.addEventListener("refresh",this.onRefresh)):s[e]===void 0?(s[e]=zr(t),s[e].events.addEventListener("refresh",this.onRefresh)):s[e].value=t,this}getValue(){return this.getDefaultOutput().getValue()}deleteParameter(e){let t=this.parameters[e];return t&&(t.isScriptableNode&&(t=t.getDefaultOutput()),t.events.removeEventListener("refresh",this.onRefresh)),this}clearParameters(){for(const e of Object.keys(this.parameters))this.deleteParameter(e);return this.needsUpdate=!0,this}call(e,...t){const n=this.getObject()[e];if(typeof n=="function")return n(...t)}async callAsync(e,...t){const n=this.getObject()[e];if(typeof n=="function")return n.constructor.name==="AsyncFunction"?await n(...t):n(...t)}getNodeType(e){return this.getDefaultOutputNode().getNodeType(e)}refresh(e=null){e!==null?this.getOutput(e).refresh():this._refresh()}getObject(){if(this.needsUpdate&&this.dispose(),this._object!==null)return this._object;const e=()=>this.refresh(),t=(c,l)=>this.setOutput(c,l),s=new fN(this),n=Wr.get("THREE"),r=Wr.get("TSL"),i=this.getMethod(),a=[s,this._local,Wr,e,t,n,r];this._object=i(...a);const u=this._object.layout;if(u&&(u.cache===!1&&this._local.clear(),this._output.outputType=u.outputType||null,Array.isArray(u.elements)))for(const c of u.elements){const l=c.id||c.name;c.inputType&&(this.getParameter(l)===void 0&&this.setParameter(l,null),this.getParameter(l).inputType=c.inputType),c.outputType&&(this.getOutput(l)===void 0&&this.setOutput(l,null),this.getOutput(l).outputType=c.outputType)}return this._object}deserialize(e){super.deserialize(e);for(const t in this.parameters){let s=this.parameters[t];s.isScriptableNode&&(s=s.getDefaultOutput()),s.events.addEventListener("refresh",this.onRefresh)}}getLayout(){return this.getObject().layout}getDefaultOutputNode(){const e=this.getDefaultOutput().value;return e&&e.isNode?e:g()}getDefaultOutput(){return this._exec()._output}getMethod(){if(this.needsUpdate&&this.dispose(),this._method!==null)return this._method;const e=["parameters","local","global","refresh","setOutput","THREE","TSL"],s=["layout","init","main","dispose"].join(", "),n="var "+s+`; var output = {}; -`,r=` -return { ...output, `+s+" };",i=n+this.codeNode.code+r;return this._method=new Function(...e,i),this._method}dispose(){this._method!==null&&(this._object&&typeof this._object.dispose=="function"&&this._object.dispose(),this._method=null,this._object=null,this._source=null,this._value=null,this._needsOutputUpdate=!0,this._output.value=null,this._outputs={})}setup(){return this.getDefaultOutputNode()}getCacheKey(e){const t=[ga(this.source),this.getDefaultOutputNode().getCacheKey(e)];for(const s in this.parameters)t.push(this.parameters[s].getCacheKey(e));return Zn(t)}set needsUpdate(e){e===!0&&this.dispose()}get needsUpdate(){return this.source!==this._source}_exec(){return this.codeNode===null?this:(this._needsOutputUpdate===!0&&(this._value=this.call("main"),this._needsOutputUpdate=!1),this._output.value=this._value,this)}_refresh(){this.needsUpdate=!0,this._exec(),this._output.refresh()}}const mN=C(gN);function If(o){let e;const t=o.context.getViewZ;return t!==void 0&&(e=t(this)),(e||xe.z).negate()}const wu=b(([o,e],t)=>{const s=If(t);return ct(o,e,s)}),Mu=b(([o],e)=>{const t=If(e);return o.mul(o,t,t).negate().exp().oneMinus()}),Xn=b(([o,e])=>P(e.toFloat().mix($n.rgb,o.toVec3()),$n.a));function yN(o,e,t){return console.warn('THREE.TSL: "rangeFog( color, near, far )" is deprecated. Use "fog( color, rangeFogFactor( near, far ) )" instead.'),Xn(o,wu(e,t))}function xN(o,e){return console.warn('THREE.TSL: "densityFog( color, density )" is deprecated. Use "fog( color, densityFogFactor( density ) )" instead.'),Xn(o,Mu(e))}let us=null,cs=null;class TN extends O{static get type(){return"RangeNode"}constructor(e=g(),t=g()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=e.getTypeLength(Ot(this.minNode.value)),s=e.getTypeLength(Ot(this.maxNode.value));return t>s?t:s}getNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}setup(e){const t=e.object;let s=null;if(t.count>1){const n=this.minNode.value,r=this.maxNode.value,i=e.getTypeLength(Ot(n)),a=e.getTypeLength(Ot(r));us=us||new Me,cs=cs||new Me,us.setScalar(0),cs.setScalar(0),i===1?us.setScalar(n):n.isColor?us.set(n.r,n.g,n.b,1):us.set(n.x,n.y,n.z||0,n.w||0),a===1?cs.setScalar(r):r.isColor?cs.set(r.r,r.g,r.b,1):cs.set(r.x,r.y,r.z||0,r.w||0);const u=4,c=u*t.count,l=new Float32Array(c);for(let h=0;hE(new bN(o,e)),NN=Ui("numWorkgroups","uvec3"),SN=Ui("workgroupId","uvec3"),vN=Ui("localId","uvec3"),AN=Ui("subgroupSize","uint");class RN extends O{constructor(e){super(),this.scope=e}generate(e){const{scope:t}=this,{renderer:s}=e;s.backend.isWebGLBackend===!0?e.addFlowCode(` // ${t}Barrier -`):e.addLineFlowCode(`${t}Barrier()`,this)}}const Bu=C(RN),CN=()=>Bu("workgroup").append(),EN=()=>Bu("storage").append(),wN=()=>Bu("texture").append();class MN extends Rs{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let s;const n=e.context.assign;if(s=super.generate(e),n!==!0){const r=this.getNodeType(e);s=e.format(s,r,t)}return s}}class BN extends O{constructor(e,t,s=0){super(t),this.bufferType=t,this.bufferCount=s,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e}label(e){return this.name=e,this}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return E(new MN(this,e))}generate(e){return e.getScopedArray(this.name||`${this.scope}Array_${this.id}`,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}const FN=(o,e)=>E(new BN("Workgroup",o,e));class Be extends be{static get type(){return"AtomicFunctionNode"}constructor(e,t,s,n=null){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=s,this.storeNode=n}getInputType(e){return this.pointerNode.getNodeType(e)}getNodeType(e){return this.getInputType(e)}generate(e){const t=this.method,s=this.getNodeType(e),n=this.getInputType(e),r=this.pointerNode,i=this.valueNode,a=[];a.push(`&${r.build(e,n)}`),a.push(i.build(e,n));const u=`${e.getMethod(t,s)}( ${a.join(", ")} )`;if(this.storeNode!==null){const c=this.storeNode.build(e,n);e.addLineFlowCode(`${c} = ${u}`,this)}else e.addLineFlowCode(u,this)}}Be.ATOMIC_LOAD="atomicLoad";Be.ATOMIC_STORE="atomicStore";Be.ATOMIC_ADD="atomicAdd";Be.ATOMIC_SUB="atomicSub";Be.ATOMIC_MAX="atomicMax";Be.ATOMIC_MIN="atomicMin";Be.ATOMIC_AND="atomicAnd";Be.ATOMIC_OR="atomicOr";Be.ATOMIC_XOR="atomicXor";const UN=C(Be),Yt=(o,e,t,s=null)=>{const n=UN(o,e,t,s);return n.append(),n},PN=(o,e,t=null)=>Yt(Be.ATOMIC_STORE,o,e,t),DN=(o,e,t=null)=>Yt(Be.ATOMIC_ADD,o,e,t),LN=(o,e,t=null)=>Yt(Be.ATOMIC_SUB,o,e,t),IN=(o,e,t=null)=>Yt(Be.ATOMIC_MAX,o,e,t),VN=(o,e,t=null)=>Yt(Be.ATOMIC_MIN,o,e,t),GN=(o,e,t=null)=>Yt(Be.ATOMIC_AND,o,e,t),ON=(o,e,t=null)=>Yt(Be.ATOMIC_OR,o,e,t),kN=(o,e,t=null)=>Yt(Be.ATOMIC_XOR,o,e,t);let Nr;function hr(o){Nr=Nr||new WeakMap;let e=Nr.get(o);return e===void 0&&Nr.set(o,e={}),e}function Fu(o){const e=hr(o);return e.shadowMatrix||(e.shadowMatrix=V("mat4").setGroup(k).onRenderUpdate(()=>(o.castShadow!==!0&&o.shadow.updateMatrices(o),o.shadow.matrix)))}function Vf(o){const e=hr(o);if(e.projectionUV===void 0){const t=Fu(o).mul(Wt);e.projectionUV=t.xyz.div(t.w)}return e.projectionUV}function Uu(o){const e=hr(o);return e.position||(e.position=V(new j).setGroup(k).onRenderUpdate((t,s)=>s.value.setFromMatrixPosition(o.matrixWorld)))}function Gf(o){const e=hr(o);return e.targetPosition||(e.targetPosition=V(new j).setGroup(k).onRenderUpdate((t,s)=>s.value.setFromMatrixPosition(o.target.matrixWorld)))}function Pi(o){const e=hr(o);return e.viewPosition||(e.viewPosition=V(new j).setGroup(k).onRenderUpdate(({camera:t},s)=>{s.value=s.value||new j,s.value.setFromMatrixPosition(o.matrixWorld),s.value.applyMatrix4(t.matrixWorldInverse)}))}const Pu=o=>je.transformDirection(Uu(o).sub(Gf(o))),zN=o=>o.sort((e,t)=>e.id-t.id),WN=(o,e)=>{for(const t of e)if(t.isAnalyticLightNode&&t.light.id===o)return t;return null},Ji=new WeakMap;class Du extends O{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=T().toVar("totalDiffuse"),this.totalSpecularNode=T().toVar("totalSpecular"),this.outgoingLightNode=T().toVar("outgoingLight"),this._lights=[],this._lightNodes=null,this._lightNodesHash=null,this.global=!0}customCacheKey(){const e=[],t=this._lights;for(let s=0;s0}}const $N=(o=[])=>E(new Du).setLights(o);class HN extends O{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=W.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({material:e}){Lu.assign(e.shadowPositionNode||Wt)}dispose(){this.updateBeforeType=W.NONE}}const Lu=T().toVar("shadowPositionWorld");function Iu(o,e={}){return e.toneMapping=o.toneMapping,e.toneMappingExposure=o.toneMappingExposure,e.outputColorSpace=o.outputColorSpace,e.renderTarget=o.getRenderTarget(),e.activeCubeFace=o.getActiveCubeFace(),e.activeMipmapLevel=o.getActiveMipmapLevel(),e.renderObjectFunction=o.getRenderObjectFunction(),e.pixelRatio=o.getPixelRatio(),e.mrt=o.getMRT(),e.clearColor=o.getClearColor(e.clearColor||new mt),e.clearAlpha=o.getClearAlpha(),e.autoClear=o.autoClear,e.scissorTest=o.getScissorTest(),e}function Of(o,e){return e=Iu(o,e),o.setMRT(null),o.setRenderObjectFunction(null),o.setClearColor(0,1),o.autoClear=!0,e}function kf(o,e){o.toneMapping=e.toneMapping,o.toneMappingExposure=e.toneMappingExposure,o.outputColorSpace=e.outputColorSpace,o.setRenderTarget(e.renderTarget,e.activeCubeFace,e.activeMipmapLevel),o.setRenderObjectFunction(e.renderObjectFunction),o.setPixelRatio(e.pixelRatio),o.setMRT(e.mrt),o.setClearColor(e.clearColor,e.clearAlpha),o.autoClear=e.autoClear,o.setScissorTest(e.scissorTest)}function Vu(o,e={}){return e.background=o.background,e.backgroundNode=o.backgroundNode,e.overrideMaterial=o.overrideMaterial,e}function zf(o,e){return e=Vu(o,e),o.background=null,o.backgroundNode=null,o.overrideMaterial=null,e}function Wf(o,e){o.background=e.background,o.backgroundNode=e.backgroundNode,o.overrideMaterial=e.overrideMaterial}function qN(o,e,t={}){return t=Iu(o,t),t=Vu(e,t),t}function $f(o,e,t){return t=Of(o,t),t=zf(e,t),t}function Hf(o,e,t){kf(o,t),Wf(e,t)}var gR=Object.freeze({__proto__:null,resetRendererAndSceneState:$f,resetRendererState:Of,resetSceneState:zf,restoreRendererAndSceneState:Hf,restoreRendererState:kf,restoreSceneState:Wf,saveRendererAndSceneState:qN,saveRendererState:Iu,saveSceneState:Vu});const Ic=new WeakMap,KN=b(([o,e,t])=>{let s=Wt.sub(o).length();return s=s.sub(e).div(t.sub(e)),s=s.saturate(),s}),XN=o=>{const e=o.shadow.camera,t=ne("near","float",e).setGroup(k),s=ne("far","float",e).setGroup(k),n=Dh(o);return KN(n,t,s)},YN=o=>{let e=Ic.get(o);if(e===void 0){const t=o.isPointLight?XN(o):null;e=new ce,e.colorNode=P(0,0,0,1),e.depthNode=t,e.isShadowNodeMaterial=!0,e.name="ShadowMaterial",e.fog=!1,Ic.set(o,e)}return e},qf=b(({depthTexture:o,shadowCoord:e})=>K(o,e.xy).compare(e.z)),Kf=b(({depthTexture:o,shadowCoord:e,shadow:t})=>{const s=(m,x)=>K(o,m).compare(x),n=ne("mapSize","vec2",t).setGroup(k),r=ne("radius","float",t).setGroup(k),i=M(1).div(n),a=i.x.negate().mul(r),u=i.y.negate().mul(r),c=i.x.mul(r),l=i.y.mul(r),d=a.div(2),h=u.div(2),p=c.div(2),f=l.div(2);return _e(s(e.xy.add(M(a,u)),e.z),s(e.xy.add(M(0,u)),e.z),s(e.xy.add(M(c,u)),e.z),s(e.xy.add(M(d,h)),e.z),s(e.xy.add(M(0,h)),e.z),s(e.xy.add(M(p,h)),e.z),s(e.xy.add(M(a,0)),e.z),s(e.xy.add(M(d,0)),e.z),s(e.xy,e.z),s(e.xy.add(M(p,0)),e.z),s(e.xy.add(M(c,0)),e.z),s(e.xy.add(M(d,f)),e.z),s(e.xy.add(M(0,f)),e.z),s(e.xy.add(M(p,f)),e.z),s(e.xy.add(M(a,l)),e.z),s(e.xy.add(M(0,l)),e.z),s(e.xy.add(M(c,l)),e.z)).mul(1/17)}),Xf=b(({depthTexture:o,shadowCoord:e,shadow:t})=>{const s=(l,d)=>K(o,l).compare(d),n=ne("mapSize","vec2",t).setGroup(k),r=M(1).div(n),i=r.x,a=r.y,u=e.xy,c=Xt(u.mul(n).add(.5));return u.subAssign(c.mul(r)),_e(s(u,e.z),s(u.add(M(i,0)),e.z),s(u.add(M(0,a)),e.z),s(u.add(r),e.z),Q(s(u.add(M(i.negate(),0)),e.z),s(u.add(M(i.mul(2),0)),e.z),c.x),Q(s(u.add(M(i.negate(),a)),e.z),s(u.add(M(i.mul(2),a)),e.z),c.x),Q(s(u.add(M(0,a.negate())),e.z),s(u.add(M(0,a.mul(2))),e.z),c.y),Q(s(u.add(M(i,a.negate())),e.z),s(u.add(M(i,a.mul(2))),e.z),c.y),Q(Q(s(u.add(M(i.negate(),a.negate())),e.z),s(u.add(M(i.mul(2),a.negate())),e.z),c.x),Q(s(u.add(M(i.negate(),a.mul(2))),e.z),s(u.add(M(i.mul(2),a.mul(2))),e.z),c.x),c.y)).mul(1/9)}),Yf=b(({depthTexture:o,shadowCoord:e})=>{const t=g(1).toVar(),s=K(o).sample(e.xy).rg,n=Ti(e.z,s.x);return z(n.notEqual(g(1)),()=>{const r=e.z.sub(s.x),i=ue(0,s.y.mul(s.y));let a=i.div(i.add(r.mul(r)));a=Et(Y(a,.3).div(.95-.3)),t.assign(Et(ue(n,a)))}),t}),jN=b(({samples:o,radius:e,size:t,shadowPass:s})=>{const n=g(0).toVar(),r=g(0).toVar(),i=o.lessThanEqual(g(1)).select(g(0),g(2).div(o.sub(1))),a=o.lessThanEqual(g(1)).select(g(0),g(-1));te({start:y(0),end:y(o),type:"int",condition:"<"},({i:c})=>{const l=a.add(g(c).mul(i)),d=s.sample(_e(dr.xy,M(0,l).mul(e)).div(t)).x;n.addAssign(d),r.addAssign(d.mul(d))}),n.divAssign(o),r.divAssign(o);const u=Pt(r.sub(n.mul(n)));return M(n,u)}),QN=b(({samples:o,radius:e,size:t,shadowPass:s})=>{const n=g(0).toVar(),r=g(0).toVar(),i=o.lessThanEqual(g(1)).select(g(0),g(2).div(o.sub(1))),a=o.lessThanEqual(g(1)).select(g(0),g(-1));te({start:y(0),end:y(o),type:"int",condition:"<"},({i:c})=>{const l=a.add(g(c).mul(i)),d=s.sample(_e(dr.xy,M(l,0).mul(e)).div(t));n.addAssign(d.x),r.addAssign(_e(d.y.mul(d.y),d.x.mul(d.x)))}),n.divAssign(o),r.divAssign(o);const u=Pt(r.sub(n.mul(n)));return M(n,u)}),ZN=[qf,Kf,Xf,Yf];let eo;const Sr=new Mi;class jf extends HN{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this.isShadowNode=!0}setupShadowFilter(e,{filterFn:t,depthTexture:s,shadowCoord:n,shadow:r}){const i=n.x.greaterThanEqual(0).and(n.x.lessThanEqual(1)).and(n.y.greaterThanEqual(0)).and(n.y.lessThanEqual(1)).and(n.z.lessThanEqual(1)),a=t({depthTexture:s,shadowCoord:n,shadow:r});return i.select(a,g(1))}setupShadowCoord(e,t){const{shadow:s}=this,{renderer:n}=e,r=ne("bias","float",s).setGroup(k);let i=t,a;if(s.camera.isOrthographicCamera||n.logarithmicDepthBuffer!==!0)i=i.xyz.div(i.w),a=i.z,n.coordinateSystem===ln&&(a=a.mul(2).sub(1));else{const u=i.w;i=i.xy.div(u);const c=ne("near","float",s.camera).setGroup(k),l=ne("far","float",s.camera).setGroup(k);a=yu(u.negate(),c,l)}return i=T(i.x,i.y.oneMinus(),a.add(r)),i}getShadowFilterFn(e){return ZN[e]}setupShadow(e){const{renderer:t}=e,{light:s,shadow:n}=this,r=t.shadowMap.type,i=new vs(n.mapSize.width,n.mapSize.height);i.compareFunction=ua;const a=e.createRenderTarget(n.mapSize.width,n.mapSize.height);if(a.depthTexture=i,n.camera.updateProjectionMatrix(),r===fr){i.compareFunction=null,this.vsmShadowMapVertical=e.createRenderTarget(n.mapSize.width,n.mapSize.height,{format:Ln,type:pt}),this.vsmShadowMapHorizontal=e.createRenderTarget(n.mapSize.width,n.mapSize.height,{format:Ln,type:pt});const N=K(i),v=K(this.vsmShadowMapVertical.texture),w=ne("blurSamples","float",n).setGroup(k),B=ne("radius","float",n).setGroup(k),F=ne("mapSize","vec2",n).setGroup(k);let L=this.vsmMaterialVertical||(this.vsmMaterialVertical=new ce);L.fragmentNode=jN({samples:w,radius:B,size:F,shadowPass:N}).context(e.getSharedContext()),L.name="VSMVertical",L=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new ce),L.fragmentNode=QN({samples:w,radius:B,size:F,shadowPass:v}).context(e.getSharedContext()),L.name="VSMHorizontal"}const u=ne("intensity","float",n).setGroup(k),c=ne("normalBias","float",n).setGroup(k),l=Fu(s).mul(Lu.add(vi.mul(c))),d=this.setupShadowCoord(e,l),h=n.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(h===null)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");const p=r===fr?this.vsmShadowMapHorizontal.texture:i,f=this.setupShadowFilter(e,{filterFn:h,shadowTexture:a.texture,depthTexture:p,shadowCoord:d,shadow:n}),m=K(a.texture,d),x=Q(1,f.rgb.mix(m,1),u.mul(m.a)).toVar();return this.shadowMap=a,this.shadow.map=a,x}setup(e){if(e.renderer.shadowMap.enabled!==!1)return b(()=>{let t=this._node;return this.setupShadowPosition(e),t===null&&(this._node=t=this.setupShadow(e)),e.material.shadowNode&&console.warn('THREE.NodeMaterial: ".shadowNode" is deprecated. Use ".castShadowNode" instead.'),e.material.receivedShadowNode&&(t=e.material.receivedShadowNode(t)),t})()}renderShadow(e){const{shadow:t,shadowMap:s,light:n}=this,{renderer:r,scene:i}=e;t.updateMatrices(n),s.setSize(t.mapSize.width,t.mapSize.height),r.render(i,t.camera)}updateShadow(e){const{shadowMap:t,light:s,shadow:n}=this,{renderer:r,scene:i,camera:a}=e,u=r.shadowMap.type,c=t.depthTexture.version;this._depthVersionCached=c,n.camera.layers.mask=a.layers.mask;const l=r.getRenderObjectFunction(),d=r.getMRT(),h=d?d.has("velocity"):!1;eo=$f(r,i,eo),i.overrideMaterial=YN(s),r.setRenderObjectFunction((p,f,m,x,N,v,...w)=>{(p.castShadow===!0||p.receiveShadow&&u===fr)&&(h&&(ba(p).useVelocity=!0),p.onBeforeShadow(r,p,a,n.camera,x,f.overrideMaterial,v),r.renderObject(p,f,m,x,N,v,...w),p.onAfterShadow(r,p,a,n.camera,x,f.overrideMaterial,v))}),r.setRenderTarget(t),this.renderShadow(e),r.setRenderObjectFunction(l),s.isPointLight!==!0&&u===fr&&this.vsmPass(r),Hf(r,i,eo)}vsmPass(e){const{shadow:t}=this;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height),e.setRenderTarget(this.vsmShadowMapVertical),Sr.material=this.vsmMaterialVertical,Sr.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),Sr.material=this.vsmMaterialHorizontal,Sr.render(e)}dispose(){this.shadowMap.dispose(),this.shadowMap=null,this.vsmShadowMapVertical!==null&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),this.vsmShadowMapHorizontal!==null&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null),super.dispose()}updateBefore(e){const{shadow:t}=this;(t.needsUpdate||t.autoUpdate)&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}}const Qf=(o,e)=>E(new jf(o,e));class Es extends hn{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new mt,this.colorNode=e&&e.colorNode||V(this.color).setGroup(k),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=W.FRAME}customCacheKey(){return di(this.light.id,this.light.castShadow?1:0)}getHash(){return this.light.uuid}setupShadowNode(){return Qf(this.light)}setupShadow(e){const{renderer:t}=e;if(t.shadowMap.enabled===!1)return;let s=this.shadowColorNode;if(s===null){const n=this.light.shadow.shadowNode;let r;n!==void 0?r=E(n):r=this.setupShadowNode(e),this.shadowNode=r,this.shadowColorNode=s=this.colorNode.mul(r),this.baseColorNode=this.colorNode}this.colorNode=s}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null,this.shadowColorNode=null)}update(){const{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}}const Gu=b(o=>{const{lightDistance:e,cutoffDistance:t,decayExponent:s}=o,n=e.pow(s).max(.01).reciprocal();return t.greaterThan(0).select(n.mul(e.div(t).pow4().oneMinus().clamp().pow2()),n)}),JN=new mt,Tt=b(([o,e])=>{const t=o.toVar(),s=oe(t),n=gt(1,ue(s.x,ue(s.y,s.z)));s.mulAssign(n),t.mulAssign(n.mul(e.mul(2).oneMinus()));const r=M(t.xy).toVar(),a=e.mul(1.5).oneMinus();return z(s.z.greaterThanEqual(a),()=>{z(t.z.greaterThan(0),()=>{r.x.assign(Y(4,t.x))})}).ElseIf(s.x.greaterThanEqual(a),()=>{const u=qn(t.x);r.x.assign(t.z.mul(u).add(u.mul(2)))}).ElseIf(s.y.greaterThanEqual(a),()=>{const u=qn(t.y);r.x.assign(t.x.add(u.mul(2)).add(2)),r.y.assign(t.z.mul(u).sub(2))}),M(.125,.25).mul(r).add(M(.375,.75)).flipY()}).setLayout({name:"cubeToUV",type:"vec2",inputs:[{name:"pos",type:"vec3"},{name:"texelSizeY",type:"float"}]}),eS=b(({depthTexture:o,bd3D:e,dp:t,texelSize:s})=>K(o,Tt(e,s.y)).compare(t)),tS=b(({depthTexture:o,bd3D:e,dp:t,texelSize:s,shadow:n})=>{const r=ne("radius","float",n).setGroup(k),i=M(-1,1).mul(r).mul(s.y);return K(o,Tt(e.add(i.xyy),s.y)).compare(t).add(K(o,Tt(e.add(i.yyy),s.y)).compare(t)).add(K(o,Tt(e.add(i.xyx),s.y)).compare(t)).add(K(o,Tt(e.add(i.yyx),s.y)).compare(t)).add(K(o,Tt(e,s.y)).compare(t)).add(K(o,Tt(e.add(i.xxy),s.y)).compare(t)).add(K(o,Tt(e.add(i.yxy),s.y)).compare(t)).add(K(o,Tt(e.add(i.xxx),s.y)).compare(t)).add(K(o,Tt(e.add(i.yxx),s.y)).compare(t)).mul(1/9)}),sS=b(({filterFn:o,depthTexture:e,shadowCoord:t,shadow:s})=>{const n=t.xyz.toVar(),r=n.length(),i=V("float").setGroup(k).onRenderUpdate(()=>s.camera.near),a=V("float").setGroup(k).onRenderUpdate(()=>s.camera.far),u=ne("bias","float",s).setGroup(k),c=V(s.mapSize).setGroup(k),l=g(1).toVar();return z(r.sub(a).lessThanEqual(0).and(r.sub(i).greaterThanEqual(0)),()=>{const d=r.sub(i).div(a.sub(i)).toVar();d.addAssign(u);const h=n.normalize(),p=M(1).div(c.mul(M(4,2)));l.assign(o({depthTexture:e,bd3D:h,dp:d,texelSize:p,shadow:s}))}),l}),Vc=new Me,Ps=new Ye,bn=new Ye;class nS extends jf{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===gm?eS:tS}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,shadowTexture:s,depthTexture:n,shadowCoord:r,shadow:i}){return sS({filterFn:t,shadowTexture:s,depthTexture:n,shadowCoord:r,shadow:i})}renderShadow(e){const{shadow:t,shadowMap:s,light:n}=this,{renderer:r,scene:i}=e,a=t.getFrameExtents();bn.copy(t.mapSize),bn.multiply(a),s.setSize(bn.width,bn.height),Ps.copy(t.mapSize);const u=r.autoClear,c=r.getClearColor(JN),l=r.getClearAlpha();r.autoClear=!1,r.setClearColor(t.clearColor,t.clearAlpha),r.clear();const d=t.getViewportCount();for(let h=0;hE(new nS(o,e)),Zf=b(({color:o,lightViewPosition:e,cutoffDistance:t,decayExponent:s},n)=>{const r=n.context.lightingModel,i=e.sub(xe),a=i.normalize(),u=i.length(),c=Gu({lightDistance:u,cutoffDistance:t,decayExponent:s}),l=o.mul(c),d=n.context.reflectedLight;r.direct({lightDirection:a,lightColor:l,reflectedLight:d},n.stack,n)});class iS extends Es{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=V(0).setGroup(k),this.decayExponentNode=V(2).setGroup(k)}update(e){const{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return rS(this.light)}setup(e){super.setup(e),Zf({color:this.colorNode,lightViewPosition:Pi(this.light),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode}).append()}}const oS=b(([o=le()])=>{const e=o.mul(2),t=e.x.floor(),s=e.y.floor();return t.add(s).mod(2).sign()}),Un=b(([o,e,t])=>{const s=g(t).toVar(),n=g(e).toVar(),r=Ht(o).toVar();return Ue(r,n,s)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),ni=b(([o,e])=>{const t=Ht(e).toVar(),s=g(o).toVar();return Ue(t,s.negate(),s)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),Te=b(([o])=>{const e=g(o).toVar();return y(At(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),he=b(([o,e])=>{const t=g(o).toVar();return e.assign(Te(t)),t.sub(g(e))}),aS=b(([o,e,t,s,n,r])=>{const i=g(r).toVar(),a=g(n).toVar(),u=g(s).toVar(),c=g(t).toVar(),l=g(e).toVar(),d=g(o).toVar(),h=g(Y(1,a)).toVar();return Y(1,i).mul(d.mul(h).add(l.mul(a))).add(i.mul(c.mul(h).add(u.mul(a))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),uS=b(([o,e,t,s,n,r])=>{const i=g(r).toVar(),a=g(n).toVar(),u=T(s).toVar(),c=T(t).toVar(),l=T(e).toVar(),d=T(o).toVar(),h=g(Y(1,a)).toVar();return Y(1,i).mul(d.mul(h).add(l.mul(a))).add(i.mul(c.mul(h).add(u.mul(a))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),Jf=Pe([aS,uS]),cS=b(([o,e,t,s,n,r,i,a,u,c,l])=>{const d=g(l).toVar(),h=g(c).toVar(),p=g(u).toVar(),f=g(a).toVar(),m=g(i).toVar(),x=g(r).toVar(),N=g(n).toVar(),v=g(s).toVar(),w=g(t).toVar(),B=g(e).toVar(),F=g(o).toVar(),L=g(Y(1,p)).toVar(),I=g(Y(1,h)).toVar();return g(Y(1,d)).toVar().mul(I.mul(F.mul(L).add(B.mul(p))).add(h.mul(w.mul(L).add(v.mul(p))))).add(d.mul(I.mul(N.mul(L).add(x.mul(p))).add(h.mul(m.mul(L).add(f.mul(p))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),lS=b(([o,e,t,s,n,r,i,a,u,c,l])=>{const d=g(l).toVar(),h=g(c).toVar(),p=g(u).toVar(),f=T(a).toVar(),m=T(i).toVar(),x=T(r).toVar(),N=T(n).toVar(),v=T(s).toVar(),w=T(t).toVar(),B=T(e).toVar(),F=T(o).toVar(),L=g(Y(1,p)).toVar(),I=g(Y(1,h)).toVar();return g(Y(1,d)).toVar().mul(I.mul(F.mul(L).add(B.mul(p))).add(h.mul(w.mul(L).add(v.mul(p))))).add(d.mul(I.mul(N.mul(L).add(x.mul(p))).add(h.mul(m.mul(L).add(f.mul(p))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),eg=Pe([cS,lS]),dS=b(([o,e,t])=>{const s=g(t).toVar(),n=g(e).toVar(),r=D(o).toVar(),i=D(r.bitAnd(D(7))).toVar(),a=g(Un(i.lessThan(D(4)),n,s)).toVar(),u=g($(2,Un(i.lessThan(D(4)),s,n))).toVar();return ni(a,Ht(i.bitAnd(D(1)))).add(ni(u,Ht(i.bitAnd(D(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),hS=b(([o,e,t,s])=>{const n=g(s).toVar(),r=g(t).toVar(),i=g(e).toVar(),a=D(o).toVar(),u=D(a.bitAnd(D(15))).toVar(),c=g(Un(u.lessThan(D(8)),i,r)).toVar(),l=g(Un(u.lessThan(D(4)),r,Un(u.equal(D(12)).or(u.equal(D(14))),i,n))).toVar();return ni(c,Ht(u.bitAnd(D(1)))).add(ni(l,Ht(u.bitAnd(D(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),Ee=Pe([dS,hS]),pS=b(([o,e,t])=>{const s=g(t).toVar(),n=g(e).toVar(),r=dn(o).toVar();return T(Ee(r.x,n,s),Ee(r.y,n,s),Ee(r.z,n,s))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),fS=b(([o,e,t,s])=>{const n=g(s).toVar(),r=g(t).toVar(),i=g(e).toVar(),a=dn(o).toVar();return T(Ee(a.x,i,r,n),Ee(a.y,i,r,n),Ee(a.z,i,r,n))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),nt=Pe([pS,fS]),gS=b(([o])=>{const e=g(o).toVar();return $(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),mS=b(([o])=>{const e=g(o).toVar();return $(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),yS=b(([o])=>{const e=T(o).toVar();return $(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),tg=Pe([gS,yS]),xS=b(([o])=>{const e=T(o).toVar();return $(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),sg=Pe([mS,xS]),tt=b(([o,e])=>{const t=y(e).toVar(),s=D(o).toVar();return s.shiftLeft(t).bitOr(s.shiftRight(y(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),ng=b(([o,e,t])=>{o.subAssign(t),o.bitXorAssign(tt(t,y(4))),t.addAssign(e),e.subAssign(o),e.bitXorAssign(tt(o,y(6))),o.addAssign(t),t.subAssign(e),t.bitXorAssign(tt(e,y(8))),e.addAssign(o),o.subAssign(t),o.bitXorAssign(tt(t,y(16))),t.addAssign(e),e.subAssign(o),e.bitXorAssign(tt(o,y(19))),o.addAssign(t),t.subAssign(e),t.bitXorAssign(tt(e,y(4))),e.addAssign(o)}),pr=b(([o,e,t])=>{const s=D(t).toVar(),n=D(e).toVar(),r=D(o).toVar();return s.bitXorAssign(n),s.subAssign(tt(n,y(14))),r.bitXorAssign(s),r.subAssign(tt(s,y(11))),n.bitXorAssign(r),n.subAssign(tt(r,y(25))),s.bitXorAssign(n),s.subAssign(tt(n,y(16))),r.bitXorAssign(s),r.subAssign(tt(s,y(4))),n.bitXorAssign(r),n.subAssign(tt(r,y(14))),s.bitXorAssign(n),s.subAssign(tt(n,y(24))),s}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),Ge=b(([o])=>{const e=D(o).toVar();return g(e).div(g(D(y(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),Rt=b(([o])=>{const e=g(o).toVar();return e.mul(e).mul(e).mul(e.mul(e.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),TS=b(([o])=>{const e=y(o).toVar(),t=D(D(1)).toVar(),s=D(D(y(3735928559)).add(t.shiftLeft(D(2))).add(D(13))).toVar();return pr(s.add(D(e)),s,s)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),_S=b(([o,e])=>{const t=y(e).toVar(),s=y(o).toVar(),n=D(D(2)).toVar(),r=D().toVar(),i=D().toVar(),a=D().toVar();return r.assign(i.assign(a.assign(D(y(3735928559)).add(n.shiftLeft(D(2))).add(D(13))))),r.addAssign(D(s)),i.addAssign(D(t)),pr(r,i,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),bS=b(([o,e,t])=>{const s=y(t).toVar(),n=y(e).toVar(),r=y(o).toVar(),i=D(D(3)).toVar(),a=D().toVar(),u=D().toVar(),c=D().toVar();return a.assign(u.assign(c.assign(D(y(3735928559)).add(i.shiftLeft(D(2))).add(D(13))))),a.addAssign(D(r)),u.addAssign(D(n)),c.addAssign(D(s)),pr(a,u,c)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),NS=b(([o,e,t,s])=>{const n=y(s).toVar(),r=y(t).toVar(),i=y(e).toVar(),a=y(o).toVar(),u=D(D(4)).toVar(),c=D().toVar(),l=D().toVar(),d=D().toVar();return c.assign(l.assign(d.assign(D(y(3735928559)).add(u.shiftLeft(D(2))).add(D(13))))),c.addAssign(D(a)),l.addAssign(D(i)),d.addAssign(D(r)),ng(c,l,d),c.addAssign(D(n)),pr(c,l,d)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),SS=b(([o,e,t,s,n])=>{const r=y(n).toVar(),i=y(s).toVar(),a=y(t).toVar(),u=y(e).toVar(),c=y(o).toVar(),l=D(D(5)).toVar(),d=D().toVar(),h=D().toVar(),p=D().toVar();return d.assign(h.assign(p.assign(D(y(3735928559)).add(l.shiftLeft(D(2))).add(D(13))))),d.addAssign(D(c)),h.addAssign(D(u)),p.addAssign(D(a)),ng(d,h,p),d.addAssign(D(i)),h.addAssign(D(r)),pr(d,h,p)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),re=Pe([TS,_S,bS,NS,SS]),vS=b(([o,e])=>{const t=y(e).toVar(),s=y(o).toVar(),n=D(re(s,t)).toVar(),r=dn().toVar();return r.x.assign(n.bitAnd(y(255))),r.y.assign(n.shiftRight(y(8)).bitAnd(y(255))),r.z.assign(n.shiftRight(y(16)).bitAnd(y(255))),r}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),AS=b(([o,e,t])=>{const s=y(t).toVar(),n=y(e).toVar(),r=y(o).toVar(),i=D(re(r,n,s)).toVar(),a=dn().toVar();return a.x.assign(i.bitAnd(y(255))),a.y.assign(i.shiftRight(y(8)).bitAnd(y(255))),a.z.assign(i.shiftRight(y(16)).bitAnd(y(255))),a}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),rt=Pe([vS,AS]),RS=b(([o])=>{const e=M(o).toVar(),t=y().toVar(),s=y().toVar(),n=g(he(e.x,t)).toVar(),r=g(he(e.y,s)).toVar(),i=g(Rt(n)).toVar(),a=g(Rt(r)).toVar(),u=g(Jf(Ee(re(t,s),n,r),Ee(re(t.add(y(1)),s),n.sub(1),r),Ee(re(t,s.add(y(1))),n,r.sub(1)),Ee(re(t.add(y(1)),s.add(y(1))),n.sub(1),r.sub(1)),i,a)).toVar();return tg(u)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),CS=b(([o])=>{const e=T(o).toVar(),t=y().toVar(),s=y().toVar(),n=y().toVar(),r=g(he(e.x,t)).toVar(),i=g(he(e.y,s)).toVar(),a=g(he(e.z,n)).toVar(),u=g(Rt(r)).toVar(),c=g(Rt(i)).toVar(),l=g(Rt(a)).toVar(),d=g(eg(Ee(re(t,s,n),r,i,a),Ee(re(t.add(y(1)),s,n),r.sub(1),i,a),Ee(re(t,s.add(y(1)),n),r,i.sub(1),a),Ee(re(t.add(y(1)),s.add(y(1)),n),r.sub(1),i.sub(1),a),Ee(re(t,s,n.add(y(1))),r,i,a.sub(1)),Ee(re(t.add(y(1)),s,n.add(y(1))),r.sub(1),i,a.sub(1)),Ee(re(t,s.add(y(1)),n.add(y(1))),r,i.sub(1),a.sub(1)),Ee(re(t.add(y(1)),s.add(y(1)),n.add(y(1))),r.sub(1),i.sub(1),a.sub(1)),u,c,l)).toVar();return sg(d)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),Ou=Pe([RS,CS]),ES=b(([o])=>{const e=M(o).toVar(),t=y().toVar(),s=y().toVar(),n=g(he(e.x,t)).toVar(),r=g(he(e.y,s)).toVar(),i=g(Rt(n)).toVar(),a=g(Rt(r)).toVar(),u=T(Jf(nt(rt(t,s),n,r),nt(rt(t.add(y(1)),s),n.sub(1),r),nt(rt(t,s.add(y(1))),n,r.sub(1)),nt(rt(t.add(y(1)),s.add(y(1))),n.sub(1),r.sub(1)),i,a)).toVar();return tg(u)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),wS=b(([o])=>{const e=T(o).toVar(),t=y().toVar(),s=y().toVar(),n=y().toVar(),r=g(he(e.x,t)).toVar(),i=g(he(e.y,s)).toVar(),a=g(he(e.z,n)).toVar(),u=g(Rt(r)).toVar(),c=g(Rt(i)).toVar(),l=g(Rt(a)).toVar(),d=T(eg(nt(rt(t,s,n),r,i,a),nt(rt(t.add(y(1)),s,n),r.sub(1),i,a),nt(rt(t,s.add(y(1)),n),r,i.sub(1),a),nt(rt(t.add(y(1)),s.add(y(1)),n),r.sub(1),i.sub(1),a),nt(rt(t,s,n.add(y(1))),r,i,a.sub(1)),nt(rt(t.add(y(1)),s,n.add(y(1))),r.sub(1),i,a.sub(1)),nt(rt(t,s.add(y(1)),n.add(y(1))),r,i.sub(1),a.sub(1)),nt(rt(t.add(y(1)),s.add(y(1)),n.add(y(1))),r.sub(1),i.sub(1),a.sub(1)),u,c,l)).toVar();return sg(d)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),ku=Pe([ES,wS]),MS=b(([o])=>{const e=g(o).toVar(),t=y(Te(e)).toVar();return Ge(re(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),BS=b(([o])=>{const e=M(o).toVar(),t=y(Te(e.x)).toVar(),s=y(Te(e.y)).toVar();return Ge(re(t,s))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),FS=b(([o])=>{const e=T(o).toVar(),t=y(Te(e.x)).toVar(),s=y(Te(e.y)).toVar(),n=y(Te(e.z)).toVar();return Ge(re(t,s,n))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),US=b(([o])=>{const e=P(o).toVar(),t=y(Te(e.x)).toVar(),s=y(Te(e.y)).toVar(),n=y(Te(e.z)).toVar(),r=y(Te(e.w)).toVar();return Ge(re(t,s,n,r))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),PS=Pe([MS,BS,FS,US]),DS=b(([o])=>{const e=g(o).toVar(),t=y(Te(e)).toVar();return T(Ge(re(t,y(0))),Ge(re(t,y(1))),Ge(re(t,y(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),LS=b(([o])=>{const e=M(o).toVar(),t=y(Te(e.x)).toVar(),s=y(Te(e.y)).toVar();return T(Ge(re(t,s,y(0))),Ge(re(t,s,y(1))),Ge(re(t,s,y(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),IS=b(([o])=>{const e=T(o).toVar(),t=y(Te(e.x)).toVar(),s=y(Te(e.y)).toVar(),n=y(Te(e.z)).toVar();return T(Ge(re(t,s,n,y(0))),Ge(re(t,s,n,y(1))),Ge(re(t,s,n,y(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),VS=b(([o])=>{const e=P(o).toVar(),t=y(Te(e.x)).toVar(),s=y(Te(e.y)).toVar(),n=y(Te(e.z)).toVar(),r=y(Te(e.w)).toVar();return T(Ge(re(t,s,n,r,y(0))),Ge(re(t,s,n,r,y(1))),Ge(re(t,s,n,r,y(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),rg=Pe([DS,LS,IS,VS]),ri=b(([o,e,t,s])=>{const n=g(s).toVar(),r=g(t).toVar(),i=y(e).toVar(),a=T(o).toVar(),u=g(0).toVar(),c=g(1).toVar();return te(i,()=>{u.addAssign(c.mul(Ou(a))),c.mulAssign(n),a.mulAssign(r)}),u}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),ig=b(([o,e,t,s])=>{const n=g(s).toVar(),r=g(t).toVar(),i=y(e).toVar(),a=T(o).toVar(),u=T(0).toVar(),c=g(1).toVar();return te(i,()=>{u.addAssign(c.mul(ku(a))),c.mulAssign(n),a.mulAssign(r)}),u}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),GS=b(([o,e,t,s])=>{const n=g(s).toVar(),r=g(t).toVar(),i=y(e).toVar(),a=T(o).toVar();return M(ri(a,i,r,n),ri(a.add(T(y(19),y(193),y(17))),i,r,n))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),OS=b(([o,e,t,s])=>{const n=g(s).toVar(),r=g(t).toVar(),i=y(e).toVar(),a=T(o).toVar(),u=T(ig(a,i,r,n)).toVar(),c=g(ri(a.add(T(y(19),y(193),y(17))),i,r,n)).toVar();return P(u,c)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),kS=b(([o,e,t,s,n,r,i])=>{const a=y(i).toVar(),u=g(r).toVar(),c=y(n).toVar(),l=y(s).toVar(),d=y(t).toVar(),h=y(e).toVar(),p=M(o).toVar(),f=T(rg(M(h.add(l),d.add(c)))).toVar(),m=M(f.x,f.y).toVar();m.subAssign(.5),m.mulAssign(u),m.addAssign(.5);const x=M(M(g(h),g(d)).add(m)).toVar(),N=M(x.sub(p)).toVar();return z(a.equal(y(2)),()=>oe(N.x).add(oe(N.y))),z(a.equal(y(3)),()=>ue(oe(N.x),oe(N.y))),is(N,N)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),zS=b(([o,e,t,s,n,r,i,a,u])=>{const c=y(u).toVar(),l=g(a).toVar(),d=y(i).toVar(),h=y(r).toVar(),p=y(n).toVar(),f=y(s).toVar(),m=y(t).toVar(),x=y(e).toVar(),N=T(o).toVar(),v=T(rg(T(x.add(p),m.add(h),f.add(d)))).toVar();v.subAssign(.5),v.mulAssign(l),v.addAssign(.5);const w=T(T(g(x),g(m),g(f)).add(v)).toVar(),B=T(w.sub(N)).toVar();return z(c.equal(y(2)),()=>oe(B.x).add(oe(B.y)).add(oe(B.z))),z(c.equal(y(3)),()=>ue(ue(oe(B.x),oe(B.y)),oe(B.z))),is(B,B)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),pn=Pe([kS,zS]),WS=b(([o,e,t])=>{const s=y(t).toVar(),n=g(e).toVar(),r=M(o).toVar(),i=y().toVar(),a=y().toVar(),u=M(he(r.x,i),he(r.y,a)).toVar(),c=g(1e6).toVar();return te({start:-1,end:y(1),name:"x",condition:"<="},({x:l})=>{te({start:-1,end:y(1),name:"y",condition:"<="},({y:d})=>{const h=g(pn(u,l,d,i,a,n,s)).toVar();c.assign(Re(c,h))})}),z(s.equal(y(0)),()=>{c.assign(Pt(c))}),c}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),$S=b(([o,e,t])=>{const s=y(t).toVar(),n=g(e).toVar(),r=M(o).toVar(),i=y().toVar(),a=y().toVar(),u=M(he(r.x,i),he(r.y,a)).toVar(),c=M(1e6,1e6).toVar();return te({start:-1,end:y(1),name:"x",condition:"<="},({x:l})=>{te({start:-1,end:y(1),name:"y",condition:"<="},({y:d})=>{const h=g(pn(u,l,d,i,a,n,s)).toVar();z(h.lessThan(c.x),()=>{c.y.assign(c.x),c.x.assign(h)}).ElseIf(h.lessThan(c.y),()=>{c.y.assign(h)})})}),z(s.equal(y(0)),()=>{c.assign(Pt(c))}),c}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),HS=b(([o,e,t])=>{const s=y(t).toVar(),n=g(e).toVar(),r=M(o).toVar(),i=y().toVar(),a=y().toVar(),u=M(he(r.x,i),he(r.y,a)).toVar(),c=T(1e6,1e6,1e6).toVar();return te({start:-1,end:y(1),name:"x",condition:"<="},({x:l})=>{te({start:-1,end:y(1),name:"y",condition:"<="},({y:d})=>{const h=g(pn(u,l,d,i,a,n,s)).toVar();z(h.lessThan(c.x),()=>{c.z.assign(c.y),c.y.assign(c.x),c.x.assign(h)}).ElseIf(h.lessThan(c.y),()=>{c.z.assign(c.y),c.y.assign(h)}).ElseIf(h.lessThan(c.z),()=>{c.z.assign(h)})})}),z(s.equal(y(0)),()=>{c.assign(Pt(c))}),c}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),qS=b(([o,e,t])=>{const s=y(t).toVar(),n=g(e).toVar(),r=T(o).toVar(),i=y().toVar(),a=y().toVar(),u=y().toVar(),c=T(he(r.x,i),he(r.y,a),he(r.z,u)).toVar(),l=g(1e6).toVar();return te({start:-1,end:y(1),name:"x",condition:"<="},({x:d})=>{te({start:-1,end:y(1),name:"y",condition:"<="},({y:h})=>{te({start:-1,end:y(1),name:"z",condition:"<="},({z:p})=>{const f=g(pn(c,d,h,p,i,a,u,n,s)).toVar();l.assign(Re(l,f))})})}),z(s.equal(y(0)),()=>{l.assign(Pt(l))}),l}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),KS=Pe([WS,qS]),XS=b(([o,e,t])=>{const s=y(t).toVar(),n=g(e).toVar(),r=T(o).toVar(),i=y().toVar(),a=y().toVar(),u=y().toVar(),c=T(he(r.x,i),he(r.y,a),he(r.z,u)).toVar(),l=M(1e6,1e6).toVar();return te({start:-1,end:y(1),name:"x",condition:"<="},({x:d})=>{te({start:-1,end:y(1),name:"y",condition:"<="},({y:h})=>{te({start:-1,end:y(1),name:"z",condition:"<="},({z:p})=>{const f=g(pn(c,d,h,p,i,a,u,n,s)).toVar();z(f.lessThan(l.x),()=>{l.y.assign(l.x),l.x.assign(f)}).ElseIf(f.lessThan(l.y),()=>{l.y.assign(f)})})})}),z(s.equal(y(0)),()=>{l.assign(Pt(l))}),l}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),YS=Pe([$S,XS]),jS=b(([o,e,t])=>{const s=y(t).toVar(),n=g(e).toVar(),r=T(o).toVar(),i=y().toVar(),a=y().toVar(),u=y().toVar(),c=T(he(r.x,i),he(r.y,a),he(r.z,u)).toVar(),l=T(1e6,1e6,1e6).toVar();return te({start:-1,end:y(1),name:"x",condition:"<="},({x:d})=>{te({start:-1,end:y(1),name:"y",condition:"<="},({y:h})=>{te({start:-1,end:y(1),name:"z",condition:"<="},({z:p})=>{const f=g(pn(c,d,h,p,i,a,u,n,s)).toVar();z(f.lessThan(l.x),()=>{l.z.assign(l.y),l.y.assign(l.x),l.x.assign(f)}).ElseIf(f.lessThan(l.y),()=>{l.z.assign(l.y),l.y.assign(f)}).ElseIf(f.lessThan(l.z),()=>{l.z.assign(f)})})})}),z(s.equal(y(0)),()=>{l.assign(Pt(l))}),l}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),QS=Pe([HS,jS]),ZS=b(([o])=>{const e=o.y,t=o.z,s=T().toVar();return z(e.lessThan(1e-4),()=>{s.assign(T(t,t,t))}).Else(()=>{let n=o.x;n=n.sub(At(n)).mul(6).toVar();const r=y(Ka(n)),i=n.sub(g(r)),a=t.mul(e.oneMinus()),u=t.mul(e.mul(i).oneMinus()),c=t.mul(e.mul(i.oneMinus()).oneMinus());z(r.equal(y(0)),()=>{s.assign(T(t,c,a))}).ElseIf(r.equal(y(1)),()=>{s.assign(T(u,t,a))}).ElseIf(r.equal(y(2)),()=>{s.assign(T(a,t,c))}).ElseIf(r.equal(y(3)),()=>{s.assign(T(a,u,t))}).ElseIf(r.equal(y(4)),()=>{s.assign(T(c,a,t))}).Else(()=>{s.assign(T(t,a,u))})}),s}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),JS=b(([o])=>{const e=T(o).toVar(),t=g(e.x).toVar(),s=g(e.y).toVar(),n=g(e.z).toVar(),r=g(Re(t,Re(s,n))).toVar(),i=g(ue(t,ue(s,n))).toVar(),a=g(i.sub(r)).toVar(),u=g().toVar(),c=g().toVar(),l=g().toVar();return l.assign(i),z(i.greaterThan(0),()=>{c.assign(a.div(i))}).Else(()=>{c.assign(0)}),z(c.lessThanEqual(0),()=>{u.assign(0)}).Else(()=>{z(t.greaterThanEqual(i),()=>{u.assign(s.sub(n).div(a))}).ElseIf(s.greaterThanEqual(i),()=>{u.assign(_e(2,n.sub(t).div(a)))}).Else(()=>{u.assign(_e(4,t.sub(s).div(a)))}),u.mulAssign(1/6),z(u.lessThan(0),()=>{u.addAssign(1)})}),T(u,c,l)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),ev=b(([o])=>{const e=T(o).toVar(),t=wa(Oa(e,T(.04045))).toVar(),s=T(e.div(12.92)).toVar(),n=T(ht(ue(e.add(T(.055)),T(0)).div(1.055),T(2.4))).toVar();return Q(s,n,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),og=(o,e)=>{o=g(o),e=g(e);const t=M(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return ct(o.sub(t),o.add(t),e)},ag=(o,e,t,s)=>Q(o,e,t[s].clamp()),tv=(o,e,t=le())=>ag(o,e,t,"x"),sv=(o,e,t=le())=>ag(o,e,t,"y"),ug=(o,e,t,s,n)=>Q(o,e,og(t,s[n])),nv=(o,e,t,s=le())=>ug(o,e,t,s,"x"),rv=(o,e,t,s=le())=>ug(o,e,t,s,"y"),iv=(o=1,e=0,t=le())=>t.mul(o).add(e),ov=(o,e=1)=>(o=g(o),o.abs().pow(e).mul(o.sign())),av=(o,e=1,t=.5)=>g(o).sub(t).mul(e).add(t),uv=(o=le(),e=1,t=0)=>Ou(o.convert("vec2|vec3")).mul(e).add(t),cv=(o=le(),e=1,t=0)=>ku(o.convert("vec2|vec3")).mul(e).add(t),lv=(o=le(),e=1,t=0)=>(o=o.convert("vec2|vec3"),P(ku(o),Ou(o.add(M(19,73)))).mul(e).add(t)),dv=(o=le(),e=1)=>KS(o.convert("vec2|vec3"),e,y(1)),hv=(o=le(),e=1)=>YS(o.convert("vec2|vec3"),e,y(1)),pv=(o=le(),e=1)=>QS(o.convert("vec2|vec3"),e,y(1)),fv=(o=le())=>PS(o.convert("vec2|vec3")),gv=(o=le(),e=3,t=2,s=.5,n=1)=>ri(o,y(e),t,s).mul(n),mv=(o=le(),e=3,t=2,s=.5,n=1)=>GS(o,y(e),t,s).mul(n),yv=(o=le(),e=3,t=2,s=.5,n=1)=>ig(o,y(e),t,s).mul(n),xv=(o=le(),e=3,t=2,s=.5,n=1)=>OS(o,y(e),t,s).mul(n),Tv=b(([o,e,t])=>{const s=qt(o).toVar("nDir"),n=Y(g(.5).mul(e.sub(t)),Wt).div(s).toVar("rbmax"),r=Y(g(-.5).mul(e.sub(t)),Wt).div(s).toVar("rbmin"),i=T().toVar("rbminmax");i.x=s.x.greaterThan(g(0)).select(n.x,r.x),i.y=s.y.greaterThan(g(0)).select(n.y,r.y),i.z=s.z.greaterThan(g(0)).select(n.z,r.z);const a=Re(Re(i.x,i.y),i.z).toVar("correction");return Wt.add(s.mul(a)).toVar("boxIntersection").sub(t)}),cg=b(([o,e])=>{const t=o.x,s=o.y,n=o.z;let r=e.element(0).mul(.886227);return r=r.add(e.element(1).mul(2*.511664).mul(s)),r=r.add(e.element(2).mul(2*.511664).mul(n)),r=r.add(e.element(3).mul(2*.511664).mul(t)),r=r.add(e.element(4).mul(2*.429043).mul(t).mul(s)),r=r.add(e.element(5).mul(2*.429043).mul(s).mul(n)),r=r.add(e.element(6).mul(n.mul(n).mul(.743125).sub(.247708))),r=r.add(e.element(7).mul(2*.429043).mul(t).mul(n)),r=r.add(e.element(8).mul(.429043).mul($(t,t).sub($(s,s)))),r});var mR=Object.freeze({__proto__:null,BRDF_GGX:jo,BRDF_Lambert:Ns,BasicShadowFilter:qf,Break:pu,Continue:Ex,DFGApprox:Nu,D_GGX:Xp,Discard:Fh,EPSILON:Gd,F_Schlick:un,Fn:b,INFINITY:Ny,If:z,Loop:te,NodeAccess:Ve,NodeShaderStage:Oo,NodeType:Zm,NodeUpdateType:W,PCFShadowFilter:Kf,PCFSoftShadowFilter:Xf,PI:Qr,PI2:Sy,Return:Vy,Schlick_to_F0:jp,ScriptableNodeResources:Wr,ShaderNode:Cn,TBNViewMatrix:gs,VSMShadowFilter:Yf,V_GGX_SmithCorrelated:Kp,abs:oe,acesFilmicToneMapping:Bf,acos:Hd,add:_e,addMethodChaining:R,addNodeElement:Oy,agxToneMapping:Ff,all:ka,alphaT:Xr,and:Ed,anisotropy:Zt,anisotropyB:_s,anisotropyT:En,any:Od,append:ud,arrayBuffer:yy,asin:$d,assign:bd,atan:$a,atan2:lh,atomicAdd:DN,atomicAnd:GN,atomicFunc:Yt,atomicMax:IN,atomicMin:VN,atomicOr:ON,atomicStore:PN,atomicSub:LN,atomicXor:kN,attenuationColor:Ia,attenuationDistance:La,attribute:we,attributeArray:Eb,backgroundBlurriness:Tf,backgroundIntensity:sa,backgroundRotation:_f,batch:Mp,billboarding:ab,bitAnd:Fd,bitNot:Ud,bitOr:Pd,bitXor:Dd,bitangentGeometry:lx,bitangentLocal:dx,bitangentView:Yh,bitangentWorld:hx,bitcast:vy,blendBurn:Sf,blendColor:Ob,blendDodge:vf,blendOverlay:Rf,blendScreen:Af,blur:sf,bool:Ht,buffer:ir,bufferAttribute:nr,bumpMap:Jh,burn:kb,bvec2:dd,bvec3:wa,bvec4:gd,bypass:Eh,cache:Mn,call:Nd,cameraFar:es,cameraNear:Jt,cameraNormalMatrix:qy,cameraPosition:su,cameraProjectionMatrix:He,cameraProjectionMatrixInverse:$y,cameraViewMatrix:je,cameraWorldMatrix:Hy,cbrt:ih,cdl:Yb,ceil:xi,checker:oS,cineonToneMapping:Mf,clamp:Et,clearcoat:Kr,clearcoatRoughness:zn,code:Fi,color:cd,colorSpaceToWorking:eu,colorToDirection:rT,compute:Ch,cond:dh,context:bi,convert:yd,convertColorSpace:wy,convertToTexture:_b,cos:It,cross:_i,cubeTexture:on,dFdx:Ha,dFdy:qa,dashSize:bs,defaultBuildStages:ko,defaultShaderStages:sd,defined:Gn,degrees:zd,deltaTime:gf,densityFog:xN,densityFogFactor:Mu,depth:xu,depthPass:tN,difference:th,diffuseColor:ee,directPointLight:Zf,directionToColor:Op,dispersion:Va,distance:eh,div:gt,dodge:zb,dot:is,drawIndex:Cp,dynamicBufferAttribute:Rh,element:md,emissive:Ho,equal:Sd,equals:Zd,equirectUV:Tu,exp:za,exp2:rn,expression:rs,faceDirection:rr,faceForward:Za,faceforward:Ay,float:g,floor:At,fog:Xn,fract:Xt,frameGroup:_d,frameId:Q_,frontFacing:Gh,fwidth:jd,gain:$_,gapSize:Hn,getConstNodeType:ad,getCurrentStack:Ea,getDirection:ef,getDistanceAttenuation:Gu,getGeometryRoughness:qp,getNormalFromDepth:Nb,getParallaxCorrectNormal:Tv,getRoughness:bu,getScreenPosition:bb,getShIrradianceAt:cg,getTextureIndex:pf,getViewPosition:ks,glsl:lN,glslFn:dN,grayscale:Hb,greaterThan:Oa,greaterThanEqual:Cd,hash:W_,highpModelNormalViewMatrix:sx,highpModelViewMatrix:tx,hue:Xb,instance:Sx,instanceIndex:lr,instancedArray:wb,instancedBufferAttribute:Zr,instancedDynamicBufferAttribute:qo,instancedMesh:wp,int:y,inverseSqrt:Wa,inversesqrt:Ry,invocationLocalIndex:Nx,invocationSubgroupIndex:bx,ior:wn,iridescence:mi,iridescenceIOR:Ua,iridescenceThickness:Pa,ivec2:Ae,ivec3:hd,ivec4:pd,js:uN,label:ph,length:zt,lengthSq:ja,lessThan:Ad,lessThanEqual:Rd,lightPosition:Uu,lightProjectionUV:Vf,lightShadowMatrix:Fu,lightTargetDirection:Pu,lightTargetPosition:Gf,lightViewPosition:Pi,lightingContext:Pp,lights:$N,linearDepth:ei,linearToneMapping:Ef,localId:vN,log:yi,log2:vt,logarithmicDepthToViewZ:zx,loop:wx,luminance:Eu,mat2:fi,mat3:Oe,mat4:Ts,matcapUV:of,materialAO:Ap,materialAlphaTest:ep,materialAnisotropy:fp,materialAnisotropyVector:Os,materialAttenuationColor:Np,materialAttenuationDistance:bp,materialClearcoat:up,materialClearcoatNormal:lp,materialClearcoatRoughness:cp,materialColor:an,materialDispersion:vp,materialEmissive:sp,materialIOR:_p,materialIridescence:gp,materialIridescenceIOR:mp,materialIridescenceThickness:yp,materialLightMap:du,materialLineDashOffset:lu,materialLineDashSize:uu,materialLineGapSize:cu,materialLineScale:au,materialLineWidth:Or,materialMetalness:op,materialNormal:ap,materialOpacity:cr,materialPointWidth:Sp,materialReference:dt,materialReflectivity:Gr,materialRefractionRatio:zh,materialRotation:dp,materialRoughness:ip,materialSheen:hp,materialSheenRoughness:pp,materialShininess:tp,materialSpecular:np,materialSpecularColor:rp,materialSpecularIntensity:Yo,materialSpecularStrength:Bn,materialThickness:Tp,materialTransmission:xp,max:ue,maxMipLevel:Ph,mediumpModelViewMatrix:Vh,metalness:kn,min:Re,mix:Q,mixElement:uh,mod:Xa,modInt:Ga,modelDirection:Qy,modelNormalMatrix:Lh,modelPosition:Zy,modelScale:Jy,modelViewMatrix:Kt,modelViewPosition:ex,modelViewProjection:hu,modelWorldMatrix:at,modelWorldMatrixInverse:Ih,morphReference:Up,mrt:ff,mul:$,mx_aastep:og,mx_cell_noise_float:fv,mx_contrast:av,mx_fractal_noise_float:gv,mx_fractal_noise_vec2:mv,mx_fractal_noise_vec3:yv,mx_fractal_noise_vec4:xv,mx_hsvtorgb:ZS,mx_noise_float:uv,mx_noise_vec3:cv,mx_noise_vec4:lv,mx_ramplr:tv,mx_ramptb:sv,mx_rgbtohsv:JS,mx_safepower:ov,mx_splitlr:nv,mx_splittb:rv,mx_srgb_texture_to_lin_rec709:ev,mx_transform_uv:iv,mx_worley_noise_float:dv,mx_worley_noise_vec2:hv,mx_worley_noise_vec3:pv,negate:qd,neutralToneMapping:Uf,nodeArray:xs,nodeImmutable:U,nodeObject:E,nodeObjects:Jn,nodeProxy:C,normalFlat:Oh,normalGeometry:Ni,normalLocal:Xe,normalMap:Xo,normalView:lt,normalWorld:Si,normalize:qt,not:Md,notEqual:vd,numWorkgroups:NN,objectDirection:Ky,objectGroup:Ba,objectPosition:Dh,objectScale:Yy,objectViewPosition:jy,objectWorldMatrix:Xy,oneMinus:Kd,or:wd,orthographicDepthToViewZ:kx,oscSawtooth:rb,oscSine:tb,oscSquare:sb,oscTriangle:nb,output:$n,outputStruct:k_,overlay:$b,overloadingFn:Pe,parabola:ta,parallaxDirection:Qh,parallaxUV:fx,parameter:G_,pass:Jb,passTexture:eN,pcurve:H_,perspectiveDepthToViewZ:mu,pmremTexture:vu,pointUV:Ub,pointWidth:Ty,positionGeometry:Ce,positionLocal:me,positionPrevious:Jr,positionView:xe,positionViewDirection:ae,positionWorld:Wt,positionWorldDirection:nu,posterize:Qb,pow:ht,pow2:Ya,pow3:sh,pow4:nh,property:Fa,radians:kd,rand:ah,range:_N,rangeFog:yN,rangeFogFactor:wu,reciprocal:Yd,reference:ne,referenceBuffer:Ko,reflect:Jd,reflectVector:Hh,reflectView:Wh,reflector:gb,refract:Qa,refractVector:qh,refractView:$h,reinhardToneMapping:wf,remainder:Vd,remap:Mh,remapClamp:Bh,renderGroup:k,renderOutput:tu,rendererReference:Sh,rotate:Au,rotateUV:ib,roughness:Nt,round:Xd,rtt:yf,sRGBTransferEOTF:yh,sRGBTransferOETF:xh,sampler:Wy,saturate:oh,saturation:qb,screen:Wb,screenCoordinate:dr,screenSize:Kn,screenUV:Bt,scriptable:mN,scriptableValue:zr,select:Ue,setCurrentStack:On,shaderStages:zo,shadow:Qf,shadowPositionWorld:Lu,sharedUniformGroup:Ma,sheen:fs,sheenRoughness:gi,shiftLeft:Ld,shiftRight:Id,shininess:Yr,sign:qn,sin:st,sinc:q_,skinning:Rx,skinningReference:Fp,smoothstep:ct,smoothstepElement:ch,specularColor:We,specularF90:Wn,spherizeUV:ob,split:xy,spritesheetUV:lb,sqrt:Pt,stack:kr,step:Ti,storage:Bi,storageBarrier:EN,storageObject:Cb,storageTexture:bf,string:my,sub:Y,subgroupIndex:_x,subgroupSize:AN,tan:Wd,tangentGeometry:Ri,tangentLocal:or,tangentView:ar,tangentWorld:Xh,temp:gh,texture:K,texture3D:af,textureBarrier:wN,textureBicubic:Jp,textureCubeUV:tf,textureLoad:ge,textureSize:ns,textureStore:Db,thickness:Da,time:Cs,timerDelta:eb,timerGlobal:J_,timerLocal:Z_,toOutputColorSpace:Th,toWorkingColorSpace:_h,toneMapping:vh,toneMappingExposure:Ah,toonOutlinePass:nN,transformDirection:rh,transformNormal:kh,transformNormalToView:ru,transformedBentNormalView:Zh,transformedBitangentView:jh,transformedBitangentWorld:px,transformedClearcoatNormalView:Hs,transformedNormalView:fe,transformedNormalWorld:vi,transformedTangentView:ou,transformedTangentWorld:cx,transmission:jr,transpose:Qd,triNoise3D:X_,triplanarTexture:hb,triplanarTextures:mf,trunc:Ka,tslFn:gy,uint:D,uniform:V,uniformArray:Gt,uniformGroup:Td,uniforms:ox,userData:Ib,uv:le,uvec2:ld,uvec3:dn,uvec4:fd,varying:ke,varyingProperty:et,vec2:M,vec3:T,vec4:P,vectorComponents:As,velocity:Gb,vertexColor:Bb,vertexIndex:Rp,vertexStage:mh,vibrance:Kb,viewZToLogarithmicDepth:yu,viewZToOrthographicDepth:Qs,viewZToPerspectiveDepth:Ip,viewport:$t,viewportBottomLeft:Vx,viewportCoordinate:Lp,viewportDepthTexture:gu,viewportLinearDepth:Wx,viewportMipTexture:fu,viewportResolution:Lx,viewportSafeUV:ub,viewportSharedTexture:Gp,viewportSize:Dp,viewportTexture:Gx,viewportTopLeft:Ix,viewportUV:Dx,wgsl:cN,wgslFn:hN,workgroupArray:FN,workgroupBarrier:CN,workgroupId:SN,workingToColorSpace:bh,xor:Bd});const Lt=new Ru;class _v extends os{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,s){const n=this.renderer,r=this.nodes.getBackgroundNode(e)||e.background;let i=!1;if(r===null)n._clearColor.getRGB(Lt,kt),Lt.a=n._clearColor.a;else if(r.isColor===!0)r.getRGB(Lt,kt),Lt.a=1,i=!0;else if(r.isNode===!0){const a=this.get(e),u=r;Lt.copy(n._clearColor);let c=a.backgroundMesh;if(c===void 0){const d=bi(P(u).mul(sa),{getUV:()=>_f.mul(Si),getTextureLevel:()=>Tf});let h=hu;h=h.setZ(h.w);const p=new ce;p.name="Background.material",p.side=Ct,p.depthTest=!1,p.depthWrite=!1,p.fog=!1,p.lights=!1,p.vertexNode=h,p.colorNode=d,a.backgroundMeshNode=d,a.backgroundMesh=c=new tn(new mm(1,32,32),p),c.frustumCulled=!1,c.name="Background.mesh",c.onBeforeRender=function(f,m,x){this.matrixWorld.copyPosition(x.matrixWorld)}}const l=u.getCacheKey();a.backgroundCacheKey!==l&&(a.backgroundMeshNode.node=P(u).mul(sa),a.backgroundMeshNode.needsUpdate=!0,c.material.needsUpdate=!0,a.backgroundCacheKey=l),t.unshift(c,c.geometry,c.material,0,0,null,null)}else console.error("THREE.Renderer: Unsupported background configuration.",r);if(n.autoClear===!0||i===!0){const a=s.clearColorValue;a.r=Lt.r,a.g=Lt.g,a.b=Lt.b,a.a=Lt.a,(n.backend.isWebGLBackend===!0||n.alpha===!0)&&(a.r*=a.a,a.g*=a.a,a.b*=a.a),s.depthClearValue=n._clearDepth,s.stencilClearValue=n._clearStencil,s.clearColor=n.autoClearColor===!0,s.clearDepth=n.autoClearDepth===!0,s.clearStencil=n.autoClearStencil===!0}else s.clearColor=!1,s.clearDepth=!1,s.clearStencil=!1}}let bv=0;class na{constructor(e="",t=[],s=0,n=[]){this.name=e,this.bindings=t,this.index=s,this.bindingsReference=n,this.id=bv++}}class Nv{constructor(e,t,s,n,r,i,a,u,c,l=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=s,this.transforms=l,this.nodeAttributes=n,this.bindings=r,this.updateNodes=i,this.updateBeforeNodes=a,this.updateAfterNodes=u,this.monitor=c,this.usedTimes=0}createBindings(){const e=[];for(const t of this.bindings)if(t.bindings[0].groupNode.shared!==!0){const n=new na(t.name,[],t.index,t);e.push(n);for(const r of t.bindings)n.bindings.push(r.clone())}else e.push(t);return e}}class Gc{constructor(e,t,s=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=s}}class Sv{constructor(e,t,s){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=s.getSelf()}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}}class lg{constructor(e,t){this.isNodeVar=!0,this.name=e,this.type=t}}class vv extends lg{constructor(e,t){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0}}class Av{constructor(e,t,s=""){this.name=e,this.type=t,this.code=s,Object.defineProperty(this,"isNodeCode",{value:!0})}}let Rv=0;class to{constructor(e=null){this.id=Rv++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return t===void 0&&this.parent!==null&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}}class Cv extends O{static get type(){return"StructTypeNode"}constructor(e,t){super(),this.name=e,this.types=t,this.isStructTypeNode=!0}getMemberTypes(){return this.types}}class ws{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0}setValue(e){this.value=e}getValue(){return this.value}}class Ev extends ws{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}}class wv extends ws{constructor(e,t=new Ye){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}}class Mv extends ws{constructor(e,t=new j){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}}class Bv extends ws{constructor(e,t=new Me){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}}class Fv extends ws{constructor(e,t=new mt){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}}class Uv extends ws{constructor(e,t=new Yn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}}class Pv extends ws{constructor(e,t=new Ie){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}}class Dv extends Ev{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Lv extends wv{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Iv extends Mv{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Vv extends Bv{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Gv extends Fv{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Ov extends Uv{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class kv extends Pv{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}const qs=4,Oc=[.125,.215,.35,.446,.526,.582],hs=20,so=new Tl(-1,1,1,-1,0,1),zv=new kg(90,1),kc=new mt;let no=null,ro=0,io=0;const ds=(1+Math.sqrt(5))/2,Ds=1/ds,zc=[new j(-ds,Ds,0),new j(ds,Ds,0),new j(-Ds,0,ds),new j(Ds,0,ds),new j(0,ds,-Ds),new j(0,ds,Ds),new j(-1,1,-1),new j(1,1,-1),new j(-1,1,1),new j(1,1,1)],Wv=[3,1,5,0,4,2],oo=ef(le(),we("faceIndex")).normalize(),zu=T(oo.x,oo.y,oo.z);class $v{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,s=.1,n=100,r=null){if(this._setSize(256),this._hasInitialized===!1){console.warn("THREE.PMREMGenerator: .fromScene() called before the backend is initialized. Try using .fromSceneAsync() instead.");const a=r||this._allocateTargets();return this.fromSceneAsync(e,t,s,n,a),a}no=this._renderer.getRenderTarget(),ro=this._renderer.getActiveCubeFace(),io=this._renderer.getActiveMipmapLevel();const i=r||this._allocateTargets();return i.depthBuffer=!0,this._sceneToCubeUV(e,s,n,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i}async fromSceneAsync(e,t=0,s=.1,n=100,r=null){return this._hasInitialized===!1&&await this._renderer.init(),this.fromScene(e,t,s,n,r)}fromEquirectangular(e,t=null){if(this._hasInitialized===!1){console.warn("THREE.PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Try using .fromEquirectangularAsync() instead."),this._setSizeFromTexture(e);const s=t||this._allocateTargets();return this.fromEquirectangularAsync(e,s),s}return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return this._hasInitialized===!1&&await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(this._hasInitialized===!1){console.warn("THREE.PMREMGenerator: .fromCubemap() called before the backend is initialized. Try using .fromCubemapAsync() instead."),this._setSizeFromTexture(e);const s=t||this._allocateTargets();return this.fromCubemapAsync(e,t),s}return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return this._hasInitialized===!1&&await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=$c(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Hc(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===Zs||e.mapping===Js?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?m:0,m,m),u.render(e,r)}u.autoClear=c,e.background=h}_textureToCubeUV(e,t){const s=this._renderer,n=e.mapping===Zs||e.mapping===Js;n?this._cubemapMaterial===null&&(this._cubemapMaterial=$c(e)):this._equirectMaterial===null&&(this._equirectMaterial=Hc(e));const r=n?this._cubemapMaterial:this._equirectMaterial;r.fragmentNode.value=e;const i=this._lodMeshes[0];i.material=r;const a=this._cubeSize;vr(t,0,0,3*a,2*a),s.setRenderTarget(t),s.render(i,so)}_applyPMREM(e){const t=this._renderer,s=t.autoClear;t.autoClear=!1;const n=this._lodPlanes.length;for(let r=1;rhs&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${hs}`);const N=[];let v=0;for(let I=0;Iw-qs?n-w+qs:0),L=4*(this._cubeSize-B);vr(t,F,L,3*B,2*B),u.setRenderTarget(t),u.render(d,so)}}function Hv(o){const e=[],t=[],s=[],n=[];let r=o;const i=o-qs+1+Oc.length;for(let a=0;ao-qs?c=Oc[a-o+qs-1]:a===0&&(c=0),s.push(c);const l=1/(u-2),d=-l,h=1+l,p=[d,d,h,d,h,h,d,d,h,h,d,h],f=6,m=6,x=3,N=2,v=1,w=new Float32Array(x*m*f),B=new Float32Array(N*m*f),F=new Float32Array(v*m*f);for(let I=0;I2?0:-1,ie=[G,X,0,G+2/3,X,0,G+2/3,X+1,0,G,X,0,G+2/3,X+1,0,G,X+1,0],Z=Wv[I];w.set(ie,x*m*Z),B.set(p,N*m*Z);const Qe=[Z,Z,Z,Z,Z,Z];F.set(Qe,v*m*Z)}const L=new Sl;L.setAttribute("position",new Ur(w,x)),L.setAttribute("uv",new Ur(B,N)),L.setAttribute("faceIndex",new Ur(F,v)),e.push(L),n.push(new tn(L,null)),r>qs&&r--}return{lodPlanes:e,sizeLods:t,sigmas:s,lodMeshes:n}}function Wc(o,e,t){const s=new Ss(o,e,t);return s.texture.mapping=bo,s.texture.name="PMREM.cubeUv",s.texture.isPMREMTexture=!0,s.scissorTest=!0,s}function vr(o,e,t,s,n){o.viewport.set(e,t,s,n),o.scissor.set(e,t,s,n)}function Wu(o){const e=new ce;return e.depthTest=!1,e.depthWrite=!1,e.blending=en,e.name=`PMREM_${o}`,e}function qv(o,e,t){const s=Gt(new Array(hs).fill(0)),n=V(new j(0,1,0)),r=V(0),i=g(hs),a=V(0),u=V(1),c=K(null),l=V(0),d=g(1/e),h=g(1/t),p=g(o),f={n:i,latitudinal:a,weights:s,poleAxis:n,outputDirection:zu,dTheta:r,samples:u,envMap:c,mipInt:l,CUBEUV_TEXEL_WIDTH:d,CUBEUV_TEXEL_HEIGHT:h,CUBEUV_MAX_MIP:p},m=Wu("blur");return m.uniforms=f,m.fragmentNode=sf({...f,latitudinal:a.equal(1)}),m}function $c(o){const e=Wu("cubemap");return e.fragmentNode=on(o,zu),e}function Hc(o){const e=Wu("equirect");return e.fragmentNode=K(o,Tu(zu),0),e}const qc=new WeakMap,Kv=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),Ar=o=>/e/g.test(o)?String(o).replace(/\+/g,""):(o=Number(o),o+(o%1?"":".0"));class dg{constructor(e,t,s){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=s,this.scene=null,this.camera=null,this.nodes=[],this.sequentialNodes=[],this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.monitor=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.flow={code:""},this.chaining=[],this.stack=kr(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new to,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.useComparisonMethod=!1}getBindGroupsCache(){let e=qc.get(this.renderer);return e===void 0&&(e=new Ft,qc.set(this.renderer,e)),e}createRenderTarget(e,t,s){return new Ss(e,t,s)}createCubeRenderTarget(e,t){return new kp(e,t)}createPMREMGenerator(){return new $v(this.renderer)}includes(e){return this.nodes.includes(e)}_getBindGroup(e,t){const s=this.getBindGroupsCache(),n=[];let r=!0;for(const a of t)n.push(a),r=r&&a.groupNode.shared!==!0;let i;return r?(i=s.get(n),i===void 0&&(i=new na(e,n,this.bindingsIndexes[e].group,n),s.set(n,i))):i=new na(e,n,this.bindingsIndexes[e].group,n),i}getBindGroupArray(e,t){const s=this.bindings[t];let n=s[e];return n===void 0&&(this.bindingsIndexes[e]===void 0&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),s[e]=n=[]),n}getBindings(){let e=this.bindGroups;if(e===null){const t={},s=this.bindings;for(const n of zo)for(const r in s[n]){const i=s[n][r];(t[r]||(t[r]=[])).push(...i)}e=[];for(const n in t){const r=t[n],i=this._getBindGroup(n,r);e.push(i)}this.bindGroups=e}return e}sortBindingGroups(){const e=this.getBindings();e.sort((t,s)=>t.bindings[0].groupNode.order-s.bindings[0].groupNode.order);for(let t=0;t=0?`${Math.round(t)}u`:"0u";if(e==="bool")return t?"true":"false";if(e==="color")return`${this.getType("vec3")}( ${Ar(t.r)}, ${Ar(t.g)}, ${Ar(t.b)} )`;const s=this.getTypeLength(e),n=this.getComponentType(e),r=i=>this.generateConst(n,i);if(s===2)return`${this.getType(e)}( ${r(t.x)}, ${r(t.y)} )`;if(s===3)return`${this.getType(e)}( ${r(t.x)}, ${r(t.y)}, ${r(t.z)} )`;if(s===4)return`${this.getType(e)}( ${r(t.x)}, ${r(t.y)}, ${r(t.z)}, ${r(t.w)} )`;if(s>4&&t&&(t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(r).join(", ")} )`;if(s>4)return`${this.getType(e)}()`;throw new Error(`NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return e==="color"?"vec3":e}hasGeometryAttribute(e){return this.geometry&&this.geometry.getAttribute(e)!==void 0}getAttribute(e,t){const s=this.attributes;for(const r of s)if(r.name===e)return r;const n=new Gc(e,t);return s.push(n),n}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return e==="void"||e==="property"||e==="sampler"||e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="depthTexture"||e==="texture3D"}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){const t=e.type;if(e.isDataTexture){if(t===ze)return"int";if(t===Le)return"uint"}return"float"}getElementType(e){return e==="mat2"?"vec2":e==="mat3"?"vec3":e==="mat4"?"vec4":this.getComponentType(e)}getComponentType(e){if(e=this.getVectorType(e),e==="float"||e==="bool"||e==="int"||e==="uint")return e;const t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return t===null?null:t[1]==="b"?"bool":t[1]==="i"?"int":t[1]==="u"?"uint":"float"}getVectorType(e){return e==="color"?"vec3":e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="texture3D"?"vec4":e}getTypeFromLength(e,t="float"){if(e===1)return t;const s=ya(e);return(t==="float"?"":t[0])+s}getTypeFromArray(e){return Kv.get(e.constructor)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);const s=t.array,n=e.itemSize,r=e.normalized;let i;return!(e instanceof yl)&&r!==!0&&(i=this.getTypeFromArray(s)),this.getTypeFromLength(n,i)}getTypeLength(e){const t=this.getVectorType(e),s=/vec([2-4])/.exec(t);return s!==null?Number(s[1]):t==="float"||t==="bool"||t==="int"||t==="uint"?1:/mat2/.test(e)===!0?4:/mat3/.test(e)===!0?9:/mat4/.test(e)===!0?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){const t=this.getComponentType(e);return t==="int"||t==="uint"?e:this.changeComponentType(e,"int")}addStack(){return this.stack=kr(this.stack),this.stacks.push(Ea()||this.stack),On(this.stack),this.stack}removeStack(){const e=this.stack;return this.stack=e.parent,On(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,s=null){s=s===null?e.isGlobal(this)?this.globalCache:this.cache:s;let n=s.getData(e);return n===void 0&&(n={},s.setData(e,n)),n[t]===void 0&&(n[t]={}),n[t]}getNodeProperties(e,t="any"){const s=this.getDataFromNode(e,t);return s.properties||(s.properties={outputNode:null})}getBufferAttributeFromNode(e,t){const s=this.getDataFromNode(e);let n=s.bufferAttribute;if(n===void 0){const r=this.uniforms.index++;n=new Gc("nodeAttribute"+r,t,e),this.bufferAttributes.push(n),s.bufferAttribute=n}return n}getStructTypeFromNode(e,t,s=this.shaderStage){const n=this.getDataFromNode(e,s);let r=n.structType;if(r===void 0){const i=this.structs.index++;r=new Cv("StructType"+i,t),this.structs[s].push(r),n.structType=r}return r}getUniformFromNode(e,t,s=this.shaderStage,n=null){const r=this.getDataFromNode(e,s,this.globalCache);let i=r.uniform;if(i===void 0){const a=this.uniforms.index++;i=new Sv(n||"nodeUniform"+a,t,e),this.uniforms[s].push(i),r.uniform=i}return i}getVarFromNode(e,t=null,s=e.getNodeType(this),n=this.shaderStage){const r=this.getDataFromNode(e,n);let i=r.variable;if(i===void 0){const a=this.vars[n]||(this.vars[n]=[]);t===null&&(t="nodeVar"+a.length),i=new lg(t,s),a.push(i),r.variable=i}return i}getVaryingFromNode(e,t=null,s=e.getNodeType(this)){const n=this.getDataFromNode(e,"any");let r=n.varying;if(r===void 0){const i=this.varyings,a=i.length;t===null&&(t="nodeVarying"+a),r=new vv(t,s),i.push(r),n.varying=r}return r}getCodeFromNode(e,t,s=this.shaderStage){const n=this.getDataFromNode(e);let r=n.code;if(r===void 0){const i=this.codes[s]||(this.codes[s]=[]),a=i.length;r=new Av("nodeCode"+a,t),i.push(r),n.code=r}return r}addFlowCodeHierarchy(e,t){const{flowCodes:s,flowCodeBlock:n}=this.getDataFromNode(e);let r=!0,i=t;for(;i;){if(n.get(i)===!0){r=!1;break}i=this.getDataFromNode(i).parentNodeBlock}if(r)for(const a of s)this.addLineFlowCode(a)}addLineFlowCodeBlock(e,t,s){const n=this.getDataFromNode(e),r=n.flowCodes||(n.flowCodes=[]),i=n.flowCodeBlock||(n.flowCodeBlock=new WeakMap);r.push(t),i.set(s,!0)}addLineFlowCode(e,t=null){return e===""?this:(t!==null&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e=e+`; -`),this.flow.code+=e,this)}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+=" ",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){const t=e.getNodeType(this),s=this.flowChildNode(e,t);return this.flowsData.set(e,s),s}buildFunctionNode(e){const t=new Pf,s=this.currentFunctionNode;return this.currentFunctionNode=t,t.code=this.buildFunctionCode(e),this.currentFunctionNode=s,t}flowShaderNode(e){const t=e.layout,s={[Symbol.iterator](){let i=0;const a=Object.values(this);return{next:()=>({value:a[i],done:i++>=a.length})}}};for(const i of t.inputs)s[i.name]=new df(i.type,i.name);e.layout=null;const n=e.call(s),r=this.flowStagesNode(n,t.type);return e.layout=t,r}flowStagesNode(e,t=null){const s=this.flow,n=this.vars,r=this.cache,i=this.buildStage,a=this.stack,u={code:""};this.flow=u,this.vars={},this.cache=new to,this.stack=kr();for(const c of ko)this.setBuildStage(c),u.result=e.build(this,t);return u.vars=this.getVars(this.shaderStage),this.flow=s,this.vars=n,this.cache=r,this.stack=a,this.setBuildStage(i),u}getFunctionOperator(){return null}flowChildNode(e,t=null){const s=this.flow,n={code:""};return this.flow=n,n.result=e.build(this,t),this.flow=s,n}flowNodeFromShaderStage(e,t,s=null,n=null){const r=this.shaderStage;this.setShaderStage(e);const i=this.flowChildNode(t,s);return n!==null&&(i.code+=`${this.tab+n} = ${i.result}; -`),this.flowCode[e]=this.flowCode[e]+i.code,this.setShaderStage(r),i}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){console.warn("Abstract function.")}getVaryings(){console.warn("Abstract function.")}getVar(e,t){return`${this.getType(e)} ${t}`}getVars(e){let t="";const s=this.vars[e];if(s!==void 0)for(const n of s)t+=`${this.getVar(n.type,n.name)}; `;return t}getUniforms(){console.warn("Abstract function.")}getCodes(e){const t=this.codes[e];let s="";if(t!==void 0)for(const n of t)s+=n.code+` -`;return s}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){console.warn("Abstract function.")}build(){const{object:e,material:t,renderer:s}=this;if(t!==null){let n=s.library.fromMaterial(t);n===null&&(console.error(`NodeMaterial: Material "${t.type}" is not compatible.`),n=new ce),n.build(this)}else this.addFlow("compute",e);for(const n of ko){this.setBuildStage(n),this.context.vertex&&this.context.vertex.isNode&&this.flowNodeFromShaderStage("vertex",this.context.vertex);for(const r of zo){this.setShaderStage(r);const i=this.flowNodes[r];for(const a of i)n==="generate"?this.flowNode(a):a.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getNodeUniform(e,t){if(t==="float"||t==="int"||t==="uint")return new Dv(e);if(t==="vec2"||t==="ivec2"||t==="uvec2")return new Lv(e);if(t==="vec3"||t==="ivec3"||t==="uvec3")return new Iv(e);if(t==="vec4"||t==="ivec4"||t==="uvec4")return new Vv(e);if(t==="color")return new Gv(e);if(t==="mat3")return new Ov(e);if(t==="mat4")return new kv(e);throw new Error(`Uniform "${t}" not declared.`)}format(e,t,s){if(t=this.getVectorType(t),s=this.getVectorType(s),t===s||s===null||this.isReference(s))return e;const n=this.getTypeLength(t),r=this.getTypeLength(s);return n===16&&r===9?`${this.getType(s)}(${e}[0].xyz, ${e}[1].xyz, ${e}[2].xyz)`:n===9&&r===4?`${this.getType(s)}(${e}[0].xy, ${e}[1].xy)`:n>4||r>4||r===0?e:n===r?`${this.getType(s)}( ${e} )`:n>r?this.format(`${e}.${"xyz".slice(0,r)}`,this.getTypeFromLength(r,this.getComponentType(t)),s):r===4&&n>1?`${this.getType(s)}( ${this.format(e,t,"vec3")}, 1.0 )`:n===2?`${this.getType(s)}( ${this.format(e,t,"vec2")}, 0.0 )`:(n===1&&r>1&&t!==this.getComponentType(s)&&(e=`${this.getType(this.getComponentType(s))}( ${e} )`),`${this.getType(s)}( ${e} )`)}getSignature(){return`// Three.js r${xl} - Node System -`}createNodeMaterial(e="NodeMaterial"){throw new Error(`THREE.NodeBuilder: createNodeMaterial() was deprecated. Use new ${e}() instead.`)}}class Kc{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let s=e.get(t);return s===void 0&&(s={renderMap:new WeakMap,frameMap:new WeakMap},e.set(t,s)),s}updateBeforeNode(e){const t=e.getUpdateBeforeType(),s=e.updateReference(this);if(t===W.FRAME){const{frameMap:n}=this._getMaps(this.updateBeforeMap,s);n.get(s)!==this.frameId&&e.updateBefore(this)!==!1&&n.set(s,this.frameId)}else if(t===W.RENDER){const{renderMap:n}=this._getMaps(this.updateBeforeMap,s);n.get(s)!==this.renderId&&e.updateBefore(this)!==!1&&n.set(s,this.renderId)}else t===W.OBJECT&&e.updateBefore(this)}updateAfterNode(e){const t=e.getUpdateAfterType(),s=e.updateReference(this);if(t===W.FRAME){const{frameMap:n}=this._getMaps(this.updateAfterMap,s);n.get(s)!==this.frameId&&e.updateAfter(this)!==!1&&n.set(s,this.frameId)}else if(t===W.RENDER){const{renderMap:n}=this._getMaps(this.updateAfterMap,s);n.get(s)!==this.renderId&&e.updateAfter(this)!==!1&&n.set(s,this.renderId)}else t===W.OBJECT&&e.updateAfter(this)}updateNode(e){const t=e.getUpdateType(),s=e.updateReference(this);if(t===W.FRAME){const{frameMap:n}=this._getMaps(this.updateMap,s);n.get(s)!==this.frameId&&e.update(this)!==!1&&n.set(s,this.frameId)}else if(t===W.RENDER){const{renderMap:n}=this._getMaps(this.updateMap,s);n.get(s)!==this.renderId&&e.update(this)!==!1&&n.set(s,this.renderId)}else t===W.OBJECT&&e.update(this)}update(){this.frameId++,this.lastTime===void 0&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}}class $u{constructor(e,t,s=null,n="",r=!1){this.type=e,this.name=t,this.count=s,this.qualifier=n,this.isConst=r}}$u.isNodeFunctionInput=!0;class Xv extends Es{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setup(e){super.setup(e);const t=e.context.lightingModel,s=this.colorNode,n=Pu(this.light),r=e.context.reflectedLight;t.direct({lightDirection:n,lightColor:s,reflectedLight:r},e.stack,e)}}const ao=new Ie,Rr=new Ie;let Nn=null;class Yv extends Es{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=V(new j).setGroup(k),this.halfWidth=V(new j).setGroup(k),this.updateType=W.RENDER}update(e){super.update(e);const{light:t}=this,s=e.camera.matrixWorldInverse;Rr.identity(),ao.copy(t.matrixWorld),ao.premultiply(s),Rr.extractRotation(ao),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(Rr),this.halfHeight.value.applyMatrix4(Rr)}setup(e){super.setup(e);let t,s;e.isAvailable("float32Filterable")?(t=K(Nn.LTC_FLOAT_1),s=K(Nn.LTC_FLOAT_2)):(t=K(Nn.LTC_HALF_1),s=K(Nn.LTC_HALF_2));const{colorNode:n,light:r}=this,i=e.context.lightingModel,a=Pi(r),u=e.context.reflectedLight;i.directRectArea({lightColor:n,lightPosition:a,halfWidth:this.halfWidth,halfHeight:this.halfHeight,reflectedLight:u,ltc_1:t,ltc_2:s},e.stack,e)}static setLTC(e){Nn=e}}class hg extends Es{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=V(0).setGroup(k),this.penumbraCosNode=V(0).setGroup(k),this.cutoffDistanceNode=V(0).setGroup(k),this.decayExponentNode=V(0).setGroup(k)}update(e){super.update(e);const{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e){const{coneCosNode:t,penumbraCosNode:s}=this;return ct(t,s,e)}setup(e){super.setup(e);const t=e.context.lightingModel,{colorNode:s,cutoffDistanceNode:n,decayExponentNode:r,light:i}=this,a=Pi(i).sub(xe),u=a.normalize(),c=u.dot(Pu(i)),l=this.getSpotAttenuation(c),d=a.length(),h=Gu({lightDistance:d,cutoffDistance:n,decayExponent:r});let p=s.mul(l).mul(h);if(i.map){const m=Vf(i),x=K(i.map,m.xy).onRenderUpdate(()=>i.map);p=m.mul(2).sub(1).abs().lessThan(1).all().select(p.mul(x),p)}const f=e.context.reflectedLight;t.direct({lightDirection:u,lightColor:p,reflectedLight:f},e.stack,e)}}class jv extends hg{static get type(){return"IESSpotLightNode"}getSpotAttenuation(e){const t=this.light.iesMap;let s=null;if(t&&t.isTexture===!0){const n=e.acos().mul(1/Math.PI);s=K(t,M(n,0),0).r}else s=super.getSpotAttenuation(e);return s}}class Qv extends Es{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class Zv extends Es{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=Uu(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=V(new mt).setGroup(k)}update(e){const{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){const{colorNode:t,groundColorNode:s,lightDirectionNode:n}=this,i=lt.dot(n).mul(.5).add(.5),a=Q(s,t,i);e.context.irradiance.addAssign(a)}}class Jv extends Es{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let s=0;s<9;s++)t.push(new j);this.lightProbe=Gt(t)}update(e){const{light:t}=this;super.update(e);for(let s=0;s<9;s++)this.lightProbe.array[s].copy(t.sh.coefficients[s]).multiplyScalar(t.intensity)}setup(e){const t=cg(Si,this.lightProbe);e.context.irradiance.addAssign(t)}}class pg{parseFunction(){console.warn("Abstract function.")}}class Hu{constructor(e,t,s="",n=""){this.type=e,this.inputs=t,this.name=s,this.precision=n}getCode(){console.warn("Abstract function.")}}Hu.isNodeFunction=!0;const eA=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,tA=/[a-z_0-9]+/ig,Xc="#pragma main",sA=o=>{o=o.trim();const e=o.indexOf(Xc),t=e!==-1?o.slice(e+Xc.length):o,s=t.match(eA);if(s!==null&&s.length===5){const n=s[4],r=[];let i=null;for(;(i=tA.exec(n))!==null;)r.push(i);const a=[];let u=0;for(;u0||e.backgroundBlurriness>0&&t.backgroundBlurriness===0;if(t.background!==s||n){const r=this.getCacheNode("background",s,()=>{if(s.isCubeTexture===!0||s.mapping===jn||s.mapping===Qn||s.mapping===bo){if(e.backgroundBlurriness>0||s.mapping===bo)return vu(s);{let i;return s.isCubeTexture===!0?i=on(s):i=K(s),Wp(i)}}else{if(s.isTexture===!0)return K(s,Bt.flipY()).setUpdateMatrix(!0);s.isColor!==!0&&console.error("WebGPUNodes: Unsupported background configuration.",s)}},n);t.backgroundNode=r,t.background=s,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,s,n=!1){const r=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap);let i=r.get(t);return(i===void 0||n)&&(i=s(),r.set(t,i)),i}updateFog(e){const t=this.get(e),s=e.fog;if(s){if(t.fog!==s){const n=this.getCacheNode("fog",s,()=>{if(s.isFogExp2){const r=ne("color","color",s).setGroup(k),i=ne("density","float",s).setGroup(k);return Xn(r,Mu(i))}else if(s.isFog){const r=ne("color","color",s).setGroup(k),i=ne("near","float",s).setGroup(k),a=ne("far","float",s).setGroup(k);return Xn(r,wu(i,a))}else console.error("THREE.Renderer: Unsupported fog configuration.",s)});t.fogNode=n,t.fog=s}}else delete t.fogNode,delete t.fog}updateEnvironment(e){const t=this.get(e),s=e.environment;if(s){if(t.environment!==s){const n=this.getCacheNode("environment",s,()=>{if(s.isCubeTexture===!0)return on(s);if(s.isTexture===!0)return K(s);console.error("Nodes: Unsupported environment configuration.",s)});t.environmentNode=n,t.environment=s}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,s=null,n=null,r=null){const i=this.nodeFrame;return i.renderer=e,i.scene=t,i.object=s,i.camera=n,i.material=r,i}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){const e=this.renderer;return e.toneMapping+","+e.currentColorSpace}hasOutputChange(e){return Yc.get(e)!==this.getOutputCacheKey()}getOutputNode(e){const t=this.renderer,s=this.getOutputCacheKey(),n=K(e,Bt).renderOutput(t.toneMapping,t.currentColorSpace);return Yc.set(e,s),n}updateBefore(e){const t=e.getNodeBuilderState();for(const s of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(s)}updateAfter(e){const t=e.getNodeBuilderState();for(const s of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(s)}updateForCompute(e){const t=this.getNodeFrame(),s=this.getForCompute(e);for(const n of s.updateNodes)t.updateNode(n)}updateForRender(e){const t=this.getNodeFrameForRender(e),s=e.getNodeBuilderState();for(const n of s.updateNodes)t.updateNode(n)}needsRefresh(e){const t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new Kc,this.nodeBuilderCache=new Map,this.cacheLib={}}}const uo=new vl;class ii{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewNormalMatrix=new Yn,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,e!==null&&(this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass,this.viewMatrix=e.viewMatrix)}projectPlanes(e,t,s){const n=e.length;for(let r=0;r{await this.compileAsync(d,h);const f=this._renderLists.get(d,h),m=this._renderContexts.get(d,h,this._renderTarget),x=d.overrideMaterial||p.material,N=this._objects.get(p,x,d,h,f.lightsNode,m,m.clippingContext),{fragmentShader:v,vertexShader:w}=N.getNodeBuilderState();return{fragmentShader:v,vertexShader:w}}}}async init(){if(this._initialized)throw new Error("Renderer: Backend has already been initialized.");return this._initPromise!==null?this._initPromise:(this._initPromise=new Promise(async(e,t)=>{let s=this.backend;try{await s.init(this)}catch(n){if(this._getFallback!==null)try{this.backend=s=this._getFallback(n),await s.init(this)}catch(r){t(r);return}else{t(n);return}}this._nodes=new iA(this,s),this._animation=new g_(this._nodes,this.info),this._attributes=new N_(s),this._background=new _v(this,this._nodes),this._geometries=new v_(this._attributes,this.info),this._textures=new V_(this,s,this.info),this._pipelines=new w_(s,this._nodes),this._bindings=new M_(s,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new T_(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new U_(this.lighting),this._bundles=new aA,this._renderContexts=new L_,this._animation.start(),this._initialized=!0,e()}),this._initPromise)}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,s=null){if(this._isDeviceLost===!0)return;this._initialized===!1&&await this.init();const n=this._nodes.nodeFrame,r=n.renderId,i=this._currentRenderContext,a=this._currentRenderObjectFunction,u=this._compilationPromises,c=e.isScene===!0?e:jc;s===null&&(s=e);const l=this._renderTarget,d=this._renderContexts.get(s,t,l),h=this._activeMipmapLevel,p=[];this._currentRenderContext=d,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=p,n.renderId++,n.update(),d.depth=this.depth,d.stencil=this.stencil,d.clippingContext||(d.clippingContext=new ii),d.clippingContext.updateGlobal(c,t),c.onBeforeRender(this,e,t,l);const f=this._renderLists.get(e,t);if(f.begin(),this._projectObject(e,t,0,f,d.clippingContext),s!==e&&s.traverseVisible(function(w){w.isLight&&w.layers.test(t.layers)&&f.pushLight(w)}),f.finish(),l!==null){this._textures.updateRenderTarget(l,h);const w=this._textures.get(l);d.textures=w.textures,d.depthTexture=w.depthTexture}else d.textures=null,d.depthTexture=null;this._background.update(c,f,d);const m=f.opaque,x=f.transparent,N=f.transparentDoublePass,v=f.lightsNode;this.opaque===!0&&m.length>0&&this._renderObjects(m,t,c,v),this.transparent===!0&&x.length>0&&this._renderTransparents(x,N,t,c,v),n.renderId=r,this._currentRenderContext=i,this._currentRenderObjectFunction=a,this._compilationPromises=u,this._handleObjectFunction=this._renderObjectDirect,await Promise.all(p)}async renderAsync(e,t){this._initialized===!1&&await this.init();const s=this._renderScene(e,t);await this.backend.resolveTimestampAsync(s,"render")}async waitForGPU(){await this.backend.waitForGPU()}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost: - -Message: ${e.message}`;e.reason&&(t+=` -Reason: ${e.reason}`),console.error(t),this._isDeviceLost=!0}_renderBundle(e,t,s){const{bundleGroup:n,camera:r,renderList:i}=e,a=this._currentRenderContext,u=this._bundles.get(n,r),c=this.backend.get(u);c.renderContexts===void 0&&(c.renderContexts=new Set);const l=n.version!==c.version,d=c.renderContexts.has(a)===!1||l;if(c.renderContexts.add(a),d){this.backend.beginBundle(a),(c.renderObjects===void 0||l)&&(c.renderObjects=[]),this._currentRenderBundle=u;const h=i.opaque;this.opaque===!0&&h.length>0&&this._renderObjects(h,r,t,s),this._currentRenderBundle=null,this.backend.finishBundle(a,u),c.version=n.version}else{const{renderObjects:h}=c;for(let p=0,f=h.length;p>=h,f.viewportValue.height>>=h,f.viewportValue.minDepth=w,f.viewportValue.maxDepth=B,f.viewport=f.viewportValue.equals(co)===!1,f.scissorValue.copy(N).multiplyScalar(v).floor(),f.scissor=this._scissorTest&&f.scissorValue.equals(co)===!1,f.scissorValue.width>>=h,f.scissorValue.height>>=h,f.clippingContext||(f.clippingContext=new ii),f.clippingContext.updateGlobal(c,t),c.onBeforeRender(this,e,t,p),Er.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),lo.setFromProjectionMatrix(Er,m);const F=this._renderLists.get(e,t);if(F.begin(),this._projectObject(e,t,0,F,f.clippingContext),F.finish(),this.sortObjects===!0&&F.sort(this._opaqueSort,this._transparentSort),p!==null){this._textures.updateRenderTarget(p,h);const Z=this._textures.get(p);f.textures=Z.textures,f.depthTexture=Z.depthTexture,f.width=Z.width,f.height=Z.height,f.renderTarget=p,f.depth=p.depthBuffer,f.stencil=p.stencilBuffer}else f.textures=null,f.depthTexture=null,f.width=this.domElement.width,f.height=this.domElement.height,f.depth=this.depth,f.stencil=this.stencil;f.width>>=h,f.height>>=h,f.activeCubeFace=d,f.activeMipmapLevel=h,f.occlusionQueryCount=F.occlusionQueryCount,this._background.update(c,F,f),this.backend.beginRender(f);const{bundles:L,lightsNode:I,transparentDoublePass:G,transparent:X,opaque:ie}=F;if(L.length>0&&this._renderBundles(L,c,I),this.opaque===!0&&ie.length>0&&this._renderObjects(ie,t,c,I),this.transparent===!0&&X.length>0&&this._renderTransparents(X,G,t,c,I),this.backend.finishRender(f),r.renderId=i,this._currentRenderContext=a,this._currentRenderObjectFunction=u,n!==null){this.setRenderTarget(l,d,h);const Z=this._quad;this._nodes.hasOutputChange(p.texture)&&(Z.material.fragmentNode=this._nodes.getOutputNode(p.texture),Z.material.needsUpdate=!0),this._renderScene(Z,Z.camera,!1)}return c.onAfterRender(this,e,t,p),f}getMaxAnisotropy(){return this.backend.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){this._initialized===!1&&await this.init(),this._animation.setAnimationLoop(e)}async getArrayBufferAsync(e){return await this.backend.getArrayBufferAsync(e)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._pixelRatio}getDrawingBufferSize(e){return e.set(this._width*this._pixelRatio,this._height*this._pixelRatio).floor()}getSize(e){return e.set(this._width,this._height)}setPixelRatio(e=1){this._pixelRatio!==e&&(this._pixelRatio=e,this.setSize(this._width,this._height,!1))}setDrawingBufferSize(e,t,s){this._width=e,this._height=t,this._pixelRatio=s,this.domElement.width=Math.floor(e*s),this.domElement.height=Math.floor(t*s),this.setViewport(0,0,e,t),this._initialized&&this.backend.updateSize()}setSize(e,t,s=!0){this._width=e,this._height=t,this.domElement.width=Math.floor(e*this._pixelRatio),this.domElement.height=Math.floor(t*this._pixelRatio),s===!0&&(this.domElement.style.width=e+"px",this.domElement.style.height=t+"px"),this.setViewport(0,0,e,t),this._initialized&&this.backend.updateSize()}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){const t=this._scissor;return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e}setScissor(e,t,s,n){const r=this._scissor;e.isVector4?r.copy(e):r.set(e,t,s,n)}getScissorTest(){return this._scissorTest}setScissorTest(e){this._scissorTest=e,this.backend.setScissorTest(e)}getViewport(e){return e.copy(this._viewport)}setViewport(e,t,s,n,r=0,i=1){const a=this._viewport;e.isVector4?a.copy(e):a.set(e,t,s,n),a.minDepth=r,a.maxDepth=i}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){const t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,s=!0){if(this._initialized===!1)return console.warn("THREE.Renderer: .clear() called before the backend is initialized. Try using .clearAsync() instead."),this.clearAsync(e,t,s);const n=this._renderTarget||this._getFrameBufferTarget();let r=null;if(n!==null){this._textures.updateRenderTarget(n);const i=this._textures.get(n);r=this._renderContexts.get(null,null,n),r.textures=i.textures,r.depthTexture=i.depthTexture,r.width=i.width,r.height=i.height,r.renderTarget=n,r.depth=n.depthBuffer,r.stencil=n.stencilBuffer}if(this.backend.clear(e,t,s,r),n!==null&&this._renderTarget===null){const i=this._quad;this._nodes.hasOutputChange(n.texture)&&(i.material.fragmentNode=this._nodes.getOutputNode(n.texture),i.material.needsUpdate=!0),this._renderScene(i,i.camera,!1)}}clearColor(){return this.clear(!0,!1,!1)}clearDepth(){return this.clear(!1,!0,!1)}clearStencil(){return this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,s=!0){this._initialized===!1&&await this.init(),this.clear(e,t,s)}async clearColorAsync(){this.clearAsync(!0,!1,!1)}async clearDepthAsync(){this.clearAsync(!1,!0,!1)}async clearStencilAsync(){this.clearAsync(!1,!1,!0)}get currentToneMapping(){return this._renderTarget!==null?ss:this.toneMapping}get currentColorSpace(){return this._renderTarget!==null?kt:this.outputColorSpace}dispose(){this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose(),this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,s=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=s}getRenderTarget(){return this._renderTarget}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e){if(this.isDeviceLost===!0)return;if(this._initialized===!1)return console.warn("THREE.Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e);const t=this._nodes.nodeFrame,s=t.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,t.renderId=this.info.calls;const n=this.backend,r=this._pipelines,i=this._bindings,a=this._nodes,u=Array.isArray(e)?e:[e];if(u[0]===void 0||u[0].isComputeNode!==!0)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");n.beginCompute(e);for(const c of u){if(r.has(c)===!1){const h=()=>{c.removeEventListener("dispose",h),r.delete(c),i.delete(c),a.delete(c)};c.addEventListener("dispose",h);const p=c.onInitFunction;p!==null&&p.call(c,{renderer:this})}a.updateForCompute(c),i.updateForCompute(c);const l=i.getForCompute(c),d=r.getForCompute(c,l);n.compute(e,c,l,d)}n.finishCompute(e),t.renderId=s}async computeAsync(e){this._initialized===!1&&await this.init(),this.compute(e),await this.backend.resolveTimestampAsync(e,"compute")}async hasFeatureAsync(e){return this._initialized===!1&&await this.init(),this.backend.hasFeature(e)}hasFeature(e){return this._initialized===!1?(console.warn("THREE.Renderer: .hasFeature() called before the backend is initialized. Try using .hasFeatureAsync() instead."),!1):this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){this._initialized===!1&&await this.init(),this._textures.updateTexture(e)}initTexture(e){this._initialized===!1&&console.warn("THREE.Renderer: .initTexture() called before the backend is initialized. Try using .initTextureAsync() instead."),this._textures.updateTexture(e)}copyFramebufferToTexture(e,t=null){if(t!==null)if(t.isVector2)t=jt.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=jt.copy(t).floor();else{console.error("THREE.Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=jt.set(0,0,e.image.width,e.image.height);let s=this._currentRenderContext,n;s!==null?n=s.renderTarget:(n=this._renderTarget||this._getFrameBufferTarget(),n!==null&&(this._textures.updateRenderTarget(n),s=this._textures.get(n))),this._textures.updateTexture(e,{renderTarget:n}),this.backend.copyFramebufferToTexture(e,s,t)}copyTextureToTexture(e,t,s=null,n=null,r=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,s,n,r)}async readRenderTargetPixelsAsync(e,t,s,n,r,i=0,a=0){return this.backend.copyTextureToBuffer(e.textures[i],t,s,n,r,a)}_projectObject(e,t,s,n,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)s=e.renderOrder,e.isClippingGroup&&e.enabled&&(r=r.getGroupContext(e));else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)n.pushLight(e);else if(e.isSprite){if(!e.frustumCulled||lo.intersectsSprite(e)){this.sortObjects===!0&&jt.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Er);const{geometry:u,material:c}=e;c.visible&&n.push(e,u,c,s,jt.z,null,r)}}else if(e.isLineLoop)console.error("THREE.Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||lo.intersectsObject(e))){const{geometry:u,material:c}=e;if(this.sortObjects===!0&&(u.boundingSphere===null&&u.computeBoundingSphere(),jt.copy(u.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(Er)),Array.isArray(c)){const l=u.groups;for(let d=0,h=l.length;d0){for(const{material:i}of t)i.side=Ct;this._renderObjects(t,s,n,r,"backSide");for(const{material:i}of t)i.side=No;this._renderObjects(e,s,n,r);for(const{material:i}of t)i.side=js}else this._renderObjects(e,s,n,r)}_renderObjects(e,t,s,n,r=null){for(let i=0,a=e.length;i0,p.isShadowNodeMaterial&&(p.side=r.shadowSide===null?r.side:r.shadowSide,r.depthNode&&r.depthNode.isNode&&(h=p.depthNode,p.depthNode=r.depthNode),r.castShadowNode&&r.castShadowNode.isNode&&(d=p.colorNode,p.colorNode=r.castShadowNode)),r=p}r.transparent===!0&&r.side===js&&r.forceSinglePass===!1?(r.side=Ct,this._handleObjectFunction(e,r,t,s,a,i,u,"backSide"),r.side=No,this._handleObjectFunction(e,r,t,s,a,i,u,c),r.side=js):this._handleObjectFunction(e,r,t,s,a,i,u,c),l!==void 0&&(t.overrideMaterial.positionNode=l),h!==void 0&&(t.overrideMaterial.depthNode=h),d!==void 0&&(t.overrideMaterial.colorNode=d),e.onAfterRender(this,t,s,n,r,i)}_renderObjectDirect(e,t,s,n,r,i,a,u){const c=this._objects.get(e,t,s,n,r,this._currentRenderContext,a,u);c.drawRange=e.geometry.drawRange,c.group=i;const l=this._nodes.needsRefresh(c);l&&(this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c)),this._pipelines.updateForRender(c),this._currentRenderBundle!==null&&(this.backend.get(this._currentRenderBundle).renderObjects.push(c),c.bundle=this._currentRenderBundle.bundleGroup),this.backend.draw(c,this.info),l&&this._nodes.updateAfter(c)}_createObjectPipeline(e,t,s,n,r,i,a,u){const c=this._objects.get(e,t,s,n,r,this._currentRenderContext,a,u);c.drawRange=e.geometry.drawRange,c.group=i,this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c),this._pipelines.getForRender(c,this._compilationPromises),this._nodes.updateAfter(c)}get compile(){return this.compileAsync}}class qu{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}clone(){return Object.assign(new this.constructor,this)}}function dA(o){return o+(ts-o%ts)%ts}class gg extends qu{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t}get byteLength(){return dA(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}}class mg extends gg{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}}let hA=0;class yg extends mg{constructor(e,t){super("UniformBuffer_"+hA++,e?e.value:null),this.nodeUniform=e,this.groupNode=t}get buffer(){return this.nodeUniform.value}}class pA extends mg{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[]}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}get values(){return this._values===null&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(e===null){const t=this.byteLength;e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){let e=0;for(let t=0,s=this.uniforms.length;t0?h:"";a=`${l.name} { - ${d} ${i.name}[${p}]; -}; -`}else a=`${this.getVectorType(i.type)} ${this.getPropertyName(i,e)};`,u=!0;const c=i.node.precision;if(c!==null&&(a=_A[c]+" "+a),u){a=" "+a;const l=i.groupNode.name;(n[l]||(n[l]=[])).push(a)}else a="uniform "+a,s.push(a)}let r="";for(const i in n){const a=n[i];r+=this._getGLSLUniformStruct(e+"_"+i,a.join(` -`))+` -`}return r+=s.join(` -`),r}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==ze){let s=e;e.isInterleavedBufferAttribute&&(s=e.data);const n=s.array;n instanceof Uint32Array||n instanceof Int32Array||(t=t.slice(1))}return t}getAttributes(e){let t="";if(e==="vertex"||e==="compute"){const s=this.getAttributesArray();let n=0;for(const r of s)t+=`layout( location = ${n++} ) in ${r.type} ${r.name}; -`}return t}getStructMembers(e){const t=[],s=e.getMemberTypes();for(let n=0;ns*n,1)}u`}getDrawIndex(){return this.renderer.backend.extensions.has("WEBGL_multi_draw")?"uint( gl_DrawID )":null}getFrontFacing(){return"gl_FrontFacing"}getFragCoord(){return"gl_FragCoord.xy"}getFragDepth(){return"gl_FragDepth"}enableExtension(e,t,s=this.shaderStage){const n=this.extensions[s]||(this.extensions[s]=new Map);n.has(e)===!1&&n.set(e,{name:e,behavior:t})}getExtensions(e){const t=[];if(e==="vertex"){const n=this.renderer.backend.extensions;this.object.isBatchedMesh&&n.has("WEBGL_multi_draw")&&this.enableExtension("GL_ANGLE_multi_draw","require",e)}const s=this.extensions[e];if(s!==void 0)for(const{name:n,behavior:r}of s.values())t.push(`#extension ${n} : ${r}`);return t.join(` -`)}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=Qc[e];if(t===void 0){let s;switch(t=!1,e){case"float32Filterable":s="OES_texture_float_linear";break;case"clipDistance":s="WEBGL_clip_cull_distance";break}if(s!==void 0){const n=this.renderer.backend.extensions;n.has(s)&&(n.get(s),t=!0)}Qc[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){const e=this.transforms;let t="";for(let s=0;s0&&(s+=` -`),s+=` // flow -> ${c} - `),s+=`${u.code} - `,a===r&&t!=="compute"&&(s+=`// result - `,t==="vertex"?(s+="gl_Position = ",s+=`${u.result};`):t==="fragment"&&(a.outputNode.isOutputStructNode||(s+="fragColor = ",s+=`${u.result};`)))}const i=e[t];i.extensions=this.getExtensions(t),i.uniforms=this.getUniforms(t),i.attributes=this.getAttributes(t),i.varyings=this.getVaryings(t),i.vars=this.getVars(t),i.structs=this.getStructs(t),i.codes=this.getCodes(t),i.transforms=this.getTransforms(t),i.flow=s}this.material!==null?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,s,n=null){const r=super.getUniformFromNode(e,t,s,n),i=this.getDataFromNode(e,s,this.globalCache);let a=i.uniformGPU;if(a===void 0){const u=e.groupNode,c=u.name,l=this.getBindGroupArray(c,s);if(t==="texture")a=new Di(r.name,r.node,u),l.push(a);else if(t==="cubeTexture")a=new Tg(r.name,r.node,u),l.push(a);else if(t==="texture3D")a=new _g(r.name,r.node,u),l.push(a);else if(t==="buffer"){e.name=`NodeBuffer_${e.id}`,r.name=`buffer${e.id}`;const d=new yg(e,u);d.name=e.name,l.push(d),a=d}else{const d=this.uniformGroups[s]||(this.uniformGroups[s]={});let h=d[c];h===void 0&&(h=new xg(s+"_"+c,u),d[c]=h,l.push(h)),a=this.getNodeUniform(r,t),h.addUniform(a)}i.uniformGPU=a}return r}}let ho=null,Ls=null;class bg{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}createSampler(){}destroySampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}isOccluded(){}async resolveTimestampAsync(){}async waitForGPU(){}async hasFeatureAsync(){}hasFeature(){}getMaxAnisotropy(){}getDrawingBufferSize(){return ho=ho||new Ye,this.renderer.getDrawingBufferSize(ho)}setScissorTest(){}getClearColor(){const e=this.renderer;return Ls=Ls||new Ru,e.getClearColor(Ls),Ls.getRGB(Ls,this.renderer.currentColorSpace),Ls}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:ym(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${xl} webgpu`),this.domElement=e),e}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}dispose(){}}let NA=0;class SA{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[this.activeBufferIndex^1]}switchBuffers(){this.activeBufferIndex^=1}}class vA{constructor(e){this.backend=e}createAttribute(e,t){const s=this.backend,{gl:n}=s,r=e.array,i=e.usage||n.STATIC_DRAW,a=e.isInterleavedBufferAttribute?e.data:e,u=s.get(a);let c=u.bufferGPU;c===void 0&&(c=this._createBuffer(n,t,r,i),u.bufferGPU=c,u.bufferType=t,u.version=a.version);let l;if(r instanceof Float32Array)l=n.FLOAT;else if(r instanceof Uint16Array)e.isFloat16BufferAttribute?l=n.HALF_FLOAT:l=n.UNSIGNED_SHORT;else if(r instanceof Int16Array)l=n.SHORT;else if(r instanceof Uint32Array)l=n.UNSIGNED_INT;else if(r instanceof Int32Array)l=n.INT;else if(r instanceof Int8Array)l=n.BYTE;else if(r instanceof Uint8Array)l=n.UNSIGNED_BYTE;else if(r instanceof Uint8ClampedArray)l=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+r);let d={bufferGPU:c,bufferType:t,type:l,byteLength:r.byteLength,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:l===n.INT||l===n.UNSIGNED_INT||e.gpuType===ze,id:NA++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){const h=this._createBuffer(n,t,r,i);d=new SA(d,h)}s.set(e,d)}updateAttribute(e){const t=this.backend,{gl:s}=t,n=e.array,r=e.isInterleavedBufferAttribute?e.data:e,i=t.get(r),a=i.bufferType,u=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(s.bindBuffer(a,i.bufferGPU),u.length===0)s.bufferSubData(a,0,n);else{for(let c=0,l=u.length;c1?this.enable(n.SAMPLE_ALPHA_TO_COVERAGE):this.disable(n.SAMPLE_ALPHA_TO_COVERAGE),s>0&&this.currentClippingPlanes!==s)for(let u=0;u<8;u++)u{function r(){const i=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(i===e.WAIT_FAILED){e.deleteSync(t),n();return}if(i===e.TIMEOUT_EXPIRED){requestAnimationFrame(r);return}e.deleteSync(t),s()}r()})}}let el=!1,wr,fo,tl;class CA{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},el===!1&&(this._init(this.gl),el=!0)}_init(e){wr={[li]:e.REPEAT,[ca]:e.CLAMP_TO_EDGE,[ci]:e.MIRRORED_REPEAT},fo={[bt]:e.NEAREST,[So]:e.NEAREST_MIPMAP_NEAREST,[Xs]:e.NEAREST_MIPMAP_LINEAR,[ft]:e.LINEAR,[_o]:e.LINEAR_MIPMAP_NEAREST,[ms]:e.LINEAR_MIPMAP_LINEAR},tl={[Bl]:e.NEVER,[Ml]:e.ALWAYS,[ua]:e.LESS,[wl]:e.LEQUAL,[El]:e.EQUAL,[Cl]:e.GEQUAL,[Rl]:e.GREATER,[Al]:e.NOTEQUAL}}filterFallback(e){const{gl:t}=this;return e===bt||e===So||e===Xs?t.NEAREST:t.LINEAR}getGLTextureType(e){const{gl:t}=this;let s;return e.isCubeTexture===!0?s=t.TEXTURE_CUBE_MAP:e.isDataArrayTexture===!0||e.isCompressedArrayTexture===!0?s=t.TEXTURE_2D_ARRAY:e.isData3DTexture===!0?s=t.TEXTURE_3D:s=t.TEXTURE_2D,s}getInternalFormat(e,t,s,n,r=!1){const{gl:i,extensions:a}=this;if(e!==null){if(i[e]!==void 0)return i[e];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+e+"'")}let u=t;return t===i.RED&&(s===i.FLOAT&&(u=i.R32F),s===i.HALF_FLOAT&&(u=i.R16F),s===i.UNSIGNED_BYTE&&(u=i.R8),s===i.UNSIGNED_SHORT&&(u=i.R16),s===i.UNSIGNED_INT&&(u=i.R32UI),s===i.BYTE&&(u=i.R8I),s===i.SHORT&&(u=i.R16I),s===i.INT&&(u=i.R32I)),t===i.RED_INTEGER&&(s===i.UNSIGNED_BYTE&&(u=i.R8UI),s===i.UNSIGNED_SHORT&&(u=i.R16UI),s===i.UNSIGNED_INT&&(u=i.R32UI),s===i.BYTE&&(u=i.R8I),s===i.SHORT&&(u=i.R16I),s===i.INT&&(u=i.R32I)),t===i.RG&&(s===i.FLOAT&&(u=i.RG32F),s===i.HALF_FLOAT&&(u=i.RG16F),s===i.UNSIGNED_BYTE&&(u=i.RG8),s===i.UNSIGNED_SHORT&&(u=i.RG16),s===i.UNSIGNED_INT&&(u=i.RG32UI),s===i.BYTE&&(u=i.RG8I),s===i.SHORT&&(u=i.RG16I),s===i.INT&&(u=i.RG32I)),t===i.RG_INTEGER&&(s===i.UNSIGNED_BYTE&&(u=i.RG8UI),s===i.UNSIGNED_SHORT&&(u=i.RG16UI),s===i.UNSIGNED_INT&&(u=i.RG32UI),s===i.BYTE&&(u=i.RG8I),s===i.SHORT&&(u=i.RG16I),s===i.INT&&(u=i.RG32I)),t===i.RGB&&(s===i.FLOAT&&(u=i.RGB32F),s===i.HALF_FLOAT&&(u=i.RGB16F),s===i.UNSIGNED_BYTE&&(u=i.RGB8),s===i.UNSIGNED_SHORT&&(u=i.RGB16),s===i.UNSIGNED_INT&&(u=i.RGB32UI),s===i.BYTE&&(u=i.RGB8I),s===i.SHORT&&(u=i.RGB16I),s===i.INT&&(u=i.RGB32I),s===i.UNSIGNED_BYTE&&(u=n===q&&r===!1?i.SRGB8:i.RGB8),s===i.UNSIGNED_SHORT_5_6_5&&(u=i.RGB565),s===i.UNSIGNED_SHORT_5_5_5_1&&(u=i.RGB5_A1),s===i.UNSIGNED_SHORT_4_4_4_4&&(u=i.RGB4),s===i.UNSIGNED_INT_5_9_9_9_REV&&(u=i.RGB9_E5)),t===i.RGB_INTEGER&&(s===i.UNSIGNED_BYTE&&(u=i.RGB8UI),s===i.UNSIGNED_SHORT&&(u=i.RGB16UI),s===i.UNSIGNED_INT&&(u=i.RGB32UI),s===i.BYTE&&(u=i.RGB8I),s===i.SHORT&&(u=i.RGB16I),s===i.INT&&(u=i.RGB32I)),t===i.RGBA&&(s===i.FLOAT&&(u=i.RGBA32F),s===i.HALF_FLOAT&&(u=i.RGBA16F),s===i.UNSIGNED_BYTE&&(u=i.RGBA8),s===i.UNSIGNED_SHORT&&(u=i.RGBA16),s===i.UNSIGNED_INT&&(u=i.RGBA32UI),s===i.BYTE&&(u=i.RGBA8I),s===i.SHORT&&(u=i.RGBA16I),s===i.INT&&(u=i.RGBA32I),s===i.UNSIGNED_BYTE&&(u=n===q&&r===!1?i.SRGB8_ALPHA8:i.RGBA8),s===i.UNSIGNED_SHORT_4_4_4_4&&(u=i.RGBA4),s===i.UNSIGNED_SHORT_5_5_5_1&&(u=i.RGB5_A1)),t===i.RGBA_INTEGER&&(s===i.UNSIGNED_BYTE&&(u=i.RGBA8UI),s===i.UNSIGNED_SHORT&&(u=i.RGBA16UI),s===i.UNSIGNED_INT&&(u=i.RGBA32UI),s===i.BYTE&&(u=i.RGBA8I),s===i.SHORT&&(u=i.RGBA16I),s===i.INT&&(u=i.RGBA32I)),t===i.DEPTH_COMPONENT&&(s===i.UNSIGNED_INT&&(u=i.DEPTH24_STENCIL8),s===i.FLOAT&&(u=i.DEPTH_COMPONENT32F)),t===i.DEPTH_STENCIL&&s===i.UNSIGNED_INT_24_8&&(u=i.DEPTH24_STENCIL8),(u===i.R16F||u===i.R32F||u===i.RG16F||u===i.RG32F||u===i.RGBA16F||u===i.RGBA32F)&&a.get("EXT_color_buffer_float"),u}setTextureParameters(e,t){const{gl:s,extensions:n,backend:r}=this;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,t.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,t.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,s.NONE),s.texParameteri(e,s.TEXTURE_WRAP_S,wr[t.wrapS]),s.texParameteri(e,s.TEXTURE_WRAP_T,wr[t.wrapT]),(e===s.TEXTURE_3D||e===s.TEXTURE_2D_ARRAY)&&s.texParameteri(e,s.TEXTURE_WRAP_R,wr[t.wrapR]),s.texParameteri(e,s.TEXTURE_MAG_FILTER,fo[t.magFilter]);const i=t.mipmaps!==void 0&&t.mipmaps.length>0,a=t.minFilter===ft&&i?ms:t.minFilter;if(s.texParameteri(e,s.TEXTURE_MIN_FILTER,fo[a]),t.compareFunction&&(s.texParameteri(e,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(e,s.TEXTURE_COMPARE_FUNC,tl[t.compareFunction])),n.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===bt||t.minFilter!==Xs&&t.minFilter!==ms||t.type===ot&&n.has("OES_texture_float_linear")===!1)return;if(t.anisotropy>1){const u=n.get("EXT_texture_filter_anisotropic");s.texParameterf(e,u.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,r.getMaxAnisotropy()))}}}createDefaultTexture(e){const{gl:t,backend:s,defaultTextures:n}=this,r=this.getGLTextureType(e);let i=n[r];i===void 0&&(i=t.createTexture(),s.state.bindTexture(r,i),t.texParameteri(r,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(r,t.TEXTURE_MAG_FILTER,t.NEAREST),n[r]=i),s.set(e,{textureGPU:i,glTextureType:r,isDefault:!0})}createTexture(e,t){const{gl:s,backend:n}=this,{levels:r,width:i,height:a,depth:u}=t,c=n.utils.convert(e.format,e.colorSpace),l=n.utils.convert(e.type),d=this.getInternalFormat(e.internalFormat,c,l,e.colorSpace,e.isVideoTexture),h=s.createTexture(),p=this.getGLTextureType(e);n.state.bindTexture(p,h),this.setTextureParameters(p,e),e.isDataArrayTexture||e.isCompressedArrayTexture?s.texStorage3D(s.TEXTURE_2D_ARRAY,r,d,i,a,u):e.isData3DTexture?s.texStorage3D(s.TEXTURE_3D,r,d,i,a,u):e.isVideoTexture||s.texStorage2D(p,r,d,i,a),n.set(e,{textureGPU:h,glTextureType:p,glFormat:c,glType:l,glInternalFormat:d})}copyBufferToTexture(e,t){const{gl:s,backend:n}=this,{textureGPU:r,glTextureType:i,glFormat:a,glType:u}=n.get(t),{width:c,height:l}=t.source.data;s.bindBuffer(s.PIXEL_UNPACK_BUFFER,e),n.state.bindTexture(i,r),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,!1),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),s.texSubImage2D(i,0,0,0,c,l,a,u,0),s.bindBuffer(s.PIXEL_UNPACK_BUFFER,null),n.state.unbindTexture()}updateTexture(e,t){const{gl:s}=this,{width:n,height:r}=t,{textureGPU:i,glTextureType:a,glFormat:u,glType:c,glInternalFormat:l}=this.backend.get(e);if(e.isRenderTargetTexture||i===void 0)return;const d=h=>h.isDataTexture?h.image.data:typeof HTMLImageElement<"u"&&h instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&h instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&h instanceof ImageBitmap||h instanceof OffscreenCanvas?h:h.data;if(this.backend.state.bindTexture(a,i),this.setTextureParameters(a,e),e.isCompressedTexture){const h=e.mipmaps,p=t.image;for(let f=0;f0,h=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(d){const p=a!==0||u!==0;let f,m;if(e.isDepthTexture===!0?(f=n.DEPTH_BUFFER_BIT,m=n.DEPTH_ATTACHMENT,t.stencil&&(f|=n.STENCIL_BUFFER_BIT)):(f=n.COLOR_BUFFER_BIT,m=n.COLOR_ATTACHMENT0),p){const x=this.backend.get(t.renderTarget),N=x.framebuffers[t.getCacheKey()],v=x.msaaFrameBuffer;r.bindFramebuffer(n.DRAW_FRAMEBUFFER,N),r.bindFramebuffer(n.READ_FRAMEBUFFER,v);const w=h-u-l;n.blitFramebuffer(a,w,a+c,w+l,a,w,a+c,w+l,f,n.NEAREST),r.bindFramebuffer(n.READ_FRAMEBUFFER,N),r.bindTexture(n.TEXTURE_2D,i),n.copyTexSubImage2D(n.TEXTURE_2D,0,0,0,a,w,c,l),r.unbindTexture()}else{const x=n.createFramebuffer();r.bindFramebuffer(n.DRAW_FRAMEBUFFER,x),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,m,n.TEXTURE_2D,i,0),n.blitFramebuffer(0,0,c,l,0,0,c,l,f,n.NEAREST),n.deleteFramebuffer(x)}}else r.bindTexture(n.TEXTURE_2D,i),n.copyTexSubImage2D(n.TEXTURE_2D,0,0,0,a,h-l-u,c,l),r.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t){const{gl:s}=this,n=t.renderTarget,{samples:r,depthTexture:i,depthBuffer:a,stencilBuffer:u,width:c,height:l}=n;if(s.bindRenderbuffer(s.RENDERBUFFER,e),a&&!u){let d=s.DEPTH_COMPONENT24;r>0?(i&&i.isDepthTexture&&i.type===s.FLOAT&&(d=s.DEPTH_COMPONENT32F),s.renderbufferStorageMultisample(s.RENDERBUFFER,r,d,c,l)):s.renderbufferStorage(s.RENDERBUFFER,d,c,l),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,e)}else a&&u&&(r>0?s.renderbufferStorageMultisample(s.RENDERBUFFER,r,s.DEPTH24_STENCIL8,c,l):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,c,l),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,e))}async copyTextureToBuffer(e,t,s,n,r,i){const{backend:a,gl:u}=this,{textureGPU:c,glFormat:l,glType:d}=this.backend.get(e),h=u.createFramebuffer();u.bindFramebuffer(u.READ_FRAMEBUFFER,h);const p=e.isCubeTexture?u.TEXTURE_CUBE_MAP_POSITIVE_X+i:u.TEXTURE_2D;u.framebufferTexture2D(u.READ_FRAMEBUFFER,u.COLOR_ATTACHMENT0,p,c,0);const f=this._getTypedArrayType(d),m=this._getBytesPerTexel(d,l),N=n*r*m,v=u.createBuffer();u.bindBuffer(u.PIXEL_PACK_BUFFER,v),u.bufferData(u.PIXEL_PACK_BUFFER,N,u.STREAM_READ),u.readPixels(t,s,n,r,l,d,0),u.bindBuffer(u.PIXEL_PACK_BUFFER,null),await a.utils._clientWaitAsync();const w=new f(N/f.BYTES_PER_ELEMENT);return u.bindBuffer(u.PIXEL_PACK_BUFFER,v),u.getBufferSubData(u.PIXEL_PACK_BUFFER,0,w),u.bindBuffer(u.PIXEL_PACK_BUFFER,null),u.deleteFramebuffer(h),w}_getTypedArrayType(e){const{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;if(e===t.UNSIGNED_SHORT_4_4_4_4||e===t.UNSIGNED_SHORT_5_5_5_1||e===t.UNSIGNED_SHORT_5_6_5||e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){const{gl:s}=this;let n=0;if(e===s.UNSIGNED_BYTE&&(n=1),(e===s.UNSIGNED_SHORT_4_4_4_4||e===s.UNSIGNED_SHORT_5_5_5_1||e===s.UNSIGNED_SHORT_5_6_5||e===s.UNSIGNED_SHORT||e===s.HALF_FLOAT)&&(n=2),(e===s.UNSIGNED_INT||e===s.FLOAT)&&(n=4),t===s.RGBA)return n*4;if(t===s.RGB)return n*3;if(t===s.ALPHA)return n}}class EA{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return t===void 0&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}}class wA{constructor(e){this.backend=e,this.maxAnisotropy=null}getMaxAnisotropy(){if(this.maxAnisotropy!==null)return this.maxAnisotropy;const e=this.backend.gl,t=this.backend.extensions;if(t.has("EXT_texture_filter_anisotropic")===!0){const s=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}}const sl={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBKIT_WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-bc",EXT_texture_compression_bptc:"texture-compression-bptc",EXT_disjoint_timer_query_webgl2:"timestamp-query"};class MA{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){const{gl:s,mode:n,object:r,type:i,info:a,index:u}=this;u!==0?s.drawElements(n,t,i,e):s.drawArrays(n,e,t),a.update(r,t,n,1)}renderInstances(e,t,s){const{gl:n,mode:r,type:i,index:a,object:u,info:c}=this;s!==0&&(a!==0?n.drawElementsInstanced(r,t,i,e,s):n.drawArraysInstanced(r,e,t,s),c.update(u,t,r,s))}renderMultiDraw(e,t,s){const{extensions:n,mode:r,object:i,info:a}=this;if(s===0)return;const u=n.get("WEBGL_multi_draw");if(u===null)for(let c=0;c0)){const s=t.queryQueue.shift();this.initTimestampQuery(s)}}async resolveTimestampAsync(e,t="render"){if(!this.disjoint||!this.trackTimestamp)return;const s=this.get(e);s.gpuQueries||(s.gpuQueries=[]);for(let n=0;n0&&(s.currentOcclusionQueries=s.occlusionQueries,s.currentOcclusionQueryObjects=s.occlusionQueryObjects,s.lastOcclusionObject=null,s.occlusionQueries=new Array(n),s.occlusionQueryObjects=new Array(n),s.occlusionQueryIndex=0)}finishRender(e){const{gl:t,state:s}=this,n=this.get(e),r=n.previousContext,i=e.occlusionQueryCount;i>0&&(i>n.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));const a=e.textures;if(a!==null)for(let u=0;u0){const l=u.framebuffers[e.getCacheKey()],d=t.COLOR_BUFFER_BIT,h=u.msaaFrameBuffer,p=e.textures;s.bindFramebuffer(t.READ_FRAMEBUFFER,h),s.bindFramebuffer(t.DRAW_FRAMEBUFFER,l);for(let f=0;f{let u=0;for(let c=0;c0&&r.add(n[c]),s[c]=null,i.deleteQuery(l),u++)}u1?N.renderInstances(B,v,w):N.render(B,v),u.bindVertexArray(null)}needsRenderUpdate(){return!1}getRenderCacheKey(){return""}createDefaultTexture(e){this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e){this.textureUtils.destroyTexture(e)}copyTextureToBuffer(e,t,s,n,r,i){return this.textureUtils.copyTextureToBuffer(e,t,s,n,r,i)}createSampler(){}destroySampler(){}createNodeBuilder(e,t){return new bA(e,t)}createProgram(e){const t=this.gl,{stage:s,code:n}=e,r=s==="fragment"?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER);t.shaderSource(r,n),t.compileShader(r),this.set(e,{shaderGPU:r})}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){const s=this.gl,n=e.pipeline,{fragmentProgram:r,vertexProgram:i}=n,a=s.createProgram(),u=this.get(r).shaderGPU,c=this.get(i).shaderGPU;if(s.attachShader(a,u),s.attachShader(a,c),s.linkProgram(a),this.set(n,{programGPU:a,fragmentShader:u,vertexShader:c}),t!==null&&this.parallel){const l=new Promise(d=>{const h=this.parallel,p=()=>{s.getProgramParameter(a,h.COMPLETION_STATUS_KHR)?(this._completeCompile(e,n),d()):requestAnimationFrame(p)};p()});t.push(l);return}this._completeCompile(e,n)}_handleSource(e,t){const s=e.split(` -`),n=[],r=Math.max(t-6,0),i=Math.min(t+6,s.length);for(let a=r;a":" "} ${u}: ${s[a]}`)}return n.join(` -`)}_getShaderErrors(e,t,s){const n=e.getShaderParameter(t,e.COMPILE_STATUS),r=e.getShaderInfoLog(t).trim();if(n&&r==="")return"";const i=/ERROR: 0:(\d+)/.exec(r);if(i){const a=parseInt(i[1]);return s.toUpperCase()+` - -`+r+` - -`+this._handleSource(e.getShaderSource(t),a)}else return r}_logProgramError(e,t,s){if(this.renderer.debug.checkShaderErrors){const n=this.gl,r=n.getProgramInfoLog(e).trim();if(n.getProgramParameter(e,n.LINK_STATUS)===!1)if(typeof this.renderer.debug.onShaderError=="function")this.renderer.debug.onShaderError(n,e,s,t);else{const i=this._getShaderErrors(n,s,"vertex"),a=this._getShaderErrors(n,t,"fragment");console.error("THREE.WebGLProgram: Shader Error "+n.getError()+" - VALIDATE_STATUS "+n.getProgramParameter(e,n.VALIDATE_STATUS)+` - -Program Info Log: `+r+` -`+i+` -`+a)}else r!==""&&console.warn("THREE.WebGLProgram: Program Info Log:",r)}}_completeCompile(e,t){const{state:s,gl:n}=this,r=this.get(t),{programGPU:i,fragmentShader:a,vertexShader:u}=r;n.getProgramParameter(i,n.LINK_STATUS)===!1&&this._logProgramError(i,a,u),s.useProgram(i);const c=e.getBindings();this._setupBindings(c,i),this.set(t,{programGPU:i})}createComputePipeline(e,t){const{state:s,gl:n}=this,r={stage:"fragment",code:`#version 300 es -precision highp float; -void main() {}`};this.createProgram(r);const{computeProgram:i}=e,a=n.createProgram(),u=this.get(r).shaderGPU,c=this.get(i).shaderGPU,l=i.transforms,d=[],h=[];for(let x=0;xsl[n]===e),s=this.extensions;for(let n=0;n0){if(p===void 0){const N=[];p=t.createFramebuffer(),s.bindFramebuffer(t.FRAMEBUFFER,p);const v=[],w=e.textures;for(let B=0;B, - @location( 0 ) vTex : vec2 -}; - -@vertex -fn main( @builtin( vertex_index ) vertexIndex : u32 ) -> VarysStruct { - - var Varys : VarysStruct; - - var pos = array< vec2, 4 >( - vec2( -1.0, 1.0 ), - vec2( 1.0, 1.0 ), - vec2( -1.0, -1.0 ), - vec2( 1.0, -1.0 ) - ); - - var tex = array< vec2, 4 >( - vec2( 0.0, 0.0 ), - vec2( 1.0, 0.0 ), - vec2( 0.0, 1.0 ), - vec2( 1.0, 1.0 ) - ); - - Varys.vTex = tex[ vertexIndex ]; - Varys.Position = vec4( pos[ vertexIndex ], 0.0, 1.0 ); - - return Varys; - -} -`,s=` -@group( 0 ) @binding( 0 ) -var imgSampler : sampler; - -@group( 0 ) @binding( 1 ) -var img : texture_2d; - -@fragment -fn main( @location( 0 ) vTex : vec2 ) -> @location( 0 ) vec4 { - - return textureSample( img, imgSampler, vTex ); - -} -`,n=` -@group( 0 ) @binding( 0 ) -var imgSampler : sampler; - -@group( 0 ) @binding( 1 ) -var img : texture_2d; - -@fragment -fn main( @location( 0 ) vTex : vec2 ) -> @location( 0 ) vec4 { - - return textureSample( img, imgSampler, vec2( vTex.x, 1.0 - vTex.y ) ); - -} -`;this.mipmapSampler=e.createSampler({minFilter:ps.Linear}),this.flipYSampler=e.createSampler({minFilter:ps.Nearest}),this.transferPipelines={},this.flipYPipelines={},this.mipmapVertexShaderModule=e.createShaderModule({label:"mipmapVertex",code:t}),this.mipmapFragmentShaderModule=e.createShaderModule({label:"mipmapFragment",code:s}),this.flipYFragmentShaderModule=e.createShaderModule({label:"flipYFragment",code:n})}getTransferPipeline(e){let t=this.transferPipelines[e];return t===void 0&&(t=this.device.createRenderPipeline({label:`mipmap-${e}`,vertex:{module:this.mipmapVertexShaderModule,entryPoint:"main"},fragment:{module:this.mipmapFragmentShaderModule,entryPoint:"main",targets:[{format:e}]},primitive:{topology:Ks.TriangleStrip,stripIndexFormat:cn.Uint32},layout:"auto"}),this.transferPipelines[e]=t),t}getFlipYPipeline(e){let t=this.flipYPipelines[e];return t===void 0&&(t=this.device.createRenderPipeline({label:`flipY-${e}`,vertex:{module:this.mipmapVertexShaderModule,entryPoint:"main"},fragment:{module:this.flipYFragmentShaderModule,entryPoint:"main",targets:[{format:e}]},primitive:{topology:Ks.TriangleStrip,stripIndexFormat:cn.Uint32},layout:"auto"}),this.flipYPipelines[e]=t),t}flipY(e,t,s=0){const n=t.format,{width:r,height:i}=t.size,a=this.getTransferPipeline(n),u=this.getFlipYPipeline(n),c=this.device.createTexture({size:{width:r,height:i,depthOrArrayLayers:1},format:n,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING}),l=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:$e.TwoD,baseArrayLayer:s}),d=c.createView({baseMipLevel:0,mipLevelCount:1,dimension:$e.TwoD,baseArrayLayer:0}),h=this.device.createCommandEncoder({}),p=(f,m,x)=>{const N=f.getBindGroupLayout(0),v=this.device.createBindGroup({layout:N,entries:[{binding:0,resource:this.flipYSampler},{binding:1,resource:m}]}),w=h.beginRenderPass({colorAttachments:[{view:x,loadOp:ye.Clear,storeOp:De.Store,clearValue:[0,0,0,0]}]});w.setPipeline(f),w.setBindGroup(0,v),w.draw(4,1,0,0),w.end()};p(a,l,d),p(u,d,l),this.device.queue.submit([h.finish()]),c.destroy()}generateMipmaps(e,t,s=0){const n=this.get(e);n.useCount===void 0&&(n.useCount=0,n.layers=[]);const r=n.layers[s]||this._mipmapCreateBundles(e,t,s),i=this.device.createCommandEncoder({});this._mipmapRunBundles(i,r),this.device.queue.submit([i.finish()]),n.useCount!==0&&(n.layers[s]=r),n.useCount++}_mipmapCreateBundles(e,t,s){const n=this.getTransferPipeline(t.format),r=n.getBindGroupLayout(0);let i=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:$e.TwoD,baseArrayLayer:s});const a=[];for(let u=1;u1;for(let a=0;a]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,zA=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,ol={f32:"float",i32:"int",u32:"uint",bool:"bool","vec2":"vec2","vec2":"ivec2","vec2":"uvec2","vec2":"bvec2",vec2f:"vec2",vec2i:"ivec2",vec2u:"uvec2",vec2b:"bvec2","vec3":"vec3","vec3":"ivec3","vec3":"uvec3","vec3":"bvec3",vec3f:"vec3",vec3i:"ivec3",vec3u:"uvec3",vec3b:"bvec3","vec4":"vec4","vec4":"ivec4","vec4":"uvec4","vec4":"bvec4",vec4f:"vec4",vec4i:"ivec4",vec4u:"uvec4",vec4b:"bvec4","mat2x2":"mat2",mat2x2f:"mat2","mat3x3":"mat3",mat3x3f:"mat3","mat4x4":"mat4",mat4x4f:"mat4",sampler:"sampler",texture_1d:"texture",texture_2d:"texture",texture_2d_array:"texture",texture_multisampled_2d:"cubeTexture",texture_depth_2d:"depthTexture",texture_depth_multisampled_2d:"depthTexture",texture_3d:"texture3D",texture_cube:"cubeTexture",texture_cube_array:"cubeTexture",texture_storage_1d:"storageTexture",texture_storage_2d:"storageTexture",texture_storage_2d_array:"storageTexture",texture_storage_3d:"storageTexture"},WA=o=>{o=o.trim();const e=o.match(kA);if(e!==null&&e.length===4){const t=e[2],s=[];let n=null;for(;(n=zA.exec(t))!==null;)s.push({name:n[1],type:n[2]});const r=[];for(let l=0;l "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}}class HA extends pg{parseFunction(e){return new $A(e)}}const Vs=typeof self<"u"?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},qA={[Ve.READ_ONLY]:"read",[Ve.WRITE_ONLY]:"write",[Ve.READ_WRITE]:"read_write"},al={[li]:"repeat",[ca]:"clamp",[ci]:"mirror"},Br={vertex:Vs?Vs.VERTEX:1,fragment:Vs?Vs.FRAGMENT:2,compute:Vs?Vs.COMPUTE:4},ul={instance:!0,swizzleAssign:!1,storageBuffer:!0},KA={"^^":"tsl_xor"},XA={float:"f32",int:"i32",uint:"u32",bool:"bool",color:"vec3",vec2:"vec2",ivec2:"vec2",uvec2:"vec2",bvec2:"vec2",vec3:"vec3",ivec3:"vec3",uvec3:"vec3",bvec3:"vec3",vec4:"vec4",ivec4:"vec4",uvec4:"vec4",bvec4:"vec4",mat2:"mat2x2",mat3:"mat3x3",mat4:"mat4x4"},cl={},it={tsl_xor:new Ne("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new Ne("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new Ne("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new Ne("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new Ne("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new Ne("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new Ne("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2 { return vec2( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new Ne("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3 { return vec3( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new Ne("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4 { return vec4( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new Ne("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new Ne("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new Ne("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),biquadraticTexture:new Ne(` -fn tsl_biquadraticTexture( map : texture_2d, coord : vec2f, iRes : vec2u, level : u32 ) -> vec4f { - - let res = vec2f( iRes ); - - let uvScaled = coord * res; - let uvWrapping = ( ( uvScaled % res ) + res ) % res; - - // https://www.shadertoy.com/view/WtyXRy - - let uv = uvWrapping - 0.5; - let iuv = floor( uv ); - let f = fract( uv ); - - let rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, level ); - let rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, level ); - let rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, level ); - let rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, level ); - - return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y ); - -} -`)},vn={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inversesqrt:"inverseSqrt",bitcast:"bitcast"};typeof navigator<"u"&&/Windows/g.test(navigator.userAgent)&&(it.pow_float=new Ne("fn tsl_pow_float( a : f32, b : f32 ) -> f32 { return select( -pow( -a, b ), pow( a, b ), a > 0.0 ); }"),it.pow_vec2=new Ne("fn tsl_pow_vec2( a : vec2f, b : vec2f ) -> vec2f { return vec2f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ) ); }",[it.pow_float]),it.pow_vec3=new Ne("fn tsl_pow_vec3( a : vec3f, b : vec3f ) -> vec3f { return vec3f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ), tsl_pow_float( a.z, b.z ) ); }",[it.pow_float]),it.pow_vec4=new Ne("fn tsl_pow_vec4( a : vec4f, b : vec4f ) -> vec4f { return vec4f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ), tsl_pow_float( a.z, b.z ), tsl_pow_float( a.w, b.w ) ); }",[it.pow_float]),vn.pow_float="tsl_pow_float",vn.pow_vec2="tsl_pow_vec2",vn.pow_vec3="tsl_pow_vec3",vn.pow_vec4="tsl_pow_vec4");let Ng="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(Ng+=`diagnostic( off, derivative_uniformity ); -`);class YA extends dg{constructor(e,t){super(e,t,new HA),this.uniformGroups={},this.builtins={},this.directives={},this.scopedArrays=new Map}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==Dn}_generateTextureSample(e,t,s,n,r=this.shaderStage){return r==="fragment"?n?`textureSample( ${t}, ${t}_sampler, ${s}, ${n} )`:`textureSample( ${t}, ${t}_sampler, ${s} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,s):this.generateTextureLod(e,t,s,n,"0")}_generateVideoSample(e,t,s=this.shaderStage){if(s==="fragment")return`textureSampleBaseClampToEdge( ${e}, ${e}_sampler, vec2( ${t}.x, 1.0 - ${t}.y ) )`;console.error(`WebGPURenderer: THREE.VideoTexture does not support ${s} shader.`)}_generateTextureSampleLevel(e,t,s,n,r,i=this.shaderStage){return(i==="fragment"||i==="compute")&&this.isUnfilterable(e)===!1?`textureSampleLevel( ${t}, ${t}_sampler, ${s}, ${n} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,s,n):this.generateTextureLod(e,t,s,r,n)}generateWrapFunction(e){const t=`tsl_coord_${al[e.wrapS]}S_${al[e.wrapT]}_${e.isData3DTexture?"3d":"2d"}T`;let s=cl[t];if(s===void 0){const n=[],r=e.isData3DTexture?"vec3f":"vec2f";let i=`fn ${t}( coord : ${r} ) -> ${r} { - - return ${r}( -`;const a=(u,c)=>{u===li?(n.push(it.repeatWrapping_float),i+=` tsl_repeatWrapping_float( coord.${c} )`):u===ca?(n.push(it.clampWrapping_float),i+=` tsl_clampWrapping_float( coord.${c} )`):u===ci?(n.push(it.mirrorWrapping_float),i+=` tsl_mirrorWrapping_float( coord.${c} )`):(i+=` coord.${c}`,console.warn(`WebGPURenderer: Unsupported texture wrap type "${u}" for vertex shader.`))};a(e.wrapS,"x"),i+=`, -`,a(e.wrapT,"y"),e.isData3DTexture&&(i+=`, -`,a(e.wrapR,"z")),i+=` - ); - -} -`,cl[t]=s=new Ne(i,n)}return s.build(this),t}generateTextureDimension(e,t,s){const n=this.getDataFromNode(e,this.shaderStage,this.globalCache);n.dimensionsSnippet===void 0&&(n.dimensionsSnippet={});let r=n.dimensionsSnippet[s];if(n.dimensionsSnippet[s]===void 0){let i,a;const{primarySamples:u}=this.renderer.backend.utils.getTextureSampleData(e),c=u>1;e.isData3DTexture?a="vec3":a="vec2",c||e.isVideoTexture||e.isStorageTexture?i=t:i=`${t}${s?`, u32( ${s} )`:""}`,r=new Ir(new Vr(`textureDimensions( ${i} )`,a)),n.dimensionsSnippet[s]=r,(e.isDataArrayTexture||e.isData3DTexture)&&(n.arrayLayerCount=new Ir(new Vr(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(n.cubeFaceCount=new Ir(new Vr("6u","u32")))}return r.build(this)}generateFilteredTexture(e,t,s,n="0u"){this._include("biquadraticTexture");const r=this.generateWrapFunction(e),i=this.generateTextureDimension(e,t,n);return`tsl_biquadraticTexture( ${t}, ${r}( ${s} ), ${i}, u32( ${n} ) )`}generateTextureLod(e,t,s,n,r="0u"){const i=this.generateWrapFunction(e),a=this.generateTextureDimension(e,t,r),u=e.isData3DTexture?"vec3":"vec2",c=`${u}(${i}(${s}) * ${u}(${a}))`;return this.generateTextureLoad(e,t,c,n,r)}generateTextureLoad(e,t,s,n,r="0u"){return e.isVideoTexture===!0||e.isStorageTexture===!0?`textureLoad( ${t}, ${s} )`:n?`textureLoad( ${t}, ${s}, ${n}, u32( ${r} ) )`:`textureLoad( ${t}, ${s}, u32( ${r} ) )`}generateTextureStore(e,t,s,n){return`textureStore( ${t}, ${s}, ${n} )`}isSampleCompare(e){return e.isDepthTexture===!0&&e.compareFunction!==null}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.isDataTexture===!0&&e.type===ot||this.isSampleCompare(e)===!1&&e.minFilter===bt&&e.magFilter===bt||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,s,n,r=this.shaderStage){let i=null;return e.isVideoTexture===!0?i=this._generateVideoSample(t,s,r):this.isUnfilterable(e)?i=this.generateTextureLod(e,t,s,n,"0",r):i=this._generateTextureSample(e,t,s,n,r),i}generateTextureGrad(e,t,s,n,r,i=this.shaderStage){if(i==="fragment")return`textureSampleGrad( ${t}, ${t}_sampler, ${s}, ${n[0]}, ${n[1]} )`;console.error(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${i} shader.`)}generateTextureCompare(e,t,s,n,r,i=this.shaderStage){if(i==="fragment")return`textureSampleCompare( ${t}, ${t}_sampler, ${s}, ${n} )`;console.error(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${i} shader.`)}generateTextureLevel(e,t,s,n,r,i=this.shaderStage){let a=null;return e.isVideoTexture===!0?a=this._generateVideoSample(t,s,i):a=this._generateTextureSampleLevel(e,t,s,n,r,i),a}generateTextureBias(e,t,s,n,r,i=this.shaderStage){if(i==="fragment")return`textureSampleBias( ${t}, ${t}_sampler, ${s}, ${n} )`;console.error(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${i} shader.`)}getPropertyName(e,t=this.shaderStage){if(e.isNodeVarying===!0&&e.needsInterpolation===!0){if(t==="vertex")return`varyings.${e.name}`}else if(e.isNodeUniform===!0){const s=e.name,n=e.type;return n==="texture"||n==="cubeTexture"||n==="storageTexture"||n==="texture3D"?s:n==="buffer"||n==="storageBuffer"||n==="indirectStorageBuffer"?`NodeBuffer_${e.id}.${s}`:e.groupNode.name+"."+s}return super.getPropertyName(e)}getOutputStructName(){return"output"}_getUniformGroupCount(e){return Object.keys(this.uniforms[e]).length}getFunctionOperator(e){const t=KA[e];return t!==void 0?(this._include(t),t):null}getNodeAccess(e,t){return t!=="compute"?Ve.READ_ONLY:e.access}getStorageAccess(e,t){return qA[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,s,n=null){const r=super.getUniformFromNode(e,t,s,n),i=this.getDataFromNode(e,s,this.globalCache);if(i.uniformGPU===void 0){let a;const u=e.groupNode,c=u.name,l=this.getBindGroupArray(c,s);if(t==="texture"||t==="cubeTexture"||t==="storageTexture"||t==="texture3D"){let d=null;const h=this.getNodeAccess(e,s);if(t==="texture"||t==="storageTexture"?d=new Di(r.name,r.node,u,h):t==="cubeTexture"?d=new Tg(r.name,r.node,u,h):t==="texture3D"&&(d=new _g(r.name,r.node,u,h)),d.store=e.isStorageTextureNode===!0,d.setVisibility(Br[s]),(s==="fragment"||s==="compute")&&this.isUnfilterable(e.value)===!1&&d.store===!1){const p=new UA(`${r.name}_sampler`,r.node,u);p.setVisibility(Br[s]),l.push(p,d),a=[p,d]}else l.push(d),a=[d]}else if(t==="buffer"||t==="storageBuffer"||t==="indirectStorageBuffer"){const d=t==="buffer"?yg:LA,h=new d(e,u);h.setVisibility(Br[s]),l.push(h),a=h}else{const d=this.uniformGroups[s]||(this.uniformGroups[s]={});let h=d[c];h===void 0&&(h=new xg(c,u),h.setVisibility(Br[s]),d[c]=h,l.push(h)),a=this.getNodeUniform(r,t),h.addUniform(a)}i.uniformGPU=a}return r}getBuiltin(e,t,s,n=this.shaderStage){const r=this.builtins[n]||(this.builtins[n]=new Map);return r.has(e)===!1&&r.set(e,{name:e,property:t,type:s}),t}hasBuiltin(e,t=this.shaderStage){return this.builtins[t]!==void 0&&this.builtins[t].has(e)}getVertexIndex(){return this.shaderStage==="vertex"?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){const t=e.layout,s=this.flowShaderNode(e),n=[];for(const i of t.inputs)n.push(i.name+" : "+this.getType(i.type));let r=`fn ${t.name}( ${n.join(", ")} ) -> ${this.getType(t.type)} { -${s.vars} -${s.code} -`;return s.result&&(r+=` return ${s.result}; -`),r+=` -} -`,r}getInstanceIndex(){return this.shaderStage==="vertex"?this.getBuiltin("instance_index","instanceIndex","u32","attribute"):"instanceIndex"}getInvocationLocalIndex(){return this.getBuiltin("local_invocation_index","invocationLocalIndex","u32","attribute")}getSubgroupSize(){return this.enableSubGroups(),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute")}getInvocationSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_invocation_id","invocationSubgroupIndex","u32","attribute")}getSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_id","subgroupIndex","u32","attribute")}getDrawIndex(){return null}getFrontFacing(){return this.getBuiltin("front_facing","isFront","bool")}getFragCoord(){return this.getBuiltin("position","fragCoord","vec4")+".xy"}getFragDepth(){return"output."+this.getBuiltin("frag_depth","depth","f32","output")}getClipDistance(){return"varyings.hw_clip_distances"}isFlipY(){return!1}enableDirective(e,t=this.shaderStage){(this.directives[t]||(this.directives[t]=new Set)).add(e)}getDirectives(e){const t=[],s=this.directives[e];if(s!==void 0)for(const n of s)t.push(`enable ${n};`);return t.join(` -`)}enableSubGroups(){this.enableDirective("subgroups")}enableSubgroupsF16(){this.enableDirective("subgroups-f16")}enableClipDistances(){this.enableDirective("clip_distances")}enableShaderF16(){this.enableDirective("f16")}enableDualSourceBlending(){this.enableDirective("dual_source_blending")}enableHardwareClipping(e){this.enableClipDistances(),this.getBuiltin("clip_distances","hw_clip_distances",`array`,"vertex")}getBuiltins(e){const t=[],s=this.builtins[e];if(s!==void 0)for(const{name:n,property:r,type:i}of s.values())t.push(`@builtin( ${n} ) ${r} : ${i}`);return t.join(`, - `)}getScopedArray(e,t,s,n){return this.scopedArrays.has(e)===!1&&this.scopedArrays.set(e,{name:e,scope:t,bufferType:s,bufferCount:n}),e}getScopedArrays(e){if(e!=="compute")return;const t=[];for(const{name:s,scope:n,bufferType:r,bufferCount:i}of this.scopedArrays.values()){const a=this.getType(r);t.push(`var<${n}> ${s}: array< ${a}, ${i} >;`)}return t.join(` -`)}getAttributes(e){const t=[];if(e==="compute"&&(this.getBuiltin("global_invocation_id","id","vec3","attribute"),this.getBuiltin("workgroup_id","workgroupId","vec3","attribute"),this.getBuiltin("local_invocation_id","localId","vec3","attribute"),this.getBuiltin("num_workgroups","numWorkgroups","vec3","attribute"),this.renderer.hasFeature("subgroups")&&(this.enableDirective("subgroups",e),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute"))),e==="vertex"||e==="compute"){const s=this.getBuiltins("attribute");s&&t.push(s);const n=this.getAttributesArray();for(let r=0,i=n.length;r`)}const n=this.getBuiltins("output");return n&&t.push(" "+n),t.join(`, -`)}getStructs(e){const t=[],s=this.structs[e];for(let n=0,r=s.length;n output : ${a}; - -`)}return t.join(` - -`)}getVar(e,t){return`var ${t} : ${this.getType(e)}`}getVars(e){const t=[],s=this.vars[e];if(s!==void 0)for(const n of s)t.push(` ${this.getVar(n.type,n.name)};`);return` -${t.join(` -`)} -`}getVaryings(e){const t=[];if(e==="vertex"&&this.getBuiltin("position","Vertex","vec4","vertex"),e==="vertex"||e==="fragment"){const r=this.varyings,i=this.vars[e];for(let a=0;a1&&(p="_multisampled"),d.isCubeTexture===!0)h="texture_cube";else if(d.isDataArrayTexture===!0||d.isCompressedArrayTexture===!0)h="texture_2d_array";else if(d.isDepthTexture===!0)h=`texture_depth${p}_2d`;else if(d.isVideoTexture===!0)h="texture_external";else if(d.isData3DTexture===!0)h="texture_3d";else if(u.node.isStorageTextureNode===!0){const m=ia(d),x=this.getStorageAccess(u.node,e);h=`texture_storage_2d<${m}, ${x}>`}else{const m=this.getComponentTypeFromTexture(d).charAt(0);h=`texture${p}_2d<${m}32>`}s.push(`@binding( ${l.binding++} ) @group( ${l.group} ) var ${u.name} : ${h};`)}else if(u.type==="buffer"||u.type==="storageBuffer"||u.type==="indirectStorageBuffer"){const d=u.node,h=this.getType(d.bufferType),p=d.bufferCount,f=p>0&&u.type==="buffer"?", "+p:"",m=d.isAtomic?`atomic<${h}>`:`${h}`,x=` ${u.name} : array< ${m}${f} > -`,N=d.isStorageBufferNode?`storage, ${this.getStorageAccess(d,e)}`:"uniform";n.push(this._getWGSLStructBinding("NodeBuffer_"+d.id,x,N,l.binding++,l.group))}else{const d=this.getType(this.getVectorType(u.type)),h=u.groupNode.name;(i[h]||(i[h]={index:l.binding++,id:l.group,snippets:[]})).snippets.push(` ${u.name} : ${d}`)}}for(const u in i){const c=i[u];r.push(this._getWGSLStructBinding(u,c.snippets.join(`, -`),"uniform",c.index,c.id))}let a=s.join(` -`);return a+=n.join(` -`),a+=r.join(` -`),a}buildCode(){const e=this.material!==null?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(const t in e){const s=e[t];s.uniforms=this.getUniforms(t),s.attributes=this.getAttributes(t),s.varyings=this.getVaryings(t),s.structs=this.getStructs(t),s.vars=this.getVars(t),s.codes=this.getCodes(t),s.directives=this.getDirectives(t),s.scopedArrays=this.getScopedArrays(t);let n=`// code - -`;n+=this.flowCode[t];const r=this.flowNodes[t],i=r[r.length-1],a=i.outputNode,u=a!==void 0&&a.isOutputStructNode===!0;for(const c of r){const l=this.getFlowData(c),d=c.name;if(d&&(n.length>0&&(n+=` -`),n+=` // flow -> ${d} - `),n+=`${l.code} - `,c===i&&t!=="compute"){if(n+=`// result - - `,t==="vertex")n+=`varyings.Vertex = ${l.result};`;else if(t==="fragment")if(u)s.returnType=a.nodeType,n+=`return ${l.result};`;else{let h=" @location(0) color: vec4";const p=this.getBuiltins("output");p&&(h+=`, - `+p),s.returnType="OutputStruct",s.structs+=this._getWGSLStruct("OutputStruct",h),s.structs+=` -var output : OutputStruct; - -`,n+=`output.color = ${l.result}; - - return output;`}}}s.flow=n}this.material!==null?(this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment)):this.computeShader=this._getWGSLComputeCode(e.compute,(this.object.workgroupSize||[64]).join(", "))}getMethod(e,t=null){let s;return t!==null&&(s=this._getWGSLMethod(e+"_"+t)),s===void 0&&(s=this._getWGSLMethod(e)),s||e}getType(e){return XA[e]||e}isAvailable(e){let t=ul[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),ul[e]=t),t}_getWGSLMethod(e){return it[e]!==void 0&&this._include(e),vn[e]}_include(e){const t=it[e];return t.build(this),this.currentFunctionNode!==null&&this.currentFunctionNode.includes.push(t),t}_getWGSLVertexCode(e){return`${this.getSignature()} -// directives -${e.directives} - -// uniforms -${e.uniforms} - -// varyings -${e.varyings} -var varyings : VaryingsStruct; - -// codes -${e.codes} - -@vertex -fn main( ${e.attributes} ) -> VaryingsStruct { - - // vars - ${e.vars} - - // flow - ${e.flow} - - return varyings; - -} -`}_getWGSLFragmentCode(e){return`${this.getSignature()} -// global -${Ng} - -// uniforms -${e.uniforms} - -// structs -${e.structs} - -// codes -${e.codes} - -@fragment -fn main( ${e.varyings} ) -> ${e.returnType} { - - // vars - ${e.vars} - - // flow - ${e.flow} - -} -`}_getWGSLComputeCode(e,t){return`${this.getSignature()} -// directives -${e.directives} - -// system -var instanceIndex : u32; - -// locals -${e.scopedArrays} - -// uniforms -${e.uniforms} - -// codes -${e.codes} - -@compute @workgroup_size( ${t} ) -fn main( ${e.attributes} ) { - - // system - instanceIndex = id.x + id.y * numWorkgroups.x * u32(${t}) + id.z * numWorkgroups.x * numWorkgroups.y * u32(${t}); - - // vars - ${e.vars} - - // flow - ${e.flow} - -} -`}_getWGSLStruct(e,t){return` -struct ${e} { -${t} -};`}_getWGSLStructBinding(e,t,s,n=0,r=0){const i=e+"Struct";return`${this._getWGSLStruct(i,t)} -@binding( ${n} ) @group( ${r} ) -var<${s}> ${e} : ${i};`}}class jA{constructor(e){this.backend=e}getCurrentDepthStencilFormat(e){let t;return e.depthTexture!==null?t=this.getTextureFormatGPU(e.depthTexture):e.depth&&e.stencil?t=_.Depth24PlusStencil8:e.depth&&(t=_.Depth24Plus),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){const r=this.backend.renderer,i=r.getRenderTarget();t=i?i.samples:r.samples}else e.renderTarget&&(t=e.renderTarget.samples);t=t||1;const s=t>1&&e.renderTarget!==null&&e.isDepthTexture!==!0&&e.isFramebufferTexture!==!0;return{samples:t,primarySamples:s?1:t,isMSAA:s}}getCurrentColorFormat(e){let t;return e.textures!==null?t=this.getTextureFormatGPU(e.textures[0]):t=this.getPreferredCanvasFormat(),t}getCurrentColorSpace(e){return e.textures!==null?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){if(e.isPoints)return Ks.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return Ks.LineList;if(e.isLine)return Ks.LineStrip;if(e.isMesh)return Ks.TriangleList}getSampleCount(e){let t=1;return e>1&&(t=Math.pow(2,Math.floor(Math.log2(e))),t===2&&(t=4)),t}getSampleCountRenderContext(e){return e.textures!==null?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.samples)}getPreferredCanvasFormat(){return navigator.userAgent.includes("Quest")?_.BGRA8Unorm:navigator.gpu.getPreferredCanvasFormat()}}const QA=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]),ZA=new Map([[yl,["float16"]]]),JA=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]);class eR{constructor(e){this.backend=e}createAttribute(e,t){const s=this._getBufferAttribute(e),n=this.backend,r=n.get(s);let i=r.buffer;if(i===void 0){const a=n.device;let u=s.array;if(e.normalized===!1&&(u.constructor===Int16Array||u.constructor===Uint16Array)){const l=new Uint32Array(u.length);for(let d=0;d1&&(u.multisampled=!0,i.texture.isDepthTexture||(u.sampleType=Is.UnfilterableFloat)),i.texture.isDepthTexture)u.sampleType=Is.Depth;else if(i.texture.isDataTexture||i.texture.isDataArrayTexture||i.texture.isData3DTexture){const l=i.texture.type;l===ze?u.sampleType=Is.SInt:l===Le?u.sampleType=Is.UInt:l===ot&&(this.backend.hasFeature("float32-filterable")?u.sampleType=Is.Float:u.sampleType=Is.UnfilterableFloat)}i.isSampledCubeTexture?u.viewDimension=$e.Cube:i.texture.isDataArrayTexture||i.texture.isCompressedArrayTexture?u.viewDimension=$e.TwoDArray:i.isSampledTexture3D&&(u.viewDimension=$e.ThreeD),a.texture=u}else console.error(`WebGPUBindingUtils: Unsupported binding "${i}".`);n.push(a)}return s.createBindGroupLayout({entries:n})}createBindings(e,t,s,n=0){const{backend:r,bindGroupLayoutCache:i}=this,a=r.get(e);let u=i.get(e.bindingsReference);u===void 0&&(u=this.createBindingsLayout(e),i.set(e.bindingsReference,u));let c;s>0&&(a.groups===void 0&&(a.groups=[],a.versions=[]),a.versions[s]===n&&(c=a.groups[s])),c===void 0&&(c=this.createBindGroup(e,u),s>0&&(a.groups[s]=c,a.versions[s]=n)),a.group=c,a.layout=u}updateBinding(e){const t=this.backend,s=t.device,n=e.buffer,r=t.get(e).buffer;s.queue.writeBuffer(r,0,n,0)}createBindGroup(e,t){const s=this.backend,n=s.device;let r=0;const i=[];for(const a of e.bindings){if(a.isUniformBuffer){const u=s.get(a);if(u.buffer===void 0){const c=a.byteLength,l=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,d=n.createBuffer({label:"bindingBuffer_"+a.name,size:c,usage:l});u.buffer=d}i.push({binding:r,resource:{buffer:u.buffer}})}else if(a.isStorageBuffer){const u=s.get(a);if(u.buffer===void 0){const c=a.attribute;u.buffer=s.get(c).buffer}i.push({binding:r,resource:{buffer:u.buffer}})}else if(a.isSampler){const u=s.get(a.texture);i.push({binding:r,resource:u.sampler})}else if(a.isSampledTexture){const u=s.get(a.texture);let c;if(u.externalTexture!==void 0)c=n.importExternalTexture({source:u.externalTexture});else{const l=a.store?1:u.texture.mipLevelCount,d=`view-${u.texture.width}-${u.texture.height}-${l}`;if(c=u[d],c===void 0){const h=BA.All;let p;a.isSampledCubeTexture?p=$e.Cube:a.isSampledTexture3D?p=$e.ThreeD:a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?p=$e.TwoDArray:p=$e.TwoD,c=u[d]=u.texture.createView({aspect:h,dimension:p,mipLevelCount:l})}}i.push({binding:r,resource:c})}r++}return n.createBindGroup({label:"bindGroup_"+e.name,layout:t,entries:i})}}class sR{constructor(e){this.backend=e}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){const{object:s,material:n,geometry:r,pipeline:i}=e,{vertexProgram:a,fragmentProgram:u}=i,c=this.backend,l=c.device,d=c.utils,h=c.get(i),p=[];for(const Ze of e.getBindings()){const Dt=c.get(Ze);p.push(Dt.layout)}const f=c.attributeUtils.createShaderVertexBuffers(e);let m;n.transparent===!0&&n.blending!==en&&(m=this._getBlending(n));let x={};n.stencilWrite===!0&&(x={compare:this._getStencilCompare(n),failOp:this._getStencilOperation(n.stencilFail),depthFailOp:this._getStencilOperation(n.stencilZFail),passOp:this._getStencilOperation(n.stencilZPass)});const N=this._getColorWriteMask(n),v=[];if(e.context.textures!==null){const Ze=e.context.textures;for(let Dt=0;Dt1},layout:l.createPipelineLayout({bindGroupLayouts:p})},ie={},Z=e.context.depth,Qe=e.context.stencil;if((Z===!0||Qe===!0)&&(Z===!0&&(ie.format=I,ie.depthWriteEnabled=n.depthWrite,ie.depthCompare=L),Qe===!0&&(ie.stencilFront=x,ie.stencilBack={},ie.stencilReadMask=n.stencilFuncMask,ie.stencilWriteMask=n.stencilWriteMask),X.depthStencil=ie),t===null)h.pipeline=l.createRenderPipeline(X);else{const Ze=new Promise(Dt=>{l.createRenderPipelineAsync(X).then(Ms=>{h.pipeline=Ms,Dt()})});t.push(Ze)}}createBundleEncoder(e){const t=this.backend,{utils:s,device:n}=t,r=s.getCurrentDepthStencilFormat(e),i=s.getCurrentColorFormat(e),a=this._getSampleCount(e),u={label:"renderBundleEncoder",colorFormats:[i],depthStencilFormat:r,sampleCount:a};return n.createRenderBundleEncoder(u)}createComputePipeline(e,t){const s=this.backend,n=s.device,r=s.get(e.computeProgram).module,i=s.get(e),a=[];for(const u of t){const c=s.get(u);a.push(c.layout)}i.pipeline=n.createComputePipeline({compute:r,layout:n.createPipelineLayout({bindGroupLayouts:a})})}_getBlending(e){let t,s;const n=e.blending,r=e.blendSrc,i=e.blendDst,a=e.blendEquation;if(n===Hl){const u=e.blendSrcAlpha!==null?e.blendSrcAlpha:r,c=e.blendDstAlpha!==null?e.blendDstAlpha:i,l=e.blendEquationAlpha!==null?e.blendEquationAlpha:a;t={srcFactor:this._getBlendFactor(r),dstFactor:this._getBlendFactor(i),operation:this._getBlendOperation(a)},s={srcFactor:this._getBlendFactor(u),dstFactor:this._getBlendFactor(c),operation:this._getBlendOperation(l)}}else{const u=e.premultipliedAlpha,c=(l,d,h,p)=>{t={srcFactor:l,dstFactor:d,operation:ls.Add},s={srcFactor:h,dstFactor:p,operation:ls.Add}};if(u)switch(n){case Ys:c(H.One,H.OneMinusSrcAlpha,H.One,H.OneMinusSrcAlpha);break;case qr:c(H.One,H.One,H.One,H.One);break;case Hr:c(H.Zero,H.OneMinusSrc,H.Zero,H.One);break;case $r:c(H.Zero,H.Src,H.Zero,H.SrcAlpha);break}else switch(n){case Ys:c(H.SrcAlpha,H.OneMinusSrcAlpha,H.One,H.OneMinusSrcAlpha);break;case qr:c(H.SrcAlpha,H.One,H.SrcAlpha,H.One);break;case Hr:c(H.Zero,H.OneMinusSrc,H.Zero,H.One);break;case $r:c(H.Zero,H.Src,H.Zero,H.Src);break}}if(t!==void 0&&s!==void 0)return{color:t,alpha:s};console.error("THREE.WebGPURenderer: Invalid blending: ",n)}_getBlendFactor(e){let t;switch(e){case $l:t=H.Zero;break;case Wl:t=H.One;break;case zl:t=H.Src;break;case Il:t=H.OneMinusSrc;break;case kl:t=H.SrcAlpha;break;case Ll:t=H.OneMinusSrcAlpha;break;case Gl:t=H.Dst;break;case Dl:t=H.OneMinusDstColor;break;case Vl:t=H.DstAlpha;break;case Pl:t=H.OneMinusDstAlpha;break;case Ol:t=H.SrcAlphaSaturated;break;case __:t=H.Constant;break;case b_:t=H.OneMinusConstant;break;default:console.error("THREE.WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t;const s=e.stencilFunc;switch(s){case Im:t=Fe.Never;break;case Lm:t=Fe.Always;break;case Dm:t=Fe.Less;break;case Pm:t=Fe.LessEqual;break;case Um:t=Fe.Equal;break;case Fm:t=Fe.GreaterEqual;break;case Bm:t=Fe.Greater;break;case Mm:t=Fe.NotEqual;break;default:console.error("THREE.WebGPURenderer: Invalid stencil function.",s)}return t}_getStencilOperation(e){let t;switch(e){case Hm:t=Qt.Keep;break;case $m:t=Qt.Zero;break;case Wm:t=Qt.Replace;break;case zm:t=Qt.Invert;break;case km:t=Qt.IncrementClamp;break;case Om:t=Qt.DecrementClamp;break;case Gm:t=Qt.IncrementWrap;break;case Vm:t=Qt.DecrementWrap;break;default:console.error("THREE.WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case Gs:t=ls.Add;break;case Ul:t=ls.Subtract;break;case Fl:t=ls.ReverseSubtract;break;case Km:t=ls.Min;break;case qm:t=ls.Max;break;default:console.error("THREE.WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,s){const n={},r=this.backend.utils;switch(n.topology=r.getPrimitiveTopology(e,s),t.index!==null&&e.isLine===!0&&e.isLineSegments!==!0&&(n.stripIndexFormat=t.index.array instanceof Uint16Array?cn.Uint16:cn.Uint32),s.side){case No:n.frontFace=go.CCW,n.cullMode=mo.Back;break;case Ct:n.frontFace=go.CCW,n.cullMode=mo.Front;break;case js:n.frontFace=go.CCW,n.cullMode=mo.None;break;default:console.error("THREE.WebGPUPipelineUtils: Unknown material.side value.",s.side);break}return n}_getColorWriteMask(e){return e.colorWrite===!0?rl.All:rl.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=Fe.Always;else{const s=e.depthFunc;switch(s){case Jl:t=Fe.Never;break;case Zl:t=Fe.Always;break;case Ql:t=Fe.Less;break;case jl:t=Fe.LessEqual;break;case Yl:t=Fe.Equal;break;case Xl:t=Fe.GreaterEqual;break;case Kl:t=Fe.Greater;break;case ql:t=Fe.NotEqual;break;default:console.error("THREE.WebGPUPipelineUtils: Invalid depth function.",s)}}return t}}class nR extends bg{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=e.alpha===void 0?!0:e.alpha,this.parameters.requiredLimits=e.requiredLimits===void 0?{}:e.requiredLimits,this.trackTimestamp=e.trackTimestamp===!0,this.device=null,this.context=null,this.colorBuffer=null,this.defaultRenderPassdescriptor=null,this.utils=new jA(this),this.attributeUtils=new eR(this),this.bindingUtils=new tR(this),this.pipelineUtils=new sR(this),this.textureUtils=new OA(this),this.occludedResolveCache=new Map}async init(e){await super.init(e);const t=this.parameters;let s;if(t.device===void 0){const i={powerPreference:t.powerPreference},a=typeof navigator<"u"?await navigator.gpu.requestAdapter(i):null;if(a===null)throw new Error("WebGPUBackend: Unable to create WebGPU adapter.");const u=Object.values(ra),c=[];for(const d of u)a.features.has(d)&&c.push(d);const l={requiredFeatures:c,requiredLimits:t.requiredLimits};s=await a.requestDevice(l)}else s=t.device;s.lost.then(i=>{const a={api:"WebGPU",message:i.message||"Unknown reason",reason:i.reason||null,originalEvent:i};e.onDeviceLost(a)});const n=t.context!==void 0?t.context:e.domElement.getContext("webgpu");this.device=s,this.context=n;const r=t.alpha?"premultiplied":"opaque";this.trackTimestamp=this.trackTimestamp&&this.hasFeature(ra.TimestampQuery),this.context.configure({device:this.device,format:this.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:r}),this.updateSize()}get coordinateSystem(){return ln}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){let e=this.defaultRenderPassdescriptor;if(e===null){const s=this.renderer;e={colorAttachments:[{view:null}]},(this.renderer.depth===!0||this.renderer.stencil===!0)&&(e.depthStencilAttachment={view:this.textureUtils.getDepthBuffer(s.depth,s.stencil).createView()});const n=e.colorAttachments[0];this.renderer.samples>0?n.view=this.colorBuffer.createView():n.resolveTarget=void 0,this.defaultRenderPassdescriptor=e}const t=e.colorAttachments[0];return this.renderer.samples>0?t.resolveTarget=this.context.getCurrentTexture().createView():t.view=this.context.getCurrentTexture().createView(),e}_getRenderPassDescriptor(e,t={}){const s=e.renderTarget,n=this.get(s);let r=n.descriptors;if(r===void 0||n.width!==s.width||n.height!==s.height||n.dimensions!==s.dimensions||n.activeMipmapLevel!==s.activeMipmapLevel||n.activeCubeFace!==e.activeCubeFace||n.samples!==s.samples||n.loadOp!==t.loadOp){r={},n.descriptors=r;const u=()=>{s.removeEventListener("dispose",u),this.delete(s)};s.addEventListener("dispose",u)}const i=e.getCacheKey();let a=r[i];if(a===void 0){const u=e.textures,c=[];let l;for(let d=0;d0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,r=s.createQuerySet({type:"occlusion",count:n,label:`occlusionQuerySet_${e.id}`}),t.occlusionQuerySet=r,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(n),t.lastOcclusionObject=null);let i;e.textures===null?i=this._getDefaultRenderPassDescriptor():i=this._getRenderPassDescriptor(e,{loadOp:ye.Load}),this.initTimestampQuery(e,i),i.occlusionQuerySet=r;const a=i.depthStencilAttachment;if(e.textures!==null){const l=i.colorAttachments;for(let d=0;d0&&t.currentPass.executeBundles(t.renderBundles),s>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery(),t.currentPass.end(),s>0){const n=s*8;let r=this.occludedResolveCache.get(n);r===void 0&&(r=this.device.createBuffer({size:n,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.occludedResolveCache.set(n,r));const i=this.device.createBuffer({size:n,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});t.encoder.resolveQuerySet(t.occlusionQuerySet,0,s,r,0),t.encoder.copyBufferToBuffer(r,0,i,0,n),t.occlusionQueryBuffer=i,this.resolveOccludedAsync(e)}if(this.prepareTimestampBuffer(e,t.encoder),this.device.queue.submit([t.encoder.finish()]),e.textures!==null){const n=e.textures;for(let r=0;ra?(c.x=Math.min(t.dispatchCount,a),c.y=Math.ceil(t.dispatchCount/a)):c.x=t.dispatchCount,r.dispatchWorkgroups(c.x,c.y,c.z)}finishCompute(e){const t=this.get(e);t.passEncoderGPU.end(),this.prepareTimestampBuffer(e,t.cmdEncoderGPU),this.device.queue.submit([t.cmdEncoderGPU.finish()])}async waitForGPU(){await this.device.queue.onSubmittedWorkDone()}draw(e,t){const{object:s,context:n,pipeline:r}=e,i=e.getBindings(),a=this.get(n),u=this.get(r).pipeline,c=a.currentSets,l=a.currentPass,d=e.getDrawParameters();if(d===null)return;c.pipeline!==u&&(l.setPipeline(u),c.pipeline=u);const h=c.bindingGroups;for(let x=0,N=i.length;x1?0:B;f===!0?l.drawIndexed(N[B],F,x[B]/p.array.BYTES_PER_ELEMENT,0,L):l.draw(N[B],F,x[B],L)}}else if(f===!0){const{vertexCount:x,instanceCount:N,firstVertex:v}=d,w=e.getIndirect();if(w!==null){const B=this.get(w).buffer;l.drawIndexedIndirect(B,0)}else l.drawIndexed(x,N,v,0,0);t.update(s,x,N)}else{const{vertexCount:x,instanceCount:N,firstVertex:v}=d,w=e.getIndirect();if(w!==null){const B=this.get(w).buffer;l.drawIndirect(B,0)}else l.draw(x,N,v,0);t.update(s,x,N)}}needsRenderUpdate(e){const t=this.get(e),{object:s,material:n}=e,r=this.utils,i=r.getSampleCountRenderContext(e.context),a=r.getCurrentColorSpace(e.context),u=r.getCurrentColorFormat(e.context),c=r.getCurrentDepthStencilFormat(e.context),l=r.getPrimitiveTopology(s,n);let d=!1;return(t.material!==n||t.materialVersion!==n.version||t.transparent!==n.transparent||t.blending!==n.blending||t.premultipliedAlpha!==n.premultipliedAlpha||t.blendSrc!==n.blendSrc||t.blendDst!==n.blendDst||t.blendEquation!==n.blendEquation||t.blendSrcAlpha!==n.blendSrcAlpha||t.blendDstAlpha!==n.blendDstAlpha||t.blendEquationAlpha!==n.blendEquationAlpha||t.colorWrite!==n.colorWrite||t.depthWrite!==n.depthWrite||t.depthTest!==n.depthTest||t.depthFunc!==n.depthFunc||t.stencilWrite!==n.stencilWrite||t.stencilFunc!==n.stencilFunc||t.stencilFail!==n.stencilFail||t.stencilZFail!==n.stencilZFail||t.stencilZPass!==n.stencilZPass||t.stencilFuncMask!==n.stencilFuncMask||t.stencilWriteMask!==n.stencilWriteMask||t.side!==n.side||t.alphaToCoverage!==n.alphaToCoverage||t.sampleCount!==i||t.colorSpace!==a||t.colorFormat!==u||t.depthStencilFormat!==c||t.primitiveTopology!==l||t.clippingContextCacheKey!==e.clippingContextCacheKey)&&(t.material=n,t.materialVersion=n.version,t.transparent=n.transparent,t.blending=n.blending,t.premultipliedAlpha=n.premultipliedAlpha,t.blendSrc=n.blendSrc,t.blendDst=n.blendDst,t.blendEquation=n.blendEquation,t.blendSrcAlpha=n.blendSrcAlpha,t.blendDstAlpha=n.blendDstAlpha,t.blendEquationAlpha=n.blendEquationAlpha,t.colorWrite=n.colorWrite,t.depthWrite=n.depthWrite,t.depthTest=n.depthTest,t.depthFunc=n.depthFunc,t.stencilWrite=n.stencilWrite,t.stencilFunc=n.stencilFunc,t.stencilFail=n.stencilFail,t.stencilZFail=n.stencilZFail,t.stencilZPass=n.stencilZPass,t.stencilFuncMask=n.stencilFuncMask,t.stencilWriteMask=n.stencilWriteMask,t.side=n.side,t.alphaToCoverage=n.alphaToCoverage,t.sampleCount=i,t.colorSpace=a,t.colorFormat=u,t.depthStencilFormat=c,t.primitiveTopology=l,t.clippingContextCacheKey=e.clippingContextCacheKey,d=!0),d}getRenderCacheKey(e){const{object:t,material:s}=e,n=this.utils,r=e.context;return[s.transparent,s.blending,s.premultipliedAlpha,s.blendSrc,s.blendDst,s.blendEquation,s.blendSrcAlpha,s.blendDstAlpha,s.blendEquationAlpha,s.colorWrite,s.depthWrite,s.depthTest,s.depthFunc,s.stencilWrite,s.stencilFunc,s.stencilFail,s.stencilZFail,s.stencilZPass,s.stencilFuncMask,s.stencilWriteMask,s.side,n.getSampleCountRenderContext(r),n.getCurrentColorSpace(r),n.getCurrentColorFormat(r),n.getCurrentDepthStencilFormat(r),n.getPrimitiveTopology(t,s),e.getGeometryCacheKey(),e.clippingContextCacheKey].join()}createSampler(e){this.textureUtils.createSampler(e)}destroySampler(e){this.textureUtils.destroySampler(e)}createDefaultTexture(e){this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e){this.textureUtils.destroyTexture(e)}copyTextureToBuffer(e,t,s,n,r,i){return this.textureUtils.copyTextureToBuffer(e,t,s,n,r,i)}initTimestampQuery(e,t){if(!this.trackTimestamp)return;const s=this.get(e);if(!s.timeStampQuerySet){const n=e.isComputeNode?"compute":"render",r=this.device.createQuerySet({type:"timestamp",count:2,label:`timestamp_${n}_${e.id}`});Object.assign(t,{timestampWrites:{querySet:r,beginningOfPassWriteIndex:0,endOfPassWriteIndex:1}}),s.timeStampQuerySet=r}}prepareTimestampBuffer(e,t){if(!this.trackTimestamp)return;const s=this.get(e),n=2*BigInt64Array.BYTES_PER_ELEMENT;s.currentTimestampQueryBuffers===void 0&&(s.currentTimestampQueryBuffers={resolveBuffer:this.device.createBuffer({label:"timestamp resolve buffer",size:n,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),resultBuffer:this.device.createBuffer({label:"timestamp result buffer",size:n,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ})});const{resolveBuffer:r,resultBuffer:i}=s.currentTimestampQueryBuffers;t.resolveQuerySet(s.timeStampQuerySet,0,2,r,0),i.mapState==="unmapped"&&t.copyBufferToBuffer(r,0,i,0,n)}async resolveTimestampAsync(e,t="render"){if(!this.trackTimestamp)return;const s=this.get(e);if(s.currentTimestampQueryBuffers===void 0)return;const{resultBuffer:n}=s.currentTimestampQueryBuffers;n.mapState==="unmapped"&&n.mapAsync(GPUMapMode.READ).then(()=>{const r=new BigUint64Array(n.getMappedRange()),i=Number(r[1]-r[0])/1e6;this.renderer.info.updateTimestamp(t,i),n.unmap()})}createNodeBuilder(e,t){return new YA(e,t)}createProgram(e){const t=this.get(e);t.module={module:this.device.createShaderModule({code:e.code,label:e.stage+(e.name!==""?`_${e.name}`:"")}),entryPoint:"main"}}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){this.pipelineUtils.createRenderPipeline(e,t)}createComputePipeline(e,t){this.pipelineUtils.createComputePipeline(e,t)}beginBundle(e){const t=this.get(e);t._currentPass=t.currentPass,t._currentSets=t.currentSets,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.currentPass=this.pipelineUtils.createBundleEncoder(e)}finishBundle(e,t){const s=this.get(e),r=s.currentPass.finish();this.get(t).bundleGPU=r,s.currentSets=s._currentSets,s.currentPass=s._currentPass}addBundle(e,t){this.get(e).renderBundles.push(this.get(t).bundleGPU)}createBindings(e,t,s,n){this.bindingUtils.createBindings(e,t,s,n)}updateBindings(e,t,s,n){this.bindingUtils.createBindings(e,t,s,n)}updateBinding(e){this.bindingUtils.updateBinding(e)}createIndexAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.INDEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createIndirectStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.INDIRECT|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}updateSize(){this.colorBuffer=this.textureUtils.getColorBuffer(),this.defaultRenderPassdescriptor=null}getMaxAnisotropy(){return 16}hasFeature(e){return this.device.features.has(e)}copyTextureToTexture(e,t,s=null,n=null,r=0){let i=0,a=0,u=0,c=0,l=0,d=0,h=e.image.width,p=e.image.height;s!==null&&(c=s.x,l=s.y,d=s.z||0,h=s.width,p=s.height),n!==null&&(i=n.x,a=n.y,u=n.z||0);const f=this.device.createCommandEncoder({label:"copyTextureToTexture_"+e.id+"_"+t.id}),m=this.get(e).texture,x=this.get(t).texture;f.copyTextureToTexture({texture:m,mipLevel:r,origin:{x:c,y:l,z:d}},{texture:x,mipLevel:r,origin:{x:i,y:a,z:u}},[h,p,1]),this.device.queue.submit([f.finish()])}copyFramebufferToTexture(e,t,s){const n=this.get(t);let r=null;t.renderTarget?e.isDepthTexture?r=this.get(t.depthTexture).texture:r=this.get(t.textures[0]).texture:e.isDepthTexture?r=this.textureUtils.getDepthBuffer(t.depth,t.stencil):r=this.context.getCurrentTexture();const i=this.get(e).texture;if(r.format!==i.format){console.error("WebGPUBackend: copyFramebufferToTexture: Source and destination formats do not match.",r.format,i.format);return}let a;if(n.currentPass?(n.currentPass.end(),a=n.encoder):a=this.device.createCommandEncoder({label:"copyFramebufferToTexture_"+e.id}),a.copyTextureToTexture({texture:r,origin:[s.x,s.y,0]},{texture:i},[s.z,s.w]),e.generateMipmaps&&this.textureUtils.generateMipmaps(e),n.currentPass){const{descriptor:u}=n;for(let c=0;c(console.warn("THREE.WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new nl(e)));const s=new t(e);super(s,e),this.library=new iR,this.isWebGPURenderer=!0}}class xR extends ll{constructor(){super(),this.isBundleGroup=!0,this.type="BundleGroup",this.static=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}}const Sg=new ce,Fr=new Mi(Sg);class TR{constructor(e,t=P(0,0,1,1)){this.renderer=e,this.outputNode=t,this.outputColorTransform=!0,this.needsUpdate=!0,Sg.name="PostProcessing"}render(){this._update();const e=this.renderer,t=e.toneMapping,s=e.outputColorSpace;e.toneMapping=ss,e.outputColorSpace=kt,Fr.render(e),e.toneMapping=t,e.outputColorSpace=s}_update(){if(this.needsUpdate===!0){const e=this.renderer,t=e.toneMapping,s=e.outputColorSpace;Fr.material.fragmentNode=this.outputColorTransform===!0?tu(this.outputNode,t,s):this.outputNode.context({toneMapping:t,outputColorSpace:s}),Fr.material.needsUpdate=!0,this.needsUpdate=!1}}async renderAsync(){this._update();const e=this.renderer,t=e.toneMapping,s=e.outputColorSpace;e.toneMapping=ss,e.outputColorSpace=kt,await Fr.renderAsync(e),e.toneMapping=t,e.outputColorSpace=s}}class _R extends aa{constructor(e=1,t=1){super(),this.image={width:e,height:t},this.magFilter=ft,this.minFilter=ft,this.isStorageTexture=!0}}class bR extends xf{constructor(e,t){super(e,t,Uint32Array),this.isIndirectStorageBufferAttribute=!0}}class oR extends Lg{constructor(e){super(e),this.textures={},this.nodes={}}load(e,t,s,n){const r=new Ig(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,i=>{try{t(this.parse(JSON.parse(i)))}catch(a){n?n(a):console.error(a),this.manager.itemError(e)}},s,n)}parseNodes(e){const t={};if(e!==void 0){for(const n of e){const{uuid:r,type:i}=n;t[r]=this.createNodeFromType(i),t[r].uuid=r}const s={nodes:t,textures:this.textures};for(const n of e)n.meta=s,t[n.uuid].deserialize(n),delete n.meta}return t}parse(e){const t=this.createNodeFromType(e.type);t.uuid=e.uuid;const n={nodes:this.parseNodes(e.nodes),textures:this.textures};return e.meta=n,t.deserialize(e),delete e.meta,t}setTextures(e){return this.textures=e,this}setNodes(e){return this.nodes=e,this}createNodeFromType(e){return this.nodes[e]===void 0?(console.error("THREE.NodeLoader: Node type not found:",e),g()):E(new this.nodes[e])}}class aR extends Vg{constructor(e){super(e),this.nodes={},this.nodeMaterials={}}parse(e){const t=super.parse(e),s=this.nodes,n=e.inputNodes;for(const r in n){const i=n[r];t[r]=s[i]}return t}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}createMaterialFromType(e){const t=this.nodeMaterials[e];return t!==void 0?new t:super.createMaterialFromType(e)}}class NR extends Gg{constructor(e){super(e),this.nodes={},this.nodeMaterials={},this._nodesJSON=null}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}parse(e,t){this._nodesJSON=e.nodes;const s=super.parse(e,t);return this._nodesJSON=null,s}parseNodes(e,t){if(e!==void 0){const s=new oR;return s.setNodes(this.nodes),s.setTextures(t),s.parseNodes(e)}return{}}parseMaterials(e,t){const s={};if(e!==void 0){const n=this.parseNodes(this._nodesJSON,t),r=new aR;r.setTextures(t),r.setNodes(n),r.setNodeMaterials(this.nodeMaterials);for(let i=0,a=e.length;i '),Ie=b(''),qe=b(''),ze=b(''),Ce=b(''),Le=b(' '),Se=b(''),Te=b(''),Fe=b('
'),Me=b('
');function Ne(te,s){ge(s,!0);let k=H(s,"value",15),K=H(s,"placeholder",3,"Select…"),ne=H(s,"class",3,""),o=C(!1),A=C(void 0),h=C(void 0),i=C(-1),T="",U,x=xe(()=>s.options.find(e=>e.value===k()));function W(e){var t,n;k(e.value),(t=s.onChange)==null||t.call(s,e.value),I(),(n=a(A))==null||n.focus()}function se(){a(o)?I():E()}function E(){c(o,!0),c(i,Math.max(0,s.options.findIndex(e=>e.value===k())),!0),requestAnimationFrame(()=>{var e,t;(t=(e=a(h))==null?void 0:e.querySelectorAll('[role="option"]')[a(i)])==null||t.scrollIntoView({block:"nearest"})})}function I(){c(o,!1),c(i,-1)}function le(e){if(e.key==="ArrowDown"||e.key==="Enter"||e.key===" ")e.preventDefault(),a(o)?B(1):E();else if(e.key==="ArrowUp")e.preventDefault(),a(o)?B(-1):E();else if(e.key==="Escape")I();else if(e.key==="Home"&&a(o))e.preventDefault(),c(i,0);else if(e.key==="End"&&a(o))e.preventDefault(),c(i,s.options.length-1);else if(a(o)&&e.key==="Enter"&&a(i)>=0)e.preventDefault(),W(s.options[a(i)]);else if(e.key.length===1&&/\S/.test(e.key)){a(o)||E(),clearTimeout(U),T+=e.key.toLowerCase(),U=setTimeout(()=>T="",600);const t=s.options.findIndex(n=>n.label.toLowerCase().startsWith(T));t>=0&&c(i,t,!0)}}function B(e){const t=s.options.length;c(i,(a(i)+e+t)%t),requestAnimationFrame(()=>{var n,l;(l=(n=a(h))==null?void 0:n.querySelectorAll('[role="option"]')[a(i)])==null||l.scrollIntoView({block:"nearest"})})}ke(()=>{if(!a(o))return;function e(t){var n,l;!((n=a(A))!=null&&n.contains(t.target))&&!((l=a(h))!=null&&l.contains(t.target))&&I()}return document.addEventListener("click",e,!0),()=>document.removeEventListener("click",e,!0)});var q=Me(),G=u(q);{var re=e=>{var t=Ee(),n=u(t,!0);v(t),g(()=>L(n,s.label)),f(e,t)};p(G,e=>{s.label&&e(re)})}var m=_(G,2);let J;var N=u(m);{var oe=e=>{var t=Ie(),n=u(t);S(n,{get name(){return s.icon},size:15}),v(t),f(e,t)};p(N,e=>{s.icon&&e(oe)})}var z=_(N,2);let O;var P=u(z);{var de=e=>{var t=qe();g(()=>ee(t,`background:${a(x).color??""}`)),f(e,t)};p(P,e=>{var t;(t=a(x))!=null&&t.color&&e(de)})}var ie=_(P);v(z);var F=_(z,2);let Q;var ve=u(F);S(ve,{name:"chevron",size:14}),v(F),v(m),ae(m,e=>c(A,e),()=>a(A));var ce=_(m,2);{var ue=e=>{var t=Fe();Ae(t,23,()=>s.options,n=>n.value,(n,l,R)=>{var y=Te();let X;var Y=u(y);{var fe=r=>{var d=ze(),w=u(d);S(w,{get name(){return a(l).icon},size:15}),v(d),f(r,d)};p(Y,r=>{a(l).icon&&r(fe)})}var Z=_(Y,2);{var be=r=>{var d=Ce();g(()=>ee(d,`background:${a(l).color??""}`)),f(r,d)};p(Z,r=>{a(l).color&&r(be)})}var M=_(Z,2),_e=u(M,!0);v(M);var $=_(M,2);{var me=r=>{var d=Le(),w=u(d,!0);v(d),g(()=>L(w,a(l).badge)),f(r,d)};p($,r=>{a(l).badge!==void 0&&r(me)})}var pe=_($,2);{var ye=r=>{var d=Se(),w=u(d);S(w,{name:"sparkle",size:12}),v(d),f(r,d)};p(pe,r=>{a(l).value===k()&&r(ye)})}v(y),g(()=>{j(y,"aria-selected",a(l).value===k()),X=D(y,1,"dd-option svelte-1fd3ybn",null,X,{"dd-active":a(R)===a(i),"dd-selected":a(l).value===k()}),L(_e,a(l).label)}),De("mouseenter",y,()=>c(i,a(R),!0)),V("click",y,()=>W(a(l))),f(n,y)}),v(t),ae(t,n=>c(h,n),()=>a(h)),g(()=>j(t,"aria-label",s.label??K())),f(e,t)};p(ce,e=>{a(o)&&e(ue)})}v(q),g(()=>{D(q,1,`dd ${ne()??""}`,"svelte-1fd3ybn"),J=D(m,1,"dd-trigger svelte-1fd3ybn",null,J,{"dd-open":a(o)}),j(m,"aria-expanded",a(o)),O=D(z,1,"dd-value svelte-1fd3ybn",null,O,{"dd-placeholder":!a(x)}),L(ie,` ${(a(x)?a(x).label:K())??""}`),Q=D(F,1,"dd-chevron svelte-1fd3ybn",null,Q,{"dd-chevron-open":a(o)})}),V("click",m,se),V("keydown",m,le),f(te,q),he()}we(["click","keydown"]);export{Ne as D}; diff --git a/apps/dashboard/build/_app/immutable/chunks/CmbJHhgy.js.br b/apps/dashboard/build/_app/immutable/chunks/CmbJHhgy.js.br deleted file mode 100644 index e0c34cb..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/CmbJHhgy.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CmbJHhgy.js.gz b/apps/dashboard/build/_app/immutable/chunks/CmbJHhgy.js.gz deleted file mode 100644 index b2dc537..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/CmbJHhgy.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CnZzd20v.js b/apps/dashboard/build/_app/immutable/chunks/CnZzd20v.js deleted file mode 100644 index cbdf8cb..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/CnZzd20v.js +++ /dev/null @@ -1 +0,0 @@ -import{v as k,w as f,O as m,P as t,Q as _,G as b,C as i}from"./wpu9U-D0.js";function E(e,a,v=a){var c=new WeakSet;k(e,"input",async r=>{var l=r?e.defaultValue:e.value;if(l=o(e)?u(l):l,v(l),f!==null&&c.add(f),await m(),l!==(l=a())){var h=e.selectionStart,d=e.selectionEnd,n=e.value.length;if(e.value=l??"",d!==null){var s=e.value.length;h===d&&d===n&&s>n?(e.selectionStart=s,e.selectionEnd=s):(e.selectionStart=h,e.selectionEnd=Math.min(d,s))}}}),(b&&e.defaultValue!==e.value||t(a)==null&&e.value)&&(v(o(e)?u(e.value):e.value),f!==null&&c.add(f)),_(()=>{var r=a();if(e===document.activeElement){var l=i??f;if(c.has(l))return}o(e)&&r===u(e.value)||e.type==="date"&&!r&&!e.value||r!==e.value&&(e.value=r??"")})}function S(e,a,v=a){k(e,"change",c=>{var r=c?e.defaultChecked:e.checked;v(r)}),(b&&e.defaultChecked!==e.checked||t(a)==null)&&v(e.checked),_(()=>{var c=a();e.checked=!!c})}function o(e){var a=e.type;return a==="number"||a==="range"}function u(e){return e===""?null:+e}export{S as a,E as b}; diff --git a/apps/dashboard/build/_app/immutable/chunks/CnZzd20v.js.br b/apps/dashboard/build/_app/immutable/chunks/CnZzd20v.js.br deleted file mode 100644 index 9ca395f..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/CnZzd20v.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CnZzd20v.js.gz b/apps/dashboard/build/_app/immutable/chunks/CnZzd20v.js.gz deleted file mode 100644 index 7c30757..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/CnZzd20v.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CpWkWWOo.js b/apps/dashboard/build/_app/immutable/chunks/CpWkWWOo.js new file mode 100644 index 0000000..5b4d2bc --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/CpWkWWOo.js @@ -0,0 +1 @@ +var cn=Object.defineProperty;var wt=e=>{throw TypeError(e)};var _n=(e,t,n)=>t in e?cn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var de=(e,t,n)=>_n(e,typeof t!="symbol"?t+"":t,n),Ke=(e,t,n)=>t.has(e)||wt("Cannot "+n);var p=(e,t,n)=>(Ke(e,t,"read from private field"),n?n.call(e):t.get(e)),F=(e,t,n)=>t.has(e)?wt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),z=(e,t,n,r)=>(Ke(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),K=(e,t,n)=>(Ke(e,t,"access private method"),n);var vn=Array.isArray,dn=Array.prototype.indexOf,me=Array.prototype.includes,lr=Array.from,or=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,pn=Object.getOwnPropertyDescriptors,hn=Object.prototype,wn=Array.prototype,kt=Object.getPrototypeOf,yt=Object.isExtensible;const yn=()=>{};function ur(e){return e()}function En(e){for(var t=0;t{e=r,t=s});return{promise:n,resolve:e,reject:t}}function cr(e,t){if(Array.isArray(e))return e;if(t===void 0||!(Symbol.iterator in e))return Array.from(e);const n=[];for(const r of e)if(n.push(r),n.length===t)break;return n}const A=2,De=4,Ie=8,Dt=1<<24,G=16,H=32,ve=64,mn=128,P=512,g=1024,R=2048,Y=4096,j=8192,Z=16384,oe=32768,je=65536,Et=1<<17,It=1<<18,Pe=1<<19,Pt=1<<20,_r=1<<25,ue=65536,Xe=1<<21,st=1<<22,W=1<<23,ae=Symbol("$state"),vr=Symbol("legacy props"),dr=Symbol(""),ne=new class extends Error{constructor(){super(...arguments);de(this,"name","StaleReactionError");de(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var Nt;const hr=!!((Nt=globalThis.document)!=null&&Nt.contentType)&&globalThis.document.contentType.includes("xml"),Ue=3,Ct=8;function gn(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function wr(e,t,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Tn(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function bn(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function An(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Sn(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function yr(){throw new Error("https://svelte.dev/e/hydration_failed")}function Er(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function Rn(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function On(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Nn(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function mr(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const gr=1,Tr=2,br=4,Ar=8,Sr=16,Rr=1,Or=2,Nr=4,kr=8,xr=16,Dr=1,Ir=2,kn="[",xn="[!",Pr="[?",Dn="]",ft={},T=Symbol(),In="http://www.w3.org/1999/xhtml";function it(e){console.warn("https://svelte.dev/e/hydration_mismatch")}function Cr(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function Fr(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let Q=!1;function Mr(e){Q=e}let m;function ge(e){if(e===null)throw it(),ft;return m=e}function Lr(){return ge(te(m))}function jr(e){if(Q){if(te(m)!==null)throw it(),ft;m=e}}function Yr(e=1){if(Q){for(var t=e,n=m;t--;)n=te(n);m=n}}function Hr(e=!0){for(var t=0,n=m;;){if(n.nodeType===Ct){var r=n.data;if(r===Dn){if(t===0)return n;t-=1}else(r===kn||r===xn||r[0]==="["&&!isNaN(Number(r.slice(1))))&&(t+=1)}var s=te(n);e&&n.remove(),n=s}}function qr(e){if(!e||e.nodeType!==Ct)throw it(),ft;return e.data}function Ft(e){return e===this.v}function Pn(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Mt(e){return!Pn(e,this.v)}let Be=!1;function Vr(){Be=!0}let S=null;function Ye(e){S=e}function Ur(e,t=!1,n){S={p:S,i:!1,c:null,e:null,s:e,x:null,l:Be&&!t?{s:null,u:null,$:[]}:null}}function Br(e){var t=S,n=t.e;if(n!==null){t.e=null;for(var r of n)Jt(r)}return t.i=!0,S=t.p,{}}function Ce(){return!Be||S!==null&&S.l===null}let re=[];function Lt(){var e=re;re=[],En(e)}function mt(e){if(re.length===0&&!Oe){var t=re;queueMicrotask(()=>{t===re&&Lt()})}re.push(e)}function Cn(){for(;re.length>0;)Lt()}function Fn(e){var t=w;if(t===null)return _.f|=W,e;if((t.f&oe)===0&&(t.f&De)===0)throw e;He(e,t)}function He(e,t){for(;t!==null;){if((t.f&mn)!==0){if((t.f&oe)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}const Mn=-7169;function E(e,t){e.f=e.f&Mn|t}function at(e){(e.f&P)!==0||e.deps===null?E(e,g):E(e,Y)}function jt(e){if(e!==null)for(const t of e)(t.f&A)===0||(t.f&ue)===0||(t.f^=ue,jt(t.deps))}function Ln(e,t,n){(e.f&R)!==0?t.add(e):(e.f&Y)!==0&&n.add(e),jt(e.deps),E(e,g)}const Me=new Set;let d=null,gt=null,b=null,N=[],Ge=null,Ze=!1,Oe=!1;var he,we,fe,ye,ke,xe,ie,U,Ee,D,We,Je,Qe,Yt;const dt=class dt{constructor(){F(this,D);de(this,"current",new Map);de(this,"previous",new Map);F(this,he,new Set);F(this,we,new Set);F(this,fe,0);F(this,ye,0);F(this,ke,null);F(this,xe,new Set);F(this,ie,new Set);F(this,U,new Map);de(this,"is_fork",!1);F(this,Ee,!1)}skip_effect(t){p(this,U).has(t)||p(this,U).set(t,{d:[],m:[]})}unskip_effect(t){var n=p(this,U).get(t);if(n){p(this,U).delete(t);for(var r of n.d)E(r,R),B(r);for(r of n.m)E(r,Y),B(r)}}process(t){var s;N=[],this.apply();var n=[],r=[];for(const f of t)K(this,D,Je).call(this,f,n,r);if(K(this,D,We).call(this)){K(this,D,Qe).call(this,r),K(this,D,Qe).call(this,n);for(const[f,a]of p(this,U))Ut(f,a)}else{for(const f of p(this,he))f();p(this,he).clear(),p(this,fe)===0&&K(this,D,Yt).call(this),gt=this,d=null,Tt(r),Tt(n),gt=null,(s=p(this,ke))==null||s.resolve()}b=null}capture(t,n){n!==T&&!this.previous.has(t)&&this.previous.set(t,n),(t.f&W)===0&&(this.current.set(t,t.v),b==null||b.set(t,t.v))}activate(){d=this,this.apply()}deactivate(){d===this&&(d=null,b=null)}flush(){if(this.activate(),N.length>0){if(Ht(),d!==null&&d!==this)return}else p(this,fe)===0&&this.process([]);this.deactivate()}discard(){for(const t of p(this,we))t(this);p(this,we).clear()}increment(t){z(this,fe,p(this,fe)+1),t&&z(this,ye,p(this,ye)+1)}decrement(t){z(this,fe,p(this,fe)-1),t&&z(this,ye,p(this,ye)-1),!p(this,Ee)&&(z(this,Ee,!0),mt(()=>{z(this,Ee,!1),K(this,D,We).call(this)?N.length>0&&this.flush():this.revive()}))}revive(){for(const t of p(this,xe))p(this,ie).delete(t),E(t,R),B(t);for(const t of p(this,ie))E(t,Y),B(t);this.flush()}oncommit(t){p(this,he).add(t)}ondiscard(t){p(this,we).add(t)}settled(){return(p(this,ke)??z(this,ke,xt())).promise}static ensure(){if(d===null){const t=d=new dt;Me.add(d),Oe||mt(()=>{d===t&&t.flush()})}return d}apply(){}};he=new WeakMap,we=new WeakMap,fe=new WeakMap,ye=new WeakMap,ke=new WeakMap,xe=new WeakMap,ie=new WeakMap,U=new WeakMap,Ee=new WeakMap,D=new WeakSet,We=function(){return this.is_fork||p(this,ye)>0},Je=function(t,n,r){t.f^=g;for(var s=t.first;s!==null;){var f=s.f,a=(f&(H|ve))!==0,l=a&&(f&g)!==0,i=l||(f&j)!==0||p(this,U).has(s);if(!i&&s.fn!==null){a?s.f^=g:(f&De)!==0?n.push(s):Fe(s)&&((f&G)!==0&&p(this,ie).add(s),Ae(s));var o=s.first;if(o!==null){s=o;continue}}for(;s!==null;){var c=s.next;if(c!==null){s=c;break}s=s.parent}}},Qe=function(t){for(var n=0;n1){this.previous.clear();var t=b,n=!0;for(const f of Me){if(f===this){n=!1;continue}const a=[];for(const[i,o]of this.current){if(f.current.has(i))if(n&&o!==f.current.get(i))f.current.set(i,o);else continue;a.push(i)}if(a.length===0)continue;const l=[...f.current.keys()].filter(i=>!this.current.has(i));if(l.length>0){var r=N;N=[];const i=new Set,o=new Map;for(const c of a)qt(c,l,i,o);if(N.length>0){d=f,f.apply();for(const c of N)K(s=f,D,Je).call(s,c,[],[]);f.deactivate()}N=r}}d=null,b=t}Me.delete(this)};let Te=dt;function jn(e){var t=Oe;Oe=!0;try{for(var n;;){if(Cn(),N.length===0&&(d==null||d.flush(),N.length===0))return Ge=null,n;Ht()}}finally{Oe=t}}function Ht(){Ze=!0;var e=null;try{for(var t=0;N.length>0;){var n=Te.ensure();if(t++>1e3){var r,s;Yn()}n.process(N),J.clear()}}finally{N=[],Ze=!1,Ge=null}}function Yn(){try{Sn()}catch(e){He(e,Ge)}}let M=null;function Tt(e){var t=e.length;if(t!==0){for(var n=0;n0)){J.clear();for(const s of M){if((s.f&(Z|j))!==0)continue;const f=[s];let a=s.parent;for(;a!==null;)M.has(a)&&(M.delete(a),f.push(a)),a=a.parent;for(let l=f.length-1;l>=0;l--){const i=f[l];(i.f&(Z|j))===0&&Ae(i)}}M.clear()}}M=null}}function qt(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const s of e.reactions){const f=s.f;(f&A)!==0?qt(s,t,n,r):(f&(st|G))!==0&&(f&R)===0&&Vt(s,t,r)&&(E(s,R),B(s))}}function Vt(e,t,n){const r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const s of e.deps){if(me.call(t,s))return!0;if((s.f&A)!==0&&Vt(s,t,n))return n.set(s,!0),!0}return n.set(e,!1),!1}function B(e){var t=Ge=e,n=t.b;if(n!=null&&n.is_pending&&(e.f&(De|Ie|Dt))!==0&&(e.f&oe)===0){n.defer_effect(e);return}for(;t.parent!==null;){t=t.parent;var r=t.f;if(Ze&&t===w&&(r&G)!==0&&(r&It)===0&&(r&oe)!==0)return;if((r&(ve|H))!==0){if((r&g)===0)return;t.f^=g}}N.push(t)}function Ut(e,t){if(!((e.f&H)!==0&&(e.f&g)!==0)){(e.f&R)!==0?t.d.push(e):(e.f&Y)!==0&&t.m.push(e),E(e,g);for(var n=e.first;n!==null;)Ut(n,t),n=n.next}}function Hn(e,t,n,r){const s=Ce()?lt:Bn;var f=e.filter(u=>!u.settled);if(n.length===0&&f.length===0){r(t.map(s));return}var a=w,l=qn(),i=f.length===1?f[0].promise:f.length>1?Promise.all(f.map(u=>u.promise)):null;function o(u){l();try{r(u)}catch(v){(a.f&Z)===0&&He(v,a)}et()}if(n.length===0){i.then(()=>o(t.map(s)));return}function c(){l(),Promise.all(n.map(u=>Un(u))).then(u=>o([...t.map(s),...u])).catch(u=>He(u,a))}i?i.then(c):c()}function qn(){var e=w,t=_,n=S,r=d;return function(f=!0){be(e),ee(t),Ye(n),f&&(r==null||r.activate())}}function et(e=!0){be(null),ee(null),Ye(null),e&&(d==null||d.deactivate())}function Vn(){var e=w.b,t=d,n=e.is_rendered();return e.update_pending_count(1),t.increment(n),()=>{e.update_pending_count(-1),t.decrement(n)}}function lt(e){var t=A|R,n=_!==null&&(_.f&A)!==0?_:null;return w!==null&&(w.f|=Pe),{ctx:S,deps:null,effects:null,equals:Ft,f:t,fn:e,reactions:null,rv:0,v:T,wv:0,parent:n??w,ac:null}}function Un(e,t,n){w===null&&gn();var s=void 0,f=ut(T),a=!_,l=new Map;return tr(()=>{var v;var i=xt();s=i.promise;try{Promise.resolve(e()).then(i.resolve,i.reject).finally(et)}catch(y){i.reject(y),et()}var o=d;if(a){var c=Vn();(v=l.get(o))==null||v.reject(ne),l.delete(o),l.set(o,i)}const u=(y,h=void 0)=>{if(o.activate(),h)h!==ne&&(f.f|=W,nt(f,h));else{(f.f&W)!==0&&(f.f^=W),nt(f,y);for(const[V,O]of l){if(l.delete(V),V===o)break;O.reject(ne)}}c&&c()};i.promise.then(u,y=>u(null,y||"unknown"))}),er(()=>{for(const i of l.values())i.reject(ne)}),new Promise(i=>{function o(c){function u(){c===s?i(f):o(s)}c.then(u,u)}o(s)})}function Gr(e){const t=lt(e);return rn(t),t}function Bn(e){const t=lt(e);return t.equals=Mt,t}function Gn(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n0&&!zt&&$n()}return t}function $n(){zt=!1;for(const e of tt)(e.f&g)!==0&&E(e,Y),Fe(e)&&Ae(e);tt.clear()}function Kr(e,t=1){var n=pe(e),r=t===1?n++:n--;return X(e,n),r}function $e(e){X(e,e.v+1)}function Kt(e,t){var n=e.reactions;if(n!==null)for(var r=Ce(),s=n.length,f=0;f{if(le===f)return l();var i=_,o=le;ee(null),Ot(f);var c=l();return ee(i),Ot(o),c};return r&&n.set("length",$(e.length)),new Proxy(e,{defineProperty(l,i,o){(!("value"in o)||o.configurable===!1||o.enumerable===!1||o.writable===!1)&&Rn();var c=n.get(i);return c===void 0?a(()=>{var u=$(o.value);return n.set(i,u),u}):X(c,o.value,!0),!0},deleteProperty(l,i){var o=n.get(i);if(o===void 0){if(i in l){const c=a(()=>$(T));n.set(i,c),$e(s)}}else X(o,T),$e(s);return!0},get(l,i,o){var y;if(i===ae)return e;var c=n.get(i),u=i in l;if(c===void 0&&(!u||(y=Re(l,i))!=null&&y.writable)&&(c=a(()=>{var h=Se(u?l[i]:T),V=$(h);return V}),n.set(i,c)),c!==void 0){var v=pe(c);return v===T?void 0:v}return Reflect.get(l,i,o)},getOwnPropertyDescriptor(l,i){var o=Reflect.getOwnPropertyDescriptor(l,i);if(o&&"value"in o){var c=n.get(i);c&&(o.value=pe(c))}else if(o===void 0){var u=n.get(i),v=u==null?void 0:u.v;if(u!==void 0&&v!==T)return{enumerable:!0,configurable:!0,value:v,writable:!0}}return o},has(l,i){var v;if(i===ae)return!0;var o=n.get(i),c=o!==void 0&&o.v!==T||Reflect.has(l,i);if(o!==void 0||w!==null&&(!c||(v=Re(l,i))!=null&&v.writable)){o===void 0&&(o=a(()=>{var y=c?Se(l[i]):T,h=$(y);return h}),n.set(i,o));var u=pe(o);if(u===T)return!1}return c},set(l,i,o,c){var ht;var u=n.get(i),v=i in l;if(r&&i==="length")for(var y=o;y$(T)),n.set(y+"",h))}if(u===void 0)(!v||(ht=Re(l,i))!=null&&ht.writable)&&(u=a(()=>$(void 0)),X(u,Se(o)),n.set(i,u));else{v=u.v!==T;var V=a(()=>Se(o));X(u,V)}var O=Reflect.getOwnPropertyDescriptor(l,i);if(O!=null&&O.set&&O.set.call(c,o),!v){if(r&&typeof i=="string"){var pt=n.get("length"),ze=Number(i);Number.isInteger(ze)&&ze>=pt.v&&X(pt,ze+1)}$e(s)}return!0},ownKeys(l){pe(s);var i=Reflect.ownKeys(l).filter(u=>{var v=n.get(u);return v===void 0||v.v!==T});for(var[o,c]of n)c.v!==T&&!(o in l)&&i.push(o);return i},setPrototypeOf(){On()}})}function bt(e){try{if(e!==null&&typeof e=="object"&&ae in e)return e[ae]}catch{}return e}function $r(e,t){return Object.is(bt(e),bt(t))}var At,Xn,Zn,$t,Xt;function Xr(){if(At===void 0){At=window,Xn=document,Zn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;$t=Re(t,"firstChild").get,Xt=Re(t,"nextSibling").get,yt(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),yt(n)&&(n.__t=void 0)}}function qe(e=""){return document.createTextNode(e)}function Ve(e){return $t.call(e)}function te(e){return Xt.call(e)}function Zr(e,t){if(!Q)return Ve(e);var n=Ve(m);if(n===null)n=m.appendChild(qe());else if(t&&n.nodeType!==Ue){var r=qe();return n==null||n.before(r),ge(r),r}return t&&ct(n),ge(n),n}function Wr(e,t=!1){if(!Q){var n=Ve(e);return n instanceof Comment&&n.data===""?te(n):n}if(t){if((m==null?void 0:m.nodeType)!==Ue){var r=qe();return m==null||m.before(r),ge(r),r}ct(m)}return m}function Jr(e,t=1,n=!1){let r=Q?m:e;for(var s;t--;)s=r,r=te(r);if(!Q)return r;if(n){if((r==null?void 0:r.nodeType)!==Ue){var f=qe();return r===null?s==null||s.after(f):r.before(f),ge(f),f}ct(r)}return ge(r),r}function Wn(e){e.textContent=""}function Qr(){return!1}function es(e,t,n){return document.createElementNS(In,e,void 0)}function ct(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===Ue;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function ts(e){Q&&Ve(e)!==null&&Wn(e)}let St=!1;function Jn(){St||(St=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const n of e.target.elements)(t=n.__on_r)==null||t.call(n)})},{capture:!0}))}function _t(e){var t=_,n=w;ee(null),be(null);try{return e()}finally{ee(t),be(n)}}function ns(e,t,n,r=n){e.addEventListener(t,()=>_t(n));const s=e.__on_r;s?e.__on_r=()=>{s(),r(!0)}:e.__on_r=()=>r(!0),Jn()}function Zt(e){w===null&&(_===null&&An(),bn()),_e&&Tn()}function Qn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function q(e,t,n){var r=w;r!==null&&(r.f&j)!==0&&(e|=j);var s={ctx:S,deps:null,nodes:null,f:e|R|P,first:null,fn:t,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};if(n)try{Ae(s)}catch(l){throw ce(s),l}else t!==null&&B(s);var f=s;if(n&&f.deps===null&&f.teardown===null&&f.nodes===null&&f.first===f.last&&(f.f&Pe)===0&&(f=f.first,(e&G)!==0&&(e&je)!==0&&f!==null&&(f.f|=je)),f!==null&&(f.parent=r,r!==null&&Qn(f,r),_!==null&&(_.f&A)!==0&&(e&ve)===0)){var a=_;(a.effects??(a.effects=[])).push(f)}return s}function Wt(){return _!==null&&!L}function er(e){const t=q(Ie,null,!1);return E(t,g),t.teardown=e,t}function rs(e){Zt();var t=w.f,n=!_&&(t&H)!==0&&(t&oe)===0;if(n){var r=S;(r.e??(r.e=[])).push(e)}else return Jt(e)}function Jt(e){return q(De|Pt,e,!1)}function ss(e){return Zt(),q(Ie|Pt,e,!0)}function fs(e){Te.ensure();const t=q(ve|Pe,e,!0);return(n={})=>new Promise(r=>{n.outro?sr(t,()=>{ce(t),r(void 0)}):(ce(t),r(void 0))})}function is(e){return q(De,e,!1)}function tr(e){return q(st|Pe,e,!0)}function as(e,t=0){return q(Ie|t,e,!0)}function ls(e,t=[],n=[],r=[]){Hn(r,t,n,s=>{q(Ie,()=>e(...s.map(pe)),!0)})}function os(e,t=0){var n=q(G|t,e,!0);return n}function us(e){return q(H|Pe,e,!0)}function Qt(e){var t=e.teardown;if(t!==null){const n=_e,r=_;Rt(!0),ee(null);try{t.call(null)}finally{Rt(n),ee(r)}}}function vt(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const s=n.ac;s!==null&&_t(()=>{s.abort(ne)});var r=n.next;(n.f&ve)!==0?n.parent=null:ce(n,t),n=r}}function nr(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&H)===0&&ce(t),t=n}}function ce(e,t=!0){var n=!1;(t||(e.f&It)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(rr(e.nodes.start,e.nodes.end),n=!0),vt(e,t&&!n),Ne(e,0),E(e,Z);var r=e.nodes&&e.nodes.t;if(r!==null)for(const f of r)f.stop();Qt(e);var s=e.parent;s!==null&&s.first!==null&&en(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function rr(e,t){for(;e!==null;){var n=e===t?null:te(e);e.remove(),e=n}}function en(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function sr(e,t,n=!0){var r=[];tn(e,r,!0);var s=()=>{n&&ce(e),t&&t()},f=r.length;if(f>0){var a=()=>--f||s();for(var l of r)l.out(a)}else s()}function tn(e,t,n){if((e.f&j)===0){e.f^=j;var r=e.nodes&&e.nodes.t;if(r!==null)for(const l of r)(l.is_global||n)&&t.push(l);for(var s=e.first;s!==null;){var f=s.next,a=(s.f&je)!==0||(s.f&H)!==0&&(e.f&G)!==0;tn(s,t,a?n:!1),s=f}}}function cs(e){nn(e,!0)}function nn(e,t){if((e.f&j)!==0){e.f^=j,(e.f&g)===0&&(E(e,R),B(e));for(var n=e.first;n!==null;){var r=n.next,s=(n.f&je)!==0||(n.f&H)!==0;nn(n,s?t:!1),n=r}var f=e.nodes&&e.nodes.t;if(f!==null)for(const a of f)(a.is_global||t)&&a.in()}}function _s(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var s=n===r?null:te(n);t.append(n),n=s}}let Le=!1,_e=!1;function Rt(e){_e=e}let _=null,L=!1;function ee(e){_=e}let w=null;function be(e){w=e}let C=null;function rn(e){_!==null&&(C===null?C=[e]:C.push(e))}let k=null,x=0,I=null;function fr(e){I=e}let sn=1,se=0,le=se;function Ot(e){le=e}function fn(){return++sn}function Fe(e){var t=e.f;if((t&R)!==0)return!0;if(t&A&&(e.f&=~ue),(t&Y)!==0){for(var n=e.deps,r=n.length,s=0;se.wv)return!0}(t&P)!==0&&b===null&&E(e,g)}return!1}function an(e,t,n=!0){var r=e.reactions;if(r!==null&&!(C!==null&&me.call(C,e)))for(var s=0;s{e.ac.abort(ne)}),e.ac=null);try{e.f|=Xe;var c=e.fn,u=c();e.f|=oe;var v=e.deps,y=d==null?void 0:d.is_fork;if(k!==null){var h;if(y||Ne(e,x),v!==null&&x>0)for(v.length=x+k.length,h=0;h{c.delete(e),l.delete(e),h(e)},s);c.set(e,t)}function g(e){const s=m++,t=Date.now(),o={id:s,createdAt:t,...e};u(n=>{const r=[o,...n];if(r.length>y){for(const i of r.slice(y)){const d=c.get(i.id);d&&clearTimeout(d),c.delete(i.id),a.delete(i.id),l.delete(i.id)}return r.slice(0,y)}return r}),w(s,e.dwellMs)}function h(e){const s=c.get(e);s&&(clearTimeout(s),c.delete(e)),a.delete(e),l.delete(e),u(t=>t.filter(o=>o.id!==e))}function D(e,s){const t=c.get(e);if(!t)return;clearTimeout(t),c.delete(e);const o=l.get(e)??Date.now(),n=Date.now()-o,r=Math.max(200,s-n);a.set(e,{remaining:r})}function C(e){const s=a.get(e);s&&(a.delete(e),w(e,s.remaining))}function S(){for(const e of c.values())clearTimeout(e);c.clear(),a.clear(),l.clear(),u(()=>[])}function _(e){const s=p[e.type]??"#818CF8",t=e.data;switch(e.type){case"DreamCompleted":{const o=Number(t.memories_replayed??0),n=Number(t.connections_found??0),r=Number(t.insights_generated??0),i=Number(t.duration_ms??0),d=[];return d.push(`Replayed ${o} ${o===1?"memory":"memories"}`),n>0&&d.push(`${n} new connection${n===1?"":"s"}`),r>0&&d.push(`${r} insight${r===1?"":"s"}`),{type:e.type,title:"Dream consolidated",body:`${d.join(" · ")} in ${(i/1e3).toFixed(1)}s`,color:s,dwellMs:7e3}}case"ConsolidationCompleted":{const o=Number(t.nodes_processed??0),n=Number(t.decay_applied??0),r=Number(t.embeddings_generated??0),i=Number(t.duration_ms??0),d=[];return n>0&&d.push(`${n} decayed`),r>0&&d.push(`${r} embedded`),{type:e.type,title:"Consolidation swept",body:`${o} node${o===1?"":"s"}${d.length?" · "+d.join(" · "):""} in ${(i/1e3).toFixed(1)}s`,color:s,dwellMs:6e3}}case"ConnectionDiscovered":{const o=Date.now();if(o-f0?`suppression #${o} · Rac1 cascade ~${n} neighbors`:`suppression #${o}`,color:s,dwellMs:5500}}case"MemoryUnsuppressed":{const o=Number(t.remaining_count??0);return{type:e.type,title:"Recovered",body:o>0?`${o} suppression${o===1?"":"s"} remain`:"fully unsuppressed",color:s,dwellMs:5e3}}case"Rac1CascadeSwept":{const o=Number(t.seeds??0),n=Number(t.neighbors_affected??0);return{type:e.type,title:"Rac1 cascade",body:`${o} seed${o===1?"":"s"} · ${n} dendritic spine${n===1?"":"s"} pruned`,color:s,dwellMs:6e3}}case"MemoryDeleted":return{type:e.type,title:"Memory deleted",body:String(t.id??"").slice(0,8),color:s,dwellMs:4e3};case"HookVerdictRecorded":{const o=String(t.verdict??"NOTE"),n=String(t.reason??"Sanhedrin receipt updated");return{type:e.type,title:`Sanhedrin ${o}`,body:n,color:s,dwellMs:o==="VETO"?8e3:R}}case"Heartbeat":case"SearchPerformed":case"RetentionDecayed":case"ActivationSpread":case"ImportanceScored":case"MemoryCreated":case"MemoryUpdated":case"DreamStarted":case"DreamProgress":case"ConsolidationStarted":case"Connected":return null;default:return null}}let M=null;return E.subscribe(e=>{if(e.length===0)return;const s=[];for(const t of e){if(t===M)break;s.push(t)}if(s.length!==0){M=e[0];for(let t=s.length-1;t>=0;t--){const o=_(s[t]);o&&g(o)}}}),{subscribe:b,dismiss:h,clear:S,pauseDwell:D,resumeDwell:C,push:g}}const $=x();function I(){[{type:"DreamCompleted",title:"Dream consolidated",body:"Replayed 127 memories · 43 new connections · 5 insights in 2.4s",color:p.DreamCompleted,dwellMs:7e3},{type:"ConnectionDiscovered",title:"Bridge discovered",body:"semantic · weight 0.87",color:p.ConnectionDiscovered,dwellMs:4500},{type:"MemorySuppressed",title:"Forgetting",body:"suppression #2 · Rac1 cascade ~8 neighbors",color:p.MemorySuppressed,dwellMs:5500},{type:"ConsolidationCompleted",title:"Consolidation swept",body:"892 nodes · 156 decayed · 48 embedded in 1.1s",color:p.ConsolidationCompleted,dwellMs:6e3}].forEach((u,m)=>{setTimeout(()=>{$.push(u)},m*800)}),T($)}export{I as f,$ as t}; diff --git a/apps/dashboard/build/_app/immutable/chunks/CqMQEF-F.js.br b/apps/dashboard/build/_app/immutable/chunks/CqMQEF-F.js.br deleted file mode 100644 index 3a8183c..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/CqMQEF-F.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CqMQEF-F.js.gz b/apps/dashboard/build/_app/immutable/chunks/CqMQEF-F.js.gz deleted file mode 100644 index 1fcfe84..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/CqMQEF-F.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/Cx-f-Pzo.js b/apps/dashboard/build/_app/immutable/chunks/Cx-f-Pzo.js new file mode 100644 index 0000000..7aa0a02 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/Cx-f-Pzo.js @@ -0,0 +1 @@ +import{a as y}from"./BKuqSeVd.js";import{N as r}from"./CpWkWWOo.js";function a(t,e,f,i){var l=t.__style;if(r||l!==e){var s=y(e);(!r||s!==t.getAttribute("style"))&&(s==null?t.removeAttribute("style"):t.style.cssText=s),t.__style=e}return i}export{a as s}; diff --git a/apps/dashboard/build/_app/immutable/chunks/Cx-f-Pzo.js.br b/apps/dashboard/build/_app/immutable/chunks/Cx-f-Pzo.js.br new file mode 100644 index 0000000..12a7516 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/Cx-f-Pzo.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/Cx-f-Pzo.js.gz b/apps/dashboard/build/_app/immutable/chunks/Cx-f-Pzo.js.gz new file mode 100644 index 0000000..ab5d4cb Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/Cx-f-Pzo.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/D7A-gG4Z.js b/apps/dashboard/build/_app/immutable/chunks/D7A-gG4Z.js deleted file mode 100644 index a7eb8ff..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/D7A-gG4Z.js +++ /dev/null @@ -1 +0,0 @@ -import"./Bzak7iHL.js";import{t as k,G as f,T as v,ai as C,av as g,M as x,I as _,J as w,aw as A,ax as z,ay as u,L,az as H,aA as V,aB as E,N as d,a as N,au as T,e as b,r as I}from"./wpu9U-D0.js";import{a as M,s as O}from"./60_R_Vbt.js";import{p as n}from"./ByYB047u.js";function Z(h,c,t=!1,l=!1,p=!1){var a=h,r="";k(()=>{var o=C;if(r===(r=c()??"")){f&&v();return}if(o.nodes!==null&&(g(o.nodes.start,o.nodes.end),o.nodes=null),r!==""){if(f){x.data;for(var e=v(),y=e;e!==null&&(e.nodeType!==_||e.data!=="");)y=e,e=w(e);if(e===null)throw A(),z;u(x,y),a=L(e);return}var m=t?V:l?E:void 0,s=H(t?"svg":l?"math":"template",m);s.innerHTML=r;var i=t||l?s:s.content;if(u(d(i),i.lastChild),t||l)for(;d(i);)a.before(d(i));else a.before(i)}})}const R={blackbox:'',memorypr:'',graph:'',reasoning:'',memories:'',timeline:'',feed:'',explore:'',activation:'',dreams:'',schedule:'',importance:'',duplicates:'',contradictions:'',patterns:'',intentions:'',stats:'',settings:'',command:'',search:'',filter:'',sparkle:'',chevron:'',close:'',pulse:'',logo:''};var S=T('');function W(h,c){let t=n(c,"size",3,20),l=n(c,"strokeWidth",3,1.6),p=n(c,"class",3,""),a=n(c,"draw",3,!1);var r=S(),o=b(r);Z(o,()=>R[c.name],!0),I(r),k(()=>{M(r,"width",t()),M(r,"height",t()),M(r,"stroke-width",l()),O(r,0,`vestige-icon ${a()?"vestige-icon-draw":""} ${p()??""}`,"svelte-1eqehiz")}),N(h,r)}export{W as I}; diff --git a/apps/dashboard/build/_app/immutable/chunks/D7A-gG4Z.js.br b/apps/dashboard/build/_app/immutable/chunks/D7A-gG4Z.js.br deleted file mode 100644 index 009a8a4..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/D7A-gG4Z.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/D7A-gG4Z.js.gz b/apps/dashboard/build/_app/immutable/chunks/D7A-gG4Z.js.gz deleted file mode 100644 index d5e541c..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/D7A-gG4Z.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/D8mhvFt8.js b/apps/dashboard/build/_app/immutable/chunks/D8mhvFt8.js deleted file mode 100644 index def1896..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/D8mhvFt8.js +++ /dev/null @@ -1,2 +0,0 @@ -var qe=Object.defineProperty;var pe=t=>{throw TypeError(t)};var xe=(t,e,s)=>e in t?qe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var J=(t,e,s)=>xe(t,typeof e!="symbol"?e+"":e,s),ie=(t,e,s)=>e.has(t)||pe("Cannot "+s);var r=(t,e,s)=>(ie(t,e,"read from private field"),s?s.call(t):e.get(t)),_=(t,e,s)=>e.has(t)?pe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),f=(t,e,s,i)=>(ie(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),b=(t,e,s)=>(ie(t,e,"access private method"),s);import{aX as Be,g as me,Q as Ce,P as Re,aY as ge,R as z,aL as Se,M as Y,G as k,ai as H,aZ as be,q as He,T as Pe,W as Ve,a_ as ye,$ as M,D as Ae,a$ as ne,_ as ae,a0 as We,b0 as ve,b1 as $e,b2 as Ee,b3 as ze,b4 as je,b5 as U,b6 as ee,b7 as we,b8 as Je,b9 as De,a2 as Ne,aF as Qe,Z as fe,L as te,n as Xe,X as Ze,ba as Q,E as Ge,F as Ke,bb as Ue,bc as et,y as tt,bd as st,ad as rt,be as oe,N as it,I as Fe,V as nt,J as at,ax as ue,K as X,bf as ft,aQ as ot,bg as ut,aI as ct,p as ht,ay as lt,aE as dt,aw as _t,b as pt,ab as P,aa as gt,a4 as bt}from"./wpu9U-D0.js";function yt(t){let e=0,s=Se(0),i;return()=>{Be()&&(me(s),Ce(()=>(e===0&&(i=Re(()=>t(()=>ge(s)))),e+=1,()=>{z(()=>{e-=1,e===0&&(i==null||i(),i=void 0,ge(s))})})))}}var vt=Ge|Ke;function Et(t,e,s,i){new wt(t,e,s,i)}var E,j,S,x,y,A,w,m,F,B,I,V,W,$,O,se,l,Oe,Ie,Le,ce,G,K,he;class wt{constructor(e,s,i,o){_(this,l);J(this,"parent");J(this,"is_pending",!1);J(this,"transform_error");_(this,E);_(this,j,k?Y:null);_(this,S);_(this,x);_(this,y);_(this,A,null);_(this,w,null);_(this,m,null);_(this,F,null);_(this,B,0);_(this,I,0);_(this,V,!1);_(this,W,new Set);_(this,$,new Set);_(this,O,null);_(this,se,yt(()=>(f(this,O,Se(r(this,B))),()=>{f(this,O,null)})));var n;f(this,E,e),f(this,S,s),f(this,x,u=>{var h=H;h.b=this,h.f|=be,i(u)}),this.parent=H.b,this.transform_error=o??((n=this.parent)==null?void 0:n.transform_error)??(u=>u),f(this,y,He(()=>{if(k){const u=r(this,j);Pe();const h=u.data===Ve;if(u.data.startsWith(ye)){const a=JSON.parse(u.data.slice(ye.length));b(this,l,Ie).call(this,a)}else h?b(this,l,Le).call(this):b(this,l,Oe).call(this)}else b(this,l,ce).call(this)},vt)),k&&f(this,E,Y)}defer_effect(e){je(e,r(this,W),r(this,$))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!r(this,S).pending}update_pending_count(e){b(this,l,he).call(this,e),f(this,B,r(this,B)+e),!(!r(this,O)||r(this,V))&&(f(this,V,!0),z(()=>{f(this,V,!1),r(this,O)&&Qe(r(this,O),r(this,B))}))}get_effect_pending(){return r(this,se).call(this),me(r(this,O))}error(e){var s=r(this,S).onerror;let i=r(this,S).failed;if(!s&&!i)throw e;r(this,A)&&(fe(r(this,A)),f(this,A,null)),r(this,w)&&(fe(r(this,w)),f(this,w,null)),r(this,m)&&(fe(r(this,m)),f(this,m,null)),k&&(te(r(this,j)),Xe(),te(Ze()));var o=!1,n=!1;const u=()=>{if(o){et();return}o=!0,n&&Ue(),r(this,m)!==null&&ae(r(this,m),()=>{f(this,m,null)}),b(this,l,K).call(this,()=>{ne.ensure(),b(this,l,ce).call(this)})},h=c=>{try{n=!0,s==null||s(c,u),n=!1}catch(a){Q(a,r(this,y)&&r(this,y).parent)}i&&f(this,m,b(this,l,K).call(this,()=>{ne.ensure();try{return M(()=>{var a=H;a.b=this,a.f|=be,i(r(this,E),()=>c,()=>u)})}catch(a){return Q(a,r(this,y).parent),null}}))};z(()=>{var c;try{c=this.transform_error(e)}catch(a){Q(a,r(this,y)&&r(this,y).parent);return}c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(h,a=>Q(a,r(this,y)&&r(this,y).parent)):h(c)})}}E=new WeakMap,j=new WeakMap,S=new WeakMap,x=new WeakMap,y=new WeakMap,A=new WeakMap,w=new WeakMap,m=new WeakMap,F=new WeakMap,B=new WeakMap,I=new WeakMap,V=new WeakMap,W=new WeakMap,$=new WeakMap,O=new WeakMap,se=new WeakMap,l=new WeakSet,Oe=function(){try{f(this,A,M(()=>r(this,x).call(this,r(this,E))))}catch(e){this.error(e)}},Ie=function(e){const s=r(this,S).failed;s&&f(this,m,M(()=>{s(r(this,E),()=>e,()=>()=>{})}))},Le=function(){const e=r(this,S).pending;e&&(this.is_pending=!0,f(this,w,M(()=>e(r(this,E)))),z(()=>{var s=f(this,F,document.createDocumentFragment()),i=Ae();s.append(i),f(this,A,b(this,l,K).call(this,()=>(ne.ensure(),M(()=>r(this,x).call(this,i))))),r(this,I)===0&&(r(this,E).before(s),f(this,F,null),ae(r(this,w),()=>{f(this,w,null)}),b(this,l,G).call(this))}))},ce=function(){try{if(this.is_pending=this.has_pending_snippet(),f(this,I,0),f(this,B,0),f(this,A,M(()=>{r(this,x).call(this,r(this,E))})),r(this,I)>0){var e=f(this,F,document.createDocumentFragment());We(r(this,A),e);const s=r(this,S).pending;f(this,w,M(()=>s(r(this,E))))}else b(this,l,G).call(this)}catch(s){this.error(s)}},G=function(){this.is_pending=!1;for(const e of r(this,W))ve(e,$e),Ee(e);for(const e of r(this,$))ve(e,ze),Ee(e);r(this,W).clear(),r(this,$).clear()},K=function(e){var s=H,i=De,o=Ne;U(r(this,y)),ee(r(this,y)),we(r(this,y).ctx);try{return e()}catch(n){return Je(n),null}finally{U(s),ee(i),we(o)}},he=function(e){var s;if(!this.has_pending_snippet()){this.parent&&b(s=this.parent,l,he).call(s,e);return}f(this,I,r(this,I)+e),r(this,I)===0&&(b(this,l,G).call(this),r(this,w)&&ae(r(this,w),()=>{f(this,w,null)}),r(this,F)&&(r(this,E).before(r(this,F)),f(this,F,null)))};const Tt=["touchstart","touchmove"];function mt(t){return Tt.includes(t)}const q=Symbol("events"),Me=new Set,le=new Set;function Rt(t,e,s,i={}){function o(n){if(i.capture||de.call(e,n),!n.cancelBubble)return st(()=>s==null?void 0:s.call(this,n))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?z(()=>{e.addEventListener(t,o,i)}):e.addEventListener(t,o,i),o}function Ot(t,e,s,i,o){var n={capture:i,passive:o},u=Rt(t,e,s,n);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&tt(()=>{e.removeEventListener(t,u,n)})}function It(t,e,s){(e[q]??(e[q]={}))[t]=s}function Lt(t){for(var e=0;e{throw L});throw T}}finally{t[q]=e,delete t.currentTarget,ee(R),U(D)}}}function Mt(t,e){var s=e==null?"":typeof e=="object"?e+"":e;s!==(t.__t??(t.__t=t.nodeValue))&&(t.__t=s,t.nodeValue=s+"")}function St(t,e){return Ye(t,e)}function Yt(t,e){oe(),e.intro=e.intro??!1;const s=e.target,i=k,o=Y;try{for(var n=it(s);n&&(n.nodeType!==Fe||n.data!==nt);)n=at(n);if(!n)throw ue;X(!0),te(n);const u=Ye(t,{...e,anchor:n});return X(!1),u}catch(u){if(u instanceof Error&&u.message.split(` -`).some(h=>h.startsWith("https://svelte.dev/e/")))throw u;return u!==ue&&console.warn("Failed to hydrate: ",u),e.recover===!1&&ft(),oe(),ot(s),X(!1),St(t,e)}finally{X(i),te(o)}}const Z=new Map;function Ye(t,{target:e,anchor:s,props:i={},events:o,context:n,intro:u=!0,transformError:h}){oe();var c=void 0,a=ut(()=>{var R=s??e.appendChild(Ae());Et(R,{pending:()=>{}},g=>{ht({});var d=Ne;if(n&&(d.c=n),o&&(i.$$events=o),k&<(g,null),c=t(g,i)||{},k&&(H.nodes.end=Y,Y===null||Y.nodeType!==Fe||Y.data!==dt))throw _t(),ue;pt()},h);var D=new Set,T=g=>{for(var d=0;d{var N;for(var g of D)for(const v of[e,document]){var d=Z.get(v),p=d.get(g);--p==0?(v.removeEventListener(g,de),d.delete(g),d.size===0&&Z.delete(v)):d.set(g,p)}le.delete(T),R!==s&&((N=R.parentNode)==null||N.removeChild(R))}});return _e.set(c,a),c}let _e=new WeakMap;function kt(t,e){const s=_e.get(t);return s?(_e.delete(t),s(e)):Promise.resolve()}function ke(t,e,s){if(t==null)return e(void 0),s&&s(void 0),P;const i=Re(()=>t.subscribe(e,s));return i.unsubscribe?()=>i.unsubscribe():i}const C=[];function At(t,e){return{subscribe:Dt(t,e).subscribe}}function Dt(t,e=P){let s=null;const i=new Set;function o(h){if(gt(t,h)&&(t=h,s)){const c=!C.length;for(const a of i)a[1](),C.push(a,t);if(c){for(let a=0;a{i.delete(a),i.size===0&&s&&(s(),s=null)}}return{set:o,update:n,subscribe:u}}function qt(t,e,s){const i=!Array.isArray(t),o=i?[t]:t;if(!o.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const n=e.length<2;return At(s,(u,h)=>{let c=!1;const a=[];let R=0,D=P;const T=()=>{if(R)return;D();const d=e(i?a[0]:a,u,h);n?u(d):D=typeof d=="function"?d:P},g=o.map((d,p)=>ke(d,N=>{a[p]=N,R&=~(1<{R|=1<e=s)(),e}export{It as a,qt as b,ke as c,Lt as d,Ot as e,xt as g,Yt as h,St as m,Mt as s,kt as u,Dt as w}; diff --git a/apps/dashboard/build/_app/immutable/chunks/D8mhvFt8.js.br b/apps/dashboard/build/_app/immutable/chunks/D8mhvFt8.js.br deleted file mode 100644 index 8b6310a..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/D8mhvFt8.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/D8mhvFt8.js.gz b/apps/dashboard/build/_app/immutable/chunks/D8mhvFt8.js.gz deleted file mode 100644 index 3f5feb9..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/D8mhvFt8.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DKve45Wd.js b/apps/dashboard/build/_app/immutable/chunks/DKve45Wd.js deleted file mode 100644 index 66e7aff..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/DKve45Wd.js +++ /dev/null @@ -1 +0,0 @@ -import{q as T,G as o,T as h,E as b,U as p,V as A,W as E,X as R,L as g,K as l}from"./wpu9U-D0.js";import{B as v}from"./BWk3o_TN.js";function S(t,u,_=!1){o&&h();var n=new v(t),c=_?b:0;function i(a,r){if(o){const e=p(t);var s;if(e===A?s=0:e===E?s=!1:s=parseInt(e.substring(1)),a!==s){var f=R();g(f),n.anchor=f,l(!1),n.ensure(a,r),l(!0);return}}n.ensure(a,r)}T(()=>{var a=!1;u((r,s=0)=>{a=!0,i(s,r)}),a||i(!1,null)},c)}export{S as i}; diff --git a/apps/dashboard/build/_app/immutable/chunks/DKve45Wd.js.br b/apps/dashboard/build/_app/immutable/chunks/DKve45Wd.js.br deleted file mode 100644 index 3241073..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/DKve45Wd.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DKve45Wd.js.gz b/apps/dashboard/build/_app/immutable/chunks/DKve45Wd.js.gz deleted file mode 100644 index 10e3b75..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/DKve45Wd.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DNjM5a-l.js b/apps/dashboard/build/_app/immutable/chunks/DNjM5a-l.js new file mode 100644 index 0000000..8ce57c7 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/DNjM5a-l.js @@ -0,0 +1 @@ +const r="/api";async function t(e,o){const i=await fetch(`${r}${e}`,{headers:{"Content-Type":"application/json"},...o});if(!i.ok)throw new Error(`API ${i.status}: ${i.statusText}`);return i.json()}const n={memories:{list:e=>{const o=e?"?"+new URLSearchParams(e).toString():"";return t(`/memories${o}`)},get:e=>t(`/memories/${e}`),delete:e=>t(`/memories/${e}`,{method:"DELETE"}),promote:e=>t(`/memories/${e}/promote`,{method:"POST"}),demote:e=>t(`/memories/${e}/demote`,{method:"POST"}),suppress:(e,o)=>t(`/memories/${e}/suppress`,{method:"POST",body:o?JSON.stringify({reason:o}):void 0}),unsuppress:e=>t(`/memories/${e}/unsuppress`,{method:"POST"})},search:(e,o=20)=>t(`/search?q=${encodeURIComponent(e)}&limit=${o}`),stats:()=>t("/stats"),health:()=>t("/health"),timeline:(e=7,o=200)=>t(`/timeline?days=${e}&limit=${o}`),graph:e=>{const o=e?"?"+new URLSearchParams(Object.entries(e).filter(([,i])=>i!==void 0).map(([i,s])=>[i,String(s)])).toString():"";return t(`/graph${o}`)},dream:()=>t("/dream",{method:"POST"}),explore:(e,o="associations",i,s=10)=>t("/explore",{method:"POST",body:JSON.stringify({from_id:e,action:o,to_id:i,limit:s})}),predict:()=>t("/predict",{method:"POST"}),importance:e=>t("/importance",{method:"POST",body:JSON.stringify({content:e})}),consolidate:()=>t("/consolidate",{method:"POST"}),retentionDistribution:()=>t("/retention-distribution"),intentions:(e="active")=>t(`/intentions?status=${e}`),deepReference:(e,o=20)=>t("/deep_reference",{method:"POST",body:JSON.stringify({query:e,depth:o})})};export{n as a}; diff --git a/apps/dashboard/build/_app/immutable/chunks/DNjM5a-l.js.br b/apps/dashboard/build/_app/immutable/chunks/DNjM5a-l.js.br new file mode 100644 index 0000000..03be48c Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/DNjM5a-l.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DNjM5a-l.js.gz b/apps/dashboard/build/_app/immutable/chunks/DNjM5a-l.js.gz new file mode 100644 index 0000000..44aee17 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/DNjM5a-l.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DPdYG9yN.js b/apps/dashboard/build/_app/immutable/chunks/DPdYG9yN.js deleted file mode 100644 index a887f81..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/DPdYG9yN.js +++ /dev/null @@ -1 +0,0 @@ -const c=()=>{var e;return typeof window<"u"&&((e=window.matchMedia)==null?void 0:e.call(window,"(prefers-reduced-motion: reduce)").matches)};function f(e,r={}){if(c())return{};const i=r.strength??8;let t=0;function o(a){const n=e.getBoundingClientRect(),m=a.clientX-(n.left+n.width/2),l=a.clientY-(n.top+n.height/2),p=Math.max(-1,Math.min(1,m/(n.width/2)))*i,v=Math.max(-1,Math.min(1,l/(n.height/2)))*i;cancelAnimationFrame(t),t=requestAnimationFrame(()=>{e.style.transform=`translate(${p}px, ${v}px)`})}function s(){cancelAnimationFrame(t),e.style.transform=""}return e.style.transition="transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1)",e.addEventListener("pointermove",o),e.addEventListener("pointerleave",s),{destroy(){e.removeEventListener("pointermove",o),e.removeEventListener("pointerleave",s),cancelAnimationFrame(t)}}}function u(e){if(c())return{};let r=0;function i(o){const s=e.getBoundingClientRect();cancelAnimationFrame(r),r=requestAnimationFrame(()=>{e.style.setProperty("--spot-x",`${o.clientX-s.left}px`),e.style.setProperty("--spot-y",`${o.clientY-s.top}px`),e.style.setProperty("--spot-o","1")})}function t(){e.style.setProperty("--spot-o","0")}return e.addEventListener("pointermove",i),e.addEventListener("pointerleave",t),{destroy(){e.removeEventListener("pointermove",i),e.removeEventListener("pointerleave",t),cancelAnimationFrame(r)}}}export{f as m,u as s}; diff --git a/apps/dashboard/build/_app/immutable/chunks/DPdYG9yN.js.br b/apps/dashboard/build/_app/immutable/chunks/DPdYG9yN.js.br deleted file mode 100644 index 7b2a8c1..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/DPdYG9yN.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DPdYG9yN.js.gz b/apps/dashboard/build/_app/immutable/chunks/DPdYG9yN.js.gz deleted file mode 100644 index e238558..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/DPdYG9yN.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DcKTNC6e.js b/apps/dashboard/build/_app/immutable/chunks/DcKTNC6e.js deleted file mode 100644 index 24ae411..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/DcKTNC6e.js +++ /dev/null @@ -1 +0,0 @@ -import"./Bzak7iHL.js";import{p as B,o as E,t as N,a as O,b as T,i as m,g as d,j as z,s as C,e as D,r as G,u as H}from"./wpu9U-D0.js";import{s as I}from"./D8mhvFt8.js";import{s as J}from"./60_R_Vbt.js";import{p as a}from"./ByYB047u.js";var K=z(" ");function U(v,t){var x;B(t,!0);let A=a(t,"decimals",3,0),_=a(t,"scale",3,1),g=a(t,"prefix",3,""),w=a(t,"suffix",3,""),F=a(t,"duration",3,900),M=a(t,"class",3,""),b=a(t,"group",3,!0),r=C(0),i=0,c=0,o=0,l=!1;const q=typeof window<"u"&&((x=window.matchMedia)==null?void 0:x.call(window,"(prefers-reduced-motion: reduce)").matches);function y(e){return e===1?1:1-Math.pow(2,-10*e)}function p(e){if(q){m(r,e,!0);return}cancelAnimationFrame(i),c=d(r),o=0;function s(f){o||(o=f);const n=Math.min(1,(f-o)/F());m(r,c+(e-c)*y(n)),n<1?i=requestAnimationFrame(s):m(r,e,!0)}i=requestAnimationFrame(s)}E(()=>{const e=t.value;return l||(l=!0),p(e),()=>cancelAnimationFrame(i)});let j=H(()=>(()=>{const s=(d(r)*_()).toFixed(A());if(!b())return s;const[f,n]=s.split("."),h=f.replace(/\B(?=(\d{3})+(?!\d))/g,",");return n!==void 0?`${h}.${n}`:h})());var u=K(),k=D(u);G(u),N(()=>{J(u,1,`tabular-nums ${M()??""}`),I(k,`${g()??""}${d(j)??""}${w()??""}`)}),O(v,u),T()}export{U as A}; diff --git a/apps/dashboard/build/_app/immutable/chunks/DcKTNC6e.js.br b/apps/dashboard/build/_app/immutable/chunks/DcKTNC6e.js.br deleted file mode 100644 index 62a2556..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/DcKTNC6e.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DcKTNC6e.js.gz b/apps/dashboard/build/_app/immutable/chunks/DcKTNC6e.js.gz deleted file mode 100644 index c230386..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/DcKTNC6e.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DdEqwvdI.js b/apps/dashboard/build/_app/immutable/chunks/DdEqwvdI.js new file mode 100644 index 0000000..9dfddf7 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/DdEqwvdI.js @@ -0,0 +1 @@ +var D=Object.defineProperty;var g=i=>{throw TypeError(i)};var F=(i,e,s)=>e in i?D(i,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[e]=s;var w=(i,e,s)=>F(i,typeof e!="symbol"?e+"":e,s),y=(i,e,s)=>e.has(i)||g("Cannot "+s);var t=(i,e,s)=>(y(i,e,"read from private field"),s?s.call(i):e.get(i)),l=(i,e,s)=>e.has(i)?g("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,s),M=(i,e,s,a)=>(y(i,e,"write to private field"),a?a.call(i,s):e.set(i,s),s);import{_ as x,aq as q,aw as k,ar as C,J as A,ai as B,N as J,U as N,ay as S,ak as U}from"./CpWkWWOo.js";var h,n,f,u,p,_,v;class E{constructor(e,s=!0){w(this,"anchor");l(this,h,new Map);l(this,n,new Map);l(this,f,new Map);l(this,u,new Set);l(this,p,!0);l(this,_,()=>{var e=x;if(t(this,h).has(e)){var s=t(this,h).get(e),a=t(this,n).get(s);if(a)q(a),t(this,u).delete(s);else{var c=t(this,f).get(s);c&&(t(this,n).set(s,c.effect),t(this,f).delete(s),c.fragment.lastChild.remove(),this.anchor.before(c.fragment),a=c.effect)}for(const[r,o]of t(this,h)){if(t(this,h).delete(r),r===e)break;const d=t(this,f).get(o);d&&(k(d.effect),t(this,f).delete(o))}for(const[r,o]of t(this,n)){if(r===s||t(this,u).has(r))continue;const d=()=>{if(Array.from(t(this,h).values()).includes(r)){var b=document.createDocumentFragment();S(o,b),b.append(A()),t(this,f).set(r,{effect:o,fragment:b})}else k(o);t(this,u).delete(r),t(this,n).delete(r)};t(this,p)||!a?(t(this,u).add(r),C(o,d,!1)):d()}}});l(this,v,e=>{t(this,h).delete(e);const s=Array.from(t(this,h).values());for(const[a,c]of t(this,f))s.includes(a)||(k(c.effect),t(this,f).delete(a))});this.anchor=e,M(this,p,s)}ensure(e,s){var a=x,c=U();if(s&&!t(this,n).has(e)&&!t(this,f).has(e))if(c){var r=document.createDocumentFragment(),o=A();r.append(o),t(this,f).set(e,{effect:B(()=>s(o)),fragment:r})}else t(this,n).set(e,B(()=>s(this.anchor)));if(t(this,h).set(a,e),c){for(const[d,m]of t(this,n))d===e?a.unskip_effect(m):a.skip_effect(m);for(const[d,m]of t(this,f))d===e?a.unskip_effect(m.effect):a.skip_effect(m.effect);a.oncommit(t(this,_)),a.ondiscard(t(this,v))}else J&&(this.anchor=N),t(this,_).call(this)}}h=new WeakMap,n=new WeakMap,f=new WeakMap,u=new WeakMap,p=new WeakMap,_=new WeakMap,v=new WeakMap;export{E as B}; diff --git a/apps/dashboard/build/_app/immutable/chunks/DdEqwvdI.js.br b/apps/dashboard/build/_app/immutable/chunks/DdEqwvdI.js.br new file mode 100644 index 0000000..4a2afa5 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/DdEqwvdI.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DdEqwvdI.js.gz b/apps/dashboard/build/_app/immutable/chunks/DdEqwvdI.js.gz new file mode 100644 index 0000000..56c70f0 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/DdEqwvdI.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/Dp1pzeXC.js b/apps/dashboard/build/_app/immutable/chunks/Dp1pzeXC.js deleted file mode 100644 index 287a815..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/Dp1pzeXC.js +++ /dev/null @@ -1 +0,0 @@ -const y="modulepreload",w=function(f,a){return new URL(f,a).href},E={},g=function(a,u,d){let h=Promise.resolve();if(u&&u.length>0){let s=function(e){return Promise.all(e.map(r=>Promise.resolve(r).then(l=>({status:"fulfilled",value:l}),l=>({status:"rejected",reason:l}))))};const t=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),v=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));h=s(u.map(e=>{if(e=w(e,d),e in E)return;E[e]=!0;const r=e.endsWith(".css"),l=r?'[rel="stylesheet"]':"";if(!!d)for(let i=t.length-1;i>=0;i--){const c=t[i];if(c.href===e&&(!r||c.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${e}"]${l}`))return;const n=document.createElement("link");if(n.rel=r?"stylesheet":y,r||(n.as="script"),n.crossOrigin="",n.href=e,v&&n.setAttribute("nonce",v),document.head.appendChild(n),r)return new Promise((i,c)=>{n.addEventListener("load",i),n.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${e}`)))})}))}function m(s){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=s,window.dispatchEvent(t),!t.defaultPrevented)throw s}return h.then(s=>{for(const t of s||[])t.status==="rejected"&&m(t.reason);return a().catch(m)})};export{g as _}; diff --git a/apps/dashboard/build/_app/immutable/chunks/Dp1pzeXC.js.br b/apps/dashboard/build/_app/immutable/chunks/Dp1pzeXC.js.br deleted file mode 100644 index 8835f5a..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/Dp1pzeXC.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/Dp1pzeXC.js.gz b/apps/dashboard/build/_app/immutable/chunks/Dp1pzeXC.js.gz deleted file mode 100644 index 4f6661e..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/Dp1pzeXC.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DrafHjYM.js b/apps/dashboard/build/_app/immutable/chunks/DrafHjYM.js deleted file mode 100644 index 1f1e177..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/DrafHjYM.js +++ /dev/null @@ -1 +0,0 @@ -import{v as s,w as v,x as o,y as c,z as b,A as m,B as h,C as y}from"./wpu9U-D0.js";function _(e,r,f=!1){if(e.multiple){if(r==null)return;if(!b(r))return m();for(var a of e.options)a.selected=r.includes(i(a));return}for(a of e.options){var t=i(a);if(h(t,r)){a.selected=!0;return}}(!f||r!==void 0)&&(e.selectedIndex=-1)}function q(e){var r=new MutationObserver(()=>{_(e,e.__value)});r.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),c(()=>{r.disconnect()})}function p(e,r,f=r){var a=new WeakSet,t=!0;s(e,"change",u=>{var l=u?"[selected]":":checked",n;if(e.multiple)n=[].map.call(e.querySelectorAll(l),i);else{var d=e.querySelector(l)??e.querySelector("option:not([disabled])");n=d&&i(d)}f(n),v!==null&&a.add(v)}),o(()=>{var u=r();if(e===document.activeElement){var l=y??v;if(a.has(l))return}if(_(e,u,t),t&&u===void 0){var n=e.querySelector(":checked");n!==null&&(u=i(n),f(u))}e.__value=u,t=!1}),q(e)}function i(e){return"__value"in e?e.__value:e.value}export{p as b}; diff --git a/apps/dashboard/build/_app/immutable/chunks/DrafHjYM.js.br b/apps/dashboard/build/_app/immutable/chunks/DrafHjYM.js.br deleted file mode 100644 index a9014f7..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/DrafHjYM.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DrafHjYM.js.gz b/apps/dashboard/build/_app/immutable/chunks/DrafHjYM.js.gz deleted file mode 100644 index 25caa92..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/DrafHjYM.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DzesjbbJ.js.br b/apps/dashboard/build/_app/immutable/chunks/DzesjbbJ.js.br deleted file mode 100644 index 7c75650..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/DzesjbbJ.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DzesjbbJ.js.gz b/apps/dashboard/build/_app/immutable/chunks/DzesjbbJ.js.gz deleted file mode 100644 index e0c61a9..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/DzesjbbJ.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CcUbQ_Wl.js b/apps/dashboard/build/_app/immutable/chunks/DzfRjky4.js similarity index 52% rename from apps/dashboard/build/_app/immutable/chunks/CcUbQ_Wl.js rename to apps/dashboard/build/_app/immutable/chunks/DzfRjky4.js index b9a927a..0f1e075 100644 --- a/apps/dashboard/build/_app/immutable/chunks/CcUbQ_Wl.js +++ b/apps/dashboard/build/_app/immutable/chunks/DzfRjky4.js @@ -1 +1 @@ -const e={fact:"#00A8FF",concept:"#9D00FF",event:"#FFB800",person:"#00FFD1",place:"#00D4FF",note:"#8B95A5",pattern:"#FF3CAC",decision:"#FF4757"},F={MemoryCreated:"#00FFD1",MemoryUpdated:"#00A8FF",MemoryDeleted:"#FF4757",MemoryPromoted:"#00FF88",MemoryDemoted:"#FF6B35",MemorySuppressed:"#A33FFF",MemoryUnsuppressed:"#14E8C6",Rac1CascadeSwept:"#6E3FFF",SearchPerformed:"#818CF8",DeepReferenceCompleted:"#C4B5FD",HookVerdictRecorded:"#F59E0B",DreamStarted:"#9D00FF",DreamProgress:"#B44AFF",DreamCompleted:"#C084FC",ConsolidationStarted:"#FFB800",ConsolidationCompleted:"#FF9500",RetentionDecayed:"#FF4757",ConnectionDiscovered:"#00D4FF",ActivationSpread:"#14E8C6",ImportanceScored:"#FF3CAC",Heartbeat:"#8B95A5"};export{F as E,e as N}; +const e={fact:"#00A8FF",concept:"#9D00FF",event:"#FFB800",person:"#00FFD1",place:"#00D4FF",note:"#8B95A5",pattern:"#FF3CAC",decision:"#FF4757"},F={MemoryCreated:"#00FFD1",MemoryUpdated:"#00A8FF",MemoryDeleted:"#FF4757",MemoryPromoted:"#00FF88",MemoryDemoted:"#FF6B35",MemorySuppressed:"#A33FFF",MemoryUnsuppressed:"#14E8C6",Rac1CascadeSwept:"#6E3FFF",SearchPerformed:"#818CF8",DeepReferenceCompleted:"#C4B5FD",DreamStarted:"#9D00FF",DreamProgress:"#B44AFF",DreamCompleted:"#C084FC",ConsolidationStarted:"#FFB800",ConsolidationCompleted:"#FF9500",RetentionDecayed:"#FF4757",ConnectionDiscovered:"#00D4FF",ActivationSpread:"#14E8C6",ImportanceScored:"#FF3CAC",Heartbeat:"#8B95A5"};export{F as E,e as N}; diff --git a/apps/dashboard/build/_app/immutable/chunks/DzfRjky4.js.br b/apps/dashboard/build/_app/immutable/chunks/DzfRjky4.js.br new file mode 100644 index 0000000..e2697c3 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/DzfRjky4.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DzfRjky4.js.gz b/apps/dashboard/build/_app/immutable/chunks/DzfRjky4.js.gz new file mode 100644 index 0000000..ec4983f Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/DzfRjky4.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/EqHb-9AZ.js b/apps/dashboard/build/_app/immutable/chunks/EqHb-9AZ.js deleted file mode 100644 index 459bed2..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/EqHb-9AZ.js +++ /dev/null @@ -1 +0,0 @@ -import{t as b}from"./60_R_Vbt.js";import{G as c}from"./wpu9U-D0.js";function A(i,u={},r,f){for(var a in r){var o=r[a];u[a]!==o&&(r[a]==null?i.style.removeProperty(a):i.style.setProperty(a,o,f))}}function P(i,u,r,f){var a=i.__style;if(c||a!==u){var o=b(u,f);(!c||o!==i.getAttribute("style"))&&(o==null?i.removeAttribute("style"):i.style.cssText=o),i.__style=u}else f&&(Array.isArray(f)?(A(i,r==null?void 0:r[0],f[0]),A(i,r==null?void 0:r[1],f[1],"important")):A(i,r,f));return f}export{P as s}; diff --git a/apps/dashboard/build/_app/immutable/chunks/EqHb-9AZ.js.br b/apps/dashboard/build/_app/immutable/chunks/EqHb-9AZ.js.br deleted file mode 100644 index c593293..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/EqHb-9AZ.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/EqHb-9AZ.js.gz b/apps/dashboard/build/_app/immutable/chunks/EqHb-9AZ.js.gz deleted file mode 100644 index 1fda5c7..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/EqHb-9AZ.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/GG5zm9kr.js b/apps/dashboard/build/_app/immutable/chunks/GG5zm9kr.js new file mode 100644 index 0000000..18d1867 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/GG5zm9kr.js @@ -0,0 +1 @@ +import{aB as a,az as t,w as u,v as o}from"./CpWkWWOo.js";function c(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function l(e){t===null&&c(),u&&t.l!==null?i(t).m.push(e):a(()=>{const n=o(e);if(typeof n=="function")return n})}function f(e){t===null&&c(),l(()=>()=>o(e))}function i(e){var n=e.l;return n.u??(n.u={a:[],b:[],m:[]})}export{f as a,l as o}; diff --git a/apps/dashboard/build/_app/immutable/chunks/GG5zm9kr.js.br b/apps/dashboard/build/_app/immutable/chunks/GG5zm9kr.js.br new file mode 100644 index 0000000..62d7832 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/GG5zm9kr.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/GG5zm9kr.js.gz b/apps/dashboard/build/_app/immutable/chunks/GG5zm9kr.js.gz new file mode 100644 index 0000000..48eecbb Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/GG5zm9kr.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/LDOJP_6N.js b/apps/dashboard/build/_app/immutable/chunks/LDOJP_6N.js deleted file mode 100644 index 28f1b46..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/LDOJP_6N.js +++ /dev/null @@ -1 +0,0 @@ -import{q as p,E as t}from"./wpu9U-D0.js";import{B as c}from"./BWk3o_TN.js";function E(r,s,...a){var e=new c(r);p(()=>{const n=s()??null;e.ensure(n,n&&(o=>n(o,...a)))},t)}export{E as s}; diff --git a/apps/dashboard/build/_app/immutable/chunks/LDOJP_6N.js.br b/apps/dashboard/build/_app/immutable/chunks/LDOJP_6N.js.br deleted file mode 100644 index 23ccb63..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/LDOJP_6N.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/LDOJP_6N.js.gz b/apps/dashboard/build/_app/immutable/chunks/LDOJP_6N.js.gz deleted file mode 100644 index 792b2a5..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/LDOJP_6N.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/MAY1QfFZ.js b/apps/dashboard/build/_app/immutable/chunks/MAY1QfFZ.js new file mode 100644 index 0000000..bf47818 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/MAY1QfFZ.js @@ -0,0 +1 @@ +import{d as i,w as S}from"./BeMFXnHE.js";const b=200;function H(){const{subscribe:t,set:o,update:e}=S({connected:!1,events:[],lastHeartbeat:null,error:null});let n=null,a=null,d=0;function m(s){const c=s||(window.location.port==="5173"?`ws://${window.location.hostname}:3927/ws`:`ws://${window.location.host}/ws`);if((n==null?void 0:n.readyState)!==WebSocket.OPEN)try{n=new WebSocket(c),n.onopen=()=>{d=0,e(r=>({...r,connected:!0,error:null}))},n.onmessage=r=>{try{const l=JSON.parse(r.data);e(f=>{if(l.type==="Heartbeat")return{...f,lastHeartbeat:l};const $=[l,...f.events].slice(0,b);return{...f,events:$}})}catch(l){console.warn("[vestige] Failed to parse WebSocket message:",l)}},n.onclose=()=>{e(r=>({...r,connected:!1})),p(c)},n.onerror=()=>{e(r=>({...r,error:"WebSocket connection failed"}))}}catch(r){e(l=>({...l,error:String(r)}))}}function p(s){a&&clearTimeout(a);const c=Math.min(1e3*2**d,3e4);d++,a=setTimeout(()=>m(s),c)}function v(){a&&clearTimeout(a),n==null||n.close(),n=null,o({connected:!1,events:[],lastHeartbeat:null,error:null})}function h(){e(s=>({...s,events:[]}))}function w(s){e(c=>{const r=[s,...c.events].slice(0,b);return{...c,events:r}})}return{subscribe:t,connect:m,disconnect:v,clearEvents:h,injectEvent:w}}const u=H(),g=i(u,t=>t.connected),k=i(u,t=>t.events);i(u,t=>t.lastHeartbeat);const M=i(u,t=>{var o,e;return((e=(o=t.lastHeartbeat)==null?void 0:o.data)==null?void 0:e.memory_count)??0}),E=i(u,t=>{var o,e;return((e=(o=t.lastHeartbeat)==null?void 0:o.data)==null?void 0:e.avg_retention)??0}),T=i(u,t=>{var o,e;return((e=(o=t.lastHeartbeat)==null?void 0:o.data)==null?void 0:e.suppressed_count)??0}),W=i(u,t=>{var o,e;return((e=(o=t.lastHeartbeat)==null?void 0:o.data)==null?void 0:e.uptime_secs)??0});function _(t){if(!Number.isFinite(t)||t<0)return"—";const o=Math.floor(t/86400),e=Math.floor(t%86400/3600),n=Math.floor(t%3600/60),a=Math.floor(t%60);return o>0?e>0?`${o}d ${e}h`:`${o}d`:e>0?n>0?`${e}h ${n}m`:`${e}h`:n>0?a>0?`${n}m ${a}s`:`${n}m`:`${a}s`}export{E as a,k as e,_ as f,g as i,M as m,T as s,W as u,u as w}; diff --git a/apps/dashboard/build/_app/immutable/chunks/MAY1QfFZ.js.br b/apps/dashboard/build/_app/immutable/chunks/MAY1QfFZ.js.br new file mode 100644 index 0000000..04a9af2 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/MAY1QfFZ.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/MAY1QfFZ.js.gz b/apps/dashboard/build/_app/immutable/chunks/MAY1QfFZ.js.gz new file mode 100644 index 0000000..8b5bf6e Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/MAY1QfFZ.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/Ma4NfFrG.js b/apps/dashboard/build/_app/immutable/chunks/Ma4NfFrG.js deleted file mode 100644 index 8a212fc..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/Ma4NfFrG.js +++ /dev/null @@ -1,2 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CfobEeQC.js","./C-SOZ1Oi.js","./Bzak7iHL.js","./TZu9D97Z.js","./wpu9U-D0.js","./D8mhvFt8.js","./DKve45Wd.js","./BWk3o_TN.js","./60_R_Vbt.js","./EqHb-9AZ.js","./CnZzd20v.js","./ByYB047u.js","./Bxs5UR9-.js","./g5OnrUYZ.js","./CcUbQ_Wl.js","./DrafHjYM.js","./BLadwbF7.js","./Dp1pzeXC.js","./D7A-gG4Z.js","../assets/Icon.tTjeJXhC.css","./CmbJHhgy.js","../assets/Dropdown.C2Z-7Phd.css","./CZfHMhLI.js","./BhIgFntf.js","../assets/11.BxoW8Jf1.css","./BZQzXWp7.js","./CLrXVRi2.js","./C8kRUgax.js"])))=>i.map(i=>d[i]); -var x=Object.defineProperty;var C=(m,t,e)=>t in m?x(m,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):m[t]=e;var i=(m,t,e)=>C(m,typeof t!="symbol"?t+"":t,e);import{_ as d}from"./Dp1pzeXC.js";import{V as p,M as w,a as T}from"./C-SOZ1Oi.js";const f=new p(0,0,0),R=30,l=44;function S(){return typeof navigator<"u"&&"gpu"in navigator}class V{constructor(t){i(this,"container");i(this,"deps");i(this,"renderer");i(this,"scene");i(this,"camera");i(this,"storm");i(this,"post",null);i(this,"booted",!1);i(this,"target",new p(0,0,0));i(this,"flythrough",0);i(this,"prevCamPos",new p);i(this,"camVel",new p);this.container=t}get cameraRef(){return this.camera}async boot(){if(this.booted)return;if(!S())throw new Error("WebGPU not supported");const t=await d(()=>import("./CfobEeQC.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]),import.meta.url),e=await d(()=>import("./BZQzXWp7.js"),__vite__mapDeps([25,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]),import.meta.url),s=await d(()=>import("./CLrXVRi2.js"),__vite__mapDeps([26,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]),import.meta.url),{SemanticComputeStorm:a}=await d(async()=>{const{SemanticComputeStorm:n}=await import("./C8kRUgax.js");return{SemanticComputeStorm:n}},__vite__mapDeps([27,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]),import.meta.url);if(this.deps={WebGPURenderer:t.WebGPURenderer,PostProcessing:t.PostProcessing,StormCtor:a,tsl:e,bloomMod:s},!t.WebGPURenderer||!t.Scene||!t.PerspectiveCamera||!t.Color)throw new Error("[cinema] three/webgpu is missing expected exports");const h=Math.max(1,this.container.clientWidth),c=Math.max(1,this.container.clientHeight);this.scene=new t.Scene,this.scene.background=new t.Color(131594),this.camera=new t.PerspectiveCamera(60,h/c,.1,2e3),this.camera.position.set(0,18,60);const o=new this.deps.WebGPURenderer({antialias:!0,alpha:!1});o.setPixelRatio(Math.min(window.devicePixelRatio,2)),o.setSize(h,c),await o.init(),this.container.appendChild(o.domElement),this.renderer=o,this.storm=new this.deps.StormCtor(o,this.scene,{});try{const{pass:n,mrt:b,output:g,emissive:_}=this.deps.tsl,r=n(this.scene,this.camera);if(typeof(r==null?void 0:r.setMRT)!="function"||typeof(r==null?void 0:r.getTextureNode)!="function")throw new Error("three/tsl pass() API mismatch — setMRT/getTextureNode missing");r.setMRT(b({output:g,emissive:_}));const M=r.getTextureNode("output"),P=r.getTextureNode("emissive"),v=this.deps.bloomMod.bloom(P,.6,.65,.35),u=new this.deps.PostProcessing(o);u.outputNode=M.add(v),this.post=u}catch(n){console.warn("[cinema] selective bloom unavailable, rendering without MRT:",n),this.post=null}this.booted=!0}transitionTo(t,e,s="II",a=99){this.booted&&this.storm.transitionTo(t,f,s,a)}dreamBeat(){this.booted&&this.storm.dreamBeat()}setFlythrough(t){this.flythrough=w.clamp(t,0,1),this.booted&&this.storm.setStreak(t)}setStreak(t){this.booted&&this.storm.setStreak(t)}setCameraVel(t){this.booted&&this.storm.setCameraVel(t)}async render(t){if(!this.booted)return;this.camVel.copy(this.camera.position).sub(this.prevCamPos).divideScalar(Math.max(t,.001)),this.prevCamPos.copy(this.camera.position);const e=w.lerp(R,6,this.flythrough),s=this.camera.position.length();if(sl||!Number.isFinite(s)){const n=Math.min(l,Math.max(e,s||l));s>.001?this.camera.position.setLength(n):this.camera.position.set(0,12,n)}this.camera.lookAt(f);const a=this.camVel.clone().applyMatrix3(new T().setFromMatrix4(this.camera.matrixWorldInverse)).negate();this.storm.setCameraVel(a);const h=this.camera.position.length(),c=this.camera.fov*Math.PI/180,o=Math.tan(c/2)*h*.82;this.storm.setContainRadius(o),await this.storm.update(t),this.post?await this.post.renderAsync():await this.renderer.renderAsync(this.scene,this.camera)}resize(){if(!this.booted)return;const t=Math.max(1,this.container.clientWidth),e=Math.max(1,this.container.clientHeight);this.camera.aspect=t/e,this.camera.updateProjectionMatrix(),this.renderer.setSize(t,e)}dispose(){var t,e,s,a,h;this.booted&&((t=this.storm)==null||t.dispose(),(s=(e=this.renderer)==null?void 0:e.dispose)==null||s.call(e),(h=(a=this.renderer)==null?void 0:a.domElement)!=null&&h.parentNode&&this.renderer.domElement.parentNode.removeChild(this.renderer.domElement),this.booted=!1)}}export{V as CinemaSandbox,S as isWebGPUSupported}; diff --git a/apps/dashboard/build/_app/immutable/chunks/Ma4NfFrG.js.br b/apps/dashboard/build/_app/immutable/chunks/Ma4NfFrG.js.br deleted file mode 100644 index d7d7852..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/Ma4NfFrG.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/Ma4NfFrG.js.gz b/apps/dashboard/build/_app/immutable/chunks/Ma4NfFrG.js.gz deleted file mode 100644 index 6441d50..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/Ma4NfFrG.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/P1-U_Xsj.js b/apps/dashboard/build/_app/immutable/chunks/P1-U_Xsj.js deleted file mode 100644 index 192a855..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/P1-U_Xsj.js +++ /dev/null @@ -1 +0,0 @@ -import{x as f,P as d,Q as l,a6 as u,aa as p}from"./wpu9U-D0.js";function m(e,n,t){f(()=>{var r=d(()=>n(e,t==null?void 0:t())||{});if(t&&(r!=null&&r.update)){var a=!1,i={};l(()=>{var s=t();u(s),a&&p(i,s)&&(i=s,r.update(s))}),a=!0}if(r!=null&&r.destroy)return()=>r.destroy()})}const y=()=>{var e;return typeof window<"u"&&((e=window.matchMedia)==null?void 0:e.call(window,"(prefers-reduced-motion: reduce)").matches)};function x(e,n={}){const{y:t=16,delay:r=0,once:a=!0,threshold:i=.12}=n;if(y())return e.classList.add("reveal-in"),{};e.classList.add("reveal"),e.style.setProperty("--reveal-y",`${t}px`),r&&e.style.setProperty("--reveal-delay",`${r}ms`);const s=new IntersectionObserver(o=>{for(const c of o)c.isIntersecting?(e.classList.add("reveal-in"),a&&s.unobserve(e)):a||e.classList.remove("reveal-in")},{threshold:i,rootMargin:"0px 0px -8% 0px"});return s.observe(e),{destroy(){s.disconnect()}}}export{m as a,x as r}; diff --git a/apps/dashboard/build/_app/immutable/chunks/P1-U_Xsj.js.br b/apps/dashboard/build/_app/immutable/chunks/P1-U_Xsj.js.br deleted file mode 100644 index 6cee039..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/P1-U_Xsj.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/P1-U_Xsj.js.gz b/apps/dashboard/build/_app/immutable/chunks/P1-U_Xsj.js.gz deleted file mode 100644 index 36ae23b..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/P1-U_Xsj.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/TZu9D97Z.js b/apps/dashboard/build/_app/immutable/chunks/TZu9D97Z.js deleted file mode 100644 index f3cc3c8..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/TZu9D97Z.js +++ /dev/null @@ -1 +0,0 @@ -import{o as l,a2 as o,al as u,P as n,as as c,at as r,O as i}from"./wpu9U-D0.js";import{h as f,m,u as _}from"./D8mhvFt8.js";function a(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function s(e){o===null&&a(),u&&o.l!==null?d(o).m.push(e):l(()=>{const t=n(e);if(typeof t=="function")return t})}function p(e){o===null&&a(),s(()=>()=>n(e))}function d(e){var t=e.l;return t.u??(t.u={a:[],b:[],m:[]})}const b=Object.freeze(Object.defineProperty({__proto__:null,flushSync:c,hydrate:f,mount:m,onDestroy:p,onMount:s,settled:r,tick:i,unmount:_,untrack:n},Symbol.toStringTag,{value:"Module"}));export{p as a,s as o,b as s}; diff --git a/apps/dashboard/build/_app/immutable/chunks/TZu9D97Z.js.br b/apps/dashboard/build/_app/immutable/chunks/TZu9D97Z.js.br deleted file mode 100644 index 86c1102..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/TZu9D97Z.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/TZu9D97Z.js.gz b/apps/dashboard/build/_app/immutable/chunks/TZu9D97Z.js.gz deleted file mode 100644 index 86a9647..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/TZu9D97Z.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/V6gjw5Ec.js b/apps/dashboard/build/_app/immutable/chunks/V6gjw5Ec.js new file mode 100644 index 0000000..f9c6462 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/V6gjw5Ec.js @@ -0,0 +1 @@ +import{k as L,l as D,P as T,g as P,c as B,h as b,m as Y,o as h,D as x,q as M,v as N,w as U,x as q,y as w,z,A as $,B as y,S as C,L as G}from"./CpWkWWOo.js";import{c as Z}from"./C6HuKgyx.js";function H(r,a,t,s){var o;var f=!U||(t&q)!==0,v=(t&M)!==0,E=(t&y)!==0,n=s,S=!0,g=()=>(S&&(S=!1,n=E?N(s):s),n),u;if(v){var O=C in r||G in r;u=((o=L(r,a))==null?void 0:o.set)??(O&&a in r?e=>r[a]=e:void 0)}var _,I=!1;v?[_,I]=Z(()=>r[a]):_=r[a],_===void 0&&s!==void 0&&(_=g(),u&&(f&&D(),u(_)));var i;if(f?i=()=>{var e=r[a];return e===void 0?g():(S=!0,e)}:i=()=>{var e=r[a];return e!==void 0&&(n=void 0),e===void 0?n:e},f&&(t&T)===0)return i;if(u){var R=r.$$legacy;return(function(e,l){return arguments.length>0?((!f||!l||R||I)&&u(l?i():e),e):i()})}var c=!1,d=((t&w)!==0?z:$)(()=>(c=!1,i()));v&&P(d);var m=h;return(function(e,l){if(arguments.length>0){const A=l?P(d):f&&v?B(e):e;return b(d,A),c=!0,n!==void 0&&(n=A),e}return Y&&c||(m.f&x)!==0?d.v:P(d)})}export{H as p}; diff --git a/apps/dashboard/build/_app/immutable/chunks/V6gjw5Ec.js.br b/apps/dashboard/build/_app/immutable/chunks/V6gjw5Ec.js.br new file mode 100644 index 0000000..e9fafc8 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/V6gjw5Ec.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/V6gjw5Ec.js.gz b/apps/dashboard/build/_app/immutable/chunks/V6gjw5Ec.js.gz new file mode 100644 index 0000000..a76e9e0 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/V6gjw5Ec.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/aVbAZ-t7.js b/apps/dashboard/build/_app/immutable/chunks/aVbAZ-t7.js new file mode 100644 index 0000000..0d246ca --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/aVbAZ-t7.js @@ -0,0 +1 @@ +import{t as A}from"./BKuqSeVd.js";import{N as o}from"./CpWkWWOo.js";function p(i,N,f,b,u,r){var l=i.__className;if(o||l!==f||l===void 0){var t=A(f,b,r);(!o||t!==i.getAttribute("class"))&&(t==null?i.removeAttribute("class"):N?i.className=t:i.setAttribute("class",t)),i.__className=f}else if(r&&u!==r)for(var a in r){var g=!!r[a];(u==null||g!==!!u[a])&&i.classList.toggle(a,g)}return r}export{p as s}; diff --git a/apps/dashboard/build/_app/immutable/chunks/aVbAZ-t7.js.br b/apps/dashboard/build/_app/immutable/chunks/aVbAZ-t7.js.br new file mode 100644 index 0000000..d857e71 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/aVbAZ-t7.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/aVbAZ-t7.js.gz b/apps/dashboard/build/_app/immutable/chunks/aVbAZ-t7.js.gz new file mode 100644 index 0000000..c673050 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/aVbAZ-t7.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/dCAmqaEc.js b/apps/dashboard/build/_app/immutable/chunks/dCAmqaEc.js deleted file mode 100644 index 32ca8e1..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/dCAmqaEc.js +++ /dev/null @@ -1 +0,0 @@ -import{s as ae}from"./TZu9D97Z.js";import{c as ne,H as $,N as M,r as mt,i as _t,b as L,s as C,p as x,n as ft,f as Nt,g as ut,a as J,d as it,S as $t,P as re,e as oe,h as se,o as Dt,j as q,k as ie,l as qt,m as ce,q as le,t as Kt,u as Pt,v as fe}from"./Bxs5UR9-.js";import{O as X,at as ue}from"./wpu9U-D0.js";import{w as he}from"./D8mhvFt8.js";class wt{constructor(a,e){this.status=a,typeof e=="string"?this.body={message:e}:e?this.body=e:this.body={message:`Error: ${a}`}}toString(){return JSON.stringify(this.body)}}class vt{constructor(a,e){this.status=a,this.location=e}}class yt extends Error{constructor(a,e,r){super(r),this.status=a,this.text=e}}const de=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function pe(t){const a=[];return{pattern:t==="/"?/^\/$/:new RegExp(`^${me(t).map(r=>{const n=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(n)return a.push({name:n[1],matcher:n[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const o=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(o)return a.push({name:o[1],matcher:o[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const s=r.split(/\[(.+?)\](?!\])/);return"/"+s.map((c,l)=>{if(l%2){if(c.startsWith("x+"))return ct(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return ct(String.fromCharCode(...c.slice(2).split("-").map(_=>parseInt(_,16))));const h=de.exec(c),[,u,w,f,d]=h;return a.push({name:f,matcher:d,optional:!!u,rest:!!w,chained:w?l===1&&s[0]==="":!1}),w?"([^]*?)":u?"([^/]*)?":"([^/]+?)"}return ct(c)}).join("")}).join("")}/?$`),params:a}}function ge(t){return t!==""&&!/^\([^)]+\)$/.test(t)}function me(t){return t.slice(1).split("/").filter(ge)}function _e(t,a,e){const r={},n=t.slice(1),o=n.filter(i=>i!==void 0);let s=0;for(let i=0;ih).join("/"),s=0),l===void 0)if(c.rest)l="";else continue;if(!c.matcher||e[c.matcher](l)){r[c.name]=l;const h=a[i+1],u=n[i+1];h&&!h.rest&&h.optional&&u&&c.chained&&(s=0),!h&&!u&&Object.keys(r).length===o.length&&(s=0);continue}if(c.optional&&c.chained){s++;continue}return}if(!s)return r}function ct(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function we({nodes:t,server_loads:a,dictionary:e,matchers:r}){const n=new Set(a);return Object.entries(e).map(([i,[c,l,h]])=>{const{pattern:u,params:w}=pe(i),f={id:i,exec:d=>{const _=u.exec(d);if(_)return _e(_,w,r)},errors:[1,...h||[]].map(d=>t[d]),layouts:[0,...l||[]].map(s),leaf:o(c)};return f.errors.length=f.layouts.length=Math.max(f.errors.length,f.layouts.length),f});function o(i){const c=i<0;return c&&(i=~i),[c,t[i]]}function s(i){return i===void 0?i:[n.has(i),t[i]]}}function Ft(t,a=JSON.parse){try{return a(sessionStorage[t])}catch{}}function It(t,a,e=JSON.stringify){const r=e(a);try{sessionStorage[t]=r}catch{}}function ve(t){return t.filter(a=>a!=null)}function Et(t){return t instanceof wt||t instanceof yt?t.status:500}function ye(t){return t instanceof yt?t.text:"Internal Error"}const{onMount:Ee}=ae,be=new Set(["icon","shortcut icon","apple-touch-icon"]),I=Ft(Kt)??{},B=Ft(qt)??{},P={url:Pt({}),page:Pt({}),navigating:he(null),updated:ne()};function bt(t){I[t]=C()}function ke(t,a){let e=t+1;for(;I[e];)delete I[e],e+=1;for(e=a+1;B[e];)delete B[e],e+=1}function V(t,a=!1){return a?location.replace(t.href):location.href=t.href,new Promise(()=>{})}async function Mt(){if("serviceWorker"in navigator){const t=await navigator.serviceWorker.getRegistration(L||"/");t&&await t.update()}}function Tt(){}let kt,ht,Q,U,dt,b;const Z=[],tt=[];let v=null;function pt(){var t;(t=v==null?void 0:v.fork)==null||t.then(a=>a==null?void 0:a.discard()),v=null}const G=new Map,Bt=new Set,Vt=new Set,F=new Set;let m={branch:[],error:null,url:null},Ht=!1,et=!1,Ot=!0,H=!1,K=!1,Yt=!1,St=!1,zt,E,R,O;const at=new Set,Ct=new Map;async function He(t,a,e){var o,s,i,c,l;(o=globalThis.__sveltekit_1wncwk)!=null&&o.data&&globalThis.__sveltekit_1wncwk.data,document.URL!==location.href&&(location.href=location.href),b=t,await((i=(s=t.hooks).init)==null?void 0:i.call(s)),kt=we(t),U=document.documentElement,dt=a,ht=t.nodes[0],Q=t.nodes[1],ht(),Q(),E=(c=history.state)==null?void 0:c[$],R=(l=history.state)==null?void 0:l[M],E||(E=R=Date.now(),history.replaceState({...history.state,[$]:E,[M]:R},""));const r=I[E];function n(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}e?(n(),await $e(dt,e)):(await D({type:"enter",url:mt(b.hash?Ke(new URL(location.href)):location.href),replace_state:!0}),n()),Ne()}function Se(){Z.length=0,St=!1}function Wt(t){tt.some(a=>a==null?void 0:a.snapshot)&&(B[t]=tt.map(a=>{var e;return(e=a==null?void 0:a.snapshot)==null?void 0:e.capture()}))}function Gt(t){var a;(a=B[t])==null||a.forEach((e,r)=>{var n,o;(o=(n=tt[r])==null?void 0:n.snapshot)==null||o.restore(e)})}function jt(){bt(E),It(Kt,I),Wt(R),It(qt,B)}async function Jt(t,a,e,r){let n;a.invalidateAll&&pt(),await D({type:"goto",url:mt(t),keepfocus:a.keepFocus,noscroll:a.noScroll,replace_state:a.replaceState,state:a.state,redirect_count:e,nav_token:r,accept:()=>{a.invalidateAll&&(St=!0,n=[...Ct.keys()]),a.invalidate&&a.invalidate.forEach(je)}}),a.invalidateAll&&X().then(X).then(()=>{Ct.forEach(({resource:o},s)=>{var i;n!=null&&n.includes(s)&&((i=o.refresh)==null||i.call(o))})})}async function Re(t){if(t.id!==(v==null?void 0:v.id)){pt();const a={};at.add(a),v={id:t.id,token:a,promise:Qt({...t,preload:a}).then(e=>(at.delete(a),e.type==="loaded"&&e.state.error&&pt(),e)),fork:null}}return v.promise}async function lt(t){var e;const a=(e=await ot(t,!1))==null?void 0:e.route;a&&await Promise.all([...a.layouts,a.leaf].filter(Boolean).map(r=>r[1]()))}async function Xt(t,a,e){var n;m=t.state;const r=document.querySelector("style[data-sveltekit]");if(r&&r.remove(),Object.assign(x,t.props.page),zt=new b.root({target:a,props:{...t.props,stores:P,components:tt},hydrate:e,sync:!1}),await Promise.resolve(),Gt(R),e){const o={from:null,to:{params:m.params,route:{id:((n=m.route)==null?void 0:n.id)??null},url:new URL(location.href),scroll:I[E]??C()},willUnload:!1,type:"enter",complete:Promise.resolve()};F.forEach(s=>s(o))}et=!0}function nt({url:t,params:a,branch:e,status:r,error:n,route:o,form:s}){let i="never";if(L&&(t.pathname===L||t.pathname===L+"/"))i="always";else for(const f of e)(f==null?void 0:f.slash)!==void 0&&(i=f.slash);t.pathname=se(t.pathname,i),t.search=t.search;const c={type:"loaded",state:{url:t,params:a,branch:e,error:n,route:o},props:{constructors:ve(e).map(f=>f.node.component),page:At(x)}};s!==void 0&&(c.props.form=s);let l={},h=!x,u=0;for(let f=0;fi(new URL(s))))return!0;return!1}function xt(t,a){return(t==null?void 0:t.type)==="data"?t:(t==null?void 0:t.type)==="skip"?a??null:null}function Ue(t,a){if(!t)return new Set(a.searchParams.keys());const e=new Set([...t.searchParams.keys(),...a.searchParams.keys()]);for(const r of e){const n=t.searchParams.getAll(r),o=a.searchParams.getAll(r);n.every(s=>o.includes(s))&&o.every(s=>n.includes(s))&&e.delete(r)}return e}function Ae({error:t,url:a,route:e,params:r}){return{type:"loaded",state:{error:t,url:a,route:e,params:r,branch:[]},props:{page:At(x),constructors:[]}}}async function Qt({id:t,invalidating:a,url:e,params:r,route:n,preload:o}){if((v==null?void 0:v.id)===t)return at.delete(v.token),v.promise;const{errors:s,layouts:i,leaf:c}=n,l=[...i,c];s.forEach(g=>g==null?void 0:g().catch(()=>{})),l.forEach(g=>g==null?void 0:g[1]().catch(()=>{}));const h=m.url?t!==rt(m.url):!1,u=m.route?n.id!==m.route.id:!1,w=Ue(m.url,e);let f=!1;const d=l.map(async(g,p)=>{var A;if(!g)return;const y=m.branch[p];return g[1]===(y==null?void 0:y.loader)&&!Le(f,u,h,w,(A=y.universal)==null?void 0:A.uses,r)?y:(f=!0,Rt({loader:g[1],url:e,params:r,route:n,parent:async()=>{var z;const T={};for(let j=0;j{});const _=[];for(let g=0;gPromise.resolve({}),server_data_node:xt(o)}),i={node:await Q(),loader:Q,universal:null,server:null,data:null};return nt({url:e,params:n,branch:[s,i],status:t,error:a,route:null})}catch(s){if(s instanceof vt)return Jt(new URL(s.location,location.href),{},0);throw s}}async function Ie(t){const a=t.href;if(G.has(a))return G.get(a);let e;try{const r=(async()=>{let n=await b.hooks.reroute({url:new URL(t),fetch:async(o,s)=>xe(o,s,t).promise})??t;if(typeof n=="string"){const o=new URL(t);b.hash?o.hash=n:o.pathname=n,n=o}return n})();G.set(a,r),e=await r}catch{G.delete(a);return}return e}async function ot(t,a){if(t&&!_t(t,L,b.hash)){const e=await Ie(t);if(!e)return;const r=Te(e);for(const n of kt){const o=n.exec(r);if(o)return{id:rt(t),invalidating:a,route:n,params:oe(o),url:t}}}}function Te(t){return ie(b.hash?t.hash.replace(/^#/,"").replace(/[?#].+/,""):t.pathname.slice(L.length))||"/"}function rt(t){return(b.hash?t.hash.replace(/^#/,""):t.pathname)+t.search}function Zt({url:t,type:a,intent:e,delta:r,event:n,scroll:o}){let s=!1;const i=Ut(m,e,t,a,o??null);r!==void 0&&(i.navigation.delta=r),n!==void 0&&(i.navigation.event=n);const c={...i.navigation,cancel:()=>{s=!0,i.reject(new Error("navigation cancelled"))}};return H||Bt.forEach(l=>l(c)),s?null:i}async function D({type:t,url:a,popped:e,keepfocus:r,noscroll:n,replace_state:o,state:s={},redirect_count:i=0,nav_token:c={},accept:l=Tt,block:h=Tt,event:u}){var j;const w=O;O=c;const f=await ot(a,!1),d=t==="enter"?Ut(m,f,a,t):Zt({url:a,type:t,delta:e==null?void 0:e.delta,intent:f,scroll:e==null?void 0:e.scroll,event:u});if(!d){h(),O===c&&(O=w);return}const _=E,g=R;l(),H=!0,et&&d.navigation.type!=="enter"&&P.navigating.set(ft.current=d.navigation);let p=f&&await Qt(f);if(!p){if(_t(a,L,b.hash))return await V(a,o);p=await te(a,{id:null},await Y(new yt(404,"Not Found",`Not found: ${a.pathname}`),{url:a,params:{},route:{id:null}}),404,o)}if(a=(f==null?void 0:f.url)||a,O!==c)return d.reject(new Error("navigation aborted")),!1;if(p.type==="redirect"){if(i<20){await D({type:t,url:new URL(p.location,a),popped:e,keepfocus:r,noscroll:n,replace_state:o,state:s,redirect_count:i+1,nav_token:c}),d.fulfil(void 0);return}p=await Lt({status:500,error:await Y(new Error("Redirect loop"),{url:a,params:{},route:{id:null}}),url:a,route:{id:null}})}else p.props.page.status>=400&&await P.updated.check()&&(await Mt(),await V(a,o));if(Se(),bt(_),Wt(g),p.props.page.url.pathname!==a.pathname&&(a.pathname=p.props.page.url.pathname),s=e?e.state:s,!e){const k=o?0:1,W={[$]:E+=k,[M]:R+=k,[$t]:s};(o?history.replaceState:history.pushState).call(history,W,"",a),o||ke(E,R)}const y=f&&(v==null?void 0:v.id)===f.id?v.fork:null;v=null,p.props.page.state=s;let S;if(et){const k=(await Promise.all(Array.from(Vt,N=>N(d.navigation)))).filter(N=>typeof N=="function");if(k.length>0){let N=function(){k.forEach(st=>{F.delete(st)})};k.push(N),k.forEach(st=>{F.add(st)})}m=p.state,p.props.page&&(p.props.page.url=a);const W=y&&await y;W?S=W.commit():(zt.$set(p.props),fe(p.props.page),S=(j=ue)==null?void 0:j()),Yt=!0}else await Xt(p,dt,!1);const{activeElement:A}=document;await S,await X(),await X();let T=null;if(Ot){const k=e?e.scroll:n?C():null;k?scrollTo(k.x,k.y):(T=a.hash&&document.getElementById(ee(a)))?T.scrollIntoView():scrollTo(0,0)}const z=document.activeElement!==A&&document.activeElement!==document.body;!r&&!z&&qe(a,!T),Ot=!0,p.props.page&&Object.assign(x,p.props.page),H=!1,t==="popstate"&&Gt(R),d.fulfil(void 0),d.navigation.to&&(d.navigation.to.scroll=C()),F.forEach(k=>k(d.navigation)),P.navigating.set(ft.current=null)}async function te(t,a,e,r,n){return t.origin===Dt&&t.pathname===location.pathname&&!Ht?await Lt({status:r,error:e,url:t,route:a}):await V(t,n)}function Oe(){let t,a={element:void 0,href:void 0},e;U.addEventListener("mousemove",i=>{const c=i.target;clearTimeout(t),t=setTimeout(()=>{o(c,q.hover)},20)});function r(i){i.defaultPrevented||o(i.composedPath()[0],q.tap)}U.addEventListener("mousedown",r),U.addEventListener("touchstart",r,{passive:!0});const n=new IntersectionObserver(i=>{for(const c of i)c.isIntersecting&&(lt(new URL(c.target.href)),n.unobserve(c.target))},{threshold:0});async function o(i,c){const l=Nt(i,U),h=l===a.element&&(l==null?void 0:l.href)===a.href&&c>=e;if(!l||h)return;const{url:u,external:w,download:f}=ut(l,L,b.hash);if(w||f)return;const d=J(l),_=u&&rt(m.url)===rt(u);if(!(d.reload||_))if(c<=d.preload_data){a={element:l,href:l.href},e=q.tap;const g=await ot(u,!1);if(!g)return;Re(g)}else c<=d.preload_code&&(a={element:l,href:l.href},e=c,lt(u))}function s(){n.disconnect();for(const i of U.querySelectorAll("a")){const{url:c,external:l,download:h}=ut(i,L,b.hash);if(l||h)continue;const u=J(i);u.reload||(u.preload_code===q.viewport&&n.observe(i),u.preload_code===q.eager&<(c))}}F.add(s),s()}function Y(t,a){if(t instanceof wt)return t.body;const e=Et(t),r=ye(t);return b.hooks.handleError({error:t,event:a,status:e,message:r})??{message:r}}function Ce(t,a){Ee(()=>(t.add(a),()=>{t.delete(a)}))}function Ye(t){Ce(Vt,t)}function ze(t,a={}){return t=new URL(mt(t)),t.origin!==Dt?Promise.reject(new Error("goto: invalid URL")):Jt(t,a,0)}function je(t){if(typeof t=="function")Z.push(t);else{const{href:a}=new URL(t,location.href);Z.push(e=>e.href===a)}}function Ne(){var a;history.scrollRestoration="manual",addEventListener("beforeunload",e=>{let r=!1;if(jt(),!H){const n=Ut(m,void 0,null,"leave"),o={...n.navigation,cancel:()=>{r=!0,n.reject(new Error("navigation cancelled"))}};Bt.forEach(s=>s(o))}r?(e.preventDefault(),e.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&jt()}),(a=navigator.connection)!=null&&a.saveData||Oe(),U.addEventListener("click",async e=>{if(e.button||e.which!==1||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.defaultPrevented)return;const r=Nt(e.composedPath()[0],U);if(!r)return;const{url:n,external:o,target:s,download:i}=ut(r,L,b.hash);if(!n)return;if(s==="_parent"||s==="_top"){if(window.parent!==window)return}else if(s&&s!=="_self")return;const c=J(r);if(!(r instanceof SVGAElement)&&n.protocol!==location.protocol&&!(n.protocol==="https:"||n.protocol==="http:")||i)return;const[h,u]=(b.hash?n.hash.replace(/^#/,""):n.href).split("#"),w=h===it(location);if(o||c.reload&&(!w||!u)){Zt({url:n,type:"link",event:e})?H=!0:e.preventDefault();return}if(u!==void 0&&w){const[,f]=m.url.href.split("#");if(f===u){if(e.preventDefault(),u===""||u==="top"&&r.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const d=r.ownerDocument.getElementById(decodeURIComponent(u));d&&(d.scrollIntoView(),d.focus())}return}if(K=!0,bt(E),t(n),!c.replace_state)return;K=!1}e.preventDefault(),await new Promise(f=>{requestAnimationFrame(()=>{setTimeout(f,0)}),setTimeout(f,100)}),await D({type:"link",url:n,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??n.href===location.href,event:e})}),U.addEventListener("submit",e=>{if(e.defaultPrevented)return;const r=HTMLFormElement.prototype.cloneNode.call(e.target),n=e.submitter;if(((n==null?void 0:n.formTarget)||r.target)==="_blank"||((n==null?void 0:n.formMethod)||r.method)!=="get")return;const i=new URL((n==null?void 0:n.hasAttribute("formaction"))&&(n==null?void 0:n.formAction)||r.action);if(_t(i,L,!1))return;const c=e.target,l=J(c);if(l.reload)return;e.preventDefault(),e.stopPropagation();const h=new FormData(c,n);i.search=new URLSearchParams(h).toString(),D({type:"form",url:i,keepfocus:l.keepfocus,noscroll:l.noscroll,replace_state:l.replace_state??i.href===location.href,event:e})}),addEventListener("popstate",async e=>{var r;if(!gt){if((r=e.state)!=null&&r[$]){const n=e.state[$];if(O={},n===E)return;const o=I[n],s=e.state[$t]??{},i=new URL(e.state[re]??location.href),c=e.state[M],l=m.url?it(location)===it(m.url):!1;if(c===R&&(Yt||l)){s!==x.state&&(x.state=s),t(i),I[E]=C(),o&&scrollTo(o.x,o.y),E=n;return}const u=n-E;await D({type:"popstate",url:i,popped:{state:s,scroll:o,delta:u},accept:()=>{E=n,R=c},block:()=>{history.go(-u)},nav_token:O,event:e})}else if(!K){const n=new URL(location.href);t(n),b.hash&&location.reload()}}}),addEventListener("hashchange",()=>{K&&(K=!1,history.replaceState({...history.state,[$]:++E,[M]:R},"",location.href))});for(const e of document.querySelectorAll("link"))be.has(e.rel)&&(e.href=e.href);addEventListener("pageshow",e=>{e.persisted&&P.navigating.set(ft.current=null)});function t(e){m.url=x.url=e,P.page.set(At(x)),P.page.notify()}}async function $e(t,{status:a=200,error:e,node_ids:r,params:n,route:o,server_route:s,data:i,form:c}){Ht=!0;const l=new URL(location.href);let h;({params:n={},route:o={id:null}}=await ot(l,!1)||{}),h=kt.find(({id:f})=>f===o.id);let u,w=!0;try{const f=r.map(async(_,g)=>{const p=i[g];return p!=null&&p.uses&&(p.uses=De(p.uses)),Rt({loader:b.nodes[_],url:l,params:n,route:o,parent:async()=>{const y={};for(let S=0;S{const i=history.state;gt=!0,location.replace(new URL(`#${r}`,location.href)),history.replaceState(i,"",t),a&&scrollTo(o,s),gt=!1})}else{const o=document.body,s=o.getAttribute("tabindex");o.tabIndex=-1,o.focus({preventScroll:!0,focusVisible:!1}),s!==null?o.setAttribute("tabindex",s):o.removeAttribute("tabindex")}const n=getSelection();if(n&&n.type!=="None"){const o=[];for(let s=0;s{if(n.rangeCount===o.length){for(let s=0;s{o=u,s=w});return i.catch(()=>{}),{navigation:{from:{params:t.params,route:{id:((l=t.route)==null?void 0:l.id)??null},url:t.url,scroll:C()},to:e&&{params:(a==null?void 0:a.params)??null,route:{id:((h=a==null?void 0:a.route)==null?void 0:h.id)??null},url:e,scroll:n},willUnload:!a,type:r,complete:i},fulfil:o,reject:s}}function At(t){return{data:t.data,error:t.error,form:t.form,params:t.params,route:t.route,state:t.state,status:t.status,url:t.url}}function Ke(t){const a=new URL(t);return a.hash=decodeURIComponent(t.hash),a}function ee(t){let a;if(b.hash){const[,,e]=t.hash.split("#",3);a=e??""}else a=t.hash.slice(1);return decodeURIComponent(a)}export{He as a,ze as g,Ye as o,P as s}; diff --git a/apps/dashboard/build/_app/immutable/chunks/dCAmqaEc.js.br b/apps/dashboard/build/_app/immutable/chunks/dCAmqaEc.js.br deleted file mode 100644 index af54f98..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/dCAmqaEc.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/dCAmqaEc.js.gz b/apps/dashboard/build/_app/immutable/chunks/dCAmqaEc.js.gz deleted file mode 100644 index dd113f9..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/dCAmqaEc.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/g5OnrUYZ.js b/apps/dashboard/build/_app/immutable/chunks/g5OnrUYZ.js deleted file mode 100644 index 0ca5483..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/g5OnrUYZ.js +++ /dev/null @@ -1 +0,0 @@ -import{x as S,Q as h,P as k,R as x,S as T}from"./wpu9U-D0.js";function t(r,i){return r===i||(r==null?void 0:r[T])===i}function A(r={},i,a,c){return S(()=>{var f,s;return h(()=>{f=s,s=[],k(()=>{r!==a(...s)&&(i(r,...s),f&&t(a(...f),r)&&i(null,...f))})}),()=>{x(()=>{s&&t(a(...s),r)&&i(null,...s)})}}),r}export{A as b}; diff --git a/apps/dashboard/build/_app/immutable/chunks/g5OnrUYZ.js.br b/apps/dashboard/build/_app/immutable/chunks/g5OnrUYZ.js.br deleted file mode 100644 index 86c4713..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/g5OnrUYZ.js.br +++ /dev/null @@ -1 +0,0 @@ -< dkN_6ߥ`/1'<\8DڢҖ'nc}CK"pCB^+m0_ e<1!070Dt/K`1OzVZ*E3qGP4*> R]\HPhg׉`Nx9%^r;%U]6%`ruN͡h \ No newline at end of file diff --git a/apps/dashboard/build/_app/immutable/chunks/g5OnrUYZ.js.gz b/apps/dashboard/build/_app/immutable/chunks/g5OnrUYZ.js.gz deleted file mode 100644 index 4f31ccd..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/g5OnrUYZ.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/sZcqyNBA.js b/apps/dashboard/build/_app/immutable/chunks/sZcqyNBA.js new file mode 100644 index 0000000..d2ed67a --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/sZcqyNBA.js @@ -0,0 +1 @@ +import{Z as k,_ as f,$ as m,v as t,X as _,N as b,a0 as i}from"./CpWkWWOo.js";function E(e,a,v=a){var c=new WeakSet;k(e,"input",async r=>{var l=r?e.defaultValue:e.value;if(l=o(e)?u(l):l,v(l),f!==null&&c.add(f),await m(),l!==(l=a())){var h=e.selectionStart,d=e.selectionEnd,n=e.value.length;if(e.value=l??"",d!==null){var s=e.value.length;h===d&&d===n&&s>n?(e.selectionStart=s,e.selectionEnd=s):(e.selectionStart=h,e.selectionEnd=Math.min(d,s))}}}),(b&&e.defaultValue!==e.value||t(a)==null&&e.value)&&(v(o(e)?u(e.value):e.value),f!==null&&c.add(f)),_(()=>{var r=a();if(e===document.activeElement){var l=i??f;if(c.has(l))return}o(e)&&r===u(e.value)||e.type==="date"&&!r&&!e.value||r!==e.value&&(e.value=r??"")})}function S(e,a,v=a){k(e,"change",c=>{var r=c?e.defaultChecked:e.checked;v(r)}),(b&&e.defaultChecked!==e.checked||t(a)==null)&&v(e.checked),_(()=>{var c=a();e.checked=!!c})}function o(e){var a=e.type;return a==="number"||a==="range"}function u(e){return e===""?null:+e}export{S as a,E as b}; diff --git a/apps/dashboard/build/_app/immutable/chunks/sZcqyNBA.js.br b/apps/dashboard/build/_app/immutable/chunks/sZcqyNBA.js.br new file mode 100644 index 0000000..a7a27e7 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/sZcqyNBA.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/sZcqyNBA.js.gz b/apps/dashboard/build/_app/immutable/chunks/sZcqyNBA.js.gz new file mode 100644 index 0000000..a12746e Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/sZcqyNBA.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/wpu9U-D0.js b/apps/dashboard/build/_app/immutable/chunks/wpu9U-D0.js deleted file mode 100644 index b5a27f7..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/wpu9U-D0.js +++ /dev/null @@ -1 +0,0 @@ -var wn=Object.defineProperty;var mt=e=>{throw TypeError(e)};var yn=(e,t,n)=>t in e?wn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ye=(e,t,n)=>yn(e,typeof t!="symbol"?t+"":t,n),We=(e,t,n)=>t.has(e)||mt("Cannot "+n);var p=(e,t,n)=>(We(e,t,"read from private field"),n?n.call(e):t.get(e)),F=(e,t,n)=>t.has(e)?mt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),W=(e,t,n,r)=>(We(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),X=(e,t,n)=>(We(e,t,"access private method"),n);var mn=Array.isArray,En=Array.prototype.indexOf,Ae=Array.prototype.includes,yr=Array.from,mr=Object.defineProperty,xe=Object.getOwnPropertyDescriptor,gn=Object.getOwnPropertyDescriptors,Tn=Object.prototype,bn=Array.prototype,Ct=Object.getPrototypeOf,Et=Object.isExtensible;const An=()=>{};function Er(e){return e()}function Sn(e){for(var t=0;t{e=r,t=s});return{promise:n,resolve:e,reject:t}}function gr(e,t){if(Array.isArray(e))return e;if(t===void 0||!(Symbol.iterator in e))return Array.from(e);const n=[];for(const r of e)if(n.push(r),n.length===t)break;return n}const A=2,Pe=4,Me=8,Pt=1<<24,K=16,U=32,we=64,Rn=128,P=512,g=1024,R=2048,V=4096,Y=8192,Q=16384,ne=32768,Ve=65536,gt=1<<17,Mt=1<<18,Fe=1<<19,Ft=1<<20,Tr=1<<25,_e=65536,Je=1<<21,it=1<<22,ee=1<<23,ue=Symbol("$state"),br=Symbol("legacy props"),Ar=Symbol(""),fe=new class extends Error{constructor(){super(...arguments);ye(this,"name","StaleReactionError");ye(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var kt;const Rr=!!((kt=globalThis.document)!=null&&kt.contentType)&&globalThis.document.contentType.includes("xml"),Le=3,Lt=8;function Nn(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Nr(e,t,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function On(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function xn(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function kn(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Dn(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Or(){throw new Error("https://svelte.dev/e/hydration_failed")}function xr(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function Cn(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function In(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Pn(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function kr(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const Dr=1,Cr=2,Ir=4,Pr=8,Mr=16,Fr=1,Lr=2,jr=4,Hr=8,Yr=16,jt=1,Mn=2,Fn="[",Ln="[!",qr="[?",jn="]",lt={},T=Symbol(),Hn="http://www.w3.org/1999/xhtml",Vr="http://www.w3.org/2000/svg",Ur="http://www.w3.org/1998/Math/MathML";function ot(e){console.warn("https://svelte.dev/e/hydration_mismatch")}function Br(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function Gr(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let D=!1;function $r(e){D=e}let y;function ve(e){if(e===null)throw ot(),lt;return y=e}function Yn(){return ve(se(y))}function zr(e){if(D){if(se(y)!==null)throw ot(),lt;y=e}}function Kr(e=1){if(D){for(var t=e,n=y;t--;)n=se(n);y=n}}function Wr(e=!0){for(var t=0,n=y;;){if(n.nodeType===Lt){var r=n.data;if(r===jn){if(t===0)return n;t-=1}else(r===Fn||r===Ln||r[0]==="["&&!isNaN(Number(r.slice(1))))&&(t+=1)}var s=se(n);e&&n.remove(),n=s}}function Xr(e){if(!e||e.nodeType!==Lt)throw ot(),lt;return e.data}function Ht(e){return e===this.v}function qn(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Yt(e){return!qn(e,this.v)}let Ge=!1;function Zr(){Ge=!0}let S=null;function Ue(e){S=e}function Jr(e,t=!1,n){S={p:S,i:!1,c:null,e:null,s:e,x:null,l:Ge&&!t?{s:null,u:null,$:[]}:null}}function Qr(e){var t=S,n=t.e;if(n!==null){t.e=null;for(var r of n)rn(r)}return t.i=!0,S=t.p,{}}function je(){return!Ge||S!==null&&S.l===null}let ae=[];function qt(){var e=ae;ae=[],Sn(e)}function Tt(e){if(ae.length===0&&!ke){var t=ae;queueMicrotask(()=>{t===ae&&qt()})}ae.push(e)}function Vn(){for(;ae.length>0;)qt()}function Un(e){var t=h;if(t===null)return _.f|=ee,e;if((t.f&ne)===0&&(t.f&Pe)===0)throw e;Be(e,t)}function Be(e,t){for(;t!==null;){if((t.f&Rn)!==0){if((t.f&ne)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}const Bn=-7169;function E(e,t){e.f=e.f&Bn|t}function ut(e){(e.f&P)!==0||e.deps===null?E(e,g):E(e,V)}function Vt(e){if(e!==null)for(const t of e)(t.f&A)===0||(t.f&_e)===0||(t.f^=_e,Vt(t.deps))}function Gn(e,t,n){(e.f&R)!==0?t.add(e):(e.f&V)!==0&&n.add(e),Vt(e.deps),E(e,g)}const Ye=new Set;let d=null,bt=null,b=null,O=[],$e=null,Qe=!1,ke=!1;var Ee,ge,le,Te,Ce,Ie,oe,$,be,C,et,tt,nt,Ut;const ht=class ht{constructor(){F(this,C);ye(this,"current",new Map);ye(this,"previous",new Map);F(this,Ee,new Set);F(this,ge,new Set);F(this,le,0);F(this,Te,0);F(this,Ce,null);F(this,Ie,new Set);F(this,oe,new Set);F(this,$,new Map);ye(this,"is_fork",!1);F(this,be,!1)}skip_effect(t){p(this,$).has(t)||p(this,$).set(t,{d:[],m:[]})}unskip_effect(t){var n=p(this,$).get(t);if(n){p(this,$).delete(t);for(var r of n.d)E(r,R),z(r);for(r of n.m)E(r,V),z(r)}}process(t){var s;O=[],this.apply();var n=[],r=[];for(const f of t)X(this,C,tt).call(this,f,n,r);if(X(this,C,et).call(this)){X(this,C,nt).call(this,r),X(this,C,nt).call(this,n);for(const[f,i]of p(this,$))zt(f,i)}else{for(const f of p(this,Ee))f();p(this,Ee).clear(),p(this,le)===0&&X(this,C,Ut).call(this),bt=this,d=null,At(r),At(n),bt=null,(s=p(this,Ce))==null||s.resolve()}b=null}capture(t,n){n!==T&&!this.previous.has(t)&&this.previous.set(t,n),(t.f&ee)===0&&(this.current.set(t,t.v),b==null||b.set(t,t.v))}activate(){d=this,this.apply()}deactivate(){d===this&&(d=null,b=null)}flush(){if(this.activate(),O.length>0){if(Bt(),d!==null&&d!==this)return}else p(this,le)===0&&this.process([]);this.deactivate()}discard(){for(const t of p(this,ge))t(this);p(this,ge).clear()}increment(t){W(this,le,p(this,le)+1),t&&W(this,Te,p(this,Te)+1)}decrement(t){W(this,le,p(this,le)-1),t&&W(this,Te,p(this,Te)-1),!p(this,be)&&(W(this,be,!0),Tt(()=>{W(this,be,!1),X(this,C,et).call(this)?O.length>0&&this.flush():this.revive()}))}revive(){for(const t of p(this,Ie))p(this,oe).delete(t),E(t,R),z(t);for(const t of p(this,oe))E(t,V),z(t);this.flush()}oncommit(t){p(this,Ee).add(t)}ondiscard(t){p(this,ge).add(t)}settled(){return(p(this,Ce)??W(this,Ce,It())).promise}static ensure(){if(d===null){const t=d=new ht;Ye.add(d),ke||Tt(()=>{d===t&&t.flush()})}return d}apply(){}};Ee=new WeakMap,ge=new WeakMap,le=new WeakMap,Te=new WeakMap,Ce=new WeakMap,Ie=new WeakMap,oe=new WeakMap,$=new WeakMap,be=new WeakMap,C=new WeakSet,et=function(){return this.is_fork||p(this,Te)>0},tt=function(t,n,r){t.f^=g;for(var s=t.first;s!==null;){var f=s.f,i=(f&(U|we))!==0,o=i&&(f&g)!==0,a=o||(f&Y)!==0||p(this,$).has(s);if(!a&&s.fn!==null){i?s.f^=g:(f&Pe)!==0?n.push(s):He(s)&&((f&K)!==0&&p(this,oe).add(s),Ne(s));var l=s.first;if(l!==null){s=l;continue}}for(;s!==null;){var c=s.next;if(c!==null){s=c;break}s=s.parent}}},nt=function(t){for(var n=0;n1){this.previous.clear();var t=b,n=!0;for(const f of Ye){if(f===this){n=!1;continue}const i=[];for(const[a,l]of this.current){if(f.current.has(a))if(n&&l!==f.current.get(a))f.current.set(a,l);else continue;i.push(a)}if(i.length===0)continue;const o=[...f.current.keys()].filter(a=>!this.current.has(a));if(o.length>0){var r=O;O=[];const a=new Set,l=new Map;for(const c of i)Gt(c,o,a,l);if(O.length>0){d=f,f.apply();for(const c of O)X(s=f,C,tt).call(s,c,[],[]);f.deactivate()}O=r}}d=null,b=t}Ye.delete(this)};let Se=ht;function $n(e){var t=ke;ke=!0;try{for(var n;;){if(Vn(),O.length===0&&(d==null||d.flush(),O.length===0))return $e=null,n;Bt()}}finally{ke=t}}function Bt(){Qe=!0;var e=null;try{for(var t=0;O.length>0;){var n=Se.ensure();if(t++>1e3){var r,s;zn()}n.process(O),te.clear()}}finally{O=[],Qe=!1,$e=null}}function zn(){try{Dn()}catch(e){Be(e,$e)}}let L=null;function At(e){var t=e.length;if(t!==0){for(var n=0;n0)){te.clear();for(const s of L){if((s.f&(Q|Y))!==0)continue;const f=[s];let i=s.parent;for(;i!==null;)L.has(i)&&(L.delete(i),f.push(i)),i=i.parent;for(let o=f.length-1;o>=0;o--){const a=f[o];(a.f&(Q|Y))===0&&Ne(a)}}L.clear()}}L=null}}function Gt(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const s of e.reactions){const f=s.f;(f&A)!==0?Gt(s,t,n,r):(f&(it|K))!==0&&(f&R)===0&&$t(s,t,r)&&(E(s,R),z(s))}}function $t(e,t,n){const r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const s of e.deps){if(Ae.call(t,s))return!0;if((s.f&A)!==0&&$t(s,t,n))return n.set(s,!0),!0}return n.set(e,!1),!1}function z(e){var t=$e=e,n=t.b;if(n!=null&&n.is_pending&&(e.f&(Pe|Me|Pt))!==0&&(e.f&ne)===0){n.defer_effect(e);return}for(;t.parent!==null;){t=t.parent;var r=t.f;if(Qe&&t===h&&(r&K)!==0&&(r&Mt)===0&&(r&ne)!==0)return;if((r&(we|U))!==0){if((r&g)===0)return;t.f^=g}}O.push(t)}function zt(e,t){if(!((e.f&U)!==0&&(e.f&g)!==0)){(e.f&R)!==0?t.d.push(e):(e.f&V)!==0&&t.m.push(e),E(e,g);for(var n=e.first;n!==null;)zt(n,t),n=n.next}}function Kn(e,t,n,r){const s=je()?ct:Jn;var f=e.filter(u=>!u.settled);if(n.length===0&&f.length===0){r(t.map(s));return}var i=h,o=Wn(),a=f.length===1?f[0].promise:f.length>1?Promise.all(f.map(u=>u.promise)):null;function l(u){o();try{r(u)}catch(v){(i.f&Q)===0&&Be(v,i)}rt()}if(n.length===0){a.then(()=>l(t.map(s)));return}function c(){o(),Promise.all(n.map(u=>Zn(u))).then(u=>l([...t.map(s),...u])).catch(u=>Be(u,i))}a?a.then(c):c()}function Wn(){var e=h,t=_,n=S,r=d;return function(f=!0){Re(e),re(t),Ue(n),f&&(r==null||r.activate())}}function rt(e=!0){Re(null),re(null),Ue(null),e&&(d==null||d.deactivate())}function Xn(){var e=h.b,t=d,n=e.is_rendered();return e.update_pending_count(1),t.increment(n),()=>{e.update_pending_count(-1),t.decrement(n)}}function ct(e){var t=A|R,n=_!==null&&(_.f&A)!==0?_:null;return h!==null&&(h.f|=Fe),{ctx:S,deps:null,effects:null,equals:Ht,f:t,fn:e,reactions:null,rv:0,v:T,wv:0,parent:n??h,ac:null}}function Zn(e,t,n){h===null&&Nn();var s=void 0,f=vt(T),i=!_,o=new Map;return or(()=>{var v;var a=It();s=a.promise;try{Promise.resolve(e()).then(a.resolve,a.reject).finally(rt)}catch(m){a.reject(m),rt()}var l=d;if(i){var c=Xn();(v=o.get(l))==null||v.reject(fe),o.delete(l),o.set(l,a)}const u=(m,w=void 0)=>{if(l.activate(),w)w!==fe&&(f.f|=ee,ft(f,w));else{(f.f&ee)!==0&&(f.f^=ee),ft(f,m);for(const[G,N]of o){if(o.delete(G),G===l)break;N.reject(fe)}}c&&c()};a.promise.then(u,m=>u(null,m||"unknown"))}),lr(()=>{for(const a of o.values())a.reject(fe)}),new Promise(a=>{function l(c){function u(){c===s?a(f):l(s)}c.then(u,u)}l(s)})}function es(e){const t=ct(e);return on(t),t}function Jn(e){const t=ct(e);return t.equals=Yt,t}function Qn(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n0&&!Xt&&nr()}return t}function nr(){Xt=!1;for(const e of st)(e.f&g)!==0&&E(e,V),He(e)&&Ne(e);st.clear()}function ns(e,t=1){var n=me(e),r=t===1?n++:n--;return J(e,n),r}function Xe(e){J(e,e.v+1)}function Zt(e,t){var n=e.reactions;if(n!==null)for(var r=je(),s=n.length,f=0;f{if(ce===f)return o();var a=_,l=ce;re(null),xt(f);var c=o();return re(a),xt(l),c};return r&&n.set("length",Z(e.length)),new Proxy(e,{defineProperty(o,a,l){(!("value"in l)||l.configurable===!1||l.enumerable===!1||l.writable===!1)&&Cn();var c=n.get(a);return c===void 0?i(()=>{var u=Z(l.value);return n.set(a,u),u}):J(c,l.value,!0),!0},deleteProperty(o,a){var l=n.get(a);if(l===void 0){if(a in o){const c=i(()=>Z(T));n.set(a,c),Xe(s)}}else J(l,T),Xe(s);return!0},get(o,a,l){var m;if(a===ue)return e;var c=n.get(a),u=a in o;if(c===void 0&&(!u||(m=xe(o,a))!=null&&m.writable)&&(c=i(()=>{var w=Oe(u?o[a]:T),G=Z(w);return G}),n.set(a,c)),c!==void 0){var v=me(c);return v===T?void 0:v}return Reflect.get(o,a,l)},getOwnPropertyDescriptor(o,a){var l=Reflect.getOwnPropertyDescriptor(o,a);if(l&&"value"in l){var c=n.get(a);c&&(l.value=me(c))}else if(l===void 0){var u=n.get(a),v=u==null?void 0:u.v;if(u!==void 0&&v!==T)return{enumerable:!0,configurable:!0,value:v,writable:!0}}return l},has(o,a){var v;if(a===ue)return!0;var l=n.get(a),c=l!==void 0&&l.v!==T||Reflect.has(o,a);if(l!==void 0||h!==null&&(!c||(v=xe(o,a))!=null&&v.writable)){l===void 0&&(l=i(()=>{var m=c?Oe(o[a]):T,w=Z(m);return w}),n.set(a,l));var u=me(l);if(u===T)return!1}return c},set(o,a,l,c){var yt;var u=n.get(a),v=a in o;if(r&&a==="length")for(var m=l;mZ(T)),n.set(m+"",w))}if(u===void 0)(!v||(yt=xe(o,a))!=null&&yt.writable)&&(u=i(()=>Z(void 0)),J(u,Oe(l)),n.set(a,u));else{v=u.v!==T;var G=i(()=>Oe(l));J(u,G)}var N=Reflect.getOwnPropertyDescriptor(o,a);if(N!=null&&N.set&&N.set.call(c,l),!v){if(r&&typeof a=="string"){var wt=n.get("length"),Ke=Number(a);Number.isInteger(Ke)&&Ke>=wt.v&&J(wt,Ke+1)}Xe(s)}return!0},ownKeys(o){me(s);var a=Reflect.ownKeys(o).filter(u=>{var v=n.get(u);return v===void 0||v.v!==T});for(var[l,c]of n)c.v!==T&&!(l in o)&&a.push(l);return a},setPrototypeOf(){In()}})}function St(e){try{if(e!==null&&typeof e=="object"&&ue in e)return e[ue]}catch{}return e}function rs(e,t){return Object.is(St(e),St(t))}var Rt,rr,Jt,Qt,en;function ss(){if(Rt===void 0){Rt=window,rr=document,Jt=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Qt=xe(t,"firstChild").get,en=xe(t,"nextSibling").get,Et(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Et(n)&&(n.__t=void 0)}}function de(e=""){return document.createTextNode(e)}function j(e){return Qt.call(e)}function se(e){return en.call(e)}function fs(e,t){if(!D)return j(e);var n=j(y);if(n===null)n=y.appendChild(de());else if(t&&n.nodeType!==Le){var r=de();return n==null||n.before(r),ve(r),r}return t&&ze(n),ve(n),n}function as(e,t=!1){if(!D){var n=j(e);return n instanceof Comment&&n.data===""?se(n):n}if(t){if((y==null?void 0:y.nodeType)!==Le){var r=de();return y==null||y.before(r),ve(r),r}ze(y)}return y}function is(e,t=1,n=!1){let r=D?y:e;for(var s;t--;)s=r,r=se(r);if(!D)return r;if(n){if((r==null?void 0:r.nodeType)!==Le){var f=de();return r===null?s==null||s.after(f):r.before(f),ve(f),f}ze(r)}return ve(r),r}function sr(e){e.textContent=""}function ls(){return!1}function fr(e,t,n){return document.createElementNS(t??Hn,e,void 0)}function ze(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===Le;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function os(e){D&&j(e)!==null&&sr(e)}let Nt=!1;function ar(){Nt||(Nt=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const n of e.target.elements)(t=n.__on_r)==null||t.call(n)})},{capture:!0}))}function dt(e){var t=_,n=h;re(null),Re(null);try{return e()}finally{re(t),Re(n)}}function us(e,t,n,r=n){e.addEventListener(t,()=>dt(n));const s=e.__on_r;s?e.__on_r=()=>{s(),r(!0)}:e.__on_r=()=>r(!0),ar()}function tn(e){h===null&&(_===null&&kn(),xn()),he&&On()}function ir(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function B(e,t,n){var r=h;r!==null&&(r.f&Y)!==0&&(e|=Y);var s={ctx:S,deps:null,nodes:null,f:e|R|P,first:null,fn:t,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};if(n)try{Ne(s)}catch(o){throw pe(s),o}else t!==null&&z(s);var f=s;if(n&&f.deps===null&&f.teardown===null&&f.nodes===null&&f.first===f.last&&(f.f&Fe)===0&&(f=f.first,(e&K)!==0&&(e&Ve)!==0&&f!==null&&(f.f|=Ve)),f!==null&&(f.parent=r,r!==null&&ir(f,r),_!==null&&(_.f&A)!==0&&(e&we)===0)){var i=_;(i.effects??(i.effects=[])).push(f)}return s}function nn(){return _!==null&&!H}function lr(e){const t=B(Me,null,!1);return E(t,g),t.teardown=e,t}function cs(e){tn();var t=h.f,n=!_&&(t&U)!==0&&(t&ne)===0;if(n){var r=S;(r.e??(r.e=[])).push(e)}else return rn(e)}function rn(e){return B(Pe|Ft,e,!1)}function _s(e){return tn(),B(Me|Ft,e,!0)}function vs(e){Se.ensure();const t=B(we|Fe,e,!0);return(n={})=>new Promise(r=>{n.outro?_r(t,()=>{pe(t),r(void 0)}):(pe(t),r(void 0))})}function ds(e){return B(Pe,e,!1)}function or(e){return B(it|Fe,e,!0)}function ps(e,t=0){return B(Me|t,e,!0)}function hs(e,t=[],n=[],r=[]){Kn(r,t,n,s=>{B(Me,()=>e(...s.map(me)),!0)})}function ws(e,t=0){var n=B(K|t,e,!0);return n}function ys(e){return B(U|Fe,e,!0)}function sn(e){var t=e.teardown;if(t!==null){const n=he,r=_;Ot(!0),re(null);try{t.call(null)}finally{Ot(n),re(r)}}}function pt(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const s=n.ac;s!==null&&dt(()=>{s.abort(fe)});var r=n.next;(n.f&we)!==0?n.parent=null:pe(n,t),n=r}}function ur(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&U)===0&&pe(t),t=n}}function pe(e,t=!0){var n=!1;(t||(e.f&Mt)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(cr(e.nodes.start,e.nodes.end),n=!0),pt(e,t&&!n),De(e,0),E(e,Q);var r=e.nodes&&e.nodes.t;if(r!==null)for(const f of r)f.stop();sn(e);var s=e.parent;s!==null&&s.first!==null&&fn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function cr(e,t){for(;e!==null;){var n=e===t?null:se(e);e.remove(),e=n}}function fn(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function _r(e,t,n=!0){var r=[];an(e,r,!0);var s=()=>{n&&pe(e),t&&t()},f=r.length;if(f>0){var i=()=>--f||s();for(var o of r)o.out(i)}else s()}function an(e,t,n){if((e.f&Y)===0){e.f^=Y;var r=e.nodes&&e.nodes.t;if(r!==null)for(const o of r)(o.is_global||n)&&t.push(o);for(var s=e.first;s!==null;){var f=s.next,i=(s.f&Ve)!==0||(s.f&U)!==0&&(e.f&K)!==0;an(s,t,i?n:!1),s=f}}}function ms(e){ln(e,!0)}function ln(e,t){if((e.f&Y)!==0){e.f^=Y,(e.f&g)===0&&(E(e,R),z(e));for(var n=e.first;n!==null;){var r=n.next,s=(n.f&Ve)!==0||(n.f&U)!==0;ln(n,s?t:!1),n=r}var f=e.nodes&&e.nodes.t;if(f!==null)for(const i of f)(i.is_global||t)&&i.in()}}function Es(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var s=n===r?null:se(n);t.append(n),n=s}}let qe=!1,he=!1;function Ot(e){he=e}let _=null,H=!1;function re(e){_=e}let h=null;function Re(e){h=e}let M=null;function on(e){_!==null&&(M===null?M=[e]:M.push(e))}let x=null,k=0,I=null;function vr(e){I=e}let un=1,ie=0,ce=ie;function xt(e){ce=e}function cn(){return++un}function He(e){var t=e.f;if((t&R)!==0)return!0;if(t&A&&(e.f&=~_e),(t&V)!==0){for(var n=e.deps,r=n.length,s=0;se.wv)return!0}(t&P)!==0&&b===null&&E(e,g)}return!1}function _n(e,t,n=!0){var r=e.reactions;if(r!==null&&!(M!==null&&Ae.call(M,e)))for(var s=0;s{e.ac.abort(fe)}),e.ac=null);try{e.f|=Je;var c=e.fn,u=c();e.f|=ne;var v=e.deps,m=d==null?void 0:d.is_fork;if(x!==null){var w;if(m||De(e,k),v!==null&&k>0)for(v.length=k+x.length,w=0;we});function pr(e){return(Ze==null?void 0:Ze.createHTML(e))??e}function hn(e){var t=fr("template");return t.innerHTML=pr(e.replaceAll("","")),t.content}function q(e,t){var n=h;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function Ss(e,t){var n=(t&jt)!==0,r=(t&Mn)!==0,s,f=!e.startsWith("");return()=>{if(D)return q(y,null),y;s===void 0&&(s=hn(f?e:""+e),n||(s=j(s)));var i=r||Jt?document.importNode(s,!0):s.cloneNode(!0);if(n){var o=j(i),a=i.lastChild;q(o,a)}else q(i,i);return i}}function hr(e,t,n="svg"){var r=!e.startsWith(""),s=(t&jt)!==0,f=`<${n}>${r?e:""+e}`,i;return()=>{if(D)return q(y,null),y;if(!i){var o=hn(f),a=j(o);if(s)for(i=document.createDocumentFragment();j(a);)i.appendChild(j(a));else i=j(a)}var l=i.cloneNode(!0);if(s){var c=j(l),u=l.lastChild;q(c,u)}else q(l,l);return l}}function Rs(e,t){return hr(e,t,"svg")}function Ns(e=""){if(!D){var t=de(e+"");return q(t,t),t}var n=y;return n.nodeType!==Le?(n.before(n=de()),ve(n)):ze(n),q(n,n),n}function Os(){if(D)return q(y,null),y;var e=document.createDocumentFragment(),t=document.createComment(""),n=de();return e.append(t,n),q(t,n),e}function xs(e,t){if(D){var n=h;((n.f&ne)===0||n.nodes.end===null)&&(n.nodes.end=y),Yn();return}e!==null&&e.before(t)}export{ys as $,Br as A,rs as B,bt as C,de as D,Ve as E,Fe as F,D as G,Mt as H,Lt as I,se as J,$r as K,ve as L,y as M,j as N,gs as O,bs as P,ps as Q,Tt as R,ue as S,Yn as T,Xr as U,Fn as V,Ln as W,Wr as X,ms as Y,pe as Z,_r as _,xs as a,Se as a$,Es as a0,ls as a1,S as a2,_s as a3,Sn as a4,Er as a5,As as a6,ct as a7,Zr as a8,ns as a9,Vr as aA,Ur as aB,je as aC,Ir as aD,jn as aE,ft as aF,Tr as aG,Nr as aH,yr as aI,Dr as aJ,Mr as aK,vt as aL,Cr as aM,Y as aN,U as aO,Pr as aP,sr as aQ,Ar as aR,Hn as aS,Ct as aT,gn as aU,Rr as aV,ar as aW,nn as aX,Xe as aY,Rn as aZ,qr as a_,qn as aa,An as ab,ts as ac,mr as ad,xe as ae,xr as af,jr as ag,he as ah,h as ai,Q as aj,Hr as ak,Ge as al,Lr as am,Fr as an,Jn as ao,Yr as ap,br as aq,rr as ar,$n as as,Ts as at,Rs as au,cr as av,ot as aw,lt as ax,q as ay,fr as az,Qr as b,E as b0,R as b1,z as b2,V as b3,Gn as b4,Re as b5,re as b6,Ue as b7,Un as b8,_ as b9,Be as ba,kr as bb,Gr as bc,dt as bd,ss as be,Or as bf,vs as bg,Os as c,Oe as d,fs as e,as as f,me as g,is as h,J as i,Ss as j,os as k,gr as l,Ns as m,Kr as n,cs as o,Jr as p,ws as q,zr as r,Z as s,hs as t,es as u,us as v,d as w,ds as x,lr as y,mn as z}; diff --git a/apps/dashboard/build/_app/immutable/chunks/wpu9U-D0.js.br b/apps/dashboard/build/_app/immutable/chunks/wpu9U-D0.js.br deleted file mode 100644 index 6e70ac5..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/wpu9U-D0.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/wpu9U-D0.js.gz b/apps/dashboard/build/_app/immutable/chunks/wpu9U-D0.js.gz deleted file mode 100644 index 65c3116..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/wpu9U-D0.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/entry/app.CYIcgKkt.js b/apps/dashboard/build/_app/immutable/entry/app.CYIcgKkt.js new file mode 100644 index 0000000..e396d4a --- /dev/null +++ b/apps/dashboard/build/_app/immutable/entry/app.CYIcgKkt.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.COz2esg5.js","../chunks/Bzak7iHL.js","../chunks/GG5zm9kr.js","../chunks/CpWkWWOo.js","../chunks/BlVfL1ME.js","../chunks/CHOnp4oo.js","../chunks/B4yTwGkE.js","../chunks/DdEqwvdI.js","../chunks/CGEBXrjl.js","../chunks/CJCPY1OL.js","../chunks/A7po6GxK.js","../chunks/aVbAZ-t7.js","../chunks/BKuqSeVd.js","../chunks/sZcqyNBA.js","../chunks/CJsMJEun.js","../chunks/C6HuKgyx.js","../chunks/BeMFXnHE.js","../chunks/BHGLDPij.js","../chunks/BskPcZf7.js","../chunks/MAY1QfFZ.js","../chunks/BUoSzNdg.js","../chunks/Cx-f-Pzo.js","../chunks/BjdL4Pm2.js","../chunks/DzfRjky4.js","../chunks/DNjM5a-l.js","../assets/0.IIz8MMYb.css","../nodes/1.DJo7hfwf.js","../nodes/2.D-vKwnTC.js","../nodes/3.Caati8mq.js","../nodes/4.DJCab_le.js","../chunks/V6gjw5Ec.js","../nodes/5.C0AYWqwr.js","../chunks/BnXDGOmJ.js","../assets/5.DQ_AfUnN.css","../nodes/6.DTUGCA1p.js","../chunks/C4h_mRt2.js","../assets/6.BSSBWVKL.css","../nodes/7.jHtvjgRi.js","../assets/7.CCrNEDd3.css","../nodes/8.CgPowUzz.js","../nodes/9.BWaJ-VBd.js","../assets/9.BBx09UGv.css","../nodes/10.Btb56kL1.js","../nodes/11.WP3QAgOF.js","../nodes/12.DaxyVsV4.js","../nodes/13.D52bbIQQ.js","../assets/13.Bjd0S47S.css","../nodes/14.DUh3SXOF.js","../nodes/15.C7Fk4d1G.js","../assets/15.ChjqzJHo.css","../nodes/16.DeYkCVEo.js","../assets/16.BnHgRQtR.css","../nodes/17.CLL0vjL4.js","../nodes/18.CXHHR36X.js","../nodes/19.D4UHDxxJ.js","../nodes/20.BwEdZXUF.js","../assets/20.DKhUrxcR.css"])))=>i.map(i=>d[i]); +var Q=r=>{throw TypeError(r)};var X=(r,t,e)=>t.has(r)||Q("Cannot "+e);var l=(r,t,e)=>(X(r,t,"read from private field"),e?e.call(r):t.get(r)),H=(r,t,e)=>t.has(r)?Q("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),W=(r,t,e,n)=>(X(r,t,"write to private field"),n?n.call(r,e):t.set(r,e),e);import{N as Z,ab as ut,b as _t,E as ct,ac as lt,ae as dt,T as ft,R as $,ax as vt,U as ht,h as U,L as pt,g as h,bc as Et,G as gt,I as Pt,p as Rt,aA as yt,aB as Ot,$ as At,f as L,e as Tt,a as bt,s as z,d as Lt,r as It,u as x,t as Dt}from"../chunks/CpWkWWOo.js";import{h as Vt,m as wt,u as kt,s as xt}from"../chunks/BlVfL1ME.js";import"../chunks/Bzak7iHL.js";import{o as St}from"../chunks/GG5zm9kr.js";import{i as B}from"../chunks/B4yTwGkE.js";import{a as g,c as V,f as et,t as jt}from"../chunks/CHOnp4oo.js";import{B as Ct}from"../chunks/DdEqwvdI.js";import{b as S}from"../chunks/CJsMJEun.js";import{p as N}from"../chunks/V6gjw5Ec.js";function j(r,t,e){var n;Z&&(n=ht,ut());var i=new Ct(r);_t(()=>{var c=t()??null;if(Z){var s=lt(n),a=s===vt,m=c!==null;if(a!==m){var R=dt();ft(R),i.anchor=R,$(!1),i.ensure(c,c&&(u=>e(u,c))),$(!0);return}}i.ensure(c,c&&(u=>e(u,c)))},ct)}function Bt(r){return class extends Nt{constructor(t){super({component:r,...t})}}}var P,d;class Nt{constructor(t){H(this,P);H(this,d);var c;var e=new Map,n=(s,a)=>{var m=Pt(a,!1,!1);return e.set(s,m),m};const i=new Proxy({...t.props||{},$$events:{}},{get(s,a){return h(e.get(a)??n(a,Reflect.get(s,a)))},has(s,a){return a===pt?!0:(h(e.get(a)??n(a,Reflect.get(s,a))),Reflect.has(s,a))},set(s,a,m){return U(e.get(a)??n(a,m),m),Reflect.set(s,a,m)}});W(this,d,(t.hydrate?Vt:wt)(t.component,{target:t.target,anchor:t.anchor,props:i,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError})),(!((c=t==null?void 0:t.props)!=null&&c.$$host)||t.sync===!1)&&Et(),W(this,P,i.$$events);for(const s of Object.keys(l(this,d)))s==="$set"||s==="$destroy"||s==="$on"||gt(this,s,{get(){return l(this,d)[s]},set(a){l(this,d)[s]=a},enumerable:!0});l(this,d).$set=s=>{Object.assign(i,s)},l(this,d).$destroy=()=>{kt(l(this,d))}}$set(t){l(this,d).$set(t)}$on(t,e){l(this,P)[t]=l(this,P)[t]||[];const n=(...i)=>e.call(this,...i);return l(this,P)[t].push(n),()=>{l(this,P)[t]=l(this,P)[t].filter(i=>i!==n)}}$destroy(){l(this,d).$destroy()}}P=new WeakMap,d=new WeakMap;const Ut="modulepreload",qt=function(r,t){return new URL(r,t).href},tt={},o=function(t,e,n){let i=Promise.resolve();if(e&&e.length>0){let s=function(u){return Promise.all(u.map(p=>Promise.resolve(p).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};const a=document.getElementsByTagName("link"),m=document.querySelector("meta[property=csp-nonce]"),R=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));i=s(e.map(u=>{if(u=qt(u,n),u in tt)return;tt[u]=!0;const p=u.endsWith(".css"),y=p?'[rel="stylesheet"]':"";if(!!n)for(let O=a.length-1;O>=0;O--){const _=a[O];if(_.href===u&&(!p||_.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${y}`))return;const E=document.createElement("link");if(E.rel=p?"stylesheet":Ut,p||(E.as="script"),E.crossOrigin="",E.href=u,R&&E.setAttribute("nonce",R),document.head.appendChild(E),p)return new Promise((O,_)=>{E.addEventListener("load",O),E.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${u}`)))})}))}function c(s){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s}return i.then(s=>{for(const a of s||[])a.status==="rejected"&&c(a.reason);return t().catch(c)})},ae={};var Ft=et('
'),Gt=et(" ",1);function Yt(r,t){Rt(t,!0);let e=N(t,"components",23,()=>[]),n=N(t,"data_0",3,null),i=N(t,"data_1",3,null),c=N(t,"data_2",3,null);yt(()=>t.stores.page.set(t.page)),Ot(()=>{t.stores,t.page,t.constructors,e(),t.form,n(),i(),c(),t.stores.page.notify()});let s=z(!1),a=z(!1),m=z(null);St(()=>{const _=t.stores.page.subscribe(()=>{h(s)&&(U(a,!0),At().then(()=>{U(m,document.title||"untitled page",!0)}))});return U(s,!0),_});const R=x(()=>t.constructors[2]);var u=Gt(),p=L(u);{var y=_=>{const A=x(()=>t.constructors[0]);var T=V(),w=L(T);j(w,()=>h(A),(b,I)=>{S(I(b,{get data(){return n()},get form(){return t.form},get params(){return t.page.params},children:(f,Wt)=>{var K=V(),at=L(K);{var st=D=>{const q=x(()=>t.constructors[1]);var k=V(),F=L(k);j(F,()=>h(q),(G,Y)=>{S(Y(G,{get data(){return i()},get form(){return t.form},get params(){return t.page.params},children:(v,zt)=>{var M=V(),nt=L(M);j(nt,()=>h(R),(it,mt)=>{S(mt(it,{get data(){return c()},get form(){return t.form},get params(){return t.page.params}}),C=>e()[2]=C,()=>{var C;return(C=e())==null?void 0:C[2]})}),g(v,M)},$$slots:{default:!0}}),v=>e()[1]=v,()=>{var v;return(v=e())==null?void 0:v[1]})}),g(D,k)},ot=D=>{const q=x(()=>t.constructors[1]);var k=V(),F=L(k);j(F,()=>h(q),(G,Y)=>{S(Y(G,{get data(){return i()},get form(){return t.form},get params(){return t.page.params}}),v=>e()[1]=v,()=>{var v;return(v=e())==null?void 0:v[1]})}),g(D,k)};B(at,D=>{t.constructors[2]?D(st):D(ot,!1)})}g(f,K)},$$slots:{default:!0}}),f=>e()[0]=f,()=>{var f;return(f=e())==null?void 0:f[0]})}),g(_,T)},J=_=>{const A=x(()=>t.constructors[0]);var T=V(),w=L(T);j(w,()=>h(A),(b,I)=>{S(I(b,{get data(){return n()},get form(){return t.form},get params(){return t.page.params}}),f=>e()[0]=f,()=>{var f;return(f=e())==null?void 0:f[0]})}),g(_,T)};B(p,_=>{t.constructors[1]?_(y):_(J,!1)})}var E=Tt(p,2);{var O=_=>{var A=Ft(),T=Lt(A);{var w=b=>{var I=jt();Dt(()=>xt(I,h(m))),g(b,I)};B(T,b=>{h(a)&&b(w)})}It(A),g(_,A)};B(E,_=>{h(s)&&_(O)})}g(r,u),bt()}const se=Bt(Yt),oe=[()=>o(()=>import("../nodes/0.COz2esg5.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]),import.meta.url),()=>o(()=>import("../nodes/1.DJo7hfwf.js"),__vite__mapDeps([26,1,20,3,4,5,18,2,16,17]),import.meta.url),()=>o(()=>import("../nodes/2.D-vKwnTC.js"),__vite__mapDeps([27,1,3,5,9,7]),import.meta.url),()=>o(()=>import("../nodes/3.Caati8mq.js"),__vite__mapDeps([28,1,20,3,2,17,16,18]),import.meta.url),()=>o(()=>import("../nodes/4.DJCab_le.js"),__vite__mapDeps([29,1,2,3,4,5,6,7,10,13,24,19,16,8,30,15,23]),import.meta.url),()=>o(()=>import("../nodes/5.C0AYWqwr.js"),__vite__mapDeps([31,1,3,4,5,6,7,8,11,12,21,32,10,30,15,16,33]),import.meta.url),()=>o(()=>import("../nodes/6.DTUGCA1p.js"),__vite__mapDeps([34,1,3,4,5,6,7,8,35,10,11,12,24,21,30,15,16,18,2,36]),import.meta.url),()=>o(()=>import("../nodes/7.jHtvjgRi.js"),__vite__mapDeps([37,1,2,3,4,5,6,7,8,10,13,11,12,21,23,38]),import.meta.url),()=>o(()=>import("../nodes/8.CgPowUzz.js"),__vite__mapDeps([39,1,3,4,5,6,7,8,10,11,12,21,13,24]),import.meta.url),()=>o(()=>import("../nodes/9.BWaJ-VBd.js"),__vite__mapDeps([40,1,20,3,4,5,6,7,8,21,12,15,16,19,23,10,11,30,41]),import.meta.url),()=>o(()=>import("../nodes/10.Btb56kL1.js"),__vite__mapDeps([42,1,2,3,4,5,6,7,8,10,11,12,21,13,32,15,16,18,14,30,23,20,24,19]),import.meta.url),()=>o(()=>import("../nodes/11.WP3QAgOF.js"),__vite__mapDeps([43,1,2,3,4,5,6,7,8,21,12,13,17,16,18,24,23,10,30,15]),import.meta.url),()=>o(()=>import("../nodes/12.DaxyVsV4.js"),__vite__mapDeps([44,1,2,3,4,5,6,7,8,11,12,24]),import.meta.url),()=>o(()=>import("../nodes/13.D52bbIQQ.js"),__vite__mapDeps([45,1,2,3,4,5,6,7,8,10,11,12,21,13,32,24,23,46]),import.meta.url),()=>o(()=>import("../nodes/14.DUh3SXOF.js"),__vite__mapDeps([47,1,2,3,4,5,6,7,8,10,11,12,21]),import.meta.url),()=>o(()=>import("../nodes/15.C7Fk4d1G.js"),__vite__mapDeps([48,1,2,3,4,5,6,7,8,35,10,21,12,13,14,24,11,30,15,16,23,49]),import.meta.url),()=>o(()=>import("../nodes/16.DeYkCVEo.js"),__vite__mapDeps([50,1,2,3,4,5,6,7,8,11,12,24,10,21,30,15,16,23,51]),import.meta.url),()=>o(()=>import("../nodes/17.CLL0vjL4.js"),__vite__mapDeps([52,1,2,3,4,5,6,7,8,11,12,21,15,16,24,19,22,23]),import.meta.url),()=>o(()=>import("../nodes/18.CXHHR36X.js"),__vite__mapDeps([53,1,2,3,4,5,6,7,8,21,12,24]),import.meta.url),()=>o(()=>import("../nodes/19.D4UHDxxJ.js"),__vite__mapDeps([54,1,2,3,4,5,6,7,8,21,12,32,24,23]),import.meta.url),()=>o(()=>import("../nodes/20.BwEdZXUF.js"),__vite__mapDeps([55,1,2,3,4,5,6,7,8,35,10,11,12,21,13,32,14,18,16,56]),import.meta.url)],ne=[],ie={"/":[3],"/(app)/activation":[4,[2]],"/(app)/contradictions":[5,[2]],"/(app)/dreams":[6,[2]],"/(app)/duplicates":[7,[2]],"/(app)/explore":[8,[2]],"/(app)/feed":[9,[2]],"/(app)/graph":[10,[2]],"/(app)/importance":[11,[2]],"/(app)/intentions":[12,[2]],"/(app)/memories":[13,[2]],"/(app)/patterns":[14,[2]],"/(app)/reasoning":[15,[2]],"/(app)/schedule":[16,[2]],"/(app)/settings":[17,[2]],"/(app)/stats":[18,[2]],"/(app)/timeline":[19,[2]],"/waitlist":[20]},rt={handleError:(({error:r})=>{console.error(r)}),reroute:(()=>{}),transport:{}},Ht=Object.fromEntries(Object.entries(rt.transport).map(([r,t])=>[r,t.decode])),me=Object.fromEntries(Object.entries(rt.transport).map(([r,t])=>[r,t.encode])),ue=!1,_e=(r,t)=>Ht[r](t);export{_e as decode,Ht as decoders,ie as dictionary,me as encoders,ue as hash,rt as hooks,ae as matchers,oe as nodes,se as root,ne as server_loads}; diff --git a/apps/dashboard/build/_app/immutable/entry/app.CYIcgKkt.js.br b/apps/dashboard/build/_app/immutable/entry/app.CYIcgKkt.js.br new file mode 100644 index 0000000..6e9072d Binary files /dev/null and b/apps/dashboard/build/_app/immutable/entry/app.CYIcgKkt.js.br differ diff --git a/apps/dashboard/build/_app/immutable/entry/app.CYIcgKkt.js.gz b/apps/dashboard/build/_app/immutable/entry/app.CYIcgKkt.js.gz new file mode 100644 index 0000000..8b88be8 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/entry/app.CYIcgKkt.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/entry/app.Dg6iMka9.js b/apps/dashboard/build/_app/immutable/entry/app.Dg6iMka9.js deleted file mode 100644 index 36a42cf..0000000 --- a/apps/dashboard/build/_app/immutable/entry/app.Dg6iMka9.js +++ /dev/null @@ -1,2 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.BmfNagK9.js","../chunks/Bzak7iHL.js","../chunks/TZu9D97Z.js","../chunks/wpu9U-D0.js","../chunks/D8mhvFt8.js","../chunks/DKve45Wd.js","../chunks/BWk3o_TN.js","../chunks/60_R_Vbt.js","../chunks/LDOJP_6N.js","../chunks/CnZzd20v.js","../chunks/g5OnrUYZ.js","../chunks/ByYB047u.js","../chunks/dCAmqaEc.js","../chunks/Bxs5UR9-.js","../chunks/BhIgFntf.js","../chunks/BLadwbF7.js","../chunks/EqHb-9AZ.js","../chunks/CqMQEF-F.js","../chunks/CcUbQ_Wl.js","../chunks/CZfHMhLI.js","../chunks/D7A-gG4Z.js","../assets/Icon.tTjeJXhC.css","../assets/0.Cf27G70K.css","../nodes/1.MT4EnKSP.js","../nodes/2.DEnQkIHv.js","../nodes/3.C8tBBpzF.js","../nodes/4.BpOpkZuP.js","../chunks/P1-U_Xsj.js","../chunks/BHDZZvku.js","../assets/PageHeader.Dmxpik8H.css","../chunks/DcKTNC6e.js","../chunks/DPdYG9yN.js","../nodes/5.CK5gRe3F.js","../assets/5.Tl8-WHJj.css","../nodes/6.DZyLUVX2.js","../chunks/CmbJHhgy.js","../assets/Dropdown.C2Z-7Phd.css","../assets/6.DQ_AfUnN.css","../nodes/7.yWYTsQ1Q.js","../chunks/DzesjbbJ.js","../assets/7.F0TwMZ5M.css","../nodes/8.D5dP0-E2.js","../nodes/9.Vz-x3Q_x.js","../nodes/10.DYHIt_do.js","../assets/10.g4OzM5ih.css","../nodes/11.Db7dgOeT.js","../chunks/C-SOZ1Oi.js","../chunks/DrafHjYM.js","../chunks/Dp1pzeXC.js","../assets/11.BxoW8Jf1.css","../nodes/12.CO2CXIFj.js","../nodes/13.BQoci-vM.js","../nodes/14.CDp0vmq1.js","../assets/14.Bjd0S47S.css","../nodes/15.C05K0kWE.js","../assets/15.BzuIe_Oj.css","../nodes/16.CrQpRrFW.js","../nodes/17.3ASmJvJ6.js","../assets/17.ChjqzJHo.css","../nodes/18.43xZFMsD.js","../assets/18.BnHgRQtR.css","../nodes/19.BYwd4oWS.js","../assets/19.C2qtIyf6.css","../nodes/20.Di2Q3Va0.js","../assets/20.CO50G5tF.css","../nodes/21.BAlasPHS.js","../nodes/22.C719k-1W.js","../assets/22.DKhUrxcR.css"])))=>i.map(i=>d[i]); -var U=e=>{throw TypeError(e)};var X=(e,t,r)=>t.has(e)||U("Cannot "+r);var n=(e,t,r)=>(X(e,t,"read from private field"),r?r.call(e):t.get(e)),B=(e,t,r)=>t.has(e)?U("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),F=(e,t,r,i)=>(X(e,t,"write to private field"),i?i.call(e,r):t.set(e,r),r);import{_ as o}from"../chunks/Dp1pzeXC.js";import{G as z,T as nt,q as mt,E as ut,U as ct,X as dt,L as lt,K as J,V as ft,M as pt,i as C,aq as vt,g as p,as as ht,ad as Et,ac as gt,p as Pt,a3 as Rt,o as Ot,O as Tt,f as R,h as yt,a as v,b as At,s as G,c as A,e as Lt,r as Dt,j as Q,u as I,m as It,t as Vt}from"../chunks/wpu9U-D0.js";import{h as bt,m as xt,u as kt,s as wt}from"../chunks/D8mhvFt8.js";import"../chunks/Bzak7iHL.js";import{o as jt}from"../chunks/TZu9D97Z.js";import{i as w}from"../chunks/DKve45Wd.js";import{B as Ct}from"../chunks/BWk3o_TN.js";import{b as V}from"../chunks/g5OnrUYZ.js";import{p as j}from"../chunks/ByYB047u.js";function b(e,t,r){var i;z&&(i=pt,nt());var _=new Ct(e);mt(()=>{var m=t()??null;if(z){var a=ct(i),s=a===ft,d=m!==null;if(s!==d){var x=dt();lt(x),_.anchor=x,J(!1),_.ensure(m,m&&(O=>r(O,m))),J(!0);return}}_.ensure(m,m&&(O=>r(O,m)))},ut)}function St(e){return class extends Mt{constructor(t){super({component:e,...t})}}}var h,c;class Mt{constructor(t){B(this,h);B(this,c);var m;var r=new Map,i=(a,s)=>{var d=gt(s,!1,!1);return r.set(a,d),d};const _=new Proxy({...t.props||{},$$events:{}},{get(a,s){return p(r.get(s)??i(s,Reflect.get(a,s)))},has(a,s){return s===vt?!0:(p(r.get(s)??i(s,Reflect.get(a,s))),Reflect.has(a,s))},set(a,s,d){return C(r.get(s)??i(s,d),d),Reflect.set(a,s,d)}});F(this,c,(t.hydrate?bt:xt)(t.component,{target:t.target,anchor:t.anchor,props:_,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError})),(!((m=t==null?void 0:t.props)!=null&&m.$$host)||t.sync===!1)&&ht(),F(this,h,_.$$events);for(const a of Object.keys(n(this,c)))a==="$set"||a==="$destroy"||a==="$on"||Et(this,a,{get(){return n(this,c)[a]},set(s){n(this,c)[a]=s},enumerable:!0});n(this,c).$set=a=>{Object.assign(_,a)},n(this,c).$destroy=()=>{kt(n(this,c))}}$set(t){n(this,c).$set(t)}$on(t,r){n(this,h)[t]=n(this,h)[t]||[];const i=(..._)=>r.call(this,..._);return n(this,h)[t].push(i),()=>{n(this,h)[t]=n(this,h)[t].filter(_=>_!==i)}}$destroy(){n(this,c).$destroy()}}h=new WeakMap,c=new WeakMap;const tr={};var Nt=Q('
'),qt=Q(" ",1);function Bt(e,t){Pt(t,!0);let r=j(t,"components",23,()=>[]),i=j(t,"data_0",3,null),_=j(t,"data_1",3,null),m=j(t,"data_2",3,null);Rt(()=>t.stores.page.set(t.page)),Ot(()=>{t.stores,t.page,t.constructors,r(),t.form,i(),_(),m(),t.stores.page.notify()});let a=G(!1),s=G(!1),d=G(null);jt(()=>{const u=t.stores.page.subscribe(()=>{p(a)&&(C(s,!0),Tt().then(()=>{C(d,document.title||"untitled page",!0)}))});return C(a,!0),u});const x=I(()=>t.constructors[2]);var O=qt(),Y=R(O);{var Z=u=>{const E=I(()=>t.constructors[0]);var g=A(),L=R(g);b(L,()=>p(E),(P,T)=>{V(T(P,{get data(){return i()},get form(){return t.form},get params(){return t.page.params},children:(l,Gt)=>{var H=A(),et=R(H);{var at=y=>{const S=I(()=>t.constructors[1]);var D=A(),M=R(D);b(M,()=>p(S),(N,q)=>{V(q(N,{get data(){return _()},get form(){return t.form},get params(){return t.page.params},children:(f,Yt)=>{var K=A(),st=R(K);b(st,()=>p(x),(it,_t)=>{V(_t(it,{get data(){return m()},get form(){return t.form},get params(){return t.page.params}}),k=>r()[2]=k,()=>{var k;return(k=r())==null?void 0:k[2]})}),v(f,K)},$$slots:{default:!0}}),f=>r()[1]=f,()=>{var f;return(f=r())==null?void 0:f[1]})}),v(y,D)},ot=y=>{const S=I(()=>t.constructors[1]);var D=A(),M=R(D);b(M,()=>p(S),(N,q)=>{V(q(N,{get data(){return _()},get form(){return t.form},get params(){return t.page.params}}),f=>r()[1]=f,()=>{var f;return(f=r())==null?void 0:f[1]})}),v(y,D)};w(et,y=>{t.constructors[2]?y(at):y(ot,!1)})}v(l,H)},$$slots:{default:!0}}),l=>r()[0]=l,()=>{var l;return(l=r())==null?void 0:l[0]})}),v(u,g)},$=u=>{const E=I(()=>t.constructors[0]);var g=A(),L=R(g);b(L,()=>p(E),(P,T)=>{V(T(P,{get data(){return i()},get form(){return t.form},get params(){return t.page.params}}),l=>r()[0]=l,()=>{var l;return(l=r())==null?void 0:l[0]})}),v(u,g)};w(Y,u=>{t.constructors[1]?u(Z):u($,!1)})}var tt=yt(Y,2);{var rt=u=>{var E=Nt(),g=Lt(E);{var L=P=>{var T=It();Vt(()=>wt(T,p(d))),v(P,T)};w(g,P=>{p(s)&&P(L)})}Dt(E),v(u,E)};w(tt,u=>{p(a)&&u(rt)})}v(e,O),At()}const rr=St(Bt),er=[()=>o(()=>import("../nodes/0.BmfNagK9.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]),import.meta.url),()=>o(()=>import("../nodes/1.MT4EnKSP.js"),__vite__mapDeps([23,1,15,3,4,13,2,12]),import.meta.url),()=>o(()=>import("../nodes/2.DEnQkIHv.js"),__vite__mapDeps([24,1,3,8,6]),import.meta.url),()=>o(()=>import("../nodes/3.C8tBBpzF.js"),__vite__mapDeps([25,1,15,3,2,4,12,13]),import.meta.url),()=>o(()=>import("../nodes/4.BpOpkZuP.js"),__vite__mapDeps([26,1,2,3,4,5,6,27,7,9,19,14,11,18,28,8,20,21,29,30,31]),import.meta.url),()=>o(()=>import("../nodes/5.CK5gRe3F.js"),__vite__mapDeps([32,1,2,3,4,5,6,7,27,16,9,11,28,8,20,21,29,30,12,13,19,14,33]),import.meta.url),()=>o(()=>import("../nodes/6.DZyLUVX2.js"),__vite__mapDeps([34,1,3,4,5,6,7,27,16,11,28,8,20,21,29,35,10,36,30,37]),import.meta.url),()=>o(()=>import("../nodes/7.yWYTsQ1Q.js"),__vite__mapDeps([38,1,3,4,5,6,7,39,27,19,16,11,13,2,28,8,20,21,29,31,40]),import.meta.url),()=>o(()=>import("../nodes/8.D5dP0-E2.js"),__vite__mapDeps([41,1,2,3,4,5,6,7,27,9,16,18,28,8,11,20,21,29,30,31]),import.meta.url),()=>o(()=>import("../nodes/9.Vz-x3Q_x.js"),__vite__mapDeps([42,1,3,4,5,6,7,27,16,9,19,28,8,11,20,21,29,30,31]),import.meta.url),()=>o(()=>import("../nodes/10.DYHIt_do.js"),__vite__mapDeps([43,1,3,4,5,6,7,27,16,11,14,18,28,8,20,21,29,30,44]),import.meta.url),()=>o(()=>import("../nodes/11.Db7dgOeT.js"),__vite__mapDeps([45,46,1,2,3,4,5,6,7,16,9,11,13,10,18,47,15,48,20,21,35,36,19,14,49]),import.meta.url),()=>o(()=>import("../nodes/12.CO2CXIFj.js"),__vite__mapDeps([50,1,2,3,4,5,6,7,27,16,9,12,13,19,18,11,28,8,20,21,29,30,31]),import.meta.url),()=>o(()=>import("../nodes/13.BQoci-vM.js"),__vite__mapDeps([51,1,2,3,4,5,6,7,27,19,28,8,11,20,21,29,35,16,10,36,30,31]),import.meta.url),()=>o(()=>import("../nodes/14.CDp0vmq1.js"),__vite__mapDeps([52,1,2,3,4,5,6,7,27,16,9,19,18,28,8,11,20,21,29,30,35,10,36,31,53]),import.meta.url),()=>o(()=>import("../nodes/15.C05K0kWE.js"),__vite__mapDeps([54,1,2,3,4,5,6,7,27,11,28,8,20,21,29,30,17,14,18,19,55]),import.meta.url),()=>o(()=>import("../nodes/16.CrQpRrFW.js"),__vite__mapDeps([56,1,2,3,4,5,6,7,27,16,28,8,11,20,21,29,30]),import.meta.url),()=>o(()=>import("../nodes/17.3ASmJvJ6.js"),__vite__mapDeps([57,1,2,3,4,5,6,7,39,27,16,9,10,19,11,18,28,8,20,21,29,30,31,58]),import.meta.url),()=>o(()=>import("../nodes/18.43xZFMsD.js"),__vite__mapDeps([59,1,2,3,4,5,6,7,19,16,11,18,28,8,20,21,29,35,10,36,60]),import.meta.url),()=>o(()=>import("../nodes/19.BYwd4oWS.js"),__vite__mapDeps([61,1,2,3,4,5,6,7,27,16,11,19,14,17,18,28,8,20,21,29,62]),import.meta.url),()=>o(()=>import("../nodes/20.Di2Q3Va0.js"),__vite__mapDeps([63,1,2,3,4,5,6,7,27,16,19,28,8,11,20,21,29,30,31,18,64]),import.meta.url),()=>o(()=>import("../nodes/21.BAlasPHS.js"),__vite__mapDeps([65,1,2,3,4,5,6,7,27,16,19,18,28,8,11,20,21,29,30,35,10,36]),import.meta.url),()=>o(()=>import("../nodes/22.C719k-1W.js"),__vite__mapDeps([66,1,2,3,4,5,6,7,39,16,9,47,10,13,67]),import.meta.url)],ar=[],or={"/":[3],"/(app)/activation":[4,[2]],"/(app)/blackbox":[5,[2]],"/(app)/contradictions":[6,[2]],"/(app)/dreams":[7,[2]],"/(app)/duplicates":[8,[2]],"/(app)/explore":[9,[2]],"/(app)/feed":[10,[2]],"/(app)/graph":[11,[2]],"/(app)/importance":[12,[2]],"/(app)/intentions":[13,[2]],"/(app)/memories":[14,[2]],"/(app)/memory-prs":[15,[2]],"/(app)/patterns":[16,[2]],"/(app)/reasoning":[17,[2]],"/(app)/schedule":[18,[2]],"/(app)/settings":[19,[2]],"/(app)/stats":[20,[2]],"/(app)/timeline":[21,[2]],"/waitlist":[22]},W={handleError:(({error:e})=>{console.error(e)}),reroute:(()=>{}),transport:{}},Ft=Object.fromEntries(Object.entries(W.transport).map(([e,t])=>[e,t.decode])),sr=Object.fromEntries(Object.entries(W.transport).map(([e,t])=>[e,t.encode])),ir=!1,_r=(e,t)=>Ft[e](t);export{_r as decode,Ft as decoders,or as dictionary,sr as encoders,ir as hash,W as hooks,tr as matchers,er as nodes,rr as root,ar as server_loads}; diff --git a/apps/dashboard/build/_app/immutable/entry/app.Dg6iMka9.js.br b/apps/dashboard/build/_app/immutable/entry/app.Dg6iMka9.js.br deleted file mode 100644 index 35fff68..0000000 Binary files a/apps/dashboard/build/_app/immutable/entry/app.Dg6iMka9.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/entry/app.Dg6iMka9.js.gz b/apps/dashboard/build/_app/immutable/entry/app.Dg6iMka9.js.gz deleted file mode 100644 index 54e99b8..0000000 Binary files a/apps/dashboard/build/_app/immutable/entry/app.Dg6iMka9.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/entry/start.BvFEq078.js b/apps/dashboard/build/_app/immutable/entry/start.BvFEq078.js deleted file mode 100644 index c225395..0000000 --- a/apps/dashboard/build/_app/immutable/entry/start.BvFEq078.js +++ /dev/null @@ -1 +0,0 @@ -import{a as r}from"../chunks/dCAmqaEc.js";import{w as t}from"../chunks/Bxs5UR9-.js";export{t as load_css,r as start}; diff --git a/apps/dashboard/build/_app/immutable/entry/start.BvFEq078.js.br b/apps/dashboard/build/_app/immutable/entry/start.BvFEq078.js.br deleted file mode 100644 index bed1076..0000000 Binary files a/apps/dashboard/build/_app/immutable/entry/start.BvFEq078.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/entry/start.BvFEq078.js.gz b/apps/dashboard/build/_app/immutable/entry/start.BvFEq078.js.gz deleted file mode 100644 index dcc3604..0000000 Binary files a/apps/dashboard/build/_app/immutable/entry/start.BvFEq078.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/entry/start.gT92nAJC.js b/apps/dashboard/build/_app/immutable/entry/start.gT92nAJC.js new file mode 100644 index 0000000..f01b681 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/entry/start.gT92nAJC.js @@ -0,0 +1 @@ +import{a as r}from"../chunks/BHGLDPij.js";import{w as t}from"../chunks/BskPcZf7.js";export{t as load_css,r as start}; diff --git a/apps/dashboard/build/_app/immutable/entry/start.gT92nAJC.js.br b/apps/dashboard/build/_app/immutable/entry/start.gT92nAJC.js.br new file mode 100644 index 0000000..68a435b Binary files /dev/null and b/apps/dashboard/build/_app/immutable/entry/start.gT92nAJC.js.br differ diff --git a/apps/dashboard/build/_app/immutable/entry/start.gT92nAJC.js.gz b/apps/dashboard/build/_app/immutable/entry/start.gT92nAJC.js.gz new file mode 100644 index 0000000..0b2d810 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/entry/start.gT92nAJC.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/0.BmfNagK9.js b/apps/dashboard/build/_app/immutable/nodes/0.BmfNagK9.js deleted file mode 100644 index 4397bdd..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/0.BmfNagK9.js +++ /dev/null @@ -1,86 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{o as et}from"../chunks/TZu9D97Z.js";import{c as tt,f as ve,a as v,h as s,e as a,r as t,t as F,j as h,p as Ye,n as ce,g as e,b as Qe,s as le,d as kt,i as f,u as Y,m as st}from"../chunks/wpu9U-D0.js";import{s as g,d as Ue,a as ie,e as Ge,b as _t,w as ct,g as vt}from"../chunks/D8mhvFt8.js";import{i as z}from"../chunks/DKve45Wd.js";import{e as Fe,a as Ae,i as Be,s as ee,r as yt}from"../chunks/60_R_Vbt.js";import{s as rt}from"../chunks/LDOJP_6N.js";import{b as wt}from"../chunks/CnZzd20v.js";import{b as $t}from"../chunks/g5OnrUYZ.js";import{s as pe,a as He}from"../chunks/ByYB047u.js";import{s as At,o as Ct,g as nt}from"../chunks/dCAmqaEc.js";import{b as _e}from"../chunks/Bxs5UR9-.js";import{s as pt,b as ut,a as mt,e as Mt,w as it,u as Tt,i as Et,f as St}from"../chunks/BhIgFntf.js";import{i as jt}from"../chunks/BLadwbF7.js";import{s as ft}from"../chunks/EqHb-9AZ.js";import{t as Ie}from"../chunks/CqMQEF-F.js";import{a as qe}from"../chunks/CZfHMhLI.js";import{I as Le}from"../chunks/D7A-gG4Z.js";const Dt=()=>{const n=At;return{page:{subscribe:n.page.subscribe},navigating:{subscribe:n.navigating.subscribe},updated:n.updated}},It={subscribe(n){return Dt().page.subscribe(n)}};var Ft=h('
');function Nt(n){const l=()=>pe(pt,"$suppressedCount",o),[o,i]=He();var b=tt(),M=ve(b);{var k=N=>{var w=Ft(),y=s(a(w),2),p=a(y);t(y),t(w),F(()=>g(p,`Actively forgetting ${l()??""} ${l()===1?"memory":"memories"}`)),v(N,w)};z(M,N=>{l()>0&&N(k)})}v(n,b),i()}var Lt=h(''),Bt=h('
');function Vt(n,l){Ye(l,!1);const o=()=>pe(Ie,"$toasts",i),[i,b]=He(),M={DreamCompleted:"✦",ConsolidationCompleted:"◉",ConnectionDiscovered:"⟷",MemoryPromoted:"↑",MemoryDemoted:"↓",MemorySuppressed:"◬",MemoryUnsuppressed:"◉",Rac1CascadeSwept:"✺",MemoryDeleted:"✕",HookVerdictRecorded:"⚑"};function k(p){return M[p]??"◆"}function N(p){Ie.dismiss(p.id)}function w(p,c){(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),Ie.dismiss(c.id))}jt();var y=Bt();Fe(y,5,o,p=>p.id,(p,c)=>{var T=Lt(),L=s(a(T),2),B=a(L),Z=a(B),Q=a(Z,!0);t(Z);var te=s(Z,2),ue=a(te,!0);t(te),t(B);var u=s(B,2),m=a(u,!0);t(u),t(L),ce(2),t(T),F($=>{Ae(T,"aria-label",`${e(c).title??""}: ${e(c).body??""}. Click to dismiss.`),ft(T,`--toast-color: ${e(c).color??""}; --toast-dwell: ${e(c).dwellMs??""}ms;`),g(Q,$),g(ue,e(c).title),g(m,e(c).body)},[()=>k(e(c).type)]),ie("click",T,()=>N(e(c))),ie("keydown",T,$=>w($,e(c))),Ge("mouseenter",T,()=>Ie.pauseDwell(e(c).id,e(c).dwellMs)),Ge("mouseleave",T,()=>Ie.resumeDwell(e(c).id)),Ge("focus",T,()=>Ie.pauseDwell(e(c).id,e(c).dwellMs)),Ge("blur",T,()=>Ie.resumeDwell(e(c).id)),v(p,T)}),t(y),v(n,y),Qe(),b()}Ue(["click","keydown"]);function Ve(n){const l=n.data;if(!l||typeof l!="object")return null;const o=l.timestamp??l.at??l.occurred_at;if(o==null)return null;if(typeof o=="number")return Number.isFinite(o)?o>1e12?o:o*1e3:null;if(typeof o!="string")return null;const i=Date.parse(o);return Number.isFinite(i)?i:null}const Ze=10,ht=3e4,Rt=Ze*ht;function Ot(n,l){const o=l-Rt,i=new Array(Ze).fill(0);for(const M of n){if(M.type==="Heartbeat")continue;const k=Ve(M);if(k===null||kl)continue;const N=Math.min(Ze-1,Math.floor((k-o)/ht));i[N]+=1}const b=Math.max(1,...i);return i.map(M=>({count:M,ratio:M/b}))}function Pt(n,l){const o=l-864e5;for(const i of n){if(i.type!=="DreamCompleted")continue;return(Ve(i)??l)>=o?i:null}return null}function zt(n){if(!n||!n.data)return null;const l=n.data,o=typeof l.insights_generated=="number"?l.insights_generated:typeof l.insightsGenerated=="number"?l.insightsGenerated:null;return o!==null&&Number.isFinite(o)?o:null}function Kt(n,l){let o=null,i=null;for(const N of n)if(!o&&N.type==="DreamStarted"&&(o=N),!i&&N.type==="DreamCompleted"&&(i=N),o&&i)break;if(!o)return!1;const b=Ve(o)??l,M=l-300*1e3;return b=i}return!1}var Wt=h(' at risk',1),Gt=h('0 at risk',1),Yt=h(' at risk',1),Qt=h(' intentions',1),Ut=h('— intentions'),Xt=h('· insights',1),Zt=h(' Last dream: ',1),Jt=h('No recent dream'),ea=h('
'),ta=h('telemetry unavailable'),aa=h('· fail-open',1),sa=h(' vetoes · appeals ',1),ra=h('
DREAMING...
',1),na=h(''),ia=h('
memories · avg retention
');function la(n,l){Ye(l,!0);const o=()=>pe(mt,"$avgRetention",M),i=()=>pe(Mt,"$eventFeed",M),b=()=>pe(ut,"$memoryCount",M),[M,k]=He(),N=Y(()=>Math.round((o()??0)*100)),w=Y(()=>(o()??0)>=.5);let y=le(null);async function p(){try{const r=await qe.retentionDistribution();if(Array.isArray(r.endangered)&&r.endangered.length>0){f(y,r.endangered.length,!0);return}const d=r.distribution??[];let _=0;for(const V of d){const G=/^(\d+)/.exec(V.range);if(!G)continue;const re=Number.parseInt(G[1],10);Number.isFinite(re)&&re<30&&(_+=V.count??0)}f(y,_,!0)}catch{f(y,null)}}let c=le(null);async function T(){var r;try{const d=await qe.intentions("active");f(c,d.total??((r=d.intentions)==null?void 0:r.length)??0,!0)}catch{f(c,null)}}let L=le(kt(Date.now()));const B=Y(()=>{const r=i(),d=Pt(r,e(L)),_=d?Ve(d)??e(L):null,V=_!==null?e(L)-_:null;return{isDreaming:Kt(r,e(L)),recent:d,recentMsAgo:V,insights:zt(d)}}),Z=Y(()=>Ot(i(),e(L)));let Q=le(null),te=le(!1);async function ue(){try{f(Q,await qe.sanhedrin.telemetry(7),!0),f(te,!1)}catch{f(Q,null),f(te,!0)}}const u=Y(()=>Ht(i(),e(L)));et(()=>{p(),T(),ue();const r=setInterval(()=>{f(L,Date.now(),!0)},1e3),d=setInterval(()=>{p(),T(),ue()},6e4);return()=>{clearInterval(r),clearInterval(d)}});var m=ia();let $;var be=a(m),xe=a(be),Ne=a(xe);let Ce;var S=s(Ne,2);let j;t(xe);var x=s(xe,2),ae=a(x,!0);t(x);var K=s(x,6);let U;var he=a(K);t(K),ce(2),t(be);var A=s(be,4),D=a(A);{var q=r=>{var d=Wt(),_=ve(d),V=a(_,!0);t(_),ce(2),F(()=>g(V,e(y))),v(r,d)},oe=r=>{var d=Gt();ce(2),v(r,d)},E=r=>{var d=Yt();ce(2),v(r,d)};z(D,r=>{e(y)!==null&&e(y)>0?r(q):e(y)===0?r(oe,1):r(E,!1)})}t(A);var X=s(A,4),se=a(X);{var de=r=>{var d=Qt(),_=ve(d);let V;var G=s(_,2);let re;var ne=a(G,!0);t(G),ce(2),F(()=>{V=ee(_,1,"inline-flex h-2 w-2 rounded-full svelte-1kk3799",null,V,{"bg-node-pattern":e(c)>5,"animate-ping-slow":e(c)>5,"bg-muted":e(c)<=5}),re=ee(G,1,"tabular-nums svelte-1kk3799",null,re,{"text-node-pattern":e(c)>5,"text-text":e(c)>0&&e(c)<=5,"text-muted":e(c)===0}),g(ne,e(c))}),v(r,d)},Se=r=>{var d=Ut();v(r,d)};z(se,r=>{e(c)!==null?r(de):r(Se,!1)})}t(X);var J=s(X,4),Me=a(J);{var me=r=>{var d=Zt(),_=s(ve(d),4),V=a(_,!0);t(_);var G=s(_,2);{var re=ne=>{var I=Xt(),C=s(ve(I),2),P=a(C,!0);t(C),ce(2),F(()=>g(P,e(B).insights)),v(ne,I)};z(G,ne=>{e(B).insights!==null&&ne(re)})}F(ne=>g(V,ne),[()=>qt(e(B).recentMsAgo)]),v(r,d)},ge=r=>{var d=Jt();v(r,d)};z(Me,r=>{e(B).recent&&e(B).recentMsAgo!==null?r(me):r(ge,!1)})}t(J);var je=s(J,4),ke=s(a(je),2);Fe(ke,21,()=>e(Z),Be,(r,d)=>{var _=ea();F(V=>ft(_,`height: ${V??""}%; opacity: ${e(d).count===0?.18:.5+e(d).ratio*.5};`),[()=>Math.max(10,e(d).ratio*100)]),v(r,_)}),t(ke),t(je);var De=s(je,4),Oe=s(a(De),2);{var Pe=r=>{var d=ta();v(r,d)},ze=r=>{var d=sa(),_=ve(d),V=a(_,!0);t(_);var G=s(_,6),re=a(G,!0);t(G);var ne=s(G,4);{var I=C=>{var P=aa(),O=s(ve(P),2),Te=a(O,!0);t(O),ce(2),F(()=>g(Te,e(Q).failOpen)),v(C,P)};z(ne,C=>{var P;(P=e(Q))!=null&&P.failOpen&&C(I)})}F(()=>{var C,P,O;g(V,((P=(C=e(Q))==null?void 0:C.byVerdict)==null?void 0:P.VETO)??"—"),g(re,((O=e(Q))==null?void 0:O.appeals)??"—")}),v(r,d)};z(Oe,r=>{e(te)?r(Pe):r(ze,!1)})}t(De);var R=s(De,2);{var H=r=>{var d=ra();ce(2),v(r,d)};z(R,r=>{e(B).isDreaming&&r(H)})}var W=s(R,4);{var fe=r=>{var d=na();v(r,d)};z(W,r=>{e(u)&&r(fe)})}t(m),F(()=>{$=ee(m,1,"ambient-strip relative flex h-9 w-full items-center gap-0 overflow-hidden border-b border-synapse/15 bg-black/40 px-3 text-[11px] text-dim backdrop-blur-md svelte-1kk3799",null,$,{"ambient-flash":e(u)}),Ce=ee(Ne,1,"absolute inline-flex h-full w-full animate-ping rounded-full opacity-75 svelte-1kk3799",null,Ce,{"bg-recall":e(w),"bg-warning":!e(w)}),j=ee(S,1,"relative inline-flex h-2 w-2 rounded-full svelte-1kk3799",null,j,{"bg-recall":e(w),"bg-warning":!e(w)}),g(ae,b()),U=ee(K,1,"svelte-1kk3799",null,U,{"text-recall":e(w),"text-warning":!e(w)}),g(he,`${e(N)??""}%`)}),v(n,m),Qe(),k()}var oa=h(" "),da=h('
  • '),ca=h(' ',1),va=h('

    Appeal recorded.

    '),pa=h('

    No appealable veto in this receipt.

    '),ua=h('
    Claim

    Verdict

    Precedent
      Fix

      Appeal
      '),ma=h('
      ');function fa(n,l){Ye(l,!0);const o=["PASS","NOTE","CAUTION","VETO","APPEALED"];let i=le(null),b=le(""),M=le(!1),k=le(null),N=le(null),w=Y(()=>{var u;return((u=e(i))==null?void 0:u.verdictBar)??(e(b)?"CAUTION":"NOTE")}),y=Y(()=>{var u,m;return((u=e(i))==null?void 0:u.claims.find($=>$.decision==="veto"))??((m=e(i))==null?void 0:m.claims.find($=>$.decision==="appealed"))??null}),p=Y(()=>{var u;return e(y)??((u=e(i))==null?void 0:u.claims[0])??null}),c=Y(()=>!!e(i)||!!e(b));et(()=>{T();const u=window.setInterval(T,4e3);return()=>window.clearInterval(u)});async function T(){var u;try{const m=await qe.sanhedrin.latest();f(i,m.receipt,!0),f(b,""),((u=m.receipt)==null?void 0:u.verdictBar)==="VETO"&&m.receipt.id!==e(N)&&(f(M,!0),f(N,m.receipt.id,!0))}catch(m){f(b,m instanceof Error?m.message:String(m),!0)}}async function L(u){var m;if(!(!e(y)||((m=e(i))==null?void 0:m.verdictBar)!=="VETO")){f(k,u,!0);try{const $=await qe.sanhedrin.appeal(u,void 0,e(y).id,e(i).id);f(i,$.receipt,!0),f(M,!0),f(b,"")}catch($){f(b,$ instanceof Error?$.message:String($),!0)}finally{f(k,null)}}}function B(u){if(!u)return"";const m=new Date(u);return Number.isNaN(m.getTime())?"":m.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function Z(u){var m;return(m=u==null?void 0:u.precedent)!=null&&m.length?u.precedent.map($=>$.summary??$.command??"Precedent recorded.").slice(0,3):["No precedent attached."]}var Q=tt(),te=ve(Q);{var ue=u=>{var m=ma(),$=a(m),be=s(a($),2);Fe(be,21,()=>o,Be,(A,D)=>{var q=oa();let oe;var E=a(q,!0);t(q),F(()=>{Ae(q,"aria-current",e(D)===e(w)?"true":void 0),oe=ee(q,1,"svelte-1j425e6",null,oe,{active:e(D)===e(w)}),g(E,e(D))}),v(A,q)}),t(be);var xe=s(be,2),Ne=a(xe);t(xe);var Ce=s(xe,2),S=a(Ce);{var j=A=>{var D=st();F(()=>g(D,e(b))),v(A,D)},x=A=>{var D=st();F(()=>g(D,e(i).summary)),v(A,D)};z(S,A=>{e(b)?A(j):e(i)&&A(x,1)})}t(Ce);var ae=s(Ce,2),K=a(ae,!0);t(ae),t($);var U=s($,2);{var he=A=>{var D=ua(),q=a(D),oe=a(q),E=s(a(oe),2),X=a(E,!0);t(E),t(oe);var se=s(oe,2),de=s(a(se),2),Se=a(de);t(de),t(se);var J=s(se,2),Me=s(a(J),2);Fe(Me,21,()=>Z(e(p)),Be,(R,H)=>{var W=da(),fe=a(W,!0);t(W),F(()=>g(fe,e(H))),v(R,W)}),t(Me),t(J);var me=s(J,2),ge=s(a(me),2),je=a(ge,!0);t(ge),t(me),t(q);var ke=s(q,2),De=s(a(ke),2);{var Oe=R=>{var H=ca(),W=ve(H),fe=a(W,!0);t(W);var r=s(W,2),d=a(r,!0);t(r);var _=s(r,2),V=a(_,!0);t(_),F((G,re,ne)=>{W.disabled=G,g(fe,e(k)==="stale"?"Saving":"Stale"),r.disabled=re,g(d,e(k)==="wrong"?"Saving":"Wrong"),_.disabled=ne,g(V,e(k)==="too_strict"?"Saving":"Too strict")},[()=>!!e(k),()=>!!e(k),()=>!!e(k)]),ie("click",W,()=>L("stale")),ie("click",r,()=>L("wrong")),ie("click",_,()=>L("too_strict")),v(R,H)},Pe=R=>{var H=va();v(R,H)},ze=R=>{var H=pa();v(R,H)};z(De,R=>{e(y)&&e(i).verdictBar==="VETO"?R(Oe):e(i).verdictBar==="APPEALED"?R(Pe,1):R(ze,!1)})}t(ke),t(D),F(()=>{var R,H,W,fe;g(X,((R=e(p))==null?void 0:R.text)??e(i).draftPreview),g(Se,`${((H=e(p))==null?void 0:H.decision)??e(i).overall??""} · ${((W=e(p))==null?void 0:W.evidence_state)??e(w)??""}`),g(je,((fe=e(p))==null?void 0:fe.fix)||"No change required.")}),v(A,D)};z(U,A=>{e(M)&&e(i)&&A(he)})}t(m),F((A,D)=>{ee(m,1,A,"svelte-1j425e6"),Ae($,"aria-expanded",e(M)),g(Ne,`Current verdict: ${e(w)??""}`),g(K,D)},[()=>`verdict-bar tone-${e(w).toLowerCase()}`,()=>{var A;return B((A=e(i))==null?void 0:A.createdAt)}]),ie("click",$,()=>f(M,!e(M))),v(u,m)};z(te,u=>{e(c)&&u(ue)})}v(n,Q),Qe()}Ue(["click"]);const gt="vestige.theme",lt="vestige-theme-light",Re=ct("dark"),Je=ct(!0),ot=_t([Re,Je],([n,l])=>n==="auto"?l?"dark":"light":n);function ha(n){return n==="dark"||n==="light"||n==="auto"}function ga(n){if(ha(n)){Re.set(n);try{localStorage.setItem(gt,n)}catch{}}}function Xe(){const n=vt(Re);ga(n==="dark"?"light":n==="light"?"auto":"dark")}function ba(){if(document.getElementById(lt))return;const n=document.createElement("style");n.id=lt,n.textContent=` -/* Vestige light-mode overrides — injected by theme.ts. - * Activated by [data-theme='light'] on . - * Tokens mirror the real names used in app.css so the cascade stays clean. */ -[data-theme='light'] { - /* Core surface palette (slate scale) */ - --color-void: #f8fafc; /* slate-50 — page background */ - --color-abyss: #f1f5f9; /* slate-100 */ - --color-deep: #e2e8f0; /* slate-200 */ - --color-surface: #f1f5f9; /* slate-100 */ - --color-elevated: #e2e8f0; /* slate-200 */ - --color-subtle: #cbd5e1; /* slate-300 */ - --color-muted: #94a3b8; /* slate-400 */ - --color-dim: #475569; /* slate-600 */ - --color-text: #0f172a; /* slate-900 */ - --color-bright: #020617; /* slate-950 */ -} - -/* Baseline body/html wiring — app.css sets these against the dark - * tokens; we just let the variables do the work. Reassert for clarity. */ -[data-theme='light'] html, -html[data-theme='light'] { - background: var(--color-void); - color: var(--color-text); -} - -/* Glass surfaces — recompose on a light canvas. The original alphas - * are tuned for dark; invert-and-tint for light so panels still read - * as elevated instead of vanishing. */ -[data-theme='light'] .glass { - background: rgba(255, 255, 255, 0.65); - border: 1px solid rgba(99, 102, 241, 0.12); - box-shadow: - inset 0 1px 0 0 rgba(255, 255, 255, 0.6), - 0 4px 24px rgba(15, 23, 42, 0.08); -} -[data-theme='light'] .glass-subtle { - background: rgba(255, 255, 255, 0.55); - border: 1px solid rgba(99, 102, 241, 0.1); - box-shadow: - inset 0 1px 0 0 rgba(255, 255, 255, 0.5), - 0 2px 12px rgba(15, 23, 42, 0.06); -} -[data-theme='light'] .glass-sidebar { - background: rgba(248, 250, 252, 0.82); - border-right: 1px solid rgba(99, 102, 241, 0.14); - box-shadow: - inset -1px 0 0 0 rgba(255, 255, 255, 0.4), - 4px 0 24px rgba(15, 23, 42, 0.08); -} -[data-theme='light'] .glass-panel { - background: rgba(255, 255, 255, 0.75); - border: 1px solid rgba(99, 102, 241, 0.14); - box-shadow: - inset 0 1px 0 0 rgba(255, 255, 255, 0.5), - 0 8px 32px rgba(15, 23, 42, 0.1); -} - -/* Halve glow intensity — neon accents stay recognizable without - * washing out on slate-50. */ -[data-theme='light'] .glow-synapse { - box-shadow: 0 0 10px rgba(99, 102, 241, 0.15), 0 0 30px rgba(99, 102, 241, 0.05); -} -[data-theme='light'] .glow-dream { - box-shadow: 0 0 10px rgba(168, 85, 247, 0.15), 0 0 30px rgba(168, 85, 247, 0.05); -} -[data-theme='light'] .glow-memory { - box-shadow: 0 0 10px rgba(59, 130, 246, 0.15), 0 0 30px rgba(59, 130, 246, 0.05); -} - -/* Ambient orbs are gorgeous on black and blinding on white. Tame them. */ -[data-theme='light'] .ambient-orb { - opacity: 0.18; - filter: blur(100px); -} - -/* Scrollbar recolor for the lighter surface. */ -[data-theme='light'] ::-webkit-scrollbar-thumb { - background: #cbd5e1; -} -[data-theme='light'] ::-webkit-scrollbar-thumb:hover { - background: #94a3b8; -} -`,document.head.appendChild(n)}function dt(n){document.documentElement.dataset.theme=n}let ye=null,Ee=null,we=null,$e=null;function xa(){ye&&Ee&&ye.removeEventListener("change",Ee),$e==null||$e(),we==null||we(),ye=null,Ee=null,$e=null,we=null,ba();let n="dark";try{const l=localStorage.getItem(gt);(l==="dark"||l==="light"||l==="auto")&&(n=l)}catch{}return Re.set(n),ye=window.matchMedia("(prefers-color-scheme: dark)"),Je.set(ye.matches),Ee=l=>Je.set(l.matches),ye.addEventListener("change",Ee),dt(vt(ot)),$e=ot.subscribe(dt),we=Re.subscribe(()=>{}),()=>{ye&&Ee&&ye.removeEventListener("change",Ee),ye=null,Ee=null,$e==null||$e(),we==null||we(),$e=null,we=null}}var ka=h('');function _a(n){const l=()=>pe(Re,"$theme",o),[o,i]=He(),b={dark:"Dark",light:"Light",auto:"Auto (system)"},M={dark:"light",light:"auto",auto:"dark"};let k=Y(l),N=Y(()=>M[e(k)]),w=Y(()=>`Toggle theme: ${b[e(k)]} (click for ${b[e(N)]})`);var y=ka(),p=a(y),c=a(p);let T;var L=s(c,2);let B;var Z=s(L,2);let Q;t(p),t(y),F(()=>{Ae(y,"aria-label",e(w)),Ae(y,"title",e(w)),Ae(y,"data-mode",e(k)),T=ee(c,0,"icon svelte-1cmi4dh",null,T,{active:e(k)==="dark"}),B=ee(L,0,"icon svelte-1cmi4dh",null,B,{active:e(k)==="light"}),Q=ee(Z,0,"icon svelte-1cmi4dh",null,Q,{active:e(k)==="auto"})}),ie("click",y,function(...te){Xe==null||Xe.apply(this,te)}),v(n,y),i()}Ue(["click"]);var ya=h(' '),wa=h('
      '),$a=h(''),Aa=h(' '),Ca=h('
      ',1),Ma=h(''),Ta=h('
      No matches
      '),Ea=h('
      esc
      '),Sa=h(" ",1);function Qa(n,l){Ye(l,!0);const o=()=>pe(It,"$page",w),i=()=>pe(Et,"$isConnected",w),b=()=>pe(ut,"$memoryCount",w),M=()=>pe(mt,"$avgRetention",w),k=()=>pe(Tt,"$uptimeSeconds",w),N=()=>pe(pt,"$suppressedCount",w),[w,y]=He();let p=le(!1),c=le(""),T=le(void 0),L=Y(()=>o().url.pathname.startsWith(_e)?o().url.pathname.slice(_e.length)||"/":o().url.pathname),B=Y(()=>e(L)==="/waitlist"||e(L).startsWith("/waitlist/"));et(()=>{e(B)||it.connect();const S=xa();function j(x){if(e(B))return;if((x.metaKey||x.ctrlKey)&&x.key==="k"){x.preventDefault(),f(p,!e(p)),f(c,""),e(p)&&requestAnimationFrame(()=>{var U;return(U=e(T))==null?void 0:U.focus()});return}if(x.key==="Escape"&&e(p)){f(p,!1);return}if(x.target instanceof HTMLInputElement||x.target instanceof HTMLTextAreaElement)return;if(x.key==="/"){x.preventDefault();const U=document.querySelector('input[type="text"]');U==null||U.focus();return}const K={g:"/graph",m:"/memories",t:"/timeline",f:"/feed",e:"/explore",i:"/intentions",s:"/stats",r:"/reasoning",a:"/activation",d:"/dreams",c:"/schedule",p:"/importance",u:"/duplicates",x:"/contradictions",n:"/patterns"}[x.key.toLowerCase()];K&&!x.metaKey&&!x.ctrlKey&&!x.altKey&&(x.preventDefault(),nt(`${_e}${K}`))}return window.addEventListener("keydown",j),()=>{it.disconnect(),window.removeEventListener("keydown",j),S()}}),Ct(S=>{if(!(!document.startViewTransition||window.matchMedia("(prefers-reduced-motion: reduce)").matches))return new Promise(j=>{document.startViewTransition(async()=>{j(),await S.complete})})});const Z=[{href:"/blackbox",label:"Black Box",icon:"blackbox",shortcut:"B"},{href:"/memory-prs",label:"Memory PRs",icon:"memorypr",shortcut:"Q"},{href:"/graph",label:"Graph",icon:"graph",shortcut:"G"},{href:"/reasoning",label:"Reasoning",icon:"reasoning",shortcut:"R"},{href:"/memories",label:"Memories",icon:"memories",shortcut:"M"},{href:"/timeline",label:"Timeline",icon:"timeline",shortcut:"T"},{href:"/feed",label:"Feed",icon:"feed",shortcut:"F"},{href:"/explore",label:"Explore",icon:"explore",shortcut:"E"},{href:"/activation",label:"Activation",icon:"activation",shortcut:"A"},{href:"/dreams",label:"Dreams",icon:"dreams",shortcut:"D"},{href:"/schedule",label:"Schedule",icon:"schedule",shortcut:"C"},{href:"/importance",label:"Importance",icon:"importance",shortcut:"P"},{href:"/duplicates",label:"Duplicates",icon:"duplicates",shortcut:"U"},{href:"/contradictions",label:"Contradictions",icon:"contradictions",shortcut:"X"},{href:"/patterns",label:"Patterns",icon:"patterns",shortcut:"N"},{href:"/intentions",label:"Intentions",icon:"intentions",shortcut:"I"},{href:"/stats",label:"Stats",icon:"stats",shortcut:"S"},{href:"/settings",label:"Settings",icon:"settings",shortcut:","}],Q=Z.slice(0,5);function te(S,j){const x=j.startsWith(_e)?j.slice(_e.length)||"/":j;return S==="/graph"?x==="/"||x==="/graph":x.startsWith(S)}let ue=Y(()=>e(c)?Z.filter(S=>S.label.toLowerCase().includes(e(c).toLowerCase())):Z);function u(S){f(p,!1),f(c,""),nt(`${_e}${S}`)}var m=Sa(),$=ve(m);{var be=S=>{var j=tt(),x=ve(j);rt(x,()=>l.children),v(S,j)},xe=S=>{var j=Ca(),x=s(ve(j),6),ae=a(x),K=a(ae),U=a(K),he=a(U);Le(he,{name:"logo",size:18,strokeWidth:1.8}),t(U),ce(2),t(K);var A=s(K,2);Fe(A,21,()=>Z,Be,(I,C)=>{const P=Y(()=>te(e(C).href,o().url.pathname));var O=ya(),Te=a(O),We=a(Te);Le(We,{get name(){return e(C).icon},size:18}),t(Te);var Ke=s(Te,2),bt=a(Ke,!0);t(Ke);var at=s(Ke,2),xt=a(at,!0);t(at),t(O),F(()=>{Ae(O,"href",`${_e??""}${e(C).href??""}`),ee(O,1,`nav-link group flex items-center gap-3 px-3 py-2.5 rounded-lg transition-all duration-200 text-sm - ${e(P)?"bg-synapse/15 text-synapse-glow border border-synapse/30 shadow-[0_0_12px_rgba(99,102,241,0.15)] nav-active-border":"text-dim hover:text-text hover:bg-white/[0.03] border border-transparent"}`,"svelte-12qhfyh"),g(bt,e(C).label),g(xt,e(C).shortcut)}),v(I,O)}),t(A);var D=s(A,2),q=a(D),oe=a(q);Le(oe,{name:"command",size:14}),ce(4),t(q),t(D);var E=s(D,2),X=a(E),se=a(X),de=s(se,2),Se=a(de,!0);t(de);var J=s(de,2),Me=a(J);_a(Me),t(J),t(X);var me=s(X,2),ge=a(me),je=a(ge);t(ge);var ke=s(ge,2),De=a(ke);t(ke);var Oe=s(ke,2);{var Pe=I=>{var C=wa(),P=a(C);t(C),F(O=>g(P,`up ${O??""}`),[()=>St(k())]),v(I,C)};z(Oe,I=>{k()>0&&I(Pe)})}t(me);var ze=s(me,2);{var R=I=>{var C=$a(),P=a(C);Nt(P),t(C),v(I,C)};z(ze,I=>{N()>0&&I(R)})}t(E),t(ae);var H=s(ae,2),W=a(H);la(W,{});var fe=s(W,2);fa(fe,{});var r=s(fe,2),d=a(r);rt(d,()=>l.children),t(r),t(H);var _=s(H,2),V=a(_),G=a(V);Fe(G,17,()=>Q,Be,(I,C)=>{const P=Y(()=>te(e(C).href,o().url.pathname));var O=Aa(),Te=a(O);Le(Te,{get name(){return e(C).icon},size:20});var We=s(Te,2),Ke=a(We,!0);t(We),t(O),F(()=>{Ae(O,"href",`${_e??""}${e(C).href??""}`),ee(O,1,`flex flex-col items-center gap-0.5 px-3 py-2 rounded-lg transition-all min-w-[3.5rem] - ${e(P)?"text-synapse-glow":"text-muted"}`),g(Ke,e(C).label)}),v(I,O)});var re=s(G,2);t(V),t(_),t(x);var ne=s(x,2);Vt(ne,{}),F(I=>{Ae(K,"href",`${_e??""}/graph`),ee(se,1,`w-2 h-2 rounded-full ${i()?"bg-recall animate-pulse-glow":"bg-decay"}`),g(Se,i()?"Connected":"Offline"),g(je,`${b()??""} memories`),g(De,`${I??""}% retention`)},[()=>(M()*100).toFixed(0)]),ie("click",q,()=>{f(p,!0),f(c,""),requestAnimationFrame(()=>{var I;return(I=e(T))==null?void 0:I.focus()})}),ie("click",re,()=>{f(p,!0),f(c,""),requestAnimationFrame(()=>{var I;return(I=e(T))==null?void 0:I.focus()})}),v(S,j)};z($,S=>{e(B)?S(be):S(xe,!1)})}var Ne=s($,2);{var Ce=S=>{var j=Ea(),x=a(j),ae=a(x),K=a(ae),U=a(K);Le(U,{name:"search",size:16}),t(K);var he=s(K,2);yt(he),$t(he,E=>f(T,E),()=>e(T)),ce(2),t(ae);var A=s(ae,2),D=a(A);Fe(D,17,()=>e(ue),Be,(E,X)=>{var se=Ma(),de=a(se),Se=a(de);Le(Se,{get name(){return e(X).icon},size:17}),t(de);var J=s(de,2),Me=a(J,!0);t(J);var me=s(J,2),ge=a(me,!0);t(me),t(se),F(()=>{g(Me,e(X).label),g(ge,e(X).shortcut)}),ie("click",se,()=>u(e(X).href)),v(E,se)});var q=s(D,2);{var oe=E=>{var X=Ta();v(E,X)};z(q,E=>{e(ue).length===0&&E(oe)})}t(A),t(x),t(j),ie("keydown",j,E=>{E.key==="Escape"&&f(p,!1)}),ie("click",j,E=>{E.target===E.currentTarget&&f(p,!1)}),ie("keydown",he,E=>{E.key==="Enter"&&e(ue).length>0&&u(e(ue)[0].href)}),wt(he,()=>e(c),E=>f(c,E)),v(S,j)};z(Ne,S=>{e(p)&&!e(B)&&S(Ce)})}v(n,m),Qe(),y()}Ue(["click","keydown"]);export{Qa as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/0.BmfNagK9.js.br b/apps/dashboard/build/_app/immutable/nodes/0.BmfNagK9.js.br deleted file mode 100644 index 758b7bb..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/0.BmfNagK9.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/0.BmfNagK9.js.gz b/apps/dashboard/build/_app/immutable/nodes/0.BmfNagK9.js.gz deleted file mode 100644 index 738f852..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/0.BmfNagK9.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/0.COz2esg5.js b/apps/dashboard/build/_app/immutable/nodes/0.COz2esg5.js new file mode 100644 index 0000000..f9dcc17 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/0.COz2esg5.js @@ -0,0 +1,86 @@ +import"../chunks/Bzak7iHL.js";import{o as st}from"../chunks/GG5zm9kr.js";import{f as ce,e as o,d as s,r as t,t as N,p as We,n as se,g as e,a as Oe,s as ye,c as mt,h as A,u as j}from"../chunks/CpWkWWOo.js";import{s as _,d as Ye,a as re,e as Le}from"../chunks/BlVfL1ME.js";import{i as B}from"../chunks/B4yTwGkE.js";import{e as De,i as Ne}from"../chunks/CGEBXrjl.js";import{c as rt,a as u,f as m}from"../chunks/CHOnp4oo.js";import{s as Xe}from"../chunks/CJCPY1OL.js";import{s as be,r as ft}from"../chunks/A7po6GxK.js";import{s as G}from"../chunks/aVbAZ-t7.js";import{b as ht}from"../chunks/sZcqyNBA.js";import{b as gt}from"../chunks/CJsMJEun.js";import{a as H,s as Te}from"../chunks/C6HuKgyx.js";import{s as bt,g as Ze}from"../chunks/BHGLDPij.js";import{b as U}from"../chunks/BskPcZf7.js";import{s as nt,m as it,a as ot,e as xt,w as Je,u as kt,i as _t,f as yt}from"../chunks/MAY1QfFZ.js";import{i as wt}from"../chunks/BUoSzNdg.js";import{s as lt}from"../chunks/Cx-f-Pzo.js";import{t as ge}from"../chunks/BjdL4Pm2.js";import{a as Ue}from"../chunks/DNjM5a-l.js";import{d as $t,w as dt,g as ct}from"../chunks/BeMFXnHE.js";const Mt=()=>{const a=bt;return{page:{subscribe:a.page.subscribe},navigating:{subscribe:a.navigating.subscribe},updated:a.updated}},Ct={subscribe(a){return Mt().page.subscribe(a)}};var At=m('
      ');function Dt(a){const r=()=>H(nt,"$suppressedCount",i),[i,c]=Te();var f=rt(),M=ce(f);{var y=D=>{var x=At(),h=o(s(x),2),v=s(h);t(h),t(x),N(()=>_(v,`Actively forgetting ${r()??""} ${r()===1?"memory":"memories"}`)),u(D,x)};B(M,D=>{r()>0&&D(y)})}u(a,f),c()}var Tt=m(''),Et=m('
      ');function Ft(a,r){We(r,!1);const i=()=>H(ge,"$toasts",c),[c,f]=Te(),M={DreamCompleted:"✦",ConsolidationCompleted:"◉",ConnectionDiscovered:"⟷",MemoryPromoted:"↑",MemoryDemoted:"↓",MemorySuppressed:"◬",MemoryUnsuppressed:"◉",Rac1CascadeSwept:"✺",MemoryDeleted:"✕"};function y(v){return M[v]??"◆"}function D(v){ge.dismiss(v.id)}function x(v,l){(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),ge.dismiss(l.id))}wt();var h=Et();De(h,5,i,v=>v.id,(v,l)=>{var b=Tt(),F=o(s(b),2),T=s(F),K=s(T),Q=s(K,!0);t(K);var V=o(K,2),X=s(V,!0);t(V),t(T);var Z=o(T,2),ne=s(Z,!0);t(Z),t(F),se(2),t(b),N(J=>{be(b,"aria-label",`${e(l).title??""}: ${e(l).body??""}. Click to dismiss.`),lt(b,`--toast-color: ${e(l).color??""}; --toast-dwell: ${e(l).dwellMs??""}ms;`),_(Q,J),_(X,e(l).title),_(ne,e(l).body)},[()=>y(e(l).type)]),re("click",b,()=>D(e(l))),re("keydown",b,J=>x(J,e(l))),Le("mouseenter",b,()=>ge.pauseDwell(e(l).id,e(l).dwellMs)),Le("mouseleave",b,()=>ge.resumeDwell(e(l).id)),Le("focus",b,()=>ge.pauseDwell(e(l).id,e(l).dwellMs)),Le("blur",b,()=>ge.resumeDwell(e(l).id)),u(v,b)}),t(h),u(a,h),Oe(),f()}Ye(["click","keydown"]);function we(a){const r=a.data;if(!r||typeof r!="object")return null;const i=r.timestamp??r.at??r.occurred_at;if(i==null)return null;if(typeof i=="number")return Number.isFinite(i)?i>1e12?i:i*1e3:null;if(typeof i!="string")return null;const c=Date.parse(i);return Number.isFinite(c)?c:null}const ze=10,vt=3e4,St=ze*vt;function It(a,r){const i=r-St,c=new Array(ze).fill(0);for(const M of a){if(M.type==="Heartbeat")continue;const y=we(M);if(y===null||yr)continue;const D=Math.min(ze-1,Math.floor((y-i)/vt));c[D]+=1}const f=Math.max(1,...c);return c.map(M=>({count:M,ratio:M/f}))}function Lt(a,r){const i=r-864e5;for(const c of a){if(c.type!=="DreamCompleted")continue;return(we(c)??r)>=i?c:null}return null}function Nt(a){if(!a||!a.data)return null;const r=a.data,i=typeof r.insights_generated=="number"?r.insights_generated:typeof r.insightsGenerated=="number"?r.insightsGenerated:null;return i!==null&&Number.isFinite(i)?i:null}function Rt(a,r){let i=null,c=null;for(const D of a)if(!i&&D.type==="DreamStarted"&&(i=D),!c&&D.type==="DreamCompleted"&&(c=D),i&&c)break;if(!i)return!1;const f=we(i)??r,M=r-300*1e3;return f=c}return!1}var Vt=m(' at risk',1),Bt=m('0 at risk',1),Gt=m(' at risk',1),Ht=m(' intentions',1),qt=m('— intentions'),zt=m('· insights',1),Pt=m(' Last dream: ',1),Wt=m('No recent dream'),Ot=m('
      '),Yt=m('
      DREAMING...
      ',1),Qt=m(''),Xt=m('
      memories · avg retention
      ');function Zt(a,r){We(r,!0);const i=()=>H(ot,"$avgRetention",M),c=()=>H(xt,"$eventFeed",M),f=()=>H(it,"$memoryCount",M),[M,y]=Te(),D=j(()=>Math.round((i()??0)*100)),x=j(()=>(i()??0)>=.5);let h=ye(null);async function v(){try{const n=await Ue.retentionDistribution();if(Array.isArray(n.endangered)&&n.endangered.length>0){A(h,n.endangered.length,!0);return}const d=n.distribution??[];let $=0;for(const S of d){const W=/^(\d+)/.exec(S.range);if(!W)continue;const O=Number.parseInt(W[1],10);Number.isFinite(O)&&O<30&&($+=S.count??0)}A(h,$,!0)}catch{A(h,null)}}let l=ye(null);async function b(){var n;try{const d=await Ue.intentions("active");A(l,d.total??((n=d.intentions)==null?void 0:n.length)??0,!0)}catch{A(l,null)}}let F=ye(mt(Date.now()));const T=j(()=>{const n=c(),d=Lt(n,e(F)),$=d?we(d)??e(F):null,S=$!==null?e(F)-$:null;return{isDreaming:Rt(n,e(F)),recent:d,recentMsAgo:S,insights:Nt(d)}}),K=j(()=>It(c(),e(F))),Q=j(()=>Kt(c(),e(F)));st(()=>{v(),b();const n=setInterval(()=>{A(F,Date.now(),!0)},1e3),d=setInterval(()=>{v(),b()},6e4);return()=>{clearInterval(n),clearInterval(d)}});var V=Xt();let X;var Z=s(V),ne=s(Z),J=s(ne);let Ee;var Re=o(J,2);let Fe;t(ne);var Me=o(ne,2),w=s(Me,!0);t(Me);var k=o(Me,6);let p;var z=s(k);t(k),se(2),t(Z);var L=o(Z,4),I=s(L);{var ie=n=>{var d=Vt(),$=ce(d),S=s($,!0);t($),se(2),N(()=>_(S,e(h))),u(n,d)},Ce=n=>{var d=Bt();se(2),u(n,d)},xe=n=>{var d=Gt();se(2),u(n,d)};B(I,n=>{e(h)!==null&&e(h)>0?n(ie):e(h)===0?n(Ce,1):n(xe,!1)})}t(L);var g=o(L,4),q=s(g);{var P=n=>{var d=Ht(),$=ce(d);let S;var W=o($,2);let O;var Y=s(W,!0);t(W),se(2),N(()=>{S=G($,1,"inline-flex h-2 w-2 rounded-full svelte-1kk3799",null,S,{"bg-node-pattern":e(l)>5,"animate-ping-slow":e(l)>5,"bg-muted":e(l)<=5}),O=G(W,1,"tabular-nums svelte-1kk3799",null,O,{"text-node-pattern":e(l)>5,"text-text":e(l)>0&&e(l)<=5,"text-muted":e(l)===0}),_(Y,e(l))}),u(n,d)},ve=n=>{var d=qt();u(n,d)};B(q,n=>{e(l)!==null?n(P):n(ve,!1)})}t(g);var oe=o(g,4),pe=s(oe);{var ue=n=>{var d=Pt(),$=o(ce(d),4),S=s($,!0);t($);var W=o($,2);{var O=Y=>{var Ae=zt(),Ie=o(ce(Ae),2),Be=s(Ie,!0);t(Ie),se(2),N(()=>_(Be,e(T).insights)),u(Y,Ae)};B(W,Y=>{e(T).insights!==null&&Y(O)})}N(Y=>_(S,Y),[()=>jt(e(T).recentMsAgo)]),u(n,d)},le=n=>{var d=Wt();u(n,d)};B(pe,n=>{e(T).recent&&e(T).recentMsAgo!==null?n(ue):n(le,!1)})}t(oe);var me=o(oe,4),ke=o(s(me),2);De(ke,21,()=>e(K),Ne,(n,d)=>{var $=Ot();N(S=>lt($,`height: ${S??""}%; opacity: ${e(d).count===0?.18:.5+e(d).ratio*.5};`),[()=>Math.max(10,e(d).ratio*100)]),u(n,$)}),t(ke),t(me);var Se=o(me,2);{var je=n=>{var d=Yt();se(2),u(n,d)};B(Se,n=>{e(T).isDreaming&&n(je)})}var Ke=o(Se,4);{var Ve=n=>{var d=Qt();u(n,d)};B(Ke,n=>{e(Q)&&n(Ve)})}t(V),N(()=>{X=G(V,1,"ambient-strip relative flex h-9 w-full items-center gap-0 overflow-hidden border-b border-synapse/15 bg-black/40 px-3 text-[11px] text-dim backdrop-blur-md svelte-1kk3799",null,X,{"ambient-flash":e(Q)}),Ee=G(J,1,"absolute inline-flex h-full w-full animate-ping rounded-full opacity-75 svelte-1kk3799",null,Ee,{"bg-recall":e(x),"bg-warning":!e(x)}),Fe=G(Re,1,"relative inline-flex h-2 w-2 rounded-full svelte-1kk3799",null,Fe,{"bg-recall":e(x),"bg-warning":!e(x)}),_(w,f()),p=G(k,1,"svelte-1kk3799",null,p,{"text-recall":e(x),"text-warning":!e(x)}),_(z,`${e(D)??""}%`)}),u(a,V),Oe(),y()}const pt="vestige.theme",et="vestige-theme-light",$e=dt("dark"),Pe=dt(!0),tt=$t([$e,Pe],([a,r])=>a==="auto"?r?"dark":"light":a);function Jt(a){return a==="dark"||a==="light"||a==="auto"}function Ut(a){if(Jt(a)){$e.set(a);try{localStorage.setItem(pt,a)}catch{}}}function qe(){const a=ct($e);Ut(a==="dark"?"light":a==="light"?"auto":"dark")}function ea(){if(document.getElementById(et))return;const a=document.createElement("style");a.id=et,a.textContent=` +/* Vestige light-mode overrides — injected by theme.ts. + * Activated by [data-theme='light'] on . + * Tokens mirror the real names used in app.css so the cascade stays clean. */ +[data-theme='light'] { + /* Core surface palette (slate scale) */ + --color-void: #f8fafc; /* slate-50 — page background */ + --color-abyss: #f1f5f9; /* slate-100 */ + --color-deep: #e2e8f0; /* slate-200 */ + --color-surface: #f1f5f9; /* slate-100 */ + --color-elevated: #e2e8f0; /* slate-200 */ + --color-subtle: #cbd5e1; /* slate-300 */ + --color-muted: #94a3b8; /* slate-400 */ + --color-dim: #475569; /* slate-600 */ + --color-text: #0f172a; /* slate-900 */ + --color-bright: #020617; /* slate-950 */ +} + +/* Baseline body/html wiring — app.css sets these against the dark + * tokens; we just let the variables do the work. Reassert for clarity. */ +[data-theme='light'] html, +html[data-theme='light'] { + background: var(--color-void); + color: var(--color-text); +} + +/* Glass surfaces — recompose on a light canvas. The original alphas + * are tuned for dark; invert-and-tint for light so panels still read + * as elevated instead of vanishing. */ +[data-theme='light'] .glass { + background: rgba(255, 255, 255, 0.65); + border: 1px solid rgba(99, 102, 241, 0.12); + box-shadow: + inset 0 1px 0 0 rgba(255, 255, 255, 0.6), + 0 4px 24px rgba(15, 23, 42, 0.08); +} +[data-theme='light'] .glass-subtle { + background: rgba(255, 255, 255, 0.55); + border: 1px solid rgba(99, 102, 241, 0.1); + box-shadow: + inset 0 1px 0 0 rgba(255, 255, 255, 0.5), + 0 2px 12px rgba(15, 23, 42, 0.06); +} +[data-theme='light'] .glass-sidebar { + background: rgba(248, 250, 252, 0.82); + border-right: 1px solid rgba(99, 102, 241, 0.14); + box-shadow: + inset -1px 0 0 0 rgba(255, 255, 255, 0.4), + 4px 0 24px rgba(15, 23, 42, 0.08); +} +[data-theme='light'] .glass-panel { + background: rgba(255, 255, 255, 0.75); + border: 1px solid rgba(99, 102, 241, 0.14); + box-shadow: + inset 0 1px 0 0 rgba(255, 255, 255, 0.5), + 0 8px 32px rgba(15, 23, 42, 0.1); +} + +/* Halve glow intensity — neon accents stay recognizable without + * washing out on slate-50. */ +[data-theme='light'] .glow-synapse { + box-shadow: 0 0 10px rgba(99, 102, 241, 0.15), 0 0 30px rgba(99, 102, 241, 0.05); +} +[data-theme='light'] .glow-dream { + box-shadow: 0 0 10px rgba(168, 85, 247, 0.15), 0 0 30px rgba(168, 85, 247, 0.05); +} +[data-theme='light'] .glow-memory { + box-shadow: 0 0 10px rgba(59, 130, 246, 0.15), 0 0 30px rgba(59, 130, 246, 0.05); +} + +/* Ambient orbs are gorgeous on black and blinding on white. Tame them. */ +[data-theme='light'] .ambient-orb { + opacity: 0.18; + filter: blur(100px); +} + +/* Scrollbar recolor for the lighter surface. */ +[data-theme='light'] ::-webkit-scrollbar-thumb { + background: #cbd5e1; +} +[data-theme='light'] ::-webkit-scrollbar-thumb:hover { + background: #94a3b8; +} +`,document.head.appendChild(a)}function at(a){document.documentElement.dataset.theme=a}let ee=null,de=null,te=null,ae=null;function ta(){ee&&de&&ee.removeEventListener("change",de),ae==null||ae(),te==null||te(),ee=null,de=null,ae=null,te=null,ea();let a="dark";try{const r=localStorage.getItem(pt);(r==="dark"||r==="light"||r==="auto")&&(a=r)}catch{}return $e.set(a),ee=window.matchMedia("(prefers-color-scheme: dark)"),Pe.set(ee.matches),de=r=>Pe.set(r.matches),ee.addEventListener("change",de),at(ct(tt)),ae=tt.subscribe(at),te=$e.subscribe(()=>{}),()=>{ee&&de&&ee.removeEventListener("change",de),ee=null,de=null,ae==null||ae(),te==null||te(),ae=null,te=null}}var aa=m('');function sa(a){const r=()=>H($e,"$theme",i),[i,c]=Te(),f={dark:"Dark",light:"Light",auto:"Auto (system)"},M={dark:"light",light:"auto",auto:"dark"};let y=j(r),D=j(()=>M[e(y)]),x=j(()=>`Toggle theme: ${f[e(y)]} (click for ${f[e(D)]})`);var h=aa(),v=s(h),l=s(v);let b;var F=o(l,2);let T;var K=o(F,2);let Q;t(v),t(h),N(()=>{be(h,"aria-label",e(x)),be(h,"title",e(x)),be(h,"data-mode",e(y)),b=G(l,0,"icon svelte-1cmi4dh",null,b,{active:e(y)==="dark"}),T=G(F,0,"icon svelte-1cmi4dh",null,T,{active:e(y)==="light"}),Q=G(K,0,"icon svelte-1cmi4dh",null,Q,{active:e(y)==="auto"})}),re("click",h,function(...V){qe==null||qe.apply(this,V)}),u(a,h),c()}Ye(["click"]);var ra=m(' '),na=m('
      '),ia=m(''),oa=m(' '),la=m('
      ',1),da=m(''),ca=m('
      No matches
      '),va=m('
      esc
      '),pa=m(" ",1);function La(a,r){We(r,!0);const i=()=>H(Ct,"$page",x),c=()=>H(_t,"$isConnected",x),f=()=>H(it,"$memoryCount",x),M=()=>H(ot,"$avgRetention",x),y=()=>H(kt,"$uptimeSeconds",x),D=()=>H(nt,"$suppressedCount",x),[x,h]=Te();let v=ye(!1),l=ye(""),b=ye(void 0),F=j(()=>i().url.pathname.startsWith(U)?i().url.pathname.slice(U.length)||"/":i().url.pathname),T=j(()=>e(F)==="/waitlist"||e(F).startsWith("/waitlist/"));st(()=>{e(T)||Je.connect();const w=ta();function k(p){if(e(T))return;if((p.metaKey||p.ctrlKey)&&p.key==="k"){p.preventDefault(),A(v,!e(v)),A(l,""),e(v)&&requestAnimationFrame(()=>{var I;return(I=e(b))==null?void 0:I.focus()});return}if(p.key==="Escape"&&e(v)){A(v,!1);return}if(p.target instanceof HTMLInputElement||p.target instanceof HTMLTextAreaElement)return;if(p.key==="/"){p.preventDefault();const I=document.querySelector('input[type="text"]');I==null||I.focus();return}const L={g:"/graph",m:"/memories",t:"/timeline",f:"/feed",e:"/explore",i:"/intentions",s:"/stats",r:"/reasoning",a:"/activation",d:"/dreams",c:"/schedule",p:"/importance",u:"/duplicates",x:"/contradictions",n:"/patterns"}[p.key.toLowerCase()];L&&!p.metaKey&&!p.ctrlKey&&!p.altKey&&(p.preventDefault(),Ze(`${U}${L}`))}return window.addEventListener("keydown",k),()=>{Je.disconnect(),window.removeEventListener("keydown",k),w()}});const K=[{href:"/graph",label:"Graph",icon:"◎",shortcut:"G"},{href:"/reasoning",label:"Reasoning",icon:"✦",shortcut:"R"},{href:"/memories",label:"Memories",icon:"◈",shortcut:"M"},{href:"/timeline",label:"Timeline",icon:"◷",shortcut:"T"},{href:"/feed",label:"Feed",icon:"◉",shortcut:"F"},{href:"/explore",label:"Explore",icon:"◬",shortcut:"E"},{href:"/activation",label:"Activation",icon:"◈",shortcut:"A"},{href:"/dreams",label:"Dreams",icon:"✧",shortcut:"D"},{href:"/schedule",label:"Schedule",icon:"◷",shortcut:"C"},{href:"/importance",label:"Importance",icon:"◎",shortcut:"P"},{href:"/duplicates",label:"Duplicates",icon:"◉",shortcut:"U"},{href:"/contradictions",label:"Contradictions",icon:"⚠",shortcut:"X"},{href:"/patterns",label:"Patterns",icon:"▦",shortcut:"N"},{href:"/intentions",label:"Intentions",icon:"◇",shortcut:"I"},{href:"/stats",label:"Stats",icon:"◫",shortcut:"S"},{href:"/settings",label:"Settings",icon:"⚙",shortcut:","}],Q=K.slice(0,5);function V(w,k){const p=k.startsWith(U)?k.slice(U.length)||"/":k;return w==="/graph"?p==="/"||p==="/graph":p.startsWith(w)}let X=j(()=>e(l)?K.filter(w=>w.label.toLowerCase().includes(e(l).toLowerCase())):K);function Z(w){A(v,!1),A(l,""),Ze(`${U}${w}`)}var ne=pa(),J=ce(ne);{var Ee=w=>{var k=rt(),p=ce(k);Xe(p,()=>r.children),u(w,k)},Re=w=>{var k=la(),p=o(ce(k),6),z=s(p),L=s(z),I=o(L,2);De(I,21,()=>K,Ne,(C,E)=>{const fe=j(()=>V(e(E).href,i().url.pathname));var R=ra(),he=s(R),Ge=s(he,!0);t(he);var _e=o(he,2),He=s(_e,!0);t(_e);var Qe=o(_e,2),ut=s(Qe,!0);t(Qe),t(R),N(()=>{be(R,"href",`${U??""}${e(E).href??""}`),G(R,1,`flex items-center gap-3 px-3 py-2.5 rounded-lg transition-all duration-200 text-sm + ${e(fe)?"bg-synapse/15 text-synapse-glow border border-synapse/30 shadow-[0_0_12px_rgba(99,102,241,0.15)] nav-active-border":"text-dim hover:text-text hover:bg-white/[0.03] border border-transparent"}`),_(Ge,e(E).icon),_(He,e(E).label),_(ut,e(E).shortcut)}),u(C,R)}),t(I);var ie=o(I,2),Ce=s(ie);t(ie);var xe=o(ie,2),g=s(xe),q=s(g),P=o(q,2),ve=s(P,!0);t(P);var oe=o(P,2),pe=s(oe);sa(pe),t(oe),t(g);var ue=o(g,2),le=s(ue),me=s(le);t(le);var ke=o(le,2),Se=s(ke);t(ke);var je=o(ke,2);{var Ke=C=>{var E=na(),fe=s(E);t(E),N(R=>_(fe,`up ${R??""}`),[()=>yt(y())]),u(C,E)};B(je,C=>{y()>0&&C(Ke)})}t(ue);var Ve=o(ue,2);{var n=C=>{var E=ia(),fe=s(E);Dt(fe),t(E),u(C,E)};B(Ve,C=>{D()>0&&C(n)})}t(xe),t(z);var d=o(z,2),$=s(d);Zt($,{});var S=o($,2),W=s(S);Xe(W,()=>r.children),t(S),t(d);var O=o(d,2),Y=s(O),Ae=s(Y);De(Ae,17,()=>Q,Ne,(C,E)=>{const fe=j(()=>V(e(E).href,i().url.pathname));var R=oa(),he=s(R),Ge=s(he,!0);t(he);var _e=o(he,2),He=s(_e,!0);t(_e),t(R),N(()=>{be(R,"href",`${U??""}${e(E).href??""}`),G(R,1,`flex flex-col items-center gap-0.5 px-3 py-2 rounded-lg transition-all min-w-[3.5rem] + ${e(fe)?"text-synapse-glow":"text-muted"}`),_(Ge,e(E).icon),_(He,e(E).label)}),u(C,R)});var Ie=o(Ae,2);t(Y),t(O),t(p);var Be=o(p,2);Ft(Be,{}),N(C=>{be(L,"href",`${U??""}/graph`),G(q,1,`w-2 h-2 rounded-full ${c()?"bg-recall animate-pulse-glow":"bg-decay"}`),_(ve,c()?"Connected":"Offline"),_(me,`${f()??""} memories`),_(Se,`${C??""}% retention`)},[()=>(M()*100).toFixed(0)]),re("click",Ce,()=>{A(v,!0),A(l,""),requestAnimationFrame(()=>{var C;return(C=e(b))==null?void 0:C.focus()})}),re("click",Ie,()=>{A(v,!0),A(l,""),requestAnimationFrame(()=>{var C;return(C=e(b))==null?void 0:C.focus()})}),u(w,k)};B(J,w=>{e(T)?w(Ee):w(Re,!1)})}var Fe=o(J,2);{var Me=w=>{var k=va(),p=s(k),z=s(p),L=o(s(z),2);ft(L),gt(L,g=>A(b,g),()=>e(b)),se(2),t(z);var I=o(z,2),ie=s(I);De(ie,17,()=>e(X),Ne,(g,q)=>{var P=da(),ve=s(P),oe=s(ve,!0);t(ve);var pe=o(ve,2),ue=s(pe,!0);t(pe);var le=o(pe,2),me=s(le,!0);t(le),t(P),N(()=>{_(oe,e(q).icon),_(ue,e(q).label),_(me,e(q).shortcut)}),re("click",P,()=>Z(e(q).href)),u(g,P)});var Ce=o(ie,2);{var xe=g=>{var q=ca();u(g,q)};B(Ce,g=>{e(X).length===0&&g(xe)})}t(I),t(p),t(k),re("keydown",k,g=>{g.key==="Escape"&&A(v,!1)}),re("click",k,g=>{g.target===g.currentTarget&&A(v,!1)}),re("keydown",L,g=>{g.key==="Enter"&&e(X).length>0&&Z(e(X)[0].href)}),ht(L,()=>e(l),g=>A(l,g)),u(w,k)};B(Fe,w=>{e(v)&&!e(T)&&w(Me)})}u(a,ne),Oe(),h()}Ye(["click","keydown"]);export{La as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/0.COz2esg5.js.br b/apps/dashboard/build/_app/immutable/nodes/0.COz2esg5.js.br new file mode 100644 index 0000000..830faa7 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/0.COz2esg5.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/0.COz2esg5.js.gz b/apps/dashboard/build/_app/immutable/nodes/0.COz2esg5.js.gz new file mode 100644 index 0000000..aa16a20 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/0.COz2esg5.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/1.DJo7hfwf.js b/apps/dashboard/build/_app/immutable/nodes/1.DJo7hfwf.js new file mode 100644 index 0000000..748af3e --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/1.DJo7hfwf.js @@ -0,0 +1 @@ +import"../chunks/Bzak7iHL.js";import{i as h}from"../chunks/BUoSzNdg.js";import{p as g,f as d,t as l,a as v,d as s,r as o,e as _}from"../chunks/CpWkWWOo.js";import{s as p}from"../chunks/BlVfL1ME.js";import{a as x,f as $}from"../chunks/CHOnp4oo.js";import{p as m}from"../chunks/BskPcZf7.js";import{s as k}from"../chunks/BHGLDPij.js";const b={get error(){return m.error},get status(){return m.status}};k.updated.check;const i=b;var E=$("

      ",1);function C(f,n){g(n,!1),h();var t=E(),r=d(t),c=s(r,!0);o(r);var a=_(r,2),u=s(a,!0);o(a),l(()=>{var e;p(c,i.status),p(u,(e=i.error)==null?void 0:e.message)}),x(f,t),v()}export{C as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/1.DJo7hfwf.js.br b/apps/dashboard/build/_app/immutable/nodes/1.DJo7hfwf.js.br new file mode 100644 index 0000000..fc2f8d4 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/1.DJo7hfwf.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/1.DJo7hfwf.js.gz b/apps/dashboard/build/_app/immutable/nodes/1.DJo7hfwf.js.gz new file mode 100644 index 0000000..91c8b82 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/1.DJo7hfwf.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/1.MT4EnKSP.js b/apps/dashboard/build/_app/immutable/nodes/1.MT4EnKSP.js deleted file mode 100644 index 2a32e99..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/1.MT4EnKSP.js +++ /dev/null @@ -1 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{i as u}from"../chunks/BLadwbF7.js";import{p as g,f as l,t as v,a as d,b as _,j as x,e as a,r as o,h as $}from"../chunks/wpu9U-D0.js";import{s as p}from"../chunks/D8mhvFt8.js";import{p as m}from"../chunks/Bxs5UR9-.js";import{s as b}from"../chunks/dCAmqaEc.js";const k={get error(){return m.error},get status(){return m.status}};b.updated.check;const i=k;var j=x("

      ",1);function B(f,n){g(n,!1),u();var t=j(),r=l(t),c=a(r,!0);o(r);var e=$(r,2),h=a(e,!0);o(e),v(()=>{var s;p(c,i.status),p(h,(s=i.error)==null?void 0:s.message)}),d(f,t),_()}export{B as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/1.MT4EnKSP.js.br b/apps/dashboard/build/_app/immutable/nodes/1.MT4EnKSP.js.br deleted file mode 100644 index 1af4c86..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/1.MT4EnKSP.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/1.MT4EnKSP.js.gz b/apps/dashboard/build/_app/immutable/nodes/1.MT4EnKSP.js.gz deleted file mode 100644 index 27ffe28..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/1.MT4EnKSP.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/10.Btb56kL1.js b/apps/dashboard/build/_app/immutable/nodes/10.Btb56kL1.js new file mode 100644 index 0000000..cb871ff --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/10.Btb56kL1.js @@ -0,0 +1,4115 @@ +var Bc=Object.defineProperty;var zc=(i,t,e)=>t in i?Bc(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var kt=(i,t,e)=>zc(i,typeof t!="symbol"?t+"":t,e);import"../chunks/Bzak7iHL.js";import{o as jl,a as Zl}from"../chunks/GG5zm9kr.js";import{s as me,c as va,h as zt,g as B,p as ys,aB as kc,a as Es,d as yt,e as bt,n as Hc,r as xt,t as Ke,u as Gn,f as Kl,j as Vc}from"../chunks/CpWkWWOo.js";import{s as fe,d as $l,a as Fe}from"../chunks/BlVfL1ME.js";import{i as kn}from"../chunks/B4yTwGkE.js";import{e as _s,i as hr}from"../chunks/CGEBXrjl.js";import{a as _e,f as Se,c as Gc}from"../chunks/CHOnp4oo.js";import{s as ve,r as xa}from"../chunks/A7po6GxK.js";import{s as Us}from"../chunks/aVbAZ-t7.js";import{s as Sr}from"../chunks/Cx-f-Pzo.js";import{b as Ma}from"../chunks/sZcqyNBA.js";import{b as Jl}from"../chunks/BnXDGOmJ.js";import{s as Wc,a as Xc}from"../chunks/C6HuKgyx.js";import{b as Do}from"../chunks/BskPcZf7.js";import{b as Yc}from"../chunks/CJsMJEun.js";import{p as vs}from"../chunks/V6gjw5Ec.js";import{N as Sa}from"../chunks/DzfRjky4.js";import{i as qc}from"../chunks/BUoSzNdg.js";import{a as gi}from"../chunks/DNjM5a-l.js";import{e as jc}from"../chunks/MAY1QfFZ.js";/** + * @license + * Copyright 2010-2024 Three.js Authors + * SPDX-License-Identifier: MIT + */const vo="172",Hi={ROTATE:0,DOLLY:1,PAN:2},Oi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Zc=0,Lo=1,Kc=2,Ql=1,$c=2,An=3,Yn=0,Xe=1,gn=2,Cn=0,Vi=1,Le=2,Uo=3,Io=4,Jc=5,ii=100,Qc=101,th=102,eh=103,nh=104,ih=200,sh=201,rh=202,ah=203,ya=204,Ea=205,oh=206,lh=207,ch=208,hh=209,uh=210,dh=211,fh=212,ph=213,mh=214,ba=0,Ta=1,wa=2,qi=3,Aa=4,Ra=5,Ca=6,Pa=7,tc=0,gh=1,_h=2,Wn=0,vh=1,xh=2,Mh=3,ec=4,Sh=5,yh=6,Eh=7,nc=300,ji=301,Zi=302,Da=303,La=304,Pr=306,Ua=1e3,ri=1001,Ia=1002,Je=1003,bh=1004,Is=1005,vn=1006,Br=1007,ai=1008,Ln=1009,ic=1010,sc=1011,Ms=1012,xo=1013,li=1014,xn=1015,Pn=1016,Mo=1017,So=1018,Ki=1020,rc=35902,ac=1021,oc=1022,dn=1023,lc=1024,cc=1025,Gi=1026,$i=1027,yo=1028,Eo=1029,hc=1030,bo=1031,To=1033,ur=33776,dr=33777,fr=33778,pr=33779,Na=35840,Fa=35841,Oa=35842,Ba=35843,za=36196,ka=37492,Ha=37496,Va=37808,Ga=37809,Wa=37810,Xa=37811,Ya=37812,qa=37813,ja=37814,Za=37815,Ka=37816,$a=37817,Ja=37818,Qa=37819,to=37820,eo=37821,mr=36492,no=36494,io=36495,uc=36283,so=36284,ro=36285,ao=36286,Th=3200,wh=3201,dc=0,Ah=1,Vn="",an="srgb",Ji="srgb-linear",yr="linear",se="srgb",_i=7680,No=519,Rh=512,Ch=513,Ph=514,fc=515,Dh=516,Lh=517,Uh=518,Ih=519,oo=35044,Fo="300 es",Rn=2e3,Er=2001;class hi{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;const n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;const s=this._listeners[t];if(s!==void 0){const r=s.indexOf(e);r!==-1&&s.splice(r,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const n=this._listeners[t.type];if(n!==void 0){t.target=this;const s=n.slice(0);for(let r=0,a=s.length;r>8&255]+Ie[i>>16&255]+Ie[i>>24&255]+"-"+Ie[t&255]+Ie[t>>8&255]+"-"+Ie[t>>16&15|64]+Ie[t>>24&255]+"-"+Ie[e&63|128]+Ie[e>>8&255]+"-"+Ie[e>>16&255]+Ie[e>>24&255]+Ie[n&255]+Ie[n>>8&255]+Ie[n>>16&255]+Ie[n>>24&255]).toLowerCase()}function Yt(i,t,e){return Math.max(t,Math.min(e,i))}function Nh(i,t){return(i%t+t)%t}function zr(i,t,e){return(1-e)*i+e*t}function _n(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function re(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const Fh={DEG2RAD:gr};class St{constructor(t=0,e=0){St.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6],this.y=s[1]*e+s[4]*n+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Yt(this.x,t.x,e.x),this.y=Yt(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=Yt(this.x,t,e),this.y=Yt(this.y,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Yt(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Yt(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),s=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*n-a*s+t.x,this.y=r*s+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ht{constructor(t,e,n,s,r,a,o,l,c){Ht.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,s,r,a,o,l,c)}set(t,e,n,s,r,a,o,l,c){const h=this.elements;return h[0]=t,h[1]=s,h[2]=o,h[3]=e,h[4]=r,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,s=e.elements,r=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],d=n[7],p=n[2],u=n[5],g=n[8],_=s[0],m=s[3],f=s[6],T=s[1],E=s[4],y=s[7],D=s[2],w=s[5],C=s[8];return r[0]=a*_+o*T+l*D,r[3]=a*m+o*E+l*w,r[6]=a*f+o*y+l*C,r[1]=c*_+h*T+d*D,r[4]=c*m+h*E+d*w,r[7]=c*f+h*y+d*C,r[2]=p*_+u*T+g*D,r[5]=p*m+u*E+g*w,r[8]=p*f+u*y+g*C,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8];return e*a*h-e*o*c-n*r*h+n*o*l+s*r*c-s*a*l}invert(){const t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],d=h*a-o*c,p=o*l-h*r,u=c*r-a*l,g=e*d+n*p+s*u;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return t[0]=d*_,t[1]=(s*c-h*n)*_,t[2]=(o*n-s*a)*_,t[3]=p*_,t[4]=(h*e-s*l)*_,t[5]=(s*r-o*e)*_,t[6]=u*_,t[7]=(n*l-c*e)*_,t[8]=(a*e-n*r)*_,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,s,r,a,o){const l=Math.cos(r),c=Math.sin(r);return this.set(n*l,n*c,-n*(l*a+c*o)+a+t,-s*c,s*l,-s*(-c*a+l*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(kr.makeScale(t,e)),this}rotate(t){return this.premultiply(kr.makeRotation(-t)),this}translate(t,e){return this.premultiply(kr.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,n=t.elements;for(let s=0;s<9;s++)if(e[s]!==n[s])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}}const kr=new Ht;function pc(i){for(let t=i.length-1;t>=0;--t)if(i[t]>=65535)return!0;return!1}function br(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Oh(){const i=br("canvas");return i.style.display="block",i}const Oo={};function Fi(i){i in Oo||(Oo[i]=!0,console.warn(i))}function Bh(i,t,e){return new Promise(function(n,s){function r(){switch(i.clientWaitSync(t,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:s();break;case i.TIMEOUT_EXPIRED:setTimeout(r,e);break;default:n()}}setTimeout(r,e)})}function zh(i){const t=i.elements;t[2]=.5*t[2]+.5*t[3],t[6]=.5*t[6]+.5*t[7],t[10]=.5*t[10]+.5*t[11],t[14]=.5*t[14]+.5*t[15]}function kh(i){const t=i.elements;t[11]===-1?(t[10]=-t[10]-1,t[14]=-t[14]):(t[10]=-t[10],t[14]=-t[14]+1)}const Bo=new Ht().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),zo=new Ht().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Hh(){const i={enabled:!0,workingColorSpace:Ji,spaces:{},convert:function(s,r,a){return this.enabled===!1||r===a||!r||!a||(this.spaces[r].transfer===se&&(s.r=Dn(s.r),s.g=Dn(s.g),s.b=Dn(s.b)),this.spaces[r].primaries!==this.spaces[a].primaries&&(s.applyMatrix3(this.spaces[r].toXYZ),s.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===se&&(s.r=Wi(s.r),s.g=Wi(s.g),s.b=Wi(s.b))),s},fromWorkingColorSpace:function(s,r){return this.convert(s,this.workingColorSpace,r)},toWorkingColorSpace:function(s,r){return this.convert(s,r,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===Vn?yr:this.spaces[s].transfer},getLuminanceCoefficients:function(s,r=this.workingColorSpace){return s.fromArray(this.spaces[r].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,r,a){return s.copy(this.spaces[r].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Ji]:{primaries:t,whitePoint:n,transfer:yr,toXYZ:Bo,fromXYZ:zo,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:an},outputColorSpaceConfig:{drawingBufferColorSpace:an}},[an]:{primaries:t,whitePoint:n,transfer:se,toXYZ:Bo,fromXYZ:zo,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:an}}}),i}const Qt=Hh();function Dn(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Wi(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let vi;class Vh{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{vi===void 0&&(vi=br("canvas")),vi.width=t.width,vi.height=t.height;const n=vi.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=vi}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const e=br("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const s=n.getImageData(0,0,t.width,t.height),r=s.data;for(let a=0;a0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==nc)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Ua:t.x=t.x-Math.floor(t.x);break;case ri:t.x=t.x<0?0:1;break;case Ia:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Ua:t.y=t.y-Math.floor(t.y);break;case ri:t.y=t.y<0?0:1;break;case Ia:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}}Pe.DEFAULT_IMAGE=null;Pe.DEFAULT_MAPPING=nc;Pe.DEFAULT_ANISOTROPY=1;class oe{constructor(t=0,e=0,n=0,s=1){oe.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,s){return this.x=t,this.y=e,this.z=n,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,s=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*s+a[12]*r,this.y=a[1]*e+a[5]*n+a[9]*s+a[13]*r,this.z=a[2]*e+a[6]*n+a[10]*s+a[14]*r,this.w=a[3]*e+a[7]*n+a[11]*s+a[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,s,r;const l=t.elements,c=l[0],h=l[4],d=l[8],p=l[1],u=l[5],g=l[9],_=l[2],m=l[6],f=l[10];if(Math.abs(h-p)<.01&&Math.abs(d-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(h+p)<.1&&Math.abs(d+_)<.1&&Math.abs(g+m)<.1&&Math.abs(c+u+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const E=(c+1)/2,y=(u+1)/2,D=(f+1)/2,w=(h+p)/4,C=(d+_)/4,I=(g+m)/4;return E>y&&E>D?E<.01?(n=0,s=.707106781,r=.707106781):(n=Math.sqrt(E),s=w/n,r=C/n):y>D?y<.01?(n=.707106781,s=0,r=.707106781):(s=Math.sqrt(y),n=w/s,r=I/s):D<.01?(n=.707106781,s=.707106781,r=0):(r=Math.sqrt(D),n=C/r,s=I/r),this.set(n,s,r,e),this}let T=Math.sqrt((m-g)*(m-g)+(d-_)*(d-_)+(p-h)*(p-h));return Math.abs(T)<.001&&(T=1),this.x=(m-g)/T,this.y=(d-_)/T,this.z=(p-h)/T,this.w=Math.acos((c+u+f-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Yt(this.x,t.x,e.x),this.y=Yt(this.y,t.y,e.y),this.z=Yt(this.z,t.z,e.z),this.w=Yt(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=Yt(this.x,t,e),this.y=Yt(this.y,t,e),this.z=Yt(this.z,t,e),this.w=Yt(this.w,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Yt(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Xh extends hi{constructor(t=1,e=1,n={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new oe(0,0,t,e),this.scissorTest=!1,this.viewport=new oe(0,0,t,e);const s={width:t,height:e,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:vn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const r=new Pe(s,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let o=0;o=0?1:-1,E=1-f*f;if(E>Number.EPSILON){const D=Math.sqrt(E),w=Math.atan2(D,f*T);m=Math.sin(m*w)/D,o=Math.sin(o*w)/D}const y=o*T;if(l=l*m+p*y,c=c*m+u*y,h=h*m+g*y,d=d*m+_*y,m===1-o){const D=1/Math.sqrt(l*l+c*c+h*h+d*d);l*=D,c*=D,h*=D,d*=D}}t[e]=l,t[e+1]=c,t[e+2]=h,t[e+3]=d}static multiplyQuaternionsFlat(t,e,n,s,r,a){const o=n[s],l=n[s+1],c=n[s+2],h=n[s+3],d=r[a],p=r[a+1],u=r[a+2],g=r[a+3];return t[e]=o*g+h*d+l*u-c*p,t[e+1]=l*g+h*p+c*d-o*u,t[e+2]=c*g+h*u+o*p-l*d,t[e+3]=h*g-o*d-l*p-c*u,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,s){return this._x=t,this._y=e,this._z=n,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const n=t._x,s=t._y,r=t._z,a=t._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(s/2),d=o(r/2),p=l(n/2),u=l(s/2),g=l(r/2);switch(a){case"XYZ":this._x=p*h*d+c*u*g,this._y=c*u*d-p*h*g,this._z=c*h*g+p*u*d,this._w=c*h*d-p*u*g;break;case"YXZ":this._x=p*h*d+c*u*g,this._y=c*u*d-p*h*g,this._z=c*h*g-p*u*d,this._w=c*h*d+p*u*g;break;case"ZXY":this._x=p*h*d-c*u*g,this._y=c*u*d+p*h*g,this._z=c*h*g+p*u*d,this._w=c*h*d-p*u*g;break;case"ZYX":this._x=p*h*d-c*u*g,this._y=c*u*d+p*h*g,this._z=c*h*g-p*u*d,this._w=c*h*d+p*u*g;break;case"YZX":this._x=p*h*d+c*u*g,this._y=c*u*d+p*h*g,this._z=c*h*g-p*u*d,this._w=c*h*d-p*u*g;break;case"XZY":this._x=p*h*d-c*u*g,this._y=c*u*d-p*h*g,this._z=c*h*g+p*u*d,this._w=c*h*d+p*u*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,s=Math.sin(n);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],s=e[4],r=e[8],a=e[1],o=e[5],l=e[9],c=e[2],h=e[6],d=e[10],p=n+o+d;if(p>0){const u=.5/Math.sqrt(p+1);this._w=.25/u,this._x=(h-l)*u,this._y=(r-c)*u,this._z=(a-s)*u}else if(n>o&&n>d){const u=2*Math.sqrt(1+n-o-d);this._w=(h-l)/u,this._x=.25*u,this._y=(s+a)/u,this._z=(r+c)/u}else if(o>d){const u=2*Math.sqrt(1+o-n-d);this._w=(r-c)/u,this._x=(s+a)/u,this._y=.25*u,this._z=(l+h)/u}else{const u=2*Math.sqrt(1+d-n-o);this._w=(a-s)/u,this._x=(r+c)/u,this._y=(l+h)/u,this._z=.25*u}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return nMath.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Yt(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(n===0)return this;const s=Math.min(1,e/n);return this.slerp(t,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,s=t._y,r=t._z,a=t._w,o=e._x,l=e._y,c=e._z,h=e._w;return this._x=n*h+a*o+s*c-r*l,this._y=s*h+a*l+r*o-n*c,this._z=r*h+a*c+n*l-s*o,this._w=a*h-n*o-s*l-r*c,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const n=this._x,s=this._y,r=this._z,a=this._w;let o=a*t._w+n*t._x+s*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=s,this._z=r,this;const l=1-o*o;if(l<=Number.EPSILON){const u=1-e;return this._w=u*a+e*this._w,this._x=u*n+e*this._x,this._y=u*s+e*this._y,this._z=u*r+e*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),d=Math.sin((1-e)*h)/c,p=Math.sin(e*h)/c;return this._w=a*d+this._w*p,this._x=n*d+this._x*p,this._y=s*d+this._y*p,this._z=r*d+this._z*p,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),s=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(s*Math.sin(t),s*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class P{constructor(t=0,e=0,n=0){P.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(ko.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(ko.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*s,this.y=r[1]*e+r[4]*n+r[7]*s,this.z=r[2]*e+r[5]*n+r[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,s=this.z,r=t.elements,a=1/(r[3]*e+r[7]*n+r[11]*s+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*s+r[12])*a,this.y=(r[1]*e+r[5]*n+r[9]*s+r[13])*a,this.z=(r[2]*e+r[6]*n+r[10]*s+r[14])*a,this}applyQuaternion(t){const e=this.x,n=this.y,s=this.z,r=t.x,a=t.y,o=t.z,l=t.w,c=2*(a*s-o*n),h=2*(o*e-r*s),d=2*(r*n-a*e);return this.x=e+l*c+a*d-o*h,this.y=n+l*h+o*c-r*d,this.z=s+l*d+r*h-a*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*s,this.y=r[1]*e+r[5]*n+r[9]*s,this.z=r[2]*e+r[6]*n+r[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Yt(this.x,t.x,e.x),this.y=Yt(this.y,t.y,e.y),this.z=Yt(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=Yt(this.x,t,e),this.y=Yt(this.y,t,e),this.z=Yt(this.z,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Yt(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,s=t.y,r=t.z,a=e.x,o=e.y,l=e.z;return this.x=s*l-r*o,this.y=r*a-n*l,this.z=n*o-s*a,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Vr.copy(this).projectOnVector(t),this.sub(Vr)}reflect(t){return this.sub(Vr.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Yt(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,s=this.z-t.z;return e*e+n*n+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const s=Math.sin(e)*t;return this.x=s*Math.sin(n),this.y=Math.cos(e)*t,this.z=s*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Vr=new P,ko=new ci;class ui{constructor(t=new P(1/0,1/0,1/0),e=new P(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,cn),cn.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(ss),Fs.subVectors(this.max,ss),xi.subVectors(t.a,ss),Mi.subVectors(t.b,ss),Si.subVectors(t.c,ss),Un.subVectors(Mi,xi),In.subVectors(Si,Mi),Zn.subVectors(xi,Si);let e=[0,-Un.z,Un.y,0,-In.z,In.y,0,-Zn.z,Zn.y,Un.z,0,-Un.x,In.z,0,-In.x,Zn.z,0,-Zn.x,-Un.y,Un.x,0,-In.y,In.x,0,-Zn.y,Zn.x,0];return!Gr(e,xi,Mi,Si,Fs)||(e=[1,0,0,0,1,0,0,0,1],!Gr(e,xi,Mi,Si,Fs))?!1:(Os.crossVectors(Un,In),e=[Os.x,Os.y,Os.z],Gr(e,xi,Mi,Si,Fs))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,cn).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(cn).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Sn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Sn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Sn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Sn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Sn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Sn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Sn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Sn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Sn),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Sn=[new P,new P,new P,new P,new P,new P,new P,new P],cn=new P,Ns=new ui,xi=new P,Mi=new P,Si=new P,Un=new P,In=new P,Zn=new P,ss=new P,Fs=new P,Os=new P,Kn=new P;function Gr(i,t,e,n,s){for(let r=0,a=i.length-3;r<=a;r+=3){Kn.fromArray(i,r);const o=s.x*Math.abs(Kn.x)+s.y*Math.abs(Kn.y)+s.z*Math.abs(Kn.z),l=t.dot(Kn),c=e.dot(Kn),h=n.dot(Kn);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const qh=new ui,rs=new P,Wr=new P;class di{constructor(t=new P,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;e!==void 0?n.copy(e):qh.setFromPoints(t).getCenter(n);let s=0;for(let r=0,a=t.length;rthis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;rs.subVectors(t,this.center);const e=rs.lengthSq();if(e>this.radius*this.radius){const n=Math.sqrt(e),s=(n-this.radius)*.5;this.center.addScaledVector(rs,s/n),this.radius+=s}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(Wr.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(rs.copy(t.center).add(Wr)),this.expandByPoint(rs.copy(t.center).sub(Wr))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}}const yn=new P,Xr=new P,Bs=new P,Nn=new P,Yr=new P,zs=new P,qr=new P;class bs{constructor(t=new P,e=new P(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,yn)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=yn.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(yn.copy(this.origin).addScaledVector(this.direction,e),yn.distanceToSquared(t))}distanceSqToSegment(t,e,n,s){Xr.copy(t).add(e).multiplyScalar(.5),Bs.copy(e).sub(t).normalize(),Nn.copy(this.origin).sub(Xr);const r=t.distanceTo(e)*.5,a=-this.direction.dot(Bs),o=Nn.dot(this.direction),l=-Nn.dot(Bs),c=Nn.lengthSq(),h=Math.abs(1-a*a);let d,p,u,g;if(h>0)if(d=a*l-o,p=a*o-l,g=r*h,d>=0)if(p>=-g)if(p<=g){const _=1/h;d*=_,p*=_,u=d*(d+a*p+2*o)+p*(a*d+p+2*l)+c}else p=r,d=Math.max(0,-(a*p+o)),u=-d*d+p*(p+2*l)+c;else p=-r,d=Math.max(0,-(a*p+o)),u=-d*d+p*(p+2*l)+c;else p<=-g?(d=Math.max(0,-(-a*r+o)),p=d>0?-r:Math.min(Math.max(-r,-l),r),u=-d*d+p*(p+2*l)+c):p<=g?(d=0,p=Math.min(Math.max(-r,-l),r),u=p*(p+2*l)+c):(d=Math.max(0,-(a*r+o)),p=d>0?r:Math.min(Math.max(-r,-l),r),u=-d*d+p*(p+2*l)+c);else p=a>0?-r:r,d=Math.max(0,-(a*p+o)),u=-d*d+p*(p+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,d),s&&s.copy(Xr).addScaledVector(Bs,p),u}intersectSphere(t,e){yn.subVectors(t.center,this.origin);const n=yn.dot(this.direction),s=yn.dot(yn)-n*n,r=t.radius*t.radius;if(s>r)return null;const a=Math.sqrt(r-s),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return n===null?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,s,r,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,d=1/this.direction.z,p=this.origin;return c>=0?(n=(t.min.x-p.x)*c,s=(t.max.x-p.x)*c):(n=(t.max.x-p.x)*c,s=(t.min.x-p.x)*c),h>=0?(r=(t.min.y-p.y)*h,a=(t.max.y-p.y)*h):(r=(t.max.y-p.y)*h,a=(t.min.y-p.y)*h),n>a||r>s||((r>n||isNaN(n))&&(n=r),(a=0?(o=(t.min.z-p.z)*d,l=(t.max.z-p.z)*d):(o=(t.max.z-p.z)*d,l=(t.min.z-p.z)*d),n>l||o>s)||((o>n||n!==n)&&(n=o),(l=0?n:s,e)}intersectsBox(t){return this.intersectBox(t,yn)!==null}intersectTriangle(t,e,n,s,r){Yr.subVectors(e,t),zs.subVectors(n,t),qr.crossVectors(Yr,zs);let a=this.direction.dot(qr),o;if(a>0){if(s)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Nn.subVectors(this.origin,t);const l=o*this.direction.dot(zs.crossVectors(Nn,zs));if(l<0)return null;const c=o*this.direction.dot(Yr.cross(Nn));if(c<0||l+c>a)return null;const h=-o*Nn.dot(qr);return h<0?null:this.at(h/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ne{constructor(t,e,n,s,r,a,o,l,c,h,d,p,u,g,_,m){ne.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,n,s,r,a,o,l,c,h,d,p,u,g,_,m)}set(t,e,n,s,r,a,o,l,c,h,d,p,u,g,_,m){const f=this.elements;return f[0]=t,f[4]=e,f[8]=n,f[12]=s,f[1]=r,f[5]=a,f[9]=o,f[13]=l,f[2]=c,f[6]=h,f[10]=d,f[14]=p,f[3]=u,f[7]=g,f[11]=_,f[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ne().fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,s=1/yi.setFromMatrixColumn(t,0).length(),r=1/yi.setFromMatrixColumn(t,1).length(),a=1/yi.setFromMatrixColumn(t,2).length();return e[0]=n[0]*s,e[1]=n[1]*s,e[2]=n[2]*s,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,s=t.y,r=t.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(s),c=Math.sin(s),h=Math.cos(r),d=Math.sin(r);if(t.order==="XYZ"){const p=a*h,u=a*d,g=o*h,_=o*d;e[0]=l*h,e[4]=-l*d,e[8]=c,e[1]=u+g*c,e[5]=p-_*c,e[9]=-o*l,e[2]=_-p*c,e[6]=g+u*c,e[10]=a*l}else if(t.order==="YXZ"){const p=l*h,u=l*d,g=c*h,_=c*d;e[0]=p+_*o,e[4]=g*o-u,e[8]=a*c,e[1]=a*d,e[5]=a*h,e[9]=-o,e[2]=u*o-g,e[6]=_+p*o,e[10]=a*l}else if(t.order==="ZXY"){const p=l*h,u=l*d,g=c*h,_=c*d;e[0]=p-_*o,e[4]=-a*d,e[8]=g+u*o,e[1]=u+g*o,e[5]=a*h,e[9]=_-p*o,e[2]=-a*c,e[6]=o,e[10]=a*l}else if(t.order==="ZYX"){const p=a*h,u=a*d,g=o*h,_=o*d;e[0]=l*h,e[4]=g*c-u,e[8]=p*c+_,e[1]=l*d,e[5]=_*c+p,e[9]=u*c-g,e[2]=-c,e[6]=o*l,e[10]=a*l}else if(t.order==="YZX"){const p=a*l,u=a*c,g=o*l,_=o*c;e[0]=l*h,e[4]=_-p*d,e[8]=g*d+u,e[1]=d,e[5]=a*h,e[9]=-o*h,e[2]=-c*h,e[6]=u*d+g,e[10]=p-_*d}else if(t.order==="XZY"){const p=a*l,u=a*c,g=o*l,_=o*c;e[0]=l*h,e[4]=-d,e[8]=c*h,e[1]=p*d+_,e[5]=a*h,e[9]=u*d-g,e[2]=g*d-u,e[6]=o*h,e[10]=_*d+p}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(jh,t,Zh)}lookAt(t,e,n){const s=this.elements;return je.subVectors(t,e),je.lengthSq()===0&&(je.z=1),je.normalize(),Fn.crossVectors(n,je),Fn.lengthSq()===0&&(Math.abs(n.z)===1?je.x+=1e-4:je.z+=1e-4,je.normalize(),Fn.crossVectors(n,je)),Fn.normalize(),ks.crossVectors(je,Fn),s[0]=Fn.x,s[4]=ks.x,s[8]=je.x,s[1]=Fn.y,s[5]=ks.y,s[9]=je.y,s[2]=Fn.z,s[6]=ks.z,s[10]=je.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,s=e.elements,r=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],d=n[5],p=n[9],u=n[13],g=n[2],_=n[6],m=n[10],f=n[14],T=n[3],E=n[7],y=n[11],D=n[15],w=s[0],C=s[4],I=s[8],S=s[12],M=s[1],A=s[5],W=s[9],k=s[13],q=s[2],Q=s[6],X=s[10],tt=s[14],H=s[3],st=s[7],gt=s[11],Et=s[15];return r[0]=a*w+o*M+l*q+c*H,r[4]=a*C+o*A+l*Q+c*st,r[8]=a*I+o*W+l*X+c*gt,r[12]=a*S+o*k+l*tt+c*Et,r[1]=h*w+d*M+p*q+u*H,r[5]=h*C+d*A+p*Q+u*st,r[9]=h*I+d*W+p*X+u*gt,r[13]=h*S+d*k+p*tt+u*Et,r[2]=g*w+_*M+m*q+f*H,r[6]=g*C+_*A+m*Q+f*st,r[10]=g*I+_*W+m*X+f*gt,r[14]=g*S+_*k+m*tt+f*Et,r[3]=T*w+E*M+y*q+D*H,r[7]=T*C+E*A+y*Q+D*st,r[11]=T*I+E*W+y*X+D*gt,r[15]=T*S+E*k+y*tt+D*Et,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],s=t[8],r=t[12],a=t[1],o=t[5],l=t[9],c=t[13],h=t[2],d=t[6],p=t[10],u=t[14],g=t[3],_=t[7],m=t[11],f=t[15];return g*(+r*l*d-s*c*d-r*o*p+n*c*p+s*o*u-n*l*u)+_*(+e*l*u-e*c*p+r*a*p-s*a*u+s*c*h-r*l*h)+m*(+e*c*d-e*o*u-r*a*d+n*a*u+r*o*h-n*c*h)+f*(-s*o*h-e*l*d+e*o*p+s*a*d-n*a*p+n*l*h)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],d=t[9],p=t[10],u=t[11],g=t[12],_=t[13],m=t[14],f=t[15],T=d*m*c-_*p*c+_*l*u-o*m*u-d*l*f+o*p*f,E=g*p*c-h*m*c-g*l*u+a*m*u+h*l*f-a*p*f,y=h*_*c-g*d*c+g*o*u-a*_*u-h*o*f+a*d*f,D=g*d*l-h*_*l-g*o*p+a*_*p+h*o*m-a*d*m,w=e*T+n*E+s*y+r*D;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/w;return t[0]=T*C,t[1]=(_*p*r-d*m*r-_*s*u+n*m*u+d*s*f-n*p*f)*C,t[2]=(o*m*r-_*l*r+_*s*c-n*m*c-o*s*f+n*l*f)*C,t[3]=(d*l*r-o*p*r-d*s*c+n*p*c+o*s*u-n*l*u)*C,t[4]=E*C,t[5]=(h*m*r-g*p*r+g*s*u-e*m*u-h*s*f+e*p*f)*C,t[6]=(g*l*r-a*m*r-g*s*c+e*m*c+a*s*f-e*l*f)*C,t[7]=(a*p*r-h*l*r+h*s*c-e*p*c-a*s*u+e*l*u)*C,t[8]=y*C,t[9]=(g*d*r-h*_*r-g*n*u+e*_*u+h*n*f-e*d*f)*C,t[10]=(a*_*r-g*o*r+g*n*c-e*_*c-a*n*f+e*o*f)*C,t[11]=(h*o*r-a*d*r-h*n*c+e*d*c+a*n*u-e*o*u)*C,t[12]=D*C,t[13]=(h*_*s-g*d*s+g*n*p-e*_*p-h*n*m+e*d*m)*C,t[14]=(g*o*s-a*_*s-g*n*l+e*_*l+a*n*m-e*o*m)*C,t[15]=(a*d*s-h*o*s+h*n*l-e*d*l-a*n*p+e*o*p)*C,this}scale(t){const e=this.elements,n=t.x,s=t.y,r=t.z;return e[0]*=n,e[4]*=s,e[8]*=r,e[1]*=n,e[5]*=s,e[9]*=r,e[2]*=n,e[6]*=s,e[10]*=r,e[3]*=n,e[7]*=s,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],s=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,s))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),s=Math.sin(e),r=1-n,a=t.x,o=t.y,l=t.z,c=r*a,h=r*o;return this.set(c*a+n,c*o-s*l,c*l+s*o,0,c*o+s*l,h*o+n,h*l-s*a,0,c*l-s*o,h*l+s*a,r*l*l+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,s,r,a){return this.set(1,n,r,0,t,1,a,0,e,s,1,0,0,0,0,1),this}compose(t,e,n){const s=this.elements,r=e._x,a=e._y,o=e._z,l=e._w,c=r+r,h=a+a,d=o+o,p=r*c,u=r*h,g=r*d,_=a*h,m=a*d,f=o*d,T=l*c,E=l*h,y=l*d,D=n.x,w=n.y,C=n.z;return s[0]=(1-(_+f))*D,s[1]=(u+y)*D,s[2]=(g-E)*D,s[3]=0,s[4]=(u-y)*w,s[5]=(1-(p+f))*w,s[6]=(m+T)*w,s[7]=0,s[8]=(g+E)*C,s[9]=(m-T)*C,s[10]=(1-(p+_))*C,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,n){const s=this.elements;let r=yi.set(s[0],s[1],s[2]).length();const a=yi.set(s[4],s[5],s[6]).length(),o=yi.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),t.x=s[12],t.y=s[13],t.z=s[14],hn.copy(this);const c=1/r,h=1/a,d=1/o;return hn.elements[0]*=c,hn.elements[1]*=c,hn.elements[2]*=c,hn.elements[4]*=h,hn.elements[5]*=h,hn.elements[6]*=h,hn.elements[8]*=d,hn.elements[9]*=d,hn.elements[10]*=d,e.setFromRotationMatrix(hn),n.x=r,n.y=a,n.z=o,this}makePerspective(t,e,n,s,r,a,o=Rn){const l=this.elements,c=2*r/(e-t),h=2*r/(n-s),d=(e+t)/(e-t),p=(n+s)/(n-s);let u,g;if(o===Rn)u=-(a+r)/(a-r),g=-2*a*r/(a-r);else if(o===Er)u=-a/(a-r),g=-a*r/(a-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=h,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=u,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,e,n,s,r,a,o=Rn){const l=this.elements,c=1/(e-t),h=1/(n-s),d=1/(a-r),p=(e+t)*c,u=(n+s)*h;let g,_;if(o===Rn)g=(a+r)*d,_=-2*d;else if(o===Er)g=r*d,_=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-p,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-u,l[2]=0,l[6]=0,l[10]=_,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let s=0;s<16;s++)if(e[s]!==n[s])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const yi=new P,hn=new ne,jh=new P(0,0,0),Zh=new P(1,1,1),Fn=new P,ks=new P,je=new P,Ho=new ne,Vo=new ci;class Mn{constructor(t=0,e=0,n=0,s=Mn.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=s}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,s=this._order){return this._x=t,this._y=e,this._z=n,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const s=t.elements,r=s[0],a=s[4],o=s[8],l=s[1],c=s[5],h=s[9],d=s[2],p=s[6],u=s[10];switch(e){case"XYZ":this._y=Math.asin(Yt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,u),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Yt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,u),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,r),this._z=0);break;case"ZXY":this._x=Math.asin(Yt(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-d,u),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-Yt(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(p,u),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Yt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-d,r)):(this._x=0,this._y=Math.atan2(o,u));break;case"XZY":this._z=Math.asin(-Yt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-h,u),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Ho.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Ho,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Vo.setFromEuler(this),this.setFromQuaternion(Vo,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Mn.DEFAULT_ORDER="XYZ";class wo{constructor(){this.mask=1}set(t){this.mask=(1<>>0}enable(t){this.mask|=1<1){for(let e=0;e1){for(let n=0;n0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.visibility=this._visibility,s.active=this._active,s.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.geometryCount=this._geometryCount,s.matricesTexture=this._matricesTexture.toJSON(t),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(s.boundingSphere={center:s.boundingSphere.center.toArray(),radius:s.boundingSphere.radius}),this.boundingBox!==null&&(s.boundingBox={min:s.boundingBox.min.toArray(),max:s.boundingBox.max.toArray()}));function r(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(t.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c0){s.children=[];for(let o=0;o0){s.animations=[];for(let o=0;o0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),d.length>0&&(n.shapes=d),p.length>0&&(n.skeletons=p),u.length>0&&(n.animations=u),g.length>0&&(n.nodes=g)}return n.object=s,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(t,e,n,s,r){un.subVectors(s,e),bn.subVectors(n,e),Zr.subVectors(t,e);const a=un.dot(un),o=un.dot(bn),l=un.dot(Zr),c=bn.dot(bn),h=bn.dot(Zr),d=a*c-o*o;if(d===0)return r.set(0,0,0),null;const p=1/d,u=(c*l-o*h)*p,g=(a*h-o*l)*p;return r.set(1-u-g,g,u)}static containsPoint(t,e,n,s){return this.getBarycoord(t,e,n,s,Tn)===null?!1:Tn.x>=0&&Tn.y>=0&&Tn.x+Tn.y<=1}static getInterpolation(t,e,n,s,r,a,o,l){return this.getBarycoord(t,e,n,s,Tn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(r,Tn.x),l.addScaledVector(a,Tn.y),l.addScaledVector(o,Tn.z),l)}static getInterpolatedAttribute(t,e,n,s,r,a){return Qr.setScalar(0),ta.setScalar(0),ea.setScalar(0),Qr.fromBufferAttribute(t,e),ta.fromBufferAttribute(t,n),ea.fromBufferAttribute(t,s),a.setScalar(0),a.addScaledVector(Qr,r.x),a.addScaledVector(ta,r.y),a.addScaledVector(ea,r.z),a}static isFrontFacing(t,e,n,s){return un.subVectors(n,e),bn.subVectors(t,e),un.cross(bn).dot(s)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,s){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,n,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,s),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return un.subVectors(this.c,this.b),bn.subVectors(this.a,this.b),un.cross(bn).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return on.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return on.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,s,r){return on.getInterpolation(t,this.a,this.b,this.c,e,n,s,r)}containsPoint(t){return on.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return on.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,s=this.b,r=this.c;let a,o;Ti.subVectors(s,n),wi.subVectors(r,n),Kr.subVectors(t,n);const l=Ti.dot(Kr),c=wi.dot(Kr);if(l<=0&&c<=0)return e.copy(n);$r.subVectors(t,s);const h=Ti.dot($r),d=wi.dot($r);if(h>=0&&d<=h)return e.copy(s);const p=l*d-h*c;if(p<=0&&l>=0&&h<=0)return a=l/(l-h),e.copy(n).addScaledVector(Ti,a);Jr.subVectors(t,r);const u=Ti.dot(Jr),g=wi.dot(Jr);if(g>=0&&u<=g)return e.copy(r);const _=u*c-l*g;if(_<=0&&c>=0&&g<=0)return o=c/(c-g),e.copy(n).addScaledVector(wi,o);const m=h*g-u*d;if(m<=0&&d-h>=0&&u-g>=0)return jo.subVectors(r,s),o=(d-h)/(d-h+(u-g)),e.copy(s).addScaledVector(jo,o);const f=1/(m+_+p);return a=_*f,o=p*f,e.copy(n).addScaledVector(Ti,a).addScaledVector(wi,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const _c={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},On={h:0,s:0,l:0},Vs={h:0,s:0,l:0};function na(i,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?i+(t-i)*6*e:e<1/2?t:e<2/3?i+(t-i)*6*(2/3-e):i}class ot{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){const s=t;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=an){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Qt.toWorkingColorSpace(this,e),this}setRGB(t,e,n,s=Qt.workingColorSpace){return this.r=t,this.g=e,this.b=n,Qt.toWorkingColorSpace(this,s),this}setHSL(t,e,n,s=Qt.workingColorSpace){if(t=Nh(t,1),e=Yt(e,0,1),n=Yt(n,0,1),e===0)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+e):n+e-n*e,a=2*n-r;this.r=na(a,r,t+1/3),this.g=na(a,r,t),this.b=na(a,r,t-1/3)}return Qt.toWorkingColorSpace(this,s),this}setStyle(t,e=an){function n(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const a=s[1],o=s[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(t)){const r=s[1],a=r.length;if(a===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,e);if(a===6)return this.setHex(parseInt(r,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=an){const n=_c[t.toLowerCase()];return n!==void 0?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Dn(t.r),this.g=Dn(t.g),this.b=Dn(t.b),this}copyLinearToSRGB(t){return this.r=Wi(t.r),this.g=Wi(t.g),this.b=Wi(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=an){return Qt.fromWorkingColorSpace(Ne.copy(this),t),Math.round(Yt(Ne.r*255,0,255))*65536+Math.round(Yt(Ne.g*255,0,255))*256+Math.round(Yt(Ne.b*255,0,255))}getHexString(t=an){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Qt.workingColorSpace){Qt.fromWorkingColorSpace(Ne.copy(this),e);const n=Ne.r,s=Ne.g,r=Ne.b,a=Math.max(n,s,r),o=Math.min(n,s,r);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const d=a-o;switch(c=h<=.5?d/(a+o):d/(2-a-o),a){case n:l=(s-r)/d+(s0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(const e in t){const n=t[e];if(n===void 0){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const s=this[e];if(s===void 0){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(n):s&&s.isVector3&&n&&n.isVector3?s.copy(n):this[e]=n}}toJSON(t){const e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Vi&&(n.blending=this.blending),this.side!==Yn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==ya&&(n.blendSrc=this.blendSrc),this.blendDst!==Ea&&(n.blendDst=this.blendDst),this.blendEquation!==ii&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==qi&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==No&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==_i&&(n.stencilFail=this.stencilFail),this.stencilZFail!==_i&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==_i&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function s(r){const a=[];for(const o in r){const l=r[o];delete l.metadata,a.push(l)}return a}if(e){const r=s(t.textures),a=s(t.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(e!==null){const s=e.length;n=new Array(s);for(let r=0;r!==s;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Ss extends qn{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ot(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Mn,this.combine=tc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const Me=new P,Gs=new St;class he{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=oo,this.updateRanges=[],this.gpuType=xn,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let s=0,r=this.itemSize;se.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ui);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new P(-1/0,-1/0,-1/0),new P(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,s=e.length;n0&&(t.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(t[c]=l[c]);return t}t.data={attributes:{}};const e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const l in n){const c=n[l];t.data.attributes[l]=c.toJSON(t.data)}const s={};let r=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let d=0,p=c.length;d0&&(s[l]=h,r=!0)}r&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;n!==null&&this.setIndex(n.clone(e));const s=t.attributes;for(const c in s){const h=s[c];this.setAttribute(c,h.clone(e))}const r=t.morphAttributes;for(const c in r){const h=[],d=r[c];for(let p=0,u=d.length;p0){const s=e[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=s.length;r(t.far-t.near)**2))&&(Zo.copy(r).invert(),$n.copy(t.ray).applyMatrix4(Zo),!(n.boundingBox!==null&&$n.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(t,e,$n)))}_computeIntersections(t,e,n){let s;const r=this.geometry,a=this.material,o=r.index,l=r.attributes.position,c=r.attributes.uv,h=r.attributes.uv1,d=r.attributes.normal,p=r.groups,u=r.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=p.length;g<_;g++){const m=p[g],f=a[m.materialIndex],T=Math.max(m.start,u.start),E=Math.min(o.count,Math.min(m.start+m.count,u.start+u.count));for(let y=T,D=E;ye.far?null:{distance:c,point:Zs.clone(),object:i}}function Ks(i,t,e,n,s,r,a,o,l,c){i.getVertexPosition(o,Xs),i.getVertexPosition(l,Ys),i.getVertexPosition(c,qs);const h=nu(i,t,e,n,Xs,Ys,qs,$o);if(h){const d=new P;on.getBarycoord($o,Xs,Ys,qs,d),s&&(h.uv=on.getInterpolatedAttribute(s,o,l,c,d,new St)),r&&(h.uv1=on.getInterpolatedAttribute(r,o,l,c,d,new St)),a&&(h.normal=on.getInterpolatedAttribute(a,o,l,c,d,new P),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const p={a:o,b:l,c,normal:new P,materialIndex:0};on.getNormal(Xs,Ys,qs,p.normal),h.face=p,h.barycoord=d}return h}class Ts extends ge{constructor(t=1,e=1,n=1,s=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:s,heightSegments:r,depthSegments:a};const o=this;s=Math.floor(s),r=Math.floor(r),a=Math.floor(a);const l=[],c=[],h=[],d=[];let p=0,u=0;g("z","y","x",-1,-1,n,e,t,a,r,0),g("z","y","x",1,-1,n,e,-t,a,r,1),g("x","z","y",1,1,t,n,e,s,a,2),g("x","z","y",1,-1,t,n,-e,s,a,3),g("x","y","z",1,-1,t,e,n,s,r,4),g("x","y","z",-1,-1,t,e,-n,s,r,5),this.setIndex(l),this.setAttribute("position",new Oe(c,3)),this.setAttribute("normal",new Oe(h,3)),this.setAttribute("uv",new Oe(d,2));function g(_,m,f,T,E,y,D,w,C,I,S){const M=y/C,A=D/I,W=y/2,k=D/2,q=w/2,Q=C+1,X=I+1;let tt=0,H=0;const st=new P;for(let gt=0;gt0?1:-1,h.push(st.x,st.y,st.z),d.push(Ft/C),d.push(1-gt/I),tt+=1}}for(let gt=0;gt0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const n={};for(const s in this.extensions)this.extensions[s]===!0&&(n[s]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}class Sc extends Ue{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ne,this.projectionMatrix=new ne,this.projectionMatrixInverse=new ne,this.coordinateSystem=Rn}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Bn=new P,Jo=new St,Qo=new St;class $e extends Sc{constructor(t=50,e=1,n=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=s,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=lo*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(gr*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return lo*2*Math.atan(Math.tan(gr*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){Bn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(Bn.x,Bn.y).multiplyScalar(-t/Bn.z),Bn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Bn.x,Bn.y).multiplyScalar(-t/Bn.z)}getViewSize(t,e){return this.getViewBounds(t,Jo,Qo),e.subVectors(Qo,Jo)}setViewOffset(t,e,n,s,r,a){this.aspect=t/e,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=s,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(gr*.5*this.fov)/this.zoom,n=2*e,s=this.aspect*n,r=-.5*s;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;r+=a.offsetX*s/l,e-=a.offsetY*n/c,s*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(r+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,e,e-n,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const Ri=-90,Ci=1;class au extends Ue{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new $e(Ri,Ci,t,e);s.layers=this.layers,this.add(s);const r=new $e(Ri,Ci,t,e);r.layers=this.layers,this.add(r);const a=new $e(Ri,Ci,t,e);a.layers=this.layers,this.add(a);const o=new $e(Ri,Ci,t,e);o.layers=this.layers,this.add(o);const l=new $e(Ri,Ci,t,e);l.layers=this.layers,this.add(l);const c=new $e(Ri,Ci,t,e);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[n,s,r,a,o,l]=e;for(const c of e)this.remove(c);if(t===Rn)n.up.set(0,1,0),n.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(t===Er)n.up.set(0,-1,0),n.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(const c of e)this.add(c),c.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:s}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,a,o,l,c,h]=this.children,d=t.getRenderTarget(),p=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),g=t.xr.enabled;t.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,s),t.render(e,r),t.setRenderTarget(n,1,s),t.render(e,a),t.setRenderTarget(n,2,s),t.render(e,o),t.setRenderTarget(n,3,s),t.render(e,l),t.setRenderTarget(n,4,s),t.render(e,c),n.texture.generateMipmaps=_,t.setRenderTarget(n,5,s),t.render(e,h),t.setRenderTarget(d,p,u),t.xr.enabled=g,n.texture.needsPMREMUpdate=!0}}class yc extends Pe{constructor(t,e,n,s,r,a,o,l,c,h){t=t!==void 0?t:[],e=e!==void 0?e:ji,super(t,e,n,s,r,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class ou extends fn{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},s=[n,n,n,n,n,n];this.texture=new yc(s,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=e.generateMipmaps!==void 0?e.generateMipmaps:!1,this.texture.minFilter=e.minFilter!==void 0?e.minFilter:vn}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},s=new Ts(5,5,5),r=new He({name:"CubemapFromEquirect",uniforms:Qi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Xe,blending:Cn});r.uniforms.tEquirect.value=e;const a=new be(s,r),o=e.minFilter;return e.minFilter===ai&&(e.minFilter=vn),new au(1,10,this).update(t,a),e.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(t,e,n,s){const r=t.getRenderTarget();for(let a=0;a<6;a++)t.setRenderTarget(this,a),t.clear(e,n,s);t.setRenderTarget(r)}}class Dr{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new ot(t),this.density=e}clone(){return new Dr(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class lu extends Ue{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Mn,this.environmentIntensity=1,this.environmentRotation=new Mn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class cu{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=oo,this.updateRanges=[],this.version=0,this.uuid=Xn()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let s=0,r=this.stride;st.far||e.push({distance:l,point:ls.clone(),uv:on.getInterpolation(ls,$s,hs,Js,tl,ra,el,new St),face:null,object:this})}copy(t,e){return super.copy(t,e),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}}function Qs(i,t,e,n,s,r){Ui.subVectors(i,e).addScalar(.5).multiply(n),s!==void 0?(cs.x=r*Ui.x-s*Ui.y,cs.y=s*Ui.x+r*Ui.y):cs.copy(Ui),i.copy(t),i.x+=cs.x,i.y+=cs.y,i.applyMatrix4(Ec)}class hu extends Pe{constructor(t=null,e=1,n=1,s,r,a,o,l,c=Je,h=Je,d,p){super(null,a,o,l,c,h,s,r,d,p),this.isDataTexture=!0,this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class nl extends he{constructor(t,e,n,s=1){super(t,e,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const Ii=new ne,il=new ne,tr=[],sl=new ui,uu=new ne,us=new be,ds=new di;class du extends be{constructor(t,e,n){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new nl(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let s=0;s1?null:e.copy(t.start).addScaledVector(n,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||pu.getNormalMatrix(t),s=this.coplanarPoint(aa).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-s.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Jn=new di,er=new P;class Ao{constructor(t=new Hn,e=new Hn,n=new Hn,s=new Hn,r=new Hn,a=new Hn){this.planes=[t,e,n,s,r,a]}set(t,e,n,s,r,a){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(s),o[4].copy(r),o[5].copy(a),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=Rn){const n=this.planes,s=t.elements,r=s[0],a=s[1],o=s[2],l=s[3],c=s[4],h=s[5],d=s[6],p=s[7],u=s[8],g=s[9],_=s[10],m=s[11],f=s[12],T=s[13],E=s[14],y=s[15];if(n[0].setComponents(l-r,p-c,m-u,y-f).normalize(),n[1].setComponents(l+r,p+c,m+u,y+f).normalize(),n[2].setComponents(l+a,p+h,m+g,y+T).normalize(),n[3].setComponents(l-a,p-h,m-g,y-T).normalize(),n[4].setComponents(l-o,p-d,m-_,y-E).normalize(),e===Rn)n[5].setComponents(l+o,p+d,m+_,y+E).normalize();else if(e===Er)n[5].setComponents(o,d,_,E).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),Jn.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),Jn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Jn)}intersectsSprite(t){return Jn.center.set(0,0,0),Jn.radius=.7071067811865476,Jn.applyMatrix4(t.matrixWorld),this.intersectsSphere(Jn)}intersectsSphere(t){const e=this.planes,n=t.center,s=-t.radius;for(let r=0;r<6;r++)if(e[r].distanceToPoint(n)0?t.max.x:t.min.x,er.y=s.normal.y>0?t.max.y:t.min.y,er.z=s.normal.z>0?t.max.z:t.min.z,s.distanceToPoint(er)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class Ar extends qn{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ot(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const Rr=new P,Cr=new P,rl=new ne,fs=new bs,nr=new di,oa=new P,al=new P;class co extends Ue{constructor(t=new ge,e=new Ar){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.index===null){const e=t.attributes.position,n=[0];for(let s=1,r=e.count;s0){const s=e[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=s.length;rn)return;oa.applyMatrix4(i.matrixWorld);const l=t.ray.origin.distanceTo(oa);if(!(lt.far))return{distance:l,point:al.clone().applyMatrix4(i.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:i}}class oi extends qn{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ot(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const ol=new ne,ho=new bs,sr=new di,rr=new P;class Yi extends Ue{constructor(t=new ge,e=new oi){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){const n=this.geometry,s=this.matrixWorld,r=t.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),sr.copy(n.boundingSphere),sr.applyMatrix4(s),sr.radius+=r,t.ray.intersectsSphere(sr)===!1)return;ol.copy(s).invert(),ho.copy(t.ray).applyMatrix4(ol);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,d=n.attributes.position;if(c!==null){const p=Math.max(0,a.start),u=Math.min(c.count,a.start+a.count);for(let g=p,_=u;g<_;g++){const m=c.getX(g);rr.fromBufferAttribute(d,m),ll(rr,m,l,s,t,e,this)}}else{const p=Math.max(0,a.start),u=Math.min(d.count,a.start+a.count);for(let g=p,_=u;g<_;g++)rr.fromBufferAttribute(d,g),ll(rr,g,l,s,t,e,this)}}updateMorphTargets(){const e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){const s=e[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=s.length;rs.far)return;r.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:t,face:null,faceIndex:null,barycoord:null,object:a})}}class zi extends Ue{constructor(){super(),this.isGroup=!0,this.type="Group"}}class bc extends Pe{constructor(t,e,n,s,r,a,o,l,c){super(t,e,n,s,r,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Tc extends Pe{constructor(t,e,n,s,r,a,o,l,c,h=Gi){if(h!==Gi&&h!==$i)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&h===Gi&&(n=li),n===void 0&&h===$i&&(n=Ki),super(null,s,r,a,o,l,h,n,c),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=o!==void 0?o:Je,this.minFilter=l!==void 0?l:Je,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}}class ws extends ge{constructor(t=1,e=1,n=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:s};const r=t/2,a=e/2,o=Math.floor(n),l=Math.floor(s),c=o+1,h=l+1,d=t/o,p=e/l,u=[],g=[],_=[],m=[];for(let f=0;f0)&&u.push(E,y,w),(f!==n-1||lu.start-g.start);let p=0;for(let u=1;u 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,Gu=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,Wu=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,Xu=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,Yu=`#if defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#elif defined( USE_COLOR ) + diffuseColor.rgb *= vColor; +#endif`,qu=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) + varying vec3 vColor; +#endif`,ju=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec3 vColor; +#endif`,Zu=`#if defined( USE_COLOR_ALPHA ) + vColor = vec4( 1.0 ); +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec3( 1.0 ); +#endif +#ifdef USE_COLOR + vColor *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.xyz *= instanceColor.xyz; +#endif +#ifdef USE_BATCHING_COLOR + vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); + vColor.xyz *= batchingColor.xyz; +#endif`,Ku=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,$u=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,Ju=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,Qu=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,td=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,ed=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,nd=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,id="gl_FragColor = linearToOutputTexel( gl_FragColor );",sd=`vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +}`,rd=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #else + vec4 envColor = vec4( 0.0 ); + #endif + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif +#endif`,ad=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif`,od=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,ld=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,cd=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,hd=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,ud=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,dd=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,fd=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,pd=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,md=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,gd=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,_d=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,vd=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,xd=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,Md=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,Sd=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,yd=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,Ed=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,bd=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,Td=`struct PhysicalMaterial { + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return saturate(v); + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColor; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; + float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; + float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); + return saturate( DG * RECIPROCAL_PI ); +} +vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); + const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); + vec4 r = roughness * c0 + c1; + float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; + vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; + return fab; +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + vec2 fab = DFGApprox( normal, viewDir, roughness ); + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + vec2 fab = DFGApprox( normal, viewDir, roughness ); + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + #endif + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); + #endif + vec3 totalScattering = singleScattering + multiScattering; + vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); + reflectedLight.indirectSpecular += radiance * singleScattering; + reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; + reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,wd=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,Ad=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,Rd=`#if defined( RE_IndirectDiffuse ) + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,Cd=`#if defined( USE_LOGDEPTHBUF ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,Pd=`#if defined( USE_LOGDEPTHBUF ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,Dd=`#ifdef USE_LOGDEPTHBUF + varying float vFragDepth; + varying float vIsPerspective; +#endif`,Ld=`#ifdef USE_LOGDEPTHBUF + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,Ud=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,Id=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,Nd=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,Fd=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,Od=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,Bd=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,zd=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,kd=`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,Hd=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,Vd=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,Gd=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,Wd=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,Xd=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,Yd=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,qd=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,jd=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,Zd=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,Kd=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,$d=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,Jd=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,Qd=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,tf=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,ef=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + return depth * ( near - far ) - near; +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + return ( near * far ) / ( ( far - near ) * depth - far ); +}`,nf=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,sf=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,rf=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,af=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,of=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,lf=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,cf=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { + return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); + } + vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { + return unpackRGBATo2Half( texture2D( shadow, uv ) ); + } + float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ + float occlusion = 1.0; + vec2 distribution = texture2DDistribution( shadow, uv ); + float hard_shadow = step( compare , distribution.x ); + if (hard_shadow != 1.0 ) { + float distance = compare - distribution.x ; + float variance = max( 0.00000, distribution.y * distribution.y ); + float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); + } + return occlusion; + } + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + #if defined( SHADOWMAP_TYPE_PCF ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx0 = - texelSize.x * shadowRadius; + float dy0 = - texelSize.y * shadowRadius; + float dx1 = + texelSize.x * shadowRadius; + float dy1 = + texelSize.y * shadowRadius; + float dx2 = dx0 / 2.0; + float dy2 = dy0 / 2.0; + float dx3 = dx1 / 2.0; + float dy3 = dy1 / 2.0; + shadow = ( + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) + ) * ( 1.0 / 17.0 ); + #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx = texelSize.x; + float dy = texelSize.y; + vec2 uv = shadowCoord.xy; + vec2 f = fract( uv * shadowMapSize + 0.5 ); + uv -= f * texelSize; + shadow = ( + texture2DCompare( shadowMap, uv, shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), + f.x ), + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), + f.x ), + f.y ) + ) * ( 1.0 / 9.0 ); + #elif defined( SHADOWMAP_TYPE_VSM ) + shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); + #else + shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + vec2 cubeToUV( vec3 v, float texelSizeY ) { + vec3 absV = abs( v ); + float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); + absV *= scaleToCube; + v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); + vec2 planar = v.xy; + float almostATexel = 1.5 * texelSizeY; + float almostOne = 1.0 - almostATexel; + if ( absV.z >= almostOne ) { + if ( v.z > 0.0 ) + planar.x = 4.0 - v.x; + } else if ( absV.x >= almostOne ) { + float signX = sign( v.x ); + planar.x = v.z * signX + 2.0 * signX; + } else if ( absV.y >= almostOne ) { + float signY = sign( v.y ); + planar.x = v.x + 2.0 * signY + 2.0; + planar.y = v.z * signY - 2.0; + } + return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); + } + float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + + float lightToPositionLength = length( lightToPosition ); + if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { + float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + shadow = ( + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) + ) * ( 1.0 / 9.0 ); + #else + shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } +#endif`,hf=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,uf=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,df=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,ff=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,pf=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,mf=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,gf=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,_f=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,vf=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,xf=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,Mf=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,Sf=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,yf=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + #else + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,Ef=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,bf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,Tf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,wf=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const Af=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,Rf=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,Cf=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,Pf=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,Df=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,Lf=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,Uf=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,If=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,Nf=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,Ff=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = packDepthToRGBA( dist ); +}`,Of=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,Bf=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,zf=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,kf=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,Hf=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,Vf=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,Gf=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,Wf=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,Xf=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,Yf=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,qf=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,jf=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,Zf=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,Kf=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,$f=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,Jf=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,Qf=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,tp=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,ep=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,np=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,ip=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,sp=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include +}`,rp=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,ap=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,Gt={alphahash_fragment:Au,alphahash_pars_fragment:Ru,alphamap_fragment:Cu,alphamap_pars_fragment:Pu,alphatest_fragment:Du,alphatest_pars_fragment:Lu,aomap_fragment:Uu,aomap_pars_fragment:Iu,batching_pars_vertex:Nu,batching_vertex:Fu,begin_vertex:Ou,beginnormal_vertex:Bu,bsdfs:zu,iridescence_fragment:ku,bumpmap_pars_fragment:Hu,clipping_planes_fragment:Vu,clipping_planes_pars_fragment:Gu,clipping_planes_pars_vertex:Wu,clipping_planes_vertex:Xu,color_fragment:Yu,color_pars_fragment:qu,color_pars_vertex:ju,color_vertex:Zu,common:Ku,cube_uv_reflection_fragment:$u,defaultnormal_vertex:Ju,displacementmap_pars_vertex:Qu,displacementmap_vertex:td,emissivemap_fragment:ed,emissivemap_pars_fragment:nd,colorspace_fragment:id,colorspace_pars_fragment:sd,envmap_fragment:rd,envmap_common_pars_fragment:ad,envmap_pars_fragment:od,envmap_pars_vertex:ld,envmap_physical_pars_fragment:xd,envmap_vertex:cd,fog_vertex:hd,fog_pars_vertex:ud,fog_fragment:dd,fog_pars_fragment:fd,gradientmap_pars_fragment:pd,lightmap_pars_fragment:md,lights_lambert_fragment:gd,lights_lambert_pars_fragment:_d,lights_pars_begin:vd,lights_toon_fragment:Md,lights_toon_pars_fragment:Sd,lights_phong_fragment:yd,lights_phong_pars_fragment:Ed,lights_physical_fragment:bd,lights_physical_pars_fragment:Td,lights_fragment_begin:wd,lights_fragment_maps:Ad,lights_fragment_end:Rd,logdepthbuf_fragment:Cd,logdepthbuf_pars_fragment:Pd,logdepthbuf_pars_vertex:Dd,logdepthbuf_vertex:Ld,map_fragment:Ud,map_pars_fragment:Id,map_particle_fragment:Nd,map_particle_pars_fragment:Fd,metalnessmap_fragment:Od,metalnessmap_pars_fragment:Bd,morphinstance_vertex:zd,morphcolor_vertex:kd,morphnormal_vertex:Hd,morphtarget_pars_vertex:Vd,morphtarget_vertex:Gd,normal_fragment_begin:Wd,normal_fragment_maps:Xd,normal_pars_fragment:Yd,normal_pars_vertex:qd,normal_vertex:jd,normalmap_pars_fragment:Zd,clearcoat_normal_fragment_begin:Kd,clearcoat_normal_fragment_maps:$d,clearcoat_pars_fragment:Jd,iridescence_pars_fragment:Qd,opaque_fragment:tf,packing:ef,premultiplied_alpha_fragment:nf,project_vertex:sf,dithering_fragment:rf,dithering_pars_fragment:af,roughnessmap_fragment:of,roughnessmap_pars_fragment:lf,shadowmap_pars_fragment:cf,shadowmap_pars_vertex:hf,shadowmap_vertex:uf,shadowmask_pars_fragment:df,skinbase_vertex:ff,skinning_pars_vertex:pf,skinning_vertex:mf,skinnormal_vertex:gf,specularmap_fragment:_f,specularmap_pars_fragment:vf,tonemapping_fragment:xf,tonemapping_pars_fragment:Mf,transmission_fragment:Sf,transmission_pars_fragment:yf,uv_pars_fragment:Ef,uv_pars_vertex:bf,uv_vertex:Tf,worldpos_vertex:wf,background_vert:Af,background_frag:Rf,backgroundCube_vert:Cf,backgroundCube_frag:Pf,cube_vert:Df,cube_frag:Lf,depth_vert:Uf,depth_frag:If,distanceRGBA_vert:Nf,distanceRGBA_frag:Ff,equirect_vert:Of,equirect_frag:Bf,linedashed_vert:zf,linedashed_frag:kf,meshbasic_vert:Hf,meshbasic_frag:Vf,meshlambert_vert:Gf,meshlambert_frag:Wf,meshmatcap_vert:Xf,meshmatcap_frag:Yf,meshnormal_vert:qf,meshnormal_frag:jf,meshphong_vert:Zf,meshphong_frag:Kf,meshphysical_vert:$f,meshphysical_frag:Jf,meshtoon_vert:Qf,meshtoon_frag:tp,points_vert:ep,points_frag:np,shadow_vert:ip,shadow_frag:sp,sprite_vert:rp,sprite_frag:ap},ct={common:{diffuse:{value:new ot(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ht},alphaMap:{value:null},alphaMapTransform:{value:new Ht},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ht}},envmap:{envMap:{value:null},envMapRotation:{value:new Ht},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ht}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ht}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ht},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ht},normalScale:{value:new St(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ht},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ht}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ht}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ht}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ot(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ot(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ht},alphaTest:{value:0},uvTransform:{value:new Ht}},sprite:{diffuse:{value:new ot(16777215)},opacity:{value:1},center:{value:new St(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ht},alphaMap:{value:null},alphaMapTransform:{value:new Ht},alphaTest:{value:0}}},mn={basic:{uniforms:ke([ct.common,ct.specularmap,ct.envmap,ct.aomap,ct.lightmap,ct.fog]),vertexShader:Gt.meshbasic_vert,fragmentShader:Gt.meshbasic_frag},lambert:{uniforms:ke([ct.common,ct.specularmap,ct.envmap,ct.aomap,ct.lightmap,ct.emissivemap,ct.bumpmap,ct.normalmap,ct.displacementmap,ct.fog,ct.lights,{emissive:{value:new ot(0)}}]),vertexShader:Gt.meshlambert_vert,fragmentShader:Gt.meshlambert_frag},phong:{uniforms:ke([ct.common,ct.specularmap,ct.envmap,ct.aomap,ct.lightmap,ct.emissivemap,ct.bumpmap,ct.normalmap,ct.displacementmap,ct.fog,ct.lights,{emissive:{value:new ot(0)},specular:{value:new ot(1118481)},shininess:{value:30}}]),vertexShader:Gt.meshphong_vert,fragmentShader:Gt.meshphong_frag},standard:{uniforms:ke([ct.common,ct.envmap,ct.aomap,ct.lightmap,ct.emissivemap,ct.bumpmap,ct.normalmap,ct.displacementmap,ct.roughnessmap,ct.metalnessmap,ct.fog,ct.lights,{emissive:{value:new ot(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Gt.meshphysical_vert,fragmentShader:Gt.meshphysical_frag},toon:{uniforms:ke([ct.common,ct.aomap,ct.lightmap,ct.emissivemap,ct.bumpmap,ct.normalmap,ct.displacementmap,ct.gradientmap,ct.fog,ct.lights,{emissive:{value:new ot(0)}}]),vertexShader:Gt.meshtoon_vert,fragmentShader:Gt.meshtoon_frag},matcap:{uniforms:ke([ct.common,ct.bumpmap,ct.normalmap,ct.displacementmap,ct.fog,{matcap:{value:null}}]),vertexShader:Gt.meshmatcap_vert,fragmentShader:Gt.meshmatcap_frag},points:{uniforms:ke([ct.points,ct.fog]),vertexShader:Gt.points_vert,fragmentShader:Gt.points_frag},dashed:{uniforms:ke([ct.common,ct.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Gt.linedashed_vert,fragmentShader:Gt.linedashed_frag},depth:{uniforms:ke([ct.common,ct.displacementmap]),vertexShader:Gt.depth_vert,fragmentShader:Gt.depth_frag},normal:{uniforms:ke([ct.common,ct.bumpmap,ct.normalmap,ct.displacementmap,{opacity:{value:1}}]),vertexShader:Gt.meshnormal_vert,fragmentShader:Gt.meshnormal_frag},sprite:{uniforms:ke([ct.sprite,ct.fog]),vertexShader:Gt.sprite_vert,fragmentShader:Gt.sprite_frag},background:{uniforms:{uvTransform:{value:new Ht},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Gt.background_vert,fragmentShader:Gt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ht}},vertexShader:Gt.backgroundCube_vert,fragmentShader:Gt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Gt.cube_vert,fragmentShader:Gt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Gt.equirect_vert,fragmentShader:Gt.equirect_frag},distanceRGBA:{uniforms:ke([ct.common,ct.displacementmap,{referencePosition:{value:new P},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Gt.distanceRGBA_vert,fragmentShader:Gt.distanceRGBA_frag},shadow:{uniforms:ke([ct.lights,ct.fog,{color:{value:new ot(0)},opacity:{value:1}}]),vertexShader:Gt.shadow_vert,fragmentShader:Gt.shadow_frag}};mn.physical={uniforms:ke([mn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ht},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ht},clearcoatNormalScale:{value:new St(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ht},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ht},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ht},sheen:{value:0},sheenColor:{value:new ot(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ht},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ht},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ht},transmissionSamplerSize:{value:new St},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ht},attenuationDistance:{value:0},attenuationColor:{value:new ot(0)},specularColor:{value:new ot(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ht},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ht},anisotropyVector:{value:new St},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ht}}]),vertexShader:Gt.meshphysical_vert,fragmentShader:Gt.meshphysical_frag};const ar={r:0,b:0,g:0},Qn=new Mn,op=new ne;function lp(i,t,e,n,s,r,a){const o=new ot(0);let l=r===!0?0:1,c,h,d=null,p=0,u=null;function g(E){let y=E.isScene===!0?E.background:null;return y&&y.isTexture&&(y=(E.backgroundBlurriness>0?e:t).get(y)),y}function _(E){let y=!1;const D=g(E);D===null?f(o,l):D&&D.isColor&&(f(D,1),y=!0);const w=i.xr.getEnvironmentBlendMode();w==="additive"?n.buffers.color.setClear(0,0,0,1,a):w==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||y)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function m(E,y){const D=g(y);D&&(D.isCubeTexture||D.mapping===Pr)?(h===void 0&&(h=new be(new Ts(1,1,1),new He({name:"BackgroundCubeMaterial",uniforms:Qi(mn.backgroundCube.uniforms),vertexShader:mn.backgroundCube.vertexShader,fragmentShader:mn.backgroundCube.fragmentShader,side:Xe,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(w,C,I){this.matrixWorld.copyPosition(I.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(h)),Qn.copy(y.backgroundRotation),Qn.x*=-1,Qn.y*=-1,Qn.z*=-1,D.isCubeTexture&&D.isRenderTargetTexture===!1&&(Qn.y*=-1,Qn.z*=-1),h.material.uniforms.envMap.value=D,h.material.uniforms.flipEnvMap.value=D.isCubeTexture&&D.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=y.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(op.makeRotationFromEuler(Qn)),h.material.toneMapped=Qt.getTransfer(D.colorSpace)!==se,(d!==D||p!==D.version||u!==i.toneMapping)&&(h.material.needsUpdate=!0,d=D,p=D.version,u=i.toneMapping),h.layers.enableAll(),E.unshift(h,h.geometry,h.material,0,0,null)):D&&D.isTexture&&(c===void 0&&(c=new be(new ws(2,2),new He({name:"BackgroundMaterial",uniforms:Qi(mn.background.uniforms),vertexShader:mn.background.vertexShader,fragmentShader:mn.background.fragmentShader,side:Yn,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(c)),c.material.uniforms.t2D.value=D,c.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,c.material.toneMapped=Qt.getTransfer(D.colorSpace)!==se,D.matrixAutoUpdate===!0&&D.updateMatrix(),c.material.uniforms.uvTransform.value.copy(D.matrix),(d!==D||p!==D.version||u!==i.toneMapping)&&(c.material.needsUpdate=!0,d=D,p=D.version,u=i.toneMapping),c.layers.enableAll(),E.unshift(c,c.geometry,c.material,0,0,null))}function f(E,y){E.getRGB(ar,Mc(i)),n.buffers.color.setClear(ar.r,ar.g,ar.b,y,a)}function T(){h!==void 0&&(h.geometry.dispose(),h.material.dispose()),c!==void 0&&(c.geometry.dispose(),c.material.dispose())}return{getClearColor:function(){return o},setClearColor:function(E,y=1){o.set(E),l=y,f(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(E){l=E,f(o,l)},render:_,addToRenderList:m,dispose:T}}function cp(i,t){const e=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},s=p(null);let r=s,a=!1;function o(M,A,W,k,q){let Q=!1;const X=d(k,W,A);r!==X&&(r=X,c(r.object)),Q=u(M,k,W,q),Q&&g(M,k,W,q),q!==null&&t.update(q,i.ELEMENT_ARRAY_BUFFER),(Q||a)&&(a=!1,y(M,A,W,k),q!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t.get(q).buffer))}function l(){return i.createVertexArray()}function c(M){return i.bindVertexArray(M)}function h(M){return i.deleteVertexArray(M)}function d(M,A,W){const k=W.wireframe===!0;let q=n[M.id];q===void 0&&(q={},n[M.id]=q);let Q=q[A.id];Q===void 0&&(Q={},q[A.id]=Q);let X=Q[k];return X===void 0&&(X=p(l()),Q[k]=X),X}function p(M){const A=[],W=[],k=[];for(let q=0;q=0){const gt=q[H];let Et=Q[H];if(Et===void 0&&(H==="instanceMatrix"&&M.instanceMatrix&&(Et=M.instanceMatrix),H==="instanceColor"&&M.instanceColor&&(Et=M.instanceColor)),gt===void 0||gt.attribute!==Et||Et&>.data!==Et.data)return!0;X++}return r.attributesNum!==X||r.index!==k}function g(M,A,W,k){const q={},Q=A.attributes;let X=0;const tt=W.getAttributes();for(const H in tt)if(tt[H].location>=0){let gt=Q[H];gt===void 0&&(H==="instanceMatrix"&&M.instanceMatrix&&(gt=M.instanceMatrix),H==="instanceColor"&&M.instanceColor&&(gt=M.instanceColor));const Et={};Et.attribute=gt,gt&>.data&&(Et.data=gt.data),q[H]=Et,X++}r.attributes=q,r.attributesNum=X,r.index=k}function _(){const M=r.newAttributes;for(let A=0,W=M.length;A=0){let st=q[tt];if(st===void 0&&(tt==="instanceMatrix"&&M.instanceMatrix&&(st=M.instanceMatrix),tt==="instanceColor"&&M.instanceColor&&(st=M.instanceColor)),st!==void 0){const gt=st.normalized,Et=st.itemSize,Ft=t.get(st);if(Ft===void 0)continue;const Xt=Ft.buffer,Y=Ft.type,nt=Ft.bytesPerElement,_t=Y===i.INT||Y===i.UNSIGNED_INT||st.gpuType===xo;if(st.isInterleavedBufferAttribute){const lt=st.data,Ct=lt.stride,Lt=st.offset;if(lt.isInstancedInterleavedBuffer){for(let Vt=0;Vt0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=e.precision!==void 0?e.precision:"highp";const h=l(c);h!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const d=e.logarithmicDepthBuffer===!0,p=e.reverseDepthBuffer===!0&&t.has("EXT_clip_control"),u=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),g=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_TEXTURE_SIZE),m=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),f=i.getParameter(i.MAX_VERTEX_ATTRIBS),T=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),E=i.getParameter(i.MAX_VARYING_VECTORS),y=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),D=g>0,w=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:d,reverseDepthBuffer:p,maxTextures:u,maxVertexTextures:g,maxTextureSize:_,maxCubemapSize:m,maxAttributes:f,maxVertexUniforms:T,maxVaryings:E,maxFragmentUniforms:y,vertexTextures:D,maxSamples:w}}function dp(i){const t=this;let e=null,n=0,s=!1,r=!1;const a=new Hn,o=new Ht,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,p){const u=d.length!==0||p||n!==0||s;return s=p,n=d.length,u},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(d,p){e=h(d,p,0)},this.setState=function(d,p,u){const g=d.clippingPlanes,_=d.clipIntersection,m=d.clipShadows,f=i.get(d);if(!s||g===null||g.length===0||r&&!m)r?h(null):c();else{const T=r?0:n,E=T*4;let y=f.clippingState||null;l.value=y,y=h(g,p,E,u);for(let D=0;D!==E;++D)y[D]=e[D];f.clippingState=y,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=T}};function c(){l.value!==e&&(l.value=e,l.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function h(d,p,u,g){const _=d!==null?d.length:0;let m=null;if(_!==0){if(m=l.value,g!==!0||m===null){const f=u+_*4,T=p.matrixWorldInverse;o.getNormalMatrix(T),(m===null||m.length0){const c=new ou(l.height);return c.fromEquirectangularTexture(i,a),t.set(a,c),a.addEventListener("dispose",s),e(c.texture,a.mapping)}else return null}}return a}function s(a){const o=a.target;o.removeEventListener("dispose",s);const l=t.get(o);l!==void 0&&(t.delete(o),l.dispose())}function r(){t=new WeakMap}return{get:n,dispose:r}}const ki=4,vl=[.125,.215,.35,.446,.526,.582],si=20,ha=new Ac,xl=new ot;let ua=null,da=0,fa=0,pa=!1;const ei=(1+Math.sqrt(5))/2,Ni=1/ei,Ml=[new P(-ei,Ni,0),new P(ei,Ni,0),new P(-Ni,0,ei),new P(Ni,0,ei),new P(0,ei,-Ni),new P(0,ei,Ni),new P(-1,1,-1),new P(1,1,-1),new P(-1,1,1),new P(1,1,1)];class Sl{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,s=100){ua=this._renderer.getRenderTarget(),da=this._renderer.getActiveCubeFace(),fa=this._renderer.getActiveMipmapLevel(),pa=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,n,s,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=bl(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=El(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t2?E:0,E,E),h.setRenderTarget(s),_&&h.render(g,o),h.render(t,o)}g.geometry.dispose(),g.material.dispose(),h.toneMapping=p,h.autoClear=d,t.background=m}_textureToCubeUV(t,e){const n=this._renderer,s=t.mapping===ji||t.mapping===Zi;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=bl()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=El());const r=s?this._cubemapMaterial:this._equirectMaterial,a=new be(this._lodPlanes[0],r),o=r.uniforms;o.envMap.value=t;const l=this._cubeSize;or(e,0,0,3*l,2*l),n.setRenderTarget(e),n.render(a,ha)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;const s=this._lodPlanes.length;for(let r=1;rsi&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${si}`);const f=[];let T=0;for(let C=0;CE-ki?s-E+ki:0),w=4*(this._cubeSize-y);or(e,D,w,3*y,2*y),l.setRenderTarget(e),l.render(d,ha)}}function pp(i){const t=[],e=[],n=[];let s=i;const r=i-ki+1+vl.length;for(let a=0;ai-ki?l=vl[a-i+ki-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),h=-c,d=1+c,p=[h,h,d,h,d,d,h,h,d,d,h,d],u=6,g=6,_=3,m=2,f=1,T=new Float32Array(_*g*u),E=new Float32Array(m*g*u),y=new Float32Array(f*g*u);for(let w=0;w2?0:-1,S=[C,I,0,C+2/3,I,0,C+2/3,I+1,0,C,I,0,C+2/3,I+1,0,C,I+1,0];T.set(S,_*g*w),E.set(p,m*g*w);const M=[w,w,w,w,w,w];y.set(M,f*g*w)}const D=new ge;D.setAttribute("position",new he(T,_)),D.setAttribute("uv",new he(E,m)),D.setAttribute("faceIndex",new he(y,f)),t.push(D),s>ki&&s--}return{lodPlanes:t,sizeLods:e,sigmas:n}}function yl(i,t,e){const n=new fn(i,t,e);return n.texture.mapping=Pr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function or(i,t,e,n,s){i.viewport.set(t,e,n,s),i.scissor.set(t,e,n,s)}function mp(i,t,e){const n=new Float32Array(si),s=new P(0,1,0);return new He({name:"SphericalGaussianBlur",defines:{n:si,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:Co(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:Cn,depthTest:!1,depthWrite:!1})}function El(){return new He({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Co(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:Cn,depthTest:!1,depthWrite:!1})}function bl(){return new He({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Co(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:Cn,depthTest:!1,depthWrite:!1})}function Co(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}function gp(i){let t=new WeakMap,e=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===Da||l===La,h=l===ji||l===Zi;if(c||h){let d=t.get(o);const p=d!==void 0?d.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==p)return e===null&&(e=new Sl(i)),d=c?e.fromEquirectangular(o,d):e.fromCubemap(o,d),d.texture.pmremVersion=o.pmremVersion,t.set(o,d),d.texture;if(d!==void 0)return d.texture;{const u=o.image;return c&&u&&u.height>0||h&&u&&s(u)?(e===null&&(e=new Sl(i)),d=c?e.fromEquirectangular(o):e.fromCubemap(o),d.texture.pmremVersion=o.pmremVersion,t.set(o,d),o.addEventListener("dispose",r),d.texture):null}}}return o}function s(o){let l=0;const c=6;for(let h=0;ht.maxTextureSize&&(D=Math.ceil(y/t.maxTextureSize),y=t.maxTextureSize);const w=new Float32Array(y*D*4*d),C=new gc(w,y,D,d);C.type=xn,C.needsUpdate=!0;const I=E*4;for(let M=0;M0)return i;const s=t*e;let r=wl[s];if(r===void 0&&(r=new Float32Array(s),wl[s]=r),t!==0){n.toArray(r,0);for(let a=1,o=0;a!==t;++a)o+=e,i[a].toArray(r,o)}return r}function Te(i,t){if(i.length!==t.length)return!1;for(let e=0,n=i.length;e":" "} ${o}: ${e[a]}`)}return n.join(` +`)}const Ul=new Ht;function gm(i){Qt._getMatrix(Ul,Qt.workingColorSpace,i);const t=`mat3( ${Ul.elements.map(e=>e.toFixed(4))} )`;switch(Qt.getTransfer(i)){case yr:return[t,"LinearTransferOETF"];case se:return[t,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",i),[t,"LinearTransferOETF"]}}function Il(i,t,e){const n=i.getShaderParameter(t,i.COMPILE_STATUS),s=i.getShaderInfoLog(t).trim();if(n&&s==="")return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const a=parseInt(r[1]);return e.toUpperCase()+` + +`+s+` + +`+mm(i.getShaderSource(t),a)}else return s}function _m(i,t){const e=gm(t);return[`vec4 ${i}( vec4 value ) {`,` return ${e[1]}( vec4( value.rgb * ${e[0]}, value.a ) );`,"}"].join(` +`)}function vm(i,t){let e;switch(t){case vh:e="Linear";break;case xh:e="Reinhard";break;case Mh:e="Cineon";break;case ec:e="ACESFilmic";break;case yh:e="AgX";break;case Eh:e="Neutral";break;case Sh:e="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),e="Linear"}return"vec3 "+i+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}const lr=new P;function xm(){Qt.getLuminanceCoefficients(lr);const i=lr.x.toFixed(4),t=lr.y.toFixed(4),e=lr.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${t}, ${e} );`," return dot( weights, rgb );","}"].join(` +`)}function Mm(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(gs).join(` +`)}function Sm(i){const t=[];for(const e in i){const n=i[e];n!==!1&&t.push("#define "+e+" "+n)}return t.join(` +`)}function ym(i,t){const e={},n=i.getProgramParameter(t,i.ACTIVE_ATTRIBUTES);for(let s=0;s/gm;function fo(i){return i.replace(Em,Tm)}const bm=new Map;function Tm(i,t){let e=Gt[t];if(e===void 0){const n=bm.get(t);if(n!==void 0)e=Gt[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,n);else throw new Error("Can not resolve #include <"+t+">")}return fo(e)}const wm=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ol(i){return i.replace(wm,Am)}function Am(i,t,e,n){let s="";for(let r=parseInt(t);r0&&(m+=` +`),f=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g].filter(gs).join(` +`),f.length>0&&(f+=` +`)):(m=[Bl(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g,e.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",e.batching?"#define USE_BATCHING":"",e.batchingColor?"#define USE_BATCHING_COLOR":"",e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.instancingMorph?"#define USE_INSTANCING_MORPH":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+h:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",e.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(gs).join(` +`),f=[Bl(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+c:"",e.envMap?"#define "+h:"",e.envMap?"#define "+d:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.dispersion?"#define USE_DISPERSION":"",e.iridescence?"#define USE_IRIDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor||e.batchingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",e.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==Wn?"#define TONE_MAPPING":"",e.toneMapping!==Wn?Gt.tonemapping_pars_fragment:"",e.toneMapping!==Wn?vm("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",Gt.colorspace_pars_fragment,_m("linearToOutputTexel",e.outputColorSpace),xm(),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",` +`].filter(gs).join(` +`)),a=fo(a),a=Nl(a,e),a=Fl(a,e),o=fo(o),o=Nl(o,e),o=Fl(o,e),a=Ol(a),o=Ol(o),e.isRawShaderMaterial!==!0&&(T=`#version 300 es +`,m=[u,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+m,f=["#define varying in",e.glslVersion===Fo?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===Fo?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+f);const E=T+m+a,y=T+f+o,D=Ll(s,s.VERTEX_SHADER,E),w=Ll(s,s.FRAGMENT_SHADER,y);s.attachShader(_,D),s.attachShader(_,w),e.index0AttributeName!==void 0?s.bindAttribLocation(_,0,e.index0AttributeName):e.morphTargets===!0&&s.bindAttribLocation(_,0,"position"),s.linkProgram(_);function C(A){if(i.debug.checkShaderErrors){const W=s.getProgramInfoLog(_).trim(),k=s.getShaderInfoLog(D).trim(),q=s.getShaderInfoLog(w).trim();let Q=!0,X=!0;if(s.getProgramParameter(_,s.LINK_STATUS)===!1)if(Q=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(s,_,D,w);else{const tt=Il(s,D,"vertex"),H=Il(s,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(_,s.VALIDATE_STATUS)+` + +Material Name: `+A.name+` +Material Type: `+A.type+` + +Program Info Log: `+W+` +`+tt+` +`+H)}else W!==""?console.warn("THREE.WebGLProgram: Program Info Log:",W):(k===""||q==="")&&(X=!1);X&&(A.diagnostics={runnable:Q,programLog:W,vertexShader:{log:k,prefix:m},fragmentShader:{log:q,prefix:f}})}s.deleteShader(D),s.deleteShader(w),I=new _r(s,_),S=ym(s,_)}let I;this.getUniforms=function(){return I===void 0&&C(this),I};let S;this.getAttributes=function(){return S===void 0&&C(this),S};let M=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=s.getProgramParameter(_,fm)),M},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(_),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=pm++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=D,this.fragmentShader=w,this}let Im=0;class Nm{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,s=this._getShaderStage(e),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(t);return a.has(s)===!1&&(a.add(s),s.usedTimes++),a.has(r)===!1&&(a.add(r),r.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const n of e)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let n=e.get(t);return n===void 0&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){const e=this.shaderCache;let n=e.get(t);return n===void 0&&(n=new Fm(t),e.set(t,n)),n}}class Fm{constructor(t){this.id=Im++,this.code=t,this.usedTimes=0}}function Om(i,t,e,n,s,r,a){const o=new wo,l=new Nm,c=new Set,h=[],d=s.logarithmicDepthBuffer,p=s.vertexTextures;let u=s.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(S){return c.add(S),S===0?"uv":`uv${S}`}function m(S,M,A,W,k){const q=W.fog,Q=k.geometry,X=S.isMeshStandardMaterial?W.environment:null,tt=(S.isMeshStandardMaterial?e:t).get(S.envMap||X),H=tt&&tt.mapping===Pr?tt.image.height:null,st=g[S.type];S.precision!==null&&(u=s.getMaxPrecision(S.precision),u!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",u,"instead."));const gt=Q.morphAttributes.position||Q.morphAttributes.normal||Q.morphAttributes.color,Et=gt!==void 0?gt.length:0;let Ft=0;Q.morphAttributes.position!==void 0&&(Ft=1),Q.morphAttributes.normal!==void 0&&(Ft=2),Q.morphAttributes.color!==void 0&&(Ft=3);let Xt,Y,nt,_t;if(st){const $t=mn[st];Xt=$t.vertexShader,Y=$t.fragmentShader}else Xt=S.vertexShader,Y=S.fragmentShader,l.update(S),nt=l.getVertexShaderID(S),_t=l.getFragmentShaderID(S);const lt=i.getRenderTarget(),Ct=i.state.buffers.depth.getReversed(),Lt=k.isInstancedMesh===!0,Vt=k.isBatchedMesh===!0,ie=!!S.map,Wt=!!S.matcap,ue=!!tt,R=!!S.aoMap,ye=!!S.lightMap,qt=!!S.bumpMap,jt=!!S.normalMap,At=!!S.displacementMap,le=!!S.emissiveMap,Rt=!!S.metalnessMap,b=!!S.roughnessMap,v=S.anisotropy>0,F=S.clearcoat>0,K=S.dispersion>0,J=S.iridescence>0,j=S.sheen>0,Tt=S.transmission>0,dt=v&&!!S.anisotropyMap,V=F&&!!S.clearcoatMap,at=F&&!!S.clearcoatNormalMap,Z=F&&!!S.clearcoatRoughnessMap,it=J&&!!S.iridescenceMap,pt=J&&!!S.iridescenceThicknessMap,wt=j&&!!S.sheenColorMap,ht=j&&!!S.sheenRoughnessMap,Bt=!!S.specularMap,Ut=!!S.specularColorMap,Zt=!!S.specularIntensityMap,L=Tt&&!!S.transmissionMap,rt=Tt&&!!S.thicknessMap,G=!!S.gradientMap,$=!!S.alphaMap,ft=S.alphaTest>0,ut=!!S.alphaHash,Ot=!!S.extensions;let ce=Wn;S.toneMapped&&(lt===null||lt.isXRRenderTarget===!0)&&(ce=i.toneMapping);const Ae={shaderID:st,shaderType:S.type,shaderName:S.name,vertexShader:Xt,fragmentShader:Y,defines:S.defines,customVertexShaderID:nt,customFragmentShaderID:_t,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:u,batching:Vt,batchingColor:Vt&&k._colorsTexture!==null,instancing:Lt,instancingColor:Lt&&k.instanceColor!==null,instancingMorph:Lt&&k.morphTexture!==null,supportsVertexTextures:p,outputColorSpace:lt===null?i.outputColorSpace:lt.isXRRenderTarget===!0?lt.texture.colorSpace:Ji,alphaToCoverage:!!S.alphaToCoverage,map:ie,matcap:Wt,envMap:ue,envMapMode:ue&&tt.mapping,envMapCubeUVHeight:H,aoMap:R,lightMap:ye,bumpMap:qt,normalMap:jt,displacementMap:p&&At,emissiveMap:le,normalMapObjectSpace:jt&&S.normalMapType===Ah,normalMapTangentSpace:jt&&S.normalMapType===dc,metalnessMap:Rt,roughnessMap:b,anisotropy:v,anisotropyMap:dt,clearcoat:F,clearcoatMap:V,clearcoatNormalMap:at,clearcoatRoughnessMap:Z,dispersion:K,iridescence:J,iridescenceMap:it,iridescenceThicknessMap:pt,sheen:j,sheenColorMap:wt,sheenRoughnessMap:ht,specularMap:Bt,specularColorMap:Ut,specularIntensityMap:Zt,transmission:Tt,transmissionMap:L,thicknessMap:rt,gradientMap:G,opaque:S.transparent===!1&&S.blending===Vi&&S.alphaToCoverage===!1,alphaMap:$,alphaTest:ft,alphaHash:ut,combine:S.combine,mapUv:ie&&_(S.map.channel),aoMapUv:R&&_(S.aoMap.channel),lightMapUv:ye&&_(S.lightMap.channel),bumpMapUv:qt&&_(S.bumpMap.channel),normalMapUv:jt&&_(S.normalMap.channel),displacementMapUv:At&&_(S.displacementMap.channel),emissiveMapUv:le&&_(S.emissiveMap.channel),metalnessMapUv:Rt&&_(S.metalnessMap.channel),roughnessMapUv:b&&_(S.roughnessMap.channel),anisotropyMapUv:dt&&_(S.anisotropyMap.channel),clearcoatMapUv:V&&_(S.clearcoatMap.channel),clearcoatNormalMapUv:at&&_(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Z&&_(S.clearcoatRoughnessMap.channel),iridescenceMapUv:it&&_(S.iridescenceMap.channel),iridescenceThicknessMapUv:pt&&_(S.iridescenceThicknessMap.channel),sheenColorMapUv:wt&&_(S.sheenColorMap.channel),sheenRoughnessMapUv:ht&&_(S.sheenRoughnessMap.channel),specularMapUv:Bt&&_(S.specularMap.channel),specularColorMapUv:Ut&&_(S.specularColorMap.channel),specularIntensityMapUv:Zt&&_(S.specularIntensityMap.channel),transmissionMapUv:L&&_(S.transmissionMap.channel),thicknessMapUv:rt&&_(S.thicknessMap.channel),alphaMapUv:$&&_(S.alphaMap.channel),vertexTangents:!!Q.attributes.tangent&&(jt||v),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!Q.attributes.color&&Q.attributes.color.itemSize===4,pointsUvs:k.isPoints===!0&&!!Q.attributes.uv&&(ie||$),fog:!!q,useFog:S.fog===!0,fogExp2:!!q&&q.isFogExp2,flatShading:S.flatShading===!0,sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:d,reverseDepthBuffer:Ct,skinning:k.isSkinnedMesh===!0,morphTargets:Q.morphAttributes.position!==void 0,morphNormals:Q.morphAttributes.normal!==void 0,morphColors:Q.morphAttributes.color!==void 0,morphTargetsCount:Et,morphTextureStride:Ft,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:S.dithering,shadowMapEnabled:i.shadowMap.enabled&&A.length>0,shadowMapType:i.shadowMap.type,toneMapping:ce,decodeVideoTexture:ie&&S.map.isVideoTexture===!0&&Qt.getTransfer(S.map.colorSpace)===se,decodeVideoTextureEmissive:le&&S.emissiveMap.isVideoTexture===!0&&Qt.getTransfer(S.emissiveMap.colorSpace)===se,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===gn,flipSided:S.side===Xe,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionClipCullDistance:Ot&&S.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ot&&S.extensions.multiDraw===!0||Vt)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()};return Ae.vertexUv1s=c.has(1),Ae.vertexUv2s=c.has(2),Ae.vertexUv3s=c.has(3),c.clear(),Ae}function f(S){const M=[];if(S.shaderID?M.push(S.shaderID):(M.push(S.customVertexShaderID),M.push(S.customFragmentShaderID)),S.defines!==void 0)for(const A in S.defines)M.push(A),M.push(S.defines[A]);return S.isRawShaderMaterial===!1&&(T(M,S),E(M,S),M.push(i.outputColorSpace)),M.push(S.customProgramCacheKey),M.join()}function T(S,M){S.push(M.precision),S.push(M.outputColorSpace),S.push(M.envMapMode),S.push(M.envMapCubeUVHeight),S.push(M.mapUv),S.push(M.alphaMapUv),S.push(M.lightMapUv),S.push(M.aoMapUv),S.push(M.bumpMapUv),S.push(M.normalMapUv),S.push(M.displacementMapUv),S.push(M.emissiveMapUv),S.push(M.metalnessMapUv),S.push(M.roughnessMapUv),S.push(M.anisotropyMapUv),S.push(M.clearcoatMapUv),S.push(M.clearcoatNormalMapUv),S.push(M.clearcoatRoughnessMapUv),S.push(M.iridescenceMapUv),S.push(M.iridescenceThicknessMapUv),S.push(M.sheenColorMapUv),S.push(M.sheenRoughnessMapUv),S.push(M.specularMapUv),S.push(M.specularColorMapUv),S.push(M.specularIntensityMapUv),S.push(M.transmissionMapUv),S.push(M.thicknessMapUv),S.push(M.combine),S.push(M.fogExp2),S.push(M.sizeAttenuation),S.push(M.morphTargetsCount),S.push(M.morphAttributeCount),S.push(M.numDirLights),S.push(M.numPointLights),S.push(M.numSpotLights),S.push(M.numSpotLightMaps),S.push(M.numHemiLights),S.push(M.numRectAreaLights),S.push(M.numDirLightShadows),S.push(M.numPointLightShadows),S.push(M.numSpotLightShadows),S.push(M.numSpotLightShadowsWithMaps),S.push(M.numLightProbes),S.push(M.shadowMapType),S.push(M.toneMapping),S.push(M.numClippingPlanes),S.push(M.numClipIntersection),S.push(M.depthPacking)}function E(S,M){o.disableAll(),M.supportsVertexTextures&&o.enable(0),M.instancing&&o.enable(1),M.instancingColor&&o.enable(2),M.instancingMorph&&o.enable(3),M.matcap&&o.enable(4),M.envMap&&o.enable(5),M.normalMapObjectSpace&&o.enable(6),M.normalMapTangentSpace&&o.enable(7),M.clearcoat&&o.enable(8),M.iridescence&&o.enable(9),M.alphaTest&&o.enable(10),M.vertexColors&&o.enable(11),M.vertexAlphas&&o.enable(12),M.vertexUv1s&&o.enable(13),M.vertexUv2s&&o.enable(14),M.vertexUv3s&&o.enable(15),M.vertexTangents&&o.enable(16),M.anisotropy&&o.enable(17),M.alphaHash&&o.enable(18),M.batching&&o.enable(19),M.dispersion&&o.enable(20),M.batchingColor&&o.enable(21),S.push(o.mask),o.disableAll(),M.fog&&o.enable(0),M.useFog&&o.enable(1),M.flatShading&&o.enable(2),M.logarithmicDepthBuffer&&o.enable(3),M.reverseDepthBuffer&&o.enable(4),M.skinning&&o.enable(5),M.morphTargets&&o.enable(6),M.morphNormals&&o.enable(7),M.morphColors&&o.enable(8),M.premultipliedAlpha&&o.enable(9),M.shadowMapEnabled&&o.enable(10),M.doubleSided&&o.enable(11),M.flipSided&&o.enable(12),M.useDepthPacking&&o.enable(13),M.dithering&&o.enable(14),M.transmission&&o.enable(15),M.sheen&&o.enable(16),M.opaque&&o.enable(17),M.pointsUvs&&o.enable(18),M.decodeVideoTexture&&o.enable(19),M.decodeVideoTextureEmissive&&o.enable(20),M.alphaToCoverage&&o.enable(21),S.push(o.mask)}function y(S){const M=g[S.type];let A;if(M){const W=mn[M];A=Tr.clone(W.uniforms)}else A=S.uniforms;return A}function D(S,M){let A;for(let W=0,k=h.length;W0?n.push(f):u.transparent===!0?s.push(f):e.push(f)}function l(d,p,u,g,_,m){const f=a(d,p,u,g,_,m);u.transmission>0?n.unshift(f):u.transparent===!0?s.unshift(f):e.unshift(f)}function c(d,p){e.length>1&&e.sort(d||zm),n.length>1&&n.sort(p||zl),s.length>1&&s.sort(p||zl)}function h(){for(let d=t,p=i.length;d=r.length?(a=new kl,r.push(a)):a=r[s],a}function e(){i=new WeakMap}return{get:t,dispose:e}}function Hm(){const i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new P,color:new ot};break;case"SpotLight":e={position:new P,direction:new P,color:new ot,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new P,color:new ot,distance:0,decay:0};break;case"HemisphereLight":e={direction:new P,skyColor:new ot,groundColor:new ot};break;case"RectAreaLight":e={color:new ot,position:new P,halfWidth:new P,halfHeight:new P};break}return i[t.id]=e,e}}}function Vm(){const i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new St};break;case"SpotLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new St};break;case"PointLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new St,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[t.id]=e,e}}}let Gm=0;function Wm(i,t){return(t.castShadow?2:0)-(i.castShadow?2:0)+(t.map?1:0)-(i.map?1:0)}function Xm(i){const t=new Hm,e=Vm(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new P);const s=new P,r=new ne,a=new ne;function o(c){let h=0,d=0,p=0;for(let S=0;S<9;S++)n.probe[S].set(0,0,0);let u=0,g=0,_=0,m=0,f=0,T=0,E=0,y=0,D=0,w=0,C=0;c.sort(Wm);for(let S=0,M=c.length;S0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ct.LTC_FLOAT_1,n.rectAreaLTC2=ct.LTC_FLOAT_2):(n.rectAreaLTC1=ct.LTC_HALF_1,n.rectAreaLTC2=ct.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=d,n.ambient[2]=p;const I=n.hash;(I.directionalLength!==u||I.pointLength!==g||I.spotLength!==_||I.rectAreaLength!==m||I.hemiLength!==f||I.numDirectionalShadows!==T||I.numPointShadows!==E||I.numSpotShadows!==y||I.numSpotMaps!==D||I.numLightProbes!==C)&&(n.directional.length=u,n.spot.length=_,n.rectArea.length=m,n.point.length=g,n.hemi.length=f,n.directionalShadow.length=T,n.directionalShadowMap.length=T,n.pointShadow.length=E,n.pointShadowMap.length=E,n.spotShadow.length=y,n.spotShadowMap.length=y,n.directionalShadowMatrix.length=T,n.pointShadowMatrix.length=E,n.spotLightMatrix.length=y+D-w,n.spotLightMap.length=D,n.numSpotLightShadowsWithMaps=w,n.numLightProbes=C,I.directionalLength=u,I.pointLength=g,I.spotLength=_,I.rectAreaLength=m,I.hemiLength=f,I.numDirectionalShadows=T,I.numPointShadows=E,I.numSpotShadows=y,I.numSpotMaps=D,I.numLightProbes=C,n.version=Gm++)}function l(c,h){let d=0,p=0,u=0,g=0,_=0;const m=h.matrixWorldInverse;for(let f=0,T=c.length;f=a.length?(o=new Hl(i),a.push(o)):o=a[r],o}function n(){t=new WeakMap}return{get:e,dispose:n}}const qm=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,jm=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +#include +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( squared_mean - mean * mean ); + gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); +}`;function Zm(i,t,e){let n=new Ao;const s=new St,r=new St,a=new oe,o=new gu({depthPacking:wh}),l=new _u,c={},h=e.maxTextureSize,d={[Yn]:Xe,[Xe]:Yn,[gn]:gn},p=new He({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new St},radius:{value:4}},vertexShader:qm,fragmentShader:jm}),u=p.clone();u.defines.HORIZONTAL_PASS=1;const g=new ge;g.setAttribute("position",new he(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new be(g,p),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ql;let f=this.type;this.render=function(w,C,I){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||w.length===0)return;const S=i.getRenderTarget(),M=i.getActiveCubeFace(),A=i.getActiveMipmapLevel(),W=i.state;W.setBlending(Cn),W.buffers.color.setClear(1,1,1,1),W.buffers.depth.setTest(!0),W.setScissorTest(!1);const k=f!==An&&this.type===An,q=f===An&&this.type!==An;for(let Q=0,X=w.length;Qh||s.y>h)&&(s.x>h&&(r.x=Math.floor(h/st.x),s.x=r.x*st.x,H.mapSize.x=r.x),s.y>h&&(r.y=Math.floor(h/st.y),s.y=r.y*st.y,H.mapSize.y=r.y)),H.map===null||k===!0||q===!0){const Et=this.type!==An?{minFilter:Je,magFilter:Je}:{};H.map!==null&&H.map.dispose(),H.map=new fn(s.x,s.y,Et),H.map.texture.name=tt.name+".shadowMap",H.camera.updateProjectionMatrix()}i.setRenderTarget(H.map),i.clear();const gt=H.getViewportCount();for(let Et=0;Et0||C.map&&C.alphaTest>0){const W=M.uuid,k=C.uuid;let q=c[W];q===void 0&&(q={},c[W]=q);let Q=q[k];Q===void 0&&(Q=M.clone(),q[k]=Q,C.addEventListener("dispose",D)),M=Q}if(M.visible=C.visible,M.wireframe=C.wireframe,S===An?M.side=C.shadowSide!==null?C.shadowSide:C.side:M.side=C.shadowSide!==null?C.shadowSide:d[C.side],M.alphaMap=C.alphaMap,M.alphaTest=C.alphaTest,M.map=C.map,M.clipShadows=C.clipShadows,M.clippingPlanes=C.clippingPlanes,M.clipIntersection=C.clipIntersection,M.displacementMap=C.displacementMap,M.displacementScale=C.displacementScale,M.displacementBias=C.displacementBias,M.wireframeLinewidth=C.wireframeLinewidth,M.linewidth=C.linewidth,I.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const W=i.properties.get(M);W.light=I}return M}function y(w,C,I,S,M){if(w.visible===!1)return;if(w.layers.test(C.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&M===An)&&(!w.frustumCulled||n.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(I.matrixWorldInverse,w.matrixWorld);const k=t.update(w),q=w.material;if(Array.isArray(q)){const Q=k.groups;for(let X=0,tt=Q.length;X=1):H.indexOf("OpenGL ES")!==-1&&(tt=parseFloat(/^OpenGL ES (\d)/.exec(H)[1]),X=tt>=2);let st=null,gt={};const Et=i.getParameter(i.SCISSOR_BOX),Ft=i.getParameter(i.VIEWPORT),Xt=new oe().fromArray(Et),Y=new oe().fromArray(Ft);function nt(L,rt,G,$){const ft=new Uint8Array(4),ut=i.createTexture();i.bindTexture(L,ut),i.texParameteri(L,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(L,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Ot=0;Ot"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new St,h=new WeakMap;let d;const p=new WeakMap;let u=!1;try{u=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(b,v){return u?new OffscreenCanvas(b,v):br("canvas")}function _(b,v,F){let K=1;const J=Rt(b);if((J.width>F||J.height>F)&&(K=F/Math.max(J.width,J.height)),K<1)if(typeof HTMLImageElement<"u"&&b instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&b instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&b instanceof ImageBitmap||typeof VideoFrame<"u"&&b instanceof VideoFrame){const j=Math.floor(K*J.width),Tt=Math.floor(K*J.height);d===void 0&&(d=g(j,Tt));const dt=v?g(j,Tt):d;return dt.width=j,dt.height=Tt,dt.getContext("2d").drawImage(b,0,0,j,Tt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+J.width+"x"+J.height+") to ("+j+"x"+Tt+")."),dt}else return"data"in b&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+J.width+"x"+J.height+")."),b;return b}function m(b){return b.generateMipmaps}function f(b){i.generateMipmap(b)}function T(b){return b.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:b.isWebGL3DRenderTarget?i.TEXTURE_3D:b.isWebGLArrayRenderTarget||b.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function E(b,v,F,K,J=!1){if(b!==null){if(i[b]!==void 0)return i[b];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+b+"'")}let j=v;if(v===i.RED&&(F===i.FLOAT&&(j=i.R32F),F===i.HALF_FLOAT&&(j=i.R16F),F===i.UNSIGNED_BYTE&&(j=i.R8)),v===i.RED_INTEGER&&(F===i.UNSIGNED_BYTE&&(j=i.R8UI),F===i.UNSIGNED_SHORT&&(j=i.R16UI),F===i.UNSIGNED_INT&&(j=i.R32UI),F===i.BYTE&&(j=i.R8I),F===i.SHORT&&(j=i.R16I),F===i.INT&&(j=i.R32I)),v===i.RG&&(F===i.FLOAT&&(j=i.RG32F),F===i.HALF_FLOAT&&(j=i.RG16F),F===i.UNSIGNED_BYTE&&(j=i.RG8)),v===i.RG_INTEGER&&(F===i.UNSIGNED_BYTE&&(j=i.RG8UI),F===i.UNSIGNED_SHORT&&(j=i.RG16UI),F===i.UNSIGNED_INT&&(j=i.RG32UI),F===i.BYTE&&(j=i.RG8I),F===i.SHORT&&(j=i.RG16I),F===i.INT&&(j=i.RG32I)),v===i.RGB_INTEGER&&(F===i.UNSIGNED_BYTE&&(j=i.RGB8UI),F===i.UNSIGNED_SHORT&&(j=i.RGB16UI),F===i.UNSIGNED_INT&&(j=i.RGB32UI),F===i.BYTE&&(j=i.RGB8I),F===i.SHORT&&(j=i.RGB16I),F===i.INT&&(j=i.RGB32I)),v===i.RGBA_INTEGER&&(F===i.UNSIGNED_BYTE&&(j=i.RGBA8UI),F===i.UNSIGNED_SHORT&&(j=i.RGBA16UI),F===i.UNSIGNED_INT&&(j=i.RGBA32UI),F===i.BYTE&&(j=i.RGBA8I),F===i.SHORT&&(j=i.RGBA16I),F===i.INT&&(j=i.RGBA32I)),v===i.RGB&&F===i.UNSIGNED_INT_5_9_9_9_REV&&(j=i.RGB9_E5),v===i.RGBA){const Tt=J?yr:Qt.getTransfer(K);F===i.FLOAT&&(j=i.RGBA32F),F===i.HALF_FLOAT&&(j=i.RGBA16F),F===i.UNSIGNED_BYTE&&(j=Tt===se?i.SRGB8_ALPHA8:i.RGBA8),F===i.UNSIGNED_SHORT_4_4_4_4&&(j=i.RGBA4),F===i.UNSIGNED_SHORT_5_5_5_1&&(j=i.RGB5_A1)}return(j===i.R16F||j===i.R32F||j===i.RG16F||j===i.RG32F||j===i.RGBA16F||j===i.RGBA32F)&&t.get("EXT_color_buffer_float"),j}function y(b,v){let F;return b?v===null||v===li||v===Ki?F=i.DEPTH24_STENCIL8:v===xn?F=i.DEPTH32F_STENCIL8:v===Ms&&(F=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):v===null||v===li||v===Ki?F=i.DEPTH_COMPONENT24:v===xn?F=i.DEPTH_COMPONENT32F:v===Ms&&(F=i.DEPTH_COMPONENT16),F}function D(b,v){return m(b)===!0||b.isFramebufferTexture&&b.minFilter!==Je&&b.minFilter!==vn?Math.log2(Math.max(v.width,v.height))+1:b.mipmaps!==void 0&&b.mipmaps.length>0?b.mipmaps.length:b.isCompressedTexture&&Array.isArray(b.image)?v.mipmaps.length:1}function w(b){const v=b.target;v.removeEventListener("dispose",w),I(v),v.isVideoTexture&&h.delete(v)}function C(b){const v=b.target;v.removeEventListener("dispose",C),M(v)}function I(b){const v=n.get(b);if(v.__webglInit===void 0)return;const F=b.source,K=p.get(F);if(K){const J=K[v.__cacheKey];J.usedTimes--,J.usedTimes===0&&S(b),Object.keys(K).length===0&&p.delete(F)}n.remove(b)}function S(b){const v=n.get(b);i.deleteTexture(v.__webglTexture);const F=b.source,K=p.get(F);delete K[v.__cacheKey],a.memory.textures--}function M(b){const v=n.get(b);if(b.depthTexture&&(b.depthTexture.dispose(),n.remove(b.depthTexture)),b.isWebGLCubeRenderTarget)for(let K=0;K<6;K++){if(Array.isArray(v.__webglFramebuffer[K]))for(let J=0;J=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+b+" texture units while this GPU supports only "+s.maxTextures),A+=1,b}function q(b){const v=[];return v.push(b.wrapS),v.push(b.wrapT),v.push(b.wrapR||0),v.push(b.magFilter),v.push(b.minFilter),v.push(b.anisotropy),v.push(b.internalFormat),v.push(b.format),v.push(b.type),v.push(b.generateMipmaps),v.push(b.premultiplyAlpha),v.push(b.flipY),v.push(b.unpackAlignment),v.push(b.colorSpace),v.join()}function Q(b,v){const F=n.get(b);if(b.isVideoTexture&&At(b),b.isRenderTargetTexture===!1&&b.version>0&&F.__version!==b.version){const K=b.image;if(K===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(K.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Y(F,b,v);return}}e.bindTexture(i.TEXTURE_2D,F.__webglTexture,i.TEXTURE0+v)}function X(b,v){const F=n.get(b);if(b.version>0&&F.__version!==b.version){Y(F,b,v);return}e.bindTexture(i.TEXTURE_2D_ARRAY,F.__webglTexture,i.TEXTURE0+v)}function tt(b,v){const F=n.get(b);if(b.version>0&&F.__version!==b.version){Y(F,b,v);return}e.bindTexture(i.TEXTURE_3D,F.__webglTexture,i.TEXTURE0+v)}function H(b,v){const F=n.get(b);if(b.version>0&&F.__version!==b.version){nt(F,b,v);return}e.bindTexture(i.TEXTURE_CUBE_MAP,F.__webglTexture,i.TEXTURE0+v)}const st={[Ua]:i.REPEAT,[ri]:i.CLAMP_TO_EDGE,[Ia]:i.MIRRORED_REPEAT},gt={[Je]:i.NEAREST,[bh]:i.NEAREST_MIPMAP_NEAREST,[Is]:i.NEAREST_MIPMAP_LINEAR,[vn]:i.LINEAR,[Br]:i.LINEAR_MIPMAP_NEAREST,[ai]:i.LINEAR_MIPMAP_LINEAR},Et={[Rh]:i.NEVER,[Ih]:i.ALWAYS,[Ch]:i.LESS,[fc]:i.LEQUAL,[Ph]:i.EQUAL,[Uh]:i.GEQUAL,[Dh]:i.GREATER,[Lh]:i.NOTEQUAL};function Ft(b,v){if(v.type===xn&&t.has("OES_texture_float_linear")===!1&&(v.magFilter===vn||v.magFilter===Br||v.magFilter===Is||v.magFilter===ai||v.minFilter===vn||v.minFilter===Br||v.minFilter===Is||v.minFilter===ai)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(b,i.TEXTURE_WRAP_S,st[v.wrapS]),i.texParameteri(b,i.TEXTURE_WRAP_T,st[v.wrapT]),(b===i.TEXTURE_3D||b===i.TEXTURE_2D_ARRAY)&&i.texParameteri(b,i.TEXTURE_WRAP_R,st[v.wrapR]),i.texParameteri(b,i.TEXTURE_MAG_FILTER,gt[v.magFilter]),i.texParameteri(b,i.TEXTURE_MIN_FILTER,gt[v.minFilter]),v.compareFunction&&(i.texParameteri(b,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(b,i.TEXTURE_COMPARE_FUNC,Et[v.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(v.magFilter===Je||v.minFilter!==Is&&v.minFilter!==ai||v.type===xn&&t.has("OES_texture_float_linear")===!1)return;if(v.anisotropy>1||n.get(v).__currentAnisotropy){const F=t.get("EXT_texture_filter_anisotropic");i.texParameterf(b,F.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,s.getMaxAnisotropy())),n.get(v).__currentAnisotropy=v.anisotropy}}}function Xt(b,v){let F=!1;b.__webglInit===void 0&&(b.__webglInit=!0,v.addEventListener("dispose",w));const K=v.source;let J=p.get(K);J===void 0&&(J={},p.set(K,J));const j=q(v);if(j!==b.__cacheKey){J[j]===void 0&&(J[j]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,F=!0),J[j].usedTimes++;const Tt=J[b.__cacheKey];Tt!==void 0&&(J[b.__cacheKey].usedTimes--,Tt.usedTimes===0&&S(v)),b.__cacheKey=j,b.__webglTexture=J[j].texture}return F}function Y(b,v,F){let K=i.TEXTURE_2D;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&(K=i.TEXTURE_2D_ARRAY),v.isData3DTexture&&(K=i.TEXTURE_3D);const J=Xt(b,v),j=v.source;e.bindTexture(K,b.__webglTexture,i.TEXTURE0+F);const Tt=n.get(j);if(j.version!==Tt.__version||J===!0){e.activeTexture(i.TEXTURE0+F);const dt=Qt.getPrimaries(Qt.workingColorSpace),V=v.colorSpace===Vn?null:Qt.getPrimaries(v.colorSpace),at=v.colorSpace===Vn||dt===V?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,at);let Z=_(v.image,!1,s.maxTextureSize);Z=le(v,Z);const it=r.convert(v.format,v.colorSpace),pt=r.convert(v.type);let wt=E(v.internalFormat,it,pt,v.colorSpace,v.isVideoTexture);Ft(K,v);let ht;const Bt=v.mipmaps,Ut=v.isVideoTexture!==!0,Zt=Tt.__version===void 0||J===!0,L=j.dataReady,rt=D(v,Z);if(v.isDepthTexture)wt=y(v.format===$i,v.type),Zt&&(Ut?e.texStorage2D(i.TEXTURE_2D,1,wt,Z.width,Z.height):e.texImage2D(i.TEXTURE_2D,0,wt,Z.width,Z.height,0,it,pt,null));else if(v.isDataTexture)if(Bt.length>0){Ut&&Zt&&e.texStorage2D(i.TEXTURE_2D,rt,wt,Bt[0].width,Bt[0].height);for(let G=0,$=Bt.length;G<$;G++)ht=Bt[G],Ut?L&&e.texSubImage2D(i.TEXTURE_2D,G,0,0,ht.width,ht.height,it,pt,ht.data):e.texImage2D(i.TEXTURE_2D,G,wt,ht.width,ht.height,0,it,pt,ht.data);v.generateMipmaps=!1}else Ut?(Zt&&e.texStorage2D(i.TEXTURE_2D,rt,wt,Z.width,Z.height),L&&e.texSubImage2D(i.TEXTURE_2D,0,0,0,Z.width,Z.height,it,pt,Z.data)):e.texImage2D(i.TEXTURE_2D,0,wt,Z.width,Z.height,0,it,pt,Z.data);else if(v.isCompressedTexture)if(v.isCompressedArrayTexture){Ut&&Zt&&e.texStorage3D(i.TEXTURE_2D_ARRAY,rt,wt,Bt[0].width,Bt[0].height,Z.depth);for(let G=0,$=Bt.length;G<$;G++)if(ht=Bt[G],v.format!==dn)if(it!==null)if(Ut){if(L)if(v.layerUpdates.size>0){const ft=_l(ht.width,ht.height,v.format,v.type);for(const ut of v.layerUpdates){const Ot=ht.data.subarray(ut*ft/ht.data.BYTES_PER_ELEMENT,(ut+1)*ft/ht.data.BYTES_PER_ELEMENT);e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,G,0,0,ut,ht.width,ht.height,1,it,Ot)}v.clearLayerUpdates()}else e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,G,0,0,0,ht.width,ht.height,Z.depth,it,ht.data)}else e.compressedTexImage3D(i.TEXTURE_2D_ARRAY,G,wt,ht.width,ht.height,Z.depth,0,ht.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ut?L&&e.texSubImage3D(i.TEXTURE_2D_ARRAY,G,0,0,0,ht.width,ht.height,Z.depth,it,pt,ht.data):e.texImage3D(i.TEXTURE_2D_ARRAY,G,wt,ht.width,ht.height,Z.depth,0,it,pt,ht.data)}else{Ut&&Zt&&e.texStorage2D(i.TEXTURE_2D,rt,wt,Bt[0].width,Bt[0].height);for(let G=0,$=Bt.length;G<$;G++)ht=Bt[G],v.format!==dn?it!==null?Ut?L&&e.compressedTexSubImage2D(i.TEXTURE_2D,G,0,0,ht.width,ht.height,it,ht.data):e.compressedTexImage2D(i.TEXTURE_2D,G,wt,ht.width,ht.height,0,ht.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ut?L&&e.texSubImage2D(i.TEXTURE_2D,G,0,0,ht.width,ht.height,it,pt,ht.data):e.texImage2D(i.TEXTURE_2D,G,wt,ht.width,ht.height,0,it,pt,ht.data)}else if(v.isDataArrayTexture)if(Ut){if(Zt&&e.texStorage3D(i.TEXTURE_2D_ARRAY,rt,wt,Z.width,Z.height,Z.depth),L)if(v.layerUpdates.size>0){const G=_l(Z.width,Z.height,v.format,v.type);for(const $ of v.layerUpdates){const ft=Z.data.subarray($*G/Z.data.BYTES_PER_ELEMENT,($+1)*G/Z.data.BYTES_PER_ELEMENT);e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,$,Z.width,Z.height,1,it,pt,ft)}v.clearLayerUpdates()}else e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Z.width,Z.height,Z.depth,it,pt,Z.data)}else e.texImage3D(i.TEXTURE_2D_ARRAY,0,wt,Z.width,Z.height,Z.depth,0,it,pt,Z.data);else if(v.isData3DTexture)Ut?(Zt&&e.texStorage3D(i.TEXTURE_3D,rt,wt,Z.width,Z.height,Z.depth),L&&e.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Z.width,Z.height,Z.depth,it,pt,Z.data)):e.texImage3D(i.TEXTURE_3D,0,wt,Z.width,Z.height,Z.depth,0,it,pt,Z.data);else if(v.isFramebufferTexture){if(Zt)if(Ut)e.texStorage2D(i.TEXTURE_2D,rt,wt,Z.width,Z.height);else{let G=Z.width,$=Z.height;for(let ft=0;ft>=1,$>>=1}}else if(Bt.length>0){if(Ut&&Zt){const G=Rt(Bt[0]);e.texStorage2D(i.TEXTURE_2D,rt,wt,G.width,G.height)}for(let G=0,$=Bt.length;G<$;G++)ht=Bt[G],Ut?L&&e.texSubImage2D(i.TEXTURE_2D,G,0,0,it,pt,ht):e.texImage2D(i.TEXTURE_2D,G,wt,it,pt,ht);v.generateMipmaps=!1}else if(Ut){if(Zt){const G=Rt(Z);e.texStorage2D(i.TEXTURE_2D,rt,wt,G.width,G.height)}L&&e.texSubImage2D(i.TEXTURE_2D,0,0,0,it,pt,Z)}else e.texImage2D(i.TEXTURE_2D,0,wt,it,pt,Z);m(v)&&f(K),Tt.__version=j.version,v.onUpdate&&v.onUpdate(v)}b.__version=v.version}function nt(b,v,F){if(v.image.length!==6)return;const K=Xt(b,v),J=v.source;e.bindTexture(i.TEXTURE_CUBE_MAP,b.__webglTexture,i.TEXTURE0+F);const j=n.get(J);if(J.version!==j.__version||K===!0){e.activeTexture(i.TEXTURE0+F);const Tt=Qt.getPrimaries(Qt.workingColorSpace),dt=v.colorSpace===Vn?null:Qt.getPrimaries(v.colorSpace),V=v.colorSpace===Vn||Tt===dt?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,V);const at=v.isCompressedTexture||v.image[0].isCompressedTexture,Z=v.image[0]&&v.image[0].isDataTexture,it=[];for(let $=0;$<6;$++)!at&&!Z?it[$]=_(v.image[$],!0,s.maxCubemapSize):it[$]=Z?v.image[$].image:v.image[$],it[$]=le(v,it[$]);const pt=it[0],wt=r.convert(v.format,v.colorSpace),ht=r.convert(v.type),Bt=E(v.internalFormat,wt,ht,v.colorSpace),Ut=v.isVideoTexture!==!0,Zt=j.__version===void 0||K===!0,L=J.dataReady;let rt=D(v,pt);Ft(i.TEXTURE_CUBE_MAP,v);let G;if(at){Ut&&Zt&&e.texStorage2D(i.TEXTURE_CUBE_MAP,rt,Bt,pt.width,pt.height);for(let $=0;$<6;$++){G=it[$].mipmaps;for(let ft=0;ft0&&rt++;const $=Rt(it[0]);e.texStorage2D(i.TEXTURE_CUBE_MAP,rt,Bt,$.width,$.height)}for(let $=0;$<6;$++)if(Z){Ut?L&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,0,0,it[$].width,it[$].height,wt,ht,it[$].data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,Bt,it[$].width,it[$].height,0,wt,ht,it[$].data);for(let ft=0;ft>j),pt=Math.max(1,v.height>>j);J===i.TEXTURE_3D||J===i.TEXTURE_2D_ARRAY?e.texImage3D(J,j,V,it,pt,v.depth,0,Tt,dt,null):e.texImage2D(J,j,V,it,pt,0,Tt,dt,null)}e.bindFramebuffer(i.FRAMEBUFFER,b),jt(v)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,K,J,Z.__webglTexture,0,qt(v)):(J===i.TEXTURE_2D||J>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&J<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,K,J,Z.__webglTexture,j),e.bindFramebuffer(i.FRAMEBUFFER,null)}function lt(b,v,F){if(i.bindRenderbuffer(i.RENDERBUFFER,b),v.depthBuffer){const K=v.depthTexture,J=K&&K.isDepthTexture?K.type:null,j=y(v.stencilBuffer,J),Tt=v.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,dt=qt(v);jt(v)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,dt,j,v.width,v.height):F?i.renderbufferStorageMultisample(i.RENDERBUFFER,dt,j,v.width,v.height):i.renderbufferStorage(i.RENDERBUFFER,j,v.width,v.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Tt,i.RENDERBUFFER,b)}else{const K=v.textures;for(let J=0;J{delete v.__boundDepthTexture,delete v.__depthDisposeCallback,K.removeEventListener("dispose",J)};K.addEventListener("dispose",J),v.__depthDisposeCallback=J}v.__boundDepthTexture=K}if(b.depthTexture&&!v.__autoAllocateDepthBuffer){if(F)throw new Error("target.depthTexture not supported in Cube render targets");Ct(v.__webglFramebuffer,b)}else if(F){v.__webglDepthbuffer=[];for(let K=0;K<6;K++)if(e.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer[K]),v.__webglDepthbuffer[K]===void 0)v.__webglDepthbuffer[K]=i.createRenderbuffer(),lt(v.__webglDepthbuffer[K],b,!1);else{const J=b.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,j=v.__webglDepthbuffer[K];i.bindRenderbuffer(i.RENDERBUFFER,j),i.framebufferRenderbuffer(i.FRAMEBUFFER,J,i.RENDERBUFFER,j)}}else if(e.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer),v.__webglDepthbuffer===void 0)v.__webglDepthbuffer=i.createRenderbuffer(),lt(v.__webglDepthbuffer,b,!1);else{const K=b.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,J=v.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,J),i.framebufferRenderbuffer(i.FRAMEBUFFER,K,i.RENDERBUFFER,J)}e.bindFramebuffer(i.FRAMEBUFFER,null)}function Vt(b,v,F){const K=n.get(b);v!==void 0&&_t(K.__webglFramebuffer,b,b.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),F!==void 0&&Lt(b)}function ie(b){const v=b.texture,F=n.get(b),K=n.get(v);b.addEventListener("dispose",C);const J=b.textures,j=b.isWebGLCubeRenderTarget===!0,Tt=J.length>1;if(Tt||(K.__webglTexture===void 0&&(K.__webglTexture=i.createTexture()),K.__version=v.version,a.memory.textures++),j){F.__webglFramebuffer=[];for(let dt=0;dt<6;dt++)if(v.mipmaps&&v.mipmaps.length>0){F.__webglFramebuffer[dt]=[];for(let V=0;V0){F.__webglFramebuffer=[];for(let dt=0;dt0&&jt(b)===!1){F.__webglMultisampledFramebuffer=i.createFramebuffer(),F.__webglColorRenderbuffer=[],e.bindFramebuffer(i.FRAMEBUFFER,F.__webglMultisampledFramebuffer);for(let dt=0;dt0)for(let V=0;V0)for(let V=0;V0){if(jt(b)===!1){const v=b.textures,F=b.width,K=b.height;let J=i.COLOR_BUFFER_BIT;const j=b.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Tt=n.get(b),dt=v.length>1;if(dt)for(let V=0;V0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function At(b){const v=a.render.frame;h.get(b)!==v&&(h.set(b,v),b.update())}function le(b,v){const F=b.colorSpace,K=b.format,J=b.type;return b.isCompressedTexture===!0||b.isVideoTexture===!0||F!==Ji&&F!==Vn&&(Qt.getTransfer(F)===se?(K!==dn||J!==Ln)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",F)),v}function Rt(b){return typeof HTMLImageElement<"u"&&b instanceof HTMLImageElement?(c.width=b.naturalWidth||b.width,c.height=b.naturalHeight||b.height):typeof VideoFrame<"u"&&b instanceof VideoFrame?(c.width=b.displayWidth,c.height=b.displayHeight):(c.width=b.width,c.height=b.height),c}this.allocateTextureUnit=k,this.resetTextureUnits=W,this.setTexture2D=Q,this.setTexture2DArray=X,this.setTexture3D=tt,this.setTextureCube=H,this.rebindTextures=Vt,this.setupRenderTarget=ie,this.updateRenderTargetMipmap=Wt,this.updateMultisampleRenderTarget=ye,this.setupDepthRenderbuffer=Lt,this.setupFrameBufferTexture=_t,this.useMultisampledRTT=jt}function Qm(i,t){function e(n,s=Vn){let r;const a=Qt.getTransfer(s);if(n===Ln)return i.UNSIGNED_BYTE;if(n===Mo)return i.UNSIGNED_SHORT_4_4_4_4;if(n===So)return i.UNSIGNED_SHORT_5_5_5_1;if(n===rc)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===ic)return i.BYTE;if(n===sc)return i.SHORT;if(n===Ms)return i.UNSIGNED_SHORT;if(n===xo)return i.INT;if(n===li)return i.UNSIGNED_INT;if(n===xn)return i.FLOAT;if(n===Pn)return i.HALF_FLOAT;if(n===ac)return i.ALPHA;if(n===oc)return i.RGB;if(n===dn)return i.RGBA;if(n===lc)return i.LUMINANCE;if(n===cc)return i.LUMINANCE_ALPHA;if(n===Gi)return i.DEPTH_COMPONENT;if(n===$i)return i.DEPTH_STENCIL;if(n===yo)return i.RED;if(n===Eo)return i.RED_INTEGER;if(n===hc)return i.RG;if(n===bo)return i.RG_INTEGER;if(n===To)return i.RGBA_INTEGER;if(n===ur||n===dr||n===fr||n===pr)if(a===se)if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===ur)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===dr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===fr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===pr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=t.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===ur)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===dr)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===fr)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===pr)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Na||n===Fa||n===Oa||n===Ba)if(r=t.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===Na)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Fa)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Oa)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Ba)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===za||n===ka||n===Ha)if(r=t.get("WEBGL_compressed_texture_etc"),r!==null){if(n===za||n===ka)return a===se?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Ha)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Va||n===Ga||n===Wa||n===Xa||n===Ya||n===qa||n===ja||n===Za||n===Ka||n===$a||n===Ja||n===Qa||n===to||n===eo)if(r=t.get("WEBGL_compressed_texture_astc"),r!==null){if(n===Va)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ga)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Wa)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Xa)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Ya)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===qa)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===ja)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Za)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Ka)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===$a)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Ja)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Qa)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===to)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===eo)return a===se?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===mr||n===no||n===io)if(r=t.get("EXT_texture_compression_bptc"),r!==null){if(n===mr)return a===se?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===no)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===io)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===uc||n===so||n===ro||n===ao)if(r=t.get("EXT_texture_compression_rgtc"),r!==null){if(n===mr)return r.COMPRESSED_RED_RGTC1_EXT;if(n===so)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===ro)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===ao)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ki?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:e}}const tg={type:"move"};class ga{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new zi,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new zi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new P,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new P),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new zi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new P,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new P),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,n){let s=null,r=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(c&&t.hand){a=!0;for(const _ of t.hand.values()){const m=e.getJointPose(_,n),f=this._getHandJoint(c,_);m!==null&&(f.matrix.fromArray(m.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=m.radius),f.visible=m!==null}const h=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],p=h.position.distanceTo(d.position),u=.02,g=.005;c.inputState.pinching&&p>u+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&p<=u-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else l!==null&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(s=e.getPose(t.targetRaySpace,n),s===null&&r!==null&&(s=r),s!==null&&(o.matrix.fromArray(s.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,s.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(s.linearVelocity)):o.hasLinearVelocity=!1,s.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(s.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(tg)))}return o!==null&&(o.visible=s!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){const n=new zi;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}const eg=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,ng=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class ig{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,n){if(this.texture===null){const s=new Pe,r=t.properties.get(s);r.__webglTexture=e.texture,(e.depthNear!==n.depthNear||e.depthFar!==n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=s}}getMesh(t){if(this.texture!==null&&this.mesh===null){const e=t.cameras[0].viewport,n=new He({vertexShader:eg,fragmentShader:ng,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new be(new ws(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class sg extends hi{constructor(t,e){super();const n=this;let s=null,r=1,a=null,o="local-floor",l=1,c=null,h=null,d=null,p=null,u=null,g=null;const _=new ig,m=e.getContextAttributes();let f=null,T=null;const E=[],y=[],D=new St;let w=null;const C=new $e;C.viewport=new oe;const I=new $e;I.viewport=new oe;const S=[C,I],M=new Su;let A=null,W=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let nt=E[Y];return nt===void 0&&(nt=new ga,E[Y]=nt),nt.getTargetRaySpace()},this.getControllerGrip=function(Y){let nt=E[Y];return nt===void 0&&(nt=new ga,E[Y]=nt),nt.getGripSpace()},this.getHand=function(Y){let nt=E[Y];return nt===void 0&&(nt=new ga,E[Y]=nt),nt.getHandSpace()};function k(Y){const nt=y.indexOf(Y.inputSource);if(nt===-1)return;const _t=E[nt];_t!==void 0&&(_t.update(Y.inputSource,Y.frame,c||a),_t.dispatchEvent({type:Y.type,data:Y.inputSource}))}function q(){s.removeEventListener("select",k),s.removeEventListener("selectstart",k),s.removeEventListener("selectend",k),s.removeEventListener("squeeze",k),s.removeEventListener("squeezestart",k),s.removeEventListener("squeezeend",k),s.removeEventListener("end",q),s.removeEventListener("inputsourceschange",Q);for(let Y=0;Y=0&&(y[lt]=null,E[lt].disconnect(_t))}for(let nt=0;nt=y.length){y.push(_t),lt=Lt;break}else if(y[Lt]===null){y[Lt]=_t,lt=Lt;break}if(lt===-1)break}const Ct=E[lt];Ct&&Ct.connect(_t)}}const X=new P,tt=new P;function H(Y,nt,_t){X.setFromMatrixPosition(nt.matrixWorld),tt.setFromMatrixPosition(_t.matrixWorld);const lt=X.distanceTo(tt),Ct=nt.projectionMatrix.elements,Lt=_t.projectionMatrix.elements,Vt=Ct[14]/(Ct[10]-1),ie=Ct[14]/(Ct[10]+1),Wt=(Ct[9]+1)/Ct[5],ue=(Ct[9]-1)/Ct[5],R=(Ct[8]-1)/Ct[0],ye=(Lt[8]+1)/Lt[0],qt=Vt*R,jt=Vt*ye,At=lt/(-R+ye),le=At*-R;if(nt.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(le),Y.translateZ(At),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert(),Ct[10]===-1)Y.projectionMatrix.copy(nt.projectionMatrix),Y.projectionMatrixInverse.copy(nt.projectionMatrixInverse);else{const Rt=Vt+At,b=ie+At,v=qt-le,F=jt+(lt-le),K=Wt*ie/b*Rt,J=ue*ie/b*Rt;Y.projectionMatrix.makePerspective(v,F,K,J,Rt,b),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}}function st(Y,nt){nt===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(nt.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(s===null)return;let nt=Y.near,_t=Y.far;_.texture!==null&&(_.depthNear>0&&(nt=_.depthNear),_.depthFar>0&&(_t=_.depthFar)),M.near=I.near=C.near=nt,M.far=I.far=C.far=_t,(A!==M.near||W!==M.far)&&(s.updateRenderState({depthNear:M.near,depthFar:M.far}),A=M.near,W=M.far),C.layers.mask=Y.layers.mask|2,I.layers.mask=Y.layers.mask|4,M.layers.mask=C.layers.mask|I.layers.mask;const lt=Y.parent,Ct=M.cameras;st(M,lt);for(let Lt=0;Lt0&&(m.alphaTest.value=f.alphaTest);const T=t.get(f),E=T.envMap,y=T.envMapRotation;E&&(m.envMap.value=E,ti.copy(y),ti.x*=-1,ti.y*=-1,ti.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(ti.y*=-1,ti.z*=-1),m.envMapRotation.value.setFromMatrix4(rg.makeRotationFromEuler(ti)),m.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap&&(m.lightMap.value=f.lightMap,m.lightMapIntensity.value=f.lightMapIntensity,e(f.lightMap,m.lightMapTransform)),f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity,e(f.aoMap,m.aoMapTransform))}function a(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,f.map&&(m.map.value=f.map,e(f.map,m.mapTransform))}function o(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function l(m,f,T,E){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*T,m.scale.value=E*.5,f.map&&(m.map.value=f.map,e(f.map,m.uvTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,e(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function c(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map,e(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,e(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function h(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function d(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function p(m,f){m.metalness.value=f.metalness,f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap,e(f.metalnessMap,m.metalnessMapTransform)),m.roughness.value=f.roughness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap,e(f.roughnessMap,m.roughnessMapTransform)),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function u(m,f,T){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap,e(f.sheenColorMap,m.sheenColorMapTransform)),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap,e(f.sheenRoughnessMap,m.sheenRoughnessMapTransform))),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap,e(f.clearcoatMap,m.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,e(f.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(m.clearcoatNormalMap.value=f.clearcoatNormalMap,e(f.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Xe&&m.clearcoatNormalScale.value.negate())),f.dispersion>0&&(m.dispersion.value=f.dispersion),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap,e(f.iridescenceMap,m.iridescenceMapTransform)),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap,e(f.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=T.texture,m.transmissionSamplerSize.value.set(T.width,T.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap,e(f.transmissionMap,m.transmissionMapTransform)),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap,e(f.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(m.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(m.anisotropyMap.value=f.anisotropyMap,e(f.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap,e(f.specularColorMap,m.specularColorMapTransform)),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap,e(f.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,f){f.matcap&&(m.matcap.value=f.matcap)}function _(m,f){const T=t.get(f).light;m.referencePosition.value.setFromMatrixPosition(T.matrixWorld),m.nearDistance.value=T.shadow.camera.near,m.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:s}}function og(i,t,e,n){let s={},r={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(T,E){const y=E.program;n.uniformBlockBinding(T,y)}function c(T,E){let y=s[T.id];y===void 0&&(g(T),y=h(T),s[T.id]=y,T.addEventListener("dispose",m));const D=E.program;n.updateUBOMapping(T,D);const w=t.render.frame;r[T.id]!==w&&(p(T),r[T.id]=w)}function h(T){const E=d();T.__bindingPointIndex=E;const y=i.createBuffer(),D=T.__size,w=T.usage;return i.bindBuffer(i.UNIFORM_BUFFER,y),i.bufferData(i.UNIFORM_BUFFER,D,w),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,E,y),y}function d(){for(let T=0;T0&&(y+=D-w),T.__size=y,T.__cache={},this}function _(T){const E={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(E.boundary=4,E.storage=4):T.isVector2?(E.boundary=8,E.storage=8):T.isVector3||T.isColor?(E.boundary=16,E.storage=12):T.isVector4?(E.boundary=16,E.storage=16):T.isMatrix3?(E.boundary=48,E.storage=48):T.isMatrix4?(E.boundary=64,E.storage=64):T.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",T),E}function m(T){const E=T.target;E.removeEventListener("dispose",m);const y=a.indexOf(E.__bindingPointIndex);a.splice(y,1),i.deleteBuffer(s[E.id]),delete s[E.id],delete r[E.id]}function f(){for(const T in s)i.deleteBuffer(s[T]);a=[],s={},r={}}return{bind:l,update:c,dispose:f}}class lg{constructor(t={}){const{canvas:e=Oh(),context:n=null,depth:s=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1,reverseDepthBuffer:p=!1}=t;this.isWebGLRenderer=!0;let u;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");u=n.getContextAttributes().alpha}else u=a;const g=new Uint32Array(4),_=new Int32Array(4);let m=null,f=null;const T=[],E=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=an,this.toneMapping=Wn,this.toneMappingExposure=1;const y=this;let D=!1,w=0,C=0,I=null,S=-1,M=null;const A=new oe,W=new oe;let k=null;const q=new ot(0);let Q=0,X=e.width,tt=e.height,H=1,st=null,gt=null;const Et=new oe(0,0,X,tt),Ft=new oe(0,0,X,tt);let Xt=!1;const Y=new Ao;let nt=!1,_t=!1;this.transmissionResolutionScale=1;const lt=new ne,Ct=new ne,Lt=new P,Vt=new oe,ie={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Wt=!1;function ue(){return I===null?H:1}let R=n;function ye(x,U){return e.getContext(x,U)}try{const x={alpha:!0,depth:s,stencil:r,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${vo}`),e.addEventListener("webglcontextlost",$,!1),e.addEventListener("webglcontextrestored",ft,!1),e.addEventListener("webglcontextcreationerror",ut,!1),R===null){const U="webgl2";if(R=ye(U,x),R===null)throw ye(U)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(x){throw console.error("THREE.WebGLRenderer: "+x.message),x}let qt,jt,At,le,Rt,b,v,F,K,J,j,Tt,dt,V,at,Z,it,pt,wt,ht,Bt,Ut,Zt,L;function rt(){qt=new _p(R),qt.init(),Ut=new Qm(R,qt),jt=new up(R,qt,t,Ut),At=new $m(R,qt),jt.reverseDepthBuffer&&p&&At.buffers.depth.setReversed(!0),le=new Mp(R),Rt=new Bm,b=new Jm(R,qt,At,Rt,jt,Ut,le),v=new fp(y),F=new gp(y),K=new wu(R),Zt=new cp(R,K),J=new vp(R,K,le,Zt),j=new yp(R,J,K,le),wt=new Sp(R,jt,b),Z=new dp(Rt),Tt=new Om(y,v,F,qt,jt,Zt,Z),dt=new ag(y,Rt),V=new km,at=new Ym(qt),pt=new lp(y,v,F,At,j,u,l),it=new Zm(y,j,jt),L=new og(R,le,jt,At),ht=new hp(R,qt,le),Bt=new xp(R,qt,le),le.programs=Tt.programs,y.capabilities=jt,y.extensions=qt,y.properties=Rt,y.renderLists=V,y.shadowMap=it,y.state=At,y.info=le}rt();const G=new sg(y,R);this.xr=G,this.getContext=function(){return R},this.getContextAttributes=function(){return R.getContextAttributes()},this.forceContextLoss=function(){const x=qt.get("WEBGL_lose_context");x&&x.loseContext()},this.forceContextRestore=function(){const x=qt.get("WEBGL_lose_context");x&&x.restoreContext()},this.getPixelRatio=function(){return H},this.setPixelRatio=function(x){x!==void 0&&(H=x,this.setSize(X,tt,!1))},this.getSize=function(x){return x.set(X,tt)},this.setSize=function(x,U,O=!0){if(G.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}X=x,tt=U,e.width=Math.floor(x*H),e.height=Math.floor(U*H),O===!0&&(e.style.width=x+"px",e.style.height=U+"px"),this.setViewport(0,0,x,U)},this.getDrawingBufferSize=function(x){return x.set(X*H,tt*H).floor()},this.setDrawingBufferSize=function(x,U,O){X=x,tt=U,H=O,e.width=Math.floor(x*O),e.height=Math.floor(U*O),this.setViewport(0,0,x,U)},this.getCurrentViewport=function(x){return x.copy(A)},this.getViewport=function(x){return x.copy(Et)},this.setViewport=function(x,U,O,z){x.isVector4?Et.set(x.x,x.y,x.z,x.w):Et.set(x,U,O,z),At.viewport(A.copy(Et).multiplyScalar(H).round())},this.getScissor=function(x){return x.copy(Ft)},this.setScissor=function(x,U,O,z){x.isVector4?Ft.set(x.x,x.y,x.z,x.w):Ft.set(x,U,O,z),At.scissor(W.copy(Ft).multiplyScalar(H).round())},this.getScissorTest=function(){return Xt},this.setScissorTest=function(x){At.setScissorTest(Xt=x)},this.setOpaqueSort=function(x){st=x},this.setTransparentSort=function(x){gt=x},this.getClearColor=function(x){return x.copy(pt.getClearColor())},this.setClearColor=function(){pt.setClearColor.apply(pt,arguments)},this.getClearAlpha=function(){return pt.getClearAlpha()},this.setClearAlpha=function(){pt.setClearAlpha.apply(pt,arguments)},this.clear=function(x=!0,U=!0,O=!0){let z=0;if(x){let N=!1;if(I!==null){const et=I.texture.format;N=et===To||et===bo||et===Eo}if(N){const et=I.texture.type,mt=et===Ln||et===li||et===Ms||et===Ki||et===Mo||et===So,vt=pt.getClearColor(),Mt=pt.getClearAlpha(),It=vt.r,Nt=vt.g,Pt=vt.b;mt?(g[0]=It,g[1]=Nt,g[2]=Pt,g[3]=Mt,R.clearBufferuiv(R.COLOR,0,g)):(_[0]=It,_[1]=Nt,_[2]=Pt,_[3]=Mt,R.clearBufferiv(R.COLOR,0,_))}else z|=R.COLOR_BUFFER_BIT}U&&(z|=R.DEPTH_BUFFER_BIT),O&&(z|=R.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),R.clear(z)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",$,!1),e.removeEventListener("webglcontextrestored",ft,!1),e.removeEventListener("webglcontextcreationerror",ut,!1),pt.dispose(),V.dispose(),at.dispose(),Rt.dispose(),v.dispose(),F.dispose(),j.dispose(),Zt.dispose(),L.dispose(),Tt.dispose(),G.dispose(),G.removeEventListener("sessionstart",Rs),G.removeEventListener("sessionend",fi),pn.stop()};function $(x){x.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),D=!0}function ft(){console.log("THREE.WebGLRenderer: Context Restored."),D=!1;const x=le.autoReset,U=it.enabled,O=it.autoUpdate,z=it.needsUpdate,N=it.type;rt(),le.autoReset=x,it.enabled=U,it.autoUpdate=O,it.needsUpdate=z,it.type=N}function ut(x){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",x.statusMessage)}function Ot(x){const U=x.target;U.removeEventListener("dispose",Ot),ce(U)}function ce(x){Ae(x),Rt.remove(x)}function Ae(x){const U=Rt.get(x).programs;U!==void 0&&(U.forEach(function(O){Tt.releaseProgram(O)}),x.isShaderMaterial&&Tt.releaseShaderCache(x))}this.renderBufferDirect=function(x,U,O,z,N,et){U===null&&(U=ie);const mt=N.isMesh&&N.matrixWorld.determinant()<0,vt=Ds(x,U,O,z,N);At.setMaterial(z,mt);let Mt=O.index,It=1;if(z.wireframe===!0){if(Mt=J.getWireframeAttribute(O),Mt===void 0)return;It=2}const Nt=O.drawRange,Pt=O.attributes.position;let Kt=Nt.start*It,te=(Nt.start+Nt.count)*It;et!==null&&(Kt=Math.max(Kt,et.start*It),te=Math.min(te,(et.start+et.count)*It)),Mt!==null?(Kt=Math.max(Kt,0),te=Math.min(te,Mt.count)):Pt!=null&&(Kt=Math.max(Kt,0),te=Math.min(te,Pt.count));const xe=te-Kt;if(xe<0||xe===1/0)return;Zt.setup(N,z,vt,O,Mt);let pe,Jt=ht;if(Mt!==null&&(pe=K.get(Mt),Jt=Bt,Jt.setIndex(pe)),N.isMesh)z.wireframe===!0?(At.setLineWidth(z.wireframeLinewidth*ue()),Jt.setMode(R.LINES)):Jt.setMode(R.TRIANGLES);else if(N.isLine){let Dt=z.linewidth;Dt===void 0&&(Dt=1),At.setLineWidth(Dt*ue()),N.isLineSegments?Jt.setMode(R.LINES):N.isLineLoop?Jt.setMode(R.LINE_LOOP):Jt.setMode(R.LINE_STRIP)}else N.isPoints?Jt.setMode(R.POINTS):N.isSprite&&Jt.setMode(R.TRIANGLES);if(N.isBatchedMesh)if(N._multiDrawInstances!==null)Jt.renderMultiDrawInstances(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount,N._multiDrawInstances);else if(qt.get("WEBGL_multi_draw"))Jt.renderMultiDraw(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount);else{const Dt=N._multiDrawStarts,De=N._multiDrawCounts,ee=N._multiDrawCount,ln=Mt?K.get(Mt).bytesPerElement:1,mi=Rt.get(z).currentProgram.getUniforms();for(let qe=0;qe{function et(){if(z.forEach(function(mt){Rt.get(mt).currentProgram.isReady()&&z.delete(mt)}),z.size===0){N(x);return}setTimeout(et,10)}qt.get("KHR_parallel_shader_compile")!==null?et():setTimeout(et,10)})};let Ye=null;function Qe(x){Ye&&Ye(x)}function Rs(){pn.stop()}function fi(){pn.start()}const pn=new Rc;pn.setAnimationLoop(Qe),typeof self<"u"&&pn.setContext(self),this.setAnimationLoop=function(x){Ye=x,G.setAnimationLoop(x),x===null?pn.stop():pn.start()},G.addEventListener("sessionstart",Rs),G.addEventListener("sessionend",fi),this.render=function(x,U){if(U!==void 0&&U.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(D===!0)return;if(x.matrixWorldAutoUpdate===!0&&x.updateMatrixWorld(),U.parent===null&&U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),G.enabled===!0&&G.isPresenting===!0&&(G.cameraAutoUpdate===!0&&G.updateCamera(U),U=G.getCamera()),x.isScene===!0&&x.onBeforeRender(y,x,U,I),f=at.get(x,E.length),f.init(U),E.push(f),Ct.multiplyMatrices(U.projectionMatrix,U.matrixWorldInverse),Y.setFromProjectionMatrix(Ct),_t=this.localClippingEnabled,nt=Z.init(this.clippingPlanes,_t),m=V.get(x,T.length),m.init(),T.push(m),G.enabled===!0&&G.isPresenting===!0){const et=y.xr.getDepthSensingMesh();et!==null&&ns(et,U,-1/0,y.sortObjects)}ns(x,U,0,y.sortObjects),m.finish(),y.sortObjects===!0&&m.sort(st,gt),Wt=G.enabled===!1||G.isPresenting===!1||G.hasDepthSensing()===!1,Wt&&pt.addToRenderList(m,x),this.info.render.frame++,nt===!0&&Z.beginShadows();const O=f.state.shadowsArray;it.render(O,x,U),nt===!0&&Z.endShadows(),this.info.autoReset===!0&&this.info.reset();const z=m.opaque,N=m.transmissive;if(f.setupLights(),U.isArrayCamera){const et=U.cameras;if(N.length>0)for(let mt=0,vt=et.length;mt0&&Ve(z,N,x,U),Wt&&pt.render(x),Cs(m,x,U);I!==null&&C===0&&(b.updateMultisampleRenderTarget(I),b.updateRenderTargetMipmap(I)),x.isScene===!0&&x.onAfterRender(y,x,U),Zt.resetDefaultState(),S=-1,M=null,E.pop(),E.length>0?(f=E[E.length-1],nt===!0&&Z.setGlobalState(y.clippingPlanes,f.state.camera)):f=null,T.pop(),T.length>0?m=T[T.length-1]:m=null};function ns(x,U,O,z){if(x.visible===!1)return;if(x.layers.test(U.layers)){if(x.isGroup)O=x.renderOrder;else if(x.isLOD)x.autoUpdate===!0&&x.update(U);else if(x.isLight)f.pushLight(x),x.castShadow&&f.pushShadow(x);else if(x.isSprite){if(!x.frustumCulled||Y.intersectsSprite(x)){z&&Vt.setFromMatrixPosition(x.matrixWorld).applyMatrix4(Ct);const mt=j.update(x),vt=x.material;vt.visible&&m.push(x,mt,vt,O,Vt.z,null)}}else if((x.isMesh||x.isLine||x.isPoints)&&(!x.frustumCulled||Y.intersectsObject(x))){const mt=j.update(x),vt=x.material;if(z&&(x.boundingSphere!==void 0?(x.boundingSphere===null&&x.computeBoundingSphere(),Vt.copy(x.boundingSphere.center)):(mt.boundingSphere===null&&mt.computeBoundingSphere(),Vt.copy(mt.boundingSphere.center)),Vt.applyMatrix4(x.matrixWorld).applyMatrix4(Ct)),Array.isArray(vt)){const Mt=mt.groups;for(let It=0,Nt=Mt.length;It0&&Re(N,U,O),et.length>0&&Re(et,U,O),mt.length>0&&Re(mt,U,O),At.buffers.depth.setTest(!0),At.buffers.depth.setMask(!0),At.buffers.color.setMask(!0),At.setPolygonOffset(!1)}function Ve(x,U,O,z){if((O.isScene===!0?O.overrideMaterial:null)!==null)return;f.state.transmissionRenderTarget[z.id]===void 0&&(f.state.transmissionRenderTarget[z.id]=new fn(1,1,{generateMipmaps:!0,type:qt.has("EXT_color_buffer_half_float")||qt.has("EXT_color_buffer_float")?Pn:Ln,minFilter:ai,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Qt.workingColorSpace}));const et=f.state.transmissionRenderTarget[z.id],mt=z.viewport||A;et.setSize(mt.z*y.transmissionResolutionScale,mt.w*y.transmissionResolutionScale);const vt=y.getRenderTarget();y.setRenderTarget(et),y.getClearColor(q),Q=y.getClearAlpha(),Q<1&&y.setClearColor(16777215,.5),y.clear(),Wt&&pt.render(O);const Mt=y.toneMapping;y.toneMapping=Wn;const It=z.viewport;if(z.viewport!==void 0&&(z.viewport=void 0),f.setupLightsView(z),nt===!0&&Z.setGlobalState(y.clippingPlanes,z),Re(x,O,z),b.updateMultisampleRenderTarget(et),b.updateRenderTargetMipmap(et),qt.has("WEBGL_multisampled_render_to_texture")===!1){let Nt=!1;for(let Pt=0,Kt=U.length;Pt0),Pt=!!O.morphAttributes.position,Kt=!!O.morphAttributes.normal,te=!!O.morphAttributes.color;let xe=Wn;z.toneMapped&&(I===null||I.isXRRenderTarget===!0)&&(xe=y.toneMapping);const pe=O.morphAttributes.position||O.morphAttributes.normal||O.morphAttributes.color,Jt=pe!==void 0?pe.length:0,Dt=Rt.get(z),De=f.state.lights;if(nt===!0&&(_t===!0||x!==M)){const Be=x===M&&z.id===S;Z.setState(z,x,Be)}let ee=!1;z.version===Dt.__version?(Dt.needsLights&&Dt.lightsStateVersion!==De.state.version||Dt.outputColorSpace!==vt||N.isBatchedMesh&&Dt.batching===!1||!N.isBatchedMesh&&Dt.batching===!0||N.isBatchedMesh&&Dt.batchingColor===!0&&N.colorTexture===null||N.isBatchedMesh&&Dt.batchingColor===!1&&N.colorTexture!==null||N.isInstancedMesh&&Dt.instancing===!1||!N.isInstancedMesh&&Dt.instancing===!0||N.isSkinnedMesh&&Dt.skinning===!1||!N.isSkinnedMesh&&Dt.skinning===!0||N.isInstancedMesh&&Dt.instancingColor===!0&&N.instanceColor===null||N.isInstancedMesh&&Dt.instancingColor===!1&&N.instanceColor!==null||N.isInstancedMesh&&Dt.instancingMorph===!0&&N.morphTexture===null||N.isInstancedMesh&&Dt.instancingMorph===!1&&N.morphTexture!==null||Dt.envMap!==Mt||z.fog===!0&&Dt.fog!==et||Dt.numClippingPlanes!==void 0&&(Dt.numClippingPlanes!==Z.numPlanes||Dt.numIntersection!==Z.numIntersection)||Dt.vertexAlphas!==It||Dt.vertexTangents!==Nt||Dt.morphTargets!==Pt||Dt.morphNormals!==Kt||Dt.morphColors!==te||Dt.toneMapping!==xe||Dt.morphTargetsCount!==Jt)&&(ee=!0):(ee=!0,Dt.__version=z.version);let ln=Dt.currentProgram;ee===!0&&(ln=en(z,U,N));let mi=!1,qe=!1,is=!1;const de=ln.getUniforms(),nn=Dt.uniforms;if(At.useProgram(ln.program)&&(mi=!0,qe=!0,is=!0),z.id!==S&&(S=z.id,qe=!0),mi||M!==x){At.buffers.depth.getReversed()?(lt.copy(x.projectionMatrix),zh(lt),kh(lt),de.setValue(R,"projectionMatrix",lt)):de.setValue(R,"projectionMatrix",x.projectionMatrix),de.setValue(R,"viewMatrix",x.matrixWorldInverse);const Ge=de.map.cameraPosition;Ge!==void 0&&Ge.setValue(R,Lt.setFromMatrixPosition(x.matrixWorld)),jt.logarithmicDepthBuffer&&de.setValue(R,"logDepthBufFC",2/(Math.log(x.far+1)/Math.LN2)),(z.isMeshPhongMaterial||z.isMeshToonMaterial||z.isMeshLambertMaterial||z.isMeshBasicMaterial||z.isMeshStandardMaterial||z.isShaderMaterial)&&de.setValue(R,"isOrthographic",x.isOrthographicCamera===!0),M!==x&&(M=x,qe=!0,is=!0)}if(N.isSkinnedMesh){de.setOptional(R,N,"bindMatrix"),de.setOptional(R,N,"bindMatrixInverse");const Be=N.skeleton;Be&&(Be.boneTexture===null&&Be.computeBoneTexture(),de.setValue(R,"boneTexture",Be.boneTexture,b))}N.isBatchedMesh&&(de.setOptional(R,N,"batchingTexture"),de.setValue(R,"batchingTexture",N._matricesTexture,b),de.setOptional(R,N,"batchingIdTexture"),de.setValue(R,"batchingIdTexture",N._indirectTexture,b),de.setOptional(R,N,"batchingColorTexture"),N._colorsTexture!==null&&de.setValue(R,"batchingColorTexture",N._colorsTexture,b));const sn=O.morphAttributes;if((sn.position!==void 0||sn.normal!==void 0||sn.color!==void 0)&&wt.update(N,O,ln),(qe||Dt.receiveShadow!==N.receiveShadow)&&(Dt.receiveShadow=N.receiveShadow,de.setValue(R,"receiveShadow",N.receiveShadow)),z.isMeshGouraudMaterial&&z.envMap!==null&&(nn.envMap.value=Mt,nn.flipEnvMap.value=Mt.isCubeTexture&&Mt.isRenderTargetTexture===!1?-1:1),z.isMeshStandardMaterial&&z.envMap===null&&U.environment!==null&&(nn.envMapIntensity.value=U.environmentIntensity),qe&&(de.setValue(R,"toneMappingExposure",y.toneMappingExposure),Dt.needsLights&&Ir(nn,is),et&&z.fog===!0&&dt.refreshFogUniforms(nn,et),dt.refreshMaterialUniforms(nn,z,H,tt,f.state.transmissionRenderTarget[x.id]),_r.upload(R,pi(Dt),nn,b)),z.isShaderMaterial&&z.uniformsNeedUpdate===!0&&(_r.upload(R,pi(Dt),nn,b),z.uniformsNeedUpdate=!1),z.isSpriteMaterial&&de.setValue(R,"center",N.center),de.setValue(R,"modelViewMatrix",N.modelViewMatrix),de.setValue(R,"normalMatrix",N.normalMatrix),de.setValue(R,"modelMatrix",N.matrixWorld),z.isShaderMaterial||z.isRawShaderMaterial){const Be=z.uniformsGroups;for(let Ge=0,Or=Be.length;Ge0&&b.useMultisampledRTT(x)===!1?N=Rt.get(x).__webglMultisampledFramebuffer:Array.isArray(Nt)?N=Nt[O]:N=Nt,A.copy(x.viewport),W.copy(x.scissor),k=x.scissorTest}else A.copy(Et).multiplyScalar(H).floor(),W.copy(Ft).multiplyScalar(H).floor(),k=Xt;if(O!==0&&(N=Nr),At.bindFramebuffer(R.FRAMEBUFFER,N)&&z&&At.drawBuffers(x,N),At.viewport(A),At.scissor(W),At.setScissorTest(k),et){const Mt=Rt.get(x.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+U,Mt.__webglTexture,O)}else if(mt){const Mt=Rt.get(x.texture),It=U;R.framebufferTextureLayer(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,Mt.__webglTexture,O,It)}else if(x!==null&&O!==0){const Mt=Rt.get(x.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,Mt.__webglTexture,O)}S=-1},this.readRenderTargetPixels=function(x,U,O,z,N,et,mt){if(!(x&&x.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let vt=Rt.get(x).__webglFramebuffer;if(x.isWebGLCubeRenderTarget&&mt!==void 0&&(vt=vt[mt]),vt){At.bindFramebuffer(R.FRAMEBUFFER,vt);try{const Mt=x.texture,It=Mt.format,Nt=Mt.type;if(!jt.textureFormatReadable(It)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!jt.textureTypeReadable(Nt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U>=0&&U<=x.width-z&&O>=0&&O<=x.height-N&&R.readPixels(U,O,z,N,Ut.convert(It),Ut.convert(Nt),et)}finally{const Mt=I!==null?Rt.get(I).__webglFramebuffer:null;At.bindFramebuffer(R.FRAMEBUFFER,Mt)}}},this.readRenderTargetPixelsAsync=async function(x,U,O,z,N,et,mt){if(!(x&&x.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let vt=Rt.get(x).__webglFramebuffer;if(x.isWebGLCubeRenderTarget&&mt!==void 0&&(vt=vt[mt]),vt){const Mt=x.texture,It=Mt.format,Nt=Mt.type;if(!jt.textureFormatReadable(It))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!jt.textureTypeReadable(Nt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(U>=0&&U<=x.width-z&&O>=0&&O<=x.height-N){At.bindFramebuffer(R.FRAMEBUFFER,vt);const Pt=R.createBuffer();R.bindBuffer(R.PIXEL_PACK_BUFFER,Pt),R.bufferData(R.PIXEL_PACK_BUFFER,et.byteLength,R.STREAM_READ),R.readPixels(U,O,z,N,Ut.convert(It),Ut.convert(Nt),0);const Kt=I!==null?Rt.get(I).__webglFramebuffer:null;At.bindFramebuffer(R.FRAMEBUFFER,Kt);const te=R.fenceSync(R.SYNC_GPU_COMMANDS_COMPLETE,0);return R.flush(),await Bh(R,te,4),R.bindBuffer(R.PIXEL_PACK_BUFFER,Pt),R.getBufferSubData(R.PIXEL_PACK_BUFFER,0,et),R.deleteBuffer(Pt),R.deleteSync(te),et}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(x,U=null,O=0){x.isTexture!==!0&&(Fi("WebGLRenderer: copyFramebufferToTexture function signature has changed."),U=arguments[0]||null,x=arguments[1]);const z=Math.pow(2,-O),N=Math.floor(x.image.width*z),et=Math.floor(x.image.height*z),mt=U!==null?U.x:0,vt=U!==null?U.y:0;b.setTexture2D(x,0),R.copyTexSubImage2D(R.TEXTURE_2D,O,0,0,mt,vt,N,et),At.unbindTexture()};const Fr=R.createFramebuffer(),Oc=R.createFramebuffer();this.copyTextureToTexture=function(x,U,O=null,z=null,N=0,et=null){x.isTexture!==!0&&(Fi("WebGLRenderer: copyTextureToTexture function signature has changed."),z=arguments[0]||null,x=arguments[1],U=arguments[2],et=arguments[3]||0,O=null),et===null&&(N!==0?(Fi("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),et=N,N=0):et=0);let mt,vt,Mt,It,Nt,Pt,Kt,te,xe;const pe=x.isCompressedTexture?x.mipmaps[et]:x.image;if(O!==null)mt=O.max.x-O.min.x,vt=O.max.y-O.min.y,Mt=O.isBox3?O.max.z-O.min.z:1,It=O.min.x,Nt=O.min.y,Pt=O.isBox3?O.min.z:0;else{const sn=Math.pow(2,-N);mt=Math.floor(pe.width*sn),vt=Math.floor(pe.height*sn),x.isDataArrayTexture?Mt=pe.depth:x.isData3DTexture?Mt=Math.floor(pe.depth*sn):Mt=1,It=0,Nt=0,Pt=0}z!==null?(Kt=z.x,te=z.y,xe=z.z):(Kt=0,te=0,xe=0);const Jt=Ut.convert(U.format),Dt=Ut.convert(U.type);let De;U.isData3DTexture?(b.setTexture3D(U,0),De=R.TEXTURE_3D):U.isDataArrayTexture||U.isCompressedArrayTexture?(b.setTexture2DArray(U,0),De=R.TEXTURE_2D_ARRAY):(b.setTexture2D(U,0),De=R.TEXTURE_2D),R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,U.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,U.unpackAlignment);const ee=R.getParameter(R.UNPACK_ROW_LENGTH),ln=R.getParameter(R.UNPACK_IMAGE_HEIGHT),mi=R.getParameter(R.UNPACK_SKIP_PIXELS),qe=R.getParameter(R.UNPACK_SKIP_ROWS),is=R.getParameter(R.UNPACK_SKIP_IMAGES);R.pixelStorei(R.UNPACK_ROW_LENGTH,pe.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,pe.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,It),R.pixelStorei(R.UNPACK_SKIP_ROWS,Nt),R.pixelStorei(R.UNPACK_SKIP_IMAGES,Pt);const de=x.isDataArrayTexture||x.isData3DTexture,nn=U.isDataArrayTexture||U.isData3DTexture;if(x.isDepthTexture){const sn=Rt.get(x),Be=Rt.get(U),Ge=Rt.get(sn.__renderTarget),Or=Rt.get(Be.__renderTarget);At.bindFramebuffer(R.READ_FRAMEBUFFER,Ge.__webglFramebuffer),At.bindFramebuffer(R.DRAW_FRAMEBUFFER,Or.__webglFramebuffer);for(let jn=0;jnMath.PI&&(n-=We),s<-Math.PI?s+=We:s>Math.PI&&(s-=We),n<=s?this._spherical.theta=Math.max(n,Math.min(s,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+s)/2?Math.max(n,this._spherical.theta):Math.min(s,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let r=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),r=a!=this._spherical.radius}if(Ee.setFromSpherical(this._spherical),Ee.applyQuaternion(this._quatInverse),e.copy(this.target).add(Ee),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const o=Ee.length();a=this._clampDistance(o*this._scale);const l=o-a;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),r=!!l}else if(this.object.isOrthographicCamera){const o=new P(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),r=l!==this.object.zoom;const c=new P(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(o),this.object.updateMatrixWorld(),a=Ee.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(cr.origin.copy(this.object.position),cr.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(cr.direction))_a||8*(1-this._lastQuaternion.dot(this.object.quaternion))>_a||this._lastTargetPosition.distanceToSquared(this.target)>_a?(this.dispatchEvent(Vl),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(t){return t!==null?We/60*this.autoRotateSpeed*t:We/60/60*this.autoRotateSpeed}_getZoomScale(t){const e=Math.abs(t*.01);return Math.pow(.95,this.zoomSpeed*e)}_rotateLeft(t){this._sphericalDelta.theta-=t}_rotateUp(t){this._sphericalDelta.phi-=t}_panLeft(t,e){Ee.setFromMatrixColumn(e,0),Ee.multiplyScalar(-t),this._panOffset.add(Ee)}_panUp(t,e){this.screenSpacePanning===!0?Ee.setFromMatrixColumn(e,1):(Ee.setFromMatrixColumn(e,0),Ee.crossVectors(this.object.up,Ee)),Ee.multiplyScalar(t),this._panOffset.add(Ee)}_pan(t,e){const n=this.domElement;if(this.object.isPerspectiveCamera){const s=this.object.position;Ee.copy(s).sub(this.target);let r=Ee.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*r/n.clientHeight,this.object.matrix),this._panUp(2*e*r/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(t*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(e*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(t,e){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),s=t-n.left,r=e-n.top,a=n.width,o=n.height;this._mouse.x=s/a*2-1,this._mouse.y=-(r/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(t){return Math.max(this.minDistance,Math.min(this.maxDistance,t))}_handleMouseDownRotate(t){this._rotateStart.set(t.clientX,t.clientY)}_handleMouseDownDolly(t){this._updateZoomParameters(t.clientX,t.clientX),this._dollyStart.set(t.clientX,t.clientY)}_handleMouseDownPan(t){this._panStart.set(t.clientX,t.clientY)}_handleMouseMoveRotate(t){this._rotateEnd.set(t.clientX,t.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(We*this._rotateDelta.x/e.clientHeight),this._rotateUp(We*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(t){this._dollyEnd.set(t.clientX,t.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(t){this._panEnd.set(t.clientX,t.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(t){this._updateZoomParameters(t.clientX,t.clientY),t.deltaY<0?this._dollyIn(this._getZoomScale(t.deltaY)):t.deltaY>0&&this._dollyOut(this._getZoomScale(t.deltaY)),this.update()}_handleKeyDown(t){let e=!1;switch(t.code){case this.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(We*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),e=!0;break;case this.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(-We*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),e=!0;break;case this.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(We*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),e=!0;break;case this.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(-We*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),e=!0;break}e&&(t.preventDefault(),this.update())}_handleTouchStartRotate(t){if(this._pointers.length===1)this._rotateStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),n=.5*(t.pageX+e.x),s=.5*(t.pageY+e.y);this._rotateStart.set(n,s)}}_handleTouchStartPan(t){if(this._pointers.length===1)this._panStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),n=.5*(t.pageX+e.x),s=.5*(t.pageY+e.y);this._panStart.set(n,s)}}_handleTouchStartDolly(t){const e=this._getSecondPointerPosition(t),n=t.pageX-e.x,s=t.pageY-e.y,r=Math.sqrt(n*n+s*s);this._dollyStart.set(0,r)}_handleTouchStartDollyPan(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enablePan&&this._handleTouchStartPan(t)}_handleTouchStartDollyRotate(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enableRotate&&this._handleTouchStartRotate(t)}_handleTouchMoveRotate(t){if(this._pointers.length==1)this._rotateEnd.set(t.pageX,t.pageY);else{const n=this._getSecondPointerPosition(t),s=.5*(t.pageX+n.x),r=.5*(t.pageY+n.y);this._rotateEnd.set(s,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(We*this._rotateDelta.x/e.clientHeight),this._rotateUp(We*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(t){if(this._pointers.length===1)this._panEnd.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t),n=.5*(t.pageX+e.x),s=.5*(t.pageY+e.y);this._panEnd.set(n,s)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(t){const e=this._getSecondPointerPosition(t),n=t.pageX-e.x,s=t.pageY-e.y,r=Math.sqrt(n*n+s*s);this._dollyEnd.set(0,r),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(t.pageX+e.x)*.5,o=(t.pageY+e.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enablePan&&this._handleTouchMovePan(t)}_handleTouchMoveDollyRotate(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enableRotate&&this._handleTouchMoveRotate(t)}_addPointer(t){this._pointers.push(t.pointerId)}_removePointer(t){delete this._pointerPositions[t.pointerId];for(let e=0;e + varying vec2 vUv; + uniform sampler2D colorTexture; + uniform vec2 invSize; + uniform vec2 direction; + uniform float gaussianCoefficients[KERNEL_RADIUS]; + + void main() { + float weightSum = gaussianCoefficients[0]; + vec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum; + for( int i = 1; i < KERNEL_RADIUS; i ++ ) { + float x = float(i); + float w = gaussianCoefficients[i]; + vec2 uvOffset = direction * invSize * x; + vec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb; + vec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb; + diffuseSum += (sample1 + sample2) * w; + weightSum += 2.0 * w; + } + gl_FragColor = vec4(diffuseSum/weightSum, 1.0); + }`})}getCompositeMaterial(t){return new He({defines:{NUM_MIPS:t},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`varying vec2 vUv; + void main() { + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + }`,fragmentShader:`varying vec2 vUv; + uniform sampler2D blurTexture1; + uniform sampler2D blurTexture2; + uniform sampler2D blurTexture3; + uniform sampler2D blurTexture4; + uniform sampler2D blurTexture5; + uniform float bloomStrength; + uniform float bloomRadius; + uniform float bloomFactors[NUM_MIPS]; + uniform vec3 bloomTintColors[NUM_MIPS]; + + float lerpBloomFactor(const in float factor) { + float mirrorFactor = 1.2 - factor; + return mix(factor, mirrorFactor, bloomRadius); + } + + void main() { + gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) + + lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) + + lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) + + lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) + + lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) ); + }`})}}ts.BlurDirectionX=new St(1,0);ts.BlurDirectionY=new St(0,1);function Pg(){const t=new Float32Array(6e3),e=new Float32Array(2e3*3);for(let r=0;r<2e3;r++){const a=Math.random()*Math.PI*2,o=Math.acos(2*Math.random()-1),l=600+Math.random()*400;t[r*3]=l*Math.sin(o)*Math.cos(a),t[r*3+1]=l*Math.sin(o)*Math.sin(a),t[r*3+2]=l*Math.cos(o);const c=Math.random();e[r*3]=.55+c*.25,e[r*3+1]=.55+c*.15,e[r*3+2]=.75+c*.25}const n=new ge;n.setAttribute("position",new he(t,3)),n.setAttribute("color",new he(e,3));const s=new oi({size:1.6,sizeAttenuation:!0,vertexColors:!0,transparent:!0,opacity:.6,depthWrite:!1,blending:Le});return new Yi(n,s)}function Dg(i){const t=new lu;t.background=new ot(328975),t.fog=new Dr(657946,.0035);const e=new $e(60,i.clientWidth/i.clientHeight,.1,2e3);e.position.set(0,30,80);const n=new lg({antialias:!0,alpha:!0,powerPreference:"high-performance"});n.setSize(i.clientWidth,i.clientHeight),n.setPixelRatio(Math.min(window.devicePixelRatio,2)),n.toneMapping=ec,n.toneMappingExposure=1.25,i.appendChild(n.domElement);const s=new hg(e,n.domElement);s.enableDamping=!0,s.dampingFactor=.05,s.rotateSpeed=.5,s.zoomSpeed=.8,s.minDistance=12,s.maxDistance=180,s.autoRotate=!0,s.autoRotateSpeed=.3;const r=new Ag(n);r.addPass(new Rg(t,e));const a=new ts(new St(i.clientWidth,i.clientHeight),.55,.6,.2);r.addPass(a);const o=new Mu(2763354,.7);t.add(o);const l=new dl(6514417,1.8,240);l.position.set(50,50,50),t.add(l);const c=new dl(11032055,1.2,240);c.position.set(-50,-30,-50),t.add(c);const h=Pg();t.add(h);const d=new Eu;d.params.Points={threshold:2};const p=new St;return{scene:t,camera:e,renderer:n,controls:s,composer:r,bloomPass:a,raycaster:d,mouse:p,lights:{ambient:o,point1:l,point2:c},starfield:h}}function Lg(i,t){const e=t.clientWidth,n=t.clientHeight;i.camera.aspect=e/n,i.camera.updateProjectionMatrix(),i.renderer.setSize(e,n),i.composer.setSize(e,n)}function Ug(i){i.scene.traverse(t=>{var e;(t instanceof be||t instanceof du)&&((e=t.geometry)==null||e.dispose(),Array.isArray(t.material)?t.material.forEach(n=>n.dispose()):t.material&&t.material.dispose())}),i.renderer.dispose(),i.composer.dispose()}class Ig{constructor(t){kt(this,"positions");kt(this,"velocities");kt(this,"running",!0);kt(this,"step",0);kt(this,"repulsionStrength",500);kt(this,"attractionStrength",.01);kt(this,"dampening",.9);kt(this,"baseMaxSteps",300);kt(this,"maxSteps",300);kt(this,"cooldownExtension",0);this.positions=t,this.velocities=new Map;for(const e of t.keys())this.velocities.set(e,new P)}addNode(t,e){this.positions.set(t,e.clone()),this.velocities.set(t,new P),this.cooldownExtension=100,this.maxSteps=Math.max(this.maxSteps,this.step+this.cooldownExtension),this.running=!0}removeNode(t){this.positions.delete(t),this.velocities.delete(t)}tick(t){if(!this.running)return;if(this.step>this.maxSteps){this.cooldownExtension>0&&(this.cooldownExtension=0,this.maxSteps=this.baseMaxSteps);return}this.step++;const e=Math.max(.001,1-this.step/this.maxSteps),n=Array.from(this.positions.keys());for(let s=0;s=.7?"active":i>=.4?"dormant":i>=.1?"silent":"unavailable"}const po={active:"#10b981",dormant:"#f59e0b",silent:"#8b5cf6",unavailable:"#6b7280"},Fg={active:"Easily retrievable (retention ≥ 70%)",dormant:"Retrievable with effort (40–70%)",silent:"Difficult, needs cues (10–40%)",unavailable:"Needs reinforcement (< 10%)"},xr={aha:"#FFD700",confusion:"#EF4444",failure:"#9CA3AF"},Og={aha:"Aha moments and breakthroughs",confusion:"Confusions and weak spots",failure:"Failures and guardrails"};function Xl(i,t){return t==="state"?po[Ng(i.retention)]:t==="ahagraph"?Bg(i)??Sa[i.type]??"#8B95A5":Sa[i.type]||"#8B95A5"}function Bg(i){const t=new Set((i.tags??[]).map(e=>e.toLowerCase()));return t.has("aha")?xr.aha:t.has("confusion")||t.has("weak-spot")?xr.confusion:t.has("failure")||t.has("guardrail")?xr.failure:null}let ms=null;function mo(){if(ms)return ms;const i=128,t=document.createElement("canvas");t.width=i,t.height=i;const e=t.getContext("2d");if(!e)return ms=new Pe,ms;const n=e.createRadialGradient(i/2,i/2,0,i/2,i/2,i/2);n.addColorStop(0,"rgba(255, 255, 255, 1.0)"),n.addColorStop(.25,"rgba(255, 255, 255, 0.7)"),n.addColorStop(.55,"rgba(255, 255, 255, 0.2)"),n.addColorStop(1,"rgba(255, 255, 255, 0.0)"),e.fillStyle=n,e.fillRect(0,0,i,i);const s=new bc(t);return s.needsUpdate=!0,ms=s,s}function Yl(i){if(i===0||i===1)return i;const t=.3;return Math.pow(2,-10*i)*Math.sin((i-t/4)*(2*Math.PI)/t)+1}function zg(i){return i*i*((1.70158+1)*i-1.70158)}class kg{constructor(){kt(this,"group");kt(this,"meshMap",new Map);kt(this,"glowMap",new Map);kt(this,"positions",new Map);kt(this,"labelSprites",new Map);kt(this,"hoveredNode",null);kt(this,"selectedNode",null);kt(this,"colorMode","type");kt(this,"materializingNodes",[]);kt(this,"dissolvingNodes",[]);kt(this,"growingNodes",[]);this.group=new zi}setColorMode(t){if(this.colorMode!==t){this.colorMode=t;for(const[e,n]of this.meshMap){const s=n.userData.retention??0,r=n.userData.type??"fact",a=Array.isArray(n.userData.tags)?n.userData.tags:[],l=Xl({type:r,retention:s,tags:a},t),c=new ot(l),h=n.material;h.color.copy(c),h.emissive.copy(c);const d=this.glowMap.get(e);d&&d.material.color.copy(c)}}}createNodes(t){const e=(1+Math.sqrt(5))/2,n=t.length;for(let s=0;s0,o=new Lr(s,16,16),l=new mu({color:new ot(r),emissive:new ot(r),emissiveIntensity:a?0:.3+t.retention*.5,roughness:.3,metalness:.1,transparent:!0,opacity:a?.2:.3+t.retention*.7}),c=new be(o,l);c.position.copy(e),c.scale.setScalar(n),c.userData={nodeId:t.id,type:t.type,retention:t.retention,tags:t.tags},this.meshMap.set(t.id,c),this.group.add(c);const h=new Xi({map:mo(),color:new ot(r),transparent:!0,opacity:n>0?a?.1:.3+t.retention*.35:0,blending:Le,depthWrite:!1}),d=new Bi(h);d.scale.set(s*6*n,s*6*n,1),d.position.copy(e),d.userData={isGlow:!0,nodeId:t.id},this.glowMap.set(t.id,d),this.group.add(d);const p=t.label||t.type,u=this.createTextSprite(p,"#94a3b8");return u.position.copy(e),u.position.y+=s*2+1.5,u.userData={isLabel:!0,nodeId:t.id,offset:s*2+1.5},this.group.add(u),this.labelSprites.set(t.id,u),{mesh:c,glow:d,label:u,size:s}}addNode(t,e,n={}){const s=(e==null?void 0:e.clone())??new P((Math.random()-.5)*40,(Math.random()-.5)*40,(Math.random()-.5)*40);this.positions.set(t.id,s);const{mesh:r,glow:a,label:o}=this.createNodeMeshes(t,s,0);return r.scale.setScalar(.001),a.scale.set(.001,.001,1),a.material.opacity=0,o.material.opacity=0,n.isBirthRitual?(r.visible=!1,a.visible=!1,o.visible=!1,r.userData.birthRitualPending={totalFrames:30,targetScale:.5+t.retention*2}):this.materializingNodes.push({id:t.id,frame:0,totalFrames:30,mesh:r,glow:a,label:o,targetScale:.5+t.retention*2}),s}igniteNode(t){const e=this.meshMap.get(t),n=this.glowMap.get(t),s=this.labelSprites.get(t);if(!e||!n||!s)return;const r=e.userData.birthRitualPending;r&&(e.visible=!0,n.visible=!0,s.visible=!0,delete e.userData.birthRitualPending,this.materializingNodes.push({id:t,frame:0,totalFrames:r.totalFrames,mesh:e,glow:n,label:s,targetScale:r.targetScale}))}removeNode(t){const e=this.meshMap.get(t),n=this.glowMap.get(t),s=this.labelSprites.get(t);!e||!n||!s||(this.materializingNodes=this.materializingNodes.filter(r=>r.id!==t),this.dissolvingNodes.push({id:t,frame:0,totalFrames:60,mesh:e,glow:n,label:s,originalScale:e.scale.x}))}growNode(t,e){const n=this.meshMap.get(t);if(!n)return;const s=n.scale.x,r=.5+e*2;n.userData.retention=e,this.growingNodes.push({id:t,frame:0,totalFrames:30,startScale:s,targetScale:r})}createTextSprite(t,e){const n=document.createElement("canvas"),s=n.getContext("2d");if(!s){const f=new Pe;return new Bi(new Xi({map:f,transparent:!0,opacity:0}))}n.width=512,n.height=64;const r=t.length>40?t.slice(0,37)+"...":t;s.clearRect(0,0,n.width,n.height),s.font='600 22px -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif';const o=s.measureText(r).width,c=Math.min(o+14*2,n.width-4),h=40,d=(n.width-c)/2,p=(n.height-h)/2,u=h/2;s.fillStyle="rgba(10, 16, 28, 0.82)",s.beginPath(),s.moveTo(d+u,p),s.lineTo(d+c-u,p),s.quadraticCurveTo(d+c,p,d+c,p+u),s.lineTo(d+c,p+h-u),s.quadraticCurveTo(d+c,p+h,d+c-u,p+h),s.lineTo(d+u,p+h),s.quadraticCurveTo(d,p+h,d,p+h-u),s.lineTo(d,p+u),s.quadraticCurveTo(d,p,d+u,p),s.closePath(),s.fill(),s.strokeStyle="rgba(148, 163, 184, 0.18)",s.lineWidth=1,s.stroke(),s.textAlign="center",s.textBaseline="middle",s.fillStyle=e,s.fillText(r,n.width/2,n.height/2+1);const g=new bc(n);g.needsUpdate=!0;const _=new Xi({map:g,transparent:!0,opacity:0,depthTest:!1,sizeAttenuation:!0}),m=new Bi(_);return m.scale.set(9,1.2,1),m}updatePositions(){this.group.children.forEach(t=>{if(t.userData.nodeId){const e=this.positions.get(t.userData.nodeId);if(!e)return;t.userData.isGlow?t.position.copy(e):t.userData.isLabel?(t.position.copy(e),t.position.y+=t.userData.offset):t instanceof be&&t.position.copy(e)}})}animate(t,e,n,s=1){var a,o;for(let l=this.materializingNodes.length-1;l>=0;l--){const c=this.materializingNodes[l];c.frame++;const h=Math.min(c.frame/c.totalFrames,1),d=Yl(h);if(c.mesh.scale.setScalar(Math.max(.001,d)),c.frame>=5){const p=Math.min((c.frame-5)/5,1),u=c.glow.material;u.opacity=p*.4;const g=c.targetScale*6*d;c.glow.scale.set(g,g,1)}if(c.frame>=40){const p=Math.min((c.frame-40)/20,1);c.label.material.opacity=p*.9}c.frame>=60&&this.materializingNodes.splice(l,1)}for(let l=this.dissolvingNodes.length-1;l>=0;l--){const c=this.dissolvingNodes[l];c.frame++;const h=Math.min(c.frame/c.totalFrames,1),d=1-zg(h),p=Math.max(.001,c.originalScale*d);c.mesh.scale.setScalar(p);const u=p*6;c.glow.scale.set(u,u,1);const g=c.mesh.material;g.opacity*=.97,c.glow.material.opacity*=.95,c.label.material.opacity*=.93,c.frame>=c.totalFrames&&(this.group.remove(c.mesh),this.group.remove(c.glow),this.group.remove(c.label),c.mesh.geometry.dispose(),c.mesh.material.dispose(),(a=c.glow.material.map)==null||a.dispose(),c.glow.material.dispose(),(o=c.label.material.map)==null||o.dispose(),c.label.material.dispose(),this.meshMap.delete(c.id),this.glowMap.delete(c.id),this.labelSprites.delete(c.id),this.positions.delete(c.id),this.dissolvingNodes.splice(l,1))}for(let l=this.growingNodes.length-1;l>=0;l--){const c=this.growingNodes[l];c.frame++;const h=Math.min(c.frame/c.totalFrames,1),d=c.startScale+(c.targetScale-c.startScale)*Yl(h),p=this.meshMap.get(c.id);p&&p.scale.setScalar(d);const u=this.glowMap.get(c.id);if(u){const g=d*6;u.scale.set(g,g,1)}c.frame>=c.totalFrames&&this.growingNodes.splice(l,1)}const r=new Set([...this.materializingNodes.map(l=>l.id),...this.dissolvingNodes.map(l=>l.id),...this.growingNodes.map(l=>l.id)]);this.meshMap.forEach((l,c)=>{if(r.has(c))return;const h=e.find(T=>T.id===c);if(!h)return;const d=1+Math.sin(t*1.5+e.indexOf(h)*.5)*.15*h.retention;l.scale.setScalar(d);const p=this.positions.get(c),u=p?n.position.distanceTo(p):0,g=1+Math.min(1.4,Math.max(0,(u-60)/100)),_=l.material;if(c===this.hoveredNode)_.emissiveIntensity=1*s;else if(c===this.selectedNode)_.emissiveIntensity=.8*s;else{const E=.3+h.retention*.5+Math.sin(t*(.8+h.retention*.7))*.1*h.retention;_.emissiveIntensity=E*s*g}const m=.3+h.retention*.7;_.opacity=Math.min(1,m*s*g);const f=this.glowMap.get(c);if(f){const T=f.material,E=.3+h.retention*.35;T.opacity=Math.min(.95,E*s*g)}}),this.labelSprites.forEach((l,c)=>{if(r.has(c))return;const h=this.positions.get(c);if(!h)return;const d=n.position.distanceTo(h),p=l.material,u=c===this.hoveredNode||c===this.selectedNode?1:d<40?.9:d<80?.9*(1-(d-40)/40):0;p.opacity+=(u-p.opacity)*.1})}getMeshes(){return Array.from(this.meshMap.values())}dispose(){this.group.traverse(t=>{var e,n,s,r,a;t instanceof be?((e=t.geometry)==null||e.dispose(),(n=t.material)==null||n.dispose()):t instanceof Bi&&((r=(s=t.material)==null?void 0:s.map)==null||r.dispose(),(a=t.material)==null||a.dispose())}),this.materializingNodes=[],this.dissolvingNodes=[],this.growingNodes=[]}}function Hg(i){return 1-Math.pow(1-i,3)}class Vg{constructor(){kt(this,"group");kt(this,"growingEdges",[]);kt(this,"dissolvingEdges",[]);this.group=new zi}createEdges(t,e){for(const n of t){const s=e.get(n.source),r=e.get(n.target);if(!s||!r)continue;const a=[s,r],o=new ge().setFromPoints(a),l=new Ar({color:9133302,transparent:!0,opacity:Math.min(.25+n.weight*.5,.8),blending:Le,depthWrite:!1}),c=new co(o,l);c.userData={source:n.source,target:n.target},this.group.add(c)}}addEdge(t,e){const n=e.get(t.source),s=e.get(t.target);if(!n||!s)return;const r=[n.clone(),n.clone()],a=new ge().setFromPoints(r),o=new Ar({color:9133302,transparent:!0,opacity:0,blending:Le,depthWrite:!1}),l=new co(a,o);l.userData={source:t.source,target:t.target},this.group.add(l),this.growingEdges.push({line:l,source:t.source,target:t.target,frame:0,totalFrames:45})}removeEdgesForNode(t){const e=[];this.group.children.forEach(n=>{const s=n;(s.userData.source===t||s.userData.target===t)&&e.push(s)});for(const n of e)this.growingEdges=this.growingEdges.filter(s=>s.line!==n),this.dissolvingEdges.push({line:n,frame:0,totalFrames:40})}animateEdges(t){for(let e=this.growingEdges.length-1;e>=0;e--){const n=this.growingEdges[e];n.frame++;const s=Hg(Math.min(n.frame/n.totalFrames,1)),r=t.get(n.source),a=t.get(n.target);if(!r||!a)continue;const o=r.clone().lerp(a,s),l=n.line.geometry.attributes.position;l.setXYZ(0,r.x,r.y,r.z),l.setXYZ(1,o.x,o.y,o.z),l.needsUpdate=!0;const c=n.line.material;c.opacity=s*.65,n.frame>=n.totalFrames&&(c.opacity=.65,this.growingEdges.splice(e,1))}for(let e=this.dissolvingEdges.length-1;e>=0;e--){const n=this.dissolvingEdges[e];n.frame++;const s=n.frame/n.totalFrames,r=n.line.material;r.opacity=Math.max(0,.65*(1-s)),n.frame>=n.totalFrames&&(this.group.remove(n.line),n.line.geometry.dispose(),n.line.material.dispose(),this.dissolvingEdges.splice(e,1))}}updatePositions(t){this.group.children.forEach(e=>{const n=e;if(this.growingEdges.some(a=>a.line===n)||this.dissolvingEdges.some(a=>a.line===n))return;const s=t.get(n.userData.source),r=t.get(n.userData.target);if(s&&r){const a=n.geometry.attributes.position;a.setXYZ(0,s.x,s.y,s.z),a.setXYZ(1,r.x,r.y,r.z),a.needsUpdate=!0}})}dispose(){this.group.children.forEach(t=>{var n,s;const e=t;(n=e.geometry)==null||n.dispose(),(s=e.material)==null||s.dispose()}),this.growingEdges=[],this.dissolvingEdges=[]}}class Gg{constructor(t){kt(this,"starField");kt(this,"neuralParticles");this.starField=this.createStarField(),this.neuralParticles=this.createNeuralParticles(),t.add(this.starField),t.add(this.neuralParticles)}createStarField(){const e=new ge,n=new Float32Array(3e3*3),s=new Float32Array(3e3);for(let a=0;a<3e3;a++)n[a*3]=(Math.random()-.5)*1e3,n[a*3+1]=(Math.random()-.5)*1e3,n[a*3+2]=(Math.random()-.5)*1e3,s[a]=Math.random()*1.5;e.setAttribute("position",new he(n,3)),e.setAttribute("size",new he(s,1));const r=new oi({color:6514417,size:.5,transparent:!0,opacity:.4,sizeAttenuation:!0,blending:Le});return new Yi(e,r)}createNeuralParticles(){const e=new ge,n=new Float32Array(500*3),s=new Float32Array(500*3);for(let a=0;a<500;a++)n[a*3]=(Math.random()-.5)*100,n[a*3+1]=(Math.random()-.5)*100,n[a*3+2]=(Math.random()-.5)*100,s[a*3]=.4+Math.random()*.3,s[a*3+1]=.3+Math.random()*.2,s[a*3+2]=.8+Math.random()*.2;e.setAttribute("position",new he(n,3)),e.setAttribute("color",new he(s,3));const r=new oi({size:.3,vertexColors:!0,transparent:!0,opacity:.4,blending:Le,sizeAttenuation:!0});return new Yi(e,r)}animate(t){this.starField.rotation.y+=1e-4,this.starField.rotation.x+=5e-5;const e=this.neuralParticles.geometry.attributes.position;for(let n=0;n=0;s--){const r=this.pulseEffects[s];if(r.intensity-=r.decay,r.intensity<=0){this.pulseEffects.splice(s,1);continue}const a=t.get(r.nodeId);if(a){const o=a.material;o.emissive.lerp(r.color,r.intensity*.3),o.emissiveIntensity=Math.max(o.emissiveIntensity,r.intensity)}}for(let s=this.spawnBursts.length-1;s>=0;s--){const r=this.spawnBursts[s];if(r.age++,r.age>120){this.scene.remove(r.particles),r.particles.geometry.dispose(),r.particles.material.dispose(),this.spawnBursts.splice(s,1);continue}const a=r.particles.geometry.attributes.position,o=r.particles.geometry.attributes.velocity;for(let c=0;c=0;s--){const r=this.rainbowBursts[s];if(r.age++,r.age>r.maxAge){this.scene.remove(r.particles),r.particles.geometry.dispose(),r.particles.material.dispose(),this.rainbowBursts.splice(s,1);continue}const a=r.particles.geometry.attributes.position,o=r.particles.geometry.attributes.velocity;for(let p=0;p=0;s--){const r=this.rippleWaves[s];if(r.age++,r.radius+=r.speed,r.age>r.maxAge){this.rippleWaves.splice(s,1);continue}const a=r.radius,o=3;n.forEach((l,c)=>{if(r.pulsedNodes.has(c))return;const h=l.distanceTo(r.origin);h>=a-o&&h<=a+o&&(r.pulsedNodes.add(c),this.addPulse(c,.8,new ot(65489),.03))})}for(let s=this.implosions.length-1;s>=0;s--){const r=this.implosions[s];if(r.age++,r.age>r.maxAge+20){this.scene.remove(r.particles),r.particles.geometry.dispose(),r.particles.material.dispose(),r.flash&&(this.scene.remove(r.flash),r.flash.geometry.dispose(),r.flash.material.dispose()),this.implosions.splice(s,1);continue}if(r.age<=r.maxAge){const a=r.particles.geometry.attributes.position,o=r.particles.geometry.attributes.velocity,l=1+r.age*.02;for(let h=0;hr.maxAge){const a=(r.age-r.maxAge)/20;r.flash.material.opacity=Math.max(0,1-a),r.flash.scale.setScalar(1+a*3)}}for(let s=this.shockwaves.length-1;s>=0;s--){const r=this.shockwaves[s];if(r.age++,r.age>r.maxAge){this.scene.remove(r.mesh),r.mesh.geometry.dispose(),r.mesh.material.dispose(),this.shockwaves.splice(s,1);continue}const a=r.age/r.maxAge;r.mesh.scale.setScalar(1+a*20),r.mesh.material.opacity=.8*(1-a),r.mesh.lookAt(e.position)}for(let s=this.connectionFlashes.length-1;s>=0;s--){const r=this.connectionFlashes[s];if(r.intensity-=.015,r.intensity<=0){this.scene.remove(r.line),r.line.geometry.dispose(),r.line.material.dispose(),this.connectionFlashes.splice(s,1);continue}r.line.material.opacity=r.intensity}for(let s=this.birthOrbs.length-1;s>=0;s--){const r=this.birthOrbs[s];r.age++;const a=r.gestationFrames+r.flightFrames,o=r.sprite.material,l=r.core.material,c=r.getTargetPos();if(c)r.lastTargetPos.copy(c);else if(r.age>r.gestationFrames&&!r.aborted){r.aborted=!0;const h=r.sprite.position;o.color.setRGB(1,.15,.2),l.color.setRGB(1,.6,.6),this.createImplosion(h,new ot(16721203)),r.arriveFired=!0,r.age=a+1}if(r.age<=r.gestationFrames){const h=r.age/r.gestationFrames,d=1-Math.pow(1-h,3),p=.85+Math.sin(r.age*.35)*.15,u=.5+d*4.5*p,g=.2+d*1.8*p;r.sprite.scale.set(u,u,1),r.core.scale.set(g,g,1),o.opacity=d*.95,l.opacity=d,o.color.copy(r.color).multiplyScalar(.7+d*.3),r.sprite.position.copy(r.startPos),r.core.position.copy(r.startPos)}else if(r.age<=a){const h=(r.age-r.gestationFrames)/r.flightFrames,d=h<.5?2*h*h:1-Math.pow(-2*h+2,2)/2,p=r.startPos,u=r.lastTargetPos,g=u.x-p.x,_=u.y-p.y,m=u.z-p.z,f=Math.sqrt(g*g+_*_+m*m),T=(p.x+u.x)*.5,E=(p.y+u.y)*.5+30+f*.15,y=(p.z+u.z)*.5,D=1-d,w=D*D,C=2*D*d,I=d*d,S=w*p.x+C*T+I*u.x,M=w*p.y+C*E+I*u.y,A=w*p.z+C*y+I*u.z;r.sprite.position.set(S,M,A),r.core.position.set(S,M,A);const W=1-d*.35;r.sprite.scale.setScalar(5*W),r.core.scale.setScalar(2*W),o.opacity=.95,l.opacity=1,o.color.copy(r.color)}else if(r.arriveFired){const h=r.age-a,d=Math.max(0,1-h/8);o.opacity=.95*d,l.opacity=1*d,r.sprite.scale.setScalar(5*(1+(1-d)*2)),d<=0&&(this.scene.remove(r.sprite),this.scene.remove(r.core),o.dispose(),l.dispose(),this.birthOrbs.splice(s,1))}else{r.arriveFired=!0;try{r.onArrive()}catch(h){console.warn("[birth-orb] onArrive threw",h)}}}}dispose(){for(const t of this.spawnBursts)this.scene.remove(t.particles),t.particles.geometry.dispose(),t.particles.material.dispose();for(const t of this.rainbowBursts)this.scene.remove(t.particles),t.particles.geometry.dispose(),t.particles.material.dispose();for(const t of this.implosions)this.scene.remove(t.particles),t.particles.geometry.dispose(),t.particles.material.dispose(),t.flash&&(this.scene.remove(t.flash),t.flash.geometry.dispose(),t.flash.material.dispose());for(const t of this.shockwaves)this.scene.remove(t.mesh),t.mesh.geometry.dispose(),t.mesh.material.dispose();for(const t of this.connectionFlashes)this.scene.remove(t.line),t.line.geometry.dispose(),t.line.material.dispose();for(const t of this.birthOrbs)this.scene.remove(t.sprite),this.scene.remove(t.core),t.sprite.material.dispose(),t.core.material.dispose();this.pulseEffects=[],this.spawnBursts=[],this.rainbowBursts=[],this.rippleWaves=[],this.implosions=[],this.shockwaves=[],this.connectionFlashes=[],this.birthOrbs=[]}}const wn={bloomStrength:.8,rotateSpeed:.3,fogColor:328976,fogDensity:.008,nebulaIntensity:0,chromaticIntensity:.002,vignetteRadius:.9,breatheAmplitude:1},zn={bloomStrength:1.8,rotateSpeed:.08,fogColor:656672,fogDensity:.006,nebulaIntensity:1,chromaticIntensity:.005,vignetteRadius:.7,breatheAmplitude:2};class Xg{constructor(){kt(this,"active",!1);kt(this,"transition",0);kt(this,"transitionSpeed",.008);kt(this,"current");kt(this,"auroraHue",0);this.current={...wn}}setActive(t){this.active=t}update(t,e,n,s,r){const a=this.active?1:0;this.transition+=(a-this.transition)*this.transitionSpeed*60*(1/60),this.transition=Math.max(0,Math.min(1,this.transition));const o=this.transition;this.current.bloomStrength=this.lerp(wn.bloomStrength,zn.bloomStrength,o),this.current.rotateSpeed=this.lerp(wn.rotateSpeed,zn.rotateSpeed,o),this.current.fogDensity=this.lerp(wn.fogDensity,zn.fogDensity,o),this.current.nebulaIntensity=this.lerp(wn.nebulaIntensity,zn.nebulaIntensity,o),this.current.chromaticIntensity=this.lerp(wn.chromaticIntensity,zn.chromaticIntensity,o),this.current.vignetteRadius=this.lerp(wn.vignetteRadius,zn.vignetteRadius,o),this.current.breatheAmplitude=this.lerp(wn.breatheAmplitude,zn.breatheAmplitude,o),e.strength=this.current.bloomStrength,n.autoRotateSpeed=this.current.rotateSpeed;const l=new ot(wn.fogColor),c=new ot(zn.fogColor),h=l.clone().lerp(c,o);if(t.fog=new Dr(h,this.current.fogDensity),o>.01){this.auroraHue=r*.1%1;const d=new ot().setHSL(.75+this.auroraHue*.15,.8,.5),p=new ot().setHSL(.55+this.auroraHue*.2,.7,.4);s.point1.color.lerp(d,o*.3),s.point2.color.lerp(p,o*.3)}else s.point1.color.set(6514417),s.point2.color.set(11032055)}lerp(t,e,n){return t+(e-t)*n}}const Yg=50,xs=[];function qg(i,t,e){const n=i.tags??[],s=i.type??"";let r=null,a=0;for(const o of t){let l=0;o.type===s&&(l+=2);for(const c of o.tags)n.includes(c)&&(l+=1);l>a&&(a=l,r=o.id)}if(r&&a>0){const o=e.get(r);if(o)return new P(o.x+(Math.random()-.5)*10,o.y+(Math.random()-.5)*10,o.z+(Math.random()-.5)*10)}return new P((Math.random()-.5)*40,(Math.random()-.5)*40,(Math.random()-.5)*40)}function jg(i,t){if(xs.length<=Yg)return;const e=xs.shift();i.edgeManager.removeEdgesForNode(e),i.nodeManager.removeNode(e),i.forceSim.removeNode(e),i.onMutation({type:"edgesRemoved",nodeId:e}),i.onMutation({type:"nodeRemoved",nodeId:e});const n=t.findIndex(s=>s.id===e);n!==-1&&t.splice(n,1)}function Zg(i,t,e){var d,p;const{effects:n,nodeManager:s,edgeManager:r,forceSim:a,camera:o,onMutation:l}=t,c=s.positions,h=s.meshMap;switch(i.type){case"MemoryCreated":{const u=i.data;if(!u.id)break;const g={id:u.id,label:(u.content??"").slice(0,60),type:u.node_type??"fact",retention:Math.max(0,Math.min(1,u.retention??.9)),tags:u.tags??[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),isCenter:!1},_=qg(g,e,c),m=s.addNode(g,_,{isBirthRitual:!0});a.addNode(u.id,m),xs.push(u.id),jg(t,e);const f=new ot(Sa[g.type]||"#00ffd1"),T=f.clone();T.offsetHSL(.15,0,0),n.createBirthOrb(o,f,()=>s.positions.get(g.id),()=>{s.igniteNode(g.id);const E=s.positions.get(g.id)??_,y=s.meshMap.get(g.id);y&&y.scale.multiplyScalar(1.8),n.createRainbowBurst(E,f),n.createShockwave(E,f,o),n.createShockwave(E,T,o),n.createRippleWave(E)}),l({type:"nodeAdded",node:g});break}case"ConnectionDiscovered":{const u=i.data;if(!u.source_id||!u.target_id)break;const g=c.get(u.source_id),_=c.get(u.target_id),m={source:u.source_id,target:u.target_id,weight:u.weight??.5,type:u.connection_type??"semantic"};r.addEdge(m,c),g&&_&&n.createConnectionFlash(g,_,new ot(54527)),u.source_id&&h.has(u.source_id)&&n.addPulse(u.source_id,1,new ot(54527),.02),u.target_id&&h.has(u.target_id)&&n.addPulse(u.target_id,1,new ot(54527),.02),l({type:"edgeAdded",edge:m});break}case"MemoryDeleted":{const u=i.data;if(!u.id)break;const g=c.get(u.id);if(g){const m=new ot(16729943);n.createImplosion(g,m)}r.removeEdgesForNode(u.id),s.removeNode(u.id),a.removeNode(u.id);const _=xs.indexOf(u.id);_!==-1&&xs.splice(_,1),l({type:"edgesRemoved",nodeId:u.id}),l({type:"nodeRemoved",nodeId:u.id});break}case"MemoryPromoted":{const u=i.data,g=u==null?void 0:u.id;if(!g)break;const _=u.new_retention??.95;if(h.has(g)){s.growNode(g,_),n.addPulse(g,1.2,new ot(65416),.01);const m=c.get(g);m&&(n.createShockwave(m,new ot(65416),o),n.createSpawnBurst(m,new ot(65416))),l({type:"nodeUpdated",nodeId:g,retention:_})}break}case"MemoryDemoted":{const u=i.data,g=u==null?void 0:u.id;if(!g)break;const _=u.new_retention??.3;h.has(g)&&(s.growNode(g,_),n.addPulse(g,.8,new ot(16729943),.03),l({type:"nodeUpdated",nodeId:g,retention:_}));break}case"MemoryUpdated":{const u=i.data,g=u==null?void 0:u.id;if(!g||!h.has(g))break;n.addPulse(g,.6,new ot(8490232),.02),u.retention!==void 0&&(s.growNode(g,u.retention),l({type:"nodeUpdated",nodeId:g,retention:u.retention}));break}case"SearchPerformed":{h.forEach((u,g)=>{n.addPulse(g,.6+Math.random()*.4,new ot(8490232),.02)});break}case"DreamStarted":{h.forEach((u,g)=>{n.addPulse(g,1,new ot(11032055),.005)});break}case"DreamProgress":{const u=(d=i.data)==null?void 0:d.memory_id;u&&h.has(u)&&n.addPulse(u,1.5,new ot(12616956),.01);break}case"DreamCompleted":{n.createSpawnBurst(new P(0,0,0),new ot(11032055)),n.createShockwave(new P(0,0,0),new ot(11032055),o);break}case"RetentionDecayed":{const u=(p=i.data)==null?void 0:p.id;u&&h.has(u)&&n.addPulse(u,.8,new ot(16729943),.03);break}case"ConsolidationCompleted":{h.forEach((u,g)=>{n.addPulse(g,.4+Math.random()*.3,new ot(16758784),.015)});break}case"ActivationSpread":{const u=i.data;if(u.source_id&&u.target_ids){const g=c.get(u.source_id);if(g)for(const _ of u.target_ids){const m=c.get(_);m&&n.createConnectionFlash(g,m,new ot(1370310))}}break}case"MemorySuppressed":{const u=i.data;if(!u.id)break;const g=c.get(u.id);if(g){n.createImplosion(g,new ot(11032055));const _=Math.max(1,u.suppression_count??1),m=Math.min(.4+_*.15,1);n.addPulse(u.id,m,new ot(11032055),.04)}break}case"MemoryUnsuppressed":{const u=i.data;if(!u.id)break;const g=c.get(u.id);g&&h.has(u.id)&&(n.createRainbowBurst(g,new ot(65416)),n.addPulse(u.id,1,new ot(65416),.02));break}case"Rac1CascadeSwept":{const g=i.data.neighbors_affected??0;if(g===0)break;const _=Array.from(h.keys()),m=Math.min(g,_.length,12);for(let f=0;f"u")return Mr;const i=localStorage.getItem(Fc);if(i===null)return Mr;const t=Number(i);return Number.isFinite(t)?Math.min(_o,Math.max(go,t)):Mr}const ni=a_();function a_(){let i=me(!1),t=me(va(new Date)),e=me(!1),n=me(1),s=me(!1),r=me(va(r_()));return{get temporalEnabled(){return B(i)},set temporalEnabled(a){zt(i,a,!0)},get temporalDate(){return B(t)},set temporalDate(a){zt(t,a,!0)},get temporalPlaying(){return B(e)},set temporalPlaying(a){zt(e,a,!0)},get temporalSpeed(){return B(n)},set temporalSpeed(a){zt(n,a,!0)},get dreamMode(){return B(s)},set dreamMode(a){zt(s,a,!0)},get brightness(){return B(r)},set brightness(a){const o=Math.min(_o,Math.max(go,a));if(zt(r,o,!0),typeof localStorage<"u")try{localStorage.setItem(Fc,String(o))}catch{}},brightnessMin:go,brightnessMax:_o,brightnessDefault:Mr}}var o_=Se('
      ');function l_(i,t){ys(t,!0);let e=vs(t,"events",19,()=>[]),n=vs(t,"isDreaming",3,!1),s=vs(t,"colorMode",3,"type");kc(()=>{l==null||l.setColorMode(s())});let r,a,o,l,c,h,d,p,u,g,_,m=null,f=[];jl(()=>{a=Dg(r),g=Jg(a.scene).material,_=i_(a.composer),h=new Gg(a.scene),l=new kg,l.colorMode=s(),c=new Vg,d=new Wg(a.scene),u=new Xg;const M=l.createNodes(t.nodes);c.createEdges(t.edges,M),p=new Ig(M),f=[...t.nodes],a.scene.add(c.group),a.scene.add(l.group),E(),window.addEventListener("resize",D),r.addEventListener("pointermove",w),r.addEventListener("click",C)}),Zl(()=>{cancelAnimationFrame(o),window.removeEventListener("resize",D),r==null||r.removeEventListener("pointermove",w),r==null||r.removeEventListener("click",C),d==null||d.dispose(),h==null||h.dispose(),l==null||l.dispose(),c==null||c.dispose(),a&&Ug(a)});let T=0;function E(){o=requestAnimationFrame(E);const S=performance.now();T===0&&(T=S);const M=S-T;if(M<16)return;T=S-M%16;const A=S*.001;p.tick(t.edges),l.updatePositions(),c.updatePositions(l.positions),c.animateEdges(l.positions),h.animate(A),l.animate(A,f,a.camera,ni.brightness),u.setActive(n()),u.update(a.scene,a.bloomPass,a.controls,a.lights,A),Qg(g,A,u.current.nebulaIntensity,r.clientWidth,r.clientHeight),s_(_,A,u.current.nebulaIntensity),y(),d.update(l.meshMap,a.camera,l.positions),a.controls.update(),a.composer.render()}function y(){if(!e()||e().length===0)return;const S=[];for(const A of e()){if(A===m)break;S.push(A)}if(S.length===0)return;if(S.length===e().length&&e().length>=200){console.warn("[vestige] Event horizon overflow: dropping visuals for",S.length,"events"),m=e()[0];return}m=e()[0];const M={effects:d,nodeManager:l,edgeManager:c,forceSim:p,camera:a.camera,onMutation:A=>{var W;A.type==="nodeAdded"?f=[...f,A.node]:A.type==="nodeRemoved"&&(f=f.filter(k=>k.id!==A.nodeId)),(W=t.onGraphMutation)==null||W.call(t,A)}};for(let A=S.length-1;A>=0;A--)Zg(S[A],M,f)}function D(){!r||!a||Lg(a,r)}function w(S){const M=r.getBoundingClientRect();a.mouse.x=(S.clientX-M.left)/M.width*2-1,a.mouse.y=-((S.clientY-M.top)/M.height)*2+1,a.raycaster.setFromCamera(a.mouse,a.camera);const A=a.raycaster.intersectObjects(l.getMeshes());A.length>0?(l.hoveredNode=A[0].object.userData.nodeId,r.style.cursor="pointer"):(l.hoveredNode=null,r.style.cursor="grab")}function C(){var S;if(l.hoveredNode){l.selectedNode=l.hoveredNode,(S=t.onSelect)==null||S.call(t,l.hoveredNode);const M=l.positions.get(l.hoveredNode);M&&a.controls.target.lerp(M.clone(),.5)}}var I=o_();Yc(I,S=>r=S,()=>r),_e(i,I),Es()}var c_=Se('
      '),h_=Se('
      ');function u_(i,t){ys(t,!0);let e=vs(t,"width",3,240),n=vs(t,"height",3,80);function s(m){return t.stability<=0?0:Math.exp(-m/t.stability)}let r=Gn(()=>{const m=[],f=Math.max(t.stability*3,30),T=4,E=e()-T*2,y=n()-T*2;for(let D=0;D<=50;D++){const w=D/50*f,C=s(w),I=T+D/50*E,S=T+(1-C)*y;m.push(`${D===0?"M":"L"}${I.toFixed(1)},${S.toFixed(1)}`)}return m.join(" ")}),a=Gn(()=>[{label:"Now",days:0,value:t.retention},{label:"1d",days:1,value:s(1)},{label:"7d",days:7,value:s(7)},{label:"30d",days:30,value:s(30)}]);function o(m){return m>.7?"#10b981":m>.4?"#f59e0b":"#ef4444"}var l=h_(),c=yt(l),h=yt(c),d=bt(h),p=bt(d),u=bt(p),g=bt(u);Hc(),xt(c);var _=bt(c,2);_s(_,21,()=>B(a),hr,(m,f)=>{var T=c_(),E=yt(T),y=yt(E);xt(E);var D=bt(E,2),w=yt(D);xt(D),xt(T),Ke((C,I)=>{fe(y,`${B(f).label??""}:`),Sr(D,`color: ${C??""}`),fe(w,`${I??""}%`)},[()=>o(B(f).value),()=>(B(f).value*100).toFixed(0)]),_e(m,T)}),xt(_),xt(l),Ke(m=>{ve(c,"width",e()),ve(c,"height",n()),ve(c,"viewBox",`0 0 ${e()??""} ${n()??""}`),ve(h,"y1",4+(n()-8)*.5),ve(h,"x2",e()-4),ve(h,"y2",4+(n()-8)*.5),ve(d,"y1",4+(n()-8)*.8),ve(d,"x2",e()-4),ve(d,"y2",4+(n()-8)*.8),ve(p,"d",B(r)),ve(u,"d",`${B(r)??""} L${e()-4},${n()-4} L4,${n()-4} Z`),ve(g,"cy",4+(1-t.retention)*(n()-8)),ve(g,"fill",m)},[()=>o(t.retention)]),_e(i,l),Es()}function ql(i,t,e){const n=e.getTime(),s=new Set,r=new Map,a=i.filter(l=>{const c=new Date(l.createdAt).getTime();if(c<=n){s.add(l.id);const h=n-c,d=1440*60*1e3,p=hs.has(l.source)&&s.has(l.target));return{visibleNodes:a,visibleEdges:o,nodeOpacities:r}}function d_(i){if(i.length===0){const n=new Date;return{oldest:n,newest:n}}let t=1/0,e=-1/0;for(const n of i){const s=new Date(n.createdAt).getTime();se&&(e=s)}return{oldest:new Date(t),newest:new Date(e)}}var f_=Se(`
      `),p_=Se('');function m_(i,t){ys(t,!0);let e=me(!1),n=me(!1),s=me(1),r=me(100),a,o=0,l=Gn(()=>d_(t.nodes)),c=Gn(()=>{const E=B(l).oldest.getTime(),D=B(l).newest.getTime()-E||1;return new Date(E+B(r)/100*D)});function h(E){return E.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function d(){zt(e,!B(e)),t.onToggle(B(e)),B(e)&&(zt(r,100),t.onDateChange(B(c)))}function p(){zt(n,!B(n)),B(n)?(zt(r,0),o=performance.now(),u()):cancelAnimationFrame(a)}function u(){B(n)&&(a=requestAnimationFrame(E=>{const y=(E-o)/1e3;o=E;const D=B(l).oldest.getTime(),C=(B(l).newest.getTime()-D)/(1440*60*1e3)||1,I=B(s)/C*100;if(zt(r,Math.min(100,B(r)+I*y),!0),t.onDateChange(B(c)),B(r)>=100){zt(n,!1);return}u()}))}function g(){t.onDateChange(B(c))}Zl(()=>{zt(n,!1),cancelAnimationFrame(a)});var _=Gc(),m=Kl(_);{var f=E=>{var y=f_(),D=yt(y),w=yt(D),C=yt(w),I=yt(C),S=yt(I,!0);xt(I);var M=bt(I,2),A=yt(M);A.value=A.__value=1;var W=bt(A);W.value=W.__value=7;var k=bt(W);k.value=k.__value=30,xt(M),xt(C);var q=bt(C,2),Q=yt(q,!0);xt(q);var X=bt(q,2);xt(w);var tt=bt(w,2);xa(tt);var H=bt(tt,2),st=yt(H),gt=yt(st,!0);xt(st);var Et=bt(st,2),Ft=yt(Et,!0);xt(Et),xt(H),xt(D),xt(y),Ke((Xt,Y,nt)=>{fe(S,B(n)?"⏸":"▶"),fe(Q,Xt),fe(gt,Y),fe(Ft,nt)},[()=>h(B(c)),()=>h(B(l).oldest),()=>h(B(l).newest)]),Fe("click",I,p),Jl(M,()=>B(s),Xt=>zt(s,Xt)),Fe("click",X,d),Fe("input",tt,g),Ma(tt,()=>B(r),Xt=>zt(r,Xt)),_e(E,y)},T=E=>{var y=p_();Fe("click",y,d),_e(E,y)};kn(m,E=>{B(e)?E(f):E(T,!1)})}_e(i,_),Es()}$l(["click","input"]);var g_=Se('
      '),__=Se('
      FSRS accessibility
      ');function v_(i,t){ys(t,!1);const e=["active","dormant","silent","unavailable"];qc();var n=__(),s=bt(yt(n),2);_s(s,1,()=>e,r=>r,(r,a)=>{var o=g_(),l=yt(o),c=bt(l,2),h=yt(c,!0);xt(c);var d=bt(c,2),p=yt(d,!0);xt(d),xt(o),Ke(u=>{Sr(l,`background: ${po[B(a)]??""}; box-shadow: 0 0 6px ${po[B(a)]??""}55;`),fe(h,B(a)),fe(p,u)},[()=>{var u;return((u=Fg[B(a)].match(/\(([^)]+)\)/))==null?void 0:u[1])??""}]),_e(r,o)}),xt(n),_e(i,n),Es()}var x_=Se('

      Loading memory graph...

      '),M_=Se(`

      MCP Backend Offline

      The Vestige MCP server isn't reachable on :3927. + The dashboard is running but has nothing to query.

      Start the backend:
      nohup bash -c 'tail -f /dev/null | VESTIGE_DASHBOARD_ENABLED=true ~/.local/bin/vestige-mcp' > /tmp/vestige.log 2>&1 & +disown
      `),S_=Se('

      Your Mind Awaits

      No memories yet. Start using Vestige to populate your graph.

      '),y_=Se('

      Your Mind Awaits

      '),E_=Se(' · · ',1),b_=Se('
      '),T_=Se('
      '),w_=Se('
      AhaGraph
      '),A_=Se(' '),R_=Se('
      '),C_=Se("
      "),P_=Se(`

      Memory Detail

      Retention Forecast
      ◬ Explore Connections
      `),D_=Se(`
      `);function Q_(i,t){ys(t,!0);const e=()=>Xc(jc,"$eventFeed",n),[n,s]=Wc();let r=me(null),a=me(null),o=me(!0),l=me(""),c=me(!1),h=me(""),d=me(150),p=me(!1),u=me(va(new Date)),g=me("type");const _=Object.entries(xr);let m=me(0),f=me(0),T=Gn(()=>B(r)?B(p)?ql(B(r).nodes,B(r).edges,B(u)).visibleNodes:B(r).nodes:[]),E=Gn(()=>B(r)?B(p)?ql(B(r).nodes,B(r).edges,B(u)).visibleEdges:B(r).edges:[]);function y(V){if(B(r))switch(V.type){case"nodeAdded":B(r).nodes=[...B(r).nodes,V.node],B(r).nodeCount=B(r).nodes.length,zt(m,B(r).nodeCount,!0);break;case"nodeRemoved":B(r).nodes=B(r).nodes.filter(at=>at.id!==V.nodeId),B(r).nodeCount=B(r).nodes.length,zt(m,B(r).nodeCount,!0);break;case"edgeAdded":B(r).edges=[...B(r).edges,V.edge],B(r).edgeCount=B(r).edges.length,zt(f,B(r).edgeCount,!0);break;case"edgesRemoved":B(r).edges=B(r).edges.filter(at=>at.source!==V.nodeId&&at.target!==V.nodeId),B(r).edgeCount=B(r).edges.length,zt(f,B(r).edgeCount,!0);break;case"nodeUpdated":{const at=B(r).nodes.find(Z=>Z.id===V.nodeId);at&&(at.retention=V.retention);break}}}jl(()=>{const V=new URLSearchParams(window.location.search).get("colorMode");D(V)&&zt(g,V,!0),w()});function D(V){return V==="type"||V==="state"||V==="ahagraph"}async function w(V,at){var Z;zt(o,!0),zt(l,"");try{const it=!V&&!at;if(zt(r,await gi.graph({max_nodes:B(d),depth:3,query:V||void 0,center_id:at||void 0,sort:it?"recent":void 0}),!0),it&&B(r)&&B(r).nodeCount<=1&&B(r).edgeCount===0){const pt=await gi.graph({max_nodes:B(d),depth:3,sort:"connected"});pt&&pt.nodeCount>B(r).nodeCount&&zt(r,pt,!0)}B(r)&&(zt(m,B(r).nodeCount,!0),zt(f,B(r).edgeCount,!0))}catch(it){const pt=it instanceof Error?it.message:String(it),wt=pt.replace(/\/[\w./-]+\.(sqlite|rs|db|toml|lock)\b/g,"[path]").slice(0,200),ht=it instanceof TypeError||/failed to fetch|NetworkError|load failed/i.test(pt)||/^API 500:?\s*(Internal Server Error)?\s*$/i.test(pt.trim()),Bt=(((Z=B(r))==null?void 0:Z.nodeCount)??0)===0&&/not found|404|empty|no memor/i.test(pt);ht?zt(l,"OFFLINE"):Bt?zt(l,"EMPTY"):zt(l,`Failed to load graph: ${wt}`)}finally{zt(o,!1)}}async function C(){zt(c,!0);try{await gi.dream(),await w()}catch{}finally{zt(c,!1)}}async function I(V){try{zt(a,await gi.memories.get(V),!0)}catch{zt(a,null)}}function S(){B(h).trim()&&w(B(h))}var M=D_(),A=yt(M);{var W=V=>{var at=x_();_e(V,at)},k=V=>{var at=M_(),Z=yt(at),it=bt(yt(Z),8),pt=yt(it),wt=bt(pt,2);xt(it),xt(Z),xt(at),Ke(()=>ve(wt,"href",`${Do??""}/settings`)),Fe("click",pt,()=>w()),_e(V,at)},q=V=>{var at=S_();_e(V,at)},Q=V=>{var at=y_(),Z=yt(at),it=bt(yt(Z),4),pt=yt(it,!0);xt(it),xt(Z),xt(at),Ke(()=>fe(pt,B(l))),_e(V,at)},X=V=>{l_(V,{get nodes(){return B(T)},get edges(){return B(E)},get centerId(){return B(r).center_id},get events(){return e()},get isDreaming(){return B(c)},get colorMode(){return B(g)},onSelect:I,onGraphMutation:y})};kn(A,V=>{B(o)?V(W):B(l)==="OFFLINE"?V(k,1):B(l)==="EMPTY"?V(q,2):B(l)?V(Q,3):B(r)&&V(X,4)})}var tt=bt(A,2),H=yt(tt),st=yt(H);xa(st);var gt=bt(st,2);xt(H);var Et=bt(H,2),Ft=yt(Et),Xt=yt(Ft),Y=bt(Xt,2),nt=bt(Y,2);xt(Ft);var _t=bt(Ft,2),lt=yt(_t);lt.value=lt.__value=50;var Ct=bt(lt);Ct.value=Ct.__value=100;var Lt=bt(Ct);Lt.value=Lt.__value=150;var Vt=bt(Lt);Vt.value=Vt.__value=200,xt(_t);var ie=bt(_t,2),Wt=bt(yt(ie),2);xa(Wt);var ue=bt(Wt,2),R=yt(ue);xt(ue),xt(ie);var ye=bt(ie,2),qt=yt(ye,!0);xt(ye);var jt=bt(ye,2);xt(Et),xt(tt);var At=bt(tt,2),le=yt(At);{var Rt=V=>{var at=E_(),Z=Kl(at),it=yt(Z);xt(Z);var pt=bt(Z,4),wt=yt(pt);xt(pt);var ht=bt(pt,4),Bt=yt(ht);xt(ht),Ke(()=>{fe(it,`${B(m)??""} nodes`),fe(wt,`${B(f)??""} edges`),fe(Bt,`depth ${B(r).depth??""}`)}),_e(V,at)};kn(le,V=>{B(r)&&V(Rt)})}xt(At);var b=bt(At,2);{var v=V=>{var at=b_(),Z=yt(at);v_(Z,{}),xt(at),_e(V,at)};kn(b,V=>{B(g)==="state"&&V(v)})}var F=bt(b,2);{var K=V=>{var at=w_(),Z=bt(yt(at),2);_s(Z,21,()=>_,hr,(it,pt)=>{var wt=Gn(()=>Vc(B(pt),2));let ht=()=>B(wt)[0],Bt=()=>B(wt)[1];var Ut=T_(),Zt=yt(Ut),L=bt(Zt,2),rt=yt(L,!0);xt(L),xt(Ut),Ke(()=>{Sr(Zt,`background: ${Bt()??""}`),fe(rt,Og[ht()])}),_e(it,Ut)}),xt(Z),xt(at),_e(V,at)};kn(F,V=>{B(g)==="ahagraph"&&V(K)})}var J=bt(F,2);{var j=V=>{m_(V,{get nodes(){return B(r).nodes},onDateChange:at=>{zt(u,at,!0)},onToggle:at=>{zt(p,at,!0)}})};kn(J,V=>{B(r)&&V(j)})}var Tt=bt(J,2);{var dt=V=>{var at=P_(),Z=yt(at),it=bt(yt(Z),2);xt(Z);var pt=bt(Z,2),wt=yt(pt),ht=yt(wt),Bt=yt(ht,!0);xt(ht);var Ut=bt(ht,2);_s(Ut,17,()=>B(a).tags,hr,(Ve,Re)=>{var tn=A_(),en=yt(tn,!0);xt(tn),Ke(()=>fe(en,B(Re))),_e(Ve,tn)}),xt(wt);var Zt=bt(wt,2),L=yt(Zt,!0);xt(Zt);var rt=bt(Zt,2);_s(rt,21,()=>[{label:"Retention",value:B(a).retentionStrength},{label:"Storage",value:B(a).storageStrength},{label:"Retrieval",value:B(a).retrievalStrength}],hr,(Ve,Re)=>{var tn=R_(),en=yt(tn),pi=yt(en),Ps=yt(pi,!0);xt(pi);var Ds=bt(pi,2),Ir=yt(Ds);xt(Ds),xt(en);var Ls=bt(en,2),Nr=yt(Ls);xt(Ls),xt(tn),Ke(Fr=>{fe(Ps,B(Re).label),fe(Ir,`${Fr??""}%`),Sr(Nr,`width: ${B(Re).value*100}%; background: ${B(Re).value>.7?"#10b981":B(Re).value>.4?"#f59e0b":"#ef4444"}`)},[()=>(B(Re).value*100).toFixed(1)]),_e(Ve,tn)}),xt(rt);var G=bt(rt,2),$=bt(yt(G),2);{let Ve=Gn(()=>B(a).storageStrength*30);u_($,{get retention(){return B(a).retentionStrength},get stability(){return B(Ve)}})}xt(G);var ft=bt(G,2),ut=yt(ft),Ot=yt(ut);xt(ut);var ce=bt(ut,2),Ae=yt(ce);xt(ce);var $t=bt(ce,2);{var Ye=Ve=>{var Re=C_(),tn=yt(Re);xt(Re),Ke(en=>fe(tn,`Accessed: ${en??""}`),[()=>new Date(B(a).lastAccessedAt).toLocaleString()]),_e(Ve,Re)};kn($t,Ve=>{B(a).lastAccessedAt&&Ve(Ye)})}var Qe=bt($t,2),Rs=yt(Qe);xt(Qe),xt(ft);var fi=bt(ft,2),pn=yt(fi),ns=bt(pn,2);xt(fi);var Cs=bt(fi,2);xt(pt),xt(at),Ke((Ve,Re)=>{fe(Bt,B(a).nodeType),fe(L,B(a).content),fe(Ot,`Created: ${Ve??""}`),fe(Ae,`Updated: ${Re??""}`),fe(Rs,`Reviews: ${B(a).reviewCount??0??""}`),ve(Cs,"href",`${Do??""}/explore`)},[()=>new Date(B(a).createdAt).toLocaleString(),()=>new Date(B(a).updatedAt).toLocaleString()]),Fe("click",it,()=>zt(a,null)),Fe("click",pn,()=>{B(a)&&gi.memories.promote(B(a).id)}),Fe("click",ns,()=>{B(a)&&gi.memories.demote(B(a).id)}),_e(V,at)};kn(Tt,V=>{B(a)&&V(dt)})}xt(M),Ke((V,at)=>{ve(Xt,"aria-checked",B(g)==="type"),Us(Xt,1,`px-3 py-1.5 rounded-lg transition ${B(g)==="type"?"bg-synapse/25 text-synapse-glow":"text-dim hover:text-text"}`),ve(Y,"aria-checked",B(g)==="state"),Us(Y,1,`px-3 py-1.5 rounded-lg transition ${B(g)==="state"?"bg-synapse/25 text-synapse-glow":"text-dim hover:text-text"}`),ve(nt,"aria-checked",B(g)==="ahagraph"),Us(nt,1,`px-3 py-1.5 rounded-lg transition ${B(g)==="ahagraph"?"bg-synapse/25 text-synapse-glow":"text-dim hover:text-text"}`),ve(ie,"title",`Adjust graph brightness (${V??""}x). Combines with auto distance compensation.`),ve(Wt,"min",ni.brightnessMin),ve(Wt,"max",ni.brightnessMax),fe(R,`${at??""}x`),ye.disabled=B(c),Us(ye,1,`px-4 py-2 rounded-xl bg-dream/20 border border-dream/40 text-dream-glow text-sm + hover:bg-dream/30 transition-all backdrop-blur-sm disabled:opacity-50 + ${B(c)?"glow-dream animate-pulse-glow":""}`),fe(qt,B(c)?"◈ Dreaming...":"◈ Dream")},[()=>ni.brightness.toFixed(1),()=>ni.brightness.toFixed(1)]),Fe("keydown",st,V=>V.key==="Enter"&&S()),Ma(st,()=>B(h),V=>zt(h,V)),Fe("click",gt,S),Fe("click",Xt,()=>zt(g,"type")),Fe("click",Y,()=>zt(g,"state")),Fe("click",nt,()=>zt(g,"ahagraph")),Fe("change",_t,()=>w()),Jl(_t,()=>B(d),V=>zt(d,V)),Ma(Wt,()=>ni.brightness,V=>ni.brightness=V),Fe("click",ye,C),Fe("click",jt,()=>w()),_e(i,M),Es(),s()}$l(["click","keydown","change"]);export{Q_ as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/10.Btb56kL1.js.br b/apps/dashboard/build/_app/immutable/nodes/10.Btb56kL1.js.br new file mode 100644 index 0000000..0115d29 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/10.Btb56kL1.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/10.Btb56kL1.js.gz b/apps/dashboard/build/_app/immutable/nodes/10.Btb56kL1.js.gz new file mode 100644 index 0000000..b707b91 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/10.Btb56kL1.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/10.DYHIt_do.js b/apps/dashboard/build/_app/immutable/nodes/10.DYHIt_do.js deleted file mode 100644 index 47efa48..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/10.DYHIt_do.js +++ /dev/null @@ -1,8 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{p as oe,o as ve,g as e,i as E,e as s,h as v,r,f as ne,t as C,a as u,b as ie,s as W,u as k,j as p,n as X}from"../chunks/wpu9U-D0.js";import{s as F,d as me,a as ue}from"../chunks/D8mhvFt8.js";import{i as P}from"../chunks/DKve45Wd.js";import{e as le,i as ce,s as ae,a as pe}from"../chunks/60_R_Vbt.js";import{a as re,r as se}from"../chunks/P1-U_Xsj.js";import{s as S}from"../chunks/EqHb-9AZ.js";import{p as Z,a as fe,s as ee}from"../chunks/ByYB047u.js";import{w as _e,e as ge,i as xe,c as he}from"../chunks/BhIgFntf.js";import{E as $e}from"../chunks/CcUbQ_Wl.js";import{P as be}from"../chunks/BHDZZvku.js";import{I as te}from"../chunks/D7A-gG4Z.js";import{A as ye}from"../chunks/DcKTNC6e.js";var we=p(' '),Ce=p('
      '),Fe=p('
      ',1),Se=p('
      '),De=p('
      '),ke=p('
      Cognitive Search Pipeline
      ');function Pe(J,M){oe(M,!0);let V=Z(M,"resultCount",3,0),B=Z(M,"durationMs",3,0),R=Z(M,"active",3,!1);const f=[{name:"Overfetch",icon:"◎",color:"#818CF8",desc:"Pull 3x results from hybrid search"},{name:"Rerank",icon:"⟿",color:"#00A8FF",desc:"Re-score by relevance quality"},{name:"Temporal",icon:"◷",color:"#00D4FF",desc:"Recent memories get recency bonus"},{name:"Access",icon:"◇",color:"#00FFD1",desc:"FSRS-6 retention threshold filter"},{name:"Context",icon:"◬",color:"#FFB800",desc:"Encoding specificity matching"},{name:"Compete",icon:"⬡",color:"#FF3CAC",desc:"Retrieval-induced forgetting"},{name:"Activate",icon:"◈",color:"#9D00FF",desc:"Spreading activation cascade"}];let b=W(-1),y=W(!1),w=W(!1);ve(()=>{R()&&!e(y)&&Q()});function Q(){E(y,!0),E(b,-1),E(w,!1);const o=Math.max(1500,(B()||50)*2),t=o/(f.length+1);f.forEach((n,c)=>{setTimeout(()=>{E(b,c,!0)},t*(c+1))}),setTimeout(()=>{E(w,!0),E(y,!1)},o)}var _=ke(),D=s(_),q=v(s(D),2);{var U=o=>{var t=we(),n=s(t);r(t),C(()=>F(n,`${V()??""} results in ${B()??""}ms`)),u(o,t)};P(q,o=>{e(w)&&o(U)})}r(D);var T=v(D,2);le(T,21,()=>f,ce,(o,t,n)=>{const c=k(()=>n<=e(b)),A=k(()=>n===e(b)&&e(y));var x=Fe(),h=ne(x),d=s(h),O=s(d,!0);r(d);var j=v(d,2),Y=s(j,!0);r(j),r(h);var z=v(h,2);{var G=L=>{var H=Ce();C(()=>S(H,`background: ${n{n{ae(d,1,`w-8 h-8 rounded-full flex items-center justify-center text-xs transition-all duration-300 - ${e(A)?"scale-125":""}`),S(d,`background: ${e(c)?e(t).color+"25":"rgba(255,255,255,0.03)"}; - border: 1.5px solid ${(e(c)?e(t).color:"rgba(255,255,255,0.06)")??""}; - color: ${(e(c)?e(t).color:"#4a4a7a")??""}; - box-shadow: ${e(A)?"0 0 12px "+e(t).color+"40":"none"}`),pe(d,"title",e(t).desc),F(O,e(t).icon),S(j,`color: ${(e(c)?e(t).color:"#4a4a7a")??""}`),F(Y,e(t).name)}),u(o,x)}),r(T);var I=v(T,2),l=s(I);{var a=o=>{var t=Se();C(n=>S(t,`width: ${n??""}%; - background: linear-gradient(90deg, #818CF8, #00FFD1, #9D00FF); - transition-duration: ${e(y)?"300ms":"500ms"}`),[()=>e(w)?"100":((e(b)+1)/f.length*100).toFixed(0)]),u(o,t)};P(l,o=>{(e(y)||e(w))&&o(a)})}r(I);var g=v(I,2);{var i=o=>{var t=De(),n=v(s(t),2),c=s(n);r(n),r(t),C(()=>F(c,`Pipeline complete: ${V()??""} memories surfaced from ${f.length??""}-stage cognitive cascade`)),u(o,t)};P(g,o=>{e(w)&&o(i)})}r(_),u(J,_),ie()}var Me=p(' events ',1),Re=p(`

      Quiet for now.

      New memory activity will stream in here the moment it happens — the feed - wakes up the instant Vestige does.

      `),Ae=p(' '),Ne=p('
      '),Ee=p('

      '),Te=p('
      '),Ie=p('
      ');function Ke(J,M){oe(M,!0);const V=()=>ee(xe,"$isConnected",f),B=()=>ee(he,"$isReconnecting",f),R=()=>ee(ge,"$eventFeed",f),[f,b]=fe();function y(l){return new Date(l).toLocaleTimeString()}function w(l){return{MemoryCreated:"memories",MemoryUpdated:"memories",MemoryDeleted:"close",MemoryPromoted:"importance",MemoryDemoted:"importance",SearchPerformed:"search",DreamStarted:"dreams",DreamProgress:"dreams",DreamCompleted:"dreams",ConsolidationStarted:"activation",ConsolidationCompleted:"activation",RetentionDecayed:"timeline",ConnectionDiscovered:"graph",ActivationSpread:"activation",ImportanceScored:"importance",Heartbeat:"pulse"}[l]||"sparkle"}function Q(l){const a=l.data;switch(l.type){case"MemoryCreated":return`New ${a.node_type}: "${String(a.content_preview).slice(0,60)}..."`;case"SearchPerformed":return`Searched "${a.query}" → ${a.result_count} results (${a.duration_ms}ms)`;case"DreamStarted":return`Dream started with ${a.memory_count} memories`;case"DreamCompleted":return`Dream complete: ${a.connections_found} connections, ${a.insights_generated} insights (${a.duration_ms}ms)`;case"ConsolidationStarted":return"Consolidation cycle started";case"ConsolidationCompleted":return`Consolidated ${a.nodes_processed} nodes, ${a.decay_applied} decayed (${a.duration_ms}ms)`;case"ConnectionDiscovered":return`Connection: ${String(a.connection_type)} (weight: ${Number(a.weight).toFixed(2)})`;case"ImportanceScored":return`Scored ${Number(a.composite_score).toFixed(2)}: "${String(a.content_preview).slice(0,50)}..."`;case"MemoryPromoted":return`Promoted → ${(Number(a.new_retention)*100).toFixed(0)}% retention`;case"MemoryDemoted":return`Demoted → ${(Number(a.new_retention)*100).toFixed(0)}% retention`;default:return JSON.stringify(a).slice(0,100)}}let _=k(()=>V()?{color:"var(--color-recall)",label:"Live",live:!0}:B()?{color:"var(--color-importance, #f59e0b)",label:"Reconnecting",live:!1}:{color:"var(--color-decay, #8B95A5)",label:"Offline",live:!1});var D=Ie(),q=s(D);be(q,{icon:"feed",title:"Live Feed",subtitle:"Every thought as it happens — memories born, searches fired, dreams consolidating, connections discovered. Vestige, thinking out loud.",accent:"synapse",children:(l,a)=>{var g=Me(),i=ne(g);let o;var t=s(i);let n;var c=v(t,2),A=s(c,!0);r(c),r(i);var x=v(i,2),h=s(x);ye(h,{get value(){return R().length},class:"text-bright font-semibold"}),X(2),r(x);var d=v(x,2),O=s(d);te(O,{name:"close",size:13}),X(2),r(d),C(()=>{o=ae(i,1,"live-status svelte-1o4vd58",null,o,{idle:!e(_).live}),n=ae(t,1,"live-dot w-2 h-2 rounded-full svelte-1o4vd58",null,n,{"ping-host":e(_).live,breathe:!e(_).live}),S(t,`color:${e(_).color??""};background:${e(_).color??""}`),F(A,e(_).label),d.disabled=R().length===0}),ue("click",d,()=>_e.clearEvents()),u(l,g)},$$slots:{default:!0}});var U=v(q,2);{var T=l=>{var a=Re(),g=s(a),i=s(g);te(i,{name:"feed",size:52,draw:!0}),r(g),X(4),r(a),re(a,o=>{var t;return(t=se)==null?void 0:t(o)}),u(l,a)},I=l=>{var a=Te();le(a,5,R,ce,(g,i,o)=>{const t=k(()=>$e[e(i).type]||"#8B95A5");var n=Ee(),c=s(n),A=s(c);{let m=k(()=>w(e(i).type));te(A,{get name(){return e(m)},size:15})}r(c);var x=v(c,2),h=s(x),d=s(h),O=s(d,!0);r(d);var j=v(d,2);{var Y=m=>{var $=Ae(),N=s($,!0);r($),C(K=>F(N,K),[()=>y(String(e(i).data.timestamp))]),u(m,$)};P(j,m=>{e(i).data.timestamp&&m(Y)})}r(h);var z=v(h,2),G=s(z,!0);r(z);var L=v(z,2);{var H=m=>{var $=Ne(),N=s($);{let K=k(()=>Number(e(i).data.result_count)||0),de=k(()=>Number(e(i).data.duration_ms)||0);Pe(N,{get resultCount(){return e(K)},get durationMs(){return e(de)},active:!0})}r($),u(m,$)};P(L,m=>{e(i).type==="SearchPerformed"&&m(H)})}r(x),r(n),re(n,(m,$)=>{var N;return(N=se)==null?void 0:N(m,$)},()=>({delay:Math.min(o*30,300),y:10})),C(m=>{S(n,`border-left: 3px solid ${e(t)??""}; --evt: ${e(t)??""};`),S(c,`background: ${e(t)??""}1a; color: ${e(t)??""}`),S(d,`color: ${e(t)??""}`),F(O,e(i).type),F(G,m)},[()=>Q(e(i))]),u(g,n)}),r(a),u(l,a)};P(U,l=>{R().length===0?l(T):l(I,!1)})}r(D),u(J,D),ie(),b()}me(["click"]);export{Ke as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/10.DYHIt_do.js.br b/apps/dashboard/build/_app/immutable/nodes/10.DYHIt_do.js.br deleted file mode 100644 index 24213d5..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/10.DYHIt_do.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/10.DYHIt_do.js.gz b/apps/dashboard/build/_app/immutable/nodes/10.DYHIt_do.js.gz deleted file mode 100644 index 7b5fa64..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/10.DYHIt_do.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/11.Db7dgOeT.js b/apps/dashboard/build/_app/immutable/nodes/11.Db7dgOeT.js deleted file mode 100644 index 0f3906a..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/11.Db7dgOeT.js +++ /dev/null @@ -1 +0,0 @@ -import{fB as f}from"../chunks/C-SOZ1Oi.js";export{f as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/11.Db7dgOeT.js.br b/apps/dashboard/build/_app/immutable/nodes/11.Db7dgOeT.js.br deleted file mode 100644 index f8e1ced..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/11.Db7dgOeT.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/11.Db7dgOeT.js.gz b/apps/dashboard/build/_app/immutable/nodes/11.Db7dgOeT.js.gz deleted file mode 100644 index d8df44b..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/11.Db7dgOeT.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/11.WP3QAgOF.js b/apps/dashboard/build/_app/immutable/nodes/11.WP3QAgOF.js new file mode 100644 index 0000000..1b2c42e --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/11.WP3QAgOF.js @@ -0,0 +1,7 @@ +import"../chunks/Bzak7iHL.js";import{o as Pt}from"../chunks/GG5zm9kr.js";import{N as Kt,ab as qt,aP as Ht,b as Wt,p as Rt,h as F,d as i,t as S,g as t,e as o,r as n,a as Tt,u as y,s as q,f as U,c as Ft,C as Xt,i as Zt,n as Gt}from"../chunks/CpWkWWOo.js";import{s as _,d as Ut,a as kt}from"../chunks/BlVfL1ME.js";import{i as R}from"../chunks/B4yTwGkE.js";import{B as Vt}from"../chunks/DdEqwvdI.js";import{e as V,i as rt}from"../chunks/CGEBXrjl.js";import{a as x,c as Nt,b as yt,f as h}from"../chunks/CHOnp4oo.js";import{s as Yt}from"../chunks/Cx-f-Pzo.js";import{b as Jt}from"../chunks/sZcqyNBA.js";import{g as Qt}from"../chunks/BHGLDPij.js";import{b as te}from"../chunks/BskPcZf7.js";import{a as Ct}from"../chunks/DNjM5a-l.js";import{N as ee}from"../chunks/DzfRjky4.js";import{s as p}from"../chunks/A7po6GxK.js";import{p as ae}from"../chunks/V6gjw5Ec.js";const re=Symbol("NaN");function se(a,C,m){Kt&&qt();var v=new Vt(a),T=!Ht();Wt(()=>{var w=C();w!==w&&(w=re),T&&w!==null&&typeof w=="object"&&(w={}),v.ensure(w,m)})}function Mt(a){return a==null||!Number.isFinite(a)||a<0?0:a>1?1:a}function ne(a){return{novelty:Mt(a==null?void 0:a.novelty),arousal:Mt(a==null?void 0:a.arousal),reward:Mt(a==null?void 0:a.reward),attention:Mt(a==null?void 0:a.attention)}}const It={sm:80,md:180,lg:320};function $t(a){return a&&(a==="sm"||a==="md"||a==="lg")?It[a]:It.md}const gt=[{key:"novelty",angle:-Math.PI/2},{key:"arousal",angle:0},{key:"reward",angle:Math.PI/2},{key:"attention",angle:Math.PI}];function oe(a){const C=$t(a);let m;switch(a){case"lg":m=44;break;case"sm":m=4;break;default:m=28}return Math.max(0,C/2-m)}var ie=yt(''),le=yt(''),de=yt(''),ce=yt(' ',1),ve=yt('');function Et(a,C){Rt(C,!0);let m=ae(C,"size",3,"md"),v=y(()=>$t(m())),T=y(()=>m()!=="sm"),w=y(()=>oe(m())),Y=y(()=>t(v)/2),J=y(()=>t(v)/2);const St={novelty:"Novelty",arousal:"Arousal",reward:"Reward",attention:"Attention"};let N=y(()=>ne({novelty:C.novelty,arousal:C.arousal,reward:C.reward,attention:C.attention}));function H(d,l){const r=d*t(w);return[t(Y)+Math.cos(l)*r,t(J)+Math.sin(l)*r]}const st=[.25,.5,.75,1];function nt(d){return gt.map(({angle:r})=>H(d,r)).map((r,c)=>`${c===0?"M":"L"}${r[0].toFixed(2)},${r[1].toFixed(2)}`).join(" ")+" Z"}let $=q(0);Pt(()=>{const l=performance.now();let r=0;const c=b=>{const g=Math.min(1,(b-l)/600);F($,1-Math.pow(1-g,3)),g<1&&(r=requestAnimationFrame(c))};return r=requestAnimationFrame(c),()=>cancelAnimationFrame(r)});let ot=y(()=>{const d=t($);return gt.map(({key:r,angle:c})=>H(t(N)[r]*d,c)).map((r,c)=>`${c===0?"M":"L"}${r[0].toFixed(2)},${r[1].toFixed(2)}`).join(" ")+" Z"});function _t(d){const l=t(w)+(m()==="lg"?18:12),r=t(Y)+Math.cos(d)*l,c=t(J)+Math.sin(d)*l;let b="middle";return Math.abs(Math.cos(d))>.5&&(b=Math.cos(d)>0?"start":"end"),{x:r,y:c,anchor:b}}var P=ve(),it=i(P);V(it,17,()=>st,rt,(d,l)=>{var r=ie();S(c=>{p(r,"d",c),p(r,"stroke-opacity",t(l)===1?.45:.18),p(r,"stroke-width",t(l)===1?1:.75)},[()=>nt(t(l))]),x(d,r)});var ht=o(it);V(ht,17,()=>gt,rt,(d,l)=>{const r=y(()=>{const[b,g]=H(1,t(l).angle);return{x:b,y:g}});var c=le();S(()=>{p(c,"x1",t(Y)),p(c,"y1",t(J)),p(c,"x2",t(r).x),p(c,"y2",t(r).y)}),x(d,c)});var W=o(ht),Q=o(W);{var wt=d=>{var l=Nt(),r=U(l);V(r,17,()=>gt,rt,(c,b)=>{const g=y(()=>{const[I,dt]=H(t(N)[t(b).key]*t($),t(b).angle);return{px:I,py:dt}});var j=de();S(()=>{p(j,"cx",t(g).px),p(j,"cy",t(g).py),p(j,"r",m()==="lg"?3:2.25)}),x(c,j)}),x(d,l)};R(Q,d=>{m()!=="sm"&&d(wt)})}var lt=o(Q);{var tt=d=>{var l=Nt(),r=U(l);V(r,17,()=>gt,rt,(c,b)=>{const g=y(()=>_t(t(b).angle));var j=ce(),I=U(j),dt=i(I);n(I);var L=o(I),ct=i(L,!0);n(L),S(At=>{p(I,"x",t(g).x),p(I,"y",t(g).y),p(I,"text-anchor",t(g).anchor),p(I,"font-size",m()==="lg"?12:10),_(dt,`${At??""}%`),p(L,"x",t(g).x),p(L,"y",t(g).y+(m()==="lg"?14:11)),p(L,"text-anchor",t(g).anchor),p(L,"font-size",m()==="lg"?10:8.5),_(ct,St[t(b).key])},[()=>(t(N)[t(b).key]*100).toFixed(0)]),x(c,j)}),x(d,l)};R(lt,d=>{t(T)&&d(tt)})}n(P),S((d,l,r,c)=>{p(P,"width",t(v)),p(P,"height",t(v)),p(P,"viewBox",`0 0 ${t(v)??""} ${t(v)??""}`),p(P,"aria-label",`Importance radar: novelty ${d??""}%, arousal ${l??""}%, reward ${r??""}%, attention ${c??""}%`),p(W,"d",t(ot)),p(W,"stroke-width",m()==="sm"?1:1.5)},[()=>(t(N).novelty*100).toFixed(0),()=>(t(N).arousal*100).toFixed(0),()=>(t(N).reward*100).toFixed(0),()=>(t(N).attention*100).toFixed(0)]),x(a,P),Tt()}var pe=h(' '),xe=h('Driven by ',1),me=h('
      ✓ Save

      '),ue=h('Weakest channel: ',1),fe=h('
      ⨯ Skip

      '),ge=h('
      Composite
      %
      ',1),ye=h(`

      Type some content above to score its importance.

      Composite = 0.25·novelty + 0.30·arousal + 0.25·reward + 0.20·attention. + Threshold for save: 60%.

      `),_e=h('
      '),he=h('
      '),we=h('

      No memories yet.

      '),be=h('· ',1),ke=h(' '),Me=h('
      '),Se=h(``),Ae=h('
      '),Ce=h(`

      Importance Radar

      4-channel importance model: Novelty · Arousal · Reward · Attention

      Test Importance

      Paste any content below. Vestige scores it across 4 channels and + decides whether it is worth saving.

      ⌘/Ctrl + Enter

      Top Important Memories This Week

      Ranked by retention × reviews ÷ age. Click any card to open it.

      `);function He(a,C){Rt(C,!0);let m=q(""),v=q(null),T=q(!1),w=q(null),Y=q(0);async function J(){const e=t(m).trim();if(!(!e||t(T))){F(T,!0),F(w,null);try{F(v,await Ct.importance(e),!0),Xt(Y)}catch(s){F(w,s instanceof Error?s.message:String(s),!0),F(v,null)}finally{F(T,!1)}}}function St(e){(e.metaKey||e.ctrlKey)&&e.key==="Enter"&&(e.preventDefault(),J())}const N={novelty:.25,arousal:.3,reward:.25,attention:.2},H={novelty:{high:"new information not already in your graph",low:"overlaps heavily with what you already know"},arousal:{high:"emotionally salient — decisions, bugs, or discoveries stick",low:"neutral tone, no strong affect signal"},reward:{high:"high reward value — preferences, wins, or solutions you will revisit",low:"low reward value — transient or incidental detail"},attention:{high:"strong attentional markers (imperatives, questions, urgency)",low:"passive phrasing, no clear attentional hook"}};let st=y(()=>t(v)?Object.keys(N).map(s=>({key:s,contribution:t(v).channels[s]*N[s]})).sort((s,u)=>u.contribution-s.contribution)[0]:null),nt=y(()=>t(v)?Object.keys(N).slice().sort((e,s)=>t(v).channels[e]-t(v).channels[s])[0]:null),$=q(Ft([])),ot=q(!0),_t=Ft({});function P(e){const s=Math.max(1,(Date.now()-new Date(e.createdAt).getTime())/864e5),u=e.reviewCount??0,f=1/Math.pow(s,.5);return e.retentionStrength*Math.log1p(u+1)*f}async function it(){F(ot,!0);try{const s=(await Ct.memories.list({limit:"20"})).memories.slice().sort((u,f)=>P(f)-P(u)).slice(0,20);F($,s,!0),t($).forEach(async u=>{try{const f=await Ct.importance(u.content);_t[u.id]=f.channels}catch{}})}catch{F($,[],!0)}finally{F(ot,!1)}}Pt(it);function ht(e){Qt(`${te}/memories`)}var W=Ce(),Q=o(i(W),2),wt=o(i(Q),2),lt=i(wt),tt=i(lt);Zt(tt);var d=o(tt,2),l=i(d),r=i(l,!0);n(l);var c=o(l,4);{var b=e=>{var s=pe(),u=i(s,!0);n(s),S(()=>_(u,t(w))),x(e,s)};R(c,e=>{t(w)&&e(b)})}n(d),n(lt);var g=o(lt,2),j=i(g);{var I=e=>{var s=ge(),u=U(s),f=o(i(u),2),z=i(f,!0);Gt(),n(f),n(u);var X=o(u,2);se(X,()=>t(Y),A=>{Et(A,{get novelty(){return t(v).channels.novelty},get arousal(){return t(v).channels.arousal},get reward(){return t(v).channels.reward},get attention(){return t(v).channels.attention},size:"lg"})});var vt=o(X,2);{var pt=A=>{var B=me(),D=o(i(B),2),Z=i(D),xt=o(Z);{var mt=k=>{var G=xe(),O=o(U(G)),ut=i(O,!0);n(O);var et=o(O);S(()=>{_(ut,t(st).key),_(et,` — ${H[t(st).key].high??""}.`)}),x(k,G)};R(xt,k=>{t(st)&&k(mt)})}n(D),n(B),S(k=>_(Z,`Composite ${k??""}% > 60% threshold. `),[()=>(t(v).composite*100).toFixed(0)]),x(A,B)},bt=A=>{var B=fe(),D=o(i(B),2),Z=i(D),xt=o(Z);{var mt=k=>{var G=ue(),O=o(U(G)),ut=i(O,!0);n(O);var et=o(O);S(()=>{_(ut,t(nt)),_(et,` — ${H[t(nt)].low??""}.`)}),x(k,G)};R(xt,k=>{t(nt)&&k(mt)})}n(D),n(B),S(k=>_(Z,`Composite ${k??""}% < 60% threshold. `),[()=>(t(v).composite*100).toFixed(0)]),x(A,B)};R(vt,A=>{t(v).composite>.6?A(pt):A(bt,!1)})}S(A=>_(z,A),[()=>(t(v).composite*100).toFixed(0)]),x(e,s)},dt=e=>{var s=ye();x(e,s)};R(j,e=>{t(v)?e(I):e(dt,!1)})}n(g),n(wt),n(Q);var L=o(Q,2),ct=i(L),At=o(i(ct),2);n(ct);var jt=o(ct,2);{var Lt=e=>{var s=he();V(s,20,()=>Array(6),rt,(u,f)=>{var z=_e();x(u,z)}),n(s),x(e,s)},Bt=e=>{var s=we();x(e,s)},Dt=e=>{var s=Ae();V(s,21,()=>t($),u=>u.id,(u,f)=>{const z=y(()=>_t[t(f).id]);var X=Se(),vt=i(X),pt=i(vt),bt=i(pt),A=o(bt,2),B=i(A,!0);n(A);var D=o(A,4),Z=i(D);n(D);var xt=o(D,2);{var mt=E=>{var K=be(),at=o(U(K),2),ft=i(at);n(at),S(()=>_(ft,`${t(f).reviewCount??""} reviews`)),x(E,K)};R(xt,E=>{t(f).reviewCount&&E(mt)})}n(pt);var k=o(pt,2),G=i(k,!0);n(k);var O=o(k,2);{var ut=E=>{var K=Me();V(K,21,()=>t(f).tags.slice(0,4),rt,(at,ft)=>{var M=ke(),zt=i(M,!0);n(M),S(()=>_(zt,t(ft))),x(at,M)}),n(K),x(E,K)};R(O,E=>{t(f).tags.length>0&&E(ut)})}n(vt);var et=o(vt,2),Ot=i(et);{let E=y(()=>{var M;return((M=t(z))==null?void 0:M.novelty)??0}),K=y(()=>{var M;return((M=t(z))==null?void 0:M.arousal)??0}),at=y(()=>{var M;return((M=t(z))==null?void 0:M.reward)??0}),ft=y(()=>{var M;return((M=t(z))==null?void 0:M.attention)??0});Et(Ot,{get novelty(){return t(E)},get arousal(){return t(K)},get reward(){return t(at)},get attention(){return t(ft)},size:"sm"})}n(et),n(X),S(E=>{Yt(bt,`background: ${(ee[t(f).nodeType]||"#8B95A5")??""}`),_(B,t(f).nodeType),_(Z,`${E??""}% retention`),_(G,t(f).content)},[()=>(t(f).retentionStrength*100).toFixed(0)]),kt("click",X,()=>ht(t(f).id)),x(u,X)}),n(s),x(e,s)};R(jt,e=>{t(ot)?e(Lt):t($).length===0?e(Bt,1):e(Dt,!1)})}n(L),n(W),S(e=>{l.disabled=e,_(r,t(T)?"Scoring…":"Score Importance")},[()=>t(T)||!t(m).trim()]),kt("keydown",tt,St),Jt(tt,()=>t(m),e=>F(m,e)),kt("click",l,J),kt("click",At,it),x(a,W),Tt()}Ut(["keydown","click"]);export{He as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/11.WP3QAgOF.js.br b/apps/dashboard/build/_app/immutable/nodes/11.WP3QAgOF.js.br new file mode 100644 index 0000000..71afdaf Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/11.WP3QAgOF.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/11.WP3QAgOF.js.gz b/apps/dashboard/build/_app/immutable/nodes/11.WP3QAgOF.js.gz new file mode 100644 index 0000000..a646228 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/11.WP3QAgOF.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/12.CO2CXIFj.js b/apps/dashboard/build/_app/immutable/nodes/12.CO2CXIFj.js deleted file mode 100644 index 1f39f22..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/12.CO2CXIFj.js +++ /dev/null @@ -1,8 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{o as Lt}from"../chunks/TZu9D97Z.js";import{G as Zt,T as Ut,aC as Vt,q as Yt,p as Bt,i as F,e as n,t as M,g as t,a as x,h as i,r,b as Dt,u as g,s as H,c as jt,f as Q,au as bt,d as zt,j as _,a9 as Jt,k as Qt,n as St}from"../chunks/wpu9U-D0.js";import{s as k,d as te,a as Ct}from"../chunks/D8mhvFt8.js";import{i as R}from"../chunks/DKve45Wd.js";import{B as ee}from"../chunks/BWk3o_TN.js";import{e as tt,i as nt,a as u}from"../chunks/60_R_Vbt.js";import{a as Ft,r as Et}from"../chunks/P1-U_Xsj.js";import{s as ae}from"../chunks/EqHb-9AZ.js";import{b as re}from"../chunks/CnZzd20v.js";import{g as se}from"../chunks/dCAmqaEc.js";import{b as ne}from"../chunks/Bxs5UR9-.js";import{a as Tt}from"../chunks/CZfHMhLI.js";import{N as oe}from"../chunks/CcUbQ_Wl.js";import{p as ie}from"../chunks/ByYB047u.js";import{P as le}from"../chunks/BHDZZvku.js";import{A as de}from"../chunks/DcKTNC6e.js";import{I as It}from"../chunks/D7A-gG4Z.js";import{s as ce}from"../chunks/DPdYG9yN.js";const ve=Symbol("NaN");function pe(o,C,f){Zt&&Ut();var p=new ee(o),$=!Vt();Yt(()=>{var h=C();h!==h&&(h=ve),$&&h!==null&&typeof h=="object"&&(h={}),p.ensure(h,f)})}function Nt(o){return o==null||!Number.isFinite(o)||o<0?0:o>1?1:o}function me(o){return{novelty:Nt(o==null?void 0:o.novelty),arousal:Nt(o==null?void 0:o.arousal),reward:Nt(o==null?void 0:o.reward),attention:Nt(o==null?void 0:o.attention)}}const Rt={sm:80,md:180,lg:320};function Ot(o){return o&&(o==="sm"||o==="md"||o==="lg")?Rt[o]:Rt.md}const wt=[{key:"novelty",angle:-Math.PI/2},{key:"arousal",angle:0},{key:"reward",angle:Math.PI/2},{key:"attention",angle:Math.PI}];function ue(o){const C=Ot(o);let f;switch(o){case"lg":f=44;break;case"sm":f=4;break;default:f=28}return Math.max(0,C/2-f)}var xe=bt(''),fe=bt(''),ge=bt(''),ye=bt(' ',1),_e=bt('');function $t(o,C){Bt(C,!0);let f=ie(C,"size",3,"md"),p=g(()=>Ot(f())),$=g(()=>f()!=="sm"),h=g(()=>ue(f())),et=g(()=>t(p)/2),at=g(()=>t(p)/2);const Pt={novelty:"Novelty",arousal:"Arousal",reward:"Reward",attention:"Attention"};let I=g(()=>me({novelty:C.novelty,arousal:C.arousal,reward:C.reward,attention:C.attention}));function K(l,d){const s=l*t(h);return[t(et)+Math.cos(d)*s,t(at)+Math.sin(d)*s]}const ot=[.25,.5,.75,1];function it(l){return wt.map(({angle:s})=>K(l,s)).map((s,c)=>`${c===0?"M":"L"}${s[0].toFixed(2)},${s[1].toFixed(2)}`).join(" ")+" Z"}let L=H(0);Lt(()=>{const d=performance.now();let s=0;const c=w=>{const y=Math.min(1,(w-d)/600);F(L,1-Math.pow(1-y,3)),y<1&&(s=requestAnimationFrame(c))};return s=requestAnimationFrame(c),()=>cancelAnimationFrame(s)});let lt=g(()=>{const l=t(L);return wt.map(({key:s,angle:c})=>K(t(I)[s]*l,c)).map((s,c)=>`${c===0?"M":"L"}${s[0].toFixed(2)},${s[1].toFixed(2)}`).join(" ")+" Z"});function kt(l){const d=t(h)+(f()==="lg"?18:12),s=t(et)+Math.cos(l)*d,c=t(at)+Math.sin(l)*d;let w="middle";return Math.abs(Math.cos(l))>.5&&(w=Math.cos(l)>0?"start":"end"),{x:s,y:c,anchor:w}}var j=_e(),dt=n(j);tt(dt,17,()=>ot,nt,(l,d)=>{var s=xe();M(c=>{u(s,"d",c),u(s,"stroke-opacity",t(d)===1?.45:.18),u(s,"stroke-width",t(d)===1?1:.75)},[()=>it(t(d))]),x(l,s)});var Mt=i(dt);tt(Mt,17,()=>wt,nt,(l,d)=>{const s=g(()=>{const[w,y]=K(1,t(d).angle);return{x:w,y}});var c=fe();M(()=>{u(c,"x1",t(et)),u(c,"y1",t(at)),u(c,"x2",t(s).x),u(c,"y2",t(s).y)}),x(l,c)});var G=i(Mt),ct=i(G);{var rt=l=>{var d=jt(),s=Q(d);tt(s,17,()=>wt,nt,(c,w)=>{const y=g(()=>{const[P,pt]=K(t(I)[t(w).key]*t(L),t(w).angle);return{px:P,py:pt}});var N=ge();M(()=>{u(N,"cx",t(y).px),u(N,"cy",t(y).py),u(N,"r",f()==="lg"?3:2.25)}),x(c,N)}),x(l,d)};R(ct,l=>{f()!=="sm"&&l(rt)})}var At=i(ct);{var vt=l=>{var d=jt(),s=Q(d);tt(s,17,()=>wt,nt,(c,w)=>{const y=g(()=>kt(t(w).angle));var N=ye(),P=Q(N),pt=n(P);r(P);var q=i(P),mt=n(q,!0);r(q),M(ut=>{u(P,"x",t(y).x),u(P,"y",t(y).y),u(P,"text-anchor",t(y).anchor),u(P,"font-size",f()==="lg"?12:10),k(pt,`${ut??""}%`),u(q,"x",t(y).x),u(q,"y",t(y).y+(f()==="lg"?14:11)),u(q,"text-anchor",t(y).anchor),u(q,"font-size",f()==="lg"?10:8.5),k(mt,Pt[t(w).key])},[()=>(t(I)[t(w).key]*100).toFixed(0)]),x(c,N)}),x(l,d)};R(At,l=>{t($)&&l(vt)})}r(j),M((l,d,s,c)=>{u(j,"width",t(p)),u(j,"height",t(p)),u(j,"viewBox",`0 0 ${t(p)??""} ${t(p)??""}`),u(j,"aria-label",`Importance radar: novelty ${l??""}%, arousal ${d??""}%, reward ${s??""}%, attention ${c??""}%`),u(G,"d",t(lt)),u(G,"stroke-width",f()==="sm"?1:1.5)},[()=>(t(I).novelty*100).toFixed(0),()=>(t(I).arousal*100).toFixed(0),()=>(t(I).reward*100).toFixed(0),()=>(t(I).attention*100).toFixed(0)]),x(o,j),Dt()}var he=_(' '),we=_('Driven by ',1),be=_('
      Save

      '),ke=_('Weakest channel: ',1),Me=_('
      Skip

      '),Ae=_('
      Composite
      ',1),Se=_(`

      Type some content above to score its importance.

      Composite = 0.25·novelty + 0.30·arousal + 0.25·reward + 0.20·attention. - Threshold for save: 60%.

      `),Ce=_('
      '),Fe=_('
      '),Ie=_(`

      No standout memories yet

      As you capture decisions, wins, and discoveries, the most important ones - will rise to the top here — ranked by retention, reviews, and recency.

      `),Ne=_('· ',1),Pe=_(' '),Ee=_('
      '),Te=_(``),je=_('
      '),ze=_(`

      Test Importance

      Paste any content below. Vestige scores it across 4 channels and - decides whether it is worth saving.

      ⌘/Ctrl + Enter

      Top Important Memories This Week

      Ranked by retention × reviews ÷ age. Click any card to open it.

      `);function ea(o,C){Bt(C,!0);let f=H(""),p=H(null),$=H(!1),h=H(null),et=H(0);async function at(){const e=t(f).trim();if(!(!e||t($))){F($,!0),F(h,null);try{F(p,await Tt.importance(e),!0),Jt(et)}catch(a){F(h,a instanceof Error?a.message:String(a),!0),F(p,null)}finally{F($,!1)}}}function Pt(e){(e.metaKey||e.ctrlKey)&&e.key==="Enter"&&(e.preventDefault(),at())}const I={novelty:.25,arousal:.3,reward:.25,attention:.2},K={novelty:{high:"new information not already in your graph",low:"overlaps heavily with what you already know"},arousal:{high:"emotionally salient — decisions, bugs, or discoveries stick",low:"neutral tone, no strong affect signal"},reward:{high:"high reward value — preferences, wins, or solutions you will revisit",low:"low reward value — transient or incidental detail"},attention:{high:"strong attentional markers (imperatives, questions, urgency)",low:"passive phrasing, no clear attentional hook"}};let ot=g(()=>t(p)?Object.keys(I).map(a=>({key:a,contribution:t(p).channels[a]*I[a]})).sort((a,v)=>v.contribution-a.contribution)[0]:null),it=g(()=>t(p)?Object.keys(I).slice().sort((e,a)=>t(p).channels[e]-t(p).channels[a])[0]:null),L=H(zt([])),lt=H(!0),kt=zt({});function j(e){const a=Math.max(1,(Date.now()-new Date(e.createdAt).getTime())/864e5),v=e.reviewCount??0,m=1/Math.pow(a,.5);return e.retentionStrength*Math.log1p(v+1)*m}async function dt(){F(lt,!0);try{const a=(await Tt.memories.list({limit:"20"})).memories.slice().sort((v,m)=>j(m)-j(v)).slice(0,20);F(L,a,!0),t(L).forEach(async v=>{try{const m=await Tt.importance(v.content);kt[v.id]=m.channels}catch{}})}catch{F(L,[],!0)}finally{F(lt,!1)}}Lt(dt);function Mt(e){se(`${ne}/memories`)}var G=ze(),ct=n(G);le(ct,{icon:"importance",title:"Importance Radar",subtitle:"4-channel importance model: Novelty · Arousal · Reward · Attention",accent:"warning"});var rt=i(ct,2),At=i(n(rt),2),vt=n(At),l=n(vt);Qt(l);var d=i(l,2),s=n(d),c=n(s,!0);r(s);var w=i(s,4);{var y=e=>{var a=he(),v=n(a,!0);r(a),M(()=>k(v,t(h))),x(e,a)};R(w,e=>{t(h)&&e(y)})}r(d),r(vt);var N=i(vt,2),P=n(N);{var pt=e=>{var a=Ae(),v=Q(a),m=i(n(v),2),xt=n(m);de(xt,{get value(){return t(p).composite},scale:100,decimals:0,suffix:"%"}),r(m),r(v);var W=i(v,2);pe(W,()=>t(et),E=>{$t(E,{get novelty(){return t(p).channels.novelty},get arousal(){return t(p).channels.arousal},get reward(){return t(p).channels.reward},get attention(){return t(p).channels.attention},size:"lg"})});var X=i(W,2);{var ft=E=>{var T=be(),B=n(T),Z=n(B);It(Z,{name:"sparkle",size:18}),St(2),r(B);var U=i(B,2),V=n(U),yt=i(V);{var Y=A=>{var J=we(),D=i(Q(J)),st=n(D,!0);r(D);var _t=i(D);M(()=>{k(st,t(ot).key),k(_t,` — ${K[t(ot).key].high??""}.`)}),x(A,J)};R(yt,A=>{t(ot)&&A(Y)})}r(U),r(T),M(A=>k(V,`Composite ${A??""}% > 60% threshold. `),[()=>(t(p).composite*100).toFixed(0)]),x(E,T)},gt=E=>{var T=Me(),B=n(T),Z=n(B);It(Z,{name:"close",size:18}),St(2),r(B);var U=i(B,2),V=n(U),yt=i(V);{var Y=A=>{var J=ke(),D=i(Q(J)),st=n(D,!0);r(D);var _t=i(D);M(()=>{k(st,t(it)),k(_t,` — ${K[t(it)].low??""}.`)}),x(A,J)};R(yt,A=>{t(it)&&A(Y)})}r(U),r(T),M(A=>k(V,`Composite ${A??""}% < 60% threshold. `),[()=>(t(p).composite*100).toFixed(0)]),x(E,T)};R(X,E=>{t(p).composite>.6?E(ft):E(gt,!1)})}x(e,a)},q=e=>{var a=Se(),v=n(a),m=n(v);It(m,{name:"importance",size:36}),r(v),St(4),r(a),x(e,a)};R(P,e=>{t(p)?e(pt):e(q,!1)})}r(N),Ft(N,e=>{var a;return(a=ce)==null?void 0:a(e)}),r(At),r(rt),Ft(rt,e=>{var a;return(a=Et)==null?void 0:a(e)});var mt=i(rt,2),ut=n(mt),qt=i(n(ut),2);r(ut);var Ht=i(ut,2);{var Kt=e=>{var a=Fe();tt(a,20,()=>Array(6),nt,(v,m)=>{var xt=Ce();x(v,xt)}),r(a),x(e,a)},Gt=e=>{var a=Ie(),v=n(a),m=n(v);It(m,{name:"importance",size:40}),r(v),St(4),r(a),x(e,a)},Wt=e=>{var a=je();tt(a,23,()=>t(L),v=>v.id,(v,m,xt)=>{const W=g(()=>kt[t(m).id]);var X=Te(),ft=n(X),gt=n(ft),E=n(gt),T=i(E,2),B=n(T,!0);r(T);var Z=i(T,4),U=n(Z);r(Z);var V=i(Z,2);{var yt=S=>{var z=Ne(),O=i(Q(z),2),ht=n(O);r(O),M(()=>k(ht,`${t(m).reviewCount??""} reviews`)),x(S,z)};R(V,S=>{t(m).reviewCount&&S(yt)})}r(gt);var Y=i(gt,2),A=n(Y,!0);r(Y);var J=i(Y,2);{var D=S=>{var z=Ee();tt(z,21,()=>t(m).tags.slice(0,4),nt,(O,ht)=>{var b=Pe(),Xt=n(b,!0);r(b),M(()=>k(Xt,t(ht))),x(O,b)}),r(z),x(S,z)};R(J,S=>{t(m).tags.length>0&&S(D)})}r(ft);var st=i(ft,2),_t=n(st);{let S=g(()=>{var b;return((b=t(W))==null?void 0:b.novelty)??0}),z=g(()=>{var b;return((b=t(W))==null?void 0:b.arousal)??0}),O=g(()=>{var b;return((b=t(W))==null?void 0:b.reward)??0}),ht=g(()=>{var b;return((b=t(W))==null?void 0:b.attention)??0});$t(_t,{get novelty(){return t(S)},get arousal(){return t(z)},get reward(){return t(O)},get attention(){return t(ht)},size:"sm"})}r(st),r(X),Ft(X,(S,z)=>{var O;return(O=Et)==null?void 0:O(S,z)},()=>({delay:t(xt)*45})),M(S=>{ae(E,`background: ${(oe[t(m).nodeType]||"#8B95A5")??""}`),k(B,t(m).nodeType),k(U,`${S??""}% retention`),k(A,t(m).content)},[()=>(t(m).retentionStrength*100).toFixed(0)]),Ct("click",X,()=>Mt(t(m).id)),x(v,X)}),r(a),x(e,a)};R(Ht,e=>{t(lt)?e(Kt):t(L).length===0?e(Gt,1):e(Wt,!1)})}r(mt),Ft(mt,e=>{var a;return(a=Et)==null?void 0:a(e)}),r(G),M(e=>{s.disabled=e,k(c,t($)?"Scoring…":"Score Importance")},[()=>t($)||!t(f).trim()]),Ct("keydown",l,Pt),re(l,()=>t(f),e=>F(f,e)),Ct("click",s,at),Ct("click",qt,dt),x(o,G),Dt()}te(["keydown","click"]);export{ea as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/12.CO2CXIFj.js.br b/apps/dashboard/build/_app/immutable/nodes/12.CO2CXIFj.js.br deleted file mode 100644 index 6805664..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/12.CO2CXIFj.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/12.CO2CXIFj.js.gz b/apps/dashboard/build/_app/immutable/nodes/12.CO2CXIFj.js.gz deleted file mode 100644 index 2a3ee30..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/12.CO2CXIFj.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/12.DaxyVsV4.js b/apps/dashboard/build/_app/immutable/nodes/12.DaxyVsV4.js new file mode 100644 index 0000000..9d93ad4 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/12.DaxyVsV4.js @@ -0,0 +1 @@ +import"../chunks/Bzak7iHL.js";import{o as gt}from"../chunks/GG5zm9kr.js";import{p as yt,s as D,c as Q,t as u,a as bt,e as o,d as n,h as O,g as r,r as a,n as ht}from"../chunks/CpWkWWOo.js";import{d as wt,s as d,a as Rt}from"../chunks/BlVfL1ME.js";import{i as R}from"../chunks/B4yTwGkE.js";import{e as L,i as U}from"../chunks/CGEBXrjl.js";import{a as l,f as v}from"../chunks/CHOnp4oo.js";import{s as W}from"../chunks/aVbAZ-t7.js";import{a as Z}from"../chunks/DNjM5a-l.js";var St=v(""),$t=v('
      '),Pt=v('
      '),Nt=v('

      Use "Remind me..." in conversation to create intentions.

      '),Ot=v(' '),It=v(' '),Tt=v('

      '),kt=v('
      '),zt=v('

      No predictions yet. Use Vestige more to train the predictive model.

      '),Dt=v(" "),Lt=v(' '),Ut=v('

      '),Ct=v('
      '),At=v('

      Intentions & Predictions

      Prospective Memory

      "Remember to do X when Y happens"

      Predicted Needs

      What you might need next
      ');function Wt(tt,et){yt(et,!0);let I=D(Q([])),C=D(Q([])),A=D(!0),S=D("active");const at={active:"text-synapse-glow bg-synapse/10 border-synapse/30",fulfilled:"text-recall bg-recall/10 border-recall/30",cancelled:"text-dim bg-white/[0.03] border-subtle/20",snoozed:"text-dream-glow bg-dream/10 border-dream/30"},st={4:"critical",3:"high",2:"normal",1:"low"},rt={4:"text-decay",3:"text-amber-400",2:"text-dim",1:"text-muted"},it={time:"⏰",context:"◎",event:"⚡",manual:"◇"};function nt(s){let t;try{const e=JSON.parse(s.trigger_data||"{}");if(typeof e.condition=="string"&&e.condition)t=e.condition;else if(typeof e.topic=="string"&&e.topic)t=e.topic;else if(typeof e.at=="string"&&e.at)try{t=new Date(e.at).toLocaleDateString("en-US",{month:"short",day:"numeric"})}catch{t=e.at}else if(typeof e.in_minutes=="number")t=`in ${e.in_minutes} min`;else if(typeof e.inMinutes=="number")t=`in ${e.inMinutes} min`;else if(typeof e.codebase=="string"&&e.codebase){const i=typeof e.filePattern=="string"&&e.filePattern?`/${e.filePattern}`:"";t=`${e.codebase}${i}`}else t=s.trigger_type}catch{t=s.trigger_type}return t.length>40?t.slice(0,37)+"...":t}gt(async()=>{await X()});async function X(){O(A,!0);try{const[s,t]=await Promise.all([Z.intentions(r(S)),Z.predict()]);O(I,s.intentions||[],!0),O(C,t.predictions||[],!0)}catch{}finally{O(A,!1)}}async function ot(s){O(S,s,!0),await X()}function M(s){if(!s)return"";try{return new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return s}}var j=At(),F=n(j),q=o(n(F),2),dt=n(q);a(q),a(F);var Y=o(F,2),E=o(n(Y),2);L(E,20,()=>["active","fulfilled","snoozed","cancelled","all"],U,(s,t)=>{var e=St(),i=n(e,!0);a(e),u(p=>{W(e,1,`px-3 py-1.5 rounded-xl text-xs transition ${r(S)===t?"bg-synapse/20 text-synapse-glow border border-synapse/40":"glass-subtle text-dim hover:bg-white/[0.03]"}`),d(i,p)},[()=>t.charAt(0).toUpperCase()+t.slice(1)]),Rt("click",e,()=>ot(t)),l(s,e)}),a(E);var lt=o(E,2);{var vt=s=>{var t=Pt();L(t,20,()=>Array(4),U,(e,i)=>{var p=$t();l(e,p)}),a(t),l(s,t)},ct=s=>{var t=Nt(),e=o(n(t),2),i=n(e);a(e),ht(2),a(t),u(()=>d(i,`No ${r(S)==="all"?"":r(S)+" "}intentions.`)),l(s,t)},pt=s=>{var t=kt();L(t,21,()=>r(I),U,(e,i)=>{var p=Tt(),g=n(p),y=n(g),T=n(y,!0);a(y);var f=o(y,2),$=n(f),k=n($,!0);a($);var b=o($,2),h=n(b),z=n(h,!0);a(h);var w=o(h,2),G=n(w);a(w);var P=o(w,2),x=n(P);a(P);var c=o(P,2);{var N=m=>{var _=Ot(),J=n(_);a(_),u(V=>d(J,`deadline: ${V??""}`),[()=>M(r(i).deadline)]),l(m,_)};R(c,m=>{r(i).deadline&&m(N)})}var B=o(c,2);{var ut=m=>{var _=It(),J=n(_);a(_),u(V=>d(J,`snoozed until ${V??""}`),[()=>M(r(i).snoozed_until)]),l(m,_)};R(B,m=>{r(i).snoozed_until&&m(ut)})}a(b),a(f);var K=o(f,2),ft=n(K,!0);a(K),a(g),a(p),u((m,_)=>{d(T,it[r(i).trigger_type]||"◇"),d(k,r(i).content),W(h,1,`px-2 py-0.5 text-[10px] rounded-lg border ${(at[r(i).status]||"text-dim bg-white/[0.03] border-subtle/20")??""}`),d(z,r(i).status),W(w,1,`text-[10px] ${(rt[r(i).priority]||"text-muted")??""}`),d(G,`${(st[r(i).priority]||"normal")??""} priority`),d(x,`${r(i).trigger_type??""}: ${m??""}`),d(ft,_)},[()=>nt(r(i)),()=>M(r(i).created_at)]),l(e,p)}),a(t),l(s,t)};R(lt,s=>{r(A)?s(vt):r(I).length===0?s(ct,1):s(pt,!1)})}a(Y);var H=o(Y,2),xt=o(n(H),2);{var mt=s=>{var t=zt();l(s,t)},_t=s=>{var t=Ct();L(t,21,()=>r(C),U,(e,i,p)=>{var g=Ut(),y=n(g);y.textContent=p+1;var T=o(y,2),f=n(T),$=n(f,!0);a(f);var k=o(f,2),b=n(k),h=n(b,!0);a(b);var z=o(b,2);{var w=x=>{var c=Dt(),N=n(c);a(c),u(B=>d(N,`${B??""}% retention`),[()=>(Number(r(i).retention)*100).toFixed(0)]),l(x,c)};R(z,x=>{r(i).retention&&x(w)})}var G=o(z,2);{var P=x=>{var c=Lt(),N=n(c);a(c),u(()=>d(N,`${r(i).predictedNeed??""} need`)),l(x,c)};R(G,x=>{r(i).predictedNeed&&x(P)})}a(k),a(T),a(g),u(()=>{d($,r(i).content),d(h,r(i).nodeType)}),l(e,g)}),a(t),l(s,t)};R(xt,s=>{r(C).length===0?s(mt):s(_t,!1)})}a(H),a(j),u(()=>d(dt,`${r(I).length??""} intentions`)),l(tt,j),bt()}wt(["click"]);export{Wt as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/12.DaxyVsV4.js.br b/apps/dashboard/build/_app/immutable/nodes/12.DaxyVsV4.js.br new file mode 100644 index 0000000..131afbf Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/12.DaxyVsV4.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/12.DaxyVsV4.js.gz b/apps/dashboard/build/_app/immutable/nodes/12.DaxyVsV4.js.gz new file mode 100644 index 0000000..d8cfdf7 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/12.DaxyVsV4.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/13.BQoci-vM.js b/apps/dashboard/build/_app/immutable/nodes/13.BQoci-vM.js deleted file mode 100644 index 4b6d8fb..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/13.BQoci-vM.js +++ /dev/null @@ -1 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{o as ke}from"../chunks/TZu9D97Z.js";import{p as Ae,s as C,d as ae,a as o,b as De,g as r,j as d,e as i,i as D,h as l,n as X,r as a,t as y,u as Ie}from"../chunks/wpu9U-D0.js";import{s as u}from"../chunks/D8mhvFt8.js";import{i as S}from"../chunks/DKve45Wd.js";import{e as F,i as q,s as se}from"../chunks/60_R_Vbt.js";import{a as L,r as re}from"../chunks/P1-U_Xsj.js";import{a as ie}from"../chunks/CZfHMhLI.js";import{P as Ne}from"../chunks/BHDZZvku.js";import{D as Oe}from"../chunks/CmbJHhgy.js";import{I as M}from"../chunks/D7A-gG4Z.js";import{A as Te}from"../chunks/DcKTNC6e.js";import{s as ne}from"../chunks/DPdYG9yN.js";var je=d(' intentions'),Ce=d('
      '),Fe=d('
      '),Le=d('

      '),Me=d(' '),Ue=d(' '),Ve=d('

      '),We=d('
      '),Ye=d('
      '),Be=d('
      '),Ee=d(`

      No predictions yet — keep using Vestige and the predictive model will start surfacing what you'll reach for next.

      `),Ge=d(' '),He=d(' '),Je=d('

      '),Xe=d('
      '),qe=d('

      Prospective Memory

      "Remember to do X when Y happens"

      Predicted Needs

      What you might need next
      ');function vt(le,oe){Ae(oe,!0);let I=C(ae([])),U=C(ae([])),N=C(!0),R=C("active");const de={active:"text-synapse-glow bg-synapse/10 border-synapse/30",fulfilled:"text-recall bg-recall/10 border-recall/30",cancelled:"text-dim bg-white/[0.03] border-subtle/20",snoozed:"text-dream-glow bg-dream/10 border-dream/30"},ve={4:"critical",3:"high",2:"normal",1:"low"},ce={4:"text-decay",3:"text-amber-400",2:"text-dim",1:"text-muted"},pe={time:"schedule",context:"graph",event:"pulse",manual:"intentions"},me=[{value:"active",label:"Active",color:"#6366f1"},{value:"fulfilled",label:"Fulfilled",color:"#10b981"},{value:"snoozed",label:"Snoozed",color:"#a78bfa"},{value:"cancelled",label:"Cancelled",color:"#8B95A5"},{value:"all",label:"All",color:"#00D4FF"}];function xe(s){let t;try{const e=JSON.parse(s.trigger_data||"{}");if(typeof e.condition=="string"&&e.condition)t=e.condition;else if(typeof e.topic=="string"&&e.topic)t=e.topic;else if(typeof e.at=="string"&&e.at)try{t=new Date(e.at).toLocaleDateString("en-US",{month:"short",day:"numeric"})}catch{t=e.at}else if(typeof e.in_minutes=="number")t=`in ${e.in_minutes} min`;else if(typeof e.inMinutes=="number")t=`in ${e.inMinutes} min`;else if(typeof e.codebase=="string"&&e.codebase){const n=typeof e.filePattern=="string"&&e.filePattern?`/${e.filePattern}`:"";t=`${e.codebase}${n}`}else t=s.trigger_type}catch{t=s.trigger_type}return t.length>40?t.slice(0,37)+"...":t}ke(async()=>{await K()});async function K(){D(N,!0);try{const[s,t]=await Promise.all([ie.intentions(r(R)),ie.predict()]);D(I,s.intentions||[],!0),D(U,t.predictions||[],!0)}catch{}finally{D(N,!1)}}async function ue(s){D(R,s,!0),await K()}function V(s){if(!s)return"";try{return new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return s}}var W=qe(),Q=i(W);Ne(Q,{icon:"intentions",title:"Intentions & Predictions",subtitle:"Prospective memory and the needs Vestige sees coming",accent:"memory",children:(s,t)=>{var e=je(),n=i(e);Te(n,{get value(){return r(I).length}}),X(),a(e),o(s,e)},$$slots:{default:!0}});var Y=l(Q,2),B=i(Y),_e=l(i(B),2);Oe(_e,{get options(){return me},get value(){return r(R)},label:"Status",icon:"filter",onChange:ue}),a(B);var fe=l(B,2);{var ge=s=>{var t=Fe();F(t,20,()=>Array(4),q,(e,n)=>{var _=Ce();o(e,_)}),a(t),o(s,t)},ye=s=>{var t=Le(),e=i(t),n=i(e);M(n,{name:"intentions",size:44,strokeWidth:1.2}),a(e);var _=l(e,2),m=i(_);a(_),a(t),y(()=>u(m,`No ${r(R)==="all"?"":r(R)+" "}intentions yet — say "Remind me…" in conversation and Vestige will hold the thought for you.`)),o(s,t)},he=s=>{var t=We();F(t,23,()=>r(I),e=>e.id,(e,n,_)=>{var m=Ve(),$=i(m),h=i($),O=i(h);{let c=Ie(()=>pe[r(n).trigger_type]||"intentions");M(O,{get name(){return r(c)},size:18})}a(h);var g=l(h,2),k=i(g),T=i(k,!0);a(k);var b=l(k,2),w=i(b),j=i(w,!0);a(w);var z=l(w,2),G=i(z);a(z);var A=l(z,2),x=i(A);a(A);var v=l(A,2);{var f=c=>{var p=Me(),P=i(p);a(p),y(J=>u(P,`deadline: ${J??""}`),[()=>V(r(n).deadline)]),o(c,p)};S(v,c=>{r(n).deadline&&c(f)})}var H=l(v,2);{var Re=c=>{var p=Ue(),P=i(p);a(p),y(J=>u(P,`snoozed until ${J??""}`),[()=>V(r(n).snoozed_until)]),o(c,p)};S(H,c=>{r(n).snoozed_until&&c(Re)})}a(b),a(g);var te=l(g,2),$e=i(te,!0);a(te),a($),a(m),L(m,(c,p)=>{var P;return(P=re)==null?void 0:P(c,p)},()=>({delay:Math.min(r(_)*35,350),y:12})),L(m,c=>{var p;return(p=ne)==null?void 0:p(c)}),y((c,p)=>{u(T,r(n).content),se(w,1,`px-2 py-0.5 text-[10px] rounded-lg border ${(de[r(n).status]||"text-dim bg-white/[0.03] border-subtle/20")??""}`),u(j,r(n).status),se(z,1,`text-[10px] ${(ce[r(n).priority]||"text-muted")??""}`),u(G,`${(ve[r(n).priority]||"normal")??""} priority`),u(x,`${r(n).trigger_type??""}: ${c??""}`),u($e,p)},[()=>xe(r(n)),()=>V(r(n).created_at)]),o(e,m)}),a(t),o(s,t)};S(fe,s=>{r(N)?s(ge):r(I).length===0?s(ye,1):s(he,!1)})}a(Y);var Z=l(Y,2),E=i(Z),ee=i(E),be=i(ee);M(be,{name:"sparkle",size:16}),a(ee),X(4),a(E);var we=l(E,2);{var ze=s=>{var t=Be();F(t,20,()=>Array(3),q,(e,n)=>{var _=Ye();o(e,_)}),a(t),o(s,t)},Pe=s=>{var t=Ee(),e=i(t),n=i(e);M(n,{name:"sparkle",size:40,strokeWidth:1.2}),a(e),X(2),a(t),o(s,t)},Se=s=>{var t=Xe();F(t,21,()=>r(U),q,(e,n,_)=>{var m=Je(),$=i(m),h=i($);h.textContent=_+1;var O=l(h,2),g=i(O),k=i(g,!0);a(g);var T=l(g,2),b=i(T),w=i(b,!0);a(b);var j=l(b,2);{var z=x=>{var v=Ge(),f=i(v);a(v),y(H=>u(f,`${H??""}% retention`),[()=>(Number(r(n).retention)*100).toFixed(0)]),o(x,v)};S(j,x=>{r(n).retention&&x(z)})}var G=l(j,2);{var A=x=>{var v=He(),f=i(v);a(v),y(()=>u(f,`${r(n).predictedNeed??""} need`)),o(x,v)};S(G,x=>{r(n).predictedNeed&&x(A)})}a(T),a(O),a($),a(m),L(m,(x,v)=>{var f;return(f=re)==null?void 0:f(x,v)},()=>({delay:Math.min(_*35,350),y:12})),L(m,x=>{var v;return(v=ne)==null?void 0:v(x)}),y(()=>{u(k,r(n).content),u(w,r(n).nodeType)}),o(e,m)}),a(t),o(s,t)};S(we,s=>{r(N)?s(ze):r(U).length===0?s(Pe,1):s(Se,!1)})}a(Z),a(W),o(le,W),De()}export{vt as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/13.BQoci-vM.js.br b/apps/dashboard/build/_app/immutable/nodes/13.BQoci-vM.js.br deleted file mode 100644 index cecfd72..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/13.BQoci-vM.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/13.BQoci-vM.js.gz b/apps/dashboard/build/_app/immutable/nodes/13.BQoci-vM.js.gz deleted file mode 100644 index 0ffa50a..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/13.BQoci-vM.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/13.D52bbIQQ.js b/apps/dashboard/build/_app/immutable/nodes/13.D52bbIQQ.js new file mode 100644 index 0000000..2c738bc --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/13.D52bbIQQ.js @@ -0,0 +1,6 @@ +import"../chunks/Bzak7iHL.js";import{o as Ye}from"../chunks/GG5zm9kr.js";import{p as Ge,s as R,c as Ne,h as M,d as s,g as e,r as t,a as Je,f as Ke,e as n,t as k,u as ae}from"../chunks/CpWkWWOo.js";import{d as Ue,s as w,a as h}from"../chunks/BlVfL1ME.js";import{i as q}from"../chunks/B4yTwGkE.js";import{e as ue,i as je}from"../chunks/CGEBXrjl.js";import{a as c,f as g,b as re}from"../chunks/CHOnp4oo.js";import{s as X,r as qe}from"../chunks/A7po6GxK.js";import{s as Le}from"../chunks/aVbAZ-t7.js";import{s as Z}from"../chunks/Cx-f-Pzo.js";import{b as Qe}from"../chunks/sZcqyNBA.js";import{b as it}from"../chunks/BnXDGOmJ.js";import{a as H}from"../chunks/DNjM5a-l.js";import{N as lt}from"../chunks/DzfRjky4.js";const dt={created:{label:"Created",color:"#10b981",glyph:"",kind:"ring"},accessed:{label:"Accessed",color:"#3b82f6",glyph:"",kind:"dot"},promoted:{label:"Promoted",color:"#10b981",glyph:"",kind:"arrow-up"},demoted:{label:"Demoted",color:"#f59e0b",glyph:"",kind:"arrow-down"},edited:{label:"Edited",color:"#facc15",glyph:"",kind:"pencil"},suppressed:{label:"Suppressed",color:"#a855f7",glyph:"",kind:"x"},dreamed:{label:"Dreamed",color:"#c084fc",glyph:"",kind:"star"},reconsolidated:{label:"Reconsolidated",color:"#ec4899",glyph:"",kind:"circle-arrow"}},ke=15;function ct(u){let p=0;for(let x=0;x>>0;return p}function vt(u){let p=u>>>0;return()=>(p=p*1664525+1013904223>>>0,p/4294967296)}function pt(u,p=Date.now(),x){if(!u)return[];const _=vt(ct(u)),S=8+Math.floor(_()*8);if(S<=0)return[];const P=[],T=p-(14+_()*21)*864e5;P.push({action:"created",timestamp:new Date(T).toISOString(),reason:"smart_ingest · prediction-error gate opened",triggered_by:"smart_ingest"});let A=T,l=.5+_()*.2;const D=["accessed","accessed","accessed","accessed","promoted","demoted","edited","dreamed","reconsolidated","suppressed"];for(let $=1;$.5?"search":"deep_reference";break}case"promoted":{const E=l;l=Math.min(1,l+.1),d.old_value=E,d.new_value=l,d.reason="confirmed helpful by user",d.triggered_by="memory(action=promote)";break}case"demoted":{const E=l;l=Math.max(0,l-.15),d.old_value=E,d.new_value=l,d.reason="user flagged as outdated",d.triggered_by="memory(action=demote)";break}case"edited":{d.reason="content refined, FSRS state preserved",d.triggered_by="memory(action=edit)";break}case"suppressed":{const E=l;l=Math.max(0,l-.08),d.old_value=E,d.new_value=l,d.reason="top-down inhibition (Anderson 2025)",d.triggered_by="suppress(dashboard)";break}case"dreamed":{const E=l;l=Math.min(1,l+.05),d.old_value=E,d.new_value=l,d.reason="replayed during dream consolidation",d.triggered_by="dream()";break}case"reconsolidated":{d.reason="edited within 5-min labile window (Nader)",d.triggered_by="reconsolidation-manager";break}case"created":d.triggered_by="smart_ingest";break}P.push(d)}return P.reverse()}function ut(u,p=Date.now()){const x=new Date(u).getTime(),_=Math.max(0,p-x),S=Math.floor(_/1e3);if(S<60)return`${S}s ago`;const P=Math.floor(S/60);if(P<60)return`${P}m ago`;const T=Math.floor(P/60);if(T<24)return`${T}h ago`;const A=Math.floor(T/24);if(A<30)return`${A}d ago`;const l=Math.floor(A/30);return l<12?`${l}mo ago`:`${Math.floor(l/12)}y ago`}function ft(u,p){const x=typeof u=="number"&&Number.isFinite(u),_=typeof p=="number"&&Number.isFinite(p);return!x&&!_?null:!x&&_?`set ${p.toFixed(2)}`:x&&!_?`was ${u.toFixed(2)}`:`${u.toFixed(2)} → ${p.toFixed(2)}`}function gt(u,p){return p||u.length<=ke?{visible:u,hiddenCount:Math.max(0,u.length-ke)}:{visible:u.slice(0,ke),hiddenCount:u.length-ke}}var _t=g('
      '),xt=g('
      '),bt=g('

      Audit trail failed to load.

      '),mt=g('

      No memory selected.

      '),ht=g('

      No audit events recorded yet.

      '),kt=g(''),yt=g(''),wt=re(''),Mt=re(''),St=re(''),Pt=re(''),Tt=re(''),At=re(''),Dt=g(' '),Et=g('
      '),Ct=g('
      '),Ft=g('
    • '),It=g(''),Lt=g('
        ',1),Nt=g('
        ');function jt(u,p){Ge(p,!0);let x=R(Ne([])),_=R(!0),S=R(!1),P=R(!1);async function T(m){return pt(m,Date.now())}Ye(async()=>{if(!p.memoryId){M(x,[],!0),M(_,!1);return}try{M(x,await T(p.memoryId),!0)}catch{M(x,[],!0),M(S,!0)}finally{M(_,!1)}});const A=ae(()=>gt(e(x),e(P))),l=ae(()=>e(A).visible),D=ae(()=>e(A).hiddenCount);var $=Nt(),I=s($);{var d=m=>{var y=xt();ue(y,20,()=>Array(5),je,(N,Q)=>{var K=_t();c(N,K)}),t(y),c(m,y)},E=m=>{var y=bt();c(m,y)},oe=m=>{var y=mt();c(m,y)},se=m=>{var y=ht();c(m,y)},fe=m=>{var y=Lt(),N=Ke(y);ue(N,23,()=>e(l),(L,b)=>L.timestamp+b,(L,b,U)=>{const v=ae(()=>dt[e(b).action]),V=ae(()=>ft(e(b).old_value,e(b).new_value));var Y=Ft(),G=s(Y),ge=s(G);{var _e=a=>{var r=kt();k(()=>Z(r,`background: ${e(v).color??""};`)),c(a,r)},ee=a=>{var r=yt();k(()=>Z(r,`border-color: ${e(v).color??""}; background: transparent;`)),c(a,r)},xe=a=>{var r=wt();k(()=>X(r,"stroke",e(v).color)),c(a,r)},ye=a=>{var r=Mt();k(()=>X(r,"stroke",e(v).color)),c(a,r)},we=a=>{var r=St();k(()=>X(r,"stroke",e(v).color)),c(a,r)},Me=a=>{var r=Pt();k(()=>X(r,"stroke",e(v).color)),c(a,r)},Se=a=>{var r=Tt();k(()=>X(r,"fill",e(v).color)),c(a,r)},f=a=>{var r=At();k(()=>X(r,"stroke",e(v).color)),c(a,r)};q(ge,a=>{e(v).kind==="dot"?a(_e):e(v).kind==="ring"?a(ee,1):e(v).kind==="arrow-up"?a(xe,2):e(v).kind==="arrow-down"?a(ye,3):e(v).kind==="pencil"?a(we,4):e(v).kind==="x"?a(Me,5):e(v).kind==="star"?a(Se,6):e(v).kind==="circle-arrow"&&a(f,7)})}t(G);var C=n(G,2),z=s(C),i=s(z),F=s(i),ne=s(F,!0);t(F);var ie=n(F,2);{var le=a=>{var r=Dt(),W=s(r,!0);t(r),k(()=>w(W,e(b).triggered_by)),c(a,r)};q(ie,a=>{e(b).triggered_by&&a(le)})}t(i);var te=n(i,2),de=s(te,!0);t(te),t(z);var be=n(z,2);{var Pe=a=>{var r=Et(),W=s(r);t(r),k(()=>w(W,`retention ${e(V)??""}`)),c(a,r)};q(be,a=>{e(V)&&a(Pe)})}var me=n(be,2);{var Te=a=>{var r=Ct(),W=s(r,!0);t(r),k(()=>w(W,e(b).reason)),c(a,r)};q(me,a=>{e(b).reason&&a(Te)})}t(C),t(Y),k((a,r)=>{Z(Y,`animation-delay: ${e(U)*40}ms;`),Z(G,`background: rgba(10,10,26,0.9); box-shadow: 0 0 10px ${e(v).color??""}88; border: 1px solid ${e(v).color??""};`),Z(F,`color: ${e(v).color??""};`),w(ne,e(v).label),X(te,"title",a),w(de,r)},[()=>new Date(e(b).timestamp).toLocaleString(),()=>ut(e(b).timestamp)]),c(L,Y)}),t(N);var Q=n(N,2);{var K=L=>{var b=It(),U=s(b,!0);t(b),k(()=>w(U,e(P)?"Hide older events":`Show ${e(D)} older event${e(D)===1?"":"s"}…`)),h("click",b,v=>{v.stopPropagation(),M(P,!e(P))}),c(L,b)};q(Q,L=>{e(D)>0&&L(K)})}c(m,y)};q(I,m=>{e(_)?m(d):e(S)?m(E,1):p.memoryId?e(x).length===0?m(se,3):m(fe,!1):m(oe,2)})}t($),c(u,$),Je()}Ue(["click"]);var Bt=g('
        '),Ot=g('
        '),Rt=g(' '),$t=g('

        ',1),zt=g('
        '),Ht=g('
        Content Audit Trail
        Promote Demote Suppress Delete
        '),qt=g(''),Qt=g('
        '),Yt=g(`

        Memories

        Min retention:
        `);function na(u,p){Ge(p,!0);let x=R(Ne([])),_=R(""),S=R(""),P="",T=R(0),A=R(!0),l=R(null),D=Ne({}),$;Ye(()=>I());async function I(){M(A,!0);try{const f={};e(_)&&(f.q=e(_)),e(S)&&(f.node_type=e(S)),e(T)>0&&(f.min_retention=String(e(T)));const C=await H.memories.list(f);M(x,C.memories,!0)}catch{M(x,[],!0)}finally{M(A,!1)}}function d(){clearTimeout($),$=setTimeout(I,300)}function E(f){return f>.7?"#10b981":f>.4?"#f59e0b":"#ef4444"}var oe=Yt(),se=s(oe),fe=n(s(se),2),m=s(fe);t(fe),t(se);var y=n(se,2),N=s(y);qe(N);var Q=n(N,2),K=s(Q);K.value=K.__value="";var L=n(K);L.value=L.__value="fact";var b=n(L);b.value=b.__value="concept";var U=n(b);U.value=U.__value="event";var v=n(U);v.value=v.__value="person";var V=n(v);V.value=V.__value="place";var Y=n(V);Y.value=Y.__value="note";var G=n(Y);G.value=G.__value="pattern";var ge=n(G);ge.value=ge.__value="decision",t(Q);var _e=n(Q,2),ee=n(s(_e),2);qe(ee);var xe=n(ee,2),ye=s(xe);t(xe),t(_e),t(y);var we=n(y,2);{var Me=f=>{var C=Ot();ue(C,20,()=>Array(8),je,(z,i)=>{var F=Bt();c(z,F)}),t(C),c(f,C)},Se=f=>{var C=Qt();ue(C,21,()=>e(x),z=>z.id,(z,i)=>{var F=qt(),ne=s(F),ie=s(ne),le=s(ie),te=s(le),de=n(te,2),be=s(de,!0);t(de);var Pe=n(de,2);ue(Pe,17,()=>e(i).tags.slice(0,3),je,(j,B)=>{var O=Rt(),ce=s(O,!0);t(O),k(()=>w(ce,e(B))),c(j,O)}),t(le);var me=n(le,2),Te=s(me,!0);t(me),t(ie);var a=n(ie,2),r=s(a),W=s(r);t(r);var Be=n(r,2),We=s(Be);t(Be),t(a),t(ne);var Xe=n(ne,2);{var Ze=j=>{const B=ae(()=>D[e(i).id]??"content");var O=Ht(),ce=s(O),he=s(ce),Ae=n(he,2);t(ce);var Oe=n(ce,2);{var Ve=o=>{var J=$t(),ve=Ke(J),pe=s(ve,!0);t(ve);var ze=n(ve,2),Fe=s(ze),tt=s(Fe);t(Fe);var Ie=n(Fe,2),at=s(Ie);t(Ie);var He=n(Ie,2),rt=s(He);t(He),t(ze),k((ot,st,nt)=>{w(pe,e(i).content),w(tt,`Storage: ${ot??""}%`),w(at,`Retrieval: ${st??""}%`),w(rt,`Created: ${nt??""}`)},[()=>(e(i).storageStrength*100).toFixed(1),()=>(e(i).retrievalStrength*100).toFixed(1),()=>new Date(e(i).createdAt).toLocaleDateString()]),c(o,J)},et=o=>{var J=zt(),ve=s(J);jt(ve,{get memoryId(){return e(i).id}}),t(J),h("click",J,pe=>pe.stopPropagation()),h("keydown",J,pe=>pe.stopPropagation()),c(o,J)};q(Oe,o=>{e(B)==="content"?o(Ve):o(et,!1)})}var Re=n(Oe,2),De=s(Re),Ee=n(De,2),Ce=n(Ee,2),$e=n(Ce,2);t(Re),t(O),k(()=>{Le(he,1,`px-3 py-1.5 rounded-lg cursor-pointer select-none transition + ${e(B)==="content"?"bg-synapse/20 text-synapse-glow border border-synapse/40":"bg-white/[0.03] text-dim hover:text-text border border-transparent"}`),Le(Ae,1,`px-3 py-1.5 rounded-lg cursor-pointer select-none transition + ${e(B)==="audit"?"bg-synapse/20 text-synapse-glow border border-synapse/40":"bg-white/[0.03] text-dim hover:text-text border border-transparent"}`)}),h("click",he,o=>{o.stopPropagation(),D[e(i).id]="content"}),h("keydown",he,o=>{(o.key==="Enter"||o.key===" ")&&(o.stopPropagation(),D[e(i).id]="content")}),h("click",Ae,o=>{o.stopPropagation(),D[e(i).id]="audit"}),h("keydown",Ae,o=>{(o.key==="Enter"||o.key===" ")&&(o.stopPropagation(),D[e(i).id]="audit")}),h("click",De,o=>{o.stopPropagation(),H.memories.promote(e(i).id)}),h("keydown",De,o=>{o.key==="Enter"&&(o.stopPropagation(),H.memories.promote(e(i).id))}),h("click",Ee,o=>{o.stopPropagation(),H.memories.demote(e(i).id)}),h("keydown",Ee,o=>{o.key==="Enter"&&(o.stopPropagation(),H.memories.demote(e(i).id))}),h("click",Ce,async o=>{o.stopPropagation(),await H.memories.suppress(e(i).id,"dashboard trigger")}),h("keydown",Ce,async o=>{o.key==="Enter"&&(o.stopPropagation(),await H.memories.suppress(e(i).id,"dashboard trigger"))}),h("click",$e,async o=>{o.stopPropagation(),await H.memories.delete(e(i).id),I()}),h("keydown",$e,async o=>{o.key==="Enter"&&(o.stopPropagation(),await H.memories.delete(e(i).id),I())}),c(j,O)};q(Xe,j=>{var B;((B=e(l))==null?void 0:B.id)===e(i).id&&j(Ze)})}t(F),k((j,B)=>{var O;Le(F,1,`text-left p-4 glass-subtle rounded-xl hover:bg-white/[0.04] + transition-all duration-200 group + ${((O=e(l))==null?void 0:O.id)===e(i).id?"!border-synapse/40 glow-synapse":""}`),Z(te,`background: ${(lt[e(i).nodeType]||"#8B95A5")??""}`),w(be,e(i).nodeType),w(Te,e(i).content),Z(W,`width: ${e(i).retentionStrength*100}%; background: ${j??""}`),w(We,`${B??""}%`)},[()=>E(e(i).retentionStrength),()=>(e(i).retentionStrength*100).toFixed(0)]),h("click",F,()=>{var j;return M(l,((j=e(l))==null?void 0:j.id)===e(i).id?null:e(i),!0)}),c(z,F)}),t(C),c(f,C)};q(we,f=>{e(A)?f(Me):f(Se,!1)})}t(oe),k(f=>{w(m,`${e(x).length??""} results`),w(ye,`${f??""}%`)},[()=>(e(T)*100).toFixed(0)]),h("input",N,d),Qe(N,()=>e(_),f=>M(_,f)),h("change",Q,I),it(Q,()=>e(S),f=>M(S,f)),h("change",ee,I),Qe(ee,()=>e(T),f=>M(T,f)),c(u,oe),Je()}Ue(["input","change","click","keydown"]);export{na as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/13.D52bbIQQ.js.br b/apps/dashboard/build/_app/immutable/nodes/13.D52bbIQQ.js.br new file mode 100644 index 0000000..9d59b5e Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/13.D52bbIQQ.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/13.D52bbIQQ.js.gz b/apps/dashboard/build/_app/immutable/nodes/13.D52bbIQQ.js.gz new file mode 100644 index 0000000..6d07d4b Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/13.D52bbIQQ.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/14.CDp0vmq1.js b/apps/dashboard/build/_app/immutable/nodes/14.CDp0vmq1.js deleted file mode 100644 index 53090b2..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/14.CDp0vmq1.js +++ /dev/null @@ -1,6 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{o as We}from"../chunks/TZu9D97Z.js";import{p as Ye,s as B,d as $e,i as P,e as s,g as e,r as t,a as l,b as Ge,f as Je,h as v,t as k,u as oe,j as f,au as ne,n as st}from"../chunks/wpu9U-D0.js";import{d as Ke,s as D,a as y}from"../chunks/D8mhvFt8.js";import{i as q}from"../chunks/DKve45Wd.js";import{e as pe,i as Oe,a as V,r as ot,s as Ie}from"../chunks/60_R_Vbt.js";import{a as He,r as nt}from"../chunks/P1-U_Xsj.js";import{s as X}from"../chunks/EqHb-9AZ.js";import{b as it}from"../chunks/CnZzd20v.js";import{a as H}from"../chunks/CZfHMhLI.js";import{N as L}from"../chunks/CcUbQ_Wl.js";import{P as lt}from"../chunks/BHDZZvku.js";import{A as dt}from"../chunks/DcKTNC6e.js";import{D as qe}from"../chunks/CmbJHhgy.js";import{I as Qe}from"../chunks/D7A-gG4Z.js";import{s as ct}from"../chunks/DPdYG9yN.js";const vt={created:{label:"Created",color:"#10b981",glyph:"",kind:"ring"},accessed:{label:"Accessed",color:"#3b82f6",glyph:"",kind:"dot"},promoted:{label:"Promoted",color:"#10b981",glyph:"",kind:"arrow-up"},demoted:{label:"Demoted",color:"#f59e0b",glyph:"",kind:"arrow-down"},edited:{label:"Edited",color:"#facc15",glyph:"",kind:"pencil"},suppressed:{label:"Suppressed",color:"#a855f7",glyph:"",kind:"x"},dreamed:{label:"Dreamed",color:"#c084fc",glyph:"",kind:"star"},reconsolidated:{label:"Reconsolidated",color:"#ec4899",glyph:"",kind:"circle-arrow"}},_e=15;function pt(g){let p=0;for(let m=0;m>>0;return p}function ut(g){let p=g>>>0;return()=>(p=p*1664525+1013904223>>>0,p/4294967296)}function ft(g,p=Date.now(),m){if(!g)return[];const x=ut(pt(g)),S=8+Math.floor(x()*8);if(S<=0)return[];const C=[],E=p-(14+x()*21)*864e5;C.push({action:"created",timestamp:new Date(E).toISOString(),reason:"smart_ingest · prediction-error gate opened",triggered_by:"smart_ingest"});let F=E,i=.5+x()*.2;const N=["accessed","accessed","accessed","accessed","promoted","demoted","edited","dreamed","reconsolidated","suppressed"];for(let z=1;z.5?"search":"deep_reference";break}case"promoted":{const I=i;i=Math.min(1,i+.1),d.old_value=I,d.new_value=i,d.reason="confirmed helpful by user",d.triggered_by="memory(action=promote)";break}case"demoted":{const I=i;i=Math.max(0,i-.15),d.old_value=I,d.new_value=i,d.reason="user flagged as outdated",d.triggered_by="memory(action=demote)";break}case"edited":{d.reason="content refined, FSRS state preserved",d.triggered_by="memory(action=edit)";break}case"suppressed":{const I=i;i=Math.max(0,i-.08),d.old_value=I,d.new_value=i,d.reason="top-down inhibition (Anderson 2025)",d.triggered_by="suppress(dashboard)";break}case"dreamed":{const I=i;i=Math.min(1,i+.05),d.old_value=I,d.new_value=i,d.reason="replayed during dream consolidation",d.triggered_by="dream()";break}case"reconsolidated":{d.reason="edited within 5-min labile window (Nader)",d.triggered_by="reconsolidation-manager";break}case"created":d.triggered_by="smart_ingest";break}C.push(d)}return C.reverse()}function gt(g,p=Date.now()){const m=new Date(g).getTime(),x=Math.max(0,p-m),S=Math.floor(x/1e3);if(S<60)return`${S}s ago`;const C=Math.floor(S/60);if(C<60)return`${C}m ago`;const E=Math.floor(C/60);if(E<24)return`${E}h ago`;const F=Math.floor(E/24);if(F<30)return`${F}d ago`;const i=Math.floor(F/30);return i<12?`${i}mo ago`:`${Math.floor(i/12)}y ago`}function xt(g,p){const m=typeof g=="number"&&Number.isFinite(g),x=typeof p=="number"&&Number.isFinite(p);return!m&&!x?null:!m&&x?`set ${p.toFixed(2)}`:m&&!x?`was ${g.toFixed(2)}`:`${g.toFixed(2)} → ${p.toFixed(2)}`}function mt(g,p){return p||g.length<=_e?{visible:g,hiddenCount:Math.max(0,g.length-_e)}:{visible:g.slice(0,_e),hiddenCount:g.length-_e}}var bt=f('
        '),_t=f('
        '),ht=f('

        Audit trail failed to load.

        '),kt=f('

        No memory selected.

        '),yt=f('

        No audit events recorded yet.

        '),wt=f(''),Mt=f(''),Pt=ne(''),St=ne(''),At=ne(''),Tt=ne(''),Dt=ne(''),Ct=ne(''),Et=f(' '),Ft=f('
        '),Nt=f('
        '),It=f('
      1. '),$t=f(''),Ot=f('
          ',1),Rt=f('
          ');function jt(g,p){Ye(p,!0);let m=B($e([])),x=B(!0),S=B(!1),C=B(!1);async function E(_){return ft(_,Date.now())}We(async()=>{if(!p.memoryId){P(m,[],!0),P(x,!1);return}try{P(m,await E(p.memoryId),!0)}catch{P(m,[],!0),P(S,!0)}finally{P(x,!1)}});const F=oe(()=>mt(e(m),e(C))),i=oe(()=>e(F).visible),N=oe(()=>e(F).hiddenCount);var z=Rt(),O=s(z);{var d=_=>{var w=_t();pe(w,20,()=>Array(5),Oe,(Q,Z)=>{var J=bt();l(Q,J)}),t(w),l(_,w)},I=_=>{var w=ht();l(_,w)},he=_=>{var w=kt();l(_,w)},ke=_=>{var w=yt();l(_,w)},ue=_=>{var w=Ot(),Q=Je(w);pe(Q,23,()=>e(i),(R,h)=>R.timestamp+h,(R,h,K)=>{const u=oe(()=>vt[e(h).action]),fe=oe(()=>xt(e(h).old_value,e(h).new_value));var ee=It(),te=s(ee),ye=s(te);{var we=a=>{var r=wt();k(()=>X(r,`background: ${e(u).color??""};`)),l(a,r)},c=a=>{var r=Mt();k(()=>X(r,`border-color: ${e(u).color??""}; background: transparent;`)),l(a,r)},M=a=>{var r=Pt();k(()=>V(r,"stroke",e(u).color)),l(a,r)},A=a=>{var r=St();k(()=>V(r,"stroke",e(u).color)),l(a,r)},n=a=>{var r=At();k(()=>V(r,"stroke",e(u).color)),l(a,r)},W=a=>{var r=Tt();k(()=>V(r,"stroke",e(u).color)),l(a,r)},j=a=>{var r=Dt();k(()=>V(r,"fill",e(u).color)),l(a,r)},ie=a=>{var r=Ct();k(()=>V(r,"stroke",e(u).color)),l(a,r)};q(ye,a=>{e(u).kind==="dot"?a(we):e(u).kind==="ring"?a(c,1):e(u).kind==="arrow-up"?a(M,2):e(u).kind==="arrow-down"?a(A,3):e(u).kind==="pencil"?a(n,4):e(u).kind==="x"?a(W,5):e(u).kind==="star"?a(j,6):e(u).kind==="circle-arrow"&&a(ie,7)})}t(te);var ae=v(te,2),U=s(ae),re=s(U),Y=s(re),Me=s(Y,!0);t(Y);var Pe=v(Y,2);{var ge=a=>{var r=Et(),b=s(r,!0);t(r),k(()=>D(b,e(h).triggered_by)),l(a,r)};q(Pe,a=>{e(h).triggered_by&&a(ge)})}t(re);var le=v(re,2),xe=s(le,!0);t(le),t(U);var se=v(U,2);{var Se=a=>{var r=Ft(),b=s(r);t(r),k(()=>D(b,`retention ${e(fe)??""}`)),l(a,r)};q(se,a=>{e(fe)&&a(Se)})}var me=v(se,2);{var Ae=a=>{var r=Nt(),b=s(r,!0);t(r),k(()=>D(b,e(h).reason)),l(a,r)};q(me,a=>{e(h).reason&&a(Ae)})}t(ae),t(ee),k((a,r)=>{X(ee,`animation-delay: ${e(K)*40}ms;`),X(te,`background: rgba(10,10,26,0.9); box-shadow: 0 0 10px ${e(u).color??""}88; border: 1px solid ${e(u).color??""};`),X(Y,`color: ${e(u).color??""};`),D(Me,e(u).label),V(le,"title",a),D(xe,r)},[()=>new Date(e(h).timestamp).toLocaleString(),()=>gt(e(h).timestamp)]),l(R,ee)}),t(Q);var Z=v(Q,2);{var J=R=>{var h=$t(),K=s(h,!0);t(h),k(()=>D(K,e(C)?"Hide older events":`Show ${e(N)} older event${e(N)===1?"":"s"}…`)),y("click",h,u=>{u.stopPropagation(),P(C,!e(C))}),l(R,h)};q(Z,R=>{e(N)>0&&R(J)})}l(_,w)};q(O,_=>{e(x)?_(d):e(S)?_(I,1):p.memoryId?e(m).length===0?_(ke,3):_(ue,!1):_(he,2)})}t(z),l(g,z),Ge()}Ke(["click"]);var Bt=f(' results'),Lt=f('
          '),zt=f('
          '),Ht=f('

          '),qt=f(' '),Qt=f('

          ',1),Wt=f('
          '),Yt=f('
          Content Audit Trail
          Promote Demote Suppress Delete
          '),Gt=f(''),Jt=f('
          '),Kt=f(`
          `);function pa(g,p){Ye(p,!0);let m=B($e([])),x=B(""),S=B(""),C="",E=B(0),F=B(!0),i=B(null),N=$e({}),z;We(()=>O());async function O(){P(F,!0);try{const c={};e(x)&&(c.q=e(x)),e(S)&&(c.node_type=e(S)),e(E)>0&&(c.min_retention=String(e(E)));const M=await H.memories.list(c);P(m,M.memories,!0)}catch{P(m,[],!0)}finally{P(F,!1)}}function d(){clearTimeout(z),z=setTimeout(O,300)}function I(c){return c>.7?"#10b981":c>.4?"#f59e0b":"#ef4444"}const he=[{value:"",label:"All types"},{value:"fact",label:"Fact",color:L.fact},{value:"concept",label:"Concept",color:L.concept},{value:"event",label:"Event",color:L.event},{value:"person",label:"Person",color:L.person},{value:"place",label:"Place",color:L.place},{value:"note",label:"Note",color:L.note},{value:"pattern",label:"Pattern",color:L.pattern},{value:"decision",label:"Decision",color:L.decision}],ke=[{value:"0",label:"Any retention"},{value:"0.3",label:"≥ 30% — fading & up"},{value:"0.5",label:"≥ 50% — half-strength"},{value:"0.7",label:"≥ 70% — well-retained"},{value:"0.9",label:"≥ 90% — core memories"}];let ue=B("0");function _(c){P(E,parseFloat(c),!0),O()}var w=Kt(),Q=s(w);lt(Q,{icon:"memories",title:"Memories",subtitle:"Search, filter, and curate everything Vestige remembers",accent:"memory",children:(c,M)=>{var A=Bt(),n=s(A);dt(n,{get value(){return e(m).length}}),st(),t(A),l(c,A)},$$slots:{default:!0}});var Z=v(Q,2),J=s(Z),R=s(J),h=s(R);Qe(h,{name:"search",size:16}),t(R);var K=v(R,2);ot(K),t(J);var u=v(J,2);qe(u,{get options(){return he},label:"Type",icon:"filter",placeholder:"All types",onChange:O,get value(){return e(S)},set value(c){P(S,c,!0)}});var fe=v(u,2);qe(fe,{get options(){return ke},label:"Retention",icon:"pulse",onChange:_,get value(){return e(ue)},set value(c){P(ue,c,!0)}}),t(Z);var ee=v(Z,2);{var te=c=>{var M=zt();pe(M,20,()=>Array(8),Oe,(A,n)=>{var W=Lt();l(A,W)}),t(M),l(c,M)},ye=c=>{var M=Ht(),A=s(M),n=s(A);Qe(n,{name:"memories",size:48,strokeWidth:1.2}),t(A);var W=v(A,2),j=s(W,!0);t(W),t(M),k(()=>D(j,e(x)||e(S)||e(E)>0?"No memories match these filters yet. Try widening your search.":"No memories yet — once Vestige starts remembering, they will surface here, alive and searchable.")),l(c,M)},we=c=>{var M=Jt();pe(M,23,()=>e(m),A=>A.id,(A,n,W)=>{var j=Gt(),ie=s(j),ae=s(ie),U=s(ae),re=s(U),Y=v(re,2),Me=s(Y,!0);t(Y);var Pe=v(Y,2);pe(Pe,17,()=>e(n).tags.slice(0,3),Oe,(b,T)=>{var $=qt(),de=s($,!0);t($),k(()=>D(de,e(T))),l(b,$)}),t(U);var ge=v(U,2),le=s(ge,!0);t(ge),t(ae);var xe=v(ae,2),se=s(xe),Se=s(se);t(se);var me=v(se,2),Ae=s(me);t(me),t(xe),t(ie);var a=v(ie,2);{var r=b=>{const T=oe(()=>N[e(n).id]??"content");var $=Yt(),de=s($),be=s(de),Te=v(be,2);t(de);var Re=v(de,2);{var Ue=o=>{var G=Qt(),ce=Je(G),ve=s(ce,!0);t(ce);var Le=v(ce,2),Fe=s(Le),Xe=s(Fe);t(Fe);var Ne=v(Fe,2),Ze=s(Ne);t(Ne);var ze=v(Ne,2),et=s(ze);t(ze),t(Le),k((tt,at,rt)=>{D(ve,e(n).content),D(Xe,`Storage: ${tt??""}%`),D(Ze,`Retrieval: ${at??""}%`),D(et,`Created: ${rt??""}`)},[()=>(e(n).storageStrength*100).toFixed(1),()=>(e(n).retrievalStrength*100).toFixed(1),()=>new Date(e(n).createdAt).toLocaleDateString()]),l(o,G)},Ve=o=>{var G=Wt(),ce=s(G);jt(ce,{get memoryId(){return e(n).id}}),t(G),y("click",G,ve=>ve.stopPropagation()),y("keydown",G,ve=>ve.stopPropagation()),l(o,G)};q(Re,o=>{e(T)==="content"?o(Ue):o(Ve,!1)})}var je=v(Re,2),De=s(je),Ce=v(De,2),Ee=v(Ce,2),Be=v(Ee,2);t(je),t($),k(()=>{Ie(be,1,`px-3 py-1.5 rounded-lg cursor-pointer select-none transition - ${e(T)==="content"?"bg-synapse/20 text-synapse-glow border border-synapse/40":"bg-white/[0.03] text-dim hover:text-text border border-transparent"}`),Ie(Te,1,`px-3 py-1.5 rounded-lg cursor-pointer select-none transition - ${e(T)==="audit"?"bg-synapse/20 text-synapse-glow border border-synapse/40":"bg-white/[0.03] text-dim hover:text-text border border-transparent"}`)}),y("click",be,o=>{o.stopPropagation(),N[e(n).id]="content"}),y("keydown",be,o=>{(o.key==="Enter"||o.key===" ")&&(o.stopPropagation(),N[e(n).id]="content")}),y("click",Te,o=>{o.stopPropagation(),N[e(n).id]="audit"}),y("keydown",Te,o=>{(o.key==="Enter"||o.key===" ")&&(o.stopPropagation(),N[e(n).id]="audit")}),y("click",De,o=>{o.stopPropagation(),H.memories.promote(e(n).id)}),y("keydown",De,o=>{o.key==="Enter"&&(o.stopPropagation(),H.memories.promote(e(n).id))}),y("click",Ce,o=>{o.stopPropagation(),H.memories.demote(e(n).id)}),y("keydown",Ce,o=>{o.key==="Enter"&&(o.stopPropagation(),H.memories.demote(e(n).id))}),y("click",Ee,async o=>{o.stopPropagation(),await H.memories.suppress(e(n).id,"dashboard trigger")}),y("keydown",Ee,async o=>{o.key==="Enter"&&(o.stopPropagation(),await H.memories.suppress(e(n).id,"dashboard trigger"))}),y("click",Be,async o=>{o.stopPropagation(),await H.memories.delete(e(n).id),O()}),y("keydown",Be,async o=>{o.key==="Enter"&&(o.stopPropagation(),await H.memories.delete(e(n).id),O())}),l(b,$)};q(a,b=>{var T;((T=e(i))==null?void 0:T.id)===e(n).id&&b(r)})}t(j),He(j,(b,T)=>{var $;return($=nt)==null?void 0:$(b,T)},()=>({delay:Math.min(e(W)*35,350),y:12})),He(j,b=>{var T;return(T=ct)==null?void 0:T(b)}),k((b,T)=>{var $;Ie(j,1,`spotlight-surface text-left p-4 glass-subtle rounded-xl hover:bg-white/[0.04] - transition-all duration-200 group - ${(($=e(i))==null?void 0:$.id)===e(n).id?"!border-synapse/40 glow-synapse live-border":""}`),X(re,`background: ${(L[e(n).nodeType]||"#8B95A5")??""}; box-shadow: 0 0 6px ${(L[e(n).nodeType]||"#8B95A5")??""}99`),D(Me,e(n).nodeType),D(le,e(n).content),X(Se,`width: ${e(n).retentionStrength*100}%; background: ${b??""}`),D(Ae,`${T??""}%`)},[()=>I(e(n).retentionStrength),()=>(e(n).retentionStrength*100).toFixed(0)]),y("click",j,()=>{var b;return P(i,((b=e(i))==null?void 0:b.id)===e(n).id?null:e(n),!0)}),l(A,j)}),t(M),l(c,M)};q(ee,c=>{e(F)?c(te):e(m).length===0?c(ye,1):c(we,!1)})}t(w),y("input",K,d),it(K,()=>e(x),c=>P(x,c)),l(g,w),Ge()}Ke(["input","click","keydown"]);export{pa as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/14.CDp0vmq1.js.br b/apps/dashboard/build/_app/immutable/nodes/14.CDp0vmq1.js.br deleted file mode 100644 index 459d062..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/14.CDp0vmq1.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/14.CDp0vmq1.js.gz b/apps/dashboard/build/_app/immutable/nodes/14.CDp0vmq1.js.gz deleted file mode 100644 index 291263d..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/14.CDp0vmq1.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/14.DUh3SXOF.js b/apps/dashboard/build/_app/immutable/nodes/14.DUh3SXOF.js new file mode 100644 index 0000000..119993e --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/14.DUh3SXOF.js @@ -0,0 +1,3 @@ +import"../chunks/Bzak7iHL.js";import{o as Ut}from"../chunks/GG5zm9kr.js";import{p as Et,d as r,e as a,r as e,t as N,g as t,u as L,a as Rt,s as rt,h as F,f as Ht,c as Vt}from"../chunks/CpWkWWOo.js";import{d as Lt,s as o,a as at,e as Mt}from"../chunks/BlVfL1ME.js";import{i as Y}from"../chunks/B4yTwGkE.js";import{e as V,i as Yt}from"../chunks/CGEBXrjl.js";import{a as _,c as Jt,f as y}from"../chunks/CHOnp4oo.js";import{s as ht}from"../chunks/A7po6GxK.js";import{s as bt}from"../chunks/aVbAZ-t7.js";import{s as wt}from"../chunks/Cx-f-Pzo.js";function Xt(h,x,A=3){const g={};for(const p of h){g[p]={};for(const u of h)g[p][u]={count:0,topNames:[]}}for(const p of x){const u=p.origin_project;if(g[u])for(const I of p.transferred_to)g[u][I]&&(g[u][I].count+=1,g[u][I].topNames.push(p.name))}const l=Math.max(0,A);for(const p of h)for(const u of h)g[p][u].topNames=g[p][u].topNames.slice(0,l);return g}function te(h,x){let A=0;for(const g of h){const l=x[g];if(l)for(const p of h){const u=l[p];u&&u.count>A&&(A=u.count)}}return A}function ee(h,x){var g;const A=[];for(const l of h)for(const p of h){const u=(g=x[l])==null?void 0:g[p];u&&u.count>0&&A.push({from:l,to:p,count:u.count,topNames:u.topNames})}return A.sort((l,p)=>p.count-l.count)}function re(h){return h?h.length>12?h.slice(0,11)+"…":h:""}var ae=y('
          '),se=y(''),ne=y(' '),oe=y('
          '),ie=y('
          Top patterns
          '),ce=y('
          No transfers recorded
          '),de=y('
          '),le=y('
          No cross-project transfers recorded yet.
          '),pe=y('
          '),ue=y(''),ve=y('
          ');function fe(h,x){Et(x,!0);const A=L(()=>Xt(x.projects,x.patterns)),g=L(()=>te(x.projects,t(A))||1);let l=rt(null);function p(n){if(n===0)return"background: rgba(255,255,255,0.02); border-color: rgba(99,102,241,0.05);";const s=n/t(g),v=.1+s*.7;if(s<.5)return`background: rgba(99, 102, 241, ${v.toFixed(3)}); border-color: rgba(129, 140, 248, ${(v*.6).toFixed(3)}); box-shadow: 0 0 ${(s*14).toFixed(1)}px rgba(129, 140, 248, ${(s*.45).toFixed(3)});`;{const f=(s-.5)*2,d=Math.round(99+69*f),C=Math.round(102+-17*f),b=Math.round(241+6*f);return`background: rgba(${d}, ${C}, ${b}, ${v.toFixed(3)}); border-color: rgba(192, 132, 252, ${(v*.7).toFixed(3)}); box-shadow: 0 0 ${(6+s*18).toFixed(1)}px rgba(192, 132, 252, ${(s*.55).toFixed(3)});`}}function u(n){if(n===0)return"text-muted";const s=n/t(g);return s>=.5?"text-bright font-semibold":s>=.2?"text-text":"text-dim"}function I(n,s,v){const d=n.currentTarget.getBoundingClientRect();F(l,{from:s,to:v,x:d.left+d.width/2,y:d.top},!0)}function j(){F(l,null)}const B=re;function st(n,s){return x.selectedCell!==null&&x.selectedCell.from===n&&x.selectedCell.to===s}const G=L(()=>ee(x.projects,t(A)));var Q=ve(),J=r(Q),X=r(J),nt=a(r(X),2),ot=a(r(nt),4),jt=r(ot,!0);e(ot),e(nt),e(X);var it=a(X,2),gt=r(it),q=r(gt),tt=r(q),ct=a(r(tt));V(ct,16,()=>x.projects,n=>n,(n,s)=>{var v=ae(),f=r(v),d=r(f),C=r(d,!0);e(d),e(f),e(v),N(b=>{ht(v,"title",s),o(C,b)},[()=>B(s)]),_(n,v)}),e(tt),e(q);var xt=a(q);V(xt,20,()=>x.projects,n=>n,(n,s)=>{var v=ne(),f=r(v),d=r(f,!0);e(f);var C=a(f);V(C,16,()=>x.projects,b=>b,(b,$)=>{const P=L(()=>t(A)[s][$]),W=L(()=>s===$);var M=se(),S=r(M),E=r(S),U=r(E,!0);e(E),e(S),e(M),N((R,Z,k)=>{wt(S,`${R??""} ${Z??""} ${t(W)&&t(P).count>0?"border-style: dashed;":""}`),ht(S,"aria-label",`${t(P).count??""} patterns from ${s??""} to ${$??""}`),bt(E,1,`text-[11px] ${k??""}`),o(U,t(P).count||"")},[()=>p(t(P).count),()=>st(s,$)?"outline: 2px solid var(--color-dream-glow); outline-offset: 1px;":"",()=>u(t(P).count)]),at("click",S,()=>x.onCellClick(s,$)),Mt("mouseenter",S,R=>I(R,s,$)),Mt("mouseleave",S,j),_(b,M)}),e(v),N(b=>{ht(f,"title",s),o(d,b)},[()=>B(s)]),_(n,v)}),e(xt),e(gt),e(it);var kt=a(it,2);{var Tt=n=>{const s=L(()=>t(A)[t(l).from][t(l).to]);var v=de(),f=r(v),d=r(f),C=r(d,!0);e(d);var b=a(d,4),$=r(b,!0);e(b),e(f);var P=a(f,2),W=r(P),M=a(W),S=r(M);e(M),e(P);var E=a(P,2);{var U=Z=>{var k=ie(),O=a(r(k),2);V(O,17,()=>t(s).topNames,Yt,(K,lt)=>{var pt=oe(),_t=r(pt);e(pt),N(()=>o(_t,`· ${t(lt)??""}`)),_(K,pt)}),e(k),_(Z,k)},R=Z=>{var k=ce();_(Z,k)};Y(E,Z=>{t(s).topNames.length>0?Z(U):Z(R,!1)})}e(v),N((Z,k)=>{wt(v,`left: ${t(l).x??""}px; top: ${t(l).y-12}px; transform: translate(-50%, -100%);`),o(C,Z),o($,k),o(W,`${t(s).count??""} `),o(S,`${t(s).count===1?"pattern":"patterns"} transferred`)},[()=>B(t(l).from),()=>B(t(l).to)]),_(n,v)};Y(kt,n=>{t(l)&&n(Tt)})}e(J);var mt=a(J,2),dt=r(mt),i=r(dt);e(dt);var c=a(dt,2);{var m=n=>{var s=le();_(n,s)},T=n=>{var s=Jt(),v=Ht(s);V(v,17,()=>t(G),f=>f.from+"->"+f.to,(f,d)=>{var C=ue(),b=r(C),$=r(b),P=r($),W=r(P,!0);e(P);var M=a(P,4),S=r(M,!0);e(M),e($);var E=a($,2);{var U=k=>{var O=pe(),K=r(O,!0);e(O),N(lt=>o(K,lt),[()=>t(d).topNames.join(" · ")]),_(k,O)};Y(E,k=>{t(d).topNames.length>0&&k(U)})}e(b);var R=a(b,2),Z=r(R,!0);e(R),e(C),N((k,O,K)=>{bt(C,1,`flex w-full items-center justify-between rounded-lg border border-synapse/10 bg-white/[0.02] p-3 transition hover:border-synapse/30 hover:bg-white/[0.04] ${k??""}`),o(W,O),o(S,K),o(Z,t(d).count)},[()=>st(t(d).from,t(d).to)?"ring-1 ring-dream-glow":"",()=>B(t(d).from),()=>B(t(d).to)]),at("click",C,()=>x.onCellClick(t(d).from,t(d).to)),_(f,C)}),_(n,s)};Y(c,n=>{t(G).length===0?n(m):n(T,!1)})}e(mt),e(Q),N(()=>{o(jt,t(g)),o(i,`${t(G).length??""} transfer pair${t(G).length===1?"":"s"} · tap to filter`)}),_(h,Q),Rt()}Lt(["click"]);var ge=y(''),xe=y(`
          Couldn't load pattern transfers
          `),me=y('
          '),_e=y('
          Filtered to
          '),ye=y('
          No matching patterns
          '),he=y('
        1. '),be=y('
            '),we=y('
            ',1),je=y('

            Cross-Project Intelligence

            Patterns learned here, applied there.

            ');function Me(h,x){Et(x,!0);const A=["ErrorHandling","AsyncConcurrency","Testing","Architecture","Performance","Security"],g={ErrorHandling:"var(--color-decay)",AsyncConcurrency:"var(--color-synapse-glow)",Testing:"var(--color-recall)",Architecture:"var(--color-dream-glow)",Performance:"var(--color-warning)",Security:"var(--color-node-pattern)"};let l=rt("All"),p=rt(Vt({projects:[],patterns:[]})),u=rt(!0),I=rt(null),j=rt(null);async function B(){return await new Promise(m=>setTimeout(m,420)),{projects:["vestige","api-gateway","desktop-app","model-runner","game-sim","security-dashboard","benchmark-suite"],patterns:[{name:"Result with thiserror context",category:"ErrorHandling",origin_project:"vestige",transferred_to:["api-gateway","desktop-app","model-runner","security-dashboard"],transfer_count:4,last_used:"2026-04-18T14:22:00Z",confidence:.94},{name:"Axum error middleware with tower-http",category:"ErrorHandling",origin_project:"api-gateway",transferred_to:["vestige","security-dashboard"],transfer_count:2,last_used:"2026-04-17T09:10:00Z",confidence:.88},{name:"Graceful shutdown on SIGINT/SIGTERM",category:"ErrorHandling",origin_project:"vestige",transferred_to:["vestige","desktop-app","security-dashboard"],transfer_count:3,last_used:"2026-04-15T22:01:00Z",confidence:.82},{name:"Python try/except with contextual re-raise",category:"ErrorHandling",origin_project:"benchmark-suite",transferred_to:["model-runner"],transfer_count:1,last_used:"2026-04-10T11:30:00Z",confidence:.7},{name:"Arc> reader/writer split",category:"AsyncConcurrency",origin_project:"vestige",transferred_to:["api-gateway","desktop-app"],transfer_count:2,last_used:"2026-04-14T16:42:00Z",confidence:.91},{name:"tokio::select! for cancellation propagation",category:"AsyncConcurrency",origin_project:"desktop-app",transferred_to:["vestige","security-dashboard"],transfer_count:2,last_used:"2026-04-19T08:05:00Z",confidence:.86},{name:"Bounded mpsc channel with backpressure",category:"AsyncConcurrency",origin_project:"desktop-app",transferred_to:["vestige","api-gateway"],transfer_count:2,last_used:"2026-04-12T13:18:00Z",confidence:.83},{name:"asyncio.gather with return_exceptions",category:"AsyncConcurrency",origin_project:"model-runner",transferred_to:["benchmark-suite"],transfer_count:1,last_used:"2026-04-08T20:45:00Z",confidence:.72},{name:"Property-based tests with proptest",category:"Testing",origin_project:"vestige",transferred_to:["api-gateway","desktop-app"],transfer_count:2,last_used:"2026-04-11T10:22:00Z",confidence:.89},{name:"Snapshot testing with insta",category:"Testing",origin_project:"api-gateway",transferred_to:["vestige"],transfer_count:1,last_used:"2026-04-16T14:00:00Z",confidence:.81},{name:"Vitest + Playwright dashboard harness",category:"Testing",origin_project:"vestige",transferred_to:["api-gateway","desktop-app"],transfer_count:2,last_used:"2026-04-19T18:30:00Z",confidence:.87},{name:"One-variable-at-a-time Kaggle submission",category:"Testing",origin_project:"benchmark-suite",transferred_to:["model-runner","game-sim"],transfer_count:2,last_used:"2026-04-20T07:15:00Z",confidence:.95},{name:"Kaggle pre-flight Input-panel screenshot",category:"Testing",origin_project:"benchmark-suite",transferred_to:["model-runner","game-sim"],transfer_count:2,last_used:"2026-04-20T06:50:00Z",confidence:.98},{name:"SvelteKit 2 + Svelte 5 runes dashboard",category:"Architecture",origin_project:"vestige",transferred_to:["api-gateway","security-dashboard"],transfer_count:2,last_used:"2026-04-19T12:10:00Z",confidence:.92},{name:"glass-panel + cosmic-dark design system",category:"Architecture",origin_project:"vestige",transferred_to:["api-gateway","security-dashboard","desktop-app"],transfer_count:3,last_used:"2026-04-20T09:00:00Z",confidence:.9},{name:"Tauri 2 + Rust/Axum sidecar",category:"Architecture",origin_project:"desktop-app",transferred_to:["security-dashboard"],transfer_count:1,last_used:"2026-04-13T19:44:00Z",confidence:.78},{name:"MCP server with 23 stateful tools",category:"Architecture",origin_project:"vestige",transferred_to:["desktop-app"],transfer_count:1,last_used:"2026-04-17T11:05:00Z",confidence:.85},{name:"USearch HNSW index for vector search",category:"Performance",origin_project:"vestige",transferred_to:["api-gateway"],transfer_count:1,last_used:"2026-04-09T15:20:00Z",confidence:.88},{name:"SQLite WAL mode for concurrent reads",category:"Performance",origin_project:"vestige",transferred_to:["api-gateway","desktop-app","security-dashboard"],transfer_count:3,last_used:"2026-04-18T21:33:00Z",confidence:.93},{name:"vLLM prefix caching at 0.35 mem util",category:"Performance",origin_project:"benchmark-suite",transferred_to:["model-runner"],transfer_count:1,last_used:"2026-04-11T08:00:00Z",confidence:.84},{name:"Cross-encoder rerank at k=30",category:"Performance",origin_project:"vestige",transferred_to:["api-gateway"],transfer_count:1,last_used:"2026-04-14T17:55:00Z",confidence:.79},{name:"Rotated auth token in env var",category:"Security",origin_project:"vestige",transferred_to:["api-gateway","desktop-app","security-dashboard"],transfer_count:3,last_used:"2026-04-16T20:12:00Z",confidence:.96},{name:"Parameterized SQL via rusqlite params!",category:"Security",origin_project:"vestige",transferred_to:["api-gateway"],transfer_count:1,last_used:"2026-04-10T13:40:00Z",confidence:.89},{name:"664-pattern secret scanner",category:"Security",origin_project:"api-gateway",transferred_to:["vestige","security-dashboard","desktop-app"],transfer_count:3,last_used:"2026-04-20T05:30:00Z",confidence:.97},{name:"CSP header with nonce-based script allow",category:"Security",origin_project:"api-gateway",transferred_to:["security-dashboard"],transfer_count:1,last_used:"2026-04-05T16:08:00Z",confidence:.8}]}}async function st(){F(u,!0),F(I,null);try{F(p,await B(),!0)}catch(i){F(I,i instanceof Error?i.message:"Failed to load pattern transfers",!0),F(p,{projects:[],patterns:[]},!0)}finally{F(u,!1)}}Ut(()=>st());const G=L(()=>t(l)==="All"?t(p).patterns:t(p).patterns.filter(i=>i.category===t(l))),Q=L(()=>[...t(j)?t(G).filter(c=>c.origin_project===t(j).from&&c.transferred_to.includes(t(j).to)):t(G)].sort((c,m)=>m.transfer_count-c.transfer_count)),J=L(()=>t(G).reduce((i,c)=>i+c.transferred_to.length,0)),X=L(()=>t(p).projects.length),nt=L(()=>t(G).length);function ot(i){F(l,i,!0),F(j,null)}function jt(i,c){t(j)&&t(j).from===i&&t(j).to===c?F(j,null):F(j,{from:i,to:c},!0)}function it(){F(j,null)}function gt(i){const c=new Date(i).getTime(),m=Date.now(),T=Math.floor((m-c)/864e5);return T<=0?"today":T===1?"1d ago":T<30?`${T}d ago`:`${Math.floor(T/30)}mo ago`}var q=je(),tt=a(r(q),2),ct=r(tt),xt=a(ct,2);V(xt,16,()=>A,i=>i,(i,c)=>{var m=ge(),T=r(m),n=a(T);e(m),N(()=>{bt(m,1,`flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium transition ${t(l)===c?"bg-synapse/25 text-synapse-glow":"text-dim hover:bg-white/[0.04] hover:text-text"}`),wt(T,`background: ${g[c]??""}`),o(n,` ${c??""}`)}),at("click",m,()=>ot(c)),_(i,m)}),e(tt);var kt=a(tt,2);{var Tt=i=>{var c=xe(),m=a(r(c),2),T=r(m,!0);e(m);var n=a(m,2);e(c),N(()=>o(T,t(I))),at("click",n,st),_(i,c)},mt=i=>{var c=me();_(i,c)},dt=i=>{var c=we(),m=Ht(c),T=r(m),n=r(T);fe(n,{get projects(){return t(p).projects},get patterns(){return t(G)},get selectedCell(){return t(j)},onCellClick:jt});var s=a(n,2);{var v=D=>{var H=_e(),z=r(H),w=a(r(z),2),ut=r(w,!0);e(w);var vt=a(w,4),ft=r(vt,!0);e(vt),e(z);var et=a(z,2);e(H),N(()=>{o(ut,t(j).from),o(ft,t(j).to)}),at("click",et,it),_(D,H)};Y(s,D=>{t(j)&&D(v)})}e(T);var f=a(T,2),d=r(f),C=a(r(d),2),b=r(C);e(C),e(d);var $=a(d,2);{var P=D=>{var H=ye(),z=a(r(H),2),w=r(z,!0);e(z),e(H),N(()=>o(w,t(j)?"No patterns transferred from this origin to this destination.":"No patterns in this category.")),_(D,H)},W=D=>{var H=be();V(H,21,()=>t(Q),z=>z.name,(z,w)=>{var ut=he(),vt=r(ut),ft=r(vt),et=r(ft),Gt=r(et,!0);e(et);var Ct=a(et,2),yt=r(Ct),Ot=r(yt,!0);e(yt);var Pt=a(yt,2),Dt=r(Pt,!0);e(Pt),e(Ct);var St=a(Ct,2),Zt=r(St),zt=r(Zt,!0);e(Zt);var Nt=a(Zt,4),Kt=r(Nt);e(Nt),e(St),e(ft);var $t=a(ft,2),At=r($t),Bt=r(At,!0);e(At);var Ft=a(At,2),Qt=r(Ft);e(Ft),e($t),e(vt),e(ut),N((Wt,qt)=>{ht(et,"title",t(w).name),o(Gt,t(w).name),wt(yt,`border-color: ${g[t(w).category]??""}66; color: ${g[t(w).category]??""}; background: ${g[t(w).category]??""}1a;`),o(Ot,t(w).category),o(Dt,Wt),o(zt,t(w).origin_project),o(Kt,`${t(w).transferred_to.length??""} + ${t(w).transferred_to.length===1?"project":"projects"}`),o(Bt,t(w).transfer_count),o(Qt,`${qt??""}%`)},[()=>gt(t(w).last_used),()=>(t(w).confidence*100).toFixed(0)]),_(z,ut)}),e(H),_(D,H)};Y($,D=>{t(Q).length===0?D(P):D(W,!1)})}e(f),e(m);var M=a(m,2),S=r(M),E=r(S),U=r(E,!0);e(E);var R=a(E),Z=a(R),k=r(Z,!0);e(Z);var O=a(Z),K=a(O),lt=r(K,!0);e(K);var pt=a(K);e(S);var _t=a(S,2),It=r(_t,!0);e(_t),e(M),N(()=>{o(b,`${t(Q).length??""} + ${t(Q).length===1?"pattern":"patterns"}`),o(U,t(nt)),o(R,` pattern${t(nt)===1?"":"s"} across `),o(k,t(X)),o(O,` project${t(X)===1?"":"s"}, `),o(lt,t(J)),o(pt,` total transfer${t(J)===1?"":"s"}`),o(It,t(l)==="All"?"All categories":t(l))}),_(i,c)};Y(kt,i=>{t(I)?i(Tt):t(u)?i(mt,1):i(dt,!1)})}e(q),N(()=>bt(ct,1,`rounded-lg px-3 py-1.5 text-xs font-medium transition ${t(l)==="All"?"bg-synapse/25 text-synapse-glow":"text-dim hover:bg-white/[0.04] hover:text-text"}`)),at("click",ct,()=>ot("All")),_(h,q),Rt()}Lt(["click"]);export{Me as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/14.DUh3SXOF.js.br b/apps/dashboard/build/_app/immutable/nodes/14.DUh3SXOF.js.br new file mode 100644 index 0000000..dc9fa11 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/14.DUh3SXOF.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/14.DUh3SXOF.js.gz b/apps/dashboard/build/_app/immutable/nodes/14.DUh3SXOF.js.gz new file mode 100644 index 0000000..e903ed0 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/14.DUh3SXOF.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/15.C05K0kWE.js b/apps/dashboard/build/_app/immutable/nodes/15.C05K0kWE.js deleted file mode 100644 index da9ffef..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/15.C05K0kWE.js +++ /dev/null @@ -1,3 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{o as Qe}from"../chunks/TZu9D97Z.js";import{p as Be,s as M,d as Je,o as Ke,t as m,a as c,b as Ue,i as w,g as e,j as u,e as i,h as v,n as Xe,r as a,m as we,u as ye}from"../chunks/wpu9U-D0.js";import{d as Ye,a as j,s as b}from"../chunks/D8mhvFt8.js";import{i as k}from"../chunks/DKve45Wd.js";import{e as C,s as P,a as Ze}from"../chunks/60_R_Vbt.js";import{a as G,r as H}from"../chunks/P1-U_Xsj.js";import{s as et,a as tt}from"../chunks/ByYB047u.js";import{P as st}from"../chunks/BHDZZvku.js";import{I as at}from"../chunks/D7A-gG4Z.js";import{A as rt}from"../chunks/DcKTNC6e.js";import{t as ie}from"../chunks/CqMQEF-F.js";import{a as U}from"../chunks/CZfHMhLI.js";import{m as it}from"../chunks/BhIgFntf.js";var lt=u(" pending"),ot=u(''),nt=u(""),dt=u('

            Loading…

            '),vt=u('

            '),ct=u('
            '),ut=u('
          • '),pt=u('
              '),_t=u('
              Select a Memory PR to review the diff.
              '),bt=u(' '),ft=u(' '),mt=u(' '),gt=u('
              + 
              '),wt=u('
              '),yt=u('
              Why this opened
              '),zt=u('
              '),ht=u(`
              Agent's reasoning
              `),xt=u(""),kt=u('
              '),Pt=u(' '),$t=u('
              Decided:
              '),Mt=u('

              '),Rt=u(`
              Vestige auto-remembers ordinary context, but opens a Memory PR when the agent tries to rewrite its own brain. Risky writes are quarantine-reviewed: recorded for audit, but held - out of retrieval until you decide — influence suspended, history preserved.
              `);function Gt(ze,he){Be(he,!0);const xe=()=>et(it,"$memoryPrEvents",ke),[ke,Pe]=tt();let O=M(Je([])),X=M(0),Y=M("risk_gated"),R=M("pending"),n=M(null),E=M(null),Z=M(!1),ee=M(null);const le=[{id:"fast",label:"Fast",blurb:"Every write auto-lands. No review."},{id:"risk_gated",label:"Risk-Gated",blurb:"Ordinary writes land; risky ones open a PR."},{id:"paranoid",label:"Paranoid",blurb:"Every write waits for approval."}],$e=["pending","promoted","merged","superseded","quarantined","forgotten"],oe={new_fact:"New fact",strengthened_fact:"Strengthened",contradiction_detected:"Contradiction",memory_superseded:"Supersede",edge_added:"New edge",node_decayed:"Decayed",dream_consolidation:"Dream merge"},Me=[{id:"promote",label:"Promote",cls:"promote"},{id:"merge",label:"Merge",cls:"merge"},{id:"supersede",label:"Supersede",cls:"supersede"},{id:"quarantine",label:"Quarantine",cls:"quarantine"},{id:"forget",label:"Forget",cls:"forget"},{id:"ask_agent_why",label:"Ask Agent Why",cls:"why"}];async function T(){w(Z,!0);try{const s=await U.memoryPrs.list(e(R)||void 0,100);w(O,s.prs,!0),w(X,s.pendingCount,!0),w(Y,s.mode,!0),e(n)&&w(n,e(O).find(t=>t.id===e(n).id)??null,!0)}finally{w(Z,!1)}}async function Re(s){var r;const t=await U.memoryPrs.setMode(s);w(Y,t.mode,!0),ie.push({type:"MemoryPromoted",title:"Review mode updated",body:`Memory PR gating is now ${(r=le.find(d=>d.id===s))==null?void 0:r.label}.`,color:"#6366f1",dwellMs:4e3})}async function Ae(s,t){w(ee,`${s.id}:${t}`);try{if(t==="ask_agent_why"){const r=await U.memoryPrs.act(s.id,t);w(E,r.why,!0),w(n,s,!0);return}await U.memoryPrs.act(s.id,t),ie.push({type:"MemoryPromoted",title:`PR ${t}d`,body:s.title,color:Ne(t),dwellMs:4500}),w(E,null),await T()}catch(r){ie.push({type:"MemoryDemoted",title:"Action failed",body:String(r),color:"#f43f5e",dwellMs:5e3})}finally{w(ee,null)}}function Ne(s){switch(s){case"promote":return"#10b981";case"merge":return"#6366f1";case"supersede":return"#38bdf8";case"quarantine":return"#f59e0b";case"forget":return"#f43f5e";default:return"#818cf8"}}function Se(s){w(n,s,!0),w(E,null)}Ke(()=>{xe().length&&T()}),Qe(T);function ne(s){var r;const t=(r=s.diff)==null?void 0:r.node;return(t==null?void 0:t.content)??""}function de(s){var r;const t=(r=s.diff)==null?void 0:r.node;return(t==null?void 0:t.nodeType)??""}function qe(s){var r;const t=(r=s.diff)==null?void 0:r.node;return(t==null?void 0:t.tags)??[]}var te=Rt(),ve=i(te);st(ve,{icon:"memorypr",title:"Memory PRs",subtitle:"Approve changes to the agent's brain like code.",accent:"synapse",children:(s,t)=>{var r=lt();let d;var y=i(r);rt(y,{get value(){return e(X)}}),Xe(),a(r),m(()=>d=P(r,1,"pending-badge svelte-c1wbiz",null,d,{has:e(X)>0})),c(s,r)},$$slots:{default:!0}});var ce=v(ve,2);G(ce,s=>{var t;return(t=H)==null?void 0:t(s)});var Q=v(ce,2);C(Q,21,()=>le,s=>s.id,(s,t)=>{var r=ot();let d;var y=i(r),f=i(y,!0);a(y);var z=v(y,2),A=i(z,!0);a(z),a(r),m(()=>{d=P(r,1,"mode svelte-c1wbiz",null,d,{on:e(Y)===e(t).id}),b(f,e(t).label),b(A,e(t).blurb)}),j("click",r,()=>Re(e(t).id)),c(s,r)}),a(Q),G(Q,s=>{var t;return(t=H)==null?void 0:t(s)});var B=v(Q,2),ue=i(B);C(ue,16,()=>$e,s=>s,(s,t)=>{var r=nt();let d;var y=i(r,!0);a(r),m(()=>{d=P(r,1,"filter svelte-c1wbiz",null,d,{on:e(R)===t}),b(y,t)}),j("click",r,()=>{w(R,t,!0),T()}),c(s,r)});var pe=v(ue,2);let _e;a(B),G(B,s=>{var t;return(t=H)==null?void 0:t(s)});var be=v(B,2),J=i(be),Ce=i(J);{var De=s=>{var t=dt();c(s,t)},Ee=s=>{var t=vt(),r=i(t);{var d=f=>{var z=we(`No pending Memory PRs. The brain is up to date — ordinary writes - are landing automatically.`);c(f,z)},y=f=>{var z=we();m(()=>b(z,`No ${(e(R)||"")??""} PRs.`)),c(f,z)};k(r,f=>{e(R)==="pending"?f(d):f(y,!1)})}a(t),c(s,t)},Te=s=>{var t=pt();C(t,21,()=>e(O),r=>r.id,(r,d)=>{var y=ut(),f=i(y);let z;var A=i(f),D=i(A),F=i(D,!0);a(D);var L=v(D,2),I=i(L,!0);a(L),a(A);var N=v(A,2),K=i(N,!0);a(N);var se=v(N,2);{var ae=$=>{var V=ct(),re=i(V);a(V),m(()=>b(re,`⚠ ${e(d).signals.length??""} risk signal${e(d).signals.length>1?"s":""}`)),c($,V)};k(se,$=>{e(d).signals.length&&$(ae)})}a(f),a(y),m(()=>{var $;z=P(f,1,"pr-row svelte-c1wbiz",null,z,{active:(($=e(n))==null?void 0:$.id)===e(d).id}),P(D,1,`pr-kind kind-${e(d).kind??""}`,"svelte-c1wbiz"),b(F,oe[e(d).kind]??e(d).kind),P(L,1,`pr-status st-${e(d).status??""}`,"svelte-c1wbiz"),b(I,e(d).status),b(K,e(d).title)}),j("click",f,()=>Se(e(d))),c(r,y)}),a(t),c(s,t)};k(Ce,s=>{e(Z)?s(De):e(O).length===0?s(Ee,1):s(Te,!1)})}a(J),G(J,s=>{var t;return(t=H)==null?void 0:t(s)});var fe=v(J,2),Fe=i(fe);{var Le=s=>{var t=_t();c(s,t)},Ie=s=>{var t=Mt(),r=i(t),d=i(r),y=i(d,!0);a(d);var f=v(d,2),z=i(f,!0);a(f);var A=v(f,2);{var D=o=>{var l=bt();Ze(l,"href","/blackbox");var p=i(l);at(p,{name:"blackbox",size:13});var _=v(p);a(l),m(g=>b(_,` ${g??""}`),[()=>e(n).run_id.replace("run_","").slice(0,8)]),c(o,l)};k(A,o=>{e(n).run_id&&o(D)})}a(r);var F=v(r,2),L=i(F,!0);a(F);var I=v(F,2),N=i(I),K=i(N);{var se=o=>{var l=ft(),p=i(l);a(l),m(_=>b(p,`type: ${_??""}`),[()=>de(e(n))]),c(o,l)},ae=ye(()=>de(e(n)));k(K,o=>{e(ae)&&o(se)})}var $=v(K,2);C($,16,()=>qe(e(n)),o=>o,(o,l)=>{var p=mt(),_=i(p);a(p),m(()=>b(_,`#${l??""}`)),c(o,p)}),a(N);var V=v(N,2);{var re=o=>{var l=gt(),p=v(i(l),1,!0);a(l),m(_=>b(p,_),[()=>ne(e(n))]),c(o,l)},Ve=ye(()=>ne(e(n)));k(V,o=>{e(Ve)&&o(re)})}a(I);var me=v(I,2);{var We=o=>{var l=yt(),p=v(i(l),2);C(p,17,()=>e(n).signals,_=>_.code,(_,g)=>{var h=wt(),x=i(h),S=i(x,!0);a(x);var q=v(x,2),W=i(q,!0);a(q),a(h),m(()=>{b(S,e(g).code),b(W,e(g).detail)}),c(_,h)}),a(l),c(o,l)};k(me,o=>{e(n).signals.length&&o(We)})}var ge=v(me,2);{var je=o=>{var l=ht(),p=v(i(l),2);C(p,17,()=>e(E),_=>_.code,(_,g)=>{var h=zt(),x=i(h),S=i(x,!0);a(x);var q=v(x,2),W=i(q,!0);a(q),a(h),m(()=>{b(S,e(g).code),b(W,e(g).detail)}),c(_,h)}),a(l),c(o,l)};k(ge,o=>{e(E)&&o(je)})}var Ge=v(ge,2);{var He=o=>{var l=kt();C(l,21,()=>Me,p=>p.id,(p,_)=>{var g=xt(),h=i(g,!0);a(g),m(()=>{P(g,1,`action ${e(_).cls??""}`,"svelte-c1wbiz"),g.disabled=e(ee)===`${e(n).id}:${e(_).id}`,b(h,e(_).label)}),j("click",g,()=>Ae(e(n),e(_).id)),c(p,g)}),a(l),c(o,l)},Oe=o=>{var l=$t(),p=v(i(l)),_=i(p,!0);a(p);var g=v(p,2);{var h=x=>{var S=Pt(),q=i(S);a(S),m(W=>b(q,`· ${W??""}`),[()=>new Date(e(n).decided_at).toLocaleString()]),c(x,S)};k(g,x=>{e(n).decided_at&&x(h)})}a(l),m(()=>b(_,e(n).decision??e(n).status)),c(o,l)};k(Ge,o=>{e(n).status==="pending"?o(He):o(Oe,!1)})}a(t),G(t,o=>{var l;return(l=H)==null?void 0:l(o)}),m(()=>{P(d,1,`pr-kind kind-${e(n).kind??""}`,"svelte-c1wbiz"),b(y,oe[e(n).kind]??e(n).kind),P(f,1,`pr-status st-${e(n).status??""}`,"svelte-c1wbiz"),b(z,e(n).status),b(L,e(n).title)}),c(s,t)};k(Fe,s=>{e(n)?s(Ie,!1):s(Le)})}a(fe),a(be),a(te),m(()=>_e=P(pe,1,"filter svelte-c1wbiz",null,_e,{on:e(R)===""})),j("click",pe,()=>{w(R,""),T()}),c(ze,te),Ue(),Pe()}Ye(["click"]);export{Gt as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/15.C05K0kWE.js.br b/apps/dashboard/build/_app/immutable/nodes/15.C05K0kWE.js.br deleted file mode 100644 index 58aed9f..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/15.C05K0kWE.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/15.C05K0kWE.js.gz b/apps/dashboard/build/_app/immutable/nodes/15.C05K0kWE.js.gz deleted file mode 100644 index a9ad2e6..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/15.C05K0kWE.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/15.C7Fk4d1G.js b/apps/dashboard/build/_app/immutable/nodes/15.C7Fk4d1G.js new file mode 100644 index 0000000..842d44e --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/15.C7Fk4d1G.js @@ -0,0 +1,5 @@ +import"../chunks/Bzak7iHL.js";import{o as Nt}from"../chunks/GG5zm9kr.js";import{p as We,d as s,g as e,e as a,r as t,n as Fe,t as w,a as Ke,u as Z,s as ce,c as Tt,W as Ft,h as D,aG as jt,f as rt}from"../chunks/CpWkWWOo.js";import{s as v,d as Lt,a as Ge}from"../chunks/BlVfL1ME.js";import{i as O}from"../chunks/B4yTwGkE.js";import{e as re,i as ye}from"../chunks/CGEBXrjl.js";import{a as f,f as _,b as ct}from"../chunks/CHOnp4oo.js";import{h as Dt}from"../chunks/C4h_mRt2.js";import{s as K,r as Ot}from"../chunks/A7po6GxK.js";import{s as b}from"../chunks/Cx-f-Pzo.js";import{b as It}from"../chunks/sZcqyNBA.js";import{b as it}from"../chunks/CJsMJEun.js";import{a as zt}from"../chunks/DNjM5a-l.js";import{s as ut}from"../chunks/aVbAZ-t7.js";import{p as ie}from"../chunks/V6gjw5Ec.js";import{N as Mt}from"../chunks/DzfRjky4.js";var $t=_('
              '),Bt=_('

              '),Gt=_("
              ");function lt(l,o){We(o,!0);let V=ie(o,"intent",3,"Synthesis"),$=ie(o,"memoriesAnalyzed",3,0),R=ie(o,"evidenceCount",3,0),i=ie(o,"contradictionCount",3,0),B=ie(o,"supersededCount",3,0),E=ie(o,"running",3,!1),G=ie(o,"stageHints",19,()=>({}));const I=[{key:"broad",icon:"◎",label:"Broad Retrieval",base:"Hybrid BM25 + semantic (3x overfetch) then cross-encoder rerank"},{key:"spreading",icon:"⟿",label:"Spreading Activation",base:"Collins & Loftus — expand via graph edges to surface what search missed"},{key:"fsrs",icon:"▲",label:"FSRS Trust Scoring",base:"retention × stability × reps ÷ lapses — which memories have earned trust"},{key:"intent",icon:"◆",label:"Intent Classification",base:"FactCheck / Timeline / RootCause / Comparison / Synthesis"},{key:"supersession",icon:"↗",label:"Temporal Supersession",base:"Newer high-trust memories replace older ones on the same fact"},{key:"contradiction",icon:"⚡",label:"Contradiction Analysis",base:"Only flag conflicts between memories where BOTH have trust > 0.3"},{key:"relation",icon:"⬡",label:"Relation Assessment",base:"Per pair: Supports / Contradicts / Supersedes / Irrelevant"},{key:"template",icon:"❖",label:"Template Reasoning",base:"Build the natural-language reasoning chain you validate"}],Y=Z(()=>({broad:$()?`Analyzed ${$()} memories · ${R()} survived ranking`:void 0,intent:V()?`Classified as ${V()}`:void 0,supersession:B()?`${B()} outdated memor${B()===1?"y":"ies"} superseded`:void 0,contradiction:i()?`${i()} real conflict${i()===1?"":"s"} between trusted memories`:"No conflicts between trusted memories"}));function Q(z,M){return G()[z]??e(Y)[z]??M}var P=Gt();let ue;re(P,23,()=>I,z=>z.key,(z,M,H)=>{var A=Bt(),U=s(A);{var le=n=>{var p=$t();w(()=>b(p,`animation-delay: ${e(H)*140+120}ms;`)),f(n,p)};O(U,n=>{e(H){b(A,`animation-delay: ${e(H)*140}ms;`),b(J,`animation-delay: ${e(H)*140}ms;`),v(te,e(M).icon),v(pe,`0${e(H)+1}`),v(me,e(M).label),v(r,n)},[()=>Q(e(M).key,e(M).base)]),f(z,A)}),t(P),w(()=>ue=ut(P,1,"reasoning-chain space-y-2 svelte-9hm057",null,ue,{running:E()})),f(l,P),Ke()}const Pt="#10b981",Ht="#f59e0b",He="#ef4444",vt="#8B95A5",ot={primary:{label:"Primary",accent:"synapse",icon:"◈"},supporting:{label:"Supporting",accent:"recall",icon:"◇"},contradicting:{label:"Contradicting",accent:"decay",icon:"⚠"},superseded:{label:"Superseded",accent:"muted",icon:"⊘"}};function Wt(l){return ot[l]??ot.supporting}function Te(l){return Number.isFinite(l)?l>75?Pt:l>=40?Ht:He:He}function dt(l){return Number.isFinite(l)?l>75?"HIGH CONFIDENCE":l>=40?"MIXED SIGNAL":"LOW CONFIDENCE":"LOW CONFIDENCE"}function Pe(l){return Number.isFinite(l)?Te(l*100):He}function Kt(l){return!Number.isFinite(l)||l<0?0:l>1?1:l}function Vt(l){return Kt(l)*100}function Yt(l){return l?Mt[l]??vt:vt}function Qt(l,o){if(l==null||typeof l!="string"||l.trim()==="")return"—";const V=new Date(l);if(Number.isNaN(V.getTime()))return l;try{return V.toLocaleDateString(o,{month:"short",day:"numeric",year:"numeric"})}catch{return l}}function Ut(l,o=8){return l?l.length>o?l.slice(0,o):l:""}var Xt=_(' '),Zt=_('

              Trust
              FSRS · reps × retention
              ');function Jt(l,o){We(o,!0);let V=ie(o,"index",3,0);const $=Z(()=>Vt(o.trust)),R=Z(()=>Wt(o.role)),i=Z(()=>Ut(o.id)),B=Z(()=>Yt(o.nodeType));var E=Zt();let G;var I=s(E),Y=s(I),Q=s(Y),P=s(Q),ue=s(P,!0);t(P);var z=a(P,1,!0);t(Q);var M=a(Q,2);{var H=r=>{var n=Xt(),p=s(n,!0);t(n),w(()=>{b(n,`color: ${e(B)??""}`),v(p,o.nodeType)}),f(r,n)};O(M,r=>{o.nodeType&&r(H)})}t(Y);var A=a(Y,2),U=s(A);t(A),t(I);var le=a(I,2),J=s(le,!0);t(le);var ee=a(le,2),te=s(ee),se=a(s(te),2),ae=s(se);t(se),t(te);var ne=a(te,2),pe=s(ne);t(ne),t(ee);var ve=a(ee,2),me=s(ve),xe=s(me,!0);t(me),Fe(2),t(ve),t(E),w((r,n,p,k,x)=>{G=ut(E,1,"evidence-card glass rounded-xl p-4 space-y-3 transition relative svelte-ksja6x",null,G,{contradicting:o.role==="contradicting",primary:o.role==="primary",superseded:o.role==="superseded"}),b(E,`animation-delay: ${V()*80}ms;`),K(E,"data-evidence-id",o.id),v(ue,e(R).icon),v(z,e(R).label),K(A,"title",o.id),v(U,`#${e(i)??""}`),v(J,o.preview),b(se,`color: ${r??""}`),v(ae,`${n??""}%`),b(pe,`width: ${e($)??""}%; background: ${p??""}; box-shadow: 0 0 8px ${k??""}80;`),v(xe,x)},[()=>Pe(o.trust),()=>e($).toFixed(0),()=>Pe(o.trust),()=>Pe(o.trust),()=>Qt(o.date)]),f(l,E),Ke()}var es=_(''),ts=_('
              Try
              '),ss=_('
              Error:
              '),as=_('
              Running cognitive pipeline
              '),ns=_('

              Reasoning

              intent: · ·
              '),rs=ct('',1),is=ct(''),ls=_('

              '),vs=_('

              Contradictions Detected

              '),os=_('
              '),ds=_('

              Superseded

              '),cs=_('
              '),us=_('

              Evolution

              '),ps=_('

              '),ms=_('

              Related Insights

              '),xs=_('
              Confidence
              %
              intent: ·
              Primary Source

              ·

              Cognitive Pipeline

              Evidence

              primary supporting contradicting superseded
              ',1),gs=_(`

              Ask anything. Vestige will run the full reasoning pipeline and show you its work.

              8-stage pipeline: retrieval → rerank → activation → trust-score → supersession → + contradiction → relations → chain. Zero LLM calls, 100% local.

              `),fs=_(`

              Reasoning Theater

              deep_reference

              Watch Vestige reason. Your query runs the 8-stage cognitive pipeline — broad retrieval, + spreading activation, FSRS trust scoring, intent classification, supersession, contradiction + analysis, relation assessment, template reasoning — and returns a pre-built answer with + trust-scored evidence.

              `);function Ls(l,o){We(o,!0);async function V(r){var qe,Ee,we;const n=await zt.deepReference(r,20),k=(Array.isArray(n.evidence)?n.evidence:[]).map(c=>{const T=typeof c.trust=="number"?c.trust:0,ke=T>1?T/100:T,Se=c.role||"supporting";return{id:String(c.id??""),trust:Math.max(0,Math.min(1,ke)),date:String(c.date??""),role:Se,preview:String(c.preview??""),nodeType:c.node_type?String(c.node_type):c.nodeType?String(c.nodeType):void 0}}),x=n.recommended,N={answer_preview:String((x==null?void 0:x.answer_preview)??((qe=k[0])==null?void 0:qe.preview)??""),memory_id:String((x==null?void 0:x.memory_id)??((Ee=k[0])==null?void 0:Ee.id)??""),trust_score:(()=>{var T;const c=x==null?void 0:x.trust_score;return typeof c=="number"?c>1?c/100:c:((T=k[0])==null?void 0:T.trust)??0})(),date:String((x==null?void 0:x.date)??((we=k[0])==null?void 0:we.date)??"")},ge=(Array.isArray(n.contradictions)?n.contradictions:[]).map(c=>({a_id:String(c.a_id??""),b_id:String(c.b_id??""),summary:String(c.summary??c.reason??"Trust-weighted conflict between high-FSRS memories.")})),he=(Array.isArray(n.superseded)?n.superseded:[]).map(c=>({old_id:String(c.old_id??""),new_id:String(c.new_id??N.memory_id??""),reason:String(c.reason??"Superseded by newer memory with higher FSRS trust.")})),fe=(Array.isArray(n.evolution)?n.evolution:[]).map(c=>({date:String(c.date??""),summary:String(c.summary??c.preview??""),trust:(()=>{const T=c.trust;return typeof T=="number"?T>1?T/100:T:0})()})),je=Array.isArray(n.related_insights)?n.related_insights:[],oe=typeof n.confidence=="number"?n.confidence:0,de=oe>1?Math.round(oe):Math.round(oe*100),Le=String(n.intent??"Synthesis"),Re=String(n.reasoning??n.guidance??""),be=typeof n.memoriesAnalyzed=="number"?n.memoriesAnalyzed:k.length;return{intent:Le,reasoning:Re,recommended:N,evidence:k,contradictions:ge,superseded:he,evolution:fe,related_insights:je,confidence:de,memoriesAnalyzed:be}}let $=ce(""),R=ce(!1),i=ce(null),B=ce(null),E=ce(null),G=ce(null),I=ce(Tt([]));async function Y(){const r=e($).trim();if(!(!r||e(R))){D(R,!0),D(B,null),D(i,null),D(I,[],!0);try{D(i,await V(r),!0),requestAnimationFrame(()=>requestAnimationFrame(Q))}catch(n){D(B,n instanceof Error?n.message:"Unknown error",!0)}finally{D(R,!1)}}}function Q(){if(!e(i)||!e(G)||e(i).contradictions.length===0){D(I,[],!0);return}const r=e(G).getBoundingClientRect(),n=[];for(const p of e(i).contradictions){const k=e(G).querySelector(`[data-evidence-id="${p.a_id}"]`),x=e(G).querySelector(`[data-evidence-id="${p.b_id}"]`);if(!k||!x)continue;const N=k.getBoundingClientRect(),W=x.getBoundingClientRect();n.push({x1:N.left-r.left+N.width/2,y1:N.top-r.top+N.height/2,x2:W.left-r.left+W.width/2,y2:W.top-r.top+W.height/2})}D(I,n,!0)}function P(r){var n,p;(r.metaKey||r.ctrlKey)&&r.key.toLowerCase()==="k"&&(r.preventDefault(),(n=e(E))==null||n.focus(),(p=e(E))==null||p.select())}Nt(()=>{var r;return(r=e(E))==null||r.focus(),window.addEventListener("keydown",P),window.addEventListener("resize",Q),()=>{window.removeEventListener("keydown",P),window.removeEventListener("resize",Q)}});const ue=["What port does the dev server use?","Should I enable prefix caching with vLLM?","Why did the benchmark score drop after the parser change?","How does FSRS-6 trust scoring work?"];var z=fs();Dt("q2v96u",r=>{Ft(()=>{jt.title="Reasoning Theater · Vestige"})});var M=a(s(z),2),H=s(M),A=a(s(H),2);Ot(A),it(A,r=>D(E,r),()=>e(E));var U=a(A,4),le=s(U,!0);t(U),t(H);var J=a(H,2);{var ee=r=>{var n=ts(),p=a(s(n),2);re(p,17,()=>ue,ye,(k,x)=>{var N=es(),W=s(N,!0);t(N),w(()=>v(W,e(x))),Ge("click",N,()=>{D($,e(x),!0),Y()}),f(k,N)}),t(n),f(r,n)};O(J,r=>{!e(i)&&!e(R)&&r(ee)})}t(M);var te=a(M,2);{var se=r=>{var n=ss(),p=a(s(n));t(n),w(()=>v(p,` ${e(B)??""}`)),f(r,n)};O(te,r=>{e(B)&&r(se)})}var ae=a(te,2);{var ne=r=>{var n=as(),p=a(s(n),2);lt(p,{running:!0}),t(n),f(r,n)};O(ae,r=>{e(R)&&r(ne)})}var pe=a(ae,2);{var ve=r=>{const n=Z(()=>e(i).confidence),p=Z(()=>Te(e(n)));var k=xs(),x=rt(k);{var N=u=>{var d=ns(),g=s(d),S=a(s(g),2),m=s(S),y=a(s(m)),j=s(y,!0);t(y),t(m);var C=a(m,4),L=s(C);t(C);var h=a(C,4),F=s(h);t(h),t(S),t(g);var q=a(g,2),X=s(q,!0);t(q),t(d),w(_e=>{v(j,e(i).intent),v(L,`${e(i).memoriesAnalyzed??""} analyzed`),b(h,`color: ${e(p)??""}`),v(F,`${e(n)??""}% ${_e??""}`),b(q,`box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.03), 0 0 32px ${e(p)??""}20, 0 8px 32px rgba(0,0,0,0.4); border-color: ${e(p)??""}35;`),v(X,e(i).reasoning)},[()=>dt(e(n))]),f(u,d)};O(x,u=>{e(i).reasoning&&u(N)})}var W=a(x,2),ge=s(W),Ce=a(s(ge),2),he=s(Ce),Ve=s(he,!0);Fe(),t(he),t(Ce);var fe=a(Ce,2),je=s(fe,!0);t(fe);var oe=a(fe,2),de=a(s(oe)),Le=s(de);t(de),t(oe);var Re=a(oe,2),be=s(Re),qe=a(s(be)),Ee=s(qe,!0);t(qe),t(be);var we=a(be,4),c=s(we);t(we),t(Re),t(ge);var T=a(ge,2),ke=s(T),Se=a(s(ke),2),pt=s(Se);t(Se),t(ke);var De=a(ke,2),mt=s(De,!0);t(De);var Ye=a(De,2),Oe=s(Ye),Qe=s(Oe),xt=a(Qe);t(Oe);var Ue=a(Oe,4),gt=s(Ue,!0);t(Ue),t(Ye),t(T),t(W);var Ie=a(W,2),Xe=a(s(Ie),2),ft=s(Xe);lt(ft,{get intent(){return e(i).intent},get memoriesAnalyzed(){return e(i).memoriesAnalyzed},get evidenceCount(){return e(i).evidence.length},get contradictionCount(){return e(i).contradictions.length},get supersededCount(){return e(i).superseded.length}}),t(Xe),t(Ie);var ze=a(Ie,2),Me=s(ze),Ze=s(Me),Je=a(s(Ze),2),_t=s(Je);t(Je),t(Ze),Fe(2),t(Me);var $e=a(Me,2),et=s($e);re(et,19,()=>e(i).evidence,u=>u.id,(u,d,g)=>{Jt(u,{get id(){return e(d).id},get trust(){return e(d).trust},get date(){return e(d).date},get role(){return e(d).role},get preview(){return e(d).preview},get nodeType(){return e(d).nodeType},get index(){return e(g)}})});var yt=a(et,2);{var ht=u=>{var d=is(),g=a(s(d));re(g,17,()=>e(I),ye,(S,m,y)=>{const j=Z(()=>(e(m).x1+e(m).x2)/2),C=Z(()=>Math.min(e(m).y1,e(m).y2)-28);var L=rs(),h=rt(L);b(h,`animation-delay: ${y*120+600}ms;`);var F=a(h);b(F,`animation-delay: ${y*120+600}ms;`);var q=a(F);b(q,`animation-delay: ${y*120+700}ms;`),w(()=>{K(h,"d",`M ${e(m).x1??""} ${e(m).y1??""} Q ${e(j)??""} ${e(C)??""} ${e(m).x2??""} ${e(m).y2??""}`),K(F,"cx",e(m).x1),K(F,"cy",e(m).y1),K(q,"cx",e(m).x2),K(q,"cy",e(m).y2)}),f(S,L)}),t(d),f(u,d)};O(yt,u=>{e(I).length>0&&u(ht)})}t($e),it($e,u=>D(G,u),()=>e(G)),t(ze);var tt=a(ze,2);{var bt=u=>{var d=vs(),g=s(d),S=a(s(g),2),m=s(S);t(S),t(g);var y=a(g,2);re(y,21,()=>e(i).contradictions,ye,(j,C,L)=>{var h=ls(),F=a(s(h),2),q=s(F),X=s(q),_e=s(X);t(X);var Ae=a(X,4),Be=s(Ae);t(Ae),t(q);var Ne=a(q,2),Ct=s(Ne,!0);t(Ne),t(F);var Rt=a(F,2);Rt.textContent=`pair ${L+1}`,t(h),w((Et,At)=>{v(_e,`#${Et??""}`),v(Be,`#${At??""}`),v(Ct,e(C).summary)},[()=>e(C).a_id.slice(0,8),()=>e(C).b_id.slice(0,8)]),f(j,h)}),t(y),t(d),w(()=>v(m,`(${e(i).contradictions.length??""})`)),f(u,d)};O(tt,u=>{e(i).contradictions.length>0&&u(bt)})}var st=a(tt,2);{var qt=u=>{var d=ds(),g=s(d),S=a(s(g),2),m=s(S);t(S),t(g);var y=a(g,2);re(y,21,()=>e(i).superseded,ye,(j,C)=>{var L=os(),h=s(L),F=s(h);t(h);var q=a(h,4),X=s(q);t(q);var _e=a(q,2),Ae=s(_e,!0);t(_e),t(L),w((Be,Ne)=>{v(F,`#${Be??""}`),v(X,`#${Ne??""}`),v(Ae,e(C).reason)},[()=>e(C).old_id.slice(0,8),()=>e(C).new_id.slice(0,8)]),f(j,L)}),t(y),t(d),w(()=>v(m,`(${e(i).superseded.length??""})`)),f(u,d)};O(st,u=>{e(i).superseded.length>0&&u(qt)})}var at=a(st,2),nt=s(at);{var wt=u=>{var d=us(),g=a(s(d),2);re(g,21,()=>e(i).evolution,ye,(S,m)=>{var y=cs(),j=s(y),C=s(j,!0);t(j);var L=a(j,2),h=a(L,2),F=s(h,!0);t(h),t(y),w((q,X)=>{v(C,q),b(L,`background: ${X??""}`),v(F,e(m).summary)},[()=>new Date(e(m).date).toLocaleDateString(void 0,{month:"short",day:"numeric"}),()=>Te(e(m).trust*100)]),f(S,y)}),t(g),t(d),f(u,d)};O(nt,u=>{e(i).evolution.length>0&&u(wt)})}var kt=a(nt,2);{var St=u=>{var d=ms(),g=a(s(d),2);re(g,21,()=>e(i).related_insights,ye,(S,m)=>{var y=ps(),j=a(s(y),1,!0);t(y),w(()=>v(j,e(m))),f(S,y)}),t(g),t(d),f(u,d)};O(kt,u=>{e(i).related_insights.length>0&&u(St)})}t(at),w((u,d,g,S,m)=>{b(ge,`box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.03), 0 0 32px ${e(p)??""}30, 0 8px 32px rgba(0,0,0,0.4); border-color: ${e(p)??""}40;`),b(he,`color: ${e(p)??""}; text-shadow: 0 0 24px ${e(p)??""}80;`),v(Ve,e(n)),b(fe,`color: ${e(p)??""}`),v(je,u),K(de,"width",e(n)/100*220),K(de,"fill",e(p)),b(de,`filter: drop-shadow(0 0 6px ${e(p)??""});`),K(Le,"to",e(n)/100*220),v(Ee,e(i).intent),v(c,`${e(i).memoriesAnalyzed??""} analyzed`),K(Se,"title",e(i).recommended.memory_id),v(pt,`#${d??""}`),v(mt,e(i).recommended.answer_preview),b(Qe,`background: ${g??""}`),v(xt,` Trust ${S??""}%`),v(gt,m),v(_t,`(${e(i).evidence.length??""})`)},[()=>dt(e(n)),()=>e(i).recommended.memory_id.slice(0,8),()=>Te(e(i).recommended.trust_score*100),()=>(e(i).recommended.trust_score*100).toFixed(0),()=>new Date(e(i).recommended.date).toLocaleDateString()]),f(r,k)};O(pe,r=>{e(i)&&!e(R)&&r(ve)})}var me=a(pe,2);{var xe=r=>{var n=gs();f(r,n)};O(me,r=>{!e(i)&&!e(R)&&!e(B)&&r(xe)})}t(z),w(r=>{U.disabled=r,v(le,e(R)?"Reasoning…":"Reason")},[()=>!e($).trim()||e(R)]),Ge("keydown",A,r=>r.key==="Enter"&&Y()),It(A,()=>e($),r=>D($,r)),Ge("click",U,Y),f(l,z),Ke()}Lt(["keydown","click"]);export{Ls as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/15.C7Fk4d1G.js.br b/apps/dashboard/build/_app/immutable/nodes/15.C7Fk4d1G.js.br new file mode 100644 index 0000000..af5f0a7 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/15.C7Fk4d1G.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/15.C7Fk4d1G.js.gz b/apps/dashboard/build/_app/immutable/nodes/15.C7Fk4d1G.js.gz new file mode 100644 index 0000000..8a605d8 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/15.C7Fk4d1G.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/16.CrQpRrFW.js b/apps/dashboard/build/_app/immutable/nodes/16.CrQpRrFW.js deleted file mode 100644 index bec5d28..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/16.CrQpRrFW.js +++ /dev/null @@ -1,3 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{o as lt}from"../chunks/TZu9D97Z.js";import{p as Ue,e as r,h as n,r as t,t as A,a as _,g as e,u as z,b as Ve,s as oe,i as S,c as Ye,f as Re,j as y,d as dt,n as Te}from"../chunks/wpu9U-D0.js";import{d as Je,s as d,a as ie,e as qe}from"../chunks/D8mhvFt8.js";import{i as q}from"../chunks/DKve45Wd.js";import{e as te,a as Ce,s as _e,i as pt}from"../chunks/60_R_Vbt.js";import{a as vt,r as ut}from"../chunks/P1-U_Xsj.js";import{s as me}from"../chunks/EqHb-9AZ.js";import{P as ft}from"../chunks/BHDZZvku.js";import{I as X}from"../chunks/D7A-gG4Z.js";import{A as ee}from"../chunks/DcKTNC6e.js";function gt(b,m,$=3){const v={};for(const u of b){v[u]={};for(const f of b)v[u][f]={count:0,topNames:[]}}for(const u of m){const f=u.origin_project;if(v[f])for(const F of u.transferred_to)v[f][F]&&(v[f][F].count+=1,v[f][F].topNames.push(u.name))}const p=Math.max(0,$);for(const u of b)for(const f of b)v[u][f].topNames=v[u][f].topNames.slice(0,p);return v}function xt(b,m){let $=0;for(const v of b){const p=m[v];if(p)for(const u of b){const f=p[u];f&&f.count>$&&($=f.count)}}return $}function _t(b,m){var v;const $=[];for(const p of b)for(const u of b){const f=(v=m[p])==null?void 0:v[u];f&&f.count>0&&$.push({from:p,to:u,count:f.count,topNames:f.topNames})}return $.sort((p,u)=>u.count-p.count)}function mt(b){return b?b.length>12?b.slice(0,11)+"…":b:""}var yt=y('
              '),ht=y(''),bt=y(' '),wt=y('
              '),jt=y('
              Top patterns
              '),kt=y('
              No transfers recorded
              '),Tt=y('
              '),Ct=y('
              No cross-project transfers recorded yet.
              '),At=y('
              '),$t=y(''),Zt=y('
              ');function Pt(b,m){Ue(m,!0);const $=z(()=>gt(m.projects,m.patterns)),v=z(()=>xt(m.projects,e($))||1);let p=oe(null);function u(a){if(a===0)return"background: rgba(255,255,255,0.02); border-color: rgba(99,102,241,0.05);";const s=a/e(v),o=.1+s*.7;if(s<.5)return`background: rgba(99, 102, 241, ${o.toFixed(3)}); border-color: rgba(129, 140, 248, ${(o*.6).toFixed(3)}); box-shadow: 0 0 ${(s*14).toFixed(1)}px rgba(129, 140, 248, ${(s*.45).toFixed(3)});`;{const c=(s-.5)*2,l=Math.round(99+69*c),x=Math.round(102+-17*c),g=Math.round(241+6*c);return`background: rgba(${l}, ${x}, ${g}, ${o.toFixed(3)}); border-color: rgba(192, 132, 252, ${(o*.7).toFixed(3)}); box-shadow: 0 0 ${(6+s*18).toFixed(1)}px rgba(192, 132, 252, ${(s*.55).toFixed(3)});`}}function f(a){if(a===0)return"text-muted";const s=a/e(v);return s>=.5?"text-bright font-semibold":s>=.2?"text-text":"text-dim"}function F(a,s,o){const l=a.currentTarget.getBoundingClientRect();S(p,{from:s,to:o,x:l.left+l.width/2,y:l.top},!0)}function k(){S(p,null)}const K=mt;function ce(a,s){return m.selectedCell!==null&&m.selectedCell.from===a&&m.selectedCell.to===s}const H=z(()=>_t(m.projects,e($)));var B=Zt(),Q=r(B),re=r(Q),U=n(r(re),2),le=n(r(U),4),Ae=r(le,!0);t(le),t(U),t(re);var de=n(re,2),ye=r(de),V=r(ye),pe=r(V),ve=n(r(pe));te(ve,16,()=>m.projects,a=>a,(a,s)=>{var o=yt(),c=r(o),l=r(c),x=r(l,!0);t(l),t(c),t(o),A(g=>{Ce(o,"title",s),d(x,g)},[()=>K(s)]),_(a,o)}),t(pe),t(V);var W=n(V);te(W,20,()=>m.projects,a=>a,(a,s)=>{var o=bt(),c=r(o),l=r(c,!0);t(c);var x=n(c);te(x,16,()=>m.projects,g=>g,(g,w)=>{const h=z(()=>e($)[s][w]),P=z(()=>s===w);var N=ht(),C=r(N),R=r(C),Y=r(R,!0);t(R),t(C),t(N),A((I,Z,T)=>{me(C,`${I??""} ${Z??""} ${e(P)&&e(h).count>0?"border-style: dashed;":""}`),Ce(C,"aria-label",`${e(h).count??""} patterns from ${s??""} to ${w??""}`),_e(R,1,`text-[11px] ${T??""}`),d(Y,e(h).count||"")},[()=>u(e(h).count),()=>ce(s,w)?"outline: 2px solid var(--color-dream-glow); outline-offset: 1px;":"",()=>f(e(h).count)]),ie("click",C,()=>m.onCellClick(s,w)),qe("mouseenter",C,I=>F(I,s,w)),qe("mouseleave",C,k),_(g,N)}),t(o),A(g=>{Ce(c,"title",s),d(l,g)},[()=>K(s)]),_(a,o)}),t(W),t(ye),t(de);var he=n(de,2);{var $e=a=>{const s=z(()=>e($)[e(p).from][e(p).to]);var o=Tt(),c=r(o),l=r(c),x=r(l,!0);t(l);var g=n(l,4),w=r(g,!0);t(g),t(c);var h=n(c,2),P=r(h),N=n(P),C=r(N);t(N),t(h);var R=n(h,2);{var Y=Z=>{var T=jt(),L=n(r(T),2);te(L,17,()=>e(s).topNames,pt,(D,J)=>{var fe=wt(),we=r(fe);t(fe),A(()=>d(we,`· ${e(J)??""}`)),_(D,fe)}),t(T),_(Z,T)},I=Z=>{var T=kt();_(Z,T)};q(R,Z=>{e(s).topNames.length>0?Z(Y):Z(I,!1)})}t(o),A((Z,T)=>{me(o,`left: ${e(p).x??""}px; top: ${e(p).y-12}px; transform: translate(-50%, -100%);`),d(x,Z),d(w,T),d(P,`${e(s).count??""} `),d(C,`${e(s).count===1?"pattern":"patterns"} transferred`)},[()=>K(e(p).from),()=>K(e(p).to)]),_(a,o)};q(he,a=>{e(p)&&a($e)})}t(Q);var be=n(Q,2),ue=r(be),Ze=r(ue);t(ue);var Pe=n(ue,2);{var Ne=a=>{var s=Ct();_(a,s)},i=a=>{var s=Ye(),o=Re(s);te(o,17,()=>e(H),c=>c.from+"->"+c.to,(c,l)=>{var x=$t(),g=r(x),w=r(g),h=r(w),P=r(h,!0);t(h);var N=n(h,4),C=r(N,!0);t(N),t(w);var R=n(w,2);{var Y=T=>{var L=At(),D=r(L,!0);t(L),A(J=>d(D,J),[()=>e(l).topNames.join(" · ")]),_(T,L)};q(R,T=>{e(l).topNames.length>0&&T(Y)})}t(g);var I=n(g,2),Z=r(I,!0);t(I),t(x),A((T,L,D)=>{_e(x,1,`flex w-full items-center justify-between rounded-lg border border-synapse/10 bg-white/[0.02] p-3 transition hover:border-synapse/30 hover:bg-white/[0.04] ${T??""}`),d(P,L),d(C,D),d(Z,e(l).count)},[()=>ce(e(l).from,e(l).to)?"ring-1 ring-dream-glow":"",()=>K(e(l).from),()=>K(e(l).to)]),ie("click",x,()=>m.onCellClick(e(l).from,e(l).to)),_(c,x)}),_(a,s)};q(Pe,a=>{e(H).length===0?a(Ne):a(i,!1)})}t(be),t(B),A(()=>{d(Ae,e(v)),d(Ze,`${e(H).length??""} transfer pair${e(H).length===1?"":"s"} · tap to filter`)}),_(b,B),Ve()}Je(["click"]);var Nt=y(' '),St=y(''),Ft=y(`
              Couldn't load pattern transfers
              `),Mt=y('
              '),Et=y('
              Filtered to
              '),zt=y('
              No matching patterns
              '),Ht=y('
            • '),Rt=y('
                '),It=y('
                ',1),Lt=y('
                ');function Jt(b,m){Ue(m,!0);const $=["ErrorHandling","AsyncConcurrency","Testing","Architecture","Performance","Security"],v={ErrorHandling:"var(--color-decay)",AsyncConcurrency:"var(--color-synapse-glow)",Testing:"var(--color-recall)",Architecture:"var(--color-dream-glow)",Performance:"var(--color-warning)",Security:"var(--color-node-pattern)"};let p=oe("All"),u=oe(dt({projects:[],patterns:[]})),f=oe(!0),F=oe(null),k=oe(null);async function K(){return await new Promise(s=>setTimeout(s,420)),{projects:["vestige","api-gateway","desktop-app","model-runner","game-sim","security-dashboard","benchmark-suite"],patterns:[{name:"Result with thiserror context",category:"ErrorHandling",origin_project:"vestige",transferred_to:["api-gateway","desktop-app","model-runner","security-dashboard"],transfer_count:4,last_used:"2026-04-18T14:22:00Z",confidence:.94},{name:"Axum error middleware with tower-http",category:"ErrorHandling",origin_project:"api-gateway",transferred_to:["vestige","security-dashboard"],transfer_count:2,last_used:"2026-04-17T09:10:00Z",confidence:.88},{name:"Graceful shutdown on SIGINT/SIGTERM",category:"ErrorHandling",origin_project:"vestige",transferred_to:["vestige","desktop-app","security-dashboard"],transfer_count:3,last_used:"2026-04-15T22:01:00Z",confidence:.82},{name:"Python try/except with contextual re-raise",category:"ErrorHandling",origin_project:"benchmark-suite",transferred_to:["model-runner"],transfer_count:1,last_used:"2026-04-10T11:30:00Z",confidence:.7},{name:"Arc> reader/writer split",category:"AsyncConcurrency",origin_project:"vestige",transferred_to:["api-gateway","desktop-app"],transfer_count:2,last_used:"2026-04-14T16:42:00Z",confidence:.91},{name:"tokio::select! for cancellation propagation",category:"AsyncConcurrency",origin_project:"desktop-app",transferred_to:["vestige","security-dashboard"],transfer_count:2,last_used:"2026-04-19T08:05:00Z",confidence:.86},{name:"Bounded mpsc channel with backpressure",category:"AsyncConcurrency",origin_project:"desktop-app",transferred_to:["vestige","api-gateway"],transfer_count:2,last_used:"2026-04-12T13:18:00Z",confidence:.83},{name:"asyncio.gather with return_exceptions",category:"AsyncConcurrency",origin_project:"model-runner",transferred_to:["benchmark-suite"],transfer_count:1,last_used:"2026-04-08T20:45:00Z",confidence:.72},{name:"Property-based tests with proptest",category:"Testing",origin_project:"vestige",transferred_to:["api-gateway","desktop-app"],transfer_count:2,last_used:"2026-04-11T10:22:00Z",confidence:.89},{name:"Snapshot testing with insta",category:"Testing",origin_project:"api-gateway",transferred_to:["vestige"],transfer_count:1,last_used:"2026-04-16T14:00:00Z",confidence:.81},{name:"Vitest + Playwright dashboard harness",category:"Testing",origin_project:"vestige",transferred_to:["api-gateway","desktop-app"],transfer_count:2,last_used:"2026-04-19T18:30:00Z",confidence:.87},{name:"One-variable-at-a-time Kaggle submission",category:"Testing",origin_project:"benchmark-suite",transferred_to:["model-runner","game-sim"],transfer_count:2,last_used:"2026-04-20T07:15:00Z",confidence:.95},{name:"Kaggle pre-flight Input-panel screenshot",category:"Testing",origin_project:"benchmark-suite",transferred_to:["model-runner","game-sim"],transfer_count:2,last_used:"2026-04-20T06:50:00Z",confidence:.98},{name:"SvelteKit 2 + Svelte 5 runes dashboard",category:"Architecture",origin_project:"vestige",transferred_to:["api-gateway","security-dashboard"],transfer_count:2,last_used:"2026-04-19T12:10:00Z",confidence:.92},{name:"glass-panel + cosmic-dark design system",category:"Architecture",origin_project:"vestige",transferred_to:["api-gateway","security-dashboard","desktop-app"],transfer_count:3,last_used:"2026-04-20T09:00:00Z",confidence:.9},{name:"Tauri 2 + Rust/Axum sidecar",category:"Architecture",origin_project:"desktop-app",transferred_to:["security-dashboard"],transfer_count:1,last_used:"2026-04-13T19:44:00Z",confidence:.78},{name:"MCP server with 23 stateful tools",category:"Architecture",origin_project:"vestige",transferred_to:["desktop-app"],transfer_count:1,last_used:"2026-04-17T11:05:00Z",confidence:.85},{name:"USearch HNSW index for vector search",category:"Performance",origin_project:"vestige",transferred_to:["api-gateway"],transfer_count:1,last_used:"2026-04-09T15:20:00Z",confidence:.88},{name:"SQLite WAL mode for concurrent reads",category:"Performance",origin_project:"vestige",transferred_to:["api-gateway","desktop-app","security-dashboard"],transfer_count:3,last_used:"2026-04-18T21:33:00Z",confidence:.93},{name:"vLLM prefix caching at 0.35 mem util",category:"Performance",origin_project:"benchmark-suite",transferred_to:["model-runner"],transfer_count:1,last_used:"2026-04-11T08:00:00Z",confidence:.84},{name:"Cross-encoder rerank at k=30",category:"Performance",origin_project:"vestige",transferred_to:["api-gateway"],transfer_count:1,last_used:"2026-04-14T17:55:00Z",confidence:.79},{name:"Rotated auth token in env var",category:"Security",origin_project:"vestige",transferred_to:["api-gateway","desktop-app","security-dashboard"],transfer_count:3,last_used:"2026-04-16T20:12:00Z",confidence:.96},{name:"Parameterized SQL via rusqlite params!",category:"Security",origin_project:"vestige",transferred_to:["api-gateway"],transfer_count:1,last_used:"2026-04-10T13:40:00Z",confidence:.89},{name:"664-pattern secret scanner",category:"Security",origin_project:"api-gateway",transferred_to:["vestige","security-dashboard","desktop-app"],transfer_count:3,last_used:"2026-04-20T05:30:00Z",confidence:.97},{name:"CSP header with nonce-based script allow",category:"Security",origin_project:"api-gateway",transferred_to:["security-dashboard"],transfer_count:1,last_used:"2026-04-05T16:08:00Z",confidence:.8}]}}async function ce(){S(f,!0),S(F,null);try{S(u,await K(),!0)}catch(i){S(F,i instanceof Error?i.message:"Failed to load pattern transfers",!0),S(u,{projects:[],patterns:[]},!0)}finally{S(f,!1)}}lt(()=>ce());const H=z(()=>e(p)==="All"?e(u).patterns:e(u).patterns.filter(i=>i.category===e(p))),B=z(()=>[...e(k)?e(H).filter(a=>a.origin_project===e(k).from&&a.transferred_to.includes(e(k).to)):e(H)].sort((a,s)=>s.transfer_count-a.transfer_count)),Q=z(()=>e(H).reduce((i,a)=>i+a.transferred_to.length,0)),re=z(()=>e(u).projects.length),U=z(()=>e(H).length);function le(i){S(p,i,!0),S(k,null)}function Ae(i,a){e(k)&&e(k).from===i&&e(k).to===a?S(k,null):S(k,{from:i,to:a},!0)}function de(){S(k,null)}function ye(i){const a=new Date(i).getTime(),s=Date.now(),o=Math.floor((s-a)/864e5);return o<=0?"today":o===1?"1d ago":o<30?`${o}d ago`:`${Math.floor(o/30)}mo ago`}var V=Lt(),pe=r(V);ft(pe,{icon:"patterns",title:"Cross-Project Intelligence",subtitle:"Patterns learned here, applied there — across every tracked project.",accent:"dream",children:(i,a)=>{var s=Ye(),o=Re(s);{var c=l=>{var x=Nt(),g=r(x),w=r(g);ee(w,{get value(){return e(U)}}),t(g);var h=n(g),P=n(h),N=r(P);ee(N,{get value(){return e(Q)}}),t(P);var C=n(P);t(x),A(()=>{d(h,` pattern${e(U)===1?"":"s"} - · `),d(C,` transfer${e(Q)===1?"":"s"}`)}),_(l,x)};q(o,l=>{!e(f)&&!e(F)&&l(c)})}_(i,s)},$$slots:{default:!0}});var ve=n(pe,2),W=r(ve),he=r(W),$e=r(he);X($e,{name:"sparkle",size:13}),Te(),t(he),t(W);var be=n(W,2);te(be,16,()=>$,i=>i,(i,a)=>{var s=St(),o=r(s),c=n(o);t(s),A(()=>{_e(s,1,`lift flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium transition ${e(p)===a?"bg-synapse/25 text-synapse-glow shadow-[0_0_16px_-4px_var(--color-synapse-glow)]":"text-dim hover:bg-white/[0.04] hover:text-text"}`),_e(o,1,`h-1.5 w-1.5 rounded-full transition-all duration-300 ${e(p)===a?"scale-150":""}`),me(o,`background: ${v[a]??""}; ${e(p)===a?`box-shadow: 0 0 8px ${v[a]};`:""}`),d(c,` ${a??""}`)}),ie("click",s,()=>le(a)),_(i,s)}),t(ve);var ue=n(ve,2);{var Ze=i=>{var a=Ft(),s=r(a),o=r(s);X(o,{name:"contradictions",size:28}),t(s);var c=n(s,4),l=r(c,!0);t(c);var x=n(c,2),g=r(x);X(g,{name:"pulse",size:14}),Te(),t(x),t(a),A(()=>d(l,e(F))),ie("click",x,ce),_(i,a)},Pe=i=>{var a=Mt();_(i,a)},Ne=i=>{var a=It(),s=Re(a),o=r(s),c=r(o);Pt(c,{get projects(){return e(u).projects},get patterns(){return e(H)},get selectedCell(){return e(k)},onCellClick:Ae});var l=n(c,2);{var x=G=>{var M=Et(),E=r(M),j=r(E),ae=r(j);X(ae,{name:"filter",size:13}),t(j);var O=n(j,4),je=r(O,!0);t(O);var se=n(O,4),ne=r(se,!0);t(se),t(E);var ge=n(E,2),xe=r(ge);X(xe,{name:"close",size:12}),Te(),t(ge),t(M),A(()=>{d(je,e(k).from),d(ne,e(k).to)}),ie("click",ge,de),_(G,M)};q(l,G=>{e(k)&&G(x)})}t(o);var g=n(o,2),w=r(g),h=r(w),P=r(h),N=r(P);X(N,{name:"patterns",size:15}),t(P),Te(),t(h);var C=n(h,2),R=r(C);ee(R,{get value(){return e(B).length}});var Y=n(R);t(C),t(w);var I=n(w,2);{var Z=G=>{var M=zt(),E=r(M),j=r(E);X(j,{name:"explore",size:32}),t(E);var ae=n(E,4),O=r(ae,!0);t(ae),t(M),A(()=>d(O,e(k)?"No patterns transferred from this origin to this destination yet — try another cell or clear the filter.":"Nothing in this category yet. Pick another category to explore what travels between projects.")),_(G,M)},T=G=>{var M=Rt();te(M,23,()=>e(B),E=>E.name,(E,j,ae)=>{var O=Ht(),je=r(O),se=r(je),ne=r(se),ge=r(ne,!0);t(ne);var xe=n(ne,2),ke=r(xe),at=r(ke,!0);t(ke);var Oe=n(ke,2),st=r(Oe,!0);t(Oe),t(xe);var De=n(xe,2),Me=r(De),nt=r(Me,!0);t(Me);var Ke=n(Me,4),ot=r(Ke);t(Ke),t(De),t(se);var Be=n(se,2),Ee=r(Be),it=r(Ee);ee(it,{get value(){return e(j).transfer_count}}),t(Ee);var Qe=n(Ee,2),ct=r(Qe);t(Qe),t(Be),t(je),t(O),vt(O,(ze,He)=>{var We;return(We=ut)==null?void 0:We(ze,He)},()=>({y:12,delay:Math.min(e(ae)*45,360)})),A((ze,He)=>{Ce(ne,"title",e(j).name),d(ge,e(j).name),me(ke,`border-color: ${v[e(j).category]??""}66; color: ${v[e(j).category]??""}; background: ${v[e(j).category]??""}1a;`),d(at,e(j).category),d(st,ze),d(nt,e(j).origin_project),d(ot,`${e(j).transferred_to.length??""} - ${e(j).transferred_to.length===1?"project":"projects"}`),d(ct,`${He??""}%`)},[()=>ye(e(j).last_used),()=>(e(j).confidence*100).toFixed(0)]),_(E,O)}),t(M),_(G,M)};q(I,G=>{e(B).length===0?G(Z):G(T,!1)})}t(g),t(s);var L=n(s,2),D=r(L),J=r(D),fe=r(J);ee(fe,{get value(){return e(U)}}),t(J);var we=n(J),Se=n(we),Xe=r(Se);ee(Xe,{get value(){return e(re)}}),t(Se);var Ie=n(Se),Fe=n(Ie),et=r(Fe);ee(et,{get value(){return e(Q)}}),t(Fe);var tt=n(Fe);t(D);var Le=n(D,2),Ge=r(Le),rt=n(Ge);t(Le),t(L),A(()=>{d(Y,` ${e(B).length===1?"pattern":"patterns"}`),d(we,` pattern${e(U)===1?"":"s"} across `),d(Ie,` project${e(re)===1?"":"s"}, `),d(tt,` total transfer${e(Q)===1?"":"s"}`),me(Ge,`background: ${(e(p)==="All"?"var(--color-synapse-glow)":v[e(p)])??""}`),d(rt,` ${(e(p)==="All"?"All categories":e(p))??""}`)}),_(i,a)};q(ue,i=>{e(F)?i(Ze):e(f)?i(Pe,1):i(Ne,!1)})}t(V),A(()=>_e(W,1,`lift rounded-lg px-3 py-1.5 text-xs font-medium transition ${e(p)==="All"?"bg-synapse/25 text-synapse-glow shadow-[0_0_16px_-4px_var(--color-synapse-glow)]":"text-dim hover:bg-white/[0.04] hover:text-text"}`)),ie("click",W,()=>le("All")),_(b,V),Ve()}Je(["click"]);export{Jt as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/16.CrQpRrFW.js.br b/apps/dashboard/build/_app/immutable/nodes/16.CrQpRrFW.js.br deleted file mode 100644 index 16c0afa..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/16.CrQpRrFW.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/16.CrQpRrFW.js.gz b/apps/dashboard/build/_app/immutable/nodes/16.CrQpRrFW.js.gz deleted file mode 100644 index b2eb33c..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/16.CrQpRrFW.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/16.DeYkCVEo.js b/apps/dashboard/build/_app/immutable/nodes/16.DeYkCVEo.js new file mode 100644 index 0000000..88e2a98 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/16.DeYkCVEo.js @@ -0,0 +1,9 @@ +import"../chunks/Bzak7iHL.js";import{o as Ve}from"../chunks/GG5zm9kr.js";import{p as Ye,d as a,e as n,g as e,f as Ze,t as y,r as t,u as S,a as qe,s as ue,h as I,c as et,n as tt}from"../chunks/CpWkWWOo.js";import{d as Ue,s as u,a as Ae}from"../chunks/BlVfL1ME.js";import{i as L}from"../chunks/B4yTwGkE.js";import{e as Q,i as pe}from"../chunks/CGEBXrjl.js";import{c as at,a as v,f as m,b as Oe}from"../chunks/CHOnp4oo.js";import{s as Fe}from"../chunks/aVbAZ-t7.js";import{a as Ee}from"../chunks/DNjM5a-l.js";import{s as M}from"../chunks/A7po6GxK.js";import{s as Re}from"../chunks/Cx-f-Pzo.js";import{p as st}from"../chunks/V6gjw5Ec.js";import{N as rt}from"../chunks/DzfRjky4.js";const ze=1440*60*1e3;function xe(p){const o=typeof p=="string"?new Date(p):new Date(p);return o.setHours(0,0,0,0),o}function we(p,o){return Math.floor((xe(p).getTime()-xe(o).getTime())/ze)}function Be(p){const o=p.getFullYear(),f=String(p.getMonth()+1).padStart(2,"0"),N=String(p.getDate()).padStart(2,"0");return`${o}-${f}-${N}`}function He(p,o){if(!o)return"none";const f=new Date(o);if(Number.isNaN(f.getTime()))return"none";const N=we(f,p);return N<0?"overdue":N===0?"today":N<=7?"week":"future"}function Ke(p,o){if(!o)return null;const f=new Date(o);return Number.isNaN(f.getTime())?null:we(f,p)}function nt(p){if(p.length===0)return 0;let o=0;for(const f of p)o+=f.retentionStrength??0;return o/p.length}function it(p){const o=xe(p);return o.setDate(o.getDate()-14),o.setDate(o.getDate()-o.getDay()),o}function ot(p,o){let f=0,N=0,P=0,E=0,j=0,Z=0;const B=xe(p);for(const H of o){if(!H.nextReviewAt)continue;const K=new Date(H.nextReviewAt);if(Number.isNaN(K.getTime()))continue;const _=we(K,p);_<0&&f++,_<=0&&N++,_<=7&&P++,_<=30&&E++,_>=0&&(j+=(K.getTime()-B.getTime())/ze,Z++)}const w=Z>0?j/Z:0;return{overdue:f,dueToday:N,dueThisWeek:P,dueThisMonth:E,avgDays:w}}var dt=Oe(''),lt=Oe(''),vt=Oe(''),ct=m('
                '),ut=m(' '),pt=m(' '),xt=m('
                '),gt=m(''),mt=m(" "),ft=m(' '),_t=m('

                '),bt=m('

                '),ht=m('

                '),yt=m('
                Avg retention of memories due — last 2 weeks → next 4
                retention today
                Overdue Due today Within 7 days Future (8+ days)
                ');function wt(p,o){Ye(o,!0);let f=st(o,"anchor",19,()=>new Date),N=S(()=>xe(f())),P=S(()=>it(f())),E=S(()=>(()=>{const r=new Map;for(const s of o.memories){if(!s.nextReviewAt)continue;const i=new Date(s.nextReviewAt);if(Number.isNaN(i.getTime()))continue;const c=Be(xe(i)),k=r.get(c);k?k.push(s):r.set(c,[s])}return r})()),j=S(()=>(()=>{const r=[];for(let s=0;s<42;s++){const i=new Date(e(P));i.setDate(i.getDate()+s);const c=Be(i),k=e(E).get(c)??[],h=we(i,e(N));r.push({date:i,key:c,isToday:h===0,inWindow:h>=-14&&h<=28,memories:k,avgRetention:nt(k)})}return r})());function Z(r){if(r.memories.length===0)return{bg:"rgba(255,255,255,0.02)",border:"rgba(99,102,241,0.06)",text:"#4a4a7a"};const s=we(r.date,e(N));return s<-1?{bg:"rgba(239,68,68,0.16)",border:"rgba(239,68,68,0.45)",text:"#fca5a5"}:s>=-1&&s<=0?{bg:"rgba(245,158,11,0.18)",border:"rgba(245,158,11,0.5)",text:"#fcd34d"}:s>0&&s<=7?{bg:"rgba(99,102,241,0.16)",border:"rgba(99,102,241,0.45)",text:"#a5b4fc"}:{bg:"rgba(168,85,247,0.08)",border:"rgba(168,85,247,0.2)",text:"#c084fc"}}let B=ue(null),w=S(()=>e(j).find(r=>r.key===e(B))??null);function H(r){I(B,e(B)===r?null:r,!0)}const K=600,_=56;let Y=S(()=>(()=>{const r=[],s=e(j).length;for(let i=0;i(()=>{const r=e(Y).filter(s=>s.count>0);return r.length===0?"":r.map((s,i)=>`${i===0?"M":"L"} ${s.x.toFixed(1)} ${s.y.toFixed(1)}`).join(" ")})()),ge=S(()=>e(j).findIndex(r=>r.isToday)),ee=S(()=>e(ge)>=0?e(ge)/(e(j).length-1)*K:-1);const me=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function fe(r){return r.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric",year:"numeric"})}var ne=yt(),_e=a(ne),be=n(a(_e),2);M(be,"viewBox","0 0 600 56");var ie=a(be);M(ie,"x2",K),M(ie,"y1",_-6-.3*(_-12)),M(ie,"y2",_-6-.3*(_-12));var oe=n(ie);M(oe,"x2",K),M(oe,"y1",_-6-.7*(_-12)),M(oe,"y2",_-6-.7*(_-12));var $e=n(oe);{var Ne=r=>{var s=dt();M(s,"y2",_),y(()=>{M(s,"x1",e(ee)),M(s,"x2",e(ee))}),v(r,s)};L($e,r=>{e(ee)>=0&&r(Ne)})}var d=n($e);{var x=r=>{var s=lt();y(()=>M(s,"d",e(ke))),v(r,s)};L(d,r=>{e(ke)&&r(x)})}var g=n(d);Q(g,17,()=>e(Y),pe,(r,s)=>{var i=at(),c=Ze(i);{var k=h=>{var A=vt();y(()=>{M(A,"cx",e(s).x),M(A,"cy",e(s).y)}),v(h,A)};L(c,h=>{e(s).count>0&&h(k)})}v(r,i)}),t(be),t(_e);var D=n(_e,2);Q(D,21,()=>me,pe,(r,s)=>{var i=ct(),c=a(i,!0);t(i),y(()=>u(c,e(s))),v(r,i)}),t(D);var W=n(D,2);Q(W,21,()=>e(j),r=>r.key,(r,s)=>{const i=S(()=>Z(e(s)));var c=gt(),k=a(c),h=a(k),A=a(h),he=a(A,!0);t(A);var de=n(A,2);{var ae=b=>{var l=ut(),C=a(l,!0);t(l),y(X=>u(C,X),[()=>e(s).date.toLocaleDateString(void 0,{month:"short"})]),v(b,l)},le=S(()=>e(s).date.getDate()===1);L(de,b=>{e(le)&&b(ae)})}t(h);var ve=n(h,2);{var se=b=>{var l=xt(),C=a(l),X=a(C,!0);t(C);var G=n(C,2);{var U=z=>{var J=pt(),V=a(J);t(J),y(ye=>u(V,`${ye??""}%`),[()=>(e(s).avgRetention*100).toFixed(0)]),v(z,J)};L(G,z=>{e(s).avgRetention>0&&z(U)})}t(l),y(()=>{Re(C,`color: ${e(i).text??""}`),u(X,e(s).memories.length)}),v(b,l)};L(ve,b=>{e(s).memories.length>0&&b(se)})}t(k),t(c),y((b,l)=>{c.disabled=e(s).memories.length===0,Fe(c,1,`relative aspect-square rounded-lg p-2 text-left transition-all duration-200 + ${e(s).inWindow?"opacity-100":"opacity-35"} + ${e(s).memories.length>0?"hover:scale-[1.03] cursor-pointer":"cursor-default"} + ${e(s).isToday?"ring-2 ring-synapse/60 shadow-[0_0_16px_rgba(99,102,241,0.3)]":""} + ${e(B)===e(s).key?"ring-2 ring-dream/60 shadow-[0_0_16px_rgba(168,85,247,0.3)]":""}`),Re(c,`background: ${e(i).bg??""}; border: 1px solid ${e(i).border??""};`),M(c,"title",b),Fe(A,1,`text-[10px] font-mono ${e(s).isToday?"text-synapse-glow font-bold":"text-dim"}`),u(he,l)},[()=>`${fe(e(s).date)} — ${e(s).memories.length} due`,()=>e(s).date.getDate()]),Ae("click",c,()=>H(e(s).key)),v(r,c)}),t(W);var q=n(W,4);{var te=r=>{var s=ht(),i=a(s),c=a(i),k=a(c),h=a(k,!0);t(k);var A=n(k,2),he=a(A);t(A),t(c);var de=n(c,2);t(i);var ae=n(i,2),le=a(ae);Q(le,17,()=>e(w).memories.slice(0,100),b=>b.id,(b,l)=>{var C=_t(),X=a(C),G=n(X,2),U=a(G),z=a(U,!0);t(U);var J=n(U,2),V=a(J),ye=a(V,!0);t(V);var Se=n(V,2);{var Ce=R=>{var F=mt(),O=a(F);t(F),y(()=>u(O,`· ${e(l).reviewCount??""} review${e(l).reviewCount===1?"":"s"}`)),v(R,F)};L(Se,R=>{e(l).reviewCount!==void 0&&R(Ce)})}var je=n(Se,2);Q(je,17,()=>e(l).tags.slice(0,2),pe,(R,F)=>{var O=ft(),De=a(O,!0);t(O),y(()=>u(De,e(F))),v(R,O)}),t(J),t(G);var $=n(G,2),T=a($),re=a(T);t(T);var ce=n(T,2),Me=a(ce);t(ce),t($),t(C),y(R=>{Re(X,`background: ${(rt[e(l).nodeType]||"#8B95A5")??""}`),u(z,e(l).content),u(ye,e(l).nodeType),Re(re,`width: ${e(l).retentionStrength*100}%; background: ${e(l).retentionStrength>.7?"var(--color-recall)":e(l).retentionStrength>.4?"var(--color-warning)":"var(--color-decay)"}`),u(Me,`${R??""}%`)},[()=>(e(l).retentionStrength*100).toFixed(0)]),v(b,C)});var ve=n(le,2);{var se=b=>{var l=bt(),C=a(l);t(l),y(()=>u(C,`+${e(w).memories.length-100} more`)),v(b,l)};L(ve,b=>{e(w).memories.length>100&&b(se)})}t(ae),t(s),y((b,l)=>{u(h,b),u(he,`${e(w).memories.length??""} memor${e(w).memories.length===1?"y":"ies"} due + · avg retention ${l??""}%`)},[()=>fe(e(w).date),()=>(e(w).avgRetention*100).toFixed(0)]),Ae("click",de,()=>I(B,null)),v(r,s)};L(q,r=>{e(w)&&e(w).memories.length>0&&r(te)})}t(ne),v(p,ne),qe()}Ue(["click"]);var kt=m(''),$t=m('
                '),St=m('
                '),Dt=m('
                '),Tt=m('
                '),Rt=m('

                API unavailable.

                Could not fetch memories from /api/memories.

                '),At=m(`

                FSRS review schedule not yet populated.

                nextReviewAt timestamp yet. Run consolidation to compute + next-review dates via FSRS-6.

                `),Ft=m('
                Overdue
                '),Nt=m('

                Nothing in this window.

                '),Ct=m('

                '),jt=m('

                '),Mt=m('
                '),Lt=m('
                '),Wt=m('

                Review Schedule

                FSRS-6 next-review dates across your memory corpus

                ');function Gt(p,o){Ye(o,!0);let f=ue(et([])),N=ue(0),P=ue(!0),E=ue(!1),j=ue("week");const Z=2e3;async function B(){const d=await Ee.memories.list({limit:String(Z)});I(f,d.memories,!0),I(N,d.total,!0)}Ve(async()=>{try{await B()}catch{I(E,!0),I(f,[],!0)}finally{I(P,!1)}});let w=S(()=>e(f).filter(d=>!!d.nextReviewAt)),H=S(()=>new Date),K=S(()=>e(N)>e(f).length),_=S(()=>(()=>{const d=e(j);return d==="all"?e(w):e(w).filter(x=>{const g=He(e(H),x.nextReviewAt);if(g==="none")return!1;if(d==="today")return g==="overdue"||g==="today";if(d==="week")return g!=="future";const D=Ke(e(H),x.nextReviewAt);return D!==null&&D<=30})})()),Y=S(()=>ot(e(H),e(w)));async function ke(){I(P,!0);try{await Ee.consolidate(),await B(),I(E,!1)}catch{I(E,!0)}finally{I(P,!1)}}const ge=[{key:"today",label:"Due today"},{key:"week",label:"This week"},{key:"month",label:"This month"},{key:"all",label:"All upcoming"}];var ee=Wt(),me=a(ee),fe=n(a(me),2);Q(fe,21,()=>ge,pe,(d,x)=>{var g=kt(),D=a(g,!0);t(g),y(()=>{Fe(g,1,`px-3 py-1.5 text-xs rounded-lg transition-all + ${e(j)===e(x).key?"bg-synapse/20 text-synapse-glow border border-synapse/30":"text-dim hover:text-text hover:bg-white/[0.03] border border-transparent"}`),u(D,e(x).label)}),Ae("click",g,()=>I(j,e(x).key,!0)),v(d,g)}),t(fe),t(me);var ne=n(me,2);{var _e=d=>{var x=$t(),g=a(x);t(x),y((D,W)=>u(g,`Showing the first ${D??""} of ${W??""} memories. + Schedule reflects this slice only.`),[()=>e(f).length.toLocaleString(),()=>e(N).toLocaleString()]),v(d,x)};L(ne,d=>{!e(P)&&!e(E)&&e(K)&&d(_e)})}var be=n(ne,2);{var ie=d=>{var x=Tt(),g=a(x),D=n(a(g),2);Q(D,20,()=>Array(42),pe,(q,te)=>{var r=St();v(q,r)}),t(D),t(g);var W=n(g,2);Q(W,20,()=>Array(5),pe,(q,te)=>{var r=Dt();v(q,r)}),t(W),t(x),v(d,x)},oe=d=>{var x=Rt();v(d,x)},$e=d=>{var x=At(),g=n(a(x),4),D=a(g);tt(2),t(g);var W=n(g,2);t(x),y(()=>u(D,`None of your ${e(f).length??""} memor${e(f).length===1?"y has":"ies have"} a `)),Ae("click",W,ke),v(d,x)},Ne=d=>{var x=Lt(),g=a(x),D=a(g);wt(D,{get memories(){return e(w)}}),t(g);var W=n(g,2),q=a(W),te=n(a(q),2),r=a(te);{var s=$=>{var T=Ft(),re=n(a(T),2),ce=a(re,!0);t(re),t(T),y(()=>u(ce,e(Y).overdue)),v($,T)};L(r,$=>{e(Y).overdue>0&&$(s)})}var i=n(r,2),c=n(a(i),2),k=a(c,!0);t(c),t(i);var h=n(i,2),A=n(a(h),2),he=a(A,!0);t(A),t(h);var de=n(h,2),ae=n(a(de),2),le=a(ae,!0);t(ae),t(de),t(te);var ve=n(te,2),se=a(ve),b=n(a(se),2),l=a(b,!0);t(b),t(se);var C=n(se,2),X=a(C);t(C),t(ve),t(q);var G=n(q,2),U=a(G),z=a(U),J=a(z,!0);t(z);var V=n(z,2),ye=a(V,!0);t(V),t(U);var Se=n(U,2);{var Ce=$=>{var T=Nt();v($,T)},je=$=>{var T=Mt(),re=a(T);Q(re,17,()=>e(_).slice().sort((R,F)=>(R.nextReviewAt??"").localeCompare(F.nextReviewAt??"")).slice(0,50),R=>R.id,(R,F)=>{const O=S(()=>He(e(H),e(F).nextReviewAt)),De=S(()=>Ke(e(H),e(F).nextReviewAt)??0);var Le=Ct(),We=a(Le),Qe=a(We,!0);t(We);var Ie=n(We,2),Te=a(Ie),Xe=a(Te,!0);t(Te);var Pe=n(Te,2),Ge=a(Pe);t(Pe),t(Ie),t(Le),y(Je=>{u(Qe,e(F).content),Fe(Te,1,e(O)==="overdue"?"text-decay":e(O)==="today"?"text-warning":e(O)==="week"?"text-synapse-glow":"text-dream-glow"),u(Xe,e(O)==="overdue"?`${-e(De)}d overdue`:e(O)==="today"?"today":`in ${e(De)}d`),u(Ge,`· ${Je??""}%`)},[()=>(e(F).retentionStrength*100).toFixed(0)]),v(R,Le)});var ce=n(re,2);{var Me=R=>{var F=jt(),O=a(F);t(F),y(()=>u(O,`+${e(_).length-50} more`)),v(R,F)};L(ce,R=>{e(_).length>50&&R(Me)})}t(T),v($,T)};L(Se,$=>{e(_).length===0?$(Ce):$(je,!1)})}t(G),t(W),t(x),y(($,T)=>{u(k,e(Y).dueToday),u(he,e(Y).dueThisWeek),u(le,e(Y).dueThisMonth),u(l,$),u(X,`Across ${e(w).length??""} scheduled memor${e(w).length===1?"y":"ies"}`),u(J,T),u(ye,e(_).length)},[()=>e(Y).avgDays.toFixed(1),()=>{var $;return($=ge.find(T=>T.key===e(j)))==null?void 0:$.label}]),v(d,x)};L(be,d=>{e(P)?d(ie):e(E)?d(oe,1):e(w).length===0?d($e,2):d(Ne,!1)})}t(ee),v(p,ee),qe()}Ue(["click"]);export{Gt as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/16.DeYkCVEo.js.br b/apps/dashboard/build/_app/immutable/nodes/16.DeYkCVEo.js.br new file mode 100644 index 0000000..0532b0e Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/16.DeYkCVEo.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/16.DeYkCVEo.js.gz b/apps/dashboard/build/_app/immutable/nodes/16.DeYkCVEo.js.gz new file mode 100644 index 0000000..ef22a5f Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/16.DeYkCVEo.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/17.3ASmJvJ6.js b/apps/dashboard/build/_app/immutable/nodes/17.3ASmJvJ6.js deleted file mode 100644 index deea646..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/17.3ASmJvJ6.js +++ /dev/null @@ -1,2 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{o as Gt}from"../chunks/TZu9D97Z.js";import{p as tt,e as s,g as e,h as a,r as t,n as Z,t as C,a as g,b as st,j as f,u as re,s as he,d as Ht,x as Wt,i as L,ar as Kt,f as ft,au as wt}from"../chunks/wpu9U-D0.js";import{s as o,d as Vt,a as Ye}from"../chunks/D8mhvFt8.js";import{i as D}from"../chunks/DKve45Wd.js";import{e as ce,s as at,a as Y,r as Qt,i as Ae}from"../chunks/60_R_Vbt.js";import{h as Ut}from"../chunks/DzesjbbJ.js";import{a as Xe,r as Yt}from"../chunks/P1-U_Xsj.js";import{s as w}from"../chunks/EqHb-9AZ.js";import{b as Xt}from"../chunks/CnZzd20v.js";import{b as _t}from"../chunks/g5OnrUYZ.js";import{a as Zt}from"../chunks/CZfHMhLI.js";import{p as ue}from"../chunks/ByYB047u.js";import{N as Jt}from"../chunks/CcUbQ_Wl.js";import{P as es}from"../chunks/BHDZZvku.js";import{I as be}from"../chunks/D7A-gG4Z.js";import{A as Ze}from"../chunks/DcKTNC6e.js";import{m as ts,s as ss}from"../chunks/DPdYG9yN.js";var as=f('
                '),ns=f('

                '),rs=f("
                ");function yt(l,v){tt(v,!0);let J=ue(v,"intent",3,"Synthesis"),B=ue(v,"memoriesAnalyzed",3,0),R=ue(v,"evidenceCount",3,0),i=ue(v,"contradictionCount",3,0),G=ue(v,"supersededCount",3,0),E=ue(v,"running",3,!1),H=ue(v,"stageHints",19,()=>({}));const I=[{key:"broad",icon:"◎",label:"Broad Retrieval",base:"Hybrid BM25 + semantic (3x overfetch) then cross-encoder rerank"},{key:"spreading",icon:"⟿",label:"Spreading Activation",base:"Collins & Loftus — expand via graph edges to surface what search missed"},{key:"fsrs",icon:"▲",label:"FSRS Trust Scoring",base:"retention × stability × reps ÷ lapses — which memories have earned trust"},{key:"intent",icon:"◆",label:"Intent Classification",base:"FactCheck / Timeline / RootCause / Comparison / Synthesis"},{key:"supersession",icon:"↗",label:"Temporal Supersession",base:"Newer high-trust memories replace older ones on the same fact"},{key:"contradiction",icon:"⚡",label:"Contradiction Analysis",base:"Only flag conflicts between memories where BOTH have trust > 0.3"},{key:"relation",icon:"⬡",label:"Relation Assessment",base:"Per pair: Supports / Contradicts / Supersedes / Irrelevant"},{key:"template",icon:"❖",label:"Template Reasoning",base:"Build the natural-language reasoning chain you validate"}],ee=re(()=>({broad:B()?`Analyzed ${B()} memories · ${R()} survived ranking`:void 0,intent:J()?`Classified as ${J()}`:void 0,supersession:G()?`${G()} outdated memor${G()===1?"y":"ies"} superseded`:void 0,contradiction:i()?`${i()} real conflict${i()===1?"":"s"} between trusted memories`:"No conflicts between trusted memories"}));function te($,K){return H()[$]??e(ee)[$]??K}var W=rs();let qe;ce(W,23,()=>I,$=>$.key,($,K,V)=>{var O=ns(),se=s(O);{var pe=N=>{var oe=as();C(()=>w(oe,`animation-delay: ${e(V)*140+120}ms;`)),g(N,oe)};D(se,N=>{e(V){w(O,`animation-delay: ${e(V)*140}ms;`),w(M,`animation-delay: ${e(V)*140}ms;`),o(me,e(K).icon),o(Ee,`0${e(V)+1}`),o(we,e(K).label),o(ne,N)},[()=>te(e(K).key,e(K).base)]),g($,O)}),t(W),C(()=>qe=at(W,1,"reasoning-chain space-y-2 svelte-9hm057",null,qe,{running:E()})),g(l,W),st()}const is="#10b981",ls="#f59e0b",et="#ef4444",ht="#8B95A5",bt={primary:{label:"Primary",accent:"synapse",icon:"◈"},supporting:{label:"Supporting",accent:"recall",icon:"◇"},contradicting:{label:"Contradicting",accent:"decay",icon:"⚠"},superseded:{label:"Superseded",accent:"muted",icon:"⊘"}};function os(l){return bt[l]??bt.supporting}function Oe(l){return Number.isFinite(l)?l>75?is:l>=40?ls:et:et}function qt(l){return Number.isFinite(l)?l>75?"HIGH CONFIDENCE":l>=40?"MIXED SIGNAL":"LOW CONFIDENCE":"LOW CONFIDENCE"}function Je(l){return Number.isFinite(l)?Oe(l*100):et}function vs(l){return!Number.isFinite(l)||l<0?0:l>1?1:l}function ds(l){return vs(l)*100}function cs(l){return l?Jt[l]??ht:ht}function us(l,v){if(l==null||typeof l!="string"||l.trim()==="")return"—";const J=new Date(l);if(Number.isNaN(J.getTime()))return l;try{return J.toLocaleDateString(v,{month:"short",day:"numeric",year:"numeric"})}catch{return l}}function ps(l,v=8){return l?l.length>v?l.slice(0,v):l:""}var ms=f(' '),xs=f('

                Trust
                FSRS · reps × retention
                ');function gs(l,v){tt(v,!0);let J=ue(v,"index",3,0);const B=re(()=>ds(v.trust)),R=re(()=>os(v.role)),i=re(()=>ps(v.id)),G=re(()=>cs(v.nodeType));var E=xs();let H;var I=s(E),ee=s(I),te=s(ee),W=s(te),qe=s(W,!0);t(W);var $=a(W,1,!0);t(te);var K=a(te,2);{var V=ne=>{var N=ms(),oe=s(N,!0);t(N),C(()=>{w(N,`color: ${e(G)??""}`),o(oe,v.nodeType)}),g(ne,N)};D(K,ne=>{v.nodeType&&ne(V)})}t(ee);var O=a(ee,2),se=s(O);t(O),t(I);var pe=a(I,2),M=s(pe,!0);t(pe);var P=a(pe,2),me=s(P),ie=a(s(me),2),xe=s(ie);t(ie),t(me);var ae=a(me,2),Ee=s(ae);t(ae),t(P);var le=a(P,2),we=s(le),ge=s(we,!0);t(we),Z(2),t(le),t(E),C((ne,N,oe,r,n)=>{H=at(E,1,"evidence-card glass rounded-xl p-4 space-y-3 transition relative svelte-ksja6x",null,H,{contradicting:v.role==="contradicting",primary:v.role==="primary",superseded:v.role==="superseded"}),w(E,`animation-delay: ${J()*80}ms;`),Y(E,"data-evidence-id",v.id),o(qe,e(R).icon),o($,e(R).label),Y(O,"title",v.id),o(se,`#${e(i)??""}`),o(M,v.preview),w(ie,`color: ${ne??""}`),o(xe,`${N??""}%`),w(Ee,`width: ${e(B)??""}%; background: ${oe??""}; box-shadow: 0 0 8px ${r??""}80;`),o(ge,n)},[()=>Je(v.trust),()=>e(B).toFixed(0),()=>Je(v.trust),()=>Je(v.trust),()=>us(v.date)]),g(l,E),st()}var fs=f(' deep_reference'),_s=f(''),ys=f('
                Try
                '),hs=f('
                Error:
                '),bs=f('
                Running cognitive pipeline
                '),qs=f('

                Reasoning

                intent: · analyzed ·
                '),ws=wt('',1),ks=wt(''),Ss=f('

                '),Cs=f('

                Contradictions Detected ()

                '),Rs=f('
                '),As=f('

                Superseded

                '),Es=f('
                '),Ns=f('

                Evolution

                '),Ts=f('

                '),js=f('

                Related Insights

                '),Fs=f('
                Confidence
                %
                intent: ·
                Primary Source

                ·

                Cognitive Pipeline

                Evidence

                primary supporting contradicting superseded
                ',1),zs=f(`

                Ask anything. Vestige will run the full reasoning pipeline and show you its work.

                8-stage pipeline: retrieval → rerank → activation → trust-score → supersession → - contradiction → relations → chain. Zero LLM calls, 100% local.

                `),Ls=f('
                ');function ea(l,v){tt(v,!0);async function J(r){var je,$e,Fe;const n=await Zt.deepReference(r,20),k=(Array.isArray(n.evidence)?n.evidence:[]).map(c=>{const j=typeof c.trust=="number"?c.trust:0,ze=j>1?j/100:j,Le=c.role||"supporting";return{id:String(c.id??""),trust:Math.max(0,Math.min(1,ze)),date:String(c.date??""),role:Le,preview:String(c.preview??""),nodeType:c.node_type?String(c.node_type):c.nodeType?String(c.nodeType):void 0}}),_=n.recommended,T={answer_preview:String((_==null?void 0:_.answer_preview)??((je=k[0])==null?void 0:je.preview)??""),memory_id:String((_==null?void 0:_.memory_id)??(($e=k[0])==null?void 0:$e.id)??""),trust_score:(()=>{var j;const c=_==null?void 0:_.trust_score;return typeof c=="number"?c>1?c/100:c:((j=k[0])==null?void 0:j.trust)??0})(),date:String((_==null?void 0:_.date)??((Fe=k[0])==null?void 0:Fe.date)??"")},ke=(Array.isArray(n.contradictions)?n.contradictions:[]).map(c=>({a_id:String(c.a_id??""),b_id:String(c.b_id??""),summary:String(c.summary??c.reason??"Trust-weighted conflict between high-FSRS memories.")})),Ne=(Array.isArray(n.superseded)?n.superseded:[]).map(c=>({old_id:String(c.old_id??""),new_id:String(c.new_id??T.memory_id??""),reason:String(c.reason??"Superseded by newer memory with higher FSRS trust.")})),Se=(Array.isArray(n.evolution)?n.evolution:[]).map(c=>({date:String(c.date??""),summary:String(c.summary??c.preview??""),trust:(()=>{const j=c.trust;return typeof j=="number"?j>1?j/100:j:0})()})),Me=Array.isArray(n.related_insights)?n.related_insights:[],fe=typeof n.confidence=="number"?n.confidence:0,_e=fe>1?Math.round(fe):Math.round(fe*100),Pe=String(n.intent??"Synthesis"),Ie=String(n.reasoning??n.guidance??""),Te=typeof n.memoriesAnalyzed=="number"?n.memoriesAnalyzed:k.length;return{intent:Pe,reasoning:Ie,recommended:T,evidence:k,contradictions:ke,superseded:Ne,evolution:Se,related_insights:Me,confidence:_e,memoriesAnalyzed:Te}}let B=he(""),R=he(!1),i=he(null),G=he(null),E=he(null),H=he(null),I=he(Ht([]));async function ee(){const r=e(B).trim();if(!(!r||e(R))){L(R,!0),L(G,null),L(i,null),L(I,[],!0);try{L(i,await J(r),!0),requestAnimationFrame(()=>requestAnimationFrame(te))}catch(n){L(G,n instanceof Error?n.message:"Unknown error",!0)}finally{L(R,!1)}}}function te(){if(!e(i)||!e(H)||e(i).contradictions.length===0){L(I,[],!0);return}const r=e(H).getBoundingClientRect(),n=[];for(const p of e(i).contradictions){const k=e(H).querySelector(`[data-evidence-id="${p.a_id}"]`),_=e(H).querySelector(`[data-evidence-id="${p.b_id}"]`);if(!k||!_)continue;const T=k.getBoundingClientRect(),Q=_.getBoundingClientRect();n.push({x1:T.left-r.left+T.width/2,y1:T.top-r.top+T.height/2,x2:Q.left-r.left+Q.width/2,y2:Q.top-r.top+Q.height/2})}L(I,n,!0)}function W(r){var n,p;(r.metaKey||r.ctrlKey)&&r.key.toLowerCase()==="k"&&(r.preventDefault(),(n=e(E))==null||n.focus(),(p=e(E))==null||p.select())}Gt(()=>{var r;return(r=e(E))==null||r.focus(),window.addEventListener("keydown",W),window.addEventListener("resize",te),()=>{window.removeEventListener("keydown",W),window.removeEventListener("resize",te)}});const qe=["What port does the dev server use?","Should I enable prefix caching with vLLM?","Why did the benchmark score drop after the parser change?","How does FSRS-6 trust scoring work?"];var $=Ls();Ut("q2v96u",r=>{Wt(()=>{Kt.title="Reasoning Theater · Vestige"})});var K=s($);es(K,{icon:"reasoning",title:"Reasoning Theater",subtitle:"Watch Vestige reason — the 8-stage cognitive pipeline runs locally and returns a pre-built answer with trust-scored evidence.",accent:"dream",children:(r,n)=>{var p=fs();g(r,p)},$$slots:{default:!0}});var V=a(K,2),O=s(V),se=s(O),pe=s(se);be(pe,{name:"reasoning",size:20}),t(se);var M=a(se,2);Qt(M),_t(M,r=>L(E,r),()=>e(E));var P=a(M,4),me=s(P,!0);t(P),Xe(P,r=>{var n;return(n=ts)==null?void 0:n(r)}),t(O);var ie=a(O,2);{var xe=r=>{var n=ys(),p=a(s(n),2);ce(p,17,()=>qe,Ae,(k,_)=>{var T=_s(),Q=s(T,!0);t(T),C(()=>o(Q,e(_))),Ye("click",T,()=>{L(B,e(_),!0),ee()}),g(k,T)}),t(n),g(r,n)};D(ie,r=>{!e(i)&&!e(R)&&r(xe)})}t(V);var ae=a(V,2);{var Ee=r=>{var n=hs(),p=a(s(n));t(n),C(()=>o(p,` ${e(G)??""}`)),g(r,n)};D(ae,r=>{e(G)&&r(Ee)})}var le=a(ae,2);{var we=r=>{var n=bs(),p=a(s(n),2);yt(p,{running:!0}),t(n),g(r,n)};D(le,r=>{e(R)&&r(we)})}var ge=a(le,2);{var ne=r=>{const n=re(()=>e(i).confidence),p=re(()=>Oe(e(n)));var k=Fs(),_=ft(k);{var T=u=>{var d=qs(),x=s(d),y=s(x),m=s(y),h=s(m);be(h,{name:"reasoning",size:16}),t(m),Z(),t(y);var F=a(y,2),S=s(F),b=a(s(S)),q=s(b,!0);t(b),t(S);var z=a(S,4),A=s(z);Ze(A,{get value(){return e(i).memoriesAnalyzed}}),Z(),t(z);var U=a(z,4),ve=s(U);t(U),t(F),t(x);var X=a(x,2),Ce=s(X),Re=s(Ce,!0);t(Ce),t(X),Xe(X,ye=>{var de;return(de=ss)==null?void 0:de(ye)}),t(d),Xe(d,ye=>{var de;return(de=Yt)==null?void 0:de(ye)}),C(ye=>{o(q,e(i).intent),w(U,`color: ${e(p)??""}`),o(ve,`${e(n)??""}% ${ye??""}`),w(X,`box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.03), 0 0 32px ${e(p)??""}20, 0 8px 32px rgba(0,0,0,0.4); border-color: ${e(p)??""}35;`),o(Re,e(i).reasoning)},[()=>qt(e(n))]),g(u,d)};D(_,u=>{e(i).reasoning&&u(T)})}var Q=a(_,2),ke=s(Q),De=a(s(ke),2),Ne=s(De),nt=s(Ne);Ze(nt,{get value(){return e(n)}}),Z(),t(Ne),t(De);var Se=a(De,2),Me=s(Se,!0);t(Se);var fe=a(Se,2),_e=a(s(fe)),Pe=s(_e);t(_e),t(fe);var Ie=a(fe,2),Te=s(Ie),je=a(s(Te)),$e=s(je,!0);t(je),t(Te);var Fe=a(Te,4),c=s(Fe);t(Fe),t(Ie),t(ke);var j=a(ke,2),ze=s(j),Le=a(s(ze),2),kt=s(Le);t(Le),t(ze);var Be=a(ze,2),St=s(Be,!0);t(Be);var rt=a(Be,2),Ge=s(rt),it=s(Ge),Ct=a(it);t(Ge);var lt=a(Ge,4),Rt=s(lt,!0);t(lt),t(rt),t(j),t(Q);var He=a(Q,2),We=s(He),ot=s(We),At=s(ot);be(At,{name:"activation",size:15}),t(ot),Z(),t(We);var vt=a(We,2),Et=s(vt);yt(Et,{get intent(){return e(i).intent},get memoriesAnalyzed(){return e(i).memoriesAnalyzed},get evidenceCount(){return e(i).evidence.length},get contradictionCount(){return e(i).contradictions.length},get supersededCount(){return e(i).superseded.length}}),t(vt),t(He);var Ke=a(He,2),Ve=s(Ke),dt=s(Ve),Qe=s(dt),Nt=s(Qe);be(Nt,{name:"memories",size:15}),t(Qe);var ct=a(Qe,2),Tt=s(ct);t(ct),t(dt),Z(2),t(Ve);var Ue=a(Ve,2),ut=s(Ue);ce(ut,19,()=>e(i).evidence,u=>u.id,(u,d,x)=>{gs(u,{get id(){return e(d).id},get trust(){return e(d).trust},get date(){return e(d).date},get role(){return e(d).role},get preview(){return e(d).preview},get nodeType(){return e(d).nodeType},get index(){return e(x)}})});var jt=a(ut,2);{var Ft=u=>{var d=ks(),x=a(s(d));ce(x,17,()=>e(I),Ae,(y,m,h)=>{const F=re(()=>(e(m).x1+e(m).x2)/2),S=re(()=>Math.min(e(m).y1,e(m).y2)-28);var b=ws(),q=ft(b);w(q,`animation-delay: ${h*120+600}ms;`);var z=a(q);w(z,`animation-delay: ${h*120+600}ms;`);var A=a(z);w(A,`animation-delay: ${h*120+700}ms;`),C(()=>{Y(q,"d",`M ${e(m).x1??""} ${e(m).y1??""} Q ${e(F)??""} ${e(S)??""} ${e(m).x2??""} ${e(m).y2??""}`),Y(z,"cx",e(m).x1),Y(z,"cy",e(m).y1),Y(A,"cx",e(m).x2),Y(A,"cy",e(m).y2)}),g(y,b)}),t(d),g(u,d)};D(jt,u=>{e(I).length>0&&u(Ft)})}t(Ue),_t(Ue,u=>L(H,u),()=>e(H)),t(Ke);var pt=a(Ke,2);{var zt=u=>{var d=Cs(),x=s(d),y=s(x),m=s(y);be(m,{name:"contradictions",size:15}),t(y);var h=a(y,2),F=a(s(h));Ze(F,{get value(){return e(i).contradictions.length}}),Z(),t(h),t(x);var S=a(x,2);ce(S,21,()=>e(i).contradictions,Ae,(b,q,z)=>{var A=Ss(),U=a(s(A),2),ve=s(U),X=s(ve),Ce=s(X);t(X);var Re=a(X,4),ye=s(Re);t(Re),t(ve);var de=a(ve,2),Ot=s(de,!0);t(de),t(U);var Mt=a(U,2);Mt.textContent=`pair ${z+1}`,t(A),C((Pt,Bt)=>{o(Ce,`#${Pt??""}`),o(ye,`#${Bt??""}`),o(Ot,e(q).summary)},[()=>e(q).a_id.slice(0,8),()=>e(q).b_id.slice(0,8)]),g(b,A)}),t(S),t(d),g(u,d)};D(pt,u=>{e(i).contradictions.length>0&&u(zt)})}var mt=a(pt,2);{var Lt=u=>{var d=As(),x=s(d),y=a(s(x),2),m=s(y);t(y),t(x);var h=a(x,2);ce(h,21,()=>e(i).superseded,Ae,(F,S)=>{var b=Rs(),q=s(b),z=s(q);t(q);var A=a(q,4),U=s(A);t(A);var ve=a(A,2),X=s(ve,!0);t(ve),t(b),C((Ce,Re)=>{o(z,`#${Ce??""}`),o(U,`#${Re??""}`),o(X,e(S).reason)},[()=>e(S).old_id.slice(0,8),()=>e(S).new_id.slice(0,8)]),g(F,b)}),t(h),t(d),C(()=>o(m,`(${e(i).superseded.length??""})`)),g(u,d)};D(mt,u=>{e(i).superseded.length>0&&u(Lt)})}var xt=a(mt,2),gt=s(xt);{var Dt=u=>{var d=Ns(),x=a(s(d),2);ce(x,21,()=>e(i).evolution,Ae,(y,m)=>{var h=Es(),F=s(h),S=s(F,!0);t(F);var b=a(F,2),q=a(b,2),z=s(q,!0);t(q),t(h),C((A,U)=>{o(S,A),w(b,`background: ${U??""}`),o(z,e(m).summary)},[()=>new Date(e(m).date).toLocaleDateString(void 0,{month:"short",day:"numeric"}),()=>Oe(e(m).trust*100)]),g(y,h)}),t(x),t(d),g(u,d)};D(gt,u=>{e(i).evolution.length>0&&u(Dt)})}var It=a(gt,2);{var $t=u=>{var d=js(),x=s(d),y=s(x),m=s(y);be(m,{name:"sparkle",size:15}),t(y),Z(),t(x);var h=a(x,2);ce(h,21,()=>e(i).related_insights,Ae,(F,S)=>{var b=Ts(),q=a(s(b),1,!0);t(b),C(()=>o(q,e(S))),g(F,b)}),t(h),t(d),g(u,d)};D(It,u=>{e(i).related_insights.length>0&&u($t)})}t(xt),C((u,d,x,y,m)=>{w(ke,`box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.03), 0 0 32px ${e(p)??""}30, 0 8px 32px rgba(0,0,0,0.4); border-color: ${e(p)??""}40;`),w(Ne,`color: ${e(p)??""}; text-shadow: 0 0 24px ${e(p)??""}80;`),w(Se,`color: ${e(p)??""}`),o(Me,u),Y(_e,"width",e(n)/100*220),Y(_e,"fill",e(p)),w(_e,`filter: drop-shadow(0 0 6px ${e(p)??""});`),Y(Pe,"to",e(n)/100*220),o($e,e(i).intent),o(c,`${e(i).memoriesAnalyzed??""} analyzed`),Y(Le,"title",e(i).recommended.memory_id),o(kt,`#${d??""}`),o(St,e(i).recommended.answer_preview),w(it,`background: ${x??""}`),o(Ct,` Trust ${y??""}%`),o(Rt,m),o(Tt,`(${e(i).evidence.length??""})`)},[()=>qt(e(n)),()=>e(i).recommended.memory_id.slice(0,8),()=>Oe(e(i).recommended.trust_score*100),()=>(e(i).recommended.trust_score*100).toFixed(0),()=>new Date(e(i).recommended.date).toLocaleDateString()]),g(r,k)};D(ge,r=>{e(i)&&!e(R)&&r(ne)})}var N=a(ge,2);{var oe=r=>{var n=zs(),p=s(n),k=s(p);be(k,{name:"reasoning",size:44,strokeWidth:1.2}),t(p),Z(4),t(n),g(r,n)};D(N,r=>{!e(i)&&!e(R)&&!e(G)&&r(oe)})}t($),C(r=>{at(se,1,`text-synapse-glow ${e(R)?"breathe":""}`,"svelte-q2v96u"),P.disabled=r,o(me,e(R)?"Reasoning…":"Reason")},[()=>!e(B).trim()||e(R)]),Ye("keydown",M,r=>r.key==="Enter"&&ee()),Xt(M,()=>e(B),r=>L(B,r)),Ye("click",P,ee),g(l,$),st()}Vt(["keydown","click"]);export{ea as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/17.3ASmJvJ6.js.br b/apps/dashboard/build/_app/immutable/nodes/17.3ASmJvJ6.js.br deleted file mode 100644 index 0c90528..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/17.3ASmJvJ6.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/17.3ASmJvJ6.js.gz b/apps/dashboard/build/_app/immutable/nodes/17.3ASmJvJ6.js.gz deleted file mode 100644 index 93b7671..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/17.3ASmJvJ6.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/17.CLL0vjL4.js b/apps/dashboard/build/_app/immutable/nodes/17.CLL0vjL4.js new file mode 100644 index 0000000..3326654 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/17.CLL0vjL4.js @@ -0,0 +1,2 @@ +import"../chunks/Bzak7iHL.js";import{o as Qe}from"../chunks/GG5zm9kr.js";import{p as Xe,t as w,a as Ze,g as s,d as t,e as i,s as k,h as m,C as et,r as e,n as _,f as tt,u as P}from"../chunks/CpWkWWOo.js";import{d as st,a as E,s as p}from"../chunks/BlVfL1ME.js";import{i as u}from"../chunks/B4yTwGkE.js";import{e as se,i as ae}from"../chunks/CGEBXrjl.js";import{a as v,f as l,t as he}from"../chunks/CHOnp4oo.js";import{s as we}from"../chunks/aVbAZ-t7.js";import{s as ke}from"../chunks/Cx-f-Pzo.js";import{s as at,a as ie}from"../chunks/C6HuKgyx.js";import{a as F}from"../chunks/DNjM5a-l.js";import{w as it,m as dt,a as rt,i as ot}from"../chunks/MAY1QfFZ.js";import{f as nt}from"../chunks/BjdL4Pm2.js";var vt=l(' Running...',1),lt=l('
                Processed
                '),ct=l('
                Decayed
                '),xt=l('
                Embedded
                '),mt=l('
                '),pt=l(' Dreaming...',1),ut=l('
                '),ft=l('
                Insights Discovered:
                ',1),gt=l('
                Connections found:
                '),bt=l('
                Memories replayed:
                '),_t=l('
                '),yt=l('
                '),ht=l('
                '),wt=l('

                Retention Distribution

                '),kt=l('
                '),St=l(`

                Settings & System

                Memories
                Avg Retention
                WebSocket
                v2.1
                Vestige

                Cognitive Operations

                Pulse Toast Preview
                Fire a synthetic event sequence — useful for UI demos
                Birth Ritual Preview
                Inject a synthetic memory — switch to Graph to watch the orb fly in
                FSRS-6 Consolidation
                Apply spaced-repetition decay, regenerate embeddings, run maintenance
                Memory Dream Cycle
                Replay memories, discover hidden connections, synthesize insights

                Keyboard Shortcuts

                About

                V
                Vestige v2.1 "Nuclear Dashboard"
                Your AI's long-term memory system
                29 cognitive modules
                FSRS-6 spaced repetition
                Nomic Embed v1.5 (256d)
                Jina Reranker v1 Turbo
                USearch HNSW (20x FAISS)
                Local-first, zero cloud
                Built with Rust + Axum + SvelteKit 2 + Svelte 5 + Three.js + Tailwind CSS 4
                `);function It(Se,Ce){Xe(Ce,!0);const De=()=>ie(dt,"$memoryCount",B),N=()=>ie(rt,"$avgRetention",B),de=()=>ie(ot,"$isConnected",B),[B,$e]=at(),re=["fact","concept","pattern","decision","person","place"];let K=k(0);function Re(){const a=re[s(K)%re.length];et(K),it.injectEvent({type:"MemoryCreated",data:{id:`demo-birth-${Date.now()}`,content:`Demo memory #${s(K)} — ${a}`,node_type:a,tags:["demo","v2.3-birth-ritual"],retention:.9}})}let T=k(!1),R=k(!1),y=k(null),f=k(null),Ae=k(null),$=k(null),oe=k(!0),Ge=k(null);Qe(()=>{O()});async function O(){m(oe,!0);try{const[a,d,c]=await Promise.all([F.stats().catch(()=>null),F.health().catch(()=>null),F.retentionDistribution().catch(()=>null)]);m(Ae,a,!0),m(Ge,d,!0),m($,c,!0)}finally{m(oe,!1)}}async function je(){m(T,!0),m(y,null);try{m(y,await F.consolidate(),!0),await O()}catch{}finally{m(T,!1)}}async function Me(){m(R,!0),m(f,null);try{m(f,await F.dream(),!0),await O()}catch{}finally{m(R,!1)}}var V=St(),q=t(V),Pe=i(t(q),2);e(q);var z=i(q,2),J=t(z),ne=t(J),Ee=t(ne,!0);e(ne),_(2),e(J);var U=i(J,2),W=t(U),Fe=t(W);e(W),_(2),e(U);var ve=i(U,2),le=t(ve),ce=t(le),xe=i(ce,2),Te=t(xe,!0);e(xe),e(le),_(2),e(ve),_(2),e(z);var Y=i(z,2),H=i(t(Y),2),me=t(H),Oe=i(t(me),2);e(me),e(H);var L=i(H,2),pe=t(L),Ie=i(t(pe),2);e(pe),e(L);var Q=i(L,2),X=t(Q),I=i(t(X),2),Ne=t(I);{var Be=a=>{var d=vt();_(),v(a,d)},Ke=a=>{var d=he("Consolidate");v(a,d)};u(Ne,a=>{s(T)?a(Be):a(Ke,!1)})}e(I),e(X);var Ve=i(X,2);{var qe=a=>{var d=mt(),c=t(d),g=t(c);{var S=o=>{var r=lt(),n=t(r),x=t(n,!0);e(n),_(2),e(r),w(()=>p(x,s(y).nodesProcessed)),v(o,r)};u(g,o=>{s(y).nodesProcessed!==void 0&&o(S)})}var b=i(g,2);{var h=o=>{var r=ct(),n=t(r),x=t(n,!0);e(n),_(2),e(r),w(()=>p(x,s(y).decayApplied)),v(o,r)};u(b,o=>{s(y).decayApplied!==void 0&&o(h)})}var C=i(b,2);{var G=o=>{var r=xt(),n=t(r),x=t(n,!0);e(n),_(2),e(r),w(()=>p(x,s(y).embeddingsGenerated)),v(o,r)};u(C,o=>{s(y).embeddingsGenerated!==void 0&&o(G)})}e(c),e(d),v(a,d)};u(Ve,a=>{s(y)&&a(qe)})}e(Q);var ue=i(Q,2),Z=t(ue),A=i(t(Z),2),ze=t(A);{var Je=a=>{var d=pt();_(),v(a,d)},Ue=a=>{var d=he("Dream");v(a,d)};u(ze,a=>{s(R)?a(Je):a(Ue,!1)})}e(A),e(Z);var We=i(Z,2);{var Ye=a=>{var d=_t(),c=t(d);{var g=o=>{var r=ft(),n=i(tt(r),2);se(n,17,()=>s(f).insights,ae,(x,j)=>{var D=ut(),M=t(D,!0);e(D),w(ee=>p(M,ee),[()=>typeof s(j)=="string"?s(j):JSON.stringify(s(j))]),v(x,D)}),v(o,r)},S=P(()=>s(f).insights&&Array.isArray(s(f).insights));u(c,o=>{s(S)&&o(g)})}var b=i(c,2);{var h=o=>{var r=gt(),n=i(t(r)),x=t(n,!0);e(n),e(r),w(()=>p(x,s(f).connections_found)),v(o,r)};u(b,o=>{s(f).connections_found!==void 0&&o(h)})}var C=i(b,2);{var G=o=>{var r=bt(),n=i(t(r)),x=t(n,!0);e(n),e(r),w(()=>p(x,s(f).memories_replayed)),v(o,r)};u(C,o=>{s(f).memories_replayed!==void 0&&o(G)})}e(d),v(a,d)};u(We,a=>{s(f)&&a(Ye)})}e(ue),e(Y);var fe=i(Y,2);{var He=a=>{var d=wt(),c=i(t(d),2),g=t(c);{var S=h=>{var C=ht();se(C,21,()=>s($).distribution,ae,(G,o,r)=>{const n=P(()=>Math.max(...s($).distribution.map(te=>te.count),1)),x=P(()=>s(o).count/s(n)*100),j=P(()=>r<2?"#ef4444":r<4?"#f59e0b":r<7?"#6366f1":"#10b981");var D=yt(),M=t(D),ee=t(M,!0);e(M);var ye=i(M,2),Le=i(ye,2);Le.textContent=`${r*10}%`,e(D),w(te=>{p(ee,s(o).count),ke(ye,`height: ${te??""}%; background: ${s(j)??""}; opacity: 0.7`)},[()=>Math.max(s(x),2)]),v(G,D)}),e(C),v(h,C)},b=P(()=>s($).distribution&&Array.isArray(s($).distribution));u(g,h=>{s(b)&&h(S)})}e(c),e(d),v(a,d)};u(fe,a=>{s($)&&a(He)})}var ge=i(fe,2),be=i(t(ge),2),_e=t(be);se(_e,20,()=>[{key:"⌘ K",desc:"Command palette"},{key:"/",desc:"Focus search"},{key:"G",desc:"Go to Graph"},{key:"M",desc:"Go to Memories"},{key:"T",desc:"Go to Timeline"},{key:"F",desc:"Go to Feed"},{key:"E",desc:"Go to Explore"},{key:"S",desc:"Go to Stats"}],ae,(a,d)=>{var c=kt(),g=t(c),S=t(g,!0);e(g);var b=i(g,2),h=t(b,!0);e(b),e(c),w(()=>{p(S,d.key),p(h,d.desc)}),v(a,c)}),e(_e),e(be),e(ge),_(2),e(V),w(a=>{p(Ee,De()),ke(W,`color: ${N()>.7?"#10b981":N()>.4?"#f59e0b":"#ef4444"}`),p(Fe,`${a??""}%`),we(ce,1,`w-2.5 h-2.5 rounded-full ${de()?"bg-recall animate-pulse-glow":"bg-decay"}`),p(Te,de()?"Online":"Offline"),I.disabled=s(T),A.disabled=s(R),we(A,1,`px-4 py-2 bg-dream/20 border border-dream/40 text-dream-glow text-sm rounded-xl hover:bg-dream/30 transition disabled:opacity-50 flex items-center gap-2 + ${s(R)?"glow-dream animate-pulse-glow":""}`)},[()=>(N()*100).toFixed(1)]),E("click",Pe,O),E("click",Oe,function(...a){var d;(d=nt)==null||d.apply(this,a)}),E("click",Ie,Re),E("click",I,je),E("click",A,Me),v(Se,V),Ze(),$e()}st(["click"]);export{It as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/17.CLL0vjL4.js.br b/apps/dashboard/build/_app/immutable/nodes/17.CLL0vjL4.js.br new file mode 100644 index 0000000..174b1e9 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/17.CLL0vjL4.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/17.CLL0vjL4.js.gz b/apps/dashboard/build/_app/immutable/nodes/17.CLL0vjL4.js.gz new file mode 100644 index 0000000..c42a40b Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/17.CLL0vjL4.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/18.43xZFMsD.js b/apps/dashboard/build/_app/immutable/nodes/18.43xZFMsD.js deleted file mode 100644 index 115f2f2..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/18.43xZFMsD.js +++ /dev/null @@ -1,8 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{o as tt}from"../chunks/TZu9D97Z.js";import{p as Ue,e as s,h as n,g as e,c as at,f as st,a as u,t as w,r as t,u as k,b as Qe,s as ue,i as W,j as g,au as Oe,d as rt,n as nt}from"../chunks/wpu9U-D0.js";import{d as Xe,s as p,a as Pe}from"../chunks/D8mhvFt8.js";import{i as N}from"../chunks/DKve45Wd.js";import{a as C,e as X,i as he,s as Ie}from"../chunks/60_R_Vbt.js";import{a as Ke}from"../chunks/CZfHMhLI.js";import{s as Ae}from"../chunks/EqHb-9AZ.js";import{p as it}from"../chunks/ByYB047u.js";import{N as ot}from"../chunks/CcUbQ_Wl.js";import{P as dt}from"../chunks/BHDZZvku.js";import{I as lt}from"../chunks/D7A-gG4Z.js";import{D as vt}from"../chunks/CmbJHhgy.js";const Ge=1440*60*1e3;function pe(x){const v=typeof x=="string"?new Date(x):new Date(x);return v.setHours(0,0,0,0),v}function be(x,v){return Math.floor((pe(x).getTime()-pe(v).getTime())/Ge)}function Ye(x){const v=x.getFullYear(),f=String(x.getMonth()+1).padStart(2,"0"),R=String(x.getDate()).padStart(2,"0");return`${v}-${f}-${R}`}function qe(x,v){if(!v)return"none";const f=new Date(v);if(Number.isNaN(f.getTime()))return"none";const R=be(f,x);return R<0?"overdue":R===0?"today":R<=7?"week":"future"}function ze(x,v){if(!v)return null;const f=new Date(v);return Number.isNaN(f.getTime())?null:be(f,x)}function ct(x){if(x.length===0)return 0;let v=0;for(const f of x)v+=f.retentionStrength??0;return v/x.length}function ut(x){const v=pe(x);return v.setDate(v.getDate()-14),v.setDate(v.getDate()-v.getDay()),v}function pt(x,v){let f=0,R=0,I=0,O=0,A=0,G=0;const E=pe(x);for(const B of v){if(!B.nextReviewAt)continue;const H=new Date(B.nextReviewAt);if(Number.isNaN(H.getTime()))continue;const _=be(H,x);_<0&&f++,_<=0&&R++,_<=7&&I++,_<=30&&O++,_>=0&&(A+=(H.getTime()-E.getTime())/Ge,G++)}const b=G>0?A/G:0;return{overdue:f,dueToday:R,dueThisWeek:I,dueThisMonth:O,avgDays:b}}var xt=Oe(''),gt=Oe(''),mt=Oe(''),ft=g('
                '),_t=g(' '),ht=g(' '),bt=g('
                '),yt=g(''),wt=g(" "),kt=g(' '),$t=g('

                '),St=g('

                '),Dt=g('

                '),Tt=g('
                Avg retention of memories due — last 2 weeks → next 4
                retention today
                Overdue Due today Within 7 days Future (8+ days)
                ');function Rt(x,v){Ue(v,!0);let f=it(v,"anchor",19,()=>new Date),R=k(()=>pe(f())),I=k(()=>ut(f())),O=k(()=>(()=>{const r=new Map;for(const a of v.memories){if(!a.nextReviewAt)continue;const o=new Date(a.nextReviewAt);if(Number.isNaN(o.getTime()))continue;const d=Ye(pe(o)),$=r.get(d);$?$.push(a):r.set(d,[a])}return r})()),A=k(()=>(()=>{const r=[];for(let a=0;a<42;a++){const o=new Date(e(I));o.setDate(o.getDate()+a);const d=Ye(o),$=e(O).get(d)??[],y=be(o,e(R));r.push({date:o,key:d,isToday:y===0,inWindow:y>=-14&&y<=28,memories:$,avgRetention:ct($)})}return r})());function G(r){if(r.memories.length===0)return{bg:"rgba(255,255,255,0.02)",border:"rgba(99,102,241,0.06)",text:"#4a4a7a"};const a=be(r.date,e(R));return a<-1?{bg:"rgba(239,68,68,0.16)",border:"rgba(239,68,68,0.45)",text:"#fca5a5"}:a>=-1&&a<=0?{bg:"rgba(245,158,11,0.18)",border:"rgba(245,158,11,0.5)",text:"#fcd34d"}:a>0&&a<=7?{bg:"rgba(99,102,241,0.16)",border:"rgba(99,102,241,0.45)",text:"#a5b4fc"}:{bg:"rgba(168,85,247,0.08)",border:"rgba(168,85,247,0.2)",text:"#c084fc"}}let E=ue(null),b=k(()=>e(A).find(r=>r.key===e(E))??null);function B(r){W(E,e(E)===r?null:r,!0)}const H=600,_=56;let L=k(()=>(()=>{const r=[],a=e(A).length;for(let o=0;o(()=>{const r=e(L).filter(a=>a.count>0);return r.length===0?"":r.map((a,o)=>`${o===0?"M":"L"} ${a.x.toFixed(1)} ${a.y.toFixed(1)}`).join(" ")})()),xe=k(()=>e(A).findIndex(r=>r.isToday)),ge=k(()=>e(xe)>=0?e(xe)/(e(A).length-1)*H:-1);const we=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function ne(r){return r.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric",year:"numeric"})}var ie=Tt(),oe=s(ie),me=n(s(oe),2);C(me,"viewBox","0 0 600 56");var J=s(me);C(J,"x2",H),C(J,"y1",_-6-.3*(_-12)),C(J,"y2",_-6-.3*(_-12));var de=n(J);C(de,"x2",H),C(de,"y1",_-6-.7*(_-12)),C(de,"y2",_-6-.7*(_-12));var ke=n(de);{var Fe=r=>{var a=xt();C(a,"y2",_),w(()=>{C(a,"x1",e(ge)),C(a,"x2",e(ge))}),u(r,a)};N(ke,r=>{e(ge)>=0&&r(Fe)})}var $e=n(ke);{var Ne=r=>{var a=gt();w(()=>C(a,"d",e(ye))),u(r,a)};N($e,r=>{e(ye)&&r(Ne)})}var Ce=n($e);X(Ce,17,()=>e(L),he,(r,a)=>{var o=at(),d=st(o);{var $=y=>{var D=mt();w(()=>{C(D,"cx",e(a).x),C(D,"cy",e(a).y)}),u(y,D)};N(d,y=>{e(a).count>0&&y($)})}u(r,o)}),t(me),t(oe);var i=n(oe,2);X(i,21,()=>we,he,(r,a)=>{var o=ft(),d=s(o,!0);t(o),w(()=>p(d,e(a))),u(r,o)}),t(i);var l=n(i,2);X(l,21,()=>e(A),r=>r.key,(r,a)=>{const o=k(()=>G(e(a)));var d=yt(),$=s(d),y=s($),D=s(y),fe=s(D,!0);t(D);var V=n(D,2);{var Z=h=>{var c=_t(),T=s(c,!0);t(c),w(Y=>p(T,Y),[()=>e(a).date.toLocaleDateString(void 0,{month:"short"})]),u(h,c)},le=k(()=>e(a).date.getDate()===1);N(V,h=>{e(le)&&h(Z)})}t(y);var ve=n(y,2);{var ce=h=>{var c=bt(),T=s(c),Y=s(T,!0);t(T);var ee=n(T,2);{var Q=te=>{var q=ht(),z=s(q);t(q),w(ae=>p(z,`${ae??""}%`),[()=>(e(a).avgRetention*100).toFixed(0)]),u(te,q)};N(ee,te=>{e(a).avgRetention>0&&te(Q)})}t(c),w(()=>{Ae(T,`color: ${e(o).text??""}`),p(Y,e(a).memories.length)}),u(h,c)};N(ve,h=>{e(a).memories.length>0&&h(ce)})}t($),t(d),w((h,c)=>{d.disabled=e(a).memories.length===0,Ie(d,1,`relative aspect-square rounded-lg p-2 text-left transition-all duration-200 - ${e(a).inWindow?"opacity-100":"opacity-35"} - ${e(a).memories.length>0?"hover:scale-[1.03] cursor-pointer":"cursor-default"} - ${e(a).isToday?"ring-2 ring-synapse/60 shadow-[0_0_16px_rgba(99,102,241,0.3)]":""} - ${e(E)===e(a).key?"ring-2 ring-dream/60 shadow-[0_0_16px_rgba(168,85,247,0.3)]":""}`),Ae(d,`background: ${e(o).bg??""}; border: 1px solid ${e(o).border??""};`),C(d,"title",h),Ie(D,1,`text-[10px] font-mono ${e(a).isToday?"text-synapse-glow font-bold":"text-dim"}`),p(fe,c)},[()=>`${ne(e(a).date)} — ${e(a).memories.length} due`,()=>e(a).date.getDate()]),Pe("click",d,()=>B(e(a).key)),u(r,d)}),t(l);var m=n(l,4);{var j=r=>{var a=Dt(),o=s(a),d=s(o),$=s(d),y=s($,!0);t($);var D=n($,2),fe=s(D);t(D),t(d);var V=n(d,2);t(o);var Z=n(o,2),le=s(Z);X(le,17,()=>e(b).memories.slice(0,100),h=>h.id,(h,c)=>{var T=$t(),Y=s(T),ee=n(Y,2),Q=s(ee),te=s(Q,!0);t(Q);var q=n(Q,2),z=s(q),ae=s(z,!0);t(z);var Se=n(z,2);{var De=M=>{var U=wt(),se=s(U);t(U),w(()=>p(se,`· ${e(c).reviewCount??""} review${e(c).reviewCount===1?"":"s"}`)),u(M,U)};N(Se,M=>{e(c).reviewCount!==void 0&&M(De)})}var je=n(Se,2);X(je,17,()=>e(c).tags.slice(0,2),he,(M,U)=>{var se=kt(),P=s(se,!0);t(se),w(()=>p(P,e(U))),u(M,se)}),t(q),t(ee);var Te=n(ee,2),_e=s(Te),Me=s(_e);t(_e);var S=n(_e,2),F=s(S);t(S),t(Te),t(T),w(M=>{Ae(Y,`background: ${(ot[e(c).nodeType]||"#8B95A5")??""}`),p(te,e(c).content),p(ae,e(c).nodeType),Ae(Me,`width: ${e(c).retentionStrength*100}%; background: ${e(c).retentionStrength>.7?"var(--color-recall)":e(c).retentionStrength>.4?"var(--color-warning)":"var(--color-decay)"}`),p(F,`${M??""}%`)},[()=>(e(c).retentionStrength*100).toFixed(0)]),u(h,T)});var ve=n(le,2);{var ce=h=>{var c=St(),T=s(c);t(c),w(()=>p(T,`+${e(b).memories.length-100} more`)),u(h,c)};N(ve,h=>{e(b).memories.length>100&&h(ce)})}t(Z),t(a),w((h,c)=>{p(y,h),p(fe,`${e(b).memories.length??""} memor${e(b).memories.length===1?"y":"ies"} due - · avg retention ${c??""}%`)},[()=>ne(e(b).date),()=>(e(b).avgRetention*100).toFixed(0)]),Pe("click",V,()=>W(E,null)),u(r,a)};N(m,r=>{e(b)&&e(b).memories.length>0&&r(j)})}t(ie),u(x,ie),Qe()}Xe(["click"]);var At=g(' '),Ft=g('
                '),Nt=g('
                '),Ct=g('
                '),jt=g('
                '),Mt=g('

                API unavailable.

                Could not fetch memories from /api/memories.

                '),Lt=g(`

                FSRS review schedule not yet populated.

                nextReviewAt timestamp yet. Run consolidation to compute - next-review dates via FSRS-6.

                `),Wt=g('
                Overdue
                '),Pt=g('

                Nothing in this window.

                '),It=g('

                '),Ot=g('

                '),Et=g('
                '),Bt=g('
                '),Ht=g('
                ');function aa(x,v){Ue(v,!0);let f=ue(rt([])),R=ue(0),I=ue(!0),O=ue(!1),A=ue("week");const G=2e3;async function E(){const i=await Ke.memories.list({limit:String(G)});W(f,i.memories,!0),W(R,i.total,!0)}tt(async()=>{try{await E()}catch{W(O,!0),W(f,[],!0)}finally{W(I,!1)}});let b=k(()=>e(f).filter(i=>!!i.nextReviewAt)),B=k(()=>new Date),H=k(()=>e(R)>e(f).length),_=k(()=>(()=>{const i=e(A);return i==="all"?e(b):e(b).filter(l=>{const m=qe(e(B),l.nextReviewAt);if(m==="none")return!1;if(i==="today")return m==="overdue"||m==="today";if(i==="week")return m!=="future";const j=ze(e(B),l.nextReviewAt);return j!==null&&j<=30})})()),L=k(()=>pt(e(B),e(b)));async function ye(){W(I,!0);try{await Ke.consolidate(),await E(),W(O,!1)}catch{W(O,!0)}finally{W(I,!1)}}const xe=[{key:"today",label:"Due today"},{key:"week",label:"This week"},{key:"month",label:"This month"},{key:"all",label:"All upcoming"}];let ge=k(()=>[{value:"today",label:"Due today",icon:"schedule",badge:e(L).dueToday,color:"#fbbf24"},{value:"week",label:"This week",icon:"schedule",badge:e(L).dueThisWeek,color:"#818cf8"},{value:"month",label:"This month",icon:"schedule",badge:e(L).dueThisMonth,color:"#c084fc"},{value:"all",label:"All upcoming",icon:"schedule",badge:e(b).length,color:"#6ee7b7"}]),we=k(()=>{var i;return((i=xe.find(l=>l.key===e(A)))==null?void 0:i.label)??""});var ne=Ht(),ie=s(ne);dt(ie,{icon:"schedule",title:"Review Schedule",subtitle:"FSRS-6 next-review dates across your memory corpus",accent:"warning",children:(i,l)=>{vt(i,{get options(){return e(ge)},label:"Window",icon:"filter",get value(){return e(A)},set value(m){W(A,m,!0)}})},$$slots:{default:!0}});var oe=n(ie,2);{var me=i=>{var l=At(),m=s(l,!0);t(l),w(()=>p(m,e(we))),u(i,l)};N(oe,i=>{e(we)&&i(me)})}var J=n(oe,2);{var de=i=>{var l=Ft(),m=s(l);t(l),w((j,r)=>p(m,`Showing the first ${j??""} of ${r??""} memories. - Schedule reflects this slice only.`),[()=>e(f).length.toLocaleString(),()=>e(R).toLocaleString()]),u(i,l)};N(J,i=>{!e(I)&&!e(O)&&e(H)&&i(de)})}var ke=n(J,2);{var Fe=i=>{var l=jt(),m=s(l),j=n(s(m),2);X(j,20,()=>Array(42),he,(a,o)=>{var d=Nt();u(a,d)}),t(j),t(m);var r=n(m,2);X(r,20,()=>Array(5),he,(a,o)=>{var d=Ct();u(a,d)}),t(r),t(l),u(i,l)},$e=i=>{var l=Mt();u(i,l)},Ne=i=>{var l=Lt(),m=s(l),j=s(m);lt(j,{name:"schedule",size:42,strokeWidth:1.2}),t(m);var r=n(m,4),a=s(r);nt(2),t(r);var o=n(r,2);t(l),w(()=>p(a,`None of your ${e(f).length??""} memor${e(f).length===1?"y has":"ies have"} a `)),Pe("click",o,ye),u(i,l)},Ce=i=>{var l=Bt(),m=s(l),j=s(m);Rt(j,{get memories(){return e(b)}}),t(m);var r=n(m,2),a=s(r),o=n(s(a),2),d=s(o);{var $=S=>{var F=Wt(),M=n(s(F),2),U=s(M,!0);t(M),t(F),w(()=>p(U,e(L).overdue)),u(S,F)};N(d,S=>{e(L).overdue>0&&S($)})}var y=n(d,2),D=n(s(y),2),fe=s(D,!0);t(D),t(y);var V=n(y,2),Z=n(s(V),2),le=s(Z,!0);t(Z),t(V);var ve=n(V,2),ce=n(s(ve),2),h=s(ce,!0);t(ce),t(ve),t(o);var c=n(o,2),T=s(c),Y=n(s(T),2),ee=s(Y,!0);t(Y),t(T);var Q=n(T,2),te=s(Q);t(Q),t(c),t(a);var q=n(a,2),z=s(q),ae=s(z),Se=s(ae,!0);t(ae);var De=n(ae,2),je=s(De,!0);t(De),t(z);var Te=n(z,2);{var _e=S=>{var F=Pt();u(S,F)},Me=S=>{var F=Et(),M=s(F);X(M,17,()=>e(_).slice().sort((P,K)=>(P.nextReviewAt??"").localeCompare(K.nextReviewAt??"")).slice(0,50),P=>P.id,(P,K)=>{const re=k(()=>qe(e(B),e(K).nextReviewAt)),Ee=k(()=>ze(e(B),e(K).nextReviewAt)??0);var Le=It(),We=s(Le),Je=s(We,!0);t(We);var Be=n(We,2),Re=s(Be),Ve=s(Re,!0);t(Re);var He=n(Re,2),Ze=s(He);t(He),t(Be),t(Le),w(et=>{p(Je,e(K).content),Ie(Re,1,e(re)==="overdue"?"text-decay":e(re)==="today"?"text-warning":e(re)==="week"?"text-synapse-glow":"text-dream-glow"),p(Ve,e(re)==="overdue"?`${-e(Ee)}d overdue`:e(re)==="today"?"today":`in ${e(Ee)}d`),p(Ze,`· ${et??""}%`)},[()=>(e(K).retentionStrength*100).toFixed(0)]),u(P,Le)});var U=n(M,2);{var se=P=>{var K=Ot(),re=s(K);t(K),w(()=>p(re,`+${e(_).length-50} more`)),u(P,K)};N(U,P=>{e(_).length>50&&P(se)})}t(F),u(S,F)};N(Te,S=>{e(_).length===0?S(_e):S(Me,!1)})}t(q),t(r),t(l),w((S,F)=>{p(fe,e(L).dueToday),p(le,e(L).dueThisWeek),p(h,e(L).dueThisMonth),p(ee,S),p(te,`Across ${e(b).length??""} scheduled memor${e(b).length===1?"y":"ies"}`),p(Se,F),p(je,e(_).length)},[()=>e(L).avgDays.toFixed(1),()=>{var S;return(S=xe.find(F=>F.key===e(A)))==null?void 0:S.label}]),u(i,l)};N(ke,i=>{e(I)?i(Fe):e(O)?i($e,1):e(b).length===0?i(Ne,2):i(Ce,!1)})}t(ne),u(x,ne),Qe()}Xe(["click"]);export{aa as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/18.43xZFMsD.js.br b/apps/dashboard/build/_app/immutable/nodes/18.43xZFMsD.js.br deleted file mode 100644 index 0010bc8..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/18.43xZFMsD.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/18.43xZFMsD.js.gz b/apps/dashboard/build/_app/immutable/nodes/18.43xZFMsD.js.gz deleted file mode 100644 index 468dc18..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/18.43xZFMsD.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/18.CXHHR36X.js b/apps/dashboard/build/_app/immutable/nodes/18.CXHHR36X.js new file mode 100644 index 0000000..8c48470 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/18.CXHHR36X.js @@ -0,0 +1 @@ +import"../chunks/Bzak7iHL.js";import{o as Ft}from"../chunks/GG5zm9kr.js";import{p as $t,a as Ct,j as W,h as y,e as s,d as e,g as t,r as a,s as E,f as dt,n as P,t as B,u as O}from"../chunks/CpWkWWOo.js";import{d as Rt,s as i,a as At}from"../chunks/BlVfL1ME.js";import{i as X}from"../chunks/B4yTwGkE.js";import{e as U,i as q}from"../chunks/CGEBXrjl.js";import{a as p,f as u}from"../chunks/CHOnp4oo.js";import{s as A}from"../chunks/Cx-f-Pzo.js";import{a as w}from"../chunks/DNjM5a-l.js";var Dt=u('
                '),Mt=u('
                '),kt=u('
                '),Bt=u('
                '),St=u('
                '),Tt=u('

                '),jt=u('

                Retention Distribution

                Memory Types

                ',1),Et=u('
                Total Memories
                Avg Retention
                Due for Review
                Embedding Coverage
                ',1),Pt=u('

                System Stats

                ');function Lt(ot,vt){$t(vt,!0);let n=E(null),m=E(null),l=E(null),Y=E(!0);Ft(async()=>{try{await(async d=>{var r=W(d,3);y(n,r[0],!0),y(m,r[1],!0),y(l,r[2],!0)})(await Promise.all([w.stats(),w.health(),w.retentionDistribution()]))}catch{}finally{y(Y,!1)}});function z(d){return{healthy:"#10b981",degraded:"#f59e0b",critical:"#ef4444",empty:"#6b7280"}[d]||"#6b7280"}async function nt(){try{await w.consolidate(),await(async d=>{var r=W(d,3);y(n,r[0],!0),y(m,r[1],!0),y(l,r[2],!0)})(await Promise.all([w.stats(),w.health(),w.retentionDistribution()]))}catch{}}var G=Pt(),lt=s(e(G),2);{var ct=d=>{var r=Mt();U(r,20,()=>Array(8),q,(F,H)=>{var $=Dt();p(F,$)}),a(r),p(d,r)},xt=d=>{var r=Et(),F=dt(r),H=e(F),$=s(H,2),pt=e($,!0);a($);var Z=s($,2),ut=e(Z);a(Z),a(F);var I=s(F,2),J=e(I),tt=e(J),mt=e(tt,!0);a(tt),P(2),a(J);var K=s(J,2),L=e(K),gt=e(L);a(L),P(2),a(K);var N=s(K,2),at=e(N),_t=e(at,!0);a(at),P(2),a(N);var et=s(N,2),st=e(et),ft=e(st);a(st),P(2),a(et),a(I);var rt=s(I,2);{var bt=D=>{var S=jt(),M=dt(S),T=s(e(M),2);U(T,21,()=>t(l).distribution,q,(g,c,v)=>{const C=O(()=>Math.max(...t(l).distribution.map(V=>V.count),1)),R=O(()=>t(c).count/t(C)*100),_=O(()=>v<3?"#ef4444":v<5?"#f59e0b":v<7?"#10b981":"#6366f1");var x=kt(),o=e(x),f=e(o,!0);a(o);var b=s(o,2),h=s(b,2),Q=e(h,!0);a(h),a(x),B(()=>{i(f,t(c).count),A(b,`height: ${t(R)??""}%; background: ${t(_)??""}; opacity: 0.7; min-height: 2px`),i(Q,t(c).range)}),p(g,x)}),a(T),a(M);var k=s(M,2),j=s(e(k),2);U(j,21,()=>Object.entries(t(l).byType),q,(g,c)=>{var v=O(()=>W(t(c),2));let C=()=>t(v)[0],R=()=>t(v)[1];var _=Bt(),x=e(_),o=s(x,2),f=e(o,!0);a(o);var b=s(o,2),h=e(b,!0);a(b),a(_),B(()=>{A(x,`background: ${({fact:"#00A8FF",concept:"#9D00FF",event:"#FFB800",person:"#00FFD1",note:"#8B95A5",pattern:"#FF3CAC",decision:"#FF4757"}[C()]||"#8B95A5")??""}`),i(f,C()),i(h,R())}),p(g,_)}),a(j),a(k);var yt=s(k,2);{var wt=g=>{var c=Tt(),v=e(c),C=e(v);a(v);var R=s(v,2);U(R,21,()=>t(l).endangered.slice(0,20),q,(_,x)=>{var o=St(),f=e(o),b=e(f);a(f);var h=s(f,2),Q=e(h,!0);a(h),a(o),B(V=>{i(b,`${V??""}%`),i(Q,t(x).content)},[()=>(t(x).retentionStrength*100).toFixed(0)]),p(_,o)}),a(R),a(c),B(()=>i(C,`Endangered Memories (${t(l).endangered.length??""})`)),p(g,c)};X(yt,g=>{t(l).endangered.length>0&&g(wt)})}p(D,S)};X(rt,D=>{t(l)&&D(bt)})}var it=s(rt,2),ht=e(it);a(it),B((D,S,M,T,k,j)=>{A(F,`border-color: ${D??""}30`),A(H,`background: ${S??""}`),A($,`color: ${M??""}`),i(pt,T),i(ut,`v${t(m).version??""}`),i(mt,t(n).totalMemories),A(L,`color: ${t(n).averageRetention>.7?"#10b981":t(n).averageRetention>.4?"#f59e0b":"#ef4444"}`),i(gt,`${k??""}%`),i(_t,t(n).dueForReview),i(ft,`${j??""}%`)},[()=>z(t(m).status),()=>z(t(m).status),()=>z(t(m).status),()=>t(m).status.toUpperCase(),()=>(t(n).averageRetention*100).toFixed(1),()=>t(n).embeddingCoverage.toFixed(0)]),At("click",ht,nt),p(d,r)};X(lt,d=>{t(Y)?d(ct):t(n)&&t(m)&&d(xt,1)})}a(G),p(ot,G),Ct()}Rt(["click"]);export{Lt as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/18.CXHHR36X.js.br b/apps/dashboard/build/_app/immutable/nodes/18.CXHHR36X.js.br new file mode 100644 index 0000000..353e8e3 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/18.CXHHR36X.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/18.CXHHR36X.js.gz b/apps/dashboard/build/_app/immutable/nodes/18.CXHHR36X.js.gz new file mode 100644 index 0000000..e2218db Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/18.CXHHR36X.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/19.BYwd4oWS.js b/apps/dashboard/build/_app/immutable/nodes/19.BYwd4oWS.js deleted file mode 100644 index 13ee522..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/19.BYwd4oWS.js +++ /dev/null @@ -1,2 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{o as ft}from"../chunks/TZu9D97Z.js";import{p as _t,t as $,a as n,b as bt,g as i,j as c,e as t,h as d,s as C,a9 as kt,i as p,f as Fe,r as e,n as m,m as Ie,u as F}from"../chunks/wpu9U-D0.js";import{d as yt,a as I,s as f}from"../chunks/D8mhvFt8.js";import{i as _}from"../chunks/DKve45Wd.js";import{e as fe,s as V,i as _e}from"../chunks/60_R_Vbt.js";import{a as R,r as A}from"../chunks/P1-U_Xsj.js";import{s as Y}from"../chunks/EqHb-9AZ.js";import{a as ht,s as be}from"../chunks/ByYB047u.js";import{a as O}from"../chunks/CZfHMhLI.js";import{a as wt,b as $t,i as St,w as Ct}from"../chunks/BhIgFntf.js";import{f as Dt}from"../chunks/CqMQEF-F.js";import{P as Rt}from"../chunks/BHDZZvku.js";import{I as P}from"../chunks/D7A-gG4Z.js";var At=c(' ',1),Pt=c(' Running...',1),Gt=c('
                Processed
                '),jt=c('
                Decayed
                '),zt=c('
                Embedded
                '),Mt=c('
                '),Tt=c(' Dreaming...',1),Et=c('
                '),Ft=c('
                Insights Discovered:
                ',1),It=c('
                Connections found:
                '),Ot=c('
                Memories replayed:
                '),Nt=c('
                '),Bt=c('
                '),Kt=c('
                '),Wt=c('

                Retention Distribution

                '),qt=c('
                '),Ht=c(`
                Memories
                Avg Retention
                WebSocket
                v2.1
                Vestige

                Cognitive Operations

                Pulse Toast Preview
                Fire a synthetic event sequence — useful for UI demos
                Birth Ritual Preview
                Inject a synthetic memory — switch to Graph to watch the orb fly in
                FSRS-6 Consolidation
                Apply spaced-repetition decay, regenerate embeddings, run maintenance
                Memory Dream Cycle
                Replay memories, discover hidden connections, synthesize insights

                Keyboard Shortcuts

                About

                Vestige v2.1 "Nuclear Dashboard"
                Your AI's long-term memory system
                29 cognitive modules
                FSRS-6 spaced repetition
                Nomic Embed v1.5 (256d)
                Jina Reranker v1 Turbo
                USearch HNSW (20x FAISS)
                Local-first, zero cloud
                Built with Rust + Axum + SvelteKit 2 + Svelte 5 + Three.js + Tailwind CSS 4
                `);function ds(Oe,Ne){_t(Ne,!0);const b=()=>be(St,"$isConnected",Q),Be=()=>be($t,"$memoryCount",Q),L=()=>be(wt,"$avgRetention",Q),[Q,Ke]=ht(),ke=["fact","concept","pattern","decision","person","place"];let X=C(0);function We(){const s=ke[i(X)%ke.length];kt(X),Ct.injectEvent({type:"MemoryCreated",data:{id:`demo-birth-${Date.now()}`,content:`Demo memory #${i(X)} — ${s}`,node_type:s,tags:["demo","v2.3-birth-ritual"],retention:.9}})}let N=C(!1),j=C(!1),S=C(null),h=C(null),qe=C(null),G=C(null),ye=C(!0),He=C(null);ft(()=>{B()});async function B(){p(ye,!0);try{const[s,r,a]=await Promise.all([O.stats().catch(()=>null),O.health().catch(()=>null),O.retentionDistribution().catch(()=>null)]);p(qe,s,!0),p(He,r,!0),p(G,a,!0)}finally{p(ye,!1)}}async function Je(){p(N,!0),p(S,null);try{p(S,await O.consolidate(),!0),await B()}catch{}finally{p(N,!1)}}async function Ue(){p(j,!0),p(h,null);try{p(h,await O.dream(),!0),await B()}catch{}finally{p(j,!1)}}var Z=Ht(),he=t(Z);Rt(he,{icon:"settings",title:"Settings & System",subtitle:"Tune the cognitive engine, watch the system breathe, and run the rituals that keep memory alive.",accent:"synapse",children:(s,r)=>{var a=At(),x=Fe(a);let k;var u=t(x);let w;var D=d(u,2),y=t(D,!0);e(D),e(x);var l=d(x,2),v=t(l);P(v,{name:"activation",size:13}),m(2),e(l),$(()=>{k=V(x,1,"conn-pill svelte-15kgmsr",null,k,{idle:!b()}),w=V(u,1,"conn-dot w-2 h-2 rounded-full svelte-15kgmsr",null,w,{"ping-host":b(),breathe:!b()}),Y(u,`color:${b()?"var(--color-recall)":"var(--color-decay)"};background:${b()?"var(--color-recall)":"var(--color-decay)"}`),f(y,b()?"Connected":"Offline")}),I("click",l,B),n(s,a)},$$slots:{default:!0}});var ee=d(he,2),K=t(ee),we=t(K),Ve=t(we,!0);e(we),m(2),e(K),R(K,(s,r)=>{var a;return(a=A)==null?void 0:a(s,r)},()=>({delay:0}));var W=d(K,2),te=t(W),Ye=t(te);e(te),m(2),e(W),R(W,(s,r)=>{var a;return(a=A)==null?void 0:a(s,r)},()=>({delay:60}));var q=d(W,2),$e=t(q),se=t($e);let Se;var Ce=d(se,2),Le=t(Ce,!0);e(Ce),e($e),m(2),e(q),R(q,(s,r)=>{var a;return(a=A)==null?void 0:a(s,r)},()=>({delay:120}));var Qe=d(q,2);R(Qe,(s,r)=>{var a;return(a=A)==null?void 0:a(s,r)},()=>({delay:180})),e(ee);var H=d(ee,2),re=t(H),Xe=t(re);P(Xe,{name:"dreams",size:16,class:"text-dream"}),m(),e(re);var ae=d(re,2),De=t(ae),ie=d(t(De),2),Ze=t(ie);P(Ze,{name:"sparkle",size:14}),m(),e(ie),e(De),e(ae);var de=d(ae,2),Re=t(de),le=d(t(Re),2),et=t(le);P(et,{name:"memories",size:14}),m(),e(le),e(Re),e(de);var ve=d(de,2),oe=t(ve),J=d(t(oe),2),tt=t(J);{var st=s=>{var r=Pt();m(),n(s,r)},rt=s=>{var r=Ie("Consolidate");n(s,r)};_(tt,s=>{i(N)?s(st):s(rt,!1)})}e(J),e(oe);var at=d(oe,2);{var it=s=>{var r=Mt(),a=t(r),x=t(a);{var k=l=>{var v=Gt(),o=t(v),g=t(o,!0);e(o),m(2),e(v),$(()=>f(g,i(S).nodesProcessed)),n(l,v)};_(x,l=>{i(S).nodesProcessed!==void 0&&l(k)})}var u=d(x,2);{var w=l=>{var v=jt(),o=t(v),g=t(o,!0);e(o),m(2),e(v),$(()=>f(g,i(S).decayApplied)),n(l,v)};_(u,l=>{i(S).decayApplied!==void 0&&l(w)})}var D=d(u,2);{var y=l=>{var v=zt(),o=t(v),g=t(o,!0);e(o),m(2),e(v),$(()=>f(g,i(S).embeddingsGenerated)),n(l,v)};_(D,l=>{i(S).embeddingsGenerated!==void 0&&l(y)})}e(a),e(r),n(s,r)};_(at,s=>{i(S)&&s(it)})}e(ve);var Ae=d(ve,2),ne=t(Ae),z=d(t(ne),2),dt=t(z);{var lt=s=>{var r=Tt();m(),n(s,r)},vt=s=>{var r=Ie("Dream");n(s,r)};_(dt,s=>{i(j)?s(lt):s(vt,!1)})}e(z),e(ne);var ot=d(ne,2);{var nt=s=>{var r=Nt(),a=t(r);{var x=l=>{var v=Ft(),o=d(Fe(v),2);fe(o,17,()=>i(h).insights,_e,(g,M)=>{var T=Et(),xe=t(T,!0);e(T),$(E=>f(xe,E),[()=>typeof i(M)=="string"?i(M):JSON.stringify(i(M))]),n(g,T)}),n(l,v)},k=F(()=>i(h).insights&&Array.isArray(i(h).insights));_(a,l=>{i(k)&&l(x)})}var u=d(a,2);{var w=l=>{var v=It(),o=d(t(v)),g=t(o,!0);e(o),e(v),$(()=>f(g,i(h).connections_found)),n(l,v)};_(u,l=>{i(h).connections_found!==void 0&&l(w)})}var D=d(u,2);{var y=l=>{var v=Ot(),o=d(t(v)),g=t(o,!0);e(o),e(v),$(()=>f(g,i(h).memories_replayed)),n(l,v)};_(D,l=>{i(h).memories_replayed!==void 0&&l(y)})}e(r),n(s,r)};_(ot,s=>{i(h)&&s(nt)})}e(Ae),e(H),R(H,(s,r)=>{var a;return(a=A)==null?void 0:a(s,r)},()=>({delay:60}));var Pe=d(H,2);{var mt=s=>{var r=Wt(),a=t(r),x=t(a);P(x,{name:"importance",size:16,class:"text-recall"}),m(),e(a);var k=d(a,2),u=t(k);{var w=y=>{var l=Kt();fe(l,21,()=>i(G).distribution,_e,(v,o,g)=>{const M=F(()=>Math.max(...i(G).distribution.map(pe=>pe.count),1)),T=F(()=>i(o).count/i(M)*100),xe=F(()=>g<2?"#ef4444":g<4?"#f59e0b":g<7?"#6366f1":"#10b981");var E=Bt(),ue=t(E),ut=t(ue,!0);e(ue);var Ee=d(ue,2),pt=d(Ee,2);pt.textContent=`${g*10}%`,e(E),$(pe=>{f(ut,i(o).count),Y(Ee,`height: ${pe??""}%; background: ${i(xe)??""}; opacity: 0.7`)},[()=>Math.max(i(T),2)]),n(v,E)}),e(l),n(y,l)},D=F(()=>i(G).distribution&&Array.isArray(i(G).distribution));_(u,y=>{i(D)&&y(w)})}e(k),e(r),R(r,(y,l)=>{var v;return(v=A)==null?void 0:v(y,l)},()=>({delay:120})),n(s,r)};_(Pe,s=>{i(G)&&s(mt)})}var U=d(Pe,2),me=t(U),ct=t(me);P(ct,{name:"command",size:16,class:"text-synapse"}),m(),e(me);var Ge=d(me,2),je=t(Ge);fe(je,20,()=>[{key:"⌘ K",desc:"Command palette"},{key:"/",desc:"Focus search"},{key:"G",desc:"Go to Graph"},{key:"M",desc:"Go to Memories"},{key:"T",desc:"Go to Timeline"},{key:"F",desc:"Go to Feed"},{key:"E",desc:"Go to Explore"},{key:"S",desc:"Go to Stats"}],_e,(s,r)=>{var a=qt(),x=t(a),k=t(x,!0);e(x);var u=d(x,2),w=t(u,!0);e(u),e(a),$(()=>{f(k,r.key),f(w,r.desc)}),n(s,a)}),e(je),e(Ge),e(U),R(U,(s,r)=>{var a;return(a=A)==null?void 0:a(s,r)},()=>({delay:160}));var ce=d(U,2),ge=t(ce),gt=t(ge);P(gt,{name:"logo",size:16,class:"text-memory"}),m(),e(ge);var ze=d(ge,2),Me=t(ze),Te=t(Me),xt=t(Te);P(xt,{name:"logo",size:20,strokeWidth:1.8}),e(Te),m(2),e(Me),m(4),e(ze),e(ce),R(ce,(s,r)=>{var a;return(a=A)==null?void 0:a(s,r)},()=>({delay:200})),e(Z),$(s=>{f(Ve,Be()),Y(te,`color: ${L()>.7?"#10b981":L()>.4?"#f59e0b":"#ef4444"}`),f(Ye,`${s??""}%`),Se=V(se,1,"w-2.5 h-2.5 rounded-full svelte-15kgmsr",null,Se,{"ping-host":b(),breathe:!b()}),Y(se,`color:${b()?"var(--color-recall)":"var(--color-decay)"};background:${b()?"var(--color-recall)":"var(--color-decay)"}`),f(Le,b()?"Online":"Offline"),J.disabled=i(N),z.disabled=i(j),V(z,1,`px-4 py-2 bg-dream/20 border border-dream/40 text-dream-glow text-sm rounded-xl hover:bg-dream/30 transition disabled:opacity-50 flex items-center gap-2 - ${i(j)?"glow-dream animate-pulse-glow":""}`,"svelte-15kgmsr")},[()=>(L()*100).toFixed(1)]),I("click",ie,function(...s){var r;(r=Dt)==null||r.apply(this,s)}),I("click",le,We),I("click",J,Je),I("click",z,Ue),n(Oe,Z),bt(),Ke()}yt(["click"]);export{ds as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/19.BYwd4oWS.js.br b/apps/dashboard/build/_app/immutable/nodes/19.BYwd4oWS.js.br deleted file mode 100644 index f5a023d..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/19.BYwd4oWS.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/19.BYwd4oWS.js.gz b/apps/dashboard/build/_app/immutable/nodes/19.BYwd4oWS.js.gz deleted file mode 100644 index 6a8b24b..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/19.BYwd4oWS.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/19.D4UHDxxJ.js b/apps/dashboard/build/_app/immutable/nodes/19.D4UHDxxJ.js new file mode 100644 index 0000000..9b09656 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/19.D4UHDxxJ.js @@ -0,0 +1 @@ +import"../chunks/Bzak7iHL.js";import{o as pe}from"../chunks/GG5zm9kr.js";import{p as ce,s as b,c as me,g as e,a as _e,e as i,d as a,h as c,r as t,t as g}from"../chunks/CpWkWWOo.js";import{d as ue,a as K,s as m}from"../chunks/BlVfL1ME.js";import{i as M}from"../chunks/B4yTwGkE.js";import{e as h,i as P}from"../chunks/CGEBXrjl.js";import{a as l,f as v}from"../chunks/CHOnp4oo.js";import{s as Q}from"../chunks/Cx-f-Pzo.js";import{b as xe}from"../chunks/BnXDGOmJ.js";import{a as fe}from"../chunks/DNjM5a-l.js";import{N as U}from"../chunks/DzfRjky4.js";var be=v('
                '),ge=v('
                '),he=v('

                No memories in the selected time range.

                '),ye=v('
                '),we=v(' '),ke=v('
                '),Te=v('
                '),je=v('
                '),Ae=v('
                '),Ne=v('

                Timeline

                ');function Re(V,W){ce(W,!0);let _=b(me([])),y=b(!0),w=b(14),k=b(null);pe(()=>R());async function R(){c(y,!0);try{const s=await fe.timeline(e(w),500);c(_,s.timeline,!0)}catch{c(_,[],!0)}finally{c(y,!1)}}var T=Ne(),j=a(T),u=i(a(j),2),A=a(u);A.value=A.__value=7;var N=i(A);N.value=N.__value=14;var O=i(N);O.value=O.__value=30;var Y=i(O);Y.value=Y.__value=90,t(u),t(j);var X=i(j,2);{var Z=s=>{var d=ge();h(d,20,()=>Array(7),P,(x,f)=>{var r=be();l(x,r)}),t(d),l(s,d)},ee=s=>{var d=he();l(s,d)},te=s=>{var d=Ae(),x=i(a(d),2);h(x,21,()=>e(_),f=>f.date,(f,r)=>{var S=je(),B=i(a(S),2),D=a(B),E=a(D),$=a(E),ae=a($,!0);t($);var q=i($,2),se=a(q);t(q),t(E);var z=i(E,2),G=a(z);h(G,17,()=>e(r).memories.slice(0,10),P,(n,o)=>{var p=ye();g(()=>Q(p,`background: ${(U[e(o).nodeType]||"#8B95A5")??""}; opacity: ${.3+e(o).retentionStrength*.7}`)),l(n,p)});var ie=i(G,2);{var re=n=>{var o=we(),p=a(o);t(o),g(()=>m(p,`+${e(r).memories.length-10}`)),l(n,o)};M(ie,n=>{e(r).memories.length>10&&n(re)})}t(z),t(D);var oe=i(D,2);{var le=n=>{var o=Te();h(o,21,()=>e(r).memories,P,(p,C)=>{var F=ke(),H=a(F),L=i(H,2),I=a(L),ve=a(I,!0);t(I),t(L);var J=i(L,2),de=a(J);t(J),t(F),g(ne=>{Q(H,`background: ${(U[e(C).nodeType]||"#8B95A5")??""}`),m(ve,e(C).content),m(de,`${ne??""}%`)},[()=>(e(C).retentionStrength*100).toFixed(0)]),l(p,F)}),t(o),l(n,o)};M(oe,n=>{e(k)===e(r).date&&n(le)})}t(B),t(S),g(()=>{m(ae,e(r).date),m(se,`${e(r).count??""} memories`)}),K("click",B,()=>c(k,e(k)===e(r).date?null:e(r).date,!0)),l(f,S)}),t(x),t(d),l(s,d)};M(X,s=>{e(y)?s(Z):e(_).length===0?s(ee,1):s(te,!1)})}t(T),K("change",u,R),xe(u,()=>e(w),s=>c(w,s)),l(V,T),_e()}ue(["change","click"]);export{Re as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/19.D4UHDxxJ.js.br b/apps/dashboard/build/_app/immutable/nodes/19.D4UHDxxJ.js.br new file mode 100644 index 0000000..74d488f Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/19.D4UHDxxJ.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/19.D4UHDxxJ.js.gz b/apps/dashboard/build/_app/immutable/nodes/19.D4UHDxxJ.js.gz new file mode 100644 index 0000000..33a85c0 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/19.D4UHDxxJ.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/2.D-vKwnTC.js b/apps/dashboard/build/_app/immutable/nodes/2.D-vKwnTC.js new file mode 100644 index 0000000..ad009e1 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/2.D-vKwnTC.js @@ -0,0 +1 @@ +import"../chunks/Bzak7iHL.js";import{f as m}from"../chunks/CpWkWWOo.js";import{c as n,a as p}from"../chunks/CHOnp4oo.js";import{s as i}from"../chunks/CJCPY1OL.js";function d(r,t){var o=n(),a=m(o);i(a,()=>t.children),p(r,o)}export{d as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/2.D-vKwnTC.js.br b/apps/dashboard/build/_app/immutable/nodes/2.D-vKwnTC.js.br new file mode 100644 index 0000000..b1be6ec Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/2.D-vKwnTC.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/2.D-vKwnTC.js.gz b/apps/dashboard/build/_app/immutable/nodes/2.D-vKwnTC.js.gz new file mode 100644 index 0000000..ba053e9 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/2.D-vKwnTC.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/2.DEnQkIHv.js b/apps/dashboard/build/_app/immutable/nodes/2.DEnQkIHv.js deleted file mode 100644 index e732e89..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/2.DEnQkIHv.js +++ /dev/null @@ -1 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{c as n,f as m,a as p}from"../chunks/wpu9U-D0.js";import{s as e}from"../chunks/LDOJP_6N.js";function f(a,r){var o=n(),t=m(o);e(t,()=>r.children),p(a,o)}export{f as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/2.DEnQkIHv.js.br b/apps/dashboard/build/_app/immutable/nodes/2.DEnQkIHv.js.br deleted file mode 100644 index 2d00db9..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/2.DEnQkIHv.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/2.DEnQkIHv.js.gz b/apps/dashboard/build/_app/immutable/nodes/2.DEnQkIHv.js.gz deleted file mode 100644 index 4dca9f4..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/2.DEnQkIHv.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/22.C719k-1W.js b/apps/dashboard/build/_app/immutable/nodes/20.BwEdZXUF.js similarity index 68% rename from apps/dashboard/build/_app/immutable/nodes/22.C719k-1W.js rename to apps/dashboard/build/_app/immutable/nodes/20.BwEdZXUF.js index 6743212..32708f0 100644 --- a/apps/dashboard/build/_app/immutable/nodes/22.C719k-1W.js +++ b/apps/dashboard/build/_app/immutable/nodes/20.BwEdZXUF.js @@ -1,6 +1,6 @@ -import"../chunks/Bzak7iHL.js";import{o as it}from"../chunks/TZu9D97Z.js";import{p as ct,s as p,d as mt,t as f,g as a,a as v,b as dt,x as pt,h as s,e as r,i as c,j as h,ar as vt,n as $e,r as o,k as ut}from"../chunks/wpu9U-D0.js";import{d as ht,e as Qe,s as u,a as bt}from"../chunks/D8mhvFt8.js";import{i as We}from"../chunks/DKve45Wd.js";import{e as k,a as Ge,i as P,r as W,s as He}from"../chunks/60_R_Vbt.js";import{h as yt}from"../chunks/DzesjbbJ.js";import{s as gt}from"../chunks/EqHb-9AZ.js";import{b as V}from"../chunks/CnZzd20v.js";import{b as Re}from"../chunks/DrafHjYM.js";import{b as ft}from"../chunks/g5OnrUYZ.js";import{b as Ue}from"../chunks/Bxs5UR9-.js";var qt=h(''),_t=h('
                '),wt=h("

                "),kt=h('
                '),Pt=h('

                '),xt=h('

                '),St=h("
                "),Tt=h('

                Checking the onboarding notes...

                '),Ct=h(''),Mt=h(`
                V Vestige Pro

                June early access

                Vestige Pro

                The paid layer for developers and teams who already trust Vestige as local memory for AI agents. +import"../chunks/Bzak7iHL.js";import{o as it}from"../chunks/GG5zm9kr.js";import{p as ct,s as p,c as mt,t as f,g as a,a as dt,W as pt,e as s,d as l,h as c,aG as vt,n as $e,r as o,i as ut}from"../chunks/CpWkWWOo.js";import{d as ht,e as Qe,s as v,a as bt}from"../chunks/BlVfL1ME.js";import{i as We}from"../chunks/B4yTwGkE.js";import{e as P,i as k}from"../chunks/CGEBXrjl.js";import{a as u,f as h}from"../chunks/CHOnp4oo.js";import{h as yt}from"../chunks/C4h_mRt2.js";import{s as Ge,r as W}from"../chunks/A7po6GxK.js";import{s as He}from"../chunks/aVbAZ-t7.js";import{s as gt}from"../chunks/Cx-f-Pzo.js";import{b as V}from"../chunks/sZcqyNBA.js";import{b as Re}from"../chunks/BnXDGOmJ.js";import{b as ft}from"../chunks/CJsMJEun.js";import{b as Ue}from"../chunks/BskPcZf7.js";var qt=h(''),_t=h('

                '),wt=h("

                "),Pt=h('
                '),kt=h('

                '),xt=h('

                '),St=h("
                "),Tt=h('

                Checking the onboarding notes...

                '),Ct=h(''),Mt=h(`
                V Vestige Pro

                June early access

                Vestige Pro

                The paid layer for developers and teams who already trust Vestige as local memory for AI agents. Sync, backups, team memory, and bot-assisted support come next.

                Early access

                Reserve a Pro seat

                Why Pro exists

                Two plans. One promise: agent memory you can depend on.

                Always-on answers

                The support bot handles the first wave.

                This is the first support layer: instant onboarding answers before anyone has to write an email. - It can run locally from the FAQ now and call a hosted support endpoint later.

                Onboarding bot

                May to June

                The plan is simple.

                1. May Get Vestige into every MCP, Claude Code, Cursor, local AI, Rust, and self-hosted channel that cares about agent memory.
                2. June Invite the first Solo Pro and Team Pro users into sync, backups, shared memory, PostgreSQL-backed deployments, and bot-assisted support.
                3. After Use paid feedback to turn Vestige from a beloved local tool into durable agent-memory infrastructure.
                `);function Ut(Be,Ee){ct(Ee,!0);let q,G=p(""),j=p(""),I=p("solo"),J=p("sync"),x=p(""),H=p(""),y=p("idle"),_=p(""),S=p(""),T=p(!1),C=p(mt([{role:"bot",content:"Ask me about installing Vestige, whether heavy models are required, Solo vs Team Pro, sync, pricing, or what happens after you join the June list."}]));const Fe=[{value:"Local",label:"SQLite memory, no hosted memory service"},{value:"MCP",label:"Claude Code, Cursor, Cline, Codex, Goose"},{value:"June",label:"Pro sync, backup, team memory early access"}],De=[{name:"Solo Pro",accent:"#22c55e",copy:"Multi-device sync, encrypted backups, managed updates, and a cleaner memory dashboard for developers living inside AI coding agents."},{name:"Team Pro",accent:"#06b6d4",copy:"Shared project memory, admin review, audit trails, PostgreSQL-backed deployments, and async support for engineering teams."}],Oe=["Private by default","Sync without lock-in","Team memory controls","Bot-assisted support"],ze=[{label:"Install",prompt:"How do I install Vestige and connect it to Claude Code?"},{label:"No 20GB?",prompt:"Do I need the Sanhedrin model or 20GB of RAM?"},{label:"Solo vs Team",prompt:"Should I choose Solo Pro or Team Pro?"},{label:"Sync",prompt:"How will Pro sync and backups work?"},{label:"Pricing",prompt:"How much will Vestige Pro cost?"},{label:"Human help",prompt:"When does a human get involved?"}];it(()=>{const t=q.getContext("2d");if(!t)return;const e=t;let l=0,i=0,m=0;const d=Array.from({length:62},(b,w)=>({x:Math.random(),y:Math.random(),vx:(Math.random()-.5)*16e-5,vy:(Math.random()-.5)*16e-5,phase:Math.random()*Math.PI*2,kind:w%5}));function M(){const b=Math.min(window.devicePixelRatio||1,2);i=window.innerWidth,m=window.innerHeight,q.width=Math.floor(i*b),q.height=Math.floor(m*b),q.style.width=`${i}px`,q.style.height=`${m}px`,e.setTransform(b,0,0,b,0,0)}function Me(b){e.clearRect(0,0,i,m);const w=e.createLinearGradient(0,0,i,m);w.addColorStop(0,"#07100f"),w.addColorStop(.45,"#0b1221"),w.addColorStop(1,"#15100a"),e.fillStyle=w,e.fillRect(0,0,i,m),e.strokeStyle="rgba(148, 163, 184, 0.08)",e.lineWidth=1;for(let n=0;n.96)&&(n.vx*=-1),(n.y<.06||n.y>.94)&&(n.vy*=-1);for(let n=0;n{cancelAnimationFrame(l),window.removeEventListener("resize",M)}});function Ne(){const t=["## Vestige Pro waitlist","",`Plan: ${a(I)}`,`Priority: ${a(J)}`,a(x).trim()?`Use case: ${a(x).trim()}`:"Use case:","","Please do not include private email addresses in this public issue."].join(` + It can run locally from the FAQ now and call a hosted support endpoint later.

                Onboarding bot

                May to June

                The plan is simple.

                1. May Get Vestige into every MCP, Claude Code, Cursor, local AI, Rust, and self-hosted channel that cares about agent memory.
                2. June Invite the first Solo Pro and Team Pro users into sync, backups, shared memory, PostgreSQL-backed deployments, and bot-assisted support.
                3. After Use paid feedback to turn Vestige from a beloved local tool into durable agent-memory infrastructure.
                `);function Ft(Be,Ee){ct(Ee,!0);let q,G=p(""),j=p(""),I=p("solo"),J=p("sync"),x=p(""),H=p(""),y=p("idle"),_=p(""),S=p(""),T=p(!1),C=p(mt([{role:"bot",content:"Ask me about installing Vestige, whether heavy models are required, Solo vs Team Pro, sync, pricing, or what happens after you join the June list."}]));const Fe=[{value:"Local",label:"SQLite memory, no hosted memory service"},{value:"MCP",label:"Claude Code, Cursor, Cline, Codex, Goose"},{value:"June",label:"Pro sync, backup, team memory early access"}],De=[{name:"Solo Pro",accent:"#22c55e",copy:"Multi-device sync, encrypted backups, managed updates, and a cleaner memory dashboard for developers living inside AI coding agents."},{name:"Team Pro",accent:"#06b6d4",copy:"Shared project memory, admin review, audit trails, PostgreSQL-backed deployments, and async support for engineering teams."}],Oe=["Private by default","Sync without lock-in","Team memory controls","Bot-assisted support"],ze=[{label:"Install",prompt:"How do I install Vestige and connect it to Claude Code?"},{label:"No 20GB?",prompt:"Do I need the Sanhedrin model or 20GB of RAM?"},{label:"Solo vs Team",prompt:"Should I choose Solo Pro or Team Pro?"},{label:"Sync",prompt:"How will Pro sync and backups work?"},{label:"Pricing",prompt:"How much will Vestige Pro cost?"},{label:"Human help",prompt:"When does a human get involved?"}];it(()=>{const t=q.getContext("2d");if(!t)return;const e=t;let r=0,i=0,m=0;const d=Array.from({length:62},(b,w)=>({x:Math.random(),y:Math.random(),vx:(Math.random()-.5)*16e-5,vy:(Math.random()-.5)*16e-5,phase:Math.random()*Math.PI*2,kind:w%5}));function M(){const b=Math.min(window.devicePixelRatio||1,2);i=window.innerWidth,m=window.innerHeight,q.width=Math.floor(i*b),q.height=Math.floor(m*b),q.style.width=`${i}px`,q.style.height=`${m}px`,e.setTransform(b,0,0,b,0,0)}function Me(b){e.clearRect(0,0,i,m);const w=e.createLinearGradient(0,0,i,m);w.addColorStop(0,"#07100f"),w.addColorStop(.45,"#0b1221"),w.addColorStop(1,"#15100a"),e.fillStyle=w,e.fillRect(0,0,i,m),e.strokeStyle="rgba(148, 163, 184, 0.08)",e.lineWidth=1;for(let n=0;n.96)&&(n.vx*=-1),(n.y<.06||n.y>.94)&&(n.vy*=-1);for(let n=0;n{cancelAnimationFrame(r),window.removeEventListener("resize",M)}});function Ne(){const t=["## Vestige Pro waitlist","",`Plan: ${a(I)}`,`Priority: ${a(J)}`,a(x).trim()?`Use case: ${a(x).trim()}`:"Use case:","","Please do not include private email addresses in this public issue."].join(` `);return`https://github.com/samvallad33/vestige/issues/new?title=${encodeURIComponent("Vestige Pro waitlist")}&body=${encodeURIComponent(t)}`}async function Ye(t){if(t.preventDefault(),c(y,"submitting"),c(_,""),a(H).trim()){c(y,"success"),c(_,"You are on the list.");return}if(!a(j).includes("@")){c(y,"error"),c(_,"Enter an email so the early-access invite can reach you.");return}a(G).trim(),a(j).trim(),a(I),a(J),a(x).trim(),new Date().toISOString();{c(y,"success"),c(_,"Email capture is ready for an endpoint. Opening the GitHub waitlist fallback with your email omitted."),window.open(Ne(),"_blank","noopener,noreferrer");return}}function Ke(t){const e=t.toLowerCase();return/(install|setup|onboard|claude|cursor|cline|codex|connect)/.test(e)?["Start with the open-source install:","1. `npm install -g vestige-mcp-server@latest`","2. Claude Code: `claude mcp add vestige vestige-mcp -s user`","3. Codex: `codex mcp add vestige -- vestige-mcp`","Then test it by asking your agent to remember a preference, opening a fresh session, and asking for that preference back."].join(` -`):/(sanhedrin|20gb|20 gb|ram|heavy|model|mlx|preflight|hook)/.test(e)?"No. The default Vestige path is the local MCP memory server. Sanhedrin, preflight hooks, and large local verifier models are optional. Pro should keep that promise: nobody should need a 20GB machine just to use memory.":/(solo|team|plan|seat|buying)/.test(e)?"Choose Solo Pro if you want your own multi-device memory, backups, smoother updates, and personal support. Choose Team Pro if multiple people need shared project memory, admin controls, PostgreSQL-backed storage, audit trails, or team onboarding.":/(sync|backup|device|dropbox|icloud|syncthing|postgres|postgresql|pg|central)/.test(e)?"Open-source Vestige should stay local-first. Pro is where guided sync, encrypted backups, conflict handling, and Team Pro PostgreSQL-backed storage belong. The important design rule: users own memory and can export it.":/(price|pricing|cost|pay|billing|stripe|lemon|subscription|monthly|yearly)/.test(e)?"Pricing is not final yet. The current plan is simple: Solo Pro for individual developers, Team Pro for engineering teams. Join the waitlist so early users can shape pricing before the June launch.":/(update|upgrade|curl|reinstall|version)/.test(e)?"Use `vestige update` for existing installs. The goal is that users should not need to keep copying curl commands just to stay current.":/(privacy|local|cloud|telemetry|data|where.*stored|sqlite)/.test(e)?"Vestige core stores memory locally in SQLite and does not need a hosted memory service. Pro should add convenience around sync, backup, and teams without turning private local memory into a black box.":/(support|bot|human|email|question|help|available|awake|discord)/.test(e)?"The support bot should answer common install, sync, plan, and onboarding questions instantly. Hard cases should escalate with context so a human teammate only handles the issues that actually need human judgment.":/(waitlist|june|early|launch|invite|after)/.test(e)?"After you join the waitlist, the June early-access flow should invite you into the right lane: Solo Pro for personal memory, Team Pro for shared memory and admin controls. The bot will keep onboarding answers available while the launch scales.":"I can help with install, updates, optional heavy models, Solo vs Team Pro, sync, backups, privacy, pricing, and support escalation. For now, the fastest next step is to join the waitlist and include your use case so the June onboarding can prioritize the right workflows."}async function pe(t,e){t==null||t.preventDefault();const l=(e??a(S)).trim();if(!(!l||a(T))){c(S,""),c(T,!0),c(C,[...a(C),{role:"user",content:l}],!0);{c(C,[...a(C),{role:"bot",content:Ke(l)}],!0),c(T,!1);return}}}var R=Mt();yt("1375qm6",t=>{var e=qt();pt(()=>{vt.title="Vestige Pro Waitlist"}),v(t,e)});var ve=r(R);ft(ve,t=>q=t,()=>q);var U=s(ve,4),ue=r(U),he=s(ue,2),Xe=s(r(he),2);$e(2),o(he),o(U);var be=s(U,2),B=r(be),E=r(B),ye=s(r(E),8);k(ye,21,()=>Fe,P,(t,e)=>{var l=_t(),i=r(l),m=r(i,!0);o(i);var g=s(i,2),d=r(g,!0);o(g),o(l),f(()=>{u(m,a(e).value),u(d,a(e).label)}),v(t,l)}),o(ye),o(E);var F=s(E,2),D=s(r(F),2),ge=s(r(D),2);W(ge),o(D);var O=s(D,2),fe=s(r(O),2);W(fe),o(O);var z=s(O,2),N=s(r(z),2),Y=r(N);Y.value=Y.__value="solo";var qe=s(Y);qe.value=qe.__value="team",o(N),o(z);var K=s(z,2),X=s(r(K),2),Z=r(X);Z.value=Z.__value="sync";var ee=s(Z);ee.value=ee.__value="team-memory";var te=s(ee);te.value=te.__value="postgres";var _e=s(te);_e.value=_e.__value="support-bot",o(X),o(K);var ae=s(K,2),we=s(r(ae),2);ut(we),o(ae);var se=s(ae,2),ke=s(r(se),2);W(ke),o(se);var L=s(se,2),Ze=r(L,!0);o(L);var et=s(L,2);{var tt=t=>{var e=wt();let l;var i=r(e,!0);o(e),f(()=>{l=He(e,1,"submit-message svelte-1375qm6",null,l,{success:a(y)==="success",error:a(y)==="error"}),u(i,a(_))}),v(t,e)};We(et,t=>{a(_)&&t(tt)})}o(F),o(B);var oe=s(B,2);k(oe,21,()=>Oe,P,(t,e)=>{var l=kt(),i=r(l,!0);o(l),f(()=>u(i,a(e))),v(t,l)}),o(oe);var le=s(oe,2),Pe=s(r(le),2);k(Pe,21,()=>De,P,(t,e)=>{var l=Pt(),i=s(r(l),2),m=r(i,!0);o(i);var g=s(i,2),d=r(g,!0);o(g),o(l),f(()=>{gt(l,`--track-color: ${a(e).accent}`),u(m,a(e).name),u(d,a(e).copy)}),v(t,l)}),o(Pe),o(le);var xe=s(le,2),Se=s(r(xe),2),re=r(Se),Te=s(r(re),4),at=r(Te,!0);o(Te),o(re);var ne=s(re,2),Ce=r(ne);k(Ce,17,()=>a(C),P,(t,e)=>{var l=St();let i;k(l,21,()=>a(e).content.split(` -`),P,(m,g)=>{var d=xt(),M=r(d,!0);o(d),f(()=>u(M,a(g))),v(m,d)}),o(l),f(()=>i=He(l,1,"svelte-1375qm6",null,i,{"bot-bubble":a(e).role==="bot","user-bubble":a(e).role==="user"})),v(t,l)});var st=s(Ce,2);{var ot=t=>{var e=Tt();v(t,e)};We(st,t=>{a(T)&&t(ot)})}o(ne);var ie=s(ne,2);k(ie,21,()=>ze,P,(t,e)=>{var l=Ct(),i=r(l,!0);o(l),f(()=>u(i,a(e).label)),bt("click",l,()=>pe(void 0,a(e).prompt)),v(t,l)}),o(ie);var ce=s(ie,2),me=r(ce);W(me);var lt=s(me,2);o(ce),o(Se),o(xe),$e(2),o(be),o(R),f(t=>{Ge(ue,"href",`${Ue}/waitlist`),Ge(Xe,"href",`${Ue}/graph`),L.disabled=a(y)==="submitting",u(Ze,a(y)==="submitting"?"Saving...":"Join June early access"),u(at,"FAQ mode"),lt.disabled=t},[()=>a(T)||!a(S).trim()]),Qe("submit",F,Ye),V(ge,()=>a(G),t=>c(G,t)),V(fe,()=>a(j),t=>c(j,t)),Re(N,()=>a(I),t=>c(I,t)),Re(X,()=>a(J),t=>c(J,t)),V(we,()=>a(x),t=>c(x,t)),V(ke,()=>a(H),t=>c(H,t)),Qe("submit",ce,pe),V(me,()=>a(S),t=>c(S,t)),v(Be,R),dt()}ht(["click"]);export{Ut as component}; +`):/(sanhedrin|20gb|20 gb|ram|heavy|model|mlx|preflight|hook)/.test(e)?"No. The default Vestige path is the local MCP memory server. Sanhedrin, preflight hooks, and large local verifier models are optional. Pro should keep that promise: nobody should need a 20GB machine just to use memory.":/(solo|team|plan|seat|buying)/.test(e)?"Choose Solo Pro if you want your own multi-device memory, backups, smoother updates, and personal support. Choose Team Pro if multiple people need shared project memory, admin controls, PostgreSQL-backed storage, audit trails, or team onboarding.":/(sync|backup|device|dropbox|icloud|syncthing|postgres|postgresql|pg|central)/.test(e)?"Open-source Vestige should stay local-first. Pro is where guided sync, encrypted backups, conflict handling, and Team Pro PostgreSQL-backed storage belong. The important design rule: users own memory and can export it.":/(price|pricing|cost|pay|billing|stripe|lemon|subscription|monthly|yearly)/.test(e)?"Pricing is not final yet. The current plan is simple: Solo Pro for individual developers, Team Pro for engineering teams. Join the waitlist so early users can shape pricing before the June launch.":/(update|upgrade|curl|reinstall|version)/.test(e)?"Use `vestige update` for existing installs. The goal is that users should not need to keep copying curl commands just to stay current.":/(privacy|local|cloud|telemetry|data|where.*stored|sqlite)/.test(e)?"Vestige core stores memory locally in SQLite and does not need a hosted memory service. Pro should add convenience around sync, backup, and teams without turning private local memory into a black box.":/(support|bot|human|email|question|help|available|awake|discord)/.test(e)?"The support bot should answer common install, sync, plan, and onboarding questions instantly. Hard cases should escalate with context so a human teammate only handles the issues that actually need human judgment.":/(waitlist|june|early|launch|invite|after)/.test(e)?"After you join the waitlist, the June early-access flow should invite you into the right lane: Solo Pro for personal memory, Team Pro for shared memory and admin controls. The bot will keep onboarding answers available while the launch scales.":"I can help with install, updates, optional heavy models, Solo vs Team Pro, sync, backups, privacy, pricing, and support escalation. For now, the fastest next step is to join the waitlist and include your use case so the June onboarding can prioritize the right workflows."}async function pe(t,e){t==null||t.preventDefault();const r=(e??a(S)).trim();if(!(!r||a(T))){c(S,""),c(T,!0),c(C,[...a(C),{role:"user",content:r}],!0);{c(C,[...a(C),{role:"bot",content:Ke(r)}],!0),c(T,!1);return}}}var R=Mt();yt("1375qm6",t=>{var e=qt();pt(()=>{vt.title="Vestige Pro Waitlist"}),u(t,e)});var ve=l(R);ft(ve,t=>q=t,()=>q);var U=s(ve,4),ue=l(U),he=s(ue,2),Xe=s(l(he),2);$e(2),o(he),o(U);var be=s(U,2),B=l(be),E=l(B),ye=s(l(E),8);P(ye,21,()=>Fe,k,(t,e)=>{var r=_t(),i=l(r),m=l(i,!0);o(i);var g=s(i,2),d=l(g,!0);o(g),o(r),f(()=>{v(m,a(e).value),v(d,a(e).label)}),u(t,r)}),o(ye),o(E);var F=s(E,2),D=s(l(F),2),ge=s(l(D),2);W(ge),o(D);var O=s(D,2),fe=s(l(O),2);W(fe),o(O);var z=s(O,2),N=s(l(z),2),Y=l(N);Y.value=Y.__value="solo";var qe=s(Y);qe.value=qe.__value="team",o(N),o(z);var K=s(z,2),X=s(l(K),2),Z=l(X);Z.value=Z.__value="sync";var ee=s(Z);ee.value=ee.__value="team-memory";var te=s(ee);te.value=te.__value="postgres";var _e=s(te);_e.value=_e.__value="support-bot",o(X),o(K);var ae=s(K,2),we=s(l(ae),2);ut(we),o(ae);var se=s(ae,2),Pe=s(l(se),2);W(Pe),o(se);var L=s(se,2),Ze=l(L,!0);o(L);var et=s(L,2);{var tt=t=>{var e=wt();let r;var i=l(e,!0);o(e),f(()=>{r=He(e,1,"submit-message svelte-1375qm6",null,r,{success:a(y)==="success",error:a(y)==="error"}),v(i,a(_))}),u(t,e)};We(et,t=>{a(_)&&t(tt)})}o(F),o(B);var oe=s(B,2);P(oe,21,()=>Oe,k,(t,e)=>{var r=Pt(),i=l(r,!0);o(r),f(()=>v(i,a(e))),u(t,r)}),o(oe);var re=s(oe,2),ke=s(l(re),2);P(ke,21,()=>De,k,(t,e)=>{var r=kt(),i=s(l(r),2),m=l(i,!0);o(i);var g=s(i,2),d=l(g,!0);o(g),o(r),f(()=>{gt(r,`--track-color: ${a(e).accent}`),v(m,a(e).name),v(d,a(e).copy)}),u(t,r)}),o(ke),o(re);var xe=s(re,2),Se=s(l(xe),2),le=l(Se),Te=s(l(le),4),at=l(Te,!0);o(Te),o(le);var ne=s(le,2),Ce=l(ne);P(Ce,17,()=>a(C),k,(t,e)=>{var r=St();let i;P(r,21,()=>a(e).content.split(` +`),k,(m,g)=>{var d=xt(),M=l(d,!0);o(d),f(()=>v(M,a(g))),u(m,d)}),o(r),f(()=>i=He(r,1,"svelte-1375qm6",null,i,{"bot-bubble":a(e).role==="bot","user-bubble":a(e).role==="user"})),u(t,r)});var st=s(Ce,2);{var ot=t=>{var e=Tt();u(t,e)};We(st,t=>{a(T)&&t(ot)})}o(ne);var ie=s(ne,2);P(ie,21,()=>ze,k,(t,e)=>{var r=Ct(),i=l(r,!0);o(r),f(()=>v(i,a(e).label)),bt("click",r,()=>pe(void 0,a(e).prompt)),u(t,r)}),o(ie);var ce=s(ie,2),me=l(ce);W(me);var rt=s(me,2);o(ce),o(Se),o(xe),$e(2),o(be),o(R),f(t=>{Ge(ue,"href",`${Ue}/waitlist`),Ge(Xe,"href",`${Ue}/graph`),L.disabled=a(y)==="submitting",v(Ze,a(y)==="submitting"?"Saving...":"Join June early access"),v(at,"FAQ mode"),rt.disabled=t},[()=>a(T)||!a(S).trim()]),Qe("submit",F,Ye),V(ge,()=>a(G),t=>c(G,t)),V(fe,()=>a(j),t=>c(j,t)),Re(N,()=>a(I),t=>c(I,t)),Re(X,()=>a(J),t=>c(J,t)),V(we,()=>a(x),t=>c(x,t)),V(Pe,()=>a(H),t=>c(H,t)),Qe("submit",ce,pe),V(me,()=>a(S),t=>c(S,t)),u(Be,R),dt()}ht(["click"]);export{Ft as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/20.BwEdZXUF.js.br b/apps/dashboard/build/_app/immutable/nodes/20.BwEdZXUF.js.br new file mode 100644 index 0000000..469e075 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/20.BwEdZXUF.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/20.BwEdZXUF.js.gz b/apps/dashboard/build/_app/immutable/nodes/20.BwEdZXUF.js.gz new file mode 100644 index 0000000..2d1f99e Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/20.BwEdZXUF.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/20.Di2Q3Va0.js b/apps/dashboard/build/_app/immutable/nodes/20.Di2Q3Va0.js deleted file mode 100644 index 145180a..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/20.Di2Q3Va0.js +++ /dev/null @@ -1 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{o as Rt}from"../chunks/TZu9D97Z.js";import{p as Ct,a as p,b as kt,j as f,e,l as dt,i as D,c as At,f as lt,g as t,h as i,r as a,t as j,s as J,n as K,u as Q}from"../chunks/wpu9U-D0.js";import{d as Mt,s as R,a as Pt}from"../chunks/D8mhvFt8.js";import{i as V}from"../chunks/DKve45Wd.js";import{e as W,i as X}from"../chunks/60_R_Vbt.js";import{a as c,r as C}from"../chunks/P1-U_Xsj.js";import{s as B}from"../chunks/EqHb-9AZ.js";import{a as S}from"../chunks/CZfHMhLI.js";import{P as Dt}from"../chunks/BHDZZvku.js";import{A as U}from"../chunks/DcKTNC6e.js";import{s as Z}from"../chunks/DPdYG9yN.js";import{N as ut}from"../chunks/CcUbQ_Wl.js";var St=f('
                '),Et=f('
                '),Ot=f('
                '),Tt=f('
                '),Nt=f('
                '),jt=f('
                '),Bt=f('

                '),Ft=f('

                Retention Distribution

                Memory Types

                ',1),Lt=f('
                Total Memories
                Avg Retention
                Due for Review
                Embedding Coverage
                ',1),Ht=f('
                ');function aa(mt,pt){Ct(pt,!0);let _=J(null),h=J(null),b=J(null),ot=J(!0);Rt(async()=>{try{await(async n=>{var o=dt(n,3);D(_,o[0],!0),D(h,o[1],!0),D(b,o[2],!0)})(await Promise.all([S.stats(),S.health(),S.retentionDistribution()]))}catch{}finally{D(ot,!1)}});function tt(n){return{healthy:"#10b981",degraded:"#f59e0b",critical:"#ef4444",empty:"#6b7280"}[n]||"#6b7280"}async function gt(){try{await S.consolidate(),await(async n=>{var o=dt(n,3);D(_,o[0],!0),D(h,o[1],!0),D(b,o[2],!0)})(await Promise.all([S.stats(),S.health(),S.retentionDistribution()]))}catch{}}var at=Ht(),nt=e(at);Dt(nt,{icon:"stats",title:"System Stats",subtitle:"Live health and retention across your memory store",accent:"recall",children:(n,o)=>{var w=At(),$=lt(w);{var E=F=>{var g=St(),O=e(g),L=i(O,2),k=e(L,!0);a(L);var H=i(L,2),et=e(H);a(H),a(g),j((T,Y,rt,q)=>{B(g,`color: ${T??""}`),B(O,`color: ${Y??""}; background: ${rt??""}`),R(k,q),R(et,`v${t(h).version??""}`)},[()=>tt(t(h).status),()=>tt(t(h).status),()=>tt(t(h).status),()=>t(h).status.toUpperCase()]),p(F,g)};V($,F=>{t(h)&&F(E)})}p(n,w)},$$slots:{default:!0}});var xt=i(nt,2);{var ft=n=>{var o=Ot();W(o,20,()=>Array(8),X,(w,$)=>{var E=Et();p(w,E)}),a(o),p(n,o)},_t=n=>{var o=Lt(),w=lt(o),$=e(w),E=e($),F=e(E);U(F,{get value(){return t(_).totalMemories}}),a(E),K(2),a($),c($,(s,r)=>{var d;return(d=C)==null?void 0:d(s,r)},()=>({delay:0})),c($,s=>{var r;return(r=Z)==null?void 0:r(s)});var g=i($,2),O=e(g),L=e(O);U(L,{get value(){return t(_).averageRetention},scale:100,decimals:1,suffix:"%"}),a(O),K(2),a(g),c(g,(s,r)=>{var d;return(d=C)==null?void 0:d(s,r)},()=>({delay:70})),c(g,s=>{var r;return(r=Z)==null?void 0:r(s)});var k=i(g,2),H=e(k),et=e(H);U(et,{get value(){return t(_).dueForReview}}),a(H),K(2),a(k),c(k,(s,r)=>{var d;return(d=C)==null?void 0:d(s,r)},()=>({delay:140})),c(k,s=>{var r;return(r=Z)==null?void 0:r(s)});var T=i(k,2),Y=e(T),rt=e(Y);U(rt,{get value(){return t(_).embeddingCoverage},decimals:0,suffix:"%"}),a(Y),K(2),a(T),c(T,(s,r)=>{var d;return(d=C)==null?void 0:d(s,r)},()=>({delay:210})),c(T,s=>{var r;return(r=Z)==null?void 0:r(s)}),a(w);var q=i(w,2);{var ht=s=>{var r=Ft(),d=lt(r),vt=i(e(d),2);W(vt,21,()=>t(b).distribution,X,(u,l,x)=>{const A=Q(()=>Math.max(...t(b).distribution.map(I=>I.count),1)),N=Q(()=>t(l).count/t(A)*100),y=Q(()=>x<3?"#ef4444":x<5?"#f59e0b":x<7?"#10b981":"#6366f1");var v=Tt(),m=e(v),M=e(m,!0);a(m);var P=i(m,2),z=i(P,2),it=e(z,!0);a(z),a(v),j(()=>{R(M,t(l).count),B(P,`height: ${t(N)??""}%; background: ${t(y)??""}; opacity: 0.7; min-height: 2px`),R(it,t(l).range)}),p(u,v)}),a(vt),a(d),c(d,u=>{var l;return(l=C)==null?void 0:l(u)});var G=i(d,2),ct=i(e(G),2);W(ct,21,()=>Object.entries(t(b).byType),X,(u,l)=>{var x=Q(()=>dt(t(l),2));let A=()=>t(x)[0],N=()=>t(x)[1];var y=Nt(),v=e(y),m=i(v,2),M=e(m,!0);a(m);var P=i(m,2),z=e(P);U(z,{get value(){return N()}}),a(P),a(y),j(()=>{B(v,`background: ${(ut[A()]||"#8B95A5")??""}; box-shadow: 0 0 8px ${(ut[A()]||"#8B95A5")??""}80`),R(M,A())}),p(u,y)}),a(ct),a(G),c(G,u=>{var l;return(l=C)==null?void 0:l(u)});var yt=i(G,2);{var wt=u=>{var l=Bt(),x=e(l),A=i(e(x));a(x);var N=i(x,2);W(N,21,()=>t(b).endangered.slice(0,20),X,(y,v)=>{var m=jt(),M=e(m),P=e(M);a(M);var z=i(M,2),it=e(z);a(z);var I=i(z,2),$t=e(I,!0);a(I),a(m),j(zt=>{R(P,`${zt??""}%`),B(it,`width: ${t(v).retentionStrength*100}%`),R($t,t(v).content)},[()=>(t(v).retentionStrength*100).toFixed(0)]),p(y,m)}),a(N),a(l),c(l,y=>{var v;return(v=C)==null?void 0:v(y)}),j(()=>R(A,` Endangered Memories (${t(b).endangered.length??""})`)),p(u,l)};V(yt,u=>{t(b).endangered.length>0&&u(wt)})}p(s,r)};V(q,s=>{t(b)&&s(ht)})}var st=i(q,2),bt=e(st);a(st),c(st,s=>{var r;return(r=C)==null?void 0:r(s)}),j(()=>B(O,`color: ${t(_).averageRetention>.7?"var(--color-recall)":t(_).averageRetention>.4?"var(--color-warning)":"var(--color-decay)"}`)),Pt("click",bt,gt),p(n,o)};V(xt,n=>{t(ot)?n(ft):t(_)&&t(h)&&n(_t,1)})}a(at),p(mt,at),kt()}Mt(["click"]);export{aa as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/20.Di2Q3Va0.js.br b/apps/dashboard/build/_app/immutable/nodes/20.Di2Q3Va0.js.br deleted file mode 100644 index fdc3112..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/20.Di2Q3Va0.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/20.Di2Q3Va0.js.gz b/apps/dashboard/build/_app/immutable/nodes/20.Di2Q3Va0.js.gz deleted file mode 100644 index 683ae7f..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/20.Di2Q3Va0.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/21.BAlasPHS.js b/apps/dashboard/build/_app/immutable/nodes/21.BAlasPHS.js deleted file mode 100644 index 6cb15a2..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/21.BAlasPHS.js +++ /dev/null @@ -1,3 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{o as ce}from"../chunks/TZu9D97Z.js";import{p as pe,s as x,d as ue,a as d,b as _e,j as v,e as t,i as u,g as e,n as O,r as a,h as c,u as fe,t as h}from"../chunks/wpu9U-D0.js";import{d as xe,s as y,a as be}from"../chunks/D8mhvFt8.js";import{i as P}from"../chunks/DKve45Wd.js";import{e as w,i as B,s as ge}from"../chunks/60_R_Vbt.js";import{a as he,r as ye}from"../chunks/P1-U_Xsj.js";import{s as q}from"../chunks/EqHb-9AZ.js";import{a as we}from"../chunks/CZfHMhLI.js";import{N as I}from"../chunks/CcUbQ_Wl.js";import{P as ke}from"../chunks/BHDZZvku.js";import{A as G}from"../chunks/DcKTNC6e.js";import{D as $e}from"../chunks/CmbJHhgy.js";import{I as Ae}from"../chunks/D7A-gG4Z.js";var Le=v('
                memories
                '),Te=v('
                '),De=v('
                '),je=v(`

                No memories in this window yet — widen the range or come back once Vestige has - been remembering a while.

                `),Ce=v('
                '),Ne=v(' '),Oe=v('
                '),Pe=v('
                '),Be=v('
                '),Ie=v('
                '),Me=v('
                ');function Ue(J,K){pe(K,!0);let f=x(ue([])),k=x(!0),M=x(14),b=x(null);ce(()=>S());async function S(){u(k,!0);try{const s=await we.timeline(e(M),500);u(f,s.timeline,!0)}catch{u(f,[],!0)}finally{u(k,!1)}}const Q=[{value:"7",label:"Last 7 days"},{value:"14",label:"Last 14 days"},{value:"30",label:"Last 30 days"},{value:"90",label:"Last 90 days"},{value:"365",label:"Last year"}];let E=x("14");function U(s){u(M,parseInt(s,10),!0),S()}let X=fe(()=>e(f).reduce((s,r)=>s+r.count,0));var $=Me(),R=t($);ke(R,{icon:"timeline",title:"Timeline",subtitle:"Watch your memories accumulate, day by day",accent:"synapse",children:(s,r)=>{var l=Le(),m=t(l),i=t(m);G(i,{get value(){return e(X)}}),O(),a(m);var A=c(m,2);$e(A,{get options(){return Q},label:"Range",icon:"schedule",onChange:U,get value(){return e(E)},set value(_){u(E,_,!0)}}),a(l),d(s,l)},$$slots:{default:!0}});var Z=c(R,2);{var ee=s=>{var r=De();w(r,20,()=>Array(7),B,(l,m)=>{var i=Te();d(l,i)}),a(r),d(s,r)},ae=s=>{var r=je(),l=t(r),m=t(l);Ae(m,{name:"timeline",size:48,strokeWidth:1.2}),a(l),O(2),a(r),d(s,r)},te=s=>{var r=Ie(),l=c(t(r),2);w(l,23,()=>e(f),m=>m.date,(m,i,A)=>{var _=Be(),g=c(t(_),2),L=t(g),T=t(L),D=t(T),se=t(D,!0);a(D);var W=c(D,2),re=t(W);G(re,{get value(){return e(i).count}}),O(),a(W),a(T);var z=c(T,2),F=t(z);w(F,17,()=>e(i).memories.slice(0,10),B,(n,o)=>{var p=Ce();h(()=>q(p,`background: ${(I[e(o).nodeType]||"#8B95A5")??""}; opacity: ${.3+e(o).retentionStrength*.7}; box-shadow: 0 0 5px ${(I[e(o).nodeType]||"#8B95A5")??""}66`)),d(n,p)});var ie=c(F,2);{var oe=n=>{var o=Ne(),p=t(o);a(o),h(()=>y(p,`+${e(i).memories.length-10}`)),d(n,o)};P(ie,n=>{e(i).memories.length>10&&n(oe)})}a(z),a(L);var le=c(L,2);{var ne=n=>{var o=Pe();w(o,21,()=>e(i).memories,B,(p,j)=>{var C=Oe(),H=t(C),N=c(H,2),V=t(N),de=t(V,!0);a(V),a(N);var Y=c(N,2),ve=t(Y);a(Y),a(C),h(me=>{q(H,`background: ${(I[e(j).nodeType]||"#8B95A5")??""}`),y(de,e(j).content),y(ve,`${me??""}%`)},[()=>(e(j).retentionStrength*100).toFixed(0)]),d(p,C)}),a(o),d(n,o)};P(le,n=>{e(b)===e(i).date&&n(ne)})}a(g),a(_),he(_,(n,o)=>{var p;return(p=ye)==null?void 0:p(n,o)},()=>({delay:Math.min(e(A)*35,350),y:12})),h(()=>{ge(g,1,`lift w-full text-left p-4 glass-subtle rounded-xl hover:bg-white/[0.04] transition-all duration-200 - ${e(b)===e(i).date?"!border-synapse/40 glow-synapse":""}`),y(se,e(i).date)}),be("click",g,()=>u(b,e(b)===e(i).date?null:e(i).date,!0)),d(m,_)}),a(l),a(r),d(s,r)};P(Z,s=>{e(k)?s(ee):e(f).length===0?s(ae,1):s(te,!1)})}a($),d(J,$),_e()}xe(["click"]);export{Ue as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/21.BAlasPHS.js.br b/apps/dashboard/build/_app/immutable/nodes/21.BAlasPHS.js.br deleted file mode 100644 index 4105f13..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/21.BAlasPHS.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/21.BAlasPHS.js.gz b/apps/dashboard/build/_app/immutable/nodes/21.BAlasPHS.js.gz deleted file mode 100644 index 6a542c2..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/21.BAlasPHS.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/22.C719k-1W.js.br b/apps/dashboard/build/_app/immutable/nodes/22.C719k-1W.js.br deleted file mode 100644 index 44eb9a2..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/22.C719k-1W.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/22.C719k-1W.js.gz b/apps/dashboard/build/_app/immutable/nodes/22.C719k-1W.js.gz deleted file mode 100644 index 8269504..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/22.C719k-1W.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/3.C8tBBpzF.js b/apps/dashboard/build/_app/immutable/nodes/3.C8tBBpzF.js deleted file mode 100644 index f32c7fa..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/3.C8tBBpzF.js +++ /dev/null @@ -1 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{i as p}from"../chunks/BLadwbF7.js";import{o as r}from"../chunks/TZu9D97Z.js";import{p as t,b as a}from"../chunks/wpu9U-D0.js";import{g as m}from"../chunks/dCAmqaEc.js";function g(i,o){t(o,!1),r(()=>m("/graph",{replaceState:!0})),p(),a()}export{g as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/3.C8tBBpzF.js.br b/apps/dashboard/build/_app/immutable/nodes/3.C8tBBpzF.js.br deleted file mode 100644 index cab233b..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/3.C8tBBpzF.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/3.C8tBBpzF.js.gz b/apps/dashboard/build/_app/immutable/nodes/3.C8tBBpzF.js.gz deleted file mode 100644 index 55534f3..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/3.C8tBBpzF.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/3.Caati8mq.js b/apps/dashboard/build/_app/immutable/nodes/3.Caati8mq.js new file mode 100644 index 0000000..1814225 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/3.Caati8mq.js @@ -0,0 +1 @@ +import"../chunks/Bzak7iHL.js";import{i as p}from"../chunks/BUoSzNdg.js";import{o as r}from"../chunks/GG5zm9kr.js";import{p as t,a}from"../chunks/CpWkWWOo.js";import{g as m}from"../chunks/BHGLDPij.js";function g(i,o){t(o,!1),r(()=>m("/graph",{replaceState:!0})),p(),a()}export{g as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/3.Caati8mq.js.br b/apps/dashboard/build/_app/immutable/nodes/3.Caati8mq.js.br new file mode 100644 index 0000000..1830c35 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/3.Caati8mq.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/3.Caati8mq.js.gz b/apps/dashboard/build/_app/immutable/nodes/3.Caati8mq.js.gz new file mode 100644 index 0000000..9de279d Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/3.Caati8mq.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/4.BpOpkZuP.js b/apps/dashboard/build/_app/immutable/nodes/4.BpOpkZuP.js deleted file mode 100644 index 7a9f2b2..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/4.BpOpkZuP.js +++ /dev/null @@ -1,5 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{o as Me,a as Se}from"../chunks/TZu9D97Z.js";import{p as Ae,s as I,d as ue,o as xe,h as y,e as n,t as L,g as e,a as E,c as Ge,f as ke,u as ve,r as c,b as Be,i as p,au as ne,j as Y,n as oe}from"../chunks/wpu9U-D0.js";import{s as j,d as Ce,a as ge}from"../chunks/D8mhvFt8.js";import{i as fe}from"../chunks/DKve45Wd.js";import{a as ye,r as Re}from"../chunks/P1-U_Xsj.js";import{e as pe,a as u,i as he,s as Le,r as be}from"../chunks/60_R_Vbt.js";import{b as Te,a as Oe}from"../chunks/CnZzd20v.js";import{a as _e}from"../chunks/CZfHMhLI.js";import{e as De}from"../chunks/BhIgFntf.js";import{p as J}from"../chunks/ByYB047u.js";import{N as je}from"../chunks/CcUbQ_Wl.js";import{P as Ke}from"../chunks/BHDZZvku.js";import{I as de}from"../chunks/D7A-gG4Z.js";import{A as Ue}from"../chunks/DcKTNC6e.js";import{m as ze}from"../chunks/DPdYG9yN.js";const qe=.93,Ye=.05,we="#8B95A5",He="#818cf8",Ve=140,me=8,Qe=4,We=12;function Xe(a){return!Number.isFinite(a)||a<=0?0:a*qe}function Je(a){return Number.isFinite(a)?a>=Ye:!1}function Ie(a){return!Number.isFinite(a)||atypeof w=="string");S.length!==0&&v.push({source_id:M.source_id,target_ids:S})}return v.reverse()}var st=ne(''),it=ne(''),at=ne(' '),ot=ne(''),nt=ne('');function ct(a,m){Ae(m,!0);let v=J(m,"width",3,900),h=J(m,"height",3,560),M=J(m,"source",3,null),S=J(m,"neighbours",19,()=>[]),w=J(m,"liveBurstKey",3,0),B=J(m,"liveBurst",3,null);const P=22,Z=14;let F=I(ue([])),G=I(ue([])),T=I(ue([])),H=0,K=null,ce=null,$=0;function ee(l,r,x,b){H+=1;const i=H,f=w()>0&&e(F).length>0?40:0,g=x+(Math.random()-.5)*f,_=b+(Math.random()-.5)*f;p(T,[...e(T),{burstId:i,x:g,y:_,radius:P,opacity:.75},{burstId:i,x:g,y:_,radius:P,opacity:.5}],!0);const X={id:`${l.id}::${i}`,label:l.label,nodeType:"source",x:g,y:_,activation:1,isSource:!0,sourceBurstId:i},U=[],C=[],R=H*.37%(Math.PI*2),se=Ze(g,_,r.length,R);r.forEach((z,ie)=>{const ae=se[ie];ae&&(U.push({id:`${z.id}::${i}`,label:z.label,nodeType:z.nodeType,x:ae.x,y:ae.y,activation:$e(ie,r.length),isSource:!1,sourceBurstId:i}),C.push({burstId:i,sourceNodeId:X.id,targetNodeId:`${z.id}::${i}`,drawProgress:0,staggerDelay:et(ie),framesElapsed:0}))}),p(F,[...e(F),X,...U],!0),p(G,[...e(G),...C],!0)}function V(){let l=[];for(const i of e(F)){const f=Xe(i.activation);Je(f)&&l.push({...i,activation:f})}p(F,l,!0);const r=new Set(l.map(i=>i.id));let x=[];for(const i of e(G)){if(!r.has(i.sourceNodeId)||!r.has(i.targetNodeId))continue;const f=i.framesElapsed+1;let g=i.drawProgress;f>=i.staggerDelay&&(g=Math.min(1,g+1/15)),x.push({...i,framesElapsed:f,drawProgress:g})}p(G,x,!0);let b=[];for(const i of e(T)){const f=i.radius+6,g=i.opacity*.96;g<.02||f>Math.max(v(),h())||b.push({...i,radius:f,opacity:g})}p(T,b,!0),K=requestAnimationFrame(V)}function Q(){p(F,[],!0),p(G,[],!0),p(T,[],!0)}xe(()=>{if(!M())return;const l=M().id;l!==ce&&(ce=l,Q(),ee(M(),S(),v()/2,h()/2))}),xe(()=>{if(!B()||w()===0||w()===$)return;$=w();const l=(Math.random()-.5)*120,r=(Math.random()-.5)*120;ee(B().source,B().neighbours,v()/2+l,h()/2+r)}),Me(()=>{K=requestAnimationFrame(V)}),Se(()=>{K!==null&&cancelAnimationFrame(K)});function le(l,r){return tt(l,r)}function te(l){const r=e(F).find(f=>f.id===l.sourceNodeId),x=e(F).find(f=>f.id===l.targetNodeId);if(!r||!x)return null;const b=r.x+(x.x-r.x)*l.drawProgress,i=r.y+(x.y-r.y)*l.drawProgress;return{x1:r.x,y1:r.y,x2:b,y2:i}}var O=nt(),q=y(n(O));pe(q,17,()=>e(T),he,(l,r)=>{var x=st();L(()=>{u(x,"cx",e(r).x),u(x,"cy",e(r).y),u(x,"r",e(r).radius),u(x,"opacity",e(r).opacity)}),E(l,x)});var re=y(q);pe(re,17,()=>e(G),he,(l,r)=>{const x=ve(()=>te(e(r)));var b=Ge(),i=ke(b);{var f=g=>{var _=it();L(()=>{u(_,"x1",e(x).x1),u(_,"y1",e(x).y1),u(_,"x2",e(x).x2),u(_,"y2",e(x).y2),u(_,"opacity",.35*e(r).drawProgress)}),E(g,_)};fe(i,g=>{e(x)&&g(f)})}E(l,b)});var W=y(re);pe(W,17,()=>e(F),l=>l.id,(l,r)=>{const x=ve(()=>le(e(r).nodeType,e(r).isSource)),b=ve(()=>e(r).isSource?P*(.7+.3*e(r).activation):Z*(.5+.8*e(r).activation));var i=ot(),f=n(i),g=y(f),_=y(g),X=y(_);{var U=C=>{var R=at(),se=n(R,!0);c(R),L(z=>{u(R,"x",e(r).x),u(R,"y",e(r).y+e(b)+18),u(R,"opacity",.9*e(r).activation),j(se,z)},[()=>e(r).label.length>40?e(r).label.slice(0,40)+"…":e(r).label]),E(C,R)};fe(X,C=>{e(r).isSource&&e(r).label&&C(U)})}c(i),L(C=>{u(i,"opacity",C),u(f,"cx",e(r).x),u(f,"cy",e(r).y),u(f,"r",e(b)*1.9),u(f,"fill",e(x)),u(f,"opacity",.18*e(r).activation),u(g,"cx",e(r).x),u(g,"cy",e(r).y),u(g,"r",e(b)),u(g,"fill",e(x)),u(_,"cx",e(r).x-e(b)*.3),u(_,"cy",e(r).y-e(b)*.3),u(_,"r",e(b)*.35),u(_,"opacity",.35*e(r).activation)},[()=>Math.min(1,e(r).activation*1.25)]),E(l,i)}),c(O),L(()=>{u(O,"width",v()),u(O,"height",h()),u(O,"viewBox",`0 0 ${v()??""} ${h()??""}`)}),E(a,O),Be()}var lt=Y('
                · bursts
                '),dt=Y('

                Computing activation…

                '),ut=Y('

                Activation failed

                '),ft=Y(`

                No matching memory

                Nothing in the graph matches . Try a broader - query or switch on live mode to watch the engine fire its own - bursts.

                `),vt=Y(`

                Waiting for activation

                Seed a burst with the search bar above, or enable live mode to - overlay bursts from the cognitive engine as they happen.

                `),pt=Y('
                Seed

                '),mt=Y(`
                Seed Memory
                Live bursts fired:
                `);function Gt(a,m){Ae(m,!0);let v=I(""),h=I(!1),M=I(!1),S=I(null),w=I(null),B=I(ue([])),P=I(!0),Z=I(0),F=I(null),G=I(0);const T=new Map;function H(t){T.set(t.id,t)}function K(t){return{id:t.id,label:ce(t.content,t.id),nodeType:t.nodeType}}function ce(t,s){if(t&&t.trim().length>0){const o=t.trim();return o.length>60?o.slice(0,60)+"…":o}return s.slice(0,8)}function $(t){const s=T.get(t);return s?K(s):{id:t,label:t.slice(0,8),nodeType:"note"}}async function ee(){const t=e(v).trim();if(!t){p(S,null);return}p(h,!0),p(M,!0),p(S,null),p(w,null),p(B,[],!0);try{const s=await _e.search(t,1);if(!s.results||s.results.length===0)return;const o=s.results[0];H(o),p(w,K(o),!0);const d=await _e.explore(o.id,"associations",void 0,15),N=(d==null?void 0:d.results)??(d==null?void 0:d.nodes)??(d==null?void 0:d.associations)??[],A=[];for(const k of N){if(!k||typeof k!="object"||!("id"in k))continue;const D=k;H(D),A.push(K(D))}p(B,A,!0)}catch(s){p(S,s instanceof Error?s.message:String(s),!0),p(w,null),p(B,[],!0)}finally{p(h,!1)}}let V=null,Q=null,le=!1;Me(()=>{V=De.subscribe(t=>{if(!t||t.length===0)return;if(!le){Q=t[0],le=!0;return}if(!e(P)){Q=t[0];return}const s=rt(t,Q);if(Q=t[0],s.length!==0)for(const o of s){const d=$(o.source_id),N=o.target_ids.map(A=>$(A));p(Z,e(Z)+1),p(F,{source:d,neighbours:N},!0),p(G,e(G)+1)}})}),Se(()=>{V&&V()});var te=mt(),O=n(te);Ke(O,{icon:"activation",title:"Spreading Activation",subtitle:"Collins & Loftus 1975 — activation spreads from a seed memory to neighbours along semantic edges, decaying 0.93 per frame until it drops below 0.05. Search seeds a focused burst; live mode overlays every engine spread in real time.",accent:"synapse",children:(t,s)=>{var o=lt(),d=n(o);let N;var A=y(d,2),k=n(A,!0);c(A);var D=y(A,4);Ue(D,{get value(){return e(G)},class:"text-synapse-glow font-semibold"}),oe(2),c(o),L(()=>{N=Le(d,1,"ping-host inline-flex h-2 w-2 rounded-full",null,N,{breathe:e(P)}),j(k,e(P)?"Live":"Paused")}),E(t,o)},$$slots:{default:!0}});var q=y(O,2),re=y(n(q),2),W=n(re);be(W);var l=y(W,2),r=n(l);de(r,{name:"activation",size:15});var x=y(r);c(l),ye(l,t=>{var s;return(s=ze)==null?void 0:s(t)}),c(re),c(q),ye(q,(t,s)=>{var o;return(o=Re)==null?void 0:o(t,s)},()=>({delay:60}));var b=y(q,2),i=n(b),f=n(i);be(f),oe(2),c(i);var g=y(i,2),_=y(n(g)),X=n(_,!0);c(_),c(g),c(b);var U=y(b,2),C=n(U);{var R=t=>{var s=dt(),o=n(s),d=n(o),N=n(d);de(N,{name:"activation",size:32}),c(d),oe(2),c(o),c(s),E(t,s)},se=t=>{var s=ut(),o=n(s),d=y(n(o),4),N=n(d,!0);c(d),c(o),c(s),L(()=>j(N,e(S))),E(t,s)},z=t=>{var s=ft(),o=n(s),d=n(o),N=n(d);de(N,{name:"search",size:30}),c(d);var A=y(d,4),k=y(n(A)),D=n(k);c(k),oe(),c(A),c(o),c(s),L(()=>j(D,`"${e(v)??""}"`)),E(t,s)},ie=t=>{var s=vt(),o=n(s),d=n(o),N=n(d);de(N,{name:"activation",size:32}),c(d),oe(4),c(o),c(s),E(t,s)},ae=t=>{ct(t,{width:1040,height:560,get source(){return e(w)},get neighbours(){return e(B)},get liveBurstKey(){return e(Z)},get liveBurst(){return e(F)}})};fe(C,t=>{e(h)?t(R):e(S)?t(se,1):!e(w)&&e(M)?t(z,2):e(w)?t(ae,!1):t(ie,3)})}c(U);var Ee=y(U,2);{var Pe=t=>{var s=pt(),o=y(n(s),2),d=n(o,!0);c(o);var N=y(o,2),A=n(N),k=n(A,!0);c(A);var D=y(A,2),Fe=n(D);c(D),c(N),c(s),L(()=>{j(d,e(w).label),j(k,e(w).nodeType),j(Fe,`${e(B).length??""} neighbours`)}),E(t,s)};fe(Ee,t=>{e(w)&&t(Pe)})}c(te),L(()=>{l.disabled=e(h),j(x,` ${e(h)?"Activating…":"Activate"}`),j(X,e(G))}),ge("keydown",W,t=>t.key==="Enter"&&ee()),Te(W,()=>e(v),t=>p(v,t)),ge("click",l,ee),Oe(f,()=>e(P),t=>p(P,t)),E(a,te),Be()}Ce(["keydown","click"]);export{Gt as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/4.BpOpkZuP.js.br b/apps/dashboard/build/_app/immutable/nodes/4.BpOpkZuP.js.br deleted file mode 100644 index 5e59fe8..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/4.BpOpkZuP.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/4.BpOpkZuP.js.gz b/apps/dashboard/build/_app/immutable/nodes/4.BpOpkZuP.js.gz deleted file mode 100644 index eaa3ab1..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/4.BpOpkZuP.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/4.DJCab_le.js b/apps/dashboard/build/_app/immutable/nodes/4.DJCab_le.js new file mode 100644 index 0000000..7d60bca --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/4.DJCab_le.js @@ -0,0 +1,8 @@ +import"../chunks/Bzak7iHL.js";import{o as we,a as Ne}from"../chunks/GG5zm9kr.js";import{p as Me,s as A,c as le,aB as ve,e as y,d as p,t as L,g as e,f as Ee,u as de,r as v,a as Se,h as d,n as me}from"../chunks/CpWkWWOo.js";import{s as K,d as Ie,a as xe}from"../chunks/BlVfL1ME.js";import{i as ue}from"../chunks/B4yTwGkE.js";import{a as E,c as Fe,b as oe,f as X}from"../chunks/CHOnp4oo.js";import{s as o,r as ge}from"../chunks/A7po6GxK.js";import{b as Ge,a as Pe}from"../chunks/sZcqyNBA.js";import{a as he}from"../chunks/DNjM5a-l.js";import{e as ke}from"../chunks/MAY1QfFZ.js";import{e as fe,i as ye}from"../chunks/CGEBXrjl.js";import{p as W}from"../chunks/V6gjw5Ec.js";import{N as Ce}from"../chunks/DzfRjky4.js";const Re=.93,Te=.05,be="#8B95A5",Le="#818cf8",Oe=140,pe=8,De=4,Ke=12;function je(s){return!Number.isFinite(s)||s<=0?0:s*Re}function Ue(s){return Number.isFinite(s)?s>=Te:!1}function Ae(s){return!Number.isFinite(s)||stypeof b=="string");M.length!==0&&u.push({source_id:N.source_id,target_ids:M})}return u.reverse()}var Qe=oe(''),We=oe(''),Xe=oe(' '),Je=oe(''),Ze=oe('');function $e(s,f){Me(f,!0);let u=W(f,"width",3,900),x=W(f,"height",3,560),N=W(f,"source",3,null),M=W(f,"neighbours",19,()=>[]),b=W(f,"liveBurstKey",3,0),S=W(f,"liveBurst",3,null);const F=22,J=14;let B=A(le([])),G=A(le([])),T=A(le([])),U=0,O=null,ne=null,Z=0;function $(n,t,c,_){U+=1;const i=U,l=b()>0&&e(B).length>0?40:0,m=c+(Math.random()-.5)*l,g=_+(Math.random()-.5)*l;d(T,[...e(T),{burstId:i,x:m,y:g,radius:F,opacity:.75},{burstId:i,x:m,y:g,radius:F,opacity:.5}],!0);const V={id:`${n.id}::${i}`,label:n.label,nodeType:"source",x:m,y:g,activation:1,isSource:!0,sourceBurstId:i},H=[],k=[],C=U*.37%(Math.PI*2),re=qe(m,g,t.length,C);t.forEach((D,ie)=>{const se=re[ie];se&&(H.push({id:`${D.id}::${i}`,label:D.label,nodeType:D.nodeType,x:se.x,y:se.y,activation:Ye(ie,t.length),isSource:!1,sourceBurstId:i}),k.push({burstId:i,sourceNodeId:V.id,targetNodeId:`${D.id}::${i}`,drawProgress:0,staggerDelay:ze(ie),framesElapsed:0}))}),d(B,[...e(B),V,...H],!0),d(G,[...e(G),...k],!0)}function q(){let n=[];for(const i of e(B)){const l=je(i.activation);Ue(l)&&n.push({...i,activation:l})}d(B,n,!0);const t=new Set(n.map(i=>i.id));let c=[];for(const i of e(G)){if(!t.has(i.sourceNodeId)||!t.has(i.targetNodeId))continue;const l=i.framesElapsed+1;let m=i.drawProgress;l>=i.staggerDelay&&(m=Math.min(1,m+1/15)),c.push({...i,framesElapsed:l,drawProgress:m})}d(G,c,!0);let _=[];for(const i of e(T)){const l=i.radius+6,m=i.opacity*.96;m<.02||l>Math.max(u(),x())||_.push({...i,radius:l,opacity:m})}d(T,_,!0),O=requestAnimationFrame(q)}function Y(){d(B,[],!0),d(G,[],!0),d(T,[],!0)}ve(()=>{if(!N())return;const n=N().id;n!==ne&&(ne=n,Y(),$(N(),M(),u()/2,x()/2))}),ve(()=>{if(!S()||b()===0||b()===Z)return;Z=b();const n=(Math.random()-.5)*120,t=(Math.random()-.5)*120;$(S().source,S().neighbours,u()/2+n,x()/2+t)}),we(()=>{O=requestAnimationFrame(q)}),Ne(()=>{O!==null&&cancelAnimationFrame(O)});function ce(n,t){return Ve(n,t)}function ee(n){const t=e(B).find(l=>l.id===n.sourceNodeId),c=e(B).find(l=>l.id===n.targetNodeId);if(!t||!c)return null;const _=t.x+(c.x-t.x)*n.drawProgress,i=t.y+(c.y-t.y)*n.drawProgress;return{x1:t.x,y1:t.y,x2:_,y2:i}}var P=Ze(),te=y(p(P));fe(te,17,()=>e(T),ye,(n,t)=>{var c=Qe();L(()=>{o(c,"cx",e(t).x),o(c,"cy",e(t).y),o(c,"r",e(t).radius),o(c,"opacity",e(t).opacity)}),E(n,c)});var j=y(te);fe(j,17,()=>e(G),ye,(n,t)=>{const c=de(()=>ee(e(t)));var _=Fe(),i=Ee(_);{var l=m=>{var g=We();L(()=>{o(g,"x1",e(c).x1),o(g,"y1",e(c).y1),o(g,"x2",e(c).x2),o(g,"y2",e(c).y2),o(g,"opacity",.35*e(t).drawProgress)}),E(m,g)};ue(i,m=>{e(c)&&m(l)})}E(n,_)});var z=y(j);fe(z,17,()=>e(B),n=>n.id,(n,t)=>{const c=de(()=>ce(e(t).nodeType,e(t).isSource)),_=de(()=>e(t).isSource?F*(.7+.3*e(t).activation):J*(.5+.8*e(t).activation));var i=Je(),l=p(i),m=y(l),g=y(m),V=y(g);{var H=k=>{var C=Xe(),re=p(C,!0);v(C),L(D=>{o(C,"x",e(t).x),o(C,"y",e(t).y+e(_)+18),o(C,"opacity",.9*e(t).activation),K(re,D)},[()=>e(t).label.length>40?e(t).label.slice(0,40)+"…":e(t).label]),E(k,C)};ue(V,k=>{e(t).isSource&&e(t).label&&k(H)})}v(i),L(k=>{o(i,"opacity",k),o(l,"cx",e(t).x),o(l,"cy",e(t).y),o(l,"r",e(_)*1.9),o(l,"fill",e(c)),o(l,"opacity",.18*e(t).activation),o(m,"cx",e(t).x),o(m,"cy",e(t).y),o(m,"r",e(_)),o(m,"fill",e(c)),o(g,"cx",e(t).x-e(_)*.3),o(g,"cy",e(t).y-e(_)*.3),o(g,"r",e(_)*.35),o(g,"opacity",.35*e(t).activation)},[()=>Math.min(1,e(t).activation*1.25)]),E(n,i)}),v(P),L(()=>{o(P,"width",u()),o(P,"height",x()),o(P,"viewBox",`0 0 ${u()??""} ${x()??""}`)}),E(s,P),Se()}var et=X('

                Computing activation...

                '),tt=X('

                Activation failed

                '),rt=X(`

                No matching memory

                Nothing in the graph matches . Try a broader + query or switch on live mode to watch the engine fire its own + bursts.

                `),it=X(`

                Waiting for activation

                Seed a burst with the search bar above, or enable live mode to + overlay bursts from the cognitive engine as they happen.

                `),st=X('
                Seed

                '),at=X(`

                Spreading Activation

                Collins & Loftus 1975 — activation spreads from a seed memory to + neighbours along semantic edges, decaying by 0.93 per animation frame + until it drops below 0.05. Search seeds a focused burst; live mode + overlays every spread event fired by the cognitive engine in real time.

                Seed Memory
                Live bursts fired:
                `);function yt(s,f){Me(f,!0);let u=A(""),x=A(!1),N=A(!1),M=A(null),b=A(null),S=A(le([])),F=A(!0),J=A(0),B=A(null),G=A(0);const T=new Map;function U(r){T.set(r.id,r)}function O(r){return{id:r.id,label:ne(r.content,r.id),nodeType:r.nodeType}}function ne(r,a){if(r&&r.trim().length>0){const h=r.trim();return h.length>60?h.slice(0,60)+"…":h}return a.slice(0,8)}function Z(r){const a=T.get(r);return a?O(a):{id:r,label:r.slice(0,8),nodeType:"note"}}async function $(){const r=e(u).trim();if(!r){d(M,null);return}d(x,!0),d(N,!0),d(M,null),d(b,null),d(S,[],!0);try{const a=await he.search(r,1);if(!a.results||a.results.length===0)return;const h=a.results[0];U(h),d(b,O(h),!0);const w=await he.explore(h.id,"associations",void 0,15),I=(w==null?void 0:w.results)??(w==null?void 0:w.nodes)??(w==null?void 0:w.associations)??[],R=[];for(const Q of I){if(!Q||typeof Q!="object"||!("id"in Q))continue;const ae=Q;U(ae),R.push(O(ae))}d(S,R,!0)}catch(a){d(M,a instanceof Error?a.message:String(a),!0),d(b,null),d(S,[],!0)}finally{d(x,!1)}}let q=null,Y=null,ce=!1;we(()=>{q=ke.subscribe(r=>{if(!r||r.length===0)return;if(!ce){Y=r[0],ce=!0;return}if(!e(F)){Y=r[0];return}const a=He(r,Y);if(Y=r[0],a.length!==0)for(const h of a){const w=Z(h.source_id),I=h.target_ids.map(R=>Z(R));d(J,e(J)+1),d(B,{source:w,neighbours:I},!0),d(G,e(G)+1)}})}),Ne(()=>{q&&q()});var ee=at(),P=y(p(ee),2),te=y(p(P),2),j=p(te);ge(j);var z=y(j,2),n=p(z,!0);v(z),v(te),v(P);var t=y(P,2),c=p(t),_=p(c);ge(_),me(2),v(c);var i=y(c,2),l=y(p(i)),m=p(l,!0);v(l),v(i),v(t);var g=y(t,2),V=p(g);{var H=r=>{var a=et();E(r,a)},k=r=>{var a=tt(),h=p(a),w=y(p(h),4),I=p(w,!0);v(w),v(h),v(a),L(()=>K(I,e(M))),E(r,a)},C=r=>{var a=rt(),h=p(a),w=y(p(h),4),I=y(p(w)),R=p(I);v(I),me(),v(w),v(h),v(a),L(()=>K(R,`"${e(u)??""}"`)),E(r,a)},re=r=>{var a=it();E(r,a)},D=r=>{$e(r,{width:1040,height:560,get source(){return e(b)},get neighbours(){return e(S)},get liveBurstKey(){return e(J)},get liveBurst(){return e(B)}})};ue(V,r=>{e(x)?r(H):e(M)?r(k,1):!e(b)&&e(N)?r(C,2):e(b)?r(D,!1):r(re,3)})}v(g);var ie=y(g,2);{var se=r=>{var a=st(),h=y(p(a),2),w=p(h,!0);v(h);var I=y(h,2),R=p(I),Q=p(R,!0);v(R);var ae=y(R,2),Be=p(ae);v(ae),v(I),v(a),L(()=>{K(w,e(b).label),K(Q,e(b).nodeType),K(Be,`${e(S).length??""} neighbours`)}),E(r,a)};ue(ie,r=>{e(b)&&r(se)})}v(ee),L(()=>{z.disabled=e(x),K(n,e(x)?"Activating…":"Activate"),K(m,e(G))}),xe("keydown",j,r=>r.key==="Enter"&&$()),Ge(j,()=>e(u),r=>d(u,r)),xe("click",z,$),Pe(_,()=>e(F),r=>d(F,r)),E(s,ee),Se()}Ie(["keydown","click"]);export{yt as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/4.DJCab_le.js.br b/apps/dashboard/build/_app/immutable/nodes/4.DJCab_le.js.br new file mode 100644 index 0000000..788a8c4 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/4.DJCab_le.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/4.DJCab_le.js.gz b/apps/dashboard/build/_app/immutable/nodes/4.DJCab_le.js.gz new file mode 100644 index 0000000..baf0e00 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/4.DJCab_le.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/5.C0AYWqwr.js b/apps/dashboard/build/_app/immutable/nodes/5.C0AYWqwr.js new file mode 100644 index 0000000..65cdcf5 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/5.C0AYWqwr.js @@ -0,0 +1,3 @@ +import"../chunks/Bzak7iHL.js";import{p as Qe,d as a,e as o,f as He,t as A,g as e,h as D,u as E,r,n as ke,a as Je,s as re}from"../chunks/CpWkWWOo.js";import{d as Ze,a as H,e as ue,s as v}from"../chunks/BlVfL1ME.js";import{a as w,f as I,b as Le}from"../chunks/CHOnp4oo.js";import{i as B}from"../chunks/B4yTwGkE.js";import{e as te,i as Ce}from"../chunks/CGEBXrjl.js";import{s as Ue}from"../chunks/aVbAZ-t7.js";import{s as X}from"../chunks/Cx-f-Pzo.js";import{b as ut}from"../chunks/BnXDGOmJ.js";import{s as i}from"../chunks/A7po6GxK.js";import{p as Ne}from"../chunks/V6gjw5Ec.js";const et=.7,tt=.5,ft="#ef4444",xt="#f59e0b",bt="#fde047";function Pe(n){return n>et?ft:n>tt?xt:bt}function rt(n){return n>et?"strong":n>tt?"moderate":"mild"}const We="#8b5cf6",gt={fact:"#3b82f6",concept:"#8b5cf6",event:"#f59e0b",person:"#10b981",place:"#06b6d4",note:"#6b7280",pattern:"#ec4899",decision:"#ef4444"};function qe(n){return n?gt[n]??We:We}const Xe=5,kt=9;function ht(n){if(!Number.isFinite(n))return Xe;const _=n<0?0:n>1?1:n;return Xe+_*kt}const wt=.12;function Ke(n,_){return _==null||_===n?1:wt}function he(n,_=60){return n==null||typeof n!="string"||_<=0?"":n.length<=_?n:n.slice(0,_-1)+"…"}function jt(n){if(!n||n.length===0)return 0;const _=new Set;for(const x of n)x.memory_a_id&&_.add(x.memory_a_id),x.memory_b_id&&_.add(x.memory_b_id);return _.size}function Mt(n){if(!n||n.length===0)return 0;let _=0;for(const x of n)_+=Math.abs((x.trust_a??0)-(x.trust_b??0));return _/n.length}var It=Le('',1),St=Le(' '),Rt=Le('',1),Tt=I('
                '),At=I('
                '),Et=I('
                '),Dt=I('
                topic:
                '),Ft=I('
                SEVERITYstrong (>0.7)moderate (0.5-0.7)mild (0.3-0.5)
                ');function Gt(n,_){Qe(_,!0);let x=Ne(_,"focusedPairIndex",3,null),F=Ne(_,"width",3,800),G=Ne(_,"height",3,600);const R=E(()=>{const m=F()/2,t=G()/2,k=Math.min(F(),G())*.38;return{cx:m,cy:t,R:k}}),U=E(()=>{const m=[],t=[],k=_.contradictions.length||1;return _.contradictions.forEach((l,y)=>{const j=y/k*Math.PI*2-Math.PI/2,p=.18+l.similarity*.22,g=j-p,d=j+p,L=e(R).R+Math.sin(y*2.3)*18,C=e(R).R+Math.cos(y*1.7)*18,u={x:e(R).cx+Math.cos(g)*L,y:e(R).cy+Math.sin(g)*L,trust:l.trust_a,preview:l.memory_a_preview,type:l.memory_a_type,created:l.memory_a_created,tags:l.memory_a_tags,memoryId:l.memory_a_id,pairIndex:y,side:"a"},M={x:e(R).cx+Math.cos(d)*C,y:e(R).cy+Math.sin(d)*C,trust:l.trust_b,preview:l.memory_b_preview,type:l.memory_b_type,created:l.memory_b_created,tags:l.memory_b_tags,memoryId:l.memory_b_id,pairIndex:y,side:"b"};m.push(u,M);const $=(u.x+M.x)/2,S=(u.y+M.y)/2,T=.55-l.similarity*.25,N=$+(e(R).cx-$)*T,Y=S+(e(R).cy-S)*T,je=1+Math.min(l.trust_a,l.trust_b)*4;t.push({pairIndex:y,path:`M ${u.x.toFixed(1)} ${u.y.toFixed(1)} Q ${N.toFixed(1)} ${Y.toFixed(1)} ${M.x.toFixed(1)} ${M.y.toFixed(1)}`,color:Pe(l.similarity),thickness:je,severity:rt(l.similarity),topic:l.topic,similarity:l.similarity,dateDiff:l.date_diff_days,aPoint:u,bPoint:M,midX:N,midY:Y})}),{nodes:m,arcs:t}});let b=re(null),P=re(null),ie=re(0),le=re(0);function ne(m){const t=m.currentTarget.getBoundingClientRect();D(ie,m.clientX-t.left),D(le,m.clientY-t.top)}function ae(m){_.onSelectPair&&_.onSelectPair(x()===m?null:m)}function me(){var m;(m=_.onSelectPair)==null||m.call(_,null)}var W=Ft(),O=a(W),se=o(a(O)),K=o(se),_e=o(K),oe=o(_e);te(oe,17,()=>e(U).arcs,m=>m.pairIndex,(m,t)=>{const k=E(()=>Ke(e(t).pairIndex,x())),l=E(()=>x()===e(t).pairIndex);var y=It(),j=He(y),p=o(j),g=o(p);A(d=>{i(j,"d",e(t).path),i(j,"stroke",e(t).color),i(j,"stroke-width",e(t).thickness*3),i(j,"stroke-opacity",.08*e(k)),i(p,"d",e(t).path),i(p,"stroke",e(t).color),i(p,"stroke-width",e(t).thickness*(e(l)?1.6:1)),i(p,"stroke-opacity",(e(l)?1:.72)*e(k)),i(p,"aria-label",`contradiction ${e(t).pairIndex+1}: ${e(t).topic??""}`),i(g,"d",e(t).path),i(g,"stroke",e(t).color),i(g,"stroke-width",d),i(g,"stroke-opacity",.85*e(k)),X(g,`animation-duration: ${4+e(t).pairIndex%5}s`)},[()=>Math.max(1,e(t).thickness*.6)]),H("click",p,d=>{d.stopPropagation(),ae(e(t).pairIndex)}),ue("mouseenter",p,()=>D(P,e(t),!0)),ue("mouseleave",p,()=>D(P,null)),H("keydown",p,d=>{d.key==="Enter"&&ae(e(t).pairIndex)}),w(m,y)});var fe=o(oe);te(fe,19,()=>e(U).nodes,(m,t)=>m.memoryId+"-"+m.side+"-"+t,(m,t)=>{const k=E(()=>Ke(e(t).pairIndex,x())),l=E(()=>x()===e(t).pairIndex),y=E(()=>ht(e(t).trust)),j=E(()=>qe(e(t).type));var p=Rt(),g=He(p),d=o(g),L=o(d);{var C=u=>{var M=St(),$=a(M,!0);r(M),A(S=>{i(M,"x",e(t).x),i(M,"y",e(t).y-e(y)-8),v($,S)},[()=>he(e(t).preview,40)]),w(u,M)};B(L,u=>{e(l)&&u(C)})}A(u=>{i(g,"cx",e(t).x),i(g,"cy",e(t).y),i(g,"r",e(y)*2.2),i(g,"fill",e(j)),i(g,"opacity",.12*e(k)),i(d,"cx",e(t).x),i(d,"cy",e(t).y),i(d,"r",e(y)),i(d,"fill",e(j)),i(d,"opacity",e(k)),i(d,"stroke-opacity",e(l)?.85:.25),i(d,"stroke-width",e(l)?2:1),i(d,"aria-label",`memory ${u??""}`)},[()=>he(e(t).preview,40)]),ue("mouseenter",d,()=>D(b,e(t),!0)),ue("mouseleave",d,()=>D(b,null)),H("click",d,u=>{u.stopPropagation(),ae(e(t).pairIndex)}),H("keydown",d,u=>{u.key==="Enter"&&ae(e(t).pairIndex)}),w(m,p)}),ke(),r(O);var we=o(O,2);{var de=m=>{var t=Et(),k=a(t),l=a(k),y=o(l,2),j=a(y,!0);r(y);var p=o(y,2),g=a(p);r(p),r(k);var d=o(k,2),L=a(d,!0);r(d);var C=o(d,2);{var u=S=>{var T=Tt(),N=a(T);r(T),A(()=>v(N,`created ${e(b).created??""}`)),w(S,T)};B(C,S=>{e(b).created&&S(u)})}var M=o(C,2);{var $=S=>{var T=At(),N=a(T,!0);r(T),A(Y=>v(N,Y),[()=>e(b).tags.slice(0,4).join(" · ")]),w(S,T)};B(M,S=>{e(b).tags&&e(b).tags.length>0&&S($)})}r(t),A((S,T,N,Y)=>{X(t,`left: ${S??""}px; top: ${T??""}px;`),X(l,`background: ${N??""}`),v(j,e(b).type??"memory"),v(g,`trust ${Y??""}%`),v(L,e(b).preview)},[()=>Math.max(0,Math.min(e(ie)+12,F()-240)),()=>Math.max(0,Math.min(e(le)-8,G()-120)),()=>qe(e(b).type),()=>(e(b).trust*100).toFixed(0)]),w(m,t)},xe=m=>{var t=Dt(),k=a(t),l=a(k),y=o(l,2),j=a(y);r(y),r(k);var p=o(k,2),g=o(a(p)),d=a(g,!0);r(g),r(p);var L=o(p,2),C=a(L);r(L),r(t),A((u,M,$)=>{X(t,`left: ${u??""}px; top: ${M??""}px;`),X(l,`background: ${e(P).color??""}`),v(j,`${e(P).severity??""} conflict`),v(d,e(P).topic),v(C,`similarity ${$??""}% · ${e(P).dateDiff??""}d apart`)},[()=>Math.max(0,Math.min(e(ie)+12,F()-240)),()=>Math.max(0,Math.min(e(le)-8,G()-120)),()=>(e(P).similarity*100).toFixed(0)]),w(m,t)};B(we,m=>{e(b)?m(de):e(P)&&m(xe,1)})}r(W),A(()=>{X(W,`aspect-ratio: ${F()??""} / ${G()??""};`),i(O,"width",F()),i(O,"height",G()),i(O,"viewBox",`0 0 ${F()??""} ${G()??""}`),i(se,"width",F()),i(se,"height",G()),i(K,"cx",e(R).cx),i(K,"cy",e(R).cy),i(K,"r",e(R).R),i(_e,"cx",e(R).cx),i(_e,"cy",e(R).cy)}),H("mousemove",O,ne),ue("mouseleave",O,()=>{D(b,null),D(P,null)}),H("click",O,me),w(n,W),Je()}Ze(["mousemove","click","keydown"]);var Ot=I(""),Ct=I(""),Nt=I(''),Pt=I(''),Lt=I('
                No contradictions match this filter.
                '),Bt=I('
                No pairs visible.
                '),$t=I(' '),Yt=I('
                '),zt=I(' '),Vt=I('
                '),Ht=I('
                Full memory A
                Full memory B
                '),Ut=I(''),Wt=I('

                Contradiction Constellation

                Where your memory disagrees with itself

                average trust delta
                visible in current filter
                strong conflicts
                ');function or(n,_){Qe(_,!0);const x=[{memory_a_id:"a1",memory_b_id:"b1",memory_a_preview:"Dev server runs on port 3000 (default Vite config)",memory_b_preview:"Dev server moved to port 3002 to avoid conflict",memory_a_type:"fact",memory_b_type:"decision",memory_a_created:"2026-01-14",memory_b_created:"2026-03-22",memory_a_tags:["dev","vite"],memory_b_tags:["dev","vite","decision"],trust_a:.42,trust_b:.91,similarity:.88,date_diff_days:67,topic:"dev server port"},{memory_a_id:"a2",memory_b_id:"b2",memory_a_preview:"Prompt variation helps at higher sampling temperatures",memory_b_preview:"Prompt variation reduced accuracy in the latest benchmark run",memory_a_type:"concept",memory_b_type:"fact",memory_a_created:"2026-03-30",memory_b_created:"2026-04-03",memory_a_tags:["research","prompting"],memory_b_tags:["research","prompting","evidence"],trust_a:.35,trust_b:.88,similarity:.92,date_diff_days:4,topic:"prompt diversity"},{memory_a_id:"a3",memory_b_id:"b3",memory_a_preview:"Use min_p=0.05 for long-form sampling",memory_b_preview:"min_p scheduling failed at high sampling temperatures",memory_a_type:"pattern",memory_b_type:"fact",memory_a_created:"2026-04-01",memory_b_created:"2026-04-05",memory_a_tags:["sampling"],memory_b_tags:["sampling"],trust_a:.58,trust_b:.74,similarity:.81,date_diff_days:4,topic:"min_p sampling"},{memory_a_id:"a4",memory_b_id:"b4",memory_a_preview:"LoRA rank 16 is enough for domain adaptation",memory_b_preview:"LoRA rank 32 consistently outperforms rank 16 on math",memory_a_type:"concept",memory_b_type:"fact",memory_a_created:"2026-02-10",memory_b_created:"2026-04-12",memory_a_tags:["lora","training"],memory_b_tags:["lora","training","nemotron"],trust_a:.48,trust_b:.76,similarity:.74,date_diff_days:61,topic:"LoRA rank"},{memory_a_id:"a5",memory_b_id:"b5",memory_a_preview:"Team prefers Rust for backend services",memory_b_preview:"Project chose Axum + Rust for the dashboard backend",memory_a_type:"note",memory_b_type:"decision",memory_a_created:"2026-01-05",memory_b_created:"2026-02-18",memory_a_tags:["preference","backend"],memory_b_tags:["backend","decision"],trust_a:.81,trust_b:.88,similarity:.42,date_diff_days:44,topic:"backend language"},{memory_a_id:"a6",memory_b_id:"b6",memory_a_preview:"Warm-start from checkpoint saves 8h of training",memory_b_preview:"Warm-start code never loaded the PEFT adapter correctly",memory_a_type:"pattern",memory_b_type:"fact",memory_a_created:"2026-03-11",memory_b_created:"2026-04-16",memory_a_tags:["training","warm-start"],memory_b_tags:["training","warm-start","bug-fix"],trust_a:.55,trust_b:.93,similarity:.79,date_diff_days:36,topic:"warm-start correctness"},{memory_a_id:"a7",memory_b_id:"b7",memory_a_preview:"Three.js force-directed graph runs fine at 5k nodes",memory_b_preview:"WebGL graph stutters above 2k nodes on M1 MacBook Air",memory_a_type:"fact",memory_b_type:"fact",memory_a_created:"2025-12-02",memory_b_created:"2026-03-29",memory_a_tags:["vestige","graph","perf"],memory_b_tags:["vestige","graph","perf"],trust_a:.39,trust_b:.72,similarity:.67,date_diff_days:117,topic:"graph performance"},{memory_a_id:"a8",memory_b_id:"b8",memory_a_preview:"Submit benchmark runs with a 16384 token budget",memory_b_preview:"Latest baseline improved when token budget increased to 32768",memory_a_type:"pattern",memory_b_type:"event",memory_a_created:"2026-04-04",memory_b_created:"2026-04-10",memory_a_tags:["benchmark","tokens"],memory_b_tags:["benchmark","baseline"],trust_a:.31,trust_b:.85,similarity:.73,date_diff_days:6,topic:"token budget"},{memory_a_id:"a9",memory_b_id:"b9",memory_a_preview:"FSRS-6 parameters require ~1k reviews to train",memory_b_preview:"FSRS-6 default parameters work fine out of the box",memory_a_type:"concept",memory_b_type:"concept",memory_a_created:"2026-01-22",memory_b_created:"2026-02-28",memory_a_tags:["fsrs","training"],memory_b_tags:["fsrs"],trust_a:.62,trust_b:.54,similarity:.57,date_diff_days:37,topic:"FSRS parameter tuning"},{memory_a_id:"a10",memory_b_id:"b10",memory_a_preview:"Tailwind 4 requires explicit CSS import only",memory_b_preview:"Tailwind 4 config still supports tailwind.config.js",memory_a_type:"fact",memory_b_type:"fact",memory_a_created:"2026-01-30",memory_b_created:"2026-02-14",memory_a_tags:["tailwind","config"],memory_b_tags:["tailwind","config"],trust_a:.47,trust_b:.33,similarity:.85,date_diff_days:15,topic:"Tailwind 4 config"},{memory_a_id:"a11",memory_b_id:"b11",memory_a_preview:"Dataset API silently ignores invalid source slugs",memory_b_preview:"Dataset API throws an error when source slug is invalid",memory_a_type:"fact",memory_b_type:"concept",memory_a_created:"2026-04-07",memory_b_created:"2026-02-20",memory_a_tags:["api","bug-fix"],memory_b_tags:["api"],trust_a:.89,trust_b:.28,similarity:.91,date_diff_days:46,topic:"API validation"},{memory_a_id:"a12",memory_b_id:"b12",memory_a_preview:"USearch HNSW is 20x faster than FAISS for embeddings",memory_b_preview:"FAISS IVF is the fastest vector index at scale",memory_a_type:"fact",memory_b_type:"concept",memory_a_created:"2026-02-01",memory_b_created:"2025-11-15",memory_a_tags:["vectors","perf"],memory_b_tags:["vectors","perf"],trust_a:.78,trust_b:.36,similarity:.69,date_diff_days:78,topic:"vector index perf"},{memory_a_id:"a13",memory_b_id:"b13",memory_a_preview:"Leaderboard scores weight by top-10 consistency",memory_b_preview:"Leaderboard uses single-best-episode scoring",memory_a_type:"fact",memory_b_type:"fact",memory_a_created:"2026-04-18",memory_b_created:"2026-04-10",memory_a_tags:["leaderboard","scoring"],memory_b_tags:["leaderboard","scoring"],trust_a:.64,trust_b:.52,similarity:.82,date_diff_days:8,topic:"leaderboard scoring"},{memory_a_id:"a14",memory_b_id:"b14",memory_a_preview:"Release notes were planned for 8am ET",memory_b_preview:"Release notes moved to 9am ET after schedule review",memory_a_type:"decision",memory_b_type:"decision",memory_a_created:"2026-03-01",memory_b_created:"2026-04-15",memory_a_tags:["cadence","content"],memory_b_tags:["cadence","content"],trust_a:.5,trust_b:.81,similarity:.58,date_diff_days:45,topic:"posting cadence"},{memory_a_id:"a15",memory_b_id:"b15",memory_a_preview:"Dream cycle consolidates ~50 memories per run",memory_b_preview:"Dream cycle replays closer to 120 memories in practice",memory_a_type:"fact",memory_b_type:"fact",memory_a_created:"2026-02-15",memory_b_created:"2026-04-08",memory_a_tags:["vestige","dream"],memory_b_tags:["vestige","dream"],trust_a:.44,trust_b:.79,similarity:.76,date_diff_days:52,topic:"dream cycle count"},{memory_a_id:"a16",memory_b_id:"b16",memory_a_preview:"Never commit API keys to git; use .env files",memory_b_preview:"Environment secrets should live in a 1Password vault",memory_a_type:"pattern",memory_b_type:"pattern",memory_a_created:"2025-10-11",memory_b_created:"2026-03-20",memory_a_tags:["security","secrets"],memory_b_tags:["security","secrets"],trust_a:.72,trust_b:.64,similarity:.48,date_diff_days:160,topic:"secret storage"}];let F=re("all"),G=re("");const R=E(()=>Array.from(new Set(x.map(s=>s.topic))).sort()),U=E(()=>{switch(e(F)){case"recent":{const s=new Date("2026-04-20").getTime(),c=10080*60*1e3;return x.filter(h=>{const f=h.memory_a_created?new Date(h.memory_a_created).getTime():0,q=h.memory_b_created?new Date(h.memory_b_created).getTime():0;return s-Math.max(f,q)<=c})}case"high-trust":return x.filter(s=>Math.min(s.trust_a,s.trust_b)>.6);case"topic":return e(G)?x.filter(s=>s.topic===e(G)):x;case"all":default:return x}});let b=re(null);function P(s){D(b,s,!0)}const ie=E(()=>jt(x)),le=E(()=>Mt(x)),ne=E(()=>{const s=new Map(x.map((c,h)=>[c.memory_a_id+"|"+c.memory_b_id,h]));return e(U).map(c=>({orig:s.get(c.memory_a_id+"|"+c.memory_b_id)??0,c}))});function ae(s){D(b,e(b)===s?null:s,!0)}var me=Wt(),W=o(a(me),2),O=a(W),se=a(O);se.textContent="47";var K=o(se,2),_e=a(K);r(K),r(O);var oe=o(O,2),fe=a(oe),we=a(fe,!0);r(fe),ke(2),r(oe);var de=o(oe,2),xe=a(de),m=a(xe,!0);r(xe),ke(2),r(de);var t=o(de,2),k=a(t),l=a(k,!0);r(k),ke(2),r(t),r(W);var y=o(W,2),j=a(y);te(j,16,()=>[{id:"all",label:"All"},{id:"recent",label:"Recent (7d)"},{id:"high-trust",label:"High trust (>60%)"},{id:"topic",label:"By topic"}],s=>s.id,(s,c)=>{var h=Ot(),f=a(h,!0);r(h),A(()=>{Ue(h,1,`px-3 py-1.5 rounded-lg text-xs border transition + ${e(F)===c.id?"bg-synapse/15 border-synapse/40 text-synapse-glow":"border-subtle/30 text-dim hover:text-text hover:bg-white/[0.03]"}`),v(f,c.label)}),H("click",h,()=>{D(F,c.id,!0),D(b,null)}),w(s,h)});var p=o(j,2);{var g=s=>{var c=Nt(),h=a(c);h.value=h.__value="";var f=o(h);te(f,17,()=>e(R),Ce,(q,z)=>{var V=Ct(),be=a(V,!0);r(V);var Q={};A(()=>{v(be,e(z)),Q!==(Q=e(z))&&(V.value=(V.__value=e(z))??"")}),w(q,V)}),r(c),ut(c,()=>e(G),q=>D(G,q)),w(s,c)};B(p,s=>{e(F)==="topic"&&s(g)})}var d=o(p,2);{var L=s=>{var c=Pt();H("click",c,()=>D(b,null)),w(s,c)};B(d,s=>{e(b)!==null&&s(L)})}r(y);var C=o(y,2),u=a(C),M=a(u);{var $=s=>{var c=Lt();w(s,c)},S=s=>{Gt(s,{get contradictions(){return e(U)},get focusedPairIndex(){return e(b)},onSelectPair:P,width:800,height:600})};B(M,s=>{e(U).length===0?s($):s(S,!1)})}r(u);var T=o(u,2),N=a(T),Y=o(a(N),2),je=a(Y,!0);r(Y),r(N);var Be=o(N,2);{var at=s=>{var c=Bt();w(s,c)};B(Be,s=>{e(ne).length===0&&s(at)})}var st=o(Be,2);te(st,19,()=>e(ne),s=>s.c.memory_a_id+"|"+s.c.memory_b_id,(s,c,h)=>{const f=E(()=>e(c).c),q=E(()=>e(b)===e(h));var z=Ut(),V=a(z),be=a(V),Q=o(be,2),ot=a(Q,!0);r(Q);var $e=o(Q,2),it=a($e);r($e),r(V);var Me=o(V,2),lt=a(Me,!0);r(Me);var Ie=o(Me,2),Se=a(Ie),Re=o(a(Se),2),nt=a(Re,!0);r(Re);var Ye=o(Re,2),mt=a(Ye);r(Ye),r(Se);var ze=o(Se,2),Te=o(a(ze),2),_t=a(Te,!0);r(Te);var Ve=o(Te,2),dt=a(Ve);r(Ve),r(ze),r(Ie);var ct=o(Ie,2);{var vt=ce=>{var ve=Ht(),pe=o(a(ve),2),Ae=a(pe,!0);r(pe);var ge=o(pe,2);{var Ee=J=>{var Z=Yt();te(Z,21,()=>e(f).memory_a_tags,Ce,(Fe,Ge)=>{var ee=$t(),Oe=a(ee,!0);r(ee),A(()=>v(Oe,e(Ge))),w(Fe,ee)}),r(Z),w(J,Z)};B(ge,J=>{e(f).memory_a_tags&&e(f).memory_a_tags.length>0&&J(Ee)})}var ye=o(ge,4),De=a(ye,!0);r(ye);var pt=o(ye,2);{var yt=J=>{var Z=Vt();te(Z,21,()=>e(f).memory_b_tags,Ce,(Fe,Ge)=>{var ee=zt(),Oe=a(ee,!0);r(ee),A(()=>v(Oe,e(Ge))),w(Fe,ee)}),r(Z),w(J,Z)};B(pt,J=>{e(f).memory_b_tags&&e(f).memory_b_tags.length>0&&J(yt)})}r(ve),A(()=>{v(Ae,e(f).memory_a_preview),v(De,e(f).memory_b_preview)}),w(ce,ve)};B(ct,ce=>{e(q)&&ce(vt)})}r(z),A((ce,ve,pe,Ae,ge,Ee,ye,De)=>{Ue(z,1,`w-full text-left p-3 rounded-xl border transition + ${e(q)?"bg-synapse/10 border-synapse/40 shadow-[0_0_12px_rgba(99,102,241,0.18)]":"border-subtle/20 hover:border-synapse/30 hover:bg-white/[0.02]"}`),X(be,`background: ${ce??""}`),X(Q,`color: ${ve??""}`),v(ot,pe),v(it,`${Ae??""}% sim · ${e(f).date_diff_days??""}d`),v(lt,e(f).topic),v(nt,ge),v(mt,`${Ee??""}%`),v(_t,ye),v(dt,`${De??""}%`)},[()=>Pe(e(f).similarity),()=>Pe(e(f).similarity),()=>rt(e(f).similarity),()=>(e(f).similarity*100).toFixed(0),()=>he(e(f).memory_a_preview),()=>(e(f).trust_a*100).toFixed(0),()=>he(e(f).memory_b_preview),()=>(e(f).trust_b*100).toFixed(0)]),H("click",z,()=>ae(e(h))),w(s,z)}),r(T),r(C),r(me),A((s,c,h)=>{v(_e,`contradictions across ${s??""} memories`),v(we,c),v(m,e(U).length),v(l,h),v(je,e(ne).length)},[()=>e(ie).toLocaleString(),()=>e(le).toFixed(2),()=>e(U).filter(s=>s.similarity>.7).length]),w(n,me),Je()}Ze(["click"]);export{or as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/5.C0AYWqwr.js.br b/apps/dashboard/build/_app/immutable/nodes/5.C0AYWqwr.js.br new file mode 100644 index 0000000..d2b9243 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/5.C0AYWqwr.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/5.C0AYWqwr.js.gz b/apps/dashboard/build/_app/immutable/nodes/5.C0AYWqwr.js.gz new file mode 100644 index 0000000..69c8947 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/5.C0AYWqwr.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/5.CK5gRe3F.js b/apps/dashboard/build/_app/immutable/nodes/5.CK5gRe3F.js deleted file mode 100644 index a1bfb65..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/5.CK5gRe3F.js +++ /dev/null @@ -1,2 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{o as es}from"../chunks/TZu9D97Z.js";import{p as Ba,e as s,r as a,h as t,n as ye,t as _,a as l,b as Ha,f as Sa,j as n,g as e,s as pe,d as La,o as as,i as R,u as ue}from"../chunks/wpu9U-D0.js";import{d as Oa,s as r,a as Fe}from"../chunks/D8mhvFt8.js";import{i as k}from"../chunks/DKve45Wd.js";import{s as J,e as K,a as _a,r as ss,i as ja}from"../chunks/60_R_Vbt.js";import{a as te,r as re}from"../chunks/P1-U_Xsj.js";import{s as _e}from"../chunks/EqHb-9AZ.js";import{b as ts}from"../chunks/CnZzd20v.js";import{p as rs,s as ua,a as vs}from"../chunks/ByYB047u.js";import{P as ls}from"../chunks/BHDZZvku.js";import{I as Wa}from"../chunks/D7A-gG4Z.js";import{A as Da}from"../chunks/DcKTNC6e.js";import{g as ns}from"../chunks/dCAmqaEc.js";import{a as Xe}from"../chunks/CZfHMhLI.js";import{l as is,t as cs,i as os,d as ds}from"../chunks/BhIgFntf.js";var ps=n('
                '),us=n('
                Activation path
                '),_s=n(' '),ys=n('
                Retrieved
                '),ws=n(' '),ms=n('
                Suppressed
                '),fs=n(" ",1),hs=n('
                retrieved
                suppressed
                trust floor
                ');function qs(c,w){Ba(w,!0);let X=rs(w,"compact",3,!1);const we={low:"var(--color-recall, #10b981)",medium:"#f59e0b",high:"#f43f5e"};function Ze(){const j=w.receipt.retrieved[0];if(!j)return;const ce=w.receipt.retrieved.join(",");ns(`/graph?center=${encodeURIComponent(j)}&focus=${encodeURIComponent(ce)}`)}var ve=hs();let me,ea;var Y=s(ve),B=s(Y),q=s(B,!0);a(B);var fe=t(B,2);let le;var P=s(fe);a(fe),a(Y);var ne=t(Y,2),he=s(ne),aa=s(he),m=s(aa,!0);a(aa),ye(2),a(he);var Ie=t(he,2),Le=s(Ie),sa=s(Le,!0);a(Le),ye(2),a(Ie);var je=t(Ie,2),De=s(je),ya=s(De);a(De),ye(2),a(je),a(ne);var Ue=t(ne,2);{var wa=j=>{var ce=fs(),Re=Sa(ce);{var ra=T=>{var D=us(),V=t(s(D),2);K(V,16,()=>w.receipt.activation_path,N=>N,(N,Z)=>{var F=ps(),qe=s(F,!0);a(F),_(()=>r(qe,Z)),l(N,F)}),a(D),l(T,D)};k(Re,T=>{w.receipt.activation_path.length&&T(ra)})}var Be=t(Re,2);{var va=T=>{var D=ys(),V=t(s(D),2);K(V,20,()=>w.receipt.retrieved,N=>N,(N,Z)=>{var F=_s(),qe=s(F,!0);a(F),_(Me=>r(qe,Me),[()=>Z.slice(0,8)]),l(N,F)}),a(V),a(D),l(T,D)};k(Be,T=>{w.receipt.retrieved.length&&T(va)})}var ma=t(Be,2);{var He=T=>{var D=ms(),V=t(s(D),2);K(V,21,()=>w.receipt.suppressed,N=>N.id,(N,Z)=>{var F=ws(),qe=s(F);a(F),_((Me,la)=>{_a(F,"title",e(Z).reason),r(qe,`${Me??""} · ${la??""}`)},[()=>e(Z).id.slice(0,8),()=>e(Z).reason.replace("_"," ")]),l(N,F)}),a(V),a(D),l(T,D)};k(ma,T=>{w.receipt.suppressed.length&&T(He)})}l(j,ce)};k(Ue,j=>{X()||j(wa)})}var ie=t(Ue,2),ta=s(ie);Wa(ta,{name:"sparkle",size:14}),ye(),a(ie),a(ve),_(j=>{me=J(ve,1,"receipt svelte-1wdzvwu",null,me,{compact:X()}),ea=_e(ve,"",ea,{"--risk":we[w.receipt.decay_risk]}),r(q,w.receipt.receipt_id),le=_e(fe,"",le,{color:we[w.receipt.decay_risk]}),r(P,`decay: ${w.receipt.decay_risk??""}`),r(m,w.receipt.retrieved.length),r(sa,w.receipt.suppressed.length),r(ya,`${j??""}%`),ie.disabled=!w.receipt.retrieved.length},[()=>(w.receipt.trust_floor*100).toFixed(0)]),Fe("click",ie,Ze),l(c,ve),Ha()}Oa(["click"]);function Ye(c){switch(c){case"mcp.call":return"var(--color-synapse-glow, #818cf8)";case"memory.retrieve":return"var(--color-recall, #10b981)";case"memory.suppress":return"#a78bfa";case"memory.write":return"#38bdf8";case"contradiction.detected":return"#fb7185";case"sanhedrin.veto":return"#f43f5e";case"dream.patch":return"#c084fc";default:return"var(--color-synapse, #6366f1)"}}function Ne(c){switch(c){case"mcp.call":return"Tool Call";case"memory.retrieve":return"Retrieved";case"memory.suppress":return"Suppressed";case"memory.write":return"Wrote";case"contradiction.detected":return"Contradiction";case"sanhedrin.veto":return"Veto";case"dream.patch":return"Dream Patch";default:return c}}function Ma(c){switch(c){case"mcp.call":return"⟐";case"memory.retrieve":return"◉";case"memory.suppress":return"⊘";case"memory.write":return"✎";case"contradiction.detected":return"⚡";case"sanhedrin.veto":return"⛔";case"dream.patch":return"☾";default:return"•"}}function Ea(c){switch(c.type){case"mcp.call":return`${c.tool} · args ${c.argsHash.slice(0,8)}`;case"memory.retrieve":return`${c.ids.length} ${c.ids.length===1?"memory":"memories"} surfaced`;case"memory.suppress":return`${c.id.slice(0,8)} — ${c.reason.replace("_"," ")}`;case"memory.write":return`${c.id.slice(0,8)} — ${c.source}`;case"contradiction.detected":return c.detail;case"sanhedrin.veto":return`"${c.claim}" (conf ${(c.confidence*100).toFixed(0)}%)`;case"dream.patch":return`${c.proposalIds.length} consolidation proposal(s)`;default:return""}}function gs(c){switch(c.type){case"memory.retrieve":return c.ids;case"memory.suppress":case"memory.write":return[c.id];case"contradiction.detected":return c.ids;case"sanhedrin.veto":return c.evidenceIds;case"dream.patch":return c.proposalIds;default:return[]}}function xs(c){return!Number.isFinite(c)||c<=0?"—":new Date(c).toLocaleTimeString(void 0,{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function Ua(c,w){return Math.max(0,c-w)}var bs=n(' ',1),ks=n(' '),zs=n('awaiting…'),Cs=n(`

                No agent runs recorded yet. Make an MCP tool call — every call is - recorded here.

                `),Is=n(' '),Rs=n(' '),Ms=n(' '),Es=n(' '),Ss=n('
              • '),Ws=n('
                  '),As=n('
                  Loading trace…
                  '),Ps=n('
                  '),Ts=n('
                  Select a run to replay.
                  '),Ns=n(' '),Fs=n(""),Ls=n(' '),js=n(' '),Ds=n('
                  '),Us=n(' '),Bs=n('
                  vs
                  '),Hs=n(' '),Os=n('
                  '),Vs=n('

                  '),$s=n('

                  No memories touched yet.

                  '),Gs=n(' '),Js=n('
                  '),Ks=n('

                  Receipts — proof behind retrievals

                  '),Qs=n('
                • '),Xs=n('
                  Step

                  Memory pulse — touched this run

                  Event producers — this run

                  • mcp.call · memory.write · memory.retrieve · memory.suppress live
                  • contradiction.detected
                  • dream.patch
                  • sanhedrin.veto

                  Event log

                    ',1),Ys=n('
                    '),Zs=n('
                    '),et=n('
                    trace events

                    Watch the agent think. Watch memory change. Watch the receipt prove why.

                    '),at=n('
                    WebSocket
                    Live runId
                    Last event
                    Events seen
                    ');function ft(c,w){Ba(w,!0);const X=()=>ua(is,"$lastTraceEvent",me),we=()=>ua(os,"$isConnected",me),Ze=()=>ua(ds,"$liveRunId",me),ve=()=>ua(cs,"$traceEvents",me),[me,ea]=vs();let Y=pe(La([])),B=pe(null),q=pe(null),fe=pe(!1),le=pe(null),P=pe(0),ne=pe(!1),he=pe(La([]));const aa=ue(()=>e(q)?e(q).events.slice(0,e(P)+1):[]),m=ue(()=>e(q)&&e(q).events.length?e(q).events[e(P)]:null),Ie=ue(()=>{var i,d;return((d=(i=e(q))==null?void 0:i.events[0])==null?void 0:d.at)??0}),Le=ue(()=>Array.from(new Set(e(aa).flatMap(gs)))),sa=ue(()=>{var i;return((i=e(q))==null?void 0:i.events.some(d=>d.type==="sanhedrin.veto"))??!1}),je=ue(()=>{var i;return((i=e(q))==null?void 0:i.events.some(d=>d.type==="dream.patch"))??!1}),De=ue(()=>{var i;return((i=e(q))==null?void 0:i.events.some(d=>d.type==="contradiction.detected"))??!1});async function ya(){try{const i=await Xe.traces.list(100);R(Y,i.runs,!0),!e(B)&&e(Y).length&&Ue(e(Y)[0].runId)}catch(i){R(le,String(i),!0)}}async function Ue(i){R(B,i,!0),R(fe,!0),R(le,null);try{R(q,await Xe.traces.get(i),!0),R(P,Math.max(0,(e(q).events.length||1)-1),!0),R(he,(await Xe.receipts.listForRun(i,8)).receipts,!0)}catch(d){R(le,String(d),!0),R(q,null)}finally{R(fe,!1)}}function wa(){e(B)&&(window.location.href=Xe.traces.exportUrl(e(B)))}as(()=>{var I;const i=X();if(!i)return;const d=(I=i.data)==null?void 0:I.run_id;d&&d===e(B)&&Xe.traces.get(e(B)).then(M=>{R(q,M,!0),R(P,Math.max(0,M.events.length-1),!0)})}),es(ya);var ie=at(),ta=s(ie);ls(ta,{icon:"blackbox",title:"Agent Black Box",subtitle:"Watch the agent think. Watch memory change. Watch the receipt prove why.",accent:"synapse",children:(i,d)=>{var I=bs(),M=Sa(I);let E;var L=s(M);Wa(L,{name:"sparkle",size:14}),ye(),a(M);var ee=t(M,2),Ee=s(ee);Wa(Ee,{name:"feed",size:14}),ye(),a(ee),_(()=>{E=J(M,1,"mode-toggle svelte-1ayqwv0",null,E,{on:e(ne)}),ee.disabled=!e(B)}),Fe("click",M,()=>R(ne,!e(ne))),Fe("click",ee,wa),l(i,I)},$$slots:{default:!0}});var j=t(ta,2),ce=s(j),Re=t(s(ce),2);let ra;var Be=s(Re);let va;var ma=t(Be);a(Re),a(ce);var He=t(ce,2),T=t(s(He),2),D=s(T,!0);a(T),a(He);var V=t(He,2),N=t(s(V),2),Z=s(N);{var F=i=>{var d=ks();let I;var M=s(d,!0);a(d),_((E,L)=>{I=_e(d,"",I,E),r(M,L)},[()=>{var E,L;return{"--c":Ye((L=(E=X().data)==null?void 0:E.event)==null?void 0:L.type)}},()=>{var E,L;return Ne((L=(E=X().data)==null?void 0:E.event)==null?void 0:L.type)}]),l(i,d)},qe=i=>{var d=zs();l(i,d)};k(Z,i=>{X()?i(F):i(qe,!1)})}a(N),a(V);var Me=t(V,2),la=t(s(Me),2),Va=s(la);Da(Va,{get value(){return ve().length}}),a(la),a(Me),a(j),te(j,i=>{var d;return(d=re)==null?void 0:d(i)});var $a=t(j,2);{var Ga=i=>{var d=Ys(),I=s(d),M=t(s(I),2);{var E=p=>{var y=Cs();l(p,y)},L=p=>{var y=Ws();K(y,21,()=>e(Y),U=>U.runId,(U,f)=>{var ae=Ss(),$=s(ae);let oe;var xe=s($),de=s(xe),Oe=s(de,!0);a(de);var h=t(de,2),Se=s(h,!0);a(h),a(xe);var be=t(xe,2),ke=s(be),We=s(ke);a(ke);var ia=t(ke,2);{var qa=x=>{var g=Is(),Q=s(g);a(g),_(()=>r(Q,`↑${e(f).retrievedCount??""}`)),l(x,g)};k(ia,x=>{e(f).retrievedCount&&x(qa)})}var ca=t(ia,2);{var Ae=x=>{var g=Rs(),Q=s(g);a(g),_(()=>r(Q,`⊘${e(f).suppressedCount??""}`)),l(x,g)};k(ca,x=>{e(f).suppressedCount&&x(Ae)})}var Ve=t(ca,2);{var Pe=x=>{var g=Ms(),Q=s(g);a(g),_(()=>r(Q,`✎${e(f).writeCount??""}`)),l(x,g)};k(Ve,x=>{e(f).writeCount&&x(Pe)})}var oa=t(Ve,2);{var da=x=>{var g=Es(),Q=s(g);a(g),_(()=>r(Q,`⛔${e(f).vetoCount??""}`)),l(x,g)};k(oa,x=>{e(f).vetoCount&&x(da)})}a(be),a($),a(ae),_(x=>{oe=J($,1,"run-row svelte-1ayqwv0",null,oe,{active:e(f).runId===e(B)}),r(Oe,x),r(Se,e(f).firstTool??"—"),r(We,`${e(f).eventCount??""} ev`)},[()=>e(f).runId.replace("run_","").slice(0,10)]),Fe("click",$,()=>Ue(e(f).runId)),l(U,ae)}),a(y),l(p,y)};k(M,p=>{e(Y).length===0?p(E):p(L,!1)})}a(I),te(I,p=>{var y;return(y=re)==null?void 0:y(p)});var ee=t(I,2),Ee=s(ee);{var fa=p=>{var y=As();l(p,y)},na=p=>{var y=Ps(),U=s(y,!0);a(y),_(()=>r(U,e(le))),l(p,y)},ha=p=>{var y=Ts();l(p,y)},ge=p=>{var y=Xs(),U=Sa(y),f=s(U),ae=s(f),$=t(s(ae)),oe=s($,!0);a($);var xe=t($);a(ae);var de=t(ae,2);{var Oe=o=>{var v=Ns(),b=s(v);a(v),_(u=>r(b,`+${u??""}ms`),[()=>Ua(e(m).at,e(Ie))]),l(o,v)};k(de,o=>{e(m)&&o(Oe)})}a(f);var h=t(f,2);ss(h);var Se=t(h,2);K(Se,21,()=>e(q).events,ja,(o,v,b)=>{var u=Fs();let z,se;_((G,ze,Te)=>{z=J(u,1,"tick svelte-1ayqwv0",null,z,{past:b<=e(P)}),_a(u,"title",G),_a(u,"aria-label",ze),se=_e(u,"",se,Te)},[()=>Ne(e(v).type),()=>`Step ${b+1}: ${Ne(e(v).type)}`,()=>({"--c":Ye(e(v).type)})]),Fe("click",u,()=>R(P,b,!0)),l(o,u)}),a(Se),a(U),te(U,o=>{var v;return(v=re)==null?void 0:v(o)});var be=t(U,2);{var ke=o=>{var v=Vs();let b;var u=s(v),z=s(u),se=s(z,!0);a(z);var G=t(z,2),ze=s(G,!0);a(G);var Te=t(G,2),$e=s(Te,!0);a(Te),a(u);var Ge=t(u,2),Je=s(Ge,!0);a(Ge);var ba=t(Ge,2);{var pa=S=>{var C=Ds();K(C,20,()=>e(m).ids,W=>W,(W,H)=>{var O=js();let A;var Ce=s(O),Ke=s(Ce,!0);a(Ce);var Ca=t(Ce,2);{var Ia=Qe=>{var Ra=Ls(),Ya=s(Ra);a(Ra),_(Za=>r(Ya,`${Za??""}%`),[()=>(e(m).activation[H]*100).toFixed(0)]),l(Qe,Ra)};k(Ca,Qe=>{e(m).activation[H]!=null&&Qe(Ia)})}a(O),_(Qe=>{A=_e(O,"",A,{"--a":e(m).activation[H]??0}),r(Ke,Qe)},[()=>H.slice(0,8)]),l(W,O)}),a(C),l(S,C)},ka=S=>{var C=Bs(),W=s(C),H=s(W);a(W);var O=t(W,4);K(O,16,()=>e(m).ids.filter(A=>A!==e(m).winnerId),A=>A,(A,Ce)=>{var Ke=Us(),Ca=s(Ke,!0);a(Ke),_(Ia=>r(Ca,Ia),[()=>Ce.slice(0,8)]),l(A,Ke)}),a(C),_(A=>r(H,`kept ${A??""}`),[()=>{var A;return(A=e(m).winnerId)==null?void 0:A.slice(0,8)}]),l(S,C)},za=S=>{var C=Os();K(C,20,()=>e(m).evidenceIds,W=>W,(W,H)=>{var O=Hs(),A=s(O,!0);a(O),_(Ce=>r(A,Ce),[()=>H.slice(0,8)]),l(W,O)}),a(C),l(S,C)};k(ba,S=>{e(m).type==="memory.retrieve"?S(pa):e(m).type==="contradiction.detected"?S(ka,1):e(m).type==="sanhedrin.veto"&&S(za,2)})}a(v),te(v,S=>{var C;return(C=re)==null?void 0:C(S)}),_((S,C,W,H,O)=>{b=_e(v,"",b,S),r(se,C),r(ze,W),r($e,H),r(Je,O)},[()=>({"--c":Ye(e(m).type)}),()=>Ma(e(m).type),()=>Ne(e(m).type),()=>xs(e(m).at),()=>Ea(e(m))]),l(o,v)};k(be,o=>{e(m)&&o(ke)})}var We=t(be,2),ia=t(s(We),2);{var qa=o=>{var v=$s();l(o,v)},ca=o=>{var v=Js();K(v,20,()=>e(Le),b=>b,(b,u)=>{var z=Gs(),se=s(z,!0);a(z),_(G=>r(se,G),[()=>u.slice(0,8)]),l(b,z)}),a(v),l(o,v)};k(ia,o=>{e(Le).length===0?o(qa):o(ca,!1)})}a(We),te(We,o=>{var v;return(v=re)==null?void 0:v(o)});var Ae=t(We,2),Ve=t(s(Ae),2),Pe=t(s(Ve),2);let oa;var da=t(s(Pe),2),x=s(da,!0);a(da),a(Pe);var g=t(Pe,2);let Q;var Aa=t(s(g),2),Ka=s(Aa,!0);a(Aa),a(g);var ga=t(g,2);let Pa;var Ta=t(s(ga),2),Qa=s(Ta,!0);a(Ta),a(ga),a(Ve),a(Ae),te(Ae,o=>{var v;return(v=re)==null?void 0:v(o)});var Na=t(Ae,2);{var Xa=o=>{var v=Ks(),b=t(s(v),2);K(b,21,()=>e(he).slice(0,2),u=>u.receipt_id,(u,z)=>{qs(u,{get receipt(){return e(z)}})}),a(b),a(v),te(v,u=>{var z;return(z=re)==null?void 0:z(u)}),l(o,v)};k(Na,o=>{e(he).length&&o(Xa)})}var xa=t(Na,2),Fa=t(s(xa),2);K(Fa,21,()=>e(q).events,ja,(o,v,b)=>{var u=Qs();let z,se;var G=s(u),ze=s(G),Te=s(ze,!0);a(ze);var $e=t(ze,2),Ge=s($e,!0);a($e);var Je=t($e,2),ba=s(Je,!0);a(Je);var pa=t(Je,2),ka=s(pa);a(pa),a(G),a(u),_((za,S,C,W,H)=>{z=J(u,1,"log-row svelte-1ayqwv0",null,z,{active:b===e(P),dim:b>e(P)}),se=_e(u,"",se,za),r(Te,S),r(Ge,C),r(ba,W),r(ka,`+${H??""}ms`)},[()=>({"--c":Ye(e(v).type)}),()=>Ma(e(v).type),()=>Ne(e(v).type),()=>Ea(e(v)),()=>Ua(e(v).at,e(Ie))]),Fe("click",G,()=>R(P,b,!0)),l(o,u)}),a(Fa),a(xa),te(xa,o=>{var v;return(v=re)==null?void 0:v(o)}),_(o=>{r(oe,e(P)+1),r(xe,` / ${e(q).events.length??""}`),_a(h,"max",o),oa=J(Pe,1,"producer svelte-1ayqwv0",null,oa,{ok:e(De)}),r(x,e(De)?"fired this run":"no contradiction in this run"),Q=J(g,1,"producer caveat svelte-1ayqwv0",null,Q,{ok:e(je)}),r(Ka,e(je)?"fired this run":"No dream run in this trace"),Pa=J(ga,1,"producer caveat svelte-1ayqwv0",null,Pa,{ok:e(sa)}),r(Qa,e(sa)?"fired this run":"No veto producer connected (optional Sanhedrin hook, off by default)")},[()=>Math.max(0,e(q).events.length-1)]),ts(h,()=>e(P),o=>R(P,o)),l(p,y)};k(Ee,p=>{e(fe)?p(fa):e(le)?p(na,1):e(q)?p(ge,!1):p(ha,2)})}a(ee),a(d),l(i,d)},Ja=i=>{var d=et(),I=s(d),M=s(I);let E;var L=t(M,2),ee=s(L,!0);a(L),a(I);var Ee=t(I,2);{var fa=ge=>{const p=ue(()=>{var h;return(h=X().data)==null?void 0:h.event});var y=Zs();let U;var f=s(y),ae=s(f,!0);a(f);var $=t(f,2),oe=s($),xe=s(oe,!0);a(oe);var de=t(oe,2),Oe=s(de,!0);a(de),a($),a(y),_((h,Se,be,ke)=>{U=_e(y,"",U,h),r(ae,Se),r(xe,be),r(Oe,ke)},[()=>{var h;return{"--c":Ye((h=e(p))==null?void 0:h.type)}},()=>{var h;return Ma((h=e(p))==null?void 0:h.type)},()=>{var h;return Ne((h=e(p))==null?void 0:h.type)},()=>Ea(e(p))]),l(ge,y)};k(Ee,ge=>{X()&&ge(fa)})}var na=t(Ee,2),ha=s(na);Da(ha,{get value(){return ve().length}}),ye(2),a(na),ye(2),a(d),te(d,ge=>{var p;return(p=re)==null?void 0:p(ge)}),_(()=>{E=J(M,1,"dot big svelte-1ayqwv0",null,E,{live:we()}),r(ee,Ze()??"awaiting run…")}),l(i,d)};k($a,i=>{e(ne)?i(Ja,!1):i(Ga)})}a(ie),_(()=>{ra=J(Re,1,"spine-value svelte-1ayqwv0",null,ra,{live:we()}),va=J(Be,1,"dot svelte-1ayqwv0",null,va,{live:we()}),r(ma,` ${we()?"Connected":"Offline"}`),r(D,Ze()??"—")}),l(c,ie),Ha(),ea()}Oa(["click"]);export{ft as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/5.CK5gRe3F.js.br b/apps/dashboard/build/_app/immutable/nodes/5.CK5gRe3F.js.br deleted file mode 100644 index ade9603..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/5.CK5gRe3F.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/5.CK5gRe3F.js.gz b/apps/dashboard/build/_app/immutable/nodes/5.CK5gRe3F.js.gz deleted file mode 100644 index e46c0a3..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/5.CK5gRe3F.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/6.DTUGCA1p.js b/apps/dashboard/build/_app/immutable/nodes/6.DTUGCA1p.js new file mode 100644 index 0000000..5f3fc6c --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/6.DTUGCA1p.js @@ -0,0 +1,14 @@ +import"../chunks/Bzak7iHL.js";import{p as qe,d as a,r as t,e as i,g as e,f as he,u as b,t as R,a as Se,n as X,h as de,s as be,W as Ge,aG as Ae}from"../chunks/CpWkWWOo.js";import{s as x,d as Ye,a as pe}from"../chunks/BlVfL1ME.js";import{c as Fe,a as m,f as _,b as Ve,t as Ie}from"../chunks/CHOnp4oo.js";import{i as j}from"../chunks/B4yTwGkE.js";import{e as ge}from"../chunks/CGEBXrjl.js";import{h as We}from"../chunks/C4h_mRt2.js";import{s as A,r as Be,a as Xe}from"../chunks/A7po6GxK.js";import{s as _e}from"../chunks/aVbAZ-t7.js";import{a as ze}from"../chunks/DNjM5a-l.js";import{s as ae}from"../chunks/Cx-f-Pzo.js";import{p as Ue}from"../chunks/V6gjw5Ec.js";import{b as Je}from"../chunks/BskPcZf7.js";const Te=5,je=["Replay","Cross-reference","Strengthen","Prune","Transfer"];function Oe(v){if(!Number.isFinite(v))return 1;const n=Math.floor(v);return n<1?1:n>Te?Te:n}const Ke=.3,Qe=.7;function Ze(v){const n=ye(v);return n>Qe?"high":n1?1:v}function $e(v){return v==null||!Number.isFinite(v)||v<0?"0ms":v<1e3?`${Math.round(v)}ms`:`${(v/1e3).toFixed(2)}s`}function et(v){const n=ye(v);return`${Math.round(n*100)}%`}function tt(v,n=""){return`${n}/memories/${v}`}function st(v,n=2){return!v||v.length===0?[]:v.slice(0,Math.max(0,n))}function at(v,n=2){return v?Math.max(0,v.length-n):0}function rt(v){return v?v.length>8?v.slice(0,8):v:""}var nt=_('
                    Episodic hippocampus
                    Semantic cortex
                    ',1),it=Ve(''),vt=_('
                    '),lt=_(''),ot=_('Replaying memories'),ct=_('New connections found: '),dt=_('Strengthened: '),ut=_('Compressed: '),ft=_('Connections persisted: Insights: ',1),mt=_('
                    ');function pt(v,n){qe(n,!0);const N=[{num:1,name:"Replay",color:"#818cf8",desc:"Hippocampal replay: tagged memories surface for consolidation."},{num:2,name:"Cross-reference",color:"#a855f7",desc:"Semantic proximity check — new edges discovered across memories."},{num:3,name:"Strengthen",color:"#c084fc",desc:"Co-activated memories strengthen; FSRS stability grows."},{num:4,name:"Prune",color:"#ef4444",desc:"Low-retention redundant memories compressed or released."},{num:5,name:"Transfer",color:"#10b981",desc:"Episodic → semantic consolidation (hippocampus → cortex)."}];let l=b(()=>Oe(n.stage)),f=b(()=>N[e(l)-1]),q=b(()=>{if(!n.dreamResult)return 8;const s=n.dreamResult.memoriesReplayed??8;return Math.max(6,Math.min(12,s))}),re=b(()=>{var r;if(!n.dreamResult)return 5;const s=((r=n.dreamResult.stats)==null?void 0:r.newConnectionsFound)??5;return Math.max(3,Math.min(e(q),s))}),z=b(()=>{var r;if(!n.dreamResult)return Math.ceil(e(q)*.5);const s=((r=n.dreamResult.stats)==null?void 0:r.memoriesStrengthened)??Math.ceil(e(q)*.5);return Math.max(1,Math.min(e(q),s))}),ne=b(()=>{var r;if(!n.dreamResult)return Math.ceil(e(q)*.25);const s=((r=n.dreamResult.stats)==null?void 0:r.memoriesCompressed)??Math.ceil(e(q)*.25);return Math.max(1,Math.min(Math.floor(e(q)/2),s))});function C(s,r=0){const d=Math.sin((s+1)*9301+49297+r*233)*233280;return d-Math.floor(d)}let U=b(()=>{const s=[],r=Math.ceil(Math.sqrt(e(q))),d=Math.ceil(e(q)/r);for(let c=0;c{const s=[],r=e(U).length;for(let d=0;d{var r=nt();X(4),m(s,r)};j(le,s=>{e(l)===5&&s(oe)})}var ee=i(le,2);ge(ee,23,()=>e(L),(s,r)=>s.a+"-"+s.b+"-"+r,(s,r,d)=>{const c=b(()=>e(U)[e(r).a]),p=b(()=>e(U)[e(r).b]);var u=Fe(),k=he(u);{var w=g=>{const M=b(()=>I(e(c))),h=b(()=>F(e(c))),V=b(()=>I(e(p))),ke=b(()=>F(e(p)));var E=it();R(()=>{A(E,"x1",e(M)),A(E,"y1",e(h)),A(E,"x2",e(V)),A(E,"y2",e(ke)),A(E,"stroke",e(f).color),A(E,"stroke-width",e(l)===2?.25:e(l)===3?.35:.2),A(E,"stroke-opacity",e(l)<2?0:e(l)===4?.25:e(l)===5?.15:.6),A(E,"stroke-dasharray",e(l)===2?"1.2 0.8":"none"),ae(E,`--edge-delay: ${e(d)*80}ms`)}),m(g,E)};j(k,g=>{e(c)&&e(p)&&g(w)})}m(s,u)}),t(ee);var S=i(ee,2);ge(S,17,()=>e(U),s=>s.id,(s,r)=>{var d=vt();let c;R((p,u,k,w,g)=>{c=_e(d,1,"memory-card svelte-1cq1ntk",null,c,{"is-pulsing":e(l)===3&&e(r).strengthened,"is-pruning":e(l)===4&&e(r).pruned,"is-transferring":e(l)===5,"semantic-side":e(l)===5&&e(r).transferIsSemantic}),ae(d,` + left: ${p??""}%; + top: ${u??""}%; + opacity: ${k??""}; + --card-scale: ${w??""}; + --card-delay: ${e(r).id*40}ms; + --card-hue: ${g??""}deg; + `)},[()=>I(e(r)),()=>F(e(r)),()=>J(e(r)),()=>K(e(r)),()=>C(e(r).id,3)*60-30]),m(s,d)});var D=i(S,2);{var te=s=>{var r=lt();m(s,r)};j(D,s=>{e(l)===1&&s(te)})}t(P);var se=i(P,2),ue=a(se);{var ce=s=>{var r=ot(),d=i(a(r)),c=a(d,!0);t(d),X(),t(r),R(()=>{var p;return x(c,((p=n.dreamResult)==null?void 0:p.memoriesReplayed)??e(q))}),m(s,r)},T=s=>{var r=ct(),d=i(a(r)),c=a(d,!0);t(d),t(r),R(()=>{var p,u;return x(c,((u=(p=n.dreamResult)==null?void 0:p.stats)==null?void 0:u.newConnectionsFound)??e(re))}),m(s,r)},H=s=>{var r=dt(),d=i(a(r)),c=a(d,!0);t(d),t(r),R(()=>{var p,u;return x(c,((u=(p=n.dreamResult)==null?void 0:p.stats)==null?void 0:u.memoriesStrengthened)??e(z))}),m(s,r)},G=s=>{var r=ut(),d=i(a(r)),c=a(d,!0);t(d),t(r),R(()=>{var p,u;return x(c,((u=(p=n.dreamResult)==null?void 0:p.stats)==null?void 0:u.memoriesCompressed)??e(ne))}),m(s,r)},fe=s=>{var r=ft(),d=he(r),c=i(a(d)),p=a(c,!0);t(c),t(d);var u=i(d,2),k=i(a(u)),w=a(k,!0);t(k),t(u),R(()=>{var g,M,h;x(p,((g=n.dreamResult)==null?void 0:g.connectionsPersisted)??0),x(w,((h=(M=n.dreamResult)==null?void 0:M.stats)==null?void 0:h.insightsGenerated)??0)}),m(s,r)};j(ue,s=>{e(l)===1?s(ce):e(l)===2?s(T,1):e(l)===3?s(H,2):e(l)===4?s(G,3):e(l)===5&&s(fe,4)})}t(se),t(ie),R(()=>{ae(Y,` + background: color-mix(in srgb, ${e(f).color??""} 20%, transparent); + color: ${e(f).color??""}; + border: 1.5px solid ${e(f).color??""}; + box-shadow: 0 0 16px color-mix(in srgb, ${e(f).color??""} 40%, transparent); + `),x(me,e(f).num),x(o,e(f).name),x(O,e(f).desc),x(B,`Stage ${e(f).num??""} / 5`),ae(P,`--stage-color: ${e(f).color??""}`),A(P,"aria-label",`Dream stage ${e(f).num??""} — ${e(f).name??""}`)}),m(v,ie),Se()}var gt=_(' novel'),xt=_(' '),bt=_(' '),ht=_('
                    Sources
                    '),_t=_('

                    Novelty
                    Confidence
                    ');function yt(v,n){qe(n,!0);let N=Ue(n,"index",3,0),l=b(()=>ye(n.insight.noveltyScore)),f=b(()=>ye(n.insight.confidence)),q=b(()=>Ze(n.insight.noveltyScore)),re=b(()=>e(q)==="high"),z=b(()=>e(q)==="low"),ne=b(()=>st(n.insight.sourceMemories,2)),C=b(()=>at(n.insight.sourceMemories,2));const U={connection:"#818cf8",pattern:"#ec4899",contradiction:"#ef4444",synthesis:"#c084fc",emergence:"#f59e0b",cluster:"#06b6d4"};let L=b(()=>{var S;return U[((S=n.insight.type)==null?void 0:S.toLowerCase())??""]??"#a855f7"});var I=_t();let F;var J=a(I),K=a(J),ie=a(K,!0);t(K);var ve=i(K,2);{var Q=S=>{var D=gt();m(S,D)};j(ve,S=>{e(re)&&S(Q)})}t(J);var Y=i(J,2),me=a(Y,!0);t(Y);var Z=i(Y,2),W=a(Z),o=i(a(W),2),y=a(o,!0);t(o),t(W);var O=i(W,2),$=a(O);t(O),t(Z);var B=i(Z,2),P=i(a(B),2),le=a(P,!0);t(P),t(B);var oe=i(B,2);{var ee=S=>{var D=ht(),te=a(D),se=i(a(te));{var ue=T=>{var H=xt(),G=a(H);t(H),R(()=>x(G,`(+${e(C)??""})`)),m(T,H)};j(se,T=>{e(C)>0&&T(ue)})}t(te);var ce=i(te,2);ge(ce,20,()=>e(ne),T=>T,(T,H)=>{var G=bt(),fe=a(G,!0);t(G),R((s,r)=>{A(G,"href",s),A(G,"title",`Open memory ${H??""}`),x(fe,r)},[()=>tt(H,Je),()=>rt(H)]),m(T,G)}),t(ce),t(D),m(S,D)};j(oe,S=>{e(ne).length>0&&S(ee)})}t(I),R((S,D)=>{F=_e(I,1,"insight-card glass-panel rounded-xl p-4 space-y-3 svelte-1y17hsl",null,F,{"high-novelty":e(re),"low-novelty":e(z)}),ae(I,`--insight-color: ${e(L)??""}; --enter-delay: ${N()*60}ms`),ae(K,`background: ${e(L)??""}22; color: ${e(L)??""}; border: 1px solid ${e(L)??""}55`),x(ie,n.insight.type??"insight"),x(me,n.insight.insight),x(y,S),ae($,`width: ${e(l)*100}%; background: linear-gradient(90deg, ${e(L)??""}, var(--color-dream-glow))`),ae(P,`color: ${e(f)>.7?"#10b981":e(f)>.4?"#f59e0b":"#ef4444"}`),x(le,D)},[()=>e(l).toFixed(2),()=>et(e(f))]),m(v,I),Se()}var kt=_(' Dreaming...',1),wt=_(' Dream Now',1),qt=_('
                    '),St=_('

                    No dream yet.

                    Click Dream Now to begin.

                    '),Mt=_(''),Rt=_('
                    '),Ct=_('
                    Replayed
                    Connections Found
                    Connections Persisted
                    Insights
                    Duration
                    '),Dt=_('
                    ',1),Nt=_(`

                    Dream Cinema

                    Scrub through Vestige's 5-stage consolidation cycle. Replay, cross-reference, + strengthen, prune, transfer. Watch episodic become semantic.

                    `);function Wt(v,n){qe(n,!0);let N=be(null),l=be(1),f=be(!1),q=be(null),re=b(()=>e(N)!==null),z=b(()=>{const o=e(N);return o?[...o.insights].sort((y,O)=>(O.noveltyScore??0)-(y.noveltyScore??0)):[]});async function ne(){if(!e(f)){de(f,!0),de(q,null);try{const o=await ze.dream();de(N,o,!0),de(l,1)}catch(o){de(q,o instanceof Error?o.message:"Dream failed",!0)}finally{de(f,!1)}}}function C(o){de(l,Oe(o),!0)}function U(o){const y=Number(o.currentTarget.value);C(y)}var L=Nt();We("1fv2vo0",o=>{Ge(()=>{Ae.title="Dream Cinema · Vestige"})});var I=a(L),F=i(a(I),2);let J;var K=a(F);{var ie=o=>{var y=kt();X(2),m(o,y)},ve=o=>{var y=wt();X(2),m(o,y)};j(K,o=>{e(f)?o(ie):o(ve,!1)})}t(F),t(I);var Q=i(I,2);{var Y=o=>{var y=qt(),O=a(y,!0);t(y),R(()=>x(O,e(q))),m(o,y)};j(Q,o=>{e(q)&&o(Y)})}var me=i(Q,2);{var Z=o=>{var y=St();m(o,y)},W=o=>{var y=Dt(),O=he(y),$=a(O),B=a($),P=a(B);t(B);var le=i(B,2),oe=a(le),ee=i(oe,2);t(le),t($);var S=i($,2),D=a(S);Be(D);var te=i(D,2);ge(te,22,()=>je,u=>u,(u,k,w)=>{var g=Mt();let M;var h=i(a(g),2),V=a(h);t(h),t(g),R(()=>{M=_e(g,1,"tick svelte-1fv2vo0",null,M,{active:e(l)===e(w)+1,passed:e(l)>e(w)+1}),g.disabled=e(f),x(V,`${e(w)+1}. ${k??""}`)}),pe("click",g,()=>C(e(w)+1)),m(u,g)}),t(te),t(S),t(O);var se=i(O,2),ue=a(se);pt(ue,{get stage(){return e(l)},get dreamResult(){return e(N)}});var ce=i(ue,2),T=a(ce),H=i(a(T),2),G=a(H);t(H),t(T);var fe=i(T,2),s=a(fe);{var r=u=>{var k=Rt(),w=a(k);{var g=h=>{var V=Ie("Dreaming...");m(h,V)},M=h=>{var V=Ie("No insights generated this cycle.");m(h,V)};j(w,h=>{e(f)?h(g):h(M,!1)})}t(k),m(u,k)},d=u=>{var k=Fe(),w=he(k);ge(w,19,()=>e(z),(g,M)=>{var h;return M+"-"+(((h=g.insight)==null?void 0:h.slice(0,32))??"")},(g,M,h)=>{yt(g,{get insight(){return e(M)},get index(){return e(h)}})}),m(u,k)};j(s,u=>{e(z).length===0?u(r):u(d,!1)})}t(fe),t(ce),t(se);var c=i(se,2);{var p=u=>{var k=Ct(),w=a(k),g=a(w),M=a(g,!0);t(g),X(2),t(w);var h=i(w,2),V=a(h),ke=a(V,!0);t(V),X(2),t(h);var E=i(h,2),Me=a(E),He=a(Me,!0);t(Me),X(2),t(E);var we=i(E,2),Re=a(we),Le=a(Re,!0);t(Re),X(2),t(we);var Ce=i(we,2),De=a(Ce),Pe=a(De,!0);t(De),X(2),t(Ce),t(k),R(xe=>{var Ne,Ee;x(M,e(N).memoriesReplayed??0),x(ke,((Ne=e(N).stats)==null?void 0:Ne.newConnectionsFound)??0),x(He,e(N).connectionsPersisted??0),x(Le,((Ee=e(N).stats)==null?void 0:Ee.insightsGenerated)??0),x(Pe,xe)},[()=>{var xe;return $e((xe=e(N).stats)==null?void 0:xe.durationMs)}]),m(u,k)};j(c,u=>{e(N)&&u(p)})}R(()=>{x(P,`Stage ${e(l)??""} · ${je[e(l)-1]??""}`),oe.disabled=e(l)<=1||e(f),ee.disabled=e(l)>=5||e(f),Xe(D,e(l)),D.disabled=e(f),x(G,`${e(z).length??""} total · by novelty`)}),pe("click",oe,()=>C(e(l)-1)),pe("click",ee,()=>C(e(l)+1)),pe("input",D,U),m(o,y)};j(me,o=>{!e(re)&&!e(f)?o(Z):o(W,!1)})}t(L),R(()=>{F.disabled=e(f),J=_e(F,1,"dream-button svelte-1fv2vo0",null,J,{"is-dreaming":e(f)})}),pe("click",F,ne),m(v,L),Se()}Ye(["click","input"]);export{Wt as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/6.DTUGCA1p.js.br b/apps/dashboard/build/_app/immutable/nodes/6.DTUGCA1p.js.br new file mode 100644 index 0000000..103008a Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/6.DTUGCA1p.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/6.DTUGCA1p.js.gz b/apps/dashboard/build/_app/immutable/nodes/6.DTUGCA1p.js.gz new file mode 100644 index 0000000..50ce680 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/6.DTUGCA1p.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/6.DZyLUVX2.js b/apps/dashboard/build/_app/immutable/nodes/6.DZyLUVX2.js deleted file mode 100644 index d551f42..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/6.DZyLUVX2.js +++ /dev/null @@ -1,2 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{p as st,e as s,h as i,f as Ke,t as F,g as e,i as E,a as w,u as M,r as a,n as ee,b as it,s as te,j as S,au as Ye}from"../chunks/wpu9U-D0.js";import{d as ot,a as W,e as ye,s as k}from"../chunks/D8mhvFt8.js";import{i as B}from"../chunks/DKve45Wd.js";import{e as ue,a as n,s as St,i as Qe}from"../chunks/60_R_Vbt.js";import{a as le,r as me}from"../chunks/P1-U_Xsj.js";import{s as q}from"../chunks/EqHb-9AZ.js";import{p as $e}from"../chunks/ByYB047u.js";import{P as Rt}from"../chunks/BHDZZvku.js";import{D as Je}from"../chunks/CmbJHhgy.js";import{I as Ze}from"../chunks/D7A-gG4Z.js";import{A as ce}from"../chunks/DcKTNC6e.js";const nt=.7,lt=.5,Tt="#ef4444",At="#f59e0b",Et="#fde047";function Be(m){return m>nt?Tt:m>lt?At:Et}function mt(m){return m>nt?"strong":m>lt?"moderate":"mild"}const et="#8b5cf6",Dt={fact:"#3b82f6",concept:"#8b5cf6",event:"#f59e0b",person:"#10b981",place:"#06b6d4",note:"#6b7280",pattern:"#ec4899",decision:"#ef4444"};function tt(m){return m?Dt[m]??et:et}const rt=5,Ot=9;function Ct(m){if(!Number.isFinite(m))return rt;const v=m<0?0:m>1?1:m;return rt+v*Ot}const Ft=.12;function at(m,v){return v==null||v===m?1:Ft}function he(m,v=60){return m==null||typeof m!="string"||v<=0?"":m.length<=v?m:m.slice(0,v-1)+"…"}function Nt(m){if(!m||m.length===0)return 0;const v=new Set;for(const u of m)u.memory_a_id&&v.add(u.memory_a_id),u.memory_b_id&&v.add(u.memory_b_id);return v.size}function Gt(m){if(!m||m.length===0)return 0;let v=0;for(const u of m)v+=Math.abs((u.trust_a??0)-(u.trust_b??0));return v/m.length}var Pt=Ye('',1),Lt=Ye(' '),$t=Ye('',1),Bt=S('
                    '),Yt=S('
                    '),zt=S('
                    '),Vt=S('
                    topic:
                    '),Ht=S('
                    SEVERITYstrong (>0.7)moderate (0.5-0.7)mild (0.3-0.5)
                    ');function Ut(m,v){st(v,!0);let u=$e(v,"focusedPairIndex",3,null),D=$e(v,"width",3,800),O=$e(v,"height",3,600);const R=M(()=>{const d=D()/2,r=O()/2,g=Math.min(D(),O())*.38;return{cx:d,cy:r,R:g}}),fe=M(()=>{const d=[],r=[],g=v.contradictions.length||1;return v.contradictions.forEach((l,p)=>{const j=p/g*Math.PI*2-Math.PI/2,y=.18+l.similarity*.22,f=j-y,_=j+y,G=e(R).R+Math.sin(p*2.3)*18,L=e(R).R+Math.cos(p*1.7)*18,b={x:e(R).cx+Math.cos(f)*G,y:e(R).cy+Math.sin(f)*G,trust:l.trust_a,preview:l.memory_a_preview,type:l.memory_a_type,created:l.memory_a_created,tags:l.memory_a_tags,memoryId:l.memory_a_id,pairIndex:p,side:"a"},h={x:e(R).cx+Math.cos(_)*L,y:e(R).cy+Math.sin(_)*L,trust:l.trust_b,preview:l.memory_b_preview,type:l.memory_b_type,created:l.memory_b_created,tags:l.memory_b_tags,memoryId:l.memory_b_id,pairIndex:p,side:"b"};d.push(b,h);const $=(b.x+h.x)/2,I=(b.y+h.y)/2,A=.55-l.similarity*.25,z=$+(e(R).cx-$)*A,V=I+(e(R).cy-I)*A,ve=1+Math.min(l.trust_a,l.trust_b)*4;r.push({pairIndex:p,path:`M ${b.x.toFixed(1)} ${b.y.toFixed(1)} Q ${z.toFixed(1)} ${V.toFixed(1)} ${h.x.toFixed(1)} ${h.y.toFixed(1)}`,color:Be(l.similarity),thickness:ve,severity:mt(l.similarity),topic:l.topic,similarity:l.similarity,dateDiff:l.date_diff_days,aPoint:b,bPoint:h,midX:z,midY:V})}),{nodes:d,arcs:r}});let T=te(null),P=te(null),Y=te(0),N=te(0);function we(d){const r=d.currentTarget.getBoundingClientRect();E(Y,d.clientX-r.left),E(N,d.clientY-r.top)}function re(d){v.onSelectPair&&v.onSelectPair(u()===d?null:d)}function je(){var d;(d=v.onSelectPair)==null||d.call(v,null)}var ae=Ht(),C=s(ae),de=i(s(C)),H=i(de),se=i(H),ie=i(se);ue(ie,17,()=>e(fe).arcs,d=>d.pairIndex,(d,r)=>{const g=M(()=>at(e(r).pairIndex,u())),l=M(()=>u()===e(r).pairIndex);var p=Pt(),j=Ke(p),y=i(j),f=i(y);F(_=>{n(j,"d",e(r).path),n(j,"stroke",e(r).color),n(j,"stroke-width",e(r).thickness*3),n(j,"stroke-opacity",.08*e(g)),n(y,"d",e(r).path),n(y,"stroke",e(r).color),n(y,"stroke-width",e(r).thickness*(e(l)?1.6:1)),n(y,"stroke-opacity",(e(l)?1:.72)*e(g)),n(y,"aria-label",`contradiction ${e(r).pairIndex+1}: ${e(r).topic??""}`),n(f,"d",e(r).path),n(f,"stroke",e(r).color),n(f,"stroke-width",_),n(f,"stroke-opacity",.85*e(g)),q(f,`animation-duration: ${4+e(r).pairIndex%5}s`)},[()=>Math.max(1,e(r).thickness*.6)]),W("click",y,_=>{_.stopPropagation(),re(e(r).pairIndex)}),ye("mouseenter",y,()=>E(P,e(r),!0)),ye("mouseleave",y,()=>E(P,null)),W("keydown",y,_=>{_.key==="Enter"&&re(e(r).pairIndex)}),w(d,p)});var oe=i(ie);ue(oe,19,()=>e(fe).nodes,(d,r)=>d.memoryId+"-"+d.side+"-"+r,(d,r)=>{const g=M(()=>at(e(r).pairIndex,u())),l=M(()=>u()===e(r).pairIndex),p=M(()=>Ct(e(r).trust)),j=M(()=>tt(e(r).type));var y=$t(),f=Ke(y),_=i(f),G=i(_);{var L=b=>{var h=Lt(),$=s(h,!0);a(h),F(I=>{n(h,"x",e(r).x),n(h,"y",e(r).y-e(p)-8),k($,I)},[()=>he(e(r).preview,40)]),w(b,h)};B(G,b=>{e(l)&&b(L)})}F(b=>{n(f,"cx",e(r).x),n(f,"cy",e(r).y),n(f,"r",e(p)*2.2),n(f,"fill",e(j)),n(f,"opacity",.12*e(g)),n(_,"cx",e(r).x),n(_,"cy",e(r).y),n(_,"r",e(p)),n(_,"fill",e(j)),n(_,"opacity",e(g)),n(_,"stroke-opacity",e(l)?.85:.25),n(_,"stroke-width",e(l)?2:1),n(_,"aria-label",`memory ${b??""}`)},[()=>he(e(r).preview,40)]),ye("mouseenter",_,()=>E(T,e(r),!0)),ye("mouseleave",_,()=>E(T,null)),W("click",_,b=>{b.stopPropagation(),re(e(r).pairIndex)}),W("keydown",_,b=>{b.key==="Enter"&&re(e(r).pairIndex)}),w(d,y)}),ee(),a(C);var _e=i(C,2);{var Me=d=>{var r=zt(),g=s(r),l=s(g),p=i(l,2),j=s(p,!0);a(p);var y=i(p,2),f=s(y);a(y),a(g);var _=i(g,2),G=s(_,!0);a(_);var L=i(_,2);{var b=I=>{var A=Bt(),z=s(A);a(A),F(()=>k(z,`created ${e(T).created??""}`)),w(I,A)};B(L,I=>{e(T).created&&I(b)})}var h=i(L,2);{var $=I=>{var A=Yt(),z=s(A,!0);a(A),F(V=>k(z,V),[()=>e(T).tags.slice(0,4).join(" · ")]),w(I,A)};B(h,I=>{e(T).tags&&e(T).tags.length>0&&I($)})}a(r),F((I,A,z,V)=>{q(r,`left: ${I??""}px; top: ${A??""}px;`),q(l,`background: ${z??""}`),k(j,e(T).type??"memory"),k(f,`trust ${V??""}%`),k(G,e(T).preview)},[()=>Math.max(0,Math.min(e(Y)+12,D()-240)),()=>Math.max(0,Math.min(e(N)-8,O()-120)),()=>tt(e(T).type),()=>(e(T).trust*100).toFixed(0)]),w(d,r)},be=d=>{var r=Vt(),g=s(r),l=s(g),p=i(l,2),j=s(p);a(p),a(g);var y=i(g,2),f=i(s(y)),_=s(f,!0);a(f),a(y);var G=i(y,2),L=s(G);a(G),a(r),F((b,h,$)=>{q(r,`left: ${b??""}px; top: ${h??""}px;`),q(l,`background: ${e(P).color??""}`),k(j,`${e(P).severity??""} conflict`),k(_,e(P).topic),k(L,`similarity ${$??""}% · ${e(P).dateDiff??""}d apart`)},[()=>Math.max(0,Math.min(e(Y)+12,D()-240)),()=>Math.max(0,Math.min(e(N)-8,O()-120)),()=>(e(P).similarity*100).toFixed(0)]),w(d,r)};B(_e,d=>{e(T)?d(Me):e(P)&&d(be,1)})}a(ae),F(()=>{q(ae,`aspect-ratio: ${D()??""} / ${O()??""};`),n(C,"width",D()),n(C,"height",O()),n(C,"viewBox",`0 0 ${D()??""} ${O()??""}`),n(de,"width",D()),n(de,"height",O()),n(H,"cx",e(R).cx),n(H,"cy",e(R).cy),n(H,"r",e(R).R),n(se,"cx",e(R).cx),n(se,"cy",e(R).cy)}),W("mousemove",C,we),ye("mouseleave",C,()=>{E(T,null),E(P,null)}),W("click",C,je),w(m,ae),it()}ot(["mousemove","click","keydown"]);var Wt=S(' in view'),qt=S(''),Xt=S('

                    No contradictions match this filter.

                    '),Kt=S('
                    No pairs visible.
                    '),Qt=S(' '),Jt=S('
                    '),Zt=S(' '),er=S('
                    '),tr=S('
                    Full memory A
                    Full memory B
                    '),rr=S(''),ar=S('
                    average trust delta
                    visible in current filter
                    strong conflicts
                    ');function ur(m,v){st(v,!0);const u=[{memory_a_id:"a1",memory_b_id:"b1",memory_a_preview:"Dev server runs on port 3000 (default Vite config)",memory_b_preview:"Dev server moved to port 3002 to avoid conflict",memory_a_type:"fact",memory_b_type:"decision",memory_a_created:"2026-01-14",memory_b_created:"2026-03-22",memory_a_tags:["dev","vite"],memory_b_tags:["dev","vite","decision"],trust_a:.42,trust_b:.91,similarity:.88,date_diff_days:67,topic:"dev server port"},{memory_a_id:"a2",memory_b_id:"b2",memory_a_preview:"Prompt variation helps at higher sampling temperatures",memory_b_preview:"Prompt variation reduced accuracy in the latest benchmark run",memory_a_type:"concept",memory_b_type:"fact",memory_a_created:"2026-03-30",memory_b_created:"2026-04-03",memory_a_tags:["research","prompting"],memory_b_tags:["research","prompting","evidence"],trust_a:.35,trust_b:.88,similarity:.92,date_diff_days:4,topic:"prompt diversity"},{memory_a_id:"a3",memory_b_id:"b3",memory_a_preview:"Use min_p=0.05 for long-form sampling",memory_b_preview:"min_p scheduling failed at high sampling temperatures",memory_a_type:"pattern",memory_b_type:"fact",memory_a_created:"2026-04-01",memory_b_created:"2026-04-05",memory_a_tags:["sampling"],memory_b_tags:["sampling"],trust_a:.58,trust_b:.74,similarity:.81,date_diff_days:4,topic:"min_p sampling"},{memory_a_id:"a4",memory_b_id:"b4",memory_a_preview:"LoRA rank 16 is enough for domain adaptation",memory_b_preview:"LoRA rank 32 consistently outperforms rank 16 on math",memory_a_type:"concept",memory_b_type:"fact",memory_a_created:"2026-02-10",memory_b_created:"2026-04-12",memory_a_tags:["lora","training"],memory_b_tags:["lora","training","nemotron"],trust_a:.48,trust_b:.76,similarity:.74,date_diff_days:61,topic:"LoRA rank"},{memory_a_id:"a5",memory_b_id:"b5",memory_a_preview:"Team prefers Rust for backend services",memory_b_preview:"Project chose Axum + Rust for the dashboard backend",memory_a_type:"note",memory_b_type:"decision",memory_a_created:"2026-01-05",memory_b_created:"2026-02-18",memory_a_tags:["preference","backend"],memory_b_tags:["backend","decision"],trust_a:.81,trust_b:.88,similarity:.42,date_diff_days:44,topic:"backend language"},{memory_a_id:"a6",memory_b_id:"b6",memory_a_preview:"Warm-start from checkpoint saves 8h of training",memory_b_preview:"Warm-start code never loaded the PEFT adapter correctly",memory_a_type:"pattern",memory_b_type:"fact",memory_a_created:"2026-03-11",memory_b_created:"2026-04-16",memory_a_tags:["training","warm-start"],memory_b_tags:["training","warm-start","bug-fix"],trust_a:.55,trust_b:.93,similarity:.79,date_diff_days:36,topic:"warm-start correctness"},{memory_a_id:"a7",memory_b_id:"b7",memory_a_preview:"Three.js force-directed graph runs fine at 5k nodes",memory_b_preview:"WebGL graph stutters above 2k nodes on M1 MacBook Air",memory_a_type:"fact",memory_b_type:"fact",memory_a_created:"2025-12-02",memory_b_created:"2026-03-29",memory_a_tags:["vestige","graph","perf"],memory_b_tags:["vestige","graph","perf"],trust_a:.39,trust_b:.72,similarity:.67,date_diff_days:117,topic:"graph performance"},{memory_a_id:"a8",memory_b_id:"b8",memory_a_preview:"Submit benchmark runs with a 16384 token budget",memory_b_preview:"Latest baseline improved when token budget increased to 32768",memory_a_type:"pattern",memory_b_type:"event",memory_a_created:"2026-04-04",memory_b_created:"2026-04-10",memory_a_tags:["benchmark","tokens"],memory_b_tags:["benchmark","baseline"],trust_a:.31,trust_b:.85,similarity:.73,date_diff_days:6,topic:"token budget"},{memory_a_id:"a9",memory_b_id:"b9",memory_a_preview:"FSRS-6 parameters require ~1k reviews to train",memory_b_preview:"FSRS-6 default parameters work fine out of the box",memory_a_type:"concept",memory_b_type:"concept",memory_a_created:"2026-01-22",memory_b_created:"2026-02-28",memory_a_tags:["fsrs","training"],memory_b_tags:["fsrs"],trust_a:.62,trust_b:.54,similarity:.57,date_diff_days:37,topic:"FSRS parameter tuning"},{memory_a_id:"a10",memory_b_id:"b10",memory_a_preview:"Tailwind 4 requires explicit CSS import only",memory_b_preview:"Tailwind 4 config still supports tailwind.config.js",memory_a_type:"fact",memory_b_type:"fact",memory_a_created:"2026-01-30",memory_b_created:"2026-02-14",memory_a_tags:["tailwind","config"],memory_b_tags:["tailwind","config"],trust_a:.47,trust_b:.33,similarity:.85,date_diff_days:15,topic:"Tailwind 4 config"},{memory_a_id:"a11",memory_b_id:"b11",memory_a_preview:"Dataset API silently ignores invalid source slugs",memory_b_preview:"Dataset API throws an error when source slug is invalid",memory_a_type:"fact",memory_b_type:"concept",memory_a_created:"2026-04-07",memory_b_created:"2026-02-20",memory_a_tags:["api","bug-fix"],memory_b_tags:["api"],trust_a:.89,trust_b:.28,similarity:.91,date_diff_days:46,topic:"API validation"},{memory_a_id:"a12",memory_b_id:"b12",memory_a_preview:"USearch HNSW is 20x faster than FAISS for embeddings",memory_b_preview:"FAISS IVF is the fastest vector index at scale",memory_a_type:"fact",memory_b_type:"concept",memory_a_created:"2026-02-01",memory_b_created:"2025-11-15",memory_a_tags:["vectors","perf"],memory_b_tags:["vectors","perf"],trust_a:.78,trust_b:.36,similarity:.69,date_diff_days:78,topic:"vector index perf"},{memory_a_id:"a13",memory_b_id:"b13",memory_a_preview:"Leaderboard scores weight by top-10 consistency",memory_b_preview:"Leaderboard uses single-best-episode scoring",memory_a_type:"fact",memory_b_type:"fact",memory_a_created:"2026-04-18",memory_b_created:"2026-04-10",memory_a_tags:["leaderboard","scoring"],memory_b_tags:["leaderboard","scoring"],trust_a:.64,trust_b:.52,similarity:.82,date_diff_days:8,topic:"leaderboard scoring"},{memory_a_id:"a14",memory_b_id:"b14",memory_a_preview:"Release notes were planned for 8am ET",memory_b_preview:"Release notes moved to 9am ET after schedule review",memory_a_type:"decision",memory_b_type:"decision",memory_a_created:"2026-03-01",memory_b_created:"2026-04-15",memory_a_tags:["cadence","content"],memory_b_tags:["cadence","content"],trust_a:.5,trust_b:.81,similarity:.58,date_diff_days:45,topic:"posting cadence"},{memory_a_id:"a15",memory_b_id:"b15",memory_a_preview:"Dream cycle consolidates ~50 memories per run",memory_b_preview:"Dream cycle replays closer to 120 memories in practice",memory_a_type:"fact",memory_b_type:"fact",memory_a_created:"2026-02-15",memory_b_created:"2026-04-08",memory_a_tags:["vestige","dream"],memory_b_tags:["vestige","dream"],trust_a:.44,trust_b:.79,similarity:.76,date_diff_days:52,topic:"dream cycle count"},{memory_a_id:"a16",memory_b_id:"b16",memory_a_preview:"Never commit API keys to git; use .env files",memory_b_preview:"Environment secrets should live in a 1Password vault",memory_a_type:"pattern",memory_b_type:"pattern",memory_a_created:"2025-10-11",memory_b_created:"2026-03-20",memory_a_tags:["security","secrets"],memory_b_tags:["security","secrets"],trust_a:.72,trust_b:.64,similarity:.48,date_diff_days:160,topic:"secret storage"}];let D=te("all"),O=te("");const R=M(()=>Array.from(new Set(u.map(t=>t.topic))).sort()),fe=[{value:"all",label:"All contradictions",icon:"contradictions"},{value:"recent",label:"Recent (last 7 days)",icon:"timeline"},{value:"high-trust",label:"High trust (>60%)",icon:"importance"},{value:"topic",label:"By topic",icon:"filter"}],T=M(()=>[{value:"",label:"All topics"},...e(R).map(t=>({value:t,label:t,badge:u.filter(o=>o.topic===t).length}))]);function P(t){E(D,t,!0),E(N,null)}const Y=M(()=>{switch(e(D)){case"recent":{const t=new Date("2026-04-20").getTime(),o=10080*60*1e3;return u.filter(c=>{const x=c.memory_a_created?new Date(c.memory_a_created).getTime():0,xe=c.memory_b_created?new Date(c.memory_b_created).getTime():0;return t-Math.max(x,xe)<=o})}case"high-trust":return u.filter(t=>Math.min(t.trust_a,t.trust_b)>.6);case"topic":return e(O)?u.filter(t=>t.topic===e(O)):u;case"all":default:return u}});let N=te(null);function we(t){E(N,t,!0)}const re=47,je=M(()=>Nt(u)),ae=M(()=>Gt(u)),C=M(()=>{const t=new Map(u.map((o,c)=>[o.memory_a_id+"|"+o.memory_b_id,c]));return e(Y).map(o=>({orig:t.get(o.memory_a_id+"|"+o.memory_b_id)??0,c:o}))});function de(t){E(N,e(N)===t?null:t,!0)}var H=ar(),se=s(H);Rt(se,{icon:"contradictions",title:"Contradiction Constellation",subtitle:"Where your memory disagrees with itself",accent:"warning",children:(t,o)=>{var c=Wt(),x=s(c);ce(x,{get value(){return e(Y).length}}),ee(),a(c),w(t,c)},$$slots:{default:!0}});var ie=i(se,2),oe=s(ie),_e=s(oe),Me=s(_e);ce(Me,{value:re}),a(_e);var be=i(_e,2),d=s(be);a(be),a(oe),le(oe,(t,o)=>{var c;return(c=me)==null?void 0:c(t,o)},()=>({delay:0,y:12}));var r=i(oe,2),g=s(r),l=s(g);ce(l,{get value(){return e(ae)},decimals:2}),a(g),ee(2),a(r),le(r,(t,o)=>{var c;return(c=me)==null?void 0:c(t,o)},()=>({delay:60,y:12}));var p=i(r,2),j=s(p),y=s(j);ce(y,{get value(){return e(Y).length}}),a(j),ee(2),a(p),le(p,(t,o)=>{var c;return(c=me)==null?void 0:c(t,o)},()=>({delay:120,y:12}));var f=i(p,2),_=s(f),G=i(s(_),2),L=s(G);{let t=M(()=>e(Y).filter(o=>o.similarity>.7).length);ce(L,{get value(){return e(t)}})}a(G),a(_),ee(2),a(f),le(f,(t,o)=>{var c;return(c=me)==null?void 0:c(t,o)},()=>({delay:180,y:12})),a(ie);var b=i(ie,2),h=s(b);Je(h,{get options(){return fe},get value(){return e(D)},label:"Lens",icon:"filter",onChange:P});var $=i(h,2);{var I=t=>{Je(t,{get options(){return e(T)},label:"Topic",icon:"contradictions",placeholder:"All topics",get value(){return e(O)},set value(o){E(O,o,!0)}})};B($,t=>{e(D)==="topic"&&t(I)})}var A=i($,2);{var z=t=>{var o=qt(),c=s(o);Ze(c,{name:"close",size:13}),ee(),a(o),W("click",o,()=>E(N,null)),w(t,o)};B(A,t=>{e(N)!==null&&t(z)})}a(b);var V=i(b,2),ve=s(V),ct=s(ve);{var dt=t=>{var o=Xt(),c=s(o),x=s(c);Ze(x,{name:"contradictions",size:44,strokeWidth:1.2}),a(c),ee(2),a(o),w(t,o)},_t=t=>{Ut(t,{get contradictions(){return e(Y)},get focusedPairIndex(){return e(N)},onSelectPair:we,width:800,height:600})};B(ct,t=>{e(Y).length===0?t(dt):t(_t,!1)})}a(ve);var Ie=i(ve,2),Se=s(Ie),ze=i(s(Se),2),vt=s(ze);ce(vt,{get value(){return e(C).length}}),a(ze),a(Se);var Ve=i(Se,2);{var pt=t=>{var o=Kt();w(t,o)};B(Ve,t=>{e(C).length===0&&t(pt)})}var yt=i(Ve,2);ue(yt,19,()=>e(C),t=>t.c.memory_a_id+"|"+t.c.memory_b_id,(t,o,c)=>{const x=M(()=>e(o).c),xe=M(()=>e(N)===e(c));var ne=rr(),Re=s(ne),He=s(Re),ge=i(He,2),ut=s(ge,!0);a(ge);var Ue=i(ge,2),ft=s(Ue);a(Ue),a(Re);var Te=i(Re,2),bt=s(Te,!0);a(Te);var Ae=i(Te,2),Ee=s(Ae),De=i(s(Ee),2),xt=s(De,!0);a(De);var We=i(De,2),gt=s(We);a(We),a(Ee);var qe=i(Ee,2),Oe=i(s(qe),2),kt=s(Oe,!0);a(Oe);var Xe=i(Oe,2),ht=s(Xe);a(Xe),a(qe),a(Ae);var wt=i(Ae,2);{var jt=X=>{var K=tr(),U=i(s(K),2),Ce=s(U,!0);a(U);var ke=i(U,2);{var Fe=Q=>{var J=Jt();ue(J,21,()=>e(x).memory_a_tags,Qe,(Ge,Pe)=>{var Z=Qt(),Le=s(Z,!0);a(Z),F(()=>k(Le,e(Pe))),w(Ge,Z)}),a(J),w(Q,J)};B(ke,Q=>{e(x).memory_a_tags&&e(x).memory_a_tags.length>0&&Q(Fe)})}var pe=i(ke,4),Ne=s(pe,!0);a(pe);var Mt=i(pe,2);{var It=Q=>{var J=er();ue(J,21,()=>e(x).memory_b_tags,Qe,(Ge,Pe)=>{var Z=Zt(),Le=s(Z,!0);a(Z),F(()=>k(Le,e(Pe))),w(Ge,Z)}),a(J),w(Q,J)};B(Mt,Q=>{e(x).memory_b_tags&&e(x).memory_b_tags.length>0&&Q(It)})}a(K),F(()=>{k(Ce,e(x).memory_a_preview),k(Ne,e(x).memory_b_preview)}),w(X,K)};B(wt,X=>{e(xe)&&X(jt)})}a(ne),le(ne,(X,K)=>{var U;return(U=me)==null?void 0:U(X,K)},()=>({delay:Math.min(e(c)*35,350),y:10})),F((X,K,U,Ce,ke,Fe,pe,Ne)=>{St(ne,1,`w-full text-left p-3 rounded-xl border transition lift - ${e(xe)?"bg-synapse/10 border-synapse/40 shadow-[0_0_12px_rgba(99,102,241,0.18)]":"border-subtle/20 hover:border-synapse/30 hover:bg-white/[0.02]"}`),q(He,`background: ${X??""}`),q(ge,`color: ${K??""}`),k(ut,U),k(ft,`${Ce??""}% sim · ${e(x).date_diff_days??""}d`),k(bt,e(x).topic),k(xt,ke),k(gt,`${Fe??""}%`),k(kt,pe),k(ht,`${Ne??""}%`)},[()=>Be(e(x).similarity),()=>Be(e(x).similarity),()=>mt(e(x).similarity),()=>(e(x).similarity*100).toFixed(0),()=>he(e(x).memory_a_preview),()=>(e(x).trust_a*100).toFixed(0),()=>he(e(x).memory_b_preview),()=>(e(x).trust_b*100).toFixed(0)]),W("click",ne,()=>de(e(c))),w(t,ne)}),a(Ie),le(Ie,(t,o)=>{var c;return(c=me)==null?void 0:c(t,o)},()=>({delay:120,y:16})),a(V),a(H),F(t=>k(d,`contradictions across ${t??""} memories`),[()=>e(je).toLocaleString()]),w(m,H),it()}ot(["click"]);export{ur as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/6.DZyLUVX2.js.br b/apps/dashboard/build/_app/immutable/nodes/6.DZyLUVX2.js.br deleted file mode 100644 index b0f809c..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/6.DZyLUVX2.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/6.DZyLUVX2.js.gz b/apps/dashboard/build/_app/immutable/nodes/6.DZyLUVX2.js.gz deleted file mode 100644 index 89cd895..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/6.DZyLUVX2.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/7.jHtvjgRi.js b/apps/dashboard/build/_app/immutable/nodes/7.jHtvjgRi.js new file mode 100644 index 0000000..65bc749 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/7.jHtvjgRi.js @@ -0,0 +1,5 @@ +import"../chunks/Bzak7iHL.js";import{o as Ce,a as Re}from"../chunks/GG5zm9kr.js";import{p as _e,f as we,g as e,a as ke,u as I,d as r,r as n,e as o,t as S,h as w,s as K,c as xe,n as he}from"../chunks/CpWkWWOo.js";import{d as Te,s as g,a as z}from"../chunks/BlVfL1ME.js";import{i as G}from"../chunks/B4yTwGkE.js";import{e as oe,i as Ae}from"../chunks/CGEBXrjl.js";import{c as Le,a as v,f as m}from"../chunks/CHOnp4oo.js";import{s as se,r as Fe}from"../chunks/A7po6GxK.js";import{b as Ne}from"../chunks/sZcqyNBA.js";import{s as pe}from"../chunks/aVbAZ-t7.js";import{s as re}from"../chunks/Cx-f-Pzo.js";import{N as Ze}from"../chunks/DzfRjky4.js";function De(s){return s>=.92?"near-identical":s>=.8?"strong":"weak"}function ge(s){const i=De(s);return i==="near-identical"?"var(--color-decay)":i==="strong"?"var(--color-warning)":"#fde047"}function Ee(s){const i=De(s);return i==="near-identical"?"Near-identical":i==="strong"?"Strong match":"Weak match"}function Pe(s){return s>.7?"#10b981":s>.4?"#f59e0b":"#ef4444"}function Be(s){if(!s||s.length===0)return null;let i=s[0],d=Number.isFinite(i.retention)?i.retention:-1/0;for(let u=1;ud&&(i=b,d=_)}return i}function Ie(s,i){return s.filter(d=>d.similarity>=i)}function be(s){return s.map(i=>i.id).slice().sort().join("|")}function Oe(s,i=80){if(!s)return"";const d=s.trim().replace(/\s+/g," ");return d.length<=i?d:d.slice(0,i)+"…"}function ye(s){if(!s||typeof s!="string")return"";const i=new Date(s);return Number.isNaN(i.getTime())?"":i.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function He(s,i=4){return Array.isArray(s)?s.slice(0,i):[]}var Ue=m('WINNER'),We=m(' '),je=m('
                    '),Ke=m('

                    '),ze=m('
                    ');function Ge(s,i){_e(i,!0);let d=K(!1);const u=I(()=>Be(i.memories)),b=I(()=>e(u)?i.memories.filter(x=>x.id!==e(u).id).map(x=>x.id):[]);function _(){i.onMerge&&e(u)&&i.onMerge(e(u).id,e(b))}var A=Le(),V=we(A);{var le=x=>{var X=ze(),O=r(X),Y=r(O),h=r(Y),C=r(h),ee=r(C);n(C);var H=o(C,2),de=r(H,!0);n(H);var U=o(H,2),q=r(U);n(U),n(h);var R=o(h,2),W=r(R);n(R),n(Y);var j=o(Y,2),ce=r(j);n(j),n(O);var L=o(O,2);oe(L,21,()=>i.memories,k=>k.id,(k,c)=>{var D=Ke(),N=r(D),Z=o(N,2),t=r(Z),a=r(t),l=r(a,!0);n(a);var p=o(a,2);{var E=y=>{var T=Ue();v(y,T)};G(p,y=>{e(c).id===e(u).id&&y(E)})}var M=o(p,2);oe(M,17,()=>He(e(c).tags,4),Ae,(y,T)=>{var B=We(),me=r(B,!0);n(B),S(()=>g(me,e(T))),v(y,B)}),n(t);var f=o(t,2),P=r(f,!0);n(f);var ae=o(f,2);{var Q=y=>{var T=je(),B=r(T,!0);n(T),S(me=>g(B,me),[()=>ye(e(c).createdAt)]),v(y,T)},ve=I(()=>ye(e(c).createdAt));G(ae,y=>{e(ve)&&y(Q)})}n(Z);var ne=o(Z,2),$=r(ne),Me=r($);n($);var fe=o($,2),Se=r(fe);n(fe),n(ne),n(D),S((y,T,B)=>{pe(D,1,`group flex items-start gap-3 rounded-xl border border-synapse/5 bg-white/[0.02] p-3 transition-all duration-200 hover:border-synapse/20 hover:bg-white/[0.04] ${e(c).id===e(u).id?"ring-1 ring-recall/30":""}`),re(N,`background: ${(Ze[e(c).nodeType]||"#8B95A5")??""}`),se(N,"title",e(c).nodeType),g(l,e(c).nodeType),pe(f,1,`text-sm text-text leading-relaxed ${e(d)?"whitespace-pre-wrap":""}`),g(P,y),re(Me,`width: ${e(c).retention*100}%; background: ${T??""}`),g(Se,`${B??""}%`)},[()=>e(d)?e(c).content:Oe(e(c).content),()=>Pe(e(c).retention),()=>(e(c).retention*100).toFixed(0)]),v(k,D)}),n(L);var te=o(L,2),J=r(te),F=o(J,2),ue=r(F,!0);n(F);var ie=o(F,2);n(te),n(X),S((k,c,D,N,Z,t,a,l)=>{re(C,`color: ${k??""}`),g(ee,`${c??""}%`),g(de,D),g(q,`· ${i.memories.length??""} memories`),se(R,"aria-valuenow",N),re(W,`width: ${Z??""}%; background: ${t??""}; box-shadow: 0 0 12px ${a??""}66`),pe(j,1,`flex-shrink-0 rounded-full border px-3 py-1 text-xs font-medium ${i.suggestedAction==="merge"?"border-recall/40 bg-recall/10 text-recall":"border-dream-glow/40 bg-dream/10 text-dream-glow"}`),g(ce,`Suggested: ${i.suggestedAction==="merge"?"Merge":"Review"}`),se(J,"title",`Merge all into highest-retention memory (${l??""}%)`),se(F,"aria-expanded",e(d)),g(ue,e(d)?"Collapse":"Review")},[()=>ge(i.similarity),()=>(i.similarity*100).toFixed(1),()=>Ee(i.similarity),()=>Math.round(i.similarity*100),()=>(i.similarity*100).toFixed(1),()=>ge(i.similarity),()=>ge(i.similarity),()=>(e(u).retention*100).toFixed(0)]),z("click",J,_),z("click",F,()=>w(d,!e(d))),z("click",ie,function(...k){var c;(c=i.onDismiss)==null||c.apply(this,k)}),v(x,X)};G(V,x=>{i.memories.length>0&&e(u)&&x(le)})}v(s,A),ke()}Te(["click"]);var Ve=m(' Detecting…',1),Xe=m(' Error',1),Ye=m(' ',1),qe=m(`
                    Couldn't detect duplicates
                    `),Je=m('
                    '),Qe=m('
                    '),$e=m('
                    ·
                    No duplicates found above threshold.
                    Memory is clean.
                    '),et=m('
                    '),tt=m('
                    '),it=m('
                    '),at=m(`

                    Memory Hygiene — Duplicate Detection

                    Cosine-similarity clustering over embeddings. Merges reinforce the winner's FSRS state; + losers inherit into the merged node. Dismissed clusters are hidden for this session only.

                    `);function ft(s,i){_e(i,!0);let d=K(.8),u=K(xe([])),b=K(xe(new Set)),_=K(!0),A=K(null),V;async function le(t){return await new Promise(l=>setTimeout(l,450)),{clusters:Ie([{similarity:.96,suggestedAction:"merge",memories:[{id:"m-001",content:"BUG FIX: Harmony parser dropped `final` channel tokens when tool call followed. Root cause: 5-layer fallback missed the final channel marker when channel switched mid-stream. Solution: added final-channel detector before tool-call pop. Files: src/parser/harmony.rs",nodeType:"fact",tags:["bug-fix","benchmark-suite","parser"],retention:.91,createdAt:"2026-04-12T14:22:00Z"},{id:"m-002",content:"Fixed Harmony parser final-channel bug — 5-layer fallback was missing the final channel marker when a tool call followed. Added detector before tool pop.",nodeType:"fact",tags:["bug-fix","benchmark-suite"],retention:.64,createdAt:"2026-04-13T09:15:00Z"},{id:"m-003",content:"Harmony parser: final channel dropped on tool-call. Patched the fallback stack.",nodeType:"note",tags:["parser"],retention:.38,createdAt:"2026-04-14T11:02:00Z"}]},{similarity:.88,suggestedAction:"merge",memories:[{id:"m-004",content:"DECISION: Use vLLM prefix caching at 0.35 gpu_memory_utilization for benchmark suite submissions. Alternatives considered: sglang (slower cold start), TensorRT-LLM (deployment friction).",nodeType:"decision",tags:["vllm","benchmark-suite","inference"],retention:.84,createdAt:"2026-04-05T18:44:00Z"},{id:"m-005",content:"Chose vLLM with prefix caching (0.35 mem util) over sglang and TensorRT-LLM for benchmark suite inference.",nodeType:"decision",tags:["vllm","benchmark-suite"],retention:.72,createdAt:"2026-04-06T10:30:00Z"}]},{similarity:.83,suggestedAction:"review",memories:[{id:"m-006",content:"Release process prefers one change per benchmark submission — stacking changes destroyed signal in a prior run.",nodeType:"pattern",tags:["methodology","benchmark-suite"],retention:.88,createdAt:"2026-04-04T22:10:00Z"},{id:"m-007",content:"One-variable-at-a-time rule: never stack multiple changes per submission. Paper 2603.27844 proves +/-2 points is noise.",nodeType:"pattern",tags:["kaggle","methodology"],retention:.67,createdAt:"2026-04-08T16:20:00Z"},{id:"m-008",content:"Lesson: stacking many changes in one benchmark run hid the causal signal. Always isolate variables.",nodeType:"note",tags:["methodology"],retention:.42,createdAt:"2026-04-15T08:55:00Z"}]},{similarity:.78,suggestedAction:"review",memories:[{id:"m-009",content:"Dimensional Illusion performance: 7-minute flow poi set, LED config Parthenos overcook preset, tempo 128 BPM.",nodeType:"event",tags:["dimensional-illusion","poi","performance"],retention:.76,createdAt:"2026-03-28T19:45:00Z"},{id:"m-010",content:"Dimensional Illusion set: 7 min, Parthenos LED overcook, 128 BPM.",nodeType:"event",tags:["dimensional-illusion","poi"],retention:.51,createdAt:"2026-04-02T12:12:00Z"}]},{similarity:.76,suggestedAction:"review",memories:[{id:"m-011",content:"Vestige v2.0.7 shipped active forgetting via Anderson 2025 top-down inhibition + Davis Rac1 cascade. Suppress compounds, reversible 24h.",nodeType:"fact",tags:["vestige","release","active-forgetting"],retention:.93,createdAt:"2026-04-17T03:22:00Z"},{id:"m-012",content:"Active Forgetting feature: compounds on each suppress, 24h reversible labile window, violet implosion animation in graph view.",nodeType:"concept",tags:["vestige","active-forgetting"],retention:.81,createdAt:"2026-04-18T09:07:00Z"}]}],t)}}async function x(){w(_,!0),w(A,null);try{const t=await le(e(d));w(u,t.clusters,!0);const a=new Set(e(u).map(p=>be(p.memories))),l=new Set;for(const p of e(b))a.has(p)&&l.add(p);w(b,l,!0)}catch(t){w(A,t instanceof Error?t.message:"Failed to detect duplicates",!0),w(u,[],!0)}finally{w(_,!1)}}function X(){clearTimeout(V),V=setTimeout(x,250)}function O(t){const a=new Set(e(b));a.add(t),w(b,a,!0)}function Y(t,a,l){console.log("Merge cluster",t,{winnerId:a,loserIds:l}),O(t)}const h=I(()=>e(u).map(t=>({c:t,key:be(t.memories)})).filter(({key:t})=>!e(b).has(t))),C=I(()=>e(h).reduce((t,{c:a})=>t+a.memories.length,0)),ee=50,H=I(()=>e(h).length>ee),de=I(()=>e(H)?e(h).slice(0,ee):e(h));Ce(()=>x()),Re(()=>clearTimeout(V));var U=at(),q=o(r(U),2),R=r(q),W=o(r(R),2);Fe(W);var j=o(W,2),ce=r(j);n(j),n(R);var L=o(R,2),te=r(L);{var J=t=>{var a=Ve();he(2),v(t,a)},F=t=>{var a=Xe();he(2),v(t,a)},ue=t=>{var a=Ye(),l=o(we(a),2),p=r(l);n(l),S(()=>g(p,`${e(h).length??""} + ${e(h).length===1?"cluster":"clusters"}, + ${e(C)??""} potential duplicate${e(C)===1?"":"s"}`)),v(t,a)};G(te,t=>{e(_)?t(J):e(A)?t(F,1):t(ue,!1)})}n(L);var ie=o(L,2);n(q);var k=o(q,2);{var c=t=>{var a=qe(),l=o(r(a),2),p=r(l,!0);n(l);var E=o(l,2);n(a),S(()=>g(p,e(A))),z("click",E,x),v(t,a)},D=t=>{var a=Qe();oe(a,20,()=>Array(3),Ae,(l,p)=>{var E=Je();v(l,E)}),n(a),v(t,a)},N=t=>{var a=$e();v(t,a)},Z=t=>{var a=it(),l=r(a);{var p=M=>{var f=et(),P=r(f);n(f),S(()=>g(P,`Showing first 50 of ${e(h).length??""} clusters. Raise the + threshold to narrow results.`)),v(M,f)};G(l,M=>{e(H)&&M(p)})}var E=o(l,2);oe(E,17,()=>e(de),({c:M,key:f})=>f,(M,f)=>{let P=()=>e(f).c,ae=()=>e(f).key;var Q=tt(),ve=r(Q);Ge(ve,{get similarity(){return P().similarity},get memories(){return P().memories},get suggestedAction(){return P().suggestedAction},onDismiss:()=>O(ae()),onMerge:(ne,$)=>Y(ae(),ne,$)}),n(Q),v(M,Q)}),n(a),v(t,a)};G(k,t=>{e(A)?t(c):e(_)?t(D,1):e(h).length===0?t(N,2):t(Z,!1)})}n(U),S(t=>{g(ce,`${t??""}%`),ie.disabled=e(_)},[()=>(e(d)*100).toFixed(0)]),z("input",W,X),Ne(W,()=>e(d),t=>w(d,t)),z("click",ie,x),v(s,U),ke()}Te(["input","click"]);export{ft as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/7.jHtvjgRi.js.br b/apps/dashboard/build/_app/immutable/nodes/7.jHtvjgRi.js.br new file mode 100644 index 0000000..3b795a7 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/7.jHtvjgRi.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/7.jHtvjgRi.js.gz b/apps/dashboard/build/_app/immutable/nodes/7.jHtvjgRi.js.gz new file mode 100644 index 0000000..8943186 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/7.jHtvjgRi.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/7.yWYTsQ1Q.js b/apps/dashboard/build/_app/immutable/nodes/7.yWYTsQ1Q.js deleted file mode 100644 index d9d4f58..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/7.yWYTsQ1Q.js +++ /dev/null @@ -1,14 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{p as Se,e as r,r as a,h as l,g as e,c as Fe,f as ge,a as m,u as _,t as N,b as Me,n as U,j as x,au as Le,x as ze,ar as Ge,s as he,i as le,m as Ie}from"../chunks/wpu9U-D0.js";import{s as b,d as Ae,a as fe}from"../chunks/D8mhvFt8.js";import{i as F}from"../chunks/DKve45Wd.js";import{e as xe,a as W,s as we,r as Ye,b as Ve}from"../chunks/60_R_Vbt.js";import{h as Be}from"../chunks/DzesjbbJ.js";import{a as ye,r as Ee}from"../chunks/P1-U_Xsj.js";import{a as We}from"../chunks/CZfHMhLI.js";import{s as re}from"../chunks/EqHb-9AZ.js";import{p as Xe}from"../chunks/ByYB047u.js";import{b as Ue}from"../chunks/Bxs5UR9-.js";import{P as Je}from"../chunks/BHDZZvku.js";import{I as ke}from"../chunks/D7A-gG4Z.js";import{m as Te}from"../chunks/DPdYG9yN.js";const Pe=5,je=["Replay","Cross-reference","Strengthen","Prune","Transfer"];function He(o){if(!Number.isFinite(o))return 1;const v=Math.floor(o);return v<1?1:v>Pe?Pe:v}const Ke=.3,Qe=.7;function Ze(o){const v=qe(o);return v>Qe?"high":v1?1:o}function $e(o){return o==null||!Number.isFinite(o)||o<0?"0ms":o<1e3?`${Math.round(o)}ms`:`${(o/1e3).toFixed(2)}s`}function et(o){const v=qe(o);return`${Math.round(v*100)}%`}function tt(o,v=""){return`${v}/memories/${o}`}function st(o,v=2){return!o||o.length===0?[]:o.slice(0,Math.max(0,v))}function at(o,v=2){return o?Math.max(0,o.length-v):0}function rt(o){return o?o.length>8?o.slice(0,8):o:""}var nt=x('
                    Episodic hippocampus
                    Semantic cortex
                    ',1),vt=Le(''),it=x('
                    '),lt=x(''),ot=x('Replaying memories'),ct=x('New connections found: '),dt=x('Strengthened: '),ut=x('Compressed: '),ft=x('Connections persisted: Insights: ',1),mt=x('
                    ');function pt(o,v){Se(v,!0);const P=[{num:1,name:"Replay",color:"#818cf8",desc:"Hippocampal replay: tagged memories surface for consolidation."},{num:2,name:"Cross-reference",color:"#a855f7",desc:"Semantic proximity check — new edges discovered across memories."},{num:3,name:"Strengthen",color:"#c084fc",desc:"Co-activated memories strengthen; FSRS stability grows."},{num:4,name:"Prune",color:"#ef4444",desc:"Low-retention redundant memories compressed or released."},{num:5,name:"Transfer",color:"#10b981",desc:"Episodic → semantic consolidation (hippocampus → cortex)."}];let c=_(()=>He(v.stage)),p=_(()=>P[e(c)-1]),q=_(()=>{if(!v.dreamResult)return 8;const t=v.dreamResult.memoriesReplayed??8;return Math.max(6,Math.min(12,t))}),Z=_(()=>{var s;if(!v.dreamResult)return 5;const t=((s=v.dreamResult.stats)==null?void 0:s.newConnectionsFound)??5;return Math.max(3,Math.min(e(q),t))}),$=_(()=>{var s;if(!v.dreamResult)return Math.ceil(e(q)*.5);const t=((s=v.dreamResult.stats)==null?void 0:s.memoriesStrengthened)??Math.ceil(e(q)*.5);return Math.max(1,Math.min(e(q),t))}),ee=_(()=>{var s;if(!v.dreamResult)return Math.ceil(e(q)*.25);const t=((s=v.dreamResult.stats)==null?void 0:s.memoriesCompressed)??Math.ceil(e(q)*.25);return Math.max(1,Math.min(Math.floor(e(q)/2),t))});function I(t,s=0){const i=Math.sin((t+1)*9301+49297+s*233)*233280;return i-Math.floor(i)}let te=_(()=>{const t=[],s=Math.ceil(Math.sqrt(e(q))),i=Math.ceil(e(q)/s);for(let n=0;n{const t=[],s=e(te).length;for(let i=0;i{var s=nt();U(4),m(t,s)};F(h,t=>{e(c)===5&&t(M)})}var A=l(h,2);xe(A,23,()=>e(G),(t,s)=>t.a+"-"+t.b+"-"+s,(t,s,i)=>{const n=_(()=>e(te)[e(s).a]),u=_(()=>e(te)[e(s).b]);var d=Fe(),D=ge(d);{var K=j=>{const Q=_(()=>L(e(n))),ue=_(()=>J(e(n))),pe=_(()=>L(e(u))),be=_(()=>J(e(u)));var z=vt();N(()=>{W(z,"x1",e(Q)),W(z,"y1",e(ue)),W(z,"x2",e(pe)),W(z,"y2",e(be)),W(z,"stroke",e(p).color),W(z,"stroke-width",e(c)===2?.25:e(c)===3?.35:.2),W(z,"stroke-opacity",e(c)<2?0:e(c)===4?.25:e(c)===5?.15:.6),W(z,"stroke-dasharray",e(c)===2?"1.2 0.8":"none"),re(z,`--edge-delay: ${e(i)*80}ms`)}),m(j,z)};F(D,j=>{e(n)&&e(u)&&j(K)})}m(t,d)}),a(A);var w=l(A,2);xe(w,17,()=>e(te),t=>t.id,(t,s)=>{var i=it();let n;N((u,d,D,K,j)=>{n=we(i,1,"memory-card svelte-1cq1ntk",null,n,{"is-pulsing":e(c)===3&&e(s).strengthened,"is-pruning":e(c)===4&&e(s).pruned,"is-transferring":e(c)===5,"semantic-side":e(c)===5&&e(s).transferIsSemantic}),re(i,` - left: ${u??""}%; - top: ${d??""}%; - opacity: ${D??""}; - --card-scale: ${K??""}; - --card-delay: ${e(s).id*40}ms; - --card-hue: ${j??""}deg; - `)},[()=>L(e(s)),()=>J(e(s)),()=>ne(e(s)),()=>se(e(s)),()=>I(e(s).id,3)*60-30]),m(t,i)});var O=l(w,2);{var ae=t=>{var s=lt();m(t,s)};F(O,t=>{e(c)===1&&t(ae)})}a(C);var oe=l(C,2),ce=r(oe);{var de=t=>{var s=ot(),i=l(r(s)),n=r(i,!0);a(i),U(),a(s),N(()=>{var u;return b(n,((u=v.dreamResult)==null?void 0:u.memoriesReplayed)??e(q))}),m(t,s)},Y=t=>{var s=ct(),i=l(r(s)),n=r(i,!0);a(i),a(s),N(()=>{var u,d;return b(n,((d=(u=v.dreamResult)==null?void 0:u.stats)==null?void 0:d.newConnectionsFound)??e(Z))}),m(t,s)},V=t=>{var s=dt(),i=l(r(s)),n=r(i,!0);a(i),a(s),N(()=>{var u,d;return b(n,((d=(u=v.dreamResult)==null?void 0:u.stats)==null?void 0:d.memoriesStrengthened)??e($))}),m(t,s)},B=t=>{var s=ut(),i=l(r(s)),n=r(i,!0);a(i),a(s),N(()=>{var u,d;return b(n,((d=(u=v.dreamResult)==null?void 0:u.stats)==null?void 0:d.memoriesCompressed)??e(ee))}),m(t,s)},me=t=>{var s=ft(),i=ge(s),n=l(r(i)),u=r(n,!0);a(n),a(i);var d=l(i,2),D=l(r(d)),K=r(D,!0);a(D),a(d),N(()=>{var j,Q,ue;b(u,((j=v.dreamResult)==null?void 0:j.connectionsPersisted)??0),b(K,((ue=(Q=v.dreamResult)==null?void 0:Q.stats)==null?void 0:ue.insightsGenerated)??0)}),m(t,s)};F(ce,t=>{e(c)===1?t(de):e(c)===2?t(Y,1):e(c)===3?t(V,2):e(c)===4?t(B,3):e(c)===5&&t(me,4)})}a(oe),a(ve),N(()=>{re(g,` - background: color-mix(in srgb, ${e(p).color??""} 20%, transparent); - color: ${e(p).color??""}; - border: 1.5px solid ${e(p).color??""}; - box-shadow: 0 0 16px color-mix(in srgb, ${e(p).color??""} 40%, transparent); - `),b(y,e(p).num),b(H,e(p).name),b(E,e(p).desc),b(X,`Stage ${e(p).num??""} / 5`),re(C,`--stage-color: ${e(p).color??""}`),W(C,"aria-label",`Dream stage ${e(p).num??""} — ${e(p).name??""}`)}),m(o,ve),Me()}var gt=x(' novel'),xt=x(' '),bt=x(' '),_t=x('
                    Sources
                    '),ht=x('

                    Novelty
                    Confidence
                    ');function yt(o,v){Se(v,!0);let P=Xe(v,"index",3,0),c=_(()=>qe(v.insight.noveltyScore)),p=_(()=>qe(v.insight.confidence)),q=_(()=>Ze(v.insight.noveltyScore)),Z=_(()=>e(q)==="high"),$=_(()=>e(q)==="low"),ee=_(()=>st(v.insight.sourceMemories,2)),I=_(()=>at(v.insight.sourceMemories,2));const te={connection:"#818cf8",pattern:"#ec4899",contradiction:"#ef4444",synthesis:"#c084fc",emergence:"#f59e0b",cluster:"#06b6d4"};let G=_(()=>{var w;return te[((w=v.insight.type)==null?void 0:w.toLowerCase())??""]??"#a855f7"});var L=ht();let J;var ne=r(L),se=r(ne),ve=r(se,!0);a(se);var ie=l(se,2);{var f=w=>{var O=gt();m(w,O)};F(ie,w=>{e(Z)&&w(f)})}a(ne);var g=l(ne,2),y=r(g,!0);a(g);var R=l(g,2),k=r(R),H=l(r(k),2),S=r(H,!0);a(H),a(k);var E=l(k,2),T=r(E);a(E),a(R);var X=l(R,2),C=l(r(X),2),h=r(C,!0);a(C),a(X);var M=l(X,2);{var A=w=>{var O=_t(),ae=r(O),oe=l(r(ae));{var ce=Y=>{var V=xt(),B=r(V);a(V),N(()=>b(B,`(+${e(I)??""})`)),m(Y,V)};F(oe,Y=>{e(I)>0&&Y(ce)})}a(ae);var de=l(ae,2);xe(de,20,()=>e(ee),Y=>Y,(Y,V)=>{var B=bt(),me=r(B,!0);a(B),N((t,s)=>{W(B,"href",t),W(B,"title",`Open memory ${V??""}`),b(me,s)},[()=>tt(V,Ue),()=>rt(V)]),m(Y,B)}),a(de),a(O),m(w,O)};F(M,w=>{e(ee).length>0&&w(A)})}a(L),N((w,O)=>{J=we(L,1,"insight-card glass-panel rounded-xl p-4 space-y-3 svelte-1y17hsl",null,J,{"high-novelty":e(Z),"low-novelty":e($)}),re(L,`--insight-color: ${e(G)??""}; --enter-delay: ${P()*60}ms`),re(se,`background: ${e(G)??""}22; color: ${e(G)??""}; border: 1px solid ${e(G)??""}55`),b(ve,v.insight.type??"insight"),b(y,v.insight.insight),b(S,w),re(T,`width: ${e(c)*100}%; background: linear-gradient(90deg, ${e(G)??""}, var(--color-dream-glow))`),re(C,`color: ${e(p)>.7?"#10b981":e(p)>.4?"#f59e0b":"#ef4444"}`),b(h,O)},[()=>e(c).toFixed(2),()=>et(e(p))]),m(o,L),Me()}var kt=x(' Consolidating'),wt=x(' Cycle complete'),qt=x(' Dreaming...',1),St=x(' Dream Now',1),Mt=x('
                    '),Rt=x('
                    '),Ct=x(`

                    Nothing's been dreamt yet.

                    Run a consolidation cycle and watch your episodic memories replay, - cross-reference, and crystallize into lasting semantic knowledge.

                    `),Dt=x(''),Nt=x('
                    '),It=x('
                    Replayed
                    Connections Found
                    Connections Persisted
                    Insights
                    Duration
                    '),Et=x('
                    ',1),Tt=x('
                    ');function Ut(o,v){Se(v,!0);let P=he(null),c=he(1),p=he(!1),q=he(null),Z=_(()=>e(P)!==null),$=_(()=>{const f=e(P);return f?[...f.insights].sort((g,y)=>(y.noveltyScore??0)-(g.noveltyScore??0)):[]});async function ee(){if(!e(p)){le(p,!0),le(q,null);try{const f=await We.dream();le(P,f,!0),le(c,1)}catch(f){le(q,f instanceof Error?f.message:"Dream failed",!0)}finally{le(p,!1)}}}function I(f){le(c,He(f),!0)}function te(f){const g=Number(f.currentTarget.value);I(g)}var G=Tt();Be("1fv2vo0",f=>{ze(()=>{Ge.title="Dream Cinema · Vestige"})});var L=r(G);Je(L,{icon:"dreams",title:"Dream Cinema",subtitle:"Scrub through Vestige's 5-stage consolidation cycle. Replay, cross-reference, strengthen, prune, transfer. Watch episodic become semantic.",accent:"dream",children:(f,g)=>{var y=Mt(),R=r(y);{var k=h=>{var M=kt();m(h,M)},H=h=>{var M=wt();m(h,M)};F(R,h=>{e(p)?h(k):e(Z)&&h(H,1)})}var S=l(R,2);let E;var T=r(S);{var X=h=>{var M=qt();U(2),m(h,M)},C=h=>{var M=St(),A=ge(M),w=r(A);ke(w,{name:"sparkle",size:16}),a(A),U(2),m(h,M)};F(T,h=>{e(p)?h(X):h(C,!1)})}a(S),ye(S,h=>{var M;return(M=Te)==null?void 0:M(h)}),a(y),N(()=>{S.disabled=e(p),E=we(S,1,"dream-button svelte-1fv2vo0",null,E,{"is-dreaming":e(p)})}),fe("click",S,ee),m(f,y)},$$slots:{default:!0}});var J=l(L,2);{var ne=f=>{var g=Rt(),y=r(g);ke(y,{name:"contradictions",size:16});var R=l(y,2),k=r(R,!0);a(R),a(g),ye(g,H=>{var S;return(S=Ee)==null?void 0:S(H)}),N(()=>b(k,e(q))),m(f,g)};F(J,f=>{e(q)&&f(ne)})}var se=l(J,2);{var ve=f=>{var g=Ct(),y=r(g),R=r(y);ke(R,{name:"dreams",size:52,draw:!0}),a(y);var k=l(y,6),H=r(k),S=r(H);ke(S,{name:"sparkle",size:16}),a(H),U(2),a(k),ye(k,E=>{var T;return(T=Te)==null?void 0:T(E)}),a(g),ye(g,E=>{var T;return(T=Ee)==null?void 0:T(E)}),fe("click",k,ee),m(f,g)},ie=f=>{var g=Et(),y=ge(g),R=r(y),k=r(R),H=r(k);a(k);var S=l(k,2),E=r(S),T=l(E,2);a(S),a(R);var X=l(R,2),C=r(X);Ye(C);var h=l(C,2);xe(h,22,()=>je,t=>t,(t,s,i)=>{var n=Dt();let u;var d=l(r(n),2),D=r(d);a(d),a(n),N(()=>{u=we(n,1,"tick svelte-1fv2vo0",null,u,{active:e(c)===e(i)+1,passed:e(c)>e(i)+1}),n.disabled=e(p),b(D,`${e(i)+1}. ${s??""}`)}),fe("click",n,()=>I(e(i)+1)),m(t,n)}),a(h),a(X),a(y);var M=l(y,2),A=r(M);pt(A,{get stage(){return e(c)},get dreamResult(){return e(P)}});var w=l(A,2),O=r(w),ae=l(r(O),2),oe=r(ae);a(ae),a(O);var ce=l(O,2),de=r(ce);{var Y=t=>{var s=Nt(),i=r(s);{var n=d=>{var D=Ie("Dreaming...");m(d,D)},u=d=>{var D=Ie("No insights generated this cycle.");m(d,D)};F(i,d=>{e(p)?d(n):d(u,!1)})}a(s),m(t,s)},V=t=>{var s=Fe(),i=ge(s);xe(i,19,()=>e($),(n,u)=>{var d;return u+"-"+(((d=n.insight)==null?void 0:d.slice(0,32))??"")},(n,u,d)=>{yt(n,{get insight(){return e(u)},get index(){return e(d)}})}),m(t,s)};F(de,t=>{e($).length===0?t(Y):t(V,!1)})}a(ce),a(w),a(M);var B=l(M,2);{var me=t=>{var s=It(),i=r(s),n=r(i),u=r(n,!0);a(n),U(2),a(i);var d=l(i,2),D=r(d),K=r(D,!0);a(D),U(2),a(d);var j=l(d,2),Q=r(j),ue=r(Q,!0);a(Q),U(2),a(j);var pe=l(j,2),be=r(pe),z=r(be,!0);a(be),U(2),a(pe);var Re=l(pe,2),Ce=r(Re),Oe=r(Ce,!0);a(Ce),U(2),a(Re),a(s),N(_e=>{var De,Ne;b(u,e(P).memoriesReplayed??0),b(K,((De=e(P).stats)==null?void 0:De.newConnectionsFound)??0),b(ue,e(P).connectionsPersisted??0),b(z,((Ne=e(P).stats)==null?void 0:Ne.insightsGenerated)??0),b(Oe,_e)},[()=>{var _e;return $e((_e=e(P).stats)==null?void 0:_e.durationMs)}]),m(t,s)};F(B,t=>{e(P)&&t(me)})}N(()=>{b(H,`Stage ${e(c)??""} · ${je[e(c)-1]??""}`),E.disabled=e(c)<=1||e(p),T.disabled=e(c)>=5||e(p),Ve(C,e(c)),C.disabled=e(p),b(oe,`${e($).length??""} total · by novelty`)}),fe("click",E,()=>I(e(c)-1)),fe("click",T,()=>I(e(c)+1)),fe("input",C,te),m(f,g)};F(se,f=>{!e(Z)&&!e(p)?f(ve):f(ie,!1)})}a(G),m(o,G),Me()}Ae(["click","input"]);export{Ut as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/7.yWYTsQ1Q.js.br b/apps/dashboard/build/_app/immutable/nodes/7.yWYTsQ1Q.js.br deleted file mode 100644 index e98fae1..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/7.yWYTsQ1Q.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/7.yWYTsQ1Q.js.gz b/apps/dashboard/build/_app/immutable/nodes/7.yWYTsQ1Q.js.gz deleted file mode 100644 index 328c4e4..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/7.yWYTsQ1Q.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/8.CgPowUzz.js b/apps/dashboard/build/_app/immutable/nodes/8.CgPowUzz.js new file mode 100644 index 0000000..6e3406e --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/8.CgPowUzz.js @@ -0,0 +1,6 @@ +import"../chunks/Bzak7iHL.js";import{p as ze,s as I,c as Ae,g as e,a as Pe,d as r,e as a,h as b,r as t,i as Qe,t as y,f as ge,u as se,j as qe}from"../chunks/CpWkWWOo.js";import{d as Be,a as q,s as o}from"../chunks/BlVfL1ME.js";import{a as c,f as m,c as De}from"../chunks/CHOnp4oo.js";import{i as k}from"../chunks/B4yTwGkE.js";import{e as ie,i as ne}from"../chunks/CGEBXrjl.js";import{r as ye}from"../chunks/A7po6GxK.js";import{s as oe}from"../chunks/aVbAZ-t7.js";import{s as Ke}from"../chunks/Cx-f-Pzo.js";import{b as de}from"../chunks/sZcqyNBA.js";import{a as X}from"../chunks/DNjM5a-l.js";var Re=m(''),Ue=m('
                    Source

                    '),Ve=m('
                    Target

                    '),Ge=m(`
                    Target Memory
                    `,1),He=m('

                    '),Je=m(' '),Le=m(" "),We=m(" "),Xe=m(" "),Ye=m(' '),Ze=m('

                    '),et=m('

                    '),tt=m('

                    No connections found for this query.

                    '),rt=m('
                    '),at=m('
                    '),st=m('
                    '),it=m(`

                    Explore Connections

                    Source Memory

                    Importance Scorer

                    4-channel neuroscience scoring: novelty, arousal, reward, attention

                    `);function ft(he,we){ze(we,!0);let V=I(""),G=I(""),F=I(null),C=I(null),B=I(Ae([])),$=I("associations"),O=I(!1),H=I(""),D=I(null);const le={associations:{icon:"◎",desc:"Spreading activation — find related memories via graph traversal"},chains:{icon:"⟿",desc:"Build reasoning path from source to target memory"},bridges:{icon:"⬡",desc:"Find connecting memories between two concepts"}};async function ve(){if(e(V).trim()){b(O,!0);try{const s=await X.search(e(V),1);s.results.length>0&&(b(F,s.results[0],!0),await Y())}catch{}finally{b(O,!1)}}}async function pe(){if(e(G).trim()){b(O,!0);try{const s=await X.search(e(G),1);s.results.length>0&&(b(C,s.results[0],!0),e(F)&&await Y())}catch{}finally{b(O,!1)}}}async function Y(){if(e(F)){b(O,!0);try{const s=(e($)==="chains"||e($)==="bridges")&&e(C)?e(C).id:void 0,i=await X.explore(e(F).id,e($),s);b(B,i.results||i.nodes||i.chain||i.bridges||[],!0)}catch{b(B,[],!0)}finally{b(O,!1)}}}async function ke(){e(H).trim()&&b(D,await X.importance(e(H)),!0)}function Se(s){b($,s,!0),e(F)&&Y()}var Z=it(),ee=a(r(Z),2);ie(ee,20,()=>["associations","chains","bridges"],ne,(s,i)=>{var d=Re(),_=r(d),h=r(_,!0);t(_);var f=a(_,2),p=r(f,!0);t(f);var n=a(f,2),g=r(n,!0);t(n),t(d),y(w=>{oe(d,1,`flex flex-col items-center gap-1 p-3 rounded-xl text-sm transition + ${e($)===i?"glass !border-synapse/30 text-synapse-glow":"glass-subtle text-dim hover:bg-white/[0.03]"}`),o(h,le[i].icon),o(p,w),o(g,le[i].desc)},[()=>i.charAt(0).toUpperCase()+i.slice(1)]),q("click",d,()=>Se(i)),c(s,d)}),t(ee);var te=a(ee,2),ce=a(r(te),2),J=r(ce);ye(J);var Fe=a(J,2);t(ce),t(te);var xe=a(te,2);{var Te=s=>{var i=Ue(),d=a(r(i),2),_=r(d,!0);t(d);var h=a(d,2),f=r(h),p=r(f,!0);t(f);var n=a(f,2),g=r(n);t(n),t(h),t(i),y((w,z)=>{o(_,w),o(p,e(F).nodeType),o(g,`${z??""}% retention`)},[()=>e(F).content.slice(0,200),()=>(e(F).retentionStrength*100).toFixed(0)]),c(s,i)};k(xe,s=>{e(F)&&s(Te)})}var me=a(xe,2);{var $e=s=>{var i=Ge(),d=ge(i),_=r(d),h=a(r(_)),f=r(h);t(h),t(_);var p=a(_,2),n=r(p);ye(n);var g=a(n,2);t(p),t(d);var w=a(d,2);{var z=u=>{var E=Ve(),x=a(r(E),2),K=r(x,!0);t(x);var M=a(x,2),S=r(M),A=r(S,!0);t(S);var T=a(S,2),P=r(T);t(T),t(M),t(E),y((Q,j)=>{o(K,Q),o(A,e(C).nodeType),o(P,`${j??""}% retention`)},[()=>e(C).content.slice(0,200),()=>(e(C).retentionStrength*100).toFixed(0)]),c(u,E)};k(w,u=>{e(C)&&u(z)})}y(()=>o(f,`(for ${e($)??""})`)),q("keydown",n,u=>u.key==="Enter"&&pe()),de(n,()=>e(G),u=>b(G,u)),q("click",g,pe),c(s,i)};k(me,s=>{(e($)==="chains"||e($)==="bridges")&&s($e)})}var ue=a(me,2);{var Ee=s=>{var i=De(),d=ge(i);{var _=p=>{var n=He(),g=a(r(n),2),w=r(g);t(g),t(n),y(()=>o(w,`Exploring ${e($)??""}...`)),c(p,n)},h=p=>{var n=et(),g=r(n),w=r(g),z=r(w);t(w),t(g);var u=a(g,2);ie(u,21,()=>e(B),ne,(E,x,K)=>{var M=Ze(),S=r(M);S.textContent=K+1;var A=a(S,2),T=r(A),P=r(T,!0);t(T);var Q=a(T,2),j=r(Q);{var L=l=>{var v=Je(),N=r(v,!0);t(v),y(()=>o(N,e(x).nodeType)),c(l,v)};k(j,l=>{e(x).nodeType&&l(L)})}var R=a(j,2);{var ae=l=>{var v=Le(),N=r(v);t(v),y(U=>o(N,`Score: ${U??""}`),[()=>Number(e(x).score).toFixed(3)]),c(l,v)};k(R,l=>{e(x).score&&l(ae)})}var W=a(R,2);{var Ie=l=>{var v=We(),N=r(v);t(v),y(U=>o(N,`Similarity: ${U??""}`),[()=>Number(e(x).similarity).toFixed(3)]),c(l,v)};k(W,l=>{e(x).similarity&&l(Ie)})}var be=a(W,2);{var je=l=>{var v=Xe(),N=r(v);t(v),y(U=>o(N,`${U??""}% retention`),[()=>(Number(e(x).retention)*100).toFixed(0)]),c(l,v)};k(be,l=>{e(x).retention&&l(je)})}var Ce=a(be,2);{var Oe=l=>{var v=Ye(),N=r(v,!0);t(v),y(()=>o(N,e(x).connectionType)),c(l,v)};k(Ce,l=>{e(x).connectionType&&l(Oe)})}t(Q),t(A),t(M),y(()=>o(P,e(x).content)),c(E,M)}),t(u),t(n),y(()=>o(z,`${e(B).length??""} Connections Found`)),c(p,n)},f=p=>{var n=tt();c(p,n)};k(d,p=>{e(O)?p(_):e(B).length>0?p(h,1):p(f,!1)})}c(s,i)};k(ue,s=>{e(F)&&s(Ee)})}var _e=a(ue,2),re=a(r(_e),4);Qe(re);var fe=a(re,2),Me=a(fe,2);{var Ne=s=>{const i=se(()=>e(D).channels),d=se(()=>Number(e(D).composite||e(D).compositeScore||0));var _=st(),h=r(_),f=r(h),p=r(f,!0);t(f);var n=a(f,2),g=r(n,!0);t(n),t(h);var w=a(h,2);{var z=u=>{var E=at();ie(E,21,()=>Object.entries(e(i)),ne,(x,K)=>{var M=se(()=>qe(e(K),2));let S=()=>e(M)[0],A=()=>e(M)[1];var T=rt(),P=r(T),Q=r(P,!0);t(P);var j=a(P,2),L=r(j);t(j);var R=a(j,2),ae=r(R,!0);t(R),t(T),y(W=>{o(Q,S()),oe(L,1,`h-full rounded-full transition-all duration-500 + ${S()==="novelty"?"bg-synapse":S()==="arousal"?"bg-dream":S()==="reward"?"bg-recall":"bg-amber-400"}`),Ke(L,`width: ${A()*100}%`),o(ae,W)},[()=>A().toFixed(2)]),c(x,T)}),t(E),c(u,E)};k(w,u=>{e(i)&&u(z)})}t(_),y(u=>{o(p,u),oe(n,1,`px-2 py-1 rounded-lg text-xs ${e(d)>.6?"bg-recall/20 text-recall border border-recall/30":"bg-white/[0.04] text-dim border border-subtle/20"}`),o(g,e(d)>.6?"SAVE":"SKIP")},[()=>e(d).toFixed(2)]),c(s,_)};k(Me,s=>{e(D)&&s(Ne)})}t(_e),t(Z),q("keydown",J,s=>s.key==="Enter"&&ve()),de(J,()=>e(V),s=>b(V,s)),q("click",Fe,ve),de(re,()=>e(H),s=>b(H,s)),q("click",fe,ke),c(he,Z),Pe()}Be(["click","keydown"]);export{ft as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/8.CgPowUzz.js.br b/apps/dashboard/build/_app/immutable/nodes/8.CgPowUzz.js.br new file mode 100644 index 0000000..3fdec98 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/8.CgPowUzz.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/8.CgPowUzz.js.gz b/apps/dashboard/build/_app/immutable/nodes/8.CgPowUzz.js.gz new file mode 100644 index 0000000..a7c32e9 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/8.CgPowUzz.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/8.D5dP0-E2.js b/apps/dashboard/build/_app/immutable/nodes/8.D5dP0-E2.js deleted file mode 100644 index 1d60119..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/8.D5dP0-E2.js +++ /dev/null @@ -1,3 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{o as Re,a as Fe}from"../chunks/TZu9D97Z.js";import{p as Ae,c as Ne,f as De,g as e,a as u,b as Me,u as O,e as s,r,h as o,t as M,i as A,j as m,s as V,d as ye,n as xe}from"../chunks/wpu9U-D0.js";import{d as Ce,s as f,a as X}from"../chunks/D8mhvFt8.js";import{i as Y}from"../chunks/DKve45Wd.js";import{e as ce,i as Se,s as he,a as le,r as Pe}from"../chunks/60_R_Vbt.js";import{a as _e,r as Ze}from"../chunks/P1-U_Xsj.js";import{b as Ee}from"../chunks/CnZzd20v.js";import{s as de}from"../chunks/EqHb-9AZ.js";import{N as Ie}from"../chunks/CcUbQ_Wl.js";import{P as Be}from"../chunks/BHDZZvku.js";import{I as je}from"../chunks/D7A-gG4Z.js";import{A as we}from"../chunks/DcKTNC6e.js";import{s as He}from"../chunks/DPdYG9yN.js";function Le(n){return n>=.92?"near-identical":n>=.8?"strong":"weak"}function be(n){const a=Le(n);return a==="near-identical"?"var(--color-decay)":a==="strong"?"var(--color-warning)":"#fde047"}function Oe(n){const a=Le(n);return a==="near-identical"?"Near-identical":a==="strong"?"Strong match":"Weak match"}function ze(n){return n>.7?"#10b981":n>.4?"#f59e0b":"#ef4444"}function Ue(n){if(!n||n.length===0)return null;let a=n[0],d=Number.isFinite(a.retention)?a.retention:-1/0;for(let v=1;vd&&(a=w,d=k)}return a}function We(n,a){return n.filter(d=>d.similarity>=a)}function ke(n){return n.map(a=>a.id).slice().sort().join("|")}function Ke(n,a=80){if(!n)return"";const d=n.trim().replace(/\s+/g," ");return d.length<=a?d:d.slice(0,a)+"…"}function Te(n){if(!n||typeof n!="string")return"";const a=new Date(n);return Number.isNaN(a.getTime())?"":a.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function Ge(n,a=4){return Array.isArray(n)?n.slice(0,a):[]}var Ve=m('WINNER'),Xe=m(' '),Ye=m('
                    '),qe=m('

                    '),Je=m('
                    ');function Qe(n,a){Ae(a,!0);let d=V(!1);const v=O(()=>Ue(a.memories)),w=O(()=>e(v)?a.memories.filter(y=>y.id!==e(v).id).map(y=>y.id):[]);function k(){a.onMerge&&e(v)&&a.onMerge(e(v).id,e(w))}var C=Ne(),q=De(C);{var ue=y=>{var J=Je(),z=s(J),Q=s(z),_=s(Q),P=s(_),ie=s(P);r(P);var U=o(P,2),ve=s(U,!0);r(U);var W=o(U,2),se=s(W);r(W),r(_);var Z=o(_,2),$=s(Z);r(Z),r(Q);var S=o(Q,2),ne=s(S);r(S),r(z);var ee=o(z,2);ce(ee,21,()=>a.memories,T=>T.id,(T,c)=>{var L=qe(),I=s(L),B=o(I,2),j=s(B),t=s(j),i=s(t,!0);r(t);var l=o(t,2);{var p=h=>{var D=Ve();u(h,D)};Y(l,h=>{e(c).id===e(v).id&&h(p)})}var b=o(l,2);ce(b,17,()=>Ge(e(c).tags,4),Se,(h,D)=>{var H=Xe(),fe=s(H,!0);r(H),M(()=>f(fe,e(D))),u(h,H)}),r(j);var g=o(j,2),x=s(g,!0);r(g);var ae=o(g,2);{var re=h=>{var D=Ye(),H=s(D,!0);r(D),M(fe=>f(H,fe),[()=>Te(e(c).createdAt)]),u(h,D)},oe=O(()=>Te(e(c).createdAt));Y(ae,h=>{e(oe)&&h(re)})}r(B);var R=o(B,2),G=s(R),ge=s(G);r(G);var F=o(G,2),N=s(F);r(F),r(R),r(L),M((h,D,H)=>{he(L,1,`group flex items-start gap-3 rounded-xl border border-synapse/5 bg-white/[0.02] p-3 transition-all duration-200 hover:border-synapse/20 hover:bg-white/[0.04] ${e(c).id===e(v).id?"ring-1 ring-recall/30":""}`),de(I,`background: ${(Ie[e(c).nodeType]||"#8B95A5")??""}`),le(I,"title",e(c).nodeType),f(i,e(c).nodeType),he(g,1,`text-sm text-text leading-relaxed ${e(d)?"whitespace-pre-wrap":""}`),f(x,h),de(ge,`width: ${e(c).retention*100}%; background: ${D??""}`),f(N,`${H??""}%`)},[()=>e(d)?e(c).content:Ke(e(c).content),()=>ze(e(c).retention),()=>(e(c).retention*100).toFixed(0)]),u(T,L)}),r(ee);var K=o(ee,2),te=s(K),E=o(te,2),me=s(E,!0);r(E);var pe=o(E,2);r(K),r(J),M((T,c,L,I,B,j,t,i)=>{de(P,`color: ${T??""}`),f(ie,`${c??""}%`),f(ve,L),f(se,`· ${a.memories.length??""} memories`),le(Z,"aria-valuenow",I),de($,`width: ${B??""}%; background: ${j??""}; box-shadow: 0 0 12px ${t??""}66`),he(S,1,`flex-shrink-0 rounded-full border px-3 py-1 text-xs font-medium ${a.suggestedAction==="merge"?"border-recall/40 bg-recall/10 text-recall":"border-dream-glow/40 bg-dream/10 text-dream-glow"}`),f(ne,`Suggested: ${a.suggestedAction==="merge"?"Merge":"Review"}`),le(te,"title",`Merge all into highest-retention memory (${i??""}%)`),le(E,"aria-expanded",e(d)),f(me,e(d)?"Collapse":"Review")},[()=>be(a.similarity),()=>(a.similarity*100).toFixed(1),()=>Oe(a.similarity),()=>Math.round(a.similarity*100),()=>(a.similarity*100).toFixed(1),()=>be(a.similarity),()=>be(a.similarity),()=>(e(v).retention*100).toFixed(0)]),X("click",te,k),X("click",E,()=>A(d,!e(d))),X("click",pe,function(...T){var c;(c=a.onDismiss)==null||c.apply(this,T)}),u(y,J)};Y(q,y=>{a.memories.length>0&&e(v)&&y(ue)})}u(n,C),Me()}Ce(["click"]);var $e=m(' Live',1),et=m(' Detecting…',1),tt=m(' Error',1),at=m(' ',1),rt=m(`
                    Couldn't detect duplicates
                    `),it=m('
                    '),st=m('
                    '),nt=m('
                    No duplicates found — your memory is clean.
                    '),ot=m('
                    '),lt=m('
                    '),dt=m('
                    '),ct=m('
                    ');function At(n,a){Ae(a,!0);let d=V(.8),v=V(ye([])),w=V(ye(new Set)),k=V(!0),C=V(null),q;async function ue(t){return await new Promise(l=>setTimeout(l,450)),{clusters:We([{similarity:.96,suggestedAction:"merge",memories:[{id:"m-001",content:"BUG FIX: Harmony parser dropped `final` channel tokens when tool call followed. Root cause: 5-layer fallback missed the final channel marker when channel switched mid-stream. Solution: added final-channel detector before tool-call pop. Files: src/parser/harmony.rs",nodeType:"fact",tags:["bug-fix","benchmark-suite","parser"],retention:.91,createdAt:"2026-04-12T14:22:00Z"},{id:"m-002",content:"Fixed Harmony parser final-channel bug — 5-layer fallback was missing the final channel marker when a tool call followed. Added detector before tool pop.",nodeType:"fact",tags:["bug-fix","benchmark-suite"],retention:.64,createdAt:"2026-04-13T09:15:00Z"},{id:"m-003",content:"Harmony parser: final channel dropped on tool-call. Patched the fallback stack.",nodeType:"note",tags:["parser"],retention:.38,createdAt:"2026-04-14T11:02:00Z"}]},{similarity:.88,suggestedAction:"merge",memories:[{id:"m-004",content:"DECISION: Use vLLM prefix caching at 0.35 gpu_memory_utilization for benchmark suite submissions. Alternatives considered: sglang (slower cold start), TensorRT-LLM (deployment friction).",nodeType:"decision",tags:["vllm","benchmark-suite","inference"],retention:.84,createdAt:"2026-04-05T18:44:00Z"},{id:"m-005",content:"Chose vLLM with prefix caching (0.35 mem util) over sglang and TensorRT-LLM for benchmark suite inference.",nodeType:"decision",tags:["vllm","benchmark-suite"],retention:.72,createdAt:"2026-04-06T10:30:00Z"}]},{similarity:.83,suggestedAction:"review",memories:[{id:"m-006",content:"Release process prefers one change per benchmark submission — stacking changes destroyed signal in a prior run.",nodeType:"pattern",tags:["methodology","benchmark-suite"],retention:.88,createdAt:"2026-04-04T22:10:00Z"},{id:"m-007",content:"One-variable-at-a-time rule: never stack multiple changes per submission. Paper 2603.27844 proves +/-2 points is noise.",nodeType:"pattern",tags:["kaggle","methodology"],retention:.67,createdAt:"2026-04-08T16:20:00Z"},{id:"m-008",content:"Lesson: stacking many changes in one benchmark run hid the causal signal. Always isolate variables.",nodeType:"note",tags:["methodology"],retention:.42,createdAt:"2026-04-15T08:55:00Z"}]},{similarity:.78,suggestedAction:"review",memories:[{id:"m-009",content:"Dimensional Illusion performance: 7-minute flow poi set, LED config Parthenos overcook preset, tempo 128 BPM.",nodeType:"event",tags:["dimensional-illusion","poi","performance"],retention:.76,createdAt:"2026-03-28T19:45:00Z"},{id:"m-010",content:"Dimensional Illusion set: 7 min, Parthenos LED overcook, 128 BPM.",nodeType:"event",tags:["dimensional-illusion","poi"],retention:.51,createdAt:"2026-04-02T12:12:00Z"}]},{similarity:.76,suggestedAction:"review",memories:[{id:"m-011",content:"Vestige v2.0.7 shipped active forgetting via Anderson 2025 top-down inhibition + Davis Rac1 cascade. Suppress compounds, reversible 24h.",nodeType:"fact",tags:["vestige","release","active-forgetting"],retention:.93,createdAt:"2026-04-17T03:22:00Z"},{id:"m-012",content:"Active Forgetting feature: compounds on each suppress, 24h reversible labile window, violet implosion animation in graph view.",nodeType:"concept",tags:["vestige","active-forgetting"],retention:.81,createdAt:"2026-04-18T09:07:00Z"}]}],t)}}async function y(){A(k,!0),A(C,null);try{const t=await ue(e(d));A(v,t.clusters,!0);const i=new Set(e(v).map(p=>ke(p.memories))),l=new Set;for(const p of e(w))i.has(p)&&l.add(p);A(w,l,!0)}catch(t){A(C,t instanceof Error?t.message:"Failed to detect duplicates",!0),A(v,[],!0)}finally{A(k,!1)}}function J(){clearTimeout(q),q=setTimeout(y,250)}function z(t){const i=new Set(e(w));i.add(t),A(w,i,!0)}function Q(t,i,l){console.log("Merge cluster",t,{winnerId:i,loserIds:l}),z(t)}const _=O(()=>e(v).map(t=>({c:t,key:ke(t.memories)})).filter(({key:t})=>!e(w).has(t))),P=O(()=>e(_).reduce((t,{c:i})=>t+i.memories.length,0)),ie=50,U=O(()=>e(_).length>ie),ve=O(()=>e(U)?e(_).slice(0,ie):e(_));Re(()=>y()),Fe(()=>clearTimeout(q));var W=ct(),se=s(W);Be(se,{icon:"duplicates",title:"Memory Hygiene — Duplicate Detection",subtitle:"Cosine-similarity clustering over embeddings. Merges reinforce the winner's FSRS state; losers inherit into the merged node. Dismissed clusters are hidden for this session only.",accent:"synapse",children:(t,i)=>{var l=$e();xe(2),u(t,l)},$$slots:{default:!0}});var Z=o(se,2),$=s(Z),S=o(s($),2);Pe(S);var ne=o(S,2),ee=s(ne);r(ne),r($);var K=o($,2),te=s(K);{var E=t=>{var i=et();xe(2),u(t,i)},me=t=>{var i=tt();xe(2),u(t,i)},pe=t=>{var i=at(),l=o(De(i),2),p=s(l);we(p,{get value(){return e(_).length}});var b=o(p),g=o(b);we(g,{get value(){return e(P)}});var x=o(g);r(l),M(()=>{f(b,` ${e(_).length===1?"cluster":"clusters"}, `),f(x,` potential duplicate${e(P)===1?"":"s"}`)}),u(t,i)};Y(te,t=>{e(k)?t(E):e(C)?t(me,1):t(pe,!1)})}r(K);var T=o(K,2);r(Z);var c=o(Z,2);{var L=t=>{var i=rt(),l=o(s(i),2),p=s(l,!0);r(l);var b=o(l,2);r(i),M(()=>f(p,e(C))),X("click",b,y),u(t,i)},I=t=>{var i=st();ce(i,20,()=>Array(3),Se,(l,p)=>{var b=it();u(l,b)}),r(i),u(t,i)},B=t=>{var i=nt(),l=s(i),p=s(l);je(p,{name:"sparkle",size:26,draw:!0}),r(l);var b=o(l,4),g=s(b);r(b),r(i),M(x=>f(g,`Nothing clusters above ${x??""}% similarity. Lower the threshold to - surface looser matches.`),[()=>(e(d)*100).toFixed(0)]),u(t,i)},j=t=>{var i=dt(),l=s(i);{var p=g=>{var x=ot(),ae=s(x);r(x),M(()=>f(ae,`Showing first 50 of ${e(_).length??""} clusters. Raise the - threshold to narrow results.`)),u(g,x)};Y(l,g=>{e(U)&&g(p)})}var b=o(l,2);ce(b,19,()=>e(ve),({c:g,key:x})=>x,(g,x,ae)=>{let re=()=>e(x).c,oe=()=>e(x).key;var R=lt(),G=s(R),ge=s(G);Qe(ge,{get similarity(){return re().similarity},get memories(){return re().memories},get suggestedAction(){return re().suggestedAction},onDismiss:()=>z(oe()),onMerge:(F,N)=>Q(oe(),F,N)}),r(G),r(R),_e(R,(F,N)=>{var h;return(h=Ze)==null?void 0:h(F,N)},()=>({delay:Math.min(e(ae)*40,400),y:14})),_e(R,F=>{var N;return(N=He)==null?void 0:N(F)}),u(g,R)}),r(i),u(t,i)};Y(c,t=>{e(C)?t(L):e(k)?t(I,1):e(_).length===0?t(B,2):t(j,!1)})}r(W),M(t=>{f(ee,`${t??""}%`),T.disabled=e(k)},[()=>(e(d)*100).toFixed(0)]),X("input",S,J),Ee(S,()=>e(d),t=>A(d,t)),X("click",T,y),u(n,W),Me()}Ce(["input","click"]);export{At as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/8.D5dP0-E2.js.br b/apps/dashboard/build/_app/immutable/nodes/8.D5dP0-E2.js.br deleted file mode 100644 index 32163d9..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/8.D5dP0-E2.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/8.D5dP0-E2.js.gz b/apps/dashboard/build/_app/immutable/nodes/8.D5dP0-E2.js.gz deleted file mode 100644 index deb4cf4..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/8.D5dP0-E2.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/9.BWaJ-VBd.js b/apps/dashboard/build/_app/immutable/nodes/9.BWaJ-VBd.js new file mode 100644 index 0000000..4378a5e --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/9.BWaJ-VBd.js @@ -0,0 +1,8 @@ +import"../chunks/Bzak7iHL.js";import{i as oe}from"../chunks/BUoSzNdg.js";import{p as ee,aB as ie,g as e,h as A,d as o,e as d,r as s,f as ne,t as $,a as te,s as K,u as X,A as Z}from"../chunks/CpWkWWOo.js";import{s as x,d as de,a as ce}from"../chunks/BlVfL1ME.js";import{a as l,f as m}from"../chunks/CHOnp4oo.js";import{i as w}from"../chunks/B4yTwGkE.js";import{e as re,i as ae}from"../chunks/CGEBXrjl.js";import{s as C}from"../chunks/Cx-f-Pzo.js";import{s as le,a as me}from"../chunks/C6HuKgyx.js";import{w as ve,e as ue}from"../chunks/MAY1QfFZ.js";import{E as O}from"../chunks/DzfRjky4.js";import{s as pe}from"../chunks/A7po6GxK.js";import{s as fe}from"../chunks/aVbAZ-t7.js";import{p as Q}from"../chunks/V6gjw5Ec.js";var xe=m(' '),_e=m('
                    '),ge=m('
                    ',1),he=m('
                    '),ye=m('
                    '),$e=m('
                    Cognitive Search Pipeline
                    ');function be(q,F){ee(F,!0);let S=Q(F,"resultCount",3,0),j=Q(F,"durationMs",3,0),I=Q(F,"active",3,!1);const p=[{name:"Overfetch",icon:"◎",color:"#818CF8",desc:"Pull 3x results from hybrid search"},{name:"Rerank",icon:"⟿",color:"#00A8FF",desc:"Re-score by relevance quality"},{name:"Temporal",icon:"◷",color:"#00D4FF",desc:"Recent memories get recency bonus"},{name:"Access",icon:"◇",color:"#00FFD1",desc:"FSRS-6 retention threshold filter"},{name:"Context",icon:"◬",color:"#FFB800",desc:"Encoding specificity matching"},{name:"Compete",icon:"⬡",color:"#FF3CAC",desc:"Retrieval-induced forgetting"},{name:"Activate",icon:"◈",color:"#9D00FF",desc:"Spreading activation cascade"}];let _=K(-1),g=K(!1),u=K(!1);ie(()=>{I()&&!e(g)&&M()});function M(){A(g,!0),A(_,-1),A(u,!1);const t=Math.max(1500,(j()||50)*2),a=t/(p.length+1);p.forEach((i,v)=>{setTimeout(()=>{A(_,v,!0)},a*(v+1))}),setTimeout(()=>{A(u,!0),A(g,!1)},t)}var D=$e(),b=o(D),L=d(o(b),2);{var V=t=>{var a=xe(),i=o(a);s(a),$(()=>x(i,`${S()??""} results in ${j()??""}ms`)),l(t,a)};w(L,t=>{e(u)&&t(V)})}s(b);var P=d(b,2);re(P,21,()=>p,ae,(t,a,i)=>{const v=X(()=>i<=e(_)),E=X(()=>i===e(_)&&e(g));var k=ge(),h=ne(k),y=o(h),J=o(y,!0);s(y);var R=d(y,2),T=o(R,!0);s(R),s(h);var U=d(h,2);{var W=B=>{var c=_e();$(()=>C(c,`background: ${i{i{fe(y,1,`w-8 h-8 rounded-full flex items-center justify-center text-xs transition-all duration-300 + ${e(E)?"scale-125":""}`),C(y,`background: ${e(v)?e(a).color+"25":"rgba(255,255,255,0.03)"}; + border: 1.5px solid ${(e(v)?e(a).color:"rgba(255,255,255,0.06)")??""}; + color: ${(e(v)?e(a).color:"#4a4a7a")??""}; + box-shadow: ${e(E)?"0 0 12px "+e(a).color+"40":"none"}`),pe(y,"title",e(a).desc),x(J,e(a).icon),C(R,`color: ${(e(v)?e(a).color:"#4a4a7a")??""}`),x(T,e(a).name)}),l(t,k)}),s(P);var N=d(P,2),z=o(N);{var n=t=>{var a=he();$(i=>C(a,`width: ${i??""}%; + background: linear-gradient(90deg, #818CF8, #00FFD1, #9D00FF); + transition-duration: ${e(g)?"300ms":"500ms"}`),[()=>e(u)?"100":((e(_)+1)/p.length*100).toFixed(0)]),l(t,a)};w(z,t=>{(e(g)||e(u))&&t(n)})}s(N);var r=d(N,2);{var H=t=>{var a=ye(),i=d(o(a),2),v=o(i);s(i),s(a),$(()=>x(v,`Pipeline complete: ${S()??""} memories surfaced from ${p.length??""}-stage cognitive cascade`)),l(t,a)};w(r,t=>{e(u)&&t(H)})}s(D),l(q,D),te()}var we=m('

                    Waiting for cognitive events...

                    Events appear here in real-time as Vestige thinks.

                    '),Ce=m(' '),Fe=m('
                    '),Se=m(`

                    `),De=m('
                    '),ke=m('

                    Live Feed

                    ');function ze(q,F){ee(F,!1);const S=()=>me(ue,"$eventFeed",j),[j,I]=le();function p(n){return new Date(n).toLocaleTimeString()}function _(n){return{MemoryCreated:"+",MemoryUpdated:"~",MemoryDeleted:"×",MemoryPromoted:"↑",MemoryDemoted:"↓",SearchPerformed:"◎",DreamStarted:"◈",DreamProgress:"◈",DreamCompleted:"◈",ConsolidationStarted:"◉",ConsolidationCompleted:"◉",RetentionDecayed:"↘",ConnectionDiscovered:"━",ActivationSpread:"◬",ImportanceScored:"◫",Heartbeat:"♡"}[n]||"·"}function g(n){const r=n.data;switch(n.type){case"MemoryCreated":return`New ${r.node_type}: "${String(r.content_preview).slice(0,60)}..."`;case"SearchPerformed":return`Searched "${r.query}" → ${r.result_count} results (${r.duration_ms}ms)`;case"DreamStarted":return`Dream started with ${r.memory_count} memories`;case"DreamCompleted":return`Dream complete: ${r.connections_found} connections, ${r.insights_generated} insights (${r.duration_ms}ms)`;case"ConsolidationStarted":return"Consolidation cycle started";case"ConsolidationCompleted":return`Consolidated ${r.nodes_processed} nodes, ${r.decay_applied} decayed (${r.duration_ms}ms)`;case"ConnectionDiscovered":return`Connection: ${String(r.connection_type)} (weight: ${Number(r.weight).toFixed(2)})`;case"ImportanceScored":return`Scored ${Number(r.composite_score).toFixed(2)}: "${String(r.content_preview).slice(0,50)}..."`;case"MemoryPromoted":return`Promoted → ${(Number(r.new_retention)*100).toFixed(0)}% retention`;case"MemoryDemoted":return`Demoted → ${(Number(r.new_retention)*100).toFixed(0)}% retention`;default:return JSON.stringify(r).slice(0,100)}}oe();var u=ke(),M=o(u),D=d(o(M),2),b=o(D),L=o(b);s(b);var V=d(b,2);s(D),s(M);var P=d(M,2);{var N=n=>{var r=we();l(n,r)},z=n=>{var r=De();re(r,5,S,ae,(H,t)=>{var a=Se(),i=o(a),v=o(i,!0);s(i);var E=d(i,2),k=o(E),h=o(k),y=o(h,!0);s(h);var J=d(h,2);{var R=c=>{var f=Ce(),Y=o(f,!0);s(f),$(G=>x(Y,G),[()=>p(String(e(t).data.timestamp))]),l(c,f)};w(J,c=>{e(t).data.timestamp&&c(R)})}s(k);var T=d(k,2),U=o(T,!0);s(T);var W=d(T,2);{var B=c=>{var f=Fe(),Y=o(f);{let G=Z(()=>Number(e(t).data.result_count)||0),se=Z(()=>Number(e(t).data.duration_ms)||0);be(Y,{get resultCount(){return e(G)},get durationMs(){return e(se)},active:!0})}s(f),l(c,f)};w(W,c=>{e(t).type==="SearchPerformed"&&c(B)})}s(E),s(a),$((c,f)=>{C(a,`border-left: 3px solid ${(O[e(t).type]||"#8B95A5")??""}`),C(i,`background: ${(O[e(t).type]||"#8B95A5")??""}15; color: ${(O[e(t).type]||"#8B95A5")??""}`),x(v,c),C(h,`color: ${(O[e(t).type]||"#8B95A5")??""}`),x(y,e(t).type),x(U,f)},[()=>_(e(t).type),()=>g(e(t))]),l(H,a)}),s(r),l(n,r)};w(P,n=>{S().length===0?n(N):n(z,!1)})}s(u),$(()=>x(L,`${S().length??""} events`)),ce("click",V,()=>ve.clearEvents()),l(q,u),te(),I()}de(["click"]);export{ze as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/9.BWaJ-VBd.js.br b/apps/dashboard/build/_app/immutable/nodes/9.BWaJ-VBd.js.br new file mode 100644 index 0000000..36cc5aa Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/9.BWaJ-VBd.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/9.BWaJ-VBd.js.gz b/apps/dashboard/build/_app/immutable/nodes/9.BWaJ-VBd.js.gz new file mode 100644 index 0000000..4766f92 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/9.BWaJ-VBd.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/9.Vz-x3Q_x.js b/apps/dashboard/build/_app/immutable/nodes/9.Vz-x3Q_x.js deleted file mode 100644 index b927b0e..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/9.Vz-x3Q_x.js +++ /dev/null @@ -1,6 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{p as Ue,s as j,d as Ve,g as e,a as v,b as Ge,e as a,h as r,i as h,j as _,r as t,n as ke,k as Je,t as k,f as Se,c as Le,u as de,l as We,m as Te}from"../chunks/wpu9U-D0.js";import{d as Xe,a as B,s as p}from"../chunks/D8mhvFt8.js";import{i as $}from"../chunks/DKve45Wd.js";import{e as W,i as X,r as Fe,s as Y}from"../chunks/60_R_Vbt.js";import{a as $e,r as Ye}from"../chunks/P1-U_Xsj.js";import{s as le}from"../chunks/EqHb-9AZ.js";import{b as ve}from"../chunks/CnZzd20v.js";import{a as Z}from"../chunks/CZfHMhLI.js";import{P as Ze}from"../chunks/BHDZZvku.js";import{I as ee}from"../chunks/D7A-gG4Z.js";import{A as Ne}from"../chunks/DcKTNC6e.js";import{s as et}from"../chunks/DPdYG9yN.js";var tt=_(''),at=_('
                    Source

                    '),rt=_('
                    Target

                    '),st=_(`
                    Target Memory
                    `,1),it=_('
                    '),nt=_('
                    '),ot=_(' '),dt=_(' '),lt=_(' '),vt=_(' '),ct=_(' '),pt=_('

                    '),xt=_('

                    Connections Found

                    '),mt=_('

                    No connections surfaced yet

                    '),ut=_('
                    '),_t=_('
                    '),ft=_('
                    '),bt=_(`
                    Source Memory

                    Importance Scorer

                    4-channel neuroscience scoring: novelty, arousal, reward, attention

                    `);function Et(ze,Ie){Ue(Ie,!0);let U=j(""),V=j(""),A=j(null),C=j(null),D=j(Ve([])),N=j("associations"),O=j(!1),G=j(""),H=j(null);const ce={associations:{icon:"activation",desc:"Spreading activation — find related memories via graph traversal"},chains:{icon:"reasoning",desc:"Build reasoning path from source to target memory"},bridges:{icon:"explore",desc:"Find connecting memories between two concepts"}};async function pe(){if(e(U).trim()){h(O,!0);try{const s=await Z.search(e(U),1);s.results.length>0&&(h(A,s.results[0],!0),await te())}catch{}finally{h(O,!1)}}}async function xe(){if(e(V).trim()){h(O,!0);try{const s=await Z.search(e(V),1);s.results.length>0&&(h(C,s.results[0],!0),e(A)&&await te())}catch{}finally{h(O,!1)}}}async function te(){if(e(A)){h(O,!0);try{const s=(e(N)==="chains"||e(N)==="bridges")&&e(C)?e(C).id:void 0,n=await Z.explore(e(A).id,e(N),s);h(D,n.results||n.nodes||n.chain||n.bridges||[],!0)}catch{h(D,[],!0)}finally{h(O,!1)}}}async function Me(){e(G).trim()&&h(H,await Z.importance(e(G)),!0)}function Ee(s){h(N,s,!0),e(A)&&te()}var ae=bt(),me=a(ae);Ze(me,{icon:"explore",title:"Explore Connections",subtitle:"Traverse the memory graph — spreading activation, reasoning chains, and conceptual bridges.",accent:"synapse"});var re=r(me,2);W(re,20,()=>["associations","chains","bridges"],X,(s,n)=>{var x=tt(),f=a(x),S=a(f);ee(S,{get name(){return ce[n].icon},size:22}),t(f);var y=r(f,2),c=a(y,!0);t(y);var o=r(y,2),m=a(o,!0);t(o),t(x),k(b=>{Y(x,1,`lift flex flex-col items-center gap-1 p-3 rounded-xl text-sm transition - ${e(N)===n?"glass !border-synapse/30 text-synapse-glow":"glass-subtle text-dim hover:bg-white/[0.03]"}`),Y(f,1,e(N)===n?"breathe":""),p(c,b),p(m,ce[n].desc)},[()=>n.charAt(0).toUpperCase()+n.slice(1)]),B("click",x,()=>Ee(n)),v(s,x)}),t(re);var se=r(re,2),ue=r(a(se),2),J=a(ue);Fe(J);var Ae=r(J,2);t(ue),t(se);var _e=r(se,2);{var Pe=s=>{var n=at(),x=r(a(n),2),f=a(x,!0);t(x);var S=r(x,2),y=a(S),c=a(y,!0);t(y);var o=r(y,2),m=a(o);t(o),t(S),t(n),k((b,w)=>{p(f,b),p(c,e(A).nodeType),p(m,`${w??""}% retention`)},[()=>e(A).content.slice(0,200),()=>(e(A).retentionStrength*100).toFixed(0)]),v(s,n)};$(_e,s=>{e(A)&&s(Pe)})}var fe=r(_e,2);{var je=s=>{var n=st(),x=Se(n),f=a(x),S=r(a(f)),y=a(S);t(S),t(f);var c=r(f,2),o=a(c);Fe(o);var m=r(o,2);t(c),t(x);var b=r(x,2);{var w=u=>{var z=rt(),i=r(a(z),2),T=a(i,!0);t(i);var g=r(i,2),F=a(g),E=a(F,!0);t(F);var I=r(F,2),P=a(I);t(I),t(g),t(z),k((Q,q)=>{p(T,Q),p(E,e(C).nodeType),p(P,`${q??""}% retention`)},[()=>e(C).content.slice(0,200),()=>(e(C).retentionStrength*100).toFixed(0)]),v(u,z)};$(b,u=>{e(C)&&u(w)})}k(()=>p(y,`(for ${e(N)??""})`)),B("keydown",o,u=>u.key==="Enter"&&xe()),ve(o,()=>e(V),u=>h(V,u)),B("click",m,xe),v(s,n)};$(fe,s=>{(e(N)==="chains"||e(N)==="bridges")&&s(je)})}var be=r(fe,2);{var Ce=s=>{var n=Le(),x=Se(n);{var f=c=>{var o=nt(),m=a(o),b=a(m);ee(b,{name:"activation",size:18,class:"breathe text-synapse-glow"});var w=r(b,2),u=a(w);t(w),t(m);var z=r(m,2);W(z,20,()=>Array(4),X,(i,T,g)=>{var F=it(),E=r(a(F),2),I=a(E);le(I,`width: ${88-g*9}%`);var P=r(I,2);le(P,`width: ${52-g*6}%`),t(E),t(F),v(i,F)}),t(z),t(o),k(()=>p(u,`Exploring ${e(N)??""}…`)),v(c,o)},S=c=>{var o=xt(),m=a(o),b=a(m),w=a(b);Ne(w,{get value(){return e(D).length},class:"text-aurora font-bold"}),ke(2),t(b),t(m);var u=r(m,2);W(u,21,()=>e(D),X,(z,i,T)=>{var g=pt(),F=a(g),E=a(F);E.textContent=T+1;var I=r(E,2),P=a(I),Q=a(P,!0);t(P);var q=r(P,2),K=a(q);{var oe=l=>{var d=ot(),M=a(d,!0);t(d),k(()=>p(M,e(i).nodeType)),v(l,d)};$(K,l=>{e(i).nodeType&&l(oe)})}var L=r(K,2);{var Be=l=>{var d=dt(),M=a(d);t(d),k(R=>p(M,`Score: ${R??""}`),[()=>Number(e(i).score).toFixed(3)]),v(l,d)};$(L,l=>{e(i).score&&l(Be)})}var ye=r(L,2);{var De=l=>{var d=lt(),M=a(d);t(d),k(R=>p(M,`Similarity: ${R??""}`),[()=>Number(e(i).similarity).toFixed(3)]),v(l,d)};$(ye,l=>{e(i).similarity&&l(De)})}var we=r(ye,2);{var He=l=>{var d=vt(),M=a(d);t(d),k(R=>p(M,`${R??""}% retention`),[()=>(Number(e(i).retention)*100).toFixed(0)]),v(l,d)};$(we,l=>{e(i).retention&&l(He)})}var Ke=r(we,2);{var Re=l=>{var d=ct(),M=a(d,!0);t(d),k(()=>p(M,e(i).connectionType)),v(l,d)};$(Ke,l=>{e(i).connectionType&&l(Re)})}t(q),t(I),t(F),t(g),$e(g,(l,d)=>{var M;return(M=Ye)==null?void 0:M(l,d)},()=>({delay:Math.min(T*35,350),y:12})),$e(g,l=>{var d;return(d=et)==null?void 0:d(l)}),k(()=>p(Q,e(i).content)),v(z,g)}),t(u),t(o),v(c,o)},y=c=>{var o=mt(),m=a(o);ee(m,{name:"explore",size:40,class:"breathe text-synapse-glow mx-auto mb-4 opacity-80"});var b=r(m,4),w=a(b);{var u=i=>{var T=Te("This memory hasn't formed strong links here. Try a broader source query — the graph rewards more general seeds.");v(i,T)},z=i=>{var T=Te();k(()=>p(T,`No ${e(N)??""} found between these two memories. Pick a different source or target and the path may light up.`)),v(i,T)};$(w,i=>{e(N)==="associations"?i(u):i(z,!1)})}t(b),t(o),v(c,o)};$(x,c=>{e(O)?c(f):e(D).length>0?c(S,1):c(y,!1)})}v(s,n)};$(be,s=>{e(A)&&s(Ce)})}var ge=r(be,2),ie=a(ge),Oe=a(ie);ee(Oe,{name:"importance",size:20,class:"text-recall"}),ke(),t(ie);var ne=r(ie,4);Je(ne);var he=r(ne,2),Qe=r(he,2);{var qe=s=>{const n=de(()=>e(H).channels),x=de(()=>Number(e(H).composite||e(H).compositeScore||0));var f=ft(),S=a(f),y=a(S);Ne(y,{get value(){return e(x)},decimals:2,class:"text-3xl text-aurora font-bold"});var c=r(y,2),o=a(c,!0);t(c),t(S);var m=r(S,2);{var b=w=>{var u=_t();W(u,21,()=>Object.entries(e(n)),X,(z,i)=>{var T=de(()=>We(e(i),2));let g=()=>e(T)[0],F=()=>e(T)[1];var E=ut(),I=a(E),P=a(I,!0);t(I);var Q=r(I,2),q=a(Q);t(Q);var K=r(Q,2),oe=a(K,!0);t(K),t(E),k(L=>{p(P,g()),Y(q,1,`h-full rounded-full transition-all duration-500 - ${g()==="novelty"?"bg-synapse":g()==="arousal"?"bg-dream":g()==="reward"?"bg-recall":"bg-amber-400"}`),le(q,`width: ${F()*100}%`),p(oe,L)},[()=>F().toFixed(2)]),v(z,E)}),t(u),v(w,u)};$(m,w=>{e(n)&&w(b)})}t(f),k(()=>{Y(c,1,`px-2 py-1 rounded-lg text-xs ${e(x)>.6?"bg-recall/20 text-recall border border-recall/30":"bg-white/[0.04] text-dim border border-subtle/20"}`),p(o,e(x)>.6?"SAVE":"SKIP")}),v(s,f)};$(Qe,s=>{e(H)&&s(qe)})}t(ge),t(ae),B("keydown",J,s=>s.key==="Enter"&&pe()),ve(J,()=>e(U),s=>h(U,s)),B("click",Ae,pe),ve(ne,()=>e(G),s=>h(G,s)),B("click",he,Me),v(ze,ae),Ge()}Xe(["click","keydown"]);export{Et as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/9.Vz-x3Q_x.js.br b/apps/dashboard/build/_app/immutable/nodes/9.Vz-x3Q_x.js.br deleted file mode 100644 index 6c8cc49..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/9.Vz-x3Q_x.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/9.Vz-x3Q_x.js.gz b/apps/dashboard/build/_app/immutable/nodes/9.Vz-x3Q_x.js.gz deleted file mode 100644 index b4a338b..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/9.Vz-x3Q_x.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/version.json b/apps/dashboard/build/_app/version.json index fdf4b42..2d5883d 100644 --- a/apps/dashboard/build/_app/version.json +++ b/apps/dashboard/build/_app/version.json @@ -1 +1 @@ -{"version":"2.2.1"} \ No newline at end of file +{"version":"1778051833240"} \ No newline at end of file diff --git a/apps/dashboard/build/_app/version.json.br b/apps/dashboard/build/_app/version.json.br index bf883c7..28b7338 100644 Binary files a/apps/dashboard/build/_app/version.json.br and b/apps/dashboard/build/_app/version.json.br differ diff --git a/apps/dashboard/build/_app/version.json.gz b/apps/dashboard/build/_app/version.json.gz index b3c3a1a..03b8889 100644 Binary files a/apps/dashboard/build/_app/version.json.gz and b/apps/dashboard/build/_app/version.json.gz differ diff --git a/apps/dashboard/build/favicon.svg.gz b/apps/dashboard/build/favicon.svg.gz index 61b0904..06ecd9b 100644 Binary files a/apps/dashboard/build/favicon.svg.gz and b/apps/dashboard/build/favicon.svg.gz differ diff --git a/apps/dashboard/build/index.html b/apps/dashboard/build/index.html index bc8e358..31b0831 100644 --- a/apps/dashboard/build/index.html +++ b/apps/dashboard/build/index.html @@ -11,19 +11,21 @@ - - - - - - - - + + + + + + + + + - - - - + + + + + Vestige @@ -31,7 +33,7 @@
                    - -{prefix}{formatted}{suffix} diff --git a/apps/dashboard/src/lib/components/Dropdown.svelte b/apps/dashboard/src/lib/components/Dropdown.svelte deleted file mode 100644 index 9c12e69..0000000 --- a/apps/dashboard/src/lib/components/Dropdown.svelte +++ /dev/null @@ -1,338 +0,0 @@ - - - - -
                    - {#if label} - {label} - {/if} - - - {#if open} -
                    - {#each options as opt, i (opt.value)} - - {/each} -
                    - {/if} -
                    - - diff --git a/apps/dashboard/src/lib/components/Graph3D.svelte b/apps/dashboard/src/lib/components/Graph3D.svelte index d09dcc9..8c0f769 100644 --- a/apps/dashboard/src/lib/components/Graph3D.svelte +++ b/apps/dashboard/src/lib/components/Graph3D.svelte @@ -50,20 +50,6 @@ let ctx: SceneContext; let animationId: number; - // Accessibility: honour the OS "reduce motion" setting. The dominant - // continuous motion in the graph is the camera auto-rotate; disabling it - // removes the vestibular-trigger while keeping the graph fully usable - // (manual orbit, hover, selection, live events all still work). Tracked - // reactively so a mid-session OS toggle is respected. - let prefersReducedMotion = - typeof window !== 'undefined' && - window.matchMedia?.('(prefers-reduced-motion: reduce)').matches; - let reducedMotionMq: MediaQueryList | null = null; - function onReducedMotionChange(e: MediaQueryListEvent) { - prefersReducedMotion = e.matches; - if (ctx?.controls) ctx.controls.autoRotate = !prefersReducedMotion; - } - // Modules let nodeManager: NodeManager; let edgeManager: EdgeManager; @@ -88,15 +74,6 @@ onMount(() => { ctx = createScene(container); - // Respect reduced-motion: the scene defaults to auto-rotate on; turn it - // off up front for users who asked for less motion, and listen for live - // OS-setting changes. - if (prefersReducedMotion) ctx.controls.autoRotate = false; - if (typeof window !== 'undefined' && window.matchMedia) { - reducedMotionMq = window.matchMedia('(prefers-reduced-motion: reduce)'); - reducedMotionMq.addEventListener?.('change', onReducedMotionChange); - } - // Nebula background const nebula = createNebulaBackground(ctx.scene); nebulaMaterial = nebula.material; @@ -136,7 +113,6 @@ onDestroy(() => { cancelAnimationFrame(animationId); window.removeEventListener('resize', onResize); - reducedMotionMq?.removeEventListener?.('change', onReducedMotionChange); container?.removeEventListener('pointermove', onPointerMove); container?.removeEventListener('click', onClick); effects?.dispose(); diff --git a/apps/dashboard/src/lib/components/Icon.svelte b/apps/dashboard/src/lib/components/Icon.svelte deleted file mode 100644 index 1acf84f..0000000 --- a/apps/dashboard/src/lib/components/Icon.svelte +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - diff --git a/apps/dashboard/src/lib/components/InsightToast.svelte b/apps/dashboard/src/lib/components/InsightToast.svelte index 8a0a991..f941911 100644 --- a/apps/dashboard/src/lib/components/InsightToast.svelte +++ b/apps/dashboard/src/lib/components/InsightToast.svelte @@ -20,7 +20,6 @@ MemoryUnsuppressed: '◉', Rac1CascadeSwept: '✺', MemoryDeleted: '✕', - HookVerdictRecorded: '⚑', }; function iconFor(type: VestigeEventType): string { @@ -91,7 +90,7 @@ right: 0.75rem; left: 0.75rem; bottom: auto; - top: 5.25rem; + top: 0.75rem; max-width: none; width: auto; align-items: stretch; diff --git a/apps/dashboard/src/lib/components/MemoryCinema.svelte b/apps/dashboard/src/lib/components/MemoryCinema.svelte deleted file mode 100644 index b78c827..0000000 --- a/apps/dashboard/src/lib/components/MemoryCinema.svelte +++ /dev/null @@ -1,831 +0,0 @@ - - - - -{#if open} - - -{/if} - - diff --git a/apps/dashboard/src/lib/components/PageHeader.svelte b/apps/dashboard/src/lib/components/PageHeader.svelte deleted file mode 100644 index 00ad638..0000000 --- a/apps/dashboard/src/lib/components/PageHeader.svelte +++ /dev/null @@ -1,69 +0,0 @@ - - -
                    -
                    -
                    - -
                    -
                    -

                    {title}

                    - {#if subtitle} -

                    {subtitle}

                    - {/if} -
                    -
                    - {#if children} -
                    - {@render children()} -
                    - {/if} -
                    - - diff --git a/apps/dashboard/src/lib/components/ReceiptCard.svelte b/apps/dashboard/src/lib/components/ReceiptCard.svelte deleted file mode 100644 index 71ea574..0000000 --- a/apps/dashboard/src/lib/components/ReceiptCard.svelte +++ /dev/null @@ -1,218 +0,0 @@ - - -
                    -
                    - {receipt.receipt_id} - - decay: {receipt.decay_risk} - -
                    - -
                    -
                    - {receipt.retrieved.length} - retrieved -
                    -
                    - {receipt.suppressed.length} - suppressed -
                    -
                    - {(receipt.trust_floor * 100).toFixed(0)}% - trust floor -
                    -
                    - - {#if !compact} - {#if receipt.activation_path.length} -
                    - Activation path - {#each receipt.activation_path as path (path)} -
                    {path}
                    - {/each} -
                    - {/if} - - {#if receipt.retrieved.length} -
                    - Retrieved -
                    - {#each receipt.retrieved as id (id)} - {id.slice(0, 8)} - {/each} -
                    -
                    - {/if} - - {#if receipt.suppressed.length} -
                    - Suppressed -
                    - {#each receipt.suppressed as s (s.id)} - - {s.id.slice(0, 8)} · {s.reason.replace('_', ' ')} - - {/each} -
                    -
                    - {/if} - {/if} - - -
                    - - diff --git a/apps/dashboard/src/lib/components/VerdictBar.svelte b/apps/dashboard/src/lib/components/VerdictBar.svelte deleted file mode 100644 index 2131642..0000000 --- a/apps/dashboard/src/lib/components/VerdictBar.svelte +++ /dev/null @@ -1,327 +0,0 @@ - - -{#if visible} -
                    - - - {#if expanded && receipt} -
                    -
                    -
                    -
                    Claim
                    -

                    {displayClaim?.text ?? receipt.draftPreview}

                    -
                    -
                    -
                    Verdict
                    -

                    {displayClaim?.decision ?? receipt.overall} · {displayClaim?.evidence_state ?? verdict}

                    -
                    -
                    -
                    Precedent
                    -
                      - {#each precedentText(displayClaim) as item} -
                    • {item}
                    • - {/each} -
                    -
                    -
                    -
                    Fix
                    -

                    {displayClaim?.fix || 'No change required.'}

                    -
                    -
                    - -
                    - Appeal - {#if appealClaim && receipt.verdictBar === 'VETO'} - - - - {:else if receipt.verdictBar === 'APPEALED'} -

                    Appeal recorded.

                    - {:else} -

                    No appealable veto in this receipt.

                    - {/if} -
                    -
                    - {/if} -
                    -{/if} - - diff --git a/apps/dashboard/src/lib/components/__tests__/PatternTransferHeatmap.test.ts b/apps/dashboard/src/lib/components/__tests__/PatternTransferHeatmap.test.ts index 8f7fa32..0fcf856 100644 --- a/apps/dashboard/src/lib/components/__tests__/PatternTransferHeatmap.test.ts +++ b/apps/dashboard/src/lib/components/__tests__/PatternTransferHeatmap.test.ts @@ -173,14 +173,14 @@ describe('buildTransferMatrix', () => { it('aggregates transfer counts directionally', () => { const m = buildTransferMatrix(PROJECTS, PATTERNS); // vestige → api-gateway: Result + proptest = 2 - expect(m.vestige['api-gateway'].count).toBe(2); + expect(m.vestige.api-gateway.count).toBe(2); // vestige → desktop-app: Result only = 1 - expect(m.vestige['desktop-app'].count).toBe(1); + expect(m.vestige.desktop-app.count).toBe(1); // api-gateway → vestige: Axum middleware = 1 - expect(m['api-gateway'].vestige.count).toBe(1); + expect(m.api-gateway.vestige.count).toBe(1); // desktop-app → anywhere: zero (no origin in desktop-app in fixtures) - expect(m['desktop-app'].vestige.count).toBe(0); - expect(m['desktop-app']['api-gateway'].count).toBe(0); + expect(m.desktop-app.vestige.count).toBe(0); + expect(m.desktop-app.api-gateway.count).toBe(0); }); it('treats (A, B) and (B, A) as distinct directions (asymmetry confirmed)', () => { @@ -189,7 +189,7 @@ describe('buildTransferMatrix', () => { // bug that aggregates both directions into the same cell would pass // the "count" test above but fail this symmetry check. const m = buildTransferMatrix(PROJECTS, PATTERNS); - expect(m.vestige['api-gateway'].count).not.toBe(m['api-gateway'].vestige.count); + expect(m.vestige.api-gateway.count).not.toBe(m.api-gateway.vestige.count); }); it('records self-transfer on the diagonal', () => { @@ -207,9 +207,9 @@ describe('buildTransferMatrix', () => { transfer_count: 1, })); const m = buildTransferMatrix(['vestige', 'api-gateway'], manyPatterns); - expect(m.vestige['api-gateway'].count).toBe(5); - expect(m.vestige['api-gateway'].topNames).toHaveLength(3); - expect(m.vestige['api-gateway'].topNames).toEqual(['pattern-0', 'pattern-1', 'pattern-2']); + expect(m.vestige.api-gateway.count).toBe(5); + expect(m.vestige.api-gateway.topNames).toHaveLength(3); + expect(m.vestige.api-gateway.topNames).toEqual(['pattern-0', 'pattern-1', 'pattern-2']); }); it('silently drops patterns whose origin is not in the projects axis', () => { @@ -238,7 +238,7 @@ describe('buildTransferMatrix', () => { }; const m = buildTransferMatrix(PROJECTS, [strayDest]); // The known destination counts; the ghost doesn't. - expect(m.vestige['api-gateway'].count).toBe(1); + expect(m.vestige.api-gateway.count).toBe(1); expect((m.vestige as Record)['ghost-project']).toBeUndefined(); }); @@ -260,7 +260,7 @@ describe('buildTransferMatrix', () => { }, ]; const m = buildTransferMatrix(['vestige', 'api-gateway'], pats, 1); - expect(m.vestige['api-gateway'].topNames).toEqual(['a']); + expect(m.vestige.api-gateway.topNames).toEqual(['a']); }); }); diff --git a/apps/dashboard/src/lib/components/blackbox-helpers.ts b/apps/dashboard/src/lib/components/blackbox-helpers.ts deleted file mode 100644 index 908d880..0000000 --- a/apps/dashboard/src/lib/components/blackbox-helpers.ts +++ /dev/null @@ -1,134 +0,0 @@ -// ═══════════════════════════════════════════════════════════════════════════ -// AGENT BLACK BOX — presentation helpers -// ─────────────────────────────────────────────────────────────────────────── -// Pure functions that turn a raw `TraceEvent` into the label, color, glyph, -// and one-line summary the Black Box timeline renders. Kept out of the -// component so they are unit-testable and reused by the Proof Mode header. -// ═══════════════════════════════════════════════════════════════════════════ -import type { TraceEvent } from '$lib/stores/api'; - -export type TraceKind = TraceEvent['type']; - -/** The accent color for each trace-event kind (CSS color value). */ -export function eventColor(kind: TraceKind): string { - switch (kind) { - case 'mcp.call': - return 'var(--color-synapse-glow, #818cf8)'; - case 'memory.retrieve': - return 'var(--color-recall, #10b981)'; - case 'memory.suppress': - return '#a78bfa'; // violet — the forgetting hue - case 'memory.write': - return '#38bdf8'; // sky — a new write - case 'contradiction.detected': - return '#fb7185'; // rose — tension - case 'sanhedrin.veto': - return '#f43f5e'; // red — a block - case 'dream.patch': - return '#c084fc'; // purple — dream - default: - return 'var(--color-synapse, #6366f1)'; - } -} - -/** A short human label for each kind. */ -export function eventLabel(kind: TraceKind): string { - switch (kind) { - case 'mcp.call': - return 'Tool Call'; - case 'memory.retrieve': - return 'Retrieved'; - case 'memory.suppress': - return 'Suppressed'; - case 'memory.write': - return 'Wrote'; - case 'contradiction.detected': - return 'Contradiction'; - case 'sanhedrin.veto': - return 'Veto'; - case 'dream.patch': - return 'Dream Patch'; - default: - return kind; - } -} - -/** A single glyph (emoji-free SVG path is overkill here; a compact symbol). */ -export function eventGlyph(kind: TraceKind): string { - switch (kind) { - case 'mcp.call': - return '⟐'; - case 'memory.retrieve': - return '◉'; - case 'memory.suppress': - return '⊘'; - case 'memory.write': - return '✎'; - case 'contradiction.detected': - return '⚡'; - case 'sanhedrin.veto': - return '⛔'; - case 'dream.patch': - return '☾'; - default: - return '•'; - } -} - -/** A one-line summary of what an event did, for the timeline row. */ -export function eventSummary(ev: TraceEvent): string { - switch (ev.type) { - case 'mcp.call': - return `${ev.tool} · args ${ev.argsHash.slice(0, 8)}`; - case 'memory.retrieve': - return `${ev.ids.length} ${ev.ids.length === 1 ? 'memory' : 'memories'} surfaced`; - case 'memory.suppress': - return `${ev.id.slice(0, 8)} — ${ev.reason.replace('_', ' ')}`; - case 'memory.write': - return `${ev.id.slice(0, 8)} — ${ev.source}`; - case 'contradiction.detected': - return ev.detail; - case 'sanhedrin.veto': - return `"${ev.claim}" (conf ${(ev.confidence * 100).toFixed(0)}%)`; - case 'dream.patch': - return `${ev.proposalIds.length} consolidation proposal(s)`; - default: - return ''; - } -} - -/** The memory ids an event touched (for graph-pulse replay). */ -export function eventMemoryIds(ev: TraceEvent): string[] { - switch (ev.type) { - case 'memory.retrieve': - return ev.ids; - case 'memory.suppress': - case 'memory.write': - return [ev.id]; - case 'contradiction.detected': - return ev.ids; - case 'sanhedrin.veto': - return ev.evidenceIds; - case 'dream.patch': - return ev.proposalIds; - default: - return []; - } -} - -/** Format a millisecond timestamp as a clock time. */ -export function formatAt(at: number): string { - if (!Number.isFinite(at) || at <= 0) return '—'; - const d = new Date(at); - return d.toLocaleTimeString(undefined, { - hour12: false, - hour: '2-digit', - minute: '2-digit', - second: '2-digit' - }); -} - -/** Elapsed milliseconds of an event relative to the run's first event. */ -export function relativeMs(at: number, startAt: number): number { - return Math.max(0, at - startAt); -} diff --git a/apps/dashboard/src/lib/graph/cinema/__tests__/auteur.test.ts b/apps/dashboard/src/lib/graph/cinema/__tests__/auteur.test.ts deleted file mode 100644 index d8fa1aa..0000000 --- a/apps/dashboard/src/lib/graph/cinema/__tests__/auteur.test.ts +++ /dev/null @@ -1,204 +0,0 @@ -import { describe, it, expect, beforeEach } from 'vitest'; -import { planShotsDeterministic, resolveShots, SHOT_DEFAULTS, type DirectorPlan } from '../auteur'; -import { planCinemaPath } from '../pathfinder'; -import { computeSignals } from '../topology'; -import { makeNode, makeEdge, resetNodeCounter } from '../../__tests__/helpers'; - -describe('auteur — carry-forward shot resolution', () => { - beforeEach(() => resetNodeCounter()); - - function smallPath() { - const a = makeNode({ id: 'a' }); - const b = makeNode({ id: 'b' }); - const c = makeNode({ id: 'c' }); - const edges = [makeEdge('a', 'b', { weight: 0.8 }), makeEdge('b', 'c', { weight: 0.6 })]; - return { path: planCinemaPath([a, b, c], edges, 'a'), nodes: [a, b, c], edges }; - } - - it('fills EVERY axis from a one-field shot, defaulting to today constants', () => { - const { path } = smallPath(); - const plan: DirectorPlan = { - source: 'backend-llm', - logline: 'x', - arc: 'flat', - shots: [{ nodeId: 'a', move: 'orbit', why: 'test' }], - }; - const resolved = resolveShots(plan, path); - expect(resolved).toHaveLength(path.beats.length); - // The specified field is honored… - expect(resolved[0].move).toBe('orbit'); - // …and every other axis is a real default, never undefined. - expect(resolved[0].standoff).toBe(SHOT_DEFAULTS.standoff); - expect(resolved[0].flightSeconds).toBe(SHOT_DEFAULTS.flightSeconds); - expect(resolved[0].angle).toBe('eye'); - for (const s of resolved) { - for (const k of Object.keys(SHOT_DEFAULTS) as (keyof typeof SHOT_DEFAULTS)[]) { - expect(s[k]).toBeDefined(); - } - expect(typeof s.why).toBe('string'); - expect(s.why.length).toBeGreaterThan(0); - } - }); - - it('carries non-cut axes forward to subsequent beats', () => { - const { path } = smallPath(); - const plan: DirectorPlan = { - source: 'backend-llm', - logline: 'x', - arc: 'flat', - // Only the FIRST beat sets standoff; later beats should inherit it. - shots: [{ nodeId: path.beats[0].nodeId, standoff: 41, why: 'set' }], - }; - const resolved = resolveShots(plan, path); - expect(resolved[0].standoff).toBe(41); - expect(resolved[resolved.length - 1].standoff).toBe(41); // carried forward - }); - - it('cut never carries forward — defaults to fly each beat', () => { - const { path } = smallPath(); - const plan: DirectorPlan = { - source: 'backend-llm', - logline: 'x', - arc: 'flat', - shots: [{ nodeId: path.beats[0].nodeId, cut: 'hard_cut', why: 'cut' }], - }; - const resolved = resolveShots(plan, path); - expect(resolved[0].cut).toBe('hard_cut'); - if (resolved.length > 1) expect(resolved[1].cut).toBe('fly'); - }); - - it('back-fills garbage / out-of-range LLM fields from defaults', () => { - const { path } = smallPath(); - const plan = { - source: 'backend-llm', - logline: 'x', - arc: 'flat', - shots: [ - { - nodeId: path.beats[0].nodeId, - move: 'teleport', // invalid enum - standoff: 9999, // out of range - dwellSeconds: -5, // out of range - why: '', - }, - ], - } as unknown as DirectorPlan; - const resolved = resolveShots(plan, path); - expect(resolved[0].move).toBe(SHOT_DEFAULTS.move); // invalid → default - expect(resolved[0].standoff).toBeLessThanOrEqual(90); // clamped - expect(resolved[0].dwellSeconds).toBeGreaterThanOrEqual(0.6); // clamped - expect(resolved[0].why.length).toBeGreaterThan(0); // empty why → fallback - }); - - it('a null plan still yields one default shot per beat', () => { - const { path } = smallPath(); - const resolved = resolveShots(null, path); - expect(resolved).toHaveLength(path.beats.length); - expect(resolved[0].move).toBe(SHOT_DEFAULTS.move); - }); -}); - -describe('auteur — deterministic director', () => { - beforeEach(() => resetNodeCounter()); - - it('produces a valid plan: one grounded shot per beat, every why non-empty, every nodeId real', () => { - const nodes = Array.from({ length: 8 }, (_, i) => makeNode({ id: `n${i}` })); - const edges = [ - makeEdge('n0', 'n1', { weight: 0.9 }), - makeEdge('n1', 'n2', { weight: 0.2, type: 'contradiction' }), - makeEdge('n0', 'n3', { weight: 0.5 }), - makeEdge('n3', 'n4', { weight: 0.7 }), - ]; - const path = planCinemaPath(nodes, edges, 'n0'); - const signals = computeSignals(nodes, edges); - const plan = planShotsDeterministic(path, signals); - const realIds = new Set(nodes.map((n) => n.id)); - expect(plan.shots).toHaveLength(path.beats.length); - for (const s of plan.shots) { - expect(realIds.has(s.nodeId)).toBe(true); - expect(s.why && s.why.length).toBeGreaterThan(0); - } - expect(plan.source).toBe('deterministic'); - expect(plan.logline.length).toBeGreaterThan(0); - }); - - it('directs a contradiction beat as a Dutch hard-cut crimson collision', () => { - const a = makeNode({ id: 'a' }); - const normal = makeNode({ id: 'normal' }); - const conflict = makeNode({ id: 'conflict' }); - const edges = [ - makeEdge('a', 'normal', { weight: 0.95 }), - makeEdge('a', 'conflict', { weight: 0.2, type: 'contradiction' }), - ]; - const path = planCinemaPath([a, normal, conflict], edges, 'a'); - const signals = computeSignals([a, normal, conflict], edges); - const plan = planShotsDeterministic(path, signals); - const contradictionShot = plan.shots.find((_, i) => path.beats[i].kind === 'contradiction'); - expect(contradictionShot).toBeDefined(); - expect(contradictionShot!.stormMode).toBe('contradiction'); - expect(contradictionShot!.cut).toBe('hard_cut'); - expect(contradictionShot!.dutch).toBeGreaterThan(0); - expect(contradictionShot!.scoreCue).toBe('minor_drop'); - }); - - it('ends on a crane pull-back with a major resolve', () => { - const nodes = Array.from({ length: 5 }, (_, i) => makeNode({ id: `m${i}` })); - const edges = nodes.slice(1).map((n, i) => makeEdge(`m${i}`, n.id, { weight: 0.6 })); - const path = planCinemaPath(nodes, edges, 'm0'); - const signals = computeSignals(nodes, edges); - const plan = planShotsDeterministic(path, signals); - const last = plan.shots[plan.shots.length - 1]; - expect(last.move).toBe('crane'); - expect(last.scoreCue).toBe('major_resolve'); - }); - - it('is deterministic — same inputs yield the same plan', () => { - const nodes = Array.from({ length: 6 }, (_, i) => makeNode({ id: `d${i}` })); - const edges = [makeEdge('d0', 'd1', { weight: 0.8 }), makeEdge('d1', 'd2', { weight: 0.5 })]; - const path = planCinemaPath(nodes, edges, 'd0'); - const sig = computeSignals(nodes, edges); - const p1 = planShotsDeterministic(path, sig); - const p2 = planShotsDeterministic(path, sig); - expect(p1.shots.map((s) => s.move)).toEqual(p2.shots.map((s) => s.move)); - expect(p1.logline).toBe(p2.logline); - }); -}); - -describe('topology — graph signals', () => { - beforeEach(() => resetNodeCounter()); - - it('computes betweenness, clusters, and peak keystone on a real shape', () => { - // Two clusters bridged by 'hub' → hub has the highest betweenness. - const hub = makeNode({ id: 'hub' }); - const l1 = makeNode({ id: 'l1' }); - const l2 = makeNode({ id: 'l2' }); - const r1 = makeNode({ id: 'r1' }); - const r2 = makeNode({ id: 'r2' }); - const edges = [ - makeEdge('l1', 'l2'), - makeEdge('l2', 'hub'), - makeEdge('hub', 'r1'), - makeEdge('r1', 'r2'), - ]; - const sig = computeSignals([hub, l1, l2, r1, r2], edges); - expect(sig.peakBetweennessId).toBe('hub'); - expect(sig.nodes.get('hub')!.betweenness).toBeGreaterThan(sig.nodes.get('l1')!.betweenness); - expect(sig.clusterCount).toBe(1); // all connected through hub - // All signals are finite and in range. - for (const s of sig.nodes.values()) { - expect(s.betweenness).toBeGreaterThanOrEqual(0); - expect(s.betweenness).toBeLessThanOrEqual(1); - expect(Number.isFinite(s.recencyRank)).toBe(true); - } - }); - - it('flags contradiction edges and computes surprise in range', () => { - const a = makeNode({ id: 'a' }); - const b = makeNode({ id: 'b' }); - const edges = [makeEdge('a', 'b', { weight: 0.1, type: 'contradiction' })]; - const sig = computeSignals([a, b], edges); - expect(sig.edges[0].isContradiction).toBe(true); - expect(sig.edges[0].surprise).toBeGreaterThanOrEqual(0); - expect(sig.edges[0].surprise).toBeLessThanOrEqual(1); - }); -}); diff --git a/apps/dashboard/src/lib/graph/cinema/__tests__/pathfinder.test.ts b/apps/dashboard/src/lib/graph/cinema/__tests__/pathfinder.test.ts deleted file mode 100644 index 40aeef6..0000000 --- a/apps/dashboard/src/lib/graph/cinema/__tests__/pathfinder.test.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { describe, it, expect, beforeEach } from 'vitest'; -import { planCinemaPath } from '../pathfinder'; -import { makeNode, makeEdge, resetNodeCounter } from '../../__tests__/helpers'; - -describe('planCinemaPath', () => { - beforeEach(() => resetNodeCounter()); - - it('returns an empty path for no nodes', () => { - const path = planCinemaPath([], [], 'missing'); - expect(path.beats).toEqual([]); - expect(path.flowEdges).toEqual([]); - }); - - it('starts at the requested center when it exists', () => { - const a = makeNode({ id: 'a' }); - const b = makeNode({ id: 'b' }); - const path = planCinemaPath([a, b], [makeEdge('a', 'b')], 'a'); - expect(path.beats[0].nodeId).toBe('a'); - expect(path.beats[0].kind).toBe('origin'); - expect(path.beats[0].viaEdge).toBeNull(); - }); - - it('falls back to the most-connected node when center is missing', () => { - const hub = makeNode({ id: 'hub' }); - const x = makeNode({ id: 'x' }); - const y = makeNode({ id: 'y' }); - const path = planCinemaPath( - [x, hub, y], - [makeEdge('hub', 'x'), makeEdge('hub', 'y')], - 'does-not-exist' - ); - expect(path.beats[0].nodeId).toBe('hub'); - }); - - it('visits the strongest-weighted connection first', () => { - const a = makeNode({ id: 'a' }); - const weak = makeNode({ id: 'weak' }); - const strong = makeNode({ id: 'strong' }); - const path = planCinemaPath( - [a, weak, strong], - [makeEdge('a', 'weak', { weight: 0.1 }), makeEdge('a', 'strong', { weight: 0.9 })], - 'a' - ); - expect(path.beats[1].nodeId).toBe('strong'); - expect(path.beats[1].kind).toBe('connection'); - }); - - it('detours through a contradiction edge when reachable', () => { - const a = makeNode({ id: 'a' }); - const normal = makeNode({ id: 'normal' }); - const conflict = makeNode({ id: 'conflict' }); - const path = planCinemaPath( - [a, normal, conflict], - [ - makeEdge('a', 'normal', { weight: 0.95, type: 'semantic' }), - makeEdge('a', 'conflict', { weight: 0.2, type: 'contradiction' }), - ], - 'a' - ); - const kinds = path.beats.map((b) => b.kind); - expect(kinds).toContain('contradiction'); - // The contradiction beat carries max intensity. - const c = path.beats.find((b) => b.kind === 'contradiction'); - expect(c?.intensity).toBe(1); - }); - - it('never exceeds maxBeats and never repeats a node', () => { - const nodes = Array.from({ length: 20 }, (_, i) => makeNode({ id: `n${i}` })); - const edges = nodes.slice(1).map((n) => makeEdge('n0', n.id, { weight: Math.random() })); - const path = planCinemaPath(nodes, edges, 'n0', 5); - expect(path.beats.length).toBeLessThanOrEqual(5); - const ids = path.beats.map((b) => b.nodeId); - expect(new Set(ids).size).toBe(ids.length); - }); - - it('is deterministic — same inputs yield the same path', () => { - const nodes = [makeNode({ id: 'a' }), makeNode({ id: 'b' }), makeNode({ id: 'c' })]; - const edges = [makeEdge('a', 'b', { weight: 0.8 }), makeEdge('b', 'c', { weight: 0.6 })]; - const p1 = planCinemaPath(nodes, edges, 'a'); - const p2 = planCinemaPath(nodes, edges, 'a'); - expect(p1.beats.map((b) => b.nodeId)).toEqual(p2.beats.map((b) => b.nodeId)); - }); - - it('records flowEdges for each traversed connection', () => { - const a = makeNode({ id: 'a' }); - const b = makeNode({ id: 'b' }); - const path = planCinemaPath([a, b], [makeEdge('a', 'b', { weight: 0.7 })], 'a'); - expect(path.flowEdges.length).toBeGreaterThanOrEqual(1); - expect(path.flowEdges[0].source === 'a' || path.flowEdges[0].target === 'a').toBe(true); - }); -}); diff --git a/apps/dashboard/src/lib/graph/cinema/auteur.ts b/apps/dashboard/src/lib/graph/cinema/auteur.ts deleted file mode 100644 index e2334bf..0000000 --- a/apps/dashboard/src/lib/graph/cinema/auteur.ts +++ /dev/null @@ -1,223 +0,0 @@ -// The Auteur — the director's brain + the typed shot-plan contract. -// -// The LLM (Tier 1) or the deterministic rule table (Tier 2) produces a -// DirectorPlan: a sequence of cinematographic Shots, one per CinemaBeat, each -// grounded in a real node and justified by a real graph metric. The camera -// runtime (director.ts) executes it. Carry-forward semantics mean a sparse or -// half-hallucinated plan ALWAYS resolves to a coherent film — the same -// robustness pattern as narrator.resolveNarration. - -import type { CinemaPath, CinemaBeat } from './pathfinder'; -import type { GraphSignals } from './topology'; - -// ── Camera grammar (string unions keep LLM output validatable) ─────────────── -export type Move = 'push_in' | 'pull_back' | 'orbit' | 'crane' | 'whip_pan' | 'rack_focus' | 'hold'; -export type Angle = 'eye' | 'low' | 'high'; // low = look up (power); high = look down (decay) -export type Cut = 'fly' | 'hard_cut' | 'match_cut'; -export type StormMode = 'anchor' | 'connection' | 'contradiction' | 'surprise'; -export type CaptionTone = 'curious' | 'tense' | 'resolved' | 'awe' | 'neutral'; -export type ScoreCue = 'motif' | 'minor_drop' | 'major_resolve' | 'silence'; -export type Act = 'I' | 'II' | 'III'; -export type EmotionalArc = 'man_in_hole' | 'rags_to_riches' | 'icarus' | 'cinderella' | 'oedipus' | 'flat'; -export type DirectorSource = 'backend-llm' | 'on-device' | 'deterministic'; - -/** A directed shot. Only axes that CHANGE need be set — the rest carry forward - * from the previous resolved shot (ultimate default = today's camera constants). */ -export interface Shot { - nodeId: string; // MUST cite a real node (alignment key + grounding constraint) - move?: Move; - angle?: Angle; - dutch?: number; // camera roll, radians, 0..~0.5 - standoff?: number; // world units - flightSeconds?: number; - dwellSeconds?: number; - halflife?: number; // spring smoothing; 0 = jump-cut - cut?: Cut; - stormMode?: StormMode; - intensity?: number; // 0..1 → scales the ignition spike - tension?: number; // 0..1 master scalar - act?: Act; - tone?: CaptionTone; - scoreCue?: ScoreCue; - why: string; // REQUIRED: cites the real metric driving this shot - viaEdgeKey?: string; // `${source}->${target}` for two-node framing -} - -export interface DirectorPlan { - source: DirectorSource; - logline: string; - arc: EmotionalArc; - shots: Shot[]; -} - -/** Every axis filled after carry-forward — what the director reads each beat. */ -export type ResolvedShot = Required> & { viaEdgeKey?: string }; - -// Ultimate defaults — today's hardcoded camera constants, so a plan-less or -// fully-sparse run is byte-identical to the pre-Auteur camera. -export const SHOT_DEFAULTS: Omit = { - move: 'hold', - angle: 'eye', - dutch: 0, - standoff: 26, - flightSeconds: 2.4, - dwellSeconds: 3.2, - halflife: 0.35, - cut: 'fly', - stormMode: 'connection', - intensity: 0.7, - tension: 0.3, - act: 'I', - tone: 'neutral', - scoreCue: 'motif', -}; - -const MOVES: ReadonlySet = new Set(['push_in', 'pull_back', 'orbit', 'crane', 'whip_pan', 'rack_focus', 'hold']); -const ANGLES: ReadonlySet = new Set(['eye', 'low', 'high']); -const CUTS: ReadonlySet = new Set(['fly', 'hard_cut', 'match_cut']); -const STORM_MODES: ReadonlySet = new Set(['anchor', 'connection', 'contradiction', 'surprise']); -const TONES: ReadonlySet = new Set(['curious', 'tense', 'resolved', 'awe', 'neutral']); -const SCORE_CUES: ReadonlySet = new Set(['motif', 'minor_drop', 'major_resolve', 'silence']); -const ACTS: ReadonlySet = new Set(['I', 'II', 'III']); - -function num(v: unknown, lo: number, hi: number, fallback: number): number { - const n = typeof v === 'number' && Number.isFinite(v) ? v : NaN; - if (Number.isNaN(n)) return fallback; - return Math.max(lo, Math.min(hi, n)); -} -function pick(v: unknown, set: ReadonlySet, fallback: T): T { - return typeof v === 'string' && set.has(v as T) ? (v as T) : fallback; -} - -/** - * Resolve a DirectorPlan into one fully-specified ResolvedShot per beat. - * Aligns by nodeId; every unspecified/garbage axis is back-filled by carry-forward - * (previous shot → SHOT_DEFAULTS). A shot can NEVER be blank or invalid. - */ -export function resolveShots(plan: DirectorPlan | null, path: CinemaPath): ResolvedShot[] { - const byNode = new Map(); - for (const s of plan?.shots ?? []) { - if (s && typeof s.nodeId === 'string') byNode.set(s.nodeId, s); - } - const resolved: ResolvedShot[] = []; - let prev: ResolvedShot | null = null; - for (const beat of path.beats) { - const raw = byNode.get(beat.nodeId); - const base = prev ?? { ...SHOT_DEFAULTS, nodeId: beat.nodeId, why: '' }; - const shot: ResolvedShot = { - nodeId: beat.nodeId, - move: pick(raw?.move, MOVES, base.move), - angle: pick(raw?.angle, ANGLES, base.angle), - dutch: num(raw?.dutch, 0, 0.6, base.dutch), - standoff: num(raw?.standoff, 8, 90, base.standoff), - flightSeconds: num(raw?.flightSeconds, 0.4, 6, base.flightSeconds), - dwellSeconds: num(raw?.dwellSeconds, 0.6, 8, base.dwellSeconds), - halflife: num(raw?.halflife, 0, 1.5, base.halflife), - cut: pick(raw?.cut, CUTS, 'fly'), // cut never carries forward — default per beat - stormMode: pick(raw?.stormMode, STORM_MODES, base.stormMode), - intensity: num(raw?.intensity, 0, 1, base.intensity), - tension: num(raw?.tension, 0, 1, base.tension), - act: pick(raw?.act, ACTS, base.act), - tone: pick(raw?.tone, TONES, base.tone), - scoreCue: pick(raw?.scoreCue, SCORE_CUES, 'motif'), - why: typeof raw?.why === 'string' && raw.why.trim() ? raw.why : base.why || 'establishing shot', - viaEdgeKey: typeof raw?.viaEdgeKey === 'string' ? raw.viaEdgeKey : undefined, - }; - resolved.push(shot); - prev = shot; - } - return resolved; -} - -// ── The deterministic auteur (Tier 2) ──────────────────────────────────────── -// The graph-metric → shot-grammar rule table. This SAME table is handed to the -// LLM as its system prompt (see directorSystemPrompt), so Tier-1 output is -// directly comparable to and back-fillable against this baseline. - -function actFor(progress: number): Act { - return progress < 0.34 ? 'I' : progress < 0.72 ? 'II' : 'III'; -} - -/** - * Produce a cinematic DirectorPlan from pure graph signals — no LLM. This alone - * ships the hero film: every shot is grounded and justified by a real metric. - */ -export function planShotsDeterministic(path: CinemaPath, signals: GraphSignals): DirectorPlan { - const n = path.beats.length; - const shots: Shot[] = path.beats.map((beat, i) => { - const progress = n > 1 ? i / (n - 1) : 0; - const act = actFor(progress); - const sig = signals.nodes.get(beat.nodeId); - const isPeak = beat.nodeId === signals.peakBetweennessId; - const isFinale = i === n - 1; - const isOrigin = i === 0; - - // Default shot for a plain connection beat. - let shot: Shot = { - nodeId: beat.nodeId, - move: 'push_in', - angle: 'eye', - cut: 'fly', - stormMode: 'connection', - tone: 'curious', - scoreCue: 'motif', - act, - intensity: 0.6, - tension: 0.3, - why: 'a connected memory', - }; - - if (isOrigin) { - shot = { ...shot, move: 'push_in', tone: 'curious', tension: 0.25, stormMode: 'anchor', why: 'opening on the focal memory' }; - } - // High-betweenness keystone → reverent low-angle slow orbit. - if (isPeak || (sig && sig.betweenness > 0.6)) { - shot = { ...shot, move: 'orbit', angle: 'low', stormMode: 'anchor', intensity: 0.75, tension: 0.45, tone: 'awe', why: 'low-angle orbit — the most load-bearing memory in the graph' }; - } - // Contradiction → Dutch push-in, hard cut, crimson chaos, minor drop. - if (beat.kind === 'contradiction') { - shot = { ...shot, move: 'push_in', angle: 'eye', dutch: 0.28, cut: 'hard_cut', stormMode: 'contradiction', intensity: 1, tension: 0.95, tone: 'tense', scoreCue: 'minor_drop', viaEdgeKey: beat.viaEdge ? `${beat.viaEdge.source}->${beat.viaEdge.target}` : undefined, why: 'two memories in tension — a Dutch two-shot collision' }; - } - // Surprise edge → gold/violet convergence, rising awe. - if (beat.kind === 'surprise') { - shot = { ...shot, move: 'orbit', stormMode: 'surprise', intensity: 0.85, tension: 0.6, tone: 'awe', scoreCue: 'motif', why: 'a surprising, distant-but-plausible connection' }; - } - // Fading memory → drifting high angle. - if (sig && (sig.retention < 0.35 || sig.suppression > 0.5)) { - shot = { ...shot, angle: 'high', move: 'pull_back', tone: 'neutral', intensity: 0.4, why: 'a fading memory — high-angle drift' }; - } - // Recent → the "now" beat. - if (beat.kind === 'recent') { - shot = { ...shot, move: 'push_in', tone: 'resolved', tension: 0.4, why: 'where the memory is now' }; - } - // Finale → crane pull-back, major resolve. - if (isFinale) { - shot = { ...shot, move: 'crane', cut: 'fly', stormMode: 'anchor', tone: 'awe', tension: 0.5, scoreCue: 'major_resolve', why: 'crane pull-back over the whole cluster — resolution' }; - } - return shot; - }); - - const arc: EmotionalArc = path.beats.some((b) => b.kind === 'contradiction') ? 'man_in_hole' : 'rags_to_riches'; - const originLabel = path.beats[0]?.node.label ?? 'a memory'; - const logline = `A short film about ${originLabel} — ${n} shots through the graph${arc === 'man_in_hole' ? ', through a contradiction and out the other side' : ''}.`; - - return { source: 'deterministic', logline, arc, shots }; -} - -/** The rule table as an LLM system prompt — keeps Tier-1 output comparable to - * the Tier-2 baseline (and thus back-fillable by resolveShots). */ -export function directorSystemPrompt(): string { - return [ - 'You are a film director shooting a short documentary about an AI\'s own memory graph.', - 'Output a DirectorPlan: a logline, an emotional arc, and one shot per beat.', - 'Each shot MUST cite a real nodeId and a real "why" referencing a graph metric.', - 'Grammar → meaning:', - '- high betweenness (load-bearing memory) → low-angle slow orbit, reverent', - '- contradiction edge → Dutch angle + push_in + hard_cut + crimson storm + minor_drop score', - '- surprising distant link → gold/violet orbit→stream convergence + awe', - '- merge/supersede → match_cut at identical standoff+angle (same idea)', - '- low retention / high suppression → high-angle drift (fading)', - '- finale → crane pull_back + major_resolve', - 'Build a real emotional arc across acts I→II→III. Only specify axes that change.', - ].join('\n'); -} diff --git a/apps/dashboard/src/lib/graph/cinema/director.ts b/apps/dashboard/src/lib/graph/cinema/director.ts deleted file mode 100644 index 0891169..0000000 --- a/apps/dashboard/src/lib/graph/cinema/director.ts +++ /dev/null @@ -1,285 +0,0 @@ -// Memory Cinema — the camera director. -// -// Drives a smooth, cinematic camera flight through a planned CinemaPath. Pure -// choreography: it mutates a THREE.PerspectiveCamera + an OrbitControls-like -// target each frame and emits beat-arrival callbacks the narrator + sandbox -// hook into. It knows nothing about which renderer (WebGL/WebGPU) is on screen, -// so it works identically for the legacy graph and the WebGPU sandbox. -// -// Respects prefers-reduced-motion: when reduced, it JUMP-CUTS between beats -// (instant position, dwell, advance) instead of flying — captions still fire. - -import * as THREE from 'three'; -import type { CinemaPath, CinemaBeat } from './pathfinder'; -import type { ResolvedShot } from './auteur'; - -export interface DirectorCallbacks { - /** Fired once when the camera arrives at (or cuts to) a beat. The resolved - * shot for the beat is passed so consumers can drive storm/score/captions. */ - onBeat?: (beat: CinemaBeat, index: number, shot: ResolvedShot | null) => void; - /** Fired when the whole tour finishes. */ - onComplete?: () => void; - /** Fired every frame with overall progress 0..1 (for a scrubber/progress bar). */ - onProgress?: (t: number) => void; -} - -export interface DirectorOptions { - /** Seconds of camera flight between consecutive beats. */ - flightSeconds?: number; - /** Seconds the camera dwells on each beat before advancing. */ - dwellSeconds?: number; - /** Stand-off distance from the focused node, in world units. */ - standoff?: number; - /** Instant cuts instead of flights (prefers-reduced-motion). */ - reducedMotion?: boolean; - /** Optional per-beat director's plan (one ResolvedShot per beat, aligned by - * index). When ABSENT the camera behaves byte-identically to the pre-Auteur - * director — every value falls back to the constants above. When present, - * each shot's move/angle/dutch/standoff/flight/dwell/cut directs that beat. */ - shots?: ResolvedShot[]; - /** When true, the camera frames the WORLD ORIGIN every shot (the WebGPU storm - * is pinned there) instead of flying out to scattered node positions — so the - * subject is ALWAYS centered and can never fly off-screen. Camera variety - * comes purely from angle/standoff/orbit. Used by the WebGPU sandbox path. */ - centerOnOrigin?: boolean; -} - -type Phase = 'idle' | 'flying' | 'dwelling' | 'done'; - -const _tmpDir = new THREE.Vector3(); -const _tmpUp = new THREE.Vector3(0, 1, 0); -const _origin = new THREE.Vector3(0, 0, 0); - -export class CinemaDirector { - private camera: THREE.PerspectiveCamera; - private target: THREE.Vector3; - private positions: Map; - private path: CinemaPath; - private cb: DirectorCallbacks; - private opts: Required; - - private phase: Phase = 'idle'; - private beatIndex = 0; - private phaseElapsed = 0; - - // Flight interpolation endpoints. - private fromPos = new THREE.Vector3(); - private toPos = new THREE.Vector3(); - private fromTarget = new THREE.Vector3(); - private toTarget = new THREE.Vector3(); - - constructor( - camera: THREE.PerspectiveCamera, - target: THREE.Vector3, - positions: Map, - path: CinemaPath, - cb: DirectorCallbacks = {}, - opts: DirectorOptions = {} - ) { - this.camera = camera; - this.target = target; - this.positions = positions; - this.path = path; - this.cb = cb; - this.opts = { - flightSeconds: opts.flightSeconds ?? 2.4, - dwellSeconds: opts.dwellSeconds ?? 3.2, - standoff: opts.standoff ?? 26, - reducedMotion: opts.reducedMotion ?? false, - shots: opts.shots ?? [], - centerOnOrigin: opts.centerOnOrigin ?? false, - }; - } - - /** The resolved shot directing a beat, or null when no plan was supplied - * (→ the camera uses the constant defaults = pre-Auteur behavior). */ - private shotAt(index: number): ResolvedShot | null { - return this.opts.shots[index] ?? null; - } - - /** Per-beat flight duration: the shot's value, else the global default. A - * hard/match cut has zero flight (handled in beginFlightTo). */ - private flightSecondsAt(index: number): number { - return this.shotAt(index)?.flightSeconds ?? this.opts.flightSeconds; - } - private dwellSecondsAt(index: number): number { - return this.shotAt(index)?.dwellSeconds ?? this.opts.dwellSeconds; - } - - get totalBeats(): number { - return this.path.beats.length; - } - - get isRunning(): boolean { - return this.phase !== 'idle' && this.phase !== 'done'; - } - - /** Begin the tour from the first beat. */ - start(): void { - if (this.path.beats.length === 0) { - this.phase = 'done'; - this.cb.onComplete?.(); - return; - } - this.beatIndex = 0; - this.beginFlightTo(0); - } - - stop(): void { - this.phase = 'done'; - } - - /** The focal point a beat frames: the world ORIGIN in centered mode (storm is - * pinned there), else the node's laid-out position. */ - private focalPoint(beat: CinemaBeat): THREE.Vector3 | null { - if (this.opts.centerOnOrigin) return _origin; - return this.positions.get(beat.nodeId) ?? null; - } - - /** Compute the camera stand-off position for a beat's focal point, directed by - * its shot (move / angle / standoff). With no shot, reproduces the original - * framing exactly: standoff = opts.standoff, +0.35 up-bias (filmic tilt). */ - private framePosition(beat: CinemaBeat, index: number, out: THREE.Vector3): THREE.Vector3 { - const nodePos = this.focalPoint(beat); - if (!nodePos) { - // Node has no resolved position yet — keep current framing. - return out.copy(this.camera.position); - } - const shot = this.shotAt(index); - - _tmpDir.copy(this.camera.position).sub(nodePos); - if (_tmpDir.lengthSq() < 1e-4) _tmpDir.set(0, 0.4, 1); - _tmpDir.normalize(); - - // Vertical bias = the camera angle. Default +0.35 (slightly above, the - // original filmic tilt). low = look UP at the node (power), high = look - // DOWN (decay/fading). - let upBias = 0.35; - if (shot) { - if (shot.angle === 'low') upBias = -0.45; - else if (shot.angle === 'high') upBias = 0.7; - } - _tmpDir.addScaledVector(_tmpUp, upBias).normalize(); - - // Stand-off = how close: push_in tightens, pull_back/crane widen. - let standoff = shot?.standoff ?? this.opts.standoff; - if (shot) { - if (shot.move === 'push_in') standoff *= 0.7; - else if (shot.move === 'pull_back') standoff *= 1.5; - else if (shot.move === 'crane') standoff *= 1.8; - } - // In centered (WebGPU storm) mode the subject is pinned to the origin and - // the sandbox clamps the camera to a far band. Keep the directed standoff - // INSIDE that band so the camera never fights the clamp (which read as an - // off-center jump) — variety here comes from angle + orbit, not distance. - if (this.opts.centerOnOrigin) standoff = Math.max(31, Math.min(43, standoff)); - return out.copy(nodePos).addScaledVector(_tmpDir, standoff); - } - - private beginFlightTo(index: number): void { - const beat = this.path.beats[index]; - const nodePos = this.focalPoint(beat); - const shot = this.shotAt(index); - - this.fromPos.copy(this.camera.position); - this.fromTarget.copy(this.target); - this.framePosition(beat, index, this.toPos); - this.toTarget.copy(nodePos ?? this.target); - this.phaseElapsed = 0; - - // A directed hard/match cut snaps instantly (like reduced-motion), so the - // editorial "cut" reads as an edit, not a fly. reduced-motion forces this - // for every beat regardless of shot. - const snap = this.opts.reducedMotion || shot?.cut === 'hard_cut' || shot?.cut === 'match_cut'; - if (snap) { - this.camera.position.copy(this.toPos); - this.target.copy(this.toTarget); - this.phase = 'dwelling'; - this.cb.onBeat?.(beat, index, shot); - } else { - this.phase = 'flying'; - } - } - - /** Advance the choreography. Call once per animation frame with delta seconds. */ - update(deltaSeconds: number): void { - if (this.phase === 'idle' || this.phase === 'done') return; - // Clamp dt so a tab-switch stall doesn't teleport the camera. - const dt = Math.max(0, Math.min(deltaSeconds, 0.05)); - this.phaseElapsed += dt; - - const flightSecs = this.flightSecondsAt(this.beatIndex); - const dwellSecs = this.dwellSecondsAt(this.beatIndex); - - if (this.phase === 'flying') { - const t = Math.min(1, this.phaseElapsed / flightSecs); - const e = easeInOutCubic(t); - this.camera.position.lerpVectors(this.fromPos, this.toPos, e); - this.target.lerpVectors(this.fromTarget, this.toTarget, e); - this.applyDutch(this.beatIndex, e); - if (t >= 1) { - this.phase = 'dwelling'; - this.phaseElapsed = 0; - this.cb.onBeat?.(this.path.beats[this.beatIndex], this.beatIndex, this.shotAt(this.beatIndex)); - } - } else if (this.phase === 'dwelling') { - if (!this.opts.reducedMotion) { - const nodePos = this.focalPoint(this.path.beats[this.beatIndex]); - if (nodePos) { - this.target.lerp(nodePos, 0.02); // gentle settle keeps the shot alive - // An orbit shot slowly revolves the camera around the node - // during the dwell — the signature "reverent" move for keystones. - if (this.shotAt(this.beatIndex)?.move === 'orbit') { - this.orbitAround(nodePos, dt * 0.35); - } - } - } - if (this.phaseElapsed >= dwellSecs) { - const nextIndex = this.beatIndex + 1; - if (nextIndex >= this.path.beats.length) { - this.phase = 'done'; - this.cb.onProgress?.(1); - this.cb.onComplete?.(); - return; - } - this.beatIndex = nextIndex; - this.beginFlightTo(nextIndex); - } - } - - // Overall progress across the whole tour (beat + intra-beat fraction). - // Guard against an empty path (per = 0) so progress can never be NaN. - const per = this.path.beats.length > 0 ? 1 / this.path.beats.length : 0; - const intra = - this.phase === 'flying' - ? Math.min(1, this.phaseElapsed / flightSecs) * 0.5 - : 0.5 + Math.min(1, this.phaseElapsed / dwellSecs) * 0.5; - this.cb.onProgress?.(Math.min(1, this.beatIndex * per + intra * per)); - } - - /** Revolve the camera around a node by `angle` radians (orbit shots). */ - private orbitAround(center: THREE.Vector3, angle: number): void { - _tmpDir.copy(this.camera.position).sub(center); - const cos = Math.cos(angle); - const sin = Math.sin(angle); - const x = _tmpDir.x * cos - _tmpDir.z * sin; - const z = _tmpDir.x * sin + _tmpDir.z * cos; - _tmpDir.x = x; - _tmpDir.z = z; - this.camera.position.copy(center).add(_tmpDir); - } - - /** Roll the camera (Dutch angle) toward the shot's target roll over the - * flight, easing back to upright for non-Dutch shots. */ - private applyDutch(index: number, t: number): void { - const targetRoll = this.shotAt(index)?.dutch ?? 0; - const roll = targetRoll * t; - // camera.up = rotate world-up around the camera's forward axis by `roll`. - _tmpDir.set(0, 0, -1).applyQuaternion(this.camera.quaternion); // forward - this.camera.up.set(0, 1, 0).applyAxisAngle(_tmpDir, roll); - } -} - -function easeInOutCubic(t: number): number { - return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2; -} diff --git a/apps/dashboard/src/lib/graph/cinema/narrator.ts b/apps/dashboard/src/lib/graph/cinema/narrator.ts deleted file mode 100644 index 7e3d429..0000000 --- a/apps/dashboard/src/lib/graph/cinema/narrator.ts +++ /dev/null @@ -1,148 +0,0 @@ -// Memory Cinema — narration tiers 1 & 2. -// -// Tier 1 (premium): a backend LLM endpoint (/api/narrative) authors rich prose -// from the planned path. Used only when the backend advertises it. -// Tier 2 (smart local default): deterministic, structured captions generated -// purely from the real node/edge data — no network, no LLM, instant. This is -// what the static HN demo and any backend-without-LLM setup uses. -// -// Tier 3 (the BFS camera engine in director.ts) always runs underneath; the -// narrator only decides what TEXT accompanies each beat. If everything here -// fails, captions fall back to Tier 2, which cannot fail. - -import type { CinemaBeat, CinemaPath } from './pathfinder'; - -export interface BeatNarration { - nodeId: string; - /** The caption shown + optionally spoken for this beat. */ - text: string; - /** Short label for the beat kind, shown as a chip. */ - chip: string; -} - -export type NarrationSource = 'backend-llm' | 'local-captions'; - -export interface CinemaNarration { - source: NarrationSource; - beats: BeatNarration[]; -} - -// `satisfies` makes the compiler error if a new CinemaBeat['kind'] is added -// without a chip here — closes the silent "undefined chip → blank UI" gap. -const KIND_CHIP = { - origin: 'Origin', - connection: 'Connection', - contradiction: 'Tension', - recent: 'Now', - bridge: 'Jump', - surprise: 'Surprise', -} satisfies Record; - -function snippet(content: string, max = 90): string { - const s = (content ?? '').replace(/\s+/g, ' ').trim(); - if (s.length <= max) return s; - return s.slice(0, max - 1).trimEnd() + '…'; -} - -function typeLabel(nodeType: string): string { - const t = (nodeType ?? 'memory').toLowerCase(); - return t.charAt(0).toUpperCase() + t.slice(1); -} - -/** - * Tier 2 — deterministic structured captions from real data only. - * Never throws; always returns a caption per beat. - */ -export function localCaptions(path: CinemaPath): CinemaNarration { - const beats: BeatNarration[] = path.beats.map((beat, i) => { - const n = beat.node; - const what = snippet(n.label || `(${typeLabel(n.type)} memory)`); - let text: string; - switch (beat.kind) { - case 'origin': - text = `We begin at a ${typeLabel(n.type).toLowerCase()} the graph is centered on — "${what}".`; - break; - case 'contradiction': { - const via = beat.viaEdge?.type ? beat.viaEdge.type.replace(/_/g, ' ') : 'a conflict'; - text = `This is held in tension with the last memory through ${via}: "${what}".`; - break; - } - case 'recent': - text = `And where the mind is now — a recent memory: "${what}".`; - break; - case 'bridge': - text = `Crossing to a separate cluster — "${what}".`; - break; - default: { - const w = beat.viaEdge?.weight ?? 0; - const strength = w > 0.66 ? 'strongly' : w > 0.33 ? 'closely' : 'loosely'; - text = `${strength} connected from there: a ${typeLabel(n.type).toLowerCase()} — "${what}".`; - } - } - // Tags add texture when present. - if (n.tags && n.tags.length > 0 && i > 0) { - text += ` [${n.tags.slice(0, 3).join(', ')}]`; - } - return { nodeId: beat.nodeId, text, chip: KIND_CHIP[beat.kind] }; - }); - return { source: 'local-captions', beats }; -} - -/** - * Resolve the best available narration for a path. - * - * @param fetchBackend optional async fn that returns backend-LLM narration - * beats (Tier 1). If it's absent, rejects, times out, or returns a mismatched - * shape, we silently fall back to Tier 2 local captions. The caller passes - * this only when the backend has advertised /api/narrative support. - */ -export async function resolveNarration( - path: CinemaPath, - fetchBackend?: () => Promise -): Promise { - const fallback = localCaptions(path); - if (!fetchBackend) return fallback; - - let timer: ReturnType | undefined; - try { - const backend = await Promise.race([ - fetchBackend(), - new Promise((resolve) => { - timer = setTimeout(() => resolve(null), 6000); - }), - ]); - - // Keep only well-formed backend beats (guards against null/empty/garbage - // entries that would otherwise produce blank captions mid-tour). - const valid = Array.isArray(backend) - ? backend.filter( - (b): b is BeatNarration => - !!b && typeof b.nodeId === 'string' && typeof b.text === 'string' && b.text.trim().length > 0 - ) - : []; - if (valid.length === 0) return fallback; - - // Align backend beats to the real path by nodeId; fill any gap from the - // bounds-safe local caption so every beat always has text (never blank). - const byNode = new Map(valid.map((b) => [b.nodeId, b])); - const beats: BeatNarration[] = path.beats.map((beat, i) => { - const hit = byNode.get(beat.nodeId); - if (hit) { - const chip = typeof hit.chip === 'string' && hit.chip.trim() ? hit.chip : KIND_CHIP[beat.kind]; - return { nodeId: beat.nodeId, text: hit.text, chip }; - } - return ( - fallback.beats[i] ?? { - nodeId: beat.nodeId, - text: beat.node.label || '(unlabeled memory)', - chip: KIND_CHIP[beat.kind], - } - ); - }); - return { source: 'backend-llm', beats }; - } catch { - return fallback; - } finally { - if (timer) clearTimeout(timer); - } -} diff --git a/apps/dashboard/src/lib/graph/cinema/pathfinder.ts b/apps/dashboard/src/lib/graph/cinema/pathfinder.ts deleted file mode 100644 index 4e8a457..0000000 --- a/apps/dashboard/src/lib/graph/cinema/pathfinder.ts +++ /dev/null @@ -1,171 +0,0 @@ -// Memory Cinema — Tier 3: the bulletproof pathfinder. -// -// Plans a cinematic tour through the REAL memory graph using nothing but the -// nodes + edges the backend already returns. This is the deterministic engine -// that ALWAYS drives the camera, regardless of which narration tier (backend -// LLM / local captions / none) is active. No WebGPU, no network, no LLM — if -// everything else fails, this still produces a coherent, watchable flythrough. -// -// The path is intentionally a STORY, not a raw BFS dump: -// 1. start at the center (the memory the graph is focused on) -// 2. visit its strongest-weighted connections (what it's most tied to) -// 3. detour to a contradiction edge if one exists (tension = interesting) -// 4. end on a recently-created node (where the mind is now) -// Falling back to plain weighted BFS when those signals are absent. - -import type { GraphNode, GraphEdge } from '$types'; - -export interface CinemaBeat { - /** Node this beat centers the camera on. */ - nodeId: string; - /** The node payload, for the narrator + visuals. */ - node: GraphNode; - /** Edge traversed to arrive here (null for the opening beat). */ - viaEdge: GraphEdge | null; - /** Why this beat exists — drives the deterministic caption + visual emphasis. */ - kind: 'origin' | 'connection' | 'contradiction' | 'recent' | 'bridge' | 'surprise'; - /** 0..1 emphasis used by the sandbox to spike emissive/bloom on arrival. */ - intensity: number; -} - -export interface CinemaPath { - beats: CinemaBeat[]; - /** The node the requested centerId resolved to (which the tour actually - * starts from). May differ from the requested centerId when it was missing, - * in which case `pivoted` is true — callers can surface this if they care. */ - centerId: string; - /** True when the requested centerId did not exist and we picked a start node. */ - pivoted: boolean; - /** Edges that should visibly "flow" during the tour, in beat order. */ - flowEdges: GraphEdge[]; -} - -export interface Adjacency { - [nodeId: string]: { edge: GraphEdge; otherId: string }[]; -} - -export function buildAdjacency(edges: GraphEdge[]): Adjacency { - const adj: Adjacency = {}; - for (const edge of edges) { - (adj[edge.source] ??= []).push({ edge, otherId: edge.target }); - (adj[edge.target] ??= []).push({ edge, otherId: edge.source }); - } - // Strongest connections first so the tour visits the most meaningful ties. - for (const id of Object.keys(adj)) { - adj[id].sort((a, b) => (b.edge.weight ?? 0) - (a.edge.weight ?? 0)); - } - return adj; -} - -export function isContradictionEdge(edge: GraphEdge): boolean { - const t = (edge.type ?? '').toLowerCase(); - return t.includes('contradict') || t.includes('conflict') || t.includes('supersede'); -} - -export function recencyOf(node: GraphNode): number { - // Larger = more recent. Tolerates missing/invalid timestamps. - const t = Date.parse(node.updatedAt || node.createdAt || ''); - return Number.isFinite(t) ? t : 0; -} - -/** - * Plan a cinematic path over the real graph. - * - * @param maxBeats hard cap on tour length (keeps the flythrough watchable). - * Deterministic: same inputs always yield the same path (no randomness), so the - * recorded launch GIF is reproducible. - */ -export function planCinemaPath( - nodes: GraphNode[], - edges: GraphEdge[], - centerId: string, - maxBeats = 7 -): CinemaPath { - const byId = new Map(nodes.map((n) => [n.id, n])); - const empty: CinemaPath = { beats: [], centerId, pivoted: false, flowEdges: [] }; - if (nodes.length === 0) return empty; - - // Resolve a real starting node: prefer centerId, else the explicit center - // flag, else the most-connected node, else the first node. Track whether we - // had to pivot off the requested centerId so callers can surface it. - const adj = buildAdjacency(edges); - const requestedExists = byId.has(centerId); - let startId = requestedExists ? centerId : ''; - if (!startId) startId = nodes.find((n) => n.isCenter)?.id ?? ''; - if (!startId) { - startId = nodes - .map((n) => ({ id: n.id, deg: adj[n.id]?.length ?? 0 })) - .sort((a, b) => b.deg - a.deg)[0].id; - } - const start = byId.get(startId); - if (!start) return empty; - const pivoted = !requestedExists; - - const visited = new Set([startId]); - const beats: CinemaBeat[] = [ - { nodeId: startId, node: start, viaEdge: null, kind: 'origin', intensity: 1 }, - ]; - const flowEdges: GraphEdge[] = []; - - // Greedy weighted walk: from the current frontier, step to the strongest - // unvisited neighbour, with a one-time detour to a contradiction if reachable. - let current = startId; - let contradictionUsed = false; - - while (beats.length < maxBeats) { - const neighbours = adj[current] ?? []; - - // Prefer an unused contradiction edge once — tension makes a better story. - let next: { edge: GraphEdge; otherId: string } | undefined; - if (!contradictionUsed) { - next = neighbours.find((n) => !visited.has(n.otherId) && isContradictionEdge(n.edge)); - if (next) contradictionUsed = true; - } - // Otherwise the strongest unvisited tie. - if (!next) next = neighbours.find((n) => !visited.has(n.otherId)); - - // Dead end: hop to the most recent unvisited node anywhere (a "bridge" - // cut) so the tour can keep going instead of stalling. - if (!next) { - const remaining = nodes - .filter((n) => !visited.has(n.id)) - .sort((a, b) => recencyOf(b) - recencyOf(a)); - if (remaining.length === 0) break; - const node = remaining[0]; - visited.add(node.id); - beats.push({ nodeId: node.id, node, viaEdge: null, kind: 'bridge', intensity: 0.6 }); - current = node.id; - continue; - } - - const node = byId.get(next.otherId); - if (!node) { - visited.add(next.otherId); - continue; - } - visited.add(node.id); - flowEdges.push(next.edge); - beats.push({ - nodeId: node.id, - node, - viaEdge: next.edge, - kind: isContradictionEdge(next.edge) ? 'contradiction' : 'connection', - intensity: isContradictionEdge(next.edge) ? 1 : Math.min(1, 0.55 + (next.edge.weight ?? 0) * 0.45), - }); - current = node.id; - } - - // Closing beat: end on the single most-recent node not already the finale, - // so the tour lands on "where the memory is now". Only if it adds variety. - if (beats.length < maxBeats) { - const last = beats[beats.length - 1].nodeId; - const recent = nodes - .filter((n) => n.id !== last) - .sort((a, b) => recencyOf(b) - recencyOf(a))[0]; - if (recent && !beats.some((b) => b.nodeId === recent.id)) { - beats.push({ nodeId: recent.id, node: recent, viaEdge: null, kind: 'recent', intensity: 0.8 }); - } - } - - return { beats, centerId: startId, pivoted, flowEdges }; -} diff --git a/apps/dashboard/src/lib/graph/cinema/sandbox.ts b/apps/dashboard/src/lib/graph/cinema/sandbox.ts deleted file mode 100644 index fbc7fe1..0000000 --- a/apps/dashboard/src/lib/graph/cinema/sandbox.ts +++ /dev/null @@ -1,283 +0,0 @@ -// Memory Cinema — the isolated WebGPU sandbox. -// -// Boots a SEPARATE WebGPU canvas + scene on Cinema launch. The legacy WebGL -// graph (nebula, grain, every current user's experience) is never touched — -// zero regression by construction. Inside the sandbox: the SemanticComputeStorm -// + selective MRT emissive bloom, driven by the CinemaDirector's beats. -// -// Everything here is dynamically imported (three/webgpu, three/tsl, storm.ts) -// so the heavy WebGPU bundle stays out of the main app. If WebGPU is -// unavailable, isSupported() returns false and the caller falls back to the -// camera-only flythrough on the existing canvas (captions still play). - -import * as THREE from 'three'; -import type { SemanticRole, SemanticComputeStorm } from './storm'; - -// The storm lives at the world origin, permanently. The camera always looks here -// and is clamped to a safe distance band so the subject can never leave frame. -const ORIGIN = new THREE.Vector3(0, 0, 0); -// Keep the camera in a narrow, fairly FAR band so the contained storm always -// sits comfortably small and centered in frame (a closer camera makes the cloud -// fill — and spill past — the edges once the bloom halo is added). -const MIN_CAM_DIST = 30; -const MAX_CAM_DIST = 44; - -export function isWebGPUSupported(): boolean { - return typeof navigator !== 'undefined' && 'gpu' in navigator; -} - -interface SandboxDeps { - WebGPURenderer: new (params: object) => { - init: () => Promise; - setSize: (w: number, h: number) => void; - setPixelRatio: (r: number) => void; - renderAsync: (scene: THREE.Scene, camera: THREE.Camera) => Promise; - computeAsync: (node: unknown) => Promise; - domElement: HTMLCanvasElement; - dispose?: () => void; - }; - PostProcessing: new (renderer: unknown) => { renderAsync: () => Promise; outputNode: unknown }; - StormCtor: typeof SemanticComputeStorm; - tsl: typeof import('three/tsl'); - bloomMod: { bloom: (node: unknown, strength?: number, radius?: number, threshold?: number) => unknown }; -} - -export class CinemaSandbox { - private container: HTMLElement; - private deps!: SandboxDeps; - private renderer!: SandboxDeps['WebGPURenderer']['prototype']; - // Scene/camera are created in boot() from the three/webgpu module so every - // object handed to the WebGPU renderer comes from the SAME Three.js instance - // (avoids the "multiple instances of Three.js" incompatibility — the base - // three import is used only for the shared Vector3 math type the director - // mutates, which is identical across instances). - private scene!: THREE.Scene; - private camera!: THREE.PerspectiveCamera; - private storm!: SemanticComputeStorm; - private post: { renderAsync: () => Promise } | null = null; - private booted = false; - - /** Camera target the director drives; mirrored into camera.lookAt each frame. */ - readonly target = new THREE.Vector3(0, 0, 0); - - // FLYTHROUGH — when >0, relaxes the camera-distance clamp floor so the camera - // can plunge inside the shell, and the storm stretches sprites along the - // apparent motion vector. Camera velocity is derived per-frame from the - // position delta (one Vector3, no compute). 0 = no streak (reduced-motion). - private flythrough = 0; - private prevCamPos = new THREE.Vector3(); - private camVel = new THREE.Vector3(); - - constructor(container: HTMLElement) { - this.container = container; - } - - get cameraRef(): THREE.PerspectiveCamera { - return this.camera; - } - - /** - * Boot the WebGPU pipeline. Throws if WebGPU is unsupported or init fails — - * the caller treats a throw as "fall back to camera-only mode". - */ - async boot(): Promise { - if (this.booted) return; - if (!isWebGPUSupported()) throw new Error('WebGPU not supported'); - - // Dynamic imports keep three/webgpu out of the main bundle. - const webgpu = (await import('three/webgpu')) as unknown as { - WebGPURenderer: SandboxDeps['WebGPURenderer']; - PostProcessing: SandboxDeps['PostProcessing']; - Scene: new () => THREE.Scene; - PerspectiveCamera: new (fov: number, aspect: number, near: number, far: number) => THREE.PerspectiveCamera; - Color: new (hex: number) => THREE.Color; - }; - const tsl = (await import('three/tsl')) as typeof import('three/tsl'); - // bloom() lives in the TSL display helpers; import the node module. - const bloomMod = (await import( - 'three/examples/jsm/tsl/display/BloomNode.js' - )) as unknown as SandboxDeps['bloomMod']; - const { SemanticComputeStorm } = await import('./storm'); - - this.deps = { - WebGPURenderer: webgpu.WebGPURenderer, - PostProcessing: webgpu.PostProcessing, - StormCtor: SemanticComputeStorm, - tsl, - bloomMod, - }; - - // Fail loud if the dynamic import didn't yield the expected constructors, - // instead of a cryptic "undefined is not a constructor" later. - if (!webgpu.WebGPURenderer || !webgpu.Scene || !webgpu.PerspectiveCamera || !webgpu.Color) { - throw new Error('[cinema] three/webgpu is missing expected exports'); - } - - // Build scene + camera from the SAME (webgpu) module instance the - // renderer + storm use, so all objects are instance-compatible. - const w = Math.max(1, this.container.clientWidth); - const h = Math.max(1, this.container.clientHeight); - this.scene = new webgpu.Scene(); - this.scene.background = new webgpu.Color(0x02020a); - this.camera = new webgpu.PerspectiveCamera(60, w / h, 0.1, 2000); - this.camera.position.set(0, 18, 60); - - const renderer = new this.deps.WebGPURenderer({ antialias: true, alpha: false }); - renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)); - renderer.setSize(w, h); - // CRITICAL FOOTGUN: WebGPU init is async. Must await before first render - // or the canvas silently draws nothing. - await renderer.init(); - this.container.appendChild(renderer.domElement); - this.renderer = renderer; - - // The compute storm (150k GPU particles). - this.storm = new this.deps.StormCtor(renderer, this.scene, {}); - - // Selective MRT bloom: scene pass emits an emissive MRT; bloom only the - // emissive channel so the storm blazes against the void without washing - // the whole frame to grey. Falls back to a plain pass if MRT setup - // throws on a given driver. - try { - const { pass, mrt, output, emissive } = this.deps.tsl as unknown as { - pass: (s: THREE.Scene, c: THREE.Camera) => { - setMRT: (m: unknown) => void; - getTextureNode: (name: string) => unknown; - }; - mrt: (cfg: Record) => unknown; - output: unknown; - emissive: unknown; - }; - const scenePass = pass(this.scene, this.camera); - if (typeof scenePass?.setMRT !== 'function' || typeof scenePass?.getTextureNode !== 'function') { - throw new Error('three/tsl pass() API mismatch — setMRT/getTextureNode missing'); - } - scenePass.setMRT(mrt({ output, emissive })); - const outputTex = scenePass.getTextureNode('output'); - const emissiveTex = scenePass.getTextureNode('emissive'); - // Gentler bloom (strength 0.6, threshold 0.35) so it accents the bright - // cores instead of washing the whole colored cloud to white. - const bloomed = this.deps.bloomMod.bloom(emissiveTex, 0.6, 0.65, 0.35); - const post = new this.deps.PostProcessing(renderer); - (post as unknown as { outputNode: unknown }).outputNode = ( - outputTex as { add: (n: unknown) => unknown } - ).add(bloomed); - this.post = post as unknown as { renderAsync: () => Promise }; - } catch (e) { - // MRT/bloom unavailable on this driver — render straight, no crash. - console.warn('[cinema] selective bloom unavailable, rendering without MRT:', e); - this.post = null; - } - - this.booted = true; - } - - /** Retarget the storm's MODE/ignition for a beat. The storm is permanently - * centered at the WORLD ORIGIN (see render) so it is always dead-center in - * frame — worldPos here only conveys which node, not where the storm sits. - * `act` lets the storm hold Act I dimmer (it opens too hot otherwise). */ - transitionTo( - role: SemanticRole, - _worldPos: THREE.Vector3, - act: 'I' | 'II' | 'III' = 'II', - beatIndex = 99 - ): void { - if (!this.booted) return; - this.storm.transitionTo(role, ORIGIN, act, beatIndex); - } - - /** Fire one endless-dream beat — a random crazier figure + color blast. Called - * on a timer after the scripted tour ends so the storm never sits idle. */ - dreamBeat(): void { - if (!this.booted) return; - this.storm.dreamBeat(); - } - - /** Flythrough strength 0..1. Relaxes the clamp floor so the camera can dive - * inside the shell, and drives the storm's velocity-stretch streak. Set to 0 - * for reduced-motion (no streak, normal clamp). */ - setFlythrough(s: number): void { - this.flythrough = THREE.MathUtils.clamp(s, 0, 1); - if (this.booted) this.storm.setStreak(s); - } - - /** Pass-through: set the storm streak strength directly. */ - setStreak(s: number): void { - if (this.booted) this.storm.setStreak(s); - } - - /** Pass-through: push view-space camera velocity to the storm. */ - setCameraVel(v: THREE.Vector3): void { - if (this.booted) this.storm.setCameraVel(v); - } - - /** Render one frame. The storm is pinned to the origin and the camera always - * looks at the origin, so the storm CANNOT leave the frame. The director - * varies only the camera's orbital position/angle (set via cameraRef), and we - * clamp that to a safe distance band here as a final guarantee. */ - async render(deltaSeconds: number): Promise { - if (!this.booted) return; - - // Camera velocity (world units / sec) from the position delta this frame — - // one Vector3 subtract, no compute. Captured BEFORE the clamp so it tracks - // the director's intended move (the clamp only rescues runaway distances). - this.camVel.copy(this.camera.position).sub(this.prevCamPos).divideScalar(Math.max(deltaSeconds, 1e-3)); - this.prevCamPos.copy(this.camera.position); - - // Hard guarantee: clamp the camera into a distance band from origin so a - // runaway director move can never push the subject out of view, then look - // dead at the origin where the storm lives. Flythrough relaxes the floor - // toward 6 so the camera can plunge inside the shell; the MAX clamp stands. - const minDist = THREE.MathUtils.lerp(MIN_CAM_DIST, 6, this.flythrough); - const distToOrigin = this.camera.position.length(); - if (distToOrigin < minDist || distToOrigin > MAX_CAM_DIST || !Number.isFinite(distToOrigin)) { - const d = Math.min(MAX_CAM_DIST, Math.max(minDist, distToOrigin || MAX_CAM_DIST)); - if (distToOrigin > 1e-3) this.camera.position.setLength(d); - else this.camera.position.set(0, 12, d); - } - this.camera.lookAt(ORIGIN); - - // Push view-space apparent particle velocity to the storm (negated world - // camera velocity transformed into view space → the direction sprites - // appear to streak). matrixWorldInverse is the previous frame's (the - // renderer refreshes it during renderAsync below) — a one-frame lag that is - // imperceptible for a streak direction. - const camVelView = this.camVel - .clone() - .applyMatrix3(new THREE.Matrix3().setFromMatrix4(this.camera.matrixWorldInverse)) - .negate(); - this.storm.setCameraVel(camVelView); - - // Size the containment sphere to the camera's VERTICAL FOV at the origin - // (the limiting dimension on a landscape frame). 0.82 lets the storm fill - // most of the frame; the storm's internal shell sits well inside this and - // the hard boundary snap keeps the bloom halo from spilling past the edge. - const dist = this.camera.position.length(); - const vfov = (this.camera.fov * Math.PI) / 180; - const fitRadius = Math.tan(vfov / 2) * dist * 0.82; - this.storm.setContainRadius(fitRadius); - - await this.storm.update(deltaSeconds); - if (this.post) await this.post.renderAsync(); - else await this.renderer.renderAsync(this.scene, this.camera); - } - - resize(): void { - if (!this.booted) return; - const w = Math.max(1, this.container.clientWidth); - const h = Math.max(1, this.container.clientHeight); - this.camera.aspect = w / h; - this.camera.updateProjectionMatrix(); - this.renderer.setSize(w, h); - } - - dispose(): void { - if (!this.booted) return; - this.storm?.dispose(); - this.renderer?.dispose?.(); - if (this.renderer?.domElement?.parentNode) { - this.renderer.domElement.parentNode.removeChild(this.renderer.domElement); - } - this.booted = false; - } -} diff --git a/apps/dashboard/src/lib/graph/cinema/storm.ts b/apps/dashboard/src/lib/graph/cinema/storm.ts deleted file mode 100644 index 55caa26..0000000 --- a/apps/dashboard/src/lib/graph/cinema/storm.ts +++ /dev/null @@ -1,1006 +0,0 @@ -// Memory Cinema — the Semantic Compute Storm (WebGPU / TSL GPGPU). -// -// 150k particles whose physics run ENTIRELY on the GPU via Three Shading -// Language compute nodes. The storm shifts behaviour with the narrative beat: -// - origin/anchor → stable orbital swarm around the focused node -// - connection → fluid streaming toward the target with wave motion -// - contradiction → explosive Rössler strange-attractor chaos (crimson) -// Emissive colour is routed so only the storm blazes through the selective -// MRT bloom pass against a clean void. -// -// IMPORTANT — verified against the INSTALLED three@0.172 three/tsl build: -// * use select() (NOT cond — does not exist in this build) -// * use TSL sin()/cos() (NOT Math.sin inside Fn) -// * SpriteNodeMaterial (NOT SpritePointsMaterial) -// * renderer.computeAsync() for the dispatch -// The whole module is dynamically imported only when Cinema launches, so the -// heavy three/webgpu + three/tsl bundles never load for normal dashboard use. -// -// This file is intentionally framework-agnostic and uses `any` for the WebGPU -// renderer type: three/webgpu's WebGPURenderer is a runtime-only dynamic import -// (kept out of the main bundle), so a compile-time type isn't available here. - -import * as THREE from 'three'; -// StorageBufferAttribute + SpriteNodeMaterial live in the three/webgpu entry, -// not the base three module. This file is dynamically imported only at Cinema -// launch, so pulling from three/webgpu here does NOT add WebGPU to the main -// bundle. -import { StorageBufferAttribute, SpriteNodeMaterial } from 'three/webgpu'; -import { - Fn, - storage, - instanceIndex, - vec3, - uniform, - select, - float, - sin, - cos, - length, - clamp, - min, - mix, - fract, - abs, - floor, - smoothstep, - oneMinus, - cross, - sqrt, - pow, - mx_noise_vec3, - vec2, - atan, - positionView, -} from 'three/tsl'; -// note: .max()/.div()/.sub()/.cos()/.sin()/.log()/.lessThanEqual() etc. are -// fluent methods on TSL nodes — no import needed. - -export type SemanticRole = 'anchor' | 'connection' | 'contradiction'; - -const ROLE_MODE: Record = { - anchor: 0, - connection: 1, - contradiction: 2, -}; - -export interface StormOptions { - count?: number; - /** World-space radius of the initial particle cloud. */ - spawnRadius?: number; -} - -/** - * GPU compute particle storm. Construct with a WebGPURenderer + Scene, call - * update(dt) each frame, and transitionTo(role, worldPos) on each narrative - * beat. dispose() releases all GPU resources. - */ -/** The TSL compute node Fn(...)().compute(count) produces. three@0.172 does not - * export a public type for it; it is opaque and only handed to computeAsync(). */ -type ComputeDispatch = ReturnType>['compute']>; - -export class SemanticComputeStorm { - readonly count: number; - private scene: THREE.Scene; - // WebGPURenderer — runtime-only type (dynamic import); see file header. - private renderer: { computeAsync: (node: ComputeDispatch) => Promise }; - - private bufferPos: StorageBufferAttribute | null; - private bufferVel: StorageBufferAttribute | null; - private bufferPhase: StorageBufferAttribute | null; - - // Definite-assigned in buildCompute() (called from the constructor). - private computeNode!: ComputeDispatch; - private mesh: THREE.InstancedMesh | null = null; - private material: THREE.Material | null = null; - - // Serialize GPU compute dispatches: never queue a new compute pass before the - // previous one resolves, or the WebGPU dispatch queue backs up and stalls. - private computeInFlight: Promise | null = null; - - // Uniforms driven from the camera/beat loop. uIgnition starts non-zero so - // the storm is visible on the very first frame (before any beat fires). - private uTarget = uniform(new THREE.Vector3(0, 0, 0)); - private uTime = uniform(0); - private uIgnition = uniform(0.2); - private uMode = uniform(0); - // World-space radius the storm is contained within. Particles past this get - // a spring force back so the storm NEVER flies off-screen. Sized to the - // camera framing by the sandbox via setContainRadius(). - private uContainRadius = uniform(48); - // Global hue rotation (advances over time) + how strongly the beat's mode - // tint overrides the rainbow (0 = full rainbow, 1 = full mode color). - private uHueShift = uniform(0); - private uModeTintAmt = uniform(0.25); - // Detonation cycle: spikes to 1 on each beat (explosion), decays to 0 - // (crystallize/reform). Drives the explode→pixelate→reform look. - private uBurst = uniform(0); - // ACT DIMMER — a master brightness scalar set per beat from the narrative - // act. Act I opens too hot (the cloud is still in its dense initial spawn and - // the first ignition flash stacks on top), so we hold Act I dimmer and let - // Acts II/III blaze at full. 1.0 = full brightness. Starts very low so the - // pre-first-beat / beat-0 boot frames fade in soft instead of flashing white. - private uActDim = uniform(0.12); - // WORLD STATE MACHINE — each narrative beat (1..7) is a UNIQUE visual world: - // 0 nebula mist · 1 orbital anchor · 2 strange attractor · 3 detonation void - // 4 crystal lattice · 5 fluid galaxy · 6 phyllotaxis bloom - // Beats map 1:1 to worlds (beatIndex % 7). The compute kernel builds all 7 - // home targets + forces and select()s the live one — particles are never - // swapped, only the forces acting on them, which IS the journey. - private uWorld = uniform(0); - private uPrevWorld = uniform(0); - // Crossfade prev→current world over ~1s after each beat (eased in update()). - // 1 = fully previous world, 0 = fully current. - private uBlend = uniform(0); - private readonly worldCount = 7; - // COLOR BLAST — a LONG-LIVED chroma envelope, decoupled from the fast physics - // burst so the detonation color OUTLIVES the shockwave (owner: "color too - // brief"). uBlast is the 0..1 magnitude (slow ~2.8s decay); uBlastTime counts - // seconds since the last detonation and drives the outward spectral wave. - private uBlast = uniform(0); - private uBlastTime = uniform(0); - // ENDLESS DREAM MODE — after the scripted 7-beat tour, the storm keeps - // generating crazier figures forever instead of sitting idle. uMorphSeed - // randomizes each procedural figure (worlds 7..11); uChaos ramps 0→1 over the - // dream so every figure is wilder than the last. - private uMorphSeed = uniform(0); - private uChaos = uniform(0); - // JARRING CLASH PAIR — which opposing inner/outer duotone is live (0..4). Set - // per beat so every figure is a fresh ice-vs-fire / acid-vs-blood collision. - private uClash = uniform(0); - // NEAR-PLANE FADE — particles dissolve as they pass very close to the camera - // (flythrough) so they never additive-pop. Distance band in world units. - private uFadeNear = uniform(2.0); - private uFadeBand = uniform(7.0); - // VOLUMETRIC FOG — distant particles dim toward the void with view depth (exp - // falloff) for atmospheric depth. Combined with near-fade in one depth read. - private uFogDensity = uniform(0.012); - // DEPTH OF FIELD — off-focus particles dim (read as bokeh defocus under the - // bloom). Folded into the single depthFade depth read (no sprite-scale, which - // is finicky + collides with the streak). Focus tracks the dive. - private uFocus = uniform(28.0); - private uFocusRange = uniform(20.0); // wider in-focus band → most of figure crisp - private uDofDim = uniform(0.3); // subtle off-focus fade → depth without darkening - // INFINITE DROSTE ZOOM — the spine. The cloud endlessly dives inward: the - // nested inner figure grows by λ each period to become the new outer shell, - // while a fresh inner spawns inside, looping FOREVER with no seam. λ = 1/0.52 - // (the inner scale) makes inner→outer EXACT so the snap is invisible. Pure - // fract(uTime/T) — no camera dolly (can't clip / fight the camera clamp). - private uZoomPeriod = uniform(9.0); // T: one promotion every 9s - private uLambda = uniform(1.923); // 1 / 0.52 self-similar ratio - private uZoomOn = uniform(0); // 0 = off (beats 0/1, reduced-motion), 1 = diving - // VELOCITY-STRETCH FLYTHROUGH STREAK — when the camera plunges through the - // shell, sprites elongate along the screen-space apparent motion vector (a - // motion-streak look). Pure scaleNode/rotationNode (a SEPARATE output graph - // from color/emissive) + camera-velocity uniforms → zero per-frame compute, - // no positionView read in color/emissive. Strength is gated to 0 from JS for - // reduced-motion, so this is a no-op until the director drives uStreak. - private uCamVelView = uniform(new THREE.Vector3(0, 0, 0)); // view-space apparent particle velocity - private uStreak = uniform(0); // 0..1 flythrough strength - private uMaxStretch = uniform(7.0); - // JS-side dream state (not uniforms): which figure is live + how many fired. - private dreamCount = 0; - - constructor( - renderer: { computeAsync: (node: ComputeDispatch) => Promise }, - scene: THREE.Scene, - opts: StormOptions = {} - ) { - this.renderer = renderer; - this.scene = scene; - this.count = opts.count ?? 150_000; - // Spawn particles ALREADY SPREAD across a wide spherical SHELL (not a tiny - // dense ball at the origin). The old ±8 cube packed all 150k into a tiny - // volume, so the very first frame (Beat 0, before the cloud expands to its - // rim-falloff homes) was a solid white blob — additive overlap dominates at - // high density regardless of per-particle dimming. Booting on a broad shell - // means the storm reads as a calm colored cloud from frame one. - const spawn = opts.spawnRadius ?? 34; - - const positions = new Float32Array(this.count * 3); - const velocities = new Float32Array(this.count * 3); - const phases = new Float32Array(this.count); - for (let i = 0; i < this.count; i++) { - // Uniform direction on a sphere, radius biased to the outer shell so the - // boot cloud is hollow-cored like the rim look (never a dense center). - const u1 = Math.random(); - const u2 = Math.random(); - const theta = u1 * Math.PI * 2; - const z = u2 * 2 - 1; - const r = Math.sqrt(Math.max(0, 1 - z * z)); - const rad = spawn * (0.55 + Math.random() * 0.45); // shell 0.55..1.0 - positions[i * 3] = Math.cos(theta) * r * rad; - positions[i * 3 + 1] = z * rad; - positions[i * 3 + 2] = Math.sin(theta) * r * rad; - phases[i] = Math.random() * Math.PI * 2; - } - const bufferPos = new StorageBufferAttribute(positions, 3); - const bufferVel = new StorageBufferAttribute(velocities, 3); - const bufferPhase = new StorageBufferAttribute(phases, 1); - this.bufferPos = bufferPos; - this.bufferVel = bufferVel; - this.bufferPhase = bufferPhase; - - this.buildCompute(bufferPos, bufferVel, bufferPhase); - this.buildRender(bufferPos, bufferPhase); - } - - private buildCompute( - bufferPos: StorageBufferAttribute, - bufferVel: StorageBufferAttribute, - bufferPhase: StorageBufferAttribute - ): void { - const posStore = storage(bufferPos, 'vec3', this.count); - const velStore = storage(bufferVel, 'vec3', this.count); - const phaseStore = storage(bufferPhase, 'float', this.count); - - this.computeNode = Fn(() => { - const pos = posStore.element(instanceIndex); - const vel = velStore.element(instanceIndex); - const phase = phaseStore.element(instanceIndex); - - // ── DETERMINISTIC PER-PARTICLE BASIS (phase → stable spherical coords) ── - const a1 = phase.mul(12.9898).sin().mul(43758.5453); - const a2 = phase.mul(78.233).sin().mul(12543.531); - const a3 = phase.mul(39.346).sin().mul(24634.633); - const u = fract(a1); // 0..1 - const v = fract(a2); // 0..1 - const w2 = fract(a3); // 0..1 - const theta = u.mul(6.28318); // azimuth 0..2π - const phi = v.mul(3.14159); // polar 0..π - const R = this.uContainRadius; - // Outer-shell bias (0.62..1.0) keeps the core hollow → reads as color, - // not a white-blooming dense center. (The dialed-in anti-white-out.) - const shellT = fract(phase.mul(3.7)); - const homeFrac = float(0.62).add(shellT.mul(shellT).mul(0.38)); - const fi = float(instanceIndex); // particle index as float (phyllotaxis) - - // ── CURL NOISE (divergence-free flow → worlds 0 nebula, 5 fluid) ── - // Never clumps, never stops; the signature "living smoke" motion. - const curl = Fn(([p]: [ReturnType]) => { - const e = float(0.6); - const dx = mx_noise_vec3(p.add(vec3(e, 0, 0))).sub(mx_noise_vec3(p.sub(vec3(e, 0, 0)))); - const dy = mx_noise_vec3(p.add(vec3(0, e, 0))).sub(mx_noise_vec3(p.sub(vec3(0, e, 0)))); - const dz = mx_noise_vec3(p.add(vec3(0, 0, e))).sub(mx_noise_vec3(p.sub(vec3(0, 0, e)))); - return vec3(dy.z.sub(dz.y), dz.x.sub(dx.z), dx.y.sub(dy.x)).normalize(); - }); - - // ── 7 WORLD HOME TARGETS (all centered on origin → centroid can't drift) ── - const sphereShell = vec3(sin(phi).mul(cos(theta)), cos(phi), sin(phi).mul(sin(theta))); - const wNebula = sphereShell.mul(R.mul(homeFrac)); // world 0 (and 3 base) - const wAnchor = sphereShell.mul(R.mul(float(0.5).add(shellT.mul(0.3)))); // world 1 - // world 2 attractor: home is "ahead" along the Thomas flow from current pos. - const bT = float(0.19); - const thomas = vec3( - sin(pos.y).sub(pos.x.mul(bT)), - sin(pos.z).sub(pos.y.mul(bT)), - sin(pos.x).sub(pos.z.mul(bT)) - ); - const wAttractor = pos.add(thomas.mul(R.mul(0.12))); - const wVoid = wNebula; // world 3 = sphere; the burst dominates this beat - const wCrystal = vec3( // world 4 cube lattice - u.sub(0.5).mul(2).mul(R.mul(0.8)), - v.sub(0.5).mul(2).mul(R.mul(0.8)), - w2.sub(0.5).mul(2).mul(R.mul(0.8)) - ); - const armAng = u.mul(6.28318).mul(3).add(w2.mul(0.6)); // world 5 galaxy spiral - const gr = R.mul(0.2).add(R.mul(0.8).mul(w2)); - const wGalaxy = vec3( - gr.mul(cos(armAng)), - R.mul(0.06).mul(sin(phase.mul(20))), - gr.mul(sin(armAng)) - ); - const golden = float(2.39996323); // world 6 phyllotaxis (Vogel sunflower) - const pAng = fi.mul(golden); - const pRad = sqrt(fi).mul(R.mul(0.0042)); // ~R at 150k particles - const wPhyllo = vec3(pAng.cos().mul(pRad), R.mul(0.04).mul(sin(phase.mul(9))), pAng.sin().mul(pRad)); - - // ══════════════════════════════════════════════════════════════════ - // ENDLESS DREAM FIGURES (worlds 7..11) — the generative mode that - // kicks in after the scripted 7-beat tour. These are PROCEDURAL and - // RANDOMIZED: uMorphSeed (set per auto-beat) + uChaos (ramps up over - // time → each figure crazier than the last) modulate the parameters, - // so the same world index never looks the same twice. - // ══════════════════════════════════════════════════════════════════ - const seed = this.uMorphSeed; - const chaos = this.uChaos; - // seeded per-figure scalars (deterministic hash of the seed) - const s1 = fract(seed.mul(0.731).add(0.13)); - const s2 = fract(seed.mul(1.323).add(0.51)); - const s3 = fract(seed.mul(2.117).add(0.27)); - - // ── (u,v) MANIFOLD GRID ── THE spaghetti→skin fix. The hash-scatter - // basis (u,v,w2) is white noise → reads as gas/strings. A deterministic - // tensor grid over instanceIndex makes neighbors share rows/cols, so the - // procedural forms below render as a continuous SCULPTED SKIN, not lines. - // 387² = 149769 ≈ 150k. Pure arithmetic on fi — no buffers, no indexing. - const GW = float(387); - const ug = fract(fi.div(GW)); // grid u 0..1 (across a row) - const vg = floor(fi.div(GW)).div(GW); // grid v 0..1 (down columns) - - // ── COMPLEX-MATH HELPERS (sinh/cosh/tanh are NOT in three@0.172 — expand - // via the confirmed .exp()). Used by the Calabi–Yau + Boy's surface forms. ── - type FNode = ReturnType; - type VNode = ReturnType; - const sinhT = (x: FNode) => x.exp().sub(x.mul(-1).exp()).mul(0.5); - const coshT = (x: FNode) => x.exp().add(x.mul(-1).exp()).mul(0.5); - const cMul = (a: VNode, b: VNode) => - vec2(a.x.mul(b.x).sub(a.y.mul(b.y)), a.x.mul(b.y).add(a.y.mul(b.x))); - const cExp = (a: VNode) => { - const e = a.x.exp(); - return vec2(e.mul(cos(a.y)), e.mul(sin(a.y))); - }; - const cLog = (a: VNode) => - vec2(a.x.mul(a.x).add(a.y.mul(a.y)).max(1e-12).log().mul(0.5), atan(a.y, a.x)); - const cPow = (a: VNode, p: FNode) => cExp(cMul(vec2(p, float(0)), cLog(a))); - const cCosh = (z: VNode) => vec2(coshT(z.x).mul(cos(z.y)), sinhT(z.x).mul(sin(z.y))); - const cSinh = (z: VNode) => vec2(sinhT(z.x).mul(cos(z.y)), coshT(z.x).mul(sin(z.y))); - const cInv = (a: VNode) => { - const dd = a.x.mul(a.x).add(a.y.mul(a.y)).max(1e-6); - return vec2(a.x.div(dd), a.y.mul(-1).div(dd)); - }; - - // world 7 · SUPERSHAPE (3D superformula — petals/stars/blobs, never same) - const m1 = float(2).add(floor(s1.mul(14))); // symmetry 2..15 - const sfAng = theta; - const sfR1 = pow(abs(cos(m1.mul(sfAng).div(4))), float(2).add(s2.mul(8))) - .add(pow(abs(sin(m1.mul(sfAng).div(4))), float(2).add(s3.mul(8)))) - .add(0.0001) - .pow(float(-0.5)); - const sfR2 = pow(abs(cos(m1.mul(phi).div(4))), float(3)) - .add(pow(abs(sin(m1.mul(phi).div(4))), float(3))) - .add(0.0001) - .pow(float(-0.5)); - const sfRad = R.mul(0.85).mul(clamp(sfR1.mul(sfR2).mul(0.5), 0.1, 1.4)); - const wSuper = vec3( - sin(phi).mul(cos(theta)).mul(sfRad), - cos(phi).mul(sfRad), - sin(phi).mul(sin(theta)).mul(sfRad) - ); - - // ══════ IMPOSSIBLE-GEOMETRY FORM PACK (worlds 8..11) ══════ - // Brand-new signature skins nobody ships as a living particle figure. - - // world 8 · CALABI–YAU quintic cross-section (6D string-theory manifold, - // Hanson 4D→3D projection). 25 interlocking petals; α rotates it THROUGH - // the 4th dimension so petals pass through each other. The trophy. - const nCY = float(5); - const patch = floor(fract(seed.mul(0.013).add(fi.mul(0.00667))).mul(25)); - const k1 = floor(patch.div(5)); // 0..4 - const k2 = patch.sub(k1.mul(5)); // 0..4 - const cyx = ug.mul(2).sub(1); // x ∈ [-1,1] - const cyy = vg.mul(1.5708); // y ∈ [0, π/2] - const zc = vec2(cyx, cyy); - const e1 = cExp(vec2(float(0), k1.mul(6.28318).div(nCY))); - const e2 = cExp(vec2(float(0), k2.mul(6.28318).div(nCY))); - const z1 = cMul(e1, cPow(cCosh(zc), float(0.4))); // 2/n = 0.4 - const z2 = cMul(e2, cPow(cSinh(zc), float(0.4))); - const alpha = this.uTime.mul(0.25).add(seed).add(chaos.mul(1.5)); - const wKnot = vec3( - z1.x, - z2.x, - cos(alpha).mul(z1.y).add(sin(alpha).mul(z2.y)) - ).mul(R.mul(0.55)); // ±1.6 → ~0.88R, centroid (0,0,0) - - // world 9 · BOY'S SURFACE (Bryant–Kusner minimal immersion of RP²) — a - // CLOSED non-orientable surface with one triple point, no spikes. Pure - // rational complex arithmetic over the unit disk → a perfect 2-manifold. - const br = sqrt(ug); // sqrt → uniform area on the disk - const bth = vg.mul(6.28318); - const zb = vec2(br.mul(cos(bth)), br.mul(sin(bth))); - const zb2 = cMul(zb, zb); - const zb3 = cMul(zb2, zb); - const zi2 = cInv(zb2); - const zi3 = cInv(zb3); - const denom = vec2(zb3.x.sub(zi3.x).add(2.2360679), zb3.y.sub(zi3.y)); // +√5 - const aZ = cInv(denom); - const V0 = cMul(vec2(float(0), float(1)), vec2(zb2.x.sub(zi2.x), zb2.y.sub(zi2.y))); - const V1 = vec2(zb2.x.add(zi2.x), zb2.y.add(zi2.y)); - const V2 = cMul(vec2(float(0), float(0.6667)), vec2(zb3.x.add(zi3.x), zb3.y.add(zi3.y))); - const Mx = cMul(aZ, V0).x; - const My = cMul(aZ, V1).x; - const Mz = cMul(aZ, V2).x.add(0.5); - const m2 = Mx.mul(Mx).add(My.mul(My)).add(Mz.mul(Mz)).max(1e-4); // sphere inversion - const wLissa = vec3(Mx.div(m2), My.div(m2), Mz.div(m2).sub(0.86)) // sub centroid z - .mul(R.mul(0.5)); - - // world 10 · AIZAWA attractor SHELL (capped spiral torus mapped over u,v; - // the Aizawa vector field added in the motion modifiers makes it breathe). - const az = vg.mul(2).sub(1); // -1..1 vertical - const ar = sqrt(float(1).sub(az.mul(az)).max(0)).mul(0.9).add(0.25); // radial profile - const aang = ug.mul(6.28318).add(az.mul(6).mul(chaos.add(0.4))); // spiral twist - const wHelix = vec3( - ar.mul(cos(aang)), - az.mul(1.4), // centered by construction - ar.mul(sin(aang)) - ).mul(R.mul(0.5)); - - // world 11 · GYROID↔SCHWARZ-D Bonnet morph (triply-periodic minimal - // surface — alien coral/bone lattice). The Bonnet angle θ continuously - // BENDS the gyroid into Schwarz-D. A woven solid skin, never seen living. - const period = float(2.2).add(chaos.mul(2.0)); - const gx = ug.mul(6.28318).mul(period); - const gy = vg.mul(6.28318).mul(period); - const gz = this.uTime.mul(0.3).add(seed.mul(6.28318)); - const gyroid = sin(gx).mul(cos(gy)).add(sin(gy).mul(cos(gz))).add(sin(gz).mul(cos(gx))); - const schwD = cos(gx).mul(cos(gy)).mul(cos(gz)).sub(sin(gx).mul(sin(gy)).mul(sin(gz))); - const bonnet = this.uTime.mul(0.15); - const fTPMS = cos(bonnet).mul(gyroid).add(sin(bonnet).mul(schwD)); - const tpmsBase = vec3( - sin(vg.mul(3.14159)).mul(cos(ug.mul(6.28318))), - cos(vg.mul(3.14159)), - sin(vg.mul(3.14159)).mul(sin(ug.mul(6.28318))) - ); - const wFoam = tpmsBase.mul(R.mul(0.5).add(fTPMS.mul(R.mul(0.12)))); // skin ± displacement - - // select() chain — no dynamic indexing in this TSL build. - const homeFor = (idx: ReturnType) => - select(idx.equal(0), wNebula, - select(idx.equal(1), wAnchor, - select(idx.equal(2), wAttractor, - select(idx.equal(3), wVoid, - select(idx.equal(4), wCrystal, - select(idx.equal(5), wGalaxy, - select(idx.equal(6), wPhyllo, - select(idx.equal(7), wSuper, - select(idx.equal(8), wKnot, - select(idx.equal(9), wLissa, - select(idx.equal(10), wHelix, wFoam))))))))))); - const homeCur = homeFor(float(this.uWorld)); - const homePrev = homeFor(float(this.uPrevWorld)); - // uBlend eases prev→cur (smoothstep) so the world morph is silky. - const blendE = smoothstep(float(0), float(1), oneMinus(this.uBlend)); - const outerHome = mix(homePrev, homeCur, blendE); - - // ══════════════════════════════════════════════════════════════════ - // 3D-WITHIN-3D — a NESTED INNER FIGURE at the core. - // ~33% of particles (a deterministic slice of the index) form a - // SECOND, smaller shape inside the outer shell — a different world, - // counter-rotating, at ~38% scale. This fills the formerly-blank-bright - // center with intentional structure (a figure inside a figure) and adds - // depth nobody ships with particles. The inner world is offset from the - // outer so the two layers never collapse into the same shape. - // ══════════════════════════════════════════════════════════════════ - const isInner = fract(fi.mul(0.001).add(0.5)).greaterThan(0.66); // ~34% inner - // Inner world = outer + 5, wrapped into 0..11 (a clearly different shape). - // Done with select() (no .mod()) so it's valid in this TSL build. - const innerSum = float(this.uWorld).add(5); - const innerWorldIdx = select(innerSum.greaterThan(11), innerSum.sub(12), innerSum); - const innerRaw = homeFor(innerWorldIdx); - // Counter-rotate the inner figure about Y so it spins against the shell, - // and scale it down to sit inside. cos/sin build a Y-rotation matrix. - const ia = this.uTime.mul(0.4); - const ic = cos(ia); - const is = sin(ia); - const innerRot = vec3( - innerRaw.x.mul(ic).sub(innerRaw.z.mul(is)), - innerRaw.y, - innerRaw.x.mul(is).add(innerRaw.z.mul(ic)) - ); - const innerHome = innerRot.mul(0.52); // nested core at ~52% scale (spread → less white) - - // ── INFINITE ZOOM DIVE ── two layers ride offset phases of fract(uTime/T): - // the outer grows pow(λ, phase) toward the camera then snaps back (invisible - // because inner@1/λ == outer@1); the inner (half-period offset) grows from - // its own base, promoted by λ so it becomes the next outer shell. uZoomOn - // gates it → beats 0/1 + reduced-motion stay perfectly still. - const zPhaseO = this.uTime.div(this.uZoomPeriod).fract(); - const zPhaseI = this.uTime.div(this.uZoomPeriod).add(0.5).fract(); - const zoomO = mix(float(1.0), this.uLambda.pow(zPhaseO), this.uZoomOn); - const zoomI = mix(float(1.0), this.uLambda.pow(zPhaseI), this.uZoomOn); - const outerDive = outerHome.mul(zoomO); - const innerDive = innerHome.mul(zoomI.mul(this.uLambda)); // inner promoted by λ each cycle - // Each particle is permanently outer OR inner (no flicker): pick its home. - const home = mix(outerDive, innerDive, isInner.select(float(1), float(0))); - - // ── DETONATION: per-particle staggered radial blast so it blooms as a - // shockwave, not all-at-once. uBurst spikes on each beat, decays fast. - const outDir = pos.normalize(); - const stagger = oneMinus(fract(phase.mul(7.3)).mul(0.4)); - vel.addAssign(outDir.mul(this.uBurst.mul(0.95).mul(stagger))); - - // ── REFORM SPRING toward the (blended) world home ── - vel.addAssign(home.sub(pos).mul(0.045)); - - // ── PER-WORLD MOTION MODIFIERS (added to the spring) ── - // worlds 0 & 5: curl turbulence (living mist / liquid arms) - const curlV = curl(pos.mul(0.045).add(vec3(0, this.uTime.mul(0.2), 0))); - const curlAmt = select(this.uWorld.equal(0), float(0.05), - select(this.uWorld.equal(5), float(0.06), float(0.0))); - vel.addAssign(curlV.mul(curlAmt)); - // world 1: orbital spin around Y (cross product → orbit, not collapse) - vel.addAssign(cross(vec3(0, 1, 0), pos).mul(0.0009).mul(select(this.uWorld.equal(1), float(1), float(0)))); - // world 2: integrate the Thomas attractor (chaos lattice) - vel.addAssign(thomas.mul(0.012).mul(select(this.uWorld.equal(2), float(1), float(0)))); - // world 10: integrate the AIZAWA vector field so the shell breathes/spirals - // along the real attractor flow (not a static torus). - const azx = pos.x.div(R.mul(0.5)); - const azy = pos.y.div(R.mul(0.5)); - const azz = pos.z.div(R.mul(0.5)); - const aizawa = vec3( - azz.sub(0.7).mul(azx).sub(azy.mul(3.5)), - azx.mul(3.5).add(azz.sub(0.7).mul(azy)), - float(0.6).add(azz.mul(0.95)).sub(azz.mul(azz).mul(azz).div(3)).sub(azx.mul(azx).add(azy.mul(azy))) - ); - vel.addAssign(aizawa.mul(0.008).mul(select(this.uWorld.equal(10), float(1), float(0)))); - // world 5: tangential swirl for liquid galaxy arms - vel.addAssign(cross(vec3(0, 1, 0), pos).mul(0.0016).mul(select(this.uWorld.equal(5), float(1), float(0)))); - - // Subtle living shimmer (mean-zero, no net drift). - const shimmer = home.normalize().mul(sin(this.uTime.mul(1.3).add(phase.mul(6.1))).mul(0.015)); - vel.addAssign(shimmer); - - // Hard velocity clamp — nothing can ever fly off or blow up. - const speed = length(vel); - const maxSpeed = float(1.3); - vel.assign(vel.mul(min(maxSpeed, speed).div(speed.max(0.0001)))); - - pos.addAssign(vel); - vel.mulAssign(0.9); // strong damping → crisp crystallization, no overshoot - - // ── PIXELATION: voxel snap as particles crystallize (low burst). World 4 - // (crystal lattice) pushes it hardest for the holographic shard look. - const crystalBoost = select(this.uWorld.equal(4), float(1.6), float(1.0)); - const cell = mix(float(0.55), float(6.0), clamp(this.uBurst, 0, 1)); - const quantized = floor(pos.div(cell)).add(0.5).mul(cell); - const pixelAmt = clamp(oneMinus(this.uBurst.mul(1.4)), 0, 0.9).mul(crystalBoost).min(0.9); - pos.assign(mix(pos, quantized, pixelAmt)); - - // Final hard safety net: clamp anything past the contain radius back - // onto the boundary shell — guarantees nothing is ever off-screen. - const finalDist = length(pos); - const hardR = this.uContainRadius; - const snapped = pos.normalize().mul(hardR); - pos.assign(mix(pos, snapped, finalDist.greaterThan(hardR).select(float(1), float(0)))); - })().compute(this.count); - } - - private buildRender(bufferPos: StorageBufferAttribute, bufferPhase: StorageBufferAttribute): void { - // SpriteNodeMaterial: emissive routed to bloom; additive against the void. - const mat = new SpriteNodeMaterial({ - transparent: true, - blending: THREE.AdditiveBlending, - depthWrite: false, - }) as SpriteNodeMaterial & { - positionNode: unknown; - colorNode: unknown; - emissiveNode: unknown; - }; - - // CANONICAL SPRITE CENTER: positionNode is the sprite's CENTER only. - // SpriteNodeMaterial.setupPositionView already builds the billboard quad - // from positionGeometry.xy (scaled by scaleNode, rotated by rotationNode), - // so the previous `.add(positionLocal)` double-counted the quad (harmless at - // the 0.1 size, sub-pixel). Using the bare center is required for the - // velocity-stretch streak (scaleNode/rotationNode now drive the quad shape). - const phaseStore = storage(bufferPhase, 'float', this.count); - const instancePos = storage(bufferPos, 'vec3', this.count).element(instanceIndex); - mat.positionNode = instancePos; - - // ── VELOCITY-STRETCH STREAK (scaleNode + rotationNode) ── a SEPARATE output - // graph from color/emissive: it reads only camera-velocity uniforms + - // phaseStore, NEVER positionView (a 2nd positionView read in a material - // output would stack-overflow three@0.172's node builder). Zero per-frame - // compute — the camera velocity is one uniform pushed from the sandbox. - const matStretch = mat as typeof mat & { scaleNode: unknown; rotationNode: unknown }; - { - // Screen-plane apparent particle velocity (view space x/y). speed≥ε so - // length()/atan() stay finite when the camera is still. - const velView = vec3(this.uCamVelView); - const vScreen = vec2(velView.x, velView.y); - const speed = length(vScreen).max(1e-4); - // Per-particle jitter (0.75..1.25) so streaks don't all stretch identically. - const jit = fract(phaseStore.element(instanceIndex).mul(13.17)).mul(0.5).add(0.75); - // Orient the quad's long axis along the motion vector. atan(y, x) is the - // 2-arg form (full -π..π range), NOT atan2. - matStretch.rotationNode = atan(vScreen.y, vScreen.x); - // X-stretch: 1 (no streak) → uMaxStretch, scaled by speed × strength × jitter. - const stretch = clamp(speed.mul(this.uStreak).mul(jit).mul(0.6).add(1.0), float(1.0), this.uMaxStretch); - // bloat = DOF circle-of-confusion base (DOF brightness is in depthFade; - // the sprite-scale bloat is the neutral 1.0 here). Streak elongates X only; - // bloat stays on both axes so the DOF circle is preserved. - const bloat = float(1.0); - matStretch.scaleNode = vec2(bloat.mul(stretch), bloat); - } - - // ── SHARED RAINBOW COLOR ── - // One Fn produces the pure iridescent color for a particle; we feed it to - // BOTH colorNode (the lit/additive surface color) AND emissiveNode (the - // channel the selective MRT bloom reads). The original code only set - // colorNode, so the bloom had NO color to bloom — it washed the frame to - // white. Routing the SAME rainbow to emissive makes the bloom glow in full - // spectral color, which is the whole point. - - // ── IQ COSINE PALETTE ── one scalar t → smooth, vivid, loopable color. - // color(t) = a + b·cos(2π·(c·t + d)). The workhorse for per-world palettes - // and the spectral dispersion wave. - const palette = Fn( - ([t, a, b, c, d]: [ - ReturnType, - ReturnType, - ReturnType, - ReturnType, - ReturnType, - ]) => a.add(b.mul(cos(c.mul(t).add(d).mul(6.28318)))) - ); - - // ── BLACKBODY K→RGB ── real plasma-cooling color (Tanner-Helland approx). - // Drives the detonation: blue-white core (hot) cooling to red embers as the - // blast decays. if/else collapsed to select() for this TSL build. - const blackbody = Fn(([kelvin]: [ReturnType]) => { - const k = kelvin.div(100.0); - const rHot = pow(k.sub(60.0).max(0.0001), float(-0.1332047592)).mul(329.698727446); - const r = k.lessThanEqual(66.0).select(float(255.0), rHot); - const gCool = k.max(0.0001).log().mul(99.4708025861).sub(161.1195681661); - const gHot = pow(k.sub(60.0).max(0.0001), float(-0.0755148492)).mul(288.1221695283); - const g = k.lessThanEqual(66.0).select(gCool, gHot); - const bMid = k.sub(10.0).max(0.0001).log().mul(138.5177312231).sub(305.0447927307); - const b = k.greaterThanEqual(66.0).select( - float(255.0), - k.lessThanEqual(19.0).select(float(0.0), bMid) - ); - return clamp(vec3(r, g, b).div(255.0), 0, 1); - }); - - const rainbowColor = Fn(() => { - const pos = instancePos; - const ph = phaseStore.element(instanceIndex); - const radius = length(pos.sub(vec3(this.uTarget))); - - // Recompute the inner/outer layer split (same formula as the compute kernel). - const fiC = float(instanceIndex); - const isInnerC = fract(fiC.mul(0.001).add(0.5)).greaterThan(0.66); - - // A flowing texture coordinate per particle — drives gradients WITHIN each - // layer's duotone so it shimmers, but stays inside that layer's color world. - const spatialBand = pos.x.mul(0.03).add(pos.y.mul(0.021)).add(pos.z.mul(0.027)); - const flow = fract( - ph.mul(0.41).add(radius.mul(0.06)).add(spatialBand).add(this.uTime.mul(0.10)).add(this.uHueShift) - ); - - // ══════════════════════════════════════════════════════════════════ - // JARRING DUOTONE CLASH — the share hook. - // The outer shell and the inner nested figure are painted from OPPOSING - // color universes (ice vs fire, acid vs blood, gold vs violet…). Not a - // hue shift in one rainbow — two palettes that FIGHT. uClash (set per - // beat) picks which clashing pair is live, so it's a fresh jarring combo - // every beat. Each layer is a 2-color gradient (cold→cold, hot→hot) so - // the layer reads as ONE color world, and the two worlds collide at the - // boundary. THIS is what makes someone stop scrolling and share. - // ══════════════════════════════════════════════════════════════════ - // Five hand-picked clash pairs: [outerA, outerB, innerA, innerB]. - const cl = this.uClash; // 0..4, set per beat - // outer gradient endpoints - const outA = select(cl.equal(0), vec3(0.0, 0.85, 1.0), // ICE: electric cyan - select(cl.equal(1), vec3(0.55, 1.0, 0.0), // ACID lime - select(cl.equal(2), vec3(1.0, 0.82, 0.0), // GOLD - select(cl.equal(3), vec3(0.0, 1.0, 0.6), // MINT/emerald - vec3(0.1, 0.5, 1.0))))); // ELECTRIC blue - const outB = select(cl.equal(0), vec3(0.3, 0.2, 1.0), // ICE→deep indigo - select(cl.equal(1), vec3(0.0, 0.7, 0.5), // ACID→teal - select(cl.equal(2), vec3(1.0, 0.4, 0.0), // GOLD→amber - select(cl.equal(3), vec3(0.0, 0.6, 1.0), // MINT→cyan - vec3(0.5, 0.0, 1.0))))); // ELECTRIC→violet - // inner gradient endpoints — the OPPOSING world - const inA = select(cl.equal(0), vec3(1.0, 0.25, 0.0), // FIRE: molten orange - select(cl.equal(1), vec3(1.0, 0.0, 0.55), // BLOOD: hot pink - select(cl.equal(2), vec3(0.6, 0.0, 1.0), // VIOLET - select(cl.equal(3), vec3(1.0, 0.1, 0.3), // CRIMSON - vec3(1.0, 0.7, 0.0))))); // GOLD - const inB = select(cl.equal(0), vec3(1.0, 0.0, 0.3), // FIRE→crimson - select(cl.equal(1), vec3(1.0, 0.45, 0.0), // BLOOD→orange - select(cl.equal(2), vec3(1.0, 0.0, 0.7), // VIOLET→magenta - select(cl.equal(3), vec3(1.0, 0.5, 0.0), // CRIMSON→amber - vec3(1.0, 0.2, 0.4))))); // GOLD→rose - - // Each layer = a 2-stop gradient driven by `flow` (stays in its world). - const grad = smoothstep(float(0.0), float(1.0), flow); - const outerColor = mix(outA, outB, grad); - const innerColor = mix(inA, inB, grad); - // Hard pick by layer → the clash is absolute at the boundary. - const rainbow = mix(outerColor, innerColor, isInnerC.select(float(1), float(0))); - - // Beat mode tint kept very light so it never muddies the clash. - const modeTint = select( - this.uMode.equal(2), - vec3(1.0, 0.08, 0.32), - select(this.uMode.equal(3), vec3(1.0, 0.78, 0.1), vec3(0.1, 0.9, 1.0)) - ); - return mix(rainbow, modeTint, this.uModeTintAmt.mul(0.4)); - }); - - // ── RIM GLOW ── THE look: bright glowing EDGES, dim center. - // The dense middle of each form (particles near the center axis, all - // stacking toward the camera) is what blooms to white. So we DIM the core - // and BLAZE the rim: brightness rises with a particle's radial distance - // from the form's center. Near center → ~0.12 (deep, calm), at the outer - // shell → ~1.0 (full blaze). The result is the glowing-shell / hollow-eye - // torus look — luminous silhouette, serene dark center. - const rimFactor = Fn(() => { - const pos = instancePos; - // Normalized radial position 0 (center) .. 1 (contain radius). - const rNorm = clamp(length(pos).div(this.uContainRadius.max(0.0001)), 0, 1); - // Smooth ramp: dark core, bright rim — the outer-shell glow that keeps the - // center from blooming white (preserved white-out protection). - const edge = rNorm.mul(rNorm); - // FACING-RATIO FRESNEL — the "make it solid" amplifier. Approximate each - // particle's surface normal as its outward radial direction; view ≈ +Z. - // pow(1−|n·v|, 4) blazes the turning-away SILHOUETTE and quiets the front, - // which flips "glowing fog" into a lit, sculpted SKIN. - const nrm = pos.normalize(); - const fres = pow(oneMinus(abs(nrm.z)), float(4.0)); - const outerRim = float(0.12).add(edge.mul(0.6)).add(fres.mul(0.5)); - // The NESTED inner figure lives at small radius where `edge` is ~0 → it - // would be invisible. Give inner particles their OWN brightness: a higher - // floor + the same Fresnel silhouette so the inner figure reads as its own - // glowing sculpted object floating inside the shell. - const fiC = float(instanceIndex); - const isInnerC = fract(fiC.mul(0.001).add(0.5)).greaterThan(0.66); - // Inner glow kept VERY low so the nested figure's CLASH COLOR survives as - // color, not white. Dense small-radius overlap blows to white fast and - // kills the contrast — so the inner sits dim and saturated, carried by its - // Fresnel silhouette. This is what makes the jarring inner/outer clash read. - const innerRim = float(0.07).add(fres.mul(0.3)); - const baseRim = isInnerC.select(innerRim, outerRim); - - // ── ZOOM SEAM CROSS-FADE ── each dive layer must be fully transparent - // exactly when it snaps (phase 0/1), so the infinite loop has NO visible - // pop. sin(phase·π) = 0 at the snap, 1 mid-cycle. Normalize by the sum so - // total opacity stays ≈1. uZoomOn=0 forces weight to 1 (no fade when still). - const pO = this.uTime.div(this.uZoomPeriod).fract(); - const pI = this.uTime.div(this.uZoomPeriod).add(0.5).fract(); - const wO = sin(pO.mul(3.14159)); - const wI = sin(pI.mul(3.14159)); - const wSum = wO.add(wI).max(0.0001); - const seamO = mix(float(1.0), wO.div(wSum).mul(2.0).min(1.0), this.uZoomOn); - const seamI = mix(float(1.0), wI.div(wSum).mul(2.0).min(1.0), this.uZoomOn); - const seam = isInnerC.select(seamI, seamO); - return baseRim.mul(seam); - }); - - // ── DEPTH FADE (near dissolve × volumetric fog) ── ONE Fn, ONE positionView - // read. Reading positionView from a SECOND Fn in the same material output - // triggers a cyclic type-resolution stack-overflow in three@0.172's node - // builder, so near-fade AND fog are combined here into a single depth read. - // near: smoothstep 0→1 across [near, near+band] (≈1 at far camera → no - // change until we fly inside; dissolves sprites at the camera). - // fog: exp falloff dims distant particles toward the void → 3D depth. - const depthFade = Fn(() => { - const d = positionView.z.negate(); // +forward view distance, read ONCE - const near = smoothstep(this.uFadeNear, this.uFadeNear.add(this.uFadeBand), d); - // Fog floor raised to 0.45 so the far field still READS — all four depth - // systems multiply, so each must dim gently or they stack to black. - const fog = clamp(this.uFogDensity.mul(d).negate().exp(), 0.45, 1.0); - // DOF: dim particles off the focus plane (defocus → bokeh under bloom). - // coc 0 at focus → 1 fully out of focus; brightness 1 → (1-uDofDim). - const coc = clamp(d.sub(this.uFocus).abs().div(this.uFocusRange), 0, 1); - const focusBright = oneMinus(coc.mul(this.uDofDim)); - return near.mul(fog).mul(focusBright); - }); - - // ── THE COLOR BLAST ── the signature detonation chroma. Keyed on the LONG - // uBlast envelope (~2.8s) so the color OUTLIVES the physics burst (owner's - // "color too brief" fix). Two layers: a blackbody plasma core that cools as - // the blast ages, and an outward-traveling SPECTRAL DISPERSION WAVE — rainbow - // shockwave rings expanding through the radius over uBlastTime, like a prism - // shattering. The unexpected color blast nobody else ships. - const blastColor = Fn(() => { - const pos = instancePos; - const b = clamp(this.uBlast, 0, 1); - const bt = this.uBlastTime; - const rNorm = clamp(length(pos).div(this.uContainRadius.max(0.0001)), 0, 1); - // Blackbody embers: a WARM core (capped ~5200K so it's hot-orange, NOT - // blinding blue-white — the white-out the owner saw was a 13000K plasma - // flash). Gentle gain so it tints, never dominates. - const kelvin = mix(float(1600.0), float(5200.0), b); - const gain = clamp(b.mul(1.1).add(0.4), 0, 1.3); - const fire = blackbody(kelvin).mul(gain); - // THE STAR OF THE BLAST — an outward SPECTRAL DISPERSION shockwave: - // concentric rainbow rings travel out through the radius over time (red - // lags, blue leads — real prism order). This is the color, not the fire. - const specT = fract(rNorm.mul(1.6).sub(bt.mul(1.5))); - const spectrum = palette(specT, vec3(0.55), vec3(0.55), vec3(3.0), vec3(0.0, 0.33, 0.67)); - // Spectrum DOMINATES (0.78); a touch of warm fire underneath for energy. - // The owner wants a COLOR blast, so the rainbow wins over the plasma. - return mix(fire, spectrum, float(0.78)); - }); - - // colorNode: world color × rim × act dim, then the blast overrides toward - // detonation chroma at the peak and lingers (the long uBlast tail) before - // melting back into the next world's palette. - mat.colorNode = Fn(() => { - const glow = clamp(this.uIgnition.mul(0.05).add(0.72), 0, 1.25); // lifted: 4 depth systems multiply-dim - const world = rainbowColor().mul(glow).mul(rimFactor()).mul(this.uActDim); - // Blast is CAPPED at 0.6 so the inner/outer CLASH duotone always shows - // through even during a detonation — the clash is the star, the blast is - // an accent (was fully overriding, which washed the contrast to rainbow). - const blastMix = smoothstep(float(0.0), float(0.85), clamp(this.uBlast, 0, 1)).mul(0.6); - return mix(world, blastColor().mul(rimFactor()).mul(this.uActDim), blastMix).mul(depthFade()); - })(); - - // emissiveNode: what the selective bloom reads — THE glow channel. Rim-gated - // so ONLY the outer shell blooms (calm dark center, no white blob). The blast - // gain is held below the color path (×0.85) so the bloom never clips white. - mat.emissiveNode = Fn(() => { - const emGain = clamp(this.uIgnition.mul(0.04).add(0.85), 0, 1.35); // lifted to feed the bloom through the depth dimming - const world = rainbowColor().mul(emGain).mul(rimFactor()).mul(this.uActDim); - // Same cap as colorNode so the bloom feeds on the CLASH colors, not a - // rainbow override. - const blastMix = smoothstep(float(0.0), float(0.85), clamp(this.uBlast, 0, 1)).mul(0.6); - // ×nearFade so the bloom ALSO dissolves near the camera (no near-plane flash). - return mix(world, blastColor().mul(0.85).mul(rimFactor()).mul(this.uActDim), blastMix).mul(depthFade()); - })(); - - // One instanced sprite per particle. Small quads (0.1) keep individual - // particles as crisp colored points of light rather than overlapping into - // white mush across the now-larger volume. - const geometry = new THREE.PlaneGeometry(0.1, 0.1); - const mesh = new THREE.InstancedMesh(geometry, mat as unknown as THREE.Material, this.count); - mesh.frustumCulled = false; - this.material = mat; - this.mesh = mesh; - this.scene.add(this.mesh); - } - - /** Advance the GPU physics one frame. Compute dispatches are serialized so - * a slow GPU never lets passes pile up and stall the queue. */ - async update(deltaSeconds: number): Promise { - const dt = Math.max(0, Math.min(deltaSeconds, 0.05)); - this.uTime.value += dt; - // Slowly rotate the whole rainbow so the cloud is always shimmering. - this.uHueShift.value = (this.uHueShift.value + dt * 0.06) % 1; - // World crossfade: ease uBlend 1→0 over ~1s after each beat so the cloud - // melts from the previous world's home/forces into the new one's. - this.uBlend.value = Math.max(0, this.uBlend.value - dt * 1.0); - // Ignition decays toward 0 between beats (spikes back up on transitionTo()). - this.uIgnition.value = Math.max(0, this.uIgnition.value - dt * 2.0); - // Burst decays fast so the explosion crystallizes back within ~1.2s. - this.uBurst.value = Math.max(0, this.uBurst.value - dt * 0.85); - // COLOR BLAST: slow decay (~2.8s) so the detonation chroma LASTS, and the - // wave clock counts up so the spectral shockwave travels outward over time. - this.uBlast.value = Math.max(0, this.uBlast.value - dt * 0.35); - this.uBlastTime.value += dt; - // RACK FOCUS — when diving, the focus plane tracks the descent (pulls inward - // over each zoom cycle so the new inner figure crisps up as it grows); when - // still, a gentle breathing pull keeps the DOF alive. - const zp = (this.uTime.value / this.uZoomPeriod.value) % 1; - const focusTarget = this.uZoomOn.value > 0.5 - ? 40 - zp * 16 // 40→24 over each dive cycle (keeps the grown figure in focus) - : 26 + Math.sin(this.uTime.value * 0.18) * 9; // 17..35 breathing - this.uFocus.value += (focusTarget - this.uFocus.value) * Math.min(1, dt * 3); - - // Wait for any in-flight compute to finish before queuing the next. - if (this.computeInFlight) await this.computeInFlight; - this.computeInFlight = this.renderer.computeAsync(this.computeNode).finally(() => { - this.computeInFlight = null; - }); - await this.computeInFlight; - } - - /** Fired on each narrative beat: retarget the storm + spike ignition. - * `act` blazes Acts II/III at full; `beatIndex` (0-based) holds the very first - * beats EXTRA dim — beats 0 and 1 fire while the cloud is still bunched from - * the initial reform and would otherwise wash to white. They ramp up to full - * over the opening, so the storm fades IN beautifully instead of flashing. */ - transitionTo( - role: SemanticRole, - worldPos: THREE.Vector3, - act: 'I' | 'II' | 'III' = 'II', - beatIndex = 99 - ): void { - this.uTarget.value.copy(worldPos); - const mode = ROLE_MODE[role] ?? 1; - this.uMode.value = mode; - - // WORLD ADVANCE: beats map 1:1 to the 7 worlds. Record the outgoing world - // and reset the crossfade so the cloud melts prev→new over ~1s. - this.uPrevWorld.value = this.uWorld.value; - this.uWorld.value = beatIndex % this.worldCount; - this.uBlend.value = 1; // 1 = fully previous; update() eases it to 0 - // Cycle the jarring inner/outer clash pair so each beat collides a fresh - // pair of opposing color worlds (ice↔fire, acid↔blood, …). - this.uClash.value = beatIndex % 5; - // Engage the infinite dive from Act II onward (beats 0/1 stay calm + still). - this.uZoomOn.value = beatIndex >= 2 ? 1 : 0; - - // Per-beat warm-up dim: beats 0/1 stay calm (dialed-in safety), then hands - // off to the act-based brightness. Acts II/III blaze. - const warmup = beatIndex === 0 ? 0.12 : beatIndex === 1 ? 0.2 : null; - const actDim = act === 'I' ? 0.26 : 1.0; - this.uActDim.value = warmup ?? actDim; - // Ignition flash: nearly none on beats 0/1, gentle for the rest of Act I, - // strong (but no longer white-blowing) for Acts II/III — lowered from 8.0 to - // 4.5 so the inner/outer CLASH colors survive the detonation instead of - // washing to white. - this.uIgnition.value = beatIndex <= 1 ? 0.4 : act === 'I' ? 1.6 : 4.5; - // PHYSICS BURST (fast) — contradiction + the DETONATION world (3) hit hardest. - const isDetonation = this.uWorld.value === 3; - this.uBurst.value = mode === 2 || isDetonation ? 1.0 : 0.8; - // COLOR BLAST (LONG) — fire the chroma envelope + reset its outward-wave - // clock. Beats 0/1 keep it very low so the calm opener never flashes. - this.uBlast.value = beatIndex <= 1 ? 0.25 : 1.0; - this.uBlastTime.value = 0; - // Dramatic beats (contradiction=2, surprise=3) push their mode color over - // the rainbow so they read clearly; calm beats stay mostly iridescent. - this.uModeTintAmt.value = mode >= 2 ? 0.7 : 0.22; - } - - /** - * ENDLESS DREAM BEAT — fired on a timer AFTER the scripted tour ends, so the - * storm never sits idle. Jumps to a RANDOM procedural figure (worlds 7..11), - * reseeds it (so it's never the same shape twice), ramps uChaos up so each one - * is wilder than the last, and detonates a full color blast. This is the - * "random figure generator that makes even crazier beats." - */ - dreamBeat(): void { - this.dreamCount += 1; - // Pick a random wild figure (worlds 7..11 are the procedural generators). - const world = 7 + Math.floor(Math.random() * 5); - this.uPrevWorld.value = this.uWorld.value; - this.uWorld.value = world; - this.uBlend.value = 1; - // Fresh random seed → the superformula/knot/lissajous/helix/foam params all - // change, so the same world index never looks the same twice. - this.uMorphSeed.value = Math.random() * 1000; - // Random opposing clash pair each dream figure → never the same collision. - this.uClash.value = Math.floor(Math.random() * 5); - // Chaos ramps up and saturates — figures get progressively crazier, then - // hold at max wildness. Eases in over the first ~8 dream beats. - this.uChaos.value = Math.min(1, 0.25 + this.dreamCount * 0.1); - // Dream mode dives endlessly — the infinite zoom is always on here. - this.uZoomOn.value = 1; - // Detonation + long color blast every dream beat — but ignition kept - // MODERATE (not the tour's 8.0) so the random dense figures don't wash to - // white at the blast peak. The rim-gated spectral blast carries the color. - this.uActDim.value = 0.85; - this.uIgnition.value = 3.0; - this.uBurst.value = 1.0; - this.uBlast.value = 1.0; - this.uBlastTime.value = 0; - // Vary the mode tint randomly too so the palette keeps surprising. - const modes = [1, 2, 3]; - this.uMode.value = modes[Math.floor(Math.random() * modes.length)]; - this.uModeTintAmt.value = 0.3 + Math.random() * 0.5; - } - - /** Size the containment sphere (world units) so the storm always stays in - * frame. The sandbox derives this from the camera distance + fov. */ - setContainRadius(radius: number): void { - this.uContainRadius.value = Math.max(8, radius); - } - - /** Enable/disable the infinite Droste zoom dive. Off for beats 0/1 (calm) and - * reduced-motion; on for Act II+ and dream mode. */ - setZoom(on: boolean): void { - this.uZoomOn.value = on ? 1 : 0; - } - - /** View-space apparent particle velocity (the negated, view-transformed camera - * velocity). Drives the streak orientation + length. */ - setCameraVel(v: THREE.Vector3): void { - this.uCamVelView.value.copy(v); - } - - /** Flythrough streak strength 0..1. Set to 0 for reduced-motion (no streak). */ - setStreak(s: number): void { - this.uStreak.value = s; - } - - dispose(): void { - if (this.mesh) { - this.scene.remove(this.mesh); - this.mesh.geometry?.dispose(); - this.mesh.dispose?.(); - this.mesh = null; - } - this.material?.dispose(); - this.material = null; - // StorageBufferAttribute extends BufferAttribute, which has no dispose(): - // its GPU buffer is released by the renderer when the owning geometry is - // disposed (done above). Drop our references so the ~2.1MB of backing - // Float32Arrays can be garbage-collected. - this.bufferPos = null; - this.bufferVel = null; - this.bufferPhase = null; - } -} diff --git a/apps/dashboard/src/lib/graph/cinema/topology.ts b/apps/dashboard/src/lib/graph/cinema/topology.ts deleted file mode 100644 index 5518b39..0000000 --- a/apps/dashboard/src/lib/graph/cinema/topology.ts +++ /dev/null @@ -1,225 +0,0 @@ -// The Auteur — graph signal extraction. -// -// Pure, dependency-free statistics over the REAL /api/graph data, computed once -// per Cinema launch. These signals are what gives the AI director something -// meaningful to direct: which memory is most load-bearing (betweenness), where -// tension lives (contradictions), what's surprising (distant-but-plausible -// links), what's fading (low retention / suppression). No LLM, no WebGPU, no -// network — fully headless-testable. - -import type { GraphNode, GraphEdge } from '$types'; -import { buildAdjacency, recencyOf, isContradictionEdge } from './pathfinder'; - -export interface NodeSignal { - nodeId: string; - /** Raw connection count. */ - degree: number; - /** Brandes betweenness centrality, normalized 0..1 — how load-bearing this - * memory is as a bridge between clusters. The director favors high-betweenness - * nodes for hero shots. */ - betweenness: number; - /** Connected-component id (which cluster of memory this belongs to). */ - clusterId: number; - /** 0..1, 1 = most recent. */ - recencyRank: number; - /** FSRS retention 0..1. */ - retention: number; - /** Suppression pressure 0..1 (memory actively being forgotten). */ - suppression: number; -} - -export interface EdgeSignal { - source: string; - target: string; - isContradiction: boolean; - isMergeSupersede: boolean; - /** 0..1: high when endpoints share neighbors (plausible) yet the edge weight - * is low (distant) — a surprising, non-obvious connection. */ - surprise: number; - weight: number; -} - -export interface GraphSignals { - nodes: Map; - edges: EdgeSignal[]; - clusterCount: number; - /** Node id with the single highest betweenness — the graph's keystone. */ - peakBetweennessId: string; -} - -function isMergeSupersedeEdge(edge: GraphEdge): boolean { - const t = (edge.type ?? '').toLowerCase(); - return t.includes('merge') || t.includes('supersede') || t.includes('duplicate'); -} - -/** - * Brandes' algorithm for betweenness centrality on an unweighted, undirected - * graph. O(V·E) — fine for /api/graph payloads. Returns raw (unnormalized) - * scores keyed by node id; the caller normalizes. - */ -function brandesBetweenness(nodeIds: string[], adj: Record): Map { - const cb = new Map(); - for (const v of nodeIds) cb.set(v, 0); - - for (const s of nodeIds) { - const stack: string[] = []; - const pred = new Map(); - const sigma = new Map(); - const dist = new Map(); - for (const v of nodeIds) { - pred.set(v, []); - sigma.set(v, 0); - dist.set(v, -1); - } - sigma.set(s, 1); - dist.set(s, 0); - - // BFS (unweighted shortest paths). - const queue: string[] = [s]; - let head = 0; - while (head < queue.length) { - const v = queue[head++]; - stack.push(v); - for (const { otherId: w } of adj[v] ?? []) { - if ((dist.get(w) ?? -1) < 0) { - dist.set(w, (dist.get(v) ?? 0) + 1); - queue.push(w); - } - if ((dist.get(w) ?? -1) === (dist.get(v) ?? 0) + 1) { - sigma.set(w, (sigma.get(w) ?? 0) + (sigma.get(v) ?? 0)); - pred.get(w)!.push(v); - } - } - } - - // Accumulation (back-propagate dependencies). - const delta = new Map(); - for (const v of nodeIds) delta.set(v, 0); - while (stack.length > 0) { - const w = stack.pop()!; - for (const v of pred.get(w) ?? []) { - const c = ((sigma.get(v) ?? 0) / (sigma.get(w) || 1)) * (1 + (delta.get(w) ?? 0)); - delta.set(v, (delta.get(v) ?? 0) + c); - } - if (w !== s) cb.set(w, (cb.get(w) ?? 0) + (delta.get(w) ?? 0)); - } - } - return cb; -} - -/** Union-find connected components → a cluster id per node. */ -function components(nodeIds: string[], edges: GraphEdge[]): { clusterOf: Map; count: number } { - const parent = new Map(); - for (const id of nodeIds) parent.set(id, id); - const find = (x: string): string => { - let root = x; - while (parent.get(root) !== root) root = parent.get(root)!; - // Path compression. - let cur = x; - while (parent.get(cur) !== root) { - const next = parent.get(cur)!; - parent.set(cur, root); - cur = next; - } - return root; - }; - const union = (a: string, b: string) => { - const ra = find(a); - const rb = find(b); - if (ra !== rb) parent.set(ra, rb); - }; - for (const e of edges) { - if (parent.has(e.source) && parent.has(e.target)) union(e.source, e.target); - } - const rootToCluster = new Map(); - const clusterOf = new Map(); - let next = 0; - for (const id of nodeIds) { - const r = find(id); - if (!rootToCluster.has(r)) rootToCluster.set(r, next++); - clusterOf.set(id, rootToCluster.get(r)!); - } - return { clusterOf, count: next }; -} - -/** - * Compute all director signals from the real graph. Pure; safe to call once at - * launch. Caps betweenness work on very large graphs by limiting to the - * top-degree subset (the only nodes that can carry meaningful centrality). - */ -export function computeSignals(nodes: GraphNode[], edges: GraphEdge[]): GraphSignals { - const nodeIds = nodes.map((n) => n.id); - const adj = buildAdjacency(edges); - - // Recency ranking (0..1, 1 = newest). - const byRecency = [...nodes].sort((a, b) => recencyOf(a) - recencyOf(b)); - const recencyRank = new Map(); - byRecency.forEach((n, i) => recencyRank.set(n.id, nodes.length > 1 ? i / (nodes.length - 1) : 1)); - - // Betweenness — guard pathological sizes: above the cap, compute on the - // top-degree subset (others get 0; they can't be meaningful bridges anyway). - const BETWEENNESS_CAP = 600; - let betweennessNodes = nodeIds; - if (nodeIds.length > BETWEENNESS_CAP) { - betweennessNodes = [...nodeIds] - .sort((a, b) => (adj[b]?.length ?? 0) - (adj[a]?.length ?? 0)) - .slice(0, BETWEENNESS_CAP); - } - const rawBetween = brandesBetweenness(betweennessNodes, adj); - let maxBetween = 0; - for (const v of rawBetween.values()) maxBetween = Math.max(maxBetween, v); - - const { clusterOf, count: clusterCount } = components(nodeIds, edges); - - const maxSuppression = Math.max(1, ...nodes.map((n) => n.suppression_count ?? 0)); - - const nodeSignals = new Map(); - let peakBetweennessId = nodeIds[0] ?? ''; - let peakVal = -1; - for (const n of nodes) { - const bt = maxBetween > 0 ? (rawBetween.get(n.id) ?? 0) / maxBetween : 0; - if (bt > peakVal) { - peakVal = bt; - peakBetweennessId = n.id; - } - nodeSignals.set(n.id, { - nodeId: n.id, - degree: adj[n.id]?.length ?? 0, - betweenness: bt, - clusterId: clusterOf.get(n.id) ?? 0, - recencyRank: recencyRank.get(n.id) ?? 0, - retention: clamp01(n.retention ?? 0), - suppression: clamp01((n.suppression_count ?? 0) / maxSuppression), - }); - } - - // Edge signals incl. surprise (shared-neighbor overlap × edge distance). - const neighborSets = new Map>(); - for (const id of nodeIds) neighborSets.set(id, new Set((adj[id] ?? []).map((a) => a.otherId))); - const edgeSignals: EdgeSignal[] = edges.map((e) => { - const a = neighborSets.get(e.source); - const b = neighborSets.get(e.target); - let shared = 0; - if (a && b) { - const [small, large] = a.size < b.size ? [a, b] : [b, a]; - for (const x of small) if (large.has(x)) shared++; - } - const union = (a?.size ?? 0) + (b?.size ?? 0) - shared || 1; - const overlap = shared / union; // Jaccard: structural plausibility. - const distance = 1 - clamp01(e.weight ?? 0); // low weight = semantically distant. - return { - source: e.source, - target: e.target, - isContradiction: isContradictionEdge(e), - isMergeSupersede: isMergeSupersedeEdge(e), - surprise: clamp01(overlap * distance * 2), // plausible AND distant = surprising. - weight: e.weight ?? 0, - }; - }); - - return { nodes: nodeSignals, edges: edgeSignals, clusterCount, peakBetweennessId }; -} - -function clamp01(x: number): number { - return Math.max(0, Math.min(1, Number.isFinite(x) ? x : 0)); -} diff --git a/apps/dashboard/src/lib/stores/api.ts b/apps/dashboard/src/lib/stores/api.ts index 950ec99..f4b77e0 100644 --- a/apps/dashboard/src/lib/stores/api.ts +++ b/apps/dashboard/src/lib/stores/api.ts @@ -12,11 +12,7 @@ import type { ConsolidationResult, IntentionItem, SuppressResult, - UnsuppressResult, - SanhedrinAppealReason, - SanhedrinAppealResponse, - SanhedrinLatestResponse, - SanhedrinTelemetryResponse + UnsuppressResult } from '$types'; const BASE = '/api'; @@ -123,132 +119,5 @@ export const api = { fetcher>('/deep_reference', { method: 'POST', body: JSON.stringify({ query, depth }) - }), - - sanhedrin: { - latest: () => fetcher('/sanhedrin/latest'), - telemetry: (days = 7) => fetcher(`/sanhedrin/telemetry?days=${days}`), - appeal: (reason: SanhedrinAppealReason, note?: string, claimId?: string, receiptId?: string) => - fetcher('/sanhedrin/appeal', { - method: 'POST', - body: JSON.stringify({ reason, note, claimId, receiptId }) - }) - }, - - // Agent Black Box (v2.2): replayable agent-run traces. The runId in a tool - // result threads through here unchanged — one id, end to end. - traces: { - list: (limit = 50) => fetcher(`/traces?limit=${limit}`), - get: (runId: string) => fetcher(`/traces/${encodeURIComponent(runId)}`), - exportUrl: (runId: string) => `${BASE}/traces/${encodeURIComponent(runId)}/export` - }, - - // Memory Receipts (v2.2): the nutrition label for a retrieval. - receipts: { - list: (limit = 50) => fetcher(`/receipts?limit=${limit}`), - // B5: scope to one run so the Black Box panel shows that run's receipts. - listForRun: (runId: string, limit = 50) => - fetcher( - `/receipts?run=${encodeURIComponent(runId)}&limit=${limit}` - ), - get: (receiptId: string) => fetcher(`/receipts/${encodeURIComponent(receiptId)}`) - }, - - // Memory PRs (v2.2): the risk-gated brain-change review queue. - memoryPrs: { - list: (status?: string, limit = 100) => { - const qs = new URLSearchParams(); - if (status) qs.set('status', status); - qs.set('limit', String(limit)); - return fetcher(`/memory-prs?${qs.toString()}`); - }, - get: (id: string) => fetcher(`/memory-prs/${encodeURIComponent(id)}`), - act: (id: string, action: MemoryPrAction) => - fetcher>(`/memory-prs/${encodeURIComponent(id)}/${action}`, { - method: 'POST' - }), - getMode: () => fetcher<{ mode: ReviewMode; pendingCount: number }>('/memory-prs/mode'), - setMode: (mode: ReviewMode) => - fetcher<{ mode: ReviewMode }>('/memory-prs/mode', { - method: 'POST', - body: JSON.stringify({ mode }) - }) - } -}; - -// --------------------------------------------------------------------------- -// Agent Black Box / Receipts / Memory PR types -// --------------------------------------------------------------------------- - -export type TraceRunSummary = { - runId: string; - firstTool: string | null; - eventCount: number; - retrievedCount: number; - suppressedCount: number; - writeCount: number; - vetoCount: number; - startedAt: number; - lastAt: number; -}; - -export type TraceRunListResponse = { total: number; runs: TraceRunSummary[] }; - -/** One trace event — discriminated on `type`, matching the Rust schema. */ -export type TraceEvent = - | { type: 'mcp.call'; runId: string; tool: string; argsHash: string; at: number } - | { type: 'memory.retrieve'; runId: string; ids: string[]; activation: Record; at: number } - | { type: 'memory.suppress'; runId: string; id: string; reason: string; at: number } - | { type: 'memory.write'; runId: string; id: string; diff: unknown; source: string; at: number } - | { type: 'contradiction.detected'; runId: string; ids: string[]; winnerId?: string; detail: string; at: number } - | { type: 'sanhedrin.veto'; runId: string; claim: string; evidenceIds: string[]; confidence: number; at: number } - | { type: 'dream.patch'; runId: string; proposalIds: string[]; at: number }; - -export type TraceDetail = { - runId: string; - summary: Omit | null; - events: TraceEvent[]; -}; - -export type Receipt = { - receipt_id: string; - retrieved: string[]; - suppressed: { id: string; reason: string }[]; - activation_path: string[]; - trust_floor: number; - decay_risk: 'low' | 'medium' | 'high'; - mutations: { id: string; kind: string; note?: string }[]; -}; - -export type ReceiptListResponse = { total: number; receipts: Receipt[] }; - -export type MemoryPrAction = - | 'promote' - | 'merge' - | 'supersede' - | 'quarantine' - | 'forget' - | 'ask_agent_why'; - -export type ReviewMode = 'fast' | 'risk_gated' | 'paranoid'; - -export type MemoryPr = { - id: string; - kind: string; - status: string; - title: string; - diff: Record; - signals: { code: string; detail: string }[]; - subject_id?: string; - run_id?: string; - created_at: string; - decided_at?: string; - decision?: string; -}; - -export type MemoryPrListResponse = { - total: number; - pendingCount: number; - mode: ReviewMode; - prs: MemoryPr[]; + }) }; diff --git a/apps/dashboard/src/lib/stores/toast.ts b/apps/dashboard/src/lib/stores/toast.ts index 6bc195c..6daef38 100644 --- a/apps/dashboard/src/lib/stores/toast.ts +++ b/apps/dashboard/src/lib/stores/toast.ts @@ -61,13 +61,6 @@ function createToastStore() { update(list => { const next = [entry, ...list]; if (next.length > MAX_VISIBLE) { - for (const dropped of next.slice(MAX_VISIBLE)) { - const handle = dwellTimers.get(dropped.id); - if (handle) clearTimeout(handle); - dwellTimers.delete(dropped.id); - dwellPaused.delete(dropped.id); - dwellStart.delete(dropped.id); - } return next.slice(0, MAX_VISIBLE); } return next; @@ -236,18 +229,6 @@ function createToastStore() { }; } - case 'HookVerdictRecorded': { - const verdict = String(d.verdict ?? 'NOTE'); - const reason = String(d.reason ?? 'Sanhedrin receipt updated'); - return { - type: event.type, - title: `Sanhedrin ${verdict}`, - body: reason, - color, - dwellMs: verdict === 'VETO' ? 8000 : DEFAULT_DWELL_MS, - }; - } - // Noise — never toast case 'Heartbeat': case 'SearchPerformed': diff --git a/apps/dashboard/src/lib/stores/websocket.ts b/apps/dashboard/src/lib/stores/websocket.ts index 2e591ac..8554581 100644 --- a/apps/dashboard/src/lib/stores/websocket.ts +++ b/apps/dashboard/src/lib/stores/websocket.ts @@ -6,13 +6,11 @@ const MAX_EVENTS = 200; function createWebSocketStore() { const { subscribe, set, update } = writable<{ connected: boolean; - reconnecting: boolean; events: VestigeEvent[]; lastHeartbeat: VestigeEvent | null; error: string | null; }>({ connected: false, - reconnecting: false, events: [], lastHeartbeat: null, error: null @@ -34,7 +32,7 @@ function createWebSocketStore() { ws.onopen = () => { reconnectAttempts = 0; - update(s => ({ ...s, connected: true, reconnecting: false, error: null })); + update(s => ({ ...s, connected: true, error: null })); }; ws.onmessage = (event) => { @@ -67,7 +65,6 @@ function createWebSocketStore() { function scheduleReconnect(url: string) { if (reconnectTimer) clearTimeout(reconnectTimer); - update(s => ({ ...s, reconnecting: true })); const delay = Math.min(1000 * 2 ** reconnectAttempts, 30000); reconnectAttempts++; reconnectTimer = setTimeout(() => connect(url), delay); @@ -77,7 +74,7 @@ function createWebSocketStore() { if (reconnectTimer) clearTimeout(reconnectTimer); ws?.close(); ws = null; - set({ connected: false, reconnecting: false, events: [], lastHeartbeat: null, error: null }); + set({ connected: false, events: [], lastHeartbeat: null, error: null }); } function clearEvents() { @@ -111,7 +108,6 @@ export const websocket = createWebSocketStore(); // Derived stores for specific event types export const isConnected = derived(websocket, $ws => $ws.connected); -export const isReconnecting = derived(websocket, $ws => $ws.reconnecting); export const eventFeed = derived(websocket, $ws => $ws.events); export const heartbeat = derived(websocket, $ws => $ws.lastHeartbeat); export const memoryCount = derived(websocket, $ws => @@ -132,30 +128,6 @@ export const uptimeSeconds = derived(websocket, $ws => ($ws.lastHeartbeat?.data?.uptime_secs as number) ?? 0 ); -// Agent Black Box (v2.2): the live stream of trace events, newest first. Each -// is a real `VestigeEvent::TraceEvent` backed by a persisted `agent_traces` -// row — the dashboard pulse is only ever driven by these, never by fakes. -export const traceEvents = derived(websocket, $ws => - $ws.events.filter((e) => e.type === 'TraceEvent') -); - -// The most recent runId seen on the live feed — the "current run" indicator in -// Proof Mode / the Black Box live header. -export const liveRunId = derived(websocket, $ws => { - const latest = $ws.events.find((e) => e.type === 'TraceEvent'); - return (latest?.data?.run_id as string) ?? null; -}); - -// The single most recent trace event (for the "last event" readout). -export const lastTraceEvent = derived(websocket, $ws => - $ws.events.find((e) => e.type === 'TraceEvent') ?? null -); - -// Live Memory PR notifications (opened / decided) for the queue badge + toasts. -export const memoryPrEvents = derived(websocket, $ws => - $ws.events.filter((e) => e.type === 'MemoryPrOpened' || e.type === 'MemoryPrDecided') -); - export function formatUptime(secs: number): string { if (!Number.isFinite(secs) || secs < 0) return '—'; const d = Math.floor(secs / 86_400); diff --git a/apps/dashboard/src/lib/types/index.ts b/apps/dashboard/src/lib/types/index.ts index 2989391..a76b092 100644 --- a/apps/dashboard/src/lib/types/index.ts +++ b/apps/dashboard/src/lib/types/index.ts @@ -167,10 +167,6 @@ export type VestigeEventType = | 'ActivationSpread' | 'ImportanceScored' | 'DeepReferenceCompleted' - | 'HookVerdictRecorded' - | 'TraceEvent' - | 'MemoryPrOpened' - | 'MemoryPrDecided' | 'Heartbeat'; export interface VestigeEvent { @@ -206,89 +202,6 @@ export interface UnsuppressResult { stability: number; } -export type VerdictLevel = 'PASS' | 'NOTE' | 'CAUTION' | 'VETO' | 'APPEALED'; -export type SanhedrinAppealReason = 'stale' | 'wrong' | 'too_strict'; - -export interface SanhedrinAppealState { - status: 'open' | 'appealed'; - actions?: SanhedrinAppealReason[]; - lastReason?: SanhedrinAppealReason; - note?: string; -} - -export interface SanhedrinPrecedent { - type?: string; - summary?: string; - command?: string; - exitCode?: number | null; - evidence?: string; -} - -export interface SanhedrinClaim { - id: string; - text: string; - fingerprint: string; - class: string; - subject: string; - risk: string; - evidence_state: string; - decision: string; - precedent: SanhedrinPrecedent[]; - fix: string; - appeal: SanhedrinAppealState; -} - -export interface SanhedrinReceipt { - schema: string; - id: string; - draftId: string; - createdAt: string; - overall: string; - verdictBar: VerdictLevel; - summary: string; - draftPreview: string; - claims: SanhedrinClaim[]; - receipts: Array>; - source?: Record; -} - -export interface SanhedrinLatestResponse { - receipt: SanhedrinReceipt | null; - stateDir: string; - receiptPath?: string; - htmlPath?: string; - schemaWarning?: string | null; -} - -export interface SanhedrinAppealResponse { - appeal: Record; - receipt: SanhedrinReceipt; -} - -export interface SanhedrinDailyTelemetry { - date: string; - total: number; - pass: number; - note: number; - caution: number; - veto: number; - appealed: number; - failOpen: number; -} - -export interface SanhedrinTelemetryResponse { - days: number; - stateDir: string; - totalRuns: number; - byVerdict: Partial>; - byClass: Record; - appeals: number; - failOpen: number; - truncated?: boolean; - lastRunAt?: string | null; - daily: SanhedrinDailyTelemetry[]; -} - // Intentions (prospective memory) export interface IntentionItem { id: string; @@ -325,7 +238,6 @@ export const EVENT_TYPE_COLORS: Record = { Rac1CascadeSwept: '#6E3FFF', SearchPerformed: '#818CF8', DeepReferenceCompleted: '#C4B5FD', - HookVerdictRecorded: '#F59E0B', DreamStarted: '#9D00FF', DreamProgress: '#B44AFF', DreamCompleted: '#C084FC', diff --git a/apps/dashboard/src/routes/(app)/activation/+page.svelte b/apps/dashboard/src/routes/(app)/activation/+page.svelte index ed4bcc0..2433e43 100644 --- a/apps/dashboard/src/routes/(app)/activation/+page.svelte +++ b/apps/dashboard/src/routes/(app)/activation/+page.svelte @@ -24,11 +24,6 @@ } from '$components/ActivationNetwork.svelte'; import { filterNewSpreadEvents } from '$components/activation-helpers'; import type { Memory, VestigeEvent } from '$types'; - import PageHeader from '$lib/components/PageHeader.svelte'; - import Icon from '$lib/components/Icon.svelte'; - import AnimatedNumber from '$lib/components/AnimatedNumber.svelte'; - import { reveal } from '$lib/actions/reveal'; - import { spotlight, magnetic } from '$lib/actions/interactions'; let searchQuery = $state(''); let loading = $state(false); @@ -185,30 +180,19 @@ }); -
                    - -
                    - - {liveEnabled ? 'Live' : 'Paused'} - · - - bursts -
                    -
                    +
                    +
                    +

                    Spreading Activation

                    +

                    + Collins & Loftus 1975 — activation spreads from a seed memory to + neighbours along semantic edges, decaying by 0.93 per animation frame + until it drops below 0.05. Search seeds a focused burst; live mode + overlays every spread event fired by the cognitive engine in real time. +

                    +
                    -
                    +
                    Seed Memory
                    @@ -254,8 +236,8 @@ {#if loading}
                    -
                    -

                    Computing activation…

                    +
                    +

                    Computing activation...

                    {:else if errorMessage} @@ -268,8 +250,8 @@
                    {:else if !focusedSource && searched}
                    -
                    -
                    +
                    +

                    No matching memory

                    Nothing in the graph matches @@ -281,8 +263,8 @@

                    {:else if !focusedSource}
                    -
                    -
                    +
                    +

                    Waiting for activation

                    Seed a burst with the search bar above, or enable live mode to diff --git a/apps/dashboard/src/routes/(app)/blackbox/+page.svelte b/apps/dashboard/src/routes/(app)/blackbox/+page.svelte deleted file mode 100644 index 3187bf8..0000000 --- a/apps/dashboard/src/routes/(app)/blackbox/+page.svelte +++ /dev/null @@ -1,954 +0,0 @@ - - -

                    - - - - - - -
                    -
                    - WebSocket - - - {$isConnected ? 'Connected' : 'Offline'} - -
                    -
                    - Live runId - {$liveRunId ?? '—'} -
                    -
                    - Last event - - {#if $lastTraceEvent} - - {eventLabel(($lastTraceEvent.data?.event as TraceEvent)?.type)} - - {:else} - awaiting… - {/if} - -
                    -
                    - Events seen - - - -
                    -
                    - - {#if !proofMode} -
                    - - - - -
                    - {#if loading} -
                    Loading trace…
                    - {:else if error} -
                    {error}
                    - {:else if !detail} -
                    Select a run to replay.
                    - {:else} - -
                    -
                    - - Step {scrubIndex + 1} / {detail.events.length} - - {#if currentEvent} - +{relativeMs(currentEvent.at, startAt)}ms - {/if} -
                    - - -
                    - {#each detail.events as ev, i (i)} - - {/each} -
                    -
                    - - - {#if currentEvent} -
                    -
                    - {eventGlyph(currentEvent.type)} - {eventLabel(currentEvent.type)} - {formatAt(currentEvent.at)} -
                    -

                    {eventSummary(currentEvent)}

                    - - {#if currentEvent.type === 'memory.retrieve'} -
                    - {#each currentEvent.ids as id (id)} - - {id.slice(0, 8)} - {#if currentEvent.activation[id] != null} - {(currentEvent.activation[id] * 100).toFixed(0)}% - {/if} - - {/each} -
                    - {:else if currentEvent.type === 'contradiction.detected'} -
                    - kept {currentEvent.winnerId?.slice(0, 8)} - vs - {#each currentEvent.ids.filter((i) => i !== currentEvent.winnerId) as id (id)} - {id.slice(0, 8)} - {/each} -
                    - {:else if currentEvent.type === 'sanhedrin.veto'} -
                    - {#each currentEvent.evidenceIds as id (id)} - {id.slice(0, 8)} - {/each} -
                    - {/if} -
                    - {/if} - - -
                    -

                    - Memory pulse — touched this run -

                    - {#if pulsedIds.length === 0} -

                    No memories touched yet.

                    - {:else} -
                    - {#each pulsedIds as id (id)} - {id.slice(0, 8)} - {/each} -
                    - {/if} -
                    - - -
                    -

                    Event producers — this run

                    -
                      -
                    • - mcp.call · memory.write · memory.retrieve · memory.suppress - live -
                    • -
                    • - contradiction.detected - - {hasContradiction ? 'fired this run' : 'no contradiction in this run'} - -
                    • -
                    • - dream.patch - - {hasDream ? 'fired this run' : 'No dream run in this trace'} - -
                    • -
                    • - sanhedrin.veto - - {hasVeto ? 'fired this run' : 'No veto producer connected (optional Sanhedrin hook, off by default)'} - -
                    • -
                    -
                    - - - {#if receipts.length} -
                    -

                    - Receipts — proof behind retrievals -

                    -
                    - {#each receipts.slice(0, 2) as r (r.receipt_id)} - - {/each} -
                    -
                    - {/if} - - -
                    -

                    Event log

                    -
                      - {#each detail.events as ev, i (i)} -
                    1. scrubIndex} - style:--c={eventColor(ev.type)} - > - -
                    2. - {/each} -
                    -
                    - {/if} -
                    -
                    - {:else} - -
                    -
                    - - {$liveRunId ?? 'awaiting run…'} -
                    - {#if $lastTraceEvent} - {@const ev = $lastTraceEvent.data?.event as TraceEvent} -
                    - {eventGlyph(ev?.type)} -
                    -
                    {eventLabel(ev?.type)}
                    -
                    {eventSummary(ev)}
                    -
                    -
                    - {/if} -
                    - - trace events -
                    -

                    Watch the agent think. Watch memory change. Watch the receipt prove why.

                    -
                    - {/if} -
                    - - diff --git a/apps/dashboard/src/routes/(app)/contradictions/+page.svelte b/apps/dashboard/src/routes/(app)/contradictions/+page.svelte index 4415f0e..13ee04e 100644 --- a/apps/dashboard/src/routes/(app)/contradictions/+page.svelte +++ b/apps/dashboard/src/routes/(app)/contradictions/+page.svelte @@ -1,10 +1,5 @@
                    - +

                    Explore Connections

                    {#each (['associations', 'chains', 'bridges'] as const) as m} @@ -154,51 +144,29 @@ {#if sourceMemory} {#if loading} -
                    -
                    - - Exploring {mode}… -
                    -
                    - {#each Array(4) as _, i} -
                    -
                    -
                    -
                    -
                    -
                    -
                    - {/each} -
                    +
                    +
                    +

                    Exploring {mode}...

                    {:else if associations.length > 0}
                    -

                    - - Connections Found -

                    +

                    {associations.length} Connections Found

                    - {#each associations as assoc, i (i)} -
                    -
                    -
                    - {i + 1} -
                    -
                    -

                    {assoc.content}

                    -
                    - {#if assoc.nodeType}{assoc.nodeType}{/if} - {#if assoc.score}Score: {Number(assoc.score).toFixed(3)}{/if} - {#if assoc.similarity}Similarity: {Number(assoc.similarity).toFixed(3)}{/if} - {#if assoc.retention}{(Number(assoc.retention) * 100).toFixed(0)}% retention{/if} - {#if assoc.connectionType}{assoc.connectionType}{/if} -
                    + {#each associations as assoc, i} +
                    +
                    + {i + 1} +
                    +
                    +

                    {assoc.content}

                    +
                    + {#if assoc.nodeType}{assoc.nodeType}{/if} + {#if assoc.score}Score: {Number(assoc.score).toFixed(3)}{/if} + {#if assoc.similarity}Similarity: {Number(assoc.similarity).toFixed(3)}{/if} + {#if assoc.retention}{(Number(assoc.retention) * 100).toFixed(0)}% retention{/if} + {#if assoc.connectionType}{assoc.connectionType}{/if}
                    @@ -206,26 +174,16 @@
                    {:else} -
                    - -

                    No connections surfaced yet

                    -

                    - {#if mode === 'associations'} - This memory hasn't formed strong links here. Try a broader source query — the graph rewards more general seeds. - {:else} - No {mode} found between these two memories. Pick a different source or target and the path may light up. - {/if} -

                    +
                    +
                    +

                    No connections found for this query.

                    {/if} {/if}
                    -

                    - - Importance Scorer -

                    +

                    Importance Scorer

                    4-channel neuroscience scoring: novelty, arousal, reward, attention