diff --git a/.opencode/plans/notes-ui-overhaul.md b/.opencode/plans/notes-ui-overhaul.md new file mode 100644 index 0000000..c0fb422 --- /dev/null +++ b/.opencode/plans/notes-ui-overhaul.md @@ -0,0 +1,63 @@ +# Notes UI Overhaul (scope: items 1–6 + 9 from ideas review) + +State at pause: red test written — internal/api/media_test.go (5 cases, +build-fails on missing Server.mediaHandler). All research done. + +## Batch 1 — server (TDD, red test exists) + +1. internal/api/media.go — mediaHandler (test-ready): + - GET /v1/media?path=media/pic.jpg + - path.Clean("/"+rel) pin against s.vault.MediaPath(); prefix check -> 400 + - extension allowlist -> Content-Type (jpg/jpeg/png/gif/webp/heic/pdf), + unsupported ext -> 400; missing -> 404 via http.ServeFile + - Cache-Control: private, max-age=3600 + - register r.Get("/v1/media", s.mediaHandler) inside authed /v1 group + +## Batch 2 — NoteView upgrades (UI + small server) + +2. RelatedLink.types (internal/api/notes.go): + - noteHandler: SELECT result FROM jobs WHERE type='connections' AND + note_path=? ORDER BY created_at DESC LIMIT 1 (new queue method + GetConnectionsResultByPath or reuse); parse + {"connections":[{note_path,type}]} -> map target path -> []string types + - RelatedLink gains Types []string `json:"types,omitempty"` +3. React: image preview (api.ts + NoteView): + - client.mediaUrl(path): fetch('/v1/media?path=..', token header) -> blob + -> objectURL; NoteView renders at top when note.type==='image' + && note.source_file; revoke on unmount +4. Entity chips (NoteView + App + SearchView): + - entities from note response? NOTE: check NoteResponse lacks entities — + reader NoteContent.Entities exists; add Entities map to NoteResponse + (from note.Entities) with people/amounts/dates arrays + - NoteView chips: people/amounts/dates rows (gold people, neutral others) + - tap person -> App onSearchQuery flow: App gains searchQuery-driven + initialQuery passed to SearchView (new prop) which fires search on + mount; chip click = switch tab + prefill +5. Copy raw button: header icon (Copy) -> navigator.clipboard.writeText + (note.raw + frontmatter-ish markdown) -> toast "copied" +6. Source URL: show domain only (new URL(url).hostname), title attr full +7. Linked notes: move ABOVE content (right after linked chips = before + excerpt/full toggle); chip shows type badges from related_links[].types + (icons: contradiction GitCompare/Zap, revisit Repeat2, follow_up Clock, + person User, similar Sparkles); keep title + click behavior + +## Batch 3 — typography pass (item 9) + +8. SheetContent: sm:max-w-[560px] on md+ screens +9. note-section typography: heading scale (11px mono uppercase exists — + keep), body line-height 1.7, max-width for raw prose, Raw section + rendered via ReactMarkdown ALWAYS (fix query-time plain-text + inconsistency: wrap markdown render then apply highlighting via + HTML-escaped text-node walk — or simpler: render markdown, skip + highlighting in full view when markdown; keep highlight in excerpt + view) — DECIDE at impl: markdown always, highlight only ExcerptView +10. Footer: subtle divider + smaller mono + +## Batch 4 — wrap + +11. openapi: /v1/media endpoint + related_links.types; UI_SPEC note-view + section rewrite; docs sync +12. vitest: media blob preview mock, entity chips render, type badges; + Go: media handler tests green, notes.go types test +13. rebuild assets; live verify: image note preview, chips -> search, + linked notes above content with badges; full suites; commit(s) diff --git a/.opencode/plans/v1.2-connections-4-6.md b/.opencode/plans/v1.2-connections-4-6.md new file mode 100644 index 0000000..301192a --- /dev/null +++ b/.opencode/plans/v1.2-connections-4-6.md @@ -0,0 +1,47 @@ +# v1.2 Slice 1 — Connection Types 4–6 + +Decisions: all three types this round; priority = person 5 > contradiction 4 > +follow_up 3 ≈ amount 3 > similar 2 > revisit 1. + +## Step 1 — Type 6: revisit (pure computation) +- internal/connections/revisit.go: `findRevisit(similar []Connection, cutoff) *Connection` +- Reuses semantic-similar matches already fetched in Find; if >=3 matches span + >6 months (oldest..newest), emit one connection: + label "you've returned to this idea N times since [date]", NotePath=oldest, + excerpt from newest (bookends) +- Table tests: span math, threshold boundary, <3 matches, no-span case + +## Step 2 — Type 5: follow-up +- queue.Store += FindFollowupCandidates(ctx, person, keywords, before, limit) + -> FTS5 intent keywords ("follow up","todo","need to","will send","promise") + AND notes sharing the person entity, created before now-14d, excluding self +- followup.go detector: for each shared person of the new note -> + candidates -> check NO subsequent capture mentions that person after intent + date (existing GetNotesByEntity covers) -> emit + "you planned to follow up with [name] — no record of this happening" +- Tests incl. completed-intent exclusion + +## Step 3 — Type 4: contradiction +- constants: ContradictionCheck system prompt -> strict JSON verdict +- connections.go += narrow interface ContradictionChecker + {GenerateWithSystemTemp}; Find signature gains optional checker (nil = + type skipped); worker passes adapter over w.llm at temp 0.2 +- contradiction.go: top-5 similar above cfg.ContradictionThreshold (default + 0.80); one LLM call per candidate; parse {"contradicts":bool} defensively; + fail-open per candidate; label "contradicts something you wrote [date]" +- Tests with fake checker (yes/no/garbage/error paths) + +## Step 4 — Config + plumbing +- ConnectionsTypes += Contradiction/FollowUp/Revisit (*bool, nil=on) +- ConnectionsConfig += ContradictionThreshold float64 (default 0.80) +- priority map: person 5, contradiction 4, follow_up 3, amount 3, similar 2, + revisit 1 +- Worker processConnections passes checker; config.example.yaml + SPEC + config section + UI_SPEC flare note updated + +## Step 5 — Live verify + wrap +- Capture a note echoing an old Bob/Alice topic against testdata vault; + expect revisit/follow_up surfacing in result JSON + flares +- Full suite, lint; commits sequenced 1-4; docs commit last + +Out of scope: voice notes, PDF (later v1.2 slices). diff --git a/README.md b/README.md index ce3fe49..3465195 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,12 @@ > Your private treasury of thought. Local, secure, yours. +*New here? Try the [silly version](SILLY_README.md) of this readme — no jargon allowed.* + Khayal demo -A local-first, privacy-focused second brain. Capture anything — text, images, URLs. Process locally with your own LLM. Search semantically and by keyword. Your data never leaves your machine. +A local-first, privacy-focused second brain. Capture anything — text, images, URLs, PDFs, voice. Process locally with your own LLM: tags, summaries, entities, and proactive connections that resurface what you've forgotten. Search semantically and by keyword, or ask AI questions over your own notes. Your data never leaves your machine. ## How It Works @@ -42,14 +44,20 @@ Khayal and Obsidian are complementary. Khayal is a capture and retrieval layer ## Features -- **Capture** — Text, images, URLs, articles with zero friction -- **Process** — Tags, summaries, key ideas, entities via local LLM +- **Capture** — Text, images, URLs, articles with zero friction (voice notes and PDF ingestion on the roadmap) +- **Process** — Tags, summaries, key ideas, entities (people, amounts, dates, places, orgs, URLs) via local LLM +- **Proactive connections** — after every capture, khayal resurfaces related thoughts, shared people, matching amounts, **contradictions of things you wrote**, unfinished follow-ups, and ideas you keep revisiting +- **Capture intelligence** — relative dates resolved at capture; an LLM-maintained memory file keeps naming consistent across months - **Search** — Keyword (FTS5) + semantic (chunk-level embeddings) hybrid, with passage-level excerpts -- **Store** — Plain markdown in your vault, yours forever +- **AI answers** — on-demand answers above search results, grounded in your own notes with `[n]` citations; explicit CTA, never automatic, never breaks search +- **Store** — Plain markdown in your vault, yours forever (Obsidian-friendly, with connection wikilinks written into frontmatter) +- **Vault care** — health report, broken-link repair, orphaned-media cleanup, duplicate detection, soft-delete with trash +- **Backup** — encrypted (age) vault/database/config backups with additive-merge restore - **PWA** — Web interface, works offline, update notifications + - Live queue over WebSocket (job status streams in; polling fallback) + - AI answer with skeleton loading, connection flares on the queue, linked notes with reasons, entity chips, image previews - Offline capture queue (syncs when server is back) - Works as installable PWA on iOS and desktop - - Live pipeline visualization for queued notes - Optional Face ID / Touch ID app lock (WebAuthn PRF) that encrypts the token at rest - **CLI** — Full client (`kl`) + server admin (`khayal`) - **Updates** — Built-in update checker via GitHub releases @@ -74,6 +82,9 @@ curl -fsSL https://ollama.com/install.sh | sh ollama pull nomic-embed-text ollama pull qwen2.5:3b ollama pull moondream + +# optional: a larger model just for memory consolidation (recommended) +ollama pull qwen2.5:7b ``` ### 2. Install Khayal @@ -175,6 +186,20 @@ search: chunk_min_words: 50 chunk_overlap_words: 35 +connections: + enabled: true # proactive connections after every capture + similarity_threshold: 0.72 + types: # toggle each detector independently + similar: true + person: true + amount: true + contradiction: true + follow_up: true + revisit: true + +memory: + enabled: true # LLM context memory + memory.md consolidation + log: level: info file: logs/khayal.log @@ -188,11 +213,14 @@ See [config.example.yaml](config.example.yaml) for all options. | Location | Content | |---|---| +| `~/Documents/brain/khayal/` | Your notes (plain markdown + media) | +| `~/Documents/brain/khayal/memory.md` | LLM-maintained memory (editable by hand) | +| `~/Documents/brain/khayal/.khayal-trash/` | Soft-deleted notes (recoverable) | | `~/.config/khayal/khayal.db` | Search index + embeddings | | `~/.config/khayal/config.yaml` | Server configuration | | `~/.config/khayal/logs/` | Server logs | -All on your machine. Back up the vault directory — it's plain markdown. +All on your machine. Back up the vault directory — it's plain markdown (or use `khayal backup --encrypt`). ## Commands @@ -207,6 +235,12 @@ All on your machine. Back up the vault directory — it's plain markdown. | `khayal status` | Server status + update check | | `khayal reindex` | Rebuild search index (FTS + chunk embeddings) | | `khayal config` | View config (token redacted) | +| `khayal vault health` | Vault health report (notes, indexed %, orphans, broken links) | +| `khayal vault fix-links` | Remove broken wikilinks (dry-run by default) | +| `khayal vault clean-media` | Move orphaned media files to trash | +| `khayal vault show-duplicates` | Show potential duplicate notes | +| `khayal backup --dest ` | Backup vault, database, config (`--encrypt` for age encryption) | +| `khayal restore --from ` | Restore from backup (additive merge, refuses while running) | ### Client (`kl`) @@ -215,7 +249,8 @@ All on your machine. Back up the vault directory — it's plain markdown. | `kl "text"` | Capture text | | `kl url "https://..."` | Capture URL | | `kl image ` | Capture image | -| `kl search "query"` | Search vault | +| `kl search "query"` | Search vault (`--answer` adds a grounded AI answer) | +| `kl delete ` | Soft-delete a note (moved to `.khayal-trash/`) | | `kl recent` | Recent captures | | `kl stats` | Vault statistics | | `kl status` | Server status + update check | @@ -238,7 +273,10 @@ tail -f ~/.config/khayal/logs/khayal.log # view logs Web interface at `http://127.0.0.1:1133` - Capture text, URLs, images -- Search with excerpts +- Search with excerpts + on-demand **AI answers** with citations +- **Live queue** — job status streams over WebSocket, connection flares on finished captures +- **Note reader** — image previews, entity chips that jump to search, linked notes with reasons, copy-as-markdown +- **Delete** — two-step confirm, recoverable from trash - Offline queue (IndexedDB) - Update notification icon @@ -257,12 +295,15 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details. ## Roadmap -- **v1.0** — Core capture, search, CLI, PWA -- **v1.1** — Chunking, entity extraction, proactive connections +- **v1.0** ✅ — Core capture, search, CLI, PWA +- **v1.1** ✅ — Chunking, entity extraction, proactive connections, capture intelligence, AI answers, delete, vault commands, encrypted backups +- **v1.2** 🚧 — Contradiction / follow-up / revisit connections ✅ · voice notes · PDF ingestion +- **v1.3** — Graph connections, backlinks +- **v1.4** — YouTube / video ingestion - **v1.5** — Browser extension - **v2.0** — Setup wizard UI -See [SPEC.md](docs/SPEC.md) for full roadmap. +See [SPEC.md](docs/SPEC.md) for the full roadmap. ## License diff --git a/SILLY_README.md b/SILLY_README.md new file mode 100644 index 0000000..6e9a5bb --- /dev/null +++ b/SILLY_README.md @@ -0,0 +1,68 @@ +# Khayal — Explained Like You're Five + +(This is the silly version. The serious version is in [README.md](README.md).) + +## What is this thing? + +Imagine you have a magic notebook. + +Whenever you think something — "Tommy owes me a dollar", "I love the new treehouse plan", "need to call grandma" — you tell it to the notebook, and the notebook writes it down for you. Forever. + +That's Khayal. It's a magic notebook that lives inside your computer. + +## But wait, how does it WRITE for me? + +There's a little robot helper living in your computer too. Its name is Ollama. + +When you tell Khayal a thought, the robot: +1. Writes it down nicely (with a title and a summary) +2. Picks out the important words (like "Tommy" and "one dollar") +3. Puts it in a special list so you can find it later + +The robot lives in YOUR computer. It never tells anyone else your secrets. Not even a little bit. + +## The coolest part: the notebook REMEMBERS stuff you forgot + +Say three weeks ago you wrote: "I want to build a treehouse." + +Then today you write: "I was thinking about building a treehouse again!" + +Khayal goes: "HEY! You thought about this before! Here's the old note!" + +Sometimes it even says: "Um, last month you wrote the OPPOSITE of this. Did you change your mind?" That's called a contradiction, and catching them is the notebook's favorite game. + +It also remembers things about people. If you wrote "need to call grandma" a whole month ago and you never called her, Khayal taps you on the shoulder: "You said you'd call grandma... and then you didn't." + +(Sorry, grandma.) + +## Finding old thoughts + +You know how finding your favorite sock in a huge pile of laundry is hard? + +Finding thoughts in Khayal is the opposite of that. You type what you remember — "treehouse", "grandma", "five dollars" — and BOOM, there it is. You can even ask questions like "what did I say about the treehouse?" and it answers using YOUR notes, with little numbers showing which note said what. + +## Where do the thoughts live? + +In your computer, in a folder, as regular story-files (called markdown). Not in a cloud far away. Not on someone else's computer. YOUR computer. + +You can even open the folder and read the files yourself, or draw on them with crayons (that's called editing). + +If you get scared you'll lose them, there's a treasure-chest command that copies everything and locks it up tight with a secret key. + +## If you mess up + +Deleted something by accident? It goes to the trash folder, not to the void. Like throwing paper in a wastebasket instead of a fire. + +## The short version + +- Khayal = magic notebook in your computer +- Ollama = the robot helper that does the writing +- Your thoughts = safe at home, never sent anywhere +- Old thoughts = easy to find, and the notebook reminds you when you forget +- Grandma = still waiting for that call + +Now go capture a thought before you forget it. That's literally the whole point. + +--- + +*Grown-ups: read the real [README](README.md) for how to install and run it.* diff --git a/config.example.yaml b/config.example.yaml index 952c7ef..04cea72 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -87,11 +87,14 @@ connections: min_age_days: 7 # never surface notes younger than this (explicit 0 = same-day allowed) max_per_capture: 3 # strict quality gate similarity_threshold: 0.72 # raw-cosine cutoff (unrelated ~0.49, related ~0.79) + contradiction_threshold: 0.80 # semantic floor for contradiction candidates (v1.2) types: similar: true # toggle each type independently person: true amount: true # only surfaces when corroborated by a shared person or high similarity - + contradiction: true # LLM verdicts (v1.2) + follow_up: true # unfinished follow-up detection (v1.2) + revisit: true # recurring-idea detection (v1.2) log: level: info worker_level: info diff --git a/docs/API_CLIENT.md b/docs/API_CLIENT.md index 3e4db3c..2982ebb 100644 --- a/docs/API_CLIENT.md +++ b/docs/API_CLIENT.md @@ -321,6 +321,42 @@ func (c *Client) GetNote(ctx context.Context, notePath string, query string) (*N } ``` +## Delete & Media Methods + +```go +// notes.go + +// DeleteNote soft-deletes a note: moves it to .khayal-trash/ and purges +// its search index, chunk vectors, and entity rows. +func (c *Client) DeleteNote(ctx context.Context, notePath string) (*DeleteNoteResponse, error) { + resp, err := c.request(ctx, "DELETE", "/v1/note?path="+url.QueryEscape(notePath), nil) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + var result DeleteNoteResponse + json.NewDecoder(resp.Body).Decode(&result) + return &result, nil +} + +// MediaBlob fetches a media file as bytes (token travels in the header — +// media URLs never carry tokens). Render via blob URL in web clients. +func (c *Client) MediaBlob(ctx context.Context, mediaPath string) ([]byte, error) { + resp, err := c.request(ctx, "GET", "/v1/media?path="+url.QueryEscape(mediaPath), nil) + if err != nil { + return nil, err + } + defer resp.Body.Close() + return io.ReadAll(resp.Body) +} +``` + +Realtime queue updates are available over `GET /v1/queue/ws` (WebSocket): +after connecting, send `{"type":"auth","token":"..."}` as the first frame; +the server then streams `{event: "job_updated", job}` on every status +transition. Invalid auth closes with code 1008. + ## Types ```go @@ -404,7 +440,9 @@ type NoteResponse struct { SourceURL string `json:"source_url,omitempty"` SourceFile string `json:"source_file,omitempty"` Description string `json:"description,omitempty"` - Related []string `json:"related,omitempty"` + Related []string `json:"related,omitempty"` + RelatedLinks []RelatedLink `json:"related_links,omitempty"` + Entities map[string]interface{} `json:"entities,omitempty"` Excerpt string `json:"excerpt,omitempty"` SearchQuery string `json:"search_query,omitempty"` ExcerptSection string `json:"excerpt_section,omitempty"` @@ -425,6 +463,16 @@ type QueueStats struct { } ``` +### RelatedLink + +```go +type RelatedLink struct { + NotePath string `json:"note_path"` + Title string `json:"title"` + Types []string `json:"types,omitempty"` // similar | person | amount | contradiction | follow_up | revisit +} +``` + ## CLI Integration The `kl` CLI uses this client: diff --git a/docs/SPEC.md b/docs/SPEC.md index 35a0e02..6642411 100644 --- a/docs/SPEC.md +++ b/docs/SPEC.md @@ -1188,10 +1188,14 @@ Find notes that semantically conflict with the new note. ``` Detection: two-step - Step 1: find top-5 similar notes (score > 0.80) - Step 2: for each, run LLM contradiction check - Surface: LLM returns "yes" only -Label: "contradicts something you wrote [date]" + Step 1: find top-5 similar notes (score > contradiction_threshold, default 0.80) + Step 2: for each, run LLM verdict call (strict JSON {"contradicts": bool}) +Surface: only "contradicts": true verdicts; fail-open per candidate — + a garbage or errored verdict skips that candidate silently +Label: "contradicts something you wrote [date]" +Cost: ~3s (async job — never blocks capture) +Config: types.contradiction toggle (nil = on); nil checker in the + engine skips the type entirely (tests stay LLM-free) ``` #### Type 5 — Follow-ups Never Completed (v1.2) @@ -1200,11 +1204,13 @@ Find past notes expressing follow-up intent mentioning the same people, with no ``` Detection: three-step - Step 1: FTS5 query for intent keywords + same person - Step 2: check date of intent note - Step 3: check if subsequent notes mention same person -Filter: intent note age > 14 days -Label: "you planned to follow up with [name] — no record of this happening" + Step 1: FTS5 query for intent keywords ("follow up", "todo", + "need to", "will send", "promise") AND same person entity + Step 2: check date of intent note — age must exceed 14 days + Step 3: verify NO subsequent capture mentions that person after the + intent date (existing entity lookup) +Label: "you planned to follow up with [name] — no record of this happening" +Config: types.follow_up toggle (nil = on) ``` #### Type 6 — Ideas Revisited Over Time (v1.2) @@ -1212,12 +1218,31 @@ Label: "you planned to follow up with [name] — no record of this happening Detect when the new note is part of a recurring pattern — same topic appearing multiple times across months or years. ``` -Detection: reuse semantic similar results +Detection: reuse the semantic-similar matches already fetched by Type 1 if 3+ similar notes found spanning > 6 months Label: "you've returned to this idea [N] times since [earliest date]" Surface: oldest + newest note as bookends +Config: types.revisit toggle (nil = on) ``` +**Ranking priority (v1.2):** + +``` +person 5 > contradiction 4 > follow_up 3 ≈ amount 3 > similar 2 > revisit 1 +``` + +Selection guarantees type diversity: before the cap fills by global rank, +every present detector type reserves its best result — a flood of person +matches can no longer silence rarer types (observed live with 19+ person +connections hiding a confirmed contradiction). Same note may appear in +two type rows (complementary information); duplicates are per +(note_path, type), not per path. + +Contradiction verdict prompts must carry BOTH sides: the new note's own +content is fetched at engine time (jobs.content, falling back to chunk +text) after live testing caught one-sided prompts producing silent +always-false verdicts. + ### Async Delivery Connections run as a separate job type after ingest completes: @@ -1290,12 +1315,12 @@ connections: min_age_days: 7 max_per_capture: 3 similarity_threshold: 0.85 - contradiction_threshold: 0.80 + contradiction_threshold: 0.80 # semantic floor for contradiction candidates types: similar: true person: true amount: true - contradiction: true + contradiction: true # LLM verdicts; nil = on follow_up: true revisit: true ``` @@ -1317,12 +1342,10 @@ Total v1.2 types: ~3-4s (async — never blocks capture) ``` internal/connections/ -├── engine.go ← orchestrates all types, ranking, dedup -├── similar.go ← semantic similarity -├── entity.go ← person + amount -├── revisit.go ← revisit detection -├── followup.go ← follow-up detection -└── contradiction.go ← LLM-based contradiction detection +├── connections.go ← Find orchestrator, ranking, dedup (v1.1) +├── revisit.go ← revisit detection (v1.2) +├── followup.go ← follow-up detection (v1.2) +└── contradiction.go ← LLM-based contradiction detection (v1.2) ``` --- @@ -1569,6 +1592,12 @@ over time: headings collapse to their first occurrence along with everything under them; invalid output errors the job for retry, leaving the previous file untouched. +- **Person name-variant joins** — personal collections store spelling + variants ("Sara"/"Sarah", "Dan"/"Daniel"); person lookups (connections, + follow-up detection, completion checks) expand each name to all known + variants via case-insensitive, shared-prefix (>=3 chars), and + edit-distance-<=1 matching before querying. Stored data is never + rewritten — matching happens at read time. - **Entity glossary rescue** — when entity extraction returns zero people, known glossary names appearing in the capture text are promoted to person entities deterministically (no extra LLM call). Non-empty extractions are diff --git a/docs/TECH_STACK.md b/docs/TECH_STACK.md index 0274cae..9699996 100644 --- a/docs/TECH_STACK.md +++ b/docs/TECH_STACK.md @@ -1,12 +1,12 @@ # Khayal Tech Stack -> Technology decisions for Khayal v1. Updated: 2026-03-17 +> Technology decisions for Khayal. Updated: 2026-09-03 ## Core | Category | Choice | Rationale | |----------|--------|------------| -| Language | Go 1.22+ | Performance, single binary, native HTTP | +| Language | Go 1.25+ | Performance, single binary, native HTTP | | License | AGPLv3 | Copyleft, protects modifications | | Org | Rawnaqs | "The luster of craftsmanship" | @@ -17,7 +17,8 @@ | HTTP Router | Chi | latest | Lightweight, idiomatic Go, middleware support | | Server | Go net/http | stdlib | No external dependency | | Auth | Token (X-Khayal-Token header) | - | Simple, effective, no session management | -| Logging | Zerolog | latest | JSON, structured, fast | +| Logging | log/slog | stdlib | Structured, multi-handler (console + rotating file) | +| WebSocket | gorilla/websocket | v1.5 | Live queue updates (/v1/queue/ws) | ## Database @@ -27,6 +28,7 @@ | Job Queue | SQLite | Built-in, reliable | | Full-Text Search | SQLite FTS5 | Built-in | | Vector Search | Pure Go cosine similarity | No external dependencies, batch processing | +| Backup Encryption | filippo.io/age | v1.2.0 | Embedded, pure Go; armored X25519 | **Notes:** - Uses `modernc.org/sqlite` for pure Go SQLite (no CGO, no system dependencies) @@ -41,7 +43,8 @@ | Fallback 1 | Groq | Fast inference, good API | | Fallback 2 | OpenAI | Universal fallback | | Embedding Model | nomic-embed-text | Ollama default, good quality | -| Text Model | llama3.2:3b | Balanced size/performance | +| Text Model | qwen2.5:3b (default config: llama3.2:3b) | Balanced size/performance | +| Consolidation Model | optional (e.g. qwen2.5:7b) | Dedicated model for memory consolidation; temp 0.2 | | Vision Model | moondream | Lightweight, effective | ## CLI @@ -60,9 +63,12 @@ |-----------|--------|-----------| | Framework | React 18+ | Ecosystem, familiarity | | Build Tool | Vite | Fast, simple, HMR | -| Routing | React Router | Standard | -| State | Zustand | Minimal, TypeScript-friendly | +| Routing | Tab state (single-page) | No router dependency needed | +| State | React hooks | Minimal surface | | HTTP Client | Fetch (native) | No extra dependency | +| Animation | framer-motion | Sheet/queue/list transitions | +| Testing | Vitest + Testing Library | Unit/component | +| E2E | Playwright | Capture/search/queue flows | | Offline | IndexedDB (idb-keyval) | Simple promise-based API | | Styling | CSS Modules + rawnaqs/theme | Scoped, design system | diff --git a/docs/UI_SPEC.md b/docs/UI_SPEC.md index 8a74e60..28b3bfa 100644 --- a/docs/UI_SPEC.md +++ b/docs/UI_SPEC.md @@ -602,6 +602,24 @@ const modes = ['hybrid', 'keyword', 'semantic'] --- +## Note view — full upgrade (v1.2) + +```tsx +// Sheet: 580px on md+ desktops, reading line-height 1.7, styled prose +// Image captures: media blob preview at top (GET /v1/media, token +// header; objectURL revoked on unmount — no token in URLs) +// Entity chips: people (gold) / amounts / dates from frontmatter; +// tap -> search tab pre-filled with the value +// Header: copy-as-markdown button (title+summary+ideas+raw+source) +// Linked notes: ABOVE content, each row shows WHY via type icons +// (contradiction/revisit/follow_up/person/similar from the +// connections result) + muted type label on the right +// FullNoteView renders raw as markdown consistently (highlighting +// stays in excerpt view); source URL shows hostname only +``` + +--- + ## Note view — two-step delete (v1.1 phase 3) ```tsx diff --git a/docs/api/openapi.yaml b/docs/api/openapi.yaml index 6479913..96332d7 100644 --- a/docs/api/openapi.yaml +++ b/docs/api/openapi.yaml @@ -202,6 +202,33 @@ paths: '401': $ref: '#/components/responses/Unauthorized' + /media: + get: + tags: + - Vault + summary: Fetch a media file + description: | + Streams a media file from the vault's media directory (v1.2). + Path must resolve inside the media dir; extension allowlist + (jpg/jpeg/png/gif/webp/heic/pdf). PWA fetches with the token + header and renders via blob URL — media URLs never carry tokens. + parameters: + - name: path + in: query + required: true + description: Media-dir-relative path (e.g. "media/1777455624.jpg") + schema: + type: string + responses: + '200': + description: Media bytes with the derived Content-Type + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '401': + $ref: '#/components/responses/Unauthorized' + /queue: get: tags: diff --git a/external/react/src/App.tsx b/external/react/src/App.tsx index e2ee09b..c7ad6ff 100644 --- a/external/react/src/App.tsx +++ b/external/react/src/App.tsx @@ -27,6 +27,7 @@ export default function App() { const [selectedNote, setSelectedNote] = useState(null) const [searchQuery, setSearchQuery] = useState('') const [deletedNotes, setDeletedNotes] = useState([]) + const [pendingSearch, setPendingSearch] = useState(undefined) const handleCaptureQuery = useCallback((query: string) => { setCaptureQuery(query) @@ -47,6 +48,15 @@ export default function App() { setSearchQuery('') }, []) + const handleEntitySearch = useCallback((q: string) => { + setPendingSearch(q) + setActiveTab('search') + }, []) + + const handlePendingSearchConsumed = useCallback(() => { + setPendingSearch(undefined) + }, []) + const handleNoteDeleted = useCallback((notePath: string) => { setDeletedNotes(prev => [...prev, notePath]) setSelectedNote(null) @@ -73,7 +83,7 @@ export default function App() { case 'capture': return case 'search': - return + return case 'queue': return default: @@ -108,6 +118,11 @@ export default function App() { query={searchQuery || undefined} onClose={handleBackToSearch} onDeleted={handleNoteDeleted} + onOpenNote={(p) => { + setSelectedNote(p) + setSearchQuery('') + }} + onSearch={handleEntitySearch} /> diff --git a/external/react/src/components/note/FullNoteView.tsx b/external/react/src/components/note/FullNoteView.tsx index e1d5332..8d1d4b9 100644 --- a/external/react/src/components/note/FullNoteView.tsx +++ b/external/react/src/components/note/FullNoteView.tsx @@ -1,4 +1,3 @@ -import { HighlightedText } from '@/components/search/HighlightedText' import ReactMarkdown from 'react-markdown' import remarkGfm from 'remark-gfm' import type { NoteResponse } from '@/lib/api' @@ -8,8 +7,6 @@ interface FullNoteViewProps { } export function FullNoteView({ note }: FullNoteViewProps) { - const query = note.search_query - return (
{/* Summary */} @@ -17,7 +14,7 @@ export function FullNoteView({ note }: FullNoteViewProps) {

Summary

- + {note.summary}

)} @@ -28,9 +25,7 @@ export function FullNoteView({ note }: FullNoteViewProps) {

Key Ideas

    {note.key_ideas.map((idea, i) => ( -
  • - -
  • +
  • {idea}
  • ))}
@@ -39,12 +34,8 @@ export function FullNoteView({ note }: FullNoteViewProps) { {/* Raw */}

Raw

-
- {query ? ( - - ) : ( - {note.raw} - )} +
+ {note.raw}
@@ -53,7 +44,7 @@ export function FullNoteView({ note }: FullNoteViewProps) {

Description

- + {note.description}

)} @@ -72,7 +63,7 @@ export function FullNoteView({ note }: FullNoteViewProps) { textDecoration: 'underline', }} > - {note.source_url} + {(() => { try { return new URL(note.source_url).hostname } catch { return note.source_url } })()} )} diff --git a/external/react/src/components/note/NoteView.tsx b/external/react/src/components/note/NoteView.tsx index 28b5d51..213bb98 100644 --- a/external/react/src/components/note/NoteView.tsx +++ b/external/react/src/components/note/NoteView.tsx @@ -3,17 +3,35 @@ import { useNote } from "@/hooks/useNote"; import { useVaultLock } from "@/hooks/useVaultLock"; import { useToast } from "@/hooks/use-toast"; import { createClient } from "@/lib/api"; -import { Sheet, SheetContent } from "@/components/ui/sheet"; +import { Sheet, SheetContent, SheetTitle, SheetDescription } from "@/components/ui/sheet"; import { Skeleton } from "@/components/ui/skeleton"; -import { Trash2, X } from "lucide-react"; +import { Trash2, X, Link2, Copy, Zap, Repeat2, Clock, User, Sparkles } from "lucide-react"; import { ExcerptView } from "./ExcerptView"; import { FullNoteView } from "./FullNoteView"; +const LINK_TYPE_ICONS: Record = { + contradiction: , + revisit: , + follow_up: , + person: , + similar: , +}; + +const LINK_TYPE_LABELS: Record = { + contradiction: "contradicts", + revisit: "revisited", + follow_up: "follow-up", + person: "person", + similar: "similar", +}; + interface NoteViewProps { notePath: string | null; query?: string; onClose: () => void; onDeleted?: (notePath: string) => void; + onOpenNote?: (notePath: string) => void; + onSearch?: (query: string) => void; } function getTypeBadgeClass(type: string) { @@ -38,11 +56,13 @@ function formatDate(dateStr: string) { } } -export function NoteView({ notePath, query, onClose, onDeleted }: NoteViewProps) { +export function NoteView({ notePath, query, onClose, onDeleted, onOpenNote, onSearch }: NoteViewProps) { const { note, loading, error } = useNote(notePath, query); const [view, setView] = useState<"excerpt" | "full">("excerpt"); const [confirming, setConfirming] = useState(false); const [deleting, setDeleting] = useState(false); + const [mediaUrl, setMediaUrl] = useState(null); + const [copied, setCopied] = useState(false); const { token } = useVaultLock(); const { toast } = useToast(); @@ -50,8 +70,51 @@ export function NoteView({ notePath, query, onClose, onDeleted }: NoteViewProps) setView("excerpt"); setConfirming(false); setDeleting(false); + setCopied(false); }, [notePath]); + // Image preview: token-authed blob fetch (no token in URL) + useEffect(() => { + setMediaUrl(null); + if (!notePath || !note?.source_file || note.type !== "image") return; + let revoke: string | null = null; + let alive = true; + createClient(token) + .mediaBlob(note.source_file) + .then((blob) => { + if (!alive) return; + revoke = URL.createObjectURL(blob); + setMediaUrl(revoke); + }) + .catch(() => { + // preview is best-effort + }); + return () => { + alive = false; + if (revoke) URL.revokeObjectURL(revoke); + }; + }, [notePath, note?.source_file, note?.type, token, note]); + + const handleCopy = async () => { + if (!note) return; + const md = [ + `# ${note.title || "Note"}`, + note.summary ? `\n${note.summary}` : "", + note.key_ideas?.length ? `\n${note.key_ideas.map((k) => `- ${k}`).join("\n")}` : "", + `\n${note.raw}`, + note.source_url ? `\nSource: ${note.source_url}` : "", + ] + .filter(Boolean) + .join("\n"); + try { + await navigator.clipboard.writeText(md); + setCopied(true); + setTimeout(() => setCopied(false), 1600); + } catch { + toast({ title: "Copy failed", variant: "destructive" }); + } + }; + const handleDelete = async () => { if (!notePath || deleting) return; setDeleting(true); @@ -82,13 +145,20 @@ export function NoteView({ notePath, query, onClose, onDeleted }: NoteViewProps) > + {/* Screen-reader title: the visible h2 is decorative styling */} + {note?.title || "Note"} + + Note details, connections, and actions + + {/* Header */}
{!loading && note && ( - confirming ? ( + <> + + {confirming ? (
move to trash? @@ -141,7 +221,8 @@ export function NoteView({ notePath, query, onClose, onDeleted }: NoteViewProps) > - ) + )} + )}
@@ -195,6 +276,89 @@ export function NoteView({ notePath, query, onClose, onDeleted }: NoteViewProps) ))}
+ {/* Image preview for image captures */} + {note.type === "image" && note.source_file && ( + mediaUrl ? ( + {note.title + ) : ( +
+ +
+ ) + )} + + {/* Entity chips — tap to search */} + {(() => { + // YAML frontmatter stores amounts (and sometimes dates) as + // numbers — coerce everything to strings before use. + const people = (note.entities?.people || []).map(String); + const amounts = (note.entities?.amounts || []).map(String); + const dates = (note.entities?.dates || []).map(String); + if (people.length === 0 && amounts.length === 0 && dates.length === 0) return null; + return ( +
+ {people.map((p, i) => ( + + ))} + {amounts.map((a, i) => ( + + ))} + {dates.map((d, i) => ( + + ))} +
+ ); + })()} + + {/* Linked notes — above content, with reason badges. + Keyed by the note path: switching notes remounts the + list so hover/focus state never lingers on a chip. */} + {note.related_links && note.related_links.length > 0 && ( +
+
linked notes
+ {note.related_links.map((link, i) => ( + + ))} +
+ )} + {/* Excerpt box */} {note.excerpt && (
diff --git a/external/react/src/components/note/__tests__/NoteView.delete.test.tsx b/external/react/src/components/note/__tests__/NoteView.delete.test.tsx index abc320e..bff9c72 100644 --- a/external/react/src/components/note/__tests__/NoteView.delete.test.tsx +++ b/external/react/src/components/note/__tests__/NoteView.delete.test.tsx @@ -39,6 +39,8 @@ vi.mock('@/lib/api', async (importOriginal) => { vi.mock('@/components/ui/sheet', () => ({ Sheet: ({ children }: any) => <>{children}, SheetContent: ({ children }: any) =>
{children}
, + SheetTitle: ({ children }: any) =>
{children}
, + SheetDescription: ({ children }: any) =>
{children}
, })) describe('NoteView delete affordance', () => { @@ -91,3 +93,31 @@ describe('NoteView delete affordance', () => { expect(onClose).not.toHaveBeenCalled() }) }) + +describe('NoteView linked-notes chips', () => { + it('renders related links as clickable chips and switches note on click', async () => { + vi.resetModules() + const onOpenNote = vi.fn() + vi.doMock('@/hooks/useNote', () => ({ + useNote: () => ({ + note: { + note_path: 'khayal/hates.md', + title: 'Hates', + type: 'text', + related_links: [ + { note_path: 'khayal/2026-08-26-bob-loves-note-abc123.md', title: 'Bob loves the note' }, + ], + }, + loading: false, + error: null, + }), + })) + const { NoteView: NV } = await import('../NoteView') + const { render: r, screen: s2, fireEvent: fe } = await import('@testing-library/react') + r( {}} onOpenNote={onOpenNote} />) + const chip = s2.getAllByTestId('note-link-chip')[0] + expect(chip.textContent).toContain('Bob loves the note') + fe.click(chip) + expect(onOpenNote).toHaveBeenCalledWith('khayal/2026-08-26-bob-loves-note-abc123.md') + }) +}) diff --git a/external/react/src/components/queue/QueueView.tsx b/external/react/src/components/queue/QueueView.tsx index f36963c..ab43edd 100644 --- a/external/react/src/components/queue/QueueView.tsx +++ b/external/react/src/components/queue/QueueView.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect, useCallback } from "react"; +import { useState, useEffect, useCallback, useRef } from "react"; import { motion } from "framer-motion"; import { RefreshCw, FileText, Link, Image, ChevronDown, ChevronUp } from "lucide-react"; import { QueueMetrics } from "./QueueMetrics"; @@ -107,8 +107,21 @@ export function QueueView({ onNoteSelect }: QueueViewProps = {}) { handleRefresh(); }, [handleRefresh]); - // Live updates: patch in place; polling remains as the fallback - useQueueWS(applyLiveJob, firstLoadDone); + // Live updates: patch in place; polling remains as the fallback. + // When an ingest job lands done, rehydrate so flare chips appear + // immediately (connection counts arrive with the queue payload). + const doneRef = useRef(false) + doneRef.current = firstLoadDone + useQueueWS((job) => { + applyLiveJob(job) + if ( + doneRef.current && + (job.status === 'done' || job.status === 'failed') && + ['text', 'image', 'article'].includes(job.type) + ) { + fetchQueue(undefined, { keepExpansion: true }) + } + }, firstLoadDone); useEffect(() => { if (!loading && !firstLoadDone) setFirstLoadDone(true); diff --git a/external/react/src/components/search/SearchView.tsx b/external/react/src/components/search/SearchView.tsx index 51c1349..e68b8f3 100644 --- a/external/react/src/components/search/SearchView.tsx +++ b/external/react/src/components/search/SearchView.tsx @@ -1,4 +1,4 @@ -import { useCallback, useEffect, useState, useMemo } from 'react' +import { useCallback, useEffect, useState, useMemo, useRef } from 'react' import { motion, AnimatePresence } from 'framer-motion' import { Search, X, AlertCircle } from 'lucide-react' import { ResultHero } from './ResultHero' @@ -52,9 +52,11 @@ interface SearchViewProps { onCaptureQuery?: (query: string) => void; onNoteSelect?: (notePath: string, query?: string) => void; deletedPaths?: string[]; + initialQuery?: string; + onInitialQueryConsumed?: () => void; } -export function SearchView({ onCaptureQuery, onNoteSelect, deletedPaths }: SearchViewProps = {}) { +export function SearchView({ onCaptureQuery, onNoteSelect, deletedPaths, initialQuery, onInitialQueryConsumed }: SearchViewProps = {}) { const [query, setQuery] = useState('') const [searchedQuery, setSearchedQuery] = useState("") const [mode, setMode] = useState('hybrid') @@ -84,6 +86,16 @@ export function SearchView({ onCaptureQuery, onNoteSelect, deletedPaths }: Searc setRecentSearches(getRecentSearches()) }, [search, mode]) + // Entity-chip entry: fire the pending search once on mount + const consumedInitialRef = useRef(undefined) + useEffect(() => { + if (initialQuery && consumedInitialRef.current !== initialQuery) { + consumedInitialRef.current = initialQuery + handleSearch(initialQuery) + onInitialQueryConsumed?.() + } + }, [initialQuery, handleSearch, onInitialQueryConsumed]) + const handleClear = useCallback(() => { setQuery('') setSearchedQuery("") diff --git a/external/react/src/hooks/useQueue.ts b/external/react/src/hooks/useQueue.ts index 709d0ce..3c71678 100644 --- a/external/react/src/hooks/useQueue.ts +++ b/external/react/src/hooks/useQueue.ts @@ -23,15 +23,16 @@ export function useQueue() { } }, []) - const fetchQueue = useCallback(async (status?: string) => { + const fetchQueue = useCallback(async (status?: string, opts?: { keepExpansion?: boolean }) => { setLoading(true) setError(null) try { const client = createClient(token) const response = await client.queue({ status, limit: LIMITS.QUEUE_JOBS }) - // a fresh poll resets the expanded history view - setDoneExpanded(false) + // a fresh poll resets the expanded history view unless this is a + // background rehydrate (e.g. live flare refresh) + if (!opts?.keepExpansion) setDoneExpanded(false) applyResponse(response) } catch (err) { setError(err instanceof Error ? err.message : 'Failed to fetch queue') diff --git a/external/react/src/index.css b/external/react/src/index.css index 86100b9..7b0289d 100644 --- a/external/react/src/index.css +++ b/external/react/src/index.css @@ -2535,6 +2535,179 @@ display: none; } + /* ── Note view typography & reading experience ─────────────── */ + + .note-media { + width: 100%; + border-radius: 14px; + border: 1px solid rgba(255, 255, 255, 0.07); + display: block; + } + + .note-media-loading { + display: flex; + align-items: center; + justify-content: center; + min-height: 160px; + } + + .entity-rows { + display: flex; + flex-wrap: wrap; + gap: 6px; + } + + .entity-chip { + display: inline-flex; + align-items: center; + gap: 5px; + padding: 4px 11px; + border-radius: 100px; + font-family: "IBM Plex Mono", monospace; + font-size: 10px; + font-weight: 600; + color: rgba(245, 245, 245, 0.65); + background: rgba(255, 255, 255, 0.03); + border: 1px solid rgba(255, 255, 255, 0.09); + cursor: pointer; + transition: all 0.15s; + } + + .entity-chip.person { + color: var(--gl, #e8b86d); + background: rgba(201, 147, 58, 0.06); + border-color: rgba(201, 147, 58, 0.28); + } + + .entity-chip:hover { + background: rgba(255, 255, 255, 0.07); + color: #fff; + } + + .entity-chip.person:hover { + background: rgba(201, 147, 58, 0.14); + color: var(--gl, #e8b86d); + } + + .note-raw-prose { + line-height: 1.7; + } + + .note-raw-prose p { + margin: 0 0 0.8em; + } + + .note-raw-prose h1, + .note-raw-prose h2, + .note-raw-prose h3 { + color: rgba(245, 245, 245, 0.85); + font-size: 0.95rem; + margin: 1.1em 0 0.4em; + } + + .note-raw-prose ul, + .note-raw-prose ol { + padding-left: 1.2em; + margin: 0.5em 0; + } + + .note-raw-prose code { + font-family: "IBM Plex Mono", monospace; + font-size: 0.85em; + background: rgba(255, 255, 255, 0.05); + padding: 1px 5px; + border-radius: 4px; + } + + .note-raw-prose pre { + background: rgba(255, 255, 255, 0.04); + border: 1px solid rgba(255, 255, 255, 0.06); + border-radius: 10px; + padding: 10px 12px; + overflow-x: auto; + } + + .note-raw-prose pre code { + background: none; + padding: 0; + } + + .note-raw-prose a { + color: var(--gold, #c9933a); + } + + .note-link-types-label { + margin-left: auto; + font-family: "IBM Plex Mono", monospace; + font-size: 8.5px; + font-weight: 700; + letter-spacing: 0.5px; + text-transform: uppercase; + color: rgba(245, 245, 245, 0.3); + white-space: nowrap; + flex-shrink: 0; + } + + /* ── Linked notes (note view) ───────────────────────────────── */ + + .note-links { + padding: 10px 12px; + border-radius: 12px; + background: rgba(255, 255, 255, 0.02); + border: 1px solid rgba(255, 255, 255, 0.06); + } + + .note-links-label { + font-family: "IBM Plex Mono", monospace; + font-size: 8.5px; + font-weight: 700; + letter-spacing: 0.8px; + text-transform: uppercase; + color: rgba(245, 245, 245, 0.25); + margin-bottom: 7px; + } + + .note-link-chip { + display: flex; + align-items: center; + gap: 7px; + width: 100%; + padding: 8px 10px; + margin-bottom: 4px; + border-radius: 9px; + border: 1px solid rgba(201, 147, 58, 0.14); + background: rgba(201, 147, 58, 0.04); + color: rgba(245, 245, 245, 0.75); + font-size: 12.5px; + line-height: 1.4; + text-align: left; + cursor: pointer; + transition: all 0.15s ease; + } + + .note-link-chip:last-child { + margin-bottom: 0; + } + + .note-link-chip svg { + color: var(--gold, #c9933a); + flex-shrink: 0; + } + + .note-link-chip:hover { + background: rgba(201, 147, 58, 0.1); + border-color: rgba(201, 147, 58, 0.35); + color: #fff; + } + + .note-link-title { + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + } + /* ── AI Answer ─────────────────────────────────────────────── */ /* Inline expanding AI answer row (first item in results list) */ diff --git a/external/react/src/lib/api.ts b/external/react/src/lib/api.ts index 378cc38..b8cd642 100644 --- a/external/react/src/lib/api.ts +++ b/external/react/src/lib/api.ts @@ -94,6 +94,12 @@ export interface QueueResponse { flares?: Record } +export interface RelatedLink { + note_path: string + title: string + types?: string[] +} + export interface NoteResponse { note_path: string title: string @@ -109,9 +115,17 @@ export interface NoteResponse { source_file?: string description?: string related?: string[] + related_links?: RelatedLink[] excerpt?: string search_query?: string excerpt_section?: string + entities?: { + people?: string[] + amounts?: string[] + dates?: string[] + places?: string[] + orgs?: string[] + } } export interface StatsResponse { @@ -230,6 +244,14 @@ export class KhayalClient { return this.request('GET', '/v1/stats') } + async mediaBlob(mediaPath: string): Promise { + const resp = await fetch(`${this.host}/v1/media?path=${encodeURIComponent(mediaPath)}`, { + headers: { 'X-Khayal-Token': this.token }, + }) + if (!resp.ok) throw new Error(`media fetch failed: ${resp.status}`) + return resp.blob() + } + async deleteNote(notePath: string): Promise<{ deleted: boolean; trash_path: string }> { return this.request('DELETE', `/v1/note?path=${encodeURIComponent(notePath)}`) } diff --git a/internal/api/api_test.go b/internal/api/api_test.go index a763893..7f8fb0b 100644 --- a/internal/api/api_test.go +++ b/internal/api/api_test.go @@ -98,6 +98,7 @@ func setupTestServer(t *testing.T) *testServer { Vault: config.VaultConfig{ Path: tmpDir, InboxDir: "inbox", + Media: config.MediaConfig{DefaultDir: "media"}, }, Search: config.SearchConfig{ MaxResults: 50, diff --git a/internal/api/media.go b/internal/api/media.go new file mode 100644 index 0000000..1e6b7d1 --- /dev/null +++ b/internal/api/media.go @@ -0,0 +1,58 @@ +package api + +import ( + "net/http" + "path" + "path/filepath" + "strings" +) + +var mediaContentTypes = map[string]string{ + ".jpg": "image/jpeg", + ".jpeg": "image/jpeg", + ".png": "image/png", + ".gif": "image/gif", + ".webp": "image/webp", + ".heic": "image/heic", + ".pdf": "application/pdf", +} + +// mediaHandler streams a media file from the vault's media directory. +// Auth is the standard header middleware; the path parameter must land +// inside the media dir — traversal or non-media paths are rejected. +func (s *Server) mediaHandler(w http.ResponseWriter, r *http.Request) { + rel := r.URL.Query().Get("path") + if rel == "" { + WriteError(w, "missing required parameter: path", "MEDIA_MISSING_PATH", http.StatusBadRequest) + return + } + + mediaRoot := s.vault.MediaPath() + // Normalize to inbox-relative so both conventions resolve: + // "media/x.jpg" (media-relative) and "khayal/media/x.jpg" + // (vault-relative, the shape stored in notes' source_file). Join + // against the inbox, then require the final path to live inside + // the media dir. + inboxRoot := filepath.Dir(mediaRoot) + rel = strings.TrimPrefix(rel, s.config.Vault.InboxDir+"/") + clean := path.Clean("/" + rel) + full := filepath.Join(inboxRoot, clean) + + if !strings.HasPrefix(full, mediaRoot+string(filepath.Separator)) { + s.logger.Warn("media path rejected", "path", rel) + WriteError(w, "invalid media path", "MEDIA_INVALID_PATH", http.StatusBadRequest) + return + } + + ext := strings.ToLower(filepath.Ext(full)) + ct, ok := mediaContentTypes[ext] + if !ok { + WriteError(w, "unsupported media type", "MEDIA_UNSUPPORTED_TYPE", http.StatusBadRequest) + return + } + + w.Header().Set("Content-Type", ct) + // Private: no intermediary may cache token-fetched media. + w.Header().Set("Cache-Control", "private, max-age=3600") + http.ServeFile(w, r, full) +} diff --git a/internal/api/media_test.go b/internal/api/media_test.go new file mode 100644 index 0000000..d285f87 --- /dev/null +++ b/internal/api/media_test.go @@ -0,0 +1,79 @@ +package api + +import ( + "net/http" + "net/http/httptest" + "os" + "path/filepath" + "testing" +) + +func TestMediaHandler(t *testing.T) { + ts := setupTestServer(t) + defer ts.close() + + // seed one media file inside the inbox media dir + mediaDir := filepath.Join(ts.Config.Vault.Path, ts.Config.Vault.InboxDir, "media") + if err := os.MkdirAll(mediaDir, 0755); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(filepath.Join(mediaDir, "pic.jpg"), []byte("JPEGDATA"), 0644); err != nil { + t.Fatal(err) + } + + get := func(url string) *httptest.ResponseRecorder { + req := httptest.NewRequest(http.MethodGet, url, nil) + req.Header.Set("X-Khayal-Token", "test-token") + rec := httptest.NewRecorder() + ts.Server.mediaHandler(rec, req) + return rec + } + + t.Run("serves file with content type", func(t *testing.T) { + rec := get("/v1/media?path=media/pic.jpg") + if rec.Code != http.StatusOK { + t.Fatalf("status %d body %s", rec.Code, rec.Body.String()) + } + if ct := rec.Header().Get("Content-Type"); ct != "image/jpeg" { + t.Errorf("content type: %s", ct) + } + if rec.Body.String() != "JPEGDATA" { + t.Errorf("body: %q", rec.Body.String()) + } + }) + + t.Run("vault-relative path accepted", func(t *testing.T) { + rec := get("/v1/media?path=" + ts.Config.Vault.InboxDir + "/media/pic.jpg") + if rec.Code != http.StatusOK || rec.Body.String() != "JPEGDATA" { + t.Errorf("status %d body %q", rec.Code, rec.Body.String()) + } + }) + + t.Run("traversal rejected", func(t *testing.T) { + rec := get("/v1/media?path=../../etc/passwd") + if rec.Code != http.StatusBadRequest { + t.Errorf("expected 400, got %d", rec.Code) + } + }) + + t.Run("outside media dir rejected", func(t *testing.T) { + rec := get("/v1/media?path=khayal/some-note.md") + if rec.Code != http.StatusBadRequest { + t.Errorf("expected 400 for non-media path, got %d", rec.Code) + } + }) + + t.Run("missing param rejected", func(t *testing.T) { + rec := get("/v1/media") + if rec.Code != http.StatusBadRequest { + t.Errorf("expected 400, got %d", rec.Code) + } + }) + + t.Run("not found is 404", func(t *testing.T) { + rec := get("/v1/media?path=media/ghost.png") + if rec.Code != http.StatusNotFound { + t.Errorf("expected 404, got %d body %s", rec.Code, rec.Body.String()) + } + }) +} diff --git a/internal/api/notes.go b/internal/api/notes.go index 6be7b2d..71ea05b 100644 --- a/internal/api/notes.go +++ b/internal/api/notes.go @@ -2,6 +2,7 @@ package api import ( "context" + "encoding/json" "errors" "net/http" "net/url" @@ -14,24 +15,34 @@ import ( "github.com/rawnaqs/khayal/internal/vault" ) +// RelatedLink is one resolved connection: a real vault path plus the +// target note's human title for display. +type RelatedLink struct { + NotePath string `json:"note_path"` + Title string `json:"title"` + Types []string `json:"types,omitempty"` +} + type NoteResponse struct { - NotePath string `json:"note_path"` - Title string `json:"title,omitempty"` - Type string `json:"type,omitempty"` - Status string `json:"status,omitempty"` - CreatedAt string `json:"created_at,omitempty"` - UpdatedAt string `json:"updated_at,omitempty"` - Tags []string `json:"tags,omitempty"` - Summary string `json:"summary,omitempty"` - KeyIdeas []string `json:"key_ideas,omitempty"` - Raw string `json:"raw"` - SourceURL string `json:"source_url,omitempty"` - SourceFile string `json:"source_file,omitempty"` - Description string `json:"description,omitempty"` - Related []string `json:"related,omitempty"` - Excerpt string `json:"excerpt,omitempty"` - SearchQuery string `json:"search_query,omitempty"` - ExcerptSection string `json:"excerpt_section,omitempty"` + NotePath string `json:"note_path"` + Title string `json:"title,omitempty"` + Type string `json:"type,omitempty"` + Status string `json:"status,omitempty"` + CreatedAt string `json:"created_at,omitempty"` + UpdatedAt string `json:"updated_at,omitempty"` + Tags []string `json:"tags,omitempty"` + Summary string `json:"summary,omitempty"` + KeyIdeas []string `json:"key_ideas,omitempty"` + Raw string `json:"raw"` + SourceURL string `json:"source_url,omitempty"` + SourceFile string `json:"source_file,omitempty"` + Description string `json:"description,omitempty"` + Related []string `json:"related,omitempty"` + RelatedLinks []RelatedLink `json:"related_links,omitempty"` + Entities map[string]interface{} `json:"entities,omitempty"` + Excerpt string `json:"excerpt,omitempty"` + SearchQuery string `json:"search_query,omitempty"` + ExcerptSection string `json:"excerpt_section,omitempty"` } func (s *Server) noteHandler(w http.ResponseWriter, r *http.Request) { @@ -66,20 +77,62 @@ func (s *Server) noteHandler(w http.ResponseWriter, r *http.Request) { s.logger.Info("note read", "path", notePath) + ctx := context.Background() + + // Resolve related links (Obsidian basenames) to real vault paths and + // human titles so clients can render and navigate them directly; + // drop unresolvable entries. + related := make([]RelatedLink, 0, len(note.Related)) + resolvedPaths := make([]string, 0, len(note.Related)) + for _, rel := range note.Related { + base := strings.TrimSuffix(strings.TrimPrefix(strings.TrimSpace(rel), "[["), "]]") + if base == "" { + continue + } + if path, err := s.queue.FindNotePathByBaseName(ctx, base); err == nil && path != "" { + resolvedPaths = append(resolvedPaths, path) + related = append(related, RelatedLink{NotePath: path}) + } + } + titles, _ := s.queue.BatchGetNoteTitles(ctx, resolvedPaths) + typeByPath := map[string][]string{} + if connPayload, err := s.queue.GetConnectionsResultByPath(ctx, notePath); err == nil { + var parsed struct { + Connections []struct { + NotePath string `json:"note_path"` + Type string `json:"type"` + } `json:"connections"` + } + if json.Unmarshal(connPayload, &parsed) == nil { + for _, c := range parsed.Connections { + typeByPath[c.NotePath] = append(typeByPath[c.NotePath], c.Type) + } + } + } + for i := range related { + t := titles[related[i].NotePath] + if t == "" { + t = strings.TrimSuffix(filepath.Base(related[i].NotePath), ".md") + } + related[i].Title = t + related[i].Types = typeByPath[related[i].NotePath] + } + // Build response resp := NoteResponse{ - NotePath: notePath, - Title: note.Title, - Type: note.Type, - Status: note.Status, - Tags: note.Tags, - Summary: note.Summary, - KeyIdeas: note.KeyIdeas, - Raw: note.Raw, - SourceURL: note.SourceURL, - SourceFile: note.SourceFile, - Description: note.Description, - Related: note.Related, + NotePath: notePath, + RelatedLinks: related, + Title: note.Title, + Type: note.Type, + Status: note.Status, + Tags: note.Tags, + Entities: note.Entities, + Summary: note.Summary, + KeyIdeas: note.KeyIdeas, + Raw: note.Raw, + SourceURL: note.SourceURL, + SourceFile: note.SourceFile, + Description: note.Description, } // Extract excerpt context if query provided diff --git a/internal/api/server.go b/internal/api/server.go index 47db03f..a53c8d7 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -65,6 +65,7 @@ func (s *Server) setupRouter() { r.Post("/capture", s.captureHandler) r.Get("/search", s.searchHandler) r.Get("/stats", s.statsHandler) + r.Get("/media", s.mediaHandler) r.Get("/notes/{path:.*}", s.noteHandler) r.Delete("/note", s.noteDeleteHandler) r.Get("/queue", s.queueListHandler) diff --git a/internal/api/ui/static/assets/index-BiXUJG5m.css b/internal/api/ui/static/assets/index-BK66E79C.css similarity index 54% rename from internal/api/ui/static/assets/index-BiXUJG5m.css rename to internal/api/ui/static/assets/index-BK66E79C.css index 65c66ac..fb4b950 100644 --- a/internal/api/ui/static/assets/index-BiXUJG5m.css +++ b/internal/api/ui/static/assets/index-BK66E79C.css @@ -1 +1 @@ -@import"https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,300;0,400;0,700;1,300&family=Bricolage+Grotesque:opsz,wght@12..96,300;12..96,400;12..96,600;12..96,800&display=swap";*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}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;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:IBM Plex Mono,ui-monospace,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--bg: #070707;--s1: #0d0d0d;--s2: #141414;--s3: #1c1c1c;--border: rgba(255, 255, 255, .05);--border2: rgba(255, 255, 255, .09);--gold: #c9933a;--gl: #e8b86d;--gd: rgba(201, 147, 58, .4);--glow: rgba(201, 147, 58, .06);--glow2: rgba(201, 147, 58, .12);--text: #f5f5f5;--t2: rgba(245, 245, 245, .5);--t3: rgba(245, 245, 255, .2);--ok: #3ddc84;--warn: #ffb340;--bad: #ff4d4d;--background: 0 0% 3%;--foreground: 0 0% 96%;--card: 0 0% 8%;--card-foreground: 0 0% 96%;--popover: 0 0% 8%;--popover-foreground: 0 0% 96%;--primary: 36 56% 51%;--primary-foreground: 0 0% 3%;--secondary: 0 0% 8%;--secondary-foreground: 0 0% 96%;--muted: 0 0% 8%;--muted-foreground: 0 0% 50%;--accent: 0 0% 10%;--accent-foreground: 0 0% 96%;--destructive: 0 84% 60%;--destructive-foreground: 0 0% 96%;--border-hsl: 0 0% 12%;--input: 0 0% 15%;--ring: 36 56% 51%;--radius: .75rem}html{background-color:#070707;overflow:hidden;overscroll-behavior:none;-webkit-overflow-scrolling:touch}body{background-color:transparent;color:#f5f5f5;font-family:IBM Plex Mono,monospace;min-height:100svh;overflow:hidden;overscroll-behavior:none}#root{height:100svh;overflow:hidden}*{border-color:#ffffff0d;-webkit-tap-highlight-color:transparent;box-sizing:border-box}button,input,textarea{min-height:44px}input,textarea{font-size:16px}body{overflow-x:hidden}::-webkit-scrollbar{width:4px;height:4px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:#ffffff17;border-radius:2px}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.hdr{padding:calc(13px + env(safe-area-inset-top)) 18px 11px;display:flex;justify-content:space-between;align-items:center;flex-shrink:0;border-bottom:1px solid rgba(255,255,255,.05)}.brand{display:flex;align-items:center;gap:9px}.mark{width:30px;height:30px;border-radius:9px}.bname{font-size:14px;font-weight:700;color:#f5f5f5;letter-spacing:-.3px}.online{width:7px;height:7px;border-radius:50%;background:#3ddc84;box-shadow:0 0 8px #3ddc84}.ver{font-family:IBM Plex Mono,monospace;font-size:8px;font-weight:400;color:#f5f5f540;letter-spacing:.3px;margin-left:3px;vertical-align:super}.update-icon{color:#3ddc84;cursor:pointer;transition:color .2s;flex-shrink:0}.nav{display:flex;padding:10px 20px max(env(safe-area-inset-bottom),16px);border-top:1px solid rgba(255,255,255,.05);background:#070707eb;backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);flex-shrink:0}.pwa-standalone body{min-height:100lvh}.pwa-standalone #root,.pwa-standalone .h-screen{height:100lvh}.pwa-standalone .max-h-screen{max-height:100lvh}.nt{flex:1;display:flex;flex-direction:column;align-items:center;gap:4px;cursor:pointer}.nt svg{width:20px;height:20px;stroke:#f5f5f533;stroke-width:1.5;fill:none;transition:stroke .2s}.nt.on svg{stroke:#c9933a}.nt-l{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;letter-spacing:.8px}.nt.on .nt-l{color:#c9933a}.nt.on .nt-pip{opacity:1}.sec{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;letter-spacing:1.5px;text-transform:uppercase;padding:0 2px}.glass{background:#141414b3;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);border:1px solid rgba(255,255,255,.05)}.btn-gradient{background:linear-gradient(135deg,#c9933a,#a67830);transition:all .2s ease}.btn-gradient:hover{box-shadow:0 4px 16px #c9933a33}.btn-gradient:active{transform:scale(.98)}.input-glow:focus{box-shadow:0 0 16px #c9933a1a;border-color:#c9933a4d}.font-display{font-family:Bricolage Grotesque,sans-serif}.text-caption{font-size:.75rem;line-height:1rem;color:hsl(var(--muted-foreground));color:#f5f5f5b3}.cap-body{flex:1;padding:12px 14px;display:flex;flex-direction:column;gap:10px;overflow:hidden}.cap-greeting{font-family:Bricolage Grotesque,sans-serif;font-size:22px;font-weight:800;color:#f5f5f5;letter-spacing:-.5px;flex-shrink:0}.bento{display:grid;grid-template-columns:1fr 1fr;gap:8px;flex-shrink:0}.bt{background:#141414;border:1px solid rgba(255,255,255,.05);border-radius:18px;padding:15px;position:relative;overflow:hidden}.bt.wide{grid-column:1 / 3}.lbl{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;letter-spacing:1.5px;text-transform:uppercase;margin-bottom:8px}.bt-streak{background:linear-gradient(145deg,#c9933a1a,#c9933a05);border-color:#c9933a2e}.streak-body{display:flex;align-items:center;gap:12px}.arc{position:relative;width:58px;height:58px;flex-shrink:0}.arc svg{width:58px;height:58px;transform:rotate(-90deg)}.arc-center{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px}.arc-n{font-size:17px;font-weight:800;color:#c9933a;line-height:1;letter-spacing:-1px}.arc-u{font-family:IBM Plex Mono,monospace;font-size:7px;color:#f5f5f533;letter-spacing:.5px}.streak-right{flex:1;min-width:0}.streak-num{font-size:26px;font-weight:800;color:#f5f5f5;line-height:1;letter-spacing:-1.5px}.streak-unit{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;margin-top:1px}.streak-goal{font-family:IBM Plex Mono,monospace;font-size:9px;color:#c9933a;margin-top:4px;display:flex;align-items:center;gap:4px}.week-dots{display:flex;gap:4px;margin-top:10px}.wd{flex:1;height:5px;border-radius:100px;background:#ffffff0f}.wd.on{background:#c9933a}.wd.today{background:#e8b86d;box-shadow:0 0 6px #e8b86d80}.wd.off{background:#ffffff0a}.today-num{font-size:32px;font-weight:800;color:#f5f5f5;line-height:1;letter-spacing:-2px}.today-sub{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;margin-top:2px;margin-bottom:10px}.hours{display:flex;align-items:flex-end;gap:2px;height:32px}.hb{flex:1;border-radius:2px 2px 0 0;background:#c9933a2e;min-height:2px;transition:height .4s ease}.hb.hi{background:#c9933a}.hb.now{background:#e8b86d;box-shadow:0 0 5px #e8b86d66;border-radius:2px}.hb.empty{background:#ffffff0a}.today-footer{display:flex;justify-content:space-between;margin-top:6px;padding-top:6px;border-top:1px solid rgba(255,255,255,.05)}.tf-stat{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533}.tf-stat span{color:#f5f5f580}.vault-inner{display:flex;align-items:center;justify-content:space-between;gap:10px}.vault-num{font-size:26px;font-weight:800;color:#f5f5f5;line-height:1;letter-spacing:-1.5px}.vault-unit{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;margin-top:1px}.vault-delta{display:inline-flex;align-items:center;gap:4px;margin-top:5px;font-family:IBM Plex Mono,monospace;font-size:9px;font-weight:700;color:#3ddc84;background:#3ddc8414;border:1px solid rgba(61,220,132,.15);border-radius:100px;padding:2px 7px}.vault-center{display:flex;flex-direction:column;gap:3px;flex:1;align-items:center}.vc-stat{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;text-align:center}.vc-stat span{color:#f5f5f580;display:block;font-size:11px;font-weight:600;letter-spacing:-.3px;margin-top:1px}.spark{display:flex;align-items:flex-end;gap:3px;height:28px}.sb-bar{width:6px;border-radius:2px 2px 0 0;min-height:2px}.sb-bar.today{background:#c9933a;box-shadow:0 0 6px #c9933a4d}.sb-bar.prev{background:#c9933a40}.compose{flex:1;background:#141414;border:1px solid rgba(201,147,58,.2);border-radius:20px;padding:14px;display:flex;flex-direction:column;gap:10px;box-shadow:0 0 0 1px #c9933a0f inset;min-height:0}.pills{display:flex;gap:5px;flex-shrink:0}.tp{padding:4px 10px;border-radius:100px;font-family:IBM Plex Mono,monospace;font-size:9px;font-weight:700;border:1px solid rgba(255,255,255,.09);color:#f5f5f533;cursor:pointer;letter-spacing:.8px;text-transform:uppercase;transition:all .15s}.tp.on{background:#c9933a;color:#000;border-color:#c9933a;box-shadow:0 3px 10px #c9933a40}.footer{display:flex;align-items:center;justify-content:space-between;padding-top:4px;border-top:1px solid rgba(255,255,255,.05);flex-shrink:0}.hint{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;letter-spacing:.3px}.send{width:50px;height:50px;border-radius:50%;background:#c9933a;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 16px #c9933a4d;flex-shrink:0;transition:transform .15s}.send:active{transform:scale(.95)}.send:disabled{opacity:.3;pointer-events:none}.send svg{width:14px;height:14px;fill:none;stroke:#000;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}.url-row{display:flex;align-items:center;gap:8px;background:#00000040;border:1px solid rgba(255,255,255,.09);border-radius:10px;padding:10px 12px}.url-row svg{width:13px;height:13px;stroke:#f5f5f533;stroke-width:2;fill:none;flex-shrink:0}.url-val{font-family:IBM Plex Mono,monospace;font-size:16px;color:#e8b86d;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.url-preview{background:#0003;border:1px solid rgba(255,255,255,.05);border-radius:10px;overflow:hidden;display:flex;flex-direction:column}.url-thumb{height:60px;background:linear-gradient(135deg,#c9933a12,#0000004d);display:flex;align-items:center;justify-content:center;font-size:20px;opacity:.4;border-bottom:1px solid rgba(255,255,255,.05);flex-shrink:0}.url-info{padding:8px 10px}.url-domain{font-family:IBM Plex Mono,monospace;font-size:9px;color:#c9933a;opacity:.6;margin-bottom:3px;letter-spacing:.5px}.url-title{font-size:12px;font-weight:600;color:#f5f5f580;line-height:1.3}.note-input{display:flex;align-items:center;gap:8px;background:#0003;border:1px solid rgba(255,255,255,.05);border-radius:10px;padding:9px 12px}.img-drop{border:1.5px dashed rgba(201,147,58,.2);border-radius:12px;padding:28px 16px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;cursor:pointer;background:#c9933a05}.img-drop-icon{width:40px;height:40px;border-radius:10px;background:#c9933a14;border:1px solid rgba(201,147,58,.15);display:flex;align-items:center;justify-content:center;font-size:18px}.img-drop-lbl{font-size:13px;font-weight:600;color:#f5f5f580}.img-drop-sub{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;letter-spacing:.3px}.img-or{display:flex;align-items:center;gap:8px}.img-or-line{flex:1;height:1px;background:#ffffff0d}.img-or-txt{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;letter-spacing:1px}.cam-btn{width:100%;padding:10px;background:#ffffff08;border:1px solid rgba(255,255,255,.09);border-radius:10px;display:flex;align-items:center;justify-content:center;gap:8px;cursor:pointer;transition:background .15s}.cam-btn:hover{background:#ffffff0d}.cam-txt{font-size:12px;font-weight:600;color:#f5f5f580}.img-filled{border-radius:12px;overflow:hidden;position:relative;height:120px;background:linear-gradient(135deg,#141020,#0a0810);display:flex;align-items:center;justify-content:center;font-size:36px;opacity:.5;border:1px solid rgba(201,147,58,.15)}.img-overlay{position:absolute;bottom:0;left:0;right:0;padding:8px 10px;background:linear-gradient(transparent,#000000bf);display:flex;align-items:center;justify-content:space-between}.img-name{font-family:IBM Plex Mono,monospace;font-size:9px;color:#ffffff8c}.img-size{font-family:IBM Plex Mono,monospace;font-size:9px;color:#ffffff59}.img-rm{width:20px;height:20px;border-radius:50%;background:#ffffff14;border:1px solid rgba(255,255,255,.12);display:flex;align-items:center;justify-content:center;font-size:9px;color:#fff6;cursor:pointer}.tile{background:#141414;border:1px solid rgba(255,255,255,.05);border-radius:14px;padding:12px 14px;display:flex;align-items:center;gap:12px}.tile-inner{flex:1;min-width:0}.tile-top{display:flex;align-items:center;justify-content:space-between;gap:8px}.tile-title{font-size:13px;font-weight:700;color:#f5f5f5}.tile-dismiss{width:16px;height:16px;border-radius:50%;background:#ffffff0d;border:1px solid rgba(255,255,255,.09);display:flex;align-items:center;justify-content:center;font-size:8px;color:#f5f5f533;cursor:pointer;flex-shrink:0}.tile-sub{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tile-bar{height:2px;background:#ffffff0a;border-radius:100px;margin-top:8px;overflow:hidden}.tile-bar-fill{height:100%;border-radius:100px}.tile-ok{background:#3ddc840d;border:1px solid rgba(61,220,132,.12)}.tile-ok .tile-bar-fill{background:#3ddc84;animation:drain 3s linear forwards}.icon-ok{width:30px;height:30px;border-radius:50%;background:#3ddc841a;border:1px solid rgba(61,220,132,.18);display:flex;align-items:center;justify-content:center;flex-shrink:0}.tags{display:flex;gap:4px;flex-wrap:wrap;margin-top:6px}.tile-q{background:#ffb3400a;border:1px solid rgba(255,179,64,.12)}.tile-q .tile-bar-fill{background:#ffb340;animation:drain 4s linear forwards}.icon-q{width:30px;height:30px;border-radius:50%;background:#ffb3401a;border:1px solid rgba(255,179,64,.18);display:flex;align-items:center;justify-content:center;flex-shrink:0;animation:spin 3s linear infinite}.steps{display:flex;align-items:center;gap:5px;margin-top:6px;flex-wrap:wrap}.sd{width:5px;height:5px;border-radius:50%;flex-shrink:0}.sd.done{background:#3ddc84}.sd.act{background:#ffb340;animation:pulse 1s infinite}.sd.wait{background:#f5f5f533}.sl{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533}.sl.done{color:#f5f5f580}.sl.act{color:#ffb340}.sep{font-size:8px;color:#f5f5f533}.tile-off{background:#c9933a0a;border:1px solid rgba(201,147,58,.1)}.tile-off .tile-bar-fill{background:#c9933a;opacity:.4;animation:drain 3.5s linear forwards}.icon-off{width:30px;height:30px;border-radius:50%;background:#c9933a14;border:1px solid rgba(201,147,58,.14);display:flex;align-items:center;justify-content:center;flex-shrink:0}.tile-err{background:#ff4d4d0a;border:1px solid rgba(255,77,77,.15)}.icon-err{width:30px;height:30px;border-radius:50%;background:#ff4d4d1a;border:1px solid rgba(255,77,77,.18);display:flex;align-items:center;justify-content:center;flex-shrink:0}.err-box{margin-top:7px;padding:7px 10px;background:#00000040;border-radius:8px;border:1px solid rgba(255,77,77,.08)}.err-code{font-family:IBM Plex Mono,monospace;font-size:9px;color:#ff4d4d;opacity:.8;letter-spacing:.3px;margin-bottom:2px}.err-hint{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f580;line-height:1.5}.err-actions{display:flex;gap:6px;margin-top:8px}.ea{flex:1;padding:7px 0;border-radius:8px;font-size:11px;font-weight:600;text-align:center;cursor:pointer;border:1px solid rgba(255,255,255,.09);color:#f5f5f580;background:transparent;transition:background .15s}.ea.p{background:#c9933a14;border-color:#c9933a33;color:#c9933a}.ea:hover{background:#ffffff0a}@keyframes drain{0%{width:100%}to{width:0%}}.srch-area{padding:12px 14px 0;flex-shrink:0}.srch-bar{display:flex;align-items:center;gap:10px;background:#141414;border:1px solid rgba(255,255,255,.09);border-radius:14px;padding:11px 14px;margin-bottom:10px;transition:border-color .15s,box-shadow .15s}.srch-bar.active{border-color:#c9933a4d;box-shadow:0 0 0 1px #c9933a14 inset}.srch-bar svg{width:14px;height:14px;stroke:#f5f5f533;stroke-width:2;fill:none;flex-shrink:0}.srch-val{font-size:16px;color:#f5f5f5;font-weight:400;flex:1;letter-spacing:-.2px}.srch-clear{width:18px;height:18px;border-radius:50%;background:#ffffff12;display:flex;align-items:center;justify-content:center;font-size:9px;color:#f5f5f533;cursor:pointer;flex-shrink:0}.modes{display:flex;gap:5px;padding-bottom:10px;border-bottom:1px solid rgba(255,255,255,.05)}.mc{padding:4px 10px;border-radius:100px;font-family:IBM Plex Mono,monospace;font-size:9px;font-weight:700;border:1px solid rgba(255,255,255,.09);color:#f5f5f533;cursor:pointer;letter-spacing:.5px;text-transform:uppercase;transition:all .15s}.mc:hover{border-color:#c9933a4d;color:#f5f5f566}.mc.on{background:#c9933a;color:#000;border-color:#c9933a}.search-empty{flex:1;display:flex;flex-direction:column;padding:16px 14px;gap:0;overflow-y:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none}.search-empty::-webkit-scrollbar{display:none}.recent-lbl{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;letter-spacing:1.5px;text-transform:uppercase;padding:0 2px;margin-bottom:8px}.recent-item{display:flex;align-items:center;gap:10px;padding:10px 12px;background:#0d0d0d;border:1px solid rgba(255,255,255,.05);border-radius:12px;margin-bottom:5px;cursor:pointer;transition:background .15s}.recent-item:hover{background:#141414}.ri-icon{width:26px;height:26px;border-radius:7px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.ri-icon.t{background:#3ddc8412;border:1px solid rgba(61,220,132,.12)}.ri-icon.f{background:#c9933a12;border:1px solid rgba(201,147,58,.12)}.ri-text{font-size:12px;font-weight:500;color:#f5f5f580;flex:1}.suggestions-lbl{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;letter-spacing:1.5px;text-transform:uppercase;padding:0 2px;margin:12px 0 8px}.sug-chips{display:flex;gap:6px;flex-wrap:wrap}.sc{padding:6px 12px;border-radius:100px;background:#141414;border:1px solid rgba(255,255,255,.09);font-size:12px;font-weight:500;color:#f5f5f580;cursor:pointer;transition:border-color .15s,color .15s}.sc:hover{border-color:#c9933a4d;color:#e8b86d}.results-header{padding:8px 16px 10px;flex-shrink:0;border-bottom:1px solid rgba(255,255,255,.05)}.rh-row{display:flex;justify-content:space-between;align-items:center}.rh-count{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533}.rh-ms{font-family:IBM Plex Mono,monospace;font-size:9px;color:#3ddc84}.filter-chips{display:flex;gap:5px;margin-top:8px}.fc{padding:3px 9px;border-radius:100px;font-family:IBM Plex Mono,monospace;font-size:9px;font-weight:700;border:1px solid rgba(255,255,255,.09);color:#f5f5f533;cursor:pointer;letter-spacing:.4px;text-transform:uppercase;transition:all .15s}.fc:hover{border-color:#c9933a4d}.fc.on{background:#c9933a1a;border-color:#c9933a40;color:#c9933a}.\!results{flex:1!important;overflow-y:auto!important;-webkit-overflow-scrolling:touch!important;padding:10px 12px!important;display:flex!important;flex-direction:column!important;gap:7px!important;scrollbar-width:none!important}.results{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:10px 12px;display:flex;flex-direction:column;gap:7px;scrollbar-width:none}.\!results::-webkit-scrollbar{display:none!important}.results::-webkit-scrollbar{display:none}.r1{background:#141414;border:1px solid rgba(255,255,255,.05);border-radius:16px;padding:14px;position:relative;overflow:hidden;cursor:pointer}.r1:after{content:"";position:absolute;top:0;left:0;right:0;height:1px;background:linear-gradient(90deg,#c9933a 0%,transparent 55%);opacity:.6}.r1-ghost{position:absolute;right:10px;top:6px;font-family:Bricolage Grotesque,sans-serif;font-size:48px;font-weight:800;color:#c9933a0f;line-height:1;letter-spacing:-3px;pointer-events:none}.r1-title{font-family:Bricolage Grotesque,sans-serif;font-size:14px;font-weight:700;color:#f5f5f5;line-height:1.35;margin-bottom:7px;padding-right:28px;letter-spacing:-.2px}.r1-meta{display:flex;gap:5px;align-items:center;margin-bottom:9px;flex-wrap:wrap}.rdate{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533}.rb{font-family:IBM Plex Mono,monospace;font-size:9px;padding:2px 6px;border-radius:100px;font-weight:700;letter-spacing:.4px}.rb-t{background:#3ddc8414;color:#3ddc84;border:1px solid rgba(61,220,132,.14)}.rb-a{background:#60a5fa14;color:#60a5fa;border:1px solid rgba(96,165,250,.14)}.rb-tag{background:#c9933a14;color:#e8b86d;border:1px solid rgba(201,147,58,.14)}.r1-ex{font-family:IBM Plex Mono,monospace;font-size:11px;color:#f5f5f580;line-height:1.6;font-style:italic;border-left:1.5px solid rgba(201,147,58,.2);padding-left:9px}.hl{color:#e8b86d;background:#e8b86d1a;border-radius:3px;padding:0 2px}.rc{display:flex;align-items:flex-start;gap:10px;background:#0d0d0d;border:1px solid rgba(255,255,255,.05);border-radius:12px;padding:10px 12px;cursor:pointer;transition:background .15s}.rc:hover{background:#141414;border-color:#ffffff17}.rc-n{font-family:Bricolage Grotesque,sans-serif;font-size:17px;font-weight:800;color:#ffffff12;flex-shrink:0;line-height:1.2;padding-top:1px;letter-spacing:-1px;width:18px}.rc-body{flex:1;min-width:0}.rc-title{font-family:Bricolage Grotesque,sans-serif;font-size:13px;font-weight:600;color:#f5f5f5;margin-bottom:4px;line-height:1.3;letter-spacing:-.1px}.rc-meta{display:flex;gap:5px;align-items:center;flex-wrap:wrap}.rc-score{font-family:IBM Plex Mono,monospace;font-size:10px;color:#f5f5f533;flex-shrink:0;padding-top:2px}.no-results{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:20px;gap:10px}.nr-icon{width:40px;height:40px;border-radius:10px;background:#ffffff08;border:1px solid rgba(255,255,255,.05);display:flex;align-items:center;justify-content:center}.nr-title{font-size:15px;font-weight:700;color:#f5f5f580;letter-spacing:-.3px}.nr-sub{font-family:IBM Plex Mono,monospace;font-size:10px;color:#f5f5f533;text-align:center;line-height:1.6}.nr-suggestions{display:flex;flex-direction:column;gap:5px;width:100%;margin-top:8px}.nr-sug{display:flex;align-items:center;gap:8px;padding:10px 12px;background:#141414;border:1px solid rgba(255,255,255,.05);border-radius:10px;cursor:pointer;transition:background .15s}.nr-sug:hover{background:#1c1c1c}.nr-sug-txt{font-size:12px;font-weight:500;color:#f5f5f580}.nr-sug-mode{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;margin-left:auto}.nr-sug.capture{border-color:#c9933a26}.nr-sug.capture .nr-sug-icon{color:#c9933a}.nr-sug.capture .nr-sug-txt{color:#e8b86d}.q-body{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:12px 14px;display:flex;flex-direction:column;gap:10px;scrollbar-width:none}.q-body::-webkit-scrollbar{display:none}.hero-card{background:#141414;border:1px solid rgba(255,255,255,.05);border-radius:20px;padding:16px;position:relative;overflow:hidden}.hero-card:before{content:"";position:absolute;top:0;left:0;right:0;height:1px;background:linear-gradient(90deg,#ffb340 0%,transparent 60%);opacity:.7}.hero-top{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:13px}.hero-filename{font-family:Bricolage Grotesque,sans-serif;font-size:14px;font-weight:700;color:#f5f5f5;letter-spacing:-.2px;margin-bottom:3px}.hero-meta{font-family:IBM Plex Mono,monospace;font-size:10px;color:#f5f5f533}.hero-badge{display:flex;align-items:center;gap:5px;background:#ffb34014;border:1px solid rgba(255,179,64,.2);border-radius:100px;padding:5px 10px;font-family:IBM Plex Mono,monospace;font-size:9px;font-weight:700;color:#ffb340;letter-spacing:.5px}.badge-dot{width:5px;height:5px;border-radius:50%;background:#ffb340;animation:pulse 1.5s infinite}@keyframes pulse{0%,to{opacity:1}50%{opacity:.3}}.prog-labels{display:flex;justify-content:space-between;margin-bottom:6px}.prog-step{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;letter-spacing:.3px}.prog-step.done{color:#ffb340}.prog-bar{height:3px;background:#ffffff0d;border-radius:100px;overflow:hidden;margin-bottom:10px}.prog-fill{height:100%;background:linear-gradient(90deg,#c9933a,#ffb340);border-radius:100px;position:relative}.prog-fill:after{content:"";position:absolute;right:-1px;top:-2px;width:7px;height:7px;border-radius:50%;background:#ffb340;box-shadow:0 0 8px #ffb340}.mc{font-family:IBM Plex Mono,monospace;font-size:9px;padding:2px 8px;border-radius:100px;background:#ffffff0a;border:1px solid rgba(255,255,255,.09);color:#f5f5f580}.stats-row{display:grid;grid-template-columns:1fr 1fr 1fr;gap:6px}.stat{background:#141414;border:1px solid rgba(255,255,255,.05);border-radius:14px;padding:12px 10px;text-align:center;position:relative;overflow:hidden}.stat:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;border-radius:0 0 14px 14px}.stat.sw:after{background:#ffb340;opacity:.4}.stat.so:after{background:#3ddc84;opacity:.4}.stat.sb:after{background:#ff4d4d;opacity:.4}.stat-n{font-family:Bricolage Grotesque,sans-serif;font-size:28px;font-weight:800;line-height:1;letter-spacing:-1px;color:#f5f5f5}.stat-n.warn{color:#ffb340}.stat-n.ok{color:#3ddc84}.stat-n.\!ok{color:#3ddc84!important}.stat-n.bad{color:#ff4d4d}.stat-l{font-family:IBM Plex Mono,monospace;font-size:8px;color:#f5f5f533;text-transform:uppercase;letter-spacing:1px;margin-top:4px}.q-list{display:flex;flex-direction:column;gap:5px}.qi{background:#0d0d0d;border:1px solid rgba(255,255,255,.05);border-radius:13px;padding:10px 13px;display:flex;align-items:center;gap:10px;cursor:pointer;transition:background .15s}.qi:hover{background:#141414}.qi-icon{width:30px;height:30px;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:13px;flex-shrink:0}.qi-icon.t{background:#3ddc8412;border:1px solid rgba(61,220,132,.12)}.qi-icon.u{background:#60a5fa12;border:1px solid rgba(96,165,250,.12)}.qi-icon.i{background:#c9933a12;border:1px solid rgba(201,147,58,.12)}.qi-body{flex:1;min-width:0}.qi-title{font-family:Bricolage Grotesque,sans-serif;font-size:12px;font-weight:600;color:#f5f5f580;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.3}.qi-meta{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;margin-top:2px}.qi-ago{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;flex-shrink:0}.qi-dot{width:6px;height:6px;border-radius:50%;flex-shrink:0}.qi-dot.q{background:#ffb340;box-shadow:0 0 6px #ffb34059}.qi-dot.\!q{background:#ffb340!important;box-shadow:0 0 6px #ffb34059!important}.qi-dot.p{background:#f5f5f533}.off-card{background:#141414;border:1px solid rgba(255,255,255,.05);border-radius:16px;padding:14px}.off-hdr{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}.off-title-row{display:flex;align-items:center;gap:7px}.off-title{font-family:Bricolage Grotesque,sans-serif;font-size:13px;font-weight:700;color:#e8b86d}.off-ct{font-family:IBM Plex Mono,monospace;font-size:10px;font-weight:700;background:#c9933a1a;border:1px solid rgba(201,147,58,.18);color:#c9933a;padding:3px 9px;border-radius:100px}.off-list{display:flex;flex-direction:column;gap:4px;margin-bottom:11px}.oi{display:flex;align-items:center;gap:8px;padding:7px 10px;background:#0003;border-radius:9px}.oi-bar{width:2px;height:22px;border-radius:1px;background:#c9933a40;flex-shrink:0}.oi-txt{font-size:11px;color:#f5f5f580;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:400}.oi-t{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;flex-shrink:0}.sync-btn{width:100%;padding:10px;background:#c9933a14;border:1px solid rgba(201,147,58,.18);border-radius:10px;display:flex;align-items:center;justify-content:center;gap:8px;cursor:pointer;transition:background .15s}.sync-btn:hover{background:#c9933a1f}.sync-txt{font-family:Bricolage Grotesque,sans-serif;font-size:12px;font-weight:600;color:#c9933a}.fail-card{background:#ff4d4d0a;border:1px solid rgba(255,77,77,.15);border-radius:16px;overflow:hidden}.fail-card:before{content:"";display:block;height:1px;background:linear-gradient(90deg,#ff4d4d 0%,transparent 50%);opacity:.5}.fail-main{padding:12px 14px;display:flex;align-items:flex-start;gap:10px}.fail-icon{width:30px;height:30px;border-radius:8px;background:#ff4d4d1a;border:1px solid rgba(255,77,77,.18);display:flex;align-items:center;justify-content:center;flex-shrink:0}.fail-body{flex:1;min-width:0}.fail-title{font-size:12px;font-weight:700;color:#f5f5f5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:3px}.fail-reason{font-family:IBM Plex Mono,monospace;font-size:9px;color:#ff4d4d;opacity:.7;margin-bottom:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.fail-time{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533}.fail-actions{display:flex;border-top:1px solid rgba(255,77,77,.1)}.fa{flex:1;padding:9px 0;display:flex;align-items:center;justify-content:center;gap:5px;font-size:11px;font-weight:600;cursor:pointer;transition:background .15s}.fa:first-child{border-right:1px solid rgba(255,77,77,.1)}.fa.retry{color:#c9933a}.fa.retry:hover{background:#c9933a0f}.fa.discard{color:#ff4d4d;opacity:.7}.fa.discard:hover{background:#ff4d4d0f}.fa svg,.fa .fa-icon{width:12px;height:12px}.fail-expanded{background:#ff4d4d0a;border:1px solid rgba(255,77,77,.15);border-radius:16px;overflow:hidden}.fail-expanded:before{content:"";display:block;height:1px;background:linear-gradient(90deg,#ff4d4d 0%,transparent 50%);opacity:.5}.fe-main{padding:12px 14px;display:flex;align-items:flex-start;gap:10px}.fe-body{flex:1;min-width:0}.fe-title{font-size:12px;font-weight:700;color:#f5f5f5;margin-bottom:6px}.fe-error-box{background:#0000004d;border:1px solid rgba(255,77,77,.12);border-radius:8px;padding:8px 10px;margin-bottom:8px}.fe-code{font-family:IBM Plex Mono,monospace;font-size:9px;color:#ff4d4d;opacity:.8;letter-spacing:.3px;margin-bottom:3px}.fe-msg{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f580;line-height:1.5}.fe-attempts{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533}.retry-all{display:flex;align-items:center;justify-content:space-between;background:#c9933a0d;border:1px solid rgba(201,147,58,.12);border-radius:12px;padding:10px 14px;cursor:pointer;transition:background .15s}.retry-all:hover{background:#c9933a14}.ra-left{display:flex;align-items:center;gap:8px}.ra-ct{font-family:IBM Plex Mono,monospace;font-size:10px;font-weight:700;background:#ff4d4d1f;border:1px solid rgba(255,77,77,.2);color:#ff4d4d;padding:2px 8px;border-radius:100px}.ra-txt{font-size:12px;font-weight:600;color:#f5f5f580}.ra-btn{display:flex;align-items:center;gap:5px;font-size:11px;font-weight:700;color:#c9933a;font-family:IBM Plex Mono,monospace;letter-spacing:.5px}.ra-btn svg,.ra-btn .ra-icon{width:12px;height:12px}.done-item{background:#0d0d0d;border:1px solid rgba(255,255,255,.05);border-radius:13px;padding:9px 13px;display:flex;align-items:center;gap:10px;opacity:.7}.done-check{width:22px;height:22px;border-radius:50%;background:#3ddc841a;border:1px solid rgba(61,220,132,.2);display:flex;align-items:center;justify-content:center;flex-shrink:0}.done-body{flex:1;min-width:0}.done-title{font-size:11px;font-weight:600;color:#f5f5f54d;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.done-meta{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;margin-top:1px;opacity:.6}.done-ago{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;flex-shrink:0;opacity:.5}.done-expand{display:flex;align-items:center;justify-content:center;gap:5px;width:100%;background:none;border:none;font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;text-align:center;letter-spacing:.5px;padding:6px 2px;transition:color .15s}.done-expand:hover:not(:disabled){color:#f5f5f573}.divider{height:1px;background:#ffffff0d}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.left-0{left:0}.right-0{right:0}.right-1{right:.25rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-4{top:1rem}.z-50{z-index:50}.z-\[100\]{z-index:100}.mx-auto{margin-left:auto;margin-right:auto}.mb-4{margin-bottom:1rem}.ml-3{margin-left:.75rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.h-0\.5{height:.125rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-40{height:10rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1px\]{height:1px}.h-auto{height:auto}.h-full{height:100%}.h-screen{height:100svh}.max-h-screen{max-height:100svh}.min-h-0{min-height:0px}.min-h-\[60px\]{min-height:60px}.w-11\/12{width:91.666667%}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-20{width:5rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-4\/5{width:80%}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[1px\]{width:1px}.w-\[90vw\]{width:90vw}.w-full{width:100%}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-border\/20{border-color:hsl(var(--border) / .2)}.border-destructive{border-color:hsl(var(--destructive))}.border-input{border-color:hsl(var(--input))}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-transparent{border-color:transparent}.border-white\/5{border-color:#ffffff0d}.bg-background{background-color:hsl(var(--background))}.bg-black\/80{background-color:#000c}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-destructive\/10{background-color:hsl(var(--destructive) / .1)}.bg-muted{background-color:hsl(var(--muted))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:transparent}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-primary{--tw-gradient-from: hsl(var(--primary)) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-primary\/80{--tw-gradient-to: hsl(var(--primary) / .8) var(--tw-gradient-to-position)}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pb-2{padding-bottom:.5rem}.pl-3{padding-left:.75rem}.pr-6{padding-right:1.5rem}.pt-0{padding-top:0}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.text-center{text-align:center}.font-mono{font-family:IBM Plex Mono,ui-monospace,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\[10px\]{font-size:10px}.text-\[17px\]{font-size:17px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-light{font-weight:300}.font-medium{font-weight:500}.font-semibold{font-weight:600}.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)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.text-\[\#C9933A\]{--tw-text-opacity: 1;color:rgb(201 147 58 / var(--tw-text-opacity, 1))}.text-\[\#f5f5f5\]{--tw-text-opacity: 1;color:rgb(245 245 245 / var(--tw-text-opacity, 1))}.text-\[rgba\(245\,245\,245\,0\.3\)\]{color:#f5f5f54d}.text-\[rgba\(245\,245\,245\,0\.4\)\]{color:#f5f5f566}.text-border{color:hsl(var(--border))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary\/70{color:hsl(var(--primary) / .7)}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.placeholder-\[rgba\(245\,245\,245\,0\.2\)\]::-moz-placeholder{color:#f5f5f533}.placeholder-\[rgba\(245\,245\,245\,0\.2\)\]::placeholder{color:#f5f5f533}.opacity-0{opacity:0}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_40px_hsl\(var\(--primary\)\/0\.1\)\]{--tw-shadow: 0 0 40px hsl(var(--primary)/.1);--tw-shadow-colored: 0 0 40px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ai-row{border-radius:12px;border:1px solid rgba(201,147,58,.16);background:linear-gradient(var(--bg-card, #111111),var(--bg-card, #111111)) padding-box,linear-gradient(135deg,#c9933a59,#c9933a0d 55%,#c9933a38) border-box;border:1px solid transparent;overflow:hidden;transition:box-shadow .25s ease}.ai-row.open{box-shadow:0 4px 24px #c9933a12}.ai-row.\!open{box-shadow:0 4px 24px #c9933a12!important}.ai-row-head{display:flex;align-items:center;gap:7px;width:100%;padding:9px 13px;border:none;background:transparent;cursor:pointer;text-align:left}.ai-spark{color:var(--gold);flex-shrink:0}.ai-spark.spin{animation:ai-pulse 1.4s ease-in-out infinite}.ai-row-label{font-family:IBM Plex Mono,monospace;font-size:10px;font-weight:700;letter-spacing:.6px;text-transform:uppercase;color:var(--gl);flex:1}.ai-chevron{color:#f5f5f540;transition:transform .3s cubic-bezier(.4,0,.2,1)}.ai-chevron.up{transform:rotate(180deg)}.ai-row-body{padding:2px 13px 11px}@keyframes ai-pulse{0%,to{opacity:1}50%{opacity:.45}}.ai-error-line{display:flex;justify-content:space-between;align-items:center;gap:8px}.ai-actions{display:flex;gap:4px}.ai-action{display:inline-flex;align-items:center;gap:4px;padding:4px;border-radius:8px;border:none;background:transparent;color:#f5f5f540;cursor:pointer;transition:all .15s}.ai-action:hover{color:var(--gl);background:#ffffff0a}.ai-foot{justify-content:flex-end;margin-top:8px}.ai-text{margin:0;font-size:13px;line-height:1.65;color:#f5f5f5d1}.ai-text.dim{color:#f5f5f559;font-size:12px}.ai-cite{display:inline;padding:0 1px;border:none;background:none;font-family:IBM Plex Mono,monospace;font-size:10px;font-weight:700;color:var(--gold);cursor:pointer;vertical-align:super;line-height:0;transition:color .15s}.ai-cite:hover{color:var(--gl)}.ai-skel-lines{display:flex;flex-direction:column;gap:9px;padding-top:2px}.ai-skel{height:11px;border-radius:6px}.q-skel-row{display:flex;align-items:center;gap:10px;padding:8px 16px}.q-skel{border-radius:6px}.q-skel-icon{width:28px;height:28px;border-radius:8px;flex-shrink:0}.q-skel-lines{display:flex;flex-direction:column;gap:6px;flex:1}.q-skel-w60{height:10px;width:60%}.q-skel-w35{height:8px;width:35%}.flare-chip{display:inline-flex;align-items:center;gap:3px;padding:2px 7px;border-radius:100px;font-family:IBM Plex Mono,monospace;font-size:9px;font-weight:700;color:var(--gl, #e8b86d);background:#c9933a14;border:1px solid rgba(201,147,58,.25);white-space:nowrap;cursor:pointer}.flare-enriched{display:inline-flex;color:#c9933a80}.done-item.clickable{cursor:pointer;transition:background .15s}.done-item.clickable:hover{background:#ffffff08}.done-expand.clickable{cursor:pointer}.animate-shimmer{background:linear-gradient(90deg,#141414,#1c1c1c,#141414);background-size:200% 100%;animation:shimmer 1.5s infinite}@keyframes shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.note-detail{padding:1rem;max-width:800px;margin:0 auto}.note-header{margin-bottom:1rem}.back-btn{background:transparent;border:1px solid rgba(255,255,255,.1);color:#f5f5f5cc;padding:.5rem 1rem;border-radius:.5rem;cursor:pointer;font-size:.875rem;transition:all .2s ease}.back-btn:hover{background:#ffffff0d;border-color:#c9933a4d;color:#c9933a}.note-title{font-size:1.875rem;font-weight:600;color:#f5f5f5;margin:1rem 0;line-height:1.3}.note-content{margin-top:1.5rem}.note-content pre{white-space:pre-wrap;word-wrap:break-word;color:#f5f5f5e6;line-height:1.6;font-family:IBM Plex Mono,monospace;font-size:.875rem}.note-content h1,.note-content h2,.note-content h3{color:#f5f5f5;margin-top:1.5rem;margin-bottom:.75rem}.note-content p{margin-bottom:1rem}.note-content ul,.note-content ol{padding-left:1.5rem;margin-bottom:1rem}.note-content li{margin-bottom:.5rem}.note-content code{background:#ffffff1a;padding:.125rem .375rem;border-radius:.25rem;font-family:IBM Plex Mono,monospace;font-size:.8125rem}.note-content pre{background:#ffffff0d;padding:1rem;border-radius:.5rem;overflow-x:auto;margin-bottom:1rem}.note-content blockquote{border-left:3px solid rgba(201,147,58,.3);padding-left:1rem;margin:1rem 0;color:#f5f5f5b3}.note-detail-loading,.note-detail-error{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:50vh;gap:1rem}.loading-text,.error-text{color:#f5f5f599;font-size:.875rem}.error-text{color:#ff4d4d}.note-section{margin-bottom:1.25rem}.note-section-heading{font-family:IBM Plex Mono,monospace;font-size:11px;font-weight:600;color:#c9933a;text-transform:uppercase;letter-spacing:.5px;margin-bottom:.5rem}.note-list{list-style:none;padding:0}.note-list li{font-size:.875rem;color:#f5f5f5b3;padding:.25rem 0 .25rem 1rem;position:relative}.note-list li:before{content:"•";position:absolute;left:0;color:#c9933a}.text-muted-foreground{color:#f5f5f5b3}.excerpt-box{background:#c9933a0f;border:1px solid rgba(201,147,58,.15);border-radius:13px;padding:1rem}.excerpt-text{font-size:.875rem;line-height:1.6;color:#f5f5f5cc}.excerpt-label{font-family:IBM Plex Mono,monospace;font-size:9px;text-transform:uppercase;letter-spacing:.5px;color:#c9933a99;margin-bottom:.5rem}.view-toggle{display:flex;gap:0;background:#ffffff08;border-radius:9px;padding:2px}.toggle-btn{flex:1;padding:.5rem .75rem;font-size:.8125rem;font-weight:500;border-radius:7px;cursor:pointer;transition:all .15s;border:none;background:transparent;color:#f5f5f566;text-align:center}.toggle-btn.active{background:#c9933a1f;color:#c9933a;font-weight:600}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.last\:border-b-0:last-child{border-bottom-width:0px}.hover\:scale-\[1\.02\]:hover{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:text-\[rgba\(245\,169\,169\,0\.9\)\]:hover{color:#f5a9a9e6}.hover\:text-\[rgba\(245\,245\,245\,0\.5\)\]:hover{color:#f5f5f580}.hover\:text-\[rgba\(245\,245\,245\,0\.6\)\]:hover{color:#f5f5f599}.hover\:text-\[rgba\(245\,245\,245\,0\.8\)\]:hover{color:#f5f5f5cc}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-destructive\/25:hover{--tw-shadow-color: hsl(var(--destructive) / .25);--tw-shadow: var(--tw-shadow-colored)}.hover\:shadow-primary\/25:hover{--tw-shadow-color: hsl(var(--primary) / .25);--tw-shadow: var(--tw-shadow-colored)}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:scale-\[0\.98\]:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:border-destructive\/30:hover{border-color:hsl(var(--destructive) / .3)}.group.destructive .group-\[\.destructive\]\:hover\:bg-destructive:hover{background-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:hover\:text-destructive-foreground:hover{color:hsl(var(--destructive-foreground))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-destructive:focus{--tw-ring-color: hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=closed\]\:duration-300[data-state=closed]{transition-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{transition-duration:.5s}.data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[swipe\=end\]\:animate-out[data-swipe=end]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\[state\=closed\]\:fade-out-80[data-state=closed]{--tw-exit-opacity: .8}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed],.data-\[state\=closed\]\:slide-out-to-right-full[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open],.data-\[state\=open\]\:slide-in-from-top-full[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=closed\]\:duration-300[data-state=closed]{animation-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{animation-duration:.5s}@media (min-width: 640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:top-auto{top:auto}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-sm{max-width:24rem}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:justify-end{justify-content:flex-end}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:text-left{text-align:left}.data-\[state\=open\]\:sm\:slide-in-from-bottom-full[data-state=open]{--tw-enter-translate-y: 100%}}@media (min-width: 768px){.md\:max-w-\[420px\]{max-width:420px}.md\:text-sm{font-size:.875rem;line-height:1.25rem}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\>button\:first-of-type\]\:hidden>button:first-of-type{display:none}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0} +@import"https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,300;0,400;0,700;1,300&family=Bricolage+Grotesque:opsz,wght@12..96,300;12..96,400;12..96,600;12..96,800&display=swap";*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}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;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:IBM Plex Mono,ui-monospace,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--bg: #070707;--s1: #0d0d0d;--s2: #141414;--s3: #1c1c1c;--border: rgba(255, 255, 255, .05);--border2: rgba(255, 255, 255, .09);--gold: #c9933a;--gl: #e8b86d;--gd: rgba(201, 147, 58, .4);--glow: rgba(201, 147, 58, .06);--glow2: rgba(201, 147, 58, .12);--text: #f5f5f5;--t2: rgba(245, 245, 245, .5);--t3: rgba(245, 245, 255, .2);--ok: #3ddc84;--warn: #ffb340;--bad: #ff4d4d;--background: 0 0% 3%;--foreground: 0 0% 96%;--card: 0 0% 8%;--card-foreground: 0 0% 96%;--popover: 0 0% 8%;--popover-foreground: 0 0% 96%;--primary: 36 56% 51%;--primary-foreground: 0 0% 3%;--secondary: 0 0% 8%;--secondary-foreground: 0 0% 96%;--muted: 0 0% 8%;--muted-foreground: 0 0% 50%;--accent: 0 0% 10%;--accent-foreground: 0 0% 96%;--destructive: 0 84% 60%;--destructive-foreground: 0 0% 96%;--border-hsl: 0 0% 12%;--input: 0 0% 15%;--ring: 36 56% 51%;--radius: .75rem}html{background-color:#070707;overflow:hidden;overscroll-behavior:none;-webkit-overflow-scrolling:touch}body{background-color:transparent;color:#f5f5f5;font-family:IBM Plex Mono,monospace;min-height:100svh;overflow:hidden;overscroll-behavior:none}#root{height:100svh;overflow:hidden}*{border-color:#ffffff0d;-webkit-tap-highlight-color:transparent;box-sizing:border-box}button,input,textarea{min-height:44px}input,textarea{font-size:16px}body{overflow-x:hidden}::-webkit-scrollbar{width:4px;height:4px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:#ffffff17;border-radius:2px}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.hdr{padding:calc(13px + env(safe-area-inset-top)) 18px 11px;display:flex;justify-content:space-between;align-items:center;flex-shrink:0;border-bottom:1px solid rgba(255,255,255,.05)}.brand{display:flex;align-items:center;gap:9px}.mark{width:30px;height:30px;border-radius:9px}.bname{font-size:14px;font-weight:700;color:#f5f5f5;letter-spacing:-.3px}.online{width:7px;height:7px;border-radius:50%;background:#3ddc84;box-shadow:0 0 8px #3ddc84}.ver{font-family:IBM Plex Mono,monospace;font-size:8px;font-weight:400;color:#f5f5f540;letter-spacing:.3px;margin-left:3px;vertical-align:super}.update-icon{color:#3ddc84;cursor:pointer;transition:color .2s;flex-shrink:0}.nav{display:flex;padding:10px 20px max(env(safe-area-inset-bottom),16px);border-top:1px solid rgba(255,255,255,.05);background:#070707eb;backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);flex-shrink:0}.pwa-standalone body{min-height:100lvh}.pwa-standalone #root,.pwa-standalone .h-screen{height:100lvh}.pwa-standalone .max-h-screen{max-height:100lvh}.nt{flex:1;display:flex;flex-direction:column;align-items:center;gap:4px;cursor:pointer}.nt svg{width:20px;height:20px;stroke:#f5f5f533;stroke-width:1.5;fill:none;transition:stroke .2s}.nt.on svg{stroke:#c9933a}.nt-l{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;letter-spacing:.8px}.nt.on .nt-l{color:#c9933a}.nt.on .nt-pip{opacity:1}.sec{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;letter-spacing:1.5px;text-transform:uppercase;padding:0 2px}.glass{background:#141414b3;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);border:1px solid rgba(255,255,255,.05)}.btn-gradient{background:linear-gradient(135deg,#c9933a,#a67830);transition:all .2s ease}.btn-gradient:hover{box-shadow:0 4px 16px #c9933a33}.btn-gradient:active{transform:scale(.98)}.input-glow:focus{box-shadow:0 0 16px #c9933a1a;border-color:#c9933a4d}.font-display{font-family:Bricolage Grotesque,sans-serif}.text-caption{font-size:.75rem;line-height:1rem;color:hsl(var(--muted-foreground));color:#f5f5f5b3}.cap-body{flex:1;padding:12px 14px;display:flex;flex-direction:column;gap:10px;overflow:hidden}.cap-greeting{font-family:Bricolage Grotesque,sans-serif;font-size:22px;font-weight:800;color:#f5f5f5;letter-spacing:-.5px;flex-shrink:0}.bento{display:grid;grid-template-columns:1fr 1fr;gap:8px;flex-shrink:0}.bt{background:#141414;border:1px solid rgba(255,255,255,.05);border-radius:18px;padding:15px;position:relative;overflow:hidden}.bt.wide{grid-column:1 / 3}.lbl{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;letter-spacing:1.5px;text-transform:uppercase;margin-bottom:8px}.bt-streak{background:linear-gradient(145deg,#c9933a1a,#c9933a05);border-color:#c9933a2e}.streak-body{display:flex;align-items:center;gap:12px}.arc{position:relative;width:58px;height:58px;flex-shrink:0}.arc svg{width:58px;height:58px;transform:rotate(-90deg)}.arc-center{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px}.arc-n{font-size:17px;font-weight:800;color:#c9933a;line-height:1;letter-spacing:-1px}.arc-u{font-family:IBM Plex Mono,monospace;font-size:7px;color:#f5f5f533;letter-spacing:.5px}.streak-right{flex:1;min-width:0}.streak-num{font-size:26px;font-weight:800;color:#f5f5f5;line-height:1;letter-spacing:-1.5px}.streak-unit{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;margin-top:1px}.streak-goal{font-family:IBM Plex Mono,monospace;font-size:9px;color:#c9933a;margin-top:4px;display:flex;align-items:center;gap:4px}.week-dots{display:flex;gap:4px;margin-top:10px}.wd{flex:1;height:5px;border-radius:100px;background:#ffffff0f}.wd.on{background:#c9933a}.wd.today{background:#e8b86d;box-shadow:0 0 6px #e8b86d80}.wd.off{background:#ffffff0a}.today-num{font-size:32px;font-weight:800;color:#f5f5f5;line-height:1;letter-spacing:-2px}.today-sub{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;margin-top:2px;margin-bottom:10px}.hours{display:flex;align-items:flex-end;gap:2px;height:32px}.hb{flex:1;border-radius:2px 2px 0 0;background:#c9933a2e;min-height:2px;transition:height .4s ease}.hb.hi{background:#c9933a}.hb.now{background:#e8b86d;box-shadow:0 0 5px #e8b86d66;border-radius:2px}.hb.empty{background:#ffffff0a}.today-footer{display:flex;justify-content:space-between;margin-top:6px;padding-top:6px;border-top:1px solid rgba(255,255,255,.05)}.tf-stat{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533}.tf-stat span{color:#f5f5f580}.vault-inner{display:flex;align-items:center;justify-content:space-between;gap:10px}.vault-num{font-size:26px;font-weight:800;color:#f5f5f5;line-height:1;letter-spacing:-1.5px}.vault-unit{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;margin-top:1px}.vault-delta{display:inline-flex;align-items:center;gap:4px;margin-top:5px;font-family:IBM Plex Mono,monospace;font-size:9px;font-weight:700;color:#3ddc84;background:#3ddc8414;border:1px solid rgba(61,220,132,.15);border-radius:100px;padding:2px 7px}.vault-center{display:flex;flex-direction:column;gap:3px;flex:1;align-items:center}.vc-stat{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;text-align:center}.vc-stat span{color:#f5f5f580;display:block;font-size:11px;font-weight:600;letter-spacing:-.3px;margin-top:1px}.spark{display:flex;align-items:flex-end;gap:3px;height:28px}.sb-bar{width:6px;border-radius:2px 2px 0 0;min-height:2px}.sb-bar.today{background:#c9933a;box-shadow:0 0 6px #c9933a4d}.sb-bar.prev{background:#c9933a40}.compose{flex:1;background:#141414;border:1px solid rgba(201,147,58,.2);border-radius:20px;padding:14px;display:flex;flex-direction:column;gap:10px;box-shadow:0 0 0 1px #c9933a0f inset;min-height:0}.pills{display:flex;gap:5px;flex-shrink:0}.tp{padding:4px 10px;border-radius:100px;font-family:IBM Plex Mono,monospace;font-size:9px;font-weight:700;border:1px solid rgba(255,255,255,.09);color:#f5f5f533;cursor:pointer;letter-spacing:.8px;text-transform:uppercase;transition:all .15s}.tp.on{background:#c9933a;color:#000;border-color:#c9933a;box-shadow:0 3px 10px #c9933a40}.footer{display:flex;align-items:center;justify-content:space-between;padding-top:4px;border-top:1px solid rgba(255,255,255,.05);flex-shrink:0}.hint{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;letter-spacing:.3px}.send{width:50px;height:50px;border-radius:50%;background:#c9933a;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 16px #c9933a4d;flex-shrink:0;transition:transform .15s}.send:active{transform:scale(.95)}.send:disabled{opacity:.3;pointer-events:none}.send svg{width:14px;height:14px;fill:none;stroke:#000;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}.url-row{display:flex;align-items:center;gap:8px;background:#00000040;border:1px solid rgba(255,255,255,.09);border-radius:10px;padding:10px 12px}.url-row svg{width:13px;height:13px;stroke:#f5f5f533;stroke-width:2;fill:none;flex-shrink:0}.url-val{font-family:IBM Plex Mono,monospace;font-size:16px;color:#e8b86d;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.url-preview{background:#0003;border:1px solid rgba(255,255,255,.05);border-radius:10px;overflow:hidden;display:flex;flex-direction:column}.url-thumb{height:60px;background:linear-gradient(135deg,#c9933a12,#0000004d);display:flex;align-items:center;justify-content:center;font-size:20px;opacity:.4;border-bottom:1px solid rgba(255,255,255,.05);flex-shrink:0}.url-info{padding:8px 10px}.url-domain{font-family:IBM Plex Mono,monospace;font-size:9px;color:#c9933a;opacity:.6;margin-bottom:3px;letter-spacing:.5px}.url-title{font-size:12px;font-weight:600;color:#f5f5f580;line-height:1.3}.note-input{display:flex;align-items:center;gap:8px;background:#0003;border:1px solid rgba(255,255,255,.05);border-radius:10px;padding:9px 12px}.img-drop{border:1.5px dashed rgba(201,147,58,.2);border-radius:12px;padding:28px 16px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;cursor:pointer;background:#c9933a05}.img-drop-icon{width:40px;height:40px;border-radius:10px;background:#c9933a14;border:1px solid rgba(201,147,58,.15);display:flex;align-items:center;justify-content:center;font-size:18px}.img-drop-lbl{font-size:13px;font-weight:600;color:#f5f5f580}.img-drop-sub{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;letter-spacing:.3px}.img-or{display:flex;align-items:center;gap:8px}.img-or-line{flex:1;height:1px;background:#ffffff0d}.img-or-txt{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;letter-spacing:1px}.cam-btn{width:100%;padding:10px;background:#ffffff08;border:1px solid rgba(255,255,255,.09);border-radius:10px;display:flex;align-items:center;justify-content:center;gap:8px;cursor:pointer;transition:background .15s}.cam-btn:hover{background:#ffffff0d}.cam-txt{font-size:12px;font-weight:600;color:#f5f5f580}.img-filled{border-radius:12px;overflow:hidden;position:relative;height:120px;background:linear-gradient(135deg,#141020,#0a0810);display:flex;align-items:center;justify-content:center;font-size:36px;opacity:.5;border:1px solid rgba(201,147,58,.15)}.img-overlay{position:absolute;bottom:0;left:0;right:0;padding:8px 10px;background:linear-gradient(transparent,#000000bf);display:flex;align-items:center;justify-content:space-between}.img-name{font-family:IBM Plex Mono,monospace;font-size:9px;color:#ffffff8c}.img-size{font-family:IBM Plex Mono,monospace;font-size:9px;color:#ffffff59}.img-rm{width:20px;height:20px;border-radius:50%;background:#ffffff14;border:1px solid rgba(255,255,255,.12);display:flex;align-items:center;justify-content:center;font-size:9px;color:#fff6;cursor:pointer}.tile{background:#141414;border:1px solid rgba(255,255,255,.05);border-radius:14px;padding:12px 14px;display:flex;align-items:center;gap:12px}.tile-inner{flex:1;min-width:0}.tile-top{display:flex;align-items:center;justify-content:space-between;gap:8px}.tile-title{font-size:13px;font-weight:700;color:#f5f5f5}.tile-dismiss{width:16px;height:16px;border-radius:50%;background:#ffffff0d;border:1px solid rgba(255,255,255,.09);display:flex;align-items:center;justify-content:center;font-size:8px;color:#f5f5f533;cursor:pointer;flex-shrink:0}.tile-sub{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tile-bar{height:2px;background:#ffffff0a;border-radius:100px;margin-top:8px;overflow:hidden}.tile-bar-fill{height:100%;border-radius:100px}.tile-ok{background:#3ddc840d;border:1px solid rgba(61,220,132,.12)}.tile-ok .tile-bar-fill{background:#3ddc84;animation:drain 3s linear forwards}.icon-ok{width:30px;height:30px;border-radius:50%;background:#3ddc841a;border:1px solid rgba(61,220,132,.18);display:flex;align-items:center;justify-content:center;flex-shrink:0}.tags{display:flex;gap:4px;flex-wrap:wrap;margin-top:6px}.tile-q{background:#ffb3400a;border:1px solid rgba(255,179,64,.12)}.tile-q .tile-bar-fill{background:#ffb340;animation:drain 4s linear forwards}.icon-q{width:30px;height:30px;border-radius:50%;background:#ffb3401a;border:1px solid rgba(255,179,64,.18);display:flex;align-items:center;justify-content:center;flex-shrink:0;animation:spin 3s linear infinite}.steps{display:flex;align-items:center;gap:5px;margin-top:6px;flex-wrap:wrap}.sd{width:5px;height:5px;border-radius:50%;flex-shrink:0}.sd.done{background:#3ddc84}.sd.act{background:#ffb340;animation:pulse 1s infinite}.sd.wait{background:#f5f5f533}.sl{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533}.sl.done{color:#f5f5f580}.sl.act{color:#ffb340}.sep{font-size:8px;color:#f5f5f533}.tile-off{background:#c9933a0a;border:1px solid rgba(201,147,58,.1)}.tile-off .tile-bar-fill{background:#c9933a;opacity:.4;animation:drain 3.5s linear forwards}.icon-off{width:30px;height:30px;border-radius:50%;background:#c9933a14;border:1px solid rgba(201,147,58,.14);display:flex;align-items:center;justify-content:center;flex-shrink:0}.tile-err{background:#ff4d4d0a;border:1px solid rgba(255,77,77,.15)}.icon-err{width:30px;height:30px;border-radius:50%;background:#ff4d4d1a;border:1px solid rgba(255,77,77,.18);display:flex;align-items:center;justify-content:center;flex-shrink:0}.err-box{margin-top:7px;padding:7px 10px;background:#00000040;border-radius:8px;border:1px solid rgba(255,77,77,.08)}.err-code{font-family:IBM Plex Mono,monospace;font-size:9px;color:#ff4d4d;opacity:.8;letter-spacing:.3px;margin-bottom:2px}.err-hint{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f580;line-height:1.5}.err-actions{display:flex;gap:6px;margin-top:8px}.ea{flex:1;padding:7px 0;border-radius:8px;font-size:11px;font-weight:600;text-align:center;cursor:pointer;border:1px solid rgba(255,255,255,.09);color:#f5f5f580;background:transparent;transition:background .15s}.ea.p{background:#c9933a14;border-color:#c9933a33;color:#c9933a}.ea:hover{background:#ffffff0a}@keyframes drain{0%{width:100%}to{width:0%}}.srch-area{padding:12px 14px 0;flex-shrink:0}.srch-bar{display:flex;align-items:center;gap:10px;background:#141414;border:1px solid rgba(255,255,255,.09);border-radius:14px;padding:11px 14px;margin-bottom:10px;transition:border-color .15s,box-shadow .15s}.srch-bar.active{border-color:#c9933a4d;box-shadow:0 0 0 1px #c9933a14 inset}.srch-bar svg{width:14px;height:14px;stroke:#f5f5f533;stroke-width:2;fill:none;flex-shrink:0}.srch-val{font-size:16px;color:#f5f5f5;font-weight:400;flex:1;letter-spacing:-.2px}.srch-clear{width:18px;height:18px;border-radius:50%;background:#ffffff12;display:flex;align-items:center;justify-content:center;font-size:9px;color:#f5f5f533;cursor:pointer;flex-shrink:0}.modes{display:flex;gap:5px;padding-bottom:10px;border-bottom:1px solid rgba(255,255,255,.05)}.mc{padding:4px 10px;border-radius:100px;font-family:IBM Plex Mono,monospace;font-size:9px;font-weight:700;border:1px solid rgba(255,255,255,.09);color:#f5f5f533;cursor:pointer;letter-spacing:.5px;text-transform:uppercase;transition:all .15s}.mc:hover{border-color:#c9933a4d;color:#f5f5f566}.mc.on{background:#c9933a;color:#000;border-color:#c9933a}.search-empty{flex:1;display:flex;flex-direction:column;padding:16px 14px;gap:0;overflow-y:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none}.search-empty::-webkit-scrollbar{display:none}.recent-lbl{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;letter-spacing:1.5px;text-transform:uppercase;padding:0 2px;margin-bottom:8px}.recent-item{display:flex;align-items:center;gap:10px;padding:10px 12px;background:#0d0d0d;border:1px solid rgba(255,255,255,.05);border-radius:12px;margin-bottom:5px;cursor:pointer;transition:background .15s}.recent-item:hover{background:#141414}.ri-icon{width:26px;height:26px;border-radius:7px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.ri-icon.t{background:#3ddc8412;border:1px solid rgba(61,220,132,.12)}.ri-icon.f{background:#c9933a12;border:1px solid rgba(201,147,58,.12)}.ri-text{font-size:12px;font-weight:500;color:#f5f5f580;flex:1}.suggestions-lbl{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;letter-spacing:1.5px;text-transform:uppercase;padding:0 2px;margin:12px 0 8px}.sug-chips{display:flex;gap:6px;flex-wrap:wrap}.sc{padding:6px 12px;border-radius:100px;background:#141414;border:1px solid rgba(255,255,255,.09);font-size:12px;font-weight:500;color:#f5f5f580;cursor:pointer;transition:border-color .15s,color .15s}.sc:hover{border-color:#c9933a4d;color:#e8b86d}.results-header{padding:8px 16px 10px;flex-shrink:0;border-bottom:1px solid rgba(255,255,255,.05)}.rh-row{display:flex;justify-content:space-between;align-items:center}.rh-count{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533}.rh-ms{font-family:IBM Plex Mono,monospace;font-size:9px;color:#3ddc84}.filter-chips{display:flex;gap:5px;margin-top:8px}.fc{padding:3px 9px;border-radius:100px;font-family:IBM Plex Mono,monospace;font-size:9px;font-weight:700;border:1px solid rgba(255,255,255,.09);color:#f5f5f533;cursor:pointer;letter-spacing:.4px;text-transform:uppercase;transition:all .15s}.fc:hover{border-color:#c9933a4d}.fc.on{background:#c9933a1a;border-color:#c9933a40;color:#c9933a}.\!results{flex:1!important;overflow-y:auto!important;-webkit-overflow-scrolling:touch!important;padding:10px 12px!important;display:flex!important;flex-direction:column!important;gap:7px!important;scrollbar-width:none!important}.results{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:10px 12px;display:flex;flex-direction:column;gap:7px;scrollbar-width:none}.\!results::-webkit-scrollbar{display:none!important}.results::-webkit-scrollbar{display:none}.r1{background:#141414;border:1px solid rgba(255,255,255,.05);border-radius:16px;padding:14px;position:relative;overflow:hidden;cursor:pointer}.r1:after{content:"";position:absolute;top:0;left:0;right:0;height:1px;background:linear-gradient(90deg,#c9933a 0%,transparent 55%);opacity:.6}.r1-ghost{position:absolute;right:10px;top:6px;font-family:Bricolage Grotesque,sans-serif;font-size:48px;font-weight:800;color:#c9933a0f;line-height:1;letter-spacing:-3px;pointer-events:none}.r1-title{font-family:Bricolage Grotesque,sans-serif;font-size:14px;font-weight:700;color:#f5f5f5;line-height:1.35;margin-bottom:7px;padding-right:28px;letter-spacing:-.2px}.r1-meta{display:flex;gap:5px;align-items:center;margin-bottom:9px;flex-wrap:wrap}.rdate{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533}.rb{font-family:IBM Plex Mono,monospace;font-size:9px;padding:2px 6px;border-radius:100px;font-weight:700;letter-spacing:.4px}.rb-t{background:#3ddc8414;color:#3ddc84;border:1px solid rgba(61,220,132,.14)}.rb-a{background:#60a5fa14;color:#60a5fa;border:1px solid rgba(96,165,250,.14)}.rb-tag{background:#c9933a14;color:#e8b86d;border:1px solid rgba(201,147,58,.14)}.r1-ex{font-family:IBM Plex Mono,monospace;font-size:11px;color:#f5f5f580;line-height:1.6;font-style:italic;border-left:1.5px solid rgba(201,147,58,.2);padding-left:9px}.hl{color:#e8b86d;background:#e8b86d1a;border-radius:3px;padding:0 2px}.rc{display:flex;align-items:flex-start;gap:10px;background:#0d0d0d;border:1px solid rgba(255,255,255,.05);border-radius:12px;padding:10px 12px;cursor:pointer;transition:background .15s}.rc:hover{background:#141414;border-color:#ffffff17}.rc-n{font-family:Bricolage Grotesque,sans-serif;font-size:17px;font-weight:800;color:#ffffff12;flex-shrink:0;line-height:1.2;padding-top:1px;letter-spacing:-1px;width:18px}.rc-body{flex:1;min-width:0}.rc-title{font-family:Bricolage Grotesque,sans-serif;font-size:13px;font-weight:600;color:#f5f5f5;margin-bottom:4px;line-height:1.3;letter-spacing:-.1px}.rc-meta{display:flex;gap:5px;align-items:center;flex-wrap:wrap}.rc-score{font-family:IBM Plex Mono,monospace;font-size:10px;color:#f5f5f533;flex-shrink:0;padding-top:2px}.no-results{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:20px;gap:10px}.nr-icon{width:40px;height:40px;border-radius:10px;background:#ffffff08;border:1px solid rgba(255,255,255,.05);display:flex;align-items:center;justify-content:center}.nr-title{font-size:15px;font-weight:700;color:#f5f5f580;letter-spacing:-.3px}.nr-sub{font-family:IBM Plex Mono,monospace;font-size:10px;color:#f5f5f533;text-align:center;line-height:1.6}.nr-suggestions{display:flex;flex-direction:column;gap:5px;width:100%;margin-top:8px}.nr-sug{display:flex;align-items:center;gap:8px;padding:10px 12px;background:#141414;border:1px solid rgba(255,255,255,.05);border-radius:10px;cursor:pointer;transition:background .15s}.nr-sug:hover{background:#1c1c1c}.nr-sug-txt{font-size:12px;font-weight:500;color:#f5f5f580}.nr-sug-mode{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;margin-left:auto}.nr-sug.capture{border-color:#c9933a26}.nr-sug.capture .nr-sug-icon{color:#c9933a}.nr-sug.capture .nr-sug-txt{color:#e8b86d}.q-body{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:12px 14px;display:flex;flex-direction:column;gap:10px;scrollbar-width:none}.q-body::-webkit-scrollbar{display:none}.hero-card{background:#141414;border:1px solid rgba(255,255,255,.05);border-radius:20px;padding:16px;position:relative;overflow:hidden}.hero-card:before{content:"";position:absolute;top:0;left:0;right:0;height:1px;background:linear-gradient(90deg,#ffb340 0%,transparent 60%);opacity:.7}.hero-top{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:13px}.hero-filename{font-family:Bricolage Grotesque,sans-serif;font-size:14px;font-weight:700;color:#f5f5f5;letter-spacing:-.2px;margin-bottom:3px}.hero-meta{font-family:IBM Plex Mono,monospace;font-size:10px;color:#f5f5f533}.hero-badge{display:flex;align-items:center;gap:5px;background:#ffb34014;border:1px solid rgba(255,179,64,.2);border-radius:100px;padding:5px 10px;font-family:IBM Plex Mono,monospace;font-size:9px;font-weight:700;color:#ffb340;letter-spacing:.5px}.badge-dot{width:5px;height:5px;border-radius:50%;background:#ffb340;animation:pulse 1.5s infinite}@keyframes pulse{0%,to{opacity:1}50%{opacity:.3}}.prog-labels{display:flex;justify-content:space-between;margin-bottom:6px}.prog-step{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;letter-spacing:.3px}.prog-step.done{color:#ffb340}.prog-bar{height:3px;background:#ffffff0d;border-radius:100px;overflow:hidden;margin-bottom:10px}.prog-fill{height:100%;background:linear-gradient(90deg,#c9933a,#ffb340);border-radius:100px;position:relative}.prog-fill:after{content:"";position:absolute;right:-1px;top:-2px;width:7px;height:7px;border-radius:50%;background:#ffb340;box-shadow:0 0 8px #ffb340}.mc{font-family:IBM Plex Mono,monospace;font-size:9px;padding:2px 8px;border-radius:100px;background:#ffffff0a;border:1px solid rgba(255,255,255,.09);color:#f5f5f580}.stats-row{display:grid;grid-template-columns:1fr 1fr 1fr;gap:6px}.stat{background:#141414;border:1px solid rgba(255,255,255,.05);border-radius:14px;padding:12px 10px;text-align:center;position:relative;overflow:hidden}.stat:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;border-radius:0 0 14px 14px}.stat.sw:after{background:#ffb340;opacity:.4}.stat.so:after{background:#3ddc84;opacity:.4}.stat.sb:after{background:#ff4d4d;opacity:.4}.stat-n{font-family:Bricolage Grotesque,sans-serif;font-size:28px;font-weight:800;line-height:1;letter-spacing:-1px;color:#f5f5f5}.stat-n.warn{color:#ffb340}.stat-n.ok{color:#3ddc84}.stat-n.\!ok{color:#3ddc84!important}.stat-n.bad{color:#ff4d4d}.stat-l{font-family:IBM Plex Mono,monospace;font-size:8px;color:#f5f5f533;text-transform:uppercase;letter-spacing:1px;margin-top:4px}.q-list{display:flex;flex-direction:column;gap:5px}.qi{background:#0d0d0d;border:1px solid rgba(255,255,255,.05);border-radius:13px;padding:10px 13px;display:flex;align-items:center;gap:10px;cursor:pointer;transition:background .15s}.qi:hover{background:#141414}.qi-icon{width:30px;height:30px;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:13px;flex-shrink:0}.qi-icon.t{background:#3ddc8412;border:1px solid rgba(61,220,132,.12)}.qi-icon.u{background:#60a5fa12;border:1px solid rgba(96,165,250,.12)}.qi-icon.i{background:#c9933a12;border:1px solid rgba(201,147,58,.12)}.qi-body{flex:1;min-width:0}.qi-title{font-family:Bricolage Grotesque,sans-serif;font-size:12px;font-weight:600;color:#f5f5f580;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.3}.qi-meta{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;margin-top:2px}.qi-ago{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;flex-shrink:0}.qi-dot{width:6px;height:6px;border-radius:50%;flex-shrink:0}.qi-dot.q{background:#ffb340;box-shadow:0 0 6px #ffb34059}.qi-dot.\!q{background:#ffb340!important;box-shadow:0 0 6px #ffb34059!important}.qi-dot.p{background:#f5f5f533}.off-card{background:#141414;border:1px solid rgba(255,255,255,.05);border-radius:16px;padding:14px}.off-hdr{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}.off-title-row{display:flex;align-items:center;gap:7px}.off-title{font-family:Bricolage Grotesque,sans-serif;font-size:13px;font-weight:700;color:#e8b86d}.off-ct{font-family:IBM Plex Mono,monospace;font-size:10px;font-weight:700;background:#c9933a1a;border:1px solid rgba(201,147,58,.18);color:#c9933a;padding:3px 9px;border-radius:100px}.off-list{display:flex;flex-direction:column;gap:4px;margin-bottom:11px}.oi{display:flex;align-items:center;gap:8px;padding:7px 10px;background:#0003;border-radius:9px}.oi-bar{width:2px;height:22px;border-radius:1px;background:#c9933a40;flex-shrink:0}.oi-txt{font-size:11px;color:#f5f5f580;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:400}.oi-t{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;flex-shrink:0}.sync-btn{width:100%;padding:10px;background:#c9933a14;border:1px solid rgba(201,147,58,.18);border-radius:10px;display:flex;align-items:center;justify-content:center;gap:8px;cursor:pointer;transition:background .15s}.sync-btn:hover{background:#c9933a1f}.sync-txt{font-family:Bricolage Grotesque,sans-serif;font-size:12px;font-weight:600;color:#c9933a}.fail-card{background:#ff4d4d0a;border:1px solid rgba(255,77,77,.15);border-radius:16px;overflow:hidden}.fail-card:before{content:"";display:block;height:1px;background:linear-gradient(90deg,#ff4d4d 0%,transparent 50%);opacity:.5}.fail-main{padding:12px 14px;display:flex;align-items:flex-start;gap:10px}.fail-icon{width:30px;height:30px;border-radius:8px;background:#ff4d4d1a;border:1px solid rgba(255,77,77,.18);display:flex;align-items:center;justify-content:center;flex-shrink:0}.fail-body{flex:1;min-width:0}.fail-title{font-size:12px;font-weight:700;color:#f5f5f5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:3px}.fail-reason{font-family:IBM Plex Mono,monospace;font-size:9px;color:#ff4d4d;opacity:.7;margin-bottom:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.fail-time{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533}.fail-actions{display:flex;border-top:1px solid rgba(255,77,77,.1)}.fa{flex:1;padding:9px 0;display:flex;align-items:center;justify-content:center;gap:5px;font-size:11px;font-weight:600;cursor:pointer;transition:background .15s}.fa:first-child{border-right:1px solid rgba(255,77,77,.1)}.fa.retry{color:#c9933a}.fa.retry:hover{background:#c9933a0f}.fa.discard{color:#ff4d4d;opacity:.7}.fa.discard:hover{background:#ff4d4d0f}.fa svg,.fa .fa-icon{width:12px;height:12px}.fail-expanded{background:#ff4d4d0a;border:1px solid rgba(255,77,77,.15);border-radius:16px;overflow:hidden}.fail-expanded:before{content:"";display:block;height:1px;background:linear-gradient(90deg,#ff4d4d 0%,transparent 50%);opacity:.5}.fe-main{padding:12px 14px;display:flex;align-items:flex-start;gap:10px}.fe-body{flex:1;min-width:0}.fe-title{font-size:12px;font-weight:700;color:#f5f5f5;margin-bottom:6px}.fe-error-box{background:#0000004d;border:1px solid rgba(255,77,77,.12);border-radius:8px;padding:8px 10px;margin-bottom:8px}.fe-code{font-family:IBM Plex Mono,monospace;font-size:9px;color:#ff4d4d;opacity:.8;letter-spacing:.3px;margin-bottom:3px}.fe-msg{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f580;line-height:1.5}.fe-attempts{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533}.retry-all{display:flex;align-items:center;justify-content:space-between;background:#c9933a0d;border:1px solid rgba(201,147,58,.12);border-radius:12px;padding:10px 14px;cursor:pointer;transition:background .15s}.retry-all:hover{background:#c9933a14}.ra-left{display:flex;align-items:center;gap:8px}.ra-ct{font-family:IBM Plex Mono,monospace;font-size:10px;font-weight:700;background:#ff4d4d1f;border:1px solid rgba(255,77,77,.2);color:#ff4d4d;padding:2px 8px;border-radius:100px}.ra-txt{font-size:12px;font-weight:600;color:#f5f5f580}.ra-btn{display:flex;align-items:center;gap:5px;font-size:11px;font-weight:700;color:#c9933a;font-family:IBM Plex Mono,monospace;letter-spacing:.5px}.ra-btn svg,.ra-btn .ra-icon{width:12px;height:12px}.done-item{background:#0d0d0d;border:1px solid rgba(255,255,255,.05);border-radius:13px;padding:9px 13px;display:flex;align-items:center;gap:10px;opacity:.7}.done-check{width:22px;height:22px;border-radius:50%;background:#3ddc841a;border:1px solid rgba(61,220,132,.2);display:flex;align-items:center;justify-content:center;flex-shrink:0}.done-body{flex:1;min-width:0}.done-title{font-size:11px;font-weight:600;color:#f5f5f54d;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.done-meta{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;margin-top:1px;opacity:.6}.done-ago{font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;flex-shrink:0;opacity:.5}.done-expand{display:flex;align-items:center;justify-content:center;gap:5px;width:100%;background:none;border:none;font-family:IBM Plex Mono,monospace;font-size:9px;color:#f5f5f533;text-align:center;letter-spacing:.5px;padding:6px 2px;transition:color .15s}.done-expand:hover:not(:disabled){color:#f5f5f573}.divider{height:1px;background:#ffffff0d}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.left-0{left:0}.right-0{right:0}.right-1{right:.25rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-4{top:1rem}.z-50{z-index:50}.z-\[100\]{z-index:100}.mx-auto{margin-left:auto;margin-right:auto}.mb-4{margin-bottom:1rem}.ml-3{margin-left:.75rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.h-0\.5{height:.125rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-40{height:10rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1px\]{height:1px}.h-auto{height:auto}.h-full{height:100%}.h-screen{height:100svh}.max-h-screen{max-height:100svh}.min-h-0{min-height:0px}.min-h-\[60px\]{min-height:60px}.w-11\/12{width:91.666667%}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-20{width:5rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-4\/5{width:80%}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[1px\]{width:1px}.w-\[90vw\]{width:90vw}.w-full{width:100%}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-border\/20{border-color:hsl(var(--border) / .2)}.border-destructive{border-color:hsl(var(--destructive))}.border-input{border-color:hsl(var(--input))}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-transparent{border-color:transparent}.border-white\/5{border-color:#ffffff0d}.bg-background{background-color:hsl(var(--background))}.bg-black\/80{background-color:#000c}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-destructive\/10{background-color:hsl(var(--destructive) / .1)}.bg-muted{background-color:hsl(var(--muted))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:transparent}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-primary{--tw-gradient-from: hsl(var(--primary)) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-primary\/80{--tw-gradient-to: hsl(var(--primary) / .8) var(--tw-gradient-to-position)}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pb-2{padding-bottom:.5rem}.pl-3{padding-left:.75rem}.pr-6{padding-right:1.5rem}.pt-0{padding-top:0}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.text-center{text-align:center}.font-mono{font-family:IBM Plex Mono,ui-monospace,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\[10px\]{font-size:10px}.text-\[17px\]{font-size:17px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-light{font-weight:300}.font-medium{font-weight:500}.font-semibold{font-weight:600}.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)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.text-\[\#C9933A\]{--tw-text-opacity: 1;color:rgb(201 147 58 / var(--tw-text-opacity, 1))}.text-\[\#f5f5f5\]{--tw-text-opacity: 1;color:rgb(245 245 245 / var(--tw-text-opacity, 1))}.text-\[rgba\(245\,245\,245\,0\.3\)\]{color:#f5f5f54d}.text-\[rgba\(245\,245\,245\,0\.4\)\]{color:#f5f5f566}.text-border{color:hsl(var(--border))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary\/70{color:hsl(var(--primary) / .7)}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.placeholder-\[rgba\(245\,245\,245\,0\.2\)\]::-moz-placeholder{color:#f5f5f533}.placeholder-\[rgba\(245\,245\,245\,0\.2\)\]::placeholder{color:#f5f5f533}.opacity-0{opacity:0}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_40px_hsl\(var\(--primary\)\/0\.1\)\]{--tw-shadow: 0 0 40px hsl(var(--primary)/.1);--tw-shadow-colored: 0 0 40px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.note-media{width:100%;border-radius:14px;border:1px solid rgba(255,255,255,.07);display:block}.note-media-loading{display:flex;align-items:center;justify-content:center;min-height:160px}.entity-rows{display:flex;flex-wrap:wrap;gap:6px}.entity-chip{display:inline-flex;align-items:center;gap:5px;padding:4px 11px;border-radius:100px;font-family:IBM Plex Mono,monospace;font-size:10px;font-weight:600;color:#f5f5f5a6;background:#ffffff08;border:1px solid rgba(255,255,255,.09);cursor:pointer;transition:all .15s}.entity-chip.person{color:var(--gl, #e8b86d);background:#c9933a0f;border-color:#c9933a47}.entity-chip:hover{background:#ffffff12;color:#fff}.entity-chip.person:hover{background:#c9933a24;color:var(--gl, #e8b86d)}.note-raw-prose{line-height:1.7}.note-raw-prose p{margin:0 0 .8em}.note-raw-prose h1,.note-raw-prose h2,.note-raw-prose h3{color:#f5f5f5d9;font-size:.95rem;margin:1.1em 0 .4em}.note-raw-prose ul,.note-raw-prose ol{padding-left:1.2em;margin:.5em 0}.note-raw-prose code{font-family:IBM Plex Mono,monospace;font-size:.85em;background:#ffffff0d;padding:1px 5px;border-radius:4px}.note-raw-prose pre{background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;padding:10px 12px;overflow-x:auto}.note-raw-prose pre code{background:none;padding:0}.note-raw-prose a{color:var(--gold, #c9933a)}.note-link-types-label{margin-left:auto;font-family:IBM Plex Mono,monospace;font-size:8.5px;font-weight:700;letter-spacing:.5px;text-transform:uppercase;color:#f5f5f54d;white-space:nowrap;flex-shrink:0}.note-links{padding:10px 12px;border-radius:12px;background:#ffffff05;border:1px solid rgba(255,255,255,.06)}.note-links-label{font-family:IBM Plex Mono,monospace;font-size:8.5px;font-weight:700;letter-spacing:.8px;text-transform:uppercase;color:#f5f5f540;margin-bottom:7px}.note-link-chip{display:flex;align-items:center;gap:7px;width:100%;padding:8px 10px;margin-bottom:4px;border-radius:9px;border:1px solid rgba(201,147,58,.14);background:#c9933a0a;color:#f5f5f5bf;font-size:12.5px;line-height:1.4;text-align:left;cursor:pointer;transition:all .15s ease}.note-link-chip:last-child{margin-bottom:0}.note-link-chip svg{color:var(--gold, #c9933a);flex-shrink:0}.note-link-chip:hover{background:#c9933a1a;border-color:#c9933a59;color:#fff}.note-link-title{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.ai-row{border-radius:12px;border:1px solid rgba(201,147,58,.16);background:linear-gradient(var(--bg-card, #111111),var(--bg-card, #111111)) padding-box,linear-gradient(135deg,#c9933a59,#c9933a0d 55%,#c9933a38) border-box;border:1px solid transparent;overflow:hidden;transition:box-shadow .25s ease}.ai-row.open{box-shadow:0 4px 24px #c9933a12}.ai-row.\!open{box-shadow:0 4px 24px #c9933a12!important}.ai-row-head{display:flex;align-items:center;gap:7px;width:100%;padding:9px 13px;border:none;background:transparent;cursor:pointer;text-align:left}.ai-spark{color:var(--gold);flex-shrink:0}.ai-spark.spin{animation:ai-pulse 1.4s ease-in-out infinite}.ai-row-label{font-family:IBM Plex Mono,monospace;font-size:10px;font-weight:700;letter-spacing:.6px;text-transform:uppercase;color:var(--gl);flex:1}.ai-chevron{color:#f5f5f540;transition:transform .3s cubic-bezier(.4,0,.2,1)}.ai-chevron.up{transform:rotate(180deg)}.ai-row-body{padding:2px 13px 11px}@keyframes ai-pulse{0%,to{opacity:1}50%{opacity:.45}}.ai-error-line{display:flex;justify-content:space-between;align-items:center;gap:8px}.ai-actions{display:flex;gap:4px}.ai-action{display:inline-flex;align-items:center;gap:4px;padding:4px;border-radius:8px;border:none;background:transparent;color:#f5f5f540;cursor:pointer;transition:all .15s}.ai-action:hover{color:var(--gl);background:#ffffff0a}.ai-foot{justify-content:flex-end;margin-top:8px}.ai-text{margin:0;font-size:13px;line-height:1.65;color:#f5f5f5d1}.ai-text.dim{color:#f5f5f559;font-size:12px}.ai-cite{display:inline;padding:0 1px;border:none;background:none;font-family:IBM Plex Mono,monospace;font-size:10px;font-weight:700;color:var(--gold);cursor:pointer;vertical-align:super;line-height:0;transition:color .15s}.ai-cite:hover{color:var(--gl)}.ai-skel-lines{display:flex;flex-direction:column;gap:9px;padding-top:2px}.ai-skel{height:11px;border-radius:6px}.q-skel-row{display:flex;align-items:center;gap:10px;padding:8px 16px}.q-skel{border-radius:6px}.q-skel-icon{width:28px;height:28px;border-radius:8px;flex-shrink:0}.q-skel-lines{display:flex;flex-direction:column;gap:6px;flex:1}.q-skel-w60{height:10px;width:60%}.q-skel-w35{height:8px;width:35%}.flare-chip{display:inline-flex;align-items:center;gap:3px;padding:2px 7px;border-radius:100px;font-family:IBM Plex Mono,monospace;font-size:9px;font-weight:700;color:var(--gl, #e8b86d);background:#c9933a14;border:1px solid rgba(201,147,58,.25);white-space:nowrap;cursor:pointer}.flare-enriched{display:inline-flex;color:#c9933a80}.done-item.clickable{cursor:pointer;transition:background .15s}.done-item.clickable:hover{background:#ffffff08}.done-expand.clickable{cursor:pointer}.animate-shimmer{background:linear-gradient(90deg,#141414,#1c1c1c,#141414);background-size:200% 100%;animation:shimmer 1.5s infinite}@keyframes shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.note-detail{padding:1rem;max-width:800px;margin:0 auto}.note-header{margin-bottom:1rem}.back-btn{background:transparent;border:1px solid rgba(255,255,255,.1);color:#f5f5f5cc;padding:.5rem 1rem;border-radius:.5rem;cursor:pointer;font-size:.875rem;transition:all .2s ease}.back-btn:hover{background:#ffffff0d;border-color:#c9933a4d;color:#c9933a}.note-title{font-size:1.875rem;font-weight:600;color:#f5f5f5;margin:1rem 0;line-height:1.3}.note-content{margin-top:1.5rem}.note-content pre{white-space:pre-wrap;word-wrap:break-word;color:#f5f5f5e6;line-height:1.6;font-family:IBM Plex Mono,monospace;font-size:.875rem}.note-content h1,.note-content h2,.note-content h3{color:#f5f5f5;margin-top:1.5rem;margin-bottom:.75rem}.note-content p{margin-bottom:1rem}.note-content ul,.note-content ol{padding-left:1.5rem;margin-bottom:1rem}.note-content li{margin-bottom:.5rem}.note-content code{background:#ffffff1a;padding:.125rem .375rem;border-radius:.25rem;font-family:IBM Plex Mono,monospace;font-size:.8125rem}.note-content pre{background:#ffffff0d;padding:1rem;border-radius:.5rem;overflow-x:auto;margin-bottom:1rem}.note-content blockquote{border-left:3px solid rgba(201,147,58,.3);padding-left:1rem;margin:1rem 0;color:#f5f5f5b3}.note-detail-loading,.note-detail-error{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:50vh;gap:1rem}.loading-text,.error-text{color:#f5f5f599;font-size:.875rem}.error-text{color:#ff4d4d}.note-section{margin-bottom:1.25rem}.note-section-heading{font-family:IBM Plex Mono,monospace;font-size:11px;font-weight:600;color:#c9933a;text-transform:uppercase;letter-spacing:.5px;margin-bottom:.5rem}.note-list{list-style:none;padding:0}.note-list li{font-size:.875rem;color:#f5f5f5b3;padding:.25rem 0 .25rem 1rem;position:relative}.note-list li:before{content:"•";position:absolute;left:0;color:#c9933a}.text-muted-foreground{color:#f5f5f5b3}.excerpt-box{background:#c9933a0f;border:1px solid rgba(201,147,58,.15);border-radius:13px;padding:1rem}.excerpt-text{font-size:.875rem;line-height:1.6;color:#f5f5f5cc}.excerpt-label{font-family:IBM Plex Mono,monospace;font-size:9px;text-transform:uppercase;letter-spacing:.5px;color:#c9933a99;margin-bottom:.5rem}.view-toggle{display:flex;gap:0;background:#ffffff08;border-radius:9px;padding:2px}.toggle-btn{flex:1;padding:.5rem .75rem;font-size:.8125rem;font-weight:500;border-radius:7px;cursor:pointer;transition:all .15s;border:none;background:transparent;color:#f5f5f566;text-align:center}.toggle-btn.active{background:#c9933a1f;color:#c9933a;font-weight:600}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.last\:border-b-0:last-child{border-bottom-width:0px}.hover\:scale-\[1\.02\]:hover{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:text-\[rgba\(245\,169\,169\,0\.9\)\]:hover{color:#f5a9a9e6}.hover\:text-\[rgba\(245\,245\,245\,0\.5\)\]:hover{color:#f5f5f580}.hover\:text-\[rgba\(245\,245\,245\,0\.6\)\]:hover{color:#f5f5f599}.hover\:text-\[rgba\(245\,245\,245\,0\.8\)\]:hover{color:#f5f5f5cc}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-destructive\/25:hover{--tw-shadow-color: hsl(var(--destructive) / .25);--tw-shadow: var(--tw-shadow-colored)}.hover\:shadow-primary\/25:hover{--tw-shadow-color: hsl(var(--primary) / .25);--tw-shadow: var(--tw-shadow-colored)}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:scale-\[0\.98\]:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:border-destructive\/30:hover{border-color:hsl(var(--destructive) / .3)}.group.destructive .group-\[\.destructive\]\:hover\:bg-destructive:hover{background-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:hover\:text-destructive-foreground:hover{color:hsl(var(--destructive-foreground))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-destructive:focus{--tw-ring-color: hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=closed\]\:duration-300[data-state=closed]{transition-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{transition-duration:.5s}.data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[swipe\=end\]\:animate-out[data-swipe=end]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\[state\=closed\]\:fade-out-80[data-state=closed]{--tw-exit-opacity: .8}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed],.data-\[state\=closed\]\:slide-out-to-right-full[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open],.data-\[state\=open\]\:slide-in-from-top-full[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=closed\]\:duration-300[data-state=closed]{animation-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{animation-duration:.5s}@media (min-width: 640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:top-auto{top:auto}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-sm{max-width:24rem}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:justify-end{justify-content:flex-end}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:text-left{text-align:left}.data-\[state\=open\]\:sm\:slide-in-from-bottom-full[data-state=open]{--tw-enter-translate-y: 100%}}@media (min-width: 768px){.md\:max-w-\[420px\]{max-width:420px}.md\:max-w-\[580px\]{max-width:580px}.md\:text-sm{font-size:.875rem;line-height:1.25rem}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\>button\:first-of-type\]\:hidden>button:first-of-type{display:none}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0} diff --git a/internal/api/ui/static/assets/index-BbIh6FfK.js b/internal/api/ui/static/assets/index-BbIh6FfK.js deleted file mode 100644 index 73587f4..0000000 --- a/internal/api/ui/static/assets/index-BbIh6FfK.js +++ /dev/null @@ -1,255 +0,0 @@ -var Ib=Object.defineProperty;var Db=(e,t,n)=>t in e?Ib(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Hl=(e,t,n)=>Db(e,typeof t!="symbol"?t+"":t,n);function _b(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var va=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vv={exports:{}},dl={},xv={exports:{}},Z={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Go=Symbol.for("react.element"),Lb=Symbol.for("react.portal"),Mb=Symbol.for("react.fragment"),Ob=Symbol.for("react.strict_mode"),Fb=Symbol.for("react.profiler"),Vb=Symbol.for("react.provider"),zb=Symbol.for("react.context"),Bb=Symbol.for("react.forward_ref"),$b=Symbol.for("react.suspense"),Ub=Symbol.for("react.memo"),Wb=Symbol.for("react.lazy"),kp=Symbol.iterator;function Hb(e){return e===null||typeof e!="object"?null:(e=kp&&e[kp]||e["@@iterator"],typeof e=="function"?e:null)}var wv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},kv=Object.assign,Sv={};function Ci(e,t,n){this.props=e,this.context=t,this.refs=Sv,this.updater=n||wv}Ci.prototype.isReactComponent={};Ci.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ci.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function bv(){}bv.prototype=Ci.prototype;function td(e,t,n){this.props=e,this.context=t,this.refs=Sv,this.updater=n||wv}var nd=td.prototype=new bv;nd.constructor=td;kv(nd,Ci.prototype);nd.isPureReactComponent=!0;var Sp=Array.isArray,Cv=Object.prototype.hasOwnProperty,rd={current:null},Ev={key:!0,ref:!0,__self:!0,__source:!0};function Tv(e,t,n){var r,i={},o=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(o=""+t.key),t)Cv.call(t,r)&&!Ev.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,ee=L[W];if(0>>1;Wi(Rt,b))cei(Kt,Rt)?(L[W]=Kt,L[ce]=b,W=ce):(L[W]=Rt,L[we]=b,W=we);else if(cei(Kt,b))L[W]=Kt,L[ce]=b,W=ce;else break e}}return _}function i(L,_){var b=L.sortIndex-_.sortIndex;return b!==0?b:L.id-_.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],u=[],c=1,f=null,h=3,p=!1,y=!1,v=!1,k=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(L){for(var _=n(u);_!==null;){if(_.callback===null)r(u);else if(_.startTime<=L)r(u),_.sortIndex=_.expirationTime,t(l,_);else break;_=n(u)}}function S(L){if(v=!1,w(L),!y)if(n(l)!==null)y=!0,K(T);else{var _=n(u);_!==null&&ne(S,_.startTime-L)}}function T(L,_){y=!1,v&&(v=!1,g(P),P=-1),p=!0;var b=h;try{for(w(_),f=n(l);f!==null&&(!(f.expirationTime>_)||L&&!I());){var W=f.callback;if(typeof W=="function"){f.callback=null,h=f.priorityLevel;var ee=W(f.expirationTime<=_);_=e.unstable_now(),typeof ee=="function"?f.callback=ee:f===n(l)&&r(l),w(_)}else r(l);f=n(l)}if(f!==null)var N=!0;else{var we=n(u);we!==null&&ne(S,we.startTime-_),N=!1}return N}finally{f=null,h=b,p=!1}}var C=!1,j=null,P=-1,A=5,E=-1;function I(){return!(e.unstable_now()-EL||125W?(L.sortIndex=b,t(u,L),n(l)===null&&L===n(u)&&(v?(g(P),P=-1):v=!0,ne(S,b-W))):(L.sortIndex=ee,t(l,L),y||p||(y=!0,K(T))),L},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(L){var _=h;return function(){var b=h;h=_;try{return L.apply(this,arguments)}finally{h=b}}}})(Av);Rv.exports=Av;var nC=Rv.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var rC=m,mt=nC;function M(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mc=Object.prototype.hasOwnProperty,iC=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Cp={},Ep={};function oC(e){return mc.call(Ep,e)?!0:mc.call(Cp,e)?!1:iC.test(e)?Ep[e]=!0:(Cp[e]=!0,!1)}function sC(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function aC(e,t,n,r){if(t===null||typeof t>"u"||sC(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Je(e,t,n,r,i,o,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var ze={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ze[e]=new Je(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ze[t]=new Je(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ze[e]=new Je(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ze[e]=new Je(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ze[e]=new Je(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ze[e]=new Je(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ze[e]=new Je(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ze[e]=new Je(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ze[e]=new Je(e,5,!1,e.toLowerCase(),null,!1,!1)});var od=/[\-:]([a-z])/g;function sd(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(od,sd);ze[t]=new Je(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(od,sd);ze[t]=new Je(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(od,sd);ze[t]=new Je(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ze[e]=new Je(e,1,!1,e.toLowerCase(),null,!1,!1)});ze.xlinkHref=new Je("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ze[e]=new Je(e,1,!1,e.toLowerCase(),null,!0,!0)});function ad(e,t,n,r){var i=ze.hasOwnProperty(t)?ze[t]:null;(i!==null?i.type!==0:r||!(2a||i[s]!==o[a]){var l=` -`+i[s].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{Gl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Qi(e):""}function lC(e){switch(e.tag){case 5:return Qi(e.type);case 16:return Qi("Lazy");case 13:return Qi("Suspense");case 19:return Qi("SuspenseList");case 0:case 2:case 15:return e=Yl(e.type,!1),e;case 11:return e=Yl(e.type.render,!1),e;case 1:return e=Yl(e.type,!0),e;default:return""}}function xc(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Wr:return"Fragment";case Ur:return"Portal";case gc:return"Profiler";case ld:return"StrictMode";case yc:return"Suspense";case vc:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case _v:return(e.displayName||"Context")+".Consumer";case Dv:return(e._context.displayName||"Context")+".Provider";case ud:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case cd:return t=e.displayName||null,t!==null?t:xc(e.type)||"Memo";case In:t=e._payload,e=e._init;try{return xc(e(t))}catch{}}return null}function uC(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return xc(t);case 8:return t===ld?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function qn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Mv(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function cC(e){var t=Mv(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ms(e){e._valueTracker||(e._valueTracker=cC(e))}function Ov(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Mv(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function xa(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function wc(e,t){var n=t.checked;return xe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Np(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=qn(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Fv(e,t){t=t.checked,t!=null&&ad(e,"checked",t,!1)}function kc(e,t){Fv(e,t);var n=qn(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Sc(e,t.type,n):t.hasOwnProperty("defaultValue")&&Sc(e,t.type,qn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Pp(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Sc(e,t,n){(t!=="number"||xa(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Zi=Array.isArray;function ii(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=gs.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Co(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var io={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},fC=["Webkit","ms","Moz","O"];Object.keys(io).forEach(function(e){fC.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),io[t]=io[e]})});function $v(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||io.hasOwnProperty(e)&&io[e]?(""+t).trim():t+"px"}function Uv(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=$v(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var dC=xe({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ec(e,t){if(t){if(dC[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(M(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(M(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(M(61))}if(t.style!=null&&typeof t.style!="object")throw Error(M(62))}}function Tc(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Nc=null;function fd(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Pc=null,oi=null,si=null;function Ap(e){if(e=Qo(e)){if(typeof Pc!="function")throw Error(M(280));var t=e.stateNode;t&&(t=yl(t),Pc(e.stateNode,e.type,t))}}function Wv(e){oi?si?si.push(e):si=[e]:oi=e}function Hv(){if(oi){var e=oi,t=si;if(si=oi=null,Ap(e),t)for(e=0;e>>=0,e===0?32:31-(bC(e)/CC|0)|0}var ys=64,vs=4194304;function Ji(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ba(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~i;a!==0?r=Ji(a):(o&=s,o!==0&&(r=Ji(o)))}else s=n&~i,s!==0?r=Ji(s):o!==0&&(r=Ji(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Yo(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ft(t),e[t]=n}function PC(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=so),zp=" ",Bp=!1;function fx(e,t){switch(e){case"keyup":return nE.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dx(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Hr=!1;function iE(e,t){switch(e){case"compositionend":return dx(t);case"keypress":return t.which!==32?null:(Bp=!0,zp);case"textInput":return e=t.data,e===zp&&Bp?null:e;default:return null}}function oE(e,t){if(Hr)return e==="compositionend"||!xd&&fx(e,t)?(e=ux(),Ys=gd=Mn=null,Hr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Hp(n)}}function gx(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?gx(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function yx(){for(var e=window,t=xa();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=xa(e.document)}return t}function wd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function pE(e){var t=yx(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&gx(n.ownerDocument.documentElement,n)){if(r!==null&&wd(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=Kp(n,o);var s=Kp(n,r);i&&s&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Kr=null,_c=null,lo=null,Lc=!1;function qp(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Lc||Kr==null||Kr!==xa(r)||(r=Kr,"selectionStart"in r&&wd(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),lo&&Ro(lo,r)||(lo=r,r=Ta(_c,"onSelect"),0Yr||(e.current=Bc[Yr],Bc[Yr]=null,Yr--)}function ue(e,t){Yr++,Bc[Yr]=e.current,e.current=t}var Gn={},He=Jn(Gn),rt=Jn(!1),xr=Gn;function pi(e,t){var n=e.type.contextTypes;if(!n)return Gn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function it(e){return e=e.childContextTypes,e!=null}function Pa(){pe(rt),pe(He)}function em(e,t,n){if(He.current!==Gn)throw Error(M(168));ue(He,t),ue(rt,n)}function Tx(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(M(108,uC(e)||"Unknown",i));return xe({},n,r)}function ja(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Gn,xr=He.current,ue(He,e),ue(rt,rt.current),!0}function tm(e,t,n){var r=e.stateNode;if(!r)throw Error(M(169));n?(e=Tx(e,t,xr),r.__reactInternalMemoizedMergedChildContext=e,pe(rt),pe(He),ue(He,e)):pe(rt),ue(rt,n)}var fn=null,vl=!1,uu=!1;function Nx(e){fn===null?fn=[e]:fn.push(e)}function TE(e){vl=!0,Nx(e)}function er(){if(!uu&&fn!==null){uu=!0;var e=0,t=ie;try{var n=fn;for(ie=1;e>=s,i-=s,dn=1<<32-Ft(t)+i|n<P?(A=j,j=null):A=j.sibling;var E=h(g,j,w[P],S);if(E===null){j===null&&(j=A);break}e&&j&&E.alternate===null&&t(g,j),x=o(E,x,P),C===null?T=E:C.sibling=E,C=E,j=A}if(P===w.length)return n(g,j),ge&&sr(g,P),T;if(j===null){for(;PP?(A=j,j=null):A=j.sibling;var I=h(g,j,E.value,S);if(I===null){j===null&&(j=A);break}e&&j&&I.alternate===null&&t(g,j),x=o(I,x,P),C===null?T=I:C.sibling=I,C=I,j=A}if(E.done)return n(g,j),ge&&sr(g,P),T;if(j===null){for(;!E.done;P++,E=w.next())E=f(g,E.value,S),E!==null&&(x=o(E,x,P),C===null?T=E:C.sibling=E,C=E);return ge&&sr(g,P),T}for(j=r(g,j);!E.done;P++,E=w.next())E=p(j,g,P,E.value,S),E!==null&&(e&&E.alternate!==null&&j.delete(E.key===null?P:E.key),x=o(E,x,P),C===null?T=E:C.sibling=E,C=E);return e&&j.forEach(function(R){return t(g,R)}),ge&&sr(g,P),T}function k(g,x,w,S){if(typeof w=="object"&&w!==null&&w.type===Wr&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case ps:e:{for(var T=w.key,C=x;C!==null;){if(C.key===T){if(T=w.type,T===Wr){if(C.tag===7){n(g,C.sibling),x=i(C,w.props.children),x.return=g,g=x;break e}}else if(C.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===In&&im(T)===C.type){n(g,C.sibling),x=i(C,w.props),x.ref=Ui(g,C,w),x.return=g,g=x;break e}n(g,C);break}else t(g,C);C=C.sibling}w.type===Wr?(x=gr(w.props.children,g.mode,S,w.key),x.return=g,g=x):(S=ra(w.type,w.key,w.props,null,g.mode,S),S.ref=Ui(g,x,w),S.return=g,g=S)}return s(g);case Ur:e:{for(C=w.key;x!==null;){if(x.key===C)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){n(g,x.sibling),x=i(x,w.children||[]),x.return=g,g=x;break e}else{n(g,x);break}else t(g,x);x=x.sibling}x=yu(w,g.mode,S),x.return=g,g=x}return s(g);case In:return C=w._init,k(g,x,C(w._payload),S)}if(Zi(w))return y(g,x,w,S);if(Fi(w))return v(g,x,w,S);Es(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(n(g,x.sibling),x=i(x,w),x.return=g,g=x):(n(g,x),x=gu(w,g.mode,S),x.return=g,g=x),s(g)):n(g,x)}return k}var gi=Ax(!0),Ix=Ax(!1),Ia=Jn(null),Da=null,Zr=null,Cd=null;function Ed(){Cd=Zr=Da=null}function Td(e){var t=Ia.current;pe(Ia),e._currentValue=t}function Wc(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function li(e,t){Da=e,Cd=Zr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(nt=!0),e.firstContext=null)}function Nt(e){var t=e._currentValue;if(Cd!==e)if(e={context:e,memoizedValue:t,next:null},Zr===null){if(Da===null)throw Error(M(308));Zr=e,Da.dependencies={lanes:0,firstContext:e}}else Zr=Zr.next=e;return t}var fr=null;function Nd(e){fr===null?fr=[e]:fr.push(e)}function Dx(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Nd(t)):(n.next=i.next,i.next=n),t.interleaved=n,yn(e,r)}function yn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Dn=!1;function Pd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function _x(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function pn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Un(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,re&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,yn(e,n)}return i=r.interleaved,i===null?(t.next=t,Nd(r)):(t.next=i.next,i.next=t),r.interleaved=t,yn(e,n)}function Qs(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,hd(e,n)}}function om(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?i=o=t:o=o.next=t}else i=o=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function _a(e,t,n,r){var i=e.updateQueue;Dn=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,u=l.next;l.next=null,s===null?o=u:s.next=u,s=l;var c=e.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==s&&(a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l))}if(o!==null){var f=i.baseState;s=0,c=u=l=null,a=o;do{var h=a.lane,p=a.eventTime;if((r&h)===h){c!==null&&(c=c.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=e,v=a;switch(h=t,p=n,v.tag){case 1:if(y=v.payload,typeof y=="function"){f=y.call(p,f,h);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=v.payload,h=typeof y=="function"?y.call(p,f,h):y,h==null)break e;f=xe({},f,h);break e;case 2:Dn=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=i.effects,h===null?i.effects=[a]:h.push(a))}else p={eventTime:p,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(u=c=p,l=f):c=c.next=p,s|=h;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;h=a,a=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);if(c===null&&(l=f),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=c,t=i.shared.interleaved,t!==null){i=t;do s|=i.lane,i=i.next;while(i!==t)}else o===null&&(i.shared.lanes=0);Sr|=s,e.lanes=s,e.memoizedState=f}}function sm(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=fu.transition;fu.transition={};try{e(!1),t()}finally{ie=n,fu.transition=r}}function Qx(){return Pt().memoizedState}function RE(e,t,n){var r=Hn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Zx(e))Jx(t,n);else if(n=Dx(e,t,n,r),n!==null){var i=Qe();Vt(n,e,r,i),ew(n,t,r)}}function AE(e,t,n){var r=Hn(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Zx(e))Jx(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,a=o(s,n);if(i.hasEagerState=!0,i.eagerState=a,$t(a,s)){var l=t.interleaved;l===null?(i.next=i,Nd(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=Dx(e,t,i,r),n!==null&&(i=Qe(),Vt(n,e,r,i),ew(n,t,r))}}function Zx(e){var t=e.alternate;return e===ve||t!==null&&t===ve}function Jx(e,t){uo=Ma=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ew(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,hd(e,n)}}var Oa={readContext:Nt,useCallback:Be,useContext:Be,useEffect:Be,useImperativeHandle:Be,useInsertionEffect:Be,useLayoutEffect:Be,useMemo:Be,useReducer:Be,useRef:Be,useState:Be,useDebugValue:Be,useDeferredValue:Be,useTransition:Be,useMutableSource:Be,useSyncExternalStore:Be,useId:Be,unstable_isNewReconciler:!1},IE={readContext:Nt,useCallback:function(e,t){return Gt().memoizedState=[e,t===void 0?null:t],e},useContext:Nt,useEffect:lm,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Js(4194308,4,Kx.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Js(4194308,4,e,t)},useInsertionEffect:function(e,t){return Js(4,2,e,t)},useMemo:function(e,t){var n=Gt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Gt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=RE.bind(null,ve,e),[r.memoizedState,e]},useRef:function(e){var t=Gt();return e={current:e},t.memoizedState=e},useState:am,useDebugValue:Md,useDeferredValue:function(e){return Gt().memoizedState=e},useTransition:function(){var e=am(!1),t=e[0];return e=jE.bind(null,e[1]),Gt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ve,i=Gt();if(ge){if(n===void 0)throw Error(M(407));n=n()}else{if(n=t(),Le===null)throw Error(M(349));kr&30||Fx(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,lm(zx.bind(null,r,o,e),[e]),r.flags|=2048,Fo(9,Vx.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Gt(),t=Le.identifierPrefix;if(ge){var n=hn,r=dn;n=(r&~(1<<32-Ft(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Mo++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Jt]=t,e[Do]=r,cw(e,t,!1,!1),t.stateNode=e;e:{switch(s=Tc(n,r),n){case"dialog":de("cancel",e),de("close",e),i=r;break;case"iframe":case"object":case"embed":de("load",e),i=r;break;case"video":case"audio":for(i=0;ixi&&(t.flags|=128,r=!0,Wi(o,!1),t.lanes=4194304)}else{if(!r)if(e=La(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Wi(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!ge)return $e(t),null}else 2*Ce()-o.renderingStartTime>xi&&n!==1073741824&&(t.flags|=128,r=!0,Wi(o,!1),t.lanes=4194304);o.isBackwards?(s.sibling=t.child,t.child=s):(n=o.last,n!==null?n.sibling=s:t.child=s,o.last=s)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Ce(),t.sibling=null,n=ye.current,ue(ye,r?n&1|2:n&1),t):($e(t),null);case 22:case 23:return $d(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ct&1073741824&&($e(t),t.subtreeFlags&6&&(t.flags|=8192)):$e(t),null;case 24:return null;case 25:return null}throw Error(M(156,t.tag))}function zE(e,t){switch(Sd(t),t.tag){case 1:return it(t.type)&&Pa(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return yi(),pe(rt),pe(He),Ad(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Rd(t),null;case 13:if(pe(ye),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(M(340));mi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return pe(ye),null;case 4:return yi(),null;case 10:return Td(t.type._context),null;case 22:case 23:return $d(),null;case 24:return null;default:return null}}var Ns=!1,Ue=!1,BE=typeof WeakSet=="function"?WeakSet:Set,$=null;function Jr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){be(e,t,r)}else n.current=null}function Jc(e,t,n){try{n()}catch(r){be(e,t,r)}}var xm=!1;function $E(e,t){if(Mc=Ca,e=yx(),wd(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,u=0,c=0,f=e,h=null;t:for(;;){for(var p;f!==n||i!==0&&f.nodeType!==3||(a=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===i&&(a=s),h===o&&++c===r&&(l=s),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Oc={focusedElem:e,selectionRange:n},Ca=!1,$=t;$!==null;)if(t=$,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,$=e;else for(;$!==null;){t=$;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var v=y.memoizedProps,k=y.memoizedState,g=t.stateNode,x=g.getSnapshotBeforeUpdate(t.elementType===t.type?v:Lt(t.type,v),k);g.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(M(163))}}catch(S){be(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,$=e;break}$=t.return}return y=xm,xm=!1,y}function co(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&Jc(t,n,o)}i=i.next}while(i!==r)}}function kl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ef(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function hw(e){var t=e.alternate;t!==null&&(e.alternate=null,hw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Jt],delete t[Do],delete t[zc],delete t[CE],delete t[EE])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function pw(e){return e.tag===5||e.tag===3||e.tag===4}function wm(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||pw(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function tf(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Na));else if(r!==4&&(e=e.child,e!==null))for(tf(e,t,n),e=e.sibling;e!==null;)tf(e,t,n),e=e.sibling}function nf(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(nf(e,t,n),e=e.sibling;e!==null;)nf(e,t,n),e=e.sibling}var Me=null,Mt=!1;function En(e,t,n){for(n=n.child;n!==null;)mw(e,t,n),n=n.sibling}function mw(e,t,n){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount(hl,n)}catch{}switch(n.tag){case 5:Ue||Jr(n,t);case 6:var r=Me,i=Mt;Me=null,En(e,t,n),Me=r,Mt=i,Me!==null&&(Mt?(e=Me,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Me.removeChild(n.stateNode));break;case 18:Me!==null&&(Mt?(e=Me,n=n.stateNode,e.nodeType===8?lu(e.parentNode,n):e.nodeType===1&&lu(e,n),Po(e)):lu(Me,n.stateNode));break;case 4:r=Me,i=Mt,Me=n.stateNode.containerInfo,Mt=!0,En(e,t,n),Me=r,Mt=i;break;case 0:case 11:case 14:case 15:if(!Ue&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&Jc(n,t,s),i=i.next}while(i!==r)}En(e,t,n);break;case 1:if(!Ue&&(Jr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){be(n,t,a)}En(e,t,n);break;case 21:En(e,t,n);break;case 22:n.mode&1?(Ue=(r=Ue)||n.memoizedState!==null,En(e,t,n),Ue=r):En(e,t,n);break;default:En(e,t,n)}}function km(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new BE),t.forEach(function(r){var i=QE.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function It(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=Ce()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*WE(r/1960))-r,10e?16:e,On===null)var r=!1;else{if(e=On,On=null,za=0,re&6)throw Error(M(331));var i=re;for(re|=4,$=e.current;$!==null;){var o=$,s=o.child;if($.flags&16){var a=o.deletions;if(a!==null){for(var l=0;lCe()-zd?mr(e,0):Vd|=n),ot(e,t)}function bw(e,t){t===0&&(e.mode&1?(t=vs,vs<<=1,!(vs&130023424)&&(vs=4194304)):t=1);var n=Qe();e=yn(e,t),e!==null&&(Yo(e,t,n),ot(e,n))}function XE(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),bw(e,n)}function QE(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(M(314))}r!==null&&r.delete(t),bw(e,n)}var Cw;Cw=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||rt.current)nt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return nt=!1,FE(e,t,n);nt=!!(e.flags&131072)}else nt=!1,ge&&t.flags&1048576&&Px(t,Aa,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;ea(e,t),e=t.pendingProps;var i=pi(t,He.current);li(t,n),i=Dd(null,t,r,e,i,n);var o=_d();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,it(r)?(o=!0,ja(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Pd(t),i.updater=wl,t.stateNode=i,i._reactInternals=t,Kc(t,r,e,n),t=Yc(null,t,r,!0,o,n)):(t.tag=0,ge&&o&&kd(t),qe(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(ea(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=JE(r),e=Lt(r,e),i){case 0:t=Gc(null,t,r,e,n);break e;case 1:t=gm(null,t,r,e,n);break e;case 11:t=pm(null,t,r,e,n);break e;case 14:t=mm(null,t,r,Lt(r.type,e),n);break e}throw Error(M(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Lt(r,i),Gc(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Lt(r,i),gm(e,t,r,i,n);case 3:e:{if(aw(t),e===null)throw Error(M(387));r=t.pendingProps,o=t.memoizedState,i=o.element,_x(e,t),_a(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=vi(Error(M(423)),t),t=ym(e,t,r,n,i);break e}else if(r!==i){i=vi(Error(M(424)),t),t=ym(e,t,r,n,i);break e}else for(ft=$n(t.stateNode.containerInfo.firstChild),dt=t,ge=!0,Ot=null,n=Ix(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(mi(),r===i){t=vn(e,t,n);break e}qe(e,t,r,n)}t=t.child}return t;case 5:return Lx(t),e===null&&Uc(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,Fc(r,i)?s=null:o!==null&&Fc(r,o)&&(t.flags|=32),sw(e,t),qe(e,t,s,n),t.child;case 6:return e===null&&Uc(t),null;case 13:return lw(e,t,n);case 4:return jd(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=gi(t,null,r,n):qe(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Lt(r,i),pm(e,t,r,i,n);case 7:return qe(e,t,t.pendingProps,n),t.child;case 8:return qe(e,t,t.pendingProps.children,n),t.child;case 12:return qe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,s=i.value,ue(Ia,r._currentValue),r._currentValue=s,o!==null)if($t(o.value,s)){if(o.children===i.children&&!rt.current){t=vn(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){s=o.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=pn(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Wc(o.return,n,t),a.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(M(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Wc(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}qe(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,li(t,n),i=Nt(i),r=r(i),t.flags|=1,qe(e,t,r,n),t.child;case 14:return r=t.type,i=Lt(r,t.pendingProps),i=Lt(r.type,i),mm(e,t,r,i,n);case 15:return iw(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Lt(r,i),ea(e,t),t.tag=1,it(r)?(e=!0,ja(t)):e=!1,li(t,n),tw(t,r,i),Kc(t,r,i,n),Yc(null,t,r,!0,e,n);case 19:return uw(e,t,n);case 22:return ow(e,t,n)}throw Error(M(156,t.tag))};function Ew(e,t){return Zv(e,t)}function ZE(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function St(e,t,n,r){return new ZE(e,t,n,r)}function Wd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function JE(e){if(typeof e=="function")return Wd(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ud)return 11;if(e===cd)return 14}return 2}function Kn(e,t){var n=e.alternate;return n===null?(n=St(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ra(e,t,n,r,i,o){var s=2;if(r=e,typeof e=="function")Wd(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Wr:return gr(n.children,i,o,t);case ld:s=8,i|=8;break;case gc:return e=St(12,n,t,i|2),e.elementType=gc,e.lanes=o,e;case yc:return e=St(13,n,t,i),e.elementType=yc,e.lanes=o,e;case vc:return e=St(19,n,t,i),e.elementType=vc,e.lanes=o,e;case Lv:return bl(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Dv:s=10;break e;case _v:s=9;break e;case ud:s=11;break e;case cd:s=14;break e;case In:s=16,r=null;break e}throw Error(M(130,e==null?e:typeof e,""))}return t=St(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function gr(e,t,n,r){return e=St(7,e,r,t),e.lanes=n,e}function bl(e,t,n,r){return e=St(22,e,r,t),e.elementType=Lv,e.lanes=n,e.stateNode={isHidden:!1},e}function gu(e,t,n){return e=St(6,e,null,t),e.lanes=n,e}function yu(e,t,n){return t=St(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function eT(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ql(0),this.expirationTimes=Ql(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ql(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Hd(e,t,n,r,i,o,s,a,l){return e=new eT(e,t,n,a,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=St(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Pd(o),e}function tT(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(jw)}catch(e){console.error(e)}}jw(),jv.exports=gt;var Ni=jv.exports;const sT=fl(Ni);var jm=Ni;pc.createRoot=jm.createRoot,pc.hydrateRoot=jm.hydrateRoot;const Yd=m.createContext({});function Xd(e){const t=m.useRef(null);return t.current===null&&(t.current=e()),t.current}const aT=typeof window<"u",Rw=aT?m.useLayoutEffect:m.useEffect,Pl=m.createContext(null);function Qd(e,t){e.indexOf(t)===-1&&e.push(t)}function Ua(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const on=(e,t,n)=>n>t?t:n{};const Yn={},Aw=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Iw(e){return typeof e=="object"&&e!==null}const Dw=e=>/^0[^.\s]+$/u.test(e);function _w(e){let t;return()=>(t===void 0&&(t=e()),t)}const Tt=e=>e,lT=(e,t)=>n=>t(e(n)),Jo=(...e)=>e.reduce(lT),zo=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class Jd{constructor(){this.subscriptions=[]}add(t){return Qd(this.subscriptions,t),()=>Ua(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let o=0;oe*1e3,bt=e=>e/1e3;function Lw(e,t){return t?e*(1e3/t):0}const Mw=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,uT=1e-7,cT=12;function fT(e,t,n,r,i){let o,s,a=0;do s=t+(n-t)/2,o=Mw(s,r,i)-e,o>0?n=s:t=s;while(Math.abs(o)>uT&&++afT(o,0,1,e,n);return o=>o===0||o===1?o:Mw(i(o),t,r)}const Ow=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Fw=e=>t=>1-e(1-t),Vw=es(.33,1.53,.69,.99),eh=Fw(Vw),zw=Ow(eh),Bw=e=>e>=1?1:(e*=2)<1?.5*eh(e):.5*(2-Math.pow(2,-10*(e-1))),th=e=>1-Math.sin(Math.acos(e)),$w=Fw(th),Uw=Ow(th),dT=es(.42,0,1,1),hT=es(0,0,.58,1),Ww=es(.42,0,.58,1),pT=e=>Array.isArray(e)&&typeof e[0]!="number",Hw=e=>Array.isArray(e)&&typeof e[0]=="number",mT={linear:Tt,easeIn:dT,easeInOut:Ww,easeOut:hT,circIn:th,circInOut:Uw,circOut:$w,backIn:eh,backInOut:zw,backOut:Vw,anticipate:Bw},gT=e=>typeof e=="string",Rm=e=>{if(Hw(e)){Zd(e.length===4);const[t,n,r,i]=e;return es(t,n,r,i)}else if(gT(e))return mT[e];return e},Rs=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function yT(e,t){let n=new Set,r=new Set,i=!1,o=!1;const s=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(c){s.has(c)&&(u.schedule(c),e()),c(a)}const u={schedule:(c,f=!1,h=!1)=>{const y=h&&i?n:r;return f&&s.add(c),y.add(c),c},cancel:c=>{r.delete(c),s.delete(c)},process:c=>{if(a=c,i){o=!0;return}i=!0;const f=n;n=r,r=f,n.forEach(l),n.clear(),i=!1,o&&(o=!1,u.process(c))}};return u}const vT=40;function Kw(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,s=Rs.reduce((w,S)=>(w[S]=yT(o),w),{}),{setup:a,read:l,resolveKeyframes:u,preUpdate:c,update:f,preRender:h,render:p,postRender:y}=s,v=()=>{const w=Yn.useManualTiming,S=w?i.timestamp:performance.now();n=!1,w||(i.delta=r?1e3/60:Math.max(Math.min(S-i.timestamp,vT),1)),i.timestamp=S,i.isProcessing=!0,a.process(i),l.process(i),u.process(i),c.process(i),f.process(i),h.process(i),p.process(i),y.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(v))},k=()=>{n=!0,r=!0,i.isProcessing||e(v)};return{schedule:Rs.reduce((w,S)=>{const T=s[S];return w[S]=(C,j=!1,P=!1)=>(n||k(),T.schedule(C,j,P)),w},{}),cancel:w=>{for(let S=0;S(ia===void 0&&Ye.set(Oe.isProcessing||Yn.useManualTiming?Oe.timestamp:performance.now()),ia),set:e=>{ia=e,queueMicrotask(xT)}},qw=e=>t=>typeof t=="string"&&t.startsWith(e),Gw=qw("--"),wT=qw("var(--"),nh=e=>wT(e)?kT.test(e.split("/*")[0].trim()):!1,kT=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Am(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Pi={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Bo={...Pi,transform:e=>on(0,1,e)},As={...Pi,default:1},po=e=>Math.round(e*1e5)/1e5,rh=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ST(e){return e==null}const bT=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ih=(e,t)=>n=>!!(typeof n=="string"&&bT.test(n)&&n.startsWith(e)||t&&!ST(n)&&Object.prototype.hasOwnProperty.call(n,t)),Yw=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,o,s,a]=r.match(rh);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(s),alpha:a!==void 0?parseFloat(a):1}},CT=e=>on(0,255,e),xu={...Pi,transform:e=>Math.round(CT(e))},hr={test:ih("rgb","red"),parse:Yw("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+xu.transform(e)+", "+xu.transform(t)+", "+xu.transform(n)+", "+po(Bo.transform(r))+")"};function ET(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const lf={test:ih("#"),parse:ET,transform:hr.transform},ts=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),jn=ts("deg"),rn=ts("%"),U=ts("px"),TT=ts("vh"),NT=ts("vw"),Im={...rn,parse:e=>rn.parse(e)/100,transform:e=>rn.transform(e*100)},ti={test:ih("hsl","hue"),parse:Yw("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+rn.transform(po(t))+", "+rn.transform(po(n))+", "+po(Bo.transform(r))+")"},Ne={test:e=>hr.test(e)||lf.test(e)||ti.test(e),parse:e=>hr.test(e)?hr.parse(e):ti.test(e)?ti.parse(e):lf.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?hr.transform(e):ti.transform(e),getAnimatableNone:e=>{const t=Ne.parse(e);return t.alpha=0,Ne.transform(t)}},PT=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function jT(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(rh))==null?void 0:t.length)||0)+(((n=e.match(PT))==null?void 0:n.length)||0)>0}const Xw="number",Qw="color",RT="var",AT="var(",Dm="${}",IT=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function wi(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let o=0;const a=t.replace(IT,l=>(Ne.test(l)?(r.color.push(o),i.push(Qw),n.push(Ne.parse(l))):l.startsWith(AT)?(r.var.push(o),i.push(RT),n.push(l)):(r.number.push(o),i.push(Xw),n.push(parseFloat(l))),++o,Dm)).split(Dm);return{values:n,split:a,indexes:r,types:i}}function DT(e){return wi(e).values}function Zw({split:e,types:t}){const n=e.length;return r=>{let i="";for(let o=0;otypeof e=="number"?0:Ne.test(e)?Ne.getAnimatableNone(e):e,MT=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:LT(e);function OT(e){const t=wi(e);return Zw(t)(t.values.map((r,i)=>MT(r,t.split[i])))}const zt={test:jT,parse:DT,createTransformer:_T,getAnimatableNone:OT};function wu(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function FT({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,o=0,s=0;if(!t)i=o=s=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;i=wu(l,a,e+1/3),o=wu(l,a,e),s=wu(l,a,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(s*255),alpha:r}}function Wa(e,t){return n=>n>0?t:e}const he=(e,t,n)=>e+(t-e)*n,ku=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},VT=[lf,hr,ti],zT=e=>VT.find(t=>t.test(e));function _m(e){const t=zT(e);if(!t)return!1;let n=t.parse(e);return t===ti&&(n=FT(n)),n}const Lm=(e,t)=>{const n=_m(e),r=_m(t);if(!n||!r)return Wa(e,t);const i={...n};return o=>(i.red=ku(n.red,r.red,o),i.green=ku(n.green,r.green,o),i.blue=ku(n.blue,r.blue,o),i.alpha=he(n.alpha,r.alpha,o),hr.transform(i))},uf=new Set(["none","hidden"]);function BT(e,t){return uf.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function $T(e,t){return n=>he(e,t,n)}function oh(e){return typeof e=="number"?$T:typeof e=="string"?nh(e)?Wa:Ne.test(e)?Lm:HT:Array.isArray(e)?Jw:typeof e=="object"?Ne.test(e)?Lm:UT:Wa}function Jw(e,t){const n=[...e],r=n.length,i=e.map((o,s)=>oh(o)(o,t[s]));return o=>{for(let s=0;s{for(const o in r)n[o]=r[o](i);return n}}function WT(e,t){const n=[],r={color:0,var:0,number:0};for(let i=0;i{const n=zt.createTransformer(t),r=wi(e),i=wi(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?uf.has(e)&&!i.values.length||uf.has(t)&&!r.values.length?BT(e,t):Jo(Jw(WT(r,i),i.values),n):Wa(e,t)};function e0(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?he(e,t,n):oh(e)(e,t)}const KT=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>se.update(t,n),stop:()=>Xn(t),now:()=>Oe.isProcessing?Oe.timestamp:Ye.now()}},t0=(e,t,n=10)=>{let r="";const i=Math.max(Math.round(t/n),2);for(let o=0;o=Ha?1/0:t}function qT(e,t=100,n){const r=n({...e,keyframes:[0,t]}),i=Math.min(sh(r),Ha);return{type:"keyframes",ease:o=>r.next(i*o).value/t,duration:bt(i)}}const Se={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function cf(e,t){return e*Math.sqrt(1-t*t)}const GT=12;function YT(e,t,n){let r=n;for(let i=1;i{const c=u*s,f=c*e,h=c-n,p=cf(u,s),y=Math.exp(-f);return Su-h/p*y},o=u=>{const f=u*s*e,h=f*n+n,p=Math.pow(s,2)*Math.pow(u,2)*e,y=Math.exp(-f),v=cf(Math.pow(u,2),s);return(-i(u)+Su>0?-1:1)*((h-p)*y)/v}):(i=u=>{const c=Math.exp(-u*e),f=(u-n)*e+1;return-Su+c*f},o=u=>{const c=Math.exp(-u*e),f=(n-u)*(e*e);return c*f});const a=5/e,l=YT(i,o,a);if(e=ht(e),isNaN(l))return{stiffness:Se.stiffness,damping:Se.damping,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:s*2*Math.sqrt(r*u),duration:e}}}const QT=["duration","bounce"],ZT=["stiffness","damping","mass"];function Mm(e,t){return t.some(n=>e[n]!==void 0)}function JT(e){let t={velocity:Se.velocity,stiffness:Se.stiffness,damping:Se.damping,mass:Se.mass,isResolvedFromDuration:!1,...e};if(!Mm(e,ZT)&&Mm(e,QT))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,o=2*on(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Se.mass,stiffness:i,damping:o}}else{const n=XT({...e,velocity:0});t={...t,...n,mass:Se.mass},t.isResolvedFromDuration=!0}return t}function Ka(e=Se.visualDuration,t=Se.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:i}=n;const o=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:u,mass:c,duration:f,velocity:h,isResolvedFromDuration:p}=JT({...n,velocity:-bt(n.velocity||0)}),y=h||0,v=u/(2*Math.sqrt(l*c)),k=s-o,g=bt(Math.sqrt(l/c)),x=Math.abs(k)<5;r||(r=x?Se.restSpeed.granular:Se.restSpeed.default),i||(i=x?Se.restDelta.granular:Se.restDelta.default);let w,S,T,C,j,P;if(v<1)T=cf(g,v),C=(y+v*g*k)/T,w=E=>{const I=Math.exp(-v*g*E);return s-I*(C*Math.sin(T*E)+k*Math.cos(T*E))},j=v*g*C+k*T,P=v*g*k-C*T,S=E=>Math.exp(-v*g*E)*(j*Math.sin(T*E)+P*Math.cos(T*E));else if(v===1){w=I=>s-Math.exp(-g*I)*(k+(y+g*k)*I);const E=y+g*k;S=I=>Math.exp(-g*I)*(g*E*I-y)}else{const E=g*Math.sqrt(v*v-1);w=F=>{const B=Math.exp(-v*g*F),K=Math.min(E*F,300);return s-B*((y+v*g*k)*Math.sinh(K)+E*k*Math.cosh(K))/E};const I=(y+v*g*k)/E,R=v*g*I-k*E,z=v*g*k-I*E;S=F=>{const B=Math.exp(-v*g*F),K=Math.min(E*F,300);return B*(R*Math.sinh(K)+z*Math.cosh(K))}}const A={calculatedDuration:p&&f||null,velocity:E=>ht(S(E)),next:E=>{if(!p&&v<1){const R=Math.exp(-v*g*E),z=Math.sin(T*E),F=Math.cos(T*E),B=s-R*(C*z+k*F),K=ht(R*(j*z+P*F));return a.done=Math.abs(K)<=r&&Math.abs(s-B)<=i,a.value=a.done?s:B,a}const I=w(E);if(p)a.done=E>=f;else{const R=ht(S(E));a.done=Math.abs(R)<=r&&Math.abs(s-I)<=i}return a.value=a.done?s:I,a},toString:()=>{const E=Math.min(sh(A),Ha),I=t0(R=>A.next(E*R).value,E,30);return E+"ms "+I},toTransition:()=>{}};return A}Ka.applyToOptions=e=>{const t=qT(e,100,Ka);return e.ease=t.ease,e.duration=ht(t.duration),e.type="keyframes",e};const eN=5;function n0(e,t,n){const r=Math.max(t-eN,0);return Lw(n-e(r),t-r)}function ff({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:l,restDelta:u=.5,restSpeed:c}){const f=e[0],h={done:!1,value:f},p=P=>a!==void 0&&Pl,y=P=>a===void 0?l:l===void 0||Math.abs(a-P)-v*Math.exp(-P/r),w=P=>g+x(P),S=P=>{const A=x(P),E=w(P);h.done=Math.abs(A)<=u,h.value=h.done?g:E};let T,C;const j=P=>{p(h.value)&&(T=P,C=Ka({keyframes:[h.value,y(h.value)],velocity:n0(w,P,h.value),damping:i,stiffness:o,restDelta:u,restSpeed:c}))};return j(0),{calculatedDuration:null,next:P=>{let A=!1;return!C&&T===void 0&&(A=!0,S(P),j(P)),T!==void 0&&P>=T?C.next(P-T):(!A&&S(P),h)}}}function tN(e,t,n){const r=[],i=n||Yn.mix||e0,o=e.length-1;for(let s=0;st[0];if(o===2&&t[0]===t[1])return()=>t[1];const s=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=tN(t,r,i),l=a.length,u=c=>{if(s&&c1)for(;fu(on(e[0],e[o-1],c)):u}function rN(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=zo(0,t,r);e.push(he(n,1,i))}}function iN(e){const t=[0];return rN(t,e.length-1),t}function oN(e,t){return e.map(n=>n*t)}function sN(e,t){return e.map(()=>t||Ww).splice(0,e.length-1)}function mo({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=pT(r)?r.map(Rm):Rm(r),o={done:!1,value:t[0]},s=oN(n&&n.length===t.length?n:iN(t),e),a=nN(s,t,{ease:Array.isArray(i)?i:sN(t,i)});return{calculatedDuration:e,next:l=>(o.value=a(l),o.done=l>=e,o)}}const aN=e=>e!==null;function jl(e,{repeat:t,repeatType:n="loop"},r,i=1){const o=e.filter(aN),a=i<0||t&&n!=="loop"&&t%2===1?0:o.length-1;return!a||r===void 0?o[a]:r}const lN={decay:ff,inertia:ff,tween:mo,keyframes:mo,spring:Ka};function r0(e){typeof e.type=="string"&&(e.type=lN[e.type])}class ah{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const uN=e=>e/100;class qa extends ah{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var r,i;const{motionValue:n}=this.options;n&&n.updatedAt!==Ye.now()&&this.tick(Ye.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(i=(r=this.options).onStop)==null||i.call(r))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;r0(t);const{type:n=mo,repeat:r=0,repeatDelay:i=0,repeatType:o,velocity:s=0}=t;let{keyframes:a}=t;const l=n||mo;l!==mo&&typeof a[0]!="number"&&(this.mixKeyframes=Jo(uN,e0(a[0],a[1])),a=[0,100]);const u=l({...t,keyframes:a});o==="mirror"&&(this.mirroredGenerator=l({...t,keyframes:[...a].reverse(),velocity:-s})),u.calculatedDuration===null&&(u.calculatedDuration=sh(u));const{calculatedDuration:c}=u;this.calculatedDuration=c,this.resolvedDuration=c+i,this.totalDuration=this.resolvedDuration*(r+1)-i,this.generator=u}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:i,mixKeyframes:o,mirroredGenerator:s,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return r.next(0);const{delay:u=0,keyframes:c,repeat:f,repeatType:h,repeatDelay:p,type:y,onUpdate:v,finalKeyframe:k}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const g=this.currentTime-u*(this.playbackSpeed>=0?1:-1),x=this.playbackSpeed>=0?g<0:g>i;this.currentTime=Math.max(g,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let w=this.currentTime,S=r;if(f){const P=Math.min(this.currentTime,i)/a;let A=Math.floor(P),E=P%1;!E&&P>=1&&(E=1),E===1&&A--,A=Math.min(A,f+1),!!(A%2)&&(h==="reverse"?(E=1-E,p&&(E-=p/a)):h==="mirror"&&(S=s)),w=on(0,1,E)*a}let T;x?(this.delayState.value=c[0],T=this.delayState):T=S.next(w),o&&!x&&(T.value=o(T.value));let{done:C}=T;!x&&l!==null&&(C=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const j=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return j&&y!==ff&&(T.value=jl(c,this.options,k,this.speed)),v&&v(T.value),j&&this.finish(),T}then(t,n){return this.finished.then(t,n)}get duration(){return bt(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+bt(t)}get time(){return bt(this.currentTime)}set time(t){t=ht(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const n=this.generator.next(t).value;return n0(r=>this.generator.next(r).value,t,n)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime(Ye.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=bt(this.currentTime))}play(){var i,o;if(this.isStopped)return;const{driver:t=KT,startTime:n}=this.options;this.driver||(this.driver=t(s=>this.tick(s))),(o=(i=this.options).onPlay)==null||o.call(i);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Ye.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function cN(e){for(let t=1;te*180/Math.PI,df=e=>{const t=pr(Math.atan2(e[1],e[0]));return hf(t)},fN={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:df,rotateZ:df,skewX:e=>pr(Math.atan(e[1])),skewY:e=>pr(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},hf=e=>(e=e%360,e<0&&(e+=360),e),Om=df,Fm=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Vm=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),dN={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Fm,scaleY:Vm,scale:e=>(Fm(e)+Vm(e))/2,rotateX:e=>hf(pr(Math.atan2(e[6],e[5]))),rotateY:e=>hf(pr(Math.atan2(-e[2],e[0]))),rotateZ:Om,rotate:Om,skewX:e=>pr(Math.atan(e[4])),skewY:e=>pr(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function pf(e){return e.includes("scale")?1:0}function mf(e,t){if(!e||e==="none")return pf(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(n)r=dN,i=n;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=fN,i=a}if(!i)return pf(t);const o=r[t],s=i[1].split(",").map(pN);return typeof o=="function"?o(s):s[o]}const hN=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return mf(n,t)};function pN(e){return parseFloat(e.trim())}const ji=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ri=new Set(ji),zm=e=>e===Pi||e===U,mN=new Set(["x","y","z"]),gN=ji.filter(e=>!mN.has(e));function yN(e){const t=[];return gN.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const Fn={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:r})=>{const i=e.max-e.min;return r==="border-box"?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:r})=>{const i=e.max-e.min;return r==="border-box"?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>mf(t,"x"),y:(e,{transform:t})=>mf(t,"y")};Fn.translateX=Fn.x;Fn.translateY=Fn.y;const yr=new Set;let gf=!1,yf=!1,vf=!1;function i0(){if(yf){const e=Array.from(yr).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const i=yN(r);i.length&&(n.set(r,i),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([o,s])=>{var a;(a=r.getValue(o))==null||a.set(s)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}yf=!1,gf=!1,yr.forEach(e=>e.complete(vf)),yr.clear()}function o0(){yr.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(yf=!0)})}function vN(){vf=!0,o0(),i0(),vf=!1}class lh{constructor(t,n,r,i,o,s=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=i,this.element=o,this.isAsync=s}scheduleResolve(){this.state="scheduled",this.isAsync?(yr.add(this),gf||(gf=!0,se.read(o0),se.resolveKeyframes(i0))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:i}=this;if(t[0]===null){const o=i==null?void 0:i.get(),s=t[t.length-1];if(o!==void 0)t[0]=o;else if(r&&n){const a=r.readValue(n,s);a!=null&&(t[0]=a)}t[0]===void 0&&(t[0]=s),i&&o===void 0&&i.set(t[0])}cN(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),yr.delete(this)}cancel(){this.state==="scheduled"&&(yr.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const xN=e=>e.startsWith("--");function s0(e,t,n){xN(t)?e.style.setProperty(t,n):e.style[t]=n}const wN={};function a0(e,t){const n=_w(e);return()=>wN[t]??n()}const kN=a0(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),l0=a0(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),to=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Bm={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:to([0,.65,.55,1]),circOut:to([.55,0,1,.45]),backIn:to([.31,.01,.66,-.59]),backOut:to([.33,1.53,.69,.99])};function u0(e,t){if(e)return typeof e=="function"?l0()?t0(e,t):"ease-out":Hw(e)?to(e):Array.isArray(e)?e.map(n=>u0(n,t)||Bm.easeOut):Bm[e]}function SN(e,t,n,{delay:r=0,duration:i=300,repeat:o=0,repeatType:s="loop",ease:a="easeOut",times:l}={},u=void 0){const c={[t]:n};l&&(c.offset=l);const f=u0(a,i);Array.isArray(f)&&(c.easing=f);const h={delay:r,duration:i,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:o+1,direction:s==="reverse"?"alternate":"normal"};return u&&(h.pseudoElement=u),e.animate(c,h)}function c0(e){return typeof e=="function"&&"applyToOptions"in e}function bN({type:e,...t}){return c0(e)&&l0()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class f0 extends ah{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:r,keyframes:i,pseudoElement:o,allowFlatten:s=!1,finalKeyframe:a,onComplete:l}=t;this.isPseudoElement=!!o,this.allowFlatten=s,this.options=t,Zd(typeof t.type!="string");const u=bN(t);this.animation=SN(n,r,i,u,o),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const c=jl(i,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(c),s0(n,r,c),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var n,r,i;const t=(n=this.options)==null?void 0:n.element;!this.isPseudoElement&&(t!=null&&t.isConnected)&&((i=(r=this.animation).commitStyles)==null||i.call(r))}get duration(){var n,r;const t=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return bt(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+bt(t)}get time(){return bt(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=ht(t),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:n,rangeEnd:r,observe:i}){var o;return this.allowFlatten&&((o=this.animation.effect)==null||o.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&kN()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),Tt):i(this)}}const d0={anticipate:Bw,backInOut:zw,circInOut:Uw};function CN(e){return e in d0}function EN(e){typeof e.ease=="string"&&CN(e.ease)&&(e.ease=d0[e.ease])}const bu=10;class TN extends f0{constructor(t){EN(t),r0(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:i,element:o,...s}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const a=new qa({...s,autoplay:!1}),l=Math.max(bu,Ye.now()-this.startTime),u=on(0,bu,l-bu),c=a.sample(l).value,{name:f}=this.options;o&&f&&s0(o,f,c),n.setWithVelocity(a.sample(Math.max(0,l-u)).value,c,u),a.stop()}}const $m=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(zt.test(e)||e==="0")&&!e.startsWith("url("));function NN(e){const t=e[0];if(e.length===1)return!0;for(let n=0;nObject.hasOwnProperty.call(Element.prototype,"animate"));function DN(e){var f;const{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:o,type:s,keyframes:a}=e;if(!(((f=t==null?void 0:t.owner)==null?void 0:f.current)instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:c}=t.owner.getProps();return IN()&&n&&(h0.has(n)||AN.has(n)&&RN(a))&&(n!=="transform"||!c)&&!u&&!r&&i!=="mirror"&&o!==0&&s!=="inertia"}const _N=40;class LN extends ah{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:o=0,repeatType:s="loop",keyframes:a,name:l,motionValue:u,element:c,...f}){var y;super(),this.stop=()=>{var v,k;this._animation&&(this._animation.stop(),(v=this.stopTimeline)==null||v.call(this)),(k=this.keyframeResolver)==null||k.cancel()},this.createdAt=Ye.now();const h={autoplay:t,delay:n,type:r,repeat:i,repeatDelay:o,repeatType:s,name:l,motionValue:u,element:c,...f},p=(c==null?void 0:c.KeyframeResolver)||lh;this.keyframeResolver=new p(a,(v,k,g)=>this.onKeyframesResolved(v,k,h,!g),l,u,c),(y=this.keyframeResolver)==null||y.scheduleResolve()}onKeyframesResolved(t,n,r,i){var g,x;this.keyframeResolver=void 0;const{name:o,type:s,velocity:a,delay:l,isHandoff:u,onUpdate:c}=r;this.resolvedAt=Ye.now();let f=!0;PN(t,o,s,a)||(f=!1,(Yn.instantAnimations||!l)&&(c==null||c(jl(t,r,n))),t[0]=t[t.length-1],xf(r),r.repeat=0);const p={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>_N?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},y=f&&!u&&DN(p),v=(x=(g=p.motionValue)==null?void 0:g.owner)==null?void 0:x.current;let k;if(y)try{k=new TN({...p,element:v})}catch{k=new qa(p)}else k=new qa(p);k.finished.then(()=>{this.notifyFinished()}).catch(Tt),this.pendingTimeline&&(this.stopTimeline=k.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=k}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),vN()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}function p0(e,t,n,r=0,i=1){const o=Array.from(e).sort((u,c)=>u.sortNodePosition(c)).indexOf(t),s=e.size,a=(s-1)*r;return typeof n=="function"?n(o,s):i===1?o*r:a-o*r}const MN=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ON(e){const t=MN.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}function m0(e,t,n=1){const[r,i]=ON(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const s=o.trim();return Aw(s)?parseFloat(s):s}return nh(i)?m0(i,t,n+1):i}const FN={type:"spring",stiffness:500,damping:25,restSpeed:10},VN=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),zN={type:"keyframes",duration:.8},BN={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},$N=(e,{keyframes:t})=>t.length>2?zN:Ri.has(e)?e.startsWith("scale")?VN(t[1]):FN:BN;function g0(e,t){if(e!=null&&e.inherit&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function uh(e,t){const n=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return n!==e?g0(n,e):n}const UN=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function WN(e){for(const t in e)if(!UN.has(t))return!0;return!1}const ch=(e,t,n,r={},i,o)=>s=>{const a=uh(r,e)||{},l=a.delay||r.delay||0;let{elapsed:u=0}=r;u=u-ht(l);const c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-u,onUpdate:h=>{t.set(h),a.onUpdate&&a.onUpdate(h)},onComplete:()=>{s(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:o?void 0:i};WN(a)||Object.assign(c,$N(e,c)),c.duration&&(c.duration=ht(c.duration)),c.repeatDelay&&(c.repeatDelay=ht(c.repeatDelay)),c.from!==void 0&&(c.keyframes[0]=c.from);let f=!1;if((c.type===!1||c.duration===0&&!c.repeatDelay)&&(xf(c),c.delay===0&&(f=!0)),(Yn.instantAnimations||Yn.skipAnimations||i!=null&&i.shouldSkipAnimations)&&(f=!0,xf(c),c.delay=0),c.allowFlatten=!a.type&&!a.ease,f&&!o&&t.get()!==void 0){const h=jl(c.keyframes,a);if(h!==void 0){se.update(()=>{c.onUpdate(h),c.onComplete()});return}}return a.isSync?new qa(c):new LN(c)};function Um(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function fh(e,t,n,r){if(typeof t=="function"){const[i,o]=Um(r);t=t(n!==void 0?n:e.custom,i,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,o]=Um(r);t=t(n!==void 0?n:e.custom,i,o)}return t}function vr(e,t,n){const r=e.getProps();return fh(r,t,n!==void 0?n:r.custom,e)}const y0=new Set(["width","height","top","left","right","bottom",...ji]),Wm=30,HN=e=>!isNaN(parseFloat(e));class KN{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var o;const i=Ye.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((o=this.events.change)==null||o.notify(this.current),this.dependents))for(const s of this.dependents)s.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Ye.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=HN(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Jd);const r=this.events[t].add(n);return t==="change"?()=>{r(),se.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Ye.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Wm)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Wm);return Lw(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ki(e,t){return new KN(e,t)}const wf=e=>Array.isArray(e);function qN(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,ki(n))}function GN(e){return wf(e)?e[e.length-1]||0:e}function YN(e,t){const n=vr(e,t);let{transitionEnd:r={},transition:i={},...o}=n||{};o={...o,...r};for(const s in o){const a=GN(o[s]);qN(e,s,a)}}const Fe=e=>!!(e&&e.getVelocity);function XN(e){return!!(Fe(e)&&e.add)}function kf(e,t){const n=e.getValue("willChange");if(XN(n))return n.add(t);if(!n&&Yn.WillChange){const r=new Yn.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function dh(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const QN="framerAppearId",v0="data-"+dh(QN);function x0(e){return e.props[v0]}function ZN({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function w0(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:o,transitionEnd:s,...a}=t;const l=e.getDefaultTransition();o=o?g0(o,l):l;const u=o==null?void 0:o.reduceMotion;r&&(o=r);const c=[],f=i&&e.animationState&&e.animationState.getState()[i];for(const h in a){const p=e.getValue(h,e.latestValues[h]??null),y=a[h];if(y===void 0||f&&ZN(f,h))continue;const v={delay:n,...uh(o||{},h)},k=p.get();if(k!==void 0&&!p.isAnimating()&&!Array.isArray(y)&&y===k&&!v.velocity){se.update(()=>p.set(y));continue}let g=!1;if(window.MotionHandoffAnimation){const S=x0(e);if(S){const T=window.MotionHandoffAnimation(S,h,se);T!==null&&(v.startTime=T,g=!0)}}kf(e,h);const x=u??e.shouldReduceMotion;p.start(ch(h,p,y,x&&y0.has(h)?{type:!1}:v,e,g));const w=p.animation;w&&c.push(w)}if(s){const h=()=>se.update(()=>{s&&YN(e,s)});c.length?Promise.all(c).then(h):h()}return c}function Sf(e,t,n={}){var l;const r=vr(e,t,n.type==="exit"?(l=e.presenceContext)==null?void 0:l.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all(w0(e,r,n)):()=>Promise.resolve(),s=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:c=0,staggerChildren:f,staggerDirection:h}=i;return JN(e,t,u,c,f,h,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[u,c]=a==="beforeChildren"?[o,s]:[s,o];return u().then(()=>c())}else return Promise.all([o(),s(n.delay)])}function JN(e,t,n=0,r=0,i=0,o=1,s){const a=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),a.push(Sf(l,t,{...s,delay:n+(typeof r=="function"?0:r)+p0(e.variantChildren,l,r,i,o)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(a)}function eP(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(o=>Sf(e,o,n));r=Promise.all(i)}else if(typeof t=="string")r=Sf(e,t,n);else{const i=typeof t=="function"?vr(e,t,n.custom):t;r=Promise.all(w0(e,i,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const tP={test:e=>e==="auto",parse:e=>e},k0=e=>t=>t.test(e),S0=[Pi,U,rn,jn,NT,TT,tP],Hm=e=>S0.find(k0(e));function nP(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Dw(e):!0}const rP=new Set(["brightness","contrast","saturate","opacity"]);function iP(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(rh)||[];if(!r)return e;const i=n.replace(r,"");let o=rP.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+i+")"}const oP=/\b([a-z-]*)\(.*?\)/gu,bf={...zt,getAnimatableNone:e=>{const t=e.match(oP);return t?t.map(iP).join(" "):e}},Cf={...zt,getAnimatableNone:e=>{const t=zt.parse(e);return zt.createTransformer(e)(t.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},Km={...Pi,transform:Math.round},sP={rotate:jn,rotateX:jn,rotateY:jn,rotateZ:jn,scale:As,scaleX:As,scaleY:As,scaleZ:As,skew:jn,skewX:jn,skewY:jn,distance:U,translateX:U,translateY:U,translateZ:U,x:U,y:U,z:U,perspective:U,transformPerspective:U,opacity:Bo,originX:Im,originY:Im,originZ:U},hh={borderWidth:U,borderTopWidth:U,borderRightWidth:U,borderBottomWidth:U,borderLeftWidth:U,borderRadius:U,borderTopLeftRadius:U,borderTopRightRadius:U,borderBottomRightRadius:U,borderBottomLeftRadius:U,width:U,maxWidth:U,height:U,maxHeight:U,top:U,right:U,bottom:U,left:U,inset:U,insetBlock:U,insetBlockStart:U,insetBlockEnd:U,insetInline:U,insetInlineStart:U,insetInlineEnd:U,padding:U,paddingTop:U,paddingRight:U,paddingBottom:U,paddingLeft:U,paddingBlock:U,paddingBlockStart:U,paddingBlockEnd:U,paddingInline:U,paddingInlineStart:U,paddingInlineEnd:U,margin:U,marginTop:U,marginRight:U,marginBottom:U,marginLeft:U,marginBlock:U,marginBlockStart:U,marginBlockEnd:U,marginInline:U,marginInlineStart:U,marginInlineEnd:U,fontSize:U,backgroundPositionX:U,backgroundPositionY:U,...sP,zIndex:Km,fillOpacity:Bo,strokeOpacity:Bo,numOctaves:Km},aP={...hh,color:Ne,backgroundColor:Ne,outlineColor:Ne,fill:Ne,stroke:Ne,borderColor:Ne,borderTopColor:Ne,borderRightColor:Ne,borderBottomColor:Ne,borderLeftColor:Ne,filter:bf,WebkitFilter:bf,mask:Cf,WebkitMask:Cf},b0=e=>aP[e],lP=new Set([bf,Cf]);function C0(e,t){let n=b0(e);return lP.has(n)||(n=zt),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const uP=new Set(["auto","none","0"]);function cP(e,t,n){let r=0,i;for(;r{t.getValue(l).set(u)}),this.resolveNoneKeyframes()}}function E0(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const i=(n==null?void 0:n[e])??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(r=>r!=null)}const T0=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function oa(e){return Iw(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:ph}=Kw(queueMicrotask,!1),_t={x:!1,y:!1};function N0(){return _t.x||_t.y}function dP(e){return e==="x"||e==="y"?_t[e]?null:(_t[e]=!0,()=>{_t[e]=!1}):_t.x||_t.y?null:(_t.x=_t.y=!0,()=>{_t.x=_t.y=!1})}function P0(e,t){const n=E0(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function hP(e){return!(e.pointerType==="touch"||N0())}function pP(e,t,n={}){const[r,i,o]=P0(e,n);return r.forEach(s=>{let a=!1,l=!1,u;const c=()=>{s.removeEventListener("pointerleave",y)},f=k=>{u&&(u(k),u=void 0),c()},h=k=>{a=!1,window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",h),l&&(l=!1,f(k))},p=()=>{a=!0,window.addEventListener("pointerup",h,i),window.addEventListener("pointercancel",h,i)},y=k=>{if(k.pointerType!=="touch"){if(a){l=!0;return}f(k)}},v=k=>{if(!hP(k))return;l=!1;const g=t(s,k);typeof g=="function"&&(u=g,s.addEventListener("pointerleave",y,i))};s.addEventListener("pointerenter",v,i),s.addEventListener("pointerdown",p,i)}),o}const j0=(e,t)=>t?e===t?!0:j0(e,t.parentElement):!1,mh=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,mP=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function gP(e){return mP.has(e.tagName)||e.isContentEditable===!0}const yP=new Set(["INPUT","SELECT","TEXTAREA"]);function vP(e){return yP.has(e.tagName)||e.isContentEditable===!0}const sa=new WeakSet;function qm(e){return t=>{t.key==="Enter"&&e(t)}}function Cu(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const xP=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=qm(()=>{if(sa.has(n))return;Cu(n,"down");const i=qm(()=>{Cu(n,"up")}),o=()=>Cu(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",o,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function Gm(e){return mh(e)&&!N0()}const Ym=new WeakSet;function wP(e,t,n={}){const[r,i,o]=P0(e,n),s=a=>{const l=a.currentTarget;if(!Gm(a)||Ym.has(a))return;sa.add(l),n.stopPropagation&&Ym.add(a);const u=t(l,a),c=(p,y)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),sa.has(l)&&sa.delete(l),Gm(p)&&typeof u=="function"&&u(p,{success:y})},f=p=>{c(p,l===window||l===document||n.useGlobalTarget||j0(l,p.target))},h=p=>{c(p,!1)};window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",h,i)};return r.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",s,i),oa(a)&&(a.addEventListener("focus",u=>xP(u,i)),!gP(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),o}function gh(e){return Iw(e)&&"ownerSVGElement"in e}const aa=new WeakMap;let Rn;const R0=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+"Size"]:gh(r)&&"getBBox"in r?r.getBBox()[t]:r[n],kP=R0("inline","width","offsetWidth"),SP=R0("block","height","offsetHeight");function bP({target:e,borderBoxSize:t}){var n;(n=aa.get(e))==null||n.forEach(r=>{r(e,{get width(){return kP(e,t)},get height(){return SP(e,t)}})})}function CP(e){e.forEach(bP)}function EP(){typeof ResizeObserver>"u"||(Rn=new ResizeObserver(CP))}function TP(e,t){Rn||EP();const n=E0(e);return n.forEach(r=>{let i=aa.get(r);i||(i=new Set,aa.set(r,i)),i.add(t),Rn==null||Rn.observe(r)}),()=>{n.forEach(r=>{const i=aa.get(r);i==null||i.delete(t),i!=null&&i.size||Rn==null||Rn.unobserve(r)})}}const la=new Set;let ni;function NP(){ni=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};la.forEach(t=>t(e))},window.addEventListener("resize",ni)}function PP(e){return la.add(e),ni||NP(),()=>{la.delete(e),!la.size&&typeof ni=="function"&&(window.removeEventListener("resize",ni),ni=void 0)}}function Xm(e,t){return typeof e=="function"?PP(e):TP(e,t)}function jP(e){return gh(e)&&e.tagName==="svg"}const RP=[...S0,Ne,zt],AP=e=>RP.find(k0(e)),Qm=()=>({translate:0,scale:1,origin:0,originPoint:0}),ri=()=>({x:Qm(),y:Qm()}),Zm=()=>({min:0,max:0}),je=()=>({x:Zm(),y:Zm()}),IP=new WeakMap;function Rl(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function $o(e){return typeof e=="string"||Array.isArray(e)}const yh=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],vh=["initial",...yh];function Al(e){return Rl(e.animate)||vh.some(t=>$o(e[t]))}function A0(e){return!!(Al(e)||e.variants)}function DP(e,t,n){for(const r in t){const i=t[r],o=n[r];if(Fe(i))e.addValue(r,i);else if(Fe(o))e.addValue(r,ki(i,{owner:e}));else if(o!==i)if(e.hasValue(r)){const s=e.getValue(r);s.liveStyle===!0?s.jump(i):s.hasAnimated||s.set(i)}else{const s=e.getStaticValue(r);e.addValue(r,ki(s!==void 0?s:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const Ef={current:null},I0={current:!1},_P=typeof window<"u";function LP(){if(I0.current=!0,!!_P)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Ef.current=e.matches;e.addEventListener("change",t),t()}else Ef.current=!1}const Jm=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Ga={};function D0(e){Ga=e}function MP(){return Ga}class OP{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,skipAnimations:o,blockInitialAnimation:s,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=lh,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=Ye.now();this.renderScheduledAtthis.bindToMotionValue(o,i)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(I0.current||LP(),this.shouldReduceMotion=Ef.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var t;this.projection&&this.projection.unmount(),Xn(this.notifyUpdate),Xn(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&h0.has(t)&&this.current instanceof HTMLElement){const{factory:s,keyframes:a,times:l,ease:u,duration:c}=n.accelerate,f=new f0({element:this.current,name:t,keyframes:a,times:l,ease:u,duration:ht(c)}),h=s(f);this.valueSubscriptions.set(t,()=>{h(),f.cancel()});return}const r=Ri.has(t);r&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",s=>{this.latestValues[t]=s,this.props.onUpdate&&se.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;typeof window<"u"&&window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Ga){const n=Ga[t];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[t]&&i&&r(this.props)&&(this.features[t]=new i(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):je()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=ki(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(Aw(r)||Dw(r))?r=parseFloat(r):!AP(r)&&zt.test(n)&&(r=C0(t,n)),this.setBaseTarget(t,Fe(r)?r.get():r)),Fe(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var o;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const s=fh(this.props,n,(o=this.presenceContext)==null?void 0:o.custom);s&&(r=s[t])}if(n&&r!==void 0)return r;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!Fe(i)?i:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Jd),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){ph.render(this.render)}}class _0 extends OP{constructor(){super(...arguments),this.KeyframeResolver=fP}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const r=t.style;return r?r[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Fe(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class tr{constructor(t){this.isMounted=!1,this.node=t}update(){}}function L0({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function FP({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function VP(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Eu(e){return e===void 0||e===1}function Tf({scale:e,scaleX:t,scaleY:n}){return!Eu(e)||!Eu(t)||!Eu(n)}function lr(e){return Tf(e)||M0(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function M0(e){return eg(e.x)||eg(e.y)}function eg(e){return e&&e!=="0%"}function Ya(e,t,n){const r=e-n,i=t*r;return n+i}function tg(e,t,n,r,i){return i!==void 0&&(e=Ya(e,i,r)),Ya(e,n,r)+t}function Nf(e,t=0,n=1,r,i){e.min=tg(e.min,t,n,r,i),e.max=tg(e.max,t,n,r,i)}function O0(e,{x:t,y:n}){Nf(e.x,t.translate,t.scale,t.originPoint),Nf(e.y,n.translate,n.scale,n.originPoint)}const ng=.999999999999,rg=1.0000000000001;function zP(e,t,n,r=!1){var a;const i=n.length;if(!i)return;t.x=t.y=1;let o,s;for(let l=0;lng&&(t.x=1),t.yng&&(t.y=1)}function Zt(e,t){e.min+=t,e.max+=t}function ig(e,t,n,r,i=.5){const o=he(e.min,e.max,i);Nf(e,t,n,o,r)}function og(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function ua(e,t,n){const r=n??e;ig(e.x,og(t.x,r.x),t.scaleX,t.scale,t.originX),ig(e.y,og(t.y,r.y),t.scaleY,t.scale,t.originY)}function F0(e,t){return L0(VP(e.getBoundingClientRect(),t))}function BP(e,t,n){const r=F0(e,n),{scroll:i}=t;return i&&(Zt(r.x,i.offset.x),Zt(r.y,i.offset.y)),r}const $P={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},UP=ji.length;function WP(e,t,n){let r="",i=!0;for(let o=0;o{if(!t.target)return e;if(typeof e=="string")if(U.test(e))e=parseFloat(e);else return e;const n=sg(e,t.target.x),r=sg(e,t.target.y);return`${n}% ${r}%`}},HP={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=zt.parse(e);if(i.length>5)return r;const o=zt.createTransformer(e),s=typeof i[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;i[0+s]/=a,i[1+s]/=l;const u=he(a,l,.5);return typeof i[2+s]=="number"&&(i[2+s]/=u),typeof i[3+s]=="number"&&(i[3+s]/=u),o(i)}},Pf={borderRadius:{...Ki,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ki,borderTopRightRadius:Ki,borderBottomLeftRadius:Ki,borderBottomRightRadius:Ki,boxShadow:HP};function z0(e,{layout:t,layoutId:n}){return Ri.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Pf[e]||e==="opacity")}function wh(e,t,n){var s;const r=e.style,i=t==null?void 0:t.style,o={};if(!r)return o;for(const a in r)(Fe(r[a])||i&&Fe(i[a])||z0(a,e)||((s=n==null?void 0:n.getValue(a))==null?void 0:s.liveStyle)!==void 0)&&(o[a]=r[a]);return o}function KP(e){return window.getComputedStyle(e)}class qP extends _0{constructor(){super(...arguments),this.type="html",this.renderInstance=V0}readValueFromInstance(t,n){var r;if(Ri.has(n))return(r=this.projection)!=null&&r.isProjecting?pf(n):hN(t,n);{const i=KP(t),o=(Gw(n)?i.getPropertyValue(n):i[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:n}){return F0(t,n)}build(t,n,r){xh(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return wh(t,n,r)}}const GP={offset:"stroke-dashoffset",array:"stroke-dasharray"},YP={offset:"strokeDashoffset",array:"strokeDasharray"};function XP(e,t,n=1,r=0,i=!0){e.pathLength=1;const o=i?GP:YP;e[o.offset]=`${-r}`,e[o.array]=`${t} ${n}`}const QP=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function B0(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:o=1,pathOffset:s=0,...a},l,u,c){if(xh(e,a,u),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:f,style:h}=e;f.transform&&(h.transform=f.transform,delete f.transform),(h.transform||f.transformOrigin)&&(h.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),h.transform&&(h.transformBox=(c==null?void 0:c.transformBox)??"fill-box",delete f.transformBox);for(const p of QP)f[p]!==void 0&&(h[p]=f[p],delete f[p]);t!==void 0&&(f.x=t),n!==void 0&&(f.y=n),r!==void 0&&(f.scale=r),i!==void 0&&XP(f,i,o,s,!1)}const $0=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),U0=e=>typeof e=="string"&&e.toLowerCase()==="svg";function ZP(e,t,n,r){V0(e,t,void 0,r);for(const i in t.attrs)e.setAttribute($0.has(i)?i:dh(i),t.attrs[i])}function W0(e,t,n){const r=wh(e,t,n);for(const i in e)if(Fe(e[i])||Fe(t[i])){const o=ji.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[o]=e[i]}return r}class JP extends _0{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=je}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Ri.has(n)){const r=b0(n);return r&&r.default||0}return n=$0.has(n)?n:dh(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return W0(t,n,r)}build(t,n,r){B0(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,i){ZP(t,n,r,i)}mount(t){this.isSVGTag=U0(t.tagName),super.mount(t)}}const ej=vh.length;function H0(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?H0(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:r})=>eP(e,n,r)))}function ij(e){let t=rj(e),n=ag(),r=!0,i=!1;const o=u=>(c,f)=>{var p;const h=vr(e,f,u==="exit"?(p=e.presenceContext)==null?void 0:p.custom:void 0);if(h){const{transition:y,transitionEnd:v,...k}=h;c={...c,...k,...v}}return c};function s(u){t=u(e)}function a(u){const{props:c}=e,f=H0(e.parent)||{},h=[],p=new Set;let y={},v=1/0;for(let g=0;gv&&T,E=!1;const I=Array.isArray(S)?S:[S];let R=I.reduce(o(x),{});C===!1&&(R={});const{prevResolvedValues:z={}}=w,F={...z,...R},B=L=>{A=!0,p.has(L)&&(E=!0,p.delete(L)),w.needsAnimating[L]=!0;const _=e.getValue(L);_&&(_.liveStyle=!1)};for(const L in F){const _=R[L],b=z[L];if(y.hasOwnProperty(L))continue;let W=!1;wf(_)&&wf(b)?W=!K0(_,b):W=_!==b,W?_!=null?B(L):p.add(L):_!==void 0&&p.has(L)?B(L):w.protectedKeys[L]=!0}w.prevProp=S,w.prevResolvedValues=R,w.isActive&&(y={...y,...R}),(r||i)&&e.blockInitialAnimation&&(A=!1);const K=j&&P;A&&(!K||E)&&h.push(...I.map(L=>{const _={type:x};if(typeof L=="string"&&(r||i)&&!K&&e.manuallyAnimateOnMount&&e.parent){const{parent:b}=e,W=vr(b,L);if(b.enteringChildren&&W){const{delayChildren:ee}=W.transition||{};_.delay=p0(b.enteringChildren,e,ee)}}return{animation:L,options:_}}))}if(p.size){const g={};if(typeof c.initial!="boolean"){const x=vr(e,Array.isArray(c.initial)?c.initial[0]:c.initial);x&&x.transition&&(g.transition=x.transition)}p.forEach(x=>{const w=e.getBaseTarget(x),S=e.getValue(x);S&&(S.liveStyle=!0),g[x]=w??null}),h.push({animation:g})}let k=!!h.length;return r&&(c.initial===!1||c.initial===c.animate)&&!e.manuallyAnimateOnMount&&(k=!1),r=!1,i=!1,k?t(h):Promise.resolve()}function l(u,c){var h;if(n[u].isActive===c)return Promise.resolve();(h=e.variantChildren)==null||h.forEach(p=>{var y;return(y=p.animationState)==null?void 0:y.setActive(u,c)}),n[u].isActive=c;const f=a(u);for(const p in n)n[p].protectedKeys={};return f}return{animateChanges:a,setActive:l,setAnimateFunction:s,getState:()=>n,reset:()=>{n=ag(),i=!0}}}function oj(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!K0(t,e):!1}function ir(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ag(){return{animate:ir(!0),whileInView:ir(),whileHover:ir(),whileTap:ir(),whileDrag:ir(),whileFocus:ir(),exit:ir()}}function jf(e,t){e.min=t.min,e.max=t.max}function Dt(e,t){jf(e.x,t.x),jf(e.y,t.y)}function lg(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const q0=1e-4,sj=1-q0,aj=1+q0,G0=.01,lj=0-G0,uj=0+G0;function Xe(e){return e.max-e.min}function cj(e,t,n){return Math.abs(e-t)<=n}function ug(e,t,n,r=.5){e.origin=r,e.originPoint=he(t.min,t.max,e.origin),e.scale=Xe(n)/Xe(t),e.translate=he(n.min,n.max,e.origin)-e.originPoint,(e.scale>=sj&&e.scale<=aj||isNaN(e.scale))&&(e.scale=1),(e.translate>=lj&&e.translate<=uj||isNaN(e.translate))&&(e.translate=0)}function go(e,t,n,r){ug(e.x,t.x,n.x,r?r.originX:void 0),ug(e.y,t.y,n.y,r?r.originY:void 0)}function cg(e,t,n,r=0){const i=r?he(n.min,n.max,r):n.min;e.min=i+t.min,e.max=e.min+Xe(t)}function fj(e,t,n,r){cg(e.x,t.x,n.x,r==null?void 0:r.x),cg(e.y,t.y,n.y,r==null?void 0:r.y)}function fg(e,t,n,r=0){const i=r?he(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+Xe(t)}function Xa(e,t,n,r){fg(e.x,t.x,n.x,r==null?void 0:r.x),fg(e.y,t.y,n.y,r==null?void 0:r.y)}function dg(e,t,n,r,i){return e-=t,e=Ya(e,1/n,r),i!==void 0&&(e=Ya(e,1/i,r)),e}function dj(e,t=0,n=1,r=.5,i,o=e,s=e){if(rn.test(t)&&(t=parseFloat(t),t=he(s.min,s.max,t/100)-s.min),typeof t!="number")return;let a=he(o.min,o.max,r);e===o&&(a-=t),e.min=dg(e.min,t,n,a,i),e.max=dg(e.max,t,n,a,i)}function hg(e,t,[n,r,i],o,s){dj(e,t[n],t[r],t[i],t.scale,o,s)}const hj=["x","scaleX","originX"],pj=["y","scaleY","originY"];function pg(e,t,n,r){hg(e.x,t,hj,n?n.x:void 0,r?r.x:void 0),hg(e.y,t,pj,n?n.y:void 0,r?r.y:void 0)}function mg(e){return e.translate===0&&e.scale===1}function Y0(e){return mg(e.x)&&mg(e.y)}function gg(e,t){return e.min===t.min&&e.max===t.max}function mj(e,t){return gg(e.x,t.x)&&gg(e.y,t.y)}function yg(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function X0(e,t){return yg(e.x,t.x)&&yg(e.y,t.y)}function vg(e){return Xe(e.x)/Xe(e.y)}function xg(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Yt(e){return[e("x"),e("y")]}function gj(e,t,n){let r="";const i=e.x.translate/t.x,o=e.y.translate/t.y,s=(n==null?void 0:n.z)||0;if((i||o||s)&&(r=`translate3d(${i}px, ${o}px, ${s}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:c,rotateX:f,rotateY:h,skewX:p,skewY:y}=n;u&&(r=`perspective(${u}px) ${r}`),c&&(r+=`rotate(${c}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),p&&(r+=`skewX(${p}deg) `),y&&(r+=`skewY(${y}deg) `)}const a=e.x.scale*t.x,l=e.y.scale*t.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const Q0=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],yj=Q0.length,wg=e=>typeof e=="string"?parseFloat(e):e,kg=e=>typeof e=="number"||U.test(e);function vj(e,t,n,r,i,o){i?(e.opacity=he(0,n.opacity??1,xj(r)),e.opacityExit=he(t.opacity??1,0,wj(r))):o&&(e.opacity=he(t.opacity??1,n.opacity??1,r));for(let s=0;srt?1:n(zo(e,t,r))}function kj(e,t,n){const r=Fe(e)?e:ki(e);return r.start(ch("",r,t,n)),r.animation}function Uo(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const Sj=(e,t)=>e.depth-t.depth;class bj{constructor(){this.children=[],this.isDirty=!1}add(t){Qd(this.children,t),this.isDirty=!0}remove(t){Ua(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Sj),this.isDirty=!1,this.children.forEach(t)}}function Cj(e,t){const n=Ye.now(),r=({timestamp:i})=>{const o=i-n;o>=t&&(Xn(r),e(o-t))};return se.setup(r,!0),()=>Xn(r)}function ca(e){return Fe(e)?e.get():e}class Ej{constructor(){this.members=[]}add(t){Qd(this.members,t);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===t||r===this.lead||r===this.prevLead)continue;const i=r.instance;(!i||i.isConnected===!1)&&!r.snapshot&&(Ua(this.members,r),r.unmount())}t.scheduleRender()}remove(t){if(Ua(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){var n;for(let r=this.members.indexOf(t)-1;r>=0;r--){const i=this.members[r];if(i.isPresent!==!1&&((n=i.instance)==null?void 0:n.isConnected)!==!1)return this.promote(i),!0}return!1}promote(t,n){var i;const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.updateSnapshot(),t.scheduleRender();const{layoutDependency:o}=r.options,{layoutDependency:s}=t.options;(o===void 0||o!==s)&&(t.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),(i=t.root)!=null&&i.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{var n,r,i,o,s;(r=(n=t.options).onExitComplete)==null||r.call(n),(s=(i=t.resumingFrom)==null?void 0:(o=i.options).onExitComplete)==null||s.call(o)})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){var t;(t=this.lead)!=null&&t.snapshot&&(this.lead.snapshot=void 0)}}const fa={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Tu=["","X","Y","Z"],Tj=1e3;let Nj=0;function Nu(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function J0(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=x0(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",se,!(i||o))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&J0(r)}function e1({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(s={},a=t==null?void 0:t()){this.id=Nj++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(Rj),this.nodes.forEach(Mj),this.nodes.forEach(Oj),this.nodes.forEach(Aj)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=s,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;se.read(()=>{f=window.innerWidth}),e(s,()=>{const p=window.innerWidth;p!==f&&(f=p,this.root.updateBlockedByResize=!0,c&&c(),c=Cj(h,250),fa.hasAnimatedSinceResize&&(fa.hasAnimatedSinceResize=!1,this.nodes.forEach(Eg)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&u&&(a||l)&&this.addEventListener("didUpdate",({delta:c,hasLayoutChanged:f,hasRelativeLayoutChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||u.getDefaultTransition()||$j,{onLayoutAnimationStart:v,onLayoutAnimationComplete:k}=u.getProps(),g=!this.targetLayout||!X0(this.targetLayout,p),x=!f&&h;if(this.options.layoutRoot||this.resumeFrom||x||f&&(g||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const w={...uh(y,"layout"),onPlay:v,onComplete:k};(u.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w),this.setAnimationOrigin(c,x)}else f||Eg(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const s=this.getStack();s&&s.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Xn(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Fj),this.animationId++)}getTransformTemplate(){const{visualElement:s}=this.options;return s&&s.getProps().transformTemplate}willUpdate(s=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&J0(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;c{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Xe(this.snapshot.measuredBox.x)&&!Xe(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const T=S/1e3;Tg(f.x,s.x,T),Tg(f.y,s.y,T),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Xa(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),zj(this.relativeTarget,this.relativeTargetOrigin,h,T),w&&mj(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=je()),Dt(w,this.relativeTarget)),v&&(this.animationValues=c,vj(c,u,this.latestValues,T,x,g)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=T},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(s){var a,l,u;this.notifyListeners("animationStart"),(a=this.currentAnimation)==null||a.stop(),(u=(l=this.resumingFrom)==null?void 0:l.currentAnimation)==null||u.stop(),this.pendingAnimation&&(Xn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=se.update(()=>{fa.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=ki(0)),this.motionValue.jump(0,!1),this.currentAnimation=kj(this.motionValue,[0,1e3],{...s,velocity:0,isSync:!0,onUpdate:c=>{this.mixTargetDelta(c),s.onUpdate&&s.onUpdate(c)},onStop:()=>{},onComplete:()=>{s.onComplete&&s.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const s=this.getStack();s&&s.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Tj),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const s=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:c}=s;if(!(!a||!l||!u)){if(this!==s&&this.layout&&u&&t1(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||je();const f=Xe(this.layout.layoutBox.x);l.x.min=s.target.x.min,l.x.max=l.x.min+f;const h=Xe(this.layout.layoutBox.y);l.y.min=s.target.y.min,l.y.max=l.y.min+h}Dt(a,l),ua(a,c),go(this.projectionDeltaWithTransform,this.layoutCorrected,a,c)}}registerSharedNode(s,a){this.sharedNodes.has(s)||this.sharedNodes.set(s,new Ej),this.sharedNodes.get(s).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const s=this.getStack();return s?s.lead===this:!0}getLead(){var a;const{layoutId:s}=this.options;return s?((a=this.getStack())==null?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:s}=this.options;return s?(a=this.getStack())==null?void 0:a.prevLead:void 0}getStack(){const{layoutId:s}=this.options;if(s)return this.root.sharedNodes.get(s)}promote({needsReset:s,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),s&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const s=this.getStack();return s?s.relegate(this):!1}resetSkewAndRotation(){const{visualElement:s}=this.options;if(!s)return;let a=!1;const{latestValues:l}=s;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const u={};l.z&&Nu("z",s,u,this.animationValues);for(let c=0;c{var a;return(a=s.currentAnimation)==null?void 0:a.stop()}),this.root.nodes.forEach(bg),this.root.sharedNodes.clear()}}}function Pj(e){e.updateLayout()}function jj(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:o}=e.options,s=t.source!==e.layout.source;if(o==="size")Yt(f=>{const h=s?t.measuredBox[f]:t.layoutBox[f],p=Xe(h);h.min=r[f].min,h.max=h.min+p});else if(o==="x"||o==="y"){const f=o==="x"?"y":"x";jf(s?t.measuredBox[f]:t.layoutBox[f],r[f])}else t1(o,t.layoutBox,r)&&Yt(f=>{const h=s?t.measuredBox[f]:t.layoutBox[f],p=Xe(r[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const a=ri();go(a,r,t.layoutBox);const l=ri();s?go(l,e.applyTransform(i,!0),t.measuredBox):go(l,r,t.layoutBox);const u=!Y0(a);let c=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const y=e.options.layoutAnchor||void 0,v=je();Xa(v,t.layoutBox,h.layoutBox,y);const k=je();Xa(k,r,p.layoutBox,y),X0(v,k)||(c=!0),f.options.layoutRoot&&(e.relativeTarget=k,e.relativeTargetOrigin=v,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function Rj(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function Aj(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Ij(e){e.clearSnapshot()}function bg(e){e.clearMeasurements()}function Dj(e){e.isLayoutDirty=!0,e.updateLayout()}function Cg(e){e.isLayoutDirty=!1}function _j(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function Lj(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Eg(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Mj(e){e.resolveTargetDelta()}function Oj(e){e.calcProjection()}function Fj(e){e.resetSkewAndRotation()}function Vj(e){e.removeLeadSnapshot()}function Tg(e,t,n){e.translate=he(t.translate,0,n),e.scale=he(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Ng(e,t,n,r){e.min=he(t.min,n.min,r),e.max=he(t.max,n.max,r)}function zj(e,t,n,r){Ng(e.x,t.x,n.x,r),Ng(e.y,t.y,n.y,r)}function Bj(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const $j={duration:.45,ease:[.4,0,.1,1]},Pg=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),jg=Pg("applewebkit/")&&!Pg("chrome/")?Math.round:Tt;function Rg(e){e.min=jg(e.min),e.max=jg(e.max)}function Uj(e){Rg(e.x),Rg(e.y)}function t1(e,t,n){return e==="position"||e==="preserve-aspect"&&!cj(vg(t),vg(n),.2)}function Wj(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const Hj=e1({attachResizeListener:(e,t)=>Uo(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||((e=document.body)==null?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||((t=document.body)==null?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),Pu={current:void 0},n1=e1({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Pu.current){const e=new Hj({});e.mount(window),e.setOptions({layoutScroll:!0}),Pu.current=e}return Pu.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),kh=m.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function Ag(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Kj(...e){return t=>{let n=!1;const r=e.map(i=>{const o=Ag(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i{const{width:p,height:y,top:v,left:k,right:g,bottom:x}=l.current;if(t||o===!1||!a.current||!p||!y)return;const w=n==="left"?`left: ${k}`:`right: ${g}`,S=r==="bottom"?`bottom: ${x}`:`top: ${v}`;a.current.dataset.motionPopId=s;const T=document.createElement("style");u&&(T.nonce=u);const C=i??document.head;return C.appendChild(T),T.sheet&&T.sheet.insertRule(` - [data-motion-pop-id="${s}"] { - position: absolute !important; - width: ${p}px !important; - height: ${y}px !important; - ${w}px !important; - ${S}px !important; - } - `),()=>{var j;(j=a.current)==null||j.removeAttribute("data-motion-pop-id"),C.contains(T)&&C.removeChild(T)}},[t]),d.jsx(Gj,{isPresent:t,childRef:a,sizeRef:l,pop:o,children:o===!1?e:m.cloneElement(e,{ref:f})})}const Xj=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:o,mode:s,anchorX:a,anchorY:l,root:u})=>{const c=Xd(Qj),f=m.useId();let h=!0,p=m.useMemo(()=>(h=!1,{id:f,initial:t,isPresent:n,custom:i,onExitComplete:y=>{c.set(y,!0);for(const v of c.values())if(!v)return;r&&r()},register:y=>(c.set(y,!1),()=>c.delete(y))}),[n,c,r]);return o&&h&&(p={...p}),m.useMemo(()=>{c.forEach((y,v)=>c.set(v,!1))},[n]),m.useEffect(()=>{!n&&!c.size&&r&&r()},[n]),e=d.jsx(Yj,{pop:s==="popLayout",isPresent:n,anchorX:a,anchorY:l,root:u,children:e}),d.jsx(Pl.Provider,{value:p,children:e})};function Qj(){return new Map}function r1(e=!0){const t=m.useContext(Pl);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,o=m.useId();m.useEffect(()=>{if(e)return i(o)},[e]);const s=m.useCallback(()=>e&&r&&r(o),[o,r,e]);return!n&&r?[!1,s]:[!0]}const Is=e=>e.key||"";function Ig(e){const t=[];return m.Children.forEach(e,n=>{m.isValidElement(n)&&t.push(n)}),t}const Wo=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:o="sync",propagate:s=!1,anchorX:a="left",anchorY:l="top",root:u})=>{const[c,f]=r1(s),h=m.useMemo(()=>Ig(e),[e]),p=s&&!c?[]:h.map(Is),y=m.useRef(!0),v=m.useRef(h),k=Xd(()=>new Map),g=m.useRef(new Set),[x,w]=m.useState(h),[S,T]=m.useState(h);Rw(()=>{y.current=!1,v.current=h;for(let P=0;P{const A=Is(P),E=s&&!c?!1:h===S||p.includes(A),I=()=>{if(g.current.has(A))return;if(k.has(A))g.current.add(A),k.set(A,!0);else return;let R=!0;k.forEach(z=>{z||(R=!1)}),R&&(j==null||j(),T(v.current),s&&(f==null||f()),r&&r())};return d.jsx(Xj,{isPresent:E,initial:!y.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:o,root:u,onExitComplete:E?void 0:I,anchorX:a,anchorY:l,children:P},A)})})},i1=m.createContext({strict:!1}),Dg={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let _g=!1;function Zj(){if(_g)return;const e={};for(const t in Dg)e[t]={isEnabled:n=>Dg[t].some(r=>!!n[r])};D0(e),_g=!0}function o1(){return Zj(),MP()}function Jj(e){const t=o1();for(const n in e)t[n]={...t[n],...e[n]};D0(t)}const eR=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Qa(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||eR.has(e)}let s1=e=>!Qa(e);function tR(e){typeof e=="function"&&(s1=t=>t.startsWith("on")?!Qa(t):e(t))}try{tR(require("@emotion/is-prop-valid").default)}catch{}function nR(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||Fe(e[i])||(s1(i)||n===!0&&Qa(i)||!t&&!Qa(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}const Il=m.createContext({});function rR(e,t){if(Al(e)){const{initial:n,animate:r}=e;return{initial:n===!1||$o(n)?n:void 0,animate:$o(r)?r:void 0}}return e.inherit!==!1?t:{}}function iR(e){const{initial:t,animate:n}=rR(e,m.useContext(Il));return m.useMemo(()=>({initial:t,animate:n}),[Lg(t),Lg(n)])}function Lg(e){return Array.isArray(e)?e.join(" "):e}const Sh=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function a1(e,t,n){for(const r in t)!Fe(t[r])&&!z0(r,n)&&(e[r]=t[r])}function oR({transformTemplate:e},t){return m.useMemo(()=>{const n=Sh();return xh(n,t,e),Object.assign({},n.vars,n.style)},[t])}function sR(e,t){const n=e.style||{},r={};return a1(r,n,e),Object.assign(r,oR(e,t)),r}function aR(e,t){const n={},r=sR(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const l1=()=>({...Sh(),attrs:{}});function lR(e,t,n,r){const i=m.useMemo(()=>{const o=l1();return B0(o,t,U0(r),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};a1(o,e.style,e),i.style={...o,...i.style}}return i}const uR=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function bh(e){return typeof e!="string"||e.includes("-")?!1:!!(uR.indexOf(e)>-1||/[A-Z]/u.test(e))}function cR(e,t,n,{latestValues:r},i,o=!1,s){const l=(s??bh(e)?lR:aR)(t,r,i,e),u=nR(t,typeof e=="string",o),c=e!==m.Fragment?{...u,...l,ref:n}:{},{children:f}=t,h=m.useMemo(()=>Fe(f)?f.get():f,[f]);return m.createElement(e,{...c,children:h})}function fR({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:dR(n,r,i,e),renderState:t()}}function dR(e,t,n,r){const i={},o=r(e,{});for(const h in o)i[h]=ca(o[h]);let{initial:s,animate:a}=e;const l=Al(e),u=A0(e);t&&u&&!l&&e.inherit!==!1&&(s===void 0&&(s=t.initial),a===void 0&&(a=t.animate));let c=n?n.initial===!1:!1;c=c||s===!1;const f=c?a:s;if(f&&typeof f!="boolean"&&!Rl(f)){const h=Array.isArray(f)?f:[f];for(let p=0;p(t,n)=>{const r=m.useContext(Il),i=m.useContext(Pl),o=()=>fR(e,t,r,i);return n?o():Xd(o)},hR=u1({scrapeMotionValuesFromProps:wh,createRenderState:Sh}),pR=u1({scrapeMotionValuesFromProps:W0,createRenderState:l1}),mR=Symbol.for("motionComponentSymbol");function gR(e,t,n){const r=m.useRef(n);m.useInsertionEffect(()=>{r.current=n});const i=m.useRef(null);return m.useCallback(o=>{var a;o&&((a=e.onMount)==null||a.call(e,o));const s=r.current;if(typeof s=="function")if(o){const l=s(o);typeof l=="function"&&(i.current=l)}else i.current?(i.current(),i.current=null):s(o);else s&&(s.current=o);t&&(o?t.mount(o):t.unmount())},[t])}const c1=m.createContext({});function Br(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function yR(e,t,n,r,i,o){var w,S;const{visualElement:s}=m.useContext(Il),a=m.useContext(i1),l=m.useContext(Pl),u=m.useContext(kh),c=u.reducedMotion,f=u.skipAnimations,h=m.useRef(null),p=m.useRef(!1);r=r||a.renderer,!h.current&&r&&(h.current=r(e,{visualState:t,parent:s,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:c,skipAnimations:f,isSVG:o}),p.current&&h.current&&(h.current.manuallyAnimateOnMount=!0));const y=h.current,v=m.useContext(c1);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&vR(h.current,n,i,v);const k=m.useRef(!1);m.useInsertionEffect(()=>{y&&k.current&&y.update(n,l)});const g=n[v0],x=m.useRef(!!g&&typeof window<"u"&&!((w=window.MotionHandoffIsComplete)!=null&&w.call(window,g))&&((S=window.MotionHasOptimisedAnimation)==null?void 0:S.call(window,g)));return Rw(()=>{p.current=!0,y&&(k.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),y.scheduleRenderMicrotask(),x.current&&y.animationState&&y.animationState.animateChanges())}),m.useEffect(()=>{y&&(!x.current&&y.animationState&&y.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{var T;(T=window.MotionHandoffMarkAsComplete)==null||T.call(window,g)}),x.current=!1),y.enteringChildren=void 0)}),y}function vR(e,t,n,r){const{layoutId:i,layout:o,drag:s,dragConstraints:a,layoutScroll:l,layoutRoot:u,layoutAnchor:c,layoutCrossfade:f}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:f1(e.parent)),e.projection.setOptions({layoutId:i,layout:o,alwaysMeasureLayout:!!s||a&&Br(a),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:r,crossfade:f,layoutScroll:l,layoutRoot:u,layoutAnchor:c})}function f1(e){if(e)return e.options.allowProjection!==!1?e.projection:f1(e.parent)}function ju(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&Jj(r);const o=n?n==="svg":bh(e),s=o?pR:hR;function a(u,c){let f;const h={...m.useContext(kh),...u,layoutId:xR(u)},{isStatic:p}=h,y=iR(u),v=s(u,p);if(!p&&typeof window<"u"){wR();const k=kR(h);f=k.MeasureLayout,y.visualElement=yR(e,v,h,i,k.ProjectionNode,o)}return d.jsxs(Il.Provider,{value:y,children:[f&&y.visualElement?d.jsx(f,{visualElement:y.visualElement,...h}):null,cR(e,u,gR(v,y.visualElement,c),v,p,t,o)]})}a.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const l=m.forwardRef(a);return l[mR]=e,l}function xR({layoutId:e}){const t=m.useContext(Yd).id;return t&&e!==void 0?t+"-"+e:e}function wR(e,t){m.useContext(i1).strict}function kR(e){const t=o1(),{drag:n,layout:r}=t;if(!n&&!r)return{};const i={...n,...r};return{MeasureLayout:n!=null&&n.isEnabled(e)||r!=null&&r.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function SR(e,t){if(typeof Proxy>"u")return ju;const n=new Map,r=(o,s)=>ju(o,s,e,t),i=(o,s)=>r(o,s);return new Proxy(i,{get:(o,s)=>s==="create"?r:(n.has(s)||n.set(s,ju(s,void 0,e,t)),n.get(s))})}const bR=(e,t)=>t.isSVG??bh(e)?new JP(t):new qP(t,{allowProjection:e!==m.Fragment});class CR extends tr{constructor(t){super(t),t.animationState||(t.animationState=ij(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Rl(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let ER=0;class TR extends tr{constructor(){super(...arguments),this.id=ER++,this.isExitComplete=!1}update(){var o;if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;if(t&&r===!1){if(this.isExitComplete){const{initial:s,custom:a}=this.node.getProps();if(typeof s=="string"){const l=vr(this.node,s,a);if(l){const{transition:u,transitionEnd:c,...f}=l;for(const h in f)(o=this.node.getValue(h))==null||o.jump(f[h])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const NR={animation:{Feature:CR},exit:{Feature:TR}};function ns(e){return{point:{x:e.pageX,y:e.pageY}}}const PR=e=>t=>mh(t)&&e(t,ns(t));function yo(e,t,n,r){return Uo(e,t,PR(n),r)}const d1=({current:e})=>e?e.ownerDocument.defaultView:null,Mg=(e,t)=>Math.abs(e-t);function jR(e,t){const n=Mg(e.x,t.x),r=Mg(e.y,t.y);return Math.sqrt(n**2+r**2)}const Og=new Set(["auto","scroll"]);class h1{constructor(t,n,{transformPagePoint:r,contextWindow:i=window,dragSnapToOrigin:o=!1,distanceThreshold:s=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=p=>{this.handleScroll(p.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Ds(this.lastRawMoveEventInfo,this.transformPagePoint));const p=Ru(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,v=jR(p.offset,{x:0,y:0})>=this.distanceThreshold;if(!y&&!v)return;const{point:k}=p,{timestamp:g}=Oe;this.history.push({...k,timestamp:g});const{onStart:x,onMove:w}=this.handlers;y||(x&&x(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,p)},this.handlePointerMove=(p,y)=>{this.lastMoveEvent=p,this.lastRawMoveEventInfo=y,this.lastMoveEventInfo=Ds(y,this.transformPagePoint),se.update(this.updatePoint,!0)},this.handlePointerUp=(p,y)=>{this.end();const{onEnd:v,onSessionEnd:k,resumeAnimation:g}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&g&&g(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=Ru(p.type==="pointercancel"?this.lastMoveEventInfo:Ds(y,this.transformPagePoint),this.history);this.startEvent&&v&&v(p,x),k&&k(p,x)},!mh(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=s,this.contextWindow=i||window;const l=ns(t),u=Ds(l,this.transformPagePoint),{point:c}=u,{timestamp:f}=Oe;this.history=[{...c,timestamp:f}];const{onSessionStart:h}=n;h&&h(t,Ru(u,this.history)),this.removeListeners=Jo(yo(this.contextWindow,"pointermove",this.handlePointerMove),yo(this.contextWindow,"pointerup",this.handlePointerUp),yo(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(Og.has(r.overflowX)||Og.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const r=t===window,i=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},o={x:i.x-n.x,y:i.y-n.y};o.x===0&&o.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=o.x,this.lastMoveEventInfo.point.y+=o.y):this.history.length>0&&(this.history[0].x-=o.x,this.history[0].y-=o.y),this.scrollPositions.set(t,i),se.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Xn(this.updatePoint)}}function Ds(e,t){return t?{point:t(e.point)}:e}function Fg(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ru({point:e},t){return{point:e,delta:Fg(e,p1(t)),offset:Fg(e,RR(t)),velocity:AR(t,.1)}}function RR(e){return e[0]}function p1(e){return e[e.length-1]}function AR(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=p1(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>ht(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>ht(t)*2&&(r=e[1]);const o=bt(i.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const s={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function IR(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?he(n,e,r.max):Math.min(e,n)),e}function Vg(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function DR(e,{top:t,left:n,bottom:r,right:i}){return{x:Vg(e.x,n,i),y:Vg(e.y,t,r)}}function zg(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=zo(t.min,t.max-r,e.min):r>i&&(n=zo(e.min,e.max-i,t.min)),on(0,1,n)}function MR(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Rf=.35;function OR(e=Rf){return e===!1?e=0:e===!0&&(e=Rf),{x:Bg(e,"left","right"),y:Bg(e,"top","bottom")}}function Bg(e,t,n){return{min:$g(e,t),max:$g(e,n)}}function $g(e,t){return typeof e=="number"?e:e[t]||0}const FR=new WeakMap;class VR{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=je(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const o=f=>{n&&this.snapToCursor(ns(f).point),this.stopAnimation()},s=(f,h)=>{const{drag:p,dragPropagation:y,onDragStart:v}=this.getProps();if(p&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=dP(p),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=h,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Yt(g=>{let x=this.getAxisMotionValue(g).get()||0;if(rn.test(x)){const{projection:w}=this.visualElement;if(w&&w.layout){const S=w.layout.layoutBox[g];S&&(x=Xe(S)*(parseFloat(x)/100))}}this.originPoint[g]=x}),v&&se.update(()=>v(f,h),!1,!0),kf(this.visualElement,"transform");const{animationState:k}=this.visualElement;k&&k.setActive("whileDrag",!0)},a=(f,h)=>{this.latestPointerEvent=f,this.latestPanInfo=h;const{dragPropagation:p,dragDirectionLock:y,onDirectionLock:v,onDrag:k}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:g}=h;if(y&&this.currentDirection===null){this.currentDirection=BR(g),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",h.point,g),this.updateAxis("y",h.point,g),this.visualElement.render(),k&&se.update(()=>k(f,h),!1,!0)},l=(f,h)=>{this.latestPointerEvent=f,this.latestPanInfo=h,this.stop(f,h),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>{const{dragSnapToOrigin:f}=this.getProps();(f||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:c}=this.getProps();this.panSession=new h1(t,{onSessionStart:o,onStart:s,onMove:a,onSessionEnd:l,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,distanceThreshold:r,contextWindow:d1(this.visualElement),element:this.visualElement.current})}stop(t,n){const r=t||this.latestPointerEvent,i=n||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!i||!r)return;const{velocity:s}=i;this.startAnimation(s);const{onDragEnd:a}=this.getProps();a&&se.postRender(()=>a(r,i))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!_s(t,i,this.currentDirection))return;const o=this.getAxisMotionValue(t);let s=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(s=IR(s,this.constraints[t],this.elastic[t])),o.set(s)}resolveConstraints(){var o;const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(o=this.visualElement.projection)==null?void 0:o.layout,i=this.constraints;t&&Br(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=DR(r.layoutBox,t):this.constraints=!1,this.elastic=OR(n),i!==this.constraints&&!Br(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&Yt(s=>{this.constraints!==!1&&this.getAxisMotionValue(s)&&(this.constraints[s]=MR(r.layoutBox[s],this.constraints[s]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Br(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=BP(r,i.root,this.visualElement.getTransformPagePoint());let s=_R(i.layout.layoutBox,o);if(n){const a=n(FP(s));this.hasMutatedConstraints=!!a,a&&(s=L0(a))}return s}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:o,dragSnapToOrigin:s,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=Yt(c=>{if(!_s(c,n,this.currentDirection))return;let f=l&&l[c]||{};(s===!0||s===c)&&(f={min:0,max:0});const h=i?200:1e6,p=i?40:1e7,y={type:"inertia",velocity:r?t[c]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...o,...f};return this.startAxisValueAnimation(c,y)});return Promise.all(u).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return kf(this.visualElement,t),r.start(ch(t,r,0,n,this.visualElement,!1))}stopAnimation(){Yt(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Yt(n=>{const{drag:r}=this.getProps();if(!_s(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:s,max:a}=i.layout.layoutBox[n],l=o.get()||0;o.set(t[n]-he(s,a,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Br(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Yt(s=>{const a=this.getAxisMotionValue(s);if(a&&this.constraints!==!1){const l=a.get();i[s]=LR({min:l,max:l},this.constraints[s])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),Yt(s=>{if(!_s(s,t,null))return;const a=this.getAxisMotionValue(s),{min:l,max:u}=this.constraints[s];a.set(he(l,u,i[s]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;FR.set(this.visualElement,this);const t=this.visualElement.current,n=yo(t,"pointerdown",u=>{const{drag:c,dragListener:f=!0}=this.getProps(),h=u.target,p=h!==t&&vP(h);c&&f&&!p&&this.start(u)});let r;const i=()=>{const{dragConstraints:u}=this.getProps();Br(u)&&u.current&&(this.constraints=this.resolveRefConstraints(),r||(r=zR(t,u.current,()=>this.scalePositionWithinConstraints())))},{projection:o}=this.visualElement,s=o.addEventListener("measure",i);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),se.read(i);const a=Uo(window,"resize",()=>this.scalePositionWithinConstraints()),l=o.addEventListener("didUpdate",({delta:u,hasLayoutChanged:c})=>{this.isDragging&&c&&(Yt(f=>{const h=this.getAxisMotionValue(f);h&&(this.originPoint[f]+=u[f].translate,h.set(h.get()+u[f].translate))}),this.visualElement.render())});return()=>{a(),n(),s(),l&&l(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:s=Rf,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:o,dragElastic:s,dragMomentum:a}}}function Ug(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function zR(e,t,n){const r=Xm(e,Ug(n)),i=Xm(t,Ug(n));return()=>{r(),i()}}function _s(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function BR(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class $R extends tr{constructor(t){super(t),this.removeGroupControls=Tt,this.removeListeners=Tt,this.controls=new VR(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Tt}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Au=e=>(t,n)=>{e&&se.update(()=>e(t,n),!1,!0)};class UR extends tr{constructor(){super(...arguments),this.removePointerDownListener=Tt}onPointerDown(t){this.session=new h1(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:d1(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:Au(t),onStart:Au(n),onMove:Au(r),onEnd:(o,s)=>{delete this.session,i&&se.postRender(()=>i(o,s))}}}mount(){this.removePointerDownListener=yo(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Iu=!1;class WR extends m.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:o}=t;o&&(n.group&&n.group.add(o),r&&r.register&&i&&r.register(o),Iu&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),fa.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:o}=this.props,{projection:s}=r;return s&&(s.isPresent=o,t.layoutDependency!==n&&s.setOptions({...s.options,layoutDependency:n}),Iu=!0,i||t.layoutDependency!==n||n===void 0||t.isPresent!==o?s.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?s.promote():s.relegate()||se.postRender(()=>{const a=s.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:n}=this.props,{projection:r}=t;r&&(r.options.layoutAnchor=n,r.root.didUpdate(),ph.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;Iu=!0,i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function m1(e){const[t,n]=r1(),r=m.useContext(Yd);return d.jsx(WR,{...e,layoutGroup:r,switchLayoutGroup:m.useContext(c1),isPresent:t,safeToRemove:n})}const HR={pan:{Feature:UR},drag:{Feature:$R,ProjectionNode:n1,MeasureLayout:m1}};function Wg(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,o=r[i];o&&se.postRender(()=>o(t,ns(t)))}class KR extends tr{mount(){const{current:t}=this.node;t&&(this.unmount=pP(t,(n,r)=>(Wg(this.node,r,"Start"),i=>Wg(this.node,i,"End"))))}unmount(){}}class qR extends tr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Jo(Uo(this.node.current,"focus",()=>this.onFocus()),Uo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Hg(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),o=r[i];o&&se.postRender(()=>o(t,ns(t)))}class GR extends tr{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=wP(t,(i,o)=>(Hg(this.node,o,"Start"),(s,{success:a})=>Hg(this.node,s,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const Af=new WeakMap,Du=new WeakMap,YR=e=>{const t=Af.get(e.target);t&&t(e)},XR=e=>{e.forEach(YR)};function QR({root:e,...t}){const n=e||document;Du.has(n)||Du.set(n,{});const r=Du.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(XR,{root:e,...t})),r[i]}function ZR(e,t,n){const r=QR(t);return Af.set(e,n),r.observe(e),()=>{Af.delete(e),r.unobserve(e)}}const JR={some:0,all:1};class eA extends tr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var l;(l=this.stopObserver)==null||l.call(this);const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:o}=t,s={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:JR[i]},a=u=>{const{isIntersecting:c}=u;if(this.isInView===c||(this.isInView=c,o&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:f,onViewportLeave:h}=this.node.getProps(),p=c?f:h;p&&p(u)};this.stopObserver=ZR(this.node.current,s,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(tA(t,n))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function tA({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const nA={inView:{Feature:eA},tap:{Feature:GR},focus:{Feature:qR},hover:{Feature:KR}},rA={layout:{ProjectionNode:n1,MeasureLayout:m1}},iA={...NR,...nA,...HR,...rA},Ae=SR(iA,bR),oA=1,sA=1e6;let _u=0;function aA(){return _u=(_u+1)%Number.MAX_SAFE_INTEGER,_u.toString()}const Lu=new Map,Kg=e=>{if(Lu.has(e))return;const t=setTimeout(()=>{Lu.delete(e),vo({type:"REMOVE_TOAST",toastId:e})},sA);Lu.set(e,t)},lA=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,oA)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?Kg(n):e.toasts.forEach(r=>{Kg(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},da=[];let ha={toasts:[]};function vo(e){ha=lA(ha,e),da.forEach(t=>{t(ha)})}function uA({...e}){const t=aA(),n=i=>vo({type:"UPDATE_TOAST",toast:{...i,id:t}}),r=()=>vo({type:"DISMISS_TOAST",toastId:t});return vo({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:i=>{i||r()}}}),{id:t,dismiss:r,update:n}}function rs(){const[e,t]=m.useState(ha);return m.useEffect(()=>(da.push(t),()=>{const n=da.indexOf(t);n>-1&&da.splice(n,1)}),[e]),{...e,toast:uA,dismiss:n=>vo({type:"DISMISS_TOAST",toastId:n})}}function _e(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function qg(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Sn(...e){return t=>{let n=!1;const r=e.map(i=>{const o=qg(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i{const{children:s,...a}=o,l=m.useMemo(()=>a,Object.values(a));return d.jsx(n.Provider,{value:l,children:s})};r.displayName=e+"Provider";function i(o){const s=m.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,i]}function Ch(e,t=[]){let n=[];function r(o,s){const a=m.createContext(s),l=n.length;n=[...n,s];const u=f=>{var g;const{scope:h,children:p,...y}=f,v=((g=h==null?void 0:h[e])==null?void 0:g[l])||a,k=m.useMemo(()=>y,Object.values(y));return d.jsx(v.Provider,{value:k,children:p})};u.displayName=o+"Provider";function c(f,h){var v;const p=((v=h==null?void 0:h[e])==null?void 0:v[l])||a,y=m.useContext(p);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[u,c]}const i=()=>{const o=n.map(s=>m.createContext(s));return function(a){const l=(a==null?void 0:a[e])||o;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,fA(i,...t)]}function fA(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...a,...f}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Gg(e){const t=dA(e),n=m.forwardRef((r,i)=>{const{children:o,...s}=r,a=m.Children.toArray(o),l=a.find(pA);if(l){const u=l.props.children,c=a.map(f=>f===l?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return d.jsx(t,{...s,ref:i,children:m.isValidElement(u)?m.cloneElement(u,void 0,c):null})}return d.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function dA(e){const t=m.forwardRef((n,r)=>{const{children:i,...o}=n;if(m.isValidElement(i)){const s=gA(i),a=mA(o,i.props);return i.type!==m.Fragment&&(a.ref=r?Sn(r,s):s),m.cloneElement(i,a)}return m.Children.count(i)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var hA=Symbol("radix.slottable");function pA(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hA}function mA(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function gA(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function yA(e){const t=e+"CollectionProvider",[n,r]=Ch(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=v=>{const{scope:k,children:g}=v,x=Qt.useRef(null),w=Qt.useRef(new Map).current;return d.jsx(i,{scope:k,itemMap:w,collectionRef:x,children:g})};s.displayName=t;const a=e+"CollectionSlot",l=Gg(a),u=Qt.forwardRef((v,k)=>{const{scope:g,children:x}=v,w=o(a,g),S=Ut(k,w.collectionRef);return d.jsx(l,{ref:S,children:x})});u.displayName=a;const c=e+"CollectionItemSlot",f="data-radix-collection-item",h=Gg(c),p=Qt.forwardRef((v,k)=>{const{scope:g,children:x,...w}=v,S=Qt.useRef(null),T=Ut(k,S),C=o(c,g);return Qt.useEffect(()=>(C.itemMap.set(S,{ref:S,...w}),()=>void C.itemMap.delete(S))),d.jsx(h,{[f]:"",ref:T,children:x})});p.displayName=c;function y(v){const k=o(e+"CollectionConsumer",v);return Qt.useCallback(()=>{const x=k.collectionRef.current;if(!x)return[];const w=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(k.itemMap.values()).sort((C,j)=>w.indexOf(C.ref.current)-w.indexOf(j.ref.current))},[k.collectionRef,k.itemMap])}return[{Provider:s,Slot:u,ItemSlot:p},y,r]}function vA(e){const t=xA(e),n=m.forwardRef((r,i)=>{const{children:o,...s}=r,a=m.Children.toArray(o),l=a.find(kA);if(l){const u=l.props.children,c=a.map(f=>f===l?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return d.jsx(t,{...s,ref:i,children:m.isValidElement(u)?m.cloneElement(u,void 0,c):null})}return d.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function xA(e){const t=m.forwardRef((n,r)=>{const{children:i,...o}=n;if(m.isValidElement(i)){const s=bA(i),a=SA(o,i.props);return i.type!==m.Fragment&&(a.ref=r?Sn(r,s):s),m.cloneElement(i,a)}return m.Children.count(i)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var wA=Symbol("radix.slottable");function kA(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===wA}function SA(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function bA(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var CA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],g1=CA.reduce((e,t)=>{const n=vA(`Primitive.${t}`),r=m.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function EA(e,t){e&&Ni.flushSync(()=>e.dispatchEvent(t))}function xn(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function TA(e,t=globalThis==null?void 0:globalThis.document){const n=xn(e);m.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var NA="DismissableLayer",If="dismissableLayer.update",PA="dismissableLayer.pointerDownOutside",jA="dismissableLayer.focusOutside",Yg,y1=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Eh=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,onDismiss:a,...l}=e,u=m.useContext(y1),[c,f]=m.useState(null),h=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=m.useState({}),y=Ut(t,j=>f(j)),v=Array.from(u.layers),[k]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),g=v.indexOf(k),x=c?v.indexOf(c):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=x>=g,T=AA(j=>{const P=j.target,A=[...u.branches].some(E=>E.contains(P));!S||A||(i==null||i(j),s==null||s(j),j.defaultPrevented||a==null||a())},h),C=IA(j=>{const P=j.target;[...u.branches].some(E=>E.contains(P))||(o==null||o(j),s==null||s(j),j.defaultPrevented||a==null||a())},h);return TA(j=>{x===u.layers.size-1&&(r==null||r(j),!j.defaultPrevented&&a&&(j.preventDefault(),a()))},h),m.useEffect(()=>{if(c)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Yg=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),Xg(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Yg)}},[c,h,n,u]),m.useEffect(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),Xg())},[c,u]),m.useEffect(()=>{const j=()=>p({});return document.addEventListener(If,j),()=>document.removeEventListener(If,j)},[]),d.jsx(g1.div,{...l,ref:y,style:{pointerEvents:w?S?"auto":"none":void 0,...e.style},onFocusCapture:_e(e.onFocusCapture,C.onFocusCapture),onBlurCapture:_e(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:_e(e.onPointerDownCapture,T.onPointerDownCapture)})});Eh.displayName=NA;var RA="DismissableLayerBranch",v1=m.forwardRef((e,t)=>{const n=m.useContext(y1),r=m.useRef(null),i=Ut(t,r);return m.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),d.jsx(g1.div,{...e,ref:i})});v1.displayName=RA;function AA(e,t=globalThis==null?void 0:globalThis.document){const n=xn(e),r=m.useRef(!1),i=m.useRef(()=>{});return m.useEffect(()=>{const o=a=>{if(a.target&&!r.current){let l=function(){x1(PA,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=l,t.addEventListener("click",i.current,{once:!0})):l()}else t.removeEventListener("click",i.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function IA(e,t=globalThis==null?void 0:globalThis.document){const n=xn(e),r=m.useRef(!1);return m.useEffect(()=>{const i=o=>{o.target&&!r.current&&x1(jA,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Xg(){const e=new CustomEvent(If);document.dispatchEvent(e)}function x1(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?EA(i,o):i.dispatchEvent(o)}var DA=Eh,_A=v1;function LA(e){const t=MA(e),n=m.forwardRef((r,i)=>{const{children:o,...s}=r,a=m.Children.toArray(o),l=a.find(FA);if(l){const u=l.props.children,c=a.map(f=>f===l?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return d.jsx(t,{...s,ref:i,children:m.isValidElement(u)?m.cloneElement(u,void 0,c):null})}return d.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function MA(e){const t=m.forwardRef((n,r)=>{const{children:i,...o}=n;if(m.isValidElement(i)){const s=zA(i),a=VA(o,i.props);return i.type!==m.Fragment&&(a.ref=r?Sn(r,s):s),m.cloneElement(i,a)}return m.Children.count(i)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var OA=Symbol("radix.slottable");function FA(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===OA}function VA(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function zA(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var BA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$A=BA.reduce((e,t)=>{const n=LA(`Primitive.${t}`),r=m.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Si=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},UA="Portal",Th=m.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[i,o]=m.useState(!1);Si(()=>o(!0),[]);const s=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?sT.createPortal(d.jsx($A.div,{...r,ref:t}),s):null});Th.displayName=UA;function WA(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var is=e=>{const{present:t,children:n}=e,r=HA(t),i=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),o=Ut(r.ref,KA(i));return typeof n=="function"||r.isPresent?m.cloneElement(i,{ref:o}):null};is.displayName="Presence";function HA(e){const[t,n]=m.useState(),r=m.useRef(null),i=m.useRef(e),o=m.useRef("none"),s=e?"mounted":"unmounted",[a,l]=WA(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const u=Ls(r.current);o.current=a==="mounted"?u:"none"},[a]),Si(()=>{const u=r.current,c=i.current;if(c!==e){const h=o.current,p=Ls(u);e?l("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(c&&h!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Si(()=>{if(t){let u;const c=t.ownerDocument.defaultView??window,f=p=>{const v=Ls(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&v&&(l("ANIMATION_END"),!i.current)){const k=t.style.animationFillMode;t.style.animationFillMode="forwards",u=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=k)})}},h=p=>{p.target===t&&(o.current=Ls(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{c.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:m.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function Ls(e){return(e==null?void 0:e.animationName)||"none"}function KA(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function qA(e){const t=GA(e),n=m.forwardRef((r,i)=>{const{children:o,...s}=r,a=m.Children.toArray(o),l=a.find(XA);if(l){const u=l.props.children,c=a.map(f=>f===l?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return d.jsx(t,{...s,ref:i,children:m.isValidElement(u)?m.cloneElement(u,void 0,c):null})}return d.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function GA(e){const t=m.forwardRef((n,r)=>{const{children:i,...o}=n;if(m.isValidElement(i)){const s=ZA(i),a=QA(o,i.props);return i.type!==m.Fragment&&(a.ref=r?Sn(r,s):s),m.cloneElement(i,a)}return m.Children.count(i)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var YA=Symbol("radix.slottable");function XA(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===YA}function QA(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function ZA(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var JA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ai=JA.reduce((e,t)=>{const n=qA(`Primitive.${t}`),r=m.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function e2(e,t){e&&Ni.flushSync(()=>e.dispatchEvent(t))}var t2=Nr[" useInsertionEffect ".trim().toString()]||Si;function w1({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,s]=n2({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:i;{const c=m.useRef(e!==void 0);m.useEffect(()=>{const f=c.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=a},[a,r])}const u=m.useCallback(c=>{var f;if(a){const h=r2(c)?c(e):c;h!==e&&((f=s.current)==null||f.call(s,h))}else o(c)},[a,e,o,s]);return[l,u]}function n2({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),i=m.useRef(n),o=m.useRef(t);return t2(()=>{o.current=t},[t]),m.useEffect(()=>{var s;i.current!==n&&((s=o.current)==null||s.call(o,n),i.current=n)},[n,i]),[n,r,o]}function r2(e){return typeof e=="function"}function i2(e){const t=o2(e),n=m.forwardRef((r,i)=>{const{children:o,...s}=r,a=m.Children.toArray(o),l=a.find(a2);if(l){const u=l.props.children,c=a.map(f=>f===l?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return d.jsx(t,{...s,ref:i,children:m.isValidElement(u)?m.cloneElement(u,void 0,c):null})}return d.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function o2(e){const t=m.forwardRef((n,r)=>{const{children:i,...o}=n;if(m.isValidElement(i)){const s=u2(i),a=l2(o,i.props);return i.type!==m.Fragment&&(a.ref=r?Sn(r,s):s),m.cloneElement(i,a)}return m.Children.count(i)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var s2=Symbol("radix.slottable");function a2(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===s2}function l2(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function u2(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var c2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],f2=c2.reduce((e,t)=>{const n=i2(`Primitive.${t}`),r=m.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),d2=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),h2="VisuallyHidden",Nh=m.forwardRef((e,t)=>d.jsx(f2.span,{...e,ref:t,style:{...d2,...e.style}}));Nh.displayName=h2;var Ph="ToastProvider",[jh,p2,m2]=yA("Toast"),[k1]=Ch("Toast",[m2]),[g2,Dl]=k1(Ph),S1=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:i="right",swipeThreshold:o=50,children:s}=e,[a,l]=m.useState(null),[u,c]=m.useState(0),f=m.useRef(!1),h=m.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Ph}\`. Expected non-empty \`string\`.`),d.jsx(jh.Provider,{scope:t,children:d.jsx(g2,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:o,toastCount:u,viewport:a,onViewportChange:l,onToastAdd:m.useCallback(()=>c(p=>p+1),[]),onToastRemove:m.useCallback(()=>c(p=>p-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:h,children:s})})};S1.displayName=Ph;var b1="ToastViewport",y2=["F8"],Df="toast.viewportPause",_f="toast.viewportResume",C1=m.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=y2,label:i="Notifications ({hotkey})",...o}=e,s=Dl(b1,n),a=p2(n),l=m.useRef(null),u=m.useRef(null),c=m.useRef(null),f=m.useRef(null),h=Ut(t,f,s.onViewportChange),p=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=s.toastCount>0;m.useEffect(()=>{const k=g=>{var w;r.length!==0&&r.every(S=>g[S]||g.code===S)&&((w=f.current)==null||w.focus())};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[r]),m.useEffect(()=>{const k=l.current,g=f.current;if(y&&k&&g){const x=()=>{if(!s.isClosePausedRef.current){const C=new CustomEvent(Df);g.dispatchEvent(C),s.isClosePausedRef.current=!0}},w=()=>{if(s.isClosePausedRef.current){const C=new CustomEvent(_f);g.dispatchEvent(C),s.isClosePausedRef.current=!1}},S=C=>{!k.contains(C.relatedTarget)&&w()},T=()=>{k.contains(document.activeElement)||w()};return k.addEventListener("focusin",x),k.addEventListener("focusout",S),k.addEventListener("pointermove",x),k.addEventListener("pointerleave",T),window.addEventListener("blur",x),window.addEventListener("focus",w),()=>{k.removeEventListener("focusin",x),k.removeEventListener("focusout",S),k.removeEventListener("pointermove",x),k.removeEventListener("pointerleave",T),window.removeEventListener("blur",x),window.removeEventListener("focus",w)}}},[y,s.isClosePausedRef]);const v=m.useCallback(({tabbingDirection:k})=>{const x=a().map(w=>{const S=w.ref.current,T=[S,...R2(S)];return k==="forwards"?T:T.reverse()});return(k==="forwards"?x.reverse():x).flat()},[a]);return m.useEffect(()=>{const k=f.current;if(k){const g=x=>{var T,C,j;const w=x.altKey||x.ctrlKey||x.metaKey;if(x.key==="Tab"&&!w){const P=document.activeElement,A=x.shiftKey;if(x.target===k&&A){(T=u.current)==null||T.focus();return}const R=v({tabbingDirection:A?"backwards":"forwards"}),z=R.findIndex(F=>F===P);Mu(R.slice(z+1))?x.preventDefault():A?(C=u.current)==null||C.focus():(j=c.current)==null||j.focus()}};return k.addEventListener("keydown",g),()=>k.removeEventListener("keydown",g)}},[a,v]),d.jsxs(_A,{ref:l,role:"region","aria-label":i.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&d.jsx(Lf,{ref:u,onFocusFromOutsideViewport:()=>{const k=v({tabbingDirection:"forwards"});Mu(k)}}),d.jsx(jh.Slot,{scope:n,children:d.jsx(Ai.ol,{tabIndex:-1,...o,ref:h})}),y&&d.jsx(Lf,{ref:c,onFocusFromOutsideViewport:()=>{const k=v({tabbingDirection:"backwards"});Mu(k)}})]})});C1.displayName=b1;var E1="ToastFocusProxy",Lf=m.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,o=Dl(E1,n);return d.jsx(Nh,{tabIndex:0,...i,ref:t,style:{position:"fixed"},onFocus:s=>{var u;const a=s.relatedTarget;!((u=o.viewport)!=null&&u.contains(a))&&r()}})});Lf.displayName=E1;var os="Toast",v2="toast.swipeStart",x2="toast.swipeMove",w2="toast.swipeCancel",k2="toast.swipeEnd",T1=m.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:i,onOpenChange:o,...s}=e,[a,l]=w1({prop:r,defaultProp:i??!0,onChange:o,caller:os});return d.jsx(is,{present:n||a,children:d.jsx(C2,{open:a,...s,ref:t,onClose:()=>l(!1),onPause:xn(e.onPause),onResume:xn(e.onResume),onSwipeStart:_e(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:_e(e.onSwipeMove,u=>{const{x:c,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${c}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:_e(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:_e(e.onSwipeEnd,u=>{const{x:c,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${c}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),l(!1)})})})});T1.displayName=os;var[S2,b2]=k1(os,{onClose(){}}),C2=m.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:i,open:o,onClose:s,onEscapeKeyDown:a,onPause:l,onResume:u,onSwipeStart:c,onSwipeMove:f,onSwipeCancel:h,onSwipeEnd:p,...y}=e,v=Dl(os,n),[k,g]=m.useState(null),x=Ut(t,F=>g(F)),w=m.useRef(null),S=m.useRef(null),T=i||v.duration,C=m.useRef(0),j=m.useRef(T),P=m.useRef(0),{onToastAdd:A,onToastRemove:E}=v,I=xn(()=>{var B;(k==null?void 0:k.contains(document.activeElement))&&((B=v.viewport)==null||B.focus()),s()}),R=m.useCallback(F=>{!F||F===1/0||(window.clearTimeout(P.current),C.current=new Date().getTime(),P.current=window.setTimeout(I,F))},[I]);m.useEffect(()=>{const F=v.viewport;if(F){const B=()=>{R(j.current),u==null||u()},K=()=>{const ne=new Date().getTime()-C.current;j.current=j.current-ne,window.clearTimeout(P.current),l==null||l()};return F.addEventListener(Df,K),F.addEventListener(_f,B),()=>{F.removeEventListener(Df,K),F.removeEventListener(_f,B)}}},[v.viewport,T,l,u,R]),m.useEffect(()=>{o&&!v.isClosePausedRef.current&&R(T)},[o,T,v.isClosePausedRef,R]),m.useEffect(()=>(A(),()=>E()),[A,E]);const z=m.useMemo(()=>k?D1(k):null,[k]);return v.viewport?d.jsxs(d.Fragment,{children:[z&&d.jsx(E2,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:z}),d.jsx(S2,{scope:n,onClose:I,children:Ni.createPortal(d.jsx(jh.ItemSlot,{scope:n,children:d.jsx(DA,{asChild:!0,onEscapeKeyDown:_e(a,()=>{v.isFocusedToastEscapeKeyDownRef.current||I(),v.isFocusedToastEscapeKeyDownRef.current=!1}),children:d.jsx(Ai.li,{tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":v.swipeDirection,...y,ref:x,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:_e(e.onKeyDown,F=>{F.key==="Escape"&&(a==null||a(F.nativeEvent),F.nativeEvent.defaultPrevented||(v.isFocusedToastEscapeKeyDownRef.current=!0,I()))}),onPointerDown:_e(e.onPointerDown,F=>{F.button===0&&(w.current={x:F.clientX,y:F.clientY})}),onPointerMove:_e(e.onPointerMove,F=>{if(!w.current)return;const B=F.clientX-w.current.x,K=F.clientY-w.current.y,ne=!!S.current,L=["left","right"].includes(v.swipeDirection),_=["left","up"].includes(v.swipeDirection)?Math.min:Math.max,b=L?_(0,B):0,W=L?0:_(0,K),ee=F.pointerType==="touch"?10:2,N={x:b,y:W},we={originalEvent:F,delta:N};ne?(S.current=N,Ms(x2,f,we,{discrete:!1})):Qg(N,v.swipeDirection,ee)?(S.current=N,Ms(v2,c,we,{discrete:!1}),F.target.setPointerCapture(F.pointerId)):(Math.abs(B)>ee||Math.abs(K)>ee)&&(w.current=null)}),onPointerUp:_e(e.onPointerUp,F=>{const B=S.current,K=F.target;if(K.hasPointerCapture(F.pointerId)&&K.releasePointerCapture(F.pointerId),S.current=null,w.current=null,B){const ne=F.currentTarget,L={originalEvent:F,delta:B};Qg(B,v.swipeDirection,v.swipeThreshold)?Ms(k2,p,L,{discrete:!0}):Ms(w2,h,L,{discrete:!0}),ne.addEventListener("click",_=>_.preventDefault(),{once:!0})}})})})}),v.viewport)})]}):null}),E2=e=>{const{__scopeToast:t,children:n,...r}=e,i=Dl(os,t),[o,s]=m.useState(!1),[a,l]=m.useState(!1);return P2(()=>s(!0)),m.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:d.jsx(Th,{asChild:!0,children:d.jsx(Nh,{...r,children:o&&d.jsxs(d.Fragment,{children:[i.label," ",n]})})})},T2="ToastTitle",N1=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return d.jsx(Ai.div,{...r,ref:t})});N1.displayName=T2;var N2="ToastDescription",P1=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return d.jsx(Ai.div,{...r,ref:t})});P1.displayName=N2;var j1="ToastAction",R1=m.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?d.jsx(I1,{altText:n,asChild:!0,children:d.jsx(Rh,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${j1}\`. Expected non-empty \`string\`.`),null)});R1.displayName=j1;var A1="ToastClose",Rh=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,i=b2(A1,n);return d.jsx(I1,{asChild:!0,children:d.jsx(Ai.button,{type:"button",...r,ref:t,onClick:_e(e.onClick,i.onClose)})})});Rh.displayName=A1;var I1=m.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...i}=e;return d.jsx(Ai.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function D1(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),j2(r)){const i=r.ariaHidden||r.hidden||r.style.display==="none",o=r.dataset.radixToastAnnounceExclude==="";if(!i)if(o){const s=r.dataset.radixToastAnnounceAlt;s&&t.push(s)}else t.push(...D1(r))}}),t}function Ms(e,t,n,{discrete:r}){const i=n.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?e2(i,o):i.dispatchEvent(o)}var Qg=(e,t,n=0)=>{const r=Math.abs(e.x),i=Math.abs(e.y),o=r>i;return t==="left"||t==="right"?o&&r>n:!o&&i>n};function P2(e=()=>{}){const t=xn(e);Si(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function j2(e){return e.nodeType===e.ELEMENT_NODE}function R2(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Mu(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var A2=S1,_1=C1,L1=T1,M1=N1,O1=P1,F1=R1,V1=Rh;function z1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e=="boolean"?`${e}`:e===0?"0":e,Jg=B1,Ah=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Jg(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=t,s=Object.keys(i).map(u=>{const c=n==null?void 0:n[u],f=o==null?void 0:o[u];if(c===null)return null;const h=Zg(c)||Zg(f);return i[u][h]}),a=n&&Object.entries(n).reduce((u,c)=>{let[f,h]=c;return h===void 0||(u[f]=h),u},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,c)=>{let{class:f,className:h,...p}=c;return Object.entries(p).every(y=>{let[v,k]=y;return Array.isArray(k)?k.includes({...o,...a}[v]):{...o,...a}[v]===k})?[...u,f,h]:u},[]);return Jg(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)};/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var I2={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const D2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),me=(e,t)=>{const n=m.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:o=2,absoluteStrokeWidth:s,className:a="",children:l,...u},c)=>m.createElement("svg",{ref:c,...I2,width:i,height:i,stroke:r,strokeWidth:s?Number(o)*24/Number(i):o,className:["lucide",`lucide-${D2(e)}`,a].join(" "),...u},[...t.map(([f,h])=>m.createElement(f,h)),...Array.isArray(l)?l:[l]]));return n.displayName=`${e}`,n};/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _2=me("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _l=me("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const L2=me("ArrowUpCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const M2=me("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $1=me("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const U1=me("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const O2=me("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const F2=me("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ey=me("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const W1=me("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const H1=me("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const K1=me("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const V2=me("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ty=me("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const z2=me("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Za=me("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ih=me("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const no=me("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const B2=me("SendHorizontal",[["path",{d:"m3 3 3 9-3 9 19-9Z",key:"1aobqy"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $2=me("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const q1=me("Sparkles",[["path",{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z",key:"17u4zn"}],["path",{d:"M5 3v4",key:"bklmnn"}],["path",{d:"M19 17v4",key:"iiml17"}],["path",{d:"M3 5h4",key:"nem4j1"}],["path",{d:"M17 19h4",key:"lbex7p"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Dh=me("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const U2=me("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jt=me("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** - * @license lucide-react v0.344.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const G1=me("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),_h="-",W2=e=>{const t=K2(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{const a=s.split(_h);return a[0]===""&&a.length!==1&&a.shift(),Y1(a,t)||H2(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},Y1=(e,t)=>{var s;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),i=r?Y1(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;const o=e.join(_h);return(s=t.validators.find(({validator:a})=>a(o)))==null?void 0:s.classGroupId},ny=/^\[(.+)\]$/,H2=e=>{if(ny.test(e)){const t=ny.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},K2=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return G2(Object.entries(e.classGroups),n).forEach(([o,s])=>{Mf(s,r,o,t)}),r},Mf=(e,t,n,r)=>{e.forEach(i=>{if(typeof i=="string"){const o=i===""?t:ry(t,i);o.classGroupId=n;return}if(typeof i=="function"){if(q2(i)){Mf(i(r),t,n,r);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,s])=>{Mf(s,ry(t,o),n,r)})})},ry=(e,t)=>{let n=e;return t.split(_h).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},q2=e=>e.isThemeGetter,G2=(e,t)=>t?e.map(([n,r])=>{const i=r.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,a])=>[t+s,a])):o);return[n,i]}):e,Y2=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const i=(o,s)=>{n.set(o,s),t++,t>e&&(t=0,r=n,n=new Map)};return{get(o){let s=n.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){n.has(o)?n.set(o,s):i(o,s)}}},X1="!",X2=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],o=t.length,s=a=>{const l=[];let u=0,c=0,f;for(let k=0;kc?f-c:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:v}};return n?a=>n({className:a,parseClassName:s}):s},Q2=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},Z2=e=>({cache:Y2(e.cacheSize),parseClassName:X2(e),...W2(e)}),J2=/\s+/,eI=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,o=[],s=e.trim().split(J2);let a="";for(let l=s.length-1;l>=0;l-=1){const u=s[l],{modifiers:c,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:p}=n(u);let y=!!p,v=r(y?h.substring(0,p):h);if(!v){if(!y){a=u+(a.length>0?" "+a:a);continue}if(v=r(h),!v){a=u+(a.length>0?" "+a:a);continue}y=!1}const k=Q2(c).join(":"),g=f?k+X1:k,x=g+v;if(o.includes(x))continue;o.push(x);const w=i(v,y);for(let S=0;S0?" "+a:a)}return a};function tI(){let e=0,t,n,r="";for(;e{if(typeof e=="string")return e;let t,n="";for(let r=0;rf(c),e());return n=Z2(u),r=n.cache.get,i=n.cache.set,o=a,a(l)}function a(l){const u=r(l);if(u)return u;const c=eI(l,n);return i(l,c),c}return function(){return o(tI.apply(null,arguments))}}const fe=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Z1=/^\[(?:([a-z-]+):)?(.+)\]$/i,rI=/^\d+\/\d+$/,iI=new Set(["px","full","screen"]),oI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,sI=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,aI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,lI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,uI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,un=e=>ci(e)||iI.has(e)||rI.test(e),Tn=e=>Ii(e,"length",yI),ci=e=>!!e&&!Number.isNaN(Number(e)),Ou=e=>Ii(e,"number",ci),qi=e=>!!e&&Number.isInteger(Number(e)),cI=e=>e.endsWith("%")&&ci(e.slice(0,-1)),Y=e=>Z1.test(e),Nn=e=>oI.test(e),fI=new Set(["length","size","percentage"]),dI=e=>Ii(e,fI,J1),hI=e=>Ii(e,"position",J1),pI=new Set(["image","url"]),mI=e=>Ii(e,pI,xI),gI=e=>Ii(e,"",vI),Gi=()=>!0,Ii=(e,t,n)=>{const r=Z1.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},yI=e=>sI.test(e)&&!aI.test(e),J1=()=>!1,vI=e=>lI.test(e),xI=e=>uI.test(e),wI=()=>{const e=fe("colors"),t=fe("spacing"),n=fe("blur"),r=fe("brightness"),i=fe("borderColor"),o=fe("borderRadius"),s=fe("borderSpacing"),a=fe("borderWidth"),l=fe("contrast"),u=fe("grayscale"),c=fe("hueRotate"),f=fe("invert"),h=fe("gap"),p=fe("gradientColorStops"),y=fe("gradientColorStopPositions"),v=fe("inset"),k=fe("margin"),g=fe("opacity"),x=fe("padding"),w=fe("saturate"),S=fe("scale"),T=fe("sepia"),C=fe("skew"),j=fe("space"),P=fe("translate"),A=()=>["auto","contain","none"],E=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto",Y,t],R=()=>[Y,t],z=()=>["",un,Tn],F=()=>["auto",ci,Y],B=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],K=()=>["solid","dashed","dotted","double","none"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],L=()=>["start","end","center","between","around","evenly","stretch"],_=()=>["","0",Y],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>[ci,Y];return{cacheSize:500,separator:":",theme:{colors:[Gi],spacing:[un,Tn],blur:["none","",Nn,Y],brightness:W(),borderColor:[e],borderRadius:["none","","full",Nn,Y],borderSpacing:R(),borderWidth:z(),contrast:W(),grayscale:_(),hueRotate:W(),invert:_(),gap:R(),gradientColorStops:[e],gradientColorStopPositions:[cI,Tn],inset:I(),margin:I(),opacity:W(),padding:R(),saturate:W(),scale:W(),sepia:_(),skew:W(),space:R(),translate:R()},classGroups:{aspect:[{aspect:["auto","square","video",Y]}],container:["container"],columns:[{columns:[Nn]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...B(),Y]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",qi,Y]}],basis:[{basis:I()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Y]}],grow:[{grow:_()}],shrink:[{shrink:_()}],order:[{order:["first","last","none",qi,Y]}],"grid-cols":[{"grid-cols":[Gi]}],"col-start-end":[{col:["auto",{span:["full",qi,Y]},Y]}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":[Gi]}],"row-start-end":[{row:["auto",{span:[qi,Y]},Y]}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Y]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Y]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...L()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...L(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...L(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[k]}],mx:[{mx:[k]}],my:[{my:[k]}],ms:[{ms:[k]}],me:[{me:[k]}],mt:[{mt:[k]}],mr:[{mr:[k]}],mb:[{mb:[k]}],ml:[{ml:[k]}],"space-x":[{"space-x":[j]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[j]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Y,t]}],"min-w":[{"min-w":[Y,t,"min","max","fit"]}],"max-w":[{"max-w":[Y,t,"none","full","min","max","fit","prose",{screen:[Nn]},Nn]}],h:[{h:[Y,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Y,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Y,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Y,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Nn,Tn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ou]}],"font-family":[{font:[Gi]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Y]}],"line-clamp":[{"line-clamp":["none",ci,Ou]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",un,Y]}],"list-image":[{"list-image":["none",Y]}],"list-style-type":[{list:["none","disc","decimal",Y]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",un,Tn]}],"underline-offset":[{"underline-offset":["auto",un,Y]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Y]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Y]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...B(),hI]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",dI]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},mI]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...K(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:K()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...K()]}],"outline-offset":[{"outline-offset":[un,Y]}],"outline-w":[{outline:[un,Tn]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[un,Tn]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Nn,gI]}],"shadow-color":[{shadow:[Gi]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...ne(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ne()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Nn,Y]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[T]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[T]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Y]}],duration:[{duration:W()}],ease:[{ease:["linear","in","out","in-out",Y]}],delay:[{delay:W()}],animate:[{animate:["none","spin","ping","pulse","bounce",Y]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[qi,Y]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Y]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Y]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Y]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[un,Tn,Ou]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},kI=nI(wI);function q(...e){return kI(B1(e))}const SI=A2,ek=m.forwardRef(({className:e,...t},n)=>d.jsx(_1,{ref:n,className:q("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));ek.displayName=_1.displayName;const bI=Ah("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),tk=m.forwardRef(({className:e,variant:t,...n},r)=>d.jsx(L1,{ref:r,className:q(bI({variant:t}),e),...n}));tk.displayName=L1.displayName;const CI=m.forwardRef(({className:e,...t},n)=>d.jsx(F1,{ref:n,className:q("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));CI.displayName=F1.displayName;const nk=m.forwardRef(({className:e,...t},n)=>d.jsx(V1,{ref:n,className:q("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:d.jsx(jt,{className:"h-4 w-4"})}));nk.displayName=V1.displayName;const rk=m.forwardRef(({className:e,...t},n)=>d.jsx(M1,{ref:n,className:q("text-sm font-semibold [&+div]:text-xs",e),...t}));rk.displayName=M1.displayName;const ik=m.forwardRef(({className:e,...t},n)=>d.jsx(O1,{ref:n,className:q("text-sm opacity-90",e),...t}));ik.displayName=O1.displayName;function EI(){const{toasts:e}=rs();return d.jsxs(SI,{children:[e.map(function({id:t,title:n,description:r,action:i,...o}){return d.jsxs(tk,{...o,children:[d.jsxs("div",{className:"grid gap-1",children:[n&&d.jsx(rk,{children:n}),r&&d.jsx(ik,{children:r})]}),i,d.jsx(nk,{})]},t)}),d.jsx(ek,{})]})}const TI="0.1.0",NI="https://github.com/rawnaqs/khayal/releases/latest",ke={TOKEN:"khayal_token",HOST:"khayal_host",RECENT_SEARCHES:"khayal-recent-searches",LOCK_SETUP_DECIDED:"khayal-lock-setup-decided"},PI=["people","payments","this week","ideas","decisions","meetings"],Of={text:["saved","tagging","summarizing","writing"],image:["saved","describing","tagging","writing"],article:["saved","extracting","summarizing","writing"]},Cr={SEARCH_RESULTS:20,QUEUE_JOBS:50,RECENT_SEARCHES:6,DONE_JOBS_SHOWN:5,TAGS_HERO:3,TAGS_COMPACT:2,HERO_SCORE_THRESHOLD:.9},Lh={CAPTURE_DISMISS:3500,STATS_POLL:6e4,SERVER_STATUS_POLL:3e4},Fu=[{maxHour:5,text:"late night thoughts?"},{maxHour:12,text:"good morning"},{maxHour:17,text:"good afternoon"},{maxHour:21,text:"good evening"},{maxHour:24,text:"late night thoughts?"}],Ee={DB_NAME:"khayal-offline",STORE_OFFLINE:"offline",STORE_VAULT:"vault",DB_VERSION:2,PRF_SALT_BYTES:32};class ok{constructor(t,n){Hl(this,"host");Hl(this,"token");this.host=t.replace(/\/$/,""),this.token=n}async request(t,n,r){const i=await fetch(`${this.host}${n}`,{method:t,headers:{"Content-Type":"application/json","X-Khayal-Token":this.token},body:r?JSON.stringify(r):void 0});if(!i.ok){const o=await i.json().catch(()=>({error:"Unknown error"}));throw new Error(o.error||`Request failed: ${i.status}`)}return i.json()}async capture(t){return this.request("POST","/v1/capture",t)}async uploadImage(t,n){const r=new FormData;r.append("file",t),n&&r.append("note",n);const i=await fetch(`${this.host}/v1/capture`,{method:"POST",headers:{"X-Khayal-Token":this.token},body:r});if(!i.ok){const o=await i.json().catch(()=>({error:"Upload failed"}));throw new Error(o.error||"Upload failed")}return i.json()}async search(t,n={}){const r=new URLSearchParams;return r.set("q",t),n.mode&&r.set("mode",n.mode),n.limit&&r.set("limit",n.limit.toString()),n.excerpt_length&&r.set("excerpt_length",n.excerpt_length.toString()),n.from&&r.set("from",n.from),n.to&&r.set("to",n.to),n.connections&&r.set("connections","true"),n.overview&&r.set("overview","true"),this.request("GET",`/v1/search?${r.toString()}`)}async health(){return this.request("GET","/v1/health")}async queue(t={}){const n=new URLSearchParams;return t.status&&n.set("status",t.status),t.limit&&n.set("limit",t.limit.toString()),t.offset&&n.set("offset",t.offset.toString()),this.request("GET",`/v1/queue?${n.toString()}`)}async retryJob(t){await this.request("POST",`/v1/queue/${t}/retry`)}async discardJob(t){await this.request("POST",`/v1/queue/${t}/discard`)}async stats(){return this.request("GET","/v1/stats")}async deleteNote(t){return this.request("DELETE",`/v1/note?path=${encodeURIComponent(t)}`)}async getNote(t,n){const r=new URLSearchParams;n&&r.set("q",n);const i=encodeURIComponent(t),o=n?"?"+r.toString():"";return this.request("GET",`/v1/notes/${i}${o}`)}}function Ct(e){const t=localStorage.getItem(ke.HOST)||window.location.origin,n=e??localStorage.getItem(ke.TOKEN)??"";return new ok(t,n)}function sk(e){return e instanceof Uint8Array?new Uint8Array(e):new Uint8Array(e)}function jI(e){if(e instanceof ArrayBuffer)return new Uint8Array(e);const t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function RI(e){const t=sk(e);let n="";for(let r=0;r"u"||typeof PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable!="function")return!1;try{return await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()}catch{return!1}}async function DI(){var n;const e=await navigator.credentials.create({publicKey:{rp:{name:"khayal",id:location.hostname},user:{id:Ho(16),name:"khayal-user",displayName:"khayal"},challenge:Ho(32),pubKeyCredParams:[{alg:-7,type:"public-key"}],authenticatorSelection:{authenticatorAttachment:"platform",residentKey:"required",userVerification:"required"},extensions:{prf:{}}}});if(!e)throw new Error("Registration cancelled");const t=!!((n=e.getClientExtensionResults().prf)!=null&&n.enabled);return{credentialId:RI(e.rawId),prfEnabled:t}}async function Vu(e,t){var i,o;const n=await navigator.credentials.get({publicKey:{challenge:Ho(32),allowCredentials:[{id:AI(e),type:"public-key"}],userVerification:"required",extensions:{prf:{eval:{first:t}}}}});if(!n)throw new Error("Unlock cancelled");const r=(o=(i=n.getClientExtensionResults().prf)==null?void 0:i.results)==null?void 0:o.first;if(!r)throw new Error("PRF unavailable for this credential");return jI(r)}async function zu(e){try{const t=await crypto.subtle.importKey("raw",e,"HKDF",!1,["deriveKey"]);return await crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:new Uint8Array(0),info:new TextEncoder().encode("khayal-prf")},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}catch{return crypto.subtle.importKey("raw",e,{name:"AES-GCM"},!1,["encrypt","decrypt"])}}async function Mh(e,t){const n=Ho(12),r=new TextEncoder().encode(t),i=await crypto.subtle.encrypt({name:"AES-GCM",iv:n},e,r),o=new Uint8Array(n.length+i.byteLength);return o.set(n,0),o.set(new Uint8Array(i),n.length),ak(o)}async function Ja(e,t){const n=Ff(t),r=n.slice(0,12),i=n.slice(12),o=await crypto.subtle.decrypt({name:"AES-GCM",iv:r},e,i);return new TextDecoder().decode(o)}function ss(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function _I(e,t){let n;const r=()=>{if(n)return n;const i=indexedDB.open(e);return i.onupgradeneeded=()=>i.result.createObjectStore(t),n=ss(i),n.then(o=>{o.onclose=()=>n=void 0},()=>{}),n};return(i,o)=>r().then(s=>o(s.transaction(t,i).objectStore(t)))}let Bu;function Oh(){return Bu||(Bu=_I("keyval-store","keyval")),Bu}function LI(e,t=Oh()){return t("readonly",n=>ss(n.get(e)))}function MI(e,t=Oh()){return t("readwrite",n=>(n.delete(e),ss(n.transaction)))}function OI(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},ss(e.transaction)}function FI(e=Oh()){return e("readonly",t=>{if(t.getAllKeys)return ss(t.getAllKeys());const n=[];return OI(t,r=>n.push(r.key)).then(()=>n)})}function Rr(){return new Promise((e,t)=>{const n=indexedDB.open(Ee.DB_NAME,Ee.DB_VERSION);n.onupgradeneeded=()=>{const r=n.result;r.objectStoreNames.contains(Ee.STORE_OFFLINE)||r.createObjectStore(Ee.STORE_OFFLINE,{keyPath:"id"}),r.objectStoreNames.contains(Ee.STORE_VAULT)||r.createObjectStore(Ee.STORE_VAULT,{keyPath:"id"})},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}function Fh(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}function Ll(e){return new Promise((t,n)=>{e.oncomplete=()=>t(),e.onerror=()=>n(e.error),e.onabort=()=>n(e.error)})}let iy=!1;async function VI(){if(!iy){iy=!0;try{const t=(await FI()).filter(r=>String(r).startsWith("khayal-offline-"));if(t.length===0)return;const n=await Rr();for(const r of t){const i=await LI(r);!i||typeof i!="object"||!i.id||(await Fh(n.transaction(Ee.STORE_OFFLINE,"readwrite").objectStore(Ee.STORE_OFFLINE).put(i)),await MI(r))}}catch{}}}async function $u(){const t=(await Rr()).transaction(Ee.STORE_VAULT,"readonly");return await Fh(t.objectStore(Ee.STORE_VAULT).get("vault"))||null}async function zI(e){const n=(await Rr()).transaction(Ee.STORE_VAULT,"readwrite");n.objectStore(Ee.STORE_VAULT).put(e),await Ll(n)}async function oy(){const t=(await Rr()).transaction(Ee.STORE_VAULT,"readwrite");t.objectStore(Ee.STORE_VAULT).delete("vault"),await Ll(t)}async function Vh(){const t=(await Rr()).transaction(Ee.STORE_OFFLINE,"readonly");return await Fh(t.objectStore(Ee.STORE_OFFLINE).getAll())||[]}async function el(e){const n=(await Rr()).transaction(Ee.STORE_OFFLINE,"readwrite");n.objectStore(Ee.STORE_OFFLINE).put(e),await Ll(n)}async function BI(e){const n=(await Rr()).transaction(Ee.STORE_OFFLINE,"readwrite");n.objectStore(Ee.STORE_OFFLINE).delete(e),await Ll(n)}function uk(e){return!!e&&e.mode!=="none"&&!!e.key}async function sy(e,t){const n=`offline-${Date.now()}-${Math.random().toString(36).slice(2)}`,r=t==null?void 0:t.token,i=Date.now();if(uk(t)){const o=JSON.stringify({request:e,token:r??null}),s=await Mh(t.key,o);await el({id:n,cipher:s,timestamp:i})}else await el({id:n,request:e,token:r,timestamp:i});return qI(),n}async function ck(e){const t=await Vh(),n=[];for(const r of t)if(r.cipher){if(!uk(e))continue;try{const i=await Ja(e.key,r.cipher),o=JSON.parse(i);n.push({id:r.id,request:o.request,token:o.token??void 0,timestamp:r.timestamp})}catch{}}else r.request&&n.push({id:r.id,request:r.request,token:r.token,timestamp:r.timestamp});return n.sort((r,i)=>r.timestamp-i.timestamp)}async function $I(e){await BI(e)}async function UI(e,t){const n=await ck(t);for(const r of n)try{await e.capture(r.request),await $I(r.id)}catch{break}}function WI(e,t,n){const r=new ok(e,t),i=()=>UI(r,n);window.addEventListener("focus",i),window.addEventListener("online",i),navigator.onLine&&i()}async function HI(e,t){const n=await Vh();for(const r of n){if(r.cipher||!r.request)continue;const i=JSON.stringify({request:r.request,token:t??r.token??null}),o=await Mh(e,i);await el({id:r.id,cipher:o,timestamp:r.timestamp})}}async function KI(e){const t=await Vh();for(const n of t)if(n.cipher)try{const r=await Ja(e,n.cipher),i=JSON.parse(r);await el({id:n.id,request:i.request,token:i.token??void 0,timestamp:n.timestamp})}catch{}}async function qI(){if("serviceWorker"in navigator&&"sync"in ServiceWorkerRegistration.prototype)try{await(await navigator.serviceWorker.ready).sync.register("sync-offline-captures")}catch{navigator.serviceWorker.controller&&navigator.serviceWorker.controller.postMessage({type:"SYNC_OFFLINE"})}}const fk=m.createContext(null);function GI({children:e}){const[t,n]=m.useState("none"),[r,i]=m.useState(!1),[o,s]=m.useState(!1),[a,l]=m.useState(null),[u,c]=m.useState(null),[f,h]=m.useState(!1),p=m.useRef(null);m.useEffect(()=>{let P=!1;return(async()=>{await VI();const A=await $u();if(!P){if(A&&A.mode==="prf")n("prf"),i(!0),s(!0);else{const E=localStorage.getItem(ke.TOKEN),I=localStorage.getItem(ke.HOST);E&&I?(l(E),n("none"),i(!1),s(!0)):(n("none"),i(!1),s(!1))}h(!0)}})(),()=>{P=!0}},[]),m.useEffect(()=>{if(!a)return;const P=localStorage.getItem(ke.HOST)||window.location.origin;!P||p.current===a||(p.current=a,WI(P,a,{mode:t,key:u,token:a}))},[a,t,u]);const y=m.useCallback(async(P,A,E,I)=>{const R=await Mh(P,A);await zI({id:"vault",mode:"prf",credentialId:E,salt:ak(I),encryptedToken:R}),await HI(P,A),localStorage.removeItem(ke.TOKEN),localStorage.setItem(ke.LOCK_SETUP_DECIDED,"1"),l(A),c(P),n("prf"),i(!1),s(!0)},[]),v=m.useCallback(async P=>{if(!await lk())return!1;try{const{credentialId:E,prfEnabled:I}=await DI();if(!I)return!1;const R=P??a??localStorage.getItem(ke.TOKEN)??"";if(!R)return!1;const z=II(Ee.PRF_SALT_BYTES),F=await Vu(E,z),B=await zu(F);return await y(B,R,E,z),!0}catch{return!1}},[a,y]),k=m.useCallback((P,A)=>{localStorage.setItem(ke.LOCK_SETUP_DECIDED,"1"),A?(localStorage.setItem(ke.HOST,window.location.origin),localStorage.setItem(ke.TOKEN,P)):localStorage.removeItem(ke.TOKEN),l(P),c(null),n("none"),i(!1),s(!0)},[]),g=m.useCallback(P=>{localStorage.setItem(ke.LOCK_SETUP_DECIDED,"1"),P?(localStorage.setItem(ke.HOST,window.location.origin),a&&localStorage.setItem(ke.TOKEN,a)):localStorage.removeItem(ke.TOKEN)},[a]),x=m.useCallback(async()=>{const P=await $u();if(!P||P.mode!=="prf"||!P.credentialId)return!1;try{const A=await Vu(P.credentialId,Ff(P.salt)),E=await zu(A),I=await Ja(E,P.encryptedToken);return l(I),c(E),n("prf"),i(!1),!0}catch{return!1}},[]),w=m.useCallback(async()=>{const P=await $u();if(!P||P.mode!=="prf"||!P.credentialId)return!1;try{const A=await Vu(P.credentialId,Ff(P.salt)),E=await zu(A),I=await Ja(E,P.encryptedToken);return localStorage.setItem(ke.TOKEN,I),await KI(E),await oy(),n("none"),i(!1),c(null),l(I),!0}catch{return!1}},[]),S=m.useCallback(()=>{t!=="none"&&(l(null),c(null),i(!0))},[t]),T=m.useCallback(async()=>{await oy(),localStorage.removeItem(ke.TOKEN),localStorage.removeItem(ke.HOST),p.current=null,n("none"),i(!1),l(null),c(null),s(!1)},[]),C=m.useMemo(()=>({mode:t,key:u,token:a??void 0}),[t,u,a]),j=m.useMemo(()=>({lockMode:t,locked:r,configured:o,token:a,vaultKey:u,session:C,unlock:x,setupPrf:v,completeOnboarding:k,setTokenPersistence:g,disable:w,lock:S,resetToOnboarding:T}),[t,r,o,a,u,C,x,v,k,g,w,S,T]);return f?d.jsx(fk.Provider,{value:j,children:e}):null}function st(){const e=m.useContext(fk);if(!e)throw new Error("useVaultLock must be used within a VaultLockProvider");return e}function YI(e=Lh.SERVER_STATUS_POLL){const{token:t}=st(),[n,r]=m.useState("offline"),[i,o]=m.useState(null),[s,a]=m.useState(null),l=m.useCallback(async()=>{try{const c=await Ct(t).health();o(c);const f=c.dependencies;f.db.status!=="ok"||f.vault.status!=="ok"?r("degraded"):r("ok")}catch{r("offline"),o(null)}a(new Date)},[t]);return m.useEffect(()=>{l();const u=setInterval(l,e);return()=>clearInterval(u)},[l,e]),{status:n,health:i,lastChecked:s,checkStatus:l}}var XI=Symbol.for("react.lazy"),tl=Nr[" use ".trim().toString()];function QI(e){return typeof e=="object"&&e!==null&&"then"in e}function dk(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===XI&&"_payload"in e&&QI(e._payload)}function ZI(e){const t=eD(e),n=m.forwardRef((r,i)=>{let{children:o,...s}=r;dk(o)&&typeof tl=="function"&&(o=tl(o._payload));const a=m.Children.toArray(o),l=a.find(nD);if(l){const u=l.props.children,c=a.map(f=>f===l?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return d.jsx(t,{...s,ref:i,children:m.isValidElement(u)?m.cloneElement(u,void 0,c):null})}return d.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}var JI=ZI("Slot");function eD(e){const t=m.forwardRef((n,r)=>{let{children:i,...o}=n;if(dk(i)&&typeof tl=="function"&&(i=tl(i._payload)),m.isValidElement(i)){const s=iD(i),a=rD(o,i.props);return i.type!==m.Fragment&&(a.ref=r?Sn(r,s):s),m.cloneElement(i,a)}return m.Children.count(i)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var tD=Symbol("radix.slottable");function nD(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===tD}function rD(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function iD(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const oD=Ah("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-gradient-to-r from-primary to-primary/80 text-primary-foreground shadow hover:shadow-lg hover:shadow-primary/25 hover:scale-[1.02] active:scale-[0.98]",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 hover:shadow-lg hover:shadow-destructive/25",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),wn=m.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},o)=>{const s=r?JI:"button";return d.jsx(s,{className:q(oD({variant:t,size:n,className:e})),ref:o,...i})});wn.displayName="Button";var sD=Object.defineProperty,Di=(e,t)=>sD(e,"name",{value:t,configurable:!0}),hk=!!(typeof window<"u"&&window.document&&window.document.createElement);function zh(e,t,{checkForDefaultPrevented:n=!0}={}){return Di(function(i){if(e==null||e(i),n===!1||!i||!i.defaultPrevented)return t==null?void 0:t(i)},"handleEvent")}Di(zh,"composeEventHandlers");function aD(e){var t;if(!hk)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}Di(aD,"getOwnerWindow");function Vf(e){if(!hk)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}Di(Vf,"getOwnerDocument");function pk(e,t=!1){const{activeElement:n}=Vf(e);if(!(n!=null&&n.nodeName))return null;if(mk(n)&&n.contentDocument)return pk(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const i=Vf(n).getElementById(r);if(i)return i}}return n}Di(pk,"getActiveElement");function mk(e){return e.tagName==="IFRAME"}Di(mk,"isFrame");var lD=Object.defineProperty,Bh=(e,t)=>lD(e,"name",{value:t,configurable:!0});function zf(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Bh(zf,"setRef");function gk(...e){return t=>{let n=!1;const r=e.map(i=>{const o=zf(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;iuD(e,"name",{value:t,configurable:!0});function cD(e,t){const n=m.createContext(t);n.displayName=e+"Context";const r=kt(o=>{const{children:s,...a}=o,l=m.useMemo(()=>a,Object.values(a));return d.jsx(n.Provider,{value:l,children:s})},"Provider");r.displayName=e+"Provider";function i(o,s={}){const{optional:a=!1}=s,l=m.useContext(n);if(l)return l;if(t!==void 0)return t;if(!a)throw new Error(`\`${o}\` must be used within \`${e}\``)}return kt(i,"useContext"),[r,i]}kt(cD,"createContext");function yk(e,t=[]){let n=[];function r(o,s){const a=m.createContext(s);a.displayName=o+"Context";const l=n.length;n=[...n,s];const u=kt(f=>{var g;const{scope:h,children:p,...y}=f,v=((g=h==null?void 0:h[e])==null?void 0:g[l])||a,k=m.useMemo(()=>y,Object.values(y));return d.jsx(v.Provider,{value:k,children:p})},"Provider");u.displayName=o+"Provider";function c(f,h,p={}){var g;const{optional:y=!1}=p,v=((g=h==null?void 0:h[e])==null?void 0:g[l])||a,k=m.useContext(v);if(k)return k;if(s!==void 0)return s;if(!y)throw new Error(`\`${f}\` must be used within \`${o}\``)}return kt(c,"useContext"),[u,c]}kt(r,"createContext");const i=kt(()=>{const o=n.map(s=>m.createContext(s));return kt(function(a){const l=(a==null?void 0:a[e])||o;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])},"useScope")},"createScope");return i.scopeName=e,[r,vk(i,...t)]}kt(yk,"createContextScope");function vk(...e){const t=e[0];if(e.length===1)return t;const n=kt(()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return kt(function(o){const s=r.reduce((a,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...a,...f}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}kt(vk,"composeContextScopes");var xk=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},fD=Object.defineProperty,dD=(e,t)=>fD(e,"name",{value:t,configurable:!0}),ay=Nr[" useEffectEvent ".trim().toString()],ly=Nr[" useInsertionEffect ".trim().toString()];function wk(e){if(typeof ay=="function")return ay(e);const t=m.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof ly=="function"?ly(()=>{t.current=e}):xk(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}dD(wk,"useEffectEvent");var hD=Object.defineProperty,as=(e,t)=>hD(e,"name",{value:t,configurable:!0}),pD=Nr[" useInsertionEffect ".trim().toString()]||xk;function kk({prop:e,defaultProp:t,onChange:n=as(()=>{},"onChange"),caller:r}){const[i,o,s]=Sk({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:i,u=m.useCallback(c=>{var f;if(a){const h=bk(c)?c(e):c;h!==e&&((f=s.current)==null||f.call(s,h))}else o(c)},[a,e,o,s]);return[l,u]}as(kk,"useControllableState");function Sk({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),i=m.useRef(n),o=m.useRef(t);return pD(()=>{o.current=t},[t]),m.useEffect(()=>{var s;i.current!==n&&((s=o.current)==null||s.call(o,n),i.current=n)},[n,i]),[n,r,o]}as(Sk,"useUncontrolledState");function bk(e){return typeof e=="function"}as(bk,"isFunction");var uy=Symbol("RADIX:SYNC_STATE");function mD(e,t,n,r){const{prop:i,defaultProp:o,onChange:s,caller:a}=t,l=i!==void 0,u=wk(s),c=[{...n,state:o}];r&&c.push(r);const[f,h]=m.useReducer((k,g)=>{if(g.type===uy)return{...k,state:g.state};const x=e(k,g);return l&&!Object.is(x.state,k.state)&&u(x.state),x},...c),p=f.state,y=m.useRef(p);m.useEffect(()=>{y.current!==p&&(y.current=p,l||u(p))},[p,y,l]);const v=m.useMemo(()=>i!==void 0?{...f,state:i}:f,[f,i]);return m.useEffect(()=>{l&&!Object.is(i,f.state)&&h({type:uy,state:i})},[i,f.state,l]),[v,h]}as(mD,"useControllableStateReducer");var gD=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},yD=Object.defineProperty,vD=(e,t)=>yD(e,"name",{value:t,configurable:!0});function Ck(e){const[t,n]=m.useState(void 0);return gD(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const l=o.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,a=u.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}vD(Ck,"useSize");var xD=Object.defineProperty,Wt=(e,t)=>xD(e,"name",{value:t,configurable:!0});function Ek(e){const t=m.forwardRef((n,r)=>{let{children:i,...o}=n,s=null,a=!1;const l=[];Bf(i)&&typeof Os=="function"&&(i=Os(i._payload)),m.Children.forEach(i,h=>{var p;if(jk(h)){a=!0;const y=h;let v="child"in y.props?y.props.child:y.props.children;Bf(v)&&typeof Os=="function"&&(v=Os(v._payload)),s=kD(y,v),l.push((p=s==null?void 0:s.props)==null?void 0:p.children)}else l.push(h)}),s?s=m.cloneElement(s,void 0,l):!a&&m.Children.count(i)===1&&m.isValidElement(i)&&(s=i);const u=s?Pk(s):void 0,c=Ml(r,u);if(!s){if(i||i===0)throw new Error(a?CD(e):bD(e));return i}const f=Nk(o,s.props??{});return s.type!==m.Fragment&&(f.ref=r?c:u),m.cloneElement(s,f)});return t.displayName=`${e}.Slot`,t}Wt(Ek,"createSlot");var Tk=Symbol.for("radix.slottable");function wD(e){const t=Wt(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=Tk,t}Wt(wD,"createSlottable");var kD=Wt((e,t)=>{if("child"in e.props){const n=e.props.child;return m.isValidElement(n)?m.cloneElement(n,void 0,e.props.children(n.props.children)):null}return m.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function Nk(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}Wt(Nk,"mergeProps");function Pk(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Wt(Pk,"getElementRef");function jk(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Tk}Wt(jk,"isSlottable");var SD=Symbol.for("react.lazy");function Bf(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===SD&&"_payload"in e&&Rk(e._payload)}Wt(Bf,"isLazyComponent");function Rk(e){return typeof e=="object"&&e!==null&&"then"in e}Wt(Rk,"isPromiseLike");var bD=Wt(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),CD=Wt(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Os=Nr[" use ".trim().toString()],ED=Object.defineProperty,TD=(e,t)=>ED(e,"name",{value:t,configurable:!0}),ND=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$h=ND.reduce((e,t)=>{const n=Ek(`Primitive.${t}`),r=m.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function PD(e,t){e&&Ni.flushSync(()=>e.dispatchEvent(t))}TD(PD,"dispatchDiscreteCustomEvent");var jD=Object.defineProperty,Qn=(e,t)=>jD(e,"name",{value:t,configurable:!0}),Uh="Switch",[RD,T5]=yk(Uh),[AD,Wh]=RD(Uh);function Ak(e){const{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:o,form:s,name:a,onCheckedChange:l,required:u,value:c="on",internal_do_not_use_render:f}=e,[h,p]=kk({prop:n,defaultProp:i??!1,onChange:l,caller:Uh}),[y,v]=m.useState(null),[k,g]=m.useState(null),x=m.useRef(!1),[w,S]=m.useReducer(j=>j+1,0),T=y?!!s||!!y.closest("form"):!0,C={checked:h,setChecked:p,disabled:o,control:y,setControl:v,name:a,form:s,value:c,hasConsumerStoppedPropagationRef:x,userInteractionCount:w,onUserInteraction:S,required:u,defaultChecked:i,isFormControl:T,bubbleInput:k,setBubbleInput:g};return d.jsx(AD,{scope:t,...C,children:Dk(f)?f(C):r})}Qn(Ak,"SwitchProvider");var ID="SwitchTrigger",DD=m.forwardRef(Qn(function({__scopeSwitch:t,onClick:n,...r},i){const{control:o,form:s,value:a,disabled:l,checked:u,required:c,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:p,onUserInteraction:y,isFormControl:v,bubbleInput:k}=Wh(ID,t),g=Ml(i,f),x=m.useRef(u);return m.useEffect(()=>{const w=s?o==null?void 0:o.ownerDocument.getElementById(s):o==null?void 0:o.form;if(w instanceof HTMLFormElement){const S=Qn(()=>h(x.current),"reset");return w.addEventListener("reset",S),()=>w.removeEventListener("reset",S)}},[o,s,h]),d.jsx($h.button,{type:"button",role:"switch","aria-checked":u,"aria-required":c,"data-state":Hh(u),"data-disabled":l?"":void 0,disabled:l,value:a,...r,ref:g,onClick:zh(n,w=>{y(),h(S=>!S),k&&v&&(p.current=w.isPropagationStopped(),p.current||w.stopPropagation())})})},"SwitchTrigger")),Ik=m.forwardRef(Qn(function(t,n){const{__scopeSwitch:r,name:i,checked:o,defaultChecked:s,required:a,disabled:l,value:u,onCheckedChange:c,form:f,...h}=t;return d.jsx(Ak,{__scopeSwitch:r,checked:o,defaultChecked:s,disabled:l,required:a,onCheckedChange:c,name:i,form:f,value:u,internal_do_not_use_render:({isFormControl:p})=>d.jsxs(d.Fragment,{children:[d.jsx(DD,{...h,ref:n,__scopeSwitch:r}),p&&d.jsx(OD,{__scopeSwitch:r})]})})},"Switch")),_D="SwitchThumb",LD=m.forwardRef(Qn(function(t,n){const{__scopeSwitch:r,...i}=t,o=Wh(_D,r);return d.jsx($h.span,{"data-state":Hh(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:n})},"SwitchThumb")),MD="SwitchBubbleInput",OD=m.forwardRef(Qn(function({__scopeSwitch:t,onClick:n,...r},i){const{control:o,hasConsumerStoppedPropagationRef:s,userInteractionCount:a,checked:l,defaultChecked:u,required:c,disabled:f,name:h,value:p,form:y,bubbleInput:v,setBubbleInput:k}=Wh(MD,t),g=Ml(i,k),x=Ck(o),w=m.useRef(!1),S=m.useRef(l),T=m.useRef(a);m.useEffect(()=>{const j=v;if(!j)return;const P=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(P,"checked").set,I=a!==T.current;T.current=a;const R=S.current!==l;S.current=l;const z=!(I&&s.current);if(R&&E){w.current=!I;const F=new Event("click",{bubbles:z});E.call(j,l),j.dispatchEvent(F),w.current=!1}},[v,l,s,a]);const C=m.useRef(l);return d.jsx($h.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??C.current,required:c,disabled:f,name:h,value:p,form:y,...r,tabIndex:-1,ref:g,onClick:zh(n,j=>{w.current&&j.stopPropagation()}),style:{...r.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function Dk(e){return typeof e=="function"}Qn(Dk,"isFunction");function Hh(e){return e?"checked":"unchecked"}Qn(Hh,"getState");const _k=m.forwardRef(({className:e,...t},n)=>d.jsx(Ik,{className:q("peer inline-flex h-5 w-9 min-h-0 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:d.jsx(LD,{className:q("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));_k.displayName=Ik.displayName;var FD=Nr[" useId ".trim().toString()]||(()=>{}),VD=0;function Uu(e){const[t,n]=m.useState(FD());return Si(()=>{n(r=>r??String(VD++))},[e]),e||(t?`radix-${t}`:"")}function zD(e){const t=BD(e),n=m.forwardRef((r,i)=>{const{children:o,...s}=r,a=m.Children.toArray(o),l=a.find(UD);if(l){const u=l.props.children,c=a.map(f=>f===l?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return d.jsx(t,{...s,ref:i,children:m.isValidElement(u)?m.cloneElement(u,void 0,c):null})}return d.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function BD(e){const t=m.forwardRef((n,r)=>{const{children:i,...o}=n;if(m.isValidElement(i)){const s=HD(i),a=WD(o,i.props);return i.type!==m.Fragment&&(a.ref=r?Sn(r,s):s),m.cloneElement(i,a)}return m.Children.count(i)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $D=Symbol("radix.slottable");function UD(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$D}function WD(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function HD(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var KD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],qD=KD.reduce((e,t)=>{const n=zD(`Primitive.${t}`),r=m.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Wu="focusScope.autoFocusOnMount",Hu="focusScope.autoFocusOnUnmount",cy={bubbles:!1,cancelable:!0},GD="FocusScope",Lk=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=e,[a,l]=m.useState(null),u=xn(i),c=xn(o),f=m.useRef(null),h=Ut(t,v=>l(v)),p=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let v=function(w){if(p.paused||!a)return;const S=w.target;a.contains(S)?f.current=S:An(f.current,{select:!0})},k=function(w){if(p.paused||!a)return;const S=w.relatedTarget;S!==null&&(a.contains(S)||An(f.current,{select:!0}))},g=function(w){if(document.activeElement===document.body)for(const T of w)T.removedNodes.length>0&&An(a)};document.addEventListener("focusin",v),document.addEventListener("focusout",k);const x=new MutationObserver(g);return a&&x.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",k),x.disconnect()}}},[r,a,p.paused]),m.useEffect(()=>{if(a){dy.add(p);const v=document.activeElement;if(!a.contains(v)){const g=new CustomEvent(Wu,cy);a.addEventListener(Wu,u),a.dispatchEvent(g),g.defaultPrevented||(YD(e_(Mk(a)),{select:!0}),document.activeElement===v&&An(a))}return()=>{a.removeEventListener(Wu,u),setTimeout(()=>{const g=new CustomEvent(Hu,cy);a.addEventListener(Hu,c),a.dispatchEvent(g),g.defaultPrevented||An(v??document.body,{select:!0}),a.removeEventListener(Hu,c),dy.remove(p)},0)}}},[a,u,c,p]);const y=m.useCallback(v=>{if(!n&&!r||p.paused)return;const k=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,g=document.activeElement;if(k&&g){const x=v.currentTarget,[w,S]=XD(x);w&&S?!v.shiftKey&&g===S?(v.preventDefault(),n&&An(w,{select:!0})):v.shiftKey&&g===w&&(v.preventDefault(),n&&An(S,{select:!0})):g===x&&v.preventDefault()}},[n,r,p.paused]);return d.jsx(qD.div,{tabIndex:-1,...s,ref:h,onKeyDown:y})});Lk.displayName=GD;function YD(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(An(r,{select:t}),document.activeElement!==n)return}function XD(e){const t=Mk(e),n=fy(t,e),r=fy(t.reverse(),e);return[n,r]}function Mk(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function fy(e,t){for(const n of e)if(!QD(n,{upTo:t}))return n}function QD(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function ZD(e){return e instanceof HTMLInputElement&&"select"in e}function An(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ZD(e)&&t&&e.select()}}var dy=JD();function JD(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=hy(e,t),e.unshift(t)},remove(t){var n;e=hy(e,t),(n=e[0])==null||n.resume()}}}function hy(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function e_(e){return e.filter(t=>t.tagName!=="A")}function Ok(e){const t=t_(e),n=m.forwardRef((r,i)=>{const{children:o,...s}=r,a=m.Children.toArray(o),l=a.find(r_);if(l){const u=l.props.children,c=a.map(f=>f===l?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return d.jsx(t,{...s,ref:i,children:m.isValidElement(u)?m.cloneElement(u,void 0,c):null})}return d.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function t_(e){const t=m.forwardRef((n,r)=>{const{children:i,...o}=n;if(m.isValidElement(i)){const s=o_(i),a=i_(o,i.props);return i.type!==m.Fragment&&(a.ref=r?Sn(r,s):s),m.cloneElement(i,a)}return m.Children.count(i)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var n_=Symbol("radix.slottable");function r_(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===n_}function i_(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function o_(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var s_=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ls=s_.reduce((e,t)=>{const n=Ok(`Primitive.${t}`),r=m.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Ku=0;function a_(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??py()),document.body.insertAdjacentElement("beforeend",e[1]??py()),Ku++,()=>{Ku===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ku--}},[])}function py(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var en=function(){return en=Object.assign||function(t){for(var n,r=1,i=arguments.length;r"u")return C_;var t=E_(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},N_=Bk(),fi="data-scroll-locked",P_=function(e,t,n,r){var i=e.left,o=e.top,s=e.right,a=e.gap;return n===void 0&&(n="margin"),` - .`.concat(u_,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(a,"px ").concat(r,`; - } - body[`).concat(fi,`] { - overflow: hidden `).concat(r,`; - overscroll-behavior: contain; - `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` - padding-left: `.concat(i,`px; - padding-top: `).concat(o,`px; - padding-right: `).concat(s,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(a,"px ").concat(r,`; - `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),` - } - - .`).concat(pa,` { - right: `).concat(a,"px ").concat(r,`; - } - - .`).concat(ma,` { - margin-right: `).concat(a,"px ").concat(r,`; - } - - .`).concat(pa," .").concat(pa,` { - right: 0 `).concat(r,`; - } - - .`).concat(ma," .").concat(ma,` { - margin-right: 0 `).concat(r,`; - } - - body[`).concat(fi,`] { - `).concat(c_,": ").concat(a,`px; - } -`)},gy=function(){var e=parseInt(document.body.getAttribute(fi)||"0",10);return isFinite(e)?e:0},j_=function(){m.useEffect(function(){return document.body.setAttribute(fi,(gy()+1).toString()),function(){var e=gy()-1;e<=0?document.body.removeAttribute(fi):document.body.setAttribute(fi,e.toString())}},[])},R_=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;j_();var o=m.useMemo(function(){return T_(i)},[i]);return m.createElement(N_,{styles:P_(o,!t,i,n?"":"!important")})},$f=!1;if(typeof window<"u")try{var Fs=Object.defineProperty({},"passive",{get:function(){return $f=!0,!0}});window.addEventListener("test",Fs,Fs),window.removeEventListener("test",Fs,Fs)}catch{$f=!1}var Mr=$f?{passive:!1}:!1,A_=function(e){return e.tagName==="TEXTAREA"},$k=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!A_(e)&&n[t]==="visible")},I_=function(e){return $k(e,"overflowY")},D_=function(e){return $k(e,"overflowX")},yy=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=Uk(e,r);if(i){var o=Wk(e,r),s=o[1],a=o[2];if(s>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},__=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},L_=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Uk=function(e,t){return e==="v"?I_(t):D_(t)},Wk=function(e,t){return e==="v"?__(t):L_(t)},M_=function(e,t){return e==="h"&&t==="rtl"?-1:1},O_=function(e,t,n,r,i){var o=M_(e,window.getComputedStyle(t).direction),s=o*r,a=n.target,l=t.contains(a),u=!1,c=s>0,f=0,h=0;do{if(!a)break;var p=Wk(e,a),y=p[0],v=p[1],k=p[2],g=v-k-o*y;(y||g)&&Uk(e,a)&&(f+=g,h+=y);var x=a.parentNode;a=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(c&&Math.abs(f)<1||!c&&Math.abs(h)<1)&&(u=!0),u},Vs=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},vy=function(e){return[e.deltaX,e.deltaY]},xy=function(e){return e&&"current"in e?e.current:e},F_=function(e,t){return e[0]===t[0]&&e[1]===t[1]},V_=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},z_=0,Or=[];function B_(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),i=m.useState(z_++)[0],o=m.useState(Bk)[0],s=m.useRef(e);m.useEffect(function(){s.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var v=l_([e.lockRef.current],(e.shards||[]).map(xy),!0).filter(Boolean);return v.forEach(function(k){return k.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),v.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=m.useCallback(function(v,k){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!s.current.allowPinchZoom;var g=Vs(v),x=n.current,w="deltaX"in v?v.deltaX:x[0]-g[0],S="deltaY"in v?v.deltaY:x[1]-g[1],T,C=v.target,j=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in v&&j==="h"&&C.type==="range")return!1;var P=window.getSelection(),A=P&&P.anchorNode,E=A?A===C||A.contains(C):!1;if(E)return!1;var I=yy(j,C);if(!I)return!0;if(I?T=j:(T=j==="v"?"h":"v",I=yy(j,C)),!I)return!1;if(!r.current&&"changedTouches"in v&&(w||S)&&(r.current=T),!T)return!0;var R=r.current||T;return O_(R,k,v,R==="h"?w:S)},[]),l=m.useCallback(function(v){var k=v;if(!(!Or.length||Or[Or.length-1]!==o)){var g="deltaY"in k?vy(k):Vs(k),x=t.current.filter(function(T){return T.name===k.type&&(T.target===k.target||k.target===T.shadowParent)&&F_(T.delta,g)})[0];if(x&&x.should){k.cancelable&&k.preventDefault();return}if(!x){var w=(s.current.shards||[]).map(xy).filter(Boolean).filter(function(T){return T.contains(k.target)}),S=w.length>0?a(k,w[0]):!s.current.noIsolation;S&&k.cancelable&&k.preventDefault()}}},[]),u=m.useCallback(function(v,k,g,x){var w={name:v,delta:k,target:g,should:x,shadowParent:$_(g)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),c=m.useCallback(function(v){n.current=Vs(v),r.current=void 0},[]),f=m.useCallback(function(v){u(v.type,vy(v),v.target,a(v,e.lockRef.current))},[]),h=m.useCallback(function(v){u(v.type,Vs(v),v.target,a(v,e.lockRef.current))},[]);m.useEffect(function(){return Or.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,Mr),document.addEventListener("touchmove",l,Mr),document.addEventListener("touchstart",c,Mr),function(){Or=Or.filter(function(v){return v!==o}),document.removeEventListener("wheel",l,Mr),document.removeEventListener("touchmove",l,Mr),document.removeEventListener("touchstart",c,Mr)}},[]);var p=e.removeScrollBar,y=e.inert;return m.createElement(m.Fragment,null,y?m.createElement(o,{styles:V_(i)}):null,p?m.createElement(R_,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function $_(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const U_=y_(zk,B_);var Hk=m.forwardRef(function(e,t){return m.createElement(Ol,en({},e,{ref:t,sideCar:U_}))});Hk.classNames=Ol.classNames;var W_=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Fr=new WeakMap,zs=new WeakMap,Bs={},Xu=0,Kk=function(e){return e&&(e.host||Kk(e.parentNode))},H_=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Kk(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},K_=function(e,t,n,r){var i=H_(t,Array.isArray(e)?e:[e]);Bs[n]||(Bs[n]=new WeakMap);var o=Bs[n],s=[],a=new Set,l=new Set(i),u=function(f){!f||a.has(f)||(a.add(f),u(f.parentNode))};i.forEach(u);var c=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(h){if(a.has(h))c(h);else try{var p=h.getAttribute(r),y=p!==null&&p!=="false",v=(Fr.get(h)||0)+1,k=(o.get(h)||0)+1;Fr.set(h,v),o.set(h,k),s.push(h),v===1&&y&&zs.set(h,!0),k===1&&h.setAttribute(n,"true"),y||h.setAttribute(r,"true")}catch(g){console.error("aria-hidden: cannot operate on ",h,g)}})};return c(t),a.clear(),Xu++,function(){s.forEach(function(f){var h=Fr.get(f)-1,p=o.get(f)-1;Fr.set(f,h),o.set(f,p),h||(zs.has(f)||f.removeAttribute(r),zs.delete(f)),p||f.removeAttribute(n)}),Xu--,Xu||(Fr=new WeakMap,Fr=new WeakMap,zs=new WeakMap,Bs={})}},q_=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=W_(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),K_(r,i,n,"aria-hidden")):function(){return null}},Fl="Dialog",[qk]=Ch(Fl),[G_,Ht]=qk(Fl),Gk=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=e,a=m.useRef(null),l=m.useRef(null),[u,c]=w1({prop:r,defaultProp:i??!1,onChange:o,caller:Fl});return d.jsx(G_,{scope:t,triggerRef:a,contentRef:l,contentId:Uu(),titleId:Uu(),descriptionId:Uu(),open:u,onOpenChange:c,onOpenToggle:m.useCallback(()=>c(f=>!f),[c]),modal:s,children:n})};Gk.displayName=Fl;var Yk="DialogTrigger",Y_=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ht(Yk,n),o=Ut(t,i.triggerRef);return d.jsx(ls.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Gh(i.open),...r,ref:o,onClick:_e(e.onClick,i.onOpenToggle)})});Y_.displayName=Yk;var Kh="DialogPortal",[X_,Xk]=qk(Kh,{forceMount:void 0}),Qk=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,o=Ht(Kh,t);return d.jsx(X_,{scope:t,forceMount:n,children:m.Children.map(r,s=>d.jsx(is,{present:n||o.open,children:d.jsx(Th,{asChild:!0,container:i,children:s})}))})};Qk.displayName=Kh;var nl="DialogOverlay",Zk=m.forwardRef((e,t)=>{const n=Xk(nl,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Ht(nl,e.__scopeDialog);return o.modal?d.jsx(is,{present:r||o.open,children:d.jsx(Z_,{...i,ref:t})}):null});Zk.displayName=nl;var Q_=Ok("DialogOverlay.RemoveScroll"),Z_=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ht(nl,n);return d.jsx(Hk,{as:Q_,allowPinchZoom:!0,shards:[i.contentRef],children:d.jsx(ls.div,{"data-state":Gh(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Er="DialogContent",Jk=m.forwardRef((e,t)=>{const n=Xk(Er,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Ht(Er,e.__scopeDialog);return d.jsx(is,{present:r||o.open,children:o.modal?d.jsx(J_,{...i,ref:t}):d.jsx(eL,{...i,ref:t})})});Jk.displayName=Er;var J_=m.forwardRef((e,t)=>{const n=Ht(Er,e.__scopeDialog),r=m.useRef(null),i=Ut(t,n.contentRef,r);return m.useEffect(()=>{const o=r.current;if(o)return q_(o)},[]),d.jsx(eS,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:_e(e.onCloseAutoFocus,o=>{var s;o.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:_e(e.onPointerDownOutside,o=>{const s=o.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&o.preventDefault()}),onFocusOutside:_e(e.onFocusOutside,o=>o.preventDefault())})}),eL=m.forwardRef((e,t)=>{const n=Ht(Er,e.__scopeDialog),r=m.useRef(!1),i=m.useRef(!1);return d.jsx(eS,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,o),o.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var l,u;(l=e.onInteractOutside)==null||l.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=o.target;((u=n.triggerRef.current)==null?void 0:u.contains(s))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),eS=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=e,a=Ht(Er,n),l=m.useRef(null),u=Ut(t,l);return a_(),d.jsxs(d.Fragment,{children:[d.jsx(Lk,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:d.jsx(Eh,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Gh(a.open),...s,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(tL,{titleId:a.titleId}),d.jsx(rL,{contentRef:l,descriptionId:a.descriptionId})]})]})}),qh="DialogTitle",tS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ht(qh,n);return d.jsx(ls.h2,{id:i.titleId,...r,ref:t})});tS.displayName=qh;var nS="DialogDescription",rS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ht(nS,n);return d.jsx(ls.p,{id:i.descriptionId,...r,ref:t})});rS.displayName=nS;var iS="DialogClose",oS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ht(iS,n);return d.jsx(ls.button,{type:"button",...r,ref:t,onClick:_e(e.onClick,()=>i.onOpenChange(!1))})});oS.displayName=iS;function Gh(e){return e?"open":"closed"}var sS="DialogTitleWarning",[N5,aS]=cA(sS,{contentName:Er,titleName:qh,docsSlug:"dialog"}),tL=({titleId:e})=>{const t=aS(sS),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return m.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},nL="DialogDescriptionWarning",rL=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${aS(nL).contentName}}.`;return m.useEffect(()=>{var o;const i=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},iL=Gk,oL=Qk,lS=Zk,uS=Jk,cS=tS,fS=rS,sL=oS;const dS=iL,aL=oL,hS=m.forwardRef(({className:e,...t},n)=>d.jsx(lS,{className:q("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));hS.displayName=lS.displayName;const lL=Ah("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Yh=m.forwardRef(({side:e="right",className:t,children:n,...r},i)=>d.jsxs(aL,{children:[d.jsx(hS,{}),d.jsxs(uS,{ref:i,className:q(lL({side:e}),t),...r,children:[d.jsxs(sL,{className:"absolute right-4 top-4 flex h-8 w-8 min-h-0 items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[d.jsx(jt,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Close"})]}),n]})]}));Yh.displayName=uS.displayName;const pS=({className:e,...t})=>d.jsx("div",{className:q("flex flex-col space-y-2 text-center sm:text-left",e),...t});pS.displayName="SheetHeader";const mS=m.forwardRef(({className:e,...t},n)=>d.jsx(cS,{ref:n,className:q("text-lg font-semibold text-foreground",e),...t}));mS.displayName=cS.displayName;const uL=m.forwardRef(({className:e,...t},n)=>d.jsx(fS,{ref:n,className:q("text-sm text-muted-foreground",e),...t}));uL.displayName=fS.displayName;function gS({onRemember:e,onDontRemember:t}){return d.jsxs("div",{className:"flex flex-col gap-3",children:[d.jsx("span",{className:"text-lg font-bold",children:"face id isn't supported here"}),d.jsx("p",{className:"text-muted-foreground text-sm",children:"this device doesn't support face id / touch id unlock. you can choose not to remember your token, so you'll enter it each time you open khayal (e.g. from your password manager)."}),d.jsx(wn,{onClick:t,children:"don't remember my token"}),d.jsx(wn,{variant:"ghost",onClick:e,children:"remember my token"})]})}function cL({onSetupPrf:e,onRemember:t,onDontRemember:n}){const[r,i]=m.useState("checking");m.useEffect(()=>{let s=!1;return lk().then(a=>{s||i(a?"prf":"noauth")}),()=>{s=!0}},[]);const o=async()=>{i("working"),await e()||i("noauth")};return r==="checking"||r==="working"?d.jsx("div",{className:"flex flex-col gap-3 p-6 items-center text-center",children:d.jsx("span",{className:"text-lg font-bold",children:r==="checking"?"checking your device...":"waiting for biometrics..."})}):r==="noauth"?d.jsx("div",{className:"p-6",children:d.jsx(gS,{onRemember:t,onDontRemember:n})}):d.jsxs("div",{className:"flex flex-col gap-3 p-6",children:[d.jsx("span",{className:"text-lg font-bold",children:"secure this device?"}),d.jsx("p",{className:"text-muted-foreground text-sm",children:"require face id / touch id to open khayal on this device. you can turn this on or off anytime in the security sheet."}),d.jsx("p",{className:"text-muted-foreground text-xs opacity-70",children:"protects against casual access to an unlocked device — not a fully compromised device. if you lose this device's face id, you can always reconnect using your server token; nothing is deleted."}),d.jsx(wn,{onClick:o,children:"set up face id"}),d.jsx(wn,{variant:"ghost",onClick:t,children:"skip for now"})]})}function fL({open:e,onOpenChange:t}){const{lockMode:n,setupPrf:r,disable:i,setTokenPersistence:o}=st(),{toast:s}=rs(),[a,l]=m.useState("idle"),[u,c]=m.useState(""),[f,h]=m.useState(!1);m.useEffect(()=>{e||(l("idle"),c(""),h(!1))},[e]);const p=async()=>{l("working"),c(""),await r()?(l("idle"),s({title:"Lock enabled"})):l("choice")},y=()=>{o(!0),l("idle"),s({title:"Token will be remembered"})},v=()=>{o(!1),l("idle"),s({title:"Token will not be remembered"})},k=async()=>{h(!0),c("");const g=await i();h(!1),g?s({title:"Lock disabled"}):c("couldn't verify. lock stays on.")};return d.jsx(dS,{open:e,onOpenChange:t,children:d.jsxs(Yh,{side:"bottom",children:[d.jsx(pS,{children:d.jsx(mS,{children:"security"})}),n==="none"&&d.jsxs(d.Fragment,{children:[a==="idle"&&d.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[d.jsx("p",{className:"text-muted-foreground text-sm",children:"khayal is not locked on this device."}),d.jsx(wn,{onClick:p,children:"set up face id"})]}),a==="working"&&d.jsx("p",{className:"text-sm text-muted-foreground text-center pt-2",children:"waiting for biometrics..."}),a==="choice"&&d.jsx("div",{className:"pt-2",children:d.jsx(gS,{onRemember:y,onDontRemember:v})})]}),n==="prf"&&d.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm",children:"require face id to open"}),d.jsx(_k,{checked:!0,onCheckedChange:g=>{g||k()}})]}),f&&d.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"verifying..."}),u&&d.jsx("p",{className:"text-sm text-destructive text-center",children:u})]})]})})}function dL(){var h,p;const{status:e,health:t}=YI(),{lockMode:n,lock:r}=st(),[i,o]=m.useState(!1),[s,a]=m.useState(!1),l=()=>{localStorage.removeItem(ke.TOKEN),n!=="none"?(r(),a(!1)):window.location.reload()},u=(t==null?void 0:t.version)||TI,c=(h=t==null?void 0:t.update)==null?void 0:h.available,f=e==="ok"?"#3ddc84":e==="degraded"?"#ffb340":"#ff4d4d";return d.jsxs("header",{className:"hdr",children:[d.jsxs("div",{className:"brand",children:[d.jsx("img",{src:"/icon.svg",alt:"khayal",className:"mark"}),d.jsxs("span",{className:"bname",children:["khayal",d.jsxs("span",{className:"ver",children:["v",u]})]}),c&&d.jsx("a",{href:NI,target:"_blank",rel:"noopener noreferrer",title:`update to v${(p=t==null?void 0:t.update)==null?void 0:p.latest}`,children:d.jsx(L2,{size:14,className:"update-icon"})})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[s?d.jsxs("div",{className:"flex items-center gap-1.5","data-testid":"logout-confirm",children:[d.jsx("span",{className:"text-[10px] font-mono whitespace-nowrap",style:{color:"rgba(245,169,169,0.8)"},children:"lock out?"}),d.jsx("button",{onClick:l,className:"flex items-center justify-center w-6 h-6 min-h-0 rounded-md",style:{color:"#f5a9a9",background:"rgba(255,99,99,0.08)",border:"1px solid rgba(255,99,99,0.25)"},title:"confirm logout","aria-label":"confirm logout","data-testid":"logout-go",children:d.jsx(ty,{size:12})}),d.jsx("button",{onClick:()=>a(!1),className:"flex items-center justify-center w-6 h-6 min-h-0 rounded-md text-[rgba(245,245,245,0.3)] hover:text-[rgba(245,245,245,0.6)] transition-colors",title:"cancel","aria-label":"cancel logout","data-testid":"logout-cancel",children:d.jsx(jt,{size:12})})]}):d.jsx("button",{onClick:()=>a(!0),className:"flex items-center justify-center w-6 h-6 min-h-0 rounded-md text-[rgba(245,245,245,0.4)] hover:text-[rgba(245,169,169,0.9)] transition-colors",title:"logout","aria-label":"logout","data-testid":"logout-trigger",children:d.jsx(ty,{size:14})}),d.jsx("button",{onClick:()=>o(!0),className:"flex items-center justify-center w-6 h-6 min-h-0 rounded-md text-[rgba(245,245,245,0.4)] hover:text-[rgba(245,245,245,0.8)] transition-colors",title:"security","aria-label":"security",children:d.jsx($2,{size:14})}),d.jsx("div",{className:"online",style:{background:f,boxShadow:e==="ok"?`0 0 8px ${f}`:"none"}})]}),d.jsx(fL,{open:i,onOpenChange:o})]})}const hL=[{id:"capture",label:"capture",icon:z2},{id:"search",label:"search",icon:no},{id:"queue",label:"queue",icon:F2}];function pL({activeTab:e,onTabChange:t}){return d.jsx("nav",{className:"nav",children:hL.map(n=>{const r=n.icon,i=e===n.id;return d.jsxs("div",{onClick:()=>t(n.id),className:q("nt",i&&"on"),children:[d.jsx(r,{}),i?d.jsx(Ae.div,{layoutId:"navIndicator",className:"w-5 h-0.5 rounded-full",style:{background:"#C9933A"},transition:{type:"spring",stiffness:380,damping:30}}):d.jsx("div",{className:"w-5 h-0.5"}),d.jsx("span",{className:"nt-l",children:n.label})]},n.id)})})}const mL=m.forwardRef(function({onSubmit:t,loading:n,initialContent:r},i){const o=m.useRef(null);m.useEffect(()=>{r&&o.current&&(o.current.value=r,o.current.selectionStart=o.current.value.length,o.current.selectionEnd=o.current.value.length)},[r]),m.useImperativeHandle(i,()=>({submit:async()=>{var l;const a=((l=o.current)==null?void 0:l.value)||"";a.trim()&&(await t(a),o.current&&(o.current.value=""))},getContent:()=>{var a;return((a=o.current)==null?void 0:a.value)||""}}));const s=a=>{var l;if(a.key==="Enter"&&(a.metaKey||a.ctrlKey)){a.preventDefault();const u=((l=o.current)==null?void 0:l.value)||"";u.trim()&&t(u).then(()=>{o.current&&(o.current.value="")})}};return d.jsx("textarea",{ref:o,placeholder:"what's on your mind...",onKeyDown:s,disabled:n,className:"w-full h-full resize-none bg-transparent text-[17px] font-light text-[#f5f5f5] placeholder-[rgba(245,245,245,0.2)] outline-none leading-relaxed",style:{fontFamily:"'Bricolage Grotesque', sans-serif"}})});function gL(e){try{return new URL(e).hostname}catch{return""}}const yL=m.forwardRef(function({onSubmit:t,loading:n},r){const[i,o]=m.useState(""),s=m.useRef(null);m.useEffect(()=>{var u;(u=s.current)==null||u.focus()},[]),m.useImperativeHandle(r,()=>({submit:async()=>{i.trim()&&(await t(i),o(""))}}));const a=u=>{u.key==="Enter"&&(u.preventDefault(),i.trim()&&t(i).then(()=>o("")))},l=gL(i);return d.jsxs("div",{className:"flex flex-col gap-3",children:[d.jsxs("div",{className:"url-row",children:[d.jsx(K1,{}),d.jsx("input",{ref:s,type:"url",placeholder:"https://example.com/article",value:i,onChange:u=>o(u.target.value),onKeyDown:a,disabled:n,className:"url-val bg-transparent outline-none"})]}),i&&l&&d.jsxs("div",{className:"url-preview",children:[d.jsx("div",{className:"url-thumb",children:d.jsx(H1,{className:"w-5 h-5",style:{color:"rgba(201,147,58,0.4)"}})}),d.jsxs("div",{className:"url-info",children:[d.jsx("div",{className:"url-domain",children:l}),d.jsx("div",{className:"url-title",children:"Extracting content..."})]})]}),d.jsx("div",{className:"note-input",children:d.jsx("input",{type:"text",placeholder:"add a note... (optional)",className:"w-full bg-transparent text-base text-[rgba(245,245,245,0.3)] placeholder-[rgba(245,245,245,0.2)] outline-none",style:{fontWeight:300}})})]})});function vL(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}const xL=m.forwardRef(function({onUpload:t},n){const[r,i]=m.useState(null),[o,s]=m.useState(""),[a,l]=m.useState(null),u=m.useRef(null);m.useImperativeHandle(n,()=>({submit:async()=>{r&&(await t(r,o),i(null),s(""),l(null))}}));const c=h=>{var y;const p=(y=h.target.files)==null?void 0:y[0];if(p){i(p);const v=new FileReader;v.onload=k=>{var g;return l((g=k.target)==null?void 0:g.result)},v.readAsDataURL(p)}},f=()=>{i(null),l(null),u.current&&(u.current.value="")};return d.jsxs("div",{className:"flex flex-col gap-3",children:[d.jsx("input",{ref:u,type:"file",accept:"image/*",onChange:c,className:"hidden"}),a?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"img-filled",children:[d.jsx("img",{src:a,alt:"preview",className:"w-full h-full object-cover",style:{position:"absolute",inset:0}}),d.jsxs("div",{className:"img-overlay",children:[d.jsx("span",{className:"img-name",children:r==null?void 0:r.name}),d.jsx("span",{className:"img-size",children:r?vL(r.size):""}),d.jsx("div",{className:"img-rm",onClick:f,children:d.jsx(jt,{className:"w-3 h-3"})})]})]}),d.jsx("div",{className:"note-input",children:d.jsx("input",{type:"text",placeholder:"add a note...",className:"w-full bg-transparent text-base text-[rgba(245,245,245,0.3)] placeholder-[rgba(245,245,245,0.2)] outline-none",style:{fontWeight:300},value:o,onChange:h=>s(h.target.value)})})]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"img-drop",onClick:()=>{var h;return(h=u.current)==null?void 0:h.click()},children:[d.jsx("div",{className:"img-drop-icon",children:d.jsx(W1,{className:"w-5 h-5",style:{color:"#C9933A"}})}),d.jsx("div",{className:"img-drop-lbl",children:"tap to choose"}),d.jsx("div",{className:"img-drop-sub",children:"jpg · png · webp · heic"})]}),d.jsxs("div",{className:"img-or",children:[d.jsx("div",{className:"img-or-line"}),d.jsx("span",{className:"img-or-txt",children:"OR"}),d.jsx("div",{className:"img-or-line"})]}),d.jsxs("div",{className:"cam-btn",onClick:()=>{var h;return(h=u.current)==null?void 0:h.click()},children:[d.jsx(M2,{className:"w-4 h-4",style:{color:"rgba(245,245,245,0.5)"}}),d.jsx("span",{className:"cam-txt",children:"open camera"})]})]})]})});function wL(e){return Of[e]||Of.text}function kL(e){const t=e.split("·").map(n=>n.trim());return t.length>=2?{code:t[0],message:t.slice(1).join(" · ")}:{code:"ERR",message:e}}function SL({result:e,processingTime:t,onDismiss:n}){const r=t?`${e.type} · ${t}ms`:e.type;return d.jsxs("div",{className:"tile tile-ok",children:[d.jsx("div",{className:"icon-ok",children:d.jsx($1,{className:"w-4 h-4",style:{color:"#3ddc84"}})}),d.jsxs("div",{className:"tile-inner",children:[d.jsxs("div",{className:"tile-top",children:[d.jsx("span",{className:"tile-title",children:"saved"}),d.jsx("div",{className:"tile-dismiss",onClick:n,children:d.jsx(jt,{className:"w-2 h-2"})})]}),d.jsx("div",{className:"tile-sub",children:r}),e.note_path&&d.jsx("div",{className:"tile-sub",style:{opacity:.5},children:e.note_path}),d.jsx("div",{className:"tile-bar",children:d.jsx("div",{className:"tile-bar-fill"})})]})]})}function bL({result:e,onDismiss:t}){const n=wL(e.type),r=1;return d.jsxs("div",{className:"tile tile-q",children:[d.jsx("div",{className:"icon-q",children:d.jsx(V2,{className:"w-4 h-4",style:{color:"#ffb340"}})}),d.jsxs("div",{className:"tile-inner",children:[d.jsxs("div",{className:"tile-top",children:[d.jsx("span",{className:"tile-title",children:"queued"}),d.jsx("div",{className:"tile-dismiss",onClick:t,children:d.jsx(jt,{className:"w-2 h-2"})})]}),d.jsxs("div",{className:"tile-sub",children:[e.note_path||e.type," · ",e.id.slice(0,8)]}),d.jsx("div",{className:"steps",children:n.map((i,o)=>d.jsxs("span",{children:[d.jsx("div",{className:`sd ${o0?t/n:1,a=o*(1-Math.min(s,1)),l=new Date().getDay(),u=l===0?6:l-1;return d.jsxs("div",{className:"bt bt-streak",children:[d.jsx("div",{className:"lbl",children:"streak"}),d.jsxs("div",{className:"streak-body",children:[d.jsxs("div",{className:"arc",children:[d.jsxs("svg",{viewBox:"0 0 58 58",children:[d.jsx("circle",{fill:"none",stroke:"rgba(255,255,255,0.05)",strokeWidth:"5",strokeLinecap:"round",cx:"29",cy:"29",r:"23",transform:"rotate(-90 29 29)"}),d.jsx("circle",{fill:"none",stroke:"url(#streakGrad)",strokeWidth:"5",strokeLinecap:"round",cx:"29",cy:"29",r:"23",strokeDasharray:o,strokeDashoffset:a,transform:"rotate(-90 29 29)"}),d.jsx("defs",{children:d.jsxs("linearGradient",{id:"streakGrad",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[d.jsx("stop",{offset:"0%",stopColor:"#C9933A"}),d.jsx("stop",{offset:"100%",stopColor:"#E8B86D"})]})})]}),d.jsxs("div",{className:"arc-center",children:[d.jsx("span",{className:"arc-n",children:t}),d.jsx("span",{className:"arc-u",children:"days"})]})]}),d.jsxs("div",{className:"streak-right",children:[d.jsx("div",{className:"streak-num",children:t}),d.jsx("div",{className:"streak-unit",children:"day streak"}),r>0&&d.jsxs("div",{className:"streak-goal",children:[r," days to ",n]})]})]}),d.jsx("div",{className:"week-dots",children:i.map((c,f)=>d.jsx("div",{className:`wd ${f===u?c?"today":"off":c?"on":"off"}`},f))})]})}function jL({stats:e}){const{count:t,by_hour:n,avg_per_day:r}=e.today,i=new Date().getHours(),o=Math.max(...n,1);return d.jsxs("div",{className:"bt",children:[d.jsx("div",{className:"lbl",children:"today"}),d.jsx("div",{className:"today-num",children:t}),d.jsx("div",{className:"today-sub",children:"captures"}),d.jsx("div",{className:"hours",children:n.map((s,a)=>{const l=s>0?Math.max(s/o*100,8):8,u=a===i,c=s>0&&s===o,f=s===0;let h="hb";return f?h+=" empty":u?h+=" now":c&&(h+=" hi"),d.jsx("div",{className:h,style:{height:`${l}%`}},a)})}),d.jsxs("div",{className:"today-footer",children:[d.jsxs("span",{className:"tf-stat",children:["avg ",d.jsxs("span",{children:[r.toFixed(1),"/day"]})]}),d.jsxs("span",{className:"tf-stat",children:["last ",d.jsx("span",{children:NL(e.vault.last_capture_at)})]})]})]})}function RL({stats:e}){const{total_notes:t,today_delta:n,last_7_days:r}=e.vault,i=Math.max(...r,1);return d.jsxs("div",{className:"bt wide",children:[d.jsx("div",{className:"lbl",children:"vault"}),d.jsxs("div",{className:"vault-inner",children:[d.jsxs("div",{children:[d.jsx("div",{className:"vault-num",children:t.toLocaleString()}),d.jsx("div",{className:"vault-unit",children:"notes"}),n>0&&d.jsxs("div",{className:"vault-delta",children:["+",n," today"]})]}),d.jsx("div",{className:"vault-center",children:d.jsxs("div",{className:"vc-stat",children:["last 7d",d.jsx("span",{children:r.reduce((o,s)=>o+s,0)})]})}),d.jsx("div",{className:"spark",children:r.map((o,s)=>{const a=o>0?Math.max(o/i*100,8):8,l=s===6;return d.jsx("div",{className:`sb-bar ${l?"today":"prev"}`,style:{height:`${a}%`}},s)})})]})]})}function AL({stats:e,loading:t}){return t?d.jsxs("div",{className:"bento",children:[d.jsx("div",{className:"bt animate-shimmer",style:{height:140}}),d.jsx("div",{className:"bt animate-shimmer",style:{height:140}}),d.jsx("div",{className:"bt wide animate-shimmer",style:{height:80}})]}):e?d.jsxs("div",{className:"bento",children:[d.jsx(PL,{stats:e}),d.jsx(jL,{stats:e}),d.jsx(RL,{stats:e})]}):d.jsxs("div",{className:"bento",children:[d.jsxs("div",{className:"bt",children:[d.jsx("div",{className:"lbl",children:"streak"}),d.jsx("div",{className:"streak-num",children:"0"}),d.jsx("div",{className:"streak-unit",children:"day streak"})]}),d.jsxs("div",{className:"bt",children:[d.jsx("div",{className:"lbl",children:"today"}),d.jsx("div",{className:"today-num",children:"0"}),d.jsx("div",{className:"today-sub",children:"captures"})]}),d.jsxs("div",{className:"bt wide",children:[d.jsx("div",{className:"lbl",children:"vault"}),d.jsx("div",{className:"vault-num",children:"0"}),d.jsx("div",{className:"vault-unit",children:"notes"})]})]})}function IL(){const{token:e,session:t}=st(),[n,r]=m.useState(!1),[i,o]=m.useState(null),[s,a]=m.useState(null),[l,u]=m.useState(void 0),[c,f]=m.useState(!1),[h,p]=m.useState(void 0);return{loading:n,result:i,error:s,errorCode:l,isOffline:c,processingTime:h,capture:async(g,x)=>{r(!0),a(null),u(void 0),o(null),f(!1),p(void 0);const w=performance.now();try{if(!navigator.onLine){await sy({type:g,content:x},t),f(!0),p(Math.round(performance.now()-w));return}const T=await Ct(e).capture({type:g,content:x});p(Math.round(performance.now()-w)),o(T)}catch(S){p(Math.round(performance.now()-w)),S instanceof Error&&S.message.includes("fetch")?(await sy({type:g,content:x},t),f(!0)):a(S instanceof Error?S.message:"Capture failed")}finally{r(!1)}},uploadImage:async(g,x)=>{r(!0),a(null),u(void 0),o(null),f(!1),p(void 0);const w=performance.now();try{if(!navigator.onLine){a("Image upload requires connection"),p(Math.round(performance.now()-w));return}const T=await Ct(e).uploadImage(g,x);p(Math.round(performance.now()-w)),o(T)}catch(S){p(Math.round(performance.now()-w)),a(S instanceof Error?S.message:"Upload failed")}finally{r(!1)}},clear:()=>{o(null),a(null),u(void 0),f(!1),p(void 0)}}}function DL(e=Lh.STATS_POLL){const{token:t}=st(),[n,r]=m.useState(null),[i,o]=m.useState(!0),s=m.useCallback(async()=>{try{const l=await Ct(t).stats();r(l)}catch{}finally{o(!1)}},[t]);return m.useEffect(()=>{s();const a=setInterval(s,e);return()=>clearInterval(a)},[s,e]),{stats:n,loading:i,refresh:s}}function _L(){const e=new Date().getHours();for(const t of Fu)if(e{e&&(r("text"),o(e),t==null||t())},[e,t]),m.useEffect(()=>{if(a||c){const E=setTimeout(()=>y(),Lh.CAPTURE_DISMISS);return()=>clearTimeout(E)}},[a,c,y]);const T=async E=>{await h(n,E),o(void 0)},C=async(E,I)=>{await p(E,I)},j=()=>{var E,I,R;switch(n){case"text":(E=g.current)==null||E.submit();break;case"url":(I=x.current)==null||I.submit();break;case"image":(R=w.current)==null||R.submit();break}},P=m.useCallback(()=>{y()},[y]),A=()=>{switch(n){case"text":return"cmd+enter to capture";case"url":return"article · will extract content";case"image":return"image · will be describe"}};return d.jsxs("div",{className:"cap-body",children:[d.jsx("div",{className:"cap-greeting",children:_L()}),d.jsx(AL,{stats:v,loading:k}),d.jsxs("div",{className:"compose",children:[d.jsxs("div",{className:"pills",children:[d.jsx("span",{className:q("tp",n==="text"&&"on"),onClick:()=>r("text"),children:"txt"}),d.jsx("span",{className:q("tp",n==="url"&&"on"),onClick:()=>r("url"),children:"url"}),d.jsx("span",{className:q("tp",n==="image"&&"on"),onClick:()=>r("image"),children:"img"})]}),d.jsx("div",{className:"flex-1 min-h-0",children:d.jsx(Wo,{mode:"wait",children:d.jsxs(Ae.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"h-full",children:[n==="text"&&d.jsx(mL,{ref:g,onSubmit:T,loading:s,initialContent:i}),n==="url"&&d.jsx(yL,{ref:x,onSubmit:T,loading:s}),n==="image"&&d.jsx(xL,{ref:w,onUpload:C,loading:s})]},n)})}),d.jsxs("div",{className:"footer",children:[d.jsx("span",{className:"hint",children:A()}),d.jsx("button",{className:"send",onClick:j,disabled:s,children:d.jsx(B2,{className:"w-4 h-4",style:{color:"#000"}})})]})]}),d.jsx(Wo,{mode:"wait",children:S&&d.jsx(Ae.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},transition:{duration:.2,ease:"easeOut"},children:d.jsx(TL,{result:a,error:l,errorCode:u,isOffline:c,processingTime:f,onDismiss:y,onRetry:P})},"tile")})]})}function LL(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return e}}function ML(e){switch(e){case"text":return"rb-t";case"article":return"rb-a";case"image":return"rb-t";default:return"rb-t"}}function ky(e,t){if(!t||!e)return e;const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`(${n})`,"gi");return e.split(r).map((o,s)=>r.test(o)?d.jsx("span",{className:"hl",children:o},s):o)}function OL({result:e,query:t,onSelect:n}){var r;return d.jsxs("div",{className:"r1",onClick:()=>n==null?void 0:n(e.note_path),children:[d.jsx("div",{className:"r1-ghost",children:"1"}),d.jsx("div",{className:"r1-title",children:ky(e.title||e.note_path,t)}),d.jsxs("div",{className:"r1-meta",children:[d.jsx("span",{className:"rdate",children:LL(e.created_at)}),d.jsx("span",{className:`rb ${ML(e.type)}`,children:e.type}),(r=e.tags)==null?void 0:r.slice(0,Cr.TAGS_HERO).map(i=>d.jsxs("span",{className:"rb rb-tag",children:["#",i]},i))]}),d.jsx("div",{className:"r1-ex",children:ky(e.excerpt,t)})]})}function FL(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return e}}function VL(e){switch(e){case"text":return"rb-t";case"article":return"rb-a";case"image":return"rb-t";default:return"rb-t"}}function zL(e,t){if(!t||!e)return e;const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`(${n})`,"gi");return e.split(r).map((o,s)=>r.test(o)?d.jsx("span",{className:"hl",children:o},s):o)}function BL({result:e,rank:t,query:n,onSelect:r}){var i,o;return d.jsxs("div",{className:"rc",onClick:()=>r==null?void 0:r(e.note_path),children:[d.jsx("span",{className:"rc-n",children:t}),d.jsxs("div",{className:"rc-body",children:[d.jsx("div",{className:"rc-title",children:zL(e.title||e.note_path,n)}),d.jsxs("div",{className:"rc-meta",children:[d.jsx("span",{className:"rdate",children:FL(e.created_at)}),d.jsx("span",{className:`rb ${VL(e.type)}`,children:e.type}),(o=(i=e.tags)==null?void 0:i.slice(0,Cr.TAGS_COMPACT))==null?void 0:o.map(s=>d.jsxs("span",{className:"rb rb-tag",children:["#",s]},s))]})]}),d.jsx("span",{className:"rc-score",children:e.score.toFixed(2)})]})}function $L(){const{token:e}=st(),[t,n]=m.useState(!1),[r,i]=m.useState(null),[o,s]=m.useState(null),a=m.useCallback(async(u,c={})=>{if(!u.trim()){i(null);return}n(!0),s(null);try{const h=await Ct(e).search(u,{mode:"hybrid",limit:Cr.SEARCH_RESULTS,...c});i(h)}catch(f){s(f instanceof Error?f.message:"Search failed")}finally{n(!1)}},[e]);return{loading:t,results:r,error:o,search:a,clear:()=>{i(null),s(null)}}}function UL(){const{token:e}=st(),[t,n]=m.useState("idle"),[r,i]=m.useState(null),o=m.useCallback(async(a,l)=>{if(a.trim()){n("loading"),i(null);try{const c=await Ct(e).search(a,{mode:l,overview:!0});c.overview?(i(c.overview),n("ready")):n("error")}catch{n("error")}}},[e]),s=m.useCallback(()=>{n("idle"),i(null)},[]);return{state:t,overview:r,ask:o,reset:s}}function WL({text:e,onCitationClick:t}){const n=e.split(/(\[\d+\])/g);return d.jsx(d.Fragment,{children:n.map((r,i)=>{const o=r.match(/^\[(\d+)\]$/);if(o){const s=parseInt(o[1],10)-1;return d.jsxs("button",{className:"ai-cite",onClick:a=>{a.stopPropagation(),t(s)},title:`jump to source ${s+1}`,children:["[",s+1,"]"]},i)}return d.jsx("span",{children:r},i)})})}function HL({state:e,expanded:t,overview:n,onAsk:r,onToggle:i,onRetry:o,onClose:s,onCitationClick:a}){const l=e==="loading",u=e==="ready"&&n!==null,c=()=>{!t&&e==="idle"?r():i()},f=l?"Thinking":u?"AI answer":"AI Answer";return d.jsxs("div",{className:q("ai-row",t&&"open"),"data-testid":"ai-answer-row",children:[d.jsxs("button",{className:"ai-row-head",onClick:c,"data-testid":"ai-answer-trigger",children:[d.jsx(q1,{className:q("w-3.5 h-3.5 ai-spark",l&&"spin")}),d.jsx("span",{className:"ai-row-label",children:f}),d.jsx(U1,{className:q("w-3 h-3 ai-chevron",t&&"up")})]}),d.jsx(Wo,{initial:!1,children:t&&d.jsx(Ae.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.32,ease:[.4,0,.2,1]},style:{overflow:"hidden"},children:d.jsxs("div",{className:"ai-row-body","data-testid":l?"ai-answer-skeleton":e==="error"?"ai-answer-error":"ai-answer",children:[l&&d.jsxs("div",{className:"ai-skel-lines",children:[d.jsx("div",{className:"animate-shimmer ai-skel w-11/12"}),d.jsx("div",{className:"animate-shimmer ai-skel w-full"}),d.jsx("div",{className:"animate-shimmer ai-skel w-4/5"}),d.jsx("div",{className:"animate-shimmer ai-skel w-2/3"})]}),e==="error"&&d.jsxs("div",{className:"ai-error-line",children:[d.jsx("span",{className:"ai-text dim",children:"The answer engine didn’t respond. Your results are unaffected."}),d.jsxs("div",{className:"ai-actions",children:[d.jsxs("button",{className:"ai-action",onClick:h=>{h.stopPropagation(),o()},title:"try again",children:[d.jsx(Za,{className:"w-3 h-3"}),"retry"]}),d.jsx("button",{className:"ai-action",onClick:h=>{h.stopPropagation(),s()},title:"dismiss",children:d.jsx(jt,{className:"w-3 h-3"})})]})]}),u&&n&&d.jsxs(d.Fragment,{children:[d.jsx("p",{className:"ai-text",children:d.jsx(WL,{text:n.text,onCitationClick:a})}),d.jsxs("div",{className:"ai-actions ai-foot",children:[d.jsx("button",{className:"ai-action",onClick:h=>{h.stopPropagation(),o()},title:"regenerate",children:d.jsx(Za,{className:"w-3 h-3"})}),d.jsx("button",{className:"ai-action",onClick:h=>{h.stopPropagation(),s()},title:"dismiss",children:d.jsx(jt,{className:"w-3 h-3"})})]})]})]})},"body")})]})}const Xh=ke.RECENT_SEARCHES,KL=Cr.RECENT_SEARCHES,qL=PI;function xo(){try{const e=localStorage.getItem(Xh);return e?JSON.parse(e):[]}catch{return[]}}function GL(e){try{const n=xo().filter(i=>i.toLowerCase()!==e.toLowerCase()),r=[e,...n].slice(0,KL);localStorage.setItem(Xh,JSON.stringify(r))}catch{}}function YL(e){try{const n=xo().filter(r=>r.toLowerCase()!==e.toLowerCase());localStorage.setItem(Xh,JSON.stringify(n))}catch{}}function XL({onCaptureQuery:e,onNoteSelect:t,deletedPaths:n}={}){const[r,i]=m.useState(""),[o,s]=m.useState(""),[a,l]=m.useState("hybrid"),[u,c]=m.useState("all"),[f,h]=m.useState(xo),{loading:p,results:y,error:v,search:k}=$L(),g=UL(),[x,w]=m.useState(!1),{toast:S}=rs();m.useEffect(()=>{v&&S({title:"Search failed",description:v,variant:"destructive"})},[v,S]);const T=m.useCallback((_,b)=>{const W=_.trim();W&&(i(W),s(W),g.reset(),w(!1),l(b||a),k(W,{mode:b||a}),GL(W),h(xo()))},[k,a]),C=m.useCallback(()=>{i(""),s(""),c("all"),g.reset(),w(!1),k("")},[k,g]),j=m.useCallback(_=>{l(_);const b=r.trim();b&&(s(b),i(b),k(b,{mode:_}))},[r,k]),P=m.useCallback((_,b)=>{b.stopPropagation(),YL(_),h(xo())},[]),A=m.useCallback(_=>{t==null||t(_,o)},[t,o]),E=m.useCallback(()=>{!K||!o.trim()||(g.ask(o,a),w(!0))},[g,a,o]),I=m.useCallback(()=>{g.reset(),w(!1)},[g]),R=m.useCallback(_=>{var b;(b=document.getElementById(`result-${_}`))==null||b.scrollIntoView({behavior:"smooth",block:"center"})},[]),z=m.useMemo(()=>{if(!(y!=null&&y.results))return null;let _=y.results;return n&&n.length>0&&(_=_.filter(b=>!n.includes(b.note_path))),u==="all"?_:_.filter(b=>b.type===u)},[y,u,n]),F=o.length>0,B=r.trim().length>0,K=z&&z.length>0,ne=!p&&F&&y&&y.results&&y.results.length===0,L=!p&&F&&y&&y.results&&y.results.length>0&&z&&z.length===0;return d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsxs("div",{className:"srch-area",children:[d.jsxs("div",{className:q("srch-bar",B&&"active"),children:[d.jsx(no,{}),d.jsx("input",{type:"text",placeholder:"Search your vault...",value:r,onChange:_=>_.target.value?i(_.target.value):C(),onKeyDown:_=>{const b=r.trim();_.key==="Enter"&&b&&T(r.trim())},className:"srch-val bg-transparent outline-none",style:{fontFamily:"'Bricolage Grotesque', sans-serif"}}),B?d.jsx("div",{className:"srch-clear",onClick:C,children:d.jsx(jt,{className:"w-2.5 h-2.5"})}):null]}),d.jsxs("div",{className:"modes",children:[d.jsx("span",{className:q("mc",a==="hybrid"&&"on"),onClick:()=>j("hybrid"),children:"hybrid"}),d.jsx("span",{className:q("mc",a==="keyword"&&"on"),onClick:()=>j("keyword"),children:"keyword"}),d.jsx("span",{className:q("mc",a==="semantic"&&"on"),onClick:()=>j("semantic"),children:"semantic"})]})]}),d.jsxs(Wo,{mode:"wait",children:[p&&d.jsx(Ae.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"results",children:[1,2,3].map(_=>d.jsx("div",{className:"animate-shimmer rounded-lg h-24"},_))},"loading"),ne&&d.jsxs(Ae.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"no-results",children:[d.jsx("div",{className:"nr-icon",children:d.jsx(_2,{className:"w-5 h-5",style:{color:"rgba(245,245,245,0.3)"}})}),d.jsx("div",{className:"nr-title",children:"nothing found"}),d.jsxs("div",{className:"nr-sub",children:["no notes match",d.jsx("br",{}),"“",o,"”"]}),d.jsxs("div",{className:"nr-suggestions",children:[d.jsx("div",{className:"recent-lbl",children:"try instead"}),a!=="keyword"&&d.jsxs("div",{className:"nr-sug",onClick:()=>T(r,"keyword"),children:[d.jsx(no,{className:"w-3.5 h-3.5",style:{color:"rgba(245,245,245,0.2)"}}),d.jsx("span",{className:"nr-sug-txt",children:o}),d.jsx("span",{className:"nr-sug-mode",children:"keyword"})]}),a!=="semantic"&&d.jsxs("div",{className:"nr-sug",onClick:()=>T(r,"semantic"),children:[d.jsx(no,{className:"w-3.5 h-3.5",style:{color:"rgba(245,245,245,0.2)"}}),d.jsx("span",{className:"nr-sug-txt",children:o}),d.jsx("span",{className:"nr-sug-mode",children:"semantic"})]}),d.jsxs("div",{className:"nr-sug capture",onClick:()=>{e==null||e(o)},children:[d.jsx("span",{style:{fontSize:14,color:"#C9933A"},children:"+"}),d.jsx("span",{className:"nr-sug-txt",children:"capture a note about this"})]})]})]},"no-results"),L&&y&&d.jsxs(Ae.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[d.jsxs("div",{className:"results-header",children:[d.jsxs("div",{className:"rh-row",children:[d.jsx("span",{className:"rh-count",children:"0 results"}),d.jsxs("span",{className:"rh-ms",children:[y.took_ms,"ms"]})]}),d.jsxs("div",{className:"filter-chips",children:[d.jsx("span",{className:q("fc",u==="all"&&"on"),onClick:()=>c("all"),children:"all"}),d.jsx("span",{className:q("fc",u==="text"&&"on"),onClick:()=>c("text"),children:"text"}),d.jsx("span",{className:q("fc",u==="article"&&"on"),onClick:()=>c("article"),children:"article"}),d.jsx("span",{className:q("fc",u==="image"&&"on"),onClick:()=>c("image"),children:"image"})]})]}),d.jsxs("div",{className:"no-results",style:{paddingTop:40},children:[d.jsxs("div",{className:"nr-title",children:["no ",u," results"]}),d.jsxs("div",{className:"nr-sub",children:["try a different filter",d.jsx("br",{}),"or reset to “all”"]})]})]},"filter-empty"),!p&&K&&y&&d.jsxs(Ae.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[d.jsxs("div",{className:"results-header",children:[d.jsxs("div",{className:"rh-row",children:[d.jsxs("span",{className:"rh-count",children:[z.length," results"]}),d.jsxs("span",{className:"rh-ms",children:[y.took_ms,"ms"]})]}),d.jsxs("div",{className:"filter-chips",children:[d.jsx("span",{className:q("fc",u==="all"&&"on"),onClick:()=>c("all"),children:"all"}),d.jsx("span",{className:q("fc",u==="text"&&"on"),onClick:()=>c("text"),children:"text"}),d.jsx("span",{className:q("fc",u==="article"&&"on"),onClick:()=>c("article"),children:"article"}),d.jsx("span",{className:q("fc",u==="image"&&"on"),onClick:()=>c("image"),children:"image"})]})]}),d.jsxs("div",{className:"results",children:[d.jsx(HL,{state:g.state,expanded:x,overview:g.overview,onAsk:E,onToggle:()=>w(_=>!_),onRetry:E,onClose:I,onCitationClick:R}),z.map((_,b)=>d.jsx("div",{id:`result-${b}`,children:b===0&&_.score>.9?d.jsx(OL,{result:_,query:o,onSelect:A}):d.jsx(BL,{result:_,rank:b+1,query:o,onSelect:A})},_.id))]})]},"results"),!p&&!F&&!y&&d.jsxs(Ae.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"search-empty",children:[f.length>0&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"recent-lbl",children:"recent searches"}),f.map((_,b)=>d.jsxs("div",{className:"recent-item",onClick:()=>T(_),children:[d.jsx("div",{className:"ri-icon t",children:d.jsx(no,{className:"w-3 h-3",style:{color:"rgba(245,245,245,0.3)"}})}),d.jsx("span",{className:"ri-text",children:_}),d.jsx("div",{className:"srch-clear",onClick:W=>P(_,W),children:d.jsx(jt,{className:"w-2 h-2"})})]},b))]}),d.jsx("div",{className:"suggestions-lbl",children:"try searching for"}),d.jsx("div",{className:"sug-chips",children:qL.map(_=>d.jsx("span",{className:"sc",onClick:()=>T(_),children:_},_))})]},"idle")]})]})}function QL({pending:e,processing:t,failed:n}){return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"sec",children:"queue"}),d.jsxs("div",{className:"stats-row",children:[d.jsxs("div",{className:"stat sw",children:[d.jsx("div",{className:q("stat-n",e>0&&"warn"),children:e}),d.jsx("div",{className:"stat-l",children:"pending"})]}),d.jsxs("div",{className:"stat so",children:[d.jsx("div",{className:q("stat-n",t>0&&"ok"),children:t}),d.jsx("div",{className:"stat-l",children:"processing"})]}),d.jsxs("div",{className:"stat sb",children:[d.jsx("div",{className:q("stat-n",n>0&&"bad"),children:n}),d.jsx("div",{className:"stat-l",children:"failed"})]})]})]})}function ZL(e){try{const t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/1e3);return r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:`${Math.floor(r/3600)}h ago`}catch{return""}}function JL(e){return Of[e]||["saved","processing"]}function eM({job:e}){const t=JL(e.type);return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"sec",children:"now processing"}),d.jsxs("div",{className:"hero-card",children:[d.jsxs("div",{className:"hero-top",children:[d.jsxs("div",{children:[d.jsx("div",{className:"hero-filename",children:e.note_path||e.type}),d.jsxs("div",{className:"hero-meta",children:[e.type," · ",ZL(e.created_at)]})]}),d.jsxs("div",{className:"hero-badge",children:[d.jsx("div",{className:"badge-dot"}),"live"]})]}),d.jsx("div",{className:"prog-labels",children:t.map((n,r)=>d.jsx("span",{className:`prog-step ${r===0?"done":""}`,children:n},n))}),d.jsx("div",{className:"prog-bar",children:d.jsx("div",{className:"prog-fill",style:{animation:"indeterminate 2s linear infinite"}})})]})]})}function tM(e){try{const t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/1e3);return r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:`${Math.floor(r/3600)}h ago`}catch{return""}}function nM(e){if(!e)return{code:"UNKNOWN",message:"unknown error"};const t=e.split("·").map(n=>n.trim());return t.length>=2?{code:t[0],message:t.slice(1).join(" · ")}:{code:"ERR",message:e}}function rM({job:e,onRetry:t,onDiscard:n}){const{code:r,message:i}=nM(e.error),o=e.note_path||e.type;return d.jsxs("div",{className:"fail-card",children:[d.jsxs("div",{className:"fail-main",children:[d.jsx("div",{className:"fail-icon",children:d.jsx(_l,{className:"w-4 h-4",style:{color:"#ff4d4d"}})}),d.jsxs("div",{className:"fail-body",children:[d.jsx("div",{className:"fail-title",children:o}),d.jsxs("div",{className:"fail-reason",children:[r," · ",i]}),d.jsxs("div",{className:"fail-time",children:["failed ",tM(e.created_at)]})]})]}),d.jsxs("div",{className:"fail-actions",children:[d.jsxs("div",{className:"fa retry",onClick:()=>t(e.id),children:[d.jsx(Ih,{className:"fa-icon"}),"retry"]}),d.jsxs("div",{className:"fa discard",onClick:()=>n(e.id),children:[d.jsx(Dh,{className:"fa-icon"}),"discard"]})]})]})}function iM(e){try{const t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/1e3);return r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:`${Math.floor(r/3600)}h ago`}catch{return""}}function oM(e){if(!e)return{code:"UNKNOWN",message:"unknown error"};const t=e.split("·").map(n=>n.trim());return t.length>=2?{code:t[0],message:t.slice(1).join(" · ")}:{code:"ERR",message:e}}function sM({job:e,onRetry:t,onDiscard:n}){const{code:r,message:i}=oM(e.error),o=e.note_path||e.type;return d.jsxs("div",{className:"fail-expanded",children:[d.jsxs("div",{className:"fe-main",children:[d.jsx("div",{className:"fail-icon",children:d.jsx(_l,{className:"w-4 h-4",style:{color:"#ff4d4d"}})}),d.jsxs("div",{className:"fe-body",children:[d.jsx("div",{className:"fe-title",children:o}),d.jsxs("div",{className:"fe-error-box",children:[d.jsx("div",{className:"fe-code",children:r}),d.jsx("div",{className:"fe-msg",children:i})]}),d.jsxs("div",{className:"fe-attempts",children:["failed ",iM(e.created_at)]})]})]}),d.jsxs("div",{className:"fail-actions",children:[d.jsxs("div",{className:"fa retry",onClick:()=>t(e.id),children:[d.jsx(Ih,{className:"fa-icon"}),"retry"]}),d.jsxs("div",{className:"fa discard",onClick:()=>n(e.id),children:[d.jsx(Dh,{className:"fa-icon"}),"discard"]})]})]})}function aM({count:e,onRetryAll:t}){return d.jsxs("div",{className:"retry-all",onClick:t,children:[d.jsxs("div",{className:"ra-left",children:[d.jsx("span",{className:"ra-ct",children:e}),d.jsx("span",{className:"ra-txt",children:"jobs failed"})]}),d.jsxs("div",{className:"ra-btn",children:[d.jsx(Ih,{className:"ra-icon"}),"retry all"]})]})}function lM(e){try{const t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/1e3);return r<60?`${r}s`:r<3600?`${Math.floor(r/60)}m`:`${Math.floor(r/3600)}h`}catch{return""}}function uM(e,t=40){return e?e.length<=t?e:e.slice(0,t-3)+"...":""}function cM({job:e,flare:t,onSelect:n}){const r=uM(e.note_path||e.type),i=!!e.note_path&&!!n;return d.jsxs("div",{className:`done-item ${i?"clickable":""}`,onClick:i?()=>n(e.note_path):void 0,role:i?"button":void 0,"data-testid":"done-item",children:[d.jsx("div",{className:"done-check",children:d.jsx($1,{className:"w-3 h-3",style:{color:"#3ddc84"}})}),d.jsxs("div",{className:"done-body",children:[d.jsx("div",{className:"done-title",children:r}),d.jsx("div",{className:"done-meta",children:e.type})]}),t&&t.connections>0&&d.jsxs("span",{className:"flare-chip",title:`${t.connections} connected notes`,children:[d.jsx(H1,{className:"w-3 h-3"}),t.connections]}),e.result!=null&&d.jsx("span",{className:"flare-enriched",title:"enriched with memory context",children:d.jsx(q1,{className:"w-3 h-3"})}),d.jsx("span",{className:"done-ago",children:lM(e.processed_at||e.created_at)})]})}function fM(e){const t=Date.now(),n=Math.floor((t-e)/1e3);return n<60?`${n}s`:n<3600?`${Math.floor(n/60)}m`:`${Math.floor(n/3600)}h`}function dM(e,t=40){if(e.length<=t)return e;if(e.startsWith("http"))try{const r=new URL(e);return r.hostname+r.pathname.slice(0,t-r.hostname.length-3)+"..."}catch{return e.slice(0,t-3)+"..."}const n=`"${e}"`;return n.length<=t?n:n.slice(0,t-3)+'..."'}function hM({items:e,onSync:t}){return e.length===0?null:d.jsxs("div",{className:"off-card",children:[d.jsxs("div",{className:"off-hdr",children:[d.jsxs("div",{className:"off-title-row",children:[d.jsx(G1,{className:"w-4 h-4 text-[#C9933A]"}),d.jsx("span",{className:"off-title",children:"offline"})]}),d.jsxs("span",{className:"off-ct",children:[e.length," waiting"]})]}),d.jsx("div",{className:"off-list",children:e.slice(0,3).map(n=>d.jsxs("div",{className:"oi",children:[d.jsx("div",{className:"oi-bar"}),d.jsx("span",{className:"oi-txt",children:dM(n.content)}),d.jsx("span",{className:"oi-t",children:fM(n.timestamp)})]},n.id))}),d.jsxs("div",{className:"sync-btn",onClick:t,children:[d.jsxs("span",{className:"sync-txt",children:["sync ",e.length," captures"]}),d.jsx(U2,{className:"w-4 h-4 text-[#C9933A]"})]})]})}const Sy=50;function pM(){const{token:e}=st(),[t,n]=m.useState(!1),[r,i]=m.useState([]),[o,s]=m.useState(0),[a,l]=m.useState(null),[u,c]=m.useState({}),[f,h]=m.useState(!1),[p,y]=m.useState(!1),v=m.useCallback(T=>{i(T.jobs||[]),s(T.total),T.flares&&c(C=>({...C,...T.flares}))},[]),k=m.useCallback(async T=>{n(!0),l(null);try{const j=await Ct(e).queue({status:T,limit:Cr.QUEUE_JOBS});h(!1),v(j)}catch(C){l(C instanceof Error?C.message:"Failed to fetch queue")}finally{n(!1)}},[e,v]),g=m.useCallback(T=>{i(C=>{const j=C.findIndex(A=>A.id===T.id);if(j===-1)return[T,...C];const P=[...C];return P[j]={...P[j],...T},P})},[]),x=m.useCallback(async()=>{if(!p){y(!0),l(null);try{const T=Ct(e);let C=r.filter(j=>j.status==="done").length;for(;;){const j=await T.queue({status:"done",limit:Sy,offset:C}),P=j.jobs||[];if(P.length===0||(i(A=>{const E=new Set(A.map(I=>I.id));return[...A,...P.filter(I=>!E.has(I.id))]}),j.flares&&c(A=>({...A,...j.flares})),P.length{try{await Ct(e).retryJob(T),await k()}catch(C){l(C instanceof Error?C.message:"Failed to retry job")}},[k,e]),S=m.useCallback(async T=>{try{await Ct(e).discardJob(T),await k()}catch(C){l(C instanceof Error?C.message:"Failed to discard job")}},[k,e]);return m.useEffect(()=>{k()},[k]),{loading:t,jobs:r,total:o,error:a,flares:u,doneExpanded:f,doneLoadingMore:p,loadMoreDone:x,applyLiveJob:g,setDoneExpanded:h,fetchQueue:k,retryJob:w,discardJob:S}}function mM(e,t=!0){const n=m.useRef(e);n.current=e,m.useEffect(()=>{if(!t)return;let r=null,i=!1,o=null,s=0;const a=()=>{const l=window.location.protocol==="https:"?"wss":"ws";try{r=new WebSocket(`${l}://${window.location.host}/v1/queue/ws`)}catch{return}r.onmessage=u=>{try{const c=JSON.parse(u.data);c.event==="job_updated"&&c.job&&n.current(c.job)}catch{}},r.onopen=()=>{const u=localStorage.getItem("khayal_token")||"";r==null||r.send(JSON.stringify({type:"auth",token:u})),s=0},r.onclose=()=>{if(i)return;s++;const u=Math.min(1e3*Math.pow(2,s),15e3);o=setTimeout(a,u)},r.onerror=()=>{r==null||r.close()}};return a(),()=>{i=!0,o&&clearTimeout(o),r==null||r.close()}},[t])}function gM(e){try{const t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/1e3);return r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:`${Math.floor(r/3600)}h ago`}catch{return""}}function yM(e){switch(e){case"text":return d.jsx(ey,{className:"w-4 h-4"});case"url":return d.jsx(K1,{className:"w-4 h-4"});case"image":return d.jsx(W1,{className:"w-4 h-4"});default:return d.jsx(ey,{className:"w-4 h-4"})}}function vM(e){switch(e){case"text":return"t";case"url":return"u";case"image":return"i";default:return"t"}}function xM(e,t=50){return e?e.length<=t?e:e.slice(0,t-3)+"...":""}const wM=new Set(["connections","memory"]);function kM({onNoteSelect:e}={}){const{loading:t,jobs:n,flares:r,doneExpanded:i,doneLoadingMore:o,loadMoreDone:s,applyLiveJob:a,setDoneExpanded:l,fetchQueue:u,retryJob:c,discardJob:f}=pM(),{toast:h}=rs(),{session:p}=st(),[y,v]=m.useState([]),[k,g]=m.useState(!1),x=m.useCallback(()=>{u(),ck(p).then(R=>{v(R.map(z=>({id:z.id,content:z.request.content,timestamp:z.timestamp})))})},[u,p]);m.useEffect(()=>{x()},[x]),mM(a,k),m.useEffect(()=>{!t&&!k&&g(!0)},[t,k]);const w=async R=>{await c(R),h({title:"Job retried"})},S=async R=>{await f(R),h({title:"Job discarded"})},T=async()=>{for(const R of A)await c(R.id);h({title:`Retried ${A.length} jobs`})},C=n.filter(R=>!wM.has(R.type)),j=C.find(R=>R.status==="processing"),P=C.filter(R=>R.status==="pending"||R.status==="queued"),A=C.filter(R=>R.status==="failed"),E=C.filter(R=>R.status==="done"),I=i?E:E.slice(0,Cr.DONE_JOBS_SHOWN);return d.jsxs("div",{className:"q-body",children:[!k&&d.jsx("div",{className:"q-list","data-testid":"queue-skeleton",children:[1,2,3,4].map(R=>d.jsxs("div",{className:"q-skel-row",children:[d.jsx("div",{className:"animate-shimmer q-skel q-skel-icon"}),d.jsxs("div",{className:"q-skel-lines",children:[d.jsx("div",{className:"animate-shimmer q-skel q-skel-w60"}),d.jsx("div",{className:"animate-shimmer q-skel q-skel-w35"})]})]},R))}),k&&d.jsxs(d.Fragment,{children:[j&&d.jsx(eM,{job:j}),d.jsx(QL,{pending:P.length,processing:j?1:0,failed:A.length}),P.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"sec",children:["pending (",P.length,")"]}),d.jsx("div",{className:"q-list",children:P.map((R,z)=>d.jsxs(Ae.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{delay:z*.02},className:"qi",children:[d.jsx("div",{className:`qi-icon ${vM(R.type)}`,children:yM(R.type)}),d.jsxs("div",{className:"qi-body",children:[d.jsx("div",{className:"qi-title",children:xM(R.note_path||R.type)}),d.jsxs("div",{className:"qi-meta",children:[R.type," · ",R.status]})]}),d.jsx("div",{className:`qi-dot ${R.status==="queued"?"q":"p"}`}),d.jsx("span",{className:"qi-ago",children:gM(R.created_at)})]},R.id))})]}),A.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"sec",children:["failed (",A.length,")"]}),A.length>1&&d.jsx(aM,{count:A.length,onRetryAll:T}),d.jsx("div",{className:"q-list",children:A.map((R,z)=>d.jsx(Ae.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{delay:z*.02},children:z===0?d.jsx(sM,{job:R,onRetry:w,onDiscard:S}):d.jsx(rM,{job:R,onRetry:w,onDiscard:S})},R.id))})]}),E.length>0&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"divider"}),d.jsxs("div",{className:"sec",children:["done (",E.length,")"]}),d.jsx("div",{className:"q-list",children:I.map((R,z)=>d.jsx(Ae.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{delay:i?0:z*.02},children:d.jsx(cM,{job:R,flare:r[R.id],onSelect:e})},R.id))}),(E.length>Cr.DONE_JOBS_SHOWN||i)&&d.jsx("button",{className:"done-expand clickable",onClick:()=>i?l(!1):s(),disabled:o,"data-testid":"queue-show-more",children:o?d.jsxs(d.Fragment,{children:[d.jsx(Za,{className:"w-3 h-3 animate-spin"}),"loading history..."]}):i?d.jsxs(d.Fragment,{children:[d.jsx(O2,{className:"w-3 h-3"}),"show less"]}):d.jsxs(d.Fragment,{children:[d.jsx(U1,{className:"w-3 h-3"}),"show all ",E.length]})})]}),d.jsx(hM,{items:y,onSync:x}),d.jsx("div",{className:"flex justify-center py-2",children:d.jsxs("button",{onClick:x,disabled:t,className:"flex items-center gap-2 text-xs text-[rgba(245,245,245,0.3)] hover:text-[rgba(245,245,245,0.5)] transition-colors",children:[d.jsx(Za,{className:q("w-3 h-3",t&&"animate-spin")}),"refresh"]})})]})]})}function SM(e,t){const{token:n}=st(),[r,i]=m.useState(null),[o,s]=m.useState(!1),[a,l]=m.useState(null);return m.useEffect(()=>{if(!e){i(null),l(null);return}(async()=>{s(!0),l(null);try{const f=await Ct(n).getNote(e,t);i(f)}catch(c){l(c instanceof Error?c.message:"Failed to load note")}finally{s(!1)}})()},[e,t,n]),{note:r,loading:o,error:a}}function Vr({className:e,...t}){return d.jsx("div",{className:q("animate-pulse rounded-md bg-primary/10",e),...t})}function ro({text:e,query:t,className:n=""}){if(!t||!e)return d.jsx("span",{className:n,children:e});const r=t.split(/\s+/).filter(a=>a.length>1).map(a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));if(r.length===0)return d.jsx("span",{className:n,children:e});const i=r.join("|"),o=new RegExp(`(${i})`,"gi"),s=e.split(o);return d.jsx("span",{className:n,children:s.map((a,l)=>r.some(c=>a.toLowerCase()===c.replace(/\\/g,"").toLowerCase())?d.jsx("mark",{className:"hl",children:a},l):d.jsx("span",{children:a},l))})}function bM({note:e}){const t=e.excerpt_section||"Raw",n=e.search_query;return d.jsx("div",{className:"note-content",children:d.jsxs("section",{className:"note-section",children:[d.jsx("h3",{className:"note-section-heading",children:t}),d.jsx("div",{className:"text-sm leading-relaxed text-muted-foreground whitespace-pre-wrap",children:d.jsx(ro,{text:e.raw,query:n})})]})})}function CM(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const EM=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,TM=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,NM={};function by(e,t){return(NM.jsx?TM:EM).test(e)}const PM=/[ \t\n\f\r]/g;function jM(e){return typeof e=="object"?e.type==="text"?Cy(e.value):!1:Cy(e)}function Cy(e){return e.replace(PM,"")===""}class us{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}us.prototype.normal={};us.prototype.property={};us.prototype.space=void 0;function yS(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new us(n,r,t)}function Uf(e){return e.toLowerCase()}class at{constructor(t,n){this.attribute=n,this.property=t}}at.prototype.attribute="";at.prototype.booleanish=!1;at.prototype.boolean=!1;at.prototype.commaOrSpaceSeparated=!1;at.prototype.commaSeparated=!1;at.prototype.defined=!1;at.prototype.mustUseProperty=!1;at.prototype.number=!1;at.prototype.overloadedBoolean=!1;at.prototype.property="";at.prototype.spaceSeparated=!1;at.prototype.space=void 0;let RM=0;const X=Ar(),Te=Ar(),Wf=Ar(),O=Ar(),le=Ar(),di=Ar(),ut=Ar();function Ar(){return 2**++RM}const Hf=Object.freeze(Object.defineProperty({__proto__:null,boolean:X,booleanish:Te,commaOrSpaceSeparated:ut,commaSeparated:di,number:O,overloadedBoolean:Wf,spaceSeparated:le},Symbol.toStringTag,{value:"Module"})),Qu=Object.keys(Hf);class Qh extends at{constructor(t,n,r,i){let o=-1;if(super(t,n),Ey(this,"space",i),typeof r=="number")for(;++o4&&n.slice(0,4)==="data"&&LM.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Ty,FM);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Ty.test(o)){let s=o.replace(_M,OM);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}i=Qh}return new i(r,t)}function OM(e){return"-"+e.toLowerCase()}function FM(e){return e.charAt(1).toUpperCase()}const VM=yS([vS,AM,kS,SS,bS],"html"),Zh=yS([vS,IM,kS,SS,bS],"svg");function zM(e){return e.join(" ").trim()}var Jh={},Ny=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,BM=/\n/g,$M=/^\s*/,UM=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,WM=/^:\s*/,HM=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,KM=/^[;\s]*/,qM=/^\s+|\s+$/g,GM=` -`,Py="/",jy="*",ur="",YM="comment",XM="declaration";function QM(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(y){var v=y.match(BM);v&&(n+=v.length);var k=y.lastIndexOf(GM);r=~k?y.length-k:r+y.length}function o(){var y={line:n,column:r};return function(v){return v.position=new s(y),u(),v}}function s(y){this.start=y,this.end={line:n,column:r},this.source=t.source}s.prototype.content=e;function a(y){var v=new Error(t.source+":"+n+":"+r+": "+y);if(v.reason=y,v.filename=t.source,v.line=n,v.column=r,v.source=e,!t.silent)throw v}function l(y){var v=y.exec(e);if(v){var k=v[0];return i(k),e=e.slice(k.length),v}}function u(){l($M)}function c(y){var v;for(y=y||[];v=f();)v!==!1&&y.push(v);return y}function f(){var y=o();if(!(Py!=e.charAt(0)||jy!=e.charAt(1))){for(var v=2;ur!=e.charAt(v)&&(jy!=e.charAt(v)||Py!=e.charAt(v+1));)++v;if(v+=2,ur===e.charAt(v-1))return a("End of comment missing");var k=e.slice(2,v-2);return r+=2,i(k),e=e.slice(v),r+=2,y({type:YM,comment:k})}}function h(){var y=o(),v=l(UM);if(v){if(f(),!l(WM))return a("property missing ':'");var k=l(HM),g=y({type:XM,property:Ry(v[0].replace(Ny,ur)),value:k?Ry(k[0].replace(Ny,ur)):ur});return l(KM),g}}function p(){var y=[];c(y);for(var v;v=h();)v!==!1&&(y.push(v),c(y));return y}return u(),p()}function Ry(e){return e?e.replace(qM,ur):ur}var ZM=QM,JM=va&&va.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Jh,"__esModule",{value:!0});Jh.default=tO;const eO=JM(ZM);function tO(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,eO.default)(e),i=typeof t=="function";return r.forEach(o=>{if(o.type!=="declaration")return;const{property:s,value:a}=o;i?t(s,a,o):a&&(n=n||{},n[s]=a)}),n}var Vl={};Object.defineProperty(Vl,"__esModule",{value:!0});Vl.camelCase=void 0;var nO=/^--[a-zA-Z0-9_-]+$/,rO=/-([a-z])/g,iO=/^[^-]+$/,oO=/^-(webkit|moz|ms|o|khtml)-/,sO=/^-(ms)-/,aO=function(e){return!e||iO.test(e)||nO.test(e)},lO=function(e,t){return t.toUpperCase()},Ay=function(e,t){return"".concat(t,"-")},uO=function(e,t){return t===void 0&&(t={}),aO(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(sO,Ay):e=e.replace(oO,Ay),e.replace(rO,lO))};Vl.camelCase=uO;var cO=va&&va.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},fO=cO(Jh),dO=Vl;function Kf(e,t){var n={};return!e||typeof e!="string"||(0,fO.default)(e,function(r,i){r&&i&&(n[(0,dO.camelCase)(r,t)]=i)}),n}Kf.default=Kf;var hO=Kf;const pO=fl(hO),CS=ES("end"),ep=ES("start");function ES(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function mO(e){const t=ep(e),n=CS(e);if(t&&n)return{start:t,end:n}}function wo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Iy(e.position):"start"in e||"end"in e?Iy(e):"line"in e||"column"in e?qf(e):""}function qf(e){return Dy(e&&e.line)+":"+Dy(e&&e.column)}function Iy(e){return qf(e&&e.start)+"-"+qf(e&&e.end)}function Dy(e){return e&&typeof e=="number"?e:1}class Ke extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},s=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(s=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const a=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=wo(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=s&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ke.prototype.file="";Ke.prototype.name="";Ke.prototype.reason="";Ke.prototype.message="";Ke.prototype.stack="";Ke.prototype.column=void 0;Ke.prototype.line=void 0;Ke.prototype.ancestors=void 0;Ke.prototype.cause=void 0;Ke.prototype.fatal=void 0;Ke.prototype.place=void 0;Ke.prototype.ruleId=void 0;Ke.prototype.source=void 0;const tp={}.hasOwnProperty,gO=new Map,yO=/[A-Z]/g,vO=new Set(["table","tbody","thead","tfoot","tr"]),xO=new Set(["td","th"]),TS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function wO(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=PO(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=NO(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Zh:VM,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=NS(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function NS(e,t,n){if(t.type==="element")return kO(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return SO(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return CO(e,t,n);if(t.type==="mdxjsEsm")return bO(e,t);if(t.type==="root")return EO(e,t,n);if(t.type==="text")return TO(e,t)}function kO(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Zh,e.schema=i),e.ancestors.push(t);const o=jS(e,t.tagName,!1),s=jO(e,t);let a=rp(e,t);return vO.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!jM(l):!0})),PS(e,s,o,t),np(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}function SO(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Ko(e,t.position)}function bO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ko(e,t.position)}function CO(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Zh,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:jS(e,t.name,!0),s=RO(e,t),a=rp(e,t);return PS(e,s,o,t),np(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}function EO(e,t,n){const r={};return np(r,rp(e,t)),e.create(t,e.Fragment,r,n)}function TO(e,t){return t.value}function PS(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function np(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function NO(e,t,n){return r;function r(i,o,s,a){const u=Array.isArray(s.children)?n:t;return a?u(o,s,a):u(o,s)}}function PO(e,t){return n;function n(r,i,o,s){const a=Array.isArray(o.children),l=ep(r);return t(i,o,s,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function jO(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&tp.call(t.properties,i)){const o=AO(e,i,t.properties[i]);if(o){const[s,a]=o;e.tableCellAlignToStyle&&s==="align"&&typeof a=="string"&&xO.has(t.tagName)?r=a:n[s]=a}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function RO(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const s=o.expression;s.type;const a=s.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Ko(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,o=e.evaluater.evaluateExpression(a.expression)}else Ko(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function rp(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:gO;for(;++ri?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);o0?(pt(e,e.length,0,t),e):t}const My={}.hasOwnProperty;function AS(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Bt(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ge=nr(/[A-Za-z]/),We=nr(/[\dA-Za-z]/),zO=nr(/[#-'*+\--9=?A-Z^-~]/);function rl(e){return e!==null&&(e<32||e===127)}const Gf=nr(/\d/),BO=nr(/[\dA-Fa-f]/),$O=nr(/[!-/:-@[-`{-~]/);function H(e){return e!==null&&e<-2}function ae(e){return e!==null&&(e<0||e===32)}function Q(e){return e===-2||e===-1||e===32}const zl=nr(new RegExp("\\p{P}|\\p{S}","u")),Tr=nr(/\s/);function nr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Li(e){const t=[];let n=-1,r=0,i=0;for(;++n55295&&o<57344){const a=e.charCodeAt(n+1);o<56320&&a>56319&&a<57344?(s=String.fromCharCode(o,a),i=1):s="�"}else s=String.fromCharCode(o);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function te(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return s;function s(l){return Q(l)?(e.enter(n),a(l)):t(l)}function a(l){return Q(l)&&o++s))return;const j=t.events.length;let P=j,A,E;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){if(A){E=t.events[P][1].end;break}A=!0}for(g(r),C=j;Cw;){const T=n[S];t.containerState=T[1],T[0].exit.call(t,e)}n.length=w}function x(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function qO(e,t,n){return te(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function bi(e){if(e===null||ae(e)||Tr(e))return 1;if(zl(e))return 2}function Bl(e,t,n){const r=[];let i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},h={...e[n][1].start};Fy(f,-l),Fy(h,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},o={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},e[r][1].end={...s.start},e[n][1].start={...a.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=wt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=wt(u,[["enter",i,t],["enter",s,t],["exit",s,t],["enter",o,t]]),u=wt(u,Bl(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=wt(u,[["exit",o,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=wt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,pt(e,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n0&&Q(C)?te(e,x,"linePrefix",o+1)(C):x(C)}function x(C){return C===null||H(C)?e.check(Vy,v,S)(C):(e.enter("codeFlowValue"),w(C))}function w(C){return C===null||H(C)?(e.exit("codeFlowValue"),x(C)):(e.consume(C),w)}function S(C){return e.exit("codeFenced"),t(C)}function T(C,j,P){let A=0;return E;function E(B){return C.enter("lineEnding"),C.consume(B),C.exit("lineEnding"),I}function I(B){return C.enter("codeFencedFence"),Q(B)?te(C,R,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):R(B)}function R(B){return B===a?(C.enter("codeFencedFenceSequence"),z(B)):P(B)}function z(B){return B===a?(A++,C.consume(B),z):A>=s?(C.exit("codeFencedFenceSequence"),Q(B)?te(C,F,"whitespace")(B):F(B)):P(B)}function F(B){return B===null||H(B)?(C.exit("codeFencedFence"),j(B)):P(B)}}}function oF(e,t,n){const r=this;return i;function i(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o)}function o(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const Ju={name:"codeIndented",tokenize:aF},sF={partial:!0,tokenize:lF};function aF(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),te(e,o,"linePrefix",5)(u)}function o(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):H(u)?e.attempt(sF,s,l)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||H(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),a)}function l(u){return e.exit("codeIndented"),t(u)}}function lF(e,t,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):H(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):te(e,o,"linePrefix",5)(s)}function o(s){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):H(s)?i(s):n(s)}}const uF={name:"codeText",previous:fF,resolve:cF,tokenize:dF};function cF(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Yi(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Yi(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Yi(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function OS(e,t,n,r,i,o,s,a,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return f;function f(g){return g===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(g),e.exit(o),h):g===null||g===32||g===41||rl(g)?n(g):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),v(g))}function h(g){return g===62?(e.enter(o),e.consume(g),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(e.exit("chunkString"),e.exit(a),h(g)):g===null||g===60||H(g)?n(g):(e.consume(g),g===92?y:p)}function y(g){return g===60||g===62||g===92?(e.consume(g),p):p(g)}function v(g){return!c&&(g===null||g===41||ae(g))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(g)):c999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(o),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):H(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||H(p)||a++>999?(e.exit("chunkString"),c(p)):(e.consume(p),l||(l=!Q(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),a++,f):f(p)}}function VS(e,t,n,r,i,o){let s;return a;function a(h){return h===34||h===39||h===40?(e.enter(r),e.enter(i),e.consume(h),e.exit(i),s=h===40?41:h,l):n(h)}function l(h){return h===s?(e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):(e.enter(o),u(h))}function u(h){return h===s?(e.exit(o),l(s)):h===null?n(h):H(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),te(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===s||h===null||H(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:c)}function f(h){return h===s||h===92?(e.consume(h),c):c(h)}}function ko(e,t){let n;return r;function r(i){return H(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Q(i)?te(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const wF={name:"definition",tokenize:SF},kF={partial:!0,tokenize:bF};function SF(e,t,n){const r=this;let i;return o;function o(p){return e.enter("definition"),s(p)}function s(p){return FS.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return i=Bt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return ae(p)?ko(e,u)(p):u(p)}function u(p){return OS(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(kF,f,f)(p)}function f(p){return Q(p)?te(e,h,"whitespace")(p):h(p)}function h(p){return p===null||H(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function bF(e,t,n){return r;function r(a){return ae(a)?ko(e,i)(a):n(a)}function i(a){return VS(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return Q(a)?te(e,s,"whitespace")(a):s(a)}function s(a){return a===null||H(a)?t(a):n(a)}}const CF={name:"hardBreakEscape",tokenize:EF};function EF(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return H(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const TF={name:"headingAtx",resolve:NF,tokenize:PF};function NF(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},pt(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function PF(e,t,n){let r=0;return i;function i(c){return e.enter("atxHeading"),o(c)}function o(c){return e.enter("atxHeadingSequence"),s(c)}function s(c){return c===35&&r++<6?(e.consume(c),s):c===null||ae(c)?(e.exit("atxHeadingSequence"),a(c)):n(c)}function a(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||H(c)?(e.exit("atxHeading"),t(c)):Q(c)?te(e,a,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),a(c))}function u(c){return c===null||c===35||ae(c)?(e.exit("atxHeadingText"),a(c)):(e.consume(c),u)}}const jF=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],By=["pre","script","style","textarea"],RF={concrete:!0,name:"htmlFlow",resolveTo:DF,tokenize:_F},AF={partial:!0,tokenize:MF},IF={partial:!0,tokenize:LF};function DF(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function _F(e,t,n){const r=this;let i,o,s,a,l;return u;function u(N){return c(N)}function c(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),f}function f(N){return N===33?(e.consume(N),h):N===47?(e.consume(N),o=!0,v):N===63?(e.consume(N),i=3,r.interrupt?t:b):Ge(N)?(e.consume(N),s=String.fromCharCode(N),k):n(N)}function h(N){return N===45?(e.consume(N),i=2,p):N===91?(e.consume(N),i=5,a=0,y):Ge(N)?(e.consume(N),i=4,r.interrupt?t:b):n(N)}function p(N){return N===45?(e.consume(N),r.interrupt?t:b):n(N)}function y(N){const we="CDATA[";return N===we.charCodeAt(a++)?(e.consume(N),a===we.length?r.interrupt?t:R:y):n(N)}function v(N){return Ge(N)?(e.consume(N),s=String.fromCharCode(N),k):n(N)}function k(N){if(N===null||N===47||N===62||ae(N)){const we=N===47,Rt=s.toLowerCase();return!we&&!o&&By.includes(Rt)?(i=1,r.interrupt?t(N):R(N)):jF.includes(s.toLowerCase())?(i=6,we?(e.consume(N),g):r.interrupt?t(N):R(N)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(N):o?x(N):w(N))}return N===45||We(N)?(e.consume(N),s+=String.fromCharCode(N),k):n(N)}function g(N){return N===62?(e.consume(N),r.interrupt?t:R):n(N)}function x(N){return Q(N)?(e.consume(N),x):E(N)}function w(N){return N===47?(e.consume(N),E):N===58||N===95||Ge(N)?(e.consume(N),S):Q(N)?(e.consume(N),w):E(N)}function S(N){return N===45||N===46||N===58||N===95||We(N)?(e.consume(N),S):T(N)}function T(N){return N===61?(e.consume(N),C):Q(N)?(e.consume(N),T):w(N)}function C(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),l=N,j):Q(N)?(e.consume(N),C):P(N)}function j(N){return N===l?(e.consume(N),l=null,A):N===null||H(N)?n(N):(e.consume(N),j)}function P(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||ae(N)?T(N):(e.consume(N),P)}function A(N){return N===47||N===62||Q(N)?w(N):n(N)}function E(N){return N===62?(e.consume(N),I):n(N)}function I(N){return N===null||H(N)?R(N):Q(N)?(e.consume(N),I):n(N)}function R(N){return N===45&&i===2?(e.consume(N),K):N===60&&i===1?(e.consume(N),ne):N===62&&i===4?(e.consume(N),W):N===63&&i===3?(e.consume(N),b):N===93&&i===5?(e.consume(N),_):H(N)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(AF,ee,z)(N)):N===null||H(N)?(e.exit("htmlFlowData"),z(N)):(e.consume(N),R)}function z(N){return e.check(IF,F,ee)(N)}function F(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),B}function B(N){return N===null||H(N)?z(N):(e.enter("htmlFlowData"),R(N))}function K(N){return N===45?(e.consume(N),b):R(N)}function ne(N){return N===47?(e.consume(N),s="",L):R(N)}function L(N){if(N===62){const we=s.toLowerCase();return By.includes(we)?(e.consume(N),W):R(N)}return Ge(N)&&s.length<8?(e.consume(N),s+=String.fromCharCode(N),L):R(N)}function _(N){return N===93?(e.consume(N),b):R(N)}function b(N){return N===62?(e.consume(N),W):N===45&&i===2?(e.consume(N),b):R(N)}function W(N){return N===null||H(N)?(e.exit("htmlFlowData"),ee(N)):(e.consume(N),W)}function ee(N){return e.exit("htmlFlow"),t(N)}}function LF(e,t,n){const r=this;return i;function i(s){return H(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):n(s)}function o(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function MF(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(cs,t,n)}}const OF={name:"htmlText",tokenize:FF};function FF(e,t,n){const r=this;let i,o,s;return a;function a(b){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(b),l}function l(b){return b===33?(e.consume(b),u):b===47?(e.consume(b),T):b===63?(e.consume(b),w):Ge(b)?(e.consume(b),P):n(b)}function u(b){return b===45?(e.consume(b),c):b===91?(e.consume(b),o=0,y):Ge(b)?(e.consume(b),x):n(b)}function c(b){return b===45?(e.consume(b),p):n(b)}function f(b){return b===null?n(b):b===45?(e.consume(b),h):H(b)?(s=f,ne(b)):(e.consume(b),f)}function h(b){return b===45?(e.consume(b),p):f(b)}function p(b){return b===62?K(b):b===45?h(b):f(b)}function y(b){const W="CDATA[";return b===W.charCodeAt(o++)?(e.consume(b),o===W.length?v:y):n(b)}function v(b){return b===null?n(b):b===93?(e.consume(b),k):H(b)?(s=v,ne(b)):(e.consume(b),v)}function k(b){return b===93?(e.consume(b),g):v(b)}function g(b){return b===62?K(b):b===93?(e.consume(b),g):v(b)}function x(b){return b===null||b===62?K(b):H(b)?(s=x,ne(b)):(e.consume(b),x)}function w(b){return b===null?n(b):b===63?(e.consume(b),S):H(b)?(s=w,ne(b)):(e.consume(b),w)}function S(b){return b===62?K(b):w(b)}function T(b){return Ge(b)?(e.consume(b),C):n(b)}function C(b){return b===45||We(b)?(e.consume(b),C):j(b)}function j(b){return H(b)?(s=j,ne(b)):Q(b)?(e.consume(b),j):K(b)}function P(b){return b===45||We(b)?(e.consume(b),P):b===47||b===62||ae(b)?A(b):n(b)}function A(b){return b===47?(e.consume(b),K):b===58||b===95||Ge(b)?(e.consume(b),E):H(b)?(s=A,ne(b)):Q(b)?(e.consume(b),A):K(b)}function E(b){return b===45||b===46||b===58||b===95||We(b)?(e.consume(b),E):I(b)}function I(b){return b===61?(e.consume(b),R):H(b)?(s=I,ne(b)):Q(b)?(e.consume(b),I):A(b)}function R(b){return b===null||b===60||b===61||b===62||b===96?n(b):b===34||b===39?(e.consume(b),i=b,z):H(b)?(s=R,ne(b)):Q(b)?(e.consume(b),R):(e.consume(b),F)}function z(b){return b===i?(e.consume(b),i=void 0,B):b===null?n(b):H(b)?(s=z,ne(b)):(e.consume(b),z)}function F(b){return b===null||b===34||b===39||b===60||b===61||b===96?n(b):b===47||b===62||ae(b)?A(b):(e.consume(b),F)}function B(b){return b===47||b===62||ae(b)?A(b):n(b)}function K(b){return b===62?(e.consume(b),e.exit("htmlTextData"),e.exit("htmlText"),t):n(b)}function ne(b){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),L}function L(b){return Q(b)?te(e,_,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):_(b)}function _(b){return e.enter("htmlTextData"),s(b)}}const sp={name:"labelEnd",resolveAll:$F,resolveTo:UF,tokenize:WF},VF={tokenize:HF},zF={tokenize:KF},BF={tokenize:qF};function $F(e){let t=-1;const n=[];for(;++t=3&&(u===null||H(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===i?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Q(u)?te(e,a,"whitespace")(u):a(u))}}const et={continuation:{tokenize:r4},exit:o4,name:"list",tokenize:n4},e4={partial:!0,tokenize:s4},t4={partial:!0,tokenize:i4};function n4(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return a;function a(p){const y=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Gf(p)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ga,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return Gf(p)&&++s<10?(e.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(cs,r.interrupt?n:c,e.attempt(e4,h,f))}function c(p){return r.containerState.initialBlankLine=!0,o++,h(p)}function f(p){return Q(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function r4(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(cs,i,o);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,te(e,t,"listItemIndent",r.containerState.size+1)(a)}function o(a){return r.containerState.furtherBlankLines||!Q(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(t4,t,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,te(e,e.attempt(et,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function i4(e,t,n){const r=this;return te(e,i,"listItemIndent",r.containerState.size+1);function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(o):n(o)}}function o4(e){e.exit(this.containerState.type)}function s4(e,t,n){const r=this;return te(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const s=r.events[r.events.length-1];return!Q(o)&&s&&s[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const $y={name:"setextUnderline",resolveTo:a4,tokenize:l4};function a4(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const s={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",s,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=s,e.push(["exit",s,t]),e}function l4(e,t,n){const r=this;let i;return o;function o(u){let c=r.events.length,f;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){f=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),i=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===i?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),Q(u)?te(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||H(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const u4={tokenize:c4};function c4(e){const t=this,n=e.attempt(cs,r,e.attempt(this.parser.constructs.flowInitial,i,te(e,e.attempt(this.parser.constructs.flow,i,e.attempt(mF,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const f4={resolveAll:BS()},d4=zS("string"),h4=zS("text");function zS(e){return{resolveAll:BS(e==="text"?p4:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,s,a);return s;function s(c){return u(c)?o(c):a(c)}function a(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),o(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const f=i[c];let h=-1;if(f)for(;++h-1){const a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}o>0&&s.push(e[i].slice(0,o))}return s}function N4(e,t){let n=-1;const r=[];let i;for(;++n0){const At=G.tokenStack[G.tokenStack.length-1];(At[1]||Wy).call(G,void 0,At[0])}for(V.position={start:Pn(D.length>0?D[0][1].start:{line:1,column:1,offset:0}),end:Pn(D.length>0?D[D.length-2][1].end:{line:1,column:1,offset:0})},oe=-1;++oe0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function B4(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $4(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function U4(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Li(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let s,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),s=e.footnoteOrder.length):s=o+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};e.patch(t,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function W4(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function H4(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function WS(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const s=i[i.length-1];return s&&s.type==="text"?s.value+=r:i.push({type:"text",value:r}),i}function K4(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return WS(e,t);const i={src:Li(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function q4(e,t){const n={src:Li(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function G4(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Y4(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return WS(e,t);const i={href:Li(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function X4(e,t){const n={href:Li(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Q4(e,t,n){const r=e.all(t),i=n?Z4(n):HS(t),o={},s=[];if(typeof t.checked=="boolean"){const c=r[0];let f;c&&c.type==="element"&&c.tagName==="p"?f=c:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let a=-1;for(;++a1}function J4(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i0){const s={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=ep(t.children[1]),l=CS(t.children[t.children.length-1]);a&&l&&(s.position={start:a,end:l}),i.push(s)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function i3(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,a=s?s.length:t.children.length;let l=-1;const u=[];for(;++l0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(qy(t.slice(i),i>0,!1)),o.join("")}function qy(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===Hy||o===Ky;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===Hy||o===Ky;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function a3(e,t){const n={type:"text",value:s3(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function l3(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const u3={blockquote:F4,break:V4,code:z4,delete:B4,emphasis:$4,footnoteReference:U4,heading:W4,html:H4,imageReference:K4,image:q4,inlineCode:G4,linkReference:Y4,link:X4,listItem:Q4,list:J4,paragraph:e3,root:t3,strong:n3,table:r3,tableCell:o3,tableRow:i3,text:a3,thematicBreak:l3,toml:$s,yaml:$s,definition:$s,footnoteDefinition:$s};function $s(){}const KS=-1,$l=0,So=1,il=2,ap=3,lp=4,up=5,cp=6,qS=7,GS=8,Gy=typeof self=="object"?self:globalThis,c3=(e,t)=>{const n=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,s]=t[i];switch(o){case $l:case KS:return n(s,i);case So:{const a=n([],i);for(const l of s)a.push(r(l));return a}case il:{const a=n({},i);for(const[l,u]of s)a[r(l)]=r(u);return a}case ap:return n(new Date(s),i);case lp:{const{source:a,flags:l}=s;return n(new RegExp(a,l),i)}case up:{const a=n(new Map,i);for(const[l,u]of s)a.set(r(l),r(u));return a}case cp:{const a=n(new Set,i);for(const l of s)a.add(r(l));return a}case qS:{const{name:a,message:l}=s;return n(new Gy[a](l),i)}case GS:return n(BigInt(s),i);case"BigInt":return n(Object(BigInt(s)),i);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:a}=new Uint8Array(s);return n(new DataView(a),s)}}return n(new Gy[o](s),i)};return r},Yy=e=>c3(new Map,e)(0),zr="",{toString:f3}={},{keys:d3}=Object,Xi=e=>{const t=typeof e;if(t!=="object"||!e)return[$l,t];const n=f3.call(e).slice(8,-1);switch(n){case"Array":return[So,zr];case"Object":return[il,zr];case"Date":return[ap,zr];case"RegExp":return[lp,zr];case"Map":return[up,zr];case"Set":return[cp,zr];case"DataView":return[So,n]}return n.includes("Array")?[So,n]:n.includes("Error")?[qS,n]:[il,n]},Us=([e,t])=>e===$l&&(t==="function"||t==="symbol"),h3=(e,t,n,r)=>{const i=(s,a)=>{const l=r.push(s)-1;return n.set(a,l),l},o=s=>{if(n.has(s))return n.get(s);let[a,l]=Xi(s);switch(a){case $l:{let c=s;switch(l){case"bigint":a=GS,c=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([KS],s)}return i([a,c],s)}case So:{if(l){let h=s;return l==="DataView"?h=new Uint8Array(s.buffer):l==="ArrayBuffer"&&(h=new Uint8Array(s)),i([l,[...h]],s)}const c=[],f=i([a,c],s);for(const h of s)c.push(o(h));return f}case il:{if(l)switch(l){case"BigInt":return i([l,s.toString()],s);case"Boolean":case"Number":case"String":return i([l,s.valueOf()],s)}if(t&&"toJSON"in s)return o(s.toJSON());const c=[],f=i([a,c],s);for(const h of d3(s))(e||!Us(Xi(s[h])))&&c.push([o(h),o(s[h])]);return f}case ap:return i([a,s.toISOString()],s);case lp:{const{source:c,flags:f}=s;return i([a,{source:c,flags:f}],s)}case up:{const c=[],f=i([a,c],s);for(const[h,p]of s)(e||!(Us(Xi(h))||Us(Xi(p))))&&c.push([o(h),o(p)]);return f}case cp:{const c=[],f=i([a,c],s);for(const h of s)(e||!Us(Xi(h)))&&c.push(o(h));return f}}const{message:u}=s;return i([a,{name:l,message:u}],s)};return o},Xy=(e,{json:t,lossy:n}={})=>{const r=[];return h3(!(t||n),!!t,new Map,r)(e),r},ol=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Yy(Xy(e,t)):structuredClone(e):(e,t)=>Yy(Xy(e,t));function p3(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function m3(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function g3(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||p3,r=e.options.footnoteBackLabel||m3,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l0&&y.push({type:"text",value:" "});let x=typeof n=="string"?n:n(l,p);typeof x=="string"&&(x={type:"text",value:x}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,p),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const k=c[c.length-1];if(k&&k.type==="element"&&k.tagName==="p"){const x=k.children[k.children.length-1];x&&x.type==="text"?x.value+=" ":k.children.push({type:"text",value:" "}),k.children.push(...y)}else c.push(...y);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(c,!0)};e.patch(u,g),a.push(g)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...ol(s),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` -`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:` -`}]}}const Ul=function(e){if(e==null)return w3;if(typeof e=="function")return Wl(e);if(typeof e=="object")return Array.isArray(e)?y3(e):v3(e);if(typeof e=="string")return x3(e);throw new Error("Expected function, string, or object as test")};function y3(e){const t=[];let n=-1;for(;++n":""))+")"})}return h;function h(){let p=YS,y,v,k;if((!t||o(l,u,c[c.length-1]||void 0))&&(p=C3(n(l,c)),p[0]===Xf))return p;if("children"in l&&l.children){const g=l;if(g.children&&p[0]!==b3)for(v=(r?g.children.length:-1)+s,k=c.concat(g);v>-1&&v0&&n.push({type:"text",value:` -`}),n}function Qy(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Zy(e,t){const n=T3(e,t),r=n.one(e,void 0),i=g3(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:` -`},i),o}function A3(e,t){return e&&"run"in e?async function(n,r){const i=Zy(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Zy(n,{file:r,...e||t})}}function Jy(e){if(e)throw e}var ya=Object.prototype.hasOwnProperty,QS=Object.prototype.toString,ev=Object.defineProperty,tv=Object.getOwnPropertyDescriptor,nv=function(t){return typeof Array.isArray=="function"?Array.isArray(t):QS.call(t)==="[object Array]"},rv=function(t){if(!t||QS.call(t)!=="[object Object]")return!1;var n=ya.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&ya.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||ya.call(t,i)},iv=function(t,n){ev&&n.name==="__proto__"?ev(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},ov=function(t,n){if(n==="__proto__")if(ya.call(t,n)){if(tv)return tv(t,n).value}else return;return t[n]},I3=function e(){var t,n,r,i,o,s,a=arguments[0],l=1,u=arguments.length,c=!1;for(typeof a=="boolean"&&(c=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});ls.length;let l;a&&s.push(i);try{l=e.apply(this,s)}catch(u){const c=u;if(a&&n)throw c;return i(c)}a||(l&&l.then&&typeof l.then=="function"?l.then(o,i):l instanceof Error?i(l):o(l))}function i(s,...a){n||(n=!0,t(s,...a))}function o(s){i(null,s)}}const Xt={basename:L3,dirname:M3,extname:O3,join:F3,sep:"/"};function L3(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');fs(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,a=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else s<0&&(o=!0,s=i+1),a>-1&&(e.codePointAt(i)===t.codePointAt(a--)?a<0&&(r=i):(a=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function M3(e){if(fs(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function O3(e){fs(e);let t=e.length,n=-1,r=0,i=-1,o=0,s;for(;t--;){const a=e.codePointAt(t);if(a===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),a===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function F3(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function z3(e,t){let n="",r=0,i=-1,o=0,s=-1,a,l;for(;++s<=e.length;){if(s2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=s,o=0;continue}}else if(n.length>0){n="",r=0,i=s,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,o=0}else a===46&&o>-1?o++:o=-1}return n}function fs(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const B3={cwd:$3};function $3(){return"/"}function Jf(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function U3(e){if(typeof e=="string")e=new URL(e);else if(!Jf(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return W3(e)}function W3(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n0){let[p,...y]=c;const v=r[h][1];Zf(v)&&Zf(p)&&(p=tc(!0,v,p)),r[h]=[u,p,...y]}}}}const G3=new dp().freeze();function oc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function sc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ac(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function av(e){if(!Zf(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function lv(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Ws(e){return Y3(e)?e:new ZS(e)}function Y3(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function X3(e){return typeof e=="string"||Q3(e)}function Q3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Z3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",uv=[],cv={allowDangerousHtml:!0},J3=/^(https?|ircs?|mailto|xmpp)$/i,eV=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function tV(e){const t=nV(e),n=rV(e);return iV(t.runSync(t.parse(n),n),e)}function nV(e){const t=e.rehypePlugins||uv,n=e.remarkPlugins||uv,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...cv}:cv;return G3().use(O4).use(n).use(A3,r).use(t)}function rV(e){const t=e.children||"",n=new ZS;return typeof t=="string"&&(n.value=t),n}function iV(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,s=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||oV;for(const c of eV)Object.hasOwn(t,c.from)&&(""+c.from+(c.to?"use `"+c.to+"` instead":"remove it")+Z3+c.id,void 0);return fp(e,u),wO(e,{Fragment:d.Fragment,components:i,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function u(c,f,h){if(c.type==="raw"&&h&&typeof f=="number")return s?h.children.splice(f,1):h.children[f]={type:"text",value:c.value},f;if(c.type==="element"){let p;for(p in Zu)if(Object.hasOwn(Zu,p)&&Object.hasOwn(c.properties,p)){const y=c.properties[p],v=Zu[p];(v===null||v.includes(c.tagName))&&(c.properties[p]=l(String(y||""),p,c))}}if(c.type==="element"){let p=n?!n.includes(c.tagName):o?o.includes(c.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(c,f,h)),p&&h&&typeof f=="number")return a&&c.children?h.children.splice(f,1,...c.children):h.children.splice(f,1),f}}}function oV(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||J3.test(e.slice(0,t))?e:""}function fv(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function sV(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function aV(e,t,n){const i=Ul((n||{}).ignore||[]),o=lV(t);let s=-1;for(;++s0?{type:"text",value:C}:void 0),C===!1?h.lastIndex=S+1:(y!==S&&x.push({type:"text",value:u.value.slice(y,S)}),Array.isArray(C)?x.push(...C):C&&x.push(C),y=S+w[0].length,g=!0),!h.global)break;w=h.exec(u.value)}return g?(y?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=fv(e,"(");let o=fv(e,")");for(;r!==-1&&i>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function JS(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Tr(n)||zl(n))&&(!t||n!==47)}eb.peek=AV;function bV(){this.buffer()}function CV(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function EV(){this.buffer()}function TV(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function NV(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Bt(this.sliceSerialize(e)).toLowerCase(),n.label=t}function PV(e){this.exit(e)}function jV(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Bt(this.sliceSerialize(e)).toLowerCase(),n.label=t}function RV(e){this.exit(e)}function AV(){return"["}function eb(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const s=n.enter("footnoteReference"),a=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{after:"]",before:o})),a(),s(),o+=i.move("]"),o}function IV(){return{enter:{gfmFootnoteCallString:bV,gfmFootnoteCall:CV,gfmFootnoteDefinitionLabelString:EV,gfmFootnoteDefinition:TV},exit:{gfmFootnoteCallString:NV,gfmFootnoteCall:PV,gfmFootnoteDefinitionLabelString:jV,gfmFootnoteDefinition:RV}}}function DV(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:eb},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,o,s){const a=o.createTracker(s);let l=a.move("[^");const u=o.enter("footnoteDefinition"),c=o.enter("label");return l+=a.move(o.safe(o.associationId(r),{before:l,after:"]"})),c(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((t?` -`:" ")+o.indentLines(o.containerFlow(r,a.current()),t?tb:_V))),u(),l}}function _V(e,t,n){return t===0?e:tb(e,t,n)}function tb(e,t,n){return(n?"":" ")+e}const LV=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];nb.peek=zV;function MV(){return{canContainEols:["delete"],enter:{strikethrough:FV},exit:{strikethrough:VV}}}function OV(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:LV}],handlers:{delete:nb}}}function FV(e){this.enter({type:"delete",children:[]},e)}function VV(e){this.exit(e)}function nb(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let s=i.move("~~");return s+=n.containerPhrasing(e,{...i.current(),before:s,after:"~"}),s+=i.move("~~"),o(),s}function zV(){return"~"}function BV(e){return e.length}function $V(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||BV,o=[],s=[],a=[],l=[];let u=0,c=-1;for(;++cu&&(u=e[c].length);++gl[g])&&(l[g]=w)}v.push(x)}s[c]=v,a[c]=k}let f=-1;if(typeof r=="object"&&"length"in r)for(;++fl[f]&&(l[f]=x),p[f]=x),h[f]=w}s.splice(1,0,h),a.splice(1,0,p),c=-1;const y=[];for(;++c "),o.shift(2);const s=n.indentLines(n.containerFlow(e,o.current()),HV);return i(),s}function HV(e,t,n){return">"+(n?"":" ")+e}function KV(e,t){return hv(e,t.inConstruct,!0)&&!hv(e,t.notInConstruct,!1)}function hv(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++rs&&(s=o):o=1,i=r+t.length,r=n.indexOf(t,i);return s}function GV(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function YV(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function XV(e,t,n,r){const i=YV(n),o=e.value||"",s=i==="`"?"GraveAccent":"Tilde";if(GV(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(o,QV);return f(),h}const a=n.createTracker(r),l=i.repeat(Math.max(qV(o,i)+1,3)),u=n.enter("codeFenced");let c=a.move(l);if(e.lang){const f=n.enter(`codeFencedLang${s}`);c+=a.move(n.safe(e.lang,{before:c,after:" ",encode:["`"],...a.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${s}`);c+=a.move(" "),c+=a.move(n.safe(e.meta,{before:c,after:` -`,encode:["`"],...a.current()})),f()}return c+=a.move(` -`),o&&(c+=a.move(o+` -`)),c+=a.move(l),u(),c}function QV(e,t,n){return(n?"":" ")+e}function hp(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function ZV(e,t,n,r){const i=hp(n),o=i==='"'?"Quote":"Apostrophe",s=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("[");return u+=l.move(n.safe(n.associationId(e),{before:u,after:"]",...l.current()})),u+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":` -`,...l.current()}))),a(),e.title&&(a=n.enter(`title${o}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),s(),u}function JV(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function qo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function sl(e,t,n){const r=bi(e),i=bi(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}rb.peek=ez;function rb(e,t,n,r){const i=JV(n),o=n.enter("emphasis"),s=n.createTracker(r),a=s.move(i);let l=s.move(n.containerPhrasing(e,{after:i,before:a,...s.current()}));const u=l.charCodeAt(0),c=sl(r.before.charCodeAt(r.before.length-1),u,i);c.inside&&(l=qo(u)+l.slice(1));const f=l.charCodeAt(l.length-1),h=sl(r.after.charCodeAt(0),f,i);h.inside&&(l=l.slice(0,-1)+qo(f));const p=s.move(i);return o(),n.attentionEncodeSurroundingInfo={after:h.outside,before:c.outside},a+l+p}function ez(e,t,n){return n.options.emphasis||"*"}function tz(e,t){let n=!1;return fp(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Xf}),!!((!e.depth||e.depth<3)&&ip(e)&&(t.options.setext||n))}function nz(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(tz(e,n)){const c=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...o.current(),before:` -`,after:` -`});return f(),c(),h+` -`+(i===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(` -`))+1))}const s="#".repeat(i),a=n.enter("headingAtx"),l=n.enter("phrasing");o.move(s+" ");let u=n.containerPhrasing(e,{before:"# ",after:` -`,...o.current()});return/^[\t ]/.test(u)&&(u=qo(u.charCodeAt(0))+u.slice(1)),u=u?s+" "+u:s,n.options.closeAtx&&(u+=" "+s),l(),a(),u}ib.peek=rz;function ib(e){return e.value||""}function rz(){return"<"}ob.peek=iz;function ob(e,t,n,r){const i=hp(n),o=i==='"'?"Quote":"Apostrophe",s=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("![");return u+=l.move(n.safe(e.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${o}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),u+=l.move(")"),s(),u}function iz(){return"!"}sb.peek=oz;function sb(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let s=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const u=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),s();const c=n.stack;n.stack=[],s=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return s(),n.stack=c,o(),i==="full"||!u||u!==f?l+=a.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function oz(){return"!"}ab.peek=sz;function ab(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o\u007F]/.test(e.url))}ub.peek=az;function ub(e,t,n,r){const i=hp(n),o=i==='"'?"Quote":"Apostrophe",s=n.createTracker(r);let a,l;if(lb(e,n)){const c=n.stack;n.stack=[],a=n.enter("autolink");let f=s.move("<");return f+=s.move(n.containerPhrasing(e,{before:f,after:">",...s.current()})),f+=s.move(">"),a(),n.stack=c,f}a=n.enter("link"),l=n.enter("label");let u=s.move("[");return u+=s.move(n.containerPhrasing(e,{before:u,after:"](",...s.current()})),u+=s.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=s.move("<"),u+=s.move(n.safe(e.url,{before:u,after:">",...s.current()})),u+=s.move(">")):(l=n.enter("destinationRaw"),u+=s.move(n.safe(e.url,{before:u,after:e.title?" ":")",...s.current()}))),l(),e.title&&(l=n.enter(`title${o}`),u+=s.move(" "+i),u+=s.move(n.safe(e.title,{before:u,after:i,...s.current()})),u+=s.move(i),l()),u+=s.move(")"),a(),u}function az(e,t,n){return lb(e,n)?"<":"["}cb.peek=lz;function cb(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let s=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const u=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),s();const c=n.stack;n.stack=[],s=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return s(),n.stack=c,o(),i==="full"||!u||u!==f?l+=a.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function lz(){return"["}function pp(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function uz(e){const t=pp(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function cz(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function fb(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function fz(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let s=e.ordered?cz(n):pp(n);const a=e.ordered?s==="."?")":".":uz(n);let l=t&&n.bulletLastUsed?s===n.bulletLastUsed:!1;if(!e.ordered){const c=e.children?e.children[0]:void 0;if((s==="*"||s==="-")&&c&&(!c.children||!c.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),fb(n)===s&&c){let f=-1;for(;++f-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let s=o.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(s=Math.ceil(s/4)*4);const a=n.createTracker(r);a.move(o+" ".repeat(s-o.length)),a.shift(s);const l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,a.current()),c);return l(),u;function c(f,h,p){return h?(p?"":" ".repeat(s))+f:(p?o:o+" ".repeat(s-o.length))+f}}function pz(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),s=n.containerPhrasing(e,r);return o(),i(),s}const mz=Ul(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function gz(e,t,n,r){return(e.children.some(function(s){return mz(s)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function yz(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}db.peek=vz;function db(e,t,n,r){const i=yz(n),o=n.enter("strong"),s=n.createTracker(r),a=s.move(i+i);let l=s.move(n.containerPhrasing(e,{after:i,before:a,...s.current()}));const u=l.charCodeAt(0),c=sl(r.before.charCodeAt(r.before.length-1),u,i);c.inside&&(l=qo(u)+l.slice(1));const f=l.charCodeAt(l.length-1),h=sl(r.after.charCodeAt(0),f,i);h.inside&&(l=l.slice(0,-1)+qo(f));const p=s.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:h.outside,before:c.outside},a+l+p}function vz(e,t,n){return n.options.strong||"*"}function xz(e,t,n,r){return n.safe(e.value,r)}function wz(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function kz(e,t,n){const r=(fb(n)+(n.options.ruleSpaces?" ":"")).repeat(wz(n));return n.options.ruleSpaces?r.slice(0,-1):r}const hb={blockquote:WV,break:pv,code:XV,definition:ZV,emphasis:rb,hardBreak:pv,heading:nz,html:ib,image:ob,imageReference:sb,inlineCode:ab,link:ub,linkReference:cb,list:fz,listItem:hz,paragraph:pz,root:gz,strong:db,text:xz,thematicBreak:kz};function Sz(){return{enter:{table:bz,tableData:mv,tableHeader:mv,tableRow:Ez},exit:{codeText:Tz,table:Cz,tableData:fc,tableHeader:fc,tableRow:fc}}}function bz(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function Cz(e){this.exit(e),this.data.inTable=void 0}function Ez(e){this.enter({type:"tableRow",children:[]},e)}function fc(e){this.exit(e)}function mv(e){this.enter({type:"tableCell",children:[]},e)}function Tz(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Nz));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Nz(e,t){return t==="|"?t:e}function Pz(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` -`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:s,tableCell:l,tableRow:a}};function s(p,y,v,k){return u(c(p,v,k),p.align)}function a(p,y,v,k){const g=f(p,v,k),x=u([g]);return x.slice(0,x.indexOf(` -`))}function l(p,y,v,k){const g=v.enter("tableCell"),x=v.enter("phrasing"),w=v.containerPhrasing(p,{...k,before:o,after:o});return x(),g(),w}function u(p,y){return $V(p,{align:y,alignDelimiters:r,padding:n,stringLength:i})}function c(p,y,v){const k=p.children;let g=-1;const x=[],w=y.enter("table");for(;++g0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Kz={tokenize:e5,partial:!0};function qz(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Qz,continuation:{tokenize:Zz},exit:Jz}},text:{91:{name:"gfmFootnoteCall",tokenize:Xz},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Gz,resolveTo:Yz}}}}function Gz(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){s=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!s||!s._balanced)return n(l);const u=Bt(r.sliceSerialize({start:s.end,end:r.now()}));return u.codePointAt(0)!==94||!o.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function Yz(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function Xz(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,s;return a;function a(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),l}function l(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(o>999||f===93&&!s||f===null||f===91||ae(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return i.includes(Bt(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return ae(f)||(s=!0),o++,e.consume(f),f===92?c:u}function c(f){return f===91||f===92||f===93?(e.consume(f),o++,u):u(f)}}function Qz(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,s=0,a;return l;function l(y){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(y){return y===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(y)}function c(y){if(s>999||y===93&&!a||y===null||y===91||ae(y))return n(y);if(y===93){e.exit("chunkString");const v=e.exit("gfmFootnoteDefinitionLabelString");return o=Bt(r.sliceSerialize(v)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return ae(y)||(a=!0),s++,e.consume(y),y===92?f:c}function f(y){return y===91||y===92||y===93?(e.consume(y),s++,c):c(y)}function h(y){return y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),i.includes(o)||i.push(o),te(e,p,"gfmFootnoteDefinitionWhitespace")):n(y)}function p(y){return t(y)}}function Zz(e,t,n){return e.check(cs,t,e.attempt(Kz,t,n))}function Jz(e){e.exit("gfmFootnoteDefinition")}function e5(e,t,n){const r=this;return te(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?t(o):n(o)}}function t5(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(s,a){let l=-1;for(;++l1?l(y):(s.consume(y),f++,p);if(f<2&&!n)return l(y);const k=s.exit("strikethroughSequenceTemporary"),g=bi(y);return k._open=!g||g===2&&!!v,k._close=!v||v===2&&!!g,a(y)}}}class n5{constructor(){this.map=[]}add(t,n,r){r5(this,t,n,r)}consume(t){if(this.map.sort(function(o,s){return o[0]-s[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const o of i)t.push(o);i=r.pop()}this.map.length=0}}function r5(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i-1;){const F=r.events[I][1].type;if(F==="lineEnding"||F==="linePrefix")I--;else break}const R=I>-1?r.events[I][1].type:null,z=R==="tableHead"||R==="tableRow"?C:l;return z===C&&r.parser.lazy[r.now().line]?n(E):z(E)}function l(E){return e.enter("tableHead"),e.enter("tableRow"),u(E)}function u(E){return E===124||(s=!0,o+=1),c(E)}function c(E){return E===null?n(E):H(E)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),p):n(E):Q(E)?te(e,c,"whitespace")(E):(o+=1,s&&(s=!1,i+=1),E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),s=!0,c):(e.enter("data"),f(E)))}function f(E){return E===null||E===124||ae(E)?(e.exit("data"),c(E)):(e.consume(E),E===92?h:f)}function h(E){return E===92||E===124?(e.consume(E),f):f(E)}function p(E){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(E):(e.enter("tableDelimiterRow"),s=!1,Q(E)?te(e,y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):y(E))}function y(E){return E===45||E===58?k(E):E===124?(s=!0,e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),v):T(E)}function v(E){return Q(E)?te(e,k,"whitespace")(E):k(E)}function k(E){return E===58?(o+=1,s=!0,e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),g):E===45?(o+=1,g(E)):E===null||H(E)?S(E):T(E)}function g(E){return E===45?(e.enter("tableDelimiterFiller"),x(E)):T(E)}function x(E){return E===45?(e.consume(E),x):E===58?(s=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(E))}function w(E){return Q(E)?te(e,S,"whitespace")(E):S(E)}function S(E){return E===124?y(E):E===null||H(E)?!s||i!==o?T(E):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(E)):T(E)}function T(E){return n(E)}function C(E){return e.enter("tableRow"),j(E)}function j(E){return E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),j):E===null||H(E)?(e.exit("tableRow"),t(E)):Q(E)?te(e,j,"whitespace")(E):(e.enter("data"),P(E))}function P(E){return E===null||E===124||ae(E)?(e.exit("data"),j(E)):(e.consume(E),E===92?A:P)}function A(E){return E===92||E===124?(e.consume(E),P):P(E)}}function a5(e,t){let n=-1,r=!0,i=0,o=[0,0,0,0],s=[0,0,0,0],a=!1,l=0,u,c,f;const h=new n5;for(;++nn[2]+1){const y=n[2]+1,v=n[3]-n[2]-1;e.add(y,v,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return i!==void 0&&(o.end=Object.assign({},$r(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function yv(e,t,n,r,i){const o=[],s=$r(t.events,n);i&&(i.end=Object.assign({},s),o.push(["exit",i,t])),r.end=Object.assign({},s),o.push(["exit",r,t]),e.add(n+1,0,o)}function $r(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const l5={name:"tasklistCheck",tokenize:c5};function u5(){return{text:{91:l5}}}function c5(e,t,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),o)}function o(l){return ae(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),s):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),s):n(l)}function s(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(l)}function a(l){return H(l)?t(l):Q(l)?e.check({tokenize:f5},t,n)(l):n(l)}}function f5(e,t,n){return te(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function d5(e){return AS([Oz(),qz(),t5(e),o5(),u5()])}const h5={};function p5(e){const t=this,n=e||h5,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(d5(n)),o.push(Dz()),s.push(_z(n))}function m5({note:e}){const t=e.search_query;return d.jsxs("div",{className:"note-content",children:[e.summary&&d.jsxs("section",{id:"excerpt-Summary",className:"note-section",children:[d.jsx("h3",{className:"note-section-heading",children:"Summary"}),d.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:d.jsx(ro,{text:e.summary,query:t})})]}),e.key_ideas&&e.key_ideas.length>0&&d.jsxs("section",{id:"excerpt-Key Ideas",className:"note-section",children:[d.jsx("h3",{className:"note-section-heading",children:"Key Ideas"}),d.jsx("ul",{className:"note-list",children:e.key_ideas.map((n,r)=>d.jsx("li",{children:d.jsx(ro,{text:n,query:t})},r))})]}),d.jsxs("section",{id:"excerpt-Raw",className:"note-section",children:[d.jsx("h3",{className:"note-section-heading",children:"Raw"}),d.jsx("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:t?d.jsx(ro,{text:e.raw,query:t}):d.jsx(tV,{remarkPlugins:[p5],children:e.raw})})]}),e.description&&d.jsxs("section",{id:"excerpt-Description",className:"note-section",children:[d.jsx("h3",{className:"note-section-heading",children:"Description"}),d.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:d.jsx(ro,{text:e.description,query:t})})]}),e.source_url&&d.jsxs("section",{className:"note-section",children:[d.jsx("h3",{className:"note-section-heading",children:"Source"}),d.jsx("a",{href:e.source_url,target:"_blank",rel:"noopener noreferrer",style:{color:"#c9933a",fontSize:"0.875rem",textDecoration:"underline"},children:e.source_url})]})]})}function g5(e){switch(e){case"text":return"rb-t";case"article":return"rb-a";case"image":return"rb-t";default:return"rb-t"}}function dc(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return e}}function y5({notePath:e,query:t,onClose:n,onDeleted:r}){var k;const{note:i,loading:o,error:s}=SM(e,t),[a,l]=m.useState("excerpt"),[u,c]=m.useState(!1),[f,h]=m.useState(!1),{token:p}=st(),{toast:y}=rs();m.useEffect(()=>{l("excerpt"),c(!1),h(!1)},[e]);const v=async()=>{if(!(!e||f)){h(!0);try{await Ct(p).deleteNote(e),y({title:"Note deleted",description:"Moved to trash — recoverable from .khayal-trash/"}),r==null||r(e),n()}catch(g){y({title:"Delete failed",description:g instanceof Error?g.message:"Unknown error",variant:"destructive"}),h(!1),c(!1)}}};return d.jsx(dS,{open:!!e,modal:!0,onOpenChange:g=>{g||n()},children:d.jsxs(Yh,{side:"right",className:"w-[90vw] sm:max-w-[500px] p-0 flex flex-col [&>button:first-of-type]:hidden focus:outline-none",style:{background:"#0d0d0d",borderLeft:"1px solid rgba(255,255,255,0.08)",paddingBottom:"max(env(safe-area-inset-bottom), 0px)"},children:[d.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-white/5 shrink-0",style:{paddingTop:"calc(1rem + env(safe-area-inset-top))"},children:[d.jsx("h2",{className:"flex-1 text-base font-semibold truncate",style:{fontFamily:"'Bricolage Grotesque', sans-serif"},children:o?d.jsx(Vr,{className:"h-5 w-48",style:{background:"#1a1a1a"}}):(i==null?void 0:i.title)||"Note"}),!o&&i&&(u?d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0","data-testid":"note-delete-confirm",children:[d.jsx("span",{className:"text-[10px] font-mono whitespace-nowrap",style:{color:"rgba(245,169,169,0.8)"},children:"move to trash?"}),d.jsx("button",{className:"px-2 py-1 rounded-md text-[10px] font-mono font-bold uppercase tracking-wide",style:{color:"#f5a9a9",background:"rgba(255,99,99,0.08)",border:"1px solid rgba(255,99,99,0.25)"},onClick:v,disabled:f,"data-testid":"note-delete-go",children:f?"...":"delete"}),d.jsx("button",{className:"p-1.5 rounded-md",style:{color:"rgba(245,245,245,0.3)"},onClick:()=>c(!1),"data-testid":"note-delete-cancel",children:d.jsx(jt,{className:"w-3.5 h-3.5"})})]}):d.jsx("button",{className:"p-2 rounded-lg shrink-0 transition-colors",style:{color:"rgba(245,245,245,0.25)"},onClick:()=>c(!0),title:"delete note","data-testid":"note-delete-trigger",children:d.jsx(Dh,{className:"w-4 h-4"})}))]}),d.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4 space-y-4",children:[o&&d.jsxs("div",{className:"space-y-4",children:[d.jsx(Vr,{className:"h-4 w-32",style:{background:"#1a1a1a"}}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx(Vr,{className:"h-5 w-16 rounded-full",style:{background:"#1a1a1a"}}),d.jsx(Vr,{className:"h-5 w-20 rounded-full",style:{background:"#1a1a1a"}})]}),d.jsx(Vr,{className:"h-24 w-full rounded-xl",style:{background:"#1a1a1a"}}),d.jsx(Vr,{className:"h-40 w-full rounded-xl",style:{background:"#1a1a1a"}})]}),s&&d.jsx("div",{className:"note-detail-error",children:d.jsxs("div",{className:"error-text",children:["Failed to load note: ",s]})}),i&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"r1-meta",children:[i.created_at&&d.jsx("span",{className:"rdate",children:dc(i.created_at)}),i.type&&d.jsx("span",{className:`rb ${g5(i.type)}`,children:i.type}),(k=i.tags)==null?void 0:k.map((g,x)=>d.jsxs("span",{className:"rb rb-tag",children:["#",g]},x))]}),i.excerpt&&d.jsx("div",{className:"excerpt-box",children:d.jsxs("p",{className:"excerpt-text",children:[d.jsx("span",{className:"excerpt-label",children:"matched excerpt"}),d.jsx("br",{}),i.excerpt]})}),i.excerpt&&d.jsxs("div",{className:"view-toggle",children:[d.jsx("button",{className:`toggle-btn ${a==="excerpt"?"active":""}`,onClick:()=>l("excerpt"),children:"Excerpt"}),d.jsx("button",{className:`toggle-btn ${a==="full"?"active":""}`,onClick:()=>l("full"),children:"Full Note"})]}),a==="excerpt"&&i.excerpt?d.jsx(bM,{note:i}):d.jsx(m5,{note:i}),d.jsxs("div",{className:"text-xs pt-4 mt-4 border-t border-white/5",style:{color:"rgba(245,245,245,0.3)"},children:[d.jsx("div",{className:"font-mono truncate",children:i.note_path}),i.created_at&&d.jsxs("div",{className:"mt-1",children:["Created ",dc(i.created_at),i.updated_at&&i.updated_at!==i.created_at&&d.jsxs(d.Fragment,{children:[" · Updated ",dc(i.updated_at)]})]})]})]})]})]})})}const Sb=m.forwardRef(({className:e,type:t,...n},r)=>d.jsx("input",{type:t,className:q("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Sb.displayName="Input";const al=m.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:q("rounded-xl border bg-card text-card-foreground shadow",e),...t}));al.displayName="Card";const ll=m.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:q("flex flex-col space-y-1.5 p-6",e),...t}));ll.displayName="CardHeader";const ul=m.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:q("font-semibold leading-none tracking-tight",e),...t}));ul.displayName="CardTitle";const v5=m.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:q("text-sm text-muted-foreground",e),...t}));v5.displayName="CardDescription";const cl=m.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:q("p-6 pt-0",e),...t}));cl.displayName="CardContent";const x5=m.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:q("flex items-center p-6 pt-0",e),...t}));x5.displayName="CardFooter";function w5(){const{setupPrf:e,completeOnboarding:t}=st(),[n,r]=m.useState(""),[i,o]=m.useState(""),[s,a]=m.useState(!1),[l,u]=m.useState(null),c=async()=>{if(!n){o("Please enter your token");return}a(!0),o("");try{const f=window.location.origin;if(!(await fetch(`${f}/v1/health`,{headers:{"X-Khayal-Token":n}})).ok)throw new Error("Invalid token");localStorage.getItem(ke.LOCK_SETUP_DECIDED)?t(n,!1):u(n)}catch{o("Cannot connect. Check your token.")}finally{a(!1)}};return l!==null?d.jsx("div",{className:"flex flex-col items-center justify-center h-screen p-6 bg-background",children:d.jsxs(al,{className:"w-full max-w-sm glass border-primary/20 shadow-[0_0_40px_hsl(var(--primary)/0.1)]",children:[d.jsx(ll,{className:"text-center pb-2",children:d.jsxs(ul,{className:"text-2xl font-bold tracking-tight",children:["connected ",d.jsx("span",{className:"text-primary",children:"✓"})]})}),d.jsx(cl,{className:"p-0",children:d.jsx(cL,{onSetupPrf:()=>e(l),onRemember:()=>t(l,!0),onDontRemember:()=>t(l,!1)})})]})}):d.jsx("div",{className:"flex flex-col items-center justify-center h-screen p-6 bg-background",children:d.jsx(Ae.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.4,ease:"easeOut"},children:d.jsxs(al,{className:"w-full max-w-sm glass border-primary/20 shadow-[0_0_40px_hsl(var(--primary)/0.1)]",children:[d.jsxs(ll,{className:"text-center pb-2",children:[d.jsx(Ae.div,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},transition:{delay:.1,duration:.4,ease:"easeOut"},className:"w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",children:d.jsx("img",{src:"/icon.svg",alt:"khayal",className:"w-16 h-16"})}),d.jsx(ul,{className:"text-2xl font-bold tracking-tight",children:"khayal"}),d.jsx("p",{className:"text-caption mt-1",children:"private second brain"})]}),d.jsxs(cl,{className:"space-y-4 pt-4",children:[d.jsx(Sb,{placeholder:"token",type:"password",value:n,onChange:f=>r(f.target.value),onKeyDown:f=>{f.key==="Enter"&&c()},className:"glass input-glow transition-all duration-300"}),i&&d.jsx(Ae.p,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},className:"text-sm text-destructive text-center",children:i}),d.jsx(Ae.div,{whileTap:{scale:.98},children:d.jsx(wn,{className:"w-full h-12 btn-gradient font-semibold tracking-wide",onClick:c,disabled:s,children:s?d.jsx("span",{className:"animate-pulse",children:"connecting..."}):"connect"})})]})]})})})}function k5(){const{unlock:e,resetToOnboarding:t}=st(),[n,r]=m.useState(""),[i,o]=m.useState(!1),s=m.useRef(!1),a=m.useCallback(async()=>{o(!0),r("");const l=await e();o(!1),l||r("can't unlock. try again.")},[e]);return m.useEffect(()=>{s.current||(s.current=!0,a())},[a]),d.jsx("div",{className:"flex flex-col items-center justify-center h-screen p-6 bg-background",children:d.jsx(Ae.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.4,ease:"easeOut"},children:d.jsxs(al,{className:"w-full max-w-sm glass border-primary/20 shadow-[0_0_40px_hsl(var(--primary)/0.1)]",children:[d.jsxs(ll,{className:"text-center pb-2",children:[d.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",children:d.jsx("img",{src:"/icon.svg",alt:"khayal",className:"w-16 h-16"})}),d.jsx(ul,{className:"text-2xl font-bold tracking-tight",children:"khayal"}),d.jsx("p",{className:"text-caption mt-1",children:"locked"})]}),d.jsxs(cl,{className:"space-y-4 pt-4",children:[d.jsx(wn,{className:"w-full h-12 btn-gradient font-semibold tracking-wide",onClick:a,disabled:i,children:i?d.jsx("span",{className:"animate-pulse",children:"unlocking..."}):"unlock with face id"}),n&&d.jsx(Ae.p,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},className:"text-sm text-destructive text-center",children:n}),d.jsx(wn,{variant:"ghost",className:"w-full text-muted-foreground text-xs",onClick:t,children:"can't unlock? reconnect instead"})]})]})})})}class hc extends Qt.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("ErrorBoundary caught:",t,n)}render(){var t;return this.state.hasError?this.props.fallback?this.props.fallback:d.jsx("div",{className:"flex flex-col items-center justify-center h-screen p-6 bg-background",children:d.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-sm text-center",children:[d.jsx("div",{className:"w-16 h-16 rounded-2xl bg-destructive/10 flex items-center justify-center",children:d.jsx(_l,{className:"w-8 h-8 text-destructive"})}),d.jsx("h2",{className:"text-xl font-bold font-display text-foreground",children:"something broke"}),d.jsx("p",{className:"text-sm text-muted-foreground",children:((t=this.state.error)==null?void 0:t.message)||"An unexpected error occurred"}),d.jsx("button",{onClick:()=>window.location.reload(),className:"mt-4 px-6 py-2 bg-primary text-primary-foreground rounded-full font-semibold text-sm",children:"reload"})]})}):this.props.children}}const S5={initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12}};function b5(){const{locked:e,configured:t}=st(),[n,r]=m.useState("capture"),[i,o]=m.useState(void 0),[s,a]=m.useState(null),[l,u]=m.useState(""),[c,f]=m.useState([]),h=m.useCallback(x=>{o(x),r("capture")},[]),p=m.useCallback(()=>{o(void 0)},[]),y=m.useCallback((x,w)=>{a(x),u(w||"")},[]),v=m.useCallback(()=>{a(null),u("")},[]),k=m.useCallback(x=>{f(w=>[...w,x]),a(null)},[]);if(e)return d.jsx(hc,{children:d.jsx(k5,{})});if(!t)return d.jsx(hc,{children:d.jsx(w5,{})});const g=()=>{switch(n){case"capture":return d.jsx(wy,{captureQuery:i,onCaptureQueryConsumed:p});case"search":return d.jsx(XL,{onCaptureQuery:h,onNoteSelect:y,deletedPaths:c});case"queue":return d.jsx(kM,{onNoteSelect:y});default:return d.jsx(wy,{captureQuery:i,onCaptureQueryConsumed:p})}};return d.jsx(hc,{children:d.jsxs("div",{className:"flex flex-col h-screen overflow-hidden",style:{background:"#070707"},children:[d.jsx(dL,{}),d.jsx("main",{className:"flex-1 overflow-hidden",children:d.jsx(Wo,{mode:"wait",children:d.jsx(Ae.div,{variants:S5,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.2,ease:"easeOut"},className:"h-full overflow-y-auto",style:{paddingBottom:"1rem"},children:g()},n)})}),d.jsx(pL,{activeTab:n,onTabChange:r}),d.jsx(EI,{}),d.jsx(y5,{notePath:s,query:l||void 0,onClose:v,onDeleted:k})]})})}"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").then(e=>{console.log("SW registered:",e.scope),navigator.serviceWorker.addEventListener("controllerchange",()=>{navigator.serviceWorker.controller&&window.location.reload()}),e.addEventListener("updatefound",()=>{const t=e.installing;t&&t.addEventListener("statechange",()=>{t.state==="installed"&&navigator.serviceWorker.controller&&t.postMessage({type:"SKIP_WAITING"}),t.state==="activated"&&console.log("SW activated")})}),"sync"in e&&e.sync.register("sync-offline-captures").catch(()=>{})}).catch(e=>{console.log("SW registration failed:",e)})});window.navigator.standalone===!0&&document.documentElement.classList.add("pwa-standalone");pc.createRoot(document.getElementById("root")).render(d.jsx(Qt.StrictMode,{children:d.jsx(GI,{children:d.jsx(b5,{})})})); diff --git a/internal/api/ui/static/assets/index-D3OJiXM7.js b/internal/api/ui/static/assets/index-D3OJiXM7.js new file mode 100644 index 0000000..5f67868 --- /dev/null +++ b/internal/api/ui/static/assets/index-D3OJiXM7.js @@ -0,0 +1,276 @@ +var Mb=Object.defineProperty;var Ob=(e,t,n)=>t in e?Mb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Hl=(e,t,n)=>Ob(e,typeof t!="symbol"?t+"":t,n);function Fb(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var ya=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bv={exports:{}},dl={},Cv={exports:{}},J={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var qo=Symbol.for("react.element"),Vb=Symbol.for("react.portal"),zb=Symbol.for("react.fragment"),Bb=Symbol.for("react.strict_mode"),$b=Symbol.for("react.profiler"),Ub=Symbol.for("react.provider"),Wb=Symbol.for("react.context"),Hb=Symbol.for("react.forward_ref"),Kb=Symbol.for("react.suspense"),qb=Symbol.for("react.memo"),Gb=Symbol.for("react.lazy"),Cp=Symbol.iterator;function Yb(e){return e===null||typeof e!="object"?null:(e=Cp&&e[Cp]||e["@@iterator"],typeof e=="function"?e:null)}var Ev={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Tv=Object.assign,Nv={};function Ci(e,t,n){this.props=e,this.context=t,this.refs=Nv,this.updater=n||Ev}Ci.prototype.isReactComponent={};Ci.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ci.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Pv(){}Pv.prototype=Ci.prototype;function td(e,t,n){this.props=e,this.context=t,this.refs=Nv,this.updater=n||Ev}var nd=td.prototype=new Pv;nd.constructor=td;Tv(nd,Ci.prototype);nd.isPureReactComponent=!0;var Ep=Array.isArray,jv=Object.prototype.hasOwnProperty,rd={current:null},Rv={key:!0,ref:!0,__self:!0,__source:!0};function Av(e,t,n){var r,i={},o=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(o=""+t.key),t)jv.call(t,r)&&!Rv.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,B=M[H];if(0>>1;Hi(Rt,E))dei(Kt,Rt)?(M[H]=Kt,M[de]=E,H=de):(M[H]=Rt,M[ie]=E,H=ie);else if(dei(Kt,E))M[H]=Kt,M[de]=E,H=de;else break e}}return z}function i(M,z){var E=M.sortIndex-z.sortIndex;return E!==0?E:M.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],u=[],c=1,f=null,h=3,p=!1,y=!1,v=!1,k=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(M){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=M)r(u),z.sortIndex=z.expirationTime,t(l,z);else break;z=n(u)}}function S(M){if(v=!1,w(M),!y)if(n(l)!==null)y=!0,K(T);else{var z=n(u);z!==null&&ee(S,z.startTime-M)}}function T(M,z){y=!1,v&&(v=!1,g(P),P=-1),p=!0;var E=h;try{for(w(z),f=n(l);f!==null&&(!(f.expirationTime>z)||M&&!A());){var H=f.callback;if(typeof H=="function"){f.callback=null,h=f.priorityLevel;var B=H(f.expirationTime<=z);z=e.unstable_now(),typeof B=="function"?f.callback=B:f===n(l)&&r(l),w(z)}else r(l);f=n(l)}if(f!==null)var N=!0;else{var ie=n(u);ie!==null&&ee(S,ie.startTime-z),N=!1}return N}finally{f=null,h=E,p=!1}}var C=!1,j=null,P=-1,R=5,b=-1;function A(){return!(e.unstable_now()-bM||125H?(M.sortIndex=E,t(u,M),n(l)===null&&M===n(u)&&(v?(g(P),P=-1):v=!0,ee(S,E-H))):(M.sortIndex=B,t(l,M),y||p||(y=!0,K(T))),M},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(M){var z=h;return function(){var E=h;h=z;try{return M.apply(this,arguments)}finally{h=E}}}})(Mv);Lv.exports=Mv;var sC=Lv.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var aC=m,gt=sC;function O(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mc=Object.prototype.hasOwnProperty,lC=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Np={},Pp={};function uC(e){return mc.call(Pp,e)?!0:mc.call(Np,e)?!1:lC.test(e)?Pp[e]=!0:(Np[e]=!0,!1)}function cC(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function fC(e,t,n,r){if(t===null||typeof t>"u"||cC(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Je(e,t,n,r,i,o,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var ze={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ze[e]=new Je(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ze[t]=new Je(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ze[e]=new Je(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ze[e]=new Je(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ze[e]=new Je(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ze[e]=new Je(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ze[e]=new Je(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ze[e]=new Je(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ze[e]=new Je(e,5,!1,e.toLowerCase(),null,!1,!1)});var od=/[\-:]([a-z])/g;function sd(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(od,sd);ze[t]=new Je(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(od,sd);ze[t]=new Je(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(od,sd);ze[t]=new Je(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ze[e]=new Je(e,1,!1,e.toLowerCase(),null,!1,!1)});ze.xlinkHref=new Je("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ze[e]=new Je(e,1,!1,e.toLowerCase(),null,!0,!0)});function ad(e,t,n,r){var i=ze.hasOwnProperty(t)?ze[t]:null;(i!==null?i.type!==0:r||!(2a||i[s]!==o[a]){var l=` +`+i[s].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{Gl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Qi(e):""}function dC(e){switch(e.tag){case 5:return Qi(e.type);case 16:return Qi("Lazy");case 13:return Qi("Suspense");case 19:return Qi("SuspenseList");case 0:case 2:case 15:return e=Yl(e.type,!1),e;case 11:return e=Yl(e.type.render,!1),e;case 1:return e=Yl(e.type,!0),e;default:return""}}function xc(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Wr:return"Fragment";case Ur:return"Portal";case gc:return"Profiler";case ld:return"StrictMode";case yc:return"Suspense";case vc:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Vv:return(e.displayName||"Context")+".Consumer";case Fv:return(e._context.displayName||"Context")+".Provider";case ud:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case cd:return t=e.displayName||null,t!==null?t:xc(e.type)||"Memo";case In:t=e._payload,e=e._init;try{return xc(e(t))}catch{}}return null}function hC(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return xc(t);case 8:return t===ld?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function qn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Bv(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function pC(e){var t=Bv(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ps(e){e._valueTracker||(e._valueTracker=pC(e))}function $v(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Bv(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function va(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function wc(e,t){var n=t.checked;return we({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Rp(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=qn(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Uv(e,t){t=t.checked,t!=null&&ad(e,"checked",t,!1)}function kc(e,t){Uv(e,t);var n=qn(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Sc(e,t.type,n):t.hasOwnProperty("defaultValue")&&Sc(e,t.type,qn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ap(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Sc(e,t,n){(t!=="number"||va(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Zi=Array.isArray;function ii(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=ms.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function bo(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ro={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},mC=["Webkit","ms","Moz","O"];Object.keys(ro).forEach(function(e){mC.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ro[t]=ro[e]})});function qv(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ro.hasOwnProperty(e)&&ro[e]?(""+t).trim():t+"px"}function Gv(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=qv(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var gC=we({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ec(e,t){if(t){if(gC[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(O(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(O(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(O(61))}if(t.style!=null&&typeof t.style!="object")throw Error(O(62))}}function Tc(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Nc=null;function fd(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Pc=null,oi=null,si=null;function _p(e){if(e=Xo(e)){if(typeof Pc!="function")throw Error(O(280));var t=e.stateNode;t&&(t=yl(t),Pc(e.stateNode,e.type,t))}}function Yv(e){oi?si?si.push(e):si=[e]:oi=e}function Xv(){if(oi){var e=oi,t=si;if(si=oi=null,_p(e),t)for(e=0;e>>=0,e===0?32:31-(NC(e)/PC|0)|0}var gs=64,ys=4194304;function Ji(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Sa(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~i;a!==0?r=Ji(a):(o&=s,o!==0&&(r=Ji(o)))}else s=n&~i,s!==0?r=Ji(s):o!==0&&(r=Ji(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Go(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ft(t),e[t]=n}function IC(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=oo),Up=" ",Wp=!1;function gx(e,t){switch(e){case"keyup":return sE.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yx(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Hr=!1;function lE(e,t){switch(e){case"compositionend":return yx(t);case"keypress":return t.which!==32?null:(Wp=!0,Up);case"textInput":return e=t.data,e===Up&&Wp?null:e;default:return null}}function uE(e,t){if(Hr)return e==="compositionend"||!xd&&gx(e,t)?(e=px(),Gs=gd=Mn=null,Hr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Gp(n)}}function kx(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?kx(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Sx(){for(var e=window,t=va();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=va(e.document)}return t}function wd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function vE(e){var t=Sx(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&kx(n.ownerDocument.documentElement,n)){if(r!==null&&wd(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=Yp(n,o);var s=Yp(n,r);i&&s&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Kr=null,_c=null,ao=null,Lc=!1;function Xp(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Lc||Kr==null||Kr!==va(r)||(r=Kr,"selectionStart"in r&&wd(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ao&&jo(ao,r)||(ao=r,r=Ea(_c,"onSelect"),0Yr||(e.current=Bc[Yr],Bc[Yr]=null,Yr--)}function fe(e,t){Yr++,Bc[Yr]=e.current,e.current=t}var Gn={},He=Jn(Gn),rt=Jn(!1),wr=Gn;function pi(e,t){var n=e.type.contextTypes;if(!n)return Gn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function it(e){return e=e.childContextTypes,e!=null}function Na(){ge(rt),ge(He)}function rm(e,t,n){if(He.current!==Gn)throw Error(O(168));fe(He,t),fe(rt,n)}function Ax(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(O(108,hC(e)||"Unknown",i));return we({},n,r)}function Pa(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Gn,wr=He.current,fe(He,e),fe(rt,rt.current),!0}function im(e,t,n){var r=e.stateNode;if(!r)throw Error(O(169));n?(e=Ax(e,t,wr),r.__reactInternalMemoizedMergedChildContext=e,ge(rt),ge(He),fe(He,e)):ge(rt),fe(rt,n)}var fn=null,vl=!1,uu=!1;function Ix(e){fn===null?fn=[e]:fn.push(e)}function RE(e){vl=!0,Ix(e)}function er(){if(!uu&&fn!==null){uu=!0;var e=0,t=oe;try{var n=fn;for(oe=1;e>=s,i-=s,dn=1<<32-Ft(t)+i|n<P?(R=j,j=null):R=j.sibling;var b=h(g,j,w[P],S);if(b===null){j===null&&(j=R);break}e&&j&&b.alternate===null&&t(g,j),x=o(b,x,P),C===null?T=b:C.sibling=b,C=b,j=R}if(P===w.length)return n(g,j),ye&&ar(g,P),T;if(j===null){for(;PP?(R=j,j=null):R=j.sibling;var A=h(g,j,b.value,S);if(A===null){j===null&&(j=R);break}e&&j&&A.alternate===null&&t(g,j),x=o(A,x,P),C===null?T=A:C.sibling=A,C=A,j=R}if(b.done)return n(g,j),ye&&ar(g,P),T;if(j===null){for(;!b.done;P++,b=w.next())b=f(g,b.value,S),b!==null&&(x=o(b,x,P),C===null?T=b:C.sibling=b,C=b);return ye&&ar(g,P),T}for(j=r(g,j);!b.done;P++,b=w.next())b=p(j,g,P,b.value,S),b!==null&&(e&&b.alternate!==null&&j.delete(b.key===null?P:b.key),x=o(b,x,P),C===null?T=b:C.sibling=b,C=b);return e&&j.forEach(function(I){return t(g,I)}),ye&&ar(g,P),T}function k(g,x,w,S){if(typeof w=="object"&&w!==null&&w.type===Wr&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case hs:e:{for(var T=w.key,C=x;C!==null;){if(C.key===T){if(T=w.type,T===Wr){if(C.tag===7){n(g,C.sibling),x=i(C,w.props.children),x.return=g,g=x;break e}}else if(C.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===In&&am(T)===C.type){n(g,C.sibling),x=i(C,w.props),x.ref=Ui(g,C,w),x.return=g,g=x;break e}n(g,C);break}else t(g,C);C=C.sibling}w.type===Wr?(x=yr(w.props.children,g.mode,S,w.key),x.return=g,g=x):(S=na(w.type,w.key,w.props,null,g.mode,S),S.ref=Ui(g,x,w),S.return=g,g=S)}return s(g);case Ur:e:{for(C=w.key;x!==null;){if(x.key===C)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){n(g,x.sibling),x=i(x,w.children||[]),x.return=g,g=x;break e}else{n(g,x);break}else t(g,x);x=x.sibling}x=yu(w,g.mode,S),x.return=g,g=x}return s(g);case In:return C=w._init,k(g,x,C(w._payload),S)}if(Zi(w))return y(g,x,w,S);if(Fi(w))return v(g,x,w,S);Cs(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(n(g,x.sibling),x=i(x,w),x.return=g,g=x):(n(g,x),x=gu(w,g.mode,S),x.return=g,g=x),s(g)):n(g,x)}return k}var gi=Mx(!0),Ox=Mx(!1),Aa=Jn(null),Ia=null,Zr=null,Cd=null;function Ed(){Cd=Zr=Ia=null}function Td(e){var t=Aa.current;ge(Aa),e._currentValue=t}function Wc(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function li(e,t){Ia=e,Cd=Zr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(nt=!0),e.firstContext=null)}function Nt(e){var t=e._currentValue;if(Cd!==e)if(e={context:e,memoizedValue:t,next:null},Zr===null){if(Ia===null)throw Error(O(308));Zr=e,Ia.dependencies={lanes:0,firstContext:e}}else Zr=Zr.next=e;return t}var dr=null;function Nd(e){dr===null?dr=[e]:dr.push(e)}function Fx(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Nd(t)):(n.next=i.next,i.next=n),t.interleaved=n,yn(e,r)}function yn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Dn=!1;function Pd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Vx(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function pn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Un(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,re&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,yn(e,n)}return i=r.interleaved,i===null?(t.next=t,Nd(r)):(t.next=i.next,i.next=t),r.interleaved=t,yn(e,n)}function Xs(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,hd(e,n)}}function lm(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?i=o=t:o=o.next=t}else i=o=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Da(e,t,n,r){var i=e.updateQueue;Dn=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,u=l.next;l.next=null,s===null?o=u:s.next=u,s=l;var c=e.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==s&&(a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l))}if(o!==null){var f=i.baseState;s=0,c=u=l=null,a=o;do{var h=a.lane,p=a.eventTime;if((r&h)===h){c!==null&&(c=c.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=e,v=a;switch(h=t,p=n,v.tag){case 1:if(y=v.payload,typeof y=="function"){f=y.call(p,f,h);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=v.payload,h=typeof y=="function"?y.call(p,f,h):y,h==null)break e;f=we({},f,h);break e;case 2:Dn=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=i.effects,h===null?i.effects=[a]:h.push(a))}else p={eventTime:p,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(u=c=p,l=f):c=c.next=p,s|=h;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;h=a,a=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);if(c===null&&(l=f),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=c,t=i.shared.interleaved,t!==null){i=t;do s|=i.lane,i=i.next;while(i!==t)}else o===null&&(i.shared.lanes=0);br|=s,e.lanes=s,e.memoizedState=f}}function um(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=fu.transition;fu.transition={};try{e(!1),t()}finally{oe=n,fu.transition=r}}function nw(){return Pt().memoizedState}function _E(e,t,n){var r=Hn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},rw(e))iw(t,n);else if(n=Fx(e,t,n,r),n!==null){var i=Qe();Vt(n,e,r,i),ow(n,t,r)}}function LE(e,t,n){var r=Hn(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(rw(e))iw(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,a=o(s,n);if(i.hasEagerState=!0,i.eagerState=a,$t(a,s)){var l=t.interleaved;l===null?(i.next=i,Nd(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=Fx(e,t,i,r),n!==null&&(i=Qe(),Vt(n,e,r,i),ow(n,t,r))}}function rw(e){var t=e.alternate;return e===xe||t!==null&&t===xe}function iw(e,t){lo=La=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ow(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,hd(e,n)}}var Ma={readContext:Nt,useCallback:Be,useContext:Be,useEffect:Be,useImperativeHandle:Be,useInsertionEffect:Be,useLayoutEffect:Be,useMemo:Be,useReducer:Be,useRef:Be,useState:Be,useDebugValue:Be,useDeferredValue:Be,useTransition:Be,useMutableSource:Be,useSyncExternalStore:Be,useId:Be,unstable_isNewReconciler:!1},ME={readContext:Nt,useCallback:function(e,t){return Gt().memoizedState=[e,t===void 0?null:t],e},useContext:Nt,useEffect:fm,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Zs(4194308,4,Qx.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Zs(4194308,4,e,t)},useInsertionEffect:function(e,t){return Zs(4,2,e,t)},useMemo:function(e,t){var n=Gt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Gt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=_E.bind(null,xe,e),[r.memoizedState,e]},useRef:function(e){var t=Gt();return e={current:e},t.memoizedState=e},useState:cm,useDebugValue:Md,useDeferredValue:function(e){return Gt().memoizedState=e},useTransition:function(){var e=cm(!1),t=e[0];return e=DE.bind(null,e[1]),Gt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=xe,i=Gt();if(ye){if(n===void 0)throw Error(O(407));n=n()}else{if(n=t(),Le===null)throw Error(O(349));Sr&30||Ux(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,fm(Hx.bind(null,r,o,e),[e]),r.flags|=2048,Oo(9,Wx.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Gt(),t=Le.identifierPrefix;if(ye){var n=hn,r=dn;n=(r&~(1<<32-Ft(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Lo++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Jt]=t,e[Io]=r,mw(e,t,!1,!1),t.stateNode=e;e:{switch(s=Tc(n,r),n){case"dialog":pe("cancel",e),pe("close",e),i=r;break;case"iframe":case"object":case"embed":pe("load",e),i=r;break;case"video":case"audio":for(i=0;ixi&&(t.flags|=128,r=!0,Wi(o,!1),t.lanes=4194304)}else{if(!r)if(e=_a(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Wi(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!ye)return $e(t),null}else 2*Ce()-o.renderingStartTime>xi&&n!==1073741824&&(t.flags|=128,r=!0,Wi(o,!1),t.lanes=4194304);o.isBackwards?(s.sibling=t.child,t.child=s):(n=o.last,n!==null?n.sibling=s:t.child=s,o.last=s)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Ce(),t.sibling=null,n=ve.current,fe(ve,r?n&1|2:n&1),t):($e(t),null);case 22:case 23:return $d(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ct&1073741824&&($e(t),t.subtreeFlags&6&&(t.flags|=8192)):$e(t),null;case 24:return null;case 25:return null}throw Error(O(156,t.tag))}function WE(e,t){switch(Sd(t),t.tag){case 1:return it(t.type)&&Na(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return yi(),ge(rt),ge(He),Ad(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Rd(t),null;case 13:if(ge(ve),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(O(340));mi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ge(ve),null;case 4:return yi(),null;case 10:return Td(t.type._context),null;case 22:case 23:return $d(),null;case 24:return null;default:return null}}var Ts=!1,Ue=!1,HE=typeof WeakSet=="function"?WeakSet:Set,U=null;function Jr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){be(e,t,r)}else n.current=null}function Jc(e,t,n){try{n()}catch(r){be(e,t,r)}}var Sm=!1;function KE(e,t){if(Mc=ba,e=Sx(),wd(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,u=0,c=0,f=e,h=null;t:for(;;){for(var p;f!==n||i!==0&&f.nodeType!==3||(a=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===i&&(a=s),h===o&&++c===r&&(l=s),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Oc={focusedElem:e,selectionRange:n},ba=!1,U=t;U!==null;)if(t=U,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,U=e;else for(;U!==null;){t=U;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var v=y.memoizedProps,k=y.memoizedState,g=t.stateNode,x=g.getSnapshotBeforeUpdate(t.elementType===t.type?v:Lt(t.type,v),k);g.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(O(163))}}catch(S){be(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,U=e;break}U=t.return}return y=Sm,Sm=!1,y}function uo(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&Jc(t,n,o)}i=i.next}while(i!==r)}}function kl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ef(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function vw(e){var t=e.alternate;t!==null&&(e.alternate=null,vw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Jt],delete t[Io],delete t[zc],delete t[PE],delete t[jE])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function xw(e){return e.tag===5||e.tag===3||e.tag===4}function bm(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||xw(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function tf(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ta));else if(r!==4&&(e=e.child,e!==null))for(tf(e,t,n),e=e.sibling;e!==null;)tf(e,t,n),e=e.sibling}function nf(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(nf(e,t,n),e=e.sibling;e!==null;)nf(e,t,n),e=e.sibling}var Me=null,Mt=!1;function En(e,t,n){for(n=n.child;n!==null;)ww(e,t,n),n=n.sibling}function ww(e,t,n){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount(hl,n)}catch{}switch(n.tag){case 5:Ue||Jr(n,t);case 6:var r=Me,i=Mt;Me=null,En(e,t,n),Me=r,Mt=i,Me!==null&&(Mt?(e=Me,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Me.removeChild(n.stateNode));break;case 18:Me!==null&&(Mt?(e=Me,n=n.stateNode,e.nodeType===8?lu(e.parentNode,n):e.nodeType===1&&lu(e,n),No(e)):lu(Me,n.stateNode));break;case 4:r=Me,i=Mt,Me=n.stateNode.containerInfo,Mt=!0,En(e,t,n),Me=r,Mt=i;break;case 0:case 11:case 14:case 15:if(!Ue&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&Jc(n,t,s),i=i.next}while(i!==r)}En(e,t,n);break;case 1:if(!Ue&&(Jr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){be(n,t,a)}En(e,t,n);break;case 21:En(e,t,n);break;case 22:n.mode&1?(Ue=(r=Ue)||n.memoizedState!==null,En(e,t,n),Ue=r):En(e,t,n);break;default:En(e,t,n)}}function Cm(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new HE),t.forEach(function(r){var i=tT.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function It(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=Ce()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*GE(r/1960))-r,10e?16:e,On===null)var r=!1;else{if(e=On,On=null,Va=0,re&6)throw Error(O(331));var i=re;for(re|=4,U=e.current;U!==null;){var o=U,s=o.child;if(U.flags&16){var a=o.deletions;if(a!==null){for(var l=0;lCe()-zd?gr(e,0):Vd|=n),ot(e,t)}function Pw(e,t){t===0&&(e.mode&1?(t=ys,ys<<=1,!(ys&130023424)&&(ys=4194304)):t=1);var n=Qe();e=yn(e,t),e!==null&&(Go(e,t,n),ot(e,n))}function eT(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Pw(e,n)}function tT(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(O(314))}r!==null&&r.delete(t),Pw(e,n)}var jw;jw=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||rt.current)nt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return nt=!1,$E(e,t,n);nt=!!(e.flags&131072)}else nt=!1,ye&&t.flags&1048576&&Dx(t,Ra,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Js(e,t),e=t.pendingProps;var i=pi(t,He.current);li(t,n),i=Dd(null,t,r,e,i,n);var o=_d();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,it(r)?(o=!0,Pa(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Pd(t),i.updater=wl,t.stateNode=i,i._reactInternals=t,Kc(t,r,e,n),t=Yc(null,t,r,!0,o,n)):(t.tag=0,ye&&o&&kd(t),qe(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Js(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=rT(r),e=Lt(r,e),i){case 0:t=Gc(null,t,r,e,n);break e;case 1:t=xm(null,t,r,e,n);break e;case 11:t=ym(null,t,r,e,n);break e;case 14:t=vm(null,t,r,Lt(r.type,e),n);break e}throw Error(O(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Lt(r,i),Gc(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Lt(r,i),xm(e,t,r,i,n);case 3:e:{if(dw(t),e===null)throw Error(O(387));r=t.pendingProps,o=t.memoizedState,i=o.element,Vx(e,t),Da(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=vi(Error(O(423)),t),t=wm(e,t,r,n,i);break e}else if(r!==i){i=vi(Error(O(424)),t),t=wm(e,t,r,n,i);break e}else for(ft=$n(t.stateNode.containerInfo.firstChild),ht=t,ye=!0,Ot=null,n=Ox(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(mi(),r===i){t=vn(e,t,n);break e}qe(e,t,r,n)}t=t.child}return t;case 5:return zx(t),e===null&&Uc(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,Fc(r,i)?s=null:o!==null&&Fc(r,o)&&(t.flags|=32),fw(e,t),qe(e,t,s,n),t.child;case 6:return e===null&&Uc(t),null;case 13:return hw(e,t,n);case 4:return jd(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=gi(t,null,r,n):qe(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Lt(r,i),ym(e,t,r,i,n);case 7:return qe(e,t,t.pendingProps,n),t.child;case 8:return qe(e,t,t.pendingProps.children,n),t.child;case 12:return qe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,s=i.value,fe(Aa,r._currentValue),r._currentValue=s,o!==null)if($t(o.value,s)){if(o.children===i.children&&!rt.current){t=vn(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){s=o.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=pn(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Wc(o.return,n,t),a.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(O(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Wc(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}qe(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,li(t,n),i=Nt(i),r=r(i),t.flags|=1,qe(e,t,r,n),t.child;case 14:return r=t.type,i=Lt(r,t.pendingProps),i=Lt(r.type,i),vm(e,t,r,i,n);case 15:return uw(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Lt(r,i),Js(e,t),t.tag=1,it(r)?(e=!0,Pa(t)):e=!1,li(t,n),sw(t,r,i),Kc(t,r,i,n),Yc(null,t,r,!0,e,n);case 19:return pw(e,t,n);case 22:return cw(e,t,n)}throw Error(O(156,t.tag))};function Rw(e,t){return rx(e,t)}function nT(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bt(e,t,n,r){return new nT(e,t,n,r)}function Wd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function rT(e){if(typeof e=="function")return Wd(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ud)return 11;if(e===cd)return 14}return 2}function Kn(e,t){var n=e.alternate;return n===null?(n=bt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function na(e,t,n,r,i,o){var s=2;if(r=e,typeof e=="function")Wd(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Wr:return yr(n.children,i,o,t);case ld:s=8,i|=8;break;case gc:return e=bt(12,n,t,i|2),e.elementType=gc,e.lanes=o,e;case yc:return e=bt(13,n,t,i),e.elementType=yc,e.lanes=o,e;case vc:return e=bt(19,n,t,i),e.elementType=vc,e.lanes=o,e;case zv:return bl(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Fv:s=10;break e;case Vv:s=9;break e;case ud:s=11;break e;case cd:s=14;break e;case In:s=16,r=null;break e}throw Error(O(130,e==null?e:typeof e,""))}return t=bt(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function yr(e,t,n,r){return e=bt(7,e,r,t),e.lanes=n,e}function bl(e,t,n,r){return e=bt(22,e,r,t),e.elementType=zv,e.lanes=n,e.stateNode={isHidden:!1},e}function gu(e,t,n){return e=bt(6,e,null,t),e.lanes=n,e}function yu(e,t,n){return t=bt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function iT(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ql(0),this.expirationTimes=Ql(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ql(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Hd(e,t,n,r,i,o,s,a,l){return e=new iT(e,t,n,a,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=bt(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Pd(o),e}function oT(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(_w)}catch(e){console.error(e)}}_w(),_v.exports=yt;var Ni=_v.exports;const cT=fl(Ni);var Im=Ni;pc.createRoot=Im.createRoot,pc.hydrateRoot=Im.hydrateRoot;const Yd=m.createContext({});function Xd(e){const t=m.useRef(null);return t.current===null&&(t.current=e()),t.current}const fT=typeof window<"u",Lw=fT?m.useLayoutEffect:m.useEffect,Pl=m.createContext(null);function Qd(e,t){e.indexOf(t)===-1&&e.push(t)}function $a(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const on=(e,t,n)=>n>t?t:n{};const Yn={},Mw=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Ow(e){return typeof e=="object"&&e!==null}const Fw=e=>/^0[^.\s]+$/u.test(e);function Vw(e){let t;return()=>(t===void 0&&(t=e()),t)}const Tt=e=>e,dT=(e,t)=>n=>t(e(n)),Zo=(...e)=>e.reduce(dT),Vo=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class Jd{constructor(){this.subscriptions=[]}add(t){return Qd(this.subscriptions,t),()=>$a(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let o=0;oe*1e3,Ct=e=>e/1e3;function zw(e,t){return t?e*(1e3/t):0}const Bw=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,hT=1e-7,pT=12;function mT(e,t,n,r,i){let o,s,a=0;do s=t+(n-t)/2,o=Bw(s,r,i)-e,o>0?n=s:t=s;while(Math.abs(o)>hT&&++amT(o,0,1,e,n);return o=>o===0||o===1?o:Bw(i(o),t,r)}const $w=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Uw=e=>t=>1-e(1-t),Ww=Jo(.33,1.53,.69,.99),eh=Uw(Ww),Hw=$w(eh),Kw=e=>e>=1?1:(e*=2)<1?.5*eh(e):.5*(2-Math.pow(2,-10*(e-1))),th=e=>1-Math.sin(Math.acos(e)),qw=Uw(th),Gw=$w(th),gT=Jo(.42,0,1,1),yT=Jo(0,0,.58,1),Yw=Jo(.42,0,.58,1),vT=e=>Array.isArray(e)&&typeof e[0]!="number",Xw=e=>Array.isArray(e)&&typeof e[0]=="number",xT={linear:Tt,easeIn:gT,easeInOut:Yw,easeOut:yT,circIn:th,circInOut:Gw,circOut:qw,backIn:eh,backInOut:Hw,backOut:Ww,anticipate:Kw},wT=e=>typeof e=="string",Dm=e=>{if(Xw(e)){Zd(e.length===4);const[t,n,r,i]=e;return Jo(t,n,r,i)}else if(wT(e))return xT[e];return e},js=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function kT(e,t){let n=new Set,r=new Set,i=!1,o=!1;const s=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(c){s.has(c)&&(u.schedule(c),e()),c(a)}const u={schedule:(c,f=!1,h=!1)=>{const y=h&&i?n:r;return f&&s.add(c),y.add(c),c},cancel:c=>{r.delete(c),s.delete(c)},process:c=>{if(a=c,i){o=!0;return}i=!0;const f=n;n=r,r=f,n.forEach(l),n.clear(),i=!1,o&&(o=!1,u.process(c))}};return u}const ST=40;function Qw(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,s=js.reduce((w,S)=>(w[S]=kT(o),w),{}),{setup:a,read:l,resolveKeyframes:u,preUpdate:c,update:f,preRender:h,render:p,postRender:y}=s,v=()=>{const w=Yn.useManualTiming,S=w?i.timestamp:performance.now();n=!1,w||(i.delta=r?1e3/60:Math.max(Math.min(S-i.timestamp,ST),1)),i.timestamp=S,i.isProcessing=!0,a.process(i),l.process(i),u.process(i),c.process(i),f.process(i),h.process(i),p.process(i),y.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(v))},k=()=>{n=!0,r=!0,i.isProcessing||e(v)};return{schedule:js.reduce((w,S)=>{const T=s[S];return w[S]=(C,j=!1,P=!1)=>(n||k(),T.schedule(C,j,P)),w},{}),cancel:w=>{for(let S=0;S(ra===void 0&&Ye.set(Oe.isProcessing||Yn.useManualTiming?Oe.timestamp:performance.now()),ra),set:e=>{ra=e,queueMicrotask(bT)}},Zw=e=>t=>typeof t=="string"&&t.startsWith(e),Jw=Zw("--"),CT=Zw("var(--"),nh=e=>CT(e)?ET.test(e.split("/*")[0].trim()):!1,ET=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function _m(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Pi={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},zo={...Pi,transform:e=>on(0,1,e)},Rs={...Pi,default:1},ho=e=>Math.round(e*1e5)/1e5,rh=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function TT(e){return e==null}const NT=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ih=(e,t)=>n=>!!(typeof n=="string"&&NT.test(n)&&n.startsWith(e)||t&&!TT(n)&&Object.prototype.hasOwnProperty.call(n,t)),e0=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,o,s,a]=r.match(rh);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(s),alpha:a!==void 0?parseFloat(a):1}},PT=e=>on(0,255,e),xu={...Pi,transform:e=>Math.round(PT(e))},pr={test:ih("rgb","red"),parse:e0("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+xu.transform(e)+", "+xu.transform(t)+", "+xu.transform(n)+", "+ho(zo.transform(r))+")"};function jT(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const lf={test:ih("#"),parse:jT,transform:pr.transform},es=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),jn=es("deg"),rn=es("%"),W=es("px"),RT=es("vh"),AT=es("vw"),Lm={...rn,parse:e=>rn.parse(e)/100,transform:e=>rn.transform(e*100)},ti={test:ih("hsl","hue"),parse:e0("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+rn.transform(ho(t))+", "+rn.transform(ho(n))+", "+ho(zo.transform(r))+")"},Ne={test:e=>pr.test(e)||lf.test(e)||ti.test(e),parse:e=>pr.test(e)?pr.parse(e):ti.test(e)?ti.parse(e):lf.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?pr.transform(e):ti.transform(e),getAnimatableNone:e=>{const t=Ne.parse(e);return t.alpha=0,Ne.transform(t)}},IT=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function DT(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(rh))==null?void 0:t.length)||0)+(((n=e.match(IT))==null?void 0:n.length)||0)>0}const t0="number",n0="color",_T="var",LT="var(",Mm="${}",MT=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function wi(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let o=0;const a=t.replace(MT,l=>(Ne.test(l)?(r.color.push(o),i.push(n0),n.push(Ne.parse(l))):l.startsWith(LT)?(r.var.push(o),i.push(_T),n.push(l)):(r.number.push(o),i.push(t0),n.push(parseFloat(l))),++o,Mm)).split(Mm);return{values:n,split:a,indexes:r,types:i}}function OT(e){return wi(e).values}function r0({split:e,types:t}){const n=e.length;return r=>{let i="";for(let o=0;otypeof e=="number"?0:Ne.test(e)?Ne.getAnimatableNone(e):e,zT=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:VT(e);function BT(e){const t=wi(e);return r0(t)(t.values.map((r,i)=>zT(r,t.split[i])))}const zt={test:DT,parse:OT,createTransformer:FT,getAnimatableNone:BT};function wu(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function $T({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,o=0,s=0;if(!t)i=o=s=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;i=wu(l,a,e+1/3),o=wu(l,a,e),s=wu(l,a,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(s*255),alpha:r}}function Ua(e,t){return n=>n>0?t:e}const me=(e,t,n)=>e+(t-e)*n,ku=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},UT=[lf,pr,ti],WT=e=>UT.find(t=>t.test(e));function Om(e){const t=WT(e);if(!t)return!1;let n=t.parse(e);return t===ti&&(n=$T(n)),n}const Fm=(e,t)=>{const n=Om(e),r=Om(t);if(!n||!r)return Ua(e,t);const i={...n};return o=>(i.red=ku(n.red,r.red,o),i.green=ku(n.green,r.green,o),i.blue=ku(n.blue,r.blue,o),i.alpha=me(n.alpha,r.alpha,o),pr.transform(i))},uf=new Set(["none","hidden"]);function HT(e,t){return uf.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function KT(e,t){return n=>me(e,t,n)}function oh(e){return typeof e=="number"?KT:typeof e=="string"?nh(e)?Ua:Ne.test(e)?Fm:YT:Array.isArray(e)?i0:typeof e=="object"?Ne.test(e)?Fm:qT:Ua}function i0(e,t){const n=[...e],r=n.length,i=e.map((o,s)=>oh(o)(o,t[s]));return o=>{for(let s=0;s{for(const o in r)n[o]=r[o](i);return n}}function GT(e,t){const n=[],r={color:0,var:0,number:0};for(let i=0;i{const n=zt.createTransformer(t),r=wi(e),i=wi(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?uf.has(e)&&!i.values.length||uf.has(t)&&!r.values.length?HT(e,t):Zo(i0(GT(r,i),i.values),n):Ua(e,t)};function o0(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?me(e,t,n):oh(e)(e,t)}const XT=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>le.update(t,n),stop:()=>Xn(t),now:()=>Oe.isProcessing?Oe.timestamp:Ye.now()}},s0=(e,t,n=10)=>{let r="";const i=Math.max(Math.round(t/n),2);for(let o=0;o=Wa?1/0:t}function QT(e,t=100,n){const r=n({...e,keyframes:[0,t]}),i=Math.min(sh(r),Wa);return{type:"keyframes",ease:o=>r.next(i*o).value/t,duration:Ct(i)}}const Se={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function cf(e,t){return e*Math.sqrt(1-t*t)}const ZT=12;function JT(e,t,n){let r=n;for(let i=1;i{const c=u*s,f=c*e,h=c-n,p=cf(u,s),y=Math.exp(-f);return Su-h/p*y},o=u=>{const f=u*s*e,h=f*n+n,p=Math.pow(s,2)*Math.pow(u,2)*e,y=Math.exp(-f),v=cf(Math.pow(u,2),s);return(-i(u)+Su>0?-1:1)*((h-p)*y)/v}):(i=u=>{const c=Math.exp(-u*e),f=(u-n)*e+1;return-Su+c*f},o=u=>{const c=Math.exp(-u*e),f=(n-u)*(e*e);return c*f});const a=5/e,l=JT(i,o,a);if(e=pt(e),isNaN(l))return{stiffness:Se.stiffness,damping:Se.damping,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:s*2*Math.sqrt(r*u),duration:e}}}const tN=["duration","bounce"],nN=["stiffness","damping","mass"];function Vm(e,t){return t.some(n=>e[n]!==void 0)}function rN(e){let t={velocity:Se.velocity,stiffness:Se.stiffness,damping:Se.damping,mass:Se.mass,isResolvedFromDuration:!1,...e};if(!Vm(e,nN)&&Vm(e,tN))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,o=2*on(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Se.mass,stiffness:i,damping:o}}else{const n=eN({...e,velocity:0});t={...t,...n,mass:Se.mass},t.isResolvedFromDuration=!0}return t}function Ha(e=Se.visualDuration,t=Se.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:i}=n;const o=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:u,mass:c,duration:f,velocity:h,isResolvedFromDuration:p}=rN({...n,velocity:-Ct(n.velocity||0)}),y=h||0,v=u/(2*Math.sqrt(l*c)),k=s-o,g=Ct(Math.sqrt(l/c)),x=Math.abs(k)<5;r||(r=x?Se.restSpeed.granular:Se.restSpeed.default),i||(i=x?Se.restDelta.granular:Se.restDelta.default);let w,S,T,C,j,P;if(v<1)T=cf(g,v),C=(y+v*g*k)/T,w=b=>{const A=Math.exp(-v*g*b);return s-A*(C*Math.sin(T*b)+k*Math.cos(T*b))},j=v*g*C+k*T,P=v*g*k-C*T,S=b=>Math.exp(-v*g*b)*(j*Math.sin(T*b)+P*Math.cos(T*b));else if(v===1){w=A=>s-Math.exp(-g*A)*(k+(y+g*k)*A);const b=y+g*k;S=A=>Math.exp(-g*A)*(g*b*A-y)}else{const b=g*Math.sqrt(v*v-1);w=L=>{const $=Math.exp(-v*g*L),K=Math.min(b*L,300);return s-$*((y+v*g*k)*Math.sinh(K)+b*k*Math.cosh(K))/b};const A=(y+v*g*k)/b,I=v*g*A-k*b,_=v*g*k-A*b;S=L=>{const $=Math.exp(-v*g*L),K=Math.min(b*L,300);return $*(I*Math.sinh(K)+_*Math.cosh(K))}}const R={calculatedDuration:p&&f||null,velocity:b=>pt(S(b)),next:b=>{if(!p&&v<1){const I=Math.exp(-v*g*b),_=Math.sin(T*b),L=Math.cos(T*b),$=s-I*(C*_+k*L),K=pt(I*(j*_+P*L));return a.done=Math.abs(K)<=r&&Math.abs(s-$)<=i,a.value=a.done?s:$,a}const A=w(b);if(p)a.done=b>=f;else{const I=pt(S(b));a.done=Math.abs(I)<=r&&Math.abs(s-A)<=i}return a.value=a.done?s:A,a},toString:()=>{const b=Math.min(sh(R),Wa),A=s0(I=>R.next(b*I).value,b,30);return b+"ms "+A},toTransition:()=>{}};return R}Ha.applyToOptions=e=>{const t=QT(e,100,Ha);return e.ease=t.ease,e.duration=pt(t.duration),e.type="keyframes",e};const iN=5;function a0(e,t,n){const r=Math.max(t-iN,0);return zw(n-e(r),t-r)}function ff({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:l,restDelta:u=.5,restSpeed:c}){const f=e[0],h={done:!1,value:f},p=P=>a!==void 0&&Pl,y=P=>a===void 0?l:l===void 0||Math.abs(a-P)-v*Math.exp(-P/r),w=P=>g+x(P),S=P=>{const R=x(P),b=w(P);h.done=Math.abs(R)<=u,h.value=h.done?g:b};let T,C;const j=P=>{p(h.value)&&(T=P,C=Ha({keyframes:[h.value,y(h.value)],velocity:a0(w,P,h.value),damping:i,stiffness:o,restDelta:u,restSpeed:c}))};return j(0),{calculatedDuration:null,next:P=>{let R=!1;return!C&&T===void 0&&(R=!0,S(P),j(P)),T!==void 0&&P>=T?C.next(P-T):(!R&&S(P),h)}}}function oN(e,t,n){const r=[],i=n||Yn.mix||o0,o=e.length-1;for(let s=0;st[0];if(o===2&&t[0]===t[1])return()=>t[1];const s=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=oN(t,r,i),l=a.length,u=c=>{if(s&&c1)for(;fu(on(e[0],e[o-1],c)):u}function aN(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=Vo(0,t,r);e.push(me(n,1,i))}}function lN(e){const t=[0];return aN(t,e.length-1),t}function uN(e,t){return e.map(n=>n*t)}function cN(e,t){return e.map(()=>t||Yw).splice(0,e.length-1)}function po({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=vT(r)?r.map(Dm):Dm(r),o={done:!1,value:t[0]},s=uN(n&&n.length===t.length?n:lN(t),e),a=sN(s,t,{ease:Array.isArray(i)?i:cN(t,i)});return{calculatedDuration:e,next:l=>(o.value=a(l),o.done=l>=e,o)}}const fN=e=>e!==null;function jl(e,{repeat:t,repeatType:n="loop"},r,i=1){const o=e.filter(fN),a=i<0||t&&n!=="loop"&&t%2===1?0:o.length-1;return!a||r===void 0?o[a]:r}const dN={decay:ff,inertia:ff,tween:po,keyframes:po,spring:Ha};function l0(e){typeof e.type=="string"&&(e.type=dN[e.type])}class ah{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const hN=e=>e/100;class Ka extends ah{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var r,i;const{motionValue:n}=this.options;n&&n.updatedAt!==Ye.now()&&this.tick(Ye.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(i=(r=this.options).onStop)==null||i.call(r))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;l0(t);const{type:n=po,repeat:r=0,repeatDelay:i=0,repeatType:o,velocity:s=0}=t;let{keyframes:a}=t;const l=n||po;l!==po&&typeof a[0]!="number"&&(this.mixKeyframes=Zo(hN,o0(a[0],a[1])),a=[0,100]);const u=l({...t,keyframes:a});o==="mirror"&&(this.mirroredGenerator=l({...t,keyframes:[...a].reverse(),velocity:-s})),u.calculatedDuration===null&&(u.calculatedDuration=sh(u));const{calculatedDuration:c}=u;this.calculatedDuration=c,this.resolvedDuration=c+i,this.totalDuration=this.resolvedDuration*(r+1)-i,this.generator=u}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:i,mixKeyframes:o,mirroredGenerator:s,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return r.next(0);const{delay:u=0,keyframes:c,repeat:f,repeatType:h,repeatDelay:p,type:y,onUpdate:v,finalKeyframe:k}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const g=this.currentTime-u*(this.playbackSpeed>=0?1:-1),x=this.playbackSpeed>=0?g<0:g>i;this.currentTime=Math.max(g,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let w=this.currentTime,S=r;if(f){const P=Math.min(this.currentTime,i)/a;let R=Math.floor(P),b=P%1;!b&&P>=1&&(b=1),b===1&&R--,R=Math.min(R,f+1),!!(R%2)&&(h==="reverse"?(b=1-b,p&&(b-=p/a)):h==="mirror"&&(S=s)),w=on(0,1,b)*a}let T;x?(this.delayState.value=c[0],T=this.delayState):T=S.next(w),o&&!x&&(T.value=o(T.value));let{done:C}=T;!x&&l!==null&&(C=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const j=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return j&&y!==ff&&(T.value=jl(c,this.options,k,this.speed)),v&&v(T.value),j&&this.finish(),T}then(t,n){return this.finished.then(t,n)}get duration(){return Ct(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Ct(t)}get time(){return Ct(this.currentTime)}set time(t){t=pt(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const n=this.generator.next(t).value;return a0(r=>this.generator.next(r).value,t,n)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime(Ye.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=Ct(this.currentTime))}play(){var i,o;if(this.isStopped)return;const{driver:t=XT,startTime:n}=this.options;this.driver||(this.driver=t(s=>this.tick(s))),(o=(i=this.options).onPlay)==null||o.call(i);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Ye.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function pN(e){for(let t=1;te*180/Math.PI,df=e=>{const t=mr(Math.atan2(e[1],e[0]));return hf(t)},mN={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:df,rotateZ:df,skewX:e=>mr(Math.atan(e[1])),skewY:e=>mr(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},hf=e=>(e=e%360,e<0&&(e+=360),e),zm=df,Bm=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),$m=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),gN={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Bm,scaleY:$m,scale:e=>(Bm(e)+$m(e))/2,rotateX:e=>hf(mr(Math.atan2(e[6],e[5]))),rotateY:e=>hf(mr(Math.atan2(-e[2],e[0]))),rotateZ:zm,rotate:zm,skewX:e=>mr(Math.atan(e[4])),skewY:e=>mr(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function pf(e){return e.includes("scale")?1:0}function mf(e,t){if(!e||e==="none")return pf(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(n)r=gN,i=n;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=mN,i=a}if(!i)return pf(t);const o=r[t],s=i[1].split(",").map(vN);return typeof o=="function"?o(s):s[o]}const yN=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return mf(n,t)};function vN(e){return parseFloat(e.trim())}const ji=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ri=new Set(ji),Um=e=>e===Pi||e===W,xN=new Set(["x","y","z"]),wN=ji.filter(e=>!xN.has(e));function kN(e){const t=[];return wN.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const Fn={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:r})=>{const i=e.max-e.min;return r==="border-box"?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:r})=>{const i=e.max-e.min;return r==="border-box"?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>mf(t,"x"),y:(e,{transform:t})=>mf(t,"y")};Fn.translateX=Fn.x;Fn.translateY=Fn.y;const vr=new Set;let gf=!1,yf=!1,vf=!1;function u0(){if(yf){const e=Array.from(vr).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const i=kN(r);i.length&&(n.set(r,i),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([o,s])=>{var a;(a=r.getValue(o))==null||a.set(s)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}yf=!1,gf=!1,vr.forEach(e=>e.complete(vf)),vr.clear()}function c0(){vr.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(yf=!0)})}function SN(){vf=!0,c0(),u0(),vf=!1}class lh{constructor(t,n,r,i,o,s=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=i,this.element=o,this.isAsync=s}scheduleResolve(){this.state="scheduled",this.isAsync?(vr.add(this),gf||(gf=!0,le.read(c0),le.resolveKeyframes(u0))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:i}=this;if(t[0]===null){const o=i==null?void 0:i.get(),s=t[t.length-1];if(o!==void 0)t[0]=o;else if(r&&n){const a=r.readValue(n,s);a!=null&&(t[0]=a)}t[0]===void 0&&(t[0]=s),i&&o===void 0&&i.set(t[0])}pN(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),vr.delete(this)}cancel(){this.state==="scheduled"&&(vr.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const bN=e=>e.startsWith("--");function f0(e,t,n){bN(t)?e.style.setProperty(t,n):e.style[t]=n}const CN={};function d0(e,t){const n=Vw(e);return()=>CN[t]??n()}const EN=d0(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),h0=d0(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),to=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Wm={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:to([0,.65,.55,1]),circOut:to([.55,0,1,.45]),backIn:to([.31,.01,.66,-.59]),backOut:to([.33,1.53,.69,.99])};function p0(e,t){if(e)return typeof e=="function"?h0()?s0(e,t):"ease-out":Xw(e)?to(e):Array.isArray(e)?e.map(n=>p0(n,t)||Wm.easeOut):Wm[e]}function TN(e,t,n,{delay:r=0,duration:i=300,repeat:o=0,repeatType:s="loop",ease:a="easeOut",times:l}={},u=void 0){const c={[t]:n};l&&(c.offset=l);const f=p0(a,i);Array.isArray(f)&&(c.easing=f);const h={delay:r,duration:i,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:o+1,direction:s==="reverse"?"alternate":"normal"};return u&&(h.pseudoElement=u),e.animate(c,h)}function m0(e){return typeof e=="function"&&"applyToOptions"in e}function NN({type:e,...t}){return m0(e)&&h0()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class g0 extends ah{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:r,keyframes:i,pseudoElement:o,allowFlatten:s=!1,finalKeyframe:a,onComplete:l}=t;this.isPseudoElement=!!o,this.allowFlatten=s,this.options=t,Zd(typeof t.type!="string");const u=NN(t);this.animation=TN(n,r,i,u,o),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const c=jl(i,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(c),f0(n,r,c),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var n,r,i;const t=(n=this.options)==null?void 0:n.element;!this.isPseudoElement&&(t!=null&&t.isConnected)&&((i=(r=this.animation).commitStyles)==null||i.call(r))}get duration(){var n,r;const t=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return Ct(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Ct(t)}get time(){return Ct(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=pt(t),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:n,rangeEnd:r,observe:i}){var o;return this.allowFlatten&&((o=this.animation.effect)==null||o.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&EN()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),Tt):i(this)}}const y0={anticipate:Kw,backInOut:Hw,circInOut:Gw};function PN(e){return e in y0}function jN(e){typeof e.ease=="string"&&PN(e.ease)&&(e.ease=y0[e.ease])}const bu=10;class RN extends g0{constructor(t){jN(t),l0(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:i,element:o,...s}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const a=new Ka({...s,autoplay:!1}),l=Math.max(bu,Ye.now()-this.startTime),u=on(0,bu,l-bu),c=a.sample(l).value,{name:f}=this.options;o&&f&&f0(o,f,c),n.setWithVelocity(a.sample(Math.max(0,l-u)).value,c,u),a.stop()}}const Hm=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(zt.test(e)||e==="0")&&!e.startsWith("url("));function AN(e){const t=e[0];if(e.length===1)return!0;for(let n=0;nObject.hasOwnProperty.call(Element.prototype,"animate"));function ON(e){var f;const{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:o,type:s,keyframes:a}=e;if(!(((f=t==null?void 0:t.owner)==null?void 0:f.current)instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:c}=t.owner.getProps();return MN()&&n&&(v0.has(n)||LN.has(n)&&_N(a))&&(n!=="transform"||!c)&&!u&&!r&&i!=="mirror"&&o!==0&&s!=="inertia"}const FN=40;class VN extends ah{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:o=0,repeatType:s="loop",keyframes:a,name:l,motionValue:u,element:c,...f}){var y;super(),this.stop=()=>{var v,k;this._animation&&(this._animation.stop(),(v=this.stopTimeline)==null||v.call(this)),(k=this.keyframeResolver)==null||k.cancel()},this.createdAt=Ye.now();const h={autoplay:t,delay:n,type:r,repeat:i,repeatDelay:o,repeatType:s,name:l,motionValue:u,element:c,...f},p=(c==null?void 0:c.KeyframeResolver)||lh;this.keyframeResolver=new p(a,(v,k,g)=>this.onKeyframesResolved(v,k,h,!g),l,u,c),(y=this.keyframeResolver)==null||y.scheduleResolve()}onKeyframesResolved(t,n,r,i){var g,x;this.keyframeResolver=void 0;const{name:o,type:s,velocity:a,delay:l,isHandoff:u,onUpdate:c}=r;this.resolvedAt=Ye.now();let f=!0;IN(t,o,s,a)||(f=!1,(Yn.instantAnimations||!l)&&(c==null||c(jl(t,r,n))),t[0]=t[t.length-1],xf(r),r.repeat=0);const p={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>FN?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},y=f&&!u&&ON(p),v=(x=(g=p.motionValue)==null?void 0:g.owner)==null?void 0:x.current;let k;if(y)try{k=new RN({...p,element:v})}catch{k=new Ka(p)}else k=new Ka(p);k.finished.then(()=>{this.notifyFinished()}).catch(Tt),this.pendingTimeline&&(this.stopTimeline=k.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=k}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),SN()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}function x0(e,t,n,r=0,i=1){const o=Array.from(e).sort((u,c)=>u.sortNodePosition(c)).indexOf(t),s=e.size,a=(s-1)*r;return typeof n=="function"?n(o,s):i===1?o*r:a-o*r}const zN=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function BN(e){const t=zN.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}function w0(e,t,n=1){const[r,i]=BN(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const s=o.trim();return Mw(s)?parseFloat(s):s}return nh(i)?w0(i,t,n+1):i}const $N={type:"spring",stiffness:500,damping:25,restSpeed:10},UN=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),WN={type:"keyframes",duration:.8},HN={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},KN=(e,{keyframes:t})=>t.length>2?WN:Ri.has(e)?e.startsWith("scale")?UN(t[1]):$N:HN;function k0(e,t){if(e!=null&&e.inherit&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function uh(e,t){const n=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return n!==e?k0(n,e):n}const qN=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function GN(e){for(const t in e)if(!qN.has(t))return!0;return!1}const ch=(e,t,n,r={},i,o)=>s=>{const a=uh(r,e)||{},l=a.delay||r.delay||0;let{elapsed:u=0}=r;u=u-pt(l);const c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-u,onUpdate:h=>{t.set(h),a.onUpdate&&a.onUpdate(h)},onComplete:()=>{s(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:o?void 0:i};GN(a)||Object.assign(c,KN(e,c)),c.duration&&(c.duration=pt(c.duration)),c.repeatDelay&&(c.repeatDelay=pt(c.repeatDelay)),c.from!==void 0&&(c.keyframes[0]=c.from);let f=!1;if((c.type===!1||c.duration===0&&!c.repeatDelay)&&(xf(c),c.delay===0&&(f=!0)),(Yn.instantAnimations||Yn.skipAnimations||i!=null&&i.shouldSkipAnimations)&&(f=!0,xf(c),c.delay=0),c.allowFlatten=!a.type&&!a.ease,f&&!o&&t.get()!==void 0){const h=jl(c.keyframes,a);if(h!==void 0){le.update(()=>{c.onUpdate(h),c.onComplete()});return}}return a.isSync?new Ka(c):new VN(c)};function Km(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function fh(e,t,n,r){if(typeof t=="function"){const[i,o]=Km(r);t=t(n!==void 0?n:e.custom,i,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,o]=Km(r);t=t(n!==void 0?n:e.custom,i,o)}return t}function xr(e,t,n){const r=e.getProps();return fh(r,t,n!==void 0?n:r.custom,e)}const S0=new Set(["width","height","top","left","right","bottom",...ji]),qm=30,YN=e=>!isNaN(parseFloat(e));class XN{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var o;const i=Ye.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((o=this.events.change)==null||o.notify(this.current),this.dependents))for(const s of this.dependents)s.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Ye.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=YN(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Jd);const r=this.events[t].add(n);return t==="change"?()=>{r(),le.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Ye.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>qm)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,qm);return zw(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ki(e,t){return new XN(e,t)}const wf=e=>Array.isArray(e);function QN(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,ki(n))}function ZN(e){return wf(e)?e[e.length-1]||0:e}function JN(e,t){const n=xr(e,t);let{transitionEnd:r={},transition:i={},...o}=n||{};o={...o,...r};for(const s in o){const a=ZN(o[s]);QN(e,s,a)}}const Fe=e=>!!(e&&e.getVelocity);function eP(e){return!!(Fe(e)&&e.add)}function kf(e,t){const n=e.getValue("willChange");if(eP(n))return n.add(t);if(!n&&Yn.WillChange){const r=new Yn.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function dh(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const tP="framerAppearId",b0="data-"+dh(tP);function C0(e){return e.props[b0]}function nP({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function E0(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:o,transitionEnd:s,...a}=t;const l=e.getDefaultTransition();o=o?k0(o,l):l;const u=o==null?void 0:o.reduceMotion;r&&(o=r);const c=[],f=i&&e.animationState&&e.animationState.getState()[i];for(const h in a){const p=e.getValue(h,e.latestValues[h]??null),y=a[h];if(y===void 0||f&&nP(f,h))continue;const v={delay:n,...uh(o||{},h)},k=p.get();if(k!==void 0&&!p.isAnimating()&&!Array.isArray(y)&&y===k&&!v.velocity){le.update(()=>p.set(y));continue}let g=!1;if(window.MotionHandoffAnimation){const S=C0(e);if(S){const T=window.MotionHandoffAnimation(S,h,le);T!==null&&(v.startTime=T,g=!0)}}kf(e,h);const x=u??e.shouldReduceMotion;p.start(ch(h,p,y,x&&S0.has(h)?{type:!1}:v,e,g));const w=p.animation;w&&c.push(w)}if(s){const h=()=>le.update(()=>{s&&JN(e,s)});c.length?Promise.all(c).then(h):h()}return c}function Sf(e,t,n={}){var l;const r=xr(e,t,n.type==="exit"?(l=e.presenceContext)==null?void 0:l.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all(E0(e,r,n)):()=>Promise.resolve(),s=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:c=0,staggerChildren:f,staggerDirection:h}=i;return rP(e,t,u,c,f,h,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[u,c]=a==="beforeChildren"?[o,s]:[s,o];return u().then(()=>c())}else return Promise.all([o(),s(n.delay)])}function rP(e,t,n=0,r=0,i=0,o=1,s){const a=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),a.push(Sf(l,t,{...s,delay:n+(typeof r=="function"?0:r)+x0(e.variantChildren,l,r,i,o)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(a)}function iP(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(o=>Sf(e,o,n));r=Promise.all(i)}else if(typeof t=="string")r=Sf(e,t,n);else{const i=typeof t=="function"?xr(e,t,n.custom):t;r=Promise.all(E0(e,i,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const oP={test:e=>e==="auto",parse:e=>e},T0=e=>t=>t.test(e),N0=[Pi,W,rn,jn,AT,RT,oP],Gm=e=>N0.find(T0(e));function sP(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Fw(e):!0}const aP=new Set(["brightness","contrast","saturate","opacity"]);function lP(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(rh)||[];if(!r)return e;const i=n.replace(r,"");let o=aP.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+i+")"}const uP=/\b([a-z-]*)\(.*?\)/gu,bf={...zt,getAnimatableNone:e=>{const t=e.match(uP);return t?t.map(lP).join(" "):e}},Cf={...zt,getAnimatableNone:e=>{const t=zt.parse(e);return zt.createTransformer(e)(t.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},Ym={...Pi,transform:Math.round},cP={rotate:jn,rotateX:jn,rotateY:jn,rotateZ:jn,scale:Rs,scaleX:Rs,scaleY:Rs,scaleZ:Rs,skew:jn,skewX:jn,skewY:jn,distance:W,translateX:W,translateY:W,translateZ:W,x:W,y:W,z:W,perspective:W,transformPerspective:W,opacity:zo,originX:Lm,originY:Lm,originZ:W},hh={borderWidth:W,borderTopWidth:W,borderRightWidth:W,borderBottomWidth:W,borderLeftWidth:W,borderRadius:W,borderTopLeftRadius:W,borderTopRightRadius:W,borderBottomRightRadius:W,borderBottomLeftRadius:W,width:W,maxWidth:W,height:W,maxHeight:W,top:W,right:W,bottom:W,left:W,inset:W,insetBlock:W,insetBlockStart:W,insetBlockEnd:W,insetInline:W,insetInlineStart:W,insetInlineEnd:W,padding:W,paddingTop:W,paddingRight:W,paddingBottom:W,paddingLeft:W,paddingBlock:W,paddingBlockStart:W,paddingBlockEnd:W,paddingInline:W,paddingInlineStart:W,paddingInlineEnd:W,margin:W,marginTop:W,marginRight:W,marginBottom:W,marginLeft:W,marginBlock:W,marginBlockStart:W,marginBlockEnd:W,marginInline:W,marginInlineStart:W,marginInlineEnd:W,fontSize:W,backgroundPositionX:W,backgroundPositionY:W,...cP,zIndex:Ym,fillOpacity:zo,strokeOpacity:zo,numOctaves:Ym},fP={...hh,color:Ne,backgroundColor:Ne,outlineColor:Ne,fill:Ne,stroke:Ne,borderColor:Ne,borderTopColor:Ne,borderRightColor:Ne,borderBottomColor:Ne,borderLeftColor:Ne,filter:bf,WebkitFilter:bf,mask:Cf,WebkitMask:Cf},P0=e=>fP[e],dP=new Set([bf,Cf]);function j0(e,t){let n=P0(e);return dP.has(n)||(n=zt),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const hP=new Set(["auto","none","0"]);function pP(e,t,n){let r=0,i;for(;r{t.getValue(l).set(u)}),this.resolveNoneKeyframes()}}function R0(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const i=(n==null?void 0:n[e])??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(r=>r!=null)}const A0=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function ia(e){return Ow(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:ph}=Qw(queueMicrotask,!1),_t={x:!1,y:!1};function I0(){return _t.x||_t.y}function gP(e){return e==="x"||e==="y"?_t[e]?null:(_t[e]=!0,()=>{_t[e]=!1}):_t.x||_t.y?null:(_t.x=_t.y=!0,()=>{_t.x=_t.y=!1})}function D0(e,t){const n=R0(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function yP(e){return!(e.pointerType==="touch"||I0())}function vP(e,t,n={}){const[r,i,o]=D0(e,n);return r.forEach(s=>{let a=!1,l=!1,u;const c=()=>{s.removeEventListener("pointerleave",y)},f=k=>{u&&(u(k),u=void 0),c()},h=k=>{a=!1,window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",h),l&&(l=!1,f(k))},p=()=>{a=!0,window.addEventListener("pointerup",h,i),window.addEventListener("pointercancel",h,i)},y=k=>{if(k.pointerType!=="touch"){if(a){l=!0;return}f(k)}},v=k=>{if(!yP(k))return;l=!1;const g=t(s,k);typeof g=="function"&&(u=g,s.addEventListener("pointerleave",y,i))};s.addEventListener("pointerenter",v,i),s.addEventListener("pointerdown",p,i)}),o}const _0=(e,t)=>t?e===t?!0:_0(e,t.parentElement):!1,mh=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,xP=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function wP(e){return xP.has(e.tagName)||e.isContentEditable===!0}const kP=new Set(["INPUT","SELECT","TEXTAREA"]);function SP(e){return kP.has(e.tagName)||e.isContentEditable===!0}const oa=new WeakSet;function Xm(e){return t=>{t.key==="Enter"&&e(t)}}function Cu(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const bP=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=Xm(()=>{if(oa.has(n))return;Cu(n,"down");const i=Xm(()=>{Cu(n,"up")}),o=()=>Cu(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",o,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function Qm(e){return mh(e)&&!I0()}const Zm=new WeakSet;function CP(e,t,n={}){const[r,i,o]=D0(e,n),s=a=>{const l=a.currentTarget;if(!Qm(a)||Zm.has(a))return;oa.add(l),n.stopPropagation&&Zm.add(a);const u=t(l,a),c=(p,y)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),oa.has(l)&&oa.delete(l),Qm(p)&&typeof u=="function"&&u(p,{success:y})},f=p=>{c(p,l===window||l===document||n.useGlobalTarget||_0(l,p.target))},h=p=>{c(p,!1)};window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",h,i)};return r.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",s,i),ia(a)&&(a.addEventListener("focus",u=>bP(u,i)),!wP(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),o}function gh(e){return Ow(e)&&"ownerSVGElement"in e}const sa=new WeakMap;let Rn;const L0=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+"Size"]:gh(r)&&"getBBox"in r?r.getBBox()[t]:r[n],EP=L0("inline","width","offsetWidth"),TP=L0("block","height","offsetHeight");function NP({target:e,borderBoxSize:t}){var n;(n=sa.get(e))==null||n.forEach(r=>{r(e,{get width(){return EP(e,t)},get height(){return TP(e,t)}})})}function PP(e){e.forEach(NP)}function jP(){typeof ResizeObserver>"u"||(Rn=new ResizeObserver(PP))}function RP(e,t){Rn||jP();const n=R0(e);return n.forEach(r=>{let i=sa.get(r);i||(i=new Set,sa.set(r,i)),i.add(t),Rn==null||Rn.observe(r)}),()=>{n.forEach(r=>{const i=sa.get(r);i==null||i.delete(t),i!=null&&i.size||Rn==null||Rn.unobserve(r)})}}const aa=new Set;let ni;function AP(){ni=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};aa.forEach(t=>t(e))},window.addEventListener("resize",ni)}function IP(e){return aa.add(e),ni||AP(),()=>{aa.delete(e),!aa.size&&typeof ni=="function"&&(window.removeEventListener("resize",ni),ni=void 0)}}function Jm(e,t){return typeof e=="function"?IP(e):RP(e,t)}function DP(e){return gh(e)&&e.tagName==="svg"}const _P=[...N0,Ne,zt],LP=e=>_P.find(T0(e)),eg=()=>({translate:0,scale:1,origin:0,originPoint:0}),ri=()=>({x:eg(),y:eg()}),tg=()=>({min:0,max:0}),je=()=>({x:tg(),y:tg()}),MP=new WeakMap;function Rl(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Bo(e){return typeof e=="string"||Array.isArray(e)}const yh=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],vh=["initial",...yh];function Al(e){return Rl(e.animate)||vh.some(t=>Bo(e[t]))}function M0(e){return!!(Al(e)||e.variants)}function OP(e,t,n){for(const r in t){const i=t[r],o=n[r];if(Fe(i))e.addValue(r,i);else if(Fe(o))e.addValue(r,ki(i,{owner:e}));else if(o!==i)if(e.hasValue(r)){const s=e.getValue(r);s.liveStyle===!0?s.jump(i):s.hasAnimated||s.set(i)}else{const s=e.getStaticValue(r);e.addValue(r,ki(s!==void 0?s:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const Ef={current:null},O0={current:!1},FP=typeof window<"u";function VP(){if(O0.current=!0,!!FP)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Ef.current=e.matches;e.addEventListener("change",t),t()}else Ef.current=!1}const ng=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let qa={};function F0(e){qa=e}function zP(){return qa}class BP{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,skipAnimations:o,blockInitialAnimation:s,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=lh,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=Ye.now();this.renderScheduledAtthis.bindToMotionValue(o,i)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(O0.current||VP(),this.shouldReduceMotion=Ef.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var t;this.projection&&this.projection.unmount(),Xn(this.notifyUpdate),Xn(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&v0.has(t)&&this.current instanceof HTMLElement){const{factory:s,keyframes:a,times:l,ease:u,duration:c}=n.accelerate,f=new g0({element:this.current,name:t,keyframes:a,times:l,ease:u,duration:pt(c)}),h=s(f);this.valueSubscriptions.set(t,()=>{h(),f.cancel()});return}const r=Ri.has(t);r&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",s=>{this.latestValues[t]=s,this.props.onUpdate&&le.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;typeof window<"u"&&window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in qa){const n=qa[t];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[t]&&i&&r(this.props)&&(this.features[t]=new i(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):je()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=ki(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(Mw(r)||Fw(r))?r=parseFloat(r):!LP(r)&&zt.test(n)&&(r=j0(t,n)),this.setBaseTarget(t,Fe(r)?r.get():r)),Fe(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var o;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const s=fh(this.props,n,(o=this.presenceContext)==null?void 0:o.custom);s&&(r=s[t])}if(n&&r!==void 0)return r;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!Fe(i)?i:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Jd),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){ph.render(this.render)}}class V0 extends BP{constructor(){super(...arguments),this.KeyframeResolver=mP}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const r=t.style;return r?r[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Fe(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class tr{constructor(t){this.isMounted=!1,this.node=t}update(){}}function z0({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function $P({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function UP(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Eu(e){return e===void 0||e===1}function Tf({scale:e,scaleX:t,scaleY:n}){return!Eu(e)||!Eu(t)||!Eu(n)}function ur(e){return Tf(e)||B0(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function B0(e){return rg(e.x)||rg(e.y)}function rg(e){return e&&e!=="0%"}function Ga(e,t,n){const r=e-n,i=t*r;return n+i}function ig(e,t,n,r,i){return i!==void 0&&(e=Ga(e,i,r)),Ga(e,n,r)+t}function Nf(e,t=0,n=1,r,i){e.min=ig(e.min,t,n,r,i),e.max=ig(e.max,t,n,r,i)}function $0(e,{x:t,y:n}){Nf(e.x,t.translate,t.scale,t.originPoint),Nf(e.y,n.translate,n.scale,n.originPoint)}const og=.999999999999,sg=1.0000000000001;function WP(e,t,n,r=!1){var a;const i=n.length;if(!i)return;t.x=t.y=1;let o,s;for(let l=0;log&&(t.x=1),t.yog&&(t.y=1)}function Zt(e,t){e.min+=t,e.max+=t}function ag(e,t,n,r,i=.5){const o=me(e.min,e.max,i);Nf(e,t,n,o,r)}function lg(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function la(e,t,n){const r=n??e;ag(e.x,lg(t.x,r.x),t.scaleX,t.scale,t.originX),ag(e.y,lg(t.y,r.y),t.scaleY,t.scale,t.originY)}function U0(e,t){return z0(UP(e.getBoundingClientRect(),t))}function HP(e,t,n){const r=U0(e,n),{scroll:i}=t;return i&&(Zt(r.x,i.offset.x),Zt(r.y,i.offset.y)),r}const KP={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},qP=ji.length;function GP(e,t,n){let r="",i=!0;for(let o=0;o{if(!t.target)return e;if(typeof e=="string")if(W.test(e))e=parseFloat(e);else return e;const n=ug(e,t.target.x),r=ug(e,t.target.y);return`${n}% ${r}%`}},YP={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=zt.parse(e);if(i.length>5)return r;const o=zt.createTransformer(e),s=typeof i[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;i[0+s]/=a,i[1+s]/=l;const u=me(a,l,.5);return typeof i[2+s]=="number"&&(i[2+s]/=u),typeof i[3+s]=="number"&&(i[3+s]/=u),o(i)}},Pf={borderRadius:{...Ki,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ki,borderTopRightRadius:Ki,borderBottomLeftRadius:Ki,borderBottomRightRadius:Ki,boxShadow:YP};function H0(e,{layout:t,layoutId:n}){return Ri.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Pf[e]||e==="opacity")}function wh(e,t,n){var s;const r=e.style,i=t==null?void 0:t.style,o={};if(!r)return o;for(const a in r)(Fe(r[a])||i&&Fe(i[a])||H0(a,e)||((s=n==null?void 0:n.getValue(a))==null?void 0:s.liveStyle)!==void 0)&&(o[a]=r[a]);return o}function XP(e){return window.getComputedStyle(e)}class QP extends V0{constructor(){super(...arguments),this.type="html",this.renderInstance=W0}readValueFromInstance(t,n){var r;if(Ri.has(n))return(r=this.projection)!=null&&r.isProjecting?pf(n):yN(t,n);{const i=XP(t),o=(Jw(n)?i.getPropertyValue(n):i[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:n}){return U0(t,n)}build(t,n,r){xh(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return wh(t,n,r)}}const ZP={offset:"stroke-dashoffset",array:"stroke-dasharray"},JP={offset:"strokeDashoffset",array:"strokeDasharray"};function ej(e,t,n=1,r=0,i=!0){e.pathLength=1;const o=i?ZP:JP;e[o.offset]=`${-r}`,e[o.array]=`${t} ${n}`}const tj=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function K0(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:o=1,pathOffset:s=0,...a},l,u,c){if(xh(e,a,u),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:f,style:h}=e;f.transform&&(h.transform=f.transform,delete f.transform),(h.transform||f.transformOrigin)&&(h.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),h.transform&&(h.transformBox=(c==null?void 0:c.transformBox)??"fill-box",delete f.transformBox);for(const p of tj)f[p]!==void 0&&(h[p]=f[p],delete f[p]);t!==void 0&&(f.x=t),n!==void 0&&(f.y=n),r!==void 0&&(f.scale=r),i!==void 0&&ej(f,i,o,s,!1)}const q0=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),G0=e=>typeof e=="string"&&e.toLowerCase()==="svg";function nj(e,t,n,r){W0(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(q0.has(i)?i:dh(i),t.attrs[i])}function Y0(e,t,n){const r=wh(e,t,n);for(const i in e)if(Fe(e[i])||Fe(t[i])){const o=ji.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[o]=e[i]}return r}class rj extends V0{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=je}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Ri.has(n)){const r=P0(n);return r&&r.default||0}return n=q0.has(n)?n:dh(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return Y0(t,n,r)}build(t,n,r){K0(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,i){nj(t,n,r,i)}mount(t){this.isSVGTag=G0(t.tagName),super.mount(t)}}const ij=vh.length;function X0(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?X0(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:r})=>iP(e,n,r)))}function lj(e){let t=aj(e),n=cg(),r=!0,i=!1;const o=u=>(c,f)=>{var p;const h=xr(e,f,u==="exit"?(p=e.presenceContext)==null?void 0:p.custom:void 0);if(h){const{transition:y,transitionEnd:v,...k}=h;c={...c,...k,...v}}return c};function s(u){t=u(e)}function a(u){const{props:c}=e,f=X0(e.parent)||{},h=[],p=new Set;let y={},v=1/0;for(let g=0;gv&&T,b=!1;const A=Array.isArray(S)?S:[S];let I=A.reduce(o(x),{});C===!1&&(I={});const{prevResolvedValues:_={}}=w,L={..._,...I},$=M=>{R=!0,p.has(M)&&(b=!0,p.delete(M)),w.needsAnimating[M]=!0;const z=e.getValue(M);z&&(z.liveStyle=!1)};for(const M in L){const z=I[M],E=_[M];if(y.hasOwnProperty(M))continue;let H=!1;wf(z)&&wf(E)?H=!Q0(z,E):H=z!==E,H?z!=null?$(M):p.add(M):z!==void 0&&p.has(M)?$(M):w.protectedKeys[M]=!0}w.prevProp=S,w.prevResolvedValues=I,w.isActive&&(y={...y,...I}),(r||i)&&e.blockInitialAnimation&&(R=!1);const K=j&&P;R&&(!K||b)&&h.push(...A.map(M=>{const z={type:x};if(typeof M=="string"&&(r||i)&&!K&&e.manuallyAnimateOnMount&&e.parent){const{parent:E}=e,H=xr(E,M);if(E.enteringChildren&&H){const{delayChildren:B}=H.transition||{};z.delay=x0(E.enteringChildren,e,B)}}return{animation:M,options:z}}))}if(p.size){const g={};if(typeof c.initial!="boolean"){const x=xr(e,Array.isArray(c.initial)?c.initial[0]:c.initial);x&&x.transition&&(g.transition=x.transition)}p.forEach(x=>{const w=e.getBaseTarget(x),S=e.getValue(x);S&&(S.liveStyle=!0),g[x]=w??null}),h.push({animation:g})}let k=!!h.length;return r&&(c.initial===!1||c.initial===c.animate)&&!e.manuallyAnimateOnMount&&(k=!1),r=!1,i=!1,k?t(h):Promise.resolve()}function l(u,c){var h;if(n[u].isActive===c)return Promise.resolve();(h=e.variantChildren)==null||h.forEach(p=>{var y;return(y=p.animationState)==null?void 0:y.setActive(u,c)}),n[u].isActive=c;const f=a(u);for(const p in n)n[p].protectedKeys={};return f}return{animateChanges:a,setActive:l,setAnimateFunction:s,getState:()=>n,reset:()=>{n=cg(),i=!0}}}function uj(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Q0(t,e):!1}function ir(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function cg(){return{animate:ir(!0),whileInView:ir(),whileHover:ir(),whileTap:ir(),whileDrag:ir(),whileFocus:ir(),exit:ir()}}function jf(e,t){e.min=t.min,e.max=t.max}function Dt(e,t){jf(e.x,t.x),jf(e.y,t.y)}function fg(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const Z0=1e-4,cj=1-Z0,fj=1+Z0,J0=.01,dj=0-J0,hj=0+J0;function Xe(e){return e.max-e.min}function pj(e,t,n){return Math.abs(e-t)<=n}function dg(e,t,n,r=.5){e.origin=r,e.originPoint=me(t.min,t.max,e.origin),e.scale=Xe(n)/Xe(t),e.translate=me(n.min,n.max,e.origin)-e.originPoint,(e.scale>=cj&&e.scale<=fj||isNaN(e.scale))&&(e.scale=1),(e.translate>=dj&&e.translate<=hj||isNaN(e.translate))&&(e.translate=0)}function mo(e,t,n,r){dg(e.x,t.x,n.x,r?r.originX:void 0),dg(e.y,t.y,n.y,r?r.originY:void 0)}function hg(e,t,n,r=0){const i=r?me(n.min,n.max,r):n.min;e.min=i+t.min,e.max=e.min+Xe(t)}function mj(e,t,n,r){hg(e.x,t.x,n.x,r==null?void 0:r.x),hg(e.y,t.y,n.y,r==null?void 0:r.y)}function pg(e,t,n,r=0){const i=r?me(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+Xe(t)}function Ya(e,t,n,r){pg(e.x,t.x,n.x,r==null?void 0:r.x),pg(e.y,t.y,n.y,r==null?void 0:r.y)}function mg(e,t,n,r,i){return e-=t,e=Ga(e,1/n,r),i!==void 0&&(e=Ga(e,1/i,r)),e}function gj(e,t=0,n=1,r=.5,i,o=e,s=e){if(rn.test(t)&&(t=parseFloat(t),t=me(s.min,s.max,t/100)-s.min),typeof t!="number")return;let a=me(o.min,o.max,r);e===o&&(a-=t),e.min=mg(e.min,t,n,a,i),e.max=mg(e.max,t,n,a,i)}function gg(e,t,[n,r,i],o,s){gj(e,t[n],t[r],t[i],t.scale,o,s)}const yj=["x","scaleX","originX"],vj=["y","scaleY","originY"];function yg(e,t,n,r){gg(e.x,t,yj,n?n.x:void 0,r?r.x:void 0),gg(e.y,t,vj,n?n.y:void 0,r?r.y:void 0)}function vg(e){return e.translate===0&&e.scale===1}function e1(e){return vg(e.x)&&vg(e.y)}function xg(e,t){return e.min===t.min&&e.max===t.max}function xj(e,t){return xg(e.x,t.x)&&xg(e.y,t.y)}function wg(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function t1(e,t){return wg(e.x,t.x)&&wg(e.y,t.y)}function kg(e){return Xe(e.x)/Xe(e.y)}function Sg(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Yt(e){return[e("x"),e("y")]}function wj(e,t,n){let r="";const i=e.x.translate/t.x,o=e.y.translate/t.y,s=(n==null?void 0:n.z)||0;if((i||o||s)&&(r=`translate3d(${i}px, ${o}px, ${s}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:c,rotateX:f,rotateY:h,skewX:p,skewY:y}=n;u&&(r=`perspective(${u}px) ${r}`),c&&(r+=`rotate(${c}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),p&&(r+=`skewX(${p}deg) `),y&&(r+=`skewY(${y}deg) `)}const a=e.x.scale*t.x,l=e.y.scale*t.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const n1=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],kj=n1.length,bg=e=>typeof e=="string"?parseFloat(e):e,Cg=e=>typeof e=="number"||W.test(e);function Sj(e,t,n,r,i,o){i?(e.opacity=me(0,n.opacity??1,bj(r)),e.opacityExit=me(t.opacity??1,0,Cj(r))):o&&(e.opacity=me(t.opacity??1,n.opacity??1,r));for(let s=0;srt?1:n(Vo(e,t,r))}function Ej(e,t,n){const r=Fe(e)?e:ki(e);return r.start(ch("",r,t,n)),r.animation}function $o(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const Tj=(e,t)=>e.depth-t.depth;class Nj{constructor(){this.children=[],this.isDirty=!1}add(t){Qd(this.children,t),this.isDirty=!0}remove(t){$a(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Tj),this.isDirty=!1,this.children.forEach(t)}}function Pj(e,t){const n=Ye.now(),r=({timestamp:i})=>{const o=i-n;o>=t&&(Xn(r),e(o-t))};return le.setup(r,!0),()=>Xn(r)}function ua(e){return Fe(e)?e.get():e}class jj{constructor(){this.members=[]}add(t){Qd(this.members,t);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===t||r===this.lead||r===this.prevLead)continue;const i=r.instance;(!i||i.isConnected===!1)&&!r.snapshot&&($a(this.members,r),r.unmount())}t.scheduleRender()}remove(t){if($a(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){var n;for(let r=this.members.indexOf(t)-1;r>=0;r--){const i=this.members[r];if(i.isPresent!==!1&&((n=i.instance)==null?void 0:n.isConnected)!==!1)return this.promote(i),!0}return!1}promote(t,n){var i;const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.updateSnapshot(),t.scheduleRender();const{layoutDependency:o}=r.options,{layoutDependency:s}=t.options;(o===void 0||o!==s)&&(t.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),(i=t.root)!=null&&i.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{var n,r,i,o,s;(r=(n=t.options).onExitComplete)==null||r.call(n),(s=(i=t.resumingFrom)==null?void 0:(o=i.options).onExitComplete)==null||s.call(o)})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){var t;(t=this.lead)!=null&&t.snapshot&&(this.lead.snapshot=void 0)}}const ca={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Tu=["","X","Y","Z"],Rj=1e3;let Aj=0;function Nu(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function i1(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=C0(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",le,!(i||o))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&i1(r)}function o1({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(s={},a=t==null?void 0:t()){this.id=Aj++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(_j),this.nodes.forEach(zj),this.nodes.forEach(Bj),this.nodes.forEach(Lj)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=s,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;le.read(()=>{f=window.innerWidth}),e(s,()=>{const p=window.innerWidth;p!==f&&(f=p,this.root.updateBlockedByResize=!0,c&&c(),c=Pj(h,250),ca.hasAnimatedSinceResize&&(ca.hasAnimatedSinceResize=!1,this.nodes.forEach(Pg)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&u&&(a||l)&&this.addEventListener("didUpdate",({delta:c,hasLayoutChanged:f,hasRelativeLayoutChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||u.getDefaultTransition()||Kj,{onLayoutAnimationStart:v,onLayoutAnimationComplete:k}=u.getProps(),g=!this.targetLayout||!t1(this.targetLayout,p),x=!f&&h;if(this.options.layoutRoot||this.resumeFrom||x||f&&(g||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const w={...uh(y,"layout"),onPlay:v,onComplete:k};(u.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w),this.setAnimationOrigin(c,x)}else f||Pg(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const s=this.getStack();s&&s.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Xn(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach($j),this.animationId++)}getTransformTemplate(){const{visualElement:s}=this.options;return s&&s.getProps().transformTemplate}willUpdate(s=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&i1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;c{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Xe(this.snapshot.measuredBox.x)&&!Xe(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const T=S/1e3;jg(f.x,s.x,T),jg(f.y,s.y,T),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ya(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),Wj(this.relativeTarget,this.relativeTargetOrigin,h,T),w&&xj(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=je()),Dt(w,this.relativeTarget)),v&&(this.animationValues=c,Sj(c,u,this.latestValues,T,x,g)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=T},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(s){var a,l,u;this.notifyListeners("animationStart"),(a=this.currentAnimation)==null||a.stop(),(u=(l=this.resumingFrom)==null?void 0:l.currentAnimation)==null||u.stop(),this.pendingAnimation&&(Xn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=le.update(()=>{ca.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=ki(0)),this.motionValue.jump(0,!1),this.currentAnimation=Ej(this.motionValue,[0,1e3],{...s,velocity:0,isSync:!0,onUpdate:c=>{this.mixTargetDelta(c),s.onUpdate&&s.onUpdate(c)},onStop:()=>{},onComplete:()=>{s.onComplete&&s.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const s=this.getStack();s&&s.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Rj),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const s=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:c}=s;if(!(!a||!l||!u)){if(this!==s&&this.layout&&u&&s1(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||je();const f=Xe(this.layout.layoutBox.x);l.x.min=s.target.x.min,l.x.max=l.x.min+f;const h=Xe(this.layout.layoutBox.y);l.y.min=s.target.y.min,l.y.max=l.y.min+h}Dt(a,l),la(a,c),mo(this.projectionDeltaWithTransform,this.layoutCorrected,a,c)}}registerSharedNode(s,a){this.sharedNodes.has(s)||this.sharedNodes.set(s,new jj),this.sharedNodes.get(s).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const s=this.getStack();return s?s.lead===this:!0}getLead(){var a;const{layoutId:s}=this.options;return s?((a=this.getStack())==null?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:s}=this.options;return s?(a=this.getStack())==null?void 0:a.prevLead:void 0}getStack(){const{layoutId:s}=this.options;if(s)return this.root.sharedNodes.get(s)}promote({needsReset:s,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),s&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const s=this.getStack();return s?s.relegate(this):!1}resetSkewAndRotation(){const{visualElement:s}=this.options;if(!s)return;let a=!1;const{latestValues:l}=s;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const u={};l.z&&Nu("z",s,u,this.animationValues);for(let c=0;c{var a;return(a=s.currentAnimation)==null?void 0:a.stop()}),this.root.nodes.forEach(Tg),this.root.sharedNodes.clear()}}}function Ij(e){e.updateLayout()}function Dj(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:o}=e.options,s=t.source!==e.layout.source;if(o==="size")Yt(f=>{const h=s?t.measuredBox[f]:t.layoutBox[f],p=Xe(h);h.min=r[f].min,h.max=h.min+p});else if(o==="x"||o==="y"){const f=o==="x"?"y":"x";jf(s?t.measuredBox[f]:t.layoutBox[f],r[f])}else s1(o,t.layoutBox,r)&&Yt(f=>{const h=s?t.measuredBox[f]:t.layoutBox[f],p=Xe(r[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const a=ri();mo(a,r,t.layoutBox);const l=ri();s?mo(l,e.applyTransform(i,!0),t.measuredBox):mo(l,r,t.layoutBox);const u=!e1(a);let c=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const y=e.options.layoutAnchor||void 0,v=je();Ya(v,t.layoutBox,h.layoutBox,y);const k=je();Ya(k,r,p.layoutBox,y),t1(v,k)||(c=!0),f.options.layoutRoot&&(e.relativeTarget=k,e.relativeTargetOrigin=v,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function _j(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function Lj(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Mj(e){e.clearSnapshot()}function Tg(e){e.clearMeasurements()}function Oj(e){e.isLayoutDirty=!0,e.updateLayout()}function Ng(e){e.isLayoutDirty=!1}function Fj(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function Vj(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Pg(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function zj(e){e.resolveTargetDelta()}function Bj(e){e.calcProjection()}function $j(e){e.resetSkewAndRotation()}function Uj(e){e.removeLeadSnapshot()}function jg(e,t,n){e.translate=me(t.translate,0,n),e.scale=me(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Rg(e,t,n,r){e.min=me(t.min,n.min,r),e.max=me(t.max,n.max,r)}function Wj(e,t,n,r){Rg(e.x,t.x,n.x,r),Rg(e.y,t.y,n.y,r)}function Hj(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const Kj={duration:.45,ease:[.4,0,.1,1]},Ag=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Ig=Ag("applewebkit/")&&!Ag("chrome/")?Math.round:Tt;function Dg(e){e.min=Ig(e.min),e.max=Ig(e.max)}function qj(e){Dg(e.x),Dg(e.y)}function s1(e,t,n){return e==="position"||e==="preserve-aspect"&&!pj(kg(t),kg(n),.2)}function Gj(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const Yj=o1({attachResizeListener:(e,t)=>$o(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||((e=document.body)==null?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||((t=document.body)==null?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),Pu={current:void 0},a1=o1({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Pu.current){const e=new Yj({});e.mount(window),e.setOptions({layoutScroll:!0}),Pu.current=e}return Pu.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),kh=m.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function _g(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Xj(...e){return t=>{let n=!1;const r=e.map(i=>{const o=_g(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i{const{width:p,height:y,top:v,left:k,right:g,bottom:x}=l.current;if(t||o===!1||!a.current||!p||!y)return;const w=n==="left"?`left: ${k}`:`right: ${g}`,S=r==="bottom"?`bottom: ${x}`:`top: ${v}`;a.current.dataset.motionPopId=s;const T=document.createElement("style");u&&(T.nonce=u);const C=i??document.head;return C.appendChild(T),T.sheet&&T.sheet.insertRule(` + [data-motion-pop-id="${s}"] { + position: absolute !important; + width: ${p}px !important; + height: ${y}px !important; + ${w}px !important; + ${S}px !important; + } + `),()=>{var j;(j=a.current)==null||j.removeAttribute("data-motion-pop-id"),C.contains(T)&&C.removeChild(T)}},[t]),d.jsx(Zj,{isPresent:t,childRef:a,sizeRef:l,pop:o,children:o===!1?e:m.cloneElement(e,{ref:f})})}const eR=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:o,mode:s,anchorX:a,anchorY:l,root:u})=>{const c=Xd(tR),f=m.useId();let h=!0,p=m.useMemo(()=>(h=!1,{id:f,initial:t,isPresent:n,custom:i,onExitComplete:y=>{c.set(y,!0);for(const v of c.values())if(!v)return;r&&r()},register:y=>(c.set(y,!1),()=>c.delete(y))}),[n,c,r]);return o&&h&&(p={...p}),m.useMemo(()=>{c.forEach((y,v)=>c.set(v,!1))},[n]),m.useEffect(()=>{!n&&!c.size&&r&&r()},[n]),e=d.jsx(Jj,{pop:s==="popLayout",isPresent:n,anchorX:a,anchorY:l,root:u,children:e}),d.jsx(Pl.Provider,{value:p,children:e})};function tR(){return new Map}function l1(e=!0){const t=m.useContext(Pl);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,o=m.useId();m.useEffect(()=>{if(e)return i(o)},[e]);const s=m.useCallback(()=>e&&r&&r(o),[o,r,e]);return!n&&r?[!1,s]:[!0]}const As=e=>e.key||"";function Lg(e){const t=[];return m.Children.forEach(e,n=>{m.isValidElement(n)&&t.push(n)}),t}const Uo=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:o="sync",propagate:s=!1,anchorX:a="left",anchorY:l="top",root:u})=>{const[c,f]=l1(s),h=m.useMemo(()=>Lg(e),[e]),p=s&&!c?[]:h.map(As),y=m.useRef(!0),v=m.useRef(h),k=Xd(()=>new Map),g=m.useRef(new Set),[x,w]=m.useState(h),[S,T]=m.useState(h);Lw(()=>{y.current=!1,v.current=h;for(let P=0;P{const R=As(P),b=s&&!c?!1:h===S||p.includes(R),A=()=>{if(g.current.has(R))return;if(k.has(R))g.current.add(R),k.set(R,!0);else return;let I=!0;k.forEach(_=>{_||(I=!1)}),I&&(j==null||j(),T(v.current),s&&(f==null||f()),r&&r())};return d.jsx(eR,{isPresent:b,initial:!y.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:o,root:u,onExitComplete:b?void 0:A,anchorX:a,anchorY:l,children:P},R)})})},u1=m.createContext({strict:!1}),Mg={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let Og=!1;function nR(){if(Og)return;const e={};for(const t in Mg)e[t]={isEnabled:n=>Mg[t].some(r=>!!n[r])};F0(e),Og=!0}function c1(){return nR(),zP()}function rR(e){const t=c1();for(const n in e)t[n]={...t[n],...e[n]};F0(t)}const iR=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Xa(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||iR.has(e)}let f1=e=>!Xa(e);function oR(e){typeof e=="function"&&(f1=t=>t.startsWith("on")?!Xa(t):e(t))}try{oR(require("@emotion/is-prop-valid").default)}catch{}function sR(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||Fe(e[i])||(f1(i)||n===!0&&Xa(i)||!t&&!Xa(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}const Il=m.createContext({});function aR(e,t){if(Al(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Bo(n)?n:void 0,animate:Bo(r)?r:void 0}}return e.inherit!==!1?t:{}}function lR(e){const{initial:t,animate:n}=aR(e,m.useContext(Il));return m.useMemo(()=>({initial:t,animate:n}),[Fg(t),Fg(n)])}function Fg(e){return Array.isArray(e)?e.join(" "):e}const Sh=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function d1(e,t,n){for(const r in t)!Fe(t[r])&&!H0(r,n)&&(e[r]=t[r])}function uR({transformTemplate:e},t){return m.useMemo(()=>{const n=Sh();return xh(n,t,e),Object.assign({},n.vars,n.style)},[t])}function cR(e,t){const n=e.style||{},r={};return d1(r,n,e),Object.assign(r,uR(e,t)),r}function fR(e,t){const n={},r=cR(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const h1=()=>({...Sh(),attrs:{}});function dR(e,t,n,r){const i=m.useMemo(()=>{const o=h1();return K0(o,t,G0(r),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};d1(o,e.style,e),i.style={...o,...i.style}}return i}const hR=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function bh(e){return typeof e!="string"||e.includes("-")?!1:!!(hR.indexOf(e)>-1||/[A-Z]/u.test(e))}function pR(e,t,n,{latestValues:r},i,o=!1,s){const l=(s??bh(e)?dR:fR)(t,r,i,e),u=sR(t,typeof e=="string",o),c=e!==m.Fragment?{...u,...l,ref:n}:{},{children:f}=t,h=m.useMemo(()=>Fe(f)?f.get():f,[f]);return m.createElement(e,{...c,children:h})}function mR({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:gR(n,r,i,e),renderState:t()}}function gR(e,t,n,r){const i={},o=r(e,{});for(const h in o)i[h]=ua(o[h]);let{initial:s,animate:a}=e;const l=Al(e),u=M0(e);t&&u&&!l&&e.inherit!==!1&&(s===void 0&&(s=t.initial),a===void 0&&(a=t.animate));let c=n?n.initial===!1:!1;c=c||s===!1;const f=c?a:s;if(f&&typeof f!="boolean"&&!Rl(f)){const h=Array.isArray(f)?f:[f];for(let p=0;p(t,n)=>{const r=m.useContext(Il),i=m.useContext(Pl),o=()=>mR(e,t,r,i);return n?o():Xd(o)},yR=p1({scrapeMotionValuesFromProps:wh,createRenderState:Sh}),vR=p1({scrapeMotionValuesFromProps:Y0,createRenderState:h1}),xR=Symbol.for("motionComponentSymbol");function wR(e,t,n){const r=m.useRef(n);m.useInsertionEffect(()=>{r.current=n});const i=m.useRef(null);return m.useCallback(o=>{var a;o&&((a=e.onMount)==null||a.call(e,o));const s=r.current;if(typeof s=="function")if(o){const l=s(o);typeof l=="function"&&(i.current=l)}else i.current?(i.current(),i.current=null):s(o);else s&&(s.current=o);t&&(o?t.mount(o):t.unmount())},[t])}const m1=m.createContext({});function Br(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function kR(e,t,n,r,i,o){var w,S;const{visualElement:s}=m.useContext(Il),a=m.useContext(u1),l=m.useContext(Pl),u=m.useContext(kh),c=u.reducedMotion,f=u.skipAnimations,h=m.useRef(null),p=m.useRef(!1);r=r||a.renderer,!h.current&&r&&(h.current=r(e,{visualState:t,parent:s,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:c,skipAnimations:f,isSVG:o}),p.current&&h.current&&(h.current.manuallyAnimateOnMount=!0));const y=h.current,v=m.useContext(m1);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&SR(h.current,n,i,v);const k=m.useRef(!1);m.useInsertionEffect(()=>{y&&k.current&&y.update(n,l)});const g=n[b0],x=m.useRef(!!g&&typeof window<"u"&&!((w=window.MotionHandoffIsComplete)!=null&&w.call(window,g))&&((S=window.MotionHasOptimisedAnimation)==null?void 0:S.call(window,g)));return Lw(()=>{p.current=!0,y&&(k.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),y.scheduleRenderMicrotask(),x.current&&y.animationState&&y.animationState.animateChanges())}),m.useEffect(()=>{y&&(!x.current&&y.animationState&&y.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{var T;(T=window.MotionHandoffMarkAsComplete)==null||T.call(window,g)}),x.current=!1),y.enteringChildren=void 0)}),y}function SR(e,t,n,r){const{layoutId:i,layout:o,drag:s,dragConstraints:a,layoutScroll:l,layoutRoot:u,layoutAnchor:c,layoutCrossfade:f}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:g1(e.parent)),e.projection.setOptions({layoutId:i,layout:o,alwaysMeasureLayout:!!s||a&&Br(a),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:r,crossfade:f,layoutScroll:l,layoutRoot:u,layoutAnchor:c})}function g1(e){if(e)return e.options.allowProjection!==!1?e.projection:g1(e.parent)}function ju(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&rR(r);const o=n?n==="svg":bh(e),s=o?vR:yR;function a(u,c){let f;const h={...m.useContext(kh),...u,layoutId:bR(u)},{isStatic:p}=h,y=lR(u),v=s(u,p);if(!p&&typeof window<"u"){CR();const k=ER(h);f=k.MeasureLayout,y.visualElement=kR(e,v,h,i,k.ProjectionNode,o)}return d.jsxs(Il.Provider,{value:y,children:[f&&y.visualElement?d.jsx(f,{visualElement:y.visualElement,...h}):null,pR(e,u,wR(v,y.visualElement,c),v,p,t,o)]})}a.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const l=m.forwardRef(a);return l[xR]=e,l}function bR({layoutId:e}){const t=m.useContext(Yd).id;return t&&e!==void 0?t+"-"+e:e}function CR(e,t){m.useContext(u1).strict}function ER(e){const t=c1(),{drag:n,layout:r}=t;if(!n&&!r)return{};const i={...n,...r};return{MeasureLayout:n!=null&&n.isEnabled(e)||r!=null&&r.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function TR(e,t){if(typeof Proxy>"u")return ju;const n=new Map,r=(o,s)=>ju(o,s,e,t),i=(o,s)=>r(o,s);return new Proxy(i,{get:(o,s)=>s==="create"?r:(n.has(s)||n.set(s,ju(s,void 0,e,t)),n.get(s))})}const NR=(e,t)=>t.isSVG??bh(e)?new rj(t):new QP(t,{allowProjection:e!==m.Fragment});class PR extends tr{constructor(t){super(t),t.animationState||(t.animationState=lj(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Rl(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let jR=0;class RR extends tr{constructor(){super(...arguments),this.id=jR++,this.isExitComplete=!1}update(){var o;if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;if(t&&r===!1){if(this.isExitComplete){const{initial:s,custom:a}=this.node.getProps();if(typeof s=="string"){const l=xr(this.node,s,a);if(l){const{transition:u,transitionEnd:c,...f}=l;for(const h in f)(o=this.node.getValue(h))==null||o.jump(f[h])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const AR={animation:{Feature:PR},exit:{Feature:RR}};function ts(e){return{point:{x:e.pageX,y:e.pageY}}}const IR=e=>t=>mh(t)&&e(t,ts(t));function go(e,t,n,r){return $o(e,t,IR(n),r)}const y1=({current:e})=>e?e.ownerDocument.defaultView:null,Vg=(e,t)=>Math.abs(e-t);function DR(e,t){const n=Vg(e.x,t.x),r=Vg(e.y,t.y);return Math.sqrt(n**2+r**2)}const zg=new Set(["auto","scroll"]);class v1{constructor(t,n,{transformPagePoint:r,contextWindow:i=window,dragSnapToOrigin:o=!1,distanceThreshold:s=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=p=>{this.handleScroll(p.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Is(this.lastRawMoveEventInfo,this.transformPagePoint));const p=Ru(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,v=DR(p.offset,{x:0,y:0})>=this.distanceThreshold;if(!y&&!v)return;const{point:k}=p,{timestamp:g}=Oe;this.history.push({...k,timestamp:g});const{onStart:x,onMove:w}=this.handlers;y||(x&&x(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,p)},this.handlePointerMove=(p,y)=>{this.lastMoveEvent=p,this.lastRawMoveEventInfo=y,this.lastMoveEventInfo=Is(y,this.transformPagePoint),le.update(this.updatePoint,!0)},this.handlePointerUp=(p,y)=>{this.end();const{onEnd:v,onSessionEnd:k,resumeAnimation:g}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&g&&g(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=Ru(p.type==="pointercancel"?this.lastMoveEventInfo:Is(y,this.transformPagePoint),this.history);this.startEvent&&v&&v(p,x),k&&k(p,x)},!mh(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=s,this.contextWindow=i||window;const l=ts(t),u=Is(l,this.transformPagePoint),{point:c}=u,{timestamp:f}=Oe;this.history=[{...c,timestamp:f}];const{onSessionStart:h}=n;h&&h(t,Ru(u,this.history)),this.removeListeners=Zo(go(this.contextWindow,"pointermove",this.handlePointerMove),go(this.contextWindow,"pointerup",this.handlePointerUp),go(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(zg.has(r.overflowX)||zg.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const r=t===window,i=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},o={x:i.x-n.x,y:i.y-n.y};o.x===0&&o.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=o.x,this.lastMoveEventInfo.point.y+=o.y):this.history.length>0&&(this.history[0].x-=o.x,this.history[0].y-=o.y),this.scrollPositions.set(t,i),le.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Xn(this.updatePoint)}}function Is(e,t){return t?{point:t(e.point)}:e}function Bg(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ru({point:e},t){return{point:e,delta:Bg(e,x1(t)),offset:Bg(e,_R(t)),velocity:LR(t,.1)}}function _R(e){return e[0]}function x1(e){return e[e.length-1]}function LR(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=x1(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>pt(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>pt(t)*2&&(r=e[1]);const o=Ct(i.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const s={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function MR(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?me(n,e,r.max):Math.min(e,n)),e}function $g(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function OR(e,{top:t,left:n,bottom:r,right:i}){return{x:$g(e.x,n,i),y:$g(e.y,t,r)}}function Ug(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=Vo(t.min,t.max-r,e.min):r>i&&(n=Vo(e.min,e.max-i,t.min)),on(0,1,n)}function zR(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Rf=.35;function BR(e=Rf){return e===!1?e=0:e===!0&&(e=Rf),{x:Wg(e,"left","right"),y:Wg(e,"top","bottom")}}function Wg(e,t,n){return{min:Hg(e,t),max:Hg(e,n)}}function Hg(e,t){return typeof e=="number"?e:e[t]||0}const $R=new WeakMap;class UR{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=je(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const o=f=>{n&&this.snapToCursor(ts(f).point),this.stopAnimation()},s=(f,h)=>{const{drag:p,dragPropagation:y,onDragStart:v}=this.getProps();if(p&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=gP(p),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=h,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Yt(g=>{let x=this.getAxisMotionValue(g).get()||0;if(rn.test(x)){const{projection:w}=this.visualElement;if(w&&w.layout){const S=w.layout.layoutBox[g];S&&(x=Xe(S)*(parseFloat(x)/100))}}this.originPoint[g]=x}),v&&le.update(()=>v(f,h),!1,!0),kf(this.visualElement,"transform");const{animationState:k}=this.visualElement;k&&k.setActive("whileDrag",!0)},a=(f,h)=>{this.latestPointerEvent=f,this.latestPanInfo=h;const{dragPropagation:p,dragDirectionLock:y,onDirectionLock:v,onDrag:k}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:g}=h;if(y&&this.currentDirection===null){this.currentDirection=HR(g),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",h.point,g),this.updateAxis("y",h.point,g),this.visualElement.render(),k&&le.update(()=>k(f,h),!1,!0)},l=(f,h)=>{this.latestPointerEvent=f,this.latestPanInfo=h,this.stop(f,h),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>{const{dragSnapToOrigin:f}=this.getProps();(f||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:c}=this.getProps();this.panSession=new v1(t,{onSessionStart:o,onStart:s,onMove:a,onSessionEnd:l,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,distanceThreshold:r,contextWindow:y1(this.visualElement),element:this.visualElement.current})}stop(t,n){const r=t||this.latestPointerEvent,i=n||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!i||!r)return;const{velocity:s}=i;this.startAnimation(s);const{onDragEnd:a}=this.getProps();a&&le.postRender(()=>a(r,i))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!Ds(t,i,this.currentDirection))return;const o=this.getAxisMotionValue(t);let s=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(s=MR(s,this.constraints[t],this.elastic[t])),o.set(s)}resolveConstraints(){var o;const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(o=this.visualElement.projection)==null?void 0:o.layout,i=this.constraints;t&&Br(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=OR(r.layoutBox,t):this.constraints=!1,this.elastic=BR(n),i!==this.constraints&&!Br(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&Yt(s=>{this.constraints!==!1&&this.getAxisMotionValue(s)&&(this.constraints[s]=zR(r.layoutBox[s],this.constraints[s]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Br(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=HP(r,i.root,this.visualElement.getTransformPagePoint());let s=FR(i.layout.layoutBox,o);if(n){const a=n($P(s));this.hasMutatedConstraints=!!a,a&&(s=z0(a))}return s}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:o,dragSnapToOrigin:s,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=Yt(c=>{if(!Ds(c,n,this.currentDirection))return;let f=l&&l[c]||{};(s===!0||s===c)&&(f={min:0,max:0});const h=i?200:1e6,p=i?40:1e7,y={type:"inertia",velocity:r?t[c]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...o,...f};return this.startAxisValueAnimation(c,y)});return Promise.all(u).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return kf(this.visualElement,t),r.start(ch(t,r,0,n,this.visualElement,!1))}stopAnimation(){Yt(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Yt(n=>{const{drag:r}=this.getProps();if(!Ds(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:s,max:a}=i.layout.layoutBox[n],l=o.get()||0;o.set(t[n]-me(s,a,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Br(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Yt(s=>{const a=this.getAxisMotionValue(s);if(a&&this.constraints!==!1){const l=a.get();i[s]=VR({min:l,max:l},this.constraints[s])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),Yt(s=>{if(!Ds(s,t,null))return;const a=this.getAxisMotionValue(s),{min:l,max:u}=this.constraints[s];a.set(me(l,u,i[s]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;$R.set(this.visualElement,this);const t=this.visualElement.current,n=go(t,"pointerdown",u=>{const{drag:c,dragListener:f=!0}=this.getProps(),h=u.target,p=h!==t&&SP(h);c&&f&&!p&&this.start(u)});let r;const i=()=>{const{dragConstraints:u}=this.getProps();Br(u)&&u.current&&(this.constraints=this.resolveRefConstraints(),r||(r=WR(t,u.current,()=>this.scalePositionWithinConstraints())))},{projection:o}=this.visualElement,s=o.addEventListener("measure",i);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),le.read(i);const a=$o(window,"resize",()=>this.scalePositionWithinConstraints()),l=o.addEventListener("didUpdate",({delta:u,hasLayoutChanged:c})=>{this.isDragging&&c&&(Yt(f=>{const h=this.getAxisMotionValue(f);h&&(this.originPoint[f]+=u[f].translate,h.set(h.get()+u[f].translate))}),this.visualElement.render())});return()=>{a(),n(),s(),l&&l(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:s=Rf,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:o,dragElastic:s,dragMomentum:a}}}function Kg(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function WR(e,t,n){const r=Jm(e,Kg(n)),i=Jm(t,Kg(n));return()=>{r(),i()}}function Ds(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function HR(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class KR extends tr{constructor(t){super(t),this.removeGroupControls=Tt,this.removeListeners=Tt,this.controls=new UR(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Tt}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Au=e=>(t,n)=>{e&&le.update(()=>e(t,n),!1,!0)};class qR extends tr{constructor(){super(...arguments),this.removePointerDownListener=Tt}onPointerDown(t){this.session=new v1(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:y1(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:Au(t),onStart:Au(n),onMove:Au(r),onEnd:(o,s)=>{delete this.session,i&&le.postRender(()=>i(o,s))}}}mount(){this.removePointerDownListener=go(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Iu=!1;class GR extends m.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:o}=t;o&&(n.group&&n.group.add(o),r&&r.register&&i&&r.register(o),Iu&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),ca.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:o}=this.props,{projection:s}=r;return s&&(s.isPresent=o,t.layoutDependency!==n&&s.setOptions({...s.options,layoutDependency:n}),Iu=!0,i||t.layoutDependency!==n||n===void 0||t.isPresent!==o?s.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?s.promote():s.relegate()||le.postRender(()=>{const a=s.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:n}=this.props,{projection:r}=t;r&&(r.options.layoutAnchor=n,r.root.didUpdate(),ph.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;Iu=!0,i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function w1(e){const[t,n]=l1(),r=m.useContext(Yd);return d.jsx(GR,{...e,layoutGroup:r,switchLayoutGroup:m.useContext(m1),isPresent:t,safeToRemove:n})}const YR={pan:{Feature:qR},drag:{Feature:KR,ProjectionNode:a1,MeasureLayout:w1}};function qg(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,o=r[i];o&&le.postRender(()=>o(t,ts(t)))}class XR extends tr{mount(){const{current:t}=this.node;t&&(this.unmount=vP(t,(n,r)=>(qg(this.node,r,"Start"),i=>qg(this.node,i,"End"))))}unmount(){}}class QR extends tr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Zo($o(this.node.current,"focus",()=>this.onFocus()),$o(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Gg(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),o=r[i];o&&le.postRender(()=>o(t,ts(t)))}class ZR extends tr{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=CP(t,(i,o)=>(Gg(this.node,o,"Start"),(s,{success:a})=>Gg(this.node,s,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const Af=new WeakMap,Du=new WeakMap,JR=e=>{const t=Af.get(e.target);t&&t(e)},e2=e=>{e.forEach(JR)};function t2({root:e,...t}){const n=e||document;Du.has(n)||Du.set(n,{});const r=Du.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(e2,{root:e,...t})),r[i]}function n2(e,t,n){const r=t2(t);return Af.set(e,n),r.observe(e),()=>{Af.delete(e),r.unobserve(e)}}const r2={some:0,all:1};class i2 extends tr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var l;(l=this.stopObserver)==null||l.call(this);const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:o}=t,s={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:r2[i]},a=u=>{const{isIntersecting:c}=u;if(this.isInView===c||(this.isInView=c,o&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:f,onViewportLeave:h}=this.node.getProps(),p=c?f:h;p&&p(u)};this.stopObserver=n2(this.node.current,s,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(o2(t,n))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function o2({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const s2={inView:{Feature:i2},tap:{Feature:ZR},focus:{Feature:QR},hover:{Feature:XR}},a2={layout:{ProjectionNode:a1,MeasureLayout:w1}},l2={...AR,...s2,...YR,...a2},Ae=TR(l2,NR),u2=1,c2=1e6;let _u=0;function f2(){return _u=(_u+1)%Number.MAX_SAFE_INTEGER,_u.toString()}const Lu=new Map,Yg=e=>{if(Lu.has(e))return;const t=setTimeout(()=>{Lu.delete(e),yo({type:"REMOVE_TOAST",toastId:e})},c2);Lu.set(e,t)},d2=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,u2)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?Yg(n):e.toasts.forEach(r=>{Yg(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},fa=[];let da={toasts:[]};function yo(e){da=d2(da,e),fa.forEach(t=>{t(da)})}function h2({...e}){const t=f2(),n=i=>yo({type:"UPDATE_TOAST",toast:{...i,id:t}}),r=()=>yo({type:"DISMISS_TOAST",toastId:t});return yo({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:i=>{i||r()}}}),{id:t,dismiss:r,update:n}}function ns(){const[e,t]=m.useState(da);return m.useEffect(()=>(fa.push(t),()=>{const n=fa.indexOf(t);n>-1&&fa.splice(n,1)}),[e]),{...e,toast:h2,dismiss:n=>yo({type:"DISMISS_TOAST",toastId:n})}}function _e(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function Xg(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Sn(...e){return t=>{let n=!1;const r=e.map(i=>{const o=Xg(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i{const{children:s,...a}=o,l=m.useMemo(()=>a,Object.values(a));return d.jsx(n.Provider,{value:l,children:s})};r.displayName=e+"Provider";function i(o){const s=m.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,i]}function Ch(e,t=[]){let n=[];function r(o,s){const a=m.createContext(s),l=n.length;n=[...n,s];const u=f=>{var g;const{scope:h,children:p,...y}=f,v=((g=h==null?void 0:h[e])==null?void 0:g[l])||a,k=m.useMemo(()=>y,Object.values(y));return d.jsx(v.Provider,{value:k,children:p})};u.displayName=o+"Provider";function c(f,h){var v;const p=((v=h==null?void 0:h[e])==null?void 0:v[l])||a,y=m.useContext(p);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[u,c]}const i=()=>{const o=n.map(s=>m.createContext(s));return function(a){const l=(a==null?void 0:a[e])||o;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,m2(i,...t)]}function m2(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...a,...f}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Qg(e){const t=g2(e),n=m.forwardRef((r,i)=>{const{children:o,...s}=r,a=m.Children.toArray(o),l=a.find(v2);if(l){const u=l.props.children,c=a.map(f=>f===l?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return d.jsx(t,{...s,ref:i,children:m.isValidElement(u)?m.cloneElement(u,void 0,c):null})}return d.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function g2(e){const t=m.forwardRef((n,r)=>{const{children:i,...o}=n;if(m.isValidElement(i)){const s=w2(i),a=x2(o,i.props);return i.type!==m.Fragment&&(a.ref=r?Sn(r,s):s),m.cloneElement(i,a)}return m.Children.count(i)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var y2=Symbol("radix.slottable");function v2(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===y2}function x2(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function w2(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function k2(e){const t=e+"CollectionProvider",[n,r]=Ch(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=v=>{const{scope:k,children:g}=v,x=Qt.useRef(null),w=Qt.useRef(new Map).current;return d.jsx(i,{scope:k,itemMap:w,collectionRef:x,children:g})};s.displayName=t;const a=e+"CollectionSlot",l=Qg(a),u=Qt.forwardRef((v,k)=>{const{scope:g,children:x}=v,w=o(a,g),S=Ut(k,w.collectionRef);return d.jsx(l,{ref:S,children:x})});u.displayName=a;const c=e+"CollectionItemSlot",f="data-radix-collection-item",h=Qg(c),p=Qt.forwardRef((v,k)=>{const{scope:g,children:x,...w}=v,S=Qt.useRef(null),T=Ut(k,S),C=o(c,g);return Qt.useEffect(()=>(C.itemMap.set(S,{ref:S,...w}),()=>void C.itemMap.delete(S))),d.jsx(h,{[f]:"",ref:T,children:x})});p.displayName=c;function y(v){const k=o(e+"CollectionConsumer",v);return Qt.useCallback(()=>{const x=k.collectionRef.current;if(!x)return[];const w=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(k.itemMap.values()).sort((C,j)=>w.indexOf(C.ref.current)-w.indexOf(j.ref.current))},[k.collectionRef,k.itemMap])}return[{Provider:s,Slot:u,ItemSlot:p},y,r]}function S2(e){const t=b2(e),n=m.forwardRef((r,i)=>{const{children:o,...s}=r,a=m.Children.toArray(o),l=a.find(E2);if(l){const u=l.props.children,c=a.map(f=>f===l?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return d.jsx(t,{...s,ref:i,children:m.isValidElement(u)?m.cloneElement(u,void 0,c):null})}return d.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function b2(e){const t=m.forwardRef((n,r)=>{const{children:i,...o}=n;if(m.isValidElement(i)){const s=N2(i),a=T2(o,i.props);return i.type!==m.Fragment&&(a.ref=r?Sn(r,s):s),m.cloneElement(i,a)}return m.Children.count(i)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var C2=Symbol("radix.slottable");function E2(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===C2}function T2(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function N2(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var P2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],k1=P2.reduce((e,t)=>{const n=S2(`Primitive.${t}`),r=m.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function j2(e,t){e&&Ni.flushSync(()=>e.dispatchEvent(t))}function xn(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function R2(e,t=globalThis==null?void 0:globalThis.document){const n=xn(e);m.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var A2="DismissableLayer",If="dismissableLayer.update",I2="dismissableLayer.pointerDownOutside",D2="dismissableLayer.focusOutside",Zg,S1=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Eh=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,onDismiss:a,...l}=e,u=m.useContext(S1),[c,f]=m.useState(null),h=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=m.useState({}),y=Ut(t,j=>f(j)),v=Array.from(u.layers),[k]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),g=v.indexOf(k),x=c?v.indexOf(c):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=x>=g,T=L2(j=>{const P=j.target,R=[...u.branches].some(b=>b.contains(P));!S||R||(i==null||i(j),s==null||s(j),j.defaultPrevented||a==null||a())},h),C=M2(j=>{const P=j.target;[...u.branches].some(b=>b.contains(P))||(o==null||o(j),s==null||s(j),j.defaultPrevented||a==null||a())},h);return R2(j=>{x===u.layers.size-1&&(r==null||r(j),!j.defaultPrevented&&a&&(j.preventDefault(),a()))},h),m.useEffect(()=>{if(c)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Zg=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),Jg(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Zg)}},[c,h,n,u]),m.useEffect(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),Jg())},[c,u]),m.useEffect(()=>{const j=()=>p({});return document.addEventListener(If,j),()=>document.removeEventListener(If,j)},[]),d.jsx(k1.div,{...l,ref:y,style:{pointerEvents:w?S?"auto":"none":void 0,...e.style},onFocusCapture:_e(e.onFocusCapture,C.onFocusCapture),onBlurCapture:_e(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:_e(e.onPointerDownCapture,T.onPointerDownCapture)})});Eh.displayName=A2;var _2="DismissableLayerBranch",b1=m.forwardRef((e,t)=>{const n=m.useContext(S1),r=m.useRef(null),i=Ut(t,r);return m.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),d.jsx(k1.div,{...e,ref:i})});b1.displayName=_2;function L2(e,t=globalThis==null?void 0:globalThis.document){const n=xn(e),r=m.useRef(!1),i=m.useRef(()=>{});return m.useEffect(()=>{const o=a=>{if(a.target&&!r.current){let l=function(){C1(I2,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=l,t.addEventListener("click",i.current,{once:!0})):l()}else t.removeEventListener("click",i.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function M2(e,t=globalThis==null?void 0:globalThis.document){const n=xn(e),r=m.useRef(!1);return m.useEffect(()=>{const i=o=>{o.target&&!r.current&&C1(D2,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Jg(){const e=new CustomEvent(If);document.dispatchEvent(e)}function C1(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?j2(i,o):i.dispatchEvent(o)}var O2=Eh,F2=b1;function V2(e){const t=z2(e),n=m.forwardRef((r,i)=>{const{children:o,...s}=r,a=m.Children.toArray(o),l=a.find($2);if(l){const u=l.props.children,c=a.map(f=>f===l?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return d.jsx(t,{...s,ref:i,children:m.isValidElement(u)?m.cloneElement(u,void 0,c):null})}return d.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function z2(e){const t=m.forwardRef((n,r)=>{const{children:i,...o}=n;if(m.isValidElement(i)){const s=W2(i),a=U2(o,i.props);return i.type!==m.Fragment&&(a.ref=r?Sn(r,s):s),m.cloneElement(i,a)}return m.Children.count(i)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var B2=Symbol("radix.slottable");function $2(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===B2}function U2(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function W2(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var H2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],K2=H2.reduce((e,t)=>{const n=V2(`Primitive.${t}`),r=m.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Si=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},q2="Portal",Th=m.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[i,o]=m.useState(!1);Si(()=>o(!0),[]);const s=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?cT.createPortal(d.jsx(K2.div,{...r,ref:t}),s):null});Th.displayName=q2;function G2(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var rs=e=>{const{present:t,children:n}=e,r=Y2(t),i=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),o=Ut(r.ref,X2(i));return typeof n=="function"||r.isPresent?m.cloneElement(i,{ref:o}):null};rs.displayName="Presence";function Y2(e){const[t,n]=m.useState(),r=m.useRef(null),i=m.useRef(e),o=m.useRef("none"),s=e?"mounted":"unmounted",[a,l]=G2(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const u=_s(r.current);o.current=a==="mounted"?u:"none"},[a]),Si(()=>{const u=r.current,c=i.current;if(c!==e){const h=o.current,p=_s(u);e?l("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(c&&h!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Si(()=>{if(t){let u;const c=t.ownerDocument.defaultView??window,f=p=>{const v=_s(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&v&&(l("ANIMATION_END"),!i.current)){const k=t.style.animationFillMode;t.style.animationFillMode="forwards",u=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=k)})}},h=p=>{p.target===t&&(o.current=_s(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{c.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:m.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function _s(e){return(e==null?void 0:e.animationName)||"none"}function X2(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Q2(e){const t=Z2(e),n=m.forwardRef((r,i)=>{const{children:o,...s}=r,a=m.Children.toArray(o),l=a.find(eA);if(l){const u=l.props.children,c=a.map(f=>f===l?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return d.jsx(t,{...s,ref:i,children:m.isValidElement(u)?m.cloneElement(u,void 0,c):null})}return d.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function Z2(e){const t=m.forwardRef((n,r)=>{const{children:i,...o}=n;if(m.isValidElement(i)){const s=nA(i),a=tA(o,i.props);return i.type!==m.Fragment&&(a.ref=r?Sn(r,s):s),m.cloneElement(i,a)}return m.Children.count(i)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var J2=Symbol("radix.slottable");function eA(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===J2}function tA(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function nA(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var rA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ai=rA.reduce((e,t)=>{const n=Q2(`Primitive.${t}`),r=m.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function iA(e,t){e&&Ni.flushSync(()=>e.dispatchEvent(t))}var oA=Pr[" useInsertionEffect ".trim().toString()]||Si;function E1({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,s]=sA({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:i;{const c=m.useRef(e!==void 0);m.useEffect(()=>{const f=c.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=a},[a,r])}const u=m.useCallback(c=>{var f;if(a){const h=aA(c)?c(e):c;h!==e&&((f=s.current)==null||f.call(s,h))}else o(c)},[a,e,o,s]);return[l,u]}function sA({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),i=m.useRef(n),o=m.useRef(t);return oA(()=>{o.current=t},[t]),m.useEffect(()=>{var s;i.current!==n&&((s=o.current)==null||s.call(o,n),i.current=n)},[n,i]),[n,r,o]}function aA(e){return typeof e=="function"}function lA(e){const t=uA(e),n=m.forwardRef((r,i)=>{const{children:o,...s}=r,a=m.Children.toArray(o),l=a.find(fA);if(l){const u=l.props.children,c=a.map(f=>f===l?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return d.jsx(t,{...s,ref:i,children:m.isValidElement(u)?m.cloneElement(u,void 0,c):null})}return d.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function uA(e){const t=m.forwardRef((n,r)=>{const{children:i,...o}=n;if(m.isValidElement(i)){const s=hA(i),a=dA(o,i.props);return i.type!==m.Fragment&&(a.ref=r?Sn(r,s):s),m.cloneElement(i,a)}return m.Children.count(i)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var cA=Symbol("radix.slottable");function fA(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===cA}function dA(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function hA(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var pA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],mA=pA.reduce((e,t)=>{const n=lA(`Primitive.${t}`),r=m.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),gA=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),yA="VisuallyHidden",Nh=m.forwardRef((e,t)=>d.jsx(mA.span,{...e,ref:t,style:{...gA,...e.style}}));Nh.displayName=yA;var Ph="ToastProvider",[jh,vA,xA]=k2("Toast"),[T1]=Ch("Toast",[xA]),[wA,Dl]=T1(Ph),N1=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:i="right",swipeThreshold:o=50,children:s}=e,[a,l]=m.useState(null),[u,c]=m.useState(0),f=m.useRef(!1),h=m.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Ph}\`. Expected non-empty \`string\`.`),d.jsx(jh.Provider,{scope:t,children:d.jsx(wA,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:o,toastCount:u,viewport:a,onViewportChange:l,onToastAdd:m.useCallback(()=>c(p=>p+1),[]),onToastRemove:m.useCallback(()=>c(p=>p-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:h,children:s})})};N1.displayName=Ph;var P1="ToastViewport",kA=["F8"],Df="toast.viewportPause",_f="toast.viewportResume",j1=m.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=kA,label:i="Notifications ({hotkey})",...o}=e,s=Dl(P1,n),a=vA(n),l=m.useRef(null),u=m.useRef(null),c=m.useRef(null),f=m.useRef(null),h=Ut(t,f,s.onViewportChange),p=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=s.toastCount>0;m.useEffect(()=>{const k=g=>{var w;r.length!==0&&r.every(S=>g[S]||g.code===S)&&((w=f.current)==null||w.focus())};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[r]),m.useEffect(()=>{const k=l.current,g=f.current;if(y&&k&&g){const x=()=>{if(!s.isClosePausedRef.current){const C=new CustomEvent(Df);g.dispatchEvent(C),s.isClosePausedRef.current=!0}},w=()=>{if(s.isClosePausedRef.current){const C=new CustomEvent(_f);g.dispatchEvent(C),s.isClosePausedRef.current=!1}},S=C=>{!k.contains(C.relatedTarget)&&w()},T=()=>{k.contains(document.activeElement)||w()};return k.addEventListener("focusin",x),k.addEventListener("focusout",S),k.addEventListener("pointermove",x),k.addEventListener("pointerleave",T),window.addEventListener("blur",x),window.addEventListener("focus",w),()=>{k.removeEventListener("focusin",x),k.removeEventListener("focusout",S),k.removeEventListener("pointermove",x),k.removeEventListener("pointerleave",T),window.removeEventListener("blur",x),window.removeEventListener("focus",w)}}},[y,s.isClosePausedRef]);const v=m.useCallback(({tabbingDirection:k})=>{const x=a().map(w=>{const S=w.ref.current,T=[S,..._A(S)];return k==="forwards"?T:T.reverse()});return(k==="forwards"?x.reverse():x).flat()},[a]);return m.useEffect(()=>{const k=f.current;if(k){const g=x=>{var T,C,j;const w=x.altKey||x.ctrlKey||x.metaKey;if(x.key==="Tab"&&!w){const P=document.activeElement,R=x.shiftKey;if(x.target===k&&R){(T=u.current)==null||T.focus();return}const I=v({tabbingDirection:R?"backwards":"forwards"}),_=I.findIndex(L=>L===P);Mu(I.slice(_+1))?x.preventDefault():R?(C=u.current)==null||C.focus():(j=c.current)==null||j.focus()}};return k.addEventListener("keydown",g),()=>k.removeEventListener("keydown",g)}},[a,v]),d.jsxs(F2,{ref:l,role:"region","aria-label":i.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&d.jsx(Lf,{ref:u,onFocusFromOutsideViewport:()=>{const k=v({tabbingDirection:"forwards"});Mu(k)}}),d.jsx(jh.Slot,{scope:n,children:d.jsx(Ai.ol,{tabIndex:-1,...o,ref:h})}),y&&d.jsx(Lf,{ref:c,onFocusFromOutsideViewport:()=>{const k=v({tabbingDirection:"backwards"});Mu(k)}})]})});j1.displayName=P1;var R1="ToastFocusProxy",Lf=m.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,o=Dl(R1,n);return d.jsx(Nh,{tabIndex:0,...i,ref:t,style:{position:"fixed"},onFocus:s=>{var u;const a=s.relatedTarget;!((u=o.viewport)!=null&&u.contains(a))&&r()}})});Lf.displayName=R1;var is="Toast",SA="toast.swipeStart",bA="toast.swipeMove",CA="toast.swipeCancel",EA="toast.swipeEnd",A1=m.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:i,onOpenChange:o,...s}=e,[a,l]=E1({prop:r,defaultProp:i??!0,onChange:o,caller:is});return d.jsx(rs,{present:n||a,children:d.jsx(PA,{open:a,...s,ref:t,onClose:()=>l(!1),onPause:xn(e.onPause),onResume:xn(e.onResume),onSwipeStart:_e(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:_e(e.onSwipeMove,u=>{const{x:c,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${c}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:_e(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:_e(e.onSwipeEnd,u=>{const{x:c,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${c}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),l(!1)})})})});A1.displayName=is;var[TA,NA]=T1(is,{onClose(){}}),PA=m.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:i,open:o,onClose:s,onEscapeKeyDown:a,onPause:l,onResume:u,onSwipeStart:c,onSwipeMove:f,onSwipeCancel:h,onSwipeEnd:p,...y}=e,v=Dl(is,n),[k,g]=m.useState(null),x=Ut(t,L=>g(L)),w=m.useRef(null),S=m.useRef(null),T=i||v.duration,C=m.useRef(0),j=m.useRef(T),P=m.useRef(0),{onToastAdd:R,onToastRemove:b}=v,A=xn(()=>{var $;(k==null?void 0:k.contains(document.activeElement))&&(($=v.viewport)==null||$.focus()),s()}),I=m.useCallback(L=>{!L||L===1/0||(window.clearTimeout(P.current),C.current=new Date().getTime(),P.current=window.setTimeout(A,L))},[A]);m.useEffect(()=>{const L=v.viewport;if(L){const $=()=>{I(j.current),u==null||u()},K=()=>{const ee=new Date().getTime()-C.current;j.current=j.current-ee,window.clearTimeout(P.current),l==null||l()};return L.addEventListener(Df,K),L.addEventListener(_f,$),()=>{L.removeEventListener(Df,K),L.removeEventListener(_f,$)}}},[v.viewport,T,l,u,I]),m.useEffect(()=>{o&&!v.isClosePausedRef.current&&I(T)},[o,T,v.isClosePausedRef,I]),m.useEffect(()=>(R(),()=>b()),[R,b]);const _=m.useMemo(()=>k?F1(k):null,[k]);return v.viewport?d.jsxs(d.Fragment,{children:[_&&d.jsx(jA,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:_}),d.jsx(TA,{scope:n,onClose:A,children:Ni.createPortal(d.jsx(jh.ItemSlot,{scope:n,children:d.jsx(O2,{asChild:!0,onEscapeKeyDown:_e(a,()=>{v.isFocusedToastEscapeKeyDownRef.current||A(),v.isFocusedToastEscapeKeyDownRef.current=!1}),children:d.jsx(Ai.li,{tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":v.swipeDirection,...y,ref:x,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:_e(e.onKeyDown,L=>{L.key==="Escape"&&(a==null||a(L.nativeEvent),L.nativeEvent.defaultPrevented||(v.isFocusedToastEscapeKeyDownRef.current=!0,A()))}),onPointerDown:_e(e.onPointerDown,L=>{L.button===0&&(w.current={x:L.clientX,y:L.clientY})}),onPointerMove:_e(e.onPointerMove,L=>{if(!w.current)return;const $=L.clientX-w.current.x,K=L.clientY-w.current.y,ee=!!S.current,M=["left","right"].includes(v.swipeDirection),z=["left","up"].includes(v.swipeDirection)?Math.min:Math.max,E=M?z(0,$):0,H=M?0:z(0,K),B=L.pointerType==="touch"?10:2,N={x:E,y:H},ie={originalEvent:L,delta:N};ee?(S.current=N,Ls(bA,f,ie,{discrete:!1})):ey(N,v.swipeDirection,B)?(S.current=N,Ls(SA,c,ie,{discrete:!1}),L.target.setPointerCapture(L.pointerId)):(Math.abs($)>B||Math.abs(K)>B)&&(w.current=null)}),onPointerUp:_e(e.onPointerUp,L=>{const $=S.current,K=L.target;if(K.hasPointerCapture(L.pointerId)&&K.releasePointerCapture(L.pointerId),S.current=null,w.current=null,$){const ee=L.currentTarget,M={originalEvent:L,delta:$};ey($,v.swipeDirection,v.swipeThreshold)?Ls(EA,p,M,{discrete:!0}):Ls(CA,h,M,{discrete:!0}),ee.addEventListener("click",z=>z.preventDefault(),{once:!0})}})})})}),v.viewport)})]}):null}),jA=e=>{const{__scopeToast:t,children:n,...r}=e,i=Dl(is,t),[o,s]=m.useState(!1),[a,l]=m.useState(!1);return IA(()=>s(!0)),m.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:d.jsx(Th,{asChild:!0,children:d.jsx(Nh,{...r,children:o&&d.jsxs(d.Fragment,{children:[i.label," ",n]})})})},RA="ToastTitle",I1=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return d.jsx(Ai.div,{...r,ref:t})});I1.displayName=RA;var AA="ToastDescription",D1=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return d.jsx(Ai.div,{...r,ref:t})});D1.displayName=AA;var _1="ToastAction",L1=m.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?d.jsx(O1,{altText:n,asChild:!0,children:d.jsx(Rh,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${_1}\`. Expected non-empty \`string\`.`),null)});L1.displayName=_1;var M1="ToastClose",Rh=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,i=NA(M1,n);return d.jsx(O1,{asChild:!0,children:d.jsx(Ai.button,{type:"button",...r,ref:t,onClick:_e(e.onClick,i.onClose)})})});Rh.displayName=M1;var O1=m.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...i}=e;return d.jsx(Ai.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function F1(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),DA(r)){const i=r.ariaHidden||r.hidden||r.style.display==="none",o=r.dataset.radixToastAnnounceExclude==="";if(!i)if(o){const s=r.dataset.radixToastAnnounceAlt;s&&t.push(s)}else t.push(...F1(r))}}),t}function Ls(e,t,n,{discrete:r}){const i=n.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?iA(i,o):i.dispatchEvent(o)}var ey=(e,t,n=0)=>{const r=Math.abs(e.x),i=Math.abs(e.y),o=r>i;return t==="left"||t==="right"?o&&r>n:!o&&i>n};function IA(e=()=>{}){const t=xn(e);Si(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function DA(e){return e.nodeType===e.ELEMENT_NODE}function _A(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Mu(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var LA=N1,V1=j1,z1=A1,B1=I1,$1=D1,U1=L1,W1=Rh;function H1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e=="boolean"?`${e}`:e===0?"0":e,ny=K1,Ah=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return ny(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=t,s=Object.keys(i).map(u=>{const c=n==null?void 0:n[u],f=o==null?void 0:o[u];if(c===null)return null;const h=ty(c)||ty(f);return i[u][h]}),a=n&&Object.entries(n).reduce((u,c)=>{let[f,h]=c;return h===void 0||(u[f]=h),u},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,c)=>{let{class:f,className:h,...p}=c;return Object.entries(p).every(y=>{let[v,k]=y;return Array.isArray(k)?k.includes({...o,...a}[v]):{...o,...a}[v]===k})?[...u,f,h]:u},[]);return ny(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)};/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var MA={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),se=(e,t)=>{const n=m.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:o=2,absoluteStrokeWidth:s,className:a="",children:l,...u},c)=>m.createElement("svg",{ref:c,...MA,width:i,height:i,stroke:r,strokeWidth:s?Number(o)*24/Number(i):o,className:["lucide",`lucide-${OA(e)}`,a].join(" "),...u},[...t.map(([f,h])=>m.createElement(f,h)),...Array.isArray(l)?l:[l]]));return n.displayName=`${e}`,n};/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const FA=se("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _l=se("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VA=se("ArrowUpCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zA=se("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const q1=se("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const G1=se("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const BA=se("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Y1=se("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ry=se("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iy=se("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const X1=se("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Qa=se("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Q1=se("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $A=se("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oy=se("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UA=se("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Za=se("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const WA=se("Repeat2",[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ih=se("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const no=se("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const HA=se("SendHorizontal",[["path",{d:"m3 3 3 9-3 9 19-9Z",key:"1aobqy"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const KA=se("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Dh=se("Sparkles",[["path",{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z",key:"17u4zn"}],["path",{d:"M5 3v4",key:"bklmnn"}],["path",{d:"M19 17v4",key:"iiml17"}],["path",{d:"M3 5h4",key:"nem4j1"}],["path",{d:"M17 19h4",key:"lbex7p"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _h=se("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qA=se("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Z1=se("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jt=se("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Lh=se("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),Mh="-",GA=e=>{const t=XA(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{const a=s.split(Mh);return a[0]===""&&a.length!==1&&a.shift(),J1(a,t)||YA(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},J1=(e,t)=>{var s;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),i=r?J1(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;const o=e.join(Mh);return(s=t.validators.find(({validator:a})=>a(o)))==null?void 0:s.classGroupId},sy=/^\[(.+)\]$/,YA=e=>{if(sy.test(e)){const t=sy.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},XA=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return ZA(Object.entries(e.classGroups),n).forEach(([o,s])=>{Mf(s,r,o,t)}),r},Mf=(e,t,n,r)=>{e.forEach(i=>{if(typeof i=="string"){const o=i===""?t:ay(t,i);o.classGroupId=n;return}if(typeof i=="function"){if(QA(i)){Mf(i(r),t,n,r);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,s])=>{Mf(s,ay(t,o),n,r)})})},ay=(e,t)=>{let n=e;return t.split(Mh).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},QA=e=>e.isThemeGetter,ZA=(e,t)=>t?e.map(([n,r])=>{const i=r.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,a])=>[t+s,a])):o);return[n,i]}):e,JA=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const i=(o,s)=>{n.set(o,s),t++,t>e&&(t=0,r=n,n=new Map)};return{get(o){let s=n.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){n.has(o)?n.set(o,s):i(o,s)}}},ek="!",eI=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],o=t.length,s=a=>{const l=[];let u=0,c=0,f;for(let k=0;kc?f-c:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:v}};return n?a=>n({className:a,parseClassName:s}):s},tI=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},nI=e=>({cache:JA(e.cacheSize),parseClassName:eI(e),...GA(e)}),rI=/\s+/,iI=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,o=[],s=e.trim().split(rI);let a="";for(let l=s.length-1;l>=0;l-=1){const u=s[l],{modifiers:c,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:p}=n(u);let y=!!p,v=r(y?h.substring(0,p):h);if(!v){if(!y){a=u+(a.length>0?" "+a:a);continue}if(v=r(h),!v){a=u+(a.length>0?" "+a:a);continue}y=!1}const k=tI(c).join(":"),g=f?k+ek:k,x=g+v;if(o.includes(x))continue;o.push(x);const w=i(v,y);for(let S=0;S0?" "+a:a)}return a};function oI(){let e=0,t,n,r="";for(;e{if(typeof e=="string")return e;let t,n="";for(let r=0;rf(c),e());return n=nI(u),r=n.cache.get,i=n.cache.set,o=a,a(l)}function a(l){const u=r(l);if(u)return u;const c=iI(l,n);return i(l,c),c}return function(){return o(oI.apply(null,arguments))}}const he=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},nk=/^\[(?:([a-z-]+):)?(.+)\]$/i,aI=/^\d+\/\d+$/,lI=new Set(["px","full","screen"]),uI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,cI=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,fI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,dI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,un=e=>ci(e)||lI.has(e)||aI.test(e),Tn=e=>Ii(e,"length",kI),ci=e=>!!e&&!Number.isNaN(Number(e)),Ou=e=>Ii(e,"number",ci),qi=e=>!!e&&Number.isInteger(Number(e)),pI=e=>e.endsWith("%")&&ci(e.slice(0,-1)),X=e=>nk.test(e),Nn=e=>uI.test(e),mI=new Set(["length","size","percentage"]),gI=e=>Ii(e,mI,rk),yI=e=>Ii(e,"position",rk),vI=new Set(["image","url"]),xI=e=>Ii(e,vI,bI),wI=e=>Ii(e,"",SI),Gi=()=>!0,Ii=(e,t,n)=>{const r=nk.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},kI=e=>cI.test(e)&&!fI.test(e),rk=()=>!1,SI=e=>dI.test(e),bI=e=>hI.test(e),CI=()=>{const e=he("colors"),t=he("spacing"),n=he("blur"),r=he("brightness"),i=he("borderColor"),o=he("borderRadius"),s=he("borderSpacing"),a=he("borderWidth"),l=he("contrast"),u=he("grayscale"),c=he("hueRotate"),f=he("invert"),h=he("gap"),p=he("gradientColorStops"),y=he("gradientColorStopPositions"),v=he("inset"),k=he("margin"),g=he("opacity"),x=he("padding"),w=he("saturate"),S=he("scale"),T=he("sepia"),C=he("skew"),j=he("space"),P=he("translate"),R=()=>["auto","contain","none"],b=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto",X,t],I=()=>[X,t],_=()=>["",un,Tn],L=()=>["auto",ci,X],$=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],K=()=>["solid","dashed","dotted","double","none"],ee=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],M=()=>["start","end","center","between","around","evenly","stretch"],z=()=>["","0",X],E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],H=()=>[ci,X];return{cacheSize:500,separator:":",theme:{colors:[Gi],spacing:[un,Tn],blur:["none","",Nn,X],brightness:H(),borderColor:[e],borderRadius:["none","","full",Nn,X],borderSpacing:I(),borderWidth:_(),contrast:H(),grayscale:z(),hueRotate:H(),invert:z(),gap:I(),gradientColorStops:[e],gradientColorStopPositions:[pI,Tn],inset:A(),margin:A(),opacity:H(),padding:I(),saturate:H(),scale:H(),sepia:z(),skew:H(),space:I(),translate:I()},classGroups:{aspect:[{aspect:["auto","square","video",X]}],container:["container"],columns:[{columns:[Nn]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...$(),X]}],overflow:[{overflow:b()}],"overflow-x":[{"overflow-x":b()}],"overflow-y":[{"overflow-y":b()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",qi,X]}],basis:[{basis:A()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",X]}],grow:[{grow:z()}],shrink:[{shrink:z()}],order:[{order:["first","last","none",qi,X]}],"grid-cols":[{"grid-cols":[Gi]}],"col-start-end":[{col:["auto",{span:["full",qi,X]},X]}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":[Gi]}],"row-start-end":[{row:["auto",{span:[qi,X]},X]}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",X]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",X]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...M()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...M(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...M(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[k]}],mx:[{mx:[k]}],my:[{my:[k]}],ms:[{ms:[k]}],me:[{me:[k]}],mt:[{mt:[k]}],mr:[{mr:[k]}],mb:[{mb:[k]}],ml:[{ml:[k]}],"space-x":[{"space-x":[j]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[j]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",X,t]}],"min-w":[{"min-w":[X,t,"min","max","fit"]}],"max-w":[{"max-w":[X,t,"none","full","min","max","fit","prose",{screen:[Nn]},Nn]}],h:[{h:[X,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[X,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[X,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[X,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Nn,Tn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ou]}],"font-family":[{font:[Gi]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",X]}],"line-clamp":[{"line-clamp":["none",ci,Ou]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",un,X]}],"list-image":[{"list-image":["none",X]}],"list-style-type":[{list:["none","disc","decimal",X]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",un,Tn]}],"underline-offset":[{"underline-offset":["auto",un,X]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",X]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",X]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...$(),yI]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",gI]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},xI]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...K(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:K()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...K()]}],"outline-offset":[{"outline-offset":[un,X]}],"outline-w":[{outline:[un,Tn]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:_()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[un,Tn]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Nn,wI]}],"shadow-color":[{shadow:[Gi]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...ee(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ee()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Nn,X]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[T]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[T]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",X]}],duration:[{duration:H()}],ease:[{ease:["linear","in","out","in-out",X]}],delay:[{delay:H()}],animate:[{animate:["none","spin","ping","pulse","bounce",X]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[qi,X]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",X]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",X]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",X]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[un,Tn,Ou]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},EI=sI(CI);function G(...e){return EI(K1(e))}const TI=LA,ik=m.forwardRef(({className:e,...t},n)=>d.jsx(V1,{ref:n,className:G("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));ik.displayName=V1.displayName;const NI=Ah("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),ok=m.forwardRef(({className:e,variant:t,...n},r)=>d.jsx(z1,{ref:r,className:G(NI({variant:t}),e),...n}));ok.displayName=z1.displayName;const PI=m.forwardRef(({className:e,...t},n)=>d.jsx(U1,{ref:n,className:G("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));PI.displayName=U1.displayName;const sk=m.forwardRef(({className:e,...t},n)=>d.jsx(W1,{ref:n,className:G("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:d.jsx(jt,{className:"h-4 w-4"})}));sk.displayName=W1.displayName;const ak=m.forwardRef(({className:e,...t},n)=>d.jsx(B1,{ref:n,className:G("text-sm font-semibold [&+div]:text-xs",e),...t}));ak.displayName=B1.displayName;const lk=m.forwardRef(({className:e,...t},n)=>d.jsx($1,{ref:n,className:G("text-sm opacity-90",e),...t}));lk.displayName=$1.displayName;function jI(){const{toasts:e}=ns();return d.jsxs(TI,{children:[e.map(function({id:t,title:n,description:r,action:i,...o}){return d.jsxs(ok,{...o,children:[d.jsxs("div",{className:"grid gap-1",children:[n&&d.jsx(ak,{children:n}),r&&d.jsx(lk,{children:r})]}),i,d.jsx(sk,{})]},t)}),d.jsx(ik,{})]})}const RI="0.1.0",AI="https://github.com/rawnaqs/khayal/releases/latest",ke={TOKEN:"khayal_token",HOST:"khayal_host",RECENT_SEARCHES:"khayal-recent-searches",LOCK_SETUP_DECIDED:"khayal-lock-setup-decided"},II=["people","payments","this week","ideas","decisions","meetings"],Of={text:["saved","tagging","summarizing","writing"],image:["saved","describing","tagging","writing"],article:["saved","extracting","summarizing","writing"]},Er={SEARCH_RESULTS:20,QUEUE_JOBS:50,RECENT_SEARCHES:6,DONE_JOBS_SHOWN:5,TAGS_HERO:3,TAGS_COMPACT:2,HERO_SCORE_THRESHOLD:.9},Oh={CAPTURE_DISMISS:3500,STATS_POLL:6e4,SERVER_STATUS_POLL:3e4},Fu=[{maxHour:5,text:"late night thoughts?"},{maxHour:12,text:"good morning"},{maxHour:17,text:"good afternoon"},{maxHour:21,text:"good evening"},{maxHour:24,text:"late night thoughts?"}],Ee={DB_NAME:"khayal-offline",STORE_OFFLINE:"offline",STORE_VAULT:"vault",DB_VERSION:2,PRF_SALT_BYTES:32};class uk{constructor(t,n){Hl(this,"host");Hl(this,"token");this.host=t.replace(/\/$/,""),this.token=n}async request(t,n,r){const i=await fetch(`${this.host}${n}`,{method:t,headers:{"Content-Type":"application/json","X-Khayal-Token":this.token},body:r?JSON.stringify(r):void 0});if(!i.ok){const o=await i.json().catch(()=>({error:"Unknown error"}));throw new Error(o.error||`Request failed: ${i.status}`)}return i.json()}async capture(t){return this.request("POST","/v1/capture",t)}async uploadImage(t,n){const r=new FormData;r.append("file",t),n&&r.append("note",n);const i=await fetch(`${this.host}/v1/capture`,{method:"POST",headers:{"X-Khayal-Token":this.token},body:r});if(!i.ok){const o=await i.json().catch(()=>({error:"Upload failed"}));throw new Error(o.error||"Upload failed")}return i.json()}async search(t,n={}){const r=new URLSearchParams;return r.set("q",t),n.mode&&r.set("mode",n.mode),n.limit&&r.set("limit",n.limit.toString()),n.excerpt_length&&r.set("excerpt_length",n.excerpt_length.toString()),n.from&&r.set("from",n.from),n.to&&r.set("to",n.to),n.connections&&r.set("connections","true"),n.overview&&r.set("overview","true"),this.request("GET",`/v1/search?${r.toString()}`)}async health(){return this.request("GET","/v1/health")}async queue(t={}){const n=new URLSearchParams;return t.status&&n.set("status",t.status),t.limit&&n.set("limit",t.limit.toString()),t.offset&&n.set("offset",t.offset.toString()),this.request("GET",`/v1/queue?${n.toString()}`)}async retryJob(t){await this.request("POST",`/v1/queue/${t}/retry`)}async discardJob(t){await this.request("POST",`/v1/queue/${t}/discard`)}async stats(){return this.request("GET","/v1/stats")}async mediaBlob(t){const n=await fetch(`${this.host}/v1/media?path=${encodeURIComponent(t)}`,{headers:{"X-Khayal-Token":this.token}});if(!n.ok)throw new Error(`media fetch failed: ${n.status}`);return n.blob()}async deleteNote(t){return this.request("DELETE",`/v1/note?path=${encodeURIComponent(t)}`)}async getNote(t,n){const r=new URLSearchParams;n&&r.set("q",n);const i=encodeURIComponent(t),o=n?"?"+r.toString():"";return this.request("GET",`/v1/notes/${i}${o}`)}}function dt(e){const t=localStorage.getItem(ke.HOST)||window.location.origin,n=e??localStorage.getItem(ke.TOKEN)??"";return new uk(t,n)}function ck(e){return e instanceof Uint8Array?new Uint8Array(e):new Uint8Array(e)}function DI(e){if(e instanceof ArrayBuffer)return new Uint8Array(e);const t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function _I(e){const t=ck(e);let n="";for(let r=0;r"u"||typeof PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable!="function")return!1;try{return await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()}catch{return!1}}async function OI(){var n;const e=await navigator.credentials.create({publicKey:{rp:{name:"khayal",id:location.hostname},user:{id:Wo(16),name:"khayal-user",displayName:"khayal"},challenge:Wo(32),pubKeyCredParams:[{alg:-7,type:"public-key"}],authenticatorSelection:{authenticatorAttachment:"platform",residentKey:"required",userVerification:"required"},extensions:{prf:{}}}});if(!e)throw new Error("Registration cancelled");const t=!!((n=e.getClientExtensionResults().prf)!=null&&n.enabled);return{credentialId:_I(e.rawId),prfEnabled:t}}async function Vu(e,t){var i,o;const n=await navigator.credentials.get({publicKey:{challenge:Wo(32),allowCredentials:[{id:LI(e),type:"public-key"}],userVerification:"required",extensions:{prf:{eval:{first:t}}}}});if(!n)throw new Error("Unlock cancelled");const r=(o=(i=n.getClientExtensionResults().prf)==null?void 0:i.results)==null?void 0:o.first;if(!r)throw new Error("PRF unavailable for this credential");return DI(r)}async function zu(e){try{const t=await crypto.subtle.importKey("raw",e,"HKDF",!1,["deriveKey"]);return await crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:new Uint8Array(0),info:new TextEncoder().encode("khayal-prf")},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}catch{return crypto.subtle.importKey("raw",e,{name:"AES-GCM"},!1,["encrypt","decrypt"])}}async function Fh(e,t){const n=Wo(12),r=new TextEncoder().encode(t),i=await crypto.subtle.encrypt({name:"AES-GCM",iv:n},e,r),o=new Uint8Array(n.length+i.byteLength);return o.set(n,0),o.set(new Uint8Array(i),n.length),fk(o)}async function Ja(e,t){const n=Ff(t),r=n.slice(0,12),i=n.slice(12),o=await crypto.subtle.decrypt({name:"AES-GCM",iv:r},e,i);return new TextDecoder().decode(o)}function os(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function FI(e,t){let n;const r=()=>{if(n)return n;const i=indexedDB.open(e);return i.onupgradeneeded=()=>i.result.createObjectStore(t),n=os(i),n.then(o=>{o.onclose=()=>n=void 0},()=>{}),n};return(i,o)=>r().then(s=>o(s.transaction(t,i).objectStore(t)))}let Bu;function Vh(){return Bu||(Bu=FI("keyval-store","keyval")),Bu}function VI(e,t=Vh()){return t("readonly",n=>os(n.get(e)))}function zI(e,t=Vh()){return t("readwrite",n=>(n.delete(e),os(n.transaction)))}function BI(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},os(e.transaction)}function $I(e=Vh()){return e("readonly",t=>{if(t.getAllKeys)return os(t.getAllKeys());const n=[];return BI(t,r=>n.push(r.key)).then(()=>n)})}function Ar(){return new Promise((e,t)=>{const n=indexedDB.open(Ee.DB_NAME,Ee.DB_VERSION);n.onupgradeneeded=()=>{const r=n.result;r.objectStoreNames.contains(Ee.STORE_OFFLINE)||r.createObjectStore(Ee.STORE_OFFLINE,{keyPath:"id"}),r.objectStoreNames.contains(Ee.STORE_VAULT)||r.createObjectStore(Ee.STORE_VAULT,{keyPath:"id"})},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}function zh(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}function Ll(e){return new Promise((t,n)=>{e.oncomplete=()=>t(),e.onerror=()=>n(e.error),e.onabort=()=>n(e.error)})}let ly=!1;async function UI(){if(!ly){ly=!0;try{const t=(await $I()).filter(r=>String(r).startsWith("khayal-offline-"));if(t.length===0)return;const n=await Ar();for(const r of t){const i=await VI(r);!i||typeof i!="object"||!i.id||(await zh(n.transaction(Ee.STORE_OFFLINE,"readwrite").objectStore(Ee.STORE_OFFLINE).put(i)),await zI(r))}}catch{}}}async function $u(){const t=(await Ar()).transaction(Ee.STORE_VAULT,"readonly");return await zh(t.objectStore(Ee.STORE_VAULT).get("vault"))||null}async function WI(e){const n=(await Ar()).transaction(Ee.STORE_VAULT,"readwrite");n.objectStore(Ee.STORE_VAULT).put(e),await Ll(n)}async function uy(){const t=(await Ar()).transaction(Ee.STORE_VAULT,"readwrite");t.objectStore(Ee.STORE_VAULT).delete("vault"),await Ll(t)}async function Bh(){const t=(await Ar()).transaction(Ee.STORE_OFFLINE,"readonly");return await zh(t.objectStore(Ee.STORE_OFFLINE).getAll())||[]}async function el(e){const n=(await Ar()).transaction(Ee.STORE_OFFLINE,"readwrite");n.objectStore(Ee.STORE_OFFLINE).put(e),await Ll(n)}async function HI(e){const n=(await Ar()).transaction(Ee.STORE_OFFLINE,"readwrite");n.objectStore(Ee.STORE_OFFLINE).delete(e),await Ll(n)}function hk(e){return!!e&&e.mode!=="none"&&!!e.key}async function cy(e,t){const n=`offline-${Date.now()}-${Math.random().toString(36).slice(2)}`,r=t==null?void 0:t.token,i=Date.now();if(hk(t)){const o=JSON.stringify({request:e,token:r??null}),s=await Fh(t.key,o);await el({id:n,cipher:s,timestamp:i})}else await el({id:n,request:e,token:r,timestamp:i});return QI(),n}async function pk(e){const t=await Bh(),n=[];for(const r of t)if(r.cipher){if(!hk(e))continue;try{const i=await Ja(e.key,r.cipher),o=JSON.parse(i);n.push({id:r.id,request:o.request,token:o.token??void 0,timestamp:r.timestamp})}catch{}}else r.request&&n.push({id:r.id,request:r.request,token:r.token,timestamp:r.timestamp});return n.sort((r,i)=>r.timestamp-i.timestamp)}async function KI(e){await HI(e)}async function qI(e,t){const n=await pk(t);for(const r of n)try{await e.capture(r.request),await KI(r.id)}catch{break}}function GI(e,t,n){const r=new uk(e,t),i=()=>qI(r,n);window.addEventListener("focus",i),window.addEventListener("online",i),navigator.onLine&&i()}async function YI(e,t){const n=await Bh();for(const r of n){if(r.cipher||!r.request)continue;const i=JSON.stringify({request:r.request,token:t??r.token??null}),o=await Fh(e,i);await el({id:r.id,cipher:o,timestamp:r.timestamp})}}async function XI(e){const t=await Bh();for(const n of t)if(n.cipher)try{const r=await Ja(e,n.cipher),i=JSON.parse(r);await el({id:n.id,request:i.request,token:i.token??void 0,timestamp:n.timestamp})}catch{}}async function QI(){if("serviceWorker"in navigator&&"sync"in ServiceWorkerRegistration.prototype)try{await(await navigator.serviceWorker.ready).sync.register("sync-offline-captures")}catch{navigator.serviceWorker.controller&&navigator.serviceWorker.controller.postMessage({type:"SYNC_OFFLINE"})}}const mk=m.createContext(null);function ZI({children:e}){const[t,n]=m.useState("none"),[r,i]=m.useState(!1),[o,s]=m.useState(!1),[a,l]=m.useState(null),[u,c]=m.useState(null),[f,h]=m.useState(!1),p=m.useRef(null);m.useEffect(()=>{let P=!1;return(async()=>{await UI();const R=await $u();if(!P){if(R&&R.mode==="prf")n("prf"),i(!0),s(!0);else{const b=localStorage.getItem(ke.TOKEN),A=localStorage.getItem(ke.HOST);b&&A?(l(b),n("none"),i(!1),s(!0)):(n("none"),i(!1),s(!1))}h(!0)}})(),()=>{P=!0}},[]),m.useEffect(()=>{if(!a)return;const P=localStorage.getItem(ke.HOST)||window.location.origin;!P||p.current===a||(p.current=a,GI(P,a,{mode:t,key:u,token:a}))},[a,t,u]);const y=m.useCallback(async(P,R,b,A)=>{const I=await Fh(P,R);await WI({id:"vault",mode:"prf",credentialId:b,salt:fk(A),encryptedToken:I}),await YI(P,R),localStorage.removeItem(ke.TOKEN),localStorage.setItem(ke.LOCK_SETUP_DECIDED,"1"),l(R),c(P),n("prf"),i(!1),s(!0)},[]),v=m.useCallback(async P=>{if(!await dk())return!1;try{const{credentialId:b,prfEnabled:A}=await OI();if(!A)return!1;const I=P??a??localStorage.getItem(ke.TOKEN)??"";if(!I)return!1;const _=MI(Ee.PRF_SALT_BYTES),L=await Vu(b,_),$=await zu(L);return await y($,I,b,_),!0}catch{return!1}},[a,y]),k=m.useCallback((P,R)=>{localStorage.setItem(ke.LOCK_SETUP_DECIDED,"1"),R?(localStorage.setItem(ke.HOST,window.location.origin),localStorage.setItem(ke.TOKEN,P)):localStorage.removeItem(ke.TOKEN),l(P),c(null),n("none"),i(!1),s(!0)},[]),g=m.useCallback(P=>{localStorage.setItem(ke.LOCK_SETUP_DECIDED,"1"),P?(localStorage.setItem(ke.HOST,window.location.origin),a&&localStorage.setItem(ke.TOKEN,a)):localStorage.removeItem(ke.TOKEN)},[a]),x=m.useCallback(async()=>{const P=await $u();if(!P||P.mode!=="prf"||!P.credentialId)return!1;try{const R=await Vu(P.credentialId,Ff(P.salt)),b=await zu(R),A=await Ja(b,P.encryptedToken);return l(A),c(b),n("prf"),i(!1),!0}catch{return!1}},[]),w=m.useCallback(async()=>{const P=await $u();if(!P||P.mode!=="prf"||!P.credentialId)return!1;try{const R=await Vu(P.credentialId,Ff(P.salt)),b=await zu(R),A=await Ja(b,P.encryptedToken);return localStorage.setItem(ke.TOKEN,A),await XI(b),await uy(),n("none"),i(!1),c(null),l(A),!0}catch{return!1}},[]),S=m.useCallback(()=>{t!=="none"&&(l(null),c(null),i(!0))},[t]),T=m.useCallback(async()=>{await uy(),localStorage.removeItem(ke.TOKEN),localStorage.removeItem(ke.HOST),p.current=null,n("none"),i(!1),l(null),c(null),s(!1)},[]),C=m.useMemo(()=>({mode:t,key:u,token:a??void 0}),[t,u,a]),j=m.useMemo(()=>({lockMode:t,locked:r,configured:o,token:a,vaultKey:u,session:C,unlock:x,setupPrf:v,completeOnboarding:k,setTokenPersistence:g,disable:w,lock:S,resetToOnboarding:T}),[t,r,o,a,u,C,x,v,k,g,w,S,T]);return f?d.jsx(mk.Provider,{value:j,children:e}):null}function st(){const e=m.useContext(mk);if(!e)throw new Error("useVaultLock must be used within a VaultLockProvider");return e}function JI(e=Oh.SERVER_STATUS_POLL){const{token:t}=st(),[n,r]=m.useState("offline"),[i,o]=m.useState(null),[s,a]=m.useState(null),l=m.useCallback(async()=>{try{const c=await dt(t).health();o(c);const f=c.dependencies;f.db.status!=="ok"||f.vault.status!=="ok"?r("degraded"):r("ok")}catch{r("offline"),o(null)}a(new Date)},[t]);return m.useEffect(()=>{l();const u=setInterval(l,e);return()=>clearInterval(u)},[l,e]),{status:n,health:i,lastChecked:s,checkStatus:l}}var eD=Symbol.for("react.lazy"),tl=Pr[" use ".trim().toString()];function tD(e){return typeof e=="object"&&e!==null&&"then"in e}function gk(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===eD&&"_payload"in e&&tD(e._payload)}function nD(e){const t=iD(e),n=m.forwardRef((r,i)=>{let{children:o,...s}=r;gk(o)&&typeof tl=="function"&&(o=tl(o._payload));const a=m.Children.toArray(o),l=a.find(sD);if(l){const u=l.props.children,c=a.map(f=>f===l?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return d.jsx(t,{...s,ref:i,children:m.isValidElement(u)?m.cloneElement(u,void 0,c):null})}return d.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}var rD=nD("Slot");function iD(e){const t=m.forwardRef((n,r)=>{let{children:i,...o}=n;if(gk(i)&&typeof tl=="function"&&(i=tl(i._payload)),m.isValidElement(i)){const s=lD(i),a=aD(o,i.props);return i.type!==m.Fragment&&(a.ref=r?Sn(r,s):s),m.cloneElement(i,a)}return m.Children.count(i)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var oD=Symbol("radix.slottable");function sD(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===oD}function aD(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function lD(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const uD=Ah("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-gradient-to-r from-primary to-primary/80 text-primary-foreground shadow hover:shadow-lg hover:shadow-primary/25 hover:scale-[1.02] active:scale-[0.98]",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 hover:shadow-lg hover:shadow-destructive/25",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),wn=m.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},o)=>{const s=r?rD:"button";return d.jsx(s,{className:G(uD({variant:t,size:n,className:e})),ref:o,...i})});wn.displayName="Button";var cD=Object.defineProperty,Di=(e,t)=>cD(e,"name",{value:t,configurable:!0}),yk=!!(typeof window<"u"&&window.document&&window.document.createElement);function $h(e,t,{checkForDefaultPrevented:n=!0}={}){return Di(function(i){if(e==null||e(i),n===!1||!i||!i.defaultPrevented)return t==null?void 0:t(i)},"handleEvent")}Di($h,"composeEventHandlers");function fD(e){var t;if(!yk)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}Di(fD,"getOwnerWindow");function Vf(e){if(!yk)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}Di(Vf,"getOwnerDocument");function vk(e,t=!1){const{activeElement:n}=Vf(e);if(!(n!=null&&n.nodeName))return null;if(xk(n)&&n.contentDocument)return vk(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const i=Vf(n).getElementById(r);if(i)return i}}return n}Di(vk,"getActiveElement");function xk(e){return e.tagName==="IFRAME"}Di(xk,"isFrame");var dD=Object.defineProperty,Uh=(e,t)=>dD(e,"name",{value:t,configurable:!0});function zf(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Uh(zf,"setRef");function wk(...e){return t=>{let n=!1;const r=e.map(i=>{const o=zf(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;ihD(e,"name",{value:t,configurable:!0});function pD(e,t){const n=m.createContext(t);n.displayName=e+"Context";const r=St(o=>{const{children:s,...a}=o,l=m.useMemo(()=>a,Object.values(a));return d.jsx(n.Provider,{value:l,children:s})},"Provider");r.displayName=e+"Provider";function i(o,s={}){const{optional:a=!1}=s,l=m.useContext(n);if(l)return l;if(t!==void 0)return t;if(!a)throw new Error(`\`${o}\` must be used within \`${e}\``)}return St(i,"useContext"),[r,i]}St(pD,"createContext");function kk(e,t=[]){let n=[];function r(o,s){const a=m.createContext(s);a.displayName=o+"Context";const l=n.length;n=[...n,s];const u=St(f=>{var g;const{scope:h,children:p,...y}=f,v=((g=h==null?void 0:h[e])==null?void 0:g[l])||a,k=m.useMemo(()=>y,Object.values(y));return d.jsx(v.Provider,{value:k,children:p})},"Provider");u.displayName=o+"Provider";function c(f,h,p={}){var g;const{optional:y=!1}=p,v=((g=h==null?void 0:h[e])==null?void 0:g[l])||a,k=m.useContext(v);if(k)return k;if(s!==void 0)return s;if(!y)throw new Error(`\`${f}\` must be used within \`${o}\``)}return St(c,"useContext"),[u,c]}St(r,"createContext");const i=St(()=>{const o=n.map(s=>m.createContext(s));return St(function(a){const l=(a==null?void 0:a[e])||o;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])},"useScope")},"createScope");return i.scopeName=e,[r,Sk(i,...t)]}St(kk,"createContextScope");function Sk(...e){const t=e[0];if(e.length===1)return t;const n=St(()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return St(function(o){const s=r.reduce((a,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...a,...f}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}St(Sk,"composeContextScopes");var bk=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},mD=Object.defineProperty,gD=(e,t)=>mD(e,"name",{value:t,configurable:!0}),fy=Pr[" useEffectEvent ".trim().toString()],dy=Pr[" useInsertionEffect ".trim().toString()];function Ck(e){if(typeof fy=="function")return fy(e);const t=m.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof dy=="function"?dy(()=>{t.current=e}):bk(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}gD(Ck,"useEffectEvent");var yD=Object.defineProperty,ss=(e,t)=>yD(e,"name",{value:t,configurable:!0}),vD=Pr[" useInsertionEffect ".trim().toString()]||bk;function Ek({prop:e,defaultProp:t,onChange:n=ss(()=>{},"onChange"),caller:r}){const[i,o,s]=Tk({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:i,u=m.useCallback(c=>{var f;if(a){const h=Nk(c)?c(e):c;h!==e&&((f=s.current)==null||f.call(s,h))}else o(c)},[a,e,o,s]);return[l,u]}ss(Ek,"useControllableState");function Tk({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),i=m.useRef(n),o=m.useRef(t);return vD(()=>{o.current=t},[t]),m.useEffect(()=>{var s;i.current!==n&&((s=o.current)==null||s.call(o,n),i.current=n)},[n,i]),[n,r,o]}ss(Tk,"useUncontrolledState");function Nk(e){return typeof e=="function"}ss(Nk,"isFunction");var hy=Symbol("RADIX:SYNC_STATE");function xD(e,t,n,r){const{prop:i,defaultProp:o,onChange:s,caller:a}=t,l=i!==void 0,u=Ck(s),c=[{...n,state:o}];r&&c.push(r);const[f,h]=m.useReducer((k,g)=>{if(g.type===hy)return{...k,state:g.state};const x=e(k,g);return l&&!Object.is(x.state,k.state)&&u(x.state),x},...c),p=f.state,y=m.useRef(p);m.useEffect(()=>{y.current!==p&&(y.current=p,l||u(p))},[p,y,l]);const v=m.useMemo(()=>i!==void 0?{...f,state:i}:f,[f,i]);return m.useEffect(()=>{l&&!Object.is(i,f.state)&&h({type:hy,state:i})},[i,f.state,l]),[v,h]}ss(xD,"useControllableStateReducer");var wD=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},kD=Object.defineProperty,SD=(e,t)=>kD(e,"name",{value:t,configurable:!0});function Pk(e){const[t,n]=m.useState(void 0);return wD(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const l=o.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,a=u.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}SD(Pk,"useSize");var bD=Object.defineProperty,Wt=(e,t)=>bD(e,"name",{value:t,configurable:!0});function jk(e){const t=m.forwardRef((n,r)=>{let{children:i,...o}=n,s=null,a=!1;const l=[];Bf(i)&&typeof Ms=="function"&&(i=Ms(i._payload)),m.Children.forEach(i,h=>{var p;if(Dk(h)){a=!0;const y=h;let v="child"in y.props?y.props.child:y.props.children;Bf(v)&&typeof Ms=="function"&&(v=Ms(v._payload)),s=ED(y,v),l.push((p=s==null?void 0:s.props)==null?void 0:p.children)}else l.push(h)}),s?s=m.cloneElement(s,void 0,l):!a&&m.Children.count(i)===1&&m.isValidElement(i)&&(s=i);const u=s?Ik(s):void 0,c=Ml(r,u);if(!s){if(i||i===0)throw new Error(a?PD(e):ND(e));return i}const f=Ak(o,s.props??{});return s.type!==m.Fragment&&(f.ref=r?c:u),m.cloneElement(s,f)});return t.displayName=`${e}.Slot`,t}Wt(jk,"createSlot");var Rk=Symbol.for("radix.slottable");function CD(e){const t=Wt(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=Rk,t}Wt(CD,"createSlottable");var ED=Wt((e,t)=>{if("child"in e.props){const n=e.props.child;return m.isValidElement(n)?m.cloneElement(n,void 0,e.props.children(n.props.children)):null}return m.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function Ak(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}Wt(Ak,"mergeProps");function Ik(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Wt(Ik,"getElementRef");function Dk(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Rk}Wt(Dk,"isSlottable");var TD=Symbol.for("react.lazy");function Bf(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===TD&&"_payload"in e&&_k(e._payload)}Wt(Bf,"isLazyComponent");function _k(e){return typeof e=="object"&&e!==null&&"then"in e}Wt(_k,"isPromiseLike");var ND=Wt(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),PD=Wt(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Ms=Pr[" use ".trim().toString()],jD=Object.defineProperty,RD=(e,t)=>jD(e,"name",{value:t,configurable:!0}),AD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Wh=AD.reduce((e,t)=>{const n=jk(`Primitive.${t}`),r=m.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ID(e,t){e&&Ni.flushSync(()=>e.dispatchEvent(t))}RD(ID,"dispatchDiscreteCustomEvent");var DD=Object.defineProperty,Qn=(e,t)=>DD(e,"name",{value:t,configurable:!0}),Hh="Switch",[_D,A5]=kk(Hh),[LD,Kh]=_D(Hh);function Lk(e){const{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:o,form:s,name:a,onCheckedChange:l,required:u,value:c="on",internal_do_not_use_render:f}=e,[h,p]=Ek({prop:n,defaultProp:i??!1,onChange:l,caller:Hh}),[y,v]=m.useState(null),[k,g]=m.useState(null),x=m.useRef(!1),[w,S]=m.useReducer(j=>j+1,0),T=y?!!s||!!y.closest("form"):!0,C={checked:h,setChecked:p,disabled:o,control:y,setControl:v,name:a,form:s,value:c,hasConsumerStoppedPropagationRef:x,userInteractionCount:w,onUserInteraction:S,required:u,defaultChecked:i,isFormControl:T,bubbleInput:k,setBubbleInput:g};return d.jsx(LD,{scope:t,...C,children:Ok(f)?f(C):r})}Qn(Lk,"SwitchProvider");var MD="SwitchTrigger",OD=m.forwardRef(Qn(function({__scopeSwitch:t,onClick:n,...r},i){const{control:o,form:s,value:a,disabled:l,checked:u,required:c,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:p,onUserInteraction:y,isFormControl:v,bubbleInput:k}=Kh(MD,t),g=Ml(i,f),x=m.useRef(u);return m.useEffect(()=>{const w=s?o==null?void 0:o.ownerDocument.getElementById(s):o==null?void 0:o.form;if(w instanceof HTMLFormElement){const S=Qn(()=>h(x.current),"reset");return w.addEventListener("reset",S),()=>w.removeEventListener("reset",S)}},[o,s,h]),d.jsx(Wh.button,{type:"button",role:"switch","aria-checked":u,"aria-required":c,"data-state":qh(u),"data-disabled":l?"":void 0,disabled:l,value:a,...r,ref:g,onClick:$h(n,w=>{y(),h(S=>!S),k&&v&&(p.current=w.isPropagationStopped(),p.current||w.stopPropagation())})})},"SwitchTrigger")),Mk=m.forwardRef(Qn(function(t,n){const{__scopeSwitch:r,name:i,checked:o,defaultChecked:s,required:a,disabled:l,value:u,onCheckedChange:c,form:f,...h}=t;return d.jsx(Lk,{__scopeSwitch:r,checked:o,defaultChecked:s,disabled:l,required:a,onCheckedChange:c,name:i,form:f,value:u,internal_do_not_use_render:({isFormControl:p})=>d.jsxs(d.Fragment,{children:[d.jsx(OD,{...h,ref:n,__scopeSwitch:r}),p&&d.jsx(BD,{__scopeSwitch:r})]})})},"Switch")),FD="SwitchThumb",VD=m.forwardRef(Qn(function(t,n){const{__scopeSwitch:r,...i}=t,o=Kh(FD,r);return d.jsx(Wh.span,{"data-state":qh(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:n})},"SwitchThumb")),zD="SwitchBubbleInput",BD=m.forwardRef(Qn(function({__scopeSwitch:t,onClick:n,...r},i){const{control:o,hasConsumerStoppedPropagationRef:s,userInteractionCount:a,checked:l,defaultChecked:u,required:c,disabled:f,name:h,value:p,form:y,bubbleInput:v,setBubbleInput:k}=Kh(zD,t),g=Ml(i,k),x=Pk(o),w=m.useRef(!1),S=m.useRef(l),T=m.useRef(a);m.useEffect(()=>{const j=v;if(!j)return;const P=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(P,"checked").set,A=a!==T.current;T.current=a;const I=S.current!==l;S.current=l;const _=!(A&&s.current);if(I&&b){w.current=!A;const L=new Event("click",{bubbles:_});b.call(j,l),j.dispatchEvent(L),w.current=!1}},[v,l,s,a]);const C=m.useRef(l);return d.jsx(Wh.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??C.current,required:c,disabled:f,name:h,value:p,form:y,...r,tabIndex:-1,ref:g,onClick:$h(n,j=>{w.current&&j.stopPropagation()}),style:{...r.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function Ok(e){return typeof e=="function"}Qn(Ok,"isFunction");function qh(e){return e?"checked":"unchecked"}Qn(qh,"getState");const Fk=m.forwardRef(({className:e,...t},n)=>d.jsx(Mk,{className:G("peer inline-flex h-5 w-9 min-h-0 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:d.jsx(VD,{className:G("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Fk.displayName=Mk.displayName;var $D=Pr[" useId ".trim().toString()]||(()=>{}),UD=0;function Uu(e){const[t,n]=m.useState($D());return Si(()=>{n(r=>r??String(UD++))},[e]),e||(t?`radix-${t}`:"")}function WD(e){const t=HD(e),n=m.forwardRef((r,i)=>{const{children:o,...s}=r,a=m.Children.toArray(o),l=a.find(qD);if(l){const u=l.props.children,c=a.map(f=>f===l?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return d.jsx(t,{...s,ref:i,children:m.isValidElement(u)?m.cloneElement(u,void 0,c):null})}return d.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function HD(e){const t=m.forwardRef((n,r)=>{const{children:i,...o}=n;if(m.isValidElement(i)){const s=YD(i),a=GD(o,i.props);return i.type!==m.Fragment&&(a.ref=r?Sn(r,s):s),m.cloneElement(i,a)}return m.Children.count(i)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var KD=Symbol("radix.slottable");function qD(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===KD}function GD(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function YD(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var XD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],QD=XD.reduce((e,t)=>{const n=WD(`Primitive.${t}`),r=m.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Wu="focusScope.autoFocusOnMount",Hu="focusScope.autoFocusOnUnmount",py={bubbles:!1,cancelable:!0},ZD="FocusScope",Vk=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=e,[a,l]=m.useState(null),u=xn(i),c=xn(o),f=m.useRef(null),h=Ut(t,v=>l(v)),p=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let v=function(w){if(p.paused||!a)return;const S=w.target;a.contains(S)?f.current=S:An(f.current,{select:!0})},k=function(w){if(p.paused||!a)return;const S=w.relatedTarget;S!==null&&(a.contains(S)||An(f.current,{select:!0}))},g=function(w){if(document.activeElement===document.body)for(const T of w)T.removedNodes.length>0&&An(a)};document.addEventListener("focusin",v),document.addEventListener("focusout",k);const x=new MutationObserver(g);return a&&x.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",k),x.disconnect()}}},[r,a,p.paused]),m.useEffect(()=>{if(a){gy.add(p);const v=document.activeElement;if(!a.contains(v)){const g=new CustomEvent(Wu,py);a.addEventListener(Wu,u),a.dispatchEvent(g),g.defaultPrevented||(JD(i_(zk(a)),{select:!0}),document.activeElement===v&&An(a))}return()=>{a.removeEventListener(Wu,u),setTimeout(()=>{const g=new CustomEvent(Hu,py);a.addEventListener(Hu,c),a.dispatchEvent(g),g.defaultPrevented||An(v??document.body,{select:!0}),a.removeEventListener(Hu,c),gy.remove(p)},0)}}},[a,u,c,p]);const y=m.useCallback(v=>{if(!n&&!r||p.paused)return;const k=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,g=document.activeElement;if(k&&g){const x=v.currentTarget,[w,S]=e_(x);w&&S?!v.shiftKey&&g===S?(v.preventDefault(),n&&An(w,{select:!0})):v.shiftKey&&g===w&&(v.preventDefault(),n&&An(S,{select:!0})):g===x&&v.preventDefault()}},[n,r,p.paused]);return d.jsx(QD.div,{tabIndex:-1,...s,ref:h,onKeyDown:y})});Vk.displayName=ZD;function JD(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(An(r,{select:t}),document.activeElement!==n)return}function e_(e){const t=zk(e),n=my(t,e),r=my(t.reverse(),e);return[n,r]}function zk(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function my(e,t){for(const n of e)if(!t_(n,{upTo:t}))return n}function t_(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function n_(e){return e instanceof HTMLInputElement&&"select"in e}function An(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&n_(e)&&t&&e.select()}}var gy=r_();function r_(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=yy(e,t),e.unshift(t)},remove(t){var n;e=yy(e,t),(n=e[0])==null||n.resume()}}}function yy(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function i_(e){return e.filter(t=>t.tagName!=="A")}function Bk(e){const t=o_(e),n=m.forwardRef((r,i)=>{const{children:o,...s}=r,a=m.Children.toArray(o),l=a.find(a_);if(l){const u=l.props.children,c=a.map(f=>f===l?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return d.jsx(t,{...s,ref:i,children:m.isValidElement(u)?m.cloneElement(u,void 0,c):null})}return d.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function o_(e){const t=m.forwardRef((n,r)=>{const{children:i,...o}=n;if(m.isValidElement(i)){const s=u_(i),a=l_(o,i.props);return i.type!==m.Fragment&&(a.ref=r?Sn(r,s):s),m.cloneElement(i,a)}return m.Children.count(i)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var s_=Symbol("radix.slottable");function a_(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===s_}function l_(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const l=o(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function u_(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var c_=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],as=c_.reduce((e,t)=>{const n=Bk(`Primitive.${t}`),r=m.forwardRef((i,o)=>{const{asChild:s,...a}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Ku=0;function f_(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??vy()),document.body.insertAdjacentElement("beforeend",e[1]??vy()),Ku++,()=>{Ku===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ku--}},[])}function vy(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var en=function(){return en=Object.assign||function(t){for(var n,r=1,i=arguments.length;r"u")return P_;var t=j_(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},A_=Hk(),fi="data-scroll-locked",I_=function(e,t,n,r){var i=e.left,o=e.top,s=e.right,a=e.gap;return n===void 0&&(n="margin"),` + .`.concat(h_,` { + overflow: hidden `).concat(r,`; + padding-right: `).concat(a,"px ").concat(r,`; + } + body[`).concat(fi,`] { + overflow: hidden `).concat(r,`; + overscroll-behavior: contain; + `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` + padding-left: `.concat(i,`px; + padding-top: `).concat(o,`px; + padding-right: `).concat(s,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(a,"px ").concat(r,`; + `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),` + } + + .`).concat(ha,` { + right: `).concat(a,"px ").concat(r,`; + } + + .`).concat(pa,` { + margin-right: `).concat(a,"px ").concat(r,`; + } + + .`).concat(ha," .").concat(ha,` { + right: 0 `).concat(r,`; + } + + .`).concat(pa," .").concat(pa,` { + margin-right: 0 `).concat(r,`; + } + + body[`).concat(fi,`] { + `).concat(p_,": ").concat(a,`px; + } +`)},wy=function(){var e=parseInt(document.body.getAttribute(fi)||"0",10);return isFinite(e)?e:0},D_=function(){m.useEffect(function(){return document.body.setAttribute(fi,(wy()+1).toString()),function(){var e=wy()-1;e<=0?document.body.removeAttribute(fi):document.body.setAttribute(fi,e.toString())}},[])},__=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;D_();var o=m.useMemo(function(){return R_(i)},[i]);return m.createElement(A_,{styles:I_(o,!t,i,n?"":"!important")})},$f=!1;if(typeof window<"u")try{var Os=Object.defineProperty({},"passive",{get:function(){return $f=!0,!0}});window.addEventListener("test",Os,Os),window.removeEventListener("test",Os,Os)}catch{$f=!1}var Or=$f?{passive:!1}:!1,L_=function(e){return e.tagName==="TEXTAREA"},Kk=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!L_(e)&&n[t]==="visible")},M_=function(e){return Kk(e,"overflowY")},O_=function(e){return Kk(e,"overflowX")},ky=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=qk(e,r);if(i){var o=Gk(e,r),s=o[1],a=o[2];if(s>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},F_=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},V_=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},qk=function(e,t){return e==="v"?M_(t):O_(t)},Gk=function(e,t){return e==="v"?F_(t):V_(t)},z_=function(e,t){return e==="h"&&t==="rtl"?-1:1},B_=function(e,t,n,r,i){var o=z_(e,window.getComputedStyle(t).direction),s=o*r,a=n.target,l=t.contains(a),u=!1,c=s>0,f=0,h=0;do{if(!a)break;var p=Gk(e,a),y=p[0],v=p[1],k=p[2],g=v-k-o*y;(y||g)&&qk(e,a)&&(f+=g,h+=y);var x=a.parentNode;a=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(c&&Math.abs(f)<1||!c&&Math.abs(h)<1)&&(u=!0),u},Fs=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Sy=function(e){return[e.deltaX,e.deltaY]},by=function(e){return e&&"current"in e?e.current:e},$_=function(e,t){return e[0]===t[0]&&e[1]===t[1]},U_=function(e){return` + .block-interactivity-`.concat(e,` {pointer-events: none;} + .allow-interactivity-`).concat(e,` {pointer-events: all;} +`)},W_=0,Fr=[];function H_(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),i=m.useState(W_++)[0],o=m.useState(Hk)[0],s=m.useRef(e);m.useEffect(function(){s.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var v=d_([e.lockRef.current],(e.shards||[]).map(by),!0).filter(Boolean);return v.forEach(function(k){return k.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),v.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=m.useCallback(function(v,k){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!s.current.allowPinchZoom;var g=Fs(v),x=n.current,w="deltaX"in v?v.deltaX:x[0]-g[0],S="deltaY"in v?v.deltaY:x[1]-g[1],T,C=v.target,j=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in v&&j==="h"&&C.type==="range")return!1;var P=window.getSelection(),R=P&&P.anchorNode,b=R?R===C||R.contains(C):!1;if(b)return!1;var A=ky(j,C);if(!A)return!0;if(A?T=j:(T=j==="v"?"h":"v",A=ky(j,C)),!A)return!1;if(!r.current&&"changedTouches"in v&&(w||S)&&(r.current=T),!T)return!0;var I=r.current||T;return B_(I,k,v,I==="h"?w:S)},[]),l=m.useCallback(function(v){var k=v;if(!(!Fr.length||Fr[Fr.length-1]!==o)){var g="deltaY"in k?Sy(k):Fs(k),x=t.current.filter(function(T){return T.name===k.type&&(T.target===k.target||k.target===T.shadowParent)&&$_(T.delta,g)})[0];if(x&&x.should){k.cancelable&&k.preventDefault();return}if(!x){var w=(s.current.shards||[]).map(by).filter(Boolean).filter(function(T){return T.contains(k.target)}),S=w.length>0?a(k,w[0]):!s.current.noIsolation;S&&k.cancelable&&k.preventDefault()}}},[]),u=m.useCallback(function(v,k,g,x){var w={name:v,delta:k,target:g,should:x,shadowParent:K_(g)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),c=m.useCallback(function(v){n.current=Fs(v),r.current=void 0},[]),f=m.useCallback(function(v){u(v.type,Sy(v),v.target,a(v,e.lockRef.current))},[]),h=m.useCallback(function(v){u(v.type,Fs(v),v.target,a(v,e.lockRef.current))},[]);m.useEffect(function(){return Fr.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,Or),document.addEventListener("touchmove",l,Or),document.addEventListener("touchstart",c,Or),function(){Fr=Fr.filter(function(v){return v!==o}),document.removeEventListener("wheel",l,Or),document.removeEventListener("touchmove",l,Or),document.removeEventListener("touchstart",c,Or)}},[]);var p=e.removeScrollBar,y=e.inert;return m.createElement(m.Fragment,null,y?m.createElement(o,{styles:U_(i)}):null,p?m.createElement(__,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function K_(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const q_=k_(Wk,H_);var Yk=m.forwardRef(function(e,t){return m.createElement(Ol,en({},e,{ref:t,sideCar:q_}))});Yk.classNames=Ol.classNames;var G_=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Vr=new WeakMap,Vs=new WeakMap,zs={},Xu=0,Xk=function(e){return e&&(e.host||Xk(e.parentNode))},Y_=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Xk(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},X_=function(e,t,n,r){var i=Y_(t,Array.isArray(e)?e:[e]);zs[n]||(zs[n]=new WeakMap);var o=zs[n],s=[],a=new Set,l=new Set(i),u=function(f){!f||a.has(f)||(a.add(f),u(f.parentNode))};i.forEach(u);var c=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(h){if(a.has(h))c(h);else try{var p=h.getAttribute(r),y=p!==null&&p!=="false",v=(Vr.get(h)||0)+1,k=(o.get(h)||0)+1;Vr.set(h,v),o.set(h,k),s.push(h),v===1&&y&&Vs.set(h,!0),k===1&&h.setAttribute(n,"true"),y||h.setAttribute(r,"true")}catch(g){console.error("aria-hidden: cannot operate on ",h,g)}})};return c(t),a.clear(),Xu++,function(){s.forEach(function(f){var h=Vr.get(f)-1,p=o.get(f)-1;Vr.set(f,h),o.set(f,p),h||(Vs.has(f)||f.removeAttribute(r),Vs.delete(f)),p||f.removeAttribute(n)}),Xu--,Xu||(Vr=new WeakMap,Vr=new WeakMap,Vs=new WeakMap,zs={})}},Q_=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=G_(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),X_(r,i,n,"aria-hidden")):function(){return null}},Fl="Dialog",[Qk]=Ch(Fl),[Z_,Ht]=Qk(Fl),Zk=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=e,a=m.useRef(null),l=m.useRef(null),[u,c]=E1({prop:r,defaultProp:i??!1,onChange:o,caller:Fl});return d.jsx(Z_,{scope:t,triggerRef:a,contentRef:l,contentId:Uu(),titleId:Uu(),descriptionId:Uu(),open:u,onOpenChange:c,onOpenToggle:m.useCallback(()=>c(f=>!f),[c]),modal:s,children:n})};Zk.displayName=Fl;var Jk="DialogTrigger",J_=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ht(Jk,n),o=Ut(t,i.triggerRef);return d.jsx(as.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Xh(i.open),...r,ref:o,onClick:_e(e.onClick,i.onOpenToggle)})});J_.displayName=Jk;var Gh="DialogPortal",[eL,eS]=Qk(Gh,{forceMount:void 0}),tS=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,o=Ht(Gh,t);return d.jsx(eL,{scope:t,forceMount:n,children:m.Children.map(r,s=>d.jsx(rs,{present:n||o.open,children:d.jsx(Th,{asChild:!0,container:i,children:s})}))})};tS.displayName=Gh;var nl="DialogOverlay",nS=m.forwardRef((e,t)=>{const n=eS(nl,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Ht(nl,e.__scopeDialog);return o.modal?d.jsx(rs,{present:r||o.open,children:d.jsx(nL,{...i,ref:t})}):null});nS.displayName=nl;var tL=Bk("DialogOverlay.RemoveScroll"),nL=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ht(nl,n);return d.jsx(Yk,{as:tL,allowPinchZoom:!0,shards:[i.contentRef],children:d.jsx(as.div,{"data-state":Xh(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Tr="DialogContent",rS=m.forwardRef((e,t)=>{const n=eS(Tr,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Ht(Tr,e.__scopeDialog);return d.jsx(rs,{present:r||o.open,children:o.modal?d.jsx(rL,{...i,ref:t}):d.jsx(iL,{...i,ref:t})})});rS.displayName=Tr;var rL=m.forwardRef((e,t)=>{const n=Ht(Tr,e.__scopeDialog),r=m.useRef(null),i=Ut(t,n.contentRef,r);return m.useEffect(()=>{const o=r.current;if(o)return Q_(o)},[]),d.jsx(iS,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:_e(e.onCloseAutoFocus,o=>{var s;o.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:_e(e.onPointerDownOutside,o=>{const s=o.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&o.preventDefault()}),onFocusOutside:_e(e.onFocusOutside,o=>o.preventDefault())})}),iL=m.forwardRef((e,t)=>{const n=Ht(Tr,e.__scopeDialog),r=m.useRef(!1),i=m.useRef(!1);return d.jsx(iS,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,o),o.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var l,u;(l=e.onInteractOutside)==null||l.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=o.target;((u=n.triggerRef.current)==null?void 0:u.contains(s))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),iS=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=e,a=Ht(Tr,n),l=m.useRef(null),u=Ut(t,l);return f_(),d.jsxs(d.Fragment,{children:[d.jsx(Vk,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:d.jsx(Eh,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Xh(a.open),...s,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(oL,{titleId:a.titleId}),d.jsx(aL,{contentRef:l,descriptionId:a.descriptionId})]})]})}),Yh="DialogTitle",oS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ht(Yh,n);return d.jsx(as.h2,{id:i.titleId,...r,ref:t})});oS.displayName=Yh;var sS="DialogDescription",aS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ht(sS,n);return d.jsx(as.p,{id:i.descriptionId,...r,ref:t})});aS.displayName=sS;var lS="DialogClose",uS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ht(lS,n);return d.jsx(as.button,{type:"button",...r,ref:t,onClick:_e(e.onClick,()=>i.onOpenChange(!1))})});uS.displayName=lS;function Xh(e){return e?"open":"closed"}var cS="DialogTitleWarning",[I5,fS]=p2(cS,{contentName:Tr,titleName:Yh,docsSlug:"dialog"}),oL=({titleId:e})=>{const t=fS(cS),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return m.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},sL="DialogDescriptionWarning",aL=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${fS(sL).contentName}}.`;return m.useEffect(()=>{var o;const i=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},lL=Zk,uL=tS,dS=nS,hS=rS,pS=oS,mS=aS,cL=uS;const gS=lL,fL=uL,yS=m.forwardRef(({className:e,...t},n)=>d.jsx(dS,{className:G("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));yS.displayName=dS.displayName;const dL=Ah("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Qh=m.forwardRef(({side:e="right",className:t,children:n,...r},i)=>d.jsxs(fL,{children:[d.jsx(yS,{}),d.jsxs(hS,{ref:i,className:G(dL({side:e}),t),...r,children:[d.jsxs(cL,{className:"absolute right-4 top-4 flex h-8 w-8 min-h-0 items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[d.jsx(jt,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Close"})]}),n]})]}));Qh.displayName=hS.displayName;const vS=({className:e,...t})=>d.jsx("div",{className:G("flex flex-col space-y-2 text-center sm:text-left",e),...t});vS.displayName="SheetHeader";const Zh=m.forwardRef(({className:e,...t},n)=>d.jsx(pS,{ref:n,className:G("text-lg font-semibold text-foreground",e),...t}));Zh.displayName=pS.displayName;const xS=m.forwardRef(({className:e,...t},n)=>d.jsx(mS,{ref:n,className:G("text-sm text-muted-foreground",e),...t}));xS.displayName=mS.displayName;function wS({onRemember:e,onDontRemember:t}){return d.jsxs("div",{className:"flex flex-col gap-3",children:[d.jsx("span",{className:"text-lg font-bold",children:"face id isn't supported here"}),d.jsx("p",{className:"text-muted-foreground text-sm",children:"this device doesn't support face id / touch id unlock. you can choose not to remember your token, so you'll enter it each time you open khayal (e.g. from your password manager)."}),d.jsx(wn,{onClick:t,children:"don't remember my token"}),d.jsx(wn,{variant:"ghost",onClick:e,children:"remember my token"})]})}function hL({onSetupPrf:e,onRemember:t,onDontRemember:n}){const[r,i]=m.useState("checking");m.useEffect(()=>{let s=!1;return dk().then(a=>{s||i(a?"prf":"noauth")}),()=>{s=!0}},[]);const o=async()=>{i("working"),await e()||i("noauth")};return r==="checking"||r==="working"?d.jsx("div",{className:"flex flex-col gap-3 p-6 items-center text-center",children:d.jsx("span",{className:"text-lg font-bold",children:r==="checking"?"checking your device...":"waiting for biometrics..."})}):r==="noauth"?d.jsx("div",{className:"p-6",children:d.jsx(wS,{onRemember:t,onDontRemember:n})}):d.jsxs("div",{className:"flex flex-col gap-3 p-6",children:[d.jsx("span",{className:"text-lg font-bold",children:"secure this device?"}),d.jsx("p",{className:"text-muted-foreground text-sm",children:"require face id / touch id to open khayal on this device. you can turn this on or off anytime in the security sheet."}),d.jsx("p",{className:"text-muted-foreground text-xs opacity-70",children:"protects against casual access to an unlocked device — not a fully compromised device. if you lose this device's face id, you can always reconnect using your server token; nothing is deleted."}),d.jsx(wn,{onClick:o,children:"set up face id"}),d.jsx(wn,{variant:"ghost",onClick:t,children:"skip for now"})]})}function pL({open:e,onOpenChange:t}){const{lockMode:n,setupPrf:r,disable:i,setTokenPersistence:o}=st(),{toast:s}=ns(),[a,l]=m.useState("idle"),[u,c]=m.useState(""),[f,h]=m.useState(!1);m.useEffect(()=>{e||(l("idle"),c(""),h(!1))},[e]);const p=async()=>{l("working"),c(""),await r()?(l("idle"),s({title:"Lock enabled"})):l("choice")},y=()=>{o(!0),l("idle"),s({title:"Token will be remembered"})},v=()=>{o(!1),l("idle"),s({title:"Token will not be remembered"})},k=async()=>{h(!0),c("");const g=await i();h(!1),g?s({title:"Lock disabled"}):c("couldn't verify. lock stays on.")};return d.jsx(gS,{open:e,onOpenChange:t,children:d.jsxs(Qh,{side:"bottom",children:[d.jsx(vS,{children:d.jsx(Zh,{children:"security"})}),n==="none"&&d.jsxs(d.Fragment,{children:[a==="idle"&&d.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[d.jsx("p",{className:"text-muted-foreground text-sm",children:"khayal is not locked on this device."}),d.jsx(wn,{onClick:p,children:"set up face id"})]}),a==="working"&&d.jsx("p",{className:"text-sm text-muted-foreground text-center pt-2",children:"waiting for biometrics..."}),a==="choice"&&d.jsx("div",{className:"pt-2",children:d.jsx(wS,{onRemember:y,onDontRemember:v})})]}),n==="prf"&&d.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm",children:"require face id to open"}),d.jsx(Fk,{checked:!0,onCheckedChange:g=>{g||k()}})]}),f&&d.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"verifying..."}),u&&d.jsx("p",{className:"text-sm text-destructive text-center",children:u})]})]})})}function mL(){var h,p;const{status:e,health:t}=JI(),{lockMode:n,lock:r}=st(),[i,o]=m.useState(!1),[s,a]=m.useState(!1),l=()=>{localStorage.removeItem(ke.TOKEN),n!=="none"?(r(),a(!1)):window.location.reload()},u=(t==null?void 0:t.version)||RI,c=(h=t==null?void 0:t.update)==null?void 0:h.available,f=e==="ok"?"#3ddc84":e==="degraded"?"#ffb340":"#ff4d4d";return d.jsxs("header",{className:"hdr",children:[d.jsxs("div",{className:"brand",children:[d.jsx("img",{src:"/icon.svg",alt:"khayal",className:"mark"}),d.jsxs("span",{className:"bname",children:["khayal",d.jsxs("span",{className:"ver",children:["v",u]})]}),c&&d.jsx("a",{href:AI,target:"_blank",rel:"noopener noreferrer",title:`update to v${(p=t==null?void 0:t.update)==null?void 0:p.latest}`,children:d.jsx(VA,{size:14,className:"update-icon"})})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[s?d.jsxs("div",{className:"flex items-center gap-1.5","data-testid":"logout-confirm",children:[d.jsx("span",{className:"text-[10px] font-mono whitespace-nowrap",style:{color:"rgba(245,169,169,0.8)"},children:"lock out?"}),d.jsx("button",{onClick:l,className:"flex items-center justify-center w-6 h-6 min-h-0 rounded-md",style:{color:"#f5a9a9",background:"rgba(255,99,99,0.08)",border:"1px solid rgba(255,99,99,0.25)"},title:"confirm logout","aria-label":"confirm logout","data-testid":"logout-go",children:d.jsx(oy,{size:12})}),d.jsx("button",{onClick:()=>a(!1),className:"flex items-center justify-center w-6 h-6 min-h-0 rounded-md text-[rgba(245,245,245,0.3)] hover:text-[rgba(245,245,245,0.6)] transition-colors",title:"cancel","aria-label":"cancel logout","data-testid":"logout-cancel",children:d.jsx(jt,{size:12})})]}):d.jsx("button",{onClick:()=>a(!0),className:"flex items-center justify-center w-6 h-6 min-h-0 rounded-md text-[rgba(245,245,245,0.4)] hover:text-[rgba(245,169,169,0.9)] transition-colors",title:"logout","aria-label":"logout","data-testid":"logout-trigger",children:d.jsx(oy,{size:14})}),d.jsx("button",{onClick:()=>o(!0),className:"flex items-center justify-center w-6 h-6 min-h-0 rounded-md text-[rgba(245,245,245,0.4)] hover:text-[rgba(245,245,245,0.8)] transition-colors",title:"security","aria-label":"security",children:d.jsx(KA,{size:14})}),d.jsx("div",{className:"online",style:{background:f,boxShadow:e==="ok"?`0 0 8px ${f}`:"none"}})]}),d.jsx(pL,{open:i,onOpenChange:o})]})}const gL=[{id:"capture",label:"capture",icon:UA},{id:"search",label:"search",icon:no},{id:"queue",label:"queue",icon:Y1}];function yL({activeTab:e,onTabChange:t}){return d.jsx("nav",{className:"nav",children:gL.map(n=>{const r=n.icon,i=e===n.id;return d.jsxs("div",{onClick:()=>t(n.id),className:G("nt",i&&"on"),children:[d.jsx(r,{}),i?d.jsx(Ae.div,{layoutId:"navIndicator",className:"w-5 h-0.5 rounded-full",style:{background:"#C9933A"},transition:{type:"spring",stiffness:380,damping:30}}):d.jsx("div",{className:"w-5 h-0.5"}),d.jsx("span",{className:"nt-l",children:n.label})]},n.id)})})}const vL=m.forwardRef(function({onSubmit:t,loading:n,initialContent:r},i){const o=m.useRef(null);m.useEffect(()=>{r&&o.current&&(o.current.value=r,o.current.selectionStart=o.current.value.length,o.current.selectionEnd=o.current.value.length)},[r]),m.useImperativeHandle(i,()=>({submit:async()=>{var l;const a=((l=o.current)==null?void 0:l.value)||"";a.trim()&&(await t(a),o.current&&(o.current.value=""))},getContent:()=>{var a;return((a=o.current)==null?void 0:a.value)||""}}));const s=a=>{var l;if(a.key==="Enter"&&(a.metaKey||a.ctrlKey)){a.preventDefault();const u=((l=o.current)==null?void 0:l.value)||"";u.trim()&&t(u).then(()=>{o.current&&(o.current.value="")})}};return d.jsx("textarea",{ref:o,placeholder:"what's on your mind...",onKeyDown:s,disabled:n,className:"w-full h-full resize-none bg-transparent text-[17px] font-light text-[#f5f5f5] placeholder-[rgba(245,245,245,0.2)] outline-none leading-relaxed",style:{fontFamily:"'Bricolage Grotesque', sans-serif"}})});function xL(e){try{return new URL(e).hostname}catch{return""}}const wL=m.forwardRef(function({onSubmit:t,loading:n},r){const[i,o]=m.useState(""),s=m.useRef(null);m.useEffect(()=>{var u;(u=s.current)==null||u.focus()},[]),m.useImperativeHandle(r,()=>({submit:async()=>{i.trim()&&(await t(i),o(""))}}));const a=u=>{u.key==="Enter"&&(u.preventDefault(),i.trim()&&t(i).then(()=>o("")))},l=xL(i);return d.jsxs("div",{className:"flex flex-col gap-3",children:[d.jsxs("div",{className:"url-row",children:[d.jsx(Q1,{}),d.jsx("input",{ref:s,type:"url",placeholder:"https://example.com/article",value:i,onChange:u=>o(u.target.value),onKeyDown:a,disabled:n,className:"url-val bg-transparent outline-none"})]}),i&&l&&d.jsxs("div",{className:"url-preview",children:[d.jsx("div",{className:"url-thumb",children:d.jsx(Qa,{className:"w-5 h-5",style:{color:"rgba(201,147,58,0.4)"}})}),d.jsxs("div",{className:"url-info",children:[d.jsx("div",{className:"url-domain",children:l}),d.jsx("div",{className:"url-title",children:"Extracting content..."})]})]}),d.jsx("div",{className:"note-input",children:d.jsx("input",{type:"text",placeholder:"add a note... (optional)",className:"w-full bg-transparent text-base text-[rgba(245,245,245,0.3)] placeholder-[rgba(245,245,245,0.2)] outline-none",style:{fontWeight:300}})})]})});function kL(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}const SL=m.forwardRef(function({onUpload:t},n){const[r,i]=m.useState(null),[o,s]=m.useState(""),[a,l]=m.useState(null),u=m.useRef(null);m.useImperativeHandle(n,()=>({submit:async()=>{r&&(await t(r,o),i(null),s(""),l(null))}}));const c=h=>{var y;const p=(y=h.target.files)==null?void 0:y[0];if(p){i(p);const v=new FileReader;v.onload=k=>{var g;return l((g=k.target)==null?void 0:g.result)},v.readAsDataURL(p)}},f=()=>{i(null),l(null),u.current&&(u.current.value="")};return d.jsxs("div",{className:"flex flex-col gap-3",children:[d.jsx("input",{ref:u,type:"file",accept:"image/*",onChange:c,className:"hidden"}),a?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"img-filled",children:[d.jsx("img",{src:a,alt:"preview",className:"w-full h-full object-cover",style:{position:"absolute",inset:0}}),d.jsxs("div",{className:"img-overlay",children:[d.jsx("span",{className:"img-name",children:r==null?void 0:r.name}),d.jsx("span",{className:"img-size",children:r?kL(r.size):""}),d.jsx("div",{className:"img-rm",onClick:f,children:d.jsx(jt,{className:"w-3 h-3"})})]})]}),d.jsx("div",{className:"note-input",children:d.jsx("input",{type:"text",placeholder:"add a note...",className:"w-full bg-transparent text-base text-[rgba(245,245,245,0.3)] placeholder-[rgba(245,245,245,0.2)] outline-none",style:{fontWeight:300},value:o,onChange:h=>s(h.target.value)})})]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"img-drop",onClick:()=>{var h;return(h=u.current)==null?void 0:h.click()},children:[d.jsx("div",{className:"img-drop-icon",children:d.jsx(X1,{className:"w-5 h-5",style:{color:"#C9933A"}})}),d.jsx("div",{className:"img-drop-lbl",children:"tap to choose"}),d.jsx("div",{className:"img-drop-sub",children:"jpg · png · webp · heic"})]}),d.jsxs("div",{className:"img-or",children:[d.jsx("div",{className:"img-or-line"}),d.jsx("span",{className:"img-or-txt",children:"OR"}),d.jsx("div",{className:"img-or-line"})]}),d.jsxs("div",{className:"cam-btn",onClick:()=>{var h;return(h=u.current)==null?void 0:h.click()},children:[d.jsx(zA,{className:"w-4 h-4",style:{color:"rgba(245,245,245,0.5)"}}),d.jsx("span",{className:"cam-txt",children:"open camera"})]})]})]})});function bL(e){return Of[e]||Of.text}function CL(e){const t=e.split("·").map(n=>n.trim());return t.length>=2?{code:t[0],message:t.slice(1).join(" · ")}:{code:"ERR",message:e}}function EL({result:e,processingTime:t,onDismiss:n}){const r=t?`${e.type} · ${t}ms`:e.type;return d.jsxs("div",{className:"tile tile-ok",children:[d.jsx("div",{className:"icon-ok",children:d.jsx(q1,{className:"w-4 h-4",style:{color:"#3ddc84"}})}),d.jsxs("div",{className:"tile-inner",children:[d.jsxs("div",{className:"tile-top",children:[d.jsx("span",{className:"tile-title",children:"saved"}),d.jsx("div",{className:"tile-dismiss",onClick:n,children:d.jsx(jt,{className:"w-2 h-2"})})]}),d.jsx("div",{className:"tile-sub",children:r}),e.note_path&&d.jsx("div",{className:"tile-sub",style:{opacity:.5},children:e.note_path}),d.jsx("div",{className:"tile-bar",children:d.jsx("div",{className:"tile-bar-fill"})})]})]})}function TL({result:e,onDismiss:t}){const n=bL(e.type),r=1;return d.jsxs("div",{className:"tile tile-q",children:[d.jsx("div",{className:"icon-q",children:d.jsx($A,{className:"w-4 h-4",style:{color:"#ffb340"}})}),d.jsxs("div",{className:"tile-inner",children:[d.jsxs("div",{className:"tile-top",children:[d.jsx("span",{className:"tile-title",children:"queued"}),d.jsx("div",{className:"tile-dismiss",onClick:t,children:d.jsx(jt,{className:"w-2 h-2"})})]}),d.jsxs("div",{className:"tile-sub",children:[e.note_path||e.type," · ",e.id.slice(0,8)]}),d.jsx("div",{className:"steps",children:n.map((i,o)=>d.jsxs("span",{children:[d.jsx("div",{className:`sd ${o0?t/n:1,a=o*(1-Math.min(s,1)),l=new Date().getDay(),u=l===0?6:l-1;return d.jsxs("div",{className:"bt bt-streak",children:[d.jsx("div",{className:"lbl",children:"streak"}),d.jsxs("div",{className:"streak-body",children:[d.jsxs("div",{className:"arc",children:[d.jsxs("svg",{viewBox:"0 0 58 58",children:[d.jsx("circle",{fill:"none",stroke:"rgba(255,255,255,0.05)",strokeWidth:"5",strokeLinecap:"round",cx:"29",cy:"29",r:"23",transform:"rotate(-90 29 29)"}),d.jsx("circle",{fill:"none",stroke:"url(#streakGrad)",strokeWidth:"5",strokeLinecap:"round",cx:"29",cy:"29",r:"23",strokeDasharray:o,strokeDashoffset:a,transform:"rotate(-90 29 29)"}),d.jsx("defs",{children:d.jsxs("linearGradient",{id:"streakGrad",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[d.jsx("stop",{offset:"0%",stopColor:"#C9933A"}),d.jsx("stop",{offset:"100%",stopColor:"#E8B86D"})]})})]}),d.jsxs("div",{className:"arc-center",children:[d.jsx("span",{className:"arc-n",children:t}),d.jsx("span",{className:"arc-u",children:"days"})]})]}),d.jsxs("div",{className:"streak-right",children:[d.jsx("div",{className:"streak-num",children:t}),d.jsx("div",{className:"streak-unit",children:"day streak"}),r>0&&d.jsxs("div",{className:"streak-goal",children:[r," days to ",n]})]})]}),d.jsx("div",{className:"week-dots",children:i.map((c,f)=>d.jsx("div",{className:`wd ${f===u?c?"today":"off":c?"on":"off"}`},f))})]})}function IL({stats:e}){const{count:t,by_hour:n,avg_per_day:r}=e.today,i=new Date().getHours(),o=Math.max(...n,1);return d.jsxs("div",{className:"bt",children:[d.jsx("div",{className:"lbl",children:"today"}),d.jsx("div",{className:"today-num",children:t}),d.jsx("div",{className:"today-sub",children:"captures"}),d.jsx("div",{className:"hours",children:n.map((s,a)=>{const l=s>0?Math.max(s/o*100,8):8,u=a===i,c=s>0&&s===o,f=s===0;let h="hb";return f?h+=" empty":u?h+=" now":c&&(h+=" hi"),d.jsx("div",{className:h,style:{height:`${l}%`}},a)})}),d.jsxs("div",{className:"today-footer",children:[d.jsxs("span",{className:"tf-stat",children:["avg ",d.jsxs("span",{children:[r.toFixed(1),"/day"]})]}),d.jsxs("span",{className:"tf-stat",children:["last ",d.jsx("span",{children:RL(e.vault.last_capture_at)})]})]})]})}function DL({stats:e}){const{total_notes:t,today_delta:n,last_7_days:r}=e.vault,i=Math.max(...r,1);return d.jsxs("div",{className:"bt wide",children:[d.jsx("div",{className:"lbl",children:"vault"}),d.jsxs("div",{className:"vault-inner",children:[d.jsxs("div",{children:[d.jsx("div",{className:"vault-num",children:t.toLocaleString()}),d.jsx("div",{className:"vault-unit",children:"notes"}),n>0&&d.jsxs("div",{className:"vault-delta",children:["+",n," today"]})]}),d.jsx("div",{className:"vault-center",children:d.jsxs("div",{className:"vc-stat",children:["last 7d",d.jsx("span",{children:r.reduce((o,s)=>o+s,0)})]})}),d.jsx("div",{className:"spark",children:r.map((o,s)=>{const a=o>0?Math.max(o/i*100,8):8,l=s===6;return d.jsx("div",{className:`sb-bar ${l?"today":"prev"}`,style:{height:`${a}%`}},s)})})]})]})}function _L({stats:e,loading:t}){return t?d.jsxs("div",{className:"bento",children:[d.jsx("div",{className:"bt animate-shimmer",style:{height:140}}),d.jsx("div",{className:"bt animate-shimmer",style:{height:140}}),d.jsx("div",{className:"bt wide animate-shimmer",style:{height:80}})]}):e?d.jsxs("div",{className:"bento",children:[d.jsx(AL,{stats:e}),d.jsx(IL,{stats:e}),d.jsx(DL,{stats:e})]}):d.jsxs("div",{className:"bento",children:[d.jsxs("div",{className:"bt",children:[d.jsx("div",{className:"lbl",children:"streak"}),d.jsx("div",{className:"streak-num",children:"0"}),d.jsx("div",{className:"streak-unit",children:"day streak"})]}),d.jsxs("div",{className:"bt",children:[d.jsx("div",{className:"lbl",children:"today"}),d.jsx("div",{className:"today-num",children:"0"}),d.jsx("div",{className:"today-sub",children:"captures"})]}),d.jsxs("div",{className:"bt wide",children:[d.jsx("div",{className:"lbl",children:"vault"}),d.jsx("div",{className:"vault-num",children:"0"}),d.jsx("div",{className:"vault-unit",children:"notes"})]})]})}function LL(){const{token:e,session:t}=st(),[n,r]=m.useState(!1),[i,o]=m.useState(null),[s,a]=m.useState(null),[l,u]=m.useState(void 0),[c,f]=m.useState(!1),[h,p]=m.useState(void 0);return{loading:n,result:i,error:s,errorCode:l,isOffline:c,processingTime:h,capture:async(g,x)=>{r(!0),a(null),u(void 0),o(null),f(!1),p(void 0);const w=performance.now();try{if(!navigator.onLine){await cy({type:g,content:x},t),f(!0),p(Math.round(performance.now()-w));return}const T=await dt(e).capture({type:g,content:x});p(Math.round(performance.now()-w)),o(T)}catch(S){p(Math.round(performance.now()-w)),S instanceof Error&&S.message.includes("fetch")?(await cy({type:g,content:x},t),f(!0)):a(S instanceof Error?S.message:"Capture failed")}finally{r(!1)}},uploadImage:async(g,x)=>{r(!0),a(null),u(void 0),o(null),f(!1),p(void 0);const w=performance.now();try{if(!navigator.onLine){a("Image upload requires connection"),p(Math.round(performance.now()-w));return}const T=await dt(e).uploadImage(g,x);p(Math.round(performance.now()-w)),o(T)}catch(S){p(Math.round(performance.now()-w)),a(S instanceof Error?S.message:"Upload failed")}finally{r(!1)}},clear:()=>{o(null),a(null),u(void 0),f(!1),p(void 0)}}}function ML(e=Oh.STATS_POLL){const{token:t}=st(),[n,r]=m.useState(null),[i,o]=m.useState(!0),s=m.useCallback(async()=>{try{const l=await dt(t).stats();r(l)}catch{}finally{o(!1)}},[t]);return m.useEffect(()=>{s();const a=setInterval(s,e);return()=>clearInterval(a)},[s,e]),{stats:n,loading:i,refresh:s}}function OL(){const e=new Date().getHours();for(const t of Fu)if(e{e&&(r("text"),o(e),t==null||t())},[e,t]),m.useEffect(()=>{if(a||c){const b=setTimeout(()=>y(),Oh.CAPTURE_DISMISS);return()=>clearTimeout(b)}},[a,c,y]);const T=async b=>{await h(n,b),o(void 0)},C=async(b,A)=>{await p(b,A)},j=()=>{var b,A,I;switch(n){case"text":(b=g.current)==null||b.submit();break;case"url":(A=x.current)==null||A.submit();break;case"image":(I=w.current)==null||I.submit();break}},P=m.useCallback(()=>{y()},[y]),R=()=>{switch(n){case"text":return"cmd+enter to capture";case"url":return"article · will extract content";case"image":return"image · will be describe"}};return d.jsxs("div",{className:"cap-body",children:[d.jsx("div",{className:"cap-greeting",children:OL()}),d.jsx(_L,{stats:v,loading:k}),d.jsxs("div",{className:"compose",children:[d.jsxs("div",{className:"pills",children:[d.jsx("span",{className:G("tp",n==="text"&&"on"),onClick:()=>r("text"),children:"txt"}),d.jsx("span",{className:G("tp",n==="url"&&"on"),onClick:()=>r("url"),children:"url"}),d.jsx("span",{className:G("tp",n==="image"&&"on"),onClick:()=>r("image"),children:"img"})]}),d.jsx("div",{className:"flex-1 min-h-0",children:d.jsx(Uo,{mode:"wait",children:d.jsxs(Ae.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"h-full",children:[n==="text"&&d.jsx(vL,{ref:g,onSubmit:T,loading:s,initialContent:i}),n==="url"&&d.jsx(wL,{ref:x,onSubmit:T,loading:s}),n==="image"&&d.jsx(SL,{ref:w,onUpload:C,loading:s})]},n)})}),d.jsxs("div",{className:"footer",children:[d.jsx("span",{className:"hint",children:R()}),d.jsx("button",{className:"send",onClick:j,disabled:s,children:d.jsx(HA,{className:"w-4 h-4",style:{color:"#000"}})})]})]}),d.jsx(Uo,{mode:"wait",children:S&&d.jsx(Ae.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},transition:{duration:.2,ease:"easeOut"},children:d.jsx(jL,{result:a,error:l,errorCode:u,isOffline:c,processingTime:f,onDismiss:y,onRetry:P})},"tile")})]})}function FL(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return e}}function VL(e){switch(e){case"text":return"rb-t";case"article":return"rb-a";case"image":return"rb-t";default:return"rb-t"}}function Ey(e,t){if(!t||!e)return e;const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`(${n})`,"gi");return e.split(r).map((o,s)=>r.test(o)?d.jsx("span",{className:"hl",children:o},s):o)}function zL({result:e,query:t,onSelect:n}){var r;return d.jsxs("div",{className:"r1",onClick:()=>n==null?void 0:n(e.note_path),children:[d.jsx("div",{className:"r1-ghost",children:"1"}),d.jsx("div",{className:"r1-title",children:Ey(e.title||e.note_path,t)}),d.jsxs("div",{className:"r1-meta",children:[d.jsx("span",{className:"rdate",children:FL(e.created_at)}),d.jsx("span",{className:`rb ${VL(e.type)}`,children:e.type}),(r=e.tags)==null?void 0:r.slice(0,Er.TAGS_HERO).map(i=>d.jsxs("span",{className:"rb rb-tag",children:["#",i]},i))]}),d.jsx("div",{className:"r1-ex",children:Ey(e.excerpt,t)})]})}function BL(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return e}}function $L(e){switch(e){case"text":return"rb-t";case"article":return"rb-a";case"image":return"rb-t";default:return"rb-t"}}function UL(e,t){if(!t||!e)return e;const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`(${n})`,"gi");return e.split(r).map((o,s)=>r.test(o)?d.jsx("span",{className:"hl",children:o},s):o)}function WL({result:e,rank:t,query:n,onSelect:r}){var i,o;return d.jsxs("div",{className:"rc",onClick:()=>r==null?void 0:r(e.note_path),children:[d.jsx("span",{className:"rc-n",children:t}),d.jsxs("div",{className:"rc-body",children:[d.jsx("div",{className:"rc-title",children:UL(e.title||e.note_path,n)}),d.jsxs("div",{className:"rc-meta",children:[d.jsx("span",{className:"rdate",children:BL(e.created_at)}),d.jsx("span",{className:`rb ${$L(e.type)}`,children:e.type}),(o=(i=e.tags)==null?void 0:i.slice(0,Er.TAGS_COMPACT))==null?void 0:o.map(s=>d.jsxs("span",{className:"rb rb-tag",children:["#",s]},s))]})]}),d.jsx("span",{className:"rc-score",children:e.score.toFixed(2)})]})}function HL(){const{token:e}=st(),[t,n]=m.useState(!1),[r,i]=m.useState(null),[o,s]=m.useState(null),a=m.useCallback(async(u,c={})=>{if(!u.trim()){i(null);return}n(!0),s(null);try{const h=await dt(e).search(u,{mode:"hybrid",limit:Er.SEARCH_RESULTS,...c});i(h)}catch(f){s(f instanceof Error?f.message:"Search failed")}finally{n(!1)}},[e]);return{loading:t,results:r,error:o,search:a,clear:()=>{i(null),s(null)}}}function KL(){const{token:e}=st(),[t,n]=m.useState("idle"),[r,i]=m.useState(null),o=m.useCallback(async(a,l)=>{if(a.trim()){n("loading"),i(null);try{const c=await dt(e).search(a,{mode:l,overview:!0});c.overview?(i(c.overview),n("ready")):n("error")}catch{n("error")}}},[e]),s=m.useCallback(()=>{n("idle"),i(null)},[]);return{state:t,overview:r,ask:o,reset:s}}function qL({text:e,onCitationClick:t}){const n=e.split(/(\[\d+\])/g);return d.jsx(d.Fragment,{children:n.map((r,i)=>{const o=r.match(/^\[(\d+)\]$/);if(o){const s=parseInt(o[1],10)-1;return d.jsxs("button",{className:"ai-cite",onClick:a=>{a.stopPropagation(),t(s)},title:`jump to source ${s+1}`,children:["[",s+1,"]"]},i)}return d.jsx("span",{children:r},i)})})}function GL({state:e,expanded:t,overview:n,onAsk:r,onToggle:i,onRetry:o,onClose:s,onCitationClick:a}){const l=e==="loading",u=e==="ready"&&n!==null,c=()=>{!t&&e==="idle"?r():i()},f=l?"Thinking":u?"AI answer":"AI Answer";return d.jsxs("div",{className:G("ai-row",t&&"open"),"data-testid":"ai-answer-row",children:[d.jsxs("button",{className:"ai-row-head",onClick:c,"data-testid":"ai-answer-trigger",children:[d.jsx(Dh,{className:G("w-3.5 h-3.5 ai-spark",l&&"spin")}),d.jsx("span",{className:"ai-row-label",children:f}),d.jsx(G1,{className:G("w-3 h-3 ai-chevron",t&&"up")})]}),d.jsx(Uo,{initial:!1,children:t&&d.jsx(Ae.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.32,ease:[.4,0,.2,1]},style:{overflow:"hidden"},children:d.jsxs("div",{className:"ai-row-body","data-testid":l?"ai-answer-skeleton":e==="error"?"ai-answer-error":"ai-answer",children:[l&&d.jsxs("div",{className:"ai-skel-lines",children:[d.jsx("div",{className:"animate-shimmer ai-skel w-11/12"}),d.jsx("div",{className:"animate-shimmer ai-skel w-full"}),d.jsx("div",{className:"animate-shimmer ai-skel w-4/5"}),d.jsx("div",{className:"animate-shimmer ai-skel w-2/3"})]}),e==="error"&&d.jsxs("div",{className:"ai-error-line",children:[d.jsx("span",{className:"ai-text dim",children:"The answer engine didn’t respond. Your results are unaffected."}),d.jsxs("div",{className:"ai-actions",children:[d.jsxs("button",{className:"ai-action",onClick:h=>{h.stopPropagation(),o()},title:"try again",children:[d.jsx(Za,{className:"w-3 h-3"}),"retry"]}),d.jsx("button",{className:"ai-action",onClick:h=>{h.stopPropagation(),s()},title:"dismiss",children:d.jsx(jt,{className:"w-3 h-3"})})]})]}),u&&n&&d.jsxs(d.Fragment,{children:[d.jsx("p",{className:"ai-text",children:d.jsx(qL,{text:n.text,onCitationClick:a})}),d.jsxs("div",{className:"ai-actions ai-foot",children:[d.jsx("button",{className:"ai-action",onClick:h=>{h.stopPropagation(),o()},title:"regenerate",children:d.jsx(Za,{className:"w-3 h-3"})}),d.jsx("button",{className:"ai-action",onClick:h=>{h.stopPropagation(),s()},title:"dismiss",children:d.jsx(jt,{className:"w-3 h-3"})})]})]})]})},"body")})]})}const Jh=ke.RECENT_SEARCHES,YL=Er.RECENT_SEARCHES,XL=II;function vo(){try{const e=localStorage.getItem(Jh);return e?JSON.parse(e):[]}catch{return[]}}function QL(e){try{const n=vo().filter(i=>i.toLowerCase()!==e.toLowerCase()),r=[e,...n].slice(0,YL);localStorage.setItem(Jh,JSON.stringify(r))}catch{}}function ZL(e){try{const n=vo().filter(r=>r.toLowerCase()!==e.toLowerCase());localStorage.setItem(Jh,JSON.stringify(n))}catch{}}function JL({onCaptureQuery:e,onNoteSelect:t,deletedPaths:n,initialQuery:r,onInitialQueryConsumed:i}={}){const[o,s]=m.useState(""),[a,l]=m.useState(""),[u,c]=m.useState("hybrid"),[f,h]=m.useState("all"),[p,y]=m.useState(vo),{loading:v,results:k,error:g,search:x}=HL(),w=KL(),[S,T]=m.useState(!1),{toast:C}=ns();m.useEffect(()=>{g&&C({title:"Search failed",description:g,variant:"destructive"})},[g,C]);const j=m.useCallback((B,N)=>{const ie=B.trim();ie&&(s(ie),l(ie),w.reset(),T(!1),c(N||u),x(ie,{mode:N||u}),QL(ie),y(vo()))},[x,u]),P=m.useRef(void 0);m.useEffect(()=>{r&&P.current!==r&&(P.current=r,j(r),i==null||i())},[r,j,i]);const R=m.useCallback(()=>{s(""),l(""),h("all"),w.reset(),T(!1),x("")},[x,w]),b=m.useCallback(B=>{c(B);const N=o.trim();N&&(l(N),s(N),x(N,{mode:B}))},[o,x]),A=m.useCallback((B,N)=>{N.stopPropagation(),ZL(B),y(vo())},[]),I=m.useCallback(B=>{t==null||t(B,a)},[t,a]),_=m.useCallback(()=>{!z||!a.trim()||(w.ask(a,u),T(!0))},[w,u,a]),L=m.useCallback(()=>{w.reset(),T(!1)},[w]),$=m.useCallback(B=>{var N;(N=document.getElementById(`result-${B}`))==null||N.scrollIntoView({behavior:"smooth",block:"center"})},[]),K=m.useMemo(()=>{if(!(k!=null&&k.results))return null;let B=k.results;return n&&n.length>0&&(B=B.filter(N=>!n.includes(N.note_path))),f==="all"?B:B.filter(N=>N.type===f)},[k,f,n]),ee=a.length>0,M=o.trim().length>0,z=K&&K.length>0,E=!v&&ee&&k&&k.results&&k.results.length===0,H=!v&&ee&&k&&k.results&&k.results.length>0&&K&&K.length===0;return d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsxs("div",{className:"srch-area",children:[d.jsxs("div",{className:G("srch-bar",M&&"active"),children:[d.jsx(no,{}),d.jsx("input",{type:"text",placeholder:"Search your vault...",value:o,onChange:B=>B.target.value?s(B.target.value):R(),onKeyDown:B=>{const N=o.trim();B.key==="Enter"&&N&&j(o.trim())},className:"srch-val bg-transparent outline-none",style:{fontFamily:"'Bricolage Grotesque', sans-serif"}}),M?d.jsx("div",{className:"srch-clear",onClick:R,children:d.jsx(jt,{className:"w-2.5 h-2.5"})}):null]}),d.jsxs("div",{className:"modes",children:[d.jsx("span",{className:G("mc",u==="hybrid"&&"on"),onClick:()=>b("hybrid"),children:"hybrid"}),d.jsx("span",{className:G("mc",u==="keyword"&&"on"),onClick:()=>b("keyword"),children:"keyword"}),d.jsx("span",{className:G("mc",u==="semantic"&&"on"),onClick:()=>b("semantic"),children:"semantic"})]})]}),d.jsxs(Uo,{mode:"wait",children:[v&&d.jsx(Ae.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"results",children:[1,2,3].map(B=>d.jsx("div",{className:"animate-shimmer rounded-lg h-24"},B))},"loading"),E&&d.jsxs(Ae.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"no-results",children:[d.jsx("div",{className:"nr-icon",children:d.jsx(FA,{className:"w-5 h-5",style:{color:"rgba(245,245,245,0.3)"}})}),d.jsx("div",{className:"nr-title",children:"nothing found"}),d.jsxs("div",{className:"nr-sub",children:["no notes match",d.jsx("br",{}),"“",a,"”"]}),d.jsxs("div",{className:"nr-suggestions",children:[d.jsx("div",{className:"recent-lbl",children:"try instead"}),u!=="keyword"&&d.jsxs("div",{className:"nr-sug",onClick:()=>j(o,"keyword"),children:[d.jsx(no,{className:"w-3.5 h-3.5",style:{color:"rgba(245,245,245,0.2)"}}),d.jsx("span",{className:"nr-sug-txt",children:a}),d.jsx("span",{className:"nr-sug-mode",children:"keyword"})]}),u!=="semantic"&&d.jsxs("div",{className:"nr-sug",onClick:()=>j(o,"semantic"),children:[d.jsx(no,{className:"w-3.5 h-3.5",style:{color:"rgba(245,245,245,0.2)"}}),d.jsx("span",{className:"nr-sug-txt",children:a}),d.jsx("span",{className:"nr-sug-mode",children:"semantic"})]}),d.jsxs("div",{className:"nr-sug capture",onClick:()=>{e==null||e(a)},children:[d.jsx("span",{style:{fontSize:14,color:"#C9933A"},children:"+"}),d.jsx("span",{className:"nr-sug-txt",children:"capture a note about this"})]})]})]},"no-results"),H&&k&&d.jsxs(Ae.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[d.jsxs("div",{className:"results-header",children:[d.jsxs("div",{className:"rh-row",children:[d.jsx("span",{className:"rh-count",children:"0 results"}),d.jsxs("span",{className:"rh-ms",children:[k.took_ms,"ms"]})]}),d.jsxs("div",{className:"filter-chips",children:[d.jsx("span",{className:G("fc",f==="all"&&"on"),onClick:()=>h("all"),children:"all"}),d.jsx("span",{className:G("fc",f==="text"&&"on"),onClick:()=>h("text"),children:"text"}),d.jsx("span",{className:G("fc",f==="article"&&"on"),onClick:()=>h("article"),children:"article"}),d.jsx("span",{className:G("fc",f==="image"&&"on"),onClick:()=>h("image"),children:"image"})]})]}),d.jsxs("div",{className:"no-results",style:{paddingTop:40},children:[d.jsxs("div",{className:"nr-title",children:["no ",f," results"]}),d.jsxs("div",{className:"nr-sub",children:["try a different filter",d.jsx("br",{}),"or reset to “all”"]})]})]},"filter-empty"),!v&&z&&k&&d.jsxs(Ae.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[d.jsxs("div",{className:"results-header",children:[d.jsxs("div",{className:"rh-row",children:[d.jsxs("span",{className:"rh-count",children:[K.length," results"]}),d.jsxs("span",{className:"rh-ms",children:[k.took_ms,"ms"]})]}),d.jsxs("div",{className:"filter-chips",children:[d.jsx("span",{className:G("fc",f==="all"&&"on"),onClick:()=>h("all"),children:"all"}),d.jsx("span",{className:G("fc",f==="text"&&"on"),onClick:()=>h("text"),children:"text"}),d.jsx("span",{className:G("fc",f==="article"&&"on"),onClick:()=>h("article"),children:"article"}),d.jsx("span",{className:G("fc",f==="image"&&"on"),onClick:()=>h("image"),children:"image"})]})]}),d.jsxs("div",{className:"results",children:[d.jsx(GL,{state:w.state,expanded:S,overview:w.overview,onAsk:_,onToggle:()=>T(B=>!B),onRetry:_,onClose:L,onCitationClick:$}),K.map((B,N)=>d.jsx("div",{id:`result-${N}`,children:N===0&&B.score>.9?d.jsx(zL,{result:B,query:a,onSelect:I}):d.jsx(WL,{result:B,rank:N+1,query:a,onSelect:I})},B.id))]})]},"results"),!v&&!ee&&!k&&d.jsxs(Ae.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"search-empty",children:[p.length>0&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"recent-lbl",children:"recent searches"}),p.map((B,N)=>d.jsxs("div",{className:"recent-item",onClick:()=>j(B),children:[d.jsx("div",{className:"ri-icon t",children:d.jsx(no,{className:"w-3 h-3",style:{color:"rgba(245,245,245,0.3)"}})}),d.jsx("span",{className:"ri-text",children:B}),d.jsx("div",{className:"srch-clear",onClick:ie=>A(B,ie),children:d.jsx(jt,{className:"w-2 h-2"})})]},N))]}),d.jsx("div",{className:"suggestions-lbl",children:"try searching for"}),d.jsx("div",{className:"sug-chips",children:XL.map(B=>d.jsx("span",{className:"sc",onClick:()=>j(B),children:B},B))})]},"idle")]})]})}function eM({pending:e,processing:t,failed:n}){return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"sec",children:"queue"}),d.jsxs("div",{className:"stats-row",children:[d.jsxs("div",{className:"stat sw",children:[d.jsx("div",{className:G("stat-n",e>0&&"warn"),children:e}),d.jsx("div",{className:"stat-l",children:"pending"})]}),d.jsxs("div",{className:"stat so",children:[d.jsx("div",{className:G("stat-n",t>0&&"ok"),children:t}),d.jsx("div",{className:"stat-l",children:"processing"})]}),d.jsxs("div",{className:"stat sb",children:[d.jsx("div",{className:G("stat-n",n>0&&"bad"),children:n}),d.jsx("div",{className:"stat-l",children:"failed"})]})]})]})}function tM(e){try{const t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/1e3);return r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:`${Math.floor(r/3600)}h ago`}catch{return""}}function nM(e){return Of[e]||["saved","processing"]}function rM({job:e}){const t=nM(e.type);return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"sec",children:"now processing"}),d.jsxs("div",{className:"hero-card",children:[d.jsxs("div",{className:"hero-top",children:[d.jsxs("div",{children:[d.jsx("div",{className:"hero-filename",children:e.note_path||e.type}),d.jsxs("div",{className:"hero-meta",children:[e.type," · ",tM(e.created_at)]})]}),d.jsxs("div",{className:"hero-badge",children:[d.jsx("div",{className:"badge-dot"}),"live"]})]}),d.jsx("div",{className:"prog-labels",children:t.map((n,r)=>d.jsx("span",{className:`prog-step ${r===0?"done":""}`,children:n},n))}),d.jsx("div",{className:"prog-bar",children:d.jsx("div",{className:"prog-fill",style:{animation:"indeterminate 2s linear infinite"}})})]})]})}function iM(e){try{const t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/1e3);return r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:`${Math.floor(r/3600)}h ago`}catch{return""}}function oM(e){if(!e)return{code:"UNKNOWN",message:"unknown error"};const t=e.split("·").map(n=>n.trim());return t.length>=2?{code:t[0],message:t.slice(1).join(" · ")}:{code:"ERR",message:e}}function sM({job:e,onRetry:t,onDiscard:n}){const{code:r,message:i}=oM(e.error),o=e.note_path||e.type;return d.jsxs("div",{className:"fail-card",children:[d.jsxs("div",{className:"fail-main",children:[d.jsx("div",{className:"fail-icon",children:d.jsx(_l,{className:"w-4 h-4",style:{color:"#ff4d4d"}})}),d.jsxs("div",{className:"fail-body",children:[d.jsx("div",{className:"fail-title",children:o}),d.jsxs("div",{className:"fail-reason",children:[r," · ",i]}),d.jsxs("div",{className:"fail-time",children:["failed ",iM(e.created_at)]})]})]}),d.jsxs("div",{className:"fail-actions",children:[d.jsxs("div",{className:"fa retry",onClick:()=>t(e.id),children:[d.jsx(Ih,{className:"fa-icon"}),"retry"]}),d.jsxs("div",{className:"fa discard",onClick:()=>n(e.id),children:[d.jsx(_h,{className:"fa-icon"}),"discard"]})]})]})}function aM(e){try{const t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/1e3);return r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:`${Math.floor(r/3600)}h ago`}catch{return""}}function lM(e){if(!e)return{code:"UNKNOWN",message:"unknown error"};const t=e.split("·").map(n=>n.trim());return t.length>=2?{code:t[0],message:t.slice(1).join(" · ")}:{code:"ERR",message:e}}function uM({job:e,onRetry:t,onDiscard:n}){const{code:r,message:i}=lM(e.error),o=e.note_path||e.type;return d.jsxs("div",{className:"fail-expanded",children:[d.jsxs("div",{className:"fe-main",children:[d.jsx("div",{className:"fail-icon",children:d.jsx(_l,{className:"w-4 h-4",style:{color:"#ff4d4d"}})}),d.jsxs("div",{className:"fe-body",children:[d.jsx("div",{className:"fe-title",children:o}),d.jsxs("div",{className:"fe-error-box",children:[d.jsx("div",{className:"fe-code",children:r}),d.jsx("div",{className:"fe-msg",children:i})]}),d.jsxs("div",{className:"fe-attempts",children:["failed ",aM(e.created_at)]})]})]}),d.jsxs("div",{className:"fail-actions",children:[d.jsxs("div",{className:"fa retry",onClick:()=>t(e.id),children:[d.jsx(Ih,{className:"fa-icon"}),"retry"]}),d.jsxs("div",{className:"fa discard",onClick:()=>n(e.id),children:[d.jsx(_h,{className:"fa-icon"}),"discard"]})]})]})}function cM({count:e,onRetryAll:t}){return d.jsxs("div",{className:"retry-all",onClick:t,children:[d.jsxs("div",{className:"ra-left",children:[d.jsx("span",{className:"ra-ct",children:e}),d.jsx("span",{className:"ra-txt",children:"jobs failed"})]}),d.jsxs("div",{className:"ra-btn",children:[d.jsx(Ih,{className:"ra-icon"}),"retry all"]})]})}function fM(e){try{const t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/1e3);return r<60?`${r}s`:r<3600?`${Math.floor(r/60)}m`:`${Math.floor(r/3600)}h`}catch{return""}}function dM(e,t=40){return e?e.length<=t?e:e.slice(0,t-3)+"...":""}function hM({job:e,flare:t,onSelect:n}){const r=dM(e.note_path||e.type),i=!!e.note_path&&!!n;return d.jsxs("div",{className:`done-item ${i?"clickable":""}`,onClick:i?()=>n(e.note_path):void 0,role:i?"button":void 0,"data-testid":"done-item",children:[d.jsx("div",{className:"done-check",children:d.jsx(q1,{className:"w-3 h-3",style:{color:"#3ddc84"}})}),d.jsxs("div",{className:"done-body",children:[d.jsx("div",{className:"done-title",children:r}),d.jsx("div",{className:"done-meta",children:e.type})]}),t&&t.connections>0&&d.jsxs("span",{className:"flare-chip",title:`${t.connections} connected notes`,children:[d.jsx(Qa,{className:"w-3 h-3"}),t.connections]}),e.result!=null&&d.jsx("span",{className:"flare-enriched",title:"enriched with memory context",children:d.jsx(Dh,{className:"w-3 h-3"})}),d.jsx("span",{className:"done-ago",children:fM(e.processed_at||e.created_at)})]})}function pM(e){const t=Date.now(),n=Math.floor((t-e)/1e3);return n<60?`${n}s`:n<3600?`${Math.floor(n/60)}m`:`${Math.floor(n/3600)}h`}function mM(e,t=40){if(e.length<=t)return e;if(e.startsWith("http"))try{const r=new URL(e);return r.hostname+r.pathname.slice(0,t-r.hostname.length-3)+"..."}catch{return e.slice(0,t-3)+"..."}const n=`"${e}"`;return n.length<=t?n:n.slice(0,t-3)+'..."'}function gM({items:e,onSync:t}){return e.length===0?null:d.jsxs("div",{className:"off-card",children:[d.jsxs("div",{className:"off-hdr",children:[d.jsxs("div",{className:"off-title-row",children:[d.jsx(Lh,{className:"w-4 h-4 text-[#C9933A]"}),d.jsx("span",{className:"off-title",children:"offline"})]}),d.jsxs("span",{className:"off-ct",children:[e.length," waiting"]})]}),d.jsx("div",{className:"off-list",children:e.slice(0,3).map(n=>d.jsxs("div",{className:"oi",children:[d.jsx("div",{className:"oi-bar"}),d.jsx("span",{className:"oi-txt",children:mM(n.content)}),d.jsx("span",{className:"oi-t",children:pM(n.timestamp)})]},n.id))}),d.jsxs("div",{className:"sync-btn",onClick:t,children:[d.jsxs("span",{className:"sync-txt",children:["sync ",e.length," captures"]}),d.jsx(qA,{className:"w-4 h-4 text-[#C9933A]"})]})]})}const Ty=50;function yM(){const{token:e}=st(),[t,n]=m.useState(!1),[r,i]=m.useState([]),[o,s]=m.useState(0),[a,l]=m.useState(null),[u,c]=m.useState({}),[f,h]=m.useState(!1),[p,y]=m.useState(!1),v=m.useCallback(T=>{i(T.jobs||[]),s(T.total),T.flares&&c(C=>({...C,...T.flares}))},[]),k=m.useCallback(async(T,C)=>{n(!0),l(null);try{const P=await dt(e).queue({status:T,limit:Er.QUEUE_JOBS});C!=null&&C.keepExpansion||h(!1),v(P)}catch(j){l(j instanceof Error?j.message:"Failed to fetch queue")}finally{n(!1)}},[e,v]),g=m.useCallback(T=>{i(C=>{const j=C.findIndex(R=>R.id===T.id);if(j===-1)return[T,...C];const P=[...C];return P[j]={...P[j],...T},P})},[]),x=m.useCallback(async()=>{if(!p){y(!0),l(null);try{const T=dt(e);let C=r.filter(j=>j.status==="done").length;for(;;){const j=await T.queue({status:"done",limit:Ty,offset:C}),P=j.jobs||[];if(P.length===0||(i(R=>{const b=new Set(R.map(A=>A.id));return[...R,...P.filter(A=>!b.has(A.id))]}),j.flares&&c(R=>({...R,...j.flares})),P.length{try{await dt(e).retryJob(T),await k()}catch(C){l(C instanceof Error?C.message:"Failed to retry job")}},[k,e]),S=m.useCallback(async T=>{try{await dt(e).discardJob(T),await k()}catch(C){l(C instanceof Error?C.message:"Failed to discard job")}},[k,e]);return m.useEffect(()=>{k()},[k]),{loading:t,jobs:r,total:o,error:a,flares:u,doneExpanded:f,doneLoadingMore:p,loadMoreDone:x,applyLiveJob:g,setDoneExpanded:h,fetchQueue:k,retryJob:w,discardJob:S}}function vM(e,t=!0){const n=m.useRef(e);n.current=e,m.useEffect(()=>{if(!t)return;let r=null,i=!1,o=null,s=0;const a=()=>{const l=window.location.protocol==="https:"?"wss":"ws";try{r=new WebSocket(`${l}://${window.location.host}/v1/queue/ws`)}catch{return}r.onmessage=u=>{try{const c=JSON.parse(u.data);c.event==="job_updated"&&c.job&&n.current(c.job)}catch{}},r.onopen=()=>{const u=localStorage.getItem("khayal_token")||"";r==null||r.send(JSON.stringify({type:"auth",token:u})),s=0},r.onclose=()=>{if(i)return;s++;const u=Math.min(1e3*Math.pow(2,s),15e3);o=setTimeout(a,u)},r.onerror=()=>{r==null||r.close()}};return a(),()=>{i=!0,o&&clearTimeout(o),r==null||r.close()}},[t])}function xM(e){try{const t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/1e3);return r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:`${Math.floor(r/3600)}h ago`}catch{return""}}function wM(e){switch(e){case"text":return d.jsx(iy,{className:"w-4 h-4"});case"url":return d.jsx(Q1,{className:"w-4 h-4"});case"image":return d.jsx(X1,{className:"w-4 h-4"});default:return d.jsx(iy,{className:"w-4 h-4"})}}function kM(e){switch(e){case"text":return"t";case"url":return"u";case"image":return"i";default:return"t"}}function SM(e,t=50){return e?e.length<=t?e:e.slice(0,t-3)+"...":""}const bM=new Set(["connections","memory"]);function CM({onNoteSelect:e}={}){const{loading:t,jobs:n,flares:r,doneExpanded:i,doneLoadingMore:o,loadMoreDone:s,applyLiveJob:a,setDoneExpanded:l,fetchQueue:u,retryJob:c,discardJob:f}=yM(),{toast:h}=ns(),{session:p}=st(),[y,v]=m.useState([]),[k,g]=m.useState(!1),x=m.useCallback(()=>{u(),pk(p).then(_=>{v(_.map(L=>({id:L.id,content:L.request.content,timestamp:L.timestamp})))})},[u,p]);m.useEffect(()=>{x()},[x]);const w=m.useRef(!1);w.current=k,vM(_=>{a(_),w.current&&(_.status==="done"||_.status==="failed")&&["text","image","article"].includes(_.type)&&u(void 0,{keepExpansion:!0})},k),m.useEffect(()=>{!t&&!k&&g(!0)},[t,k]);const S=async _=>{await c(_),h({title:"Job retried"})},T=async _=>{await f(_),h({title:"Job discarded"})},C=async()=>{for(const _ of b)await c(_.id);h({title:`Retried ${b.length} jobs`})},j=n.filter(_=>!bM.has(_.type)),P=j.find(_=>_.status==="processing"),R=j.filter(_=>_.status==="pending"||_.status==="queued"),b=j.filter(_=>_.status==="failed"),A=j.filter(_=>_.status==="done"),I=i?A:A.slice(0,Er.DONE_JOBS_SHOWN);return d.jsxs("div",{className:"q-body",children:[!k&&d.jsx("div",{className:"q-list","data-testid":"queue-skeleton",children:[1,2,3,4].map(_=>d.jsxs("div",{className:"q-skel-row",children:[d.jsx("div",{className:"animate-shimmer q-skel q-skel-icon"}),d.jsxs("div",{className:"q-skel-lines",children:[d.jsx("div",{className:"animate-shimmer q-skel q-skel-w60"}),d.jsx("div",{className:"animate-shimmer q-skel q-skel-w35"})]})]},_))}),k&&d.jsxs(d.Fragment,{children:[P&&d.jsx(rM,{job:P}),d.jsx(eM,{pending:R.length,processing:P?1:0,failed:b.length}),R.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"sec",children:["pending (",R.length,")"]}),d.jsx("div",{className:"q-list",children:R.map((_,L)=>d.jsxs(Ae.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{delay:L*.02},className:"qi",children:[d.jsx("div",{className:`qi-icon ${kM(_.type)}`,children:wM(_.type)}),d.jsxs("div",{className:"qi-body",children:[d.jsx("div",{className:"qi-title",children:SM(_.note_path||_.type)}),d.jsxs("div",{className:"qi-meta",children:[_.type," · ",_.status]})]}),d.jsx("div",{className:`qi-dot ${_.status==="queued"?"q":"p"}`}),d.jsx("span",{className:"qi-ago",children:xM(_.created_at)})]},_.id))})]}),b.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"sec",children:["failed (",b.length,")"]}),b.length>1&&d.jsx(cM,{count:b.length,onRetryAll:C}),d.jsx("div",{className:"q-list",children:b.map((_,L)=>d.jsx(Ae.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{delay:L*.02},children:L===0?d.jsx(uM,{job:_,onRetry:S,onDiscard:T}):d.jsx(sM,{job:_,onRetry:S,onDiscard:T})},_.id))})]}),A.length>0&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"divider"}),d.jsxs("div",{className:"sec",children:["done (",A.length,")"]}),d.jsx("div",{className:"q-list",children:I.map((_,L)=>d.jsx(Ae.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{delay:i?0:L*.02},children:d.jsx(hM,{job:_,flare:r[_.id],onSelect:e})},_.id))}),(A.length>Er.DONE_JOBS_SHOWN||i)&&d.jsx("button",{className:"done-expand clickable",onClick:()=>i?l(!1):s(),disabled:o,"data-testid":"queue-show-more",children:o?d.jsxs(d.Fragment,{children:[d.jsx(Za,{className:"w-3 h-3 animate-spin"}),"loading history..."]}):i?d.jsxs(d.Fragment,{children:[d.jsx(BA,{className:"w-3 h-3"}),"show less"]}):d.jsxs(d.Fragment,{children:[d.jsx(G1,{className:"w-3 h-3"}),"show all ",A.length]})})]}),d.jsx(gM,{items:y,onSync:x}),d.jsx("div",{className:"flex justify-center py-2",children:d.jsxs("button",{onClick:x,disabled:t,className:"flex items-center gap-2 text-xs text-[rgba(245,245,245,0.3)] hover:text-[rgba(245,245,245,0.5)] transition-colors",children:[d.jsx(Za,{className:G("w-3 h-3",t&&"animate-spin")}),"refresh"]})})]})]})}function EM(e,t){const{token:n}=st(),[r,i]=m.useState(null),[o,s]=m.useState(!1),[a,l]=m.useState(null);return m.useEffect(()=>{if(!e){i(null),l(null);return}(async()=>{s(!0),l(null);try{const f=await dt(n).getNote(e,t);i(f)}catch(c){l(c instanceof Error?c.message:"Failed to load note")}finally{s(!1)}})()},[e,t,n]),{note:r,loading:o,error:a}}function or({className:e,...t}){return d.jsx("div",{className:G("animate-pulse rounded-md bg-primary/10",e),...t})}function TM({text:e,query:t,className:n=""}){if(!t||!e)return d.jsx("span",{className:n,children:e});const r=t.split(/\s+/).filter(a=>a.length>1).map(a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));if(r.length===0)return d.jsx("span",{className:n,children:e});const i=r.join("|"),o=new RegExp(`(${i})`,"gi"),s=e.split(o);return d.jsx("span",{className:n,children:s.map((a,l)=>r.some(c=>a.toLowerCase()===c.replace(/\\/g,"").toLowerCase())?d.jsx("mark",{className:"hl",children:a},l):d.jsx("span",{children:a},l))})}function NM({note:e}){const t=e.excerpt_section||"Raw",n=e.search_query;return d.jsx("div",{className:"note-content",children:d.jsxs("section",{className:"note-section",children:[d.jsx("h3",{className:"note-section-heading",children:t}),d.jsx("div",{className:"text-sm leading-relaxed text-muted-foreground whitespace-pre-wrap",children:d.jsx(TM,{text:e.raw,query:n})})]})})}function PM(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const jM=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,RM=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,AM={};function Ny(e,t){return(AM.jsx?RM:jM).test(e)}const IM=/[ \t\n\f\r]/g;function DM(e){return typeof e=="object"?e.type==="text"?Py(e.value):!1:Py(e)}function Py(e){return e.replace(IM,"")===""}class ls{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}ls.prototype.normal={};ls.prototype.property={};ls.prototype.space=void 0;function kS(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new ls(n,r,t)}function Uf(e){return e.toLowerCase()}class at{constructor(t,n){this.attribute=n,this.property=t}}at.prototype.attribute="";at.prototype.booleanish=!1;at.prototype.boolean=!1;at.prototype.commaOrSpaceSeparated=!1;at.prototype.commaSeparated=!1;at.prototype.defined=!1;at.prototype.mustUseProperty=!1;at.prototype.number=!1;at.prototype.overloadedBoolean=!1;at.prototype.property="";at.prototype.spaceSeparated=!1;at.prototype.space=void 0;let _M=0;const Q=Ir(),Te=Ir(),Wf=Ir(),F=Ir(),ce=Ir(),di=Ir(),ut=Ir();function Ir(){return 2**++_M}const Hf=Object.freeze(Object.defineProperty({__proto__:null,boolean:Q,booleanish:Te,commaOrSpaceSeparated:ut,commaSeparated:di,number:F,overloadedBoolean:Wf,spaceSeparated:ce},Symbol.toStringTag,{value:"Module"})),Qu=Object.keys(Hf);class ep extends at{constructor(t,n,r,i){let o=-1;if(super(t,n),jy(this,"space",i),typeof r=="number")for(;++o4&&n.slice(0,4)==="data"&&VM.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Ry,$M);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Ry.test(o)){let s=o.replace(FM,BM);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}i=ep}return new i(r,t)}function BM(e){return"-"+e.toLowerCase()}function $M(e){return e.charAt(1).toUpperCase()}const UM=kS([SS,LM,ES,TS,NS],"html"),tp=kS([SS,MM,ES,TS,NS],"svg");function WM(e){return e.join(" ").trim()}var np={},Ay=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,HM=/\n/g,KM=/^\s*/,qM=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,GM=/^:\s*/,YM=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,XM=/^[;\s]*/,QM=/^\s+|\s+$/g,ZM=` +`,Iy="/",Dy="*",cr="",JM="comment",eO="declaration";function tO(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(y){var v=y.match(HM);v&&(n+=v.length);var k=y.lastIndexOf(ZM);r=~k?y.length-k:r+y.length}function o(){var y={line:n,column:r};return function(v){return v.position=new s(y),u(),v}}function s(y){this.start=y,this.end={line:n,column:r},this.source=t.source}s.prototype.content=e;function a(y){var v=new Error(t.source+":"+n+":"+r+": "+y);if(v.reason=y,v.filename=t.source,v.line=n,v.column=r,v.source=e,!t.silent)throw v}function l(y){var v=y.exec(e);if(v){var k=v[0];return i(k),e=e.slice(k.length),v}}function u(){l(KM)}function c(y){var v;for(y=y||[];v=f();)v!==!1&&y.push(v);return y}function f(){var y=o();if(!(Iy!=e.charAt(0)||Dy!=e.charAt(1))){for(var v=2;cr!=e.charAt(v)&&(Dy!=e.charAt(v)||Iy!=e.charAt(v+1));)++v;if(v+=2,cr===e.charAt(v-1))return a("End of comment missing");var k=e.slice(2,v-2);return r+=2,i(k),e=e.slice(v),r+=2,y({type:JM,comment:k})}}function h(){var y=o(),v=l(qM);if(v){if(f(),!l(GM))return a("property missing ':'");var k=l(YM),g=y({type:eO,property:_y(v[0].replace(Ay,cr)),value:k?_y(k[0].replace(Ay,cr)):cr});return l(XM),g}}function p(){var y=[];c(y);for(var v;v=h();)v!==!1&&(y.push(v),c(y));return y}return u(),p()}function _y(e){return e?e.replace(QM,cr):cr}var nO=tO,rO=ya&&ya.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(np,"__esModule",{value:!0});np.default=oO;const iO=rO(nO);function oO(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,iO.default)(e),i=typeof t=="function";return r.forEach(o=>{if(o.type!=="declaration")return;const{property:s,value:a}=o;i?t(s,a,o):a&&(n=n||{},n[s]=a)}),n}var Vl={};Object.defineProperty(Vl,"__esModule",{value:!0});Vl.camelCase=void 0;var sO=/^--[a-zA-Z0-9_-]+$/,aO=/-([a-z])/g,lO=/^[^-]+$/,uO=/^-(webkit|moz|ms|o|khtml)-/,cO=/^-(ms)-/,fO=function(e){return!e||lO.test(e)||sO.test(e)},dO=function(e,t){return t.toUpperCase()},Ly=function(e,t){return"".concat(t,"-")},hO=function(e,t){return t===void 0&&(t={}),fO(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(cO,Ly):e=e.replace(uO,Ly),e.replace(aO,dO))};Vl.camelCase=hO;var pO=ya&&ya.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},mO=pO(np),gO=Vl;function Kf(e,t){var n={};return!e||typeof e!="string"||(0,mO.default)(e,function(r,i){r&&i&&(n[(0,gO.camelCase)(r,t)]=i)}),n}Kf.default=Kf;var yO=Kf;const vO=fl(yO),PS=jS("end"),rp=jS("start");function jS(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function xO(e){const t=rp(e),n=PS(e);if(t&&n)return{start:t,end:n}}function xo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?My(e.position):"start"in e||"end"in e?My(e):"line"in e||"column"in e?qf(e):""}function qf(e){return Oy(e&&e.line)+":"+Oy(e&&e.column)}function My(e){return qf(e&&e.start)+"-"+qf(e&&e.end)}function Oy(e){return e&&typeof e=="number"?e:1}class Ke extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},s=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(s=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const a=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=xo(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=s&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ke.prototype.file="";Ke.prototype.name="";Ke.prototype.reason="";Ke.prototype.message="";Ke.prototype.stack="";Ke.prototype.column=void 0;Ke.prototype.line=void 0;Ke.prototype.ancestors=void 0;Ke.prototype.cause=void 0;Ke.prototype.fatal=void 0;Ke.prototype.place=void 0;Ke.prototype.ruleId=void 0;Ke.prototype.source=void 0;const ip={}.hasOwnProperty,wO=new Map,kO=/[A-Z]/g,SO=new Set(["table","tbody","thead","tfoot","tr"]),bO=new Set(["td","th"]),RS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function CO(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=IO(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=AO(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?tp:UM,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=AS(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function AS(e,t,n){if(t.type==="element")return EO(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return TO(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return PO(e,t,n);if(t.type==="mdxjsEsm")return NO(e,t);if(t.type==="root")return jO(e,t,n);if(t.type==="text")return RO(e,t)}function EO(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=tp,e.schema=i),e.ancestors.push(t);const o=DS(e,t.tagName,!1),s=DO(e,t);let a=sp(e,t);return SO.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!DM(l):!0})),IS(e,s,o,t),op(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}function TO(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Ho(e,t.position)}function NO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ho(e,t.position)}function PO(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=tp,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:DS(e,t.name,!0),s=_O(e,t),a=sp(e,t);return IS(e,s,o,t),op(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}function jO(e,t,n){const r={};return op(r,sp(e,t)),e.create(t,e.Fragment,r,n)}function RO(e,t){return t.value}function IS(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function op(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function AO(e,t,n){return r;function r(i,o,s,a){const u=Array.isArray(s.children)?n:t;return a?u(o,s,a):u(o,s)}}function IO(e,t){return n;function n(r,i,o,s){const a=Array.isArray(o.children),l=rp(r);return t(i,o,s,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function DO(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&ip.call(t.properties,i)){const o=LO(e,i,t.properties[i]);if(o){const[s,a]=o;e.tableCellAlignToStyle&&s==="align"&&typeof a=="string"&&bO.has(t.tagName)?r=a:n[s]=a}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function _O(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const s=o.expression;s.type;const a=s.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Ho(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,o=e.evaluater.evaluateExpression(a.expression)}else Ho(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function sp(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:wO;for(;++ri?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);o0?(mt(e,e.length,0,t),e):t}const zy={}.hasOwnProperty;function LS(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Bt(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ge=nr(/[A-Za-z]/),We=nr(/[\dA-Za-z]/),WO=nr(/[#-'*+\--9=?A-Z^-~]/);function rl(e){return e!==null&&(e<32||e===127)}const Gf=nr(/\d/),HO=nr(/[\dA-Fa-f]/),KO=nr(/[!-/:-@[-`{-~]/);function q(e){return e!==null&&e<-2}function ue(e){return e!==null&&(e<0||e===32)}function Z(e){return e===-2||e===-1||e===32}const zl=nr(new RegExp("\\p{P}|\\p{S}","u")),Nr=nr(/\s/);function nr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Li(e){const t=[];let n=-1,r=0,i=0;for(;++n55295&&o<57344){const a=e.charCodeAt(n+1);o<56320&&a>56319&&a<57344?(s=String.fromCharCode(o,a),i=1):s="�"}else s=String.fromCharCode(o);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function ne(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return s;function s(l){return Z(l)?(e.enter(n),a(l)):t(l)}function a(l){return Z(l)&&o++s))return;const j=t.events.length;let P=j,R,b;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){if(R){b=t.events[P][1].end;break}R=!0}for(g(r),C=j;Cw;){const T=n[S];t.containerState=T[1],T[0].exit.call(t,e)}n.length=w}function x(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function QO(e,t,n){return ne(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function bi(e){if(e===null||ue(e)||Nr(e))return 1;if(zl(e))return 2}function Bl(e,t,n){const r=[];let i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},h={...e[n][1].start};$y(f,-l),$y(h,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},o={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},e[r][1].end={...s.start},e[n][1].start={...a.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=kt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=kt(u,[["enter",i,t],["enter",s,t],["exit",s,t],["enter",o,t]]),u=kt(u,Bl(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=kt(u,[["exit",o,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=kt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,mt(e,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n0&&Z(C)?ne(e,x,"linePrefix",o+1)(C):x(C)}function x(C){return C===null||q(C)?e.check(Uy,v,S)(C):(e.enter("codeFlowValue"),w(C))}function w(C){return C===null||q(C)?(e.exit("codeFlowValue"),x(C)):(e.consume(C),w)}function S(C){return e.exit("codeFenced"),t(C)}function T(C,j,P){let R=0;return b;function b($){return C.enter("lineEnding"),C.consume($),C.exit("lineEnding"),A}function A($){return C.enter("codeFencedFence"),Z($)?ne(C,I,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):I($)}function I($){return $===a?(C.enter("codeFencedFenceSequence"),_($)):P($)}function _($){return $===a?(R++,C.consume($),_):R>=s?(C.exit("codeFencedFenceSequence"),Z($)?ne(C,L,"whitespace")($):L($)):P($)}function L($){return $===null||q($)?(C.exit("codeFencedFence"),j($)):P($)}}}function uF(e,t,n){const r=this;return i;function i(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o)}function o(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const Ju={name:"codeIndented",tokenize:fF},cF={partial:!0,tokenize:dF};function fF(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),ne(e,o,"linePrefix",5)(u)}function o(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):q(u)?e.attempt(cF,s,l)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||q(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),a)}function l(u){return e.exit("codeIndented"),t(u)}}function dF(e,t,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):q(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):ne(e,o,"linePrefix",5)(s)}function o(s){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):q(s)?i(s):n(s)}}const hF={name:"codeText",previous:mF,resolve:pF,tokenize:gF};function pF(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Yi(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Yi(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Yi(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function BS(e,t,n,r,i,o,s,a,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return f;function f(g){return g===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(g),e.exit(o),h):g===null||g===32||g===41||rl(g)?n(g):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),v(g))}function h(g){return g===62?(e.enter(o),e.consume(g),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(e.exit("chunkString"),e.exit(a),h(g)):g===null||g===60||q(g)?n(g):(e.consume(g),g===92?y:p)}function y(g){return g===60||g===62||g===92?(e.consume(g),p):p(g)}function v(g){return!c&&(g===null||g===41||ue(g))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(g)):c999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(o),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):q(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||q(p)||a++>999?(e.exit("chunkString"),c(p)):(e.consume(p),l||(l=!Z(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),a++,f):f(p)}}function US(e,t,n,r,i,o){let s;return a;function a(h){return h===34||h===39||h===40?(e.enter(r),e.enter(i),e.consume(h),e.exit(i),s=h===40?41:h,l):n(h)}function l(h){return h===s?(e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):(e.enter(o),u(h))}function u(h){return h===s?(e.exit(o),l(s)):h===null?n(h):q(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),ne(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===s||h===null||q(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:c)}function f(h){return h===s||h===92?(e.consume(h),c):c(h)}}function wo(e,t){let n;return r;function r(i){return q(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Z(i)?ne(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const CF={name:"definition",tokenize:TF},EF={partial:!0,tokenize:NF};function TF(e,t,n){const r=this;let i;return o;function o(p){return e.enter("definition"),s(p)}function s(p){return $S.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return i=Bt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return ue(p)?wo(e,u)(p):u(p)}function u(p){return BS(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(EF,f,f)(p)}function f(p){return Z(p)?ne(e,h,"whitespace")(p):h(p)}function h(p){return p===null||q(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function NF(e,t,n){return r;function r(a){return ue(a)?wo(e,i)(a):n(a)}function i(a){return US(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return Z(a)?ne(e,s,"whitespace")(a):s(a)}function s(a){return a===null||q(a)?t(a):n(a)}}const PF={name:"hardBreakEscape",tokenize:jF};function jF(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return q(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const RF={name:"headingAtx",resolve:AF,tokenize:IF};function AF(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},mt(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function IF(e,t,n){let r=0;return i;function i(c){return e.enter("atxHeading"),o(c)}function o(c){return e.enter("atxHeadingSequence"),s(c)}function s(c){return c===35&&r++<6?(e.consume(c),s):c===null||ue(c)?(e.exit("atxHeadingSequence"),a(c)):n(c)}function a(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||q(c)?(e.exit("atxHeading"),t(c)):Z(c)?ne(e,a,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),a(c))}function u(c){return c===null||c===35||ue(c)?(e.exit("atxHeadingText"),a(c)):(e.consume(c),u)}}const DF=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Hy=["pre","script","style","textarea"],_F={concrete:!0,name:"htmlFlow",resolveTo:OF,tokenize:FF},LF={partial:!0,tokenize:zF},MF={partial:!0,tokenize:VF};function OF(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function FF(e,t,n){const r=this;let i,o,s,a,l;return u;function u(N){return c(N)}function c(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),f}function f(N){return N===33?(e.consume(N),h):N===47?(e.consume(N),o=!0,v):N===63?(e.consume(N),i=3,r.interrupt?t:E):Ge(N)?(e.consume(N),s=String.fromCharCode(N),k):n(N)}function h(N){return N===45?(e.consume(N),i=2,p):N===91?(e.consume(N),i=5,a=0,y):Ge(N)?(e.consume(N),i=4,r.interrupt?t:E):n(N)}function p(N){return N===45?(e.consume(N),r.interrupt?t:E):n(N)}function y(N){const ie="CDATA[";return N===ie.charCodeAt(a++)?(e.consume(N),a===ie.length?r.interrupt?t:I:y):n(N)}function v(N){return Ge(N)?(e.consume(N),s=String.fromCharCode(N),k):n(N)}function k(N){if(N===null||N===47||N===62||ue(N)){const ie=N===47,Rt=s.toLowerCase();return!ie&&!o&&Hy.includes(Rt)?(i=1,r.interrupt?t(N):I(N)):DF.includes(s.toLowerCase())?(i=6,ie?(e.consume(N),g):r.interrupt?t(N):I(N)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(N):o?x(N):w(N))}return N===45||We(N)?(e.consume(N),s+=String.fromCharCode(N),k):n(N)}function g(N){return N===62?(e.consume(N),r.interrupt?t:I):n(N)}function x(N){return Z(N)?(e.consume(N),x):b(N)}function w(N){return N===47?(e.consume(N),b):N===58||N===95||Ge(N)?(e.consume(N),S):Z(N)?(e.consume(N),w):b(N)}function S(N){return N===45||N===46||N===58||N===95||We(N)?(e.consume(N),S):T(N)}function T(N){return N===61?(e.consume(N),C):Z(N)?(e.consume(N),T):w(N)}function C(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),l=N,j):Z(N)?(e.consume(N),C):P(N)}function j(N){return N===l?(e.consume(N),l=null,R):N===null||q(N)?n(N):(e.consume(N),j)}function P(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||ue(N)?T(N):(e.consume(N),P)}function R(N){return N===47||N===62||Z(N)?w(N):n(N)}function b(N){return N===62?(e.consume(N),A):n(N)}function A(N){return N===null||q(N)?I(N):Z(N)?(e.consume(N),A):n(N)}function I(N){return N===45&&i===2?(e.consume(N),K):N===60&&i===1?(e.consume(N),ee):N===62&&i===4?(e.consume(N),H):N===63&&i===3?(e.consume(N),E):N===93&&i===5?(e.consume(N),z):q(N)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(LF,B,_)(N)):N===null||q(N)?(e.exit("htmlFlowData"),_(N)):(e.consume(N),I)}function _(N){return e.check(MF,L,B)(N)}function L(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),$}function $(N){return N===null||q(N)?_(N):(e.enter("htmlFlowData"),I(N))}function K(N){return N===45?(e.consume(N),E):I(N)}function ee(N){return N===47?(e.consume(N),s="",M):I(N)}function M(N){if(N===62){const ie=s.toLowerCase();return Hy.includes(ie)?(e.consume(N),H):I(N)}return Ge(N)&&s.length<8?(e.consume(N),s+=String.fromCharCode(N),M):I(N)}function z(N){return N===93?(e.consume(N),E):I(N)}function E(N){return N===62?(e.consume(N),H):N===45&&i===2?(e.consume(N),E):I(N)}function H(N){return N===null||q(N)?(e.exit("htmlFlowData"),B(N)):(e.consume(N),H)}function B(N){return e.exit("htmlFlow"),t(N)}}function VF(e,t,n){const r=this;return i;function i(s){return q(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):n(s)}function o(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function zF(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(us,t,n)}}const BF={name:"htmlText",tokenize:$F};function $F(e,t,n){const r=this;let i,o,s;return a;function a(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),l}function l(E){return E===33?(e.consume(E),u):E===47?(e.consume(E),T):E===63?(e.consume(E),w):Ge(E)?(e.consume(E),P):n(E)}function u(E){return E===45?(e.consume(E),c):E===91?(e.consume(E),o=0,y):Ge(E)?(e.consume(E),x):n(E)}function c(E){return E===45?(e.consume(E),p):n(E)}function f(E){return E===null?n(E):E===45?(e.consume(E),h):q(E)?(s=f,ee(E)):(e.consume(E),f)}function h(E){return E===45?(e.consume(E),p):f(E)}function p(E){return E===62?K(E):E===45?h(E):f(E)}function y(E){const H="CDATA[";return E===H.charCodeAt(o++)?(e.consume(E),o===H.length?v:y):n(E)}function v(E){return E===null?n(E):E===93?(e.consume(E),k):q(E)?(s=v,ee(E)):(e.consume(E),v)}function k(E){return E===93?(e.consume(E),g):v(E)}function g(E){return E===62?K(E):E===93?(e.consume(E),g):v(E)}function x(E){return E===null||E===62?K(E):q(E)?(s=x,ee(E)):(e.consume(E),x)}function w(E){return E===null?n(E):E===63?(e.consume(E),S):q(E)?(s=w,ee(E)):(e.consume(E),w)}function S(E){return E===62?K(E):w(E)}function T(E){return Ge(E)?(e.consume(E),C):n(E)}function C(E){return E===45||We(E)?(e.consume(E),C):j(E)}function j(E){return q(E)?(s=j,ee(E)):Z(E)?(e.consume(E),j):K(E)}function P(E){return E===45||We(E)?(e.consume(E),P):E===47||E===62||ue(E)?R(E):n(E)}function R(E){return E===47?(e.consume(E),K):E===58||E===95||Ge(E)?(e.consume(E),b):q(E)?(s=R,ee(E)):Z(E)?(e.consume(E),R):K(E)}function b(E){return E===45||E===46||E===58||E===95||We(E)?(e.consume(E),b):A(E)}function A(E){return E===61?(e.consume(E),I):q(E)?(s=A,ee(E)):Z(E)?(e.consume(E),A):R(E)}function I(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),i=E,_):q(E)?(s=I,ee(E)):Z(E)?(e.consume(E),I):(e.consume(E),L)}function _(E){return E===i?(e.consume(E),i=void 0,$):E===null?n(E):q(E)?(s=_,ee(E)):(e.consume(E),_)}function L(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||ue(E)?R(E):(e.consume(E),L)}function $(E){return E===47||E===62||ue(E)?R(E):n(E)}function K(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function ee(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),M}function M(E){return Z(E)?ne(e,z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):z(E)}function z(E){return e.enter("htmlTextData"),s(E)}}const up={name:"labelEnd",resolveAll:KF,resolveTo:qF,tokenize:GF},UF={tokenize:YF},WF={tokenize:XF},HF={tokenize:QF};function KF(e){let t=-1;const n=[];for(;++t=3&&(u===null||q(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===i?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Z(u)?ne(e,a,"whitespace")(u):a(u))}}const et={continuation:{tokenize:a4},exit:u4,name:"list",tokenize:s4},i4={partial:!0,tokenize:c4},o4={partial:!0,tokenize:l4};function s4(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return a;function a(p){const y=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Gf(p)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ma,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return Gf(p)&&++s<10?(e.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(us,r.interrupt?n:c,e.attempt(i4,h,f))}function c(p){return r.containerState.initialBlankLine=!0,o++,h(p)}function f(p){return Z(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function a4(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(us,i,o);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ne(e,t,"listItemIndent",r.containerState.size+1)(a)}function o(a){return r.containerState.furtherBlankLines||!Z(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(o4,t,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,ne(e,e.attempt(et,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function l4(e,t,n){const r=this;return ne(e,i,"listItemIndent",r.containerState.size+1);function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(o):n(o)}}function u4(e){e.exit(this.containerState.type)}function c4(e,t,n){const r=this;return ne(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const s=r.events[r.events.length-1];return!Z(o)&&s&&s[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const Ky={name:"setextUnderline",resolveTo:f4,tokenize:d4};function f4(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const s={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",s,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=s,e.push(["exit",s,t]),e}function d4(e,t,n){const r=this;let i;return o;function o(u){let c=r.events.length,f;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){f=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),i=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===i?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),Z(u)?ne(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||q(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const h4={tokenize:p4};function p4(e){const t=this,n=e.attempt(us,r,e.attempt(this.parser.constructs.flowInitial,i,ne(e,e.attempt(this.parser.constructs.flow,i,e.attempt(xF,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const m4={resolveAll:HS()},g4=WS("string"),y4=WS("text");function WS(e){return{resolveAll:HS(e==="text"?v4:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,s,a);return s;function s(c){return u(c)?o(c):a(c)}function a(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),o(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const f=i[c];let h=-1;if(f)for(;++h-1){const a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}o>0&&s.push(e[i].slice(0,o))}return s}function A4(e,t){let n=-1;const r=[];let i;for(;++n0){const At=Y.tokenStack[Y.tokenStack.length-1];(At[1]||Gy).call(Y,void 0,At[0])}for(V.position={start:Pn(D.length>0?D[0][1].start:{line:1,column:1,offset:0}),end:Pn(D.length>0?D[D.length-2][1].end:{line:1,column:1,offset:0})},ae=-1;++ae0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function H4(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function K4(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function q4(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Li(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let s,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),s=e.footnoteOrder.length):s=o+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};e.patch(t,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function G4(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Y4(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function GS(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const s=i[i.length-1];return s&&s.type==="text"?s.value+=r:i.push({type:"text",value:r}),i}function X4(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return GS(e,t);const i={src:Li(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function Q4(e,t){const n={src:Li(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Z4(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function J4(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return GS(e,t);const i={href:Li(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function e3(e,t){const n={href:Li(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function t3(e,t,n){const r=e.all(t),i=n?n3(n):YS(t),o={},s=[];if(typeof t.checked=="boolean"){const c=r[0];let f;c&&c.type==="element"&&c.tagName==="p"?f=c:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let a=-1;for(;++a1}function r3(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i0){const s={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=rp(t.children[1]),l=PS(t.children[t.children.length-1]);a&&l&&(s.position={start:a,end:l}),i.push(s)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function l3(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,a=s?s.length:t.children.length;let l=-1;const u=[];for(;++l0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(Qy(t.slice(i),i>0,!1)),o.join("")}function Qy(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===Yy||o===Xy;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===Yy||o===Xy;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function f3(e,t){const n={type:"text",value:c3(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function d3(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const h3={blockquote:$4,break:U4,code:W4,delete:H4,emphasis:K4,footnoteReference:q4,heading:G4,html:Y4,imageReference:X4,image:Q4,inlineCode:Z4,linkReference:J4,link:e3,listItem:t3,list:r3,paragraph:i3,root:o3,strong:s3,table:a3,tableCell:u3,tableRow:l3,text:f3,thematicBreak:d3,toml:Bs,yaml:Bs,definition:Bs,footnoteDefinition:Bs};function Bs(){}const XS=-1,$l=0,ko=1,il=2,cp=3,fp=4,dp=5,hp=6,QS=7,ZS=8,Zy=typeof self=="object"?self:globalThis,p3=(e,t)=>{const n=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,s]=t[i];switch(o){case $l:case XS:return n(s,i);case ko:{const a=n([],i);for(const l of s)a.push(r(l));return a}case il:{const a=n({},i);for(const[l,u]of s)a[r(l)]=r(u);return a}case cp:return n(new Date(s),i);case fp:{const{source:a,flags:l}=s;return n(new RegExp(a,l),i)}case dp:{const a=n(new Map,i);for(const[l,u]of s)a.set(r(l),r(u));return a}case hp:{const a=n(new Set,i);for(const l of s)a.add(r(l));return a}case QS:{const{name:a,message:l}=s;return n(new Zy[a](l),i)}case ZS:return n(BigInt(s),i);case"BigInt":return n(Object(BigInt(s)),i);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:a}=new Uint8Array(s);return n(new DataView(a),s)}}return n(new Zy[o](s),i)};return r},Jy=e=>p3(new Map,e)(0),zr="",{toString:m3}={},{keys:g3}=Object,Xi=e=>{const t=typeof e;if(t!=="object"||!e)return[$l,t];const n=m3.call(e).slice(8,-1);switch(n){case"Array":return[ko,zr];case"Object":return[il,zr];case"Date":return[cp,zr];case"RegExp":return[fp,zr];case"Map":return[dp,zr];case"Set":return[hp,zr];case"DataView":return[ko,n]}return n.includes("Array")?[ko,n]:n.includes("Error")?[QS,n]:[il,n]},$s=([e,t])=>e===$l&&(t==="function"||t==="symbol"),y3=(e,t,n,r)=>{const i=(s,a)=>{const l=r.push(s)-1;return n.set(a,l),l},o=s=>{if(n.has(s))return n.get(s);let[a,l]=Xi(s);switch(a){case $l:{let c=s;switch(l){case"bigint":a=ZS,c=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([XS],s)}return i([a,c],s)}case ko:{if(l){let h=s;return l==="DataView"?h=new Uint8Array(s.buffer):l==="ArrayBuffer"&&(h=new Uint8Array(s)),i([l,[...h]],s)}const c=[],f=i([a,c],s);for(const h of s)c.push(o(h));return f}case il:{if(l)switch(l){case"BigInt":return i([l,s.toString()],s);case"Boolean":case"Number":case"String":return i([l,s.valueOf()],s)}if(t&&"toJSON"in s)return o(s.toJSON());const c=[],f=i([a,c],s);for(const h of g3(s))(e||!$s(Xi(s[h])))&&c.push([o(h),o(s[h])]);return f}case cp:return i([a,s.toISOString()],s);case fp:{const{source:c,flags:f}=s;return i([a,{source:c,flags:f}],s)}case dp:{const c=[],f=i([a,c],s);for(const[h,p]of s)(e||!($s(Xi(h))||$s(Xi(p))))&&c.push([o(h),o(p)]);return f}case hp:{const c=[],f=i([a,c],s);for(const h of s)(e||!$s(Xi(h)))&&c.push(o(h));return f}}const{message:u}=s;return i([a,{name:l,message:u}],s)};return o},ev=(e,{json:t,lossy:n}={})=>{const r=[];return y3(!(t||n),!!t,new Map,r)(e),r},ol=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Jy(ev(e,t)):structuredClone(e):(e,t)=>Jy(ev(e,t));function v3(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function x3(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function w3(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||v3,r=e.options.footnoteBackLabel||x3,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l0&&y.push({type:"text",value:" "});let x=typeof n=="string"?n:n(l,p);typeof x=="string"&&(x={type:"text",value:x}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,p),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const k=c[c.length-1];if(k&&k.type==="element"&&k.tagName==="p"){const x=k.children[k.children.length-1];x&&x.type==="text"?x.value+=" ":k.children.push({type:"text",value:" "}),k.children.push(...y)}else c.push(...y);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(c,!0)};e.patch(u,g),a.push(g)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...ol(s),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:` +`}]}}const Ul=function(e){if(e==null)return C3;if(typeof e=="function")return Wl(e);if(typeof e=="object")return Array.isArray(e)?k3(e):S3(e);if(typeof e=="string")return b3(e);throw new Error("Expected function, string, or object as test")};function k3(e){const t=[];let n=-1;for(;++n":""))+")"})}return h;function h(){let p=JS,y,v,k;if((!t||o(l,u,c[c.length-1]||void 0))&&(p=P3(n(l,c)),p[0]===Xf))return p;if("children"in l&&l.children){const g=l;if(g.children&&p[0]!==N3)for(v=(r?g.children.length:-1)+s,k=c.concat(g);v>-1&&v0&&n.push({type:"text",value:` +`}),n}function tv(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function nv(e,t){const n=R3(e,t),r=n.one(e,void 0),i=w3(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:` +`},i),o}function L3(e,t){return e&&"run"in e?async function(n,r){const i=nv(n,{file:r,...t});await e.run(i,r)}:function(n,r){return nv(n,{file:r,...e||t})}}function rv(e){if(e)throw e}var ga=Object.prototype.hasOwnProperty,tb=Object.prototype.toString,iv=Object.defineProperty,ov=Object.getOwnPropertyDescriptor,sv=function(t){return typeof Array.isArray=="function"?Array.isArray(t):tb.call(t)==="[object Array]"},av=function(t){if(!t||tb.call(t)!=="[object Object]")return!1;var n=ga.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&ga.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||ga.call(t,i)},lv=function(t,n){iv&&n.name==="__proto__"?iv(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},uv=function(t,n){if(n==="__proto__")if(ga.call(t,n)){if(ov)return ov(t,n).value}else return;return t[n]},M3=function e(){var t,n,r,i,o,s,a=arguments[0],l=1,u=arguments.length,c=!1;for(typeof a=="boolean"&&(c=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});ls.length;let l;a&&s.push(i);try{l=e.apply(this,s)}catch(u){const c=u;if(a&&n)throw c;return i(c)}a||(l&&l.then&&typeof l.then=="function"?l.then(o,i):l instanceof Error?i(l):o(l))}function i(s,...a){n||(n=!0,t(s,...a))}function o(s){i(null,s)}}const Xt={basename:V3,dirname:z3,extname:B3,join:$3,sep:"/"};function V3(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');cs(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,a=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else s<0&&(o=!0,s=i+1),a>-1&&(e.codePointAt(i)===t.codePointAt(a--)?a<0&&(r=i):(a=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function z3(e){if(cs(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function B3(e){cs(e);let t=e.length,n=-1,r=0,i=-1,o=0,s;for(;t--;){const a=e.codePointAt(t);if(a===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),a===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function $3(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function W3(e,t){let n="",r=0,i=-1,o=0,s=-1,a,l;for(;++s<=e.length;){if(s2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=s,o=0;continue}}else if(n.length>0){n="",r=0,i=s,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,o=0}else a===46&&o>-1?o++:o=-1}return n}function cs(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const H3={cwd:K3};function K3(){return"/"}function Jf(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function q3(e){if(typeof e=="string")e=new URL(e);else if(!Jf(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return G3(e)}function G3(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n0){let[p,...y]=c;const v=r[h][1];Zf(v)&&Zf(p)&&(p=tc(!0,v,p)),r[h]=[u,p,...y]}}}}const Z3=new mp().freeze();function oc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function sc(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ac(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function fv(e){if(!Zf(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function dv(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Us(e){return J3(e)?e:new nb(e)}function J3(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function eV(e){return typeof e=="string"||tV(e)}function tV(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const nV="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",hv=[],pv={allowDangerousHtml:!0},rV=/^(https?|ircs?|mailto|xmpp)$/i,iV=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function oV(e){const t=sV(e),n=aV(e);return lV(t.runSync(t.parse(n),n),e)}function sV(e){const t=e.rehypePlugins||hv,n=e.remarkPlugins||hv,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...pv}:pv;return Z3().use(B4).use(n).use(L3,r).use(t)}function aV(e){const t=e.children||"",n=new nb;return typeof t=="string"&&(n.value=t),n}function lV(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,s=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||uV;for(const c of iV)Object.hasOwn(t,c.from)&&(""+c.from+(c.to?"use `"+c.to+"` instead":"remove it")+nV+c.id,void 0);return pp(e,u),CO(e,{Fragment:d.Fragment,components:i,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function u(c,f,h){if(c.type==="raw"&&h&&typeof f=="number")return s?h.children.splice(f,1):h.children[f]={type:"text",value:c.value},f;if(c.type==="element"){let p;for(p in Zu)if(Object.hasOwn(Zu,p)&&Object.hasOwn(c.properties,p)){const y=c.properties[p],v=Zu[p];(v===null||v.includes(c.tagName))&&(c.properties[p]=l(String(y||""),p,c))}}if(c.type==="element"){let p=n?!n.includes(c.tagName):o?o.includes(c.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(c,f,h)),p&&h&&typeof f=="number")return a&&c.children?h.children.splice(f,1,...c.children):h.children.splice(f,1),f}}}function uV(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||rV.test(e.slice(0,t))?e:""}function mv(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function cV(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function fV(e,t,n){const i=Ul((n||{}).ignore||[]),o=dV(t);let s=-1;for(;++s0?{type:"text",value:C}:void 0),C===!1?h.lastIndex=S+1:(y!==S&&x.push({type:"text",value:u.value.slice(y,S)}),Array.isArray(C)?x.push(...C):C&&x.push(C),y=S+w[0].length,g=!0),!h.global)break;w=h.exec(u.value)}return g?(y?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=mv(e,"(");let o=mv(e,")");for(;r!==-1&&i>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function rb(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Nr(n)||zl(n))&&(!t||n!==47)}ib.peek=LV;function NV(){this.buffer()}function PV(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function jV(){this.buffer()}function RV(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function AV(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Bt(this.sliceSerialize(e)).toLowerCase(),n.label=t}function IV(e){this.exit(e)}function DV(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Bt(this.sliceSerialize(e)).toLowerCase(),n.label=t}function _V(e){this.exit(e)}function LV(){return"["}function ib(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const s=n.enter("footnoteReference"),a=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{after:"]",before:o})),a(),s(),o+=i.move("]"),o}function MV(){return{enter:{gfmFootnoteCallString:NV,gfmFootnoteCall:PV,gfmFootnoteDefinitionLabelString:jV,gfmFootnoteDefinition:RV},exit:{gfmFootnoteCallString:AV,gfmFootnoteCall:IV,gfmFootnoteDefinitionLabelString:DV,gfmFootnoteDefinition:_V}}}function OV(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:ib},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,o,s){const a=o.createTracker(s);let l=a.move("[^");const u=o.enter("footnoteDefinition"),c=o.enter("label");return l+=a.move(o.safe(o.associationId(r),{before:l,after:"]"})),c(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((t?` +`:" ")+o.indentLines(o.containerFlow(r,a.current()),t?ob:FV))),u(),l}}function FV(e,t,n){return t===0?e:ob(e,t,n)}function ob(e,t,n){return(n?"":" ")+e}const VV=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];sb.peek=WV;function zV(){return{canContainEols:["delete"],enter:{strikethrough:$V},exit:{strikethrough:UV}}}function BV(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:VV}],handlers:{delete:sb}}}function $V(e){this.enter({type:"delete",children:[]},e)}function UV(e){this.exit(e)}function sb(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let s=i.move("~~");return s+=n.containerPhrasing(e,{...i.current(),before:s,after:"~"}),s+=i.move("~~"),o(),s}function WV(){return"~"}function HV(e){return e.length}function KV(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||HV,o=[],s=[],a=[],l=[];let u=0,c=-1;for(;++cu&&(u=e[c].length);++gl[g])&&(l[g]=w)}v.push(x)}s[c]=v,a[c]=k}let f=-1;if(typeof r=="object"&&"length"in r)for(;++fl[f]&&(l[f]=x),p[f]=x),h[f]=w}s.splice(1,0,h),a.splice(1,0,p),c=-1;const y=[];for(;++c "),o.shift(2);const s=n.indentLines(n.containerFlow(e,o.current()),YV);return i(),s}function YV(e,t,n){return">"+(n?"":" ")+e}function XV(e,t){return yv(e,t.inConstruct,!0)&&!yv(e,t.notInConstruct,!1)}function yv(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++rs&&(s=o):o=1,i=r+t.length,r=n.indexOf(t,i);return s}function ZV(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function JV(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function ez(e,t,n,r){const i=JV(n),o=e.value||"",s=i==="`"?"GraveAccent":"Tilde";if(ZV(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(o,tz);return f(),h}const a=n.createTracker(r),l=i.repeat(Math.max(QV(o,i)+1,3)),u=n.enter("codeFenced");let c=a.move(l);if(e.lang){const f=n.enter(`codeFencedLang${s}`);c+=a.move(n.safe(e.lang,{before:c,after:" ",encode:["`"],...a.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${s}`);c+=a.move(" "),c+=a.move(n.safe(e.meta,{before:c,after:` +`,encode:["`"],...a.current()})),f()}return c+=a.move(` +`),o&&(c+=a.move(o+` +`)),c+=a.move(l),u(),c}function tz(e,t,n){return(n?"":" ")+e}function gp(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function nz(e,t,n,r){const i=gp(n),o=i==='"'?"Quote":"Apostrophe",s=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("[");return u+=l.move(n.safe(n.associationId(e),{before:u,after:"]",...l.current()})),u+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":` +`,...l.current()}))),a(),e.title&&(a=n.enter(`title${o}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),s(),u}function rz(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Ko(e){return"&#x"+e.toString(16).toUpperCase()+";"}function sl(e,t,n){const r=bi(e),i=bi(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}ab.peek=iz;function ab(e,t,n,r){const i=rz(n),o=n.enter("emphasis"),s=n.createTracker(r),a=s.move(i);let l=s.move(n.containerPhrasing(e,{after:i,before:a,...s.current()}));const u=l.charCodeAt(0),c=sl(r.before.charCodeAt(r.before.length-1),u,i);c.inside&&(l=Ko(u)+l.slice(1));const f=l.charCodeAt(l.length-1),h=sl(r.after.charCodeAt(0),f,i);h.inside&&(l=l.slice(0,-1)+Ko(f));const p=s.move(i);return o(),n.attentionEncodeSurroundingInfo={after:h.outside,before:c.outside},a+l+p}function iz(e,t,n){return n.options.emphasis||"*"}function oz(e,t){let n=!1;return pp(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Xf}),!!((!e.depth||e.depth<3)&&ap(e)&&(t.options.setext||n))}function sz(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(oz(e,n)){const c=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...o.current(),before:` +`,after:` +`});return f(),c(),h+` +`+(i===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(` +`))+1))}const s="#".repeat(i),a=n.enter("headingAtx"),l=n.enter("phrasing");o.move(s+" ");let u=n.containerPhrasing(e,{before:"# ",after:` +`,...o.current()});return/^[\t ]/.test(u)&&(u=Ko(u.charCodeAt(0))+u.slice(1)),u=u?s+" "+u:s,n.options.closeAtx&&(u+=" "+s),l(),a(),u}lb.peek=az;function lb(e){return e.value||""}function az(){return"<"}ub.peek=lz;function ub(e,t,n,r){const i=gp(n),o=i==='"'?"Quote":"Apostrophe",s=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("![");return u+=l.move(n.safe(e.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${o}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),u+=l.move(")"),s(),u}function lz(){return"!"}cb.peek=uz;function cb(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let s=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const u=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),s();const c=n.stack;n.stack=[],s=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return s(),n.stack=c,o(),i==="full"||!u||u!==f?l+=a.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function uz(){return"!"}fb.peek=cz;function fb(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o\u007F]/.test(e.url))}hb.peek=fz;function hb(e,t,n,r){const i=gp(n),o=i==='"'?"Quote":"Apostrophe",s=n.createTracker(r);let a,l;if(db(e,n)){const c=n.stack;n.stack=[],a=n.enter("autolink");let f=s.move("<");return f+=s.move(n.containerPhrasing(e,{before:f,after:">",...s.current()})),f+=s.move(">"),a(),n.stack=c,f}a=n.enter("link"),l=n.enter("label");let u=s.move("[");return u+=s.move(n.containerPhrasing(e,{before:u,after:"](",...s.current()})),u+=s.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=s.move("<"),u+=s.move(n.safe(e.url,{before:u,after:">",...s.current()})),u+=s.move(">")):(l=n.enter("destinationRaw"),u+=s.move(n.safe(e.url,{before:u,after:e.title?" ":")",...s.current()}))),l(),e.title&&(l=n.enter(`title${o}`),u+=s.move(" "+i),u+=s.move(n.safe(e.title,{before:u,after:i,...s.current()})),u+=s.move(i),l()),u+=s.move(")"),a(),u}function fz(e,t,n){return db(e,n)?"<":"["}pb.peek=dz;function pb(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let s=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const u=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),s();const c=n.stack;n.stack=[],s=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return s(),n.stack=c,o(),i==="full"||!u||u!==f?l+=a.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function dz(){return"["}function yp(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function hz(e){const t=yp(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function pz(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function mb(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function mz(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let s=e.ordered?pz(n):yp(n);const a=e.ordered?s==="."?")":".":hz(n);let l=t&&n.bulletLastUsed?s===n.bulletLastUsed:!1;if(!e.ordered){const c=e.children?e.children[0]:void 0;if((s==="*"||s==="-")&&c&&(!c.children||!c.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),mb(n)===s&&c){let f=-1;for(;++f-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let s=o.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(s=Math.ceil(s/4)*4);const a=n.createTracker(r);a.move(o+" ".repeat(s-o.length)),a.shift(s);const l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,a.current()),c);return l(),u;function c(f,h,p){return h?(p?"":" ".repeat(s))+f:(p?o:o+" ".repeat(s-o.length))+f}}function vz(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),s=n.containerPhrasing(e,r);return o(),i(),s}const xz=Ul(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function wz(e,t,n,r){return(e.children.some(function(s){return xz(s)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function kz(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}gb.peek=Sz;function gb(e,t,n,r){const i=kz(n),o=n.enter("strong"),s=n.createTracker(r),a=s.move(i+i);let l=s.move(n.containerPhrasing(e,{after:i,before:a,...s.current()}));const u=l.charCodeAt(0),c=sl(r.before.charCodeAt(r.before.length-1),u,i);c.inside&&(l=Ko(u)+l.slice(1));const f=l.charCodeAt(l.length-1),h=sl(r.after.charCodeAt(0),f,i);h.inside&&(l=l.slice(0,-1)+Ko(f));const p=s.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:h.outside,before:c.outside},a+l+p}function Sz(e,t,n){return n.options.strong||"*"}function bz(e,t,n,r){return n.safe(e.value,r)}function Cz(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Ez(e,t,n){const r=(mb(n)+(n.options.ruleSpaces?" ":"")).repeat(Cz(n));return n.options.ruleSpaces?r.slice(0,-1):r}const yb={blockquote:GV,break:vv,code:ez,definition:nz,emphasis:ab,hardBreak:vv,heading:sz,html:lb,image:ub,imageReference:cb,inlineCode:fb,link:hb,linkReference:pb,list:mz,listItem:yz,paragraph:vz,root:wz,strong:gb,text:bz,thematicBreak:Ez};function Tz(){return{enter:{table:Nz,tableData:xv,tableHeader:xv,tableRow:jz},exit:{codeText:Rz,table:Pz,tableData:fc,tableHeader:fc,tableRow:fc}}}function Nz(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function Pz(e){this.exit(e),this.data.inTable=void 0}function jz(e){this.enter({type:"tableRow",children:[]},e)}function fc(e){this.exit(e)}function xv(e){this.enter({type:"tableCell",children:[]},e)}function Rz(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Az));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Az(e,t){return t==="|"?t:e}function Iz(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:s,tableCell:l,tableRow:a}};function s(p,y,v,k){return u(c(p,v,k),p.align)}function a(p,y,v,k){const g=f(p,v,k),x=u([g]);return x.slice(0,x.indexOf(` +`))}function l(p,y,v,k){const g=v.enter("tableCell"),x=v.enter("phrasing"),w=v.containerPhrasing(p,{...k,before:o,after:o});return x(),g(),w}function u(p,y){return KV(p,{align:y,alignDelimiters:r,padding:n,stringLength:i})}function c(p,y,v){const k=p.children;let g=-1;const x=[],w=y.enter("table");for(;++g0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Xz={tokenize:i5,partial:!0};function Qz(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:t5,continuation:{tokenize:n5},exit:r5}},text:{91:{name:"gfmFootnoteCall",tokenize:e5},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Zz,resolveTo:Jz}}}}function Zz(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){s=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!s||!s._balanced)return n(l);const u=Bt(r.sliceSerialize({start:s.end,end:r.now()}));return u.codePointAt(0)!==94||!o.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function Jz(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function e5(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,s;return a;function a(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),l}function l(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(o>999||f===93&&!s||f===null||f===91||ue(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return i.includes(Bt(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return ue(f)||(s=!0),o++,e.consume(f),f===92?c:u}function c(f){return f===91||f===92||f===93?(e.consume(f),o++,u):u(f)}}function t5(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,s=0,a;return l;function l(y){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(y){return y===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(y)}function c(y){if(s>999||y===93&&!a||y===null||y===91||ue(y))return n(y);if(y===93){e.exit("chunkString");const v=e.exit("gfmFootnoteDefinitionLabelString");return o=Bt(r.sliceSerialize(v)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return ue(y)||(a=!0),s++,e.consume(y),y===92?f:c}function f(y){return y===91||y===92||y===93?(e.consume(y),s++,c):c(y)}function h(y){return y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),i.includes(o)||i.push(o),ne(e,p,"gfmFootnoteDefinitionWhitespace")):n(y)}function p(y){return t(y)}}function n5(e,t,n){return e.check(us,t,e.attempt(Xz,t,n))}function r5(e){e.exit("gfmFootnoteDefinition")}function i5(e,t,n){const r=this;return ne(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?t(o):n(o)}}function o5(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(s,a){let l=-1;for(;++l1?l(y):(s.consume(y),f++,p);if(f<2&&!n)return l(y);const k=s.exit("strikethroughSequenceTemporary"),g=bi(y);return k._open=!g||g===2&&!!v,k._close=!v||v===2&&!!g,a(y)}}}class s5{constructor(){this.map=[]}add(t,n,r){a5(this,t,n,r)}consume(t){if(this.map.sort(function(o,s){return o[0]-s[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const o of i)t.push(o);i=r.pop()}this.map.length=0}}function a5(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i-1;){const L=r.events[A][1].type;if(L==="lineEnding"||L==="linePrefix")A--;else break}const I=A>-1?r.events[A][1].type:null,_=I==="tableHead"||I==="tableRow"?C:l;return _===C&&r.parser.lazy[r.now().line]?n(b):_(b)}function l(b){return e.enter("tableHead"),e.enter("tableRow"),u(b)}function u(b){return b===124||(s=!0,o+=1),c(b)}function c(b){return b===null?n(b):q(b)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),p):n(b):Z(b)?ne(e,c,"whitespace")(b):(o+=1,s&&(s=!1,i+=1),b===124?(e.enter("tableCellDivider"),e.consume(b),e.exit("tableCellDivider"),s=!0,c):(e.enter("data"),f(b)))}function f(b){return b===null||b===124||ue(b)?(e.exit("data"),c(b)):(e.consume(b),b===92?h:f)}function h(b){return b===92||b===124?(e.consume(b),f):f(b)}function p(b){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(b):(e.enter("tableDelimiterRow"),s=!1,Z(b)?ne(e,y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):y(b))}function y(b){return b===45||b===58?k(b):b===124?(s=!0,e.enter("tableCellDivider"),e.consume(b),e.exit("tableCellDivider"),v):T(b)}function v(b){return Z(b)?ne(e,k,"whitespace")(b):k(b)}function k(b){return b===58?(o+=1,s=!0,e.enter("tableDelimiterMarker"),e.consume(b),e.exit("tableDelimiterMarker"),g):b===45?(o+=1,g(b)):b===null||q(b)?S(b):T(b)}function g(b){return b===45?(e.enter("tableDelimiterFiller"),x(b)):T(b)}function x(b){return b===45?(e.consume(b),x):b===58?(s=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(b),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(b))}function w(b){return Z(b)?ne(e,S,"whitespace")(b):S(b)}function S(b){return b===124?y(b):b===null||q(b)?!s||i!==o?T(b):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(b)):T(b)}function T(b){return n(b)}function C(b){return e.enter("tableRow"),j(b)}function j(b){return b===124?(e.enter("tableCellDivider"),e.consume(b),e.exit("tableCellDivider"),j):b===null||q(b)?(e.exit("tableRow"),t(b)):Z(b)?ne(e,j,"whitespace")(b):(e.enter("data"),P(b))}function P(b){return b===null||b===124||ue(b)?(e.exit("data"),j(b)):(e.consume(b),b===92?R:P)}function R(b){return b===92||b===124?(e.consume(b),P):P(b)}}function f5(e,t){let n=-1,r=!0,i=0,o=[0,0,0,0],s=[0,0,0,0],a=!1,l=0,u,c,f;const h=new s5;for(;++nn[2]+1){const y=n[2]+1,v=n[3]-n[2]-1;e.add(y,v,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return i!==void 0&&(o.end=Object.assign({},$r(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function kv(e,t,n,r,i){const o=[],s=$r(t.events,n);i&&(i.end=Object.assign({},s),o.push(["exit",i,t])),r.end=Object.assign({},s),o.push(["exit",r,t]),e.add(n+1,0,o)}function $r(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const d5={name:"tasklistCheck",tokenize:p5};function h5(){return{text:{91:d5}}}function p5(e,t,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),o)}function o(l){return ue(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),s):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),s):n(l)}function s(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(l)}function a(l){return q(l)?t(l):Z(l)?e.check({tokenize:m5},t,n)(l):n(l)}}function m5(e,t,n){return ne(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function g5(e){return LS([Bz(),Qz(),o5(e),u5(),h5()])}const y5={};function v5(e){const t=this,n=e||y5,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(g5(n)),o.push(Oz()),s.push(Fz(n))}function x5({note:e}){return d.jsxs("div",{className:"note-content",children:[e.summary&&d.jsxs("section",{id:"excerpt-Summary",className:"note-section",children:[d.jsx("h3",{className:"note-section-heading",children:"Summary"}),d.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:e.summary})]}),e.key_ideas&&e.key_ideas.length>0&&d.jsxs("section",{id:"excerpt-Key Ideas",className:"note-section",children:[d.jsx("h3",{className:"note-section-heading",children:"Key Ideas"}),d.jsx("ul",{className:"note-list",children:e.key_ideas.map((t,n)=>d.jsx("li",{children:t},n))})]}),d.jsxs("section",{id:"excerpt-Raw",className:"note-section",children:[d.jsx("h3",{className:"note-section-heading",children:"Raw"}),d.jsx("div",{className:"note-raw-prose text-sm text-muted-foreground",children:d.jsx(oV,{remarkPlugins:[v5],children:e.raw})})]}),e.description&&d.jsxs("section",{id:"excerpt-Description",className:"note-section",children:[d.jsx("h3",{className:"note-section-heading",children:"Description"}),d.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:e.description})]}),e.source_url&&d.jsxs("section",{className:"note-section",children:[d.jsx("h3",{className:"note-section-heading",children:"Source"}),d.jsx("a",{href:e.source_url,target:"_blank",rel:"noopener noreferrer",style:{color:"#c9933a",fontSize:"0.875rem",textDecoration:"underline"},children:(()=>{try{return new URL(e.source_url).hostname}catch{return e.source_url}})()})]})]})}const w5={contradiction:d.jsx(Lh,{className:"w-3 h-3 shrink-0",style:{color:"#ff8a5c"}}),revisit:d.jsx(WA,{className:"w-3 h-3 shrink-0",style:{color:"#8ab4ff"}}),follow_up:d.jsx(Y1,{className:"w-3 h-3 shrink-0",style:{color:"#ffd166"}}),person:d.jsx(Z1,{className:"w-3 h-3 shrink-0",style:{color:"#c9933a"}}),similar:d.jsx(Dh,{className:"w-3 h-3 shrink-0",style:{color:"#3ddc84"}})},Sv={contradiction:"contradicts",revisit:"revisited",follow_up:"follow-up",person:"person",similar:"similar"};function k5(e){switch(e){case"text":return"rb-t";case"article":return"rb-a";case"image":return"rb-t";default:return"rb-t"}}function dc(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return e}}function S5({notePath:e,query:t,onClose:n,onDeleted:r,onOpenNote:i,onSearch:o}){var j;const{note:s,loading:a,error:l}=EM(e,t),[u,c]=m.useState("excerpt"),[f,h]=m.useState(!1),[p,y]=m.useState(!1),[v,k]=m.useState(null),[g,x]=m.useState(!1),{token:w}=st(),{toast:S}=ns();m.useEffect(()=>{c("excerpt"),h(!1),y(!1),x(!1)},[e]),m.useEffect(()=>{if(k(null),!e||!(s!=null&&s.source_file)||s.type!=="image")return;let P=null,R=!0;return dt(w).mediaBlob(s.source_file).then(b=>{R&&(P=URL.createObjectURL(b),k(P))}).catch(()=>{}),()=>{R=!1,P&&URL.revokeObjectURL(P)}},[e,s==null?void 0:s.source_file,s==null?void 0:s.type,w,s]);const T=async()=>{var R;if(!s)return;const P=[`# ${s.title||"Note"}`,s.summary?` +${s.summary}`:"",(R=s.key_ideas)!=null&&R.length?` +${s.key_ideas.map(b=>`- ${b}`).join(` +`)}`:"",` +${s.raw}`,s.source_url?` +Source: ${s.source_url}`:""].filter(Boolean).join(` +`);try{await navigator.clipboard.writeText(P),x(!0),setTimeout(()=>x(!1),1600)}catch{S({title:"Copy failed",variant:"destructive"})}},C=async()=>{if(!(!e||p)){y(!0);try{await dt(w).deleteNote(e),S({title:"Note deleted",description:"Moved to trash — recoverable from .khayal-trash/"}),r==null||r(e),n()}catch(P){S({title:"Delete failed",description:P instanceof Error?P.message:"Unknown error",variant:"destructive"}),y(!1),h(!1)}}};return d.jsx(gS,{open:!!e,modal:!0,onOpenChange:P=>{P||n()},children:d.jsxs(Qh,{side:"right","aria-describedby":void 0,className:"w-[90vw] sm:max-w-[500px] md:max-w-[580px] p-0 flex flex-col [&>button:first-of-type]:hidden focus:outline-none",style:{background:"#0d0d0d",borderLeft:"1px solid rgba(255,255,255,0.08)",paddingBottom:"max(env(safe-area-inset-bottom), 0px)"},children:[d.jsx(Zh,{className:"sr-only",children:(s==null?void 0:s.title)||"Note"}),d.jsx(xS,{className:"sr-only",children:"Note details, connections, and actions"}),d.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-white/5 shrink-0",style:{paddingTop:"calc(1rem + env(safe-area-inset-top))"},children:[d.jsx("h2",{className:"flex-1 text-base font-semibold truncate",style:{fontFamily:"'Bricolage Grotesque', sans-serif"},children:a?d.jsx(or,{className:"h-5 w-48",style:{background:"#1a1a1a"}}):(s==null?void 0:s.title)||"Note"}),!a&&s&&d.jsxs(d.Fragment,{children:[d.jsx("button",{className:"p-2 rounded-lg shrink-0 transition-colors",style:{color:g?"#3ddc84":"rgba(245,245,245,0.25)"},onClick:T,title:"copy note as markdown","data-testid":"note-copy",children:g?d.jsx(ry,{className:"w-4 h-4"}):d.jsx(ry,{className:"w-4 h-4"})}),f?d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0","data-testid":"note-delete-confirm",children:[d.jsx("span",{className:"text-[10px] font-mono whitespace-nowrap",style:{color:"rgba(245,169,169,0.8)"},children:"move to trash?"}),d.jsx("button",{className:"px-2 py-1 rounded-md text-[10px] font-mono font-bold uppercase tracking-wide",style:{color:"#f5a9a9",background:"rgba(255,99,99,0.08)",border:"1px solid rgba(255,99,99,0.25)"},onClick:C,disabled:p,"data-testid":"note-delete-go",children:p?"...":"delete"}),d.jsx("button",{className:"p-1.5 rounded-md",style:{color:"rgba(245,245,245,0.3)"},onClick:()=>h(!1),"data-testid":"note-delete-cancel",children:d.jsx(jt,{className:"w-3.5 h-3.5"})})]}):d.jsx("button",{className:"p-2 rounded-lg shrink-0 transition-colors",style:{color:"rgba(245,245,245,0.25)"},onClick:()=>h(!0),title:"delete note","data-testid":"note-delete-trigger",children:d.jsx(_h,{className:"w-4 h-4"})})]})]}),d.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4 space-y-4",children:[a&&d.jsxs("div",{className:"space-y-4",children:[d.jsx(or,{className:"h-4 w-32",style:{background:"#1a1a1a"}}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx(or,{className:"h-5 w-16 rounded-full",style:{background:"#1a1a1a"}}),d.jsx(or,{className:"h-5 w-20 rounded-full",style:{background:"#1a1a1a"}})]}),d.jsx(or,{className:"h-24 w-full rounded-xl",style:{background:"#1a1a1a"}}),d.jsx(or,{className:"h-40 w-full rounded-xl",style:{background:"#1a1a1a"}})]}),l&&d.jsx("div",{className:"note-detail-error",children:d.jsxs("div",{className:"error-text",children:["Failed to load note: ",l]})}),s&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"r1-meta",children:[s.created_at&&d.jsx("span",{className:"rdate",children:dc(s.created_at)}),s.type&&d.jsx("span",{className:`rb ${k5(s.type)}`,children:s.type}),(j=s.tags)==null?void 0:j.map((P,R)=>d.jsxs("span",{className:"rb rb-tag",children:["#",P]},R))]}),s.type==="image"&&s.source_file&&(v?d.jsx("img",{src:v,alt:s.title||"captured image",className:"note-media","data-testid":"note-media"}):d.jsx("div",{className:"note-media note-media-loading",children:d.jsx(or,{className:"h-40 w-full rounded-xl",style:{background:"#1a1a1a"}})})),(()=>{var A,I,_;const P=(((A=s.entities)==null?void 0:A.people)||[]).map(String),R=(((I=s.entities)==null?void 0:I.amounts)||[]).map(String),b=(((_=s.entities)==null?void 0:_.dates)||[]).map(String);return P.length===0&&R.length===0&&b.length===0?null:d.jsxs("div",{className:"entity-rows","data-testid":"entity-chips",children:[P.map((L,$)=>d.jsxs("button",{className:"entity-chip person",onClick:()=>o==null?void 0:o(L),title:`search notes about ${L}`,children:[d.jsx(Z1,{className:"w-3 h-3"}),L]},`p-${$}`)),R.map((L,$)=>d.jsx("button",{className:"entity-chip",onClick:()=>o==null?void 0:o(L),title:`search ${L}`,children:L},`a-${$}`)),b.map((L,$)=>d.jsx("button",{className:"entity-chip",onClick:()=>o==null?void 0:o(L),title:`search ${L}`,children:L},`d-${$}`))]})})(),s.related_links&&s.related_links.length>0&&d.jsxs("div",{className:"note-links","data-testid":"note-links",children:[d.jsx("div",{className:"note-links-label",children:"linked notes"}),s.related_links.map((P,R)=>{var b,A,I;return d.jsxs("button",{className:"note-link-chip",onClick:()=>i==null?void 0:i(P.note_path),onMouseDown:_=>_.preventDefault(),title:P.note_path,"data-testid":"note-link-chip",children:[(b=P.types)==null?void 0:b.map(_=>d.jsx("span",{className:"note-link-type",title:Sv[_]||_,children:w5[_]||d.jsx(Qa,{className:"w-3 h-3 shrink-0"})},_)),!((A=P.types)!=null&&A.length)&&d.jsx(Qa,{className:"w-3 h-3 shrink-0"}),d.jsx("span",{className:"note-link-title",children:P.title}),(I=P.types)!=null&&I.length?d.jsx("span",{className:"note-link-types-label",children:P.types.map(_=>Sv[_]||_).join(" · ")}):null]},s.note_path+"-"+R)})]},s.note_path),s.excerpt&&d.jsx("div",{className:"excerpt-box",children:d.jsxs("p",{className:"excerpt-text",children:[d.jsx("span",{className:"excerpt-label",children:"matched excerpt"}),d.jsx("br",{}),s.excerpt]})}),s.excerpt&&d.jsxs("div",{className:"view-toggle",children:[d.jsx("button",{className:`toggle-btn ${u==="excerpt"?"active":""}`,onClick:()=>c("excerpt"),children:"Excerpt"}),d.jsx("button",{className:`toggle-btn ${u==="full"?"active":""}`,onClick:()=>c("full"),children:"Full Note"})]}),u==="excerpt"&&s.excerpt?d.jsx(NM,{note:s}):d.jsx(x5,{note:s}),d.jsxs("div",{className:"text-xs pt-4 mt-4 border-t border-white/5",style:{color:"rgba(245,245,245,0.3)"},children:[d.jsx("div",{className:"font-mono truncate",children:s.note_path}),s.created_at&&d.jsxs("div",{className:"mt-1",children:["Created ",dc(s.created_at),s.updated_at&&s.updated_at!==s.created_at&&d.jsxs(d.Fragment,{children:[" · Updated ",dc(s.updated_at)]})]})]})]})]})]})})}const Tb=m.forwardRef(({className:e,type:t,...n},r)=>d.jsx("input",{type:t,className:G("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Tb.displayName="Input";const al=m.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:G("rounded-xl border bg-card text-card-foreground shadow",e),...t}));al.displayName="Card";const ll=m.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:G("flex flex-col space-y-1.5 p-6",e),...t}));ll.displayName="CardHeader";const ul=m.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:G("font-semibold leading-none tracking-tight",e),...t}));ul.displayName="CardTitle";const b5=m.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:G("text-sm text-muted-foreground",e),...t}));b5.displayName="CardDescription";const cl=m.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:G("p-6 pt-0",e),...t}));cl.displayName="CardContent";const C5=m.forwardRef(({className:e,...t},n)=>d.jsx("div",{ref:n,className:G("flex items-center p-6 pt-0",e),...t}));C5.displayName="CardFooter";function E5(){const{setupPrf:e,completeOnboarding:t}=st(),[n,r]=m.useState(""),[i,o]=m.useState(""),[s,a]=m.useState(!1),[l,u]=m.useState(null),c=async()=>{if(!n){o("Please enter your token");return}a(!0),o("");try{const f=window.location.origin;if(!(await fetch(`${f}/v1/health`,{headers:{"X-Khayal-Token":n}})).ok)throw new Error("Invalid token");localStorage.getItem(ke.LOCK_SETUP_DECIDED)?t(n,!1):u(n)}catch{o("Cannot connect. Check your token.")}finally{a(!1)}};return l!==null?d.jsx("div",{className:"flex flex-col items-center justify-center h-screen p-6 bg-background",children:d.jsxs(al,{className:"w-full max-w-sm glass border-primary/20 shadow-[0_0_40px_hsl(var(--primary)/0.1)]",children:[d.jsx(ll,{className:"text-center pb-2",children:d.jsxs(ul,{className:"text-2xl font-bold tracking-tight",children:["connected ",d.jsx("span",{className:"text-primary",children:"✓"})]})}),d.jsx(cl,{className:"p-0",children:d.jsx(hL,{onSetupPrf:()=>e(l),onRemember:()=>t(l,!0),onDontRemember:()=>t(l,!1)})})]})}):d.jsx("div",{className:"flex flex-col items-center justify-center h-screen p-6 bg-background",children:d.jsx(Ae.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.4,ease:"easeOut"},children:d.jsxs(al,{className:"w-full max-w-sm glass border-primary/20 shadow-[0_0_40px_hsl(var(--primary)/0.1)]",children:[d.jsxs(ll,{className:"text-center pb-2",children:[d.jsx(Ae.div,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},transition:{delay:.1,duration:.4,ease:"easeOut"},className:"w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",children:d.jsx("img",{src:"/icon.svg",alt:"khayal",className:"w-16 h-16"})}),d.jsx(ul,{className:"text-2xl font-bold tracking-tight",children:"khayal"}),d.jsx("p",{className:"text-caption mt-1",children:"private second brain"})]}),d.jsxs(cl,{className:"space-y-4 pt-4",children:[d.jsx(Tb,{placeholder:"token",type:"password",value:n,onChange:f=>r(f.target.value),onKeyDown:f=>{f.key==="Enter"&&c()},className:"glass input-glow transition-all duration-300"}),i&&d.jsx(Ae.p,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},className:"text-sm text-destructive text-center",children:i}),d.jsx(Ae.div,{whileTap:{scale:.98},children:d.jsx(wn,{className:"w-full h-12 btn-gradient font-semibold tracking-wide",onClick:c,disabled:s,children:s?d.jsx("span",{className:"animate-pulse",children:"connecting..."}):"connect"})})]})]})})})}function T5(){const{unlock:e,resetToOnboarding:t}=st(),[n,r]=m.useState(""),[i,o]=m.useState(!1),s=m.useRef(!1),a=m.useCallback(async()=>{o(!0),r("");const l=await e();o(!1),l||r("can't unlock. try again.")},[e]);return m.useEffect(()=>{s.current||(s.current=!0,a())},[a]),d.jsx("div",{className:"flex flex-col items-center justify-center h-screen p-6 bg-background",children:d.jsx(Ae.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.4,ease:"easeOut"},children:d.jsxs(al,{className:"w-full max-w-sm glass border-primary/20 shadow-[0_0_40px_hsl(var(--primary)/0.1)]",children:[d.jsxs(ll,{className:"text-center pb-2",children:[d.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",children:d.jsx("img",{src:"/icon.svg",alt:"khayal",className:"w-16 h-16"})}),d.jsx(ul,{className:"text-2xl font-bold tracking-tight",children:"khayal"}),d.jsx("p",{className:"text-caption mt-1",children:"locked"})]}),d.jsxs(cl,{className:"space-y-4 pt-4",children:[d.jsx(wn,{className:"w-full h-12 btn-gradient font-semibold tracking-wide",onClick:a,disabled:i,children:i?d.jsx("span",{className:"animate-pulse",children:"unlocking..."}):"unlock with face id"}),n&&d.jsx(Ae.p,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},className:"text-sm text-destructive text-center",children:n}),d.jsx(wn,{variant:"ghost",className:"w-full text-muted-foreground text-xs",onClick:t,children:"can't unlock? reconnect instead"})]})]})})})}class hc extends Qt.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("ErrorBoundary caught:",t,n)}render(){var t;return this.state.hasError?this.props.fallback?this.props.fallback:d.jsx("div",{className:"flex flex-col items-center justify-center h-screen p-6 bg-background",children:d.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-sm text-center",children:[d.jsx("div",{className:"w-16 h-16 rounded-2xl bg-destructive/10 flex items-center justify-center",children:d.jsx(_l,{className:"w-8 h-8 text-destructive"})}),d.jsx("h2",{className:"text-xl font-bold font-display text-foreground",children:"something broke"}),d.jsx("p",{className:"text-sm text-muted-foreground",children:((t=this.state.error)==null?void 0:t.message)||"An unexpected error occurred"}),d.jsx("button",{onClick:()=>window.location.reload(),className:"mt-4 px-6 py-2 bg-primary text-primary-foreground rounded-full font-semibold text-sm",children:"reload"})]})}):this.props.children}}const N5={initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12}};function P5(){const{locked:e,configured:t}=st(),[n,r]=m.useState("capture"),[i,o]=m.useState(void 0),[s,a]=m.useState(null),[l,u]=m.useState(""),[c,f]=m.useState([]),[h,p]=m.useState(void 0),y=m.useCallback(C=>{o(C),r("capture")},[]),v=m.useCallback(()=>{o(void 0)},[]),k=m.useCallback((C,j)=>{a(C),u(j||"")},[]),g=m.useCallback(()=>{a(null),u("")},[]),x=m.useCallback(C=>{p(C),r("search")},[]),w=m.useCallback(()=>{p(void 0)},[]),S=m.useCallback(C=>{f(j=>[...j,C]),a(null)},[]);if(e)return d.jsx(hc,{children:d.jsx(T5,{})});if(!t)return d.jsx(hc,{children:d.jsx(E5,{})});const T=()=>{switch(n){case"capture":return d.jsx(Cy,{captureQuery:i,onCaptureQueryConsumed:v});case"search":return d.jsx(JL,{onCaptureQuery:y,onNoteSelect:k,deletedPaths:c,initialQuery:h,onInitialQueryConsumed:w});case"queue":return d.jsx(CM,{onNoteSelect:k});default:return d.jsx(Cy,{captureQuery:i,onCaptureQueryConsumed:v})}};return d.jsx(hc,{children:d.jsxs("div",{className:"flex flex-col h-screen overflow-hidden",style:{background:"#070707"},children:[d.jsx(mL,{}),d.jsx("main",{className:"flex-1 overflow-hidden",children:d.jsx(Uo,{mode:"wait",children:d.jsx(Ae.div,{variants:N5,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.2,ease:"easeOut"},className:"h-full overflow-y-auto",style:{paddingBottom:"1rem"},children:T()},n)})}),d.jsx(yL,{activeTab:n,onTabChange:r}),d.jsx(jI,{}),d.jsx(S5,{notePath:s,query:l||void 0,onClose:g,onDeleted:S,onOpenNote:C=>{a(C),u("")},onSearch:x})]})})}"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").then(e=>{console.log("SW registered:",e.scope),navigator.serviceWorker.addEventListener("controllerchange",()=>{navigator.serviceWorker.controller&&window.location.reload()}),e.addEventListener("updatefound",()=>{const t=e.installing;t&&t.addEventListener("statechange",()=>{t.state==="installed"&&navigator.serviceWorker.controller&&t.postMessage({type:"SKIP_WAITING"}),t.state==="activated"&&console.log("SW activated")})}),"sync"in e&&e.sync.register("sync-offline-captures").catch(()=>{})}).catch(e=>{console.log("SW registration failed:",e)})});window.navigator.standalone===!0&&document.documentElement.classList.add("pwa-standalone");pc.createRoot(document.getElementById("root")).render(d.jsx(Qt.StrictMode,{children:d.jsx(ZI,{children:d.jsx(P5,{})})})); diff --git a/internal/api/ui/static/index.html b/internal/api/ui/static/index.html index 6334eae..97dfa4b 100644 --- a/internal/api/ui/static/index.html +++ b/internal/api/ui/static/index.html @@ -17,8 +17,8 @@ Khayal - - + + diff --git a/internal/api/ui/static/sw.js b/internal/api/ui/static/sw.js index 5837a59..362cd6f 100644 --- a/internal/api/ui/static/sw.js +++ b/internal/api/ui/static/sw.js @@ -1 +1 @@ -if(!self.define){let e,n={};const s=(s,i)=>(s=new URL(s+".js",i).href,n[s]||new Promise(n=>{if("document"in self){const e=document.createElement("script");e.src=s,e.onload=n,document.head.appendChild(e)}else e=s,importScripts(s),n()}).then(()=>{let e=n[s];if(!e)throw new Error(`Module ${s} didn’t register its module`);return e}));self.define=(i,c)=>{const a=e||("document"in self?document.currentScript.src:"")||location.href;if(n[a])return;let r={};const t=e=>s(e,a),o={module:{uri:a},exports:r,require:t};n[a]=Promise.all(i.map(e=>o[e]||t(e))).then(e=>(c(...e),r))}}define(["./workbox-3795e1a3"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"index.html",revision:"37a22912820e2321b9d7b008e36d3076"},{url:"icon.svg",revision:"b1d8deee9cce160807b894c502a1c82d"},{url:"icon.png",revision:"49f91e0df87340b1890ac8f41298c095"},{url:"icon-512.png",revision:"49f91e0df87340b1890ac8f41298c095"},{url:"icon-192.png",revision:"03df4e41a630bb7e7fa123bc2e615cc2"},{url:"assets/index-BiXUJG5m.css",revision:null},{url:"assets/index-BbIh6FfK.js",revision:null},{url:"icon-192.png",revision:"03df4e41a630bb7e7fa123bc2e615cc2"},{url:"icon-512.png",revision:"49f91e0df87340b1890ac8f41298c095"},{url:"manifest.webmanifest",revision:"2f3a8f746d4a09d09d6bf45217471bf8"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html"))),e.registerRoute(/^https?:\/\/.*\.(js|css|html|ico|png|svg)$/,new e.CacheFirst({cacheName:"khayal-shell",plugins:[new e.ExpirationPlugin({maxEntries:50,maxAgeSeconds:2592e3})]}),"GET"),e.registerRoute(/\/v1\/health/,new e.NetworkFirst({cacheName:"khayal-health",plugins:[new e.ExpirationPlugin({maxEntries:1,maxAgeSeconds:60})]}),"GET"),e.registerRoute(/\/v1\/stats/,new e.StaleWhileRevalidate({cacheName:"khayal-stats",plugins:[new e.ExpirationPlugin({maxEntries:1,maxAgeSeconds:60})]}),"GET"),e.registerRoute(/\/v1\/search/,new e.NetworkFirst({cacheName:"khayal-search",plugins:[new e.ExpirationPlugin({maxEntries:20,maxAgeSeconds:300})]}),"GET"),e.registerRoute(/\/v1\/queue/,new e.NetworkFirst({cacheName:"khayal-queue",plugins:[new e.ExpirationPlugin({maxEntries:10,maxAgeSeconds:300})]}),"GET"),e.registerRoute(/\/v1\/capture/,new e.NetworkOnly,"GET")}); +if(!self.define){let e,n={};const s=(s,i)=>(s=new URL(s+".js",i).href,n[s]||new Promise(n=>{if("document"in self){const e=document.createElement("script");e.src=s,e.onload=n,document.head.appendChild(e)}else e=s,importScripts(s),n()}).then(()=>{let e=n[s];if(!e)throw new Error(`Module ${s} didn’t register its module`);return e}));self.define=(i,c)=>{const a=e||("document"in self?document.currentScript.src:"")||location.href;if(n[a])return;let r={};const t=e=>s(e,a),o={module:{uri:a},exports:r,require:t};n[a]=Promise.all(i.map(e=>o[e]||t(e))).then(e=>(c(...e),r))}}define(["./workbox-3795e1a3"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"index.html",revision:"4b19e206db3ed95353fe4edd45571d1e"},{url:"icon.svg",revision:"b1d8deee9cce160807b894c502a1c82d"},{url:"icon.png",revision:"49f91e0df87340b1890ac8f41298c095"},{url:"icon-512.png",revision:"49f91e0df87340b1890ac8f41298c095"},{url:"icon-192.png",revision:"03df4e41a630bb7e7fa123bc2e615cc2"},{url:"assets/index-D3OJiXM7.js",revision:null},{url:"assets/index-BK66E79C.css",revision:null},{url:"icon-192.png",revision:"03df4e41a630bb7e7fa123bc2e615cc2"},{url:"icon-512.png",revision:"49f91e0df87340b1890ac8f41298c095"},{url:"manifest.webmanifest",revision:"2f3a8f746d4a09d09d6bf45217471bf8"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html"))),e.registerRoute(/^https?:\/\/.*\.(js|css|html|ico|png|svg)$/,new e.CacheFirst({cacheName:"khayal-shell",plugins:[new e.ExpirationPlugin({maxEntries:50,maxAgeSeconds:2592e3})]}),"GET"),e.registerRoute(/\/v1\/health/,new e.NetworkFirst({cacheName:"khayal-health",plugins:[new e.ExpirationPlugin({maxEntries:1,maxAgeSeconds:60})]}),"GET"),e.registerRoute(/\/v1\/stats/,new e.StaleWhileRevalidate({cacheName:"khayal-stats",plugins:[new e.ExpirationPlugin({maxEntries:1,maxAgeSeconds:60})]}),"GET"),e.registerRoute(/\/v1\/search/,new e.NetworkFirst({cacheName:"khayal-search",plugins:[new e.ExpirationPlugin({maxEntries:20,maxAgeSeconds:300})]}),"GET"),e.registerRoute(/\/v1\/queue/,new e.NetworkFirst({cacheName:"khayal-queue",plugins:[new e.ExpirationPlugin({maxEntries:10,maxAgeSeconds:300})]}),"GET"),e.registerRoute(/\/v1\/capture/,new e.NetworkOnly,"GET")}); diff --git a/internal/config/config.go b/internal/config/config.go index 88146d0..9afb252 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -149,10 +149,13 @@ type ConnectionsConfig struct { Enabled *bool `yaml:"enabled"` // MinAgeDays: nil means the 7-day default; an explicit 0 is honored // (surface everything up to now) — needed for testing setups. - MinAgeDays *int `yaml:"min_age_days"` - MaxPerCapture int `yaml:"max_per_capture"` - SimilarityThreshold float64 `yaml:"similarity_threshold"` - Types ConnectionsTypes `yaml:"types"` + MinAgeDays *int `yaml:"min_age_days"` + MaxPerCapture int `yaml:"max_per_capture"` + SimilarityThreshold float64 `yaml:"similarity_threshold"` + // ContradictionThreshold is the semantic floor for contradiction + // candidates before the LLM verdict runs; default 0.80. + ContradictionThreshold float64 `yaml:"contradiction_threshold"` + Types ConnectionsTypes `yaml:"types"` } // AgeDays resolves the minimum-age setting: nil -> 7, negative -> 7. @@ -196,9 +199,12 @@ func (m MemoryConfig) PersonsThreshold() int { // ConnectionsTypes toggles individual connection types; nil means on. type ConnectionsTypes struct { - Similar *bool `yaml:"similar"` - Person *bool `yaml:"person"` - Amount *bool `yaml:"amount"` + Similar *bool `yaml:"similar"` + Person *bool `yaml:"person"` + Amount *bool `yaml:"amount"` + Contradiction *bool `yaml:"contradiction"` + FollowUp *bool `yaml:"follow_up"` + Revisit *bool `yaml:"revisit"` } // IsOn resolves a nil-means-true flag. @@ -345,6 +351,9 @@ func (c *Config) ApplyDefaults() { if c.Connections.SimilarityThreshold <= 0 { c.Connections.SimilarityThreshold = 0.72 } + if c.Connections.ContradictionThreshold <= 0 { + c.Connections.ContradictionThreshold = 0.80 + } if c.LLM.TruncateTextTokens == 0 { c.LLM.TruncateTextTokens = 2000 } diff --git a/internal/connections/connections.go b/internal/connections/connections.go index 643bfa5..ba075fa 100644 --- a/internal/connections/connections.go +++ b/internal/connections/connections.go @@ -9,24 +9,34 @@ import ( "sort" "time" + "strings" + "github.com/rawnaqs/khayal/internal/config" + "github.com/rawnaqs/khayal/internal/constants" "github.com/rawnaqs/khayal/internal/queue" ) // Connection is one surfaced relation between the new note and an older one. type Connection struct { - Type string `json:"type"` // "similar" | "person" | "amount" + Type string `json:"type"` // "similar" | "person" | "amount" | "revisit" | ... NotePath string `json:"note_path"` Excerpt string `json:"excerpt"` Score float64 `json:"score"` // true cosine for "similar"; 1.0 for entity matches Label string `json:"label"` + // CreatedAt carries the target note's creation time between detectors + // and ranking; hidden from API output. + CreatedAt *time.Time `json:"-"` } -// priority per SPEC: person > amount > similar. +// priority per SPEC: person > contradiction > follow_up ~ amount > +// similar > revisit. var priority = map[string]int{ - "person": 3, - "amount": 2, - "similar": 1, + "person": 5, + "contradiction": 4, + "follow_up": 3, + "amount": 3, + "similar": 2, + "revisit": 1, } // Store is the slice of queue.Queue the engine needs. *queue.Queue @@ -37,12 +47,17 @@ type Store interface { GetEntitiesByNote(ctx context.Context, notePath, entityType string) ([]string, error) GetNotesByEntity(ctx context.Context, entityValue, entityType string, cutoff time.Time) ([]queue.EntityMatch, error) CountNotesByEntity(ctx context.Context, entityValue, entityType string, cutoff time.Time, excludePath string) (int, error) + GetNoteContent(ctx context.Context, notePath string) (string, error) + GetPersonVariants(ctx context.Context, person string) ([]string, error) + FindFollowupCandidates(ctx context.Context, person string, keywords []string, before time.Time, excludePath string) ([]queue.FollowupCandidate, error) + PersonMentionedSince(ctx context.Context, person string, since time.Time, excludePaths ...string) (bool, error) } // Find runs every enabled detector against older notes and returns at most // cfg.MaxPerCapture ranked connections. Detector errors degrade to skipping // that type — a connections job must not fail because one source hiccups. -func Find(ctx context.Context, q Store, notePath string, cfg config.ConnectionsConfig) ([]Connection, error) { +func Find(ctx context.Context, q Store, notePath string, cfg config.ConnectionsConfig, + checker ContradictionChecker) ([]Connection, error) { if !config.IsOn(cfg.Enabled) { return nil, nil } @@ -57,13 +72,46 @@ func Find(ctx context.Context, q Store, notePath string, cfg config.ConnectionsC var conns []Connection + var similarConns []Connection + if hasEmb { sim, err := findSimilar(ctx, q, selfEmb, notePath, cutoff, cfg.SimilarityThreshold) if err == nil { conns = append(conns, sim...) + similarConns = sim } else { fmt.Println("connections: similar skipped:", err) } + + // Revisit rides on the same semantic matches (v1.2 Type 6). + if config.IsOn(cfg.Types.Revisit) { + if r := findRevisit(similarConns, time.Now().UTC()); r != nil { + conns = append(conns, *r) + } + } + + // Contradiction runs LLM verdicts over high-similarity candidates + // (v1.2 Type 4). Nil checker skips it entirely. + if config.IsOn(cfg.Types.Contradiction) && checker != nil { + floor := cfg.SimilarityThreshold - 0.10 + if cfg.ContradictionThreshold > 0 { + floor = cfg.ContradictionThreshold + } + hot := make([]Connection, 0, len(similarConns)) + for _, c := range similarConns { + if c.Score >= floor { + hot = append(hot, c) + } + } + selfContent, cerr := q.GetNoteContent(ctx, notePath) + if cerr != nil || strings.TrimSpace(selfContent) == "" { + selfContent = "" + } + if cds := findContradictions(ctx, checker, + constants.DefaultSystemPrompts.CheckContradiction, selfContent, hot, time.Now().UTC()); len(cds) > 0 { + conns = append(conns, cds...) + } + } } personByPath := map[string]bool{} @@ -76,6 +124,12 @@ func Find(ctx context.Context, q Store, notePath string, cfg config.ConnectionsC } } } + if config.IsOn(cfg.Types.FollowUp) { + if f := findFollowups(ctx, q, notePath, time.Now().UTC()); len(f) > 0 { + conns = append(conns, f...) + } + } + if config.IsOn(cfg.Types.Amount) { a, err := findAmounts(ctx, q, selfEmb, hasEmb, personByPath, notePath, cutoff, cfg.SimilarityThreshold) if err == nil { @@ -97,12 +151,14 @@ func findSimilar(ctx context.Context, q Store, selfEmb []float32, notePath strin var conns []Connection for _, m := range matches { created, _ := time.Parse(time.RFC3339, m.CreatedAt) + createdCopy := created conns = append(conns, Connection{ - Type: "similar", - NotePath: m.NotePath, - Excerpt: m.Content, - Score: m.Score, - Label: fmt.Sprintf("you thought about this %s", formatAge(created)), + Type: "similar", + NotePath: m.NotePath, + Excerpt: m.Content, + Score: m.Score, + Label: fmt.Sprintf("you thought about this %s", formatAge(created)), + CreatedAt: &createdCopy, }) } return conns, nil @@ -115,26 +171,38 @@ func findByEntity(ctx context.Context, q Store, notePath, entityType string, cut } var conns []Connection + seenPaths := map[string]bool{} for _, val := range values { - matches, err := q.GetNotesByEntity(ctx, val, entityType, cutoff) - if err != nil { - continue + // Name variants (Sara/Sarah, Dan/Daniel) resolve to the same + // human — expand each extracted value before matching. + variants := []string{val} + if entityType == "person" { + if vs, err := q.GetPersonVariants(ctx, val); err == nil && len(vs) > 0 { + variants = vs + } } - for _, m := range matches { - if m.NotePath == notePath { + for _, variant := range variants { + matches, err := q.GetNotesByEntity(ctx, variant, entityType, cutoff) + if err != nil { continue } - label := fmt.Sprintf("%s also appears in %d other notes", val, otherCount(q, ctx, val, entityType, cutoff, notePath)) - if entityType == "amount" { - label = "you've mentioned this amount before" + for _, m := range matches { + if m.NotePath == notePath || seenPaths[m.NotePath] { + continue + } + seenPaths[m.NotePath] = true + label := fmt.Sprintf("%s also appears in %d other notes", val, otherCount(q, ctx, val, entityType, cutoff, notePath)) + if entityType == "amount" { + label = "you've mentioned this amount before" + } + conns = append(conns, Connection{ + Type: entityType, + NotePath: m.NotePath, + Excerpt: m.Excerpt, + Score: 1.0, + Label: label, + }) } - conns = append(conns, Connection{ - Type: entityType, - NotePath: m.NotePath, - Excerpt: m.Excerpt, - Score: 1.0, - Label: label, - }) } } return conns, nil @@ -214,12 +282,15 @@ func otherCount(q Store, ctx context.Context, val, typ string, cutoff time.Time, // rankAndLimit dedupes by note (keeping the highest-priority occurrence), // sorts by priority then score, and caps the output. func rankAndLimit(conns []Connection, max int) []Connection { - best := make(map[string]Connection, len(conns)) + // Keep the best connection per (notePath, type): different detector + // types about the same note are complementary information, not dupes. + type key struct{ path, typ string } + best := make(map[key]Connection, len(conns)) for _, c := range conns { - cur, seen := best[c.NotePath] - if !seen || priority[c.Type] > priority[cur.Type] || - (priority[c.Type] == priority[cur.Type] && c.Score > cur.Score) { - best[c.NotePath] = c + k := key{c.NotePath, c.Type} + cur, seen := best[k] + if !seen || c.Score > cur.Score { + best[k] = c } } @@ -235,10 +306,39 @@ func rankAndLimit(conns []Connection, max int) []Connection { return deduped[i].Score > deduped[j].Score }) - if len(deduped) > max { - deduped = deduped[:max] + if len(deduped) <= max { + return deduped + } + + // Diversity guarantee: before filling the remainder by global rank, + // reserve one slot for every present type so a high-priority flood + // cannot silence rarer detector types entirely. + selected := make([]Connection, 0, max) + seenType := make(map[string]bool) + taken := make(map[key]bool) + for _, c := range deduped { + if len(selected) >= max { + break + } + if seenType[c.Type] { + continue + } + seenType[c.Type] = true + taken[key{c.NotePath, c.Type}] = true + selected = append(selected, c) + } + for _, c := range deduped { + if len(selected) >= max { + break + } + k := key{c.NotePath, c.Type} + if taken[k] { + continue + } + taken[k] = true + selected = append(selected, c) } - return deduped + return selected } func formatAge(t time.Time) string { diff --git a/internal/connections/connections_test.go b/internal/connections/connections_test.go index 7d774a8..17c5828 100644 --- a/internal/connections/connections_test.go +++ b/internal/connections/connections_test.go @@ -2,6 +2,7 @@ package connections import ( "context" + "fmt" "path/filepath" "testing" "time" @@ -58,7 +59,7 @@ func TestFind_DisabledYieldsNothing(t *testing.T) { off := false cfg.Enabled = &off - got, err := Find(context.Background(), q, "khayal/x.md", cfg) + got, err := Find(context.Background(), q, "khayal/x.md", cfg, nil) if err != nil || got != nil { t.Fatalf("disabled must return nil,nil, got %v (err=%v)", got, err) } @@ -76,7 +77,7 @@ func TestFind_SemimilarDetectedWithAgeAndSelfFilters(t *testing.T) { mkOldNote(t, ctx, q, "old-diff", "khayal/old-diff.md", "cooking pasta today", []float32{0, 0, 1}, nil) - got, err := Find(ctx, q, "khayal/current.md", testCfg()) + got, err := Find(ctx, q, "khayal/current.md", testCfg(), nil) if err != nil { t.Fatal(err) } @@ -121,7 +122,7 @@ func TestFind_PersonAndAmountLabels(t *testing.T) { // A second older note with Alice, to exercise the count label. mkOldNote(t, ctx, q, "p2", "khayal/p2.md", "Coffee with Alice", nil, []string{"Alice"}) - got, err := Find(ctx, q, "khayal/current.md", testCfg()) + got, err := Find(ctx, q, "khayal/current.md", testCfg(), nil) if err != nil { t.Fatal(err) } @@ -153,38 +154,42 @@ func TestRankAndLimit(t *testing.T) { {Type: "amount", NotePath: "c", Score: 1.0}, {Type: "similar", NotePath: "d", Score: 0.95}, {Type: "person", NotePath: "e", Score: 1.0}, - // duplicate note across types — keep highest priority occurrence + // same note in two types = complementary rows, both may survive {Type: "similar", NotePath: "b", Score: 0.99}, } - got := rankAndLimit(conns, 3) + got := rankAndLimit(conns, 4) - if len(got) != 3 { - t.Fatalf("len = %d, want 3", len(got)) + if len(got) != 4 { + t.Fatalf("len = %d, want 4 (one per distinct type + fill), got %+v", len(got), got) } if got[0].Type != "person" { t.Errorf("first = %+v, want a person connection", got[0]) } - foundB := false + foundBPerson := false + pairs := map[string]bool{} for _, c := range got { if c.NotePath == "b" && c.Type == "person" { - foundB = true + foundBPerson = true + } + k := c.NotePath + "|" + c.Type + if pairs[k] { + t.Errorf("duplicate (path,type) pair leaked: %s", k) } + pairs[k] = true } - if !foundB { - t.Errorf("b must survive as its higher-priority person occurrence: %+v", got) + if !foundBPerson { + t.Errorf("b's person occurrence must survive: %+v", got) } + typesSeen := map[string]bool{} for _, c := range got { if c.NotePath == "" { t.Error("nil path leaked") } + typesSeen[c.Type] = true } - paths := map[string]bool{} - for _, c := range got { - if paths[c.NotePath] { - t.Errorf("duplicate note_path in output: %s", c.NotePath) - } - paths[c.NotePath] = true + if !typesSeen["similar"] || !typesSeen["amount"] || !typesSeen["person"] { + t.Errorf("type diversity violated: %v", typesSeen) } } @@ -231,7 +236,7 @@ func TestFind_AmountRequiresCorroboration(t *testing.T) { []float32{1, 0, 0}, []float32{0, 1, 0}) // unrelated content defer closeQ() - got, err := Find(ctx, q, "khayal/current.md", testCfg()) + got, err := Find(ctx, q, "khayal/current.md", testCfg(), nil) if err != nil { t.Fatal(err) } @@ -247,7 +252,7 @@ func TestFind_AmountRequiresCorroboration(t *testing.T) { []float32{1, 0, 0}, []float32{0.995, 0.03, 0}) // near-identical topic defer closeQ() - got, err := Find(ctx, q, "khayal/current.md", testCfg()) + got, err := Find(ctx, q, "khayal/current.md", testCfg(), nil) if err != nil { t.Fatal(err) } @@ -282,7 +287,7 @@ func TestFind_AmountRequiresCorroboration(t *testing.T) { t.Fatal(err) } } - got, err := Find(ctx, q, "khayal/c2.md", testCfg()) + got, err := Find(ctx, q, "khayal/c2.md", testCfg(), nil) if err != nil { t.Fatal(err) } @@ -308,7 +313,7 @@ func TestFind_SimilarReportsTrueCosine(t *testing.T) { mkOldNote(t, ctx, q, "old-sim", "khayal/old-sim.md", "similar", []float32{4, 3, 0}, nil) // cos = 24/25 = 0.96 - got, err := Find(ctx, q, "khayal/current.md", testCfg()) + got, err := Find(ctx, q, "khayal/current.md", testCfg(), nil) if err != nil { t.Fatal(err) } @@ -322,3 +327,25 @@ func TestFind_SimilarReportsTrueCosine(t *testing.T) { } t.Fatalf("similar connection missing: %+v", got) } + +// Ranking must not let one high-priority type crowd out every other type: +// each present type contributes its best result before the cap fills. +func TestRankAndLimitTypeDiversity(t *testing.T) { + var conns []Connection + for i := 0; i < 5; i++ { + conns = append(conns, Connection{Type: "person", Score: 1.0, + Label: fmt.Sprintf("person %d", i)}) + } + conns = append(conns, Connection{Type: "similar", Score: 0.9, Label: "similar top"}, + Connection{Type: "similar", Score: 0.8, Label: "similar low"}, + Connection{Type: "contradiction", Score: 0.95, Label: "contradiction!"}) + + got := rankAndLimit(conns, 3) + types := map[string]bool{} + for _, c := range got { + types[c.Type] = true + } + if !types["person"] || !types["similar"] || !types["contradiction"] { + t.Errorf("diversity violated, got: %+v", got) + } +} diff --git a/internal/connections/contradiction.go b/internal/connections/contradiction.go new file mode 100644 index 0000000..41ca943 --- /dev/null +++ b/internal/connections/contradiction.go @@ -0,0 +1,73 @@ +package connections + +import ( + "context" + "encoding/json" + "fmt" + "strings" + "time" + + "github.com/rawnaqs/khayal/internal/constants" +) + +// maxContradictionCandidates bounds the LLM verdict calls per capture. +const maxContradictionCandidates = 5 + +// ContradictionChecker is the slice of llm.LLMExt the contradiction +// detector needs. Nil checker = type skipped entirely. +type ContradictionChecker interface { + GenerateWithSystemTemp(system, user string, temperature float64) (string, error) +} + +// findContradictions runs an LLM verdict per semantic candidate above the +// contradiction threshold and keeps only confirmed conflicts. Fail-open: +// any parse or call error skips that candidate. +func findContradictions(ctx context.Context, checker ContradictionChecker, + system, selfContent string, similar []Connection, now time.Time) []Connection { + if checker == nil || len(similar) == 0 || strings.TrimSpace(selfContent) == "" { + return nil + } + + candidates := similar + if len(candidates) > maxContradictionCandidates { + candidates = candidates[:maxContradictionCandidates] + } + + var conns []Connection + for _, c := range candidates { + if c.CreatedAt == nil { + continue + } + user := fmt.Sprintf("NOTE A (newest, %s):\n%s\n\nNOTE B (older, %s):\n%s", + now.Format("January 2, 2006"), strings.TrimSpace(selfContent), + c.CreatedAt.Format("January 2, 2006"), strings.TrimSpace(c.Excerpt)) + resp, err := checker.GenerateWithSystemTemp(system, user, 0.2) + if err != nil { + continue + } + var verdict struct { + Contradicts bool `json:"contradicts"` + Because string `json:"because"` + } + if err := json.Unmarshal([]byte(strings.TrimSpace(resp)), &verdict); err != nil || !verdict.Contradicts { + continue + } + label := "contradicts something you wrote " + c.CreatedAt.Format("January 2, 2006") + if verdict.Because != "" { + label += " — " + verdict.Because + } + conns = append(conns, Connection{ + Type: "contradiction", + NotePath: c.NotePath, + Excerpt: c.Excerpt, + Score: c.Score, + Label: label, + }) + } + return conns +} + +// ContradictionSystemPrompt exposes the default for the worker adapter. +func ContradictionSystemPrompt() string { + return constants.DefaultSystemPrompts.CheckContradiction +} diff --git a/internal/connections/contradiction_test.go b/internal/connections/contradiction_test.go new file mode 100644 index 0000000..117157c --- /dev/null +++ b/internal/connections/contradiction_test.go @@ -0,0 +1,112 @@ +package connections + +import ( + "context" + "strings" + "testing" + "time" +) + +type fakeChecker struct { + response string + err error + calls int +} + +func (f *fakeChecker) GenerateWithSystemTemp(system, user string, temp float64) (string, error) { + f.calls++ + if f.err != nil { + return "", f.err + } + if f.response != "" { + return f.response, nil + } + // default: only the debt note contradicts — a false-positive trap for + // detectors that flag every candidate + if strings.Contains(user, "owes") { + return `{"contradicts": true, "because": "payment vs debt"}`, nil + } + return `{"contradicts": false}`, nil +} + +func contraConn(path, content string, created time.Time) Connection { + c := simConn(path, created) + c.Excerpt = content + return c +} + +func TestFindContradictions(t *testing.T) { + now := time.Now().UTC() + similar := []Connection{ + contraConn("khayal/old.md", "bob still owes me 100 rupees", now.AddDate(-1, 0, 0)), + contraConn("khayal/other.md", "unrelated note about go channels", now.AddDate(0, -2, 0)), + } + system := "system prompt" + + t.Run("contradicting verdict surfaces with date in label", func(t *testing.T) { + fc := &fakeChecker{} + got := findContradictions(context.Background(), fc, system, "bob paid back every rupee today", similar, now) + if len(got) != 1 || got[0].Type != "contradiction" || got[0].NotePath != "khayal/old.md" { + t.Fatalf("got %+v", got) + } + if !strings.Contains(got[0].Label, "contradicts something you wrote") { + t.Errorf("label: %q", got[0].Label) + } + }) + + t.Run("non-contradicting verdicts are dropped", func(t *testing.T) { + fc := &fakeChecker{response: `{"contradicts": false, "because": "different topics"}`} + if got := findContradictions(context.Background(), fc, system, "bob paid back every rupee today", similar, now); len(got) != 0 { + t.Errorf("expected none, got %+v", got) + } + }) + + t.Run("garbage verdict fails open per candidate", func(t *testing.T) { + fc := &fakeChecker{response: `I think maybe it does not contradict!`} + if got := findContradictions(context.Background(), fc, system, "bob paid back every rupee today", similar, now); len(got) != 0 { + t.Errorf("garbage must be skipped, got %+v", got) + } + if fc.calls != len(similar) { + t.Errorf("expected one call per candidate (%d), got %d", len(similar), fc.calls) + } + }) + + t.Run("checker errors fail open", func(t *testing.T) { + fc := &fakeChecker{err: context.DeadlineExceeded} + if got := findContradictions(context.Background(), fc, system, "bob paid back every rupee today", similar, now); len(got) != 0 { + t.Errorf("errors must skip candidates, got %+v", got) + } + }) +} + +func TestFindContradictionsNilChecker(t *testing.T) { + if got := findContradictions(context.Background(), nil, "", "body", nil, time.Now()); len(got) != 0 { + t.Errorf("nil checker must yield nothing, got %+v", got) + } +} + +type recordingChecker struct { + fakeChecker + lastUser string +} + +func (r *recordingChecker) GenerateWithSystemTemp(system, user string, temp float64) (string, error) { + r.lastUser = user + return r.fakeChecker.GenerateWithSystemTemp(system, user, temp) +} + +// Regression: the verdict prompt must contain BOTH sides — the new note's +// own body was silently omitted, leaving the model nothing to contradict. +func TestFindContradictionsPromptIncludesSelfContent(t *testing.T) { + rc := &recordingChecker{} + similar := []Connection{ + contraConn("khayal/old.md", "bob still owes me 100 rupees", time.Now().AddDate(-1, 0, 0)), + } + findContradictions(context.Background(), rc, "sys", "bob paid back every rupee today", similar, time.Now()) + if !strings.Contains(rc.lastUser, "bob paid back every rupee today") { + t.Errorf("self content missing from verdict prompt:\n%s", rc.lastUser) + } + if !strings.Contains(rc.lastUser, "owes me 100 rupees") { + t.Errorf("candidate excerpt missing from verdict prompt:\n%s", rc.lastUser) + } +} diff --git a/internal/connections/followup.go b/internal/connections/followup.go new file mode 100644 index 0000000..f2bafdb --- /dev/null +++ b/internal/connections/followup.go @@ -0,0 +1,56 @@ +package connections + +import ( + "context" + "strings" + "time" +) + +// followupKeywords are the intent markers FTS hunts for in past notes. +var followupKeywords = []string{ + "follow up", "follow-up", "todo", "need to", + "will send", "promise", "must remember", +} + +// followupMinAgeDays: intents younger than this still have time. +const followupMinAgeDays = 14 + +// findFollowups surfaces old intent notes ("need to follow up with X") +// whose person never appears again afterwards — the planned contact has +// no record of happening. At most one connection per person. +func findFollowups(ctx context.Context, q Store, notePath string, now time.Time) []Connection { + persons, err := q.GetEntitiesByNote(ctx, notePath, "person") + if err != nil || len(persons) == 0 { + return nil + } + + before := now.AddDate(0, 0, -followupMinAgeDays) + var conns []Connection + seen := map[string]bool{} + + for _, person := range persons { + if seen[strings.ToLower(person)] { + continue + } + candidates, err := q.FindFollowupCandidates(ctx, person, followupKeywords, before, notePath) + if err != nil { + continue // fail-open per person + } + for _, cand := range candidates { + completed, err := q.PersonMentionedSince(ctx, person, cand.CreatedAt, notePath, cand.NotePath) + if err != nil || completed { + continue + } + seen[strings.ToLower(person)] = true + conns = append(conns, Connection{ + Type: "follow_up", + NotePath: cand.NotePath, + Excerpt: cand.Content, + Score: 1.0, + Label: "you planned to follow up with " + person + " — no record of this happening", + }) + break // one intent per person is enough + } + } + return conns +} diff --git a/internal/connections/followup_test.go b/internal/connections/followup_test.go new file mode 100644 index 0000000..ec605da --- /dev/null +++ b/internal/connections/followup_test.go @@ -0,0 +1,123 @@ +package connections + +import ( + "context" + "strings" + "testing" + "time" + + "github.com/rawnaqs/khayal/internal/queue" +) + +// seedFollowup creates a done note with content, optional person entity, +// created at the given offset from now. +func seedFollowup(t *testing.T, ctx context.Context, q *queue.Queue, id, path, content string, people []string, ageDays int) { + t.Helper() + now := time.Now().UTC() + j := &queue.Job{ID: id, Type: "text", Status: "done", NotePath: path, + Content: content, CreatedAt: now.Add(-time.Duration(ageDays) * 24 * time.Hour)} + if err := q.CreateJob(ctx, j); err != nil { + t.Fatal(err) + } + if err := q.IndexNote(ctx, path, path, content, ""); err != nil { + t.Fatal(err) + } + if len(people) > 0 { + if err := q.SaveEntities(ctx, path, queue.NoteEntities{People: people}); err != nil { + t.Fatal(err) + } + } +} + +func TestFindFollowups(t *testing.T) { + ctx := context.Background() + + t.Run("old intent with no completion surfaces", func(t *testing.T) { + q, closeQ := setup(t) + defer closeQ() + + seedFollowup(t, ctx, q, "intent", "khayal/intent.md", + "need to follow up with bob about the invoice", []string{"Bob"}, 30) + + seedFollowup(t, ctx, q, "new", "khayal/new.md", + "meeting bob later today", []string{"Bob"}, 0) + + got := findFollowups(ctx, q, "khayal/new.md", time.Now().UTC()) + found := false + for _, c := range got { + if c.Type == "follow_up" && strings.Contains(c.Label, "Bob") && + c.NotePath == "khayal/intent.md" { + found = true + } + } + if !found { + t.Errorf("expected follow_up connection for Bob, got %+v", got) + } + }) + + t.Run("recent intent is below the 14-day floor", func(t *testing.T) { + q, closeQ := setup(t) + defer closeQ() + + seedFollowup(t, ctx, q, "recent", "khayal/recent.md", + "need to follow up with bob", []string{"Bob"}, 5) + + if got := findFollowups(ctx, q, "khayal/new.md", time.Now().UTC()); len(got) != 0 { + t.Errorf("expected none for fresh intent, got %+v", got) + } + }) + + t.Run("completion mention suppresses the follow-up", func(t *testing.T) { + q, closeQ := setup(t) + defer closeQ() + + seedFollowup(t, ctx, q, "old-intent", "khayal/old.md", + "must follow up with bob on the contract", []string{"Bob"}, 40) + // a later note mentioning Bob = record of contact + seedFollowup(t, ctx, q, "later", "khayal/later.md", + "called bob today, all settled", []string{"Bob"}, 3) + + if got := findFollowups(ctx, q, "khayal/new.md", time.Now().UTC()); len(got) != 0 { + t.Errorf("expected suppression after completion, got %+v", got) + } + }) + + t.Run("no intent keywords means no candidates", func(t *testing.T) { + q, closeQ := setup(t) + defer closeQ() + + seedFollowup(t, ctx, q, "plain", "khayal/plain.md", + "had a call with bob about pricing", []string{"Bob"}, 30) + + if got := findFollowups(ctx, q, "khayal/new.md", time.Now().UTC()); len(got) != 0 { + t.Errorf("expected none without intent keyword, got %+v", got) + } + }) +} + +// Regression for the live-found gap: the model extracted "Sara" but older +// notes store "Sarah" — variant-aware joins must still find the intent. +func TestFindFollowups_NameVariants(t *testing.T) { + ctx := context.Background() + q, closeQ := setup(t) + defer closeQ() + + // older intent stored as "Sarah" with intent keyword + seedFollowup(t, ctx, q, "intent", "khayal/intent.md", + "todo: need to follow up with Sarah about the design feedback", []string{"Sarah"}, 30) + + // current capture extracted the variant "Sara" + seedFollowup(t, ctx, q, "new", "khayal/new.md", + "meeting sara later", []string{"Sara"}, 0) + + got := findFollowups(ctx, q, "khayal/new.md", time.Now().UTC()) + found := false + for _, c := range got { + if c.Type == "follow_up" && c.NotePath == "khayal/intent.md" { + found = true + } + } + if !found { + t.Errorf("variant join failed, got %+v", got) + } +} diff --git a/internal/connections/revisit.go b/internal/connections/revisit.go new file mode 100644 index 0000000..4c227e5 --- /dev/null +++ b/internal/connections/revisit.go @@ -0,0 +1,55 @@ +package connections + +import ( + "fmt" + "time" +) + +// revisitMinMatches is how many prior notes on the same topic constitute a +// pattern rather than a coincidence. +const revisitMinMatches = 3 + +// revisitSpan is the minimum time between the oldest and newest match +// before repeated mentions count as a recurring idea. +const revisitSpan = 6 * 30 * 24 * time.Hour + +// findRevisit detects a recurring-idea pattern from the semantic-similar +// matches already gathered for Type 1. When enough matches span a long +// enough window, it emits one connection anchored to the oldest note with +// the newest as its excerpt. Nil when no pattern exists. +func findRevisit(similar []Connection, now time.Time) *Connection { + dated := make([]Connection, 0, len(similar)) + for _, c := range similar { + if c.CreatedAt != nil { + dated = append(dated, c) + } + } + if len(dated) < revisitMinMatches { + return nil + } + + oldest, newest := dated[0], dated[0] + for _, c := range dated[1:] { + if c.CreatedAt.Before(*oldest.CreatedAt) { + oldest = c + } + if c.CreatedAt.After(*newest.CreatedAt) { + newest = c + } + } + + span := newest.CreatedAt.Sub(*oldest.CreatedAt) + if span < revisitSpan { + return nil + } + + label := fmt.Sprintf("you've returned to this idea %d times since %s", + len(dated), oldest.CreatedAt.Format("January 2006")) + return &Connection{ + Type: "revisit", + NotePath: oldest.NotePath, + Excerpt: newest.Excerpt, + Score: newest.Score, + Label: label, + } +} diff --git a/internal/connections/revisit_test.go b/internal/connections/revisit_test.go new file mode 100644 index 0000000..af5cc63 --- /dev/null +++ b/internal/connections/revisit_test.go @@ -0,0 +1,72 @@ +package connections + +import ( + "strings" + "testing" + "time" +) + +func simConn(path string, created time.Time) Connection { + return Connection{ + Type: "similar", + NotePath: path, + Score: 0.9, + Label: "you thought about this", + CreatedAt: &created, + } +} + +func TestFindRevisit(t *testing.T) { + now := time.Now().UTC() + + t.Run("three matches spanning over six months emit one revisit", func(t *testing.T) { + similar := []Connection{ + simConn("khayal/newest.md", now.AddDate(0, 0, -30)), + simConn("khayal/mid.md", now.AddDate(0, -4, -5)), + simConn("khayal/oldest.md", now.AddDate(-1, 0, 0)), // >1 year ago + } + got := findRevisit(similar, now) + if got == nil { + t.Fatal("expected a revisit connection") + } + if got.Type != "revisit" || got.NotePath != "khayal/oldest.md" { + t.Errorf("type/path: %+v", got) + } + if !strings.Contains(got.Label, "returned to this idea") || + !strings.Contains(got.Label, "3 times") { + t.Errorf("label missing phrase/count: %q", got.Label) + } + }) + + t.Run("short span does not trigger", func(t *testing.T) { + similar := []Connection{ + simConn("a", now.AddDate(0, 0, -10)), + simConn("b", now.AddDate(0, 0, -20)), + simConn("c", now.AddDate(0, -1, 0)), + } + if got := findRevisit(similar, now); got != nil { + t.Errorf("expected nil for <6 month span, got %+v", got) + } + }) + + t.Run("fewer than three matches does not trigger", func(t *testing.T) { + similar := []Connection{ + simConn("a", now.AddDate(-1, 0, 0)), + simConn("b", now.AddDate(0, 0, -30)), + } + if got := findRevisit(similar, now); got != nil { + t.Errorf("expected nil with 2 matches, got %+v", got) + } + }) + + t.Run("matches without timestamps are ignored", func(t *testing.T) { + similar := []Connection{ + simConn("a", now), + {Type: "similar", NotePath: "b"}, // no CreatedAt + simConn("c", now.AddDate(-1, 0, 0)), + } + if got := findRevisit(similar, now); got != nil { + t.Errorf("expected nil when timestamps missing, got %+v", got) + } + }) +} diff --git a/internal/constants/constants.go b/internal/constants/constants.go index a1fbe87..67f359e 100644 --- a/internal/constants/constants.go +++ b/internal/constants/constants.go @@ -50,13 +50,14 @@ const ( // System prompts define the model's persona and output expectations. type SystemPrompts struct { - ExtractTags string `yaml:"extract_tags"` - Summarize string `yaml:"summarize"` - ExtractKeyIdeas string `yaml:"extract_key_ideas"` - DescribeImage string `yaml:"describe_image"` - ExtractEntities string `yaml:"extract_entities"` - ConsolidateMemory string `yaml:"consolidate_memory"` - SearchOverview string `yaml:"search_overview"` + ExtractTags string `yaml:"extract_tags"` + Summarize string `yaml:"summarize"` + ExtractKeyIdeas string `yaml:"extract_key_ideas"` + DescribeImage string `yaml:"describe_image"` + ExtractEntities string `yaml:"extract_entities"` + ConsolidateMemory string `yaml:"consolidate_memory"` + SearchOverview string `yaml:"search_overview"` + CheckContradiction string `yaml:"check_contradiction"` } var DefaultSystemPrompts = SystemPrompts{ @@ -109,6 +110,13 @@ Include: Output format: Plain descriptive text. Do NOT use bullet points or numbered lists. Write in flowing prose.`, + CheckContradiction: `You judge whether two notes from the same personal knowledge base contradict each other. Work in steps: +1. Restate NOTE A as one factual claim. +2. Restate NOTE B as one factual claim. +3. Decide: they contradict ONLY if both claims cannot simultaneously be true, or express directly opposing conclusions about the same subject (e.g. "bob paid back the loan" vs "bob still owes me money"). Mere differences in topic, tone, or detail are NOT contradictions. + +Respond with ONLY a valid JSON object: {"contradicts": true|false, "because": ""}. No markdown, no commentary.`, + SearchOverview: `You are a precise answer engine over a personal knowledge base. Given a question and numbered note excerpts, write a short standalone answer (3-6 sentences) grounded ONLY in those excerpts. Cite sources inline as [n] matching the excerpt numbers. If the excerpts do not contain enough information, say so plainly — never speculate. Plain prose, no markdown headers, no bullet lists unless comparing items.`, ExtractEntities: `You are a structured entity extractor for a personal knowledge base. Extract entities from the given content. diff --git a/internal/queue/queue.go b/internal/queue/queue.go index 146a240..9e7ceed 100644 --- a/internal/queue/queue.go +++ b/internal/queue/queue.go @@ -2218,3 +2218,226 @@ func (q *Queue) GetReferencedMedia(ctx context.Context) ([]string, error) { } return out, rows.Err() } + +// FollowupCandidate is one past intent-bearing note for a person. +type FollowupCandidate struct { + NotePath string + Content string + CreatedAt time.Time +} + +// FindFollowupCandidates locates done notes older than `before` that both +// mention the given person and contain any of the FTS keywords — the raw +// material for follow-up-never-completed detection. +func (q *Queue) FindFollowupCandidates(ctx context.Context, person string, keywords []string, before time.Time, excludePath string) ([]FollowupCandidate, error) { + if len(keywords) == 0 { + return nil, nil + } + variants, err := q.GetPersonVariants(ctx, person) + if err != nil { + return nil, err + } + parts := make([]string, len(keywords)) + for i, kw := range keywords { + parts[i] = `"` + strings.ReplaceAll(kw, `"`, "") + `"` + } + match := strings.Join(parts, " OR ") + + var out []FollowupCandidate + for _, variant := range variants { + rows, err := q.db.QueryContext(ctx, ` + SELECT DISTINCT j.note_path, j.content, j.created_at + FROM jobs j + JOIN entities e ON e.note_path = j.note_path + AND e.entity_type = 'person' AND LOWER(e.entity_value) = LOWER(?) + JOIN notes_fts f ON f.note_path = j.note_path AND notes_fts MATCH ? + WHERE j.status = 'done' AND j.created_at <= ? AND j.note_path != ? + ORDER BY j.created_at ASC LIMIT 5`, + variant, match, before.UTC().Format(time.RFC3339), excludePath) + if err != nil { + return out, err + } + for rows.Next() { + var c FollowupCandidate + var created string + var content sql.NullString + if err := rows.Scan(&c.NotePath, &content, &created); err != nil { + continue + } + c.Content = content.String + c.CreatedAt, _ = time.Parse(time.RFC3339, created) + out = append(out, c) + } + rows.Close() + } + return out, nil +} + +// PersonMentionedSince reports whether any note outside excludePaths +// mentions the person STRICTLY after `since` — evidence an intended +// follow-up actually happened. +func (q *Queue) PersonMentionedSince(ctx context.Context, person string, since time.Time, excludePaths ...string) (bool, error) { + excludes := make([]string, len(excludePaths)) + for i, p := range excludePaths { + excludes[i] = strings.ToLower(p) + } + variants, err := q.GetPersonVariants(ctx, person) + if err != nil { + return false, err + } + for _, variant := range variants { + rows, err := q.db.QueryContext(ctx, ` + SELECT DISTINCT j.note_path FROM jobs j + JOIN entities e ON e.note_path = j.note_path + WHERE e.entity_type = 'person' AND LOWER(e.entity_value) = LOWER(?) + AND j.created_at > ?`, variant, since.UTC().Format(time.RFC3339)) + if err != nil { + return false, err + } + if rowsContainsExcluded(rows, excludes) { + return true, nil + } + } + return false, nil +} + +// rowsContainsExcluded drains rows and reports whether ANY note_path is +// outside the exclude list. +func rowsContainsExcluded(rows *sql.Rows, excludes []string) bool { + defer rows.Close() + for rows.Next() { + var p string + if err := rows.Scan(&p); err != nil { + continue + } + lp := strings.ToLower(p) + excluded := false + for _, x := range excludes { + if lp == x { + excluded = true + break + } + } + if !excluded { + return true + } + } + return false +} + +// GetNoteContent returns the most recent stored content for a note path, +// falling back to the note's chunk text (chunks are written during ingest +// and survive any later pruning of job payloads). +func (q *Queue) GetNoteContent(ctx context.Context, notePath string) (string, error) { + var content sql.NullString + err := q.db.QueryRowContext(ctx, + `SELECT content FROM jobs WHERE note_path = ? AND content IS NOT NULL AND content != '' + ORDER BY created_at DESC LIMIT 1`, notePath).Scan(&content) + if err == nil && strings.TrimSpace(content.String) != "" { + return content.String, nil + } + err = q.db.QueryRowContext(ctx, + `SELECT content FROM chunks WHERE note_path = ? LIMIT 1`, notePath).Scan(&content) + if err != nil { + return "", err + } + return content.String, nil +} + +// FindNotePathByBaseName resolves an Obsidian-style wikilink basename +// ("2026-08-25-my-note-abc123") to its vault-relative note path. +func (q *Queue) FindNotePathByBaseName(ctx context.Context, base string) (string, error) { + var p sql.NullString + err := q.db.QueryRowContext(ctx, + `SELECT note_path FROM jobs WHERE note_path LIKE '%/' || ? || '.md' AND status='done' + ORDER BY created_at DESC LIMIT 1`, base).Scan(&p) + if err != nil { + return "", err + } + return p.String, nil +} + +// GetConnectionsResultByPath returns the stored result payload of the +// most recent connections job for a note path (nil when none ran). +func (q *Queue) GetConnectionsResultByPath(ctx context.Context, notePath string) (json.RawMessage, error) { + var result sql.NullString + err := q.db.QueryRowContext(ctx, + `SELECT result FROM jobs WHERE type='connections' AND note_path = ? AND result IS NOT NULL + ORDER BY created_at DESC LIMIT 1`, notePath).Scan(&result) + if err != nil { + return nil, err + } + return json.RawMessage(result.String), nil +} + +// GetPersonVariants returns every distinct person entity_value that +// fuzzy-matches the given name: case-insensitive equality, shared-prefix +// (Sara/Sarah, Dan/Daniel), or edit distance <= 1 (min length 4). Personal +// note collections routinely store name variants; person joins must treat +// them as the same human. +func (q *Queue) GetPersonVariants(ctx context.Context, name string) ([]string, error) { + rows, err := q.db.QueryContext(ctx, + `SELECT DISTINCT entity_value FROM entities WHERE entity_type = 'person' LIMIT 1000`) + if err != nil { + return nil, err + } + defer rows.Close() + + var out []string + for rows.Next() { + var v string + if err := rows.Scan(&v); err != nil { + continue + } + if personNameMatches(name, v) { + out = append(out, v) + } + } + return out, rows.Err() +} + +// personNameMatches decides whether two person-name spellings refer to the +// same human. +func personNameMatches(a, b string) bool { + a, b = strings.ToLower(strings.TrimSpace(a)), strings.ToLower(strings.TrimSpace(b)) + if a == "" || b == "" { + return false + } + if a == b { + return true + } + // shared prefix of at least 3 chars: "sara"~"sarah", "dan"~"daniel" + minLen := len(a) + if len(b) < minLen { + minLen = len(b) + } + if minLen >= 3 && (strings.HasPrefix(a, b) || strings.HasPrefix(b, a)) { + return true + } + // single edit for reasonably long names: "jeff"~"geoff" style typos + if minLen >= 4 && levenshtein(a, b) <= 1 { + return true + } + return false +} + +func levenshtein(a, b string) int { + ra, rb := []rune(a), []rune(b) + prev := make([]int, len(rb)+1) + cur := make([]int, len(rb)+1) + for j := range prev { + prev[j] = j + } + for i := 1; i <= len(ra); i++ { + cur[0] = i + for j := 1; j <= len(rb); j++ { + cost := 1 + if ra[i-1] == rb[j-1] { + cost = 0 + } + cur[j] = min(min(cur[j-1]+1, prev[j]+1), prev[j-1]+cost) + } + prev, cur = cur, prev + } + return prev[len(rb)] +} diff --git a/internal/queue/queue_test.go b/internal/queue/queue_test.go index 45d4731..31c34bb 100644 --- a/internal/queue/queue_test.go +++ b/internal/queue/queue_test.go @@ -1125,3 +1125,69 @@ func TestRemoveNote(t *testing.T) { } } } + +func TestGetPersonVariants(t *testing.T) { + tmpDir := t.TempDir() + q, err := NewQueue(filepath.Join(tmpDir, "test.db")) + if err != nil { + t.Fatal(err) + } + defer q.Close() + + ctx := context.Background() + seed := func(path, person string) { + j := &Job{ID: path, Type: "text", Status: "done", NotePath: path, CreatedAt: time.Now()} + if err := q.CreateJob(ctx, j); err != nil { + t.Fatal(err) + } + if err := q.SaveEntities(ctx, path, NoteEntities{People: []string{person}}); err != nil { + t.Fatal(err) + } + } + seed("a.md", "Sarah") + seed("b.md", "sara") + seed("c.md", "Bob") + seed("d.md", "Bobby") + seed("e.md", "Alice") + + t.Run("case-insensitive + prefix + edit-distance-1", func(t *testing.T) { + variants, err := q.GetPersonVariants(ctx, "Sara") + if err != nil { + t.Fatal(err) + } + set := map[string]bool{} + for _, v := range variants { + set[strings.ToLower(v)] = true + } + if !set["sarah"] || !set["sara"] { + t.Errorf("expected Sarah + sara, got %v", variants) + } + if set["bob"] || set["alice"] { + t.Errorf("unrelated names leaked: %v", variants) + } + }) + + t.Run("exact name returns itself", func(t *testing.T) { + variants, err := q.GetPersonVariants(ctx, "bob") + if err != nil { + t.Fatal(err) + } + lower := map[string]bool{} + for _, v := range variants { + lower[strings.ToLower(v)] = true + } + if !lower["bob"] { + t.Errorf("expected bob in %v", variants) + } + }) + + t.Run("unknown name yields nothing", func(t *testing.T) { + variants, err := q.GetPersonVariants(ctx, "Zephyr") + if err != nil { + t.Fatal(err) + } + if len(variants) != 0 { + t.Errorf("expected none, got %v", variants) + } + }) +} diff --git a/internal/vault/reader.go b/internal/vault/reader.go index 32f8cc0..4127e6d 100644 --- a/internal/vault/reader.go +++ b/internal/vault/reader.go @@ -35,6 +35,7 @@ type NoteContent struct { UserContext string `yaml:"user_context,omitempty"` Entities map[string]interface{} `yaml:"entities,omitempty"` Related []string `yaml:"related,omitempty"` + Connections []string `yaml:"connections,omitempty"` // Sections (parsed from markdown body) Title string @@ -94,6 +95,12 @@ func parseMarkdown(content []byte) (*NoteContent, error) { return nil, fmt.Errorf("failed to parse frontmatter: %w", err) } + // The proactive-connections block (written by SetConnections) is the + // same relationship data as related links — surface it either way. + if len(note.Related) == 0 && len(note.Connections) > 0 { + note.Related = note.Connections + } + // Parse markdown body sections body := string(parts[2]) parseSections(note, body) diff --git a/internal/vault/reader_test.go b/internal/vault/reader_test.go index 1e339e2..2bfc95d 100644 --- a/internal/vault/reader_test.go +++ b/internal/vault/reader_test.go @@ -148,3 +148,39 @@ Content in subdirectory. t.Errorf("expected title 'Subdir Note', got %q", note.Title) } } + +// The proactive-connections block is written as `connections:` by +// SetConnections; the reader must surface it through Related so the API +// (and PWA note view) can render linked notes. +func TestReader_ReadNote_ConnectionsFoldIntoRelated(t *testing.T) { + vaultPath := t.TempDir() + inboxPath := filepath.Join(vaultPath, "inbox") + os.MkdirAll(inboxPath, 0755) + + testNote := `--- +created: "2024-03-16T14:23:00Z" +type: text +connections: + - "[[2024-03-10-old-note]]" + - "[[2024-03-12-other-note]]" +--- + +# Connected Note + +## Summary +x +` + os.WriteFile(filepath.Join(inboxPath, "connected.md"), []byte(testNote), 0644) + + r := NewReader(vaultPath, "inbox") + note, err := r.ReadNote("inbox/connected.md") + if err != nil { + t.Fatal(err) + } + if len(note.Related) != 2 { + t.Fatalf("expected 2 related links, got %v", note.Related) + } + if note.Related[0] != "[[2024-03-10-old-note]]" { + t.Errorf("link content mismatch: %v", note.Related) + } +} diff --git a/internal/worker/worker.go b/internal/worker/worker.go index d63cb1f..33d8070 100644 --- a/internal/worker/worker.go +++ b/internal/worker/worker.go @@ -203,7 +203,11 @@ func (w *Worker) processJob(jobID string) { } now := time.Now().UTC() - job.NotePath = notePath + if notePath != "" || (job.Type != "connections" && job.Type != "memory") { + // Enricher jobs carry their note path from creation; never let an + // empty local overwrite the stored value. + job.NotePath = notePath + } job.Status = "done" job.ProcessedAt = &now job.Error = "" @@ -347,7 +351,13 @@ func (w *Worker) chainMemoryConsolidation(ingestJobID string) { // the note's frontmatter as Obsidian wikilinks. Only targets that exist on // disk become links (vault safety: never write broken wikilinks). func (w *Worker) processConnections(ctx context.Context, job *queue.Job) error { - conns, err := connections.Find(ctx, w.queue, job.NotePath, w.connCfg) + var checker connections.ContradictionChecker + if temp, ok := w.llm.(interface { + GenerateWithSystemTemp(system, user string, temperature float64) (string, error) + }); ok { + checker = temp + } + conns, err := connections.Find(ctx, w.queue, job.NotePath, w.connCfg, checker) if err != nil { return fmt.Errorf("connection engine failed: %w", err) } @@ -360,12 +370,17 @@ func (w *Worker) processConnections(ctx context.Context, job *queue.Job) error { } links := make([]string, 0, len(conns)) + linked := map[string]bool{} for _, c := range conns { base := filepath.Base(c.NotePath) if strings.EqualFold(base, strings.TrimSpace(w.memCfg.File)) { continue // never link the managed memory file } + if linked[c.NotePath] { + continue // one wikilink per target note, even if multiple types matched + } if w.vault.NoteExists(c.NotePath) { + linked[c.NotePath] = true links = append(links, c.NotePath) } else { w.logger.Warn("connection target missing on disk, skipping link",