From 5c2c51205e2e33fd8759aa87d8d6e5425d34f511 Mon Sep 17 00:00:00 2001 From: jidechao <408645320@qq.com> Date: Sun, 28 Jun 2026 16:31:44 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=EF=BB=BFfeat:=20add=20REST=20API=20server?= =?UTF-8?q?=20and=20Knowledge=20Workbench=20web=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a production-ready REST API (FastAPI) and a bundled React single-page app ("Knowledge Workbench") served at the same origin, so OpenKB can be driven from the browser, Postman, or other HTTP clients without the CLI. REST API (openkb/api.py): - Endpoints under /api/v1: /kbs, /init, /add, /query, /chat, /chat/sessions{,/load,/delete}, /list, /status, /lint, /remove, /recompile, /watch/{start,stop,status}, /watch/events (SSE) - Bearer-token auth, SSE streaming for query/chat/add/remove/recompile, multipart upload, and KB name resolution via OPENKB_KB_ROOT - Shared SSE event layer (iter_agent_response_events) reused by query/chat so the CLI and API emit identical event streams - Background file-watcher service (openkb/watch_service.py) for auto-compile Knowledge Workbench (frontend/, built to web/): - React + Vite dark three-pane workbench: Overview, Documents, Query, Chat, Maintenance, with a live retrieval/reasoning inspector timeline - Streamed answers, multi-turn chat with persisted sessions, drag-and-drop upload with per-file progress, lint/recompile/watch controls - Markdown via react-markdown + remark-gfm + rehype-highlight Also: initialize_kb inherits project-root config.yaml and .env (filtering OPENKB_* server vars) so a KB created from the UI runs out of the box; POSTMAN collection; README docs. --- .env.example | 7 + .gitignore | 1 + README.md | 503 ++- config.yaml.example | 4 +- frontend/.gitignore | 3 + frontend/index.html | 13 + frontend/package-lock.json | 3414 +++++++++++++++++++++ frontend/package.json | 23 + frontend/src/App.jsx | 81 + frontend/src/api/client.js | 79 + frontend/src/api/sse.js | 101 + frontend/src/components/EmptyState.jsx | 9 + frontend/src/components/Inspector.jsx | 34 + frontend/src/components/Markdown.jsx | 26 + frontend/src/components/SettingsModal.jsx | 52 + frontend/src/components/Sidebar.jsx | 101 + frontend/src/components/Spinner.jsx | 3 + frontend/src/components/Toast.jsx | 7 + frontend/src/hooks/useSSEStream.js | 45 + frontend/src/main.jsx | 13 + frontend/src/state/AppContext.jsx | 84 + frontend/src/styles.css | 345 +++ frontend/src/views/Chat.jsx | 161 + frontend/src/views/Documents.jsx | 139 + frontend/src/views/Maintenance.jsx | 175 ++ frontend/src/views/Overview.jsx | 111 + frontend/src/views/Query.jsx | 108 + frontend/vite.config.js | 22 + openkb-postman.json | 845 +++++ openkb/agent/chat.py | 56 +- openkb/agent/query.py | 53 + openkb/api.py | 1206 ++++++++ openkb/cli.py | 1031 +++++-- openkb/config.py | 65 + openkb/watch_service.py | 225 ++ openkb/watcher.py | 35 +- pyproject.toml | 4 +- tests/test_api.py | 1401 +++++++++ tests/test_api_watch.py | 175 ++ tests/test_remove.py | 83 + tests/test_watch_service.py | 193 ++ web/assets/index-B95kof3N.js | 171 ++ web/assets/index-I-GkV6Af.css | 1 + web/index.html | 14 + 44 files changed, 10985 insertions(+), 237 deletions(-) create mode 100644 frontend/.gitignore create mode 100644 frontend/index.html create mode 100644 frontend/package-lock.json create mode 100644 frontend/package.json create mode 100644 frontend/src/App.jsx create mode 100644 frontend/src/api/client.js create mode 100644 frontend/src/api/sse.js create mode 100644 frontend/src/components/EmptyState.jsx create mode 100644 frontend/src/components/Inspector.jsx create mode 100644 frontend/src/components/Markdown.jsx create mode 100644 frontend/src/components/SettingsModal.jsx create mode 100644 frontend/src/components/Sidebar.jsx create mode 100644 frontend/src/components/Spinner.jsx create mode 100644 frontend/src/components/Toast.jsx create mode 100644 frontend/src/hooks/useSSEStream.js create mode 100644 frontend/src/main.jsx create mode 100644 frontend/src/state/AppContext.jsx create mode 100644 frontend/src/styles.css create mode 100644 frontend/src/views/Chat.jsx create mode 100644 frontend/src/views/Documents.jsx create mode 100644 frontend/src/views/Maintenance.jsx create mode 100644 frontend/src/views/Overview.jsx create mode 100644 frontend/src/views/Query.jsx create mode 100644 frontend/vite.config.js create mode 100644 openkb-postman.json create mode 100644 openkb/api.py create mode 100644 openkb/watch_service.py create mode 100644 tests/test_api.py create mode 100644 tests/test_api_watch.py create mode 100644 tests/test_watch_service.py create mode 100644 web/assets/index-B95kof3N.js create mode 100644 web/assets/index-I-GkV6Af.css create mode 100644 web/index.html diff --git a/.env.example b/.env.example index bda78e3d6..e0068c1fb 100644 --- a/.env.example +++ b/.env.example @@ -4,3 +4,10 @@ # Gemini: LLM_API_KEY=AIza... # DeepSeek: LLM_API_KEY=sk-... LLM_API_KEY=your-key-here + +# Optional base URL override for OpenAI-compatible gateways +# OPENAI_API_BASE=https://api.deepseek.com + +# --- REST API server variables (read by `openkb-api` / `python -m openkb.api`) --- +# OPENKB_API_TOKEN=... # required bearer token clients send as Authorization: Bearer +# OPENKB_KB_ROOT=... # optional; where REST /init creates KBs (default: ~/.config/openkb/kbs) diff --git a/.gitignore b/.gitignore index c448d2758..28f24bb59 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ raw/ wiki/ .openkb/ output/ +kbs/ # Local only docs/ diff --git a/README.md b/README.md index 0fecbe114..333d91f99 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ # OpenKB: Open LLM Knowledge Base -

Scale to long documents  •  Reasoning-based retrieval  •  Native multi-modality  •  No Vector DB

+

Scale to long documents • Reasoning-based retrieval • Native multi-modality • No Vector DB

@@ -49,6 +49,7 @@ OpenKB has two layers: a **wiki foundation** that compiles and maintains your kn - **Skill Factory:** Distills redistributable agent skills from your wiki. - **OKF-ready:** Wiki pages follow the [Google OKF](https://cloud.google.com/blog/products/data-analytics/how-the-open-knowledge-format-can-improve-data-sharing) specification for knowledge sharing. - **Obsidian-compatible:** The wiki is plain `.md` files with cross-links. Opens in Obsidian for graph view. +- **Knowledge Workbench (Web UI):** A bundled React SPA served at `/` turns the REST API into a full dark-themed three-pane workbench — browse stats, upload & compile documents, stream queries/chats with a live reasoning timeline, and run maintenance, all in the browser. No separate frontend server needed. # 🚀 Getting Started @@ -62,13 +63,13 @@ pip install openkb Other install options: - **Latest from GitHub:** - + ```bash pip install git+https://github.com/VectifyAI/OpenKB.git ``` - **Install from source** (editable, for development): - + ```bash git clone https://github.com/VectifyAI/OpenKB.git cd OpenKB @@ -115,6 +116,40 @@ Create a `.env` file with your LLM API key: LLM_API_KEY=your_llm_api_key ``` +### Knowledge Workbench (Web UI) + +OpenKB ships a bundled React single-page app — the **Knowledge Workbench** — served directly by the REST server at `/`, so you get a full browser interface with no separate frontend process. + +```bash +# 1. build front web +cd frontend/ +npm install +npm run build + +# back project root +cd .. + +# 2. Set server variables (in .env or your shell) +OPENKB_API_TOKEN=test-token # bearer token the browser sends +OPENKB_KB_ROOT=/path/to/kbs # where REST /init creates KBs + +OR Edit .env and config.yaml + +# 3. Install with the API extra and start the server +pip install -e ".[api]" +python -m openkb.api --host 127.0.0.1 --port 8000 # serves the API + Workbench at http://127.0.0.1:8000/ +``` + +Open `http://127.0.0.1:8000/` in your browser. On first launch a **Connection Settings** dialog asks for the API base (leave blank for same-origin) and the bearer token. The Workbench then provides: + +- **Overview** — index/concept/summary/report stat cards, clickable concept chips, recent documents, and last-compile/lint activity. +- **Documents** — drag-and-drop multi-file upload with per-file SSE progress, hash table, and delete with confirmation. +- **Query** — streamed answers with `tool_call` reasoning shown live in the right-pane timeline; GFM Markdown rendering (bold, tables, code, etc.). +- **Chat** — multi-turn streaming with a persisted session list: load history, resume a session, delete it. +- **Maintenance** — lint (with optional auto-fix), recompile (all or single doc, SSE log), and a file-watcher toggle. + +A right-pane **Inspector** timeline shows the vectorless retrieval & reasoning steps for every streamed operation. Creating a new KB from the Workbench inherits the project-root `config.yaml` and LLM credentials (`.env`) so it runs queries out of the box. The UI is responsive — on narrow screens the three panes collapse to a single column with a hamburger nav. + # 🧩 How OpenKB Works ### Architecture @@ -125,12 +160,12 @@ LLM_API_KEY=your_llm_api_key ### Short vs Long Document Handling -| | Short documents | Long documents (PDF ≥ 20 pages) | -|---|---|---| -| **Convert** | markitdown → Markdown | PageIndex → tree index + summaries | -| **Images** | Extracted inline (pymupdf) | Extracted by PageIndex | -| **LLM reads** | Full text | Document trees | -| **Result** | summary + concepts | summary + concepts | +| | Short documents | Long documents (PDF ≥ 20 pages) | +| ------------- | -------------------------- | ---------------------------------- | +| **Convert** | markitdown → Markdown | PageIndex → tree index + summaries | +| **Images** | Extracted inline (pymupdf) | Extracted by PageIndex | +| **LLM reads** | Full text | Document trees | +| **Result** | summary + concepts | summary + concepts | Short documents are read in full by the LLM. Long PDFs are processed by [PageIndex](https://github.com/VectifyAI/PageIndex) into a hierarchical tree index. The LLM reads the tree instead of the full text, enabling accurate and scalable retrieval for long documents. @@ -152,24 +187,24 @@ OpenKB commands fall into two layers: the **wiki foundation** (compile + manage ## Layer 1: 🧱 Wiki Foundation — compile and maintain -| Command | Description | -|---|---| -| `openkb init` | Initialize a new knowledge base (interactive) | +| Command | Description | +| ------------------------------------------------------------ | --------------------------------------------------------------------------------------- | +| `openkb init` | Initialize a new knowledge base (interactive) | | openkb add <file_or_dir_or_URL> | Add files, directories, or URLs and compile to wiki (URL content type is auto-detected) | -| `openkb list` | List indexed documents and concepts | -| `openkb status` | Show knowledge base stats | -| `openkb watch` | Watch `raw/` and auto-compile new files | -| `openkb lint` | Run structural and knowledge health checks | +| `openkb list` | List indexed documents and concepts | +| `openkb status` | Show knowledge base stats | +| `openkb watch` | Watch `raw/` and auto-compile new files | +| `openkb lint` | Run structural and knowledge health checks |
More wiki commands:
-| Command | Description | -|---|---| -| openkb remove <doc> | Remove a document and clean up its wiki pages, images, registry, and PageIndex state (`--dry-run` to preview, `--keep-raw` / `--keep-empty` to retain artifacts) | +| Command | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| openkb remove <doc> | Remove a document and clean up its wiki pages, images, registry, and PageIndex state (`--dry-run` to preview, `--keep-raw` / `--keep-empty` to retain artifacts) | | openkb recompile [<doc>] [--all] | Re-run the compile pipeline on already-indexed docs without re-indexing. Regenerates summaries and rewrites concept pages; manual edits are overwritten (`--dry-run` to preview, `--refresh-schema` to also update `wiki/AGENTS.md`) | -| openkb feedback ["msg"] | File feedback by opening a prefilled GitHub issue (`--type bug/feature/question` to tag it) | +| openkb feedback ["msg"] | File feedback by opening a prefilled GitHub issue (`--type bug/feature/question` to tag it) |
@@ -179,23 +214,23 @@ OpenKB commands fall into two layers: the **wiki foundation** (compile + manage A "generator" reads from the compiled wiki and produces something usable: an answer, a conversation, a skill folder. The wiki is the substrate; generators are the surfaces. -| Command | Output | Example | -|---|---|---| -| openkb query "question" | A grounded answer with citations (`--save` to persist to `wiki/explorations/`) | [query & save](examples/commands/) | -| openkb chat | Interactive multi-turn session over the wiki (`--resume`, `--list`, `--delete` to manage sessions) | [chat](examples/chat/) | -| openkb visualize | A self-contained interactive knowledge graph at `output/visualize/graph.html` — 3D, mind-map, and radial views | [visualize](examples/visualize/) | -| openkb skill new <skill-name> "<intent>" | Distill a redistributable agent skill from your wiki (see [Skill Factory](#skill-factory) below) | [skills](examples/skills/) | -| openkb deck new <name> "<intent>" | Generate a single-file HTML slide deck (`--skill` picks a theme, `--critique` runs a quality pass) | [slides](examples/slides/) | +| Command | Output | Example | +| ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ---------------------------------- | +| openkb query "question" | A grounded answer with citations (`--save` to persist to `wiki/explorations/`) | [query & save](examples/commands/) | +| openkb chat | Interactive multi-turn session over the wiki (`--resume`, `--list`, `--delete` to manage sessions) | [chat](examples/chat/) | +| openkb visualize | A self-contained interactive knowledge graph at `output/visualize/graph.html` — 3D, mind-map, and radial views | [visualize](examples/visualize/) | +| openkb skill new <skill-name> "<intent>" | Distill a redistributable agent skill from your wiki (see [Skill Factory](#skill-factory) below) | [skills](examples/skills/) | +| openkb deck new <name> "<intent>" | Generate a single-file HTML slide deck (`--skill` picks a theme, `--critique` runs a quality pass) | [slides](examples/slides/) |
More skill commands:
-| Command | Output | -|---|---| -| openkb skill validate [name] | Validate compiled skills (auto-runs after `skill new`) | -| openkb skill eval <name> | Check the skill triggers on the right prompts | -| openkb skill history <name> / openkb skill rollback <name> | Version history + rollback for skills | +| Command | Output | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------ | +| openkb skill validate [name] | Validate compiled skills (auto-runs after `skill new`) | +| openkb skill eval <name> | Check the skill triggers on the right prompts | +| openkb skill history <name> / openkb skill rollback <name> | Version history + rollback for skills |
@@ -299,19 +334,403 @@ gemini skills install https://github.com/VectifyAI/OpenKB.git --path skills/open The skill is read-only. It won't run `openkb add`, `remove`, or `lint --fix` without you asking. See [`skills/openkb/SKILL.md`](skills/openkb/SKILL.md) for the full instruction set. +# REST API + +OpenKB also ships a FastAPI service for using a knowledge base from Postman, +frontends, or other HTTP clients. + +Install the API dependencies if needed: + +```bash +pip install -e ".[api]" +``` + +Start the API server: + +```powershell +$env:OPENKB_API_TOKEN="test-token" +$env:OPENKB_KB_ROOT="D:\project\OpenKB\kbs" +.\.venv\Scripts\python.exe -m openkb.api --host 127.0.0.1 --port 8000 +``` + +### Authentication and common behavior + +`OPENKB_API_TOKEN` is required. Send it on every request: + +```text +Authorization: Bearer test-token +``` + +`OPENKB_KB_ROOT` is optional. It controls where REST-created knowledge bases +are stored. If unset, OpenKB uses `~/.config/openkb/kbs`. + +REST clients identify a knowledge base with `kb`, not a filesystem path. For +example, `postman-kb` resolves to `$OPENKB_KB_ROOT/postman-kb`. + +Common status codes across all endpoints: + +- `200` — success. +- `400` — invalid request body, unknown `kb`, or a KB that isn't an OpenKB dir + (missing `.openkb/` or `wiki/`). +- `401` — missing or wrong bearer token. +- `404` — referenced document/watcher not found (remove/recompile/watch-stop). +- `409` — ambiguous identifier (remove/recompile) with `candidates` in `detail`. +- `500` — server error, or `OPENKB_API_TOKEN` not configured on the server. + +All JSON endpoints use `Content-Type: application/json`. `/api/v1/add` is the +only `multipart/form-data` endpoint. + +### Streaming (SSE) + +Endpoints that accept `"stream": true` (`query`, `chat`, `remove`, `recompile`), +plus `add` (via a `stream` form field) and `watch/events` (always), return +Server-Sent Events (`Content-Type: text/event-stream`). Each frame is: + +```text +event: +data: +``` + +SSE event names: + +- `start` — stream opened; `data` includes the `endpoint`. +- `delta` — incremental answer text (query/chat), `{"text": "..."}`. +- `tool_call` — agent tool invocation (query/chat), with the call details. +- `uploaded` / `file_start` / `file_done` — per-file progress (add). +- `plan` — execution plan (remove: full plan; recompile: target list). +- `progress` — stage progress (remove: `wiki_cleanup`). +- `doc` — one document recompiled (recompile stream). +- `final` — terminal success payload (matches the non-streaming JSON body). +- `error` — failure, `{"message": "..."}` (may carry `code` for remove). +- `done` — stream closed; always emitted last. + +### Endpoints + +All endpoints are under `/api/v1`. + +| Method | Path | Body | Streams | Purpose | +| ------ | ----------------------- | ------------ | -------- | -------------------------------------- | +| GET | `/kbs` | — | no | List knowledge bases under the KB root | +| POST | `/init` | JSON | no | Create a knowledge base | +| POST | `/add` | multipart | optional | Upload + compile documents | +| POST | `/query` | JSON | yes | Ask a one-shot question | +| POST | `/chat` | JSON | yes | Multi-turn chat session | +| POST | `/chat/sessions` | JSON | no | List persisted chat sessions | +| POST | `/chat/sessions/load` | JSON | no | Load a session's history | +| POST | `/chat/sessions/delete` | JSON | no | Delete a session | +| POST | `/list` | JSON | no | List documents, summaries, concepts | +| POST | `/status` | JSON | no | KB directory/index stats | +| POST | `/lint` | JSON | no | Structural + semantic lint report | +| POST | `/remove` | JSON | yes | Remove a document + cleanup | +| POST | `/recompile` | JSON | yes | Recompile one or all docs | +| POST | `/watch/start` | JSON | no | Start a filesystem watcher | +| POST | `/watch/stop` | JSON | no | Stop a watcher | +| POST | `/watch/status` | JSON | no | Watcher status + recent events | +| GET | `/watch/events` | query params | always | SSE feed of watcher events | + +#### Initialize a KB + +```http +POST /api/v1/init +Content-Type: application/json +Authorization: Bearer test-token +``` + +Request (`InitRequest`): + +| Field | Type | Required | Default | Notes | +| ----------------- | ------ | -------- | ------- | ----------------------------- | +| `kb` | string | yes | — | new KB name | +| `model` | string | no | `null` | LLM model override | +| `api_key` | string | no | `null` | written to KB-local `.env` | +| `openai_api_base` | string | no | `null` | OpenAI-compatible gateway URL | + +`api_key` and `openai_api_base` are written to the KB-local `.env` when the KB +is created; secret values are not echoed back in the response. + +When `model`, `api_key`, and `openai_api_base` are all omitted (the Workbench's +default), the new KB inherits the operator's project-root `config.yaml` and LLM +credentials from the server's working-directory `.env` (server-level `OPENKB_*` +vars are filtered out), so a KB created from the UI runs queries out of the box. + +Response (`InitResponse`, `200`): `kb` (string), `created` (bool, `false` if the +KB already existed), `env_written` (`{api_key: bool, openai_api_base: bool}`), +`message` (string). Errors: `400` invalid/existing KB, `500` other. + +#### Add Documents + +```http +POST /api/v1/add +Authorization: Bearer test-token +``` + +`multipart/form-data`: + +| Field | Type | Value | +| -------- | ---- | --------------------- | +| `kb` | Text | `postman-kb` | +| `stream` | Text | `true` or `false` | +| `files` | File | one or more documents | + +Supported types match the CLI: `.pdf`, `.md`, `.markdown`, `.docx`, `.pptx`, +`.xlsx`, `.xls`, `.html`, `.htm`, `.txt`, `.csv`. `stream: true` emits per-file +SSE events (`uploaded`, `file_start`, `file_done`, `final`); `stream: false` +returns one JSON body. `400` if no files are uploaded. + +Response (`AddResponse`, `200`): `kb`, `files` (each +`{original_name, saved_path, status, message}`), `added_count`, `skipped_count` +(already indexed), `failed_count`. + +#### Query + +```http +POST /api/v1/query +Content-Type: application/json +Authorization: Bearer test-token +``` + +Request (`QueryRequest`): + +| Field | Type | Required | Default | Notes | +| ---------- | ------ | -------- | ------- | ------------------------------------ | +| `kb` | string | yes | — | | +| `question` | string | yes | — | | +| `stream` | bool | no | `true` | SSE vs single JSON | +| `save` | bool | no | `false` | write answer to `wiki/explorations/` | + +Non-streaming response (`QueryResponse`, `200`): `answer` (string), `saved_path` +(string\|null, set when `save: true`). Stream events: `start`, `delta`, +`tool_call`, `final` (`{answer, saved_path}`), `error`, `done`. `500` on failure. + +#### Chat + +```http +POST /api/v1/chat +Content-Type: application/json +Authorization: Bearer test-token +``` + +Request (`ChatRequest`): + +| Field | Type | Required | Default | Notes | +| ------------ | ------ | -------- | ------- | -------------------------- | +| `kb` | string | yes | — | | +| `message` | string | yes | — | | +| `session_id` | string | no | `null` | resume an existing session | +| `stream` | bool | no | `true` | SSE vs single JSON | + +Non-streaming response (`ChatResponse`, `200`): `session_id` (pass back to +continue), `answer`, `turn_count` (total turns in the session). Stream events: +`start` (includes `session_id`), `delta`, `tool_call`, `final`, `error`, `done`. + +#### Chat Sessions + +List, load, or delete persisted multi-turn sessions for a KB. These power the +session sidebar in the Workbench. + +```http +POST /api/v1/chat/sessions +Authorization: Bearer test-token +``` + +Request (`KbRequest`): `{ "kb": "postman-kb" }`. +Response (`ChatSessionListResponse`): `{ "kb", "sessions": [{ id, title, turn_count, updated_at, model }] }`, +ordered by `updated_at` descending. + +```http +POST /api/v1/chat/sessions/load +Authorization: Bearer test-token +``` + +Request (`ChatSessionLoadRequest`): `{ "kb", "session_id" }`. +Response (`ChatSessionLoadResponse`): `{ session_id, title, turn_count, user_turns: [...], assistant_texts: [...] }`. +Clients interleave `user_turns` and `assistant_texts` to render the history. +`404` if the session does not exist. + +```http +POST /api/v1/chat/sessions/delete +Authorization: Bearer test-token +``` + +Request (`ChatSessionDeleteRequest`): `{ "kb", "session_id" }`. +Response (`ChatSessionDeleteResponse`): `{ deleted: true }`. Returns `404` if not found. + +#### List + +```http +POST /api/v1/list +Content-Type: application/json +Authorization: Bearer test-token +``` + +Request (`KbRequest`): `kb`. + +Response (`ListResponse`, `200`): `documents` +(`[{hash, name, type, display_type, pages}]`), `document_count`, `summaries`, +`concepts`, `reports` (lists of page names). + +#### Status + +```http +POST /api/v1/status +Content-Type: application/json +Authorization: Bearer test-token +``` + +Request (`KbRequest`): `kb`. + +Response (`StatusResponse`, `200`): `directories` (per-folder file counts), +`raw_count`, `total_indexed`, `last_compile` and `last_lint` (ISO timestamps or +`null`). + +#### Lint + +```http +POST /api/v1/lint +Content-Type: application/json +Authorization: Bearer test-token +``` + +Request (`LintRequest`): + +| Field | Type | Required | Default | Notes | +| ----- | ------ | -------- | ------- | ------------------------------------------ | +| `kb` | string | yes | — | | +| `fix` | bool | no | `false` | rewrite/strip broken `[[wikilinks]]` first | + +When `fix: true`, broken wikilinks are rewritten/stripped under the KB ingest +lock (mirroring `openkb lint --fix`) before the report runs, so the report +reflects the post-fix state. The semantic lint is a multi-turn LLM agent run, so +the response can take tens of seconds to minutes regardless of `fix`; the `fix` +pass itself is a local, millisecond file rewrite. + +Response (`LintResponse`, `200`): + +| Field | Type | Notes | +| --------------------- | ------------ | ------------------------------------------- | +| `skipped` | bool | `true` when no documents are indexed | +| `reason` | string\|null | e.g. `no_documents_indexed` | +| `message` | string | status + fix summary when `fix: true` | +| `structural_report` | string\|null | local structural lint markdown | +| `knowledge_report` | string\|null | LLM semantic lint markdown | +| `report_path` | string\|null | report under `wiki/reports/` | +| `lint_files_changed` | int\|null | files rewritten by `fix` (else `null`) | +| `lint_ghosts_removed` | int\|null | ghost links stripped by `fix` (else `null`) | + +#### Remove Documents + +Remove a document and clean up its wiki pages, images, registry, and PageIndex +state, the same pipeline as `openkb remove`. + +```http +POST /api/v1/remove +Content-Type: application/json +Authorization: Bearer test-token +``` + +Request (`RemoveRequest`): + +| Field | Type | Required | Default | Notes | +| ------------ | ------ | -------- | ------- | --------------------------------------- | +| `kb` | string | yes | — | | +| `identifier` | string | yes | — | filename, `doc_name` slug, or substring | +| `keep_raw` | bool | no | `false` | keep the source file | +| `keep_empty` | bool | no | `false` | keep now-empty concept/entity pages | +| `dry_run` | bool | no | `false` | preview only | +| `stream` | bool | no | `false` | SSE vs single JSON | + +Response (`RemoveResponse`, `200`): `status` (`removed`, `partial`, `dry_run`), +`name`, `doc_name`, `actions` (each `{tag, target}`), `concepts_deleted`, +`entities_deleted`, `lint_files_changed` and `lint_ghosts_removed` (scoped +`lint --fix` counts after removal), `pageindex_message`/`pageindex_error`, +`message`, `candidates`. Errors: `404` no match, `409` multiple matches (with +`candidates`). Stream events: `start`, `plan`, `progress`, `final`, `error`, +`done`. + +#### Recompile + +Re-compile one or all documents, mirroring `openkb recompile`. + +```http +POST /api/v1/recompile +Content-Type: application/json +Authorization: Bearer test-token +``` + +Request (`RecompileRequest`): + +| Field | Type | Required | Default | Notes | +| ---------------- | ------ | -------- | ------- | --------------------------------- | +| `kb` | string | yes | — | | +| `doc_name` | string | no | `null` | one doc; omit with `all_docs` | +| `all_docs` | bool | no | `false` | recompile every document | +| `dry_run` | bool | no | `false` | preview only | +| `refresh_schema` | bool | no | `false` | re-extract PageIndex schema first | +| `stream` | bool | no | `false` | SSE vs single JSON | + +Response (`RecompileResponse`, `200`): `status` (`done`), `total`, `recompiled`, +`skipped`, `docs` (each `{name, doc_name, type, status, elapsed, message}`), +`targets`/`candidates` (present for plans/ambiguity). Errors: `404` no match, +`409` ambiguous (with `candidates`), `500` otherwise. Stream events: `start`, +`plan` (`{targets}`), `doc` (per-document result), `final`, `error`, `done`. + +#### Watch (auto-compile on file change) + +Start/stop/inspect a filesystem watcher that auto-compiles files dropped into +`raw/` (same as `openkb watch`), plus an SSE feed of watcher events. + +```http +POST /api/v1/watch/start +POST /api/v1/watch/stop +POST /api/v1/watch/status +GET /api/v1/watch/events +Content-Type: application/json +Authorization: Bearer test-token +``` + +`watch/start` (`WatchStartRequest`): `kb`, `debounce` (seconds, default `2.0`, +must be `> 0`). `watch/stop` and `watch/status` take only `kb`. + +```json +{ "kb": "postman-kb", "debounce": 2.0 } +``` + +All three return `WatchStatusResponse`: `kb`, `active` (bool), `started_at` +(epoch or `null`), `raw_dir`, `debounce`, `counters` (`{added, updated, failed, +...}`), `recent_events` (`[{ts, event, data}]`). `watch/stop` returns `404` if +no watcher is active for that KB. + +`GET /api/v1/watch/events` is always SSE. Query params: `kb` (required), +`max_events` (int, `>=1`, stop after N events), `timeout_seconds` (float, `>=0`, +stop after this many seconds). Stream events: `start`, the watcher's own events +(e.g. `added`, `updated`, `failed`, `final`), `error`, `done`. + +A Postman collection is included at [`openkb-postman.json`](openkb-postman.json). + +### Postman Tips + +- For JSON endpoints, choose **Body -> raw -> JSON** and set + `Content-Type: application/json`. +- For `/api/v1/add`, choose **Body -> form-data**. Set `files` to type + **File** and let Postman generate the multipart `Content-Type`. +- For `GET /api/v1/watch/events`, put `kb`, `max_events`, and `timeout_seconds` + in **Params**, not the body. +- Verify non-streaming requests first with `"stream": false`, then test SSE + streaming once the JSON path works. + # 🧭 Learn More ### Compared to Karpathy's Approach -| | Karpathy's workflow | OpenKB | -|---|---|---| -| Short documents | LLM reads directly | markitdown → LLM reads | -| Long documents | Context limits, context rot | PageIndex tree index | -| Input sources | Web clipper → .md | PDF, Word, PPT, Excel, HTML, text, CSV, .md, URLs | -| Wiki compilation | LLM agent | LLM agent (same) | -| Entity extraction | Manual | Automatic (people, orgs, places, products) | -| Q&A | Query over wiki | Wiki + PageIndex retrieval | -| Output | Wiki only | Wiki + Skill Factory + agent CLI integration | +| | Karpathy's workflow | OpenKB | +| ----------------- | --------------------------- | ------------------------------------------------- | +| Short documents | LLM reads directly | markitdown → LLM reads | +| Long documents | Context limits, context rot | PageIndex tree index | +| Input sources | Web clipper → .md | PDF, Word, PPT, Excel, HTML, text, CSV, .md, URLs | +| Wiki compilation | LLM agent | LLM agent (same) | +| Entity extraction | Manual | Automatic (people, orgs, places, products) | +| Q&A | Query over wiki | Wiki + PageIndex retrieval | +| Output | Wiki only | Wiki + Skill Factory + agent CLI integration | ### The Stack @@ -328,7 +747,7 @@ The skill is read-only. It won't run `openkb add`, `remove`, or `lint --fix` wit - [ ] Scale to large document collections with nested folder support - [ ] Hierarchical concept (topic) indexing for massive knowledge bases - [ ] Database-backed storage engine -- [ ] Web UI for browsing and managing wikis +- [x] Web UI for browsing and managing wikis (Knowledge Workbench, served at `/`) ### Contributing diff --git a/config.yaml.example b/config.yaml.example index eebf3bf64..df239c6a4 100644 --- a/config.yaml.example +++ b/config.yaml.example @@ -1,5 +1,5 @@ -model: gpt-5.4 # LLM model (any LiteLLM-supported provider) -language: en # Wiki output language +model: openai/deepseek-v4-flash # LLM model (any LiteLLM-supported provider) +language: zh # Wiki output language pageindex_threshold: 20 # PDF pages threshold for PageIndex # Optional: override the entity-type vocabulary used for entity pages. diff --git a/frontend/.gitignore b/frontend/.gitignore new file mode 100644 index 000000000..804bd4a4a --- /dev/null +++ b/frontend/.gitignore @@ -0,0 +1,3 @@ +node_modules +dist +*.local diff --git a/frontend/index.html b/frontend/index.html new file mode 100644 index 000000000..eec773b38 --- /dev/null +++ b/frontend/index.html @@ -0,0 +1,13 @@ + + + + + + OpenKB · 知识工作台 + + + +
+ + + \ No newline at end of file diff --git a/frontend/package-lock.json b/frontend/package-lock.json new file mode 100644 index 000000000..35230a481 --- /dev/null +++ b/frontend/package-lock.json @@ -0,0 +1,3414 @@ +{ + "name": "openkb-web", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "openkb-web", + "version": "0.1.0", + "dependencies": { + "lucide-react": "^0.469.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "react-markdown": "^9.0.1", + "rehype-highlight": "^7.0.1", + "remark-gfm": "^4.0.0" + }, + "devDependencies": { + "@vitejs/plugin-react": "^4.3.4", + "vite": "^6.0.7" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.29.7", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz", + "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz", + "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.7", + "@babel/helper-compilation-targets": "^7.29.7", + "@babel/helper-module-transforms": "^7.29.7", + "@babel/helpers": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/template": "^7.29.7", + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.7.tgz", + "integrity": "sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz", + "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.29.7", + "@babel/helper-validator-option": "^7.29.7", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz", + "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz", + "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz", + "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7", + "@babel/traverse": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz", + "integrity": "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz", + "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.7.tgz", + "integrity": "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz", + "integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.7" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-self": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.29.7.tgz", + "integrity": "sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-source": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.29.7.tgz", + "integrity": "sha512-06IyK09H3wi4cGbhDBwp5gUGo0IKtnYa8tyTiephirPCK6fbobVGiXMMI5zLQ4aKEYP3wZ3ArU44o+8KMrSG/Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz", + "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.7.tgz", + "integrity": "sha512-EhlfNQtZ+NK22w5BM61ciuiq1m58ed33Wr1Xan//ZRTy6hgjnwyCffRYwzsGXdASJSUJ1guZILsErh1eQcl+zw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.7", + "@babel/helper-globals": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.7", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz", + "integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", + "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", + "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", + "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", + "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", + "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", + "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", + "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", + "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", + "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", + "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", + "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", + "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", + "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", + "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", + "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", + "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", + "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", + "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", + "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", + "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", + "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", + "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", + "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", + "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", + "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", + "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.0-beta.27", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz", + "integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.62.2.tgz", + "integrity": "sha512-6o7ZLZK+BeenkZCFNDXqpbjw9bD6nuWonvS/lwQJp7NoVVxm6p3qE7qQ5jGuBjiFsgvqjD8mZAU5oWxTmbOeOg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.62.2.tgz", + "integrity": "sha512-BaH7BllCACHoH1LguOU56UItGfUWjujlO65kS9LAodViaN4bwIKd7oeW/ZHJ/4ljr/7MIiENnNy3HJ0zXv8Zkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.62.2.tgz", + "integrity": "sha512-v39RCCvj4He82I9sFmk+M1VZ0PLM9sfsLVikjfx2hYBNALhrrOR2D3JjQA6AhlaSOgcR+RzrKY7e1+bT6SUO/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.62.2.tgz", + "integrity": "sha512-yl0y2vq3S3lHeuXhEdss6TWfKW8vkujImO12tn4ZkG/4oghr09LvdYm2RElVjokTQiUvDUGXLGsYeLqUMCKpGA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.62.2.tgz", + "integrity": "sha512-tT4pvt4qXD+vEoezupCWi+a1F0vvDiksiHc+PxRlYTOH1I6/X4id9jPxTP+Fg+545euaFT1jJVs4CEdHZAU1vw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.62.2.tgz", + "integrity": "sha512-6nU5F2wCW+qvCBhTn1pdIU3bzsIoF7EUwsCDRxilWGprQR6yd508YnH9+OKFCwpfS8pjZqDUmnCAr7exax0XCg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.62.2.tgz", + "integrity": "sha512-n1GJHPOvpIfhi3TmrCeh6S6URt9BFCt0KQE3qvexyGCTAKpR4Lg+eWvNZEqu7epxwus/8ElT3hacYEucm49SZg==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.62.2.tgz", + "integrity": "sha512-JqgflS8wEB+UXV/vS1RpRbifGBeN4D5lz8D8oOFbFZw4vedvdOgCFAjfBmIMdW3yL10XpQQ0Ambepw6MXrhOnA==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.62.2.tgz", + "integrity": "sha512-wnFJkogWvN4jm/hQRF2UBaeUmk20j5+DmHvoyWii2b8HJDyvz1MF2OU/6ynXt2KR63rbZLWkFpoytpdc/yBuSA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.62.2.tgz", + "integrity": "sha512-HVu2bp0zhvJ8xHEV9+UUs7S90VadmBSY3LcIMvozbPo4AuMGDWlz3ymHLHZPX4hR67TKTt8Qp5PJ5RBg/i+RMQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.62.2.tgz", + "integrity": "sha512-mQqqAV8QaoSgr9I2fKDLY2BAVvmKjWoGiu/cSYQonsLvtqwEn1E4QYfnCOcp5zoEqNhsDYin1s6jx/VJmrxlZg==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.62.2.tgz", + "integrity": "sha512-IxKLoxCQ2IWi6bT2akyDUBGsOImDKB+sPp4EsTmwFQ/fMwpCKm8uLSSgP/Kx/QYUgKis6SEZ5/Nlhup0DIA0PQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.62.2.tgz", + "integrity": "sha512-Mk5ha2RQSgyFfmYYLkBpPnUk8D8FriBxesO1u9O75X0mHgXL1UQcH5Itl2lurWL2tj0RxV9b9tJgipac0hRY9A==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.62.2.tgz", + "integrity": "sha512-CjvEnqJL/0/TQ3TXX3OPIJ/kmBellrWd4heXUmHeJlTnmwjKpSJzoehLaL6Xk0ZnMHBu9dZuFADNOrtjF4v+2w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.62.2.tgz", + "integrity": "sha512-1SiZbzwdkaDURsew/tSOrooKiYy7EQGT6m8ufavAi9NEyQb/6VuIxFXAL1fqa4iZe3g4NbNk4P7J32z2tw5Mgg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.62.2.tgz", + "integrity": "sha512-nQts12zJ3NQRoE6uYljOH89v7szzLDvG2JD/vsX+vGXU8w/At1GowTZ5/7qeFQ8m7L55rpR8Okugnuo5bgjy2Q==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.62.2.tgz", + "integrity": "sha512-E9/ll019jhPIJgpzfZoIkBGhcz+kKNgVWYRY0zr9srBdPPFVpvOKW8VaJKUbeK+eZXyQF9ltME+Kk6affeaPgg==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.62.2.tgz", + "integrity": "sha512-5BqxR/pshjey51iliyzTD5Xi3EN0aLmQ2lZ3lvefVV9c82BvrLo2/6OT55iifpWBufs6kdwWbuOKS841DrmK9A==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.62.2.tgz", + "integrity": "sha512-uNN83XxQrRAh/w0/pmAfibcwyb6YWt4gP+dpnQKPVJshAloQ785ii8CT8ZCIxkGg9opVsvAlGhFitSm6D1Jjpg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.62.2.tgz", + "integrity": "sha512-srjEIxSH3LRnJN6THczDHWQplqEMFiAJrTab0msUryh9kwNpkICf3Ea6q6MN/2cZwRFUNx5w+h6Hpi4QuHS6Zg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.62.2.tgz", + "integrity": "sha512-8hOJnxgbyObnCm5AlRA3A931xX19xq80RjVTKgJOvEKWqJruP/Uf12IbAOaDjjEXYRewwHLfmF0YRIdK3OwKWA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.62.2.tgz", + "integrity": "sha512-mmF4AY1i0hG/bLWUctUq59gtmgaSIRa3cu/A3JFRp/sCNEme2bgDEiDS22P9FbnJB8NJNF4jPJiSP5RHQpUTDg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.62.2.tgz", + "integrity": "sha512-DZgkknc6jhHrk46V25vbAM0zZkyP0nSDkJB8/dRkLTxv470dOmWDqGoEJl/9A0dFfS7yE3REOwNDxpHwSLSt0Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.62.2.tgz", + "integrity": "sha512-T6xr6ucWSFto+VGajA8YH26LdpHRuP4YLHEKAtCWvJDOlnmWcDZVCI2Jmjr+IFHDlt2zRaTAKE4tfjTaWLgJBg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.2.tgz", + "integrity": "sha512-BfzEnDJOt9T8M989/lA37EcJgat01wLRnoi5dQf3QzOH7jzpqTAzdDbVfRljVr5r+jzKqpbHeyOfAaXxAd0PAA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", + "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", + "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.28.2" + } + }, + "node_modules/@types/debug": { + "version": "4.1.13", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz", + "integrity": "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==", + "license": "MIT", + "dependencies": { + "@types/ms": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "license": "MIT" + }, + "node_modules/@types/estree-jsx": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz", + "integrity": "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==", + "license": "MIT", + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "license": "MIT" + }, + "node_modules/@types/react": { + "version": "19.2.17", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.17.tgz", + "integrity": "sha512-MXfmqaVPEVgkBT/aY0aGCkRWWtByiYQXo3xdQ8r5RzuFrPiRn8Gar2tQdXSUQ2GKV3bkXckek89V8wQBY2Q/Aw==", + "license": "MIT", + "peer": true, + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "license": "MIT" + }, + "node_modules/@ungap/structured-clone": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.2.tgz", + "integrity": "sha512-5jsZFwgR5rTdKwidH9Qmat75RKwqfpKlWWB1frDkljN127mwqBu8K0PYo7/hFpF03IEJpfVPpCQDY/eDx3iHvA==", + "license": "ISC" + }, + "node_modules/@vitejs/plugin-react": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz", + "integrity": "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.28.0", + "@babel/plugin-transform-react-jsx-self": "^7.27.1", + "@babel/plugin-transform-react-jsx-source": "^7.27.1", + "@rolldown/pluginutils": "1.0.0-beta.27", + "@types/babel__core": "^7.20.5", + "react-refresh": "^0.17.0" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "peerDependencies": { + "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" + } + }, + "node_modules/bail": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", + "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/baseline-browser-mapping": { + "version": "2.10.40", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.40.tgz", + "integrity": "sha512-BSSLZ9/Cjjv7Gtj5B68ZzXcXUg8iOf3fme+FCuh8rC/Go+Kmh8cox7M3A8dolou16s64QjLPOSdngh7GxXvkSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.cjs" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/browserslist": { + "version": "4.28.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.4.tgz", + "integrity": "sha512-MTc8i/x9jBQd1iMw2CFGS+rwMa07eYjLR0CCTLDACl9xhxy+nIs3KeML/biicXtk9JrZ6dnnTatmc7ErPXIxqw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "baseline-browser-mapping": "^2.10.38", + "caniuse-lite": "^1.0.30001799", + "electron-to-chromium": "^1.5.376", + "node-releases": "^2.0.48", + "update-browserslist-db": "^1.2.3" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001799", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001799.tgz", + "integrity": "sha512-hG1bReV+OUU+MOqK4t/ZWI0tZOyz3rqS9XuhOUz1cIcbwBKjOyJEJuw9ER5JuNyqxNk8u/JUVbGibBOL1yrjFw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", + "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-html4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-reference-invalid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", + "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "license": "MIT", + "peer": true + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decode-named-character-reference": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.3.0.tgz", + "integrity": "sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q==", + "license": "MIT", + "dependencies": { + "character-entities": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "license": "MIT", + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.380", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.380.tgz", + "integrity": "sha512-W6d5AbuEoRayO447cqrg6lKJIlscgRnnxOZl/08kfV71BQDoEBC7Wwis68z87LjyK6f4kWyTaubuDbhHKrZkbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/esbuild": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", + "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.12", + "@esbuild/android-arm": "0.25.12", + "@esbuild/android-arm64": "0.25.12", + "@esbuild/android-x64": "0.25.12", + "@esbuild/darwin-arm64": "0.25.12", + "@esbuild/darwin-x64": "0.25.12", + "@esbuild/freebsd-arm64": "0.25.12", + "@esbuild/freebsd-x64": "0.25.12", + "@esbuild/linux-arm": "0.25.12", + "@esbuild/linux-arm64": "0.25.12", + "@esbuild/linux-ia32": "0.25.12", + "@esbuild/linux-loong64": "0.25.12", + "@esbuild/linux-mips64el": "0.25.12", + "@esbuild/linux-ppc64": "0.25.12", + "@esbuild/linux-riscv64": "0.25.12", + "@esbuild/linux-s390x": "0.25.12", + "@esbuild/linux-x64": "0.25.12", + "@esbuild/netbsd-arm64": "0.25.12", + "@esbuild/netbsd-x64": "0.25.12", + "@esbuild/openbsd-arm64": "0.25.12", + "@esbuild/openbsd-x64": "0.25.12", + "@esbuild/openharmony-arm64": "0.25.12", + "@esbuild/sunos-x64": "0.25.12", + "@esbuild/win32-arm64": "0.25.12", + "@esbuild/win32-ia32": "0.25.12", + "@esbuild/win32-x64": "0.25.12" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/estree-util-is-identifier-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/estree-util-is-identifier-name/-/estree-util-is-identifier-name-3.0.0.tgz", + "integrity": "sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "license": "MIT" + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/hast-util-is-element": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-3.0.0.tgz", + "integrity": "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-to-jsx-runtime": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.6.tgz", + "integrity": "sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "hast-util-whitespace": "^3.0.0", + "mdast-util-mdx-expression": "^2.0.0", + "mdast-util-mdx-jsx": "^3.0.0", + "mdast-util-mdxjs-esm": "^2.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0", + "style-to-js": "^1.0.0", + "unist-util-position": "^5.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-to-text": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/hast-util-to-text/-/hast-util-to-text-4.0.2.tgz", + "integrity": "sha512-KK6y/BN8lbaq654j7JgBydev7wuNMcID54lkRav1P0CaE1e47P72AWWPiGKXTJU271ooYzcvTAn/Zt0REnvc7A==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "hast-util-is-element": "^3.0.0", + "unist-util-find-after": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-whitespace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/highlight.js": { + "version": "11.11.1", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.11.1.tgz", + "integrity": "sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/html-url-attributes": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/html-url-attributes/-/html-url-attributes-3.0.1.tgz", + "integrity": "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/inline-style-parser": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.7.tgz", + "integrity": "sha512-Nb2ctOyNR8DqQoR0OwRG95uNWIC0C1lCgf5Naz5H6Ji72KZ8OcFZLz2P5sNgwlyoJ8Yif11oMuYs5pBQa86csA==", + "license": "MIT" + }, + "node_modules/is-alphabetical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", + "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-alphanumerical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", + "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", + "license": "MIT", + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-decimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", + "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-hexadecimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", + "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/longest-streak": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", + "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "license": "MIT", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/lowlight": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lowlight/-/lowlight-3.3.0.tgz", + "integrity": "sha512-0JNhgFoPvP6U6lE/UdVsSq99tn6DhjjpAj5MxG49ewd2mOBVtwWYIT8ClyABhq198aXXODMU6Ox8DrGy/CpTZQ==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "devlop": "^1.0.0", + "highlight.js": "~11.11.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/lucide-react": { + "version": "0.469.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.469.0.tgz", + "integrity": "sha512-28vvUnnKQ/dBwiCQtwJw7QauYnE7yd2Cyp4tTTJpvglX4EMpbflcdBgrgToX2j71B3YvugK/NH3BGUk+E/p/Fw==", + "license": "ISC", + "peerDependencies": { + "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/markdown-table": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz", + "integrity": "sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdast-util-find-and-replace": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.2.tgz", + "integrity": "sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "escape-string-regexp": "^5.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-from-markdown": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.3.tgz", + "integrity": "sha512-W4mAWTvSlKvf8L6J+VN9yLSqQ9AOAAvHuoDAmPkz4dHf553m5gVj2ejadHJhoJmcmxEnOv6Pa8XJhpxE93kb8Q==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark": "^4.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-3.1.0.tgz", + "integrity": "sha512-0ulfdQOM3ysHhCJ1p06l0b0VKlhU0wuQs3thxZQagjcjPrlFRqY215uZGHHJan9GEAXd9MbfPjFJz+qMkVR6zQ==", + "license": "MIT", + "dependencies": { + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-gfm-autolink-literal": "^2.0.0", + "mdast-util-gfm-footnote": "^2.0.0", + "mdast-util-gfm-strikethrough": "^2.0.0", + "mdast-util-gfm-table": "^2.0.0", + "mdast-util-gfm-task-list-item": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-autolink-literal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-2.0.1.tgz", + "integrity": "sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "ccount": "^2.0.0", + "devlop": "^1.0.0", + "mdast-util-find-and-replace": "^3.0.0", + "micromark-util-character": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-footnote": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-2.1.0.tgz", + "integrity": "sha512-sqpDWlsHn7Ac9GNZQMeUzPQSMzR6Wv0WKRNvQRg0KqHh02fpTz69Qc1QSseNX29bhz1ROIyNyxExfawVKTm1GQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-strikethrough": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-2.0.0.tgz", + "integrity": "sha512-mKKb915TF+OC5ptj5bJ7WFRPdYtuHv0yTRxK2tJvi+BDqbkiG7h7u/9SI89nRAYcmap2xHQL9D+QG/6wSrTtXg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-table": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-2.0.0.tgz", + "integrity": "sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "markdown-table": "^3.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-task-list-item": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-2.0.0.tgz", + "integrity": "sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdx-expression": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz", + "integrity": "sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdx-jsx": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.2.0.tgz", + "integrity": "sha512-lj/z8v0r6ZtsN/cGNNtemmmfoLAFZnjMbNyLzBafjzikOM+glrjNHPlf6lQDOTccj9n5b0PPihEBbhneMyGs1Q==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "parse-entities": "^4.0.0", + "stringify-entities": "^4.0.0", + "unist-util-stringify-position": "^4.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdxjs-esm": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-2.0.1.tgz", + "integrity": "sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-phrasing": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz", + "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-hast": { + "version": "13.2.1", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz", + "integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@ungap/structured-clone": "^1.0.0", + "devlop": "^1.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "trim-lines": "^3.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-markdown": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.2.tgz", + "integrity": "sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "longest-streak": "^3.0.0", + "mdast-util-phrasing": "^4.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "unist-util-visit": "^5.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", + "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.2.tgz", + "integrity": "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-core-commonmark": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.3.tgz", + "integrity": "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-destination": "^2.0.0", + "micromark-factory-label": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-factory-title": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-extension-gfm": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-3.0.0.tgz", + "integrity": "sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w==", + "license": "MIT", + "dependencies": { + "micromark-extension-gfm-autolink-literal": "^2.0.0", + "micromark-extension-gfm-footnote": "^2.0.0", + "micromark-extension-gfm-strikethrough": "^2.0.0", + "micromark-extension-gfm-table": "^2.0.0", + "micromark-extension-gfm-tagfilter": "^2.0.0", + "micromark-extension-gfm-task-list-item": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-autolink-literal": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-2.1.0.tgz", + "integrity": "sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw==", + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-footnote": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-footnote/-/micromark-extension-gfm-footnote-2.1.0.tgz", + "integrity": "sha512-/yPhxI1ntnDNsiHtzLKYnE3vf9JZ6cAisqVDauhp4CEHxlb4uoOTxOCJ+9s51bIB8U1N1FJ1RXOKTIlD5B/gqw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-strikethrough": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-2.1.0.tgz", + "integrity": "sha512-ADVjpOOkjz1hhkZLlBiYA9cR2Anf8F4HqZUO6e5eDcPQd0Txw5fxLzzxnEkSkfnD0wziSGiv7sYhk/ktvbf1uw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-table": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-2.1.1.tgz", + "integrity": "sha512-t2OU/dXXioARrC6yWfJ4hqB7rct14e8f7m0cbI5hUmDyyIlwv5vEtooptH8INkbLzOatzKuVbQmAYcbWoyz6Dg==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-tagfilter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-2.0.0.tgz", + "integrity": "sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg==", + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-task-list-item": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-2.1.0.tgz", + "integrity": "sha512-qIBZhqxqI6fjLDYFTBIa4eivDMnP+OZqsNwmQ3xNLE4Cxwc+zfQEfbs6tzAo2Hjq+bh6q5F+Z8/cksrLFYWQQw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-factory-destination": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz", + "integrity": "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-label": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.1.tgz", + "integrity": "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-space": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.1.tgz", + "integrity": "sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-title": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.1.tgz", + "integrity": "sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-whitespace": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.1.tgz", + "integrity": "sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-character": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-chunked": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.1.tgz", + "integrity": "sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-classify-character": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.1.tgz", + "integrity": "sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-combine-extensions": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.1.tgz", + "integrity": "sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-chunked": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-numeric-character-reference": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.2.tgz", + "integrity": "sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-string": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.1.tgz", + "integrity": "sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-encode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-html-tag-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz", + "integrity": "sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-normalize-identifier": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.1.tgz", + "integrity": "sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-resolve-all": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.1.tgz", + "integrity": "sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-subtokenize": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.1.0.tgz", + "integrity": "sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-symbol": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz", + "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.15", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.15.tgz", + "integrity": "sha512-y7Wygv/7mEOvxTuEQDB8StXdMRBWf1kR/tlhAzBRUFkB2jfcLOAxO/SHmOO2zgz1pVgK29/kyupn059/bCHdjA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/node-releases": { + "version": "2.0.50", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.50.tgz", + "integrity": "sha512-J6l92tKHX6w8Jy5nO1Vuc01NoIiRGi/d6qBKVxh+IQ8Cr3b6HbVNfKiF8ZpFKufTwpwxMmce2W3iQZ861ZRyTg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/parse-entities": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.2.tgz", + "integrity": "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^2.0.0", + "character-entities-legacy": "^3.0.0", + "character-reference-invalid": "^2.0.0", + "decode-named-character-reference": "^1.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0", + "is-hexadecimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/parse-entities/node_modules/@types/unist": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.15", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz", + "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.12", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/property-information": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.2.0.tgz", + "integrity": "sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/react": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.2" + }, + "peerDependencies": { + "react": "^18.3.1" + } + }, + "node_modules/react-markdown": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-9.1.0.tgz", + "integrity": "sha512-xaijuJB0kzGiUdG7nc2MOMDUDBWPyGAjZtUrow9XxUeua8IqeP+VlIfAZ3bphpcLTnSZXz6z9jcVC/TCwbfgdw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "hast-util-to-jsx-runtime": "^2.0.0", + "html-url-attributes": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.0.0", + "unified": "^11.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "peerDependencies": { + "@types/react": ">=18", + "react": ">=18" + } + }, + "node_modules/react-refresh": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz", + "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rehype-highlight": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/rehype-highlight/-/rehype-highlight-7.0.2.tgz", + "integrity": "sha512-k158pK7wdC2qL3M5NcZROZ2tR/l7zOzjxXd5VGdcfIyoijjQqpHd3JKtYSBDpDZ38UI2WJWuFAtkMDxmx5kstA==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "hast-util-to-text": "^4.0.0", + "lowlight": "^3.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-gfm": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-4.0.1.tgz", + "integrity": "sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-gfm": "^3.0.0", + "micromark-extension-gfm": "^3.0.0", + "remark-parse": "^11.0.0", + "remark-stringify": "^11.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-parse": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", + "integrity": "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-rehype": { + "version": "11.1.2", + "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.2.tgz", + "integrity": "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "mdast-util-to-hast": "^13.0.0", + "unified": "^11.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-stringify": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-11.0.0.tgz", + "integrity": "sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-to-markdown": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/rollup": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.2.tgz", + "integrity": "sha512-RFnrW4lhXA3s3eqHDZvN654g8OTjzRfqpIRJYczCGB6HzphckVAi/Qh4tbPUbRuDi7s1Llv8g/NspLkttY3gTA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.9" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.62.2", + "@rollup/rollup-android-arm64": "4.62.2", + "@rollup/rollup-darwin-arm64": "4.62.2", + "@rollup/rollup-darwin-x64": "4.62.2", + "@rollup/rollup-freebsd-arm64": "4.62.2", + "@rollup/rollup-freebsd-x64": "4.62.2", + "@rollup/rollup-linux-arm-gnueabihf": "4.62.2", + "@rollup/rollup-linux-arm-musleabihf": "4.62.2", + "@rollup/rollup-linux-arm64-gnu": "4.62.2", + "@rollup/rollup-linux-arm64-musl": "4.62.2", + "@rollup/rollup-linux-loong64-gnu": "4.62.2", + "@rollup/rollup-linux-loong64-musl": "4.62.2", + "@rollup/rollup-linux-ppc64-gnu": "4.62.2", + "@rollup/rollup-linux-ppc64-musl": "4.62.2", + "@rollup/rollup-linux-riscv64-gnu": "4.62.2", + "@rollup/rollup-linux-riscv64-musl": "4.62.2", + "@rollup/rollup-linux-s390x-gnu": "4.62.2", + "@rollup/rollup-linux-x64-gnu": "4.62.2", + "@rollup/rollup-linux-x64-musl": "4.62.2", + "@rollup/rollup-openbsd-x64": "4.62.2", + "@rollup/rollup-openharmony-arm64": "4.62.2", + "@rollup/rollup-win32-arm64-msvc": "4.62.2", + "@rollup/rollup-win32-ia32-msvc": "4.62.2", + "@rollup/rollup-win32-x64-gnu": "4.62.2", + "@rollup/rollup-win32-x64-msvc": "4.62.2", + "fsevents": "~2.3.2" + } + }, + "node_modules/scheduler": { + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0" + } + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/stringify-entities": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "license": "MIT", + "dependencies": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/style-to-js": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.21.tgz", + "integrity": "sha512-RjQetxJrrUJLQPHbLku6U/ocGtzyjbJMP9lCNK7Ag0CNh690nSH8woqWH9u16nMjYBAok+i7JO1NP2pOy8IsPQ==", + "license": "MIT", + "dependencies": { + "style-to-object": "1.0.14" + } + }, + "node_modules/style-to-object": { + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.14.tgz", + "integrity": "sha512-LIN7rULI0jBscWQYaSswptyderlarFkjQ+t79nzty8tcIAceVomEVlLzH5VP4Cmsv6MtKhs7qaAiwlcp+Mgaxw==", + "license": "MIT", + "dependencies": { + "inline-style-parser": "0.2.7" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/trim-lines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/trough": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz", + "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/unified": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", + "integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "bail": "^2.0.0", + "devlop": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-find-after": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-find-after/-/unist-util-find-after-5.0.0.tgz", + "integrity": "sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-is": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.1.tgz", + "integrity": "sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.1.0.tgz", + "integrity": "sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.2.tgz", + "integrity": "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", + "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/vfile": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.3.tgz", + "integrity": "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vite": { + "version": "6.4.3", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.3.tgz", + "integrity": "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.25.0", + "fdir": "^6.4.4", + "picomatch": "^4.0.2", + "postcss": "^8.5.3", + "rollup": "^4.34.9", + "tinyglobby": "^0.2.13" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "jiti": ">=1.21.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + }, + "node_modules/zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + } + } +} diff --git a/frontend/package.json b/frontend/package.json new file mode 100644 index 000000000..27a62031d --- /dev/null +++ b/frontend/package.json @@ -0,0 +1,23 @@ +{ + "name": "openkb-web", + "private": true, + "version": "0.1.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "dependencies": { + "lucide-react": "^0.469.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "react-markdown": "^9.0.1", + "rehype-highlight": "^7.0.1", + "remark-gfm": "^4.0.0" + }, + "devDependencies": { + "@vitejs/plugin-react": "^4.3.4", + "vite": "^6.0.7" + } +} diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx new file mode 100644 index 000000000..4a9c5a1e9 --- /dev/null +++ b/frontend/src/App.jsx @@ -0,0 +1,81 @@ +import { useEffect, useCallback } from "react"; +import { Menu } from "lucide-react"; +import { AppProvider, useApp } from "./state/AppContext.jsx"; +import { api, hasConnection } from "./api/client.js"; +import Sidebar from "./components/Sidebar.jsx"; +import Inspector from "./components/Inspector.jsx"; +import SettingsModal from "./components/SettingsModal.jsx"; +import Toast from "./components/Toast.jsx"; +import Overview from "./views/Overview.jsx"; +import Documents from "./views/Documents.jsx"; +import Query from "./views/Query.jsx"; +import Chat from "./views/Chat.jsx"; +import Maintenance from "./views/Maintenance.jsx"; + +const TITLES = { overview: "概览", documents: "文档管理", query: "查询", chat: "对话", maintenance: "维护" }; + +function Shell() { + const { kb, view, setKbs, setKb, kbs, setSidebarOpen, setSettingsOpen, toastMsg } = useApp(); + + const loadKbs = useCallback(async () => { + if (!hasConnection()) return; + try { + const data = await api.listKbs(); + setKbs(data.knowledge_bases || []); + setKb((prev) => prev || (data.knowledge_bases?.[0]?.name ?? null)); + } catch { + setKbs([]); + } + }, [setKbs, setKb]); + + useEffect(() => { + loadKbs(); + function onReload() { loadKbs(); } + function onToast(e) { toastMsg(e.detail.message, e.detail.kind); } + function onUnauthorized() { setSettingsOpen(true); } + window.addEventListener("openkb:reload-kbs", onReload); + window.addEventListener("openkb:toast", onToast); + window.addEventListener("openkb:unauthorized", onUnauthorized); + return () => { + window.removeEventListener("openkb:reload-kbs", onReload); + window.removeEventListener("openkb:toast", onToast); + window.removeEventListener("openkb:unauthorized", onUnauthorized); + }; + }, [loadKbs, toastMsg, setSettingsOpen]); + + function renderView() { + if (!kb) return

未选择知识库

请在左侧选择或新建一个知识库。

; + if (view === "overview") return ; + if (view === "documents") return ; + if (view === "query") return ; + if (view === "chat") return ; + if (view === "maintenance") return ; + return null; + } + + return ( +
+ + +
+
+

{TITLES[view]}

+
+
{renderView()}
+
+ + + +
+ ); +} + +export default function App() { + return ( + + + + ); +} diff --git a/frontend/src/api/client.js b/frontend/src/api/client.js new file mode 100644 index 000000000..dc26fa668 --- /dev/null +++ b/frontend/src/api/client.js @@ -0,0 +1,79 @@ +// Lightweight API client. Reads base URL + token from localStorage so the SPA +// can talk to the OpenKB REST API after the user configures the connection. + +const LS_BASE = "openkb_api_base"; +const LS_TOKEN = "openkb_token"; + +export function getApiBase() { + return localStorage.getItem(LS_BASE) || ""; +} + +export function getToken() { + return localStorage.getItem(LS_TOKEN) || ""; +} + +export function setConnection(apiBase, token) { + localStorage.setItem(LS_BASE, apiBase); + localStorage.setItem(LS_TOKEN, token); +} + +export function hasConnection() { + return !!getToken(); +} + +// Resolve the API base. In dev (Vite proxy) the relative "/api" paths are +// proxied; otherwise use the configured absolute base. Falls back to same-origin. +export function baseUrl() { + return getApiBase().replace(/\/$/, ""); +} + +// Surface 401s to the UI so the connection modal can reopen for re-entry. +export function notifyUnauthorized() { + window.dispatchEvent(new CustomEvent("openkb:unauthorized")); +} + +export async function request(path, { method = "GET", body, headers } = {}) { + const token = getToken(); + const finalHeaders = { + ...(body && !(body instanceof FormData) ? { "Content-Type": "application/json" } : {}), + ...(token ? { Authorization: `Bearer ${token}` } : {}), + ...headers, + }; + const init = { method, headers: finalHeaders }; + if (body !== undefined) init.body = body instanceof FormData ? body : JSON.stringify(body); + const res = await fetch(baseUrl() + path, init); + if (!res.ok) { + let msg = `${res.status} ${res.statusText}`; + try { + const j = await res.json(); + msg = typeof j.detail === "string" ? j.detail : JSON.stringify(j.detail || j); + } catch { + // keep default message + } + const err = new Error(msg); + err.status = res.status; + if (res.status === 401) notifyUnauthorized(); + throw err; +} + const ct = res.headers.get("content-type") || ""; + if (ct.includes("application/json")) return res.json(); + return res.text(); +} + +export const api = { + listKbs: () => request("/api/v1/kbs"), + initKb: (kb) => request("/api/v1/init", { method: "POST", body: { kb } }), + status: (kb) => request("/api/v1/status", { method: "POST", body: { kb } }), + list: (kb) => request("/api/v1/list", { method: "POST", body: { kb } }), + lint: (kb, fix) => request("/api/v1/lint", { method: "POST", body: { kb, fix } }), + watchStatus: (kb) => request("/api/v1/watch/status", { method: "POST", body: { kb } }), + watchStart: (kb, debounce) => + request("/api/v1/watch/start", { method: "POST", body: { kb, debounce } }), + watchStop: (kb) => request("/api/v1/watch/stop", { method: "POST", body: { kb } }), + chatSessions: (kb) => + request("/api/v1/chat/sessions", { method: "POST", body: { kb } }), + chatSessionLoad: (kb, sessionId) => + request("/api/v1/chat/sessions/load", { method: "POST", body: { kb, session_id: sessionId } }), + chatSessionDelete: (kb, sessionId) => + request("/api/v1/chat/sessions/delete", { method: "POST", body: { kb, session_id: sessionId } }), +}; diff --git a/frontend/src/api/sse.js b/frontend/src/api/sse.js new file mode 100644 index 000000000..7219af90e --- /dev/null +++ b/frontend/src/api/sse.js @@ -0,0 +1,101 @@ +// SSE streaming over fetch (EventSource cannot set Authorization headers). +// Parses `event:` / `data:` blocks from a ReadableStream and invokes handlers. + +import { baseUrl, getToken, notifyUnauthorized } from "./client.js"; + +// Parse raw text buffer into complete SSE blocks, returning [events, remainder]. +function parseBuffer(buf) { + const blocks = buf.split("\n\n"); + const remainder = blocks.pop(); + const events = []; + for (const blk of blocks) { + const evMatch = blk.match(/^event:\s*(.+)$/m); + const daMatch = blk.match(/^data:\s*(.+)$/m); + if (evMatch && daMatch) { + let data; + try { + data = JSON.parse(daMatch[1]); + } catch { + data = { raw: daMatch[1] }; + } + events.push({ event: evMatch[1].trim(), data }); + } + } + return [events, remainder]; +} + +async function readStream(res, onEvent) { + const reader = res.body.getReader(); + const dec = new TextDecoder(); + let buf = ""; + while (true) { + const { value, done } = await reader.read(); + if (done) break; + buf += dec.decode(value, { stream: true }); + const [events, remainder] = parseBuffer(buf); + buf = remainder; + for (const { event, data } of events) { + if (onEvent(event, data) === false) return; + } + } +} + +// Build headers with token. JSON bodies are stringified; FormData passed through. +function buildHeaders(body, extra = {}) { + const token = getToken(); + const isForm = body instanceof FormData; + return { + ...(body && !isForm ? { "Content-Type": "application/json" } : {}), + Accept: "text/event-stream", + ...(token ? { Authorization: `Bearer ${token}` } : {}), + ...extra, + }; +} + +// Stream a JSON-POST endpoint. Returns an AbortController-like handle via opts.signal. +export async function streamSSE(path, payload, onEvent, opts = {}) { + const res = await fetch(baseUrl() + path, { + method: "POST", + headers: buildHeaders(payload), + body: JSON.stringify(payload), + signal: opts.signal, + }); + if (!res.ok) { + let msg = `${res.status} ${res.statusText}`; + try { + const j = await res.json(); + msg = typeof j.detail === "string" ? j.detail : JSON.stringify(j.detail || j); + } catch { + // keep default + } + const err = new Error(msg); + err.status = res.status; + if (res.status === 401) notifyUnauthorized(); + throw err; +} +await readStream(res, onEvent); +} + +// Stream a multipart upload (FormData) endpoint. +export async function streamUpload(path, form, onEvent, opts = {}) { + const res = await fetch(baseUrl() + path, { + method: "POST", + headers: buildHeaders(form), + body: form, + signal: opts.signal, + }); + if (!res.ok) { + let msg = `${res.status} ${res.statusText}`; + try { + const j = await res.json(); + msg = typeof j.detail === "string" ? j.detail : JSON.stringify(j.detail || j); + } catch { + // keep default + } + const err = new Error(msg); + err.status = res.status; + if (res.status === 401) notifyUnauthorized(); + throw err; +} +await readStream(res, onEvent); +} diff --git a/frontend/src/components/EmptyState.jsx b/frontend/src/components/EmptyState.jsx new file mode 100644 index 000000000..e6bc5f73e --- /dev/null +++ b/frontend/src/components/EmptyState.jsx @@ -0,0 +1,9 @@ +export default function EmptyState({ title, desc, icon }) { + return ( +
+ {icon || null} + {title &&

{title}

} + {desc &&

{desc}

} +
+ ); +} diff --git a/frontend/src/components/Inspector.jsx b/frontend/src/components/Inspector.jsx new file mode 100644 index 000000000..0a1eaafa3 --- /dev/null +++ b/frontend/src/components/Inspector.jsx @@ -0,0 +1,34 @@ +import { useEffect, useRef } from "react"; +import { useApp } from "../state/AppContext.jsx"; + +export default function Inspector() { + const { inspItems, inspBusy } = useApp(); + const bodyRef = useRef(null); + + useEffect(() => { + if (bodyRef.current) bodyRef.current.scrollTop = bodyRef.current.scrollHeight; + }, [inspItems]); + + return ( + + ); +} diff --git a/frontend/src/components/Markdown.jsx b/frontend/src/components/Markdown.jsx new file mode 100644 index 000000000..b9e541930 --- /dev/null +++ b/frontend/src/components/Markdown.jsx @@ -0,0 +1,26 @@ +import { memo } from "react"; +import ReactMarkdown from "react-markdown"; +import remarkGfm from "remark-gfm"; +import rehypeHighlight from "rehype-highlight"; + +// Replaces the hand-rolled regex renderer (which dropped **bold**, tables, +// blockquotes, etc.). react-markdown + remark-gfm covers the full GFM spec +// (bold/italic/strikethrough/tables/task-lists/autolinks); rehype-highlight +// adds syntax highlighting to fenced code blocks. +const MarkdownImpl = ({ children }) => { + return ( + + ); +}; + +export default memo(MarkdownImpl); diff --git a/frontend/src/components/SettingsModal.jsx b/frontend/src/components/SettingsModal.jsx new file mode 100644 index 000000000..b72bd9c0a --- /dev/null +++ b/frontend/src/components/SettingsModal.jsx @@ -0,0 +1,52 @@ +import { useState, useEffect } from "react"; +import { X } from "lucide-react"; +import { useApp } from "../state/AppContext.jsx"; + +export default function SettingsModal() { + const { settingsOpen, setSettingsOpen, saveConnection, apiBase, token, toastMsg } = useApp(); + const [base, setBase] = useState(apiBase); + const [tok, setTok] = useState(token); + + useEffect(() => { + setBase(apiBase); + setTok(token); + }, [apiBase, token, settingsOpen]); + + if (!settingsOpen) return null; + + function handleSave() { + const cleaned = (base || "").trim().replace(/\/$/, ""); + saveConnection(cleaned, tok); + setSettingsOpen(false); + toastMsg("已保存,正在刷新…", "ok"); + window.dispatchEvent(new CustomEvent("openkb:reload-kbs")); + } + + return ( +
setSettingsOpen(false)}> +
e.stopPropagation()}> +
+

连接设置

+ +
+
+ + +

配置信息仅保存在本浏览器本地。

+
+
+ + +
+
+
+ ); +} diff --git a/frontend/src/components/Sidebar.jsx b/frontend/src/components/Sidebar.jsx new file mode 100644 index 000000000..219c8dbdb --- /dev/null +++ b/frontend/src/components/Sidebar.jsx @@ -0,0 +1,101 @@ +import { useState, useRef, useEffect } from "react"; +import { LayoutGrid, FileText, Search, MessageSquare, Wrench, Settings, Plus, ChevronDown } from "lucide-react"; +import { useApp } from "../state/AppContext.jsx"; +import { api } from "../api/client.js"; + +const NAV = [ + { view: "overview", label: "概览", icon: LayoutGrid }, + { view: "documents", label: "文档", icon: FileText }, + { view: "query", label: "查询", icon: Search }, + { view: "chat", label: "对话", icon: MessageSquare }, + { view: "maintenance", label: "维护", icon: Wrench }, +]; + +export default function Sidebar() { + const { kbs, kb, setKb, view, setView, setSettingsOpen, sidebarOpen, setSidebarOpen, toastMsg } = useApp(); + const [menuOpen, setMenuOpen] = useState(false); + const [creating, setCreating] = useState(false); + const menuRef = useRef(null); + + useEffect(() => { + function onClick(e) { + if (menuRef.current && !menuRef.current.contains(e.target)) setMenuOpen(false); + } + document.addEventListener("mousedown", onClick); + return () => document.removeEventListener("mousedown", onClick); + }, []); + + async function handleCreate() { + const name = window.prompt("新知识库名称(字母/数字/下划线/连字符):"); + if (!name) return; + setCreating(true); + try { + await api.initKb(name.trim()); + setKb(name.trim()); + setMenuOpen(false); + window.dispatchEvent(new CustomEvent("openkb:reload-kbs")); + toastMsg("已创建:" + name.trim(), "ok"); + } catch (e) { + toastMsg(e.message, "err"); + } finally { + setCreating(false); + } + } + + return ( + <> + {sidebarOpen &&
setSidebarOpen(false)} />} + + + ); +} diff --git a/frontend/src/components/Spinner.jsx b/frontend/src/components/Spinner.jsx new file mode 100644 index 000000000..3f878bd45 --- /dev/null +++ b/frontend/src/components/Spinner.jsx @@ -0,0 +1,3 @@ +export default function Spinner({ size = 18 }) { + return ; +} diff --git a/frontend/src/components/Toast.jsx b/frontend/src/components/Toast.jsx new file mode 100644 index 000000000..89b30d31b --- /dev/null +++ b/frontend/src/components/Toast.jsx @@ -0,0 +1,7 @@ +import { useApp } from "../state/AppContext.jsx"; + +export default function Toast() { + const { toast } = useApp(); + if (!toast) return null; + return
{toast.message}
; +} diff --git a/frontend/src/hooks/useSSEStream.js b/frontend/src/hooks/useSSEStream.js new file mode 100644 index 000000000..5bbf7edc0 --- /dev/null +++ b/frontend/src/hooks/useSSEStream.js @@ -0,0 +1,45 @@ +// Unified SSE lifecycle hook: a single busy state + abortable streams. +// start() forwards every SSE event to onEvent and surfaces fetch/network +// errors as a synthetic {error} event so callers only handle one shape. +// stop() aborts the in-flight request via AbortController; onAbort fires +// so the caller can flip a pending bubble to a settled state. + +import { useCallback, useRef, useState } from "react"; +import { streamSSE, streamUpload } from "../api/sse.js"; + +export function useSSEStream() { + const [busy, setBusy] = useState(false); + const ctrlRef = useRef(null); + + const stop = useCallback(() => { + if (ctrlRef.current) { + ctrlRef.current.abort(); + } + }, []); + + const start = useCallback(async (cfg, onEvent, onAbort) => { + if (ctrlRef.current) return; // already streaming + const ctrl = new AbortController(); + ctrlRef.current = ctrl; + setBusy(true); + try { + if (cfg.form) { + await streamUpload(cfg.path, cfg.form, onEvent, { signal: ctrl.signal }); + } else { + await streamSSE(cfg.path, cfg.payload, onEvent, { signal: ctrl.signal }); + } + } catch (err) { + if (ctrl.signal.aborted) { + // User-initiated stop; do not surface as an error. + if (onAbort) onAbort(); + } else { + onEvent("error", { message: err?.message || "请求失败" }); + } + } finally { + ctrlRef.current = null; + setBusy(false); + } + }, []); + + return { busy, start, stop }; +} diff --git a/frontend/src/main.jsx b/frontend/src/main.jsx new file mode 100644 index 000000000..bf549fe59 --- /dev/null +++ b/frontend/src/main.jsx @@ -0,0 +1,13 @@ +import React from "react"; +import ReactDOM from "react-dom/client"; +import App from "./App.jsx"; +import "./styles.css"; + +// Vite mangles the zh-CN on Windows; set it at runtime to stay correct. +document.title = "OpenKB · 知识工作台"; + +ReactDOM.createRoot(document.getElementById("root")).render( + <React.StrictMode> + <App /> + </React.StrictMode> +); diff --git a/frontend/src/state/AppContext.jsx b/frontend/src/state/AppContext.jsx new file mode 100644 index 000000000..36be2b992 --- /dev/null +++ b/frontend/src/state/AppContext.jsx @@ -0,0 +1,84 @@ +import { createContext, useContext, useState, useCallback, useRef } from "react"; +import { getApiBase, getToken, setConnection, hasConnection } from "../api/client.js"; + +const AppContext = createContext(null); + +export function AppProvider({ children }) { + const [apiBase, setApiBaseState] = useState(getApiBase()); + const [token, setTokenState] = useState(getToken()); + const [kbs, setKbs] = useState([]); + const [kb, setKb] = useState(null); + const [view, setView] = useState("overview"); + const [settingsOpen, setSettingsOpen] = useState(!hasConnection()); + // Right-pane reasoning timeline. + const [inspItems, setInspItems] = useState([]); + const [inspBusy, setInspBusy] = useState(false); + const [toast, setToastState] = useState(null); + const toastTimer = useRef(null); + const [sidebarOpen, setSidebarOpen] = useState(false); + + const saveConnection = useCallback((base, tok) => { + const cleaned = (base || "").trim().replace(/\/$/, ""); + setConnection(cleaned, (tok || "").trim()); + setApiBaseState(cleaned); + setTokenState((tok || "").trim()); + }, []); + + const setViewSafe = useCallback((v) => { + setView(v); + setSidebarOpen(false); + }, []); + + const toastMsg = useCallback((message, kind = "") => { + setToastState({ message, kind }); + clearTimeout(toastTimer.current); + toastTimer.current = setTimeout(() => setToastState(null), 3200); + }, []); + + // Inspector timeline helpers. + const inspReset = useCallback((busy) => { + setInspItems(busy ? [{ kind: "start", tag: "开始", body: "启动推理检索…" }] : []); + setInspBusy(!!busy); + }, []); + + const inspAdd = useCallback((kind, tag, body) => { + // delta is too granular for the timeline; render in the answer pane instead. + if (kind === "delta") return; + setInspItems((prev) => [...prev, { kind, tag, body }]); + }, []); + + const inspDone = useCallback(() => { + setInspBusy(false); + }, []); + + const value = { + apiBase, + token, + kbs, + setKbs, + kb, + setKb, + view, + setView: setViewSafe, + settingsOpen, + setSettingsOpen, + sidebarOpen, + setSidebarOpen, + saveConnection, + toast, + toastMsg, + inspItems, + inspBusy, + inspReset, + inspAdd, + inspDone, + }; + + return <AppContext.Provider value={value}>{children}</AppContext.Provider>; +} + +export function useApp() { + const ctx = useContext(AppContext); + if (!ctx) throw new Error("useApp must be used within AppProvider"); + return ctx; +} diff --git a/frontend/src/styles.css b/frontend/src/styles.css new file mode 100644 index 000000000..8b67a3fb4 --- /dev/null +++ b/frontend/src/styles.css @@ -0,0 +1,345 @@ +:root { + --bg: #0e1015; + --bg-1: #14171f; + --bg-2: #1a1e28; + --bg-3: #222734; + --border: #2a2f3c; + --border-soft: #232834; + --text: #e7eaf0; + --text-2: #9aa3b2; + --text-3: #6b7280; + --accent: #5b8def; + --accent-soft: rgba(91, 141, 239, 0.14); + --cyan: #22d3ee; + --green: #34d399; + --amber: #fbbf24; + --red: #f87171; + --purple: #a78bfa; + --radius: 10px; + --radius-sm: 7px; + --shadow: 0 8px 30px rgba(0, 0, 0, 0.35); + --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif; + --mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, monospace; +} +* { box-sizing: border-box; margin: 0; padding: 0; } +html, body, #root { height: 100%; } +body { + font-family: var(--font); + background: var(--bg); + color: var(--text); + font-size: 14px; + line-height: 1.55; + letter-spacing: 0; + -webkit-font-smoothing: antialiased; +} +.app { display: grid; grid-template-columns: 232px 1fr 340px; height: 100vh; overflow: hidden; } +.hidden { display: none !important; } +button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; } +input, textarea, select { font-family: inherit; font-size: 14px; } +svg { display: block; flex-shrink: 0; } +a { color: var(--accent); } + +/* ===== Sidebar ===== */ +.sidebar { + background: var(--bg-1); + border-right: 1px solid var(--border); + display: flex; flex-direction: column; + padding: 16px 12px; + gap: 16px; + min-height: 0; +} +.brand { display: flex; align-items: center; gap: 9px; padding: 2px 6px; } +.brand-mark { + width: 26px; height: 26px; border-radius: 7px; + background: linear-gradient(135deg, var(--accent), var(--cyan)); + color: #fff; font-weight: 700; font-size: 12px; + display: grid; place-items: center; letter-spacing: 0.5px; +} +.brand-name { font-weight: 600; font-size: 15px; } +.kb-switcher { position: relative; } +.kb-current { + width: 100%; display: flex; align-items: center; gap: 9px; + padding: 9px 10px; border-radius: var(--radius-sm); + background: var(--bg-2); border: 1px solid var(--border); + transition: background 0.15s; +} +.kb-current:hover { background: var(--bg-3); } +.kb-current-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex-shrink: 0; box-shadow: 0 0 8px var(--green); } +.kb-current-name { flex: 1; text-align: left; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.kb-current .kb-chev { color: var(--text-2); } +.kb-menu { + position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40; + background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); + box-shadow: var(--shadow); padding: 6px; max-height: 320px; overflow-y: auto; +} +.kb-menu-item { + width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; + padding: 8px 10px; border-radius: var(--radius-sm); text-align: left; transition: background 0.15s; +} +.kb-menu-item:hover { background: var(--bg-3); } +.kb-menu-item.active { background: var(--accent-soft); color: var(--accent); } +.kb-menu-item .mi-name { font-weight: 500; } +.kb-menu-item .mi-meta { font-size: 11px; color: var(--text-3); } +.kb-menu-item.active .mi-meta { color: var(--accent); opacity: 0.8; } +.kb-menu-new { + width: 100%; display: flex; align-items: center; gap: 7px; + padding: 8px 10px; border-radius: var(--radius-sm); color: var(--accent); + border-top: 1px solid var(--border-soft); margin-top: 4px; font-weight: 500; +} +.kb-menu-new:hover { background: var(--bg-3); } +.kb-menu-new:disabled { opacity: 0.5; cursor: not-allowed; } +.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; } +.nav-item { + display: flex; align-items: center; gap: 10px; + padding: 9px 11px; border-radius: var(--radius-sm); text-align: left; + color: var(--text-2); font-weight: 500; transition: background 0.15s, color 0.15s; +} +.nav-item:hover { background: var(--bg-2); color: var(--text); } +.nav-item.active { background: var(--accent-soft); color: var(--accent); } +.sidebar-foot { display: flex; justify-content: flex-end; } +.icon-btn { + display: grid; place-items: center; width: 32px; height: 32px; + border-radius: var(--radius-sm); color: var(--text-2); transition: background 0.15s, color 0.15s; +} +.icon-btn:hover { background: var(--bg-2); color: var(--text); } + +/* ===== Workspace ===== */ +.workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); } +.ws-header { + display: flex; align-items: center; justify-content: space-between; gap: 16px; + padding: 18px 28px; border-bottom: 1px solid var(--border); flex-shrink: 0; +} +.ws-title { font-size: 19px; font-weight: 650; letter-spacing: -0.01em; } +.ws-body { flex: 1; overflow-y: auto; padding: 24px 28px 40px; } + +/* ===== Inspector ===== */ +.inspector { + background: var(--bg-1); border-left: 1px solid var(--border); + display: flex; flex-direction: column; min-height: 0; +} +.insp-head { + display: flex; align-items: center; justify-content: space-between; + padding: 16px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0; +} +.insp-title { font-weight: 600; font-size: 13px; } +.insp-status { font-size: 12px; color: var(--text-3); } +.insp-status.busy { color: var(--cyan); } +.insp-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; } +.insp-empty { color: var(--text-3); font-size: 13px; text-align: center; margin: auto; line-height: 1.7; } +.timeline-item { + background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); + padding: 10px 12px; font-size: 13px; animation: fadein 0.2s ease; +} +.timeline-item.tool { border-left: 2px solid var(--cyan); } +.timeline-item.done { border-left-color: var(--green); } +.timeline-item.error { border-left-color: var(--red); } +.timeline-item.start { border-left: 2px solid var(--accent); } +.timeline-item .tl-tag { font-size: 11px; font-weight: 600; color: var(--cyan); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; display: block; } +.timeline-item.done .tl-tag { color: var(--green); } +.timeline-item.error .tl-tag { color: var(--red); } +.timeline-item.start .tl-tag { color: var(--accent); } +.timeline-item .tl-body { color: var(--text-2); word-break: break-word; } +.timeline-item .tl-body code { font-family: var(--mono); font-size: 11px; background: var(--bg-3); padding: 1px 5px; border-radius: 4px; } +@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } } + +/* ===== Buttons / controls ===== */ +.btn { + display: inline-flex; align-items: center; gap: 7px; justify-content: center; + padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 550; font-size: 13px; + border: 1px solid var(--border); background: var(--bg-2); color: var(--text); transition: background 0.15s, border-color 0.15s, opacity 0.15s; +} +.btn:hover { background: var(--bg-3); } +.btn:disabled { opacity: 0.5; cursor: not-allowed; } +.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; } +.btn-primary:hover { background: #4f80e6; } +.btn-ghost { background: transparent; border-color: var(--border); } +.btn-ghost:hover { background: var(--bg-2); } +.btn-danger { background: transparent; border-color: var(--border); color: var(--red); } +.btn-danger:hover { background: rgba(248, 113, 113, 0.1); border-color: var(--red); } +.btn-sm { padding: 5px 10px; font-size: 12px; } + +/* ===== Stat cards ===== */ +.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; } +.stat-card { + background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); + padding: 18px; +} +.stat-label { font-size: 12px; color: var(--text-2); margin-bottom: 8px; } +.stat-value { font-size: 28px; font-weight: 680; letter-spacing: -0.02em; } +.stat-sub { font-size: 11px; color: var(--text-3); margin-top: 4px; } +.stat-card.accent .stat-value { color: var(--accent); } +.stat-card.cyan .stat-value { color: var(--cyan); } +.stat-card.green .stat-value { color: var(--green); } +.stat-card.purple .stat-value { color: var(--purple); } + +.panel { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 18px; } +.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); } +.panel-title { font-weight: 600; font-size: 14px; } +.panel-body { padding: 8px 0; } + +/* ===== Table ===== */ +.table { width: 100%; border-collapse: collapse; } +.table th, .table td { text-align: left; padding: 10px 16px; font-size: 13px; border-bottom: 1px solid var(--border-soft); } +.table th { color: var(--text-2); font-weight: 550; font-size: 12px; } +.table tr:last-child td { border-bottom: none; } +.table tbody tr { transition: background 0.12s; cursor: default; } +.table tbody tr:hover { background: var(--bg-2); } +.cell-name { font-weight: 550; } +.cell-meta { color: var(--text-2); font-size: 12px; } +.tag { + display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 550; + padding: 2px 8px; border-radius: 20px; background: var(--bg-3); color: var(--text-2); +} +.tag.green { background: rgba(52, 211, 153, 0.14); color: var(--green); } +.tag.cyan { background: rgba(34, 211, 238, 0.14); color: var(--cyan); } +.tag.amber { background: rgba(251, 191, 36, 0.14); color: var(--amber); } +.tag.red { background: rgba(248, 113, 113, 0.14); color: var(--red); } +.tag.purple { background: rgba(167, 139, 250, 0.14); color: var(--purple); } +.icon-cell { display: inline-flex; align-items: center; gap: 8px; } +.file-ico { width: 28px; height: 28px; border-radius: 6px; background: var(--bg-3); display: grid; place-items: center; color: var(--text-2); font-size: 10px; font-weight: 600; } + +/* ===== Dropzone / upload ===== */ +.dropzone { + border: 1.5px dashed var(--border); border-radius: var(--radius); padding: 26px; + text-align: center; color: var(--text-2); transition: border-color 0.15s, background 0.15s; cursor: pointer; + margin-bottom: 18px; +} +.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--text); } +.dropzone .dz-title { font-weight: 550; margin-bottom: 4px; color: var(--text); } +.upload-item { display: flex; align-items: center; gap: 10px; padding: 8px 16px; font-size: 13px; } +.upload-item .up-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.progress { height: 4px; background: var(--bg-3); border-radius: 4px; overflow: hidden; flex: 1; } +.progress > span { display: block; height: 100%; background: var(--accent); transition: width 0.3s; } + +/* ===== Query / Chat ===== */ +.qa-wrap { display: flex; flex-direction: column; height: 100%; gap: 16px; } +.qa-input-bar { display: flex; gap: 10px; flex-shrink: 0; align-items: flex-end; } +.qa-input { + flex: 1; background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); + padding: 12px 14px; color: var(--text); resize: none; min-height: 46px; transition: border-color 0.15s; +} +.qa-input:focus { outline: none; border-color: var(--accent); } +.qa-stream { flex: 1; overflow-y: auto; } +.msg { margin-bottom: 18px; animation: fadein 0.2s ease; } +.msg-role { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; display: flex; align-items: center; gap: 7px; } +.msg-role .role-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); } +.msg-role.user .role-dot { background: var(--text-2); } +.msg-bubble { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; } +.msg-bubble.user { background: var(--accent-soft); border-color: transparent; } +.spinner-wrap { display: inline-flex; align-items: center; gap: 8px; } +.chat-sessions { display: flex; flex-direction: column; gap: 2px; max-height: 160px; overflow-y: auto; flex-shrink: 0; } +.session-item { padding: 7px 10px; border-radius: var(--radius-sm); font-size: 12px; color: var(--text-2); text-align: left; display: flex; gap: 8px; align-items: center; justify-content: space-between; } +.session-item:hover { background: var(--bg-2); color: var(--text); } +.session-item.active { background: var(--accent-soft); color: var(--accent); } +.session-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.session-del { color: var(--text-3); flex-shrink: 0; opacity: 0; transition: opacity 0.15s; } +.session-item:hover .session-del { opacity: 1; } +.session-del:hover { color: var(--red); } + +/* ===== Markdown ===== */ +.md { font-size: 14px; line-height: 1.65; color: var(--text); word-break: break-word; } +.md > :first-child { margin-top: 0; } +.md > :last-child { margin-bottom: 0; } +.md p { margin: 0 0 10px; } +.md h1, .md h2, .md h3, .md h4 { margin: 16px 0 8px; font-weight: 650; line-height: 1.3; } +.md h1 { font-size: 18px; } .md h2 { font-size: 16px; } .md h3 { font-size: 15px; } .md h4 { font-size: 14px; } +.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; } +.md li { margin: 2px 0; } +.md a { color: var(--accent); text-decoration: none; } .md a:hover { text-decoration: underline; } +.md code { font-family: var(--mono); font-size: 12.5px; background: var(--bg-3); padding: 1px 6px; border-radius: 4px; color: var(--cyan); } +.md pre { background: var(--bg); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 12px 14px; overflow-x: auto; margin: 8px 0; } +.md pre code { background: none; padding: 0; color: var(--text); font-size: 12.5px; line-height: 1.5; } +.md blockquote { border-left: 3px solid var(--border); margin: 8px 0; padding: 4px 14px; color: var(--text-2); } +.md table { border-collapse: collapse; margin: 8px 0; width: 100%; font-size: 13px; } +.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; } +.md th { background: var(--bg-2); font-weight: 600; } +.md hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; } +.md img { max-width: 100%; border-radius: var(--radius-sm); } +.md input[type="checkbox"] { margin-right: 6px; accent-color: var(--accent); } + +/* ===== Maintenance ===== */ +.maint-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } +.maint-card { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; } +.maint-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; } +.maint-card p { font-size: 12.5px; color: var(--text-2); margin-bottom: 14px; } +.maint-log { + background: var(--bg); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); + padding: 12px 14px; font-family: var(--mono); font-size: 12px; color: var(--text-2); + max-height: 240px; overflow-y: auto; margin-top: 12px; white-space: pre-wrap; +} +.maint-log .log-line { padding: 1px 0; } +.maint-log .log-line.ok { color: var(--green); } +.maint-log .log-line.warn { color: var(--amber); } +.maint-log .log-line.err { color: var(--red); } +.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; } +.toggle { position: relative; width: 38px; height: 22px; background: var(--bg-3); border-radius: 20px; cursor: pointer; transition: background 0.18s; flex-shrink: 0; } +.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: var(--text); border-radius: 50%; transition: transform 0.18s; } +.toggle.on { background: var(--green); } +.toggle.on::after { transform: translateX(16px); } + +/* ===== Overlay / modal / toast ===== */ +.overlay { position: fixed; inset: 0; background: rgba(8, 9, 12, 0.65); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; } +.modal { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); width: 420px; max-width: 92vw; box-shadow: var(--shadow); } +.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border-soft); } +.modal-head h2 { font-size: 16px; font-weight: 650; } +.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; } +.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border-soft); } +.field { display: flex; flex-direction: column; gap: 6px; } +.field-label { font-size: 12px; color: var(--text-2); font-weight: 550; } +.field input, .field textarea, .field select { + background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); + padding: 9px 11px; color: var(--text); transition: border-color 0.15s; +} +.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); } +.field-hint { font-size: 11px; color: var(--text-3); } +.toast { + position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); + background: var(--bg-3); border: 1px solid var(--border); color: var(--text); + padding: 11px 18px; border-radius: var(--radius-sm); font-size: 13px; box-shadow: var(--shadow); z-index: 200; + animation: fadein 0.2s ease; +} +.toast.ok { border-color: var(--green); } +.toast.err { border-color: var(--red); } + +/* ===== Misc ===== */ +.empty-state { text-align: center; color: var(--text-3); padding: 60px 20px; } +.empty-state svg { margin: 0 auto 14px; color: var(--text-3); } +.empty-state h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--text-2); } +.empty-state p { font-size: 13px; } +.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; } +@keyframes spin { to { transform: rotate(360deg); } } +.concept-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 16px; } +.concept-chip { font-size: 12px; padding: 4px 11px; border-radius: 20px; background: var(--bg-2); border: 1px solid var(--border-soft); color: var(--text-2); cursor: pointer; transition: background 0.15s, color 0.15s; } +.concept-chip:hover { background: var(--accent-soft); color: var(--accent); border-color: transparent; } +.row-actions { display: flex; gap: 6px; justify-content: flex-end; } +.select { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 11px; color: var(--text); font-size: 13px; } +.select:focus { outline: none; border-color: var(--accent); } + +/* ===== Mobile ===== */ +.mobile-menu-btn { display: none; } +.sidebar-overlay { display: none; } +@media (max-width: 960px) { + .app { grid-template-columns: 1fr; } + .sidebar { + position: fixed; top: 0; left: 0; bottom: 0; width: 232px; z-index: 60; + transform: translateX(-100%); transition: transform 0.22s ease; + } + .sidebar.open { transform: translateX(0); } + .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 55; } + .mobile-menu-btn { + display: grid; place-items: center; position: fixed; top: 14px; left: 14px; z-index: 50; + width: 38px; height: 38px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--border); color: var(--text); + } + .workspace { padding-top: 44px; } + .inspector { display: none; } + .stat-grid { grid-template-columns: repeat(2, 1fr); } + .maint-grid { grid-template-columns: 1fr; } + .ws-header { padding: 14px 20px 14px 64px; } + .ws-body { padding: 18px 20px 32px; } +} + +/* ===== Scrollbar ===== */ +::-webkit-scrollbar { width: 9px; height: 9px; } +::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; } +::-webkit-scrollbar-thumb:hover { background: #2e3445; } +::-webkit-scrollbar-track { background: transparent; } diff --git a/frontend/src/views/Chat.jsx b/frontend/src/views/Chat.jsx new file mode 100644 index 000000000..6eb5c8d8b --- /dev/null +++ b/frontend/src/views/Chat.jsx @@ -0,0 +1,161 @@ +import { useState, useRef, useEffect, useCallback } from "react"; +import { MessageSquare, Send, Plus, Trash2, StopCircle } from "lucide-react"; +import { useSSEStream } from "../hooks/useSSEStream.js"; +import { api } from "../api/client.js"; +import { useApp } from "../state/AppContext.jsx"; +import EmptyState from "../components/EmptyState.jsx"; +import Markdown from "../components/Markdown.jsx"; + +function esc(s) { + return String(s == null ? "" : s).replace(/[&<>]/g, (c) => ({ "&": "&", "<": "<", ">": ">" }[c])); +} + +export default function Chat({ kb }) { + const { inspReset, inspAdd, inspDone, toastMsg } = useApp(); + const { busy, start, stop } = useSSEStream(); + const [sessions, setSessions] = useState([]); + const [sessionId, setSessionId] = useState(null); + const [msgs, setMsgs] = useState([]); + const [input, setInput] = useState(""); + const taRef = useRef(null); + const scrollRef = useRef(null); + + const loadSessions = useCallback(() => { + api.chatSessions(kb).then((r) => setSessions(r.sessions || [])).catch(() => setSessions([])); + }, [kb]); + + useEffect(loadSessions, [loadSessions]); + + useEffect(() => { if (scrollRef.current) scrollRef.current.scrollTop = scrollRef.current.scrollHeight; }, [msgs]); + + function newSession() { + setSessionId(null); + setMsgs([]); + } + + async function loadHistory(sid) { + setSessionId(sid); + setMsgs([]); + try { + const r = await api.chatSessionLoad(kb, sid); + const hist = []; + const n = Math.max(r.user_turns.length, r.assistant_texts.length); + for (let i = 0; i < n; i++) { + if (i < r.user_turns.length) hist.push({ role: "user", text: r.user_turns[i] }); + if (i < r.assistant_texts.length) hist.push({ role: "assistant", text: r.assistant_texts[i] }); + } + setMsgs(hist); + } catch (e) { + toastMsg(e.message, "err"); + } + } + + async function delSession(sid, e) { + e.stopPropagation(); + if (!window.confirm("删除此会话?")) return; + try { + await api.chatSessionDelete(kb, sid); + if (sid === sessionId) newSession(); + loadSessions(); + toastMsg("已删除", "ok"); + } catch (e2) { + toastMsg(e2.message, "err"); + } + } + + function autosize() { + const ta = taRef.current; + if (ta) { ta.style.height = "auto"; ta.style.height = Math.min(ta.scrollHeight, 140) + "px"; } + } + + async function send() { + const text = input.trim(); + if (!text || busy) return; + setInput(""); + if (taRef.current) taRef.current.style.height = "auto"; + inspReset(true); + const userMsg = { role: "user", text }; + const aiMsg = { role: "assistant", text: "", pending: true }; + setMsgs((m) => [...m, userMsg, aiMsg]); + const aiIdx = msgs.length + 1; + let acc = ""; + const onAbort = () => { + setMsgs((m) => { const n = [...m]; n[aiIdx] = { role: "assistant", text: acc, pending: false, aborted: true }; return n; }); + inspAdd("tool", "已停止", "用户中断生成"); + }; + try { + await start( + { path: "/api/v1/chat", payload: { kb, message: text, session_id: sessionId, stream: true } }, + (ev, d) => { + if (ev === "start" && d.session_id) setSessionId(d.session_id); + else if (ev === "tool_call") inspAdd("tool", "检索 · " + (d.name || "tool"), `<code>${esc((d.arguments || "").slice(0, 120))}</code>`); + else if (ev === "delta") { + acc += d.text || ""; + setMsgs((m) => { const n = [...m]; n[aiIdx] = { role: "assistant", text: acc, pending: true }; return n; }); + } else if (ev === "final") { + acc = d.answer || acc; + setMsgs((m) => { const n = [...m]; n[aiIdx] = { role: "assistant", text: acc, pending: false }; return n; }); + inspAdd("done", "完成", `第 ${d.turn_count || ""} 轮`); + } else if (ev === "error") { + setMsgs((m) => { const n = [...m]; n[aiIdx] = { role: "assistant", text: `<span style="color:var(--red)">${esc(d.message)}</span>`, pending: false }; return n; }); + inspAdd("error", "错误", esc(d.message)); + } + }, + onAbort + ); + loadSessions(); + } finally { + inspDone(); + } + } + + return ( + <div className="qa-wrap"> + <div className="chat-sessions"> + <button className={`session-item ${!sessionId ? "active" : ""}`} onClick={newSession}> + <Plus size={13} /> 本次新会话 + </button> + {sessions.map((s) => ( + <button key={s.id} className={`session-item ${s.id === sessionId ? "active" : ""}`} onClick={() => loadHistory(s.id)}> + <span className="session-title">{s.title || s.id}</span> + <Trash2 size={13} className="session-del" onClick={(e) => delSession(s.id, e)} /> + </button> + ))} + </div> + <div className="qa-stream" ref={scrollRef}> + {msgs.length === 0 ? ( + <EmptyState + icon={<MessageSquare size={40} strokeWidth={1.5} />} + title="多轮对话" + desc="会话自动持久化,可跨次恢复。" + /> + ) : ( + msgs.map((m, i) => ( + <div className="msg" key={i}> + <div className={`msg-role ${m.role === "user" ? "user" : ""}`}><span className="role-dot" />{m.role === "user" ? "你" : "OpenKB"}</div> + <div className={`msg-bubble ${m.role === "user" ? "user" : ""}`}> + {m.role === "user" ? m.text : (m.text ? <Markdown>{m.text}</Markdown> : (m.aborted ? <span className="cell-meta">已停止生成</span> : <span className="spinner-wrap"><span className="spinner" /></span>))} + </div> + </div> + )) + )} + </div> + <div className="qa-input-bar"> + <button className="btn btn-ghost btn-sm" onClick={newSession}><Plus size={14} /> 新会话</button> + <textarea + ref={taRef} + className="qa-input" + placeholder="继续对话…" + rows={1} + value={input} + onChange={(e) => { setInput(e.target.value); autosize(); }} + // isComposing: 避免拼音输入法确认候选词时误触发提交 + onKeyDown={(e) => { if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) { e.preventDefault(); send(); } }} + /> + {busy + ? <button className="btn btn-ghost" onClick={stop}><StopCircle size={15} /> 停止生成</button> + : <button className="btn btn-primary" onClick={send}><Send size={15} /> 发送</button>} + </div> + </div> + ); +} diff --git a/frontend/src/views/Documents.jsx b/frontend/src/views/Documents.jsx new file mode 100644 index 000000000..5ff088d64 --- /dev/null +++ b/frontend/src/views/Documents.jsx @@ -0,0 +1,139 @@ +import { useEffect, useState, useRef, useCallback } from "react"; +import { UploadCloud, Trash2, RefreshCw } from "lucide-react"; +import { api } from "../api/client.js"; +import { streamUpload, streamSSE } from "../api/sse.js"; +import { useApp } from "../state/AppContext.jsx"; +import EmptyState from "../components/EmptyState.jsx"; +import Spinner from "../components/Spinner.jsx"; + +function docRow(d) { + const ext = (d.name.split(".").pop() || "").toLowerCase(); + const ico = d.type === "url" ? "URL" : ext.toUpperCase().slice(0, 4) || "FILE"; + return ( + <tr key={d.hash}> + <td><span className="icon-cell"><span className="file-ico">{ico}</span><span className="cell-name">{d.name}</span></span></td> + <td><span className="tag">{d.display_type || d.type || "—"}</span></td> + <td className="cell-meta">{d.pages != null ? d.pages : "—"}</td> + <td className="cell-meta">{d.hash.slice(0, 8)}</td> + <td><div className="row-actions"><button className="btn btn-danger btn-sm" data-rm={d.name}>删除</button></div></td> + </tr> + ); +} + +export default function Documents({ kb }) { + const { inspReset, inspAdd, inspDone, toastMsg } = useApp(); + const [docs, setDocs] = useState(null); + const [err, setErr] = useState(null); + const [uploads, setUploads] = useState([]); + const [dragging, setDragging] = useState(false); + const fileRef = useRef(null); + + const load = useCallback(() => { + setDocs(null); + setErr(null); + api.list(kb).then((r) => setDocs(r.documents || [])).catch((e) => setErr(e.message)); + }, [kb]); + + useEffect(load, [load]); + + function onFiles(files) { + if (!files || !files.length) return; + const items = Array.from(files).map((f) => ({ name: f.name, pct: 10, status: "上传中" })); + setUploads(items); + inspReset(true); + const form = new FormData(); + form.append("kb", kb); + form.append("stream", "true"); + Array.from(files).forEach((f) => form.append("files", f)); + streamUpload("/api/v1/add", form, (ev, d) => { + if (ev === "file_start") { + setUploads((prev) => prev.map((u) => (u.name === d.original_name ? { ...u, pct: 50, status: "编译中" } : u))); + inspAdd("tool", "编译", `处理 <code>${d.original_name}</code>`); + } else if (ev === "file_done") { + const ok = d.status === "added"; + setUploads((prev) => prev.map((u) => (u.name === d.original_name ? { ...u, pct: 100, status: ok ? "已添加" : d.status } : u))); + inspAdd(ok ? "done" : "tool", ok ? "完成" : "跳过", `${d.original_name}:${d.message || d.status}`); + } else if (ev === "final") { + toastMsg(`已添加 ${d.added_count},跳过 ${d.skipped_count},失败 ${d.failed_count}`, d.failed_count ? "err" : "ok"); + } else if (ev === "error") { + toastMsg(d.message || "上传失败", "err"); + inspAdd("error", "错误", d.message || ""); + } + }).then(() => { inspAdd("done", "结束", "编译流程结束"); load(); }) + .catch((e) => { toastMsg(e.message, "err"); inspAdd("error", "错误", e.message); }) + .finally(() => { inspDone(); }); + } + + async function removeDoc(name) { + if (!window.confirm(`确定删除文档「${name}」并清理其 wiki 页面?`)) return; + inspReset(true); + try { + await streamSSE("/api/v1/remove", { kb, identifier: name, stream: true }, (ev, d) => { + if (ev === "plan") inspAdd("tool", "计划", `将清理 ${d.name || name} 相关页面`); + else if (ev === "final") inspAdd("done", "完成", `已删除 ${d.name || name}`); + else if (ev === "error") { toastMsg(d.message || "删除失败", "err"); inspAdd("error", "错误", d.message || ""); } + }); + toastMsg("已删除", "ok"); + load(); + } catch (e) { + toastMsg(e.message, "err"); + inspAdd("error", "错误", e.message); + } finally { + inspDone(); + } + } + + return ( + <> + <div + className={`dropzone ${dragging ? "drag" : ""}`} + onClick={() => fileRef.current && fileRef.current.click()} + onDragOver={(e) => { e.preventDefault(); setDragging(true); }} + onDragLeave={() => setDragging(false)} + onDrop={(e) => { e.preventDefault(); setDragging(false); if (e.dataTransfer.files.length) onFiles(e.dataTransfer.files); }} + > + <UploadCloud size={28} style={{ margin: "0 auto 8px", color: "var(--text-2)" }} /> + <div className="dz-title">拖入文件或点击上传</div> + <div>PDF · Word · Markdown · PPT · HTML · Excel · CSV · TXT · URL</div> + <input ref={fileRef} type="file" multiple style={{ display: "none" }} onChange={(e) => { if (e.target.files.length) onFiles(e.target.files); e.target.value = ""; }} /> + </div> + + {uploads.length > 0 && ( + <div className="panel"> + <div className="panel-head"><span className="panel-title">上传进度</span></div> + <div className="panel-body"> + {uploads.map((u, i) => ( + <div className="upload-item" key={i}> + <span className="up-name">{u.name}</span> + <div className="progress"><span style={{ width: `${u.pct}%` }} /></div> + <span className="cell-meta">{u.status}</span> + </div> + ))} + </div> + </div> + )} + + <div className="panel"> + <div className="panel-head"> + <span className="panel-title">已索引文档</span> + <button className="btn btn-ghost btn-sm" onClick={load}><RefreshCw size={14} /> 刷新</button> + </div> + <div className="panel-body"> + {err ? <EmptyState title="加载失败" desc={err} /> : + docs === null ? <div className="empty-state"><Spinner /></div> : + docs.length === 0 ? <EmptyState title="暂无文档" desc="上传文件后将自动编译为 wiki。" /> : ( + <table className="table"> + <thead><tr><th>文档</th><th>类型</th><th>页数</th><th>哈希</th><th></th></tr></thead> + <tbody> + {docs.map((d) => { + const row = docRow(d); + return <tr key={d.hash} onClick={(e) => { const btn = e.target.closest("[data-rm]"); if (btn) removeDoc(btn.getAttribute("data-rm")); }}>{row.props.children}</tr>; + })} + </tbody> + </table> + )} + </div> + </div> + </> + ); +} diff --git a/frontend/src/views/Maintenance.jsx b/frontend/src/views/Maintenance.jsx new file mode 100644 index 000000000..ce53a69e6 --- /dev/null +++ b/frontend/src/views/Maintenance.jsx @@ -0,0 +1,175 @@ +import { useState, useEffect, useRef } from "react"; +import { api } from "../api/client.js"; +import { streamSSE } from "../api/sse.js"; +import { useApp } from "../state/AppContext.jsx"; + +function esc(s) { + return String(s == null ? "" : s).replace(/[&<>]/g, (c) => ({ "&": "&", "<": "<", ">": ">" }[c])); +} + +function fmtTime(iso) { + if (!iso) return null; + try { const d = new Date(iso); return isNaN(d) ? iso : d.toLocaleString("zh-CN", { month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" }); } + catch { return iso; } +} + +export default function Maintenance({ kb }) { + const { inspReset, inspAdd, inspDone, toastMsg } = useApp(); + const [fix, setFix] = useState(false); + const [lintLog, setLintLog] = useState([]); + const [rcScope, setRcScope] = useState("all"); + const [rcDocs, setRcDocs] = useState([]); + const [rcDoc, setRcDoc] = useState(""); + const [rcLog, setRcLog] = useState([]); + const [watchOn, setWatchOn] = useState(false); + const [status, setStatus] = useState(null); + const rcScroll = useRef(null); + const lintRef = useRef([]); + const rcRef = useRef([]); + + useEffect(() => { + api.status(kb).then(setStatus).catch(() => setStatus(null)); + api.watchStatus(kb).then((r) => setWatchOn(!!r.active)).catch(() => {}); + }, [kb]); + + // Populate the document list for the "指定文档" recompile scope. + useEffect(() => { + let alive = true; + api.list(kb) + .then((r) => { if (!alive) return; const docs = (r.documents || []).map((d) => d.name).filter(Boolean); setRcDocs(docs); setRcDoc((prev) => (prev && docs.includes(prev)) ? prev : (docs[0] || "")); }) + .catch(() => { if (!alive) return; setRcDocs([]); setRcDoc(""); }); + return () => { alive = false; }; + }, [kb]); + + useEffect(() => { if (rcScroll.current) rcScroll.current.scrollTop = rcScroll.current.scrollHeight; }, [rcLog]); + + function pushLint(line) { lintRef.current = [...lintRef.current, line]; setLintLog(lintRef.current); } + function pushRc(line) { rcRef.current = [...rcRef.current, line]; setRcLog(rcRef.current); } + + async function runLint() { + lintRef.current = [{ kind: "plain", text: `运行中${fix ? "(自动修复)" : ""}…` }]; + setLintLog(lintRef.current); + inspReset(true); + try { + const r = await api.lint(kb, fix); + lintRef.current = []; + if (r.skipped) pushLint({ kind: "warn", text: r.reason || "已跳过" }); + pushLint({ kind: "ok", text: r.message }); + if (r.lint_files_changed != null) pushLint({ kind: "plain", text: `修改文件:${r.lint_files_changed},清理幽灵链接:${r.lint_ghosts_removed}` }); + if (r.structural_report) pushLint({ kind: "plain", text: esc(r.structural_report).slice(0, 600) }); + inspAdd("done", "Lint", esc(r.message)); + toastMsg("检查完成", "ok"); + } catch (e) { + pushLint({ kind: "err", text: esc(e.message) }); + toastMsg(e.message, "err"); + inspAdd("error", "错误", esc(e.message)); + } finally { + inspDone(); + } + } + + async function runRecompile() { + rcRef.current = [{ kind: "plain", text: "重编译中…" }]; + setRcLog(rcRef.current); + inspReset(true); + // all -> all_docs:true; one -> doc_name (backend resolves a single doc). + const payload = rcScope === "one" + ? { kb, doc_name: rcDoc, stream: true } + : { kb, all_docs: true, stream: true }; + try { + await streamSSE("/api/v1/recompile", payload, (ev, d) => { + if (ev === "plan") pushRc({ kind: "plain", text: `目标 ${d.targets ? d.targets.length : 0} 个` }); + else if (ev === "doc") pushRc({ kind: d.status === "ok" ? "ok" : d.status === "error" ? "err" : "warn", text: `${d.name || d.doc_name || ""} → ${d.status}${d.message ? "," + d.message : ""}` }); + else if (ev === "final") { pushRc({ kind: "ok", text: `完成:重编译 ${d.recompiled},跳过 ${d.skipped}` }); toastMsg("重编译完成", "ok"); inspAdd("done", "完成", `重编译 ${d.recompiled},跳过 ${d.skipped}`); } + else if (ev === "error") { pushRc({ kind: "err", text: d.message }); toastMsg(d.message, "err"); inspAdd("error", "错误", esc(d.message)); } + }); + } catch (e) { + pushRc({ kind: "err", text: esc(e.message) }); + toastMsg(e.message, "err"); + inspAdd("error", "错误", esc(e.message)); + } finally { + inspDone(); + api.status(kb).then(setStatus).catch(() => {}); + } + } + + async function toggleWatch() { + const turnOn = !watchOn; + try { + if (turnOn) await api.watchStart(kb, 2); + else await api.watchStop(kb); + setWatchOn(turnOn); + toastMsg(turnOn ? "已开启监听" : "已停止监听", "ok"); + } catch (e) { + toastMsg(e.message, "err"); + } + } + + const dirs = status?.directories || {}; + const rcDisabled = rcScope === "one" && !rcDoc; + + return ( + <div className="maint-grid"> + <div className="maint-card"> + <h3>健康检查 · Lint</h3> + <p>检测结构完整性与知识一致性,可自动修复失效的 wikilink。</p> + <div className="toggle-row"> + <span className="cell-meta">自动修复</span> + <div className={`toggle ${fix ? "on" : ""}`} onClick={() => setFix((f) => !f)} /> + </div> + <div className="row-actions"> + <button className="btn btn-primary btn-sm" onClick={runLint}>运行检查</button> + </div> + <div className="maint-log"> + {lintLog.map((l, i) => <div key={i} className={`log-line ${l.kind}`}>{l.text}</div>)} + </div> + </div> + + <div className="maint-card"> + <h3>重新编译 · Recompile</h3> + <p>对已索引文档重跑编译,重生成摘要并改写概念页(手动编辑会被覆盖)。</p> + <div className="toggle-row"> + <span className="cell-meta">范围</span> + <select className="select" style={{ width: "auto" }} value={rcScope} onChange={(e) => setRcScope(e.target.value)}> + <option value="all">全部文档</option> + <option value="one">指定文档</option> + </select> + {rcScope === "one" && ( + <select className="select" style={{ width: "auto", marginLeft: 8 }} value={rcDoc} onChange={(e) => setRcDoc(e.target.value)} disabled={rcDocs.length === 0}> + {rcDocs.length === 0 + ? <option value="">(无文档)</option> + : rcDocs.map((n) => <option key={n} value={n}>{n}</option>)} + </select> + )} + </div> + <div className="row-actions"> + <button className="btn btn-ghost btn-sm" onClick={runRecompile} disabled={rcDisabled}>开始重编译</button> + </div> + <div className="maint-log" ref={rcScroll}> + {rcLog.map((l, i) => <div key={i} className={`log-line ${l.kind}`}>{l.text}</div>)} + </div> + </div> + + <div className="maint-card"> + <h3>文件监听 · Watch</h3> + <p>监听 raw/ 目录,新增文件自动编译为 wiki。</p> + <div className="toggle-row"> + <span className="cell-meta">监听状态</span> + <div className={`toggle ${watchOn ? "on" : ""}`} onClick={toggleWatch} /> + </div> + </div> + + <div className="maint-card"> + <h3>知识库状态</h3> + <p>目录结构与索引概况。</p> + <div className="maint-log"> + {Object.entries(dirs).map(([k, v]) => <div key={k} className="log-line">{k}:{v} 篇</div>)} + {status && <div className="log-line">原始文件:{status.raw_count}</div>} + {status && <div className="log-line">已索引:{status.total_indexed}</div>} + {status?.last_compile && <div className="log-line ok">上次编译:{fmtTime(status.last_compile)}</div>} + {status?.last_lint && <div className="log-line ok">上次检查:{fmtTime(status.last_lint)}</div>} + </div> + </div> + </div> + ); +} diff --git a/frontend/src/views/Overview.jsx b/frontend/src/views/Overview.jsx new file mode 100644 index 000000000..e49d9a11b --- /dev/null +++ b/frontend/src/views/Overview.jsx @@ -0,0 +1,111 @@ +import { useEffect, useState } from "react"; +import { api } from "../api/client.js"; +import { useApp } from "../state/AppContext.jsx"; +import EmptyState from "../components/EmptyState.jsx"; +import Spinner from "../components/Spinner.jsx"; + +function StatCard({ label, value, sub, color }) { + return ( + <div className={`stat-card ${color || ""}`}> + <div className="stat-label">{label}</div> + <div className="stat-value">{value}</div> + <div className="stat-sub">{sub}</div> + </div> + ); +} + +function fmtTime(iso) { + if (!iso) return null; + try { + const d = new Date(iso); + if (isNaN(d)) return iso; + return d.toLocaleString("zh-CN", { month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" }); + } catch { + return iso; + } +} + +export default function Overview({ kb }) { + const { setView, toastMsg } = useApp(); + const [data, setData] = useState(null); + const [err, setErr] = useState(null); + + useEffect(() => { + let alive = true; + setData(null); + setErr(null); + Promise.all([api.status(kb), api.list(kb)]) + .then(([status, list]) => { if (alive) setData({ status, list }); }) + .catch((e) => { if (alive) setErr(e.message); }); + return () => { alive = false; }; + }, [kb]); + + if (err) return <EmptyState title="加载失败" desc={err} />; + if (!data) return <div className="empty-state"><Spinner /></div>; + + const { status, list } = data; + const dirs = status.directories || {}; + + return ( + <> + <div className="stat-grid"> + <StatCard label="已索引文档" value={status.total_indexed} sub={`原始文件 ${status.raw_count}`} color="accent" /> + <StatCard label="概念页" value={dirs.concepts || 0} sub="跨文档综合" color="cyan" /> + <StatCard label="摘要页" value={dirs.summaries || 0} sub="每篇一摘要" color="green" /> + <StatCard label="报告页" value={dirs.reports || 0} sub="检查与合成" color="purple" /> + </div> + + {list.concepts && list.concepts.length > 0 && ( + <div className="panel"> + <div className="panel-head"> + <span className="panel-title">核心概念</span> + <span className="tag">{list.concepts.length}</span> + </div> + <div className="concept-chips"> + {list.concepts.slice(0, 40).map((c) => ( + <button + key={c} + className="concept-chip" + onClick={() => { setView("query"); setTimeout(() => window.dispatchEvent(new CustomEvent("openkb:prefill-query", { detail: `什么是「${c}」?请基于知识库解释。` })), 30); }} + > + {c} + </button> + ))} + </div> + </div> + )} + + <div className="panel"> + <div className="panel-head"><span className="panel-title">最近文档</span></div> + <div className="panel-body"> + {list.documents && list.documents.length > 0 ? ( + <table className="table"> + <thead><tr><th>文档</th><th>类型</th><th>页数</th></tr></thead> + <tbody> + {list.documents.slice(-8).reverse().map((d) => ( + <tr key={d.hash}> + <td><span className="icon-cell"><span className="file-ico">{d.display_type || d.type || "FILE"}</span><span className="cell-name">{d.name}</span></span></td> + <td><span className="tag">{d.display_type || d.type || "—"}</span></td> + <td className="cell-meta">{d.pages != null ? d.pages : "—"}</td> + </tr> + ))} + </tbody> + </table> + ) : ( + <EmptyState title="暂无文档" desc="去「文档」页添加文件开始编译。" /> + )} + </div> + </div> + + {(status.last_compile || status.last_lint) && ( + <div className="panel"> + <div className="panel-head"><span className="panel-title">活动</span></div> + <div className="panel-body"> + {status.last_compile && <div className="log-line ok" style={{ padding: "4px 16px" }}>上次编译:{fmtTime(status.last_compile)}</div>} + {status.last_lint && <div className="log-line ok" style={{ padding: "4px 16px" }}>上次检查:{fmtTime(status.last_lint)}</div>} + </div> + </div> + )} + </> + ); +} diff --git a/frontend/src/views/Query.jsx b/frontend/src/views/Query.jsx new file mode 100644 index 000000000..71084e171 --- /dev/null +++ b/frontend/src/views/Query.jsx @@ -0,0 +1,108 @@ +import { useState, useRef, useEffect } from "react"; +import { Search, Send, StopCircle } from "lucide-react"; +import { useSSEStream } from "../hooks/useSSEStream.js"; +import { useApp } from "../state/AppContext.jsx"; +import EmptyState from "../components/EmptyState.jsx"; +import Markdown from "../components/Markdown.jsx"; + +function esc(s) { + return String(s == null ? "" : s).replace(/[&<>]/g, (c) => ({ "&": "&", "<": "<", ">": ">" }[c])); +} + +export default function Query({ kb }) { + const { inspReset, inspAdd, inspDone, toastMsg } = useApp(); + const { busy, start, stop } = useSSEStream(); + const [q, setQ] = useState(""); + const [msgs, setMsgs] = useState([]); + const taRef = useRef(null); + const scrollRef = useRef(null); + + useEffect(() => { + function onPrefill(e) { setQ(e.detail); if (taRef.current) taRef.current.focus(); } + window.addEventListener("openkb:prefill-query", onPrefill); + return () => window.removeEventListener("openkb:prefill-query", onPrefill); + }, []); + + useEffect(() => { if (scrollRef.current) scrollRef.current.scrollTop = scrollRef.current.scrollHeight; }, [msgs]); + + function autosize() { + const ta = taRef.current; + if (ta) { ta.style.height = "auto"; ta.style.height = Math.min(ta.scrollHeight, 140) + "px"; } + } + + async function run() { + const question = q.trim(); + if (!question || busy) return; + setQ(""); + if (taRef.current) taRef.current.style.height = "auto"; + inspReset(true); + const pair = { user: question, acc: "" }; + setMsgs((m) => [...m, pair]); + const idx = msgs.length; + const onAbort = () => { + setMsgs((m) => { const n = [...m]; n[idx] = { ...pair, aborted: true }; return n; }); + inspAdd("tool", "已停止", "用户中断生成"); + }; + try { + await start( + { path: "/api/v1/query", payload: { kb, question, stream: true } }, + (ev, d) => { + if (ev === "tool_call") inspAdd("tool", "检索 · " + (d.name || "tool"), `<code>${esc((d.arguments || "").slice(0, 120))}</code>`); + else if (ev === "delta") { + pair.acc += d.text || ""; + setMsgs((m) => { const n = [...m]; n[idx] = { ...pair }; return n; }); + } else if (ev === "final") { + pair.acc = d.answer || pair.acc; + setMsgs((m) => { const n = [...m]; n[idx] = { ...pair }; return n; }); + inspAdd("done", "完成", "推理检索结束"); + } else if (ev === "error") { + pair.acc = `<span style="color:var(--red)">${esc(d.message)}</span>`; + setMsgs((m) => { const n = [...m]; n[idx] = { ...pair }; return n; }); + inspAdd("error", "错误", esc(d.message)); + } + }, + onAbort + ); + } finally { + inspDone(); + } + } + + return ( + <div className="qa-wrap"> + <div className="qa-stream" ref={scrollRef}> + {msgs.length === 0 ? ( + <EmptyState + icon={<Search size={40} strokeWidth={1.5} />} + title="向知识库提问" + desc="基于无向量推理检索,答案附推理过程。" + /> + ) : ( + msgs.map((m, i) => ( + <div className="msg" key={i}> + <div className="msg-role user"><span className="role-dot" />你</div> + <div className="msg-bubble user">{m.user}</div> + <div className="msg-role"><span className="role-dot" />OpenKB</div> + <div className="msg-bubble">{m.acc ? <Markdown>{m.acc}</Markdown> : (m.aborted ? <span className="cell-meta">已停止生成</span> : <span className="spinner-wrap"><span className="spinner" /></span>)}</div> + </div> + )) + )} + </div> + <div className="qa-input-bar"> + <textarea + ref={taRef} + className="qa-input" + placeholder="例如:这篇文章的主要结论是什么?" + rows={1} + value={q} + onChange={(e) => { setQ(e.target.value); autosize(); }} + // isComposing: 避免拼音输入法确认候选词时误触发提交 + onKeyDown={(e) => { if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) { e.preventDefault(); run(); } }} + /> + {busy + ? <button className="btn btn-ghost" onClick={stop}><StopCircle size={15} /> 停止生成</button> + : <button className="btn btn-primary" onClick={run}><Send size={15} /> 提问</button>} + </div> + </div> + ); +} diff --git a/frontend/vite.config.js b/frontend/vite.config.js new file mode 100644 index 000000000..b31764914 --- /dev/null +++ b/frontend/vite.config.js @@ -0,0 +1,22 @@ +import { defineConfig } from "vite"; +import react from "@vitejs/plugin-react"; + +// Dev server proxies /api to the OpenKB REST API on :8000; production serves +// the built bundle from the same origin via FastAPI StaticFiles. +export default defineConfig({ + plugins: [react()], + base: "/", + build: { + outDir: "../web", + emptyOutDir: true, + }, + server: { + port: 5173, + proxy: { + "/api": { + target: "http://127.0.0.1:8000", + changeOrigin: true, + }, + }, + }, +}); diff --git a/openkb-postman.json b/openkb-postman.json new file mode 100644 index 000000000..554f95916 --- /dev/null +++ b/openkb-postman.json @@ -0,0 +1,845 @@ +{ + "info": { + "_postman_id": "209b7e72-4e08-44f5-a30a-332b4faf79d1", + "name": "openkb", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "list", + "request": { + "method": "POST", + "url": { + "raw": "http://127.0.0.1:8000/api/v1/list", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "path": [ + "api", + "v1", + "list" + ] + }, + "header": [ + { + "key": "User-Agent", + "value": "EasyPostman/v5.5.9" + }, + { + "key": "Accept", + "value": "*/*" + }, + { + "key": "Accept-Encoding", + "value": "gzip, deflate, br" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Authorization", + "value": "Bearer test-token" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"kb\": \"postman-kb\"\n}" + }, + "auth": { + } + } + }, + { + "name": "status", + "request": { + "method": "POST", + "url": { + "raw": "http://127.0.0.1:8000/api/v1/status", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "path": [ + "api", + "v1", + "status" + ] + }, + "header": [ + { + "key": "User-Agent", + "value": "EasyPostman/v5.5.9" + }, + { + "key": "Accept", + "value": "*/*" + }, + { + "key": "Accept-Encoding", + "value": "gzip, deflate, br" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Authorization", + "value": "Bearer test-token" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"kb\": \"postman-kb\"\n}" + }, + "auth": { + } + } + }, + { + "name": "lint", + "request": { + "method": "POST", + "url": { + "raw": "http://127.0.0.1:8000/api/v1/lint", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "path": [ + "api", + "v1", + "lint" + ] + }, + "header": [ + { + "key": "User-Agent", + "value": "EasyPostman/v5.5.9" + }, + { + "key": "Accept", + "value": "*/*" + }, + { + "key": "Accept-Encoding", + "value": "gzip, deflate, br" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Authorization", + "value": "Bearer test-token" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"kb\": \"postman-kb\",\n \"fix\": false\n}" + }, + "auth": { + } + } + }, + { + "name": "query-stream", + "request": { + "method": "POST", + "url": { + "raw": "http://127.0.0.1:8000/api/v1/query", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "path": [ + "api", + "v1", + "query" + ] + }, + "header": [ + { + "key": "User-Agent", + "value": "EasyPostman/v5.5.9" + }, + { + "key": "Accept", + "value": "text/event-stream" + }, + { + "key": "Accept-Encoding", + "value": "gzip, deflate, br" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Authorization", + "value": "Bearer test-token" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"kb_dir\": \"D:\\\\project\\\\OpenKB\\\\postman-kb\",\n \"question\": \"这个知识库里有什么?\",\n \"stream\": true,\n \"save\": false\n}" + }, + "auth": { + } + } + }, + { + "name": "chat-stream", + "request": { + "method": "POST", + "url": { + "raw": "http://127.0.0.1:8000/api/v1/chat", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "path": [ + "api", + "v1", + "chat" + ] + }, + "header": [ + { + "key": "User-Agent", + "value": "EasyPostman/v5.5.9" + }, + { + "key": "Accept", + "value": "text/event-stream" + }, + { + "key": "Accept-Encoding", + "value": "gzip, deflate, br" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer test-token" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"kb\": \"postman-kb\",\n \"message\": \"详细说说brainstorming\",\n \"session_id\": \"20260627-124751-igb\",\n \"stream\": true\n}" + }, + "auth": { + } + } + }, + { + "name": "query", + "request": { + "method": "POST", + "url": { + "raw": "http://127.0.0.1:8000/api/v1/query", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "path": [ + "api", + "v1", + "query" + ] + }, + "header": [ + { + "key": "User-Agent", + "value": "EasyPostman/v5.5.9" + }, + { + "key": "Accept", + "value": "*/*" + }, + { + "key": "Accept-Encoding", + "value": "gzip, deflate, br" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Authorization", + "value": "Bearer test-token" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"kb\": \"postman-kb\",\n \"question\": \"这个知识库里有什么?\",\n \"stream\": false,\n \"save\": false\n}" + }, + "auth": { + } + } + }, + { + "name": "chat", + "request": { + "method": "POST", + "url": { + "raw": "http://127.0.0.1:8000/api/v1/chat", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "path": [ + "api", + "v1", + "chat" + ] + }, + "header": [ + { + "key": "User-Agent", + "value": "EasyPostman/v5.5.9" + }, + { + "key": "Accept", + "value": "*/*" + }, + { + "key": "Accept-Encoding", + "value": "gzip, deflate, br" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer test-token" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"kb\": \"postman-kb\",\n \"message\": \"详细说说superpowers\",\n \"session_id\": \"20260627-124523-p45\",\n \"stream\": false\n}" + }, + "auth": { + } + } + }, + { + "name": "init", + "request": { + "method": "POST", + "url": { + "raw": "http://127.0.0.1:8000/api/v1/init", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "path": [ + "api", + "v1", + "init" + ] + }, + "header": [ + { + "key": "User-Agent", + "value": "EasyPostman/v5.5.9" + }, + { + "key": "Accept", + "value": "*/*" + }, + { + "key": "Accept-Encoding", + "value": "gzip, deflate, br" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Authorization", + "value": "Bearer test-token" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"kb\": \"postman-kb\",\n \"model\": \"openai/deepseek-v4-flash\",\n \"api_key\": \"your-llm-api-key\",\n \"openai_api_base\": \"https://api.deepseek.com\"\n}" + }, + "auth": { + } + } + }, + { + "name": "add", + "request": { + "method": "POST", + "url": { + "raw": "http://127.0.0.1:8000/api/v1/add", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "path": [ + "api", + "v1", + "add" + ] + }, + "header": [ + { + "key": "User-Agent", + "value": "EasyPostman/v5.5.9" + }, + { + "key": "Accept", + "value": "*/*" + }, + { + "key": "Accept-Encoding", + "value": "gzip, deflate, br" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Authorization", + "value": "Bearer test-token" + }, + { + "key": "Content-Type", + "value": "multipart/form-data" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "kb", + "value": "postman-kb", + "type": "text" + }, + { + "key": "stream", + "value": "false", + "type": "text" + }, + { + "key": "files", + "src": "D:\\project\\ReadAgent(无需分块和向量化的RAG)\\OpenKB-Repo\\OpenKB\\md\\andrej-karpathy-skills-使用指南.md", + "type": "file" + }, + { + "key": "files", + "src": "D:\\project\\ReadAgent(无需分块和向量化的RAG)\\OpenKB-Repo\\OpenKB\\md\\codex-plugin-cc-使用指南.md", + "type": "file" + }, + { + "key": "files", + "src": "D:\\project\\ReadAgent(无需分块和向量化的RAG)\\OpenKB-Repo\\OpenKB\\md\\README_CN.md", + "type": "file" + }, + { + "key": "files", + "src": "D:\\project\\ReadAgent(无需分块和向量化的RAG)\\OpenKB-Repo\\OpenKB\\md\\SUPERPOWERS-完整使用指南.md", + "type": "file" + } + ] + }, + "auth": { + } + } + }, + { + "name": "remove", + "request": { + "method": "POST", + "url": { + "raw": "http://127.0.0.1:8000/api/v1/remove", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "path": [ + "api", + "v1", + "remove" + ] + }, + "header": [ + { + "key": "User-Agent", + "value": "EasyPostman/v5.5.9" + }, + { + "key": "Accept", + "value": "*/*" + }, + { + "key": "Accept-Encoding", + "value": "gzip, deflate, br" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer test-token" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"kb\": \"postman-kb\",\n \"identifier\": \"README_CN.md\",\n \"keep_raw\": false,\n \"keep_empty\": false,\n \"dry_run\": false, //true:先预览,false:直接删除\n \"stream\": false\n}" + }, + "auth": { + } + } + }, + { + "name": "recompile", + "request": { + "method": "POST", + "url": { + "raw": "http://127.0.0.1:8000/api/v1/recompile", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "path": [ + "api", + "v1", + "recompile" + ] + }, + "header": [ + { + "key": "User-Agent", + "value": "EasyPostman/v5.5.9" + }, + { + "key": "Accept", + "value": "*/*" + }, + { + "key": "Accept-Encoding", + "value": "gzip, deflate, br" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer test-token" + } + ], + "body": { + "mode": "raw", + "raw": "{ \"kb\": \"postman-kb\", \"all_docs\": true }" + }, + "auth": { + } + } + }, + { + "name": "watch/start", + "request": { + "method": "POST", + "url": { + "raw": "http://127.0.0.1:8000/api/v1/watch/start", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "path": [ + "api", + "v1", + "watch", + "start" + ] + }, + "header": [ + { + "key": "User-Agent", + "value": "EasyPostman/v5.5.9" + }, + { + "key": "Accept", + "value": "*/*" + }, + { + "key": "Accept-Encoding", + "value": "gzip, deflate, br" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer test-token" + } + ], + "body": { + "mode": "raw", + "raw": "{ \"kb\": \"postman-kb\", \"debounce\": 2.0 }" + }, + "auth": { + } + } + }, + { + "name": "watch/status", + "request": { + "method": "POST", + "url": { + "raw": "http://127.0.0.1:8000/api/v1/watch/status", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "path": [ + "api", + "v1", + "watch", + "status" + ] + }, + "header": [ + { + "key": "User-Agent", + "value": "EasyPostman/v5.5.9" + }, + { + "key": "Accept", + "value": "*/*" + }, + { + "key": "Accept-Encoding", + "value": "gzip, deflate, br" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer test-token" + } + ], + "body": { + "mode": "raw", + "raw": "{ \"kb\": \"postman-kb\" }" + }, + "auth": { + } + } + }, + { + "name": "watch/stop", + "request": { + "method": "POST", + "url": { + "raw": "http://127.0.0.1:8000/api/v1/watch/stop", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "path": [ + "api", + "v1", + "watch", + "stop" + ] + }, + "header": [ + { + "key": "User-Agent", + "value": "EasyPostman/v5.5.9" + }, + { + "key": "Accept", + "value": "*/*" + }, + { + "key": "Accept-Encoding", + "value": "gzip, deflate, br" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer test-token" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"kb\": \"postman-kb\"\n}" + }, + "auth": { + } + } + }, + { + "name": "watch/events", + "request": { + "method": "GET", + "url": { + "raw": "http://127.0.0.1:8000/api/v1/watch/events?kb=postman-kb", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "path": [ + "api", + "v1", + "watch", + "events" + ], + "query": [ + { + "key": "kb", + "value": "postman-kb" + }, + { + "key": "kb", + "value": "postman-kb" + } + ] + }, + "header": [ + { + "key": "User-Agent", + "value": "EasyPostman/v5.5.9" + }, + { + "key": "Accept", + "value": "text/event-stream" + }, + { + "key": "Accept-Encoding", + "value": "gzip, deflate, br" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Bearer test-token" + } + ], + "auth": { + } + } + } + ] +} \ No newline at end of file diff --git a/openkb/agent/chat.py b/openkb/agent/chat.py index 3d2753062..de605edc8 100644 --- a/openkb/agent/chat.py +++ b/openkb/agent/chat.py @@ -13,7 +13,7 @@ import sys import time from pathlib import Path -from typing import Any +from typing import Any, AsyncIterator from prompt_toolkit import PromptSession from prompt_toolkit.completion import Completer, Completion, PathCompleter @@ -23,7 +23,12 @@ from prompt_toolkit.styles import Style from openkb.agent.chat_session import ChatSession -from openkb.agent.query import MAX_TURNS, build_chat_agent +from openkb.agent.query import ( + MAX_TURNS, + build_chat_agent, + build_query_agent, + iter_agent_response_events, +) from openkb.log import append_log @@ -847,6 +852,53 @@ async def _handle_slash_critique(arg: str, kb_dir: Path, style: Style) -> None: _fmt(style, ("class:slash.ok", f"Critique pass complete: {rel_str}\n")) +def build_chat_session_agent(kb_dir: Path, session: ChatSession) -> Any: + """Build the query-backed agent for one chat session (REST ``/chat``). + + Thin wrapper that resolves language from the session/config and delegates + to ``build_query_agent`` with the session's model. Kept in chat.py (not + query.py) so the query module's ``build_chat_agent`` signature stays + unchanged for the CLI; the API uses this session-aware variant instead. + """ + from openkb.config import load_config + + config = load_config(kb_dir / ".openkb" / "config.yaml") + language = session.language or config.get("language", "en") + wiki_root = str(kb_dir / "wiki") + return build_query_agent(wiki_root, session.model, language=language) + + +async def iter_chat_turn_events( + agent: Any, + session: ChatSession, + user_input: str, +) -> AsyncIterator[dict[str, Any]]: + """Yield non-TTY events for one chat turn and persist the final turn. + + Used by the REST ``/chat`` SSE stream: forwards delta/tool_call events from + ``iter_agent_response_events`` unchanged, and on the final event records + the turn into the session (history + counts) before re-emitting it with + ``session_id``/``turn_count``. + """ + new_input = session.history + [{"role": "user", "content": user_input}] + + async for event in iter_agent_response_events(agent, new_input, max_turns=MAX_TURNS): + if event["event"] != "final": + yield event + continue + + data = event["data"] + answer = data["answer"] + session.record_turn(user_input, answer, data["history"]) + yield { + "event": "final", + "data": { + "answer": answer, + "session_id": session.id, + "turn_count": session.turn_count, + }, + } + async def run_chat( kb_dir: Path, session: ChatSession, diff --git a/openkb/agent/query.py b/openkb/agent/query.py index 5a755d76f..65a37f001 100644 --- a/openkb/agent/query.py +++ b/openkb/agent/query.py @@ -2,6 +2,7 @@ from __future__ import annotations from pathlib import Path +from typing import Any, AsyncIterator from agents import Agent, Runner, function_tool @@ -103,6 +104,58 @@ def get_image(image_path: str) -> ToolOutputImage | ToolOutputText: ) +async def iter_agent_response_events( + agent: Agent, + input_data: str | list[dict[str, Any]], + *, + max_turns: int = MAX_TURNS, +) -> AsyncIterator[dict[str, Any]]: + """Yield non-TTY events for a streamed agent response. + + The CLI renders these events to stdout; the REST API serializes the same + events as SSE. Events: ``{"event": "delta", "data": {"text": ...}}`` for + each response-text delta, ``{"event": "tool_call", "data": {...}}`` for + tool invocations, and a final ``{"event": "final", "data": {"answer": ..., + "history": [...]}}`` carrying the complete answer and reusable Agents SDK + history. + """ + from agents import RawResponsesStreamEvent, RunItemStreamEvent + from openai.types.responses import ResponseTextDeltaEvent + + result = Runner.run_streamed(agent, input_data, max_turns=max_turns) + collected: list[str] = [] + + async for event in result.stream_events(): + if isinstance(event, RawResponsesStreamEvent): + if isinstance(event.data, ResponseTextDeltaEvent): + text = event.data.delta + if text: + collected.append(text) + yield {"event": "delta", "data": {"text": text}} + elif isinstance(event, RunItemStreamEvent): + item = event.item + if item.type == "tool_call_item": + raw_item = item.raw_item + yield { + "event": "tool_call", + "data": { + "name": getattr(raw_item, "name", "?"), + "arguments": getattr(raw_item, "arguments", "") or "", + }, + } + + answer = "".join(collected).strip() + if not answer: + answer = (result.final_output or "").strip() + yield { + "event": "final", + "data": { + "answer": answer, + "history": result.to_input_list(), + }, + } + + def build_chat_agent( kb_dir: Path, model: str, diff --git a/openkb/api.py b/openkb/api.py new file mode 100644 index 000000000..2c3f09393 --- /dev/null +++ b/openkb/api.py @@ -0,0 +1,1206 @@ +"""FastAPI REST service for OpenKB query and chat.""" +from __future__ import annotations + +import argparse +import asyncio +import json +import os +import time +import re +from contextlib import asynccontextmanager +from pathlib import Path +from typing import Any, AsyncIterator + +import litellm +from agents import set_tracing_disabled +from dotenv import load_dotenv +from fastapi import Depends, FastAPI, File, Form, HTTPException, Query, UploadFile, status +from fastapi.middleware.cors import CORSMiddleware +from fastapi.responses import StreamingResponse +from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer +from pydantic import BaseModel, Field +from starlette.concurrency import run_in_threadpool +from starlette.staticfiles import StaticFiles + +from openkb.agent.chat import build_chat_session_agent, iter_chat_turn_events +from openkb.agent.chat_session import ChatSession, delete_session, list_sessions, load_session +from openkb.agent.query import build_query_agent, iter_agent_response_events, run_query +from openkb.cli import ( + SUPPORTED_EXTENSIONS, + _add_for_api, + get_kb_list, + get_kb_status, + initialize_kb, + run_remove_for_api, + run_lint_report, + iter_recompile, +) +from openkb.config import ( + DEFAULT_CONFIG, + kb_root_dir, + load_config, + register_kb_alias, + resolve_kb_alias, + validate_kb_name, +) +from openkb.log import append_log +from openkb.watch_service import WatchRegistry + +set_tracing_disabled(True) +os.environ.setdefault("LITELLM_LOCAL_MODEL_COST_MAP", "true") +litellm.suppress_debug_info = True +load_dotenv() + +security = HTTPBearer(auto_error=False) +UPLOAD_CHUNK_BYTES = 1024 * 1024 +MAX_UPLOAD_FILE_BYTES = int( + os.environ.get("OPENKB_MAX_UPLOAD_FILE_BYTES", str(100 * 1024 * 1024)) +) +MAX_UPLOAD_REQUEST_BYTES = int( + os.environ.get("OPENKB_MAX_UPLOAD_REQUEST_BYTES", str(500 * 1024 * 1024)) +) + + +class QueryRequest(BaseModel): + kb: str = Field(..., min_length=1) + question: str = Field(..., min_length=1) + stream: bool = True + save: bool = False + + +class QueryResponse(BaseModel): + answer: str + saved_path: str | None = None + + +class ChatRequest(BaseModel): + kb: str = Field(..., min_length=1) + message: str = Field(..., min_length=1) + session_id: str | None = None + stream: bool = True + + +class ChatResponse(BaseModel): + session_id: str + answer: str + turn_count: int + + +class ChatSessionItem(BaseModel): + id: str + title: str + turn_count: int + updated_at: str + model: str + + +class ChatSessionListResponse(BaseModel): + kb: str + sessions: list[ChatSessionItem] + + +class ChatSessionLoadResponse(BaseModel): + session_id: str + title: str + turn_count: int + user_turns: list[str] + assistant_texts: list[str] + + +class ChatSessionLoadRequest(BaseModel): + kb: str = Field(..., min_length=1) + session_id: str = Field(..., min_length=1) + + +class ChatSessionDeleteRequest(BaseModel): + kb: str = Field(..., min_length=1) + session_id: str = Field(..., min_length=1) + + +class ChatSessionDeleteResponse(BaseModel): + deleted: bool + + +class InitRequest(BaseModel): + kb: str = Field(..., min_length=1) + model: str | None = None + api_key: str | None = None + openai_api_base: str | None = None + + +class EnvWritten(BaseModel): + api_key: bool + openai_api_base: bool + + +class InitResponse(BaseModel): + kb: str + created: bool + env_written: EnvWritten + message: str + + +class AddFileItem(BaseModel): + original_name: str + saved_path: str | None = None + status: str + message: str + + +class AddResponse(BaseModel): + kb: str + files: list[AddFileItem] + added_count: int + skipped_count: int + failed_count: int + + +class KbRequest(BaseModel): + kb: str = Field(..., min_length=1) + + +class LintRequest(BaseModel): + kb: str = Field(..., min_length=1) + fix: bool = False + + +class DocumentItem(BaseModel): + hash: str + name: str + type: str + display_type: str + pages: int | None = None + + +class ListResponse(BaseModel): + documents: list[DocumentItem] + document_count: int + summaries: list[str] + concepts: list[str] + reports: list[str] + + +class StatusResponse(BaseModel): + directories: dict[str, int] + raw_count: int + total_indexed: int + last_compile: str | None = None + last_lint: str | None = None + + +class LintResponse(BaseModel): + skipped: bool + reason: str | None = None + message: str + structural_report: str | None = None + knowledge_report: str | None = None + report_path: str | None = None + lint_files_changed: int | None = None + lint_ghosts_removed: int | None = None + + +class RemoveRequest(BaseModel): + kb: str = Field(..., min_length=1) + identifier: str = Field(..., min_length=1) + keep_raw: bool = False + keep_empty: bool = False + dry_run: bool = False + stream: bool = False + + +class RemoveActionItem(BaseModel): + tag: str + target: str + + +class RemoveResponse(BaseModel): + status: str + name: str | None = None + doc_name: str | None = None + actions: list[RemoveActionItem] = [] + concepts_deleted: list[str] = [] + entities_deleted: list[str] = [] + lint_files_changed: int | None = None + lint_ghosts_removed: int | None = None + pageindex_message: str | None = None + pageindex_error: str | None = None + message: str | None = None + candidates: list[dict[str, str]] = [] + + +class RecompileDocItem(BaseModel): + name: str | None = None + doc_name: str | None = None + type: str + status: str + elapsed: float | None = None + message: str | None = None + + +class RecompileRequest(BaseModel): + kb: str = Field(..., min_length=1) + doc_name: str | None = None + all_docs: bool = False + dry_run: bool = False + refresh_schema: bool = False + stream: bool = False + + +class RecompileTargetItem(BaseModel): + name: str + doc_name: str + type: str + + +class RecompileResponse(BaseModel): + status: str + total: int + recompiled: int + skipped: int + docs: list[RecompileDocItem] = [] + targets: list[RecompileTargetItem] | None = None + candidates: list[dict[str, str]] | None = None + message: str | None = None + + +class WatchStartRequest(BaseModel): + kb: str = Field(..., min_length=1) + debounce: float = Field(default=2.0, gt=0) + + +class WatchEventItem(BaseModel): + ts: float + event: str + data: dict[str, Any] = {} + + +class WatchStatusResponse(BaseModel): + kb: str + active: bool + started_at: float | None = None + raw_dir: str | None = None + debounce: float | None = None + counters: dict[str, int] = {} + recent_events: list[WatchEventItem] = [] + + +class KbSummaryItem(BaseModel): + name: str + document_count: int = 0 + last_compile: str | None = None + has_raw: bool = False + + +class KbListResponse(BaseModel): + root: str + knowledge_bases: list[KbSummaryItem] + + +def create_app() -> FastAPI: + # One registry per app instance so each TestClient is isolated. + registry = WatchRegistry() + + @asynccontextmanager + async def lifespan(app: FastAPI): + try: + yield + finally: + registry.stop_all() + + app = FastAPI(title="OpenKB API", lifespan=lifespan) + + _configure_cors(app) + + @app.get("/api/v1/kbs", response_model=KbListResponse) + async def list_kbs_endpoint( + _: None = Depends(require_bearer_token), + ) -> KbListResponse: + return KbListResponse(**_list_knowledge_bases()) + + @app.post("/api/v1/init", response_model=InitResponse) + async def init_endpoint( + request: InitRequest, + _: None = Depends(require_bearer_token), + ) -> InitResponse: + try: + kb_name = validate_kb_name(request.kb) + kb_dir = (kb_root_dir() / kb_name).resolve() + result = initialize_kb( + kb_dir, + model=request.model, + api_key=request.api_key, + openai_api_base=request.openai_api_base, + ) + register_kb_alias(kb_name, kb_dir) + except ValueError as exc: + raise HTTPException( + status_code=status.HTTP_400_BAD_REQUEST, + detail=str(exc), + ) from exc + except FileExistsError as exc: + raise HTTPException( + status_code=status.HTTP_400_BAD_REQUEST, + detail=str(exc), + ) from exc + except Exception as exc: + raise HTTPException( + status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, + detail=f"Init failed: {exc}", + ) from exc + return InitResponse( + kb=kb_name, + created=bool(result["created"]), + env_written=EnvWritten(**result["env_written"]), + message=str(result["message"]), + ) + + @app.post("/api/v1/add", response_model=AddResponse) + async def add_endpoint( + kb: str = Form(...), + stream: str = Form("true"), + files: list[UploadFile] = File(default=[]), + _: None = Depends(require_bearer_token), + ) -> Any: + resolved_kb_dir = _resolve_kb(kb) + if not files: + raise HTTPException( + status_code=status.HTTP_400_BAD_REQUEST, + detail="No files uploaded.", + ) + saved_uploads = await _save_add_uploads(resolved_kb_dir, files) + if _parse_stream_form(stream): + return StreamingResponse( + _stream_add_uploads(kb, resolved_kb_dir, saved_uploads), + media_type="text/event-stream", + ) + return await _run_add_uploads(kb, resolved_kb_dir, saved_uploads) + + @app.post("/api/v1/query", response_model=QueryResponse) + async def query_endpoint( + request: QueryRequest, + _: None = Depends(require_bearer_token), + ) -> Any: + kb_dir = _resolve_kb(request.kb) + _setup_llm_key(kb_dir) + config = load_config(kb_dir / ".openkb" / "config.yaml") + model = config.get("model", DEFAULT_CONFIG["model"]) + + if request.stream: + return StreamingResponse( + _stream_query(request, kb_dir, model), + media_type="text/event-stream", + ) + + try: + answer = await run_query(request.question, kb_dir, model, stream=False) + append_log(kb_dir / "wiki", "query", request.question) + saved_path = ( + _save_query_answer(kb_dir, request.question, answer) + if request.save + else None + ) + except Exception as exc: + raise HTTPException( + status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, + detail=f"Query failed: {exc}", + ) from exc + return QueryResponse( + answer=answer, + saved_path=str(saved_path) if saved_path else None, + ) + + @app.post("/api/v1/chat", response_model=ChatResponse) + async def chat_endpoint( + request: ChatRequest, + _: None = Depends(require_bearer_token), + ) -> Any: + kb_dir = _resolve_kb(request.kb) + _setup_llm_key(kb_dir) + session = _load_or_create_session(kb_dir, request.session_id) + + if request.stream: + return StreamingResponse( + _stream_chat(request, kb_dir, session), + media_type="text/event-stream", + ) + + try: + answer = "" + append_log(kb_dir / "wiki", "query", request.message) + agent = build_chat_session_agent(kb_dir, session) + async for event in iter_chat_turn_events(agent, session, request.message): + if event["event"] == "final": + answer = event["data"]["answer"] + except Exception as exc: + raise HTTPException( + status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, + detail=f"Chat failed: {exc}", + ) from exc + return ChatResponse( + session_id=session.id, + answer=answer, + turn_count=session.turn_count, + ) + + @app.post("/api/v1/chat/sessions", response_model=ChatSessionListResponse) + async def chat_sessions_endpoint( + request: KbRequest, + _: None = Depends(require_bearer_token), + ) -> ChatSessionListResponse: + kb_dir = _resolve_kb(request.kb) + try: + sessions = list_sessions(kb_dir) + except Exception as exc: + raise HTTPException( + status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, + detail=f"List sessions failed: {exc}", + ) from exc + return ChatSessionListResponse(kb=request.kb, sessions=sessions) + + @app.post("/api/v1/chat/sessions/load", response_model=ChatSessionLoadResponse) + async def chat_session_load_endpoint( + request: ChatSessionLoadRequest, + _: None = Depends(require_bearer_token), + ) -> ChatSessionLoadResponse: + kb_dir = _resolve_kb(request.kb) + try: + session = load_session(kb_dir, request.session_id) + except FileNotFoundError as exc: + raise HTTPException( + status_code=status.HTTP_404_NOT_FOUND, + detail=f"Chat session not found: {request.session_id}", + ) from exc + except Exception as exc: + raise HTTPException( + status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, + detail=f"Load session failed: {exc}", + ) from exc + return ChatSessionLoadResponse( + session_id=session.id, + title=session.title, + turn_count=session.turn_count, + user_turns=session.user_turns, + assistant_texts=session.assistant_texts, + ) + + @app.post("/api/v1/chat/sessions/delete", response_model=ChatSessionDeleteResponse) + async def chat_session_delete_endpoint( + request: ChatSessionDeleteRequest, + _: None = Depends(require_bearer_token), + ) -> ChatSessionDeleteResponse: + kb_dir = _resolve_kb(request.kb) + try: + deleted = delete_session(kb_dir, request.session_id) + except Exception as exc: + raise HTTPException( + status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, + detail=f"Delete session failed: {exc}", + ) from exc + if not deleted: + raise HTTPException( + status_code=status.HTTP_404_NOT_FOUND, + detail=f"Chat session not found: {request.session_id}", + ) + return ChatSessionDeleteResponse(deleted=True) + + @app.post("/api/v1/list", response_model=ListResponse) + async def list_endpoint( + request: KbRequest, + _: None = Depends(require_bearer_token), + ) -> ListResponse: + kb_dir = _resolve_kb(request.kb) + try: + return ListResponse(**get_kb_list(kb_dir)) + except Exception as exc: + raise HTTPException( + status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, + detail=f"List failed: {exc}", + ) from exc + + @app.post("/api/v1/status", response_model=StatusResponse) + async def status_endpoint( + request: KbRequest, + _: None = Depends(require_bearer_token), + ) -> StatusResponse: + kb_dir = _resolve_kb(request.kb) + try: + return StatusResponse(**get_kb_status(kb_dir)) + except Exception as exc: + raise HTTPException( + status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, + detail=f"Status failed: {exc}", + ) from exc + + @app.post("/api/v1/lint", response_model=LintResponse) + async def lint_endpoint( + request: LintRequest, + _: None = Depends(require_bearer_token), + ) -> LintResponse: + kb_dir = _resolve_kb(request.kb) + try: + return LintResponse(**await run_lint_report(kb_dir, fix=request.fix)) + except Exception as exc: + raise HTTPException( + status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, + detail=f"Lint failed: {exc}", + ) from exc + + @app.post("/api/v1/remove", response_model=RemoveResponse) + async def remove_endpoint( + request: RemoveRequest, + _: None = Depends(require_bearer_token), + ) -> Any: + kb_dir = _resolve_kb(request.kb) + if request.stream: + return StreamingResponse( + _stream_remove(request, kb_dir), + media_type="text/event-stream", + ) + result = await run_in_threadpool( + run_remove_for_api, + kb_dir, + request.identifier, + keep_raw=request.keep_raw, + keep_empty=request.keep_empty, + dry_run=request.dry_run, + ) + status_value = result.get("status") + if status_value == "not_found": + raise HTTPException(status_code=404, detail=result.get("message", "Document not found.")) + if status_value == "multiple": + raise HTTPException( + status_code=409, + detail={ + "message": "Identifier matches multiple documents.", + "candidates": result.get("candidates", []), + }, + ) + return RemoveResponse(**result) + + @app.post("/api/v1/recompile", response_model=RecompileResponse) + async def recompile_endpoint( + request: RecompileRequest, + _: None = Depends(require_bearer_token), + ) -> Any: + kb_dir = _resolve_kb(request.kb) + if request.stream: + return StreamingResponse( + _stream_recompile(request, kb_dir), + media_type="text/event-stream", + ) + # Aggregate the async generator into a single JSON response. Terminal + # errors map to HTTP codes; the final event carries the aggregate. + targets: list[dict] | None = None + candidates: list[dict[str, str]] | None = None + error_code: int | None = None + error_message: str | None = None + result: dict = {} + async for event in iter_recompile( + kb_dir, + request.doc_name, + all_docs=request.all_docs, + dry_run=request.dry_run, + refresh_schema=request.refresh_schema, + ): + name = event.get("event") + if name == "plan": + targets = event.get("targets", []) + elif name == "error": + error_code = event.get("code", 500) + error_message = event.get("message", "Recompile failed.") + candidates = event.get("candidates") + elif name == "final": + result = event + if error_code is not None: + if error_code == 409 and candidates is not None: + raise HTTPException( + status_code=409, + detail={"message": error_message, "candidates": candidates}, + ) + raise HTTPException(status_code=error_code, detail=error_message) + return RecompileResponse( + status=result.get("status", "done"), + total=result.get("total", 0), + recompiled=result.get("recompiled", 0), + skipped=result.get("skipped", 0), + docs=result.get("docs", []), + targets=targets, + candidates=candidates, + ) + + @app.post("/api/v1/watch/start", response_model=WatchStatusResponse) + async def watch_start_endpoint( + request: WatchStartRequest, + _: None = Depends(require_bearer_token), + ) -> WatchStatusResponse: + kb_dir = _resolve_kb(request.kb) + try: + registry.start(request.kb, kb_dir, debounce=request.debounce) + except Exception as exc: + raise HTTPException( + status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, + detail=f"Watch start failed: {exc}", + ) from exc + return WatchStatusResponse(**registry.status(request.kb)) + + @app.post("/api/v1/watch/stop", response_model=WatchStatusResponse) + async def watch_stop_endpoint( + request: KbRequest, + _: None = Depends(require_bearer_token), + ) -> WatchStatusResponse: + _resolve_kb(request.kb) + if not registry.stop(request.kb): + raise HTTPException( + status_code=status.HTTP_404_NOT_FOUND, + detail=f"No active watcher for KB: {request.kb}", + ) + return WatchStatusResponse(kb=request.kb, active=False) + + @app.post("/api/v1/watch/status", response_model=WatchStatusResponse) + async def watch_status_endpoint( + request: KbRequest, + _: None = Depends(require_bearer_token), + ) -> WatchStatusResponse: + _resolve_kb(request.kb) + return WatchStatusResponse(**registry.status(request.kb)) + + @app.get("/api/v1/watch/events") + async def watch_events_endpoint( + kb: str = Query(..., min_length=1), + max_events: int | None = Query(default=None, ge=1), + timeout_seconds: float | None = Query(default=None, ge=0), + _: None = Depends(require_bearer_token), + ) -> Any: + _resolve_kb(kb) + return StreamingResponse( + _stream_watch_events(registry, kb, max_events, timeout_seconds), + media_type="text/event-stream", + ) + + _mount_web_ui(app) + + return app + + +def _configure_cors(app: FastAPI) -> None: + """Allow browser frontends to call the API (configurable via env).""" + raw = os.environ.get("OPENKB_CORS_ORIGINS", "") + if raw.strip() == "*": + origins = ["*"] + else: + origins = [o.strip() for o in raw.split(",") if o.strip()] or [ + "http://localhost:5173", + "http://127.0.0.1:5173", + "http://localhost:8000", + "http://127.0.0.1:8000", + ] + app.add_middleware( + CORSMiddleware, + allow_origins=origins, + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], + ) + + +def _mount_web_ui(app: FastAPI) -> None: + """Serve the bundled web UI at ``/`` when the ``web/`` directory exists. + + Mounting under the API origin avoids cross-origin fetch from ``file://`` + so the browser SPA can call the REST endpoints directly. + """ + web_dir = Path(__file__).resolve().parent.parent / "web" + if web_dir.is_dir(): + app.mount("/", StaticFiles(directory=str(web_dir), html=True), name="web-ui") + + +def _list_knowledge_bases() -> dict[str, Any]: + """Enumerate knowledge bases under the configured KB root. + + Used by the web UI's KB switcher. There is no persisted KB registry, so + discovery is directory-based: a child of ``OPENKB_KB_ROOT`` counts as a KB + when it has both ``.openkb`` and ``wiki`` subdirectories. + """ + root = kb_root_dir() + items: list[dict[str, Any]] = [] + if root.is_dir(): + for child in sorted(root.iterdir()): + if not child.is_dir(): + continue + if not (child / ".openkb").is_dir() or not (child / "wiki").is_dir(): + continue + hashes_file = child / ".openkb" / "hashes.json" + doc_count = 0 + if hashes_file.exists(): + try: + doc_count = len(json.loads(hashes_file.read_text(encoding="utf-8"))) + except (ValueError, OSError): + doc_count = 0 + last_compile = None + summaries_dir = child / "wiki" / "summaries" + if summaries_dir.is_dir(): + mtimes = [p.stat().st_mtime for p in summaries_dir.glob("*.md")] + if mtimes: + last_compile = time.strftime( + "%Y-%m-%dT%H:%M:%S", time.localtime(max(mtimes)) + ) + items.append( + { + "name": child.name, + "document_count": doc_count, + "last_compile": last_compile, + "has_raw": (child / "raw").is_dir(), + } + ) + return {"root": str(root), "knowledge_bases": items} + + +def require_bearer_token( + credentials: HTTPAuthorizationCredentials | None = Depends(security), +) -> None: + expected = os.environ.get("OPENKB_API_TOKEN") + if not expected: + raise HTTPException( + status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, + detail="OPENKB_API_TOKEN is not configured.", + ) + if credentials is None or credentials.scheme.lower() != "bearer": + raise HTTPException( + status_code=status.HTTP_401_UNAUTHORIZED, + detail="Bearer token required.", + ) + if credentials.credentials != expected: + raise HTTPException( + status_code=status.HTTP_401_UNAUTHORIZED, + detail="Invalid bearer token.", + ) + + +def _resolve_kb(value: str) -> Path: + try: + kb_dir = resolve_kb_alias(value) + except ValueError as exc: + raise HTTPException( + status_code=status.HTTP_400_BAD_REQUEST, + detail=str(exc), + ) from exc + if not (kb_dir / ".openkb").is_dir() or not (kb_dir / "wiki").is_dir(): + raise HTTPException( + status_code=status.HTTP_400_BAD_REQUEST, + detail=f"Not a knowledge base: {value}", + ) + return kb_dir + + +def _setup_llm_key(kb_dir: Path) -> None: + from openkb.cli import _setup_llm_key as setup + + setup(kb_dir) + + +def _save_query_answer(kb_dir: Path, question: str, answer: str) -> Path | None: + if not answer: + return None + slug = re.sub(r"[^a-z0-9]+", "-", question.lower()).strip("-")[:60] + explore_dir = kb_dir / "wiki" / "explorations" + explore_dir.mkdir(parents=True, exist_ok=True) + explore_path = explore_dir / f"{slug}.md" + explore_path.write_text( + f"---\nquery: \"{question}\"\n---\n\n{answer}\n", + encoding="utf-8", + ) + return explore_path + + +def _parse_stream_form(value: str | bool | None) -> bool: + if isinstance(value, bool): + return value + if value is None: + return True + return value.strip().lower() not in {"false", "0", "no", "off"} + + +def _safe_upload_name(filename: str | None) -> str: + name = Path(filename or "").name + if not name: + raise HTTPException( + status_code=status.HTTP_400_BAD_REQUEST, + detail="Uploaded file is missing a filename.", + ) + return name + + +def _unique_raw_path(raw_dir: Path, filename: str) -> Path: + candidate = raw_dir / filename + if not candidate.exists(): + return candidate + + stem = candidate.stem + suffix = candidate.suffix + counter = 1 + while True: + candidate = raw_dir / f"{stem}-{counter}{suffix}" + if not candidate.exists(): + return candidate + counter += 1 + + +async def _save_upload( + kb_dir: Path, + upload: UploadFile, + request_bytes_so_far: int, +) -> tuple[Path, int]: + filename = _safe_upload_name(upload.filename) + suffix = Path(filename).suffix.lower() + if suffix not in SUPPORTED_EXTENSIONS: + raise HTTPException( + status_code=status.HTTP_400_BAD_REQUEST, + detail=( + f"Unsupported file type: {suffix}. " + f"Supported: {', '.join(sorted(SUPPORTED_EXTENSIONS))}" + ), + ) + + raw_dir = kb_dir / "raw" + raw_dir.mkdir(parents=True, exist_ok=True) + saved_path = _unique_raw_path(raw_dir, filename) + try: + file_bytes = 0 + with saved_path.open("wb") as handle: + while chunk := await upload.read(UPLOAD_CHUNK_BYTES): + file_bytes += len(chunk) + request_bytes = request_bytes_so_far + file_bytes + if file_bytes > MAX_UPLOAD_FILE_BYTES: + raise HTTPException( + status_code=413, + detail=( + f"Uploaded file exceeds limit of " + f"{MAX_UPLOAD_FILE_BYTES} bytes." + ), + ) + if request_bytes > MAX_UPLOAD_REQUEST_BYTES: + raise HTTPException( + status_code=413, + detail=( + f"Upload request exceeds limit of " + f"{MAX_UPLOAD_REQUEST_BYTES} bytes." + ), + ) + handle.write(chunk) + except Exception as exc: + saved_path.unlink(missing_ok=True) + if isinstance(exc, HTTPException): + raise + raise HTTPException( + status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, + detail=f"Upload save failed: {exc}", + ) from exc + finally: + await upload.close() + return saved_path, file_bytes + + +def _summarize_add_results(kb: str, results: list[AddFileItem]) -> AddResponse: + return AddResponse( + kb=kb, + files=results, + added_count=sum(1 for item in results if item.status == "added"), + skipped_count=sum(1 for item in results if item.status == "skipped"), + failed_count=sum(1 for item in results if item.status == "failed"), + ) + + +def _model_payload(model: BaseModel) -> dict[str, Any]: + if hasattr(model, "model_dump"): + return model.model_dump() + return model.dict() + + +async def _save_add_uploads( + kb_dir: Path, + files: list[UploadFile], +) -> list[tuple[Path, str]]: + saved_uploads: list[tuple[Path, str]] = [] + request_bytes = 0 + try: + for upload in files: + original_name = _safe_upload_name(upload.filename) + saved_path, file_bytes = await _save_upload(kb_dir, upload, request_bytes) + request_bytes += file_bytes + saved_uploads.append((saved_path, original_name)) + except Exception: + for saved_path, _ in saved_uploads: + saved_path.unlink(missing_ok=True) + raise + return saved_uploads + + +async def _run_add_uploads( + kb: str, + kb_dir: Path, + saved_uploads: list[tuple[Path, str]], +) -> AddResponse: + results = [] + for saved_path, original_name in saved_uploads: + results.append(await _add_saved_file(kb_dir, saved_path, original_name)) + return _summarize_add_results(kb, results) + + +async def _stream_add_uploads( + kb: str, + kb_dir: Path, + saved_uploads: list[tuple[Path, str]], +) -> AsyncIterator[str]: + yield _sse( + "start", + {"endpoint": "add", "kb": kb, "file_count": len(saved_uploads)}, + ) + results: list[AddFileItem] = [] + try: + for saved_path, original_name in saved_uploads: + yield _sse( + "uploaded", + {"original_name": original_name, "saved_path": str(saved_path)}, + ) + yield _sse( + "file_start", + {"original_name": original_name, "saved_path": str(saved_path)}, + ) + item = await _add_saved_file(kb_dir, saved_path, original_name) + results.append(item) + yield _sse("file_done", _model_payload(item)) + final = _summarize_add_results(kb, results) + yield _sse("final", _model_payload(final)) + except HTTPException as exc: + yield _sse("error", {"message": exc.detail}) + except Exception as exc: + yield _sse("error", {"message": f"Add failed: {exc}"}) + yield _sse("done", {}) + + +async def _add_saved_file(kb_dir: Path, saved_path: Path, original_name: str) -> AddFileItem: + result = await run_in_threadpool(_add_for_api, saved_path, kb_dir) + item = AddFileItem(**result.__dict__) + item.original_name = original_name + if item.status == "skipped": + saved_path.unlink(missing_ok=True) + item.saved_path = None + return item + + +def _load_or_create_session(kb_dir: Path, session_id: str | None) -> ChatSession: + if session_id: + try: + return load_session(kb_dir, session_id) + except FileNotFoundError as exc: + raise HTTPException( + status_code=status.HTTP_404_NOT_FOUND, + detail=f"Chat session not found: {session_id}", + ) from exc + + config = load_config(kb_dir / ".openkb" / "config.yaml") + model = config.get("model", DEFAULT_CONFIG["model"]) + language = config.get("language", "en") + return ChatSession.new(kb_dir, model, language) + + +def _sse(event: str, data: dict[str, Any]) -> str: + payload = json.dumps(data, ensure_ascii=False) + return f"event: {event}\ndata: {payload}\n\n" + + +async def _stream_query( + request: QueryRequest, + kb_dir: Path, + model: str, +) -> AsyncIterator[str]: + yield _sse("start", {"endpoint": "query"}) + try: + config = load_config(kb_dir / ".openkb" / "config.yaml") + language = config.get("language", "en") + agent = build_query_agent(str(kb_dir / "wiki"), model, language=language) + final_answer = "" + async for event in iter_agent_response_events(agent, request.question): + data = event["data"] + if event["event"] == "final": + final_answer = data["answer"] + saved_path = ( + _save_query_answer(kb_dir, request.question, final_answer) + if request.save + else None + ) + append_log(kb_dir / "wiki", "query", request.question) + yield _sse( + "final", + { + "answer": final_answer, + "saved_path": str(saved_path) if saved_path else None, + }, + ) + else: + yield _sse(event["event"], data) + except Exception as exc: + yield _sse("error", {"message": f"Query failed: {exc}"}) + yield _sse("done", {}) + + +async def _stream_chat( + request: ChatRequest, + kb_dir: Path, + session: ChatSession, +) -> AsyncIterator[str]: + yield _sse("start", {"endpoint": "chat", "session_id": session.id}) + try: + append_log(kb_dir / "wiki", "query", request.message) + agent = build_chat_session_agent(kb_dir, session) + async for event in iter_chat_turn_events(agent, session, request.message): + yield _sse(event["event"], event["data"]) + except Exception as exc: + yield _sse("error", {"message": f"Chat failed: {exc}"}) + yield _sse("done", {}) + + +async def _stream_remove( + request: RemoveRequest, + kb_dir: Path, +) -> AsyncIterator[str]: + """SSE view of remove: start, plan, per-stage progress, final, done. + + Maps ``run_remove_for_api``'s status codes to events so a streaming + client can react to ``not_found`` / ``multiple`` / ``partial`` without + waiting on an HTTP error. + """ + yield _sse("start", {"endpoint": "remove", "identifier": request.identifier}) + try: + result = await run_in_threadpool( + run_remove_for_api, + kb_dir, + request.identifier, + keep_raw=request.keep_raw, + keep_empty=request.keep_empty, + dry_run=request.dry_run, + ) + status_value = result.get("status") + if status_value == "not_found": + yield _sse("error", {"code": 404, "message": "Document not found."}) + elif status_value == "multiple": + yield _sse( + "error", + {"code": 409, "message": "Identifier matches multiple documents.", + "candidates": result.get("candidates", [])}, + ) + else: + yield _sse("plan", { + "name": result.get("name"), + "doc_name": result.get("doc_name"), + "actions": result.get("actions", []), + }) + if status_value == "dry_run": + yield _sse("final", {"status": "dry_run", **result}) + else: + yield _sse("progress", {"stage": "wiki_cleanup"}) + yield _sse("final", {"status": status_value, **result}) + except Exception as exc: + yield _sse("error", {"message": f"Remove failed: {exc}"}) + yield _sse("done", {}) + + +async def _stream_recompile( + request: RecompileRequest, + kb_dir: Path, +) -> AsyncIterator[str]: + """SSE view of recompile: start, per-doc progress, final, done. + + Maps ``iter_recompile``'s events to SSE so a streaming client can react + to ``doc`` (ok/skipped/error) and terminal ``error`` (404/409/etc.) as + they happen, without waiting on an HTTP error. + """ + yield _sse("start", {"endpoint": "recompile"}) + try: + async for event in iter_recompile( + kb_dir, + request.doc_name, + all_docs=request.all_docs, + dry_run=request.dry_run, + refresh_schema=request.refresh_schema, + ): + name = event.get("event") + if name == "error": + yield _sse("error", { + "code": event.get("code", 500), + "message": event.get("message", "Recompile failed."), + **({"candidates": event["candidates"]} if "candidates" in event else {}), + }) + elif name == "plan": + yield _sse("plan", {"targets": event.get("targets", [])}) + elif name == "doc": + yield _sse("doc", {k: v for k, v in event.items() if k != "event"}) + elif name == "final": + yield _sse("final", {k: v for k, v in event.items() if k != "event"}) + except Exception as exc: + yield _sse("error", {"message": f"Recompile failed: {exc}"}) + yield _sse("done", {}) + + +async def _stream_watch_events( + registry: WatchRegistry, + kb: str, + max_events: int | None, + timeout_seconds: float | None, +) -> AsyncIterator[str]: + """Tail a KB's watch event ring buffer as an SSE stream. + + Replays existing events then polls for new ones. Terminates when the + watcher stops, or when ``max_events``/``timeout_seconds`` is reached (so + bounded clients and tests can drain without hanging). With both unset the + stream tails indefinitely. + """ + state = registry.get(kb) + yield _sse("start", {"endpoint": "watch", "kb": kb, "active": state is not None}) + if state is None: + yield _sse("error", {"message": f"No active watcher for KB: {kb}"}) + yield _sse("done", {}) + return + next_seq = 0 + emitted = 0 + started = time.monotonic() + try: + while True: + for ev in list(state.events): + if ev["seq"] < next_seq: + continue + next_seq = ev["seq"] + 1 + yield _sse(ev["event"], ev["data"]) + emitted += 1 + if ev["event"] == "watcher_stopped": + yield _sse("done", {}) + return + if max_events is not None and emitted >= max_events: + yield _sse("done", {}) + return + if timeout_seconds is not None and (time.monotonic() - started) >= timeout_seconds: + yield _sse("done", {}) + return + await asyncio.sleep(0.5) + except Exception as exc: + yield _sse("error", {"message": f"Watch events stream failed: {exc}"}) + yield _sse("done", {}) + + +app = create_app() + + +def main() -> None: + parser = argparse.ArgumentParser(description="Run the OpenKB REST API.") + parser.add_argument("--host", default="127.0.0.1") + parser.add_argument("--port", type=int, default=8000) + parser.add_argument("--reload", action="store_true") + args = parser.parse_args() + + import uvicorn + + uvicorn.run("openkb.api:app", host=args.host, port=args.port, reload=args.reload) + + +if __name__ == "__main__": + main() diff --git a/openkb/cli.py b/openkb/cli.py index 28694987d..b4e3364c6 100644 --- a/openkb/cli.py +++ b/openkb/cli.py @@ -1,4 +1,4 @@ -"""OpenKB CLI — command-line interface for the knowledge base workflow.""" +"""OpenKB CLI — command-line interface for the knowledge base workflow.""" from __future__ import annotations # Silence import-time warnings (e.g. pydub's missing-ffmpeg warning emitted @@ -10,6 +10,7 @@ import asyncio import json import logging +from dataclasses import dataclass import shutil import sys import time @@ -456,6 +457,44 @@ def _add_single_file_locked(file_path: Path, kb_dir: Path) -> Literal["added", " return "added" +@dataclass +class AddFileResult: + """Structured add outcome for the REST API. + + Wraps the plain ``Literal`` returned by the locked ``add_single_file`` with + the original filename and a human-readable message, which the API's + ``/add`` endpoint surfaces per file in its JSON/SSE response. + """ + original_name: str + saved_path: str | None + status: str + message: str + + +def _add_for_api(file_path: Path, kb_dir: Path) -> AddFileResult: + """Run the locked add pipeline and return a structured result for the API. + + Reuses the upstream ``add_single_file`` (which already holds the ingest + lock and handles cloud import / registry dedup) so the API and CLI share a + single ingest code path. Maps the ``Literal`` status to a message-bearing + ``AddFileResult``; on ``skipped`` the caller (api._add_saved_file) deletes + the freshly uploaded raw copy to avoid orphaning it. + """ + status_str = add_single_file(file_path, kb_dir) + if status_str == "skipped": + message = f"Already in knowledge base: {file_path.name}" + elif status_str == "failed": + message = f"Failed to add: {file_path.name} (see server logs)" + else: + message = f"Added: {file_path.name}" + return AddFileResult( + original_name=file_path.name, + saved_path=str(file_path) if status_str == "added" else None, + status=status_str, + message=message, + ) + + def _cleanup_failed_cloud_import(kb_dir: Path, doc_name: str) -> None: """Best-effort wiki cleanup after a cloud import whose compilation failed. @@ -1018,176 +1057,396 @@ def _resolve_doc_identifier(registry, identifier: str) -> list[tuple[str, dict]] return fuzzy -@cli.command() -@click.argument("identifier") -@click.option("--keep-raw", is_flag=True, default=False, - help="Don't delete the original file from raw/.") -@click.option("--keep-empty", "--keep-empty-concepts", "keep_empty", - is_flag=True, default=False, - help="Keep concept AND entity pages whose only source was the " - "removed doc (leaving an empty sources: [] list). Useful " - "when replacing the doc with a newer version. " - "(--keep-empty-concepts is a backward-compatible alias.)") -@click.option("--dry-run", is_flag=True, default=False, - help="Print what would be done without modifying anything.") -@click.option("--yes", "-y", is_flag=True, default=False, - help="Skip the confirmation prompt.") -@click.pass_context -@_with_kb_lock(exclusive=True) -def remove(ctx, identifier, keep_raw, keep_empty, dry_run, yes): - """Remove a document from the knowledge base. +@dataclass +class RemoveAction: + """One planned step surfaced in the remove preview/summary.""" + tag: str + target: str - IDENTIFIER may be the original filename ("paper.pdf"), the doc_name - slug ("paper-a1b2c3d4e5f6"), or a substring that uniquely matches one. - Deletes the doc's summary and source files, prunes the doc from - concept- and entity-page frontmatter and Related Documents sections, - drops the Documents entry from index.md, removes the hash entry, and - finally runs `lint --fix` to clean any dangling wikilinks. +@dataclass +class RemovePlan: + """Structured preview of what ``remove`` will do (no side effects yet). - Concept and entity pages whose only source was this doc are deleted by - default; use --keep-empty to retain them. + Built by ``_build_remove_plan``; consumed by the CLI (for printing the + preview) and by ``_execute_remove_plan`` (for actually doing it). """ - from openkb.agent.compiler import ( - remove_doc_from_concept_pages, - remove_doc_from_entity_pages, - remove_doc_from_index, - scan_affected_pages, - ) - from openkb.lint import fix_broken_links - from openkb.state import HashRegistry - - kb_dir = _find_kb_dir(ctx.obj.get("kb_dir_override")) - if kb_dir is None: - click.echo("No knowledge base found. Run `openkb init` first.") - return - - openkb_dir = kb_dir / ".openkb" - registry = HashRegistry(openkb_dir / "hashes.json") - - matches = _resolve_doc_identifier(registry, identifier) - if not matches: - click.echo(f"No document matching '{identifier}' found in the KB.") - click.echo("Try `openkb list` to see indexed documents.") - return - if len(matches) > 1: - click.echo(f"'{identifier}' matches multiple documents:") - for _, m in matches: - click.echo(f" - {m.get('name', '?')} (doc_name: {m.get('doc_name', '?')})") - click.echo("Use a more specific name or the exact doc_name slug.") - return + name: str + doc_name: str + doc_type: str + file_hash: str + actions: list[RemoveAction] + concept_deletes: list[str] + entity_deletes: list[str] + raw_path: Path | None + cleanup_pageindex: bool + pageindex_doc_id: str | None + summary_path: Path + source_md: Path + source_json: Path + images_dir: Path + + +@dataclass +class RemoveResult: + """Outcome of executing a :class:`RemovePlan`. + + ``status="partial"`` means PageIndex cleanup raised and the registry + entry was deliberately kept so the user can retry — mirroring the CLI. + """ + status: Literal["removed", "partial"] + name: str + doc_name: str + actions: list[RemoveAction] + concepts_deleted: list[str] + entities_deleted: list[str] + lint_files_changed: int + lint_ghosts_removed: int + pageindex_message: str | None + pageindex_error: str | None + message: str + + +def _build_remove_plan( + kb_dir: Path, + file_hash: str, + meta: dict, + *, + keep_raw: bool, + keep_empty: bool, +) -> RemovePlan: + """Scan the KB and predict every file remove will touch (no writes). + + Only frontmatter ``sources:`` membership drives the delete/edit + classification so the plan reflects what the executor will actually do. + """ + from openkb.agent.compiler import scan_affected_pages - file_hash, meta = matches[0] name = meta.get("name", "?") doc_name = meta.get("doc_name") or Path(name).stem doc_type = meta.get("type", "") wiki_dir = kb_dir / "wiki" + openkb_dir = kb_dir / ".openkb" - # ----- Build the plan (no side effects) ----- - actions: list[tuple[str, str]] = [] + actions: list[RemoveAction] = [] summary_path = wiki_dir / "summaries" / f"{doc_name}.md" if summary_path.exists(): - actions.append(("DELETE", str(summary_path.relative_to(kb_dir)))) + actions.append(RemoveAction("DELETE", str(summary_path.relative_to(kb_dir)))) source_md = wiki_dir / "sources" / f"{doc_name}.md" source_json = wiki_dir / "sources" / f"{doc_name}.json" if source_md.exists(): - actions.append(("DELETE", str(source_md.relative_to(kb_dir)))) + actions.append(RemoveAction("DELETE", str(source_md.relative_to(kb_dir)))) if source_json.exists(): - actions.append(("DELETE", str(source_json.relative_to(kb_dir)))) + actions.append(RemoveAction("DELETE", str(source_json.relative_to(kb_dir)))) # Per-doc extracted-images directory (PDF page images + base64 images # from docx/pptx + copied relative refs from .md inputs). Created by # openkb.images during ingest, keyed by doc_name. images_dir = wiki_dir / "sources" / "images" / doc_name if images_dir.is_dir(): - actions.append(( - "DELETE", - f"{images_dir.relative_to(kb_dir)}/ (images directory)", - )) + actions.append( + RemoveAction("DELETE", f"{images_dir.relative_to(kb_dir)}/ (images directory)") + ) - # Scan concept pages to predict which will be edited vs. deleted. - # Only frontmatter ``sources:`` membership drives the plan — body-only - # references (e.g. a stray ``See also:`` line a user added by hand - # without updating sources) are cleaned by the executor but don't - # affect the delete/edit classification, so the plan reflects what - # the executor will actually do. source_file_marker = f"summaries/{doc_name}.md" affected_concepts = scan_affected_pages(wiki_dir / "concepts", source_file_marker) - concept_deletes = [s for s, r in affected_concepts if r == 0 and not keep_empty] concept_edits = [s for s, r in affected_concepts if r > 0 or keep_empty] for slug in concept_deletes: - actions.append(("DELETE", f"wiki/concepts/{slug}.md (only source: this doc)")) + actions.append(RemoveAction("DELETE", f"wiki/concepts/{slug}.md (only source: this doc)")) for slug in concept_edits: - actions.append(("MODIFY", f"wiki/concepts/{slug}.md (drop this doc from sources)")) + actions.append(RemoveAction("MODIFY", f"wiki/concepts/{slug}.md (drop this doc from sources)")) - # Scan entity pages with the same frontmatter logic as concepts. The - # executor calls ``remove_doc_from_entity_pages``; this only makes the - # preview/summary truthful about what it will delete vs. edit. affected_entities = scan_affected_pages(wiki_dir / "entities", source_file_marker) - entity_deletes = [s for s, r in affected_entities if r == 0 and not keep_empty] entity_edits = [s for s, r in affected_entities if r > 0 or keep_empty] for slug in entity_deletes: - actions.append(("DELETE", f"wiki/entities/{slug}.md (only source: this doc)")) + actions.append(RemoveAction("DELETE", f"wiki/entities/{slug}.md (only source: this doc)")) for slug in entity_edits: - actions.append(("MODIFY", f"wiki/entities/{slug}.md (drop this doc from sources)")) + actions.append(RemoveAction("MODIFY", f"wiki/entities/{slug}.md (drop this doc from sources)")) if (wiki_dir / "index.md").exists(): - actions.append(("MODIFY", "wiki/index.md (remove Documents entry)")) + actions.append(RemoveAction("MODIFY", "wiki/index.md (remove Documents entry)")) - actions.append(("REGISTRY", f"remove hash entry ({file_hash[:12]}…)")) + actions.append(RemoveAction("REGISTRY", f"remove hash entry ({file_hash[:12]}…)")) # Long PDFs leave state in PageIndex's local store (`.openkb/pageindex.db` # row + `.openkb/files/<collection>/<doc_id>.pdf` + extracted images). # Only flag this when both the registry says long_pdf and PageIndex # state exists on disk — short-doc-only KBs never created any. pageindex_doc_id = meta.get("doc_id") - pageindex_state_exists = (openkb_dir / "pageindex.db").exists() - cleanup_pageindex = doc_type == "long_pdf" and pageindex_state_exists + cleanup_pageindex = doc_type == "long_pdf" and (openkb_dir / "pageindex.db").exists() if cleanup_pageindex: if pageindex_doc_id: - actions.append(( - "PAGEINDEX", f"delete document ({pageindex_doc_id[:12]}…)", - )) + actions.append(RemoveAction("PAGEINDEX", f"delete document ({pageindex_doc_id[:12]}…)")) else: - actions.append(( - "PAGEINDEX", f"delete document (lookup by doc_name; legacy entry)", - )) + actions.append(RemoveAction("PAGEINDEX", "delete document (lookup by doc_name; legacy entry)")) + # Raw copies are named by doc_name since the collision fix: use the + # recorded raw_path when present. Only pre-upgrade entries (no + # raw_path field) fall back to the original filename — a recorded + # path that no longer exists must NOT fall through, or it could + # delete a same-named raw file belonging to another document. raw_path = None if not keep_raw: raw_dir = kb_dir / "raw" - # Raw copies are named by doc_name since the collision fix: use the - # recorded raw_path when present. Only pre-upgrade entries (no - # raw_path field) fall back to the original filename — a recorded - # path that no longer exists must NOT fall through, or it could - # delete a same-named raw file belonging to another document. if meta.get("raw_path"): candidate = kb_dir / meta["raw_path"] else: candidate = raw_dir / name if candidate.exists(): raw_path = candidate - actions.append(("DELETE", str(candidate.relative_to(kb_dir)))) + actions.append(RemoveAction("DELETE", str(candidate.relative_to(kb_dir)))) + + return RemovePlan( + name=name, + doc_name=doc_name, + doc_type=doc_type, + file_hash=file_hash, + actions=actions, + concept_deletes=concept_deletes, + entity_deletes=entity_deletes, + raw_path=raw_path, + cleanup_pageindex=cleanup_pageindex, + pageindex_doc_id=pageindex_doc_id, + summary_path=summary_path, + source_md=source_md, + source_json=source_json, + images_dir=images_dir, + ) + + +def _execute_remove_plan( + kb_dir: Path, + plan: RemovePlan, + registry, + *, + keep_empty: bool, +) -> RemoveResult: + """Carry out a remove plan. Registry write is the commit point. + + Every step before ``registry.remove_by_hash`` is idempotent, so a + PageIndex failure leaves the entry (with its ``doc_id``) intact for a + retry. The ``lint --fix`` scope is limited to the pages this remove + actually touched (modified concept + entity pages ∪ index.md) so the + sweep doesn't strip pre-existing dangling links in unrelated pages + (issue #58). + """ + from openkb.agent.compiler import ( + remove_doc_from_concept_pages, + remove_doc_from_entity_pages, + remove_doc_from_index, + ) + from openkb.lint import fix_broken_links + + wiki_dir = kb_dir / "wiki" + openkb_dir = kb_dir / ".openkb" + doc_name = plan.doc_name + name = plan.name + + plan.summary_path.unlink(missing_ok=True) + plan.source_md.unlink(missing_ok=True) + plan.source_json.unlink(missing_ok=True) + if plan.images_dir.is_dir(): + shutil.rmtree(plan.images_dir, ignore_errors=True) + + concept_result = remove_doc_from_concept_pages(wiki_dir, doc_name, keep_empty=keep_empty) + entity_result = remove_doc_from_entity_pages(wiki_dir, doc_name, keep_empty=keep_empty) + remove_doc_from_index( + wiki_dir, doc_name, concept_result["deleted"], + entity_slugs_deleted=entity_result["deleted"], + ) + + lint_scope: list[Path] = [wiki_dir / "concepts" / f"{s}.md" for s in concept_result["modified"]] + lint_scope += [wiki_dir / "entities" / f"{s}.md" for s in entity_result["modified"]] + index_md = wiki_dir / "index.md" + if index_md.exists(): + lint_scope.append(index_md) + files_changed, ghosts = fix_broken_links(wiki_dir, restrict_to=lint_scope) + + pageindex_message: str | None = None + if plan.cleanup_pageindex: + try: + _, pageindex_message = _cleanup_pageindex( + openkb_dir, kb_dir, doc_name, plan.pageindex_doc_id, + ) + except Exception as exc: + logging.getLogger(__name__).debug("PageIndex cleanup traceback:", exc_info=True) + return RemoveResult( + status="partial", + name=name, + doc_name=doc_name, + actions=plan.actions, + concepts_deleted=concept_result["deleted"], + entities_deleted=entity_result["deleted"], + lint_files_changed=files_changed, + lint_ghosts_removed=ghosts, + pageindex_message=None, + pageindex_error=str(exc), + message=( + f"PageIndex cleanup failed: {exc}; registry entry kept, " + f"re-run `openkb remove {name}` to retry" + ), + ) + + registry.remove_by_hash(plan.file_hash) + if plan.raw_path is not None: + plan.raw_path.unlink(missing_ok=True) + append_log(wiki_dir, "remove", name) + return RemoveResult( + status="removed", + name=name, + doc_name=doc_name, + actions=plan.actions, + concepts_deleted=concept_result["deleted"], + entities_deleted=entity_result["deleted"], + lint_files_changed=files_changed, + lint_ghosts_removed=ghosts, + pageindex_message=pageindex_message, + pageindex_error=None, + message=f"{name} removed from knowledge base.", + ) + + +def run_remove_for_api( + kb_dir: Path, + identifier: str, + *, + keep_raw: bool = False, + keep_empty: bool = False, + dry_run: bool = False, +) -> dict: + """Resolve ``identifier`` and run remove under the KB ingest lock. + + Shared entry point for the REST ``/api/v1/remove`` endpoint. Resolve + + plan + execute all run inside ``kb_ingest_lock`` so concurrent + add/remove can't interleave (matching the CLI's ``@_with_kb_lock``). + + Returns a dict whose ``status`` is one of ``not_found``, ``multiple``, + ``dry_run``, ``removed``, ``partial``. + """ + from openkb.state import HashRegistry + + openkb_dir = kb_dir / ".openkb" + registry = HashRegistry(openkb_dir / "hashes.json") + with kb_ingest_lock(openkb_dir): + matches = _resolve_doc_identifier(registry, identifier) + if not matches: + return {"status": "not_found", "identifier": identifier} + if len(matches) > 1: + return { + "status": "multiple", + "identifier": identifier, + "candidates": [ + {"name": m.get("name", "?"), "doc_name": m.get("doc_name", "?")} + for _, m in matches + ], + } + + file_hash, meta = matches[0] + plan = _build_remove_plan( + kb_dir, file_hash, meta, keep_raw=keep_raw, keep_empty=keep_empty, + ) + if dry_run: + return { + "status": "dry_run", + "name": plan.name, + "doc_name": plan.doc_name, + "actions": [a.__dict__ for a in plan.actions], + "concepts_deleted": plan.concept_deletes, + "entities_deleted": plan.entity_deletes, + } + + result = _execute_remove_plan(kb_dir, plan, registry, keep_empty=keep_empty) + return { + "status": result.status, + "name": result.name, + "doc_name": result.doc_name, + "actions": [a.__dict__ for a in result.actions], + "concepts_deleted": result.concepts_deleted, + "entities_deleted": result.entities_deleted, + "lint_files_changed": result.lint_files_changed, + "lint_ghosts_removed": result.lint_ghosts_removed, + "pageindex_message": result.pageindex_message, + "pageindex_error": result.pageindex_error, + "message": result.message, + } + + +@cli.command() +@click.argument("identifier") +@click.option("--keep-raw", is_flag=True, default=False, + help="Don't delete the original file from raw/.") +@click.option("--keep-empty", "--keep-empty-concepts", "keep_empty", + is_flag=True, default=False, + help="Keep concept AND entity pages whose only source was the " + "removed doc (leaving an empty sources: [] list). Useful " + "when replacing the doc with a newer version. " + "(--keep-empty-concepts is a backward-compatible alias.)") +@click.option("--dry-run", is_flag=True, default=False, + help="Print what would be done without modifying anything.") +@click.option("--yes", "-y", is_flag=True, default=False, + help="Skip the confirmation prompt.") +@click.pass_context +@_with_kb_lock(exclusive=True) +def remove(ctx, identifier, keep_raw, keep_empty, dry_run, yes): + """Remove a document from the knowledge base. + + IDENTIFIER may be the original filename ("paper.pdf"), the doc_name + slug ("paper-a1b2c3d4e5f6"), or a substring that uniquely matches one. + + Deletes the doc's summary and source files, prunes the doc from + concept- and entity-page frontmatter and Related Documents sections, + drops the Documents entry from index.md, removes the hash entry, and + finally runs `lint --fix` to clean any dangling wikilinks. + + Concept and entity pages whose only source was this doc are deleted by + default; use --keep-empty to retain them. + """ + from openkb.state import HashRegistry + + kb_dir = _find_kb_dir(ctx.obj.get("kb_dir_override")) + if kb_dir is None: + click.echo("No knowledge base found. Run `openkb init` first.") + return + + openkb_dir = kb_dir / ".openkb" + registry = HashRegistry(openkb_dir / "hashes.json") + + matches = _resolve_doc_identifier(registry, identifier) + if not matches: + click.echo(f"No document matching '{identifier}' found in the KB.") + click.echo("Try `openkb list` to see indexed documents.") + return + if len(matches) > 1: + click.echo(f"'{identifier}' matches multiple documents:") + for _, m in matches: + click.echo(f" - {m.get('name', '?')} (doc_name: {m.get('doc_name', '?')})") + click.echo("Use a more specific name or the exact doc_name slug.") + return + + file_hash, meta = matches[0] + plan = _build_remove_plan( + kb_dir, file_hash, meta, keep_raw=keep_raw, keep_empty=keep_empty, + ) # ----- Print the plan ----- - click.echo(f"Removing '{name}' (doc_name: {doc_name}, type: {doc_type or '?'}).") + click.echo(f"Removing '{plan.name}' (doc_name: {plan.doc_name}, type: {plan.doc_type or '?'}).") click.echo("") - for tag, target in actions: - click.echo(f" {tag:<8} {target}") - if concept_deletes: + for action in plan.actions: + click.echo(f" {action.tag:<8} {action.target}") + if plan.concept_deletes: click.echo("") click.echo( - f" {len(concept_deletes)} concept(s) will be DELETED because this is their only source." + f" {len(plan.concept_deletes)} concept(s) will be DELETED because this is their only source." ) click.echo(" Pass --keep-empty to retain them instead.") - if entity_deletes: + if plan.entity_deletes: click.echo("") click.echo( - f" {len(entity_deletes)} entity(s) will be DELETED because this is their only source." + f" {len(plan.entity_deletes)} entity(s) will be DELETED because this is their only source." ) click.echo(" Pass --keep-empty to retain them instead.") click.echo("") @@ -1201,91 +1460,20 @@ def remove(ctx, identifier, keep_raw, keep_empty, dry_run, yes): click.echo("Aborted.") return - # ----- Execute ----- - # Ordering rationale: every step before the registry write is - # idempotent (``unlink(missing_ok=True)``, ``shutil.rmtree( - # ignore_errors=True)``, concept/index helpers that no-op on - # already-clean state, and PageIndex's own delete-by-doc_id which - # uses ``missing_ok`` + ``if dir.exists()`` internally). The - # registry write is therefore the *commit point*: if anything - # before it raises (including PageIndex), the entry plus its - # ``doc_id`` survive and the user can simply re-run ``openkb - # remove`` to retry from a clean slate. - summary_path.unlink(missing_ok=True) - source_md.unlink(missing_ok=True) - source_json.unlink(missing_ok=True) - if images_dir.is_dir(): - shutil.rmtree(images_dir, ignore_errors=True) - - concept_result = remove_doc_from_concept_pages( - wiki_dir, doc_name, keep_empty=keep_empty, - ) - - entity_result = remove_doc_from_entity_pages( - wiki_dir, doc_name, keep_empty=keep_empty, - ) - - remove_doc_from_index(wiki_dir, doc_name, concept_result["deleted"], - entity_slugs_deleted=entity_result["deleted"]) - - # Strip dangling wikilinks now so a retry (after a PageIndex - # failure below) finds a clean wiki — no point in re-running this - # on every attempt. - # - # Scope: only the pages this remove actually touched (modified - # concept + entity pages ∪ index.md). Previously this swept the whole - # wiki via ``fix_broken_links(wiki_dir)``, which silently stripped - # pre-existing dangling links in unrelated pages — see issue #58 - # (Bug 2). Users who want a wiki-wide sweep can still run - # ``openkb lint --fix`` explicitly. - lint_scope: list[Path] = [ - wiki_dir / "concepts" / f"{slug}.md" - for slug in concept_result["modified"] - ] - lint_scope += [ - wiki_dir / "entities" / f"{slug}.md" - for slug in entity_result["modified"] - ] - index_md = wiki_dir / "index.md" - if index_md.exists(): - lint_scope.append(index_md) - files_changed, ghosts = fix_broken_links(wiki_dir, restrict_to=lint_scope) - if files_changed: - click.echo(f" lint --fix cleaned {ghosts} dangling wikilink(s) in {files_changed} file(s)") - - # Free PageIndex's local managed state for long PDFs *before* the - # registry write so the user can retry on failure — leaving the - # entry intact preserves the ``doc_id`` we need for the second - # attempt. PageIndex's local dedup is SHA-256 based, so a stale row - # left behind here would silently re-bind on the next ``openkb - # add`` and the user would get the old parse back without warning. - if cleanup_pageindex: - try: - cleaned, msg = _cleanup_pageindex( - openkb_dir, kb_dir, doc_name, pageindex_doc_id, - ) - click.echo(f" PageIndex: {msg}") - except Exception as exc: - click.echo( - f" [WARN] PageIndex cleanup failed: {exc} " - f"— registry entry kept; re-run `openkb remove {name}` to retry" - ) - logging.getLogger(__name__).debug( - "PageIndex cleanup traceback:", exc_info=True, - ) - return - - # ----- Commit point ----- - # Prune by hash, not by ``doc_name``: legacy registry entries - # (ingested before commit c504e26) carry only ``{name, type}`` and - # would silently no-op under ``remove_by_doc_name``. See issue #58. - registry.remove_by_hash(file_hash) + result = _execute_remove_plan(kb_dir, plan, registry, keep_empty=keep_empty) - if raw_path is not None: - raw_path.unlink(missing_ok=True) + if result.lint_files_changed: + click.echo(f" lint --fix cleaned {result.lint_ghosts_removed} dangling wikilink(s) in {result.lint_files_changed} file(s)") + if result.pageindex_message is not None: + click.echo(f" PageIndex: {result.pageindex_message}") + if result.pageindex_error is not None: + click.echo( + f" [WARN] PageIndex cleanup failed: {result.pageindex_error} " + f"— registry entry kept; re-run `openkb remove {result.name}` to retry" + ) + return - append_log(wiki_dir, "remove", name) - click.echo(f" [OK] {name} removed from knowledge base.") + click.echo(f" [OK] {result.name} removed from knowledge base.") def _refresh_schema(wiki_dir: Path) -> bool: @@ -1480,6 +1668,172 @@ def _classify(meta: dict) -> str: append_log(wiki_dir, "recompile", f"recompiled {recompiled}, skipped {skipped}") +async def iter_recompile( + kb_dir: Path, + doc_name: str | None = None, + *, + all_docs: bool = False, + dry_run: bool = False, + refresh_schema: bool = False, +): + """Async generator view of ``recompile`` for the REST ``/api/v1/recompile``. + + Shared entry point for both the non-streaming JSON path and the SSE + streaming path. Yields ``{"event": ..., ...}`` dicts (see the endpoint): + ``start`` -> optional ``plan`` -> one ``doc`` per document -> ``final``. + Terminal errors yield an ``error`` event carrying an HTTP-mapped ``code``: + 400 (bad args), 404 (not found / empty registry), 409 (multiple). + + The whole resolve + compile span runs under ``kb_ingest_lock`` (matching + the CLI's ``@_with_kb_lock(exclusive=True)``). Compile calls are awaited on + the caller's event loop instead of ``asyncio.run``, so this is safe inside + an async FastAPI endpoint. Reference ``compiler`` via the module so tests + can patch ``openkb.agent.compiler.compile_*`` and see the call. + """ + from openkb.state import HashRegistry + + openkb_dir = kb_dir / ".openkb" + wiki_dir = kb_dir / "wiki" + registry = HashRegistry(openkb_dir / "hashes.json") + + def _classify(meta: dict) -> str: + return "long" if _is_long_doc(meta) else "short" + + with kb_ingest_lock(openkb_dir): + # --- validate args --- + if all_docs and doc_name: + yield {"event": "error", "code": 400, + "message": "Specify either a doc_name or all_docs, not both."} + return + if not all_docs and not doc_name: + yield {"event": "error", "code": 400, + "message": "Specify a document name or set all_docs to recompile every doc."} + return + + # --- resolve targets --- + if all_docs: + entries = list(registry.all_entries().values()) + if not entries: + yield {"event": "error", "code": 404, + "message": "No documents indexed yet."} + return + targets = entries + else: + matches = _resolve_doc_identifier(registry, doc_name) + if not matches: + yield {"event": "error", "code": 404, + "message": f"No document matching '{doc_name}' found in the KB."} + return + if len(matches) > 1: + yield { + "event": "error", "code": 409, + "message": "doc_name matches multiple documents.", + "candidates": [ + {"name": m.get("name", "?"), "doc_name": m.get("doc_name", "?")} + for _, m in matches + ], + } + return + targets = [matches[0][1]] + + total = len(targets) + yield {"event": "start", "total": total, "all_docs": all_docs} + + # --- dry-run: enumerate only, no LLM calls, no writes --- + if dry_run: + yield { + "event": "plan", + "targets": [ + { + "name": meta.get("doc_name") or meta.get("name", "?"), + "doc_name": meta.get("doc_name") or meta.get("name", "?"), + "type": _classify(meta), + } + for meta in targets + ], + "total": total, + } + yield {"event": "final", "status": "dry_run", "total": total, + "recompiled": 0, "skipped": 0, "docs": []} + return + + if refresh_schema: + _refresh_schema(wiki_dir) + + _setup_llm_key(kb_dir) + config = load_config(openkb_dir / "config.yaml") + model: str = config.get("model", DEFAULT_CONFIG["model"]) + + from openkb.agent import compiler + + recompiled = 0 + skipped = 0 + docs: list[dict] = [] + for meta in targets: + name = meta.get("doc_name") or Path(meta.get("name", "")).stem + doc_type = _classify(meta) + ok = False + + if not name: + doc = {"name": None, "doc_name": None, "type": doc_type, + "status": "skipped", "elapsed": None, + "message": "registry entry has no doc_name."} + elif _is_long_doc(meta): + summary_path = wiki_dir / "summaries" / f"{name}.md" + doc_id = meta.get("doc_id") + if not doc_id: + doc = {"name": name, "doc_name": name, "type": "long", + "status": "skipped", "elapsed": None, + "message": "legacy long-doc entry without a doc_id; re-add to refresh."} + elif not summary_path.exists(): + doc = {"name": name, "doc_name": name, "type": "long", + "status": "skipped", "elapsed": None, + "message": f"missing summary at wiki/summaries/{name}.md."} + else: + start = time.time() + try: + await compiler.compile_long_doc(name, summary_path, doc_id, kb_dir, model) + except Exception as exc: + doc = {"name": name, "doc_name": name, "type": "long", + "status": "error", "elapsed": round(time.time() - start, 1), + "message": f"Compilation failed: {exc}"} + else: + doc = {"name": name, "doc_name": name, "type": "long", + "status": "ok", "elapsed": round(time.time() - start, 1), + "message": None} + ok = True + else: + source_path = wiki_dir / "sources" / f"{name}.md" + if not source_path.exists(): + doc = {"name": name, "doc_name": name, "type": "short", + "status": "skipped", "elapsed": None, + "message": f"missing source at wiki/sources/{name}.md."} + else: + start = time.time() + try: + await compiler.compile_short_doc(name, source_path, kb_dir, model) + except Exception as exc: + doc = {"name": name, "doc_name": name, "type": "short", + "status": "error", "elapsed": round(time.time() - start, 1), + "message": f"Compilation failed: {exc}"} + else: + doc = {"name": name, "doc_name": name, "type": "short", + "status": "ok", "elapsed": round(time.time() - start, 1), + "message": None} + ok = True + + docs.append(doc) + yield {"event": "doc", **doc} + if ok: + recompiled += 1 + else: + skipped += 1 + + append_log(wiki_dir, "recompile", f"recompiled {recompiled}, skipped {skipped}") + yield {"event": "final", "status": "done", "total": total, + "recompiled": recompiled, "skipped": skipped, "docs": docs} + + @cli.command() @click.option( "--resume", "-r", "resume", @@ -2635,3 +2989,308 @@ def _save_deck_iteration(kb_dir: Path, deck_name: str) -> Path | None: dest = ws / f"iteration-{next_n}" shutil.copytree(src, dest) return dest + + +# --------------------------------------------------------------------------- +# REST API helpers (structured init/list/status/lint + add wrapper) +# +# These return plain dicts (or AddFileResult) so openkb.api can serialize them +# directly as JSON. They deliberately reuse the locked CLI code paths so the +# API and CLI never diverge in behavior. +# --------------------------------------------------------------------------- + + +def _newest_mtime_iso(paths: list[Path]) -> str | None: + """Newest mtime among paths as an ISO-8601 string, or None when empty.""" + if not paths: + return None + import datetime + newest = max(paths, key=lambda p: p.stat().st_mtime) + local_tz = datetime.datetime.now().astimezone().tzinfo + return datetime.datetime.fromtimestamp( + newest.stat().st_mtime, + tz=local_tz, + ).isoformat() + + +def initialize_kb( + kb_dir: Path, + *, + model: str | None = None, + api_key: str | None = None, + openai_api_base: str | None = None, +) -> dict[str, Any]: + """Initialize a knowledge base at an explicit directory (REST ``/init``). + + Non-interactive counterpart to the ``init`` Click command: creates the + raw/wiki/.openkb layout, seed files, config, and empty hash registry, then + optionally writes LLM credentials to a KB-local ``.env``. Raises + ``FileExistsError`` if the KB is already initialized. + """ + from openkb.config import kb_root_dir + + kb_dir = kb_dir.expanduser().resolve() + openkb_dir = kb_dir / ".openkb" + if openkb_dir.exists(): + raise FileExistsError(f"Knowledge base already initialized: {kb_dir}") + + kb_dir.mkdir(parents=True, exist_ok=True) + (kb_dir / "raw").mkdir(exist_ok=True) + (kb_dir / "wiki" / "sources" / "images").mkdir(parents=True, exist_ok=True) + (kb_dir / "wiki" / "summaries").mkdir(parents=True, exist_ok=True) + (kb_dir / "wiki" / "concepts").mkdir(parents=True, exist_ok=True) + (kb_dir / "wiki" / "entities").mkdir(parents=True, exist_ok=True) + + atomic_write_text(kb_dir / "wiki" / "AGENTS.md", AGENTS_MD) + atomic_write_text(kb_dir / "wiki" / "index.md", INDEX_SEED) + atomic_write_text(kb_dir / "wiki" / "log.md", "# Operations Log\n\n") + + openkb_dir.mkdir() + # Seed config.yaml: an explicit model wins; otherwise inherit the + # operator's project-root config.yaml (model/language/optional blocks) + # so a KB created via the REST UI matches the deployed setup instead of + # the hardcoded DEFAULT_CONFIG (gpt-5.4 / en). Defaults are the last resort. + template_config = Path.cwd() / "config.yaml" + if model is not None: + config = { + "model": model, + "language": DEFAULT_CONFIG["language"], + "pageindex_threshold": DEFAULT_CONFIG["pageindex_threshold"], + } + save_config(openkb_dir / "config.yaml", config) + elif template_config.exists(): + shutil.copy2(template_config, openkb_dir / "config.yaml") + else: + config = { + "model": DEFAULT_CONFIG["model"], + "language": DEFAULT_CONFIG["language"], + "pageindex_threshold": DEFAULT_CONFIG["pageindex_threshold"], + } + save_config(openkb_dir / "config.yaml", config) + atomic_write_json(openkb_dir / "hashes.json", {}) + + # Seed KB-local .env: inherit LLM credentials from the project-root .env so + # a new KB can run queries/compiles out of the box. REST-server variables + # (OPENKB_API_TOKEN, OPENKB_KB_ROOT, ...) are filtered out — they scope to + # the server, not a single KB. Explicit api_key/openai_api_base params + # override anything inherited. Precedence: default -> template -> explicit. + env_path = kb_dir / ".env" + can_write_env = not env_path.exists() + env_pairs: dict[str, str] = {} + if can_write_env: + env_pairs["LITELLM_LOCAL_MODEL_COST_MAP"] = "true" + template_env = Path.cwd() / ".env" + if template_env.exists(): + for raw in template_env.read_text(encoding="utf-8").splitlines(): + line = raw.strip() + if not line or line.startswith("#") or "=" not in line: + continue + key, _, val = line.partition("=") + key = key.strip() + # Skip REST-server variables; keep LLM/provider config. + if key.startswith("OPENKB_"): + continue + env_pairs[key] = val.strip() + if api_key: + env_pairs["LLM_API_KEY"] = api_key + if openai_api_base: + env_pairs["OPENAI_API_BASE"] = openai_api_base + if env_pairs: + env_path.write_text( + "".join(f"{k}={v}\n" for k, v in env_pairs.items()), + encoding="utf-8", + ) + os.chmod(env_path, 0o600) + + register_kb(kb_dir) + return { + "kb_dir": str(kb_dir), + "created": True, + "env_written": { + "api_key": "LLM_API_KEY" in env_pairs, + "openai_api_base": "OPENAI_API_BASE" in env_pairs, + }, + "message": "Knowledge base initialized.", + } + + +def get_kb_list(kb_dir: Path) -> dict[str, Any]: + """Return a structured inventory of the knowledge base (REST ``/list``).""" + openkb_dir = kb_dir / ".openkb" + hashes_file = openkb_dir / "hashes.json" + hashes = ( + json.loads(hashes_file.read_text(encoding="utf-8")) + if hashes_file.exists() else {} + ) + + documents = [] + for file_hash, meta in hashes.items(): + raw_type = meta.get("type", "unknown") + pages = meta.get("pages") + documents.append({ + "hash": file_hash, + "name": meta.get("name", "unknown"), + "type": raw_type, + "display_type": _display_type(raw_type), + "pages": pages if pages not in ("", 0) else None, + }) + + summaries_dir = kb_dir / "wiki" / "summaries" + concepts_dir = kb_dir / "wiki" / "concepts" + reports_dir = kb_dir / "wiki" / "reports" + return { + "documents": documents, + "document_count": len(documents), + "summaries": sorted(p.stem for p in summaries_dir.glob("*.md")) + if summaries_dir.exists() else [], + "concepts": sorted(p.stem for p in concepts_dir.glob("*.md")) + if concepts_dir.exists() else [], + "reports": sorted(p.name for p in reports_dir.glob("*.md")) + if reports_dir.exists() else [], + } + + +def get_kb_status(kb_dir: Path) -> dict[str, Any]: + """Return structured status for the knowledge base (REST ``/status``).""" + wiki_dir = kb_dir / "wiki" + subdirs = ["sources", "summaries", "concepts", "reports"] + directories = {} + for subdir in subdirs: + path = wiki_dir / subdir + directories[subdir] = len(list(path.glob("*.md"))) if path.exists() else 0 + + raw_dir = kb_dir / "raw" + raw_count = ( + len([f for f in raw_dir.iterdir() if f.is_file()]) if raw_dir.exists() else 0 + ) + + hashes_file = kb_dir / ".openkb" / "hashes.json" + hashes = ( + json.loads(hashes_file.read_text(encoding="utf-8")) + if hashes_file.exists() else {} + ) + + summaries = ( + list((wiki_dir / "summaries").glob("*.md")) + if (wiki_dir / "summaries").exists() else [] + ) + reports = ( + list((wiki_dir / "reports").glob("*.md")) + if (wiki_dir / "reports").exists() else [] + ) + return { + "directories": directories, + "raw_count": raw_count, + "total_indexed": len(hashes), + "last_compile": _newest_mtime_iso(summaries), + "last_lint": _newest_mtime_iso(reports), + } + + +def _fix_summary(files_changed: int | None, ghosts: int | None) -> str: + """One-line summary of a ``lint --fix`` pass (mirrors the CLI wording).""" + if files_changed: + return f"Fixed {ghosts} wikilink(s) across {files_changed} file(s)." + return "Nothing to fix — all wikilinks resolve." + + +async def run_lint_report(kb_dir: Path, *, fix: bool = False, echo: bool = False) -> dict[str, Any]: + """Run lint and return structured report metadata (REST ``/lint``). + + Mirrors ``run_lint`` (structural + knowledge lint, writes a combined + report) but returns a JSON-serializable dict instead of printing and + returning only a path. Skips with a structured payload when there is + nothing to lint. + + When ``fix`` is True, ``fix_broken_links`` runs first under the KB ingest + lock (mirroring ``openkb lint --fix``), so the report reflects the + post-fix state and the fix counts are returned as + ``lint_files_changed`` / ``lint_ghosts_removed``. + """ + from openkb.lint import fix_broken_links, run_structural_lint + from openkb.agent.linter import run_knowledge_lint + + # Optional fix pass runs first (matching `openkb lint --fix`), before any + # skip/report logic, so the report and message reflect the post-fix state. + lint_files_changed: int | None = None + lint_ghosts_removed: int | None = None + if fix: + with kb_ingest_lock(kb_dir / ".openkb"): + files_changed, ghosts = fix_broken_links(kb_dir / "wiki") + lint_files_changed = files_changed + lint_ghosts_removed = ghosts + + openkb_dir = kb_dir / ".openkb" + hashes_file = openkb_dir / "hashes.json" + hashes = ( + json.loads(hashes_file.read_text(encoding="utf-8")) + if hashes_file.exists() else {} + ) + + if not hashes: + message = "Nothing to lint - no documents indexed yet. Run `openkb add` first." + if fix: + message = f"{_fix_summary(lint_files_changed, lint_ghosts_removed)} {message}" + if echo: + click.echo(message) + return { + "skipped": True, + "reason": "no_documents_indexed", + "message": message, + "structural_report": None, + "knowledge_report": None, + "report_path": None, + "lint_files_changed": lint_files_changed, + "lint_ghosts_removed": lint_ghosts_removed, + } + + config = load_config(openkb_dir / "config.yaml") + _setup_llm_key(kb_dir) + model: str = config.get("model", DEFAULT_CONFIG["model"]) + + if echo: + click.echo("Running structural lint...") + structural_report = run_structural_lint(kb_dir) + if echo: + click.echo(structural_report) + click.echo("Running knowledge lint...") + + try: + knowledge_report = await run_knowledge_lint(kb_dir, model) + except Exception as exc: + knowledge_report = f"Knowledge lint failed: {exc}" + if echo: + click.echo(knowledge_report) + + reports_dir = kb_dir / "wiki" / "reports" + reports_dir.mkdir(parents=True, exist_ok=True) + import datetime + timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S") + report_path = reports_dir / f"lint_{timestamp}.md" + counter = 1 + while report_path.exists(): + report_path = reports_dir / f"lint_{timestamp}_{counter}.md" + counter += 1 + report_content = ( + f"# Lint Report — {timestamp}\n\n" + f"## Structural\n\n{structural_report}\n\n" + f"## Semantic\n\n{knowledge_report}\n" + ) + report_path.write_text(report_content, encoding="utf-8") + append_log(kb_dir / "wiki", "lint", f"report → {report_path.name}") + if echo: + click.echo(f"\nReport written to {report_path}") + + message = "Lint report written." + if fix: + message = f"{_fix_summary(lint_files_changed, lint_ghosts_removed)} {message}" + return { + "skipped": False, + "reason": None, + "message": message, + "structural_report": structural_report, + "knowledge_report": knowledge_report, + "report_path": str(report_path), + "lint_files_changed": lint_files_changed, + "lint_ghosts_removed": lint_ghosts_removed, + } diff --git a/openkb/config.py b/openkb/config.py index 52082c62d..989bb94b2 100644 --- a/openkb/config.py +++ b/openkb/config.py @@ -4,6 +4,7 @@ import logging import math import re +import os from pathlib import Path from typing import Any, Iterator @@ -29,6 +30,11 @@ GLOBAL_CONFIG_PATH = GLOBAL_CONFIG_DIR / "global.yaml" GLOBAL_CONFIG_LOCK_PATH = GLOBAL_CONFIG_DIR / "global.lock" +# Portable KB names for the REST API: letters, numbers, underscores, hyphens. +# Lets clients address a knowledge base by a filesystem-safe short name +# (``kb``) instead of an absolute path, resolved via kb_aliases/OPENKB_KB_ROOT. +KB_NAME_RE = re.compile(r"[A-Za-z0-9_-]+") + @contextlib.contextmanager def _with_global_config_lock() -> Iterator[None]: @@ -282,3 +288,62 @@ def register_kb(kb_path: Path) -> None: gc["known_kbs"] = known gc["default_kb"] = resolved _atomic_yaml_dump(GLOBAL_CONFIG_PATH, gc) + + +def kb_root_dir() -> Path: + """Return the root directory for API-addressable KB names. + + Controlled by ``OPENKB_KB_ROOT``; defaults to ``<config>/kbs`` so REST + ``/init`` creates knowledge bases under a predictable location. + """ + configured_root = os.environ.get("OPENKB_KB_ROOT") + if configured_root: + return Path(configured_root).expanduser().resolve() + return (GLOBAL_CONFIG_DIR / "kbs").resolve() + + +def validate_kb_name(name: str) -> str: + """Validate and return a portable KB name.""" + normalized = name.strip() + if not normalized or not KB_NAME_RE.fullmatch(normalized): + raise ValueError( + "KB name must contain only letters, numbers, underscores, and hyphens" + ) + return normalized + + +def register_kb_alias(name: str, kb_path: Path) -> None: + """Register a portable KB name alias for a KB path. + + Held under the global-config lock so concurrent API writes (uvicorn + threadpool) can't lose an alias to a read-modify-write race. + """ + alias = validate_kb_name(name) + resolved = str(kb_path.resolve()) + with _with_global_config_lock(): + gc = _load_global_config_unlocked() + known = gc.get("known_kbs", []) + if resolved not in known: + known.append(resolved) + gc["known_kbs"] = known + aliases = gc.get("kb_aliases", {}) + aliases[alias] = resolved + gc["kb_aliases"] = aliases + gc["default_kb"] = resolved + _atomic_yaml_dump(GLOBAL_CONFIG_PATH, gc) + + +def resolve_kb_alias(name: str) -> Path: + """Resolve a portable KB name to its registered path or root fallback. + + If the name is a registered alias, return its path; otherwise fall back to + ``<kb_root_dir>/<name>`` so a freshly created KB is addressable without an + explicit alias round-trip. + """ + alias = validate_kb_name(name) + with _with_global_config_lock(): + gc = _load_global_config_unlocked() + aliases = gc.get("kb_aliases", {}) + if alias in aliases: + return Path(aliases[alias]).expanduser().resolve() + return (kb_root_dir() / alias).resolve() diff --git a/openkb/watch_service.py b/openkb/watch_service.py new file mode 100644 index 000000000..a2c63f272 --- /dev/null +++ b/openkb/watch_service.py @@ -0,0 +1,225 @@ +"""Server-managed file watchers for the OpenKB REST API. + +Each knowledge base may have at most one active watcher that observes its +``raw/`` directory and automatically ingests new/modified files through the +same locked pipeline used by the CLI ``add`` command and the REST ``/add`` +endpoint (``openkb.cli._add_for_api``). The watcher runs entirely in +background threads; the FastAPI layer only starts/stops/reads state. + +Design notes: +* One worker thread per KB consumes debounced file batches sequentially, so + ingest is serialized per-KB (the global ingest lock would serialize it + anyway) while different KBs proceed in parallel. +* Per-KB mutable state is held in :class:`WatcherState`; the registry guards + only the KB->state map. Events live in a bounded ring buffer so a long-lived + watcher never accumulates unbounded memory. +* ``_add_for_api`` and ``SUPPORTED_EXTENSIONS`` are imported into this module's + namespace so tests can monkeypatch ``openkb.watch_service._add_for_api``. +""" +from __future__ import annotations + +import os +import queue +import threading +import time +from collections import deque +from dataclasses import dataclass, field +from pathlib import Path +from typing import Any + +from watchdog.observers import Observer + +from openkb.cli import SUPPORTED_EXTENSIONS, _add_for_api +from openkb.watcher import start_watch + +# How many recent events to retain per KB for status() and SSE replay. +_MAX_EVENTS = int(os.environ.get("OPENKB_WATCH_MAX_EVENTS", "200")) + + +@dataclass +class WatcherState: + """Runtime state for a single KB's watcher.""" + + kb: str + kb_dir: Path + raw_dir: Path + debounce: float + started_at: float + observer: Observer | None = None + worker_thread: threading.Thread | None = None + queue: queue.Queue = field(default_factory=queue.Queue) + running: threading.Event = field(default_factory=threading.Event) + events: deque = field(default_factory=lambda: deque(maxlen=_MAX_EVENTS)) + counters: dict[str, int] = field(default_factory=lambda: {"added": 0, "skipped": 0, "failed": 0}) + _seq: int = 0 + _lock: threading.Lock = field(default_factory=threading.Lock, repr=False) + + def __post_init__(self) -> None: + self.running.set() + + +def _record_event(state: WatcherState, event: str, data: dict[str, Any]) -> None: + """Append a timestamped, sequenced event to the per-KB ring buffer.""" + with state._lock: + state._seq += 1 + seq = state._seq + state.events.append({"seq": seq, "ts": time.time(), "event": event, "data": data}) + + +def _inc(state: WatcherState, key: str) -> None: + with state._lock: + state.counters[key] = state.counters.get(key, 0) + 1 + + +def _public_event(ev: dict[str, Any]) -> dict[str, Any]: + """Strip the internal ``seq`` before exposing an event over the API.""" + return {"ts": ev["ts"], "event": ev["event"], "data": ev.get("data", {})} + + +def _run_worker(state: WatcherState) -> None: + """Consume debounced file batches and ingest each file. + + Exits when ``stop`` puts the ``None`` sentinel. Any per-file exception is + recorded as an ``error`` event; the worker never propagates so one bad + file can't kill the watcher. + """ + while True: + try: + paths = state.queue.get() + except Exception: + return + if paths is None: + return + for raw_path in paths: + _process_file(state, raw_path) + + +def _process_file(state: WatcherState, raw_path: str) -> None: + path = Path(raw_path) + suffix = path.suffix.lower() + if not suffix or suffix not in SUPPORTED_EXTENSIONS: + supported = ", ".join(sorted(SUPPORTED_EXTENSIONS)) + _record_event(state, "file_done", { + "path": str(path), + "original_name": path.name, + "status": "skipped", + "message": f"Skipping unsupported file type: {suffix}. Supported: {supported}", + }) + _inc(state, "skipped") + return + _record_event(state, "file_start", { + "path": str(path), + "original_name": path.name, + }) + try: + result = _add_for_api(path, state.kb_dir) + except Exception as exc: # worker must never die + _record_event(state, "error", { + "path": str(path), + "original_name": path.name, + "message": f"Failed to add: {path.name}: {exc}", + }) + _inc(state, "failed") + return + status = result.status if result.status in ("added", "skipped", "failed") else "failed" + _record_event(state, "file_done", { + "path": str(path), + "original_name": path.name, + "status": status, + "message": result.message, + }) + _inc(state, status) + + +class WatchRegistry: + """Thread-safe registry of per-KB watchers (one app instance owns one).""" + + def __init__(self, max_events: int = _MAX_EVENTS) -> None: + self._watchers: dict[str, WatcherState] = {} + self._lock = threading.Lock() + self._max_events = max_events + + def start(self, kb: str, kb_dir: Path, debounce: float = 2.0) -> WatcherState: + """Start a watcher for *kb*, or return the existing one (idempotent).""" + with self._lock: + existing = self._watchers.get(kb) + if existing is not None and existing.running.is_set(): + return existing + raw_dir = kb_dir / "raw" + raw_dir.mkdir(parents=True, exist_ok=True) + state = WatcherState( + kb=kb, + kb_dir=kb_dir, + raw_dir=raw_dir, + debounce=debounce, + started_at=time.time(), + events=deque(maxlen=self._max_events), + ) + + def on_new_files(paths: list[str]) -> None: + state.queue.put(paths) + + state.observer = start_watch(raw_dir, on_new_files, debounce=debounce) + state.worker_thread = threading.Thread( + target=_run_worker, args=(state,), daemon=True, + name=f"openkb-watch-{kb}", + ) + self._watchers[kb] = state + state.worker_thread.start() + return state + + def get(self, kb: str) -> WatcherState | None: + with self._lock: + return self._watchers.get(kb) + + def recent_events(self, kb: str) -> list[dict[str, Any]]: + """Return public (seq-stripped) recent events for *kb* (empty if none).""" + with self._lock: + state = self._watchers.get(kb) + if state is None: + return [] + return [_public_event(e) for e in state.events] + + def status(self, kb: str) -> dict[str, Any]: + with self._lock: + state = self._watchers.get(kb) + if state is None: + return {"kb": kb, "active": False} + with state._lock: + counters = dict(state.counters) + return { + "kb": state.kb, + "active": state.running.is_set(), + "started_at": state.started_at, + "raw_dir": str(state.raw_dir), + "debounce": state.debounce, + "counters": counters, + "recent_events": [_public_event(e) for e in state.events], + } + + def list_active(self) -> list[str]: + with self._lock: + return list(self._watchers.keys()) + + def stop(self, kb: str) -> bool: + """Stop and remove *kb*'s watcher. Return False if none was active.""" + with self._lock: + state = self._watchers.pop(kb, None) + if state is None: + return False + _record_event(state, "watcher_stopped", {"kb": kb}) + state.running.clear() + try: + if state.observer is not None: + state.observer.stop() + state.observer.join(timeout=5.0) + except Exception: + pass + state.queue.put(None) + if state.worker_thread is not None: + state.worker_thread.join(timeout=5.0) + return True + + def stop_all(self) -> None: + for kb in self.list_active(): + self.stop(kb) \ No newline at end of file diff --git a/openkb/watcher.py b/openkb/watcher.py index 2a0fae91e..94e96b2fa 100644 --- a/openkb/watcher.py +++ b/openkb/watcher.py @@ -81,18 +81,45 @@ def watch_directory( ) -> None: """Start watching *raw_dir* and block until Ctrl+C. + Thin blocking wrapper around :func:`start_watch`; kept so the CLI + ``openkb watch`` command is unchanged. The REST layer uses + :func:`start_watch` directly so it can own the Observer's lifecycle. + Args: raw_dir: Directory to watch for file changes. callback: Called with sorted list of new/modified file paths. debounce: Debounce delay in seconds. Defaults to 2.0. """ - handler = DebouncedHandler(callback, debounce_seconds=debounce) - observer = Observer() - observer.schedule(handler, str(raw_dir), recursive=True) - observer.start() + observer = start_watch(raw_dir, callback, debounce) try: while observer.is_alive(): observer.join(timeout=1.0) except KeyboardInterrupt: observer.stop() observer.join() + + +def start_watch( + raw_dir: Path, + callback: Callable[[list[str]], None], + debounce: float = 2.0, +) -> Observer: + """Start a non-blocking watcher on *raw_dir* and return its Observer. + + The caller owns the Observer's lifecycle: call ``observer.stop()`` then + ``observer.join()`` to tear it down. Debounce/filter behavior is identical + to :func:`watch_directory`. + + Args: + raw_dir: Directory to watch for file changes. + callback: Called with sorted list of new/modified file paths. + debounce: Debounce delay in seconds. Defaults to 2.0. + + Returns: + The started watchdog Observer. + """ + handler = DebouncedHandler(callback, debounce_seconds=debounce) + observer = Observer() + observer.schedule(handler, str(raw_dir), recursive=True) + observer.start() + return observer diff --git a/pyproject.toml b/pyproject.toml index 694ab5e01..cfca17f75 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,12 +54,14 @@ Issues = "https://github.com/VectifyAI/OpenKB/issues" [project.scripts] openkb = "openkb.cli:cli" +openkb-api = "openkb.api:main" [tool.pytest.ini_options] testpaths = ["tests"] [project.optional-dependencies] -dev = ["pytest==9.0.3", "pytest-asyncio==1.3.0"] +dev = ["pytest==9.0.3", "pytest-asyncio==1.3.0", "httpx"] +api = ["fastapi", "uvicorn", "python-multipart"] [tool.hatch.version] source = "vcs" diff --git a/tests/test_api.py b/tests/test_api.py new file mode 100644 index 000000000..e3c21c0bd --- /dev/null +++ b/tests/test_api.py @@ -0,0 +1,1401 @@ +from __future__ import annotations + +import json +from typing import Any + +import yaml +from fastapi.testclient import TestClient + +from openkb.api import create_app + + +def _client(monkeypatch, token: str | None = "secret") -> TestClient: + if token is None: + monkeypatch.delenv("OPENKB_API_TOKEN", raising=False) + else: + monkeypatch.setenv("OPENKB_API_TOKEN", token) + return TestClient(create_app()) + + +def _auth(token: str = "secret") -> dict[str, str]: + return {"Authorization": f"Bearer {token}"} + + +def _use_named_kb(monkeypatch, kb_dir, name: str = "test-kb") -> str: + def resolve(kb): + assert kb == name + return kb_dir + + monkeypatch.setattr("openkb.api.resolve_kb_alias", resolve) + return name + + +def _events_from_sse(text: str) -> list[dict[str, Any]]: + events: list[dict[str, Any]] = [] + for block in text.strip().split("\n\n"): + lines = block.splitlines() + event = lines[0].removeprefix("event: ") + data = json.loads(lines[1].removeprefix("data: ")) + events.append({"event": event, "data": data}) + return events + + +def test_api_requires_configured_token(monkeypatch, kb_dir): + client = _client(monkeypatch, token=None) + kb = _use_named_kb(monkeypatch, kb_dir) + + response = client.post( + "/api/v1/query", + json={"kb": kb, "question": "What?"}, + headers=_auth(), + ) + + assert response.status_code == 500 + assert "OPENKB_API_TOKEN" in response.json()["detail"] + + +def test_api_rejects_missing_or_invalid_token(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + missing = client.post( + "/api/v1/query", + json={"kb": kb, "question": "What?"}, + ) + invalid = client.post( + "/api/v1/query", + json={"kb": kb, "question": "What?"}, + headers=_auth("wrong"), + ) + + assert missing.status_code == 401 + assert invalid.status_code == 401 + + +def test_query_non_stream_returns_json(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + async def fake_run_query(question, kb, model, stream=False): + assert question == "What is OpenKB?" + assert kb == kb_dir + assert stream is False + return "A knowledge base." + + monkeypatch.setattr("openkb.api._setup_llm_key", lambda kb: None) + monkeypatch.setattr("openkb.api.run_query", fake_run_query) + + response = client.post( + "/api/v1/query", + json={"kb": kb, "question": "What is OpenKB?", "stream": False}, + headers=_auth(), + ) + + assert response.status_code == 200 + assert response.json() == {"answer": "A knowledge base.", "saved_path": None} + + +def test_query_stream_returns_sse_events(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + async def fake_events(agent, question): + assert question == "What is OpenKB?" + yield {"event": "delta", "data": {"text": "A knowledge"}} + yield {"event": "delta", "data": {"text": " base."}} + yield {"event": "final", "data": {"answer": "A knowledge base.", "history": []}} + + monkeypatch.setattr("openkb.api._setup_llm_key", lambda kb: None) + monkeypatch.setattr("openkb.api.build_query_agent", lambda *args, **kwargs: object()) + monkeypatch.setattr("openkb.api.iter_agent_response_events", fake_events) + + response = client.post( + "/api/v1/query", + json={"kb": kb, "question": "What is OpenKB?"}, + headers=_auth(), + ) + + assert response.status_code == 200 + assert response.headers["content-type"].startswith("text/event-stream") + events = _events_from_sse(response.text) + assert [event["event"] for event in events] == ["start", "delta", "delta", "final", "done"] + assert events[-2]["data"]["answer"] == "A knowledge base." + + +def test_chat_non_stream_creates_and_persists_session(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + async def fake_agent_events(agent, input_data, *, max_turns): + yield {"event": "delta", "data": {"text": "Hello"}} + yield { + "event": "final", + "data": { + "answer": "Hello", + "history": [{"role": "assistant", "content": "Hello"}], + }, + } + + monkeypatch.setattr("openkb.api._setup_llm_key", lambda kb: None) + monkeypatch.setattr("openkb.api.build_chat_session_agent", lambda *args, **kwargs: object()) + monkeypatch.setattr("openkb.agent.chat.iter_agent_response_events", fake_agent_events) + + response = client.post( + "/api/v1/chat", + json={"kb": kb, "message": "Hi", "stream": False}, + headers=_auth(), + ) + + assert response.status_code == 200 + payload = response.json() + assert payload["answer"] == "Hello" + assert payload["turn_count"] == 1 + session_path = kb_dir / ".openkb" / "chats" / f"{payload['session_id']}.json" + assert session_path.exists() + + +def test_chat_stream_resumes_session(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + from openkb.agent.chat_session import ChatSession + + session = ChatSession.new(kb_dir, "gpt-4o-mini", "en") + session.record_turn("Hi", "Hello", [{"role": "assistant", "content": "Hello"}]) + + async def fake_chat_events(agent, loaded_session, message): + assert loaded_session.id == session.id + assert message == "Again" + yield {"event": "delta", "data": {"text": "Again"}} + yield { + "event": "final", + "data": { + "answer": "Again", + "session_id": loaded_session.id, + "turn_count": 2, + }, + } + + monkeypatch.setattr("openkb.api._setup_llm_key", lambda kb: None) + monkeypatch.setattr("openkb.api.build_chat_session_agent", lambda *args, **kwargs: object()) + monkeypatch.setattr("openkb.api.iter_chat_turn_events", fake_chat_events) + + response = client.post( + "/api/v1/chat", + json={"kb": kb, "message": "Again", "session_id": session.id}, + headers=_auth(), + ) + + assert response.status_code == 200 + events = _events_from_sse(response.text) + assert events[0]["data"]["session_id"] == session.id + assert events[-2]["data"]["turn_count"] == 2 + + +def test_init_endpoint_creates_named_kb_under_env_root(monkeypatch, tmp_path): + client = _client(monkeypatch) + root = tmp_path / "api-kbs" + kb_dir = root / "postman-kb" + # Run from a clean CWD so the KB does not inherit the real project-root + # config.yaml/.env (initialize_kb seeds from Path.cwd()). + monkeypatch.chdir(tmp_path) + monkeypatch.setenv("OPENKB_KB_ROOT", str(root)) + monkeypatch.setattr("openkb.config.GLOBAL_CONFIG_PATH", tmp_path / "global.yaml") + monkeypatch.setattr("openkb.config.GLOBAL_CONFIG_DIR", tmp_path) + + response = client.post( + "/api/v1/init", + json={"kb": "postman-kb", "model": "gpt-5.4-mini"}, + headers=_auth(), + ) + + assert response.status_code == 200 + payload = response.json() + assert payload["kb"] == "postman-kb" + assert payload["created"] is True + assert payload["env_written"] == {"api_key": False, "openai_api_base": False} + assert (kb_dir / ".openkb" / "config.yaml").is_file() + assert (kb_dir / "wiki" / "AGENTS.md").is_file() + global_config = yaml.safe_load((tmp_path / "global.yaml").read_text(encoding="utf-8")) + assert global_config["kb_aliases"] == {"postman-kb": str(kb_dir.resolve())} + + +def test_init_endpoint_ignores_stale_alias_for_creation(monkeypatch, tmp_path): + client = _client(monkeypatch) + root = tmp_path / "api-kbs" + kb_dir = root / "postman-kb" + stale_path = tmp_path / "stale-kb" + stale_path.joinpath(".openkb").mkdir(parents=True) + stale_path.joinpath("wiki").mkdir() + stale_path.joinpath("wiki", "AGENTS.md").write_text("# stale\n", encoding="utf-8") + global_dir = tmp_path / "global-config" + global_path = global_dir / "global.yaml" + global_dir.mkdir() + global_path.write_text( + yaml.safe_dump( + { + "default_kb": str(stale_path), + "known_kbs": [str(stale_path)], + "kb_aliases": {"postman-kb": str(stale_path)}, + }, + sort_keys=True, + ), + encoding="utf-8", + ) + monkeypatch.setenv("OPENKB_KB_ROOT", str(root)) + monkeypatch.setattr("openkb.config.GLOBAL_CONFIG_PATH", global_path) + monkeypatch.setattr("openkb.config.GLOBAL_CONFIG_DIR", global_dir) + + response = client.post( + "/api/v1/init", + json={"kb": "postman-kb"}, + headers=_auth(), + ) + + assert response.status_code == 200 + assert (kb_dir / ".openkb" / "config.yaml").is_file() + assert (kb_dir / "wiki" / "AGENTS.md").is_file() + global_config = yaml.safe_load(global_path.read_text(encoding="utf-8")) + assert global_config["kb_aliases"]["postman-kb"] == str(kb_dir.resolve()) + + +def test_init_endpoint_rejects_invalid_kb_name(monkeypatch): + client = _client(monkeypatch) + + response = client.post( + "/api/v1/init", + json={"kb": "../bad"}, + headers=_auth(), + ) + + assert response.status_code == 400 + assert "KB name" in response.json()["detail"] + + +def test_init_endpoint_writes_env_without_leaking_values(monkeypatch, tmp_path): + client = _client(monkeypatch) + root = tmp_path / "api-kbs" + kb_dir = root / "new-kb" + monkeypatch.chdir(tmp_path) + monkeypatch.setenv("OPENKB_KB_ROOT", str(root)) + monkeypatch.setattr("openkb.config.GLOBAL_CONFIG_PATH", tmp_path / "global.yaml") + monkeypatch.setattr("openkb.config.GLOBAL_CONFIG_DIR", tmp_path) + + response = client.post( + "/api/v1/init", + json={ + "kb": "new-kb", + "api_key": "sk-secret", + "openai_api_base": "https://gateway.example/v1", + }, + headers=_auth(), + ) + + assert response.status_code == 200 + payload_text = response.text + assert "sk-secret" not in payload_text + assert "https://gateway.example/v1" not in payload_text + assert response.json()["env_written"] == {"api_key": True, "openai_api_base": True} + assert (kb_dir / ".env").read_text(encoding="utf-8") == ( + "LITELLM_LOCAL_MODEL_COST_MAP=true\n" + "LLM_API_KEY=sk-secret\n" + "OPENAI_API_BASE=https://gateway.example/v1\n" + ) + + +def test_init_endpoint_inherits_project_root_config(monkeypatch, tmp_path): + # A KB created from the REST UI (no explicit params) should inherit the + # operator's project-root config.yaml and LLM credentials from .env, so it + # can run queries/compiles out of the box. Server-level OPENKB_* vars are + # filtered out of the inherited .env. + client = _client(monkeypatch) + root = tmp_path / "api-kbs" + kb_dir = root / "templated-kb" + # Simulate the project root: deploy a config.yaml + .env at CWD. + monkeypatch.chdir(tmp_path) + (tmp_path / "config.yaml").write_text( + "model: openai/deepseek-v4-flash\n" + "language: zh\n" + "pageindex_threshold: 20\n", + encoding="utf-8", + ) + (tmp_path / ".env").write_text( + "LLM_API_KEY=sk-inherited\n" + "OPENAI_API_BASE=https://gateway.example/v1\n" + "OPENKB_API_TOKEN=secret\n" + "OPENKB_KB_ROOT=" + str(root) + "\n", + encoding="utf-8", + ) + monkeypatch.setenv("OPENKB_KB_ROOT", str(root)) + monkeypatch.setattr("openkb.config.GLOBAL_CONFIG_PATH", tmp_path / "global.yaml") + monkeypatch.setattr("openkb.config.GLOBAL_CONFIG_DIR", tmp_path) + + response = client.post("/api/v1/init", json={"kb": "templated-kb"}, headers=_auth()) + + assert response.status_code == 200 + payload = response.json() + assert payload["env_written"] == {"api_key": True, "openai_api_base": True} + # config.yaml inherited verbatim (model/language preserved, not gpt-5.4/en). + config = yaml.safe_load((kb_dir / ".openkb" / "config.yaml").read_text("utf-8")) + assert config["model"] == "openai/deepseek-v4-flash" + assert config["language"] == "zh" + # .env inherited LLM creds but dropped server-level OPENKB_* vars. + env_text = (kb_dir / ".env").read_text(encoding="utf-8") + assert "LLM_API_KEY=sk-inherited" in env_text + assert "OPENAI_API_BASE=https://gateway.example/v1" in env_text + assert "OPENKB_API_TOKEN" not in env_text + assert "OPENKB_KB_ROOT" not in env_text + + +def test_init_endpoint_rejects_existing_kb(monkeypatch, tmp_path): + client = _client(monkeypatch) + root = tmp_path / "api-kbs" + kb_dir = root / "existing-kb" + (kb_dir / ".openkb").mkdir(parents=True) + monkeypatch.setenv("OPENKB_KB_ROOT", str(root)) + monkeypatch.setattr("openkb.config.GLOBAL_CONFIG_PATH", tmp_path / "global.yaml") + monkeypatch.setattr("openkb.config.GLOBAL_CONFIG_DIR", tmp_path) + + response = client.post( + "/api/v1/init", + json={"kb": "existing-kb"}, + headers=_auth(), + ) + + assert response.status_code == 400 + assert "already initialized" in response.json()["detail"] + + +def test_add_endpoint_rejects_missing_files(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + response = client.post( + "/api/v1/add", + data={"kb": kb, "stream": "false"}, + headers=_auth(), + ) + + assert response.status_code == 400 + assert "No files uploaded" in response.json()["detail"] + + +def test_add_endpoint_rejects_unsupported_extension(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + response = client.post( + "/api/v1/add", + data={"kb": kb, "stream": "false"}, + files=[("files", ("bad.xyz", b"bad", "application/octet-stream"))], + headers=_auth(), + ) + + assert response.status_code == 400 + assert "Unsupported file type" in response.json()["detail"] + + +def test_add_endpoint_rejects_oversized_file(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + monkeypatch.setattr("openkb.api.MAX_UPLOAD_FILE_BYTES", 4) + monkeypatch.setattr("openkb.api.MAX_UPLOAD_REQUEST_BYTES", 100) + + response = client.post( + "/api/v1/add", + data={"kb": kb}, + files=[("files", ("paper.md", b"12345", "text/markdown"))], + headers=_auth(), + ) + + assert response.status_code == 413 + assert "Uploaded file exceeds limit" in response.json()["detail"] + assert not (kb_dir / "raw" / "paper.md").exists() + + +def test_add_endpoint_rejects_oversized_aggregate_request(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + monkeypatch.setattr("openkb.api.MAX_UPLOAD_FILE_BYTES", 10) + monkeypatch.setattr("openkb.api.MAX_UPLOAD_REQUEST_BYTES", 8) + + response = client.post( + "/api/v1/add", + data={"kb": kb, "stream": "false"}, + files=[ + ("files", ("one.md", b"12345", "text/markdown")), + ("files", ("two.md", b"67890", "text/markdown")), + ], + headers=_auth(), + ) + + assert response.status_code == 413 + assert "Upload request exceeds limit" in response.json()["detail"] + assert not (kb_dir / "raw" / "one.md").exists() + assert not (kb_dir / "raw" / "two.md").exists() + + +def test_add_endpoint_uploads_and_adds_single_file(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + from openkb.cli import AddFileResult + + calls = [] + + def fake_add(path, target_kb): + calls.append((path, target_kb)) + return AddFileResult(path.name, str(path), "added", f"{path.name} added to knowledge base.") + + monkeypatch.setattr("openkb.api._add_for_api", fake_add) + + response = client.post( + "/api/v1/add", + data={"kb": kb, "stream": "false"}, + files=[("files", ("paper.md", b"# Paper", "text/markdown"))], + headers=_auth(), + ) + + assert response.status_code == 200 + saved_path = kb_dir / "raw" / "paper.md" + assert saved_path.read_bytes() == b"# Paper" + assert calls == [(saved_path, kb_dir)] + assert response.json()["files"][0] == { + "original_name": "paper.md", + "saved_path": str(saved_path), + "status": "added", + "message": "paper.md added to knowledge base.", + } + assert response.json()["added_count"] == 1 + + +def test_add_endpoint_runs_real_add_helper_outside_event_loop(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + from openkb.converter import ConvertResult + + def fake_convert(path, target_kb): + assert target_kb == kb_dir + return ConvertResult( + raw_path=path, + source_path=target_kb / "wiki" / "sources" / path.name, + is_long_doc=False, + file_hash="abc123", + ) + + async def fake_compile_short_doc(doc_name, source_path, target_kb, model): + assert doc_name == "paper" + assert target_kb == kb_dir + + monkeypatch.setattr("openkb.cli._setup_llm_key", lambda kb: None) + monkeypatch.setattr("openkb.cli.convert_document", fake_convert) + monkeypatch.setattr("openkb.agent.compiler.compile_short_doc", fake_compile_short_doc) + + response = client.post( + "/api/v1/add", + data={"kb": kb, "stream": "false"}, + files=[("files", ("paper.md", b"# Paper", "text/markdown"))], + headers=_auth(), + ) + + assert response.status_code == 200 + payload = response.json() + assert payload["added_count"] == 1 + assert payload["files"][0]["status"] == "added" + assert payload["files"][0]["saved_path"] == str(kb_dir / "raw" / "paper.md") + + +def test_add_endpoint_uploads_and_adds_multiple_files(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + from openkb.cli import AddFileResult + + calls = [] + + def fake_add(path, target_kb): + calls.append((path, target_kb)) + if path.name == "notes.txt": + return AddFileResult( + path.name, + None, + "skipped", + "Already in knowledge base: notes.txt", + ) + return AddFileResult( + path.name, + str(path), + "added", + f"{path.name} added to knowledge base.", + ) + + monkeypatch.setattr("openkb.api._add_for_api", fake_add) + + response = client.post( + "/api/v1/add", + data={"kb": kb, "stream": "false"}, + files=[ + ("files", ("paper.md", b"# Paper", "text/markdown")), + ("files", ("notes.txt", b"Notes", "text/plain")), + ], + headers=_auth(), + ) + + paper_path = kb_dir / "raw" / "paper.md" + notes_path = kb_dir / "raw" / "notes.txt" + assert response.status_code == 200 + assert paper_path.read_bytes() == b"# Paper" + assert not notes_path.exists() + assert calls == [(paper_path, kb_dir), (notes_path, kb_dir)] + assert response.json() == { + "kb": kb, + "files": [ + { + "original_name": "paper.md", + "saved_path": str(paper_path), + "status": "added", + "message": "paper.md added to knowledge base.", + }, + { + "original_name": "notes.txt", + "saved_path": None, + "status": "skipped", + "message": "Already in knowledge base: notes.txt", + }, + ], + "added_count": 1, + "skipped_count": 1, + "failed_count": 0, + } + + +def test_add_endpoint_uses_unique_raw_filename(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + (kb_dir / "raw" / "paper.md").write_text("existing", encoding="utf-8") + + from openkb.cli import AddFileResult + + def fake_add(path, target_kb): + return AddFileResult(path.name, str(path), "added", f"{path.name} added to knowledge base.") + + monkeypatch.setattr("openkb.api._add_for_api", fake_add) + + response = client.post( + "/api/v1/add", + data={"kb": kb, "stream": "false"}, + files=[("files", ("paper.md", b"# New", "text/markdown"))], + headers=_auth(), + ) + + assert response.status_code == 200 + assert (kb_dir / "raw" / "paper.md").read_text(encoding="utf-8") == "existing" + assert (kb_dir / "raw" / "paper-1.md").read_bytes() == b"# New" + assert response.json()["files"][0]["original_name"] == "paper.md" + assert response.json()["files"][0]["saved_path"] == str(kb_dir / "raw" / "paper-1.md") + + +def test_add_endpoint_removes_skipped_upload(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + from openkb.cli import AddFileResult + + skipped_path = None + + def fake_add(path, target_kb): + nonlocal skipped_path + skipped_path = path + return AddFileResult(path.name, None, "skipped", "Already in knowledge base: paper.md") + + monkeypatch.setattr("openkb.api._add_for_api", fake_add) + + response = client.post( + "/api/v1/add", + data={"kb": kb, "stream": "false"}, + files=[("files", ("paper.md", b"# Paper", "text/markdown"))], + headers=_auth(), + ) + + assert response.status_code == 200 + assert skipped_path == kb_dir / "raw" / "paper.md" + assert not skipped_path.exists() + assert response.json()["files"][0] == { + "original_name": "paper.md", + "saved_path": None, + "status": "skipped", + "message": "Already in knowledge base: paper.md", + } + assert response.json()["skipped_count"] == 1 + + +def test_add_endpoint_streams_events(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + from openkb.cli import AddFileResult + + def fake_add(path, target_kb): + return AddFileResult(path.name, str(path), "added", f"{path.name} added to knowledge base.") + + monkeypatch.setattr("openkb.api._add_for_api", fake_add) + + response = client.post( + "/api/v1/add", + data={"kb": kb, "stream": "true"}, + files=[("files", ("paper.md", b"# Paper", "text/markdown"))], + headers=_auth(), + ) + + assert response.status_code == 200 + assert response.headers["content-type"].startswith("text/event-stream") + events = _events_from_sse(response.text) + assert [event["event"] for event in events] == [ + "start", + "uploaded", + "file_start", + "file_done", + "final", + "done", + ] + assert events[0]["data"]["kb"] == kb + assert events[-2]["data"]["added_count"] == 1 + + +def test_unknown_kb_returns_400(monkeypatch, tmp_path): + client = _client(monkeypatch) + monkeypatch.setattr("openkb.api.resolve_kb_alias", lambda kb: tmp_path) + + response = client.post( + "/api/v1/query", + json={"kb": "missing-kb", "question": "What?"}, + headers=_auth(), + ) + + assert response.status_code == 400 + assert "Not a knowledge base" in response.json()["detail"] + + +def test_kb_endpoints_reject_unknown_kb(monkeypatch, tmp_path): + client = _client(monkeypatch) + monkeypatch.setattr("openkb.api.resolve_kb_alias", lambda kb: tmp_path) + + for path in ("/api/v1/list", "/api/v1/status", "/api/v1/lint"): + response = client.post( + path, + json={"kb": "missing-kb"}, + headers=_auth(), + ) + assert response.status_code == 400 + + +def test_kb_endpoints_reject_invalid_kb_name(monkeypatch): + client = _client(monkeypatch) + + response = client.post( + "/api/v1/query", + json={"kb": "../bad", "question": "What?"}, + headers=_auth(), + ) + + assert response.status_code == 400 + assert "KB name" in response.json()["detail"] + + +def test_unknown_chat_session_returns_404(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + response = client.post( + "/api/v1/chat", + json={ + "kb": kb, + "message": "Hi", + "session_id": "missing-session", + "stream": False, + }, + headers=_auth(), + ) + + assert response.status_code == 404 + + +def test_list_endpoint_returns_empty_inventory(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + response = client.post( + "/api/v1/list", + json={"kb": kb}, + headers=_auth(), + ) + + assert response.status_code == 200 + assert response.json() == { + "documents": [], + "document_count": 0, + "summaries": [], + "concepts": [], + "reports": [], + } + + +def test_list_endpoint_returns_structured_inventory(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + hashes = { + "abc123": {"name": "paper.pdf", "type": "pdf", "pages": 12}, + "def456": {"name": "notes.md", "type": "md"}, + } + (kb_dir / ".openkb" / "hashes.json").write_text(json.dumps(hashes), encoding="utf-8") + (kb_dir / "wiki" / "summaries" / "paper.md").write_text("# Paper", encoding="utf-8") + (kb_dir / "wiki" / "concepts" / "attention.md").write_text("# Attention", encoding="utf-8") + (kb_dir / "wiki" / "reports" / "lint_20260101_000000.md").write_text("# Report", encoding="utf-8") + + response = client.post( + "/api/v1/list", + json={"kb": kb}, + headers=_auth(), + ) + + assert response.status_code == 200 + payload = response.json() + assert payload["document_count"] == 2 + assert payload["documents"] == [ + { + "hash": "abc123", + "name": "paper.pdf", + "type": "pdf", + "display_type": "short", + "pages": 12, + }, + { + "hash": "def456", + "name": "notes.md", + "type": "md", + "display_type": "short", + "pages": None, + }, + ] + assert payload["summaries"] == ["paper"] + assert payload["concepts"] == ["attention"] + assert payload["reports"] == ["lint_20260101_000000.md"] + + +def test_status_endpoint_returns_structured_counts(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + (kb_dir / "raw" / "paper.pdf").write_bytes(b"pdf") + (kb_dir / "wiki" / "sources" / "paper.md").write_text("# Source", encoding="utf-8") + (kb_dir / "wiki" / "summaries" / "paper.md").write_text("# Summary", encoding="utf-8") + (kb_dir / "wiki" / "concepts" / "attention.md").write_text("# Attention", encoding="utf-8") + (kb_dir / "wiki" / "reports" / "lint_20260101_000000.md").write_text("# Report", encoding="utf-8") + (kb_dir / ".openkb" / "hashes.json").write_text( + json.dumps({"abc123": {"name": "paper.pdf", "type": "pdf"}}), + encoding="utf-8", + ) + + response = client.post( + "/api/v1/status", + json={"kb": kb}, + headers=_auth(), + ) + + assert response.status_code == 200 + payload = response.json() + assert payload["directories"] == { + "sources": 1, + "summaries": 1, + "concepts": 1, + "reports": 1, + } + assert payload["raw_count"] == 1 + assert payload["total_indexed"] == 1 + assert payload["last_compile"] is not None + assert payload["last_lint"] is not None + + +def test_lint_endpoint_skips_empty_kb(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + response = client.post( + "/api/v1/lint", + json={"kb": kb}, + headers=_auth(), + ) + + assert response.status_code == 200 + assert response.json() == { + "skipped": True, + "reason": "no_documents_indexed", + "message": "Nothing to lint - no documents indexed yet. Run `openkb add` first.", + "structural_report": None, + "knowledge_report": None, + "report_path": None, + "lint_files_changed": None, + "lint_ghosts_removed": None, + } + assert list((kb_dir / "wiki" / "reports").glob("*.md")) == [] + + +def test_lint_endpoint_runs_and_writes_report(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + (kb_dir / ".openkb" / "hashes.json").write_text( + json.dumps({"abc123": {"name": "paper.pdf", "type": "pdf"}}), + encoding="utf-8", + ) + + async def fake_knowledge_lint(kb, model): + assert kb == kb_dir + return "No semantic issues." + + monkeypatch.setattr("openkb.cli._setup_llm_key", lambda kb: None) + monkeypatch.setattr("openkb.agent.linter.run_knowledge_lint", fake_knowledge_lint) + + response = client.post( + "/api/v1/lint", + json={"kb": kb}, + headers=_auth(), + ) + + assert response.status_code == 200 + payload = response.json() + assert payload["skipped"] is False + assert payload["reason"] is None + assert payload["message"] == "Lint report written." + assert "Structural Lint Report" in payload["structural_report"] + assert payload["knowledge_report"] == "No semantic issues." + # Without `fix`, the new count fields are absent (None). + assert payload["lint_files_changed"] is None + assert payload["lint_ghosts_removed"] is None + reports = list((kb_dir / "wiki" / "reports").glob("lint_*.md")) + assert len(reports) == 1 + assert payload["report_path"] == str(reports[0]) + assert "No semantic issues." in reports[0].read_text(encoding="utf-8") + +# --------------------------------------------------------------------------- +# POST /api/v1/remove +# --------------------------------------------------------------------------- + + +def test_lint_endpoint_fix_rewrites_broken_wikilinks(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + # Non-empty hashes so the report path (not the skip path) runs. + (kb_dir / ".openkb" / "hashes.json").write_text( + json.dumps({"abc123": {"name": "paper.pdf", "type": "pdf"}}), + encoding="utf-8", + ) + # Valid target + a page with a broken link that has no match. + (kb_dir / "wiki" / "concepts" / "a.md").write_text("A valid page.", encoding="utf-8") + page = kb_dir / "wiki" / "summaries" / "s.md" + page.write_text("See [[concepts/a]] and [[Ghost Link]].", encoding="utf-8") + + async def fake_knowledge_lint(kb, model): + return "No semantic issues." + + monkeypatch.setattr("openkb.cli._setup_llm_key", lambda kb: None) + monkeypatch.setattr("openkb.agent.linter.run_knowledge_lint", fake_knowledge_lint) + + response = client.post( + "/api/v1/lint", + json={"kb": kb, "fix": True}, + headers=_auth(), + ) + + assert response.status_code == 200 + payload = response.json() + # The broken link was stripped from its file. + assert payload["lint_files_changed"] >= 1 + assert payload["lint_ghosts_removed"] >= 1 + assert "[[Ghost Link]]" not in page.read_text(encoding="utf-8") + # The valid link is left intact. + assert "[[concepts/a]]" in page.read_text(encoding="utf-8") + # A lint report was still written, reflecting the post-fix state. + assert payload["skipped"] is False + assert "Fixed" in payload["message"] + reports = list((kb_dir / "wiki" / "reports").glob("lint_*.md")) + assert len(reports) == 1 + + +def test_lint_endpoint_fix_noop_when_clean(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + (kb_dir / ".openkb" / "hashes.json").write_text( + json.dumps({"abc123": {"name": "paper.pdf", "type": "pdf"}}), + encoding="utf-8", + ) + # Clean wiki: only a valid, resolving link. + (kb_dir / "wiki" / "concepts" / "a.md").write_text("A valid page.", encoding="utf-8") + (kb_dir / "wiki" / "summaries" / "s.md").write_text( + "See [[concepts/a]].", encoding="utf-8" + ) + + async def fake_knowledge_lint(kb, model): + return "No semantic issues." + + monkeypatch.setattr("openkb.cli._setup_llm_key", lambda kb: None) + monkeypatch.setattr("openkb.agent.linter.run_knowledge_lint", fake_knowledge_lint) + + response = client.post( + "/api/v1/lint", + json={"kb": kb, "fix": True}, + headers=_auth(), + ) + + assert response.status_code == 200 + payload = response.json() + assert payload["lint_files_changed"] == 0 + assert payload["lint_ghosts_removed"] == 0 + assert "Nothing to fix" in payload["message"] + assert payload["skipped"] is False + + +def test_remove_non_stream_success(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + payload = { + "status": "removed", "name": "paper.pdf", "doc_name": "paper", + "actions": [{"tag": "DELETE", "target": "wiki/summaries/paper.md"}], + "concepts_deleted": ["transformer"], "entities_deleted": [], + "lint_files_changed": 1, "lint_ghosts_removed": 2, + "pageindex_message": None, "pageindex_error": None, + "message": "paper.pdf removed from knowledge base.", + } + monkeypatch.setattr( + "openkb.api.run_remove_for_api", + lambda kb_dir, identifier, **kw: payload, + ) + + response = client.post( + "/api/v1/remove", + json={"kb": kb, "identifier": "paper.pdf"}, + headers=_auth(), + ) + assert response.status_code == 200 + body = response.json() + assert body["status"] == "removed" + assert body["doc_name"] == "paper" + assert body["actions"][0]["tag"] == "DELETE" + assert body["lint_files_changed"] == 1 + + +def test_remove_not_found_returns_404(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + monkeypatch.setattr( + "openkb.api.run_remove_for_api", + lambda kb_dir, identifier, **kw: {"status": "not_found", "message": "Document not found."}, + ) + response = client.post( + "/api/v1/remove", + json={"kb": kb, "identifier": "nope"}, + headers=_auth(), + ) + assert response.status_code == 404 + + +def test_remove_multiple_matches_returns_409(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + monkeypatch.setattr( + "openkb.api.run_remove_for_api", + lambda kb_dir, identifier, **kw: { + "status": "multiple", + "candidates": [ + {"name": "a.pdf", "doc_name": "a-h1"}, + {"name": "b.pdf", "doc_name": "b-h2"}, + ], + }, + ) + response = client.post( + "/api/v1/remove", + json={"kb": kb, "identifier": "h"}, + headers=_auth(), + ) + assert response.status_code == 409 + detail = response.json()["detail"] + assert detail["candidates"][0]["doc_name"] == "a-h1" + + +def test_remove_dry_run_returns_plan(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + captured = {} + + def fake(kb_dir, identifier, *, keep_raw, keep_empty, dry_run): + captured["dry_run"] = dry_run + captured["keep_raw"] = keep_raw + return { + "status": "dry_run", "name": "paper.pdf", "doc_name": "paper", + "actions": [{"tag": "DELETE", "target": "wiki/summaries/paper.md"}], + "concepts_deleted": [], "entities_deleted": [], + } + + monkeypatch.setattr("openkb.api.run_remove_for_api", fake) + + response = client.post( + "/api/v1/remove", + json={"kb": kb, "identifier": "paper.pdf", "dry_run": True, "keep_raw": True}, + headers=_auth(), + ) + assert response.status_code == 200 + assert response.json()["status"] == "dry_run" + assert captured["dry_run"] is True + assert captured["keep_raw"] is True + + +def test_remove_passes_keep_empty(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + captured = {} + + def fake(kb_dir, identifier, *, keep_raw, keep_empty, dry_run): + captured["keep_empty"] = keep_empty + return {"status": "removed", "name": "p", "doc_name": "p", "actions": []} + + monkeypatch.setattr("openkb.api.run_remove_for_api", fake) + client.post( + "/api/v1/remove", + json={"kb": kb, "identifier": "p", "keep_empty": True}, + headers=_auth(), + ) + assert captured["keep_empty"] is True + + +def test_remove_stream_returns_sse(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + monkeypatch.setattr( + "openkb.api.run_remove_for_api", + lambda kb_dir, identifier, **kw: { + "status": "removed", "name": "paper.pdf", "doc_name": "paper", + "actions": [{"tag": "DELETE", "target": "wiki/summaries/paper.md"}], + "concepts_deleted": [], "entities_deleted": [], + "message": "done", + }, + ) + + response = client.post( + "/api/v1/remove", + json={"kb": kb, "identifier": "paper.pdf", "stream": True}, + headers=_auth(), + ) + assert response.status_code == 200 + assert response.headers["content-type"].startswith("text/event-stream") + events = _events_from_sse(response.text) + names = [e["event"] for e in events] + assert names[0] == "start" + assert names[-1] == "done" + assert "plan" in names and "final" in names + + +def test_remove_stream_not_found(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + monkeypatch.setattr( + "openkb.api.run_remove_for_api", + lambda kb_dir, identifier, **kw: {"status": "not_found"}, + ) + response = client.post( + "/api/v1/remove", + json={"kb": kb, "identifier": "x", "stream": True}, + headers=_auth(), + ) + events = _events_from_sse(response.text) + assert any(e["event"] == "error" and e["data"].get("code") == 404 for e in events) + + + +# --------------------------------------------------------------------------- +# recompile endpoint +# --------------------------------------------------------------------------- +# +# Seed helpers mirror tests/test_recompile.py (_seed_short/_seed_long) but are +# kept local to avoid coupling the two test modules. + + +from pathlib import Path +from unittest.mock import AsyncMock, patch + + +def _seed_short(kb_dir: Path, *, slug: str = "notes", name: str = "notes.md") -> None: + (kb_dir / ".openkb" / "hashes.json").write_text(json.dumps({ + "h_s": {"name": name, "doc_name": slug, "type": "md"}, + })) + (kb_dir / "wiki" / "sources" / f"{slug}.md").write_text("# Notes\n\nbody\n", encoding="utf-8") + (kb_dir / "wiki" / "log.md").write_text("# Log\n\n", encoding="utf-8") + + +def _seed_long(kb_dir: Path, *, slug: str = "paper", name: str = "paper.pdf", + doc_id: str = "doc-abc123") -> None: + (kb_dir / ".openkb" / "hashes.json").write_text(json.dumps({ + "h_l": {"name": name, "doc_name": slug, "type": "long_pdf", "doc_id": doc_id}, + })) + (kb_dir / "wiki" / "summaries" / f"{slug}.md").write_text( + "---\nsources: [raw/paper.pdf]\nbrief: P\n---\n# Paper\n", encoding="utf-8", + ) + (kb_dir / "wiki" / "log.md").write_text("# Log\n\n", encoding="utf-8") + + +def _patch_recompile(monkeypatch): + monkeypatch.setattr("openkb.cli._setup_llm_key", lambda kb: None) + short = AsyncMock() + long_ = AsyncMock() + monkeypatch.setattr("openkb.agent.compiler.compile_short_doc", short) + monkeypatch.setattr("openkb.agent.compiler.compile_long_doc", long_) + return short, long_ + + +def test_recompile_non_stream_short_doc(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + _seed_short(kb_dir) + short, long_ = _patch_recompile(monkeypatch) + + response = client.post( + "/api/v1/recompile", + json={"kb": kb, "doc_name": "notes.md"}, + headers=_auth(), + ) + assert response.status_code == 200, response.text + body = response.json() + assert body["status"] == "done" + assert body["recompiled"] == 1 + assert body["skipped"] == 0 + assert body["docs"][0]["status"] == "ok" + short.assert_called_once() + assert short.call_args.args[0] == "notes" # doc_name + assert short.call_args.args[2] == kb_dir # kb_dir + long_.assert_not_called() + + +def test_recompile_non_stream_long_doc(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + _seed_long(kb_dir) + short, long_ = _patch_recompile(monkeypatch) + + response = client.post( + "/api/v1/recompile", + json={"kb": kb, "doc_name": "paper.pdf"}, + headers=_auth(), + ) + assert response.status_code == 200, response.text + long_.assert_called_once() + args = long_.call_args.args + assert args[0] == "paper" # doc_name + assert args[2] == "doc-abc123" # doc_id + assert args[3] == kb_dir # kb_dir + short.assert_not_called() + + +def test_recompile_not_found_404(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + _seed_short(kb_dir) + + response = client.post( + "/api/v1/recompile", + json={"kb": kb, "doc_name": "ghost"}, + headers=_auth(), + ) + assert response.status_code == 404 + + +def test_recompile_multiple_409(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + # Two entries whose slug share a substring. + (kb_dir / ".openkb" / "hashes.json").write_text(json.dumps({ + "h1": {"name": "a.pdf", "doc_name": "rep-x", "type": "md"}, + "h2": {"name": "b.pdf", "doc_name": "rep-y", "type": "md"}, + })) + + response = client.post( + "/api/v1/recompile", + json={"kb": kb, "doc_name": "rep"}, + headers=_auth(), + ) + assert response.status_code == 409 + detail = response.json()["detail"] + assert detail["candidates"][0]["doc_name"] == "rep-x" + + +def test_recompile_requires_doc_or_all_400(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + _seed_short(kb_dir) + + response = client.post( + "/api/v1/recompile", + json={"kb": kb}, + headers=_auth(), + ) + assert response.status_code == 400 + + +def test_recompile_both_doc_and_all_400(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + _seed_short(kb_dir) + + response = client.post( + "/api/v1/recompile", + json={"kb": kb, "doc_name": "notes.md", "all_docs": True}, + headers=_auth(), + ) + assert response.status_code == 400 + + +def test_recompile_dry_run_returns_plan(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + _seed_short(kb_dir) + short, _ = _patch_recompile(monkeypatch) + + response = client.post( + "/api/v1/recompile", + json={"kb": kb, "doc_name": "notes.md", "dry_run": True}, + headers=_auth(), + ) + assert response.status_code == 200, response.text + body = response.json() + assert body["status"] == "dry_run" + assert body["targets"][0]["doc_name"] == "notes" + short.assert_not_called() + + +def test_recompile_all_recompiles_every_doc(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + _seed_short(kb_dir, slug="a", name="a.md") + (kb_dir / "wiki" / "sources" / "a.md").write_text("# A\n", encoding="utf-8") + # add a second short doc to the registry + data = json.loads((kb_dir / ".openkb" / "hashes.json").read_text()) + data["h2"] = {"name": "b.md", "doc_name": "b", "type": "md"} + (kb_dir / ".openkb" / "hashes.json").write_text(json.dumps(data)) + (kb_dir / "wiki" / "sources" / "b.md").write_text("# B\n", encoding="utf-8") + short, _ = _patch_recompile(monkeypatch) + + response = client.post( + "/api/v1/recompile", + json={"kb": kb, "all_docs": True}, + headers=_auth(), + ) + assert response.status_code == 200, response.text + body = response.json() + assert body["total"] == 2 + assert body["recompiled"] == 2 + assert short.call_count == 2 + + +def test_recompile_refresh_schema_invoked(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + _seed_short(kb_dir) + _patch_recompile(monkeypatch) + called = {"n": 0} + + def fake_refresh(wiki_dir): + called["n"] += 1 + return False + + monkeypatch.setattr("openkb.cli._refresh_schema", fake_refresh) + + response = client.post( + "/api/v1/recompile", + json={"kb": kb, "doc_name": "notes.md", "refresh_schema": True}, + headers=_auth(), + ) + assert response.status_code == 200, response.text + assert called["n"] == 1 + + +def test_recompile_skip_missing_source(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + _seed_short(kb_dir, slug="good", name="good.md") + (kb_dir / "wiki" / "sources" / "good.md").write_text("# Good\n", encoding="utf-8") + # second doc whose source file is absent -> should be skipped + data = json.loads((kb_dir / ".openkb" / "hashes.json").read_text()) + data["h2"] = {"name": "bad.md", "doc_name": "bad", "type": "md"} + (kb_dir / ".openkb" / "hashes.json").write_text(json.dumps(data)) + short, _ = _patch_recompile(monkeypatch) + + response = client.post( + "/api/v1/recompile", + json={"kb": kb, "all_docs": True}, + headers=_auth(), + ) + assert response.status_code == 200, response.text + body = response.json() + assert body["recompiled"] == 1 + assert body["skipped"] == 1 + assert short.call_count == 1 + + +def test_recompile_compile_error_counts_as_skipped(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + _seed_short(kb_dir) + short = AsyncMock(side_effect=RuntimeError("boom")) + long_ = AsyncMock() + monkeypatch.setattr("openkb.cli._setup_llm_key", lambda kb: None) + monkeypatch.setattr("openkb.agent.compiler.compile_short_doc", short) + monkeypatch.setattr("openkb.agent.compiler.compile_long_doc", long_) + + response = client.post( + "/api/v1/recompile", + json={"kb": kb, "doc_name": "notes.md"}, + headers=_auth(), + ) + assert response.status_code == 200, response.text + body = response.json() + assert body["recompiled"] == 0 + assert body["skipped"] == 1 + assert body["docs"][0]["status"] == "error" + + +def test_recompile_stream_per_doc_events(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + _seed_short(kb_dir) + _patch_recompile(monkeypatch) + + response = client.post( + "/api/v1/recompile", + json={"kb": kb, "doc_name": "notes.md", "stream": True}, + headers=_auth(), + ) + assert response.status_code == 200 + assert response.headers["content-type"].startswith("text/event-stream") + events = _events_from_sse(response.text) + names = [e["event"] for e in events] + assert names[0] == "start" + assert names[-1] == "done" + assert "doc" in names and "final" in names + + +def test_recompile_stream_not_found(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + _seed_short(kb_dir) + + response = client.post( + "/api/v1/recompile", + json={"kb": kb, "doc_name": "ghost", "stream": True}, + headers=_auth(), + ) + events = _events_from_sse(response.text) + assert any(e["event"] == "error" and e["data"].get("code") == 404 for e in events) diff --git a/tests/test_api_watch.py b/tests/test_api_watch.py new file mode 100644 index 000000000..5ad064ac3 --- /dev/null +++ b/tests/test_api_watch.py @@ -0,0 +1,175 @@ +"""Tests for the watch REST endpoints (lifecycle + SSE), isolated per app. + +Mirrors the helpers/patterns in tests/test_api.py. Ingest is mocked so no real +LLM/compilation runs. +""" +from __future__ import annotations + +import json +import time +from typing import Any + +from fastapi.testclient import TestClient + +from openkb.api import create_app +from openkb.cli import AddFileResult + + +def _client(monkeypatch, token: str | None = "secret") -> TestClient: + if token is None: + monkeypatch.delenv("OPENKB_API_TOKEN", raising=False) + else: + monkeypatch.setenv("OPENKB_API_TOKEN", token) + return TestClient(create_app()) + + +def _auth(token: str = "secret") -> dict[str, str]: + return {"Authorization": f"Bearer {token}"} + + +def _use_named_kb(monkeypatch, kb_dir, name: str = "test-kb") -> str: + def resolve(kb): + assert kb == name + return kb_dir + + monkeypatch.setattr("openkb.api.resolve_kb_alias", resolve) + return name + + +def _events_from_sse(text: str) -> list[dict[str, Any]]: + events: list[dict[str, Any]] = [] + for block in text.strip().split("\n\n"): + lines = block.splitlines() + if not lines: + continue + event = lines[0].removeprefix("event: ") + data = json.loads(lines[1].removeprefix("data: ")) + events.append({"event": event, "data": data}) + return events + + +def _mock_add(monkeypatch, status: str = "added"): + monkeypatch.setattr( + "openkb.watch_service._add_for_api", + lambda path, kb: AddFileResult(path.name, str(path), status, "msg"), + ) + + +def test_watch_endpoints_require_token(monkeypatch, kb_dir): + client = _client(monkeypatch, token=None) + kb = _use_named_kb(monkeypatch, kb_dir) + for method, path in ( + ("post", "/api/v1/watch/start"), + ("post", "/api/v1/watch/status"), + ): + resp = getattr(client, method)(path, json={"kb": kb}) + assert resp.status_code == 500 + assert "OPENKB_API_TOKEN" in resp.json()["detail"] + resp = client.get("/api/v1/watch/events", params={"kb": kb}) + assert resp.status_code == 500 + + +def test_watch_start_status_stop_lifecycle(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + _mock_add(monkeypatch) + + started = client.post("/api/v1/watch/start", json={"kb": kb}, headers=_auth()) + assert started.status_code == 200, started.text + body = started.json() + assert body["active"] is True + assert body["kb"] == kb + assert body["raw_dir"].endswith("raw") + assert body["debounce"] == 2.0 + + status = client.post("/api/v1/watch/status", json={"kb": kb}, headers=_auth()) + assert status.status_code == 200 + assert status.json()["active"] is True + + stopped = client.post("/api/v1/watch/stop", json={"kb": kb}, headers=_auth()) + assert stopped.status_code == 200 + stop_body = stopped.json() + assert stop_body["kb"] == kb + assert stop_body["active"] is False + + status2 = client.post("/api/v1/watch/status", json={"kb": kb}, headers=_auth()) + assert status2.status_code == 200 + assert status2.json()["active"] is False + + +def test_watch_start_is_idempotent(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + _mock_add(monkeypatch) + + first = client.post("/api/v1/watch/start", json={"kb": kb}, headers=_auth()) + second = client.post("/api/v1/watch/start", json={"kb": kb}, headers=_auth()) + assert first.status_code == 200 and second.status_code == 200 + assert first.json() == second.json() + client.post("/api/v1/watch/stop", json={"kb": kb}, headers=_auth()) + + +def test_watch_stop_unknown_returns_404(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + resp = client.post("/api/v1/watch/stop", json={"kb": kb}, headers=_auth()) + assert resp.status_code == 404 + assert "No active watcher" in resp.json()["detail"] + + +def test_watch_start_rejects_invalid_debounce(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + resp = client.post("/api/v1/watch/start", json={"kb": kb, "debounce": 0}, headers=_auth()) + assert resp.status_code == 422 + + +def _wait_for_added(client, kb: str, timeout: float = 6.0) -> bool: + deadline = time.monotonic() + timeout + while time.monotonic() < deadline: + st = client.post("/api/v1/watch/status", json={"kb": kb}, headers=_auth()) + if st.json().get("counters", {}).get("added", 0) >= 1: + return True + time.sleep(0.1) + return False + + +def test_watch_events_streams_file_done_after_drop(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + _mock_add(monkeypatch) + + started = client.post("/api/v1/watch/start", json={"kb": kb, "debounce": 0.1}, headers=_auth()) + assert started.status_code == 200 + try: + (kb_dir / "raw" / "dropped.md").write_text("# hi", encoding="utf-8") + assert _wait_for_added(client, kb), "file was not processed in time" + + resp = client.get( + "/api/v1/watch/events", + params={"kb": kb, "max_events": 2, "timeout_seconds": 5}, + headers=_auth(), + ) + assert resp.status_code == 200 + assert resp.headers["content-type"].startswith("text/event-stream") + events = _events_from_sse(resp.text) + names = [e["event"] for e in events] + assert names[0] == "start" + assert names[-1] == "done" + assert "file_start" in names and "file_done" in names + finally: + client.post("/api/v1/watch/stop", json={"kb": kb}, headers=_auth()) + + +def test_watch_events_inactive_returns_error(monkeypatch, kb_dir): + client = _client(monkeypatch) + kb = _use_named_kb(monkeypatch, kb_dir) + + resp = client.get("/api/v1/watch/events", params={"kb": kb, "max_events": 1}, headers=_auth()) + events = _events_from_sse(resp.text) + assert events[0]["event"] == "start" + assert events[0]["data"]["active"] is False + assert any(e["event"] == "error" for e in events) + assert events[-1]["event"] == "done" diff --git a/tests/test_remove.py b/tests/test_remove.py index ac3907328..24a982ace 100644 --- a/tests/test_remove.py +++ b/tests/test_remove.py @@ -1276,3 +1276,86 @@ def test_remove_cloud_doc_never_touches_pageindex(tmp_path): assert not (tmp_path / "wiki" / "summaries" / "cloud-doc.md").exists() assert not (tmp_path / "wiki" / "sources" / "cloud-doc.json").exists() assert HashRegistry(openkb_dir / "hashes.json").get("synthhash") is None + +# --------------------------------------------------------------------------- +# run_remove_for_api (REST entry point, shares _build/_execute with the CLI) +# --------------------------------------------------------------------------- + + +def _seed_one_doc_kb(kb_dir: Path) -> None: + (kb_dir / ".openkb" / "hashes.json").write_text(json.dumps({ + "h_a": {"name": "paper.pdf", "doc_name": "paper", "type": "short", + "path": "raw/paper.pdf"}, + })) + (kb_dir / "raw" / "paper.pdf").write_bytes(b"%PDF-paper") + (kb_dir / "wiki" / "summaries" / "paper.md").write_text( + "---\nsources: [raw/paper.pdf]\nbrief: x\n---\n# Paper\n", encoding="utf-8", + ) + (kb_dir / "wiki" / "index.md").write_text( + "# Knowledge Base Index\n\n## Documents\n" + "- [[summaries/paper]] (short) - x\n\n## Concepts\n\n## Explorations\n", + encoding="utf-8", + ) + (kb_dir / "wiki" / "log.md").write_text("# Log\n", encoding="utf-8") + + +def test_run_remove_for_api_dry_run_has_no_side_effects(kb_dir): + _seed_one_doc_kb(kb_dir) + from openkb.cli import run_remove_for_api + + result = run_remove_for_api(kb_dir, "paper.pdf", dry_run=True) + + assert result["status"] == "dry_run" + assert result["name"] == "paper.pdf" + assert any(a["tag"] == "DELETE" for a in result["actions"]) + # Nothing modified. + assert (kb_dir / "wiki" / "summaries" / "paper.md").exists() + assert "h_a" in json.loads((kb_dir / ".openkb" / "hashes.json").read_text()) + + +def test_run_remove_for_api_removes_doc(kb_dir): + _seed_one_doc_kb(kb_dir) + from openkb.cli import run_remove_for_api + + result = run_remove_for_api(kb_dir, "paper.pdf", dry_run=False) + + assert result["status"] == "removed" + assert not (kb_dir / "wiki" / "summaries" / "paper.md").exists() + assert not (kb_dir / "raw" / "paper.pdf").exists() + assert json.loads((kb_dir / ".openkb" / "hashes.json").read_text()) == {} + + +def test_run_remove_for_api_not_found(kb_dir): + _seed_one_doc_kb(kb_dir) + from openkb.cli import run_remove_for_api + + assert run_remove_for_api(kb_dir, "missing")["status"] == "not_found" + + +def test_run_remove_for_api_keep_raw_preserves_file(kb_dir): + _seed_one_doc_kb(kb_dir) + from openkb.cli import run_remove_for_api + + run_remove_for_api(kb_dir, "paper.pdf", keep_raw=True) + assert (kb_dir / "raw" / "paper.pdf").exists() + assert json.loads((kb_dir / ".openkb" / "hashes.json").read_text()) == {} + + +def test_run_remove_for_api_pageindex_failure_is_partial(kb_dir): + """PageIndex cleanup raising must leave the registry entry intact for + retry (status=partial), mirroring the CLI behavior.""" + _seed_long_pdf_kb(kb_dir, doc_id="pi-doc-xyz") + + failing_client = MagicMock() + failing_client.collection.side_effect = RuntimeError("LLM key missing") + + with patch("pageindex.PageIndexClient", return_value=failing_client), \ + patch("openkb.cli._setup_llm_key"): + from openkb.cli import run_remove_for_api + result = run_remove_for_api(kb_dir, "paper.pdf", keep_raw=True) + + assert result["status"] == "partial" + # Registry entry (with doc_id) survives for retry. + hashes = json.loads((kb_dir / ".openkb" / "hashes.json").read_text()) + assert "h_paper" in hashes + assert hashes["h_paper"]["doc_id"] == "pi-doc-xyz" diff --git a/tests/test_watch_service.py b/tests/test_watch_service.py new file mode 100644 index 000000000..154966b9f --- /dev/null +++ b/tests/test_watch_service.py @@ -0,0 +1,193 @@ +"""Tests for openkb.watch_service (per-KB watcher registry + worker). + +All ingest is mocked so no real LLM/compilation runs, per AGENTS.md. +Worker behavior is driven by putting batches directly on the queue to avoid +OS-watcher timing flakiness; one end-to-end test exercises the real debounce +pipeline with a small debounce. +""" +from __future__ import annotations + +import threading +import time +from collections import deque +from pathlib import Path + +from openkb.cli import AddFileResult +from openkb.watch_service import ( + WatchRegistry, + WatcherState, + _public_event, + _record_event, +) + + +def _drain_worker(state: WatcherState, timeout: float = 2.0) -> None: + """Run the worker loop on already-queued batches, then stop it.""" + from openkb.watch_service import _run_worker + + state.queue.put(None) + t = threading.Thread(target=_run_worker, args=(state,)) + t.start() + t.join(timeout=timeout) + assert not t.is_alive(), "worker did not drain in time" + + +def _events_of(state: WatcherState, name: str) -> list[dict]: + return [e["data"] for e in state.events if e["event"] == name] + + +def _make_state(kb_dir: Path, kb: str = "test-kb") -> WatcherState: + return WatcherState( + kb=kb, + kb_dir=kb_dir, + raw_dir=kb_dir / "raw", + debounce=0.0, + started_at=time.time(), + ) + + +# registry lifecycle + + +def test_start_is_idempotent(kb_dir, monkeypatch): + monkeypatch.setattr("openkb.watch_service.start_watch", lambda *a, **k: object()) + reg = WatchRegistry() + s1 = reg.start("test-kb", kb_dir, debounce=0.0) + s2 = reg.start("test-kb", kb_dir, debounce=0.0) + assert s1 is s2 + assert reg.list_active() == ["test-kb"] + reg.stop("test-kb") + + +def test_stop_returns_false_when_not_active(): + reg = WatchRegistry() + assert reg.stop("nope") is False + + +def test_status_inactive_returns_active_false(): + reg = WatchRegistry() + assert reg.status("missing") == {"kb": "missing", "active": False} + + +def test_status_active_fields_and_recent_events(kb_dir, monkeypatch): + monkeypatch.setattr("openkb.watch_service.start_watch", lambda *a, **k: object()) + reg = WatchRegistry() + state = reg.start("test-kb", kb_dir, debounce=0.0) + _record_event(state, "file_done", {"original_name": "a.md", "status": "added"}) + st = reg.status("test-kb") + assert st["active"] is True + assert st["kb"] == "test-kb" + assert st["raw_dir"] == str(kb_dir / "raw") + assert st["counters"] == {"added": 0, "skipped": 0, "failed": 0} + assert len(st["recent_events"]) == 1 + assert st["recent_events"][0]["event"] == "file_done" + assert "seq" not in st["recent_events"][0] + reg.stop("test-kb") + + +def test_stop_all_clears_registry(kb_dir, monkeypatch): + monkeypatch.setattr("openkb.watch_service.start_watch", lambda *a, **k: object()) + reg = WatchRegistry() + reg.start("a", kb_dir, debounce=0.0) + reg.start("b", kb_dir, debounce=0.0) + reg.stop_all() + assert reg.list_active() == [] + + +# worker file processing + + +def test_worker_added_records_file_start_done_and_counter(kb_dir, monkeypatch): + state = _make_state(kb_dir) + state.queue.put([str(kb_dir / "raw" / "paper.md")]) + monkeypatch.setattr( + "openkb.watch_service._add_for_api", + lambda path, kb: AddFileResult(path.name, str(path), "added", "Added."), + ) + _drain_worker(state) + assert _events_of(state, "file_start")[0]["original_name"] == "paper.md" + done = _events_of(state, "file_done")[0] + assert done["status"] == "added" + assert done["message"] == "Added." + assert state.counters == {"added": 1, "skipped": 0, "failed": 0} + + +def test_worker_skipped_and_failed_branches(kb_dir, monkeypatch): + state = _make_state(kb_dir) + state.queue.put([str(kb_dir / "raw" / "dup.md"), str(kb_dir / "raw" / "boom.md")]) + + def fake_add(path, target_kb): + if path.name == "dup.md": + return AddFileResult(path.name, None, "skipped", "Already in KB.") + raise RuntimeError("explode") + + monkeypatch.setattr("openkb.watch_service._add_for_api", fake_add) + _drain_worker(state) + dones = _events_of(state, "file_done") + assert [d["status"] for d in dones] == ["skipped"] + assert dones[0]["message"] == "Already in KB." + errs = _events_of(state, "error") + assert len(errs) == 1 + assert "explode" in errs[0]["message"] + assert state.counters == {"added": 0, "skipped": 1, "failed": 1} + + +def test_worker_unsupported_suffix_is_skipped_without_ingest(kb_dir, monkeypatch): + state = _make_state(kb_dir) + state.queue.put([str(kb_dir / "raw" / "image.xyz")]) + called = [] + monkeypatch.setattr( + "openkb.watch_service._add_for_api", + lambda path, kb: called.append(path) or AddFileResult("x", None, "added", "x"), + ) + _drain_worker(state) + assert called == [] + done = _events_of(state, "file_done")[0] + assert done["status"] == "skipped" + assert "unsupported" in done["message"].lower() + assert state.counters == {"added": 0, "skipped": 1, "failed": 0} + + +def test_worker_does_not_die_on_exception(kb_dir, monkeypatch): + state = _make_state(kb_dir) + state.queue.put([str(kb_dir / "raw" / "bad.md"), str(kb_dir / "raw" / "good.md")]) + + def fake_add(path, target_kb): + if path.name == "bad.md": + raise RuntimeError("nope") + return AddFileResult(path.name, str(path), "added", "ok") + + monkeypatch.setattr("openkb.watch_service._add_for_api", fake_add) + _drain_worker(state) + assert state.counters == {"added": 1, "skipped": 0, "failed": 1} + + +def test_ring_buffer_keeps_most_recent_ordered(): + buf = deque(maxlen=3) + for i in range(5): + buf.append({"seq": i, "ts": float(i), "event": "file_done", "data": {"i": i}}) + public = [_public_event(e) for e in buf] + assert [p["data"]["i"] for p in public] == [2, 3, 4] + assert public[0]["ts"] < public[-1]["ts"] + + +def test_end_to_end_debounce_processes_real_file(kb_dir, monkeypatch): + seen = [] + monkeypatch.setattr( + "openkb.watch_service._add_for_api", + lambda path, kb: seen.append(path.name) + or AddFileResult(path.name, str(path), "added", "ok"), + ) + reg = WatchRegistry() + reg.start("test-kb", kb_dir, debounce=0.1) + try: + (kb_dir / "raw" / "dropped.md").write_text("# hi", encoding="utf-8") + for _ in range(50): + if reg.status("test-kb")["counters"]["added"] == 1: + break + time.sleep(0.1) + assert seen == ["dropped.md"] + names = [e["event"] for e in reg.status("test-kb")["recent_events"]] + assert "file_start" in names and "file_done" in names + finally: + reg.stop("test-kb") \ No newline at end of file diff --git a/web/assets/index-B95kof3N.js b/web/assets/index-B95kof3N.js new file mode 100644 index 000000000..fb275e561 --- /dev/null +++ b/web/assets/index-B95kof3N.js @@ -0,0 +1,171 @@ +(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))l(s);new MutationObserver(s=>{for(const c of s)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&l(u)}).observe(document,{childList:!0,subtree:!0});function r(s){const c={};return s.integrity&&(c.integrity=s.integrity),s.referrerPolicy&&(c.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?c.credentials="include":s.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function l(s){if(s.ep)return;s.ep=!0;const c=r(s);fetch(s.href,c)}})();function Mo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ys={exports:{}},ko={},Qs={exports:{}},Fe={};/** + * @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 vf;function Zg(){if(vf)return Fe;vf=1;var e=Symbol.for("react.element"),i=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.iterator;function E(O){return O===null||typeof O!="object"?null:(O=y&&O[y]||O["@@iterator"],typeof O=="function"?O:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,C={};function T(O,j,S){this.props=O,this.context=j,this.refs=C,this.updater=S||b}T.prototype.isReactComponent={},T.prototype.setState=function(O,j){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,j,"setState")},T.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function w(){}w.prototype=T.prototype;function F(O,j,S){this.props=O,this.context=j,this.refs=C,this.updater=S||b}var L=F.prototype=new w;L.constructor=F,x(L,T.prototype),L.isPureReactComponent=!0;var $=Array.isArray,K=Object.prototype.hasOwnProperty,I={current:null},Z={key:!0,ref:!0,__self:!0,__source:!0};function G(O,j,S){var we,Me={},ke=null,$e=null;if(j!=null)for(we in j.ref!==void 0&&($e=j.ref),j.key!==void 0&&(ke=""+j.key),j)K.call(j,we)&&!Z.hasOwnProperty(we)&&(Me[we]=j[we]);var De=arguments.length-2;if(De===1)Me.children=S;else if(1<De){for(var Ke=Array(De),Xe=0;Xe<De;Xe++)Ke[Xe]=arguments[Xe+2];Me.children=Ke}if(O&&O.defaultProps)for(we in De=O.defaultProps,De)Me[we]===void 0&&(Me[we]=De[we]);return{$$typeof:e,type:O,key:ke,ref:$e,props:Me,_owner:I.current}}function te(O,j){return{$$typeof:e,type:O.type,key:j,ref:O.ref,props:O.props,_owner:O._owner}}function D(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function ne(O){var j={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(S){return j[S]})}var X=/\/+/g;function fe(O,j){return typeof O=="object"&&O!==null&&O.key!=null?ne(""+O.key):j.toString(36)}function q(O,j,S,we,Me){var ke=typeof O;(ke==="undefined"||ke==="boolean")&&(O=null);var $e=!1;if(O===null)$e=!0;else switch(ke){case"string":case"number":$e=!0;break;case"object":switch(O.$$typeof){case e:case i:$e=!0}}if($e)return $e=O,Me=Me($e),O=we===""?"."+fe($e,0):we,$(Me)?(S="",O!=null&&(S=O.replace(X,"$&/")+"/"),q(Me,j,S,"",function(Xe){return Xe})):Me!=null&&(D(Me)&&(Me=te(Me,S+(!Me.key||$e&&$e.key===Me.key?"":(""+Me.key).replace(X,"$&/")+"/")+O)),j.push(Me)),1;if($e=0,we=we===""?".":we+":",$(O))for(var De=0;De<O.length;De++){ke=O[De];var Ke=we+fe(ke,De);$e+=q(ke,j,S,Ke,Me)}else if(Ke=E(O),typeof Ke=="function")for(O=Ke.call(O),De=0;!(ke=O.next()).done;)ke=ke.value,Ke=we+fe(ke,De++),$e+=q(ke,j,S,Ke,Me);else if(ke==="object")throw j=String(O),Error("Objects are not valid as a React child (found: "+(j==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":j)+"). If you meant to render a collection of children, use an array instead.");return $e}function P(O,j,S){if(O==null)return O;var we=[],Me=0;return q(O,we,"","",function(ke){return j.call(S,ke,Me++)}),we}function le(O){if(O._status===-1){var j=O._result;j=j(),j.then(function(S){(O._status===0||O._status===-1)&&(O._status=1,O._result=S)},function(S){(O._status===0||O._status===-1)&&(O._status=2,O._result=S)}),O._status===-1&&(O._status=0,O._result=j)}if(O._status===1)return O._result.default;throw O._result}var ae={current:null},W={transition:null},de={ReactCurrentDispatcher:ae,ReactCurrentBatchConfig:W,ReactCurrentOwner:I};function v(){throw Error("act(...) is not supported in production builds of React.")}return Fe.Children={map:P,forEach:function(O,j,S){P(O,function(){j.apply(this,arguments)},S)},count:function(O){var j=0;return P(O,function(){j++}),j},toArray:function(O){return P(O,function(j){return j})||[]},only:function(O){if(!D(O))throw Error("React.Children.only expected to receive a single React element child.");return O}},Fe.Component=T,Fe.Fragment=r,Fe.Profiler=s,Fe.PureComponent=F,Fe.StrictMode=l,Fe.Suspense=p,Fe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=de,Fe.act=v,Fe.cloneElement=function(O,j,S){if(O==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+O+".");var we=x({},O.props),Me=O.key,ke=O.ref,$e=O._owner;if(j!=null){if(j.ref!==void 0&&(ke=j.ref,$e=I.current),j.key!==void 0&&(Me=""+j.key),O.type&&O.type.defaultProps)var De=O.type.defaultProps;for(Ke in j)K.call(j,Ke)&&!Z.hasOwnProperty(Ke)&&(we[Ke]=j[Ke]===void 0&&De!==void 0?De[Ke]:j[Ke])}var Ke=arguments.length-2;if(Ke===1)we.children=S;else if(1<Ke){De=Array(Ke);for(var Xe=0;Xe<Ke;Xe++)De[Xe]=arguments[Xe+2];we.children=De}return{$$typeof:e,type:O.type,key:Me,ref:ke,props:we,_owner:$e}},Fe.createContext=function(O){return O={$$typeof:u,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},O.Provider={$$typeof:c,_context:O},O.Consumer=O},Fe.createElement=G,Fe.createFactory=function(O){var j=G.bind(null,O);return j.type=O,j},Fe.createRef=function(){return{current:null}},Fe.forwardRef=function(O){return{$$typeof:d,render:O}},Fe.isValidElement=D,Fe.lazy=function(O){return{$$typeof:g,_payload:{_status:-1,_result:O},_init:le}},Fe.memo=function(O,j){return{$$typeof:m,type:O,compare:j===void 0?null:j}},Fe.startTransition=function(O){var j=W.transition;W.transition={};try{O()}finally{W.transition=j}},Fe.unstable_act=v,Fe.useCallback=function(O,j){return ae.current.useCallback(O,j)},Fe.useContext=function(O){return ae.current.useContext(O)},Fe.useDebugValue=function(){},Fe.useDeferredValue=function(O){return ae.current.useDeferredValue(O)},Fe.useEffect=function(O,j){return ae.current.useEffect(O,j)},Fe.useId=function(){return ae.current.useId()},Fe.useImperativeHandle=function(O,j,S){return ae.current.useImperativeHandle(O,j,S)},Fe.useInsertionEffect=function(O,j){return ae.current.useInsertionEffect(O,j)},Fe.useLayoutEffect=function(O,j){return ae.current.useLayoutEffect(O,j)},Fe.useMemo=function(O,j){return ae.current.useMemo(O,j)},Fe.useReducer=function(O,j,S){return ae.current.useReducer(O,j,S)},Fe.useRef=function(O){return ae.current.useRef(O)},Fe.useState=function(O){return ae.current.useState(O)},Fe.useSyncExternalStore=function(O,j,S){return ae.current.useSyncExternalStore(O,j,S)},Fe.useTransition=function(){return ae.current.useTransition()},Fe.version="18.3.1",Fe}var kf;function Du(){return kf||(kf=1,Qs.exports=Zg()),Qs.exports}/** + * @license React + * react-jsx-runtime.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 wf;function Xg(){if(wf)return ko;wf=1;var e=Du(),i=Symbol.for("react.element"),r=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function u(d,p,m){var g,y={},E=null,b=null;m!==void 0&&(E=""+m),p.key!==void 0&&(E=""+p.key),p.ref!==void 0&&(b=p.ref);for(g in p)l.call(p,g)&&!c.hasOwnProperty(g)&&(y[g]=p[g]);if(d&&d.defaultProps)for(g in p=d.defaultProps,p)y[g]===void 0&&(y[g]=p[g]);return{$$typeof:i,type:d,key:E,ref:b,props:y,_owner:s.current}}return ko.Fragment=r,ko.jsx=u,ko.jsxs=u,ko}var xf;function Jg(){return xf||(xf=1,Ys.exports=Xg()),Ys.exports}var k=Jg(),ue=Du();const ey=Mo(ue);var Gl={},Zs={exports:{}},Zt={},Xs={exports:{}},Js={};/** + * @license React + * scheduler.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 Sf;function ty(){return Sf||(Sf=1,(function(e){function i(W,de){var v=W.length;W.push(de);e:for(;0<v;){var O=v-1>>>1,j=W[O];if(0<s(j,de))W[O]=de,W[v]=j,v=O;else break e}}function r(W){return W.length===0?null:W[0]}function l(W){if(W.length===0)return null;var de=W[0],v=W.pop();if(v!==de){W[0]=v;e:for(var O=0,j=W.length,S=j>>>1;O<S;){var we=2*(O+1)-1,Me=W[we],ke=we+1,$e=W[ke];if(0>s(Me,v))ke<j&&0>s($e,Me)?(W[O]=$e,W[ke]=v,O=ke):(W[O]=Me,W[we]=v,O=we);else if(ke<j&&0>s($e,v))W[O]=$e,W[ke]=v,O=ke;else break e}}return de}function s(W,de){var v=W.sortIndex-de.sortIndex;return v!==0?v:W.id-de.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var p=[],m=[],g=1,y=null,E=3,b=!1,x=!1,C=!1,T=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function L(W){for(var de=r(m);de!==null;){if(de.callback===null)l(m);else if(de.startTime<=W)l(m),de.sortIndex=de.expirationTime,i(p,de);else break;de=r(m)}}function $(W){if(C=!1,L(W),!x)if(r(p)!==null)x=!0,le(K);else{var de=r(m);de!==null&&ae($,de.startTime-W)}}function K(W,de){x=!1,C&&(C=!1,w(G),G=-1),b=!0;var v=E;try{for(L(de),y=r(p);y!==null&&(!(y.expirationTime>de)||W&&!ne());){var O=y.callback;if(typeof O=="function"){y.callback=null,E=y.priorityLevel;var j=O(y.expirationTime<=de);de=e.unstable_now(),typeof j=="function"?y.callback=j:y===r(p)&&l(p),L(de)}else l(p);y=r(p)}if(y!==null)var S=!0;else{var we=r(m);we!==null&&ae($,we.startTime-de),S=!1}return S}finally{y=null,E=v,b=!1}}var I=!1,Z=null,G=-1,te=5,D=-1;function ne(){return!(e.unstable_now()-D<te)}function X(){if(Z!==null){var W=e.unstable_now();D=W;var de=!0;try{de=Z(!0,W)}finally{de?fe():(I=!1,Z=null)}}else I=!1}var fe;if(typeof F=="function")fe=function(){F(X)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,P=q.port2;q.port1.onmessage=X,fe=function(){P.postMessage(null)}}else fe=function(){T(X,0)};function le(W){Z=W,I||(I=!0,fe())}function ae(W,de){G=T(function(){W(e.unstable_now())},de)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(W){W.callback=null},e.unstable_continueExecution=function(){x||b||(x=!0,le(K))},e.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):te=0<W?Math.floor(1e3/W):5},e.unstable_getCurrentPriorityLevel=function(){return E},e.unstable_getFirstCallbackNode=function(){return r(p)},e.unstable_next=function(W){switch(E){case 1:case 2:case 3:var de=3;break;default:de=E}var v=E;E=de;try{return W()}finally{E=v}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(W,de){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var v=E;E=W;try{return de()}finally{E=v}},e.unstable_scheduleCallback=function(W,de,v){var O=e.unstable_now();switch(typeof v=="object"&&v!==null?(v=v.delay,v=typeof v=="number"&&0<v?O+v:O):v=O,W){case 1:var j=-1;break;case 2:j=250;break;case 5:j=1073741823;break;case 4:j=1e4;break;default:j=5e3}return j=v+j,W={id:g++,callback:de,priorityLevel:W,startTime:v,expirationTime:j,sortIndex:-1},v>O?(W.sortIndex=v,i(m,W),r(p)===null&&W===r(m)&&(C?(w(G),G=-1):C=!0,ae($,v-O))):(W.sortIndex=j,i(p,W),x||b||(x=!0,le(K))),W},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(W){var de=E;return function(){var v=E;E=de;try{return W.apply(this,arguments)}finally{E=v}}}})(Js)),Js}var Nf;function ny(){return Nf||(Nf=1,Xs.exports=ty()),Xs.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 Cf;function ry(){if(Cf)return Zt;Cf=1;var e=Du(),i=ny();function r(t){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+t,o=1;o<arguments.length;o++)n+="&args[]="+encodeURIComponent(arguments[o]);return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var l=new Set,s={};function c(t,n){u(t,n),u(t+"Capture",n)}function u(t,n){for(s[t]=n,t=0;t<n.length;t++)l.add(n[t])}var d=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,m=/^[: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]*$/,g={},y={};function E(t){return p.call(y,t)?!0:p.call(g,t)?!1:m.test(t)?y[t]=!0:(g[t]=!0,!1)}function b(t,n,o,a){if(o!==null&&o.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return a?!1:o!==null?!o.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function x(t,n,o,a){if(n===null||typeof n>"u"||b(t,n,o,a))return!0;if(a)return!1;if(o!==null)switch(o.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function C(t,n,o,a,f,h,_){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=a,this.attributeNamespace=f,this.mustUseProperty=o,this.propertyName=t,this.type=n,this.sanitizeURL=h,this.removeEmptyString=_}var T={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){T[t]=new C(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var n=t[0];T[n]=new C(n,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){T[t]=new C(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){T[t]=new C(t,2,!1,t,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(t){T[t]=new C(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){T[t]=new C(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){T[t]=new C(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){T[t]=new C(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){T[t]=new C(t,5,!1,t.toLowerCase(),null,!1,!1)});var w=/[\-:]([a-z])/g;function F(t){return t[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(t){var n=t.replace(w,F);T[n]=new C(n,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var n=t.replace(w,F);T[n]=new C(n,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var n=t.replace(w,F);T[n]=new C(n,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){T[t]=new C(t,1,!1,t.toLowerCase(),null,!1,!1)}),T.xlinkHref=new C("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){T[t]=new C(t,1,!1,t.toLowerCase(),null,!0,!0)});function L(t,n,o,a){var f=T.hasOwnProperty(n)?T[n]:null;(f!==null?f.type!==0:a||!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(x(n,o,f,a)&&(o=null),a||f===null?E(n)&&(o===null?t.removeAttribute(n):t.setAttribute(n,""+o)):f.mustUseProperty?t[f.propertyName]=o===null?f.type===3?!1:"":o:(n=f.attributeName,a=f.attributeNamespace,o===null?t.removeAttribute(n):(f=f.type,o=f===3||f===4&&o===!0?"":""+o,a?t.setAttributeNS(a,n,o):t.setAttribute(n,o))))}var $=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,K=Symbol.for("react.element"),I=Symbol.for("react.portal"),Z=Symbol.for("react.fragment"),G=Symbol.for("react.strict_mode"),te=Symbol.for("react.profiler"),D=Symbol.for("react.provider"),ne=Symbol.for("react.context"),X=Symbol.for("react.forward_ref"),fe=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),le=Symbol.for("react.lazy"),ae=Symbol.for("react.offscreen"),W=Symbol.iterator;function de(t){return t===null||typeof t!="object"?null:(t=W&&t[W]||t["@@iterator"],typeof t=="function"?t:null)}var v=Object.assign,O;function j(t){if(O===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);O=n&&n[1]||""}return` +`+O+t}var S=!1;function we(t,n){if(!t||S)return"";S=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(n)if(n=function(){throw Error()},Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(n,[])}catch(U){var a=U}Reflect.construct(t,[],n)}else{try{n.call()}catch(U){a=U}t.call(n.prototype)}else{try{throw Error()}catch(U){a=U}t()}}catch(U){if(U&&a&&typeof U.stack=="string"){for(var f=U.stack.split(` +`),h=a.stack.split(` +`),_=f.length-1,N=h.length-1;1<=_&&0<=N&&f[_]!==h[N];)N--;for(;1<=_&&0<=N;_--,N--)if(f[_]!==h[N]){if(_!==1||N!==1)do if(_--,N--,0>N||f[_]!==h[N]){var R=` +`+f[_].replace(" at new "," at ");return t.displayName&&R.includes("<anonymous>")&&(R=R.replace("<anonymous>",t.displayName)),R}while(1<=_&&0<=N);break}}}finally{S=!1,Error.prepareStackTrace=o}return(t=t?t.displayName||t.name:"")?j(t):""}function Me(t){switch(t.tag){case 5:return j(t.type);case 16:return j("Lazy");case 13:return j("Suspense");case 19:return j("SuspenseList");case 0:case 2:case 15:return t=we(t.type,!1),t;case 11:return t=we(t.type.render,!1),t;case 1:return t=we(t.type,!0),t;default:return""}}function ke(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Z:return"Fragment";case I:return"Portal";case te:return"Profiler";case G:return"StrictMode";case fe:return"Suspense";case q:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case ne:return(t.displayName||"Context")+".Consumer";case D:return(t._context.displayName||"Context")+".Provider";case X:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case P:return n=t.displayName||null,n!==null?n:ke(t.type)||"Memo";case le:n=t._payload,t=t._init;try{return ke(t(n))}catch{}}return null}function $e(t){var n=t.type;switch(t.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=n.render,t=t.displayName||t.name||"",n.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ke(n);case 8:return n===G?"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 n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function De(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Ke(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Xe(t){var n=Ke(t)?"checked":"value",o=Object.getOwnPropertyDescriptor(t.constructor.prototype,n),a=""+t[n];if(!t.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var f=o.get,h=o.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return f.call(this)},set:function(_){a=""+_,h.call(this,_)}}),Object.defineProperty(t,n,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(_){a=""+_},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function en(t){t._valueTracker||(t._valueTracker=Xe(t))}function ar(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var o=n.getValue(),a="";return t&&(a=Ke(t)?t.checked?"true":"false":t.value),t=a,t!==o?(n.setValue(t),!0):!1}function In(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Wn(t,n){var o=n.checked;return v({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??t._wrapperState.initialChecked})}function Vn(t,n){var o=n.defaultValue==null?"":n.defaultValue,a=n.checked!=null?n.checked:n.defaultChecked;o=De(n.value!=null?n.value:o),t._wrapperState={initialChecked:a,initialValue:o,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Ge(t,n){n=n.checked,n!=null&&L(t,"checked",n,!1)}function tn(t,n){Ge(t,n);var o=De(n.value),a=n.type;if(o!=null)a==="number"?(o===0&&t.value===""||t.value!=o)&&(t.value=""+o):t.value!==""+o&&(t.value=""+o);else if(a==="submit"||a==="reset"){t.removeAttribute("value");return}n.hasOwnProperty("value")?Mn(t,n.type,o):n.hasOwnProperty("defaultValue")&&Mn(t,n.type,De(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(t.defaultChecked=!!n.defaultChecked)}function un(t,n,o){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var a=n.type;if(!(a!=="submit"&&a!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+t._wrapperState.initialValue,o||n===t.value||(t.value=n),t.defaultValue=n}o=t.name,o!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,o!==""&&(t.name=o)}function Mn(t,n,o){(n!=="number"||In(t.ownerDocument)!==t)&&(o==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+o&&(t.defaultValue=""+o))}var _n=Array.isArray;function Ln(t,n,o,a){if(t=t.options,n){n={};for(var f=0;f<o.length;f++)n["$"+o[f]]=!0;for(o=0;o<t.length;o++)f=n.hasOwnProperty("$"+t[o].value),t[o].selected!==f&&(t[o].selected=f),f&&a&&(t[o].defaultSelected=!0)}else{for(o=""+De(o),n=null,f=0;f<t.length;f++){if(t[f].value===o){t[f].selected=!0,a&&(t[f].defaultSelected=!0);return}n!==null||t[f].disabled||(n=t[f])}n!==null&&(n.selected=!0)}}function Or(t,n){if(n.dangerouslySetInnerHTML!=null)throw Error(r(91));return v({},n,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Ir(t,n){var o=n.value;if(o==null){if(o=n.children,n=n.defaultValue,o!=null){if(n!=null)throw Error(r(92));if(_n(o)){if(1<o.length)throw Error(r(93));o=o[0]}n=o}n==null&&(n=""),o=n}t._wrapperState={initialValue:De(o)}}function cn(t,n){var o=De(n.value),a=De(n.defaultValue);o!=null&&(o=""+o,o!==t.value&&(t.value=o),n.defaultValue==null&&t.defaultValue!==o&&(t.defaultValue=o)),a!=null&&(t.defaultValue=""+a)}function Mr(t){var n=t.textContent;n===t._wrapperState.initialValue&&n!==""&&n!==null&&(t.value=n)}function H(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function oe(t,n){return t==null||t==="http://www.w3.org/1999/xhtml"?H(n):t==="http://www.w3.org/2000/svg"&&n==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Te,Pe=(function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(n,o,a,f){MSApp.execUnsafeLocalFunction(function(){return t(n,o,a,f)})}:t})(function(t,n){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=n;else{for(Te=Te||document.createElement("div"),Te.innerHTML="<svg>"+n.valueOf().toString()+"</svg>",n=Te.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;n.firstChild;)t.appendChild(n.firstChild)}});function je(t,n){if(n){var o=t.firstChild;if(o&&o===t.lastChild&&o.nodeType===3){o.nodeValue=n;return}}t.textContent=n}var _t={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},vn=["Webkit","ms","Moz","O"];Object.keys(_t).forEach(function(t){vn.forEach(function(n){n=n+t.charAt(0).toUpperCase()+t.substring(1),_t[n]=_t[t]})});function Gt(t,n,o){return n==null||typeof n=="boolean"||n===""?"":o||typeof n!="number"||n===0||_t.hasOwnProperty(t)&&_t[t]?(""+n).trim():n+"px"}function kn(t,n){t=t.style;for(var o in n)if(n.hasOwnProperty(o)){var a=o.indexOf("--")===0,f=Gt(o,n[o],a);o==="float"&&(o="cssFloat"),a?t.setProperty(o,f):t[o]=f}}var qn=v({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 vt(t,n){if(n){if(qn[t]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(r(137,t));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(r(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(r(61))}if(n.style!=null&&typeof n.style!="object")throw Error(r(62))}}function dn(t,n){if(t.indexOf("-")===-1)return typeof n.is=="string";switch(t){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 Tt=null;function oi(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var li=null,sr=null,Yn=null;function Qn(t){if(t=lo(t)){if(typeof li!="function")throw Error(r(280));var n=t.stateNode;n&&(n=ll(n),li(t.stateNode,t.type,n))}}function A(t){sr?Yn?Yn.push(t):Yn=[t]:sr=t}function V(){if(sr){var t=sr,n=Yn;if(Yn=sr=null,Qn(t),n)for(t=0;t<n.length;t++)Qn(n[t])}}function ce(t,n){return t(n)}function Re(){}var rt=!1;function lt(t,n,o){if(rt)return t(n,o);rt=!0;try{return ce(t,n,o)}finally{rt=!1,(sr!==null||Yn!==null)&&(Re(),V())}}function he(t,n){var o=t.stateNode;if(o===null)return null;var a=ll(o);if(a===null)return null;o=a[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(a=!a.disabled)||(t=t.type,a=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!a;break e;default:t=!1}if(t)return null;if(o&&typeof o!="function")throw Error(r(231,n,typeof o));return o}var me=!1;if(d)try{var xe={};Object.defineProperty(xe,"passive",{get:function(){me=!0}}),window.addEventListener("test",xe,xe),window.removeEventListener("test",xe,xe)}catch{me=!1}function yt(t,n,o,a,f,h,_,N,R){var U=Array.prototype.slice.call(arguments,3);try{n.apply(o,U)}catch(Q){this.onError(Q)}}var tt=!1,Dn=null,ur=!1,Lr=null,ha={onError:function(t){tt=!0,Dn=t}};function Ui(t,n,o,a,f,h,_,N,R){tt=!1,Dn=null,yt.apply(ha,arguments)}function ga(t,n,o,a,f,h,_,N,R){if(Ui.apply(this,arguments),tt){if(tt){var U=Dn;tt=!1,Dn=null}else throw Error(r(198));ur||(ur=!0,Lr=U)}}function Zn(t){var n=t,o=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(o=n.return),t=n.return;while(t)}return n.tag===3?o:null}function Fo(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function $i(t){if(Zn(t)!==t)throw Error(r(188))}function ai(t){var n=t.alternate;if(!n){if(n=Zn(t),n===null)throw Error(r(188));return n!==t?null:t}for(var o=t,a=n;;){var f=o.return;if(f===null)break;var h=f.alternate;if(h===null){if(a=f.return,a!==null){o=a;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===o)return $i(f),t;if(h===a)return $i(f),n;h=h.sibling}throw Error(r(188))}if(o.return!==a.return)o=f,a=h;else{for(var _=!1,N=f.child;N;){if(N===o){_=!0,o=f,a=h;break}if(N===a){_=!0,a=f,o=h;break}N=N.sibling}if(!_){for(N=h.child;N;){if(N===o){_=!0,o=h,a=f;break}if(N===a){_=!0,a=h,o=f;break}N=N.sibling}if(!_)throw Error(r(189))}}if(o.alternate!==a)throw Error(r(190))}if(o.tag!==3)throw Error(r(188));return o.stateNode.current===o?t:n}function Bo(t){return t=ai(t),t!==null?Uo(t):null}function Uo(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var n=Uo(t);if(n!==null)return n;t=t.sibling}return null}var $o=i.unstable_scheduleCallback,wn=i.unstable_cancelCallback,jo=i.unstable_shouldYield,Ho=i.unstable_requestPaint,st=i.unstable_now,ya=i.unstable_getCurrentPriorityLevel,ji=i.unstable_ImmediatePriority,Dr=i.unstable_UserBlockingPriority,si=i.unstable_NormalPriority,re=i.unstable_LowPriority,ve=i.unstable_IdlePriority,ze=null,Be=null;function mt(t){if(Be&&typeof Be.onCommitFiberRoot=="function")try{Be.onCommitFiberRoot(ze,t,void 0,(t.current.flags&128)===128)}catch{}}var ut=Math.clz32?Math.clz32:zt,Pn=Math.log,ui=Math.LN2;function zt(t){return t>>>=0,t===0?32:31-(Pn(t)/ui|0)|0}var Ft=64,Pr=4194304;function cr(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function zr(t,n){var o=t.pendingLanes;if(o===0)return 0;var a=0,f=t.suspendedLanes,h=t.pingedLanes,_=o&268435455;if(_!==0){var N=_&~f;N!==0?a=cr(N):(h&=_,h!==0&&(a=cr(h)))}else _=o&~f,_!==0?a=cr(_):h!==0&&(a=cr(h));if(a===0)return 0;if(n!==0&&n!==a&&(n&f)===0&&(f=a&-a,h=n&-n,f>=h||f===16&&(h&4194240)!==0))return n;if((a&4)!==0&&(a|=o&16),n=t.entangledLanes,n!==0)for(t=t.entanglements,n&=a;0<n;)o=31-ut(n),f=1<<o,a|=t[o],n&=~f;return a}function ba(t,n){switch(t){case 1:case 2:case 4:return n+250;case 8:case 16:case 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 n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ea(t,n){for(var o=t.suspendedLanes,a=t.pingedLanes,f=t.expirationTimes,h=t.pendingLanes;0<h;){var _=31-ut(h),N=1<<_,R=f[_];R===-1?((N&o)===0||(N&a)!==0)&&(f[_]=ba(N,n)):R<=n&&(t.expiredLanes|=N),h&=~N}}function Hi(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Ko(){var t=Ft;return Ft<<=1,(Ft&4194240)===0&&(Ft=64),t}function dr(t){for(var n=[],o=0;31>o;o++)n.push(t);return n}function fr(t,n,o){t.pendingLanes|=n,n!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,n=31-ut(n),t[n]=o}function fn(t,n){var o=t.pendingLanes&~n;t.pendingLanes=n,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=n,t.mutableReadLanes&=n,t.entangledLanes&=n,n=t.entanglements;var a=t.eventTimes;for(t=t.expirationTimes;0<o;){var f=31-ut(o),h=1<<f;n[f]=0,a[f]=-1,t[f]=-1,o&=~h}}function Ki(t,n){var o=t.entangledLanes|=n;for(t=t.entanglements;o;){var a=31-ut(o),f=1<<a;f&n|t[a]&n&&(t[a]|=n),o&=~f}}var Ve=0;function Ie(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var Gi,ht,Qe,Fr,zn,Br=!1,pr=[],se=null,ge=null,Ae=null,He=new Map,ft=new Map,xt=[],_a="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Go(t,n){switch(t){case"focusin":case"focusout":se=null;break;case"dragenter":case"dragleave":ge=null;break;case"mouseover":case"mouseout":Ae=null;break;case"pointerover":case"pointerout":He.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":ft.delete(n.pointerId)}}function Wi(t,n,o,a,f,h){return t===null||t.nativeEvent!==h?(t={blockedOn:n,domEventName:o,eventSystemFlags:a,nativeEvent:h,targetContainers:[f]},n!==null&&(n=lo(n),n!==null&&ht(n)),t):(t.eventSystemFlags|=a,n=t.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),t)}function _h(t,n,o,a,f){switch(n){case"focusin":return se=Wi(se,t,n,o,a,f),!0;case"dragenter":return ge=Wi(ge,t,n,o,a,f),!0;case"mouseover":return Ae=Wi(Ae,t,n,o,a,f),!0;case"pointerover":var h=f.pointerId;return He.set(h,Wi(He.get(h)||null,t,n,o,a,f)),!0;case"gotpointercapture":return h=f.pointerId,ft.set(h,Wi(ft.get(h)||null,t,n,o,a,f)),!0}return!1}function ic(t){var n=Ur(t.target);if(n!==null){var o=Zn(n);if(o!==null){if(n=o.tag,n===13){if(n=Fo(o),n!==null){t.blockedOn=n,zn(t.priority,function(){Qe(o)});return}}else if(n===3&&o.stateNode.current.memoizedState.isDehydrated){t.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Wo(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var o=ka(t.domEventName,t.eventSystemFlags,n[0],t.nativeEvent);if(o===null){o=t.nativeEvent;var a=new o.constructor(o.type,o);Tt=a,o.target.dispatchEvent(a),Tt=null}else return n=lo(o),n!==null&&ht(n),t.blockedOn=o,!1;n.shift()}return!0}function oc(t,n,o){Wo(t)&&o.delete(n)}function vh(){Br=!1,se!==null&&Wo(se)&&(se=null),ge!==null&&Wo(ge)&&(ge=null),Ae!==null&&Wo(Ae)&&(Ae=null),He.forEach(oc),ft.forEach(oc)}function Vi(t,n){t.blockedOn===n&&(t.blockedOn=null,Br||(Br=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,vh)))}function qi(t){function n(f){return Vi(f,t)}if(0<pr.length){Vi(pr[0],t);for(var o=1;o<pr.length;o++){var a=pr[o];a.blockedOn===t&&(a.blockedOn=null)}}for(se!==null&&Vi(se,t),ge!==null&&Vi(ge,t),Ae!==null&&Vi(Ae,t),He.forEach(n),ft.forEach(n),o=0;o<xt.length;o++)a=xt[o],a.blockedOn===t&&(a.blockedOn=null);for(;0<xt.length&&(o=xt[0],o.blockedOn===null);)ic(o),o.blockedOn===null&&xt.shift()}var ci=$.ReactCurrentBatchConfig,Vo=!0;function kh(t,n,o,a){var f=Ve,h=ci.transition;ci.transition=null;try{Ve=1,va(t,n,o,a)}finally{Ve=f,ci.transition=h}}function wh(t,n,o,a){var f=Ve,h=ci.transition;ci.transition=null;try{Ve=4,va(t,n,o,a)}finally{Ve=f,ci.transition=h}}function va(t,n,o,a){if(Vo){var f=ka(t,n,o,a);if(f===null)Ba(t,n,a,qo,o),Go(t,a);else if(_h(f,t,n,o,a))a.stopPropagation();else if(Go(t,a),n&4&&-1<_a.indexOf(t)){for(;f!==null;){var h=lo(f);if(h!==null&&Gi(h),h=ka(t,n,o,a),h===null&&Ba(t,n,a,qo,o),h===f)break;f=h}f!==null&&a.stopPropagation()}else Ba(t,n,a,null,o)}}var qo=null;function ka(t,n,o,a){if(qo=null,t=oi(a),t=Ur(t),t!==null)if(n=Zn(t),n===null)t=null;else if(o=n.tag,o===13){if(t=Fo(n),t!==null)return t;t=null}else if(o===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null);return qo=t,null}function lc(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(ya()){case ji:return 1;case Dr:return 4;case si:case re:return 16;case ve:return 536870912;default:return 16}default:return 16}}var mr=null,wa=null,Yo=null;function ac(){if(Yo)return Yo;var t,n=wa,o=n.length,a,f="value"in mr?mr.value:mr.textContent,h=f.length;for(t=0;t<o&&n[t]===f[t];t++);var _=o-t;for(a=1;a<=_&&n[o-a]===f[h-a];a++);return Yo=f.slice(t,1<a?1-a:void 0)}function Qo(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function Zo(){return!0}function sc(){return!1}function nn(t){function n(o,a,f,h,_){this._reactName=o,this._targetInst=f,this.type=a,this.nativeEvent=h,this.target=_,this.currentTarget=null;for(var N in t)t.hasOwnProperty(N)&&(o=t[N],this[N]=o?o(h):h[N]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?Zo:sc,this.isPropagationStopped=sc,this}return v(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=Zo)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Zo)},persist:function(){},isPersistent:Zo}),n}var di={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xa=nn(di),Yi=v({},di,{view:0,detail:0}),xh=nn(Yi),Sa,Na,Qi,Xo=v({},Yi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ta,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Qi&&(Qi&&t.type==="mousemove"?(Sa=t.screenX-Qi.screenX,Na=t.screenY-Qi.screenY):Na=Sa=0,Qi=t),Sa)},movementY:function(t){return"movementY"in t?t.movementY:Na}}),uc=nn(Xo),Sh=v({},Xo,{dataTransfer:0}),Nh=nn(Sh),Ch=v({},Yi,{relatedTarget:0}),Ca=nn(Ch),Th=v({},di,{animationName:0,elapsedTime:0,pseudoElement:0}),Ah=nn(Th),Rh=v({},di,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Oh=nn(Rh),Ih=v({},di,{data:0}),cc=nn(Ih),Mh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Lh={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Dh={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ph(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=Dh[t])?!!n[t]:!1}function Ta(){return Ph}var zh=v({},Yi,{key:function(t){if(t.key){var n=Mh[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=Qo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Lh[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ta,charCode:function(t){return t.type==="keypress"?Qo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Qo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Fh=nn(zh),Bh=v({},Xo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),dc=nn(Bh),Uh=v({},Yi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ta}),$h=nn(Uh),jh=v({},di,{propertyName:0,elapsedTime:0,pseudoElement:0}),Hh=nn(jh),Kh=v({},Xo,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Gh=nn(Kh),Wh=[9,13,27,32],Aa=d&&"CompositionEvent"in window,Zi=null;d&&"documentMode"in document&&(Zi=document.documentMode);var Vh=d&&"TextEvent"in window&&!Zi,fc=d&&(!Aa||Zi&&8<Zi&&11>=Zi),pc=" ",mc=!1;function hc(t,n){switch(t){case"keyup":return Wh.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gc(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var fi=!1;function qh(t,n){switch(t){case"compositionend":return gc(n);case"keypress":return n.which!==32?null:(mc=!0,pc);case"textInput":return t=n.data,t===pc&&mc?null:t;default:return null}}function Yh(t,n){if(fi)return t==="compositionend"||!Aa&&hc(t,n)?(t=ac(),Yo=wa=mr=null,fi=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return fc&&n.locale!=="ko"?null:n.data;default:return null}}var Qh={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function yc(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!Qh[t.type]:n==="textarea"}function bc(t,n,o,a){A(a),n=rl(n,"onChange"),0<n.length&&(o=new xa("onChange","change",null,o,a),t.push({event:o,listeners:n}))}var Xi=null,Ji=null;function Zh(t){Pc(t,0)}function Jo(t){var n=yi(t);if(ar(n))return t}function Xh(t,n){if(t==="change")return n}var Ec=!1;if(d){var Ra;if(d){var Oa="oninput"in document;if(!Oa){var _c=document.createElement("div");_c.setAttribute("oninput","return;"),Oa=typeof _c.oninput=="function"}Ra=Oa}else Ra=!1;Ec=Ra&&(!document.documentMode||9<document.documentMode)}function vc(){Xi&&(Xi.detachEvent("onpropertychange",kc),Ji=Xi=null)}function kc(t){if(t.propertyName==="value"&&Jo(Ji)){var n=[];bc(n,Ji,t,oi(t)),lt(Zh,n)}}function Jh(t,n,o){t==="focusin"?(vc(),Xi=n,Ji=o,Xi.attachEvent("onpropertychange",kc)):t==="focusout"&&vc()}function eg(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Jo(Ji)}function tg(t,n){if(t==="click")return Jo(n)}function ng(t,n){if(t==="input"||t==="change")return Jo(n)}function rg(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var xn=typeof Object.is=="function"?Object.is:rg;function eo(t,n){if(xn(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var o=Object.keys(t),a=Object.keys(n);if(o.length!==a.length)return!1;for(a=0;a<o.length;a++){var f=o[a];if(!p.call(n,f)||!xn(t[f],n[f]))return!1}return!0}function wc(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function xc(t,n){var o=wc(t);t=0;for(var a;o;){if(o.nodeType===3){if(a=t+o.textContent.length,t<=n&&a>=n)return{node:o,offset:n-t};t=a}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=wc(o)}}function Sc(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Sc(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Nc(){for(var t=window,n=In();n instanceof t.HTMLIFrameElement;){try{var o=typeof n.contentWindow.location.href=="string"}catch{o=!1}if(o)t=n.contentWindow;else break;n=In(t.document)}return n}function Ia(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}function ig(t){var n=Nc(),o=t.focusedElem,a=t.selectionRange;if(n!==o&&o&&o.ownerDocument&&Sc(o.ownerDocument.documentElement,o)){if(a!==null&&Ia(o)){if(n=a.start,t=a.end,t===void 0&&(t=n),"selectionStart"in o)o.selectionStart=n,o.selectionEnd=Math.min(t,o.value.length);else if(t=(n=o.ownerDocument||document)&&n.defaultView||window,t.getSelection){t=t.getSelection();var f=o.textContent.length,h=Math.min(a.start,f);a=a.end===void 0?h:Math.min(a.end,f),!t.extend&&h>a&&(f=a,a=h,h=f),f=xc(o,h);var _=xc(o,a);f&&_&&(t.rangeCount!==1||t.anchorNode!==f.node||t.anchorOffset!==f.offset||t.focusNode!==_.node||t.focusOffset!==_.offset)&&(n=n.createRange(),n.setStart(f.node,f.offset),t.removeAllRanges(),h>a?(t.addRange(n),t.extend(_.node,_.offset)):(n.setEnd(_.node,_.offset),t.addRange(n)))}}for(n=[],t=o;t=t.parentNode;)t.nodeType===1&&n.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<n.length;o++)t=n[o],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var og=d&&"documentMode"in document&&11>=document.documentMode,pi=null,Ma=null,to=null,La=!1;function Cc(t,n,o){var a=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;La||pi==null||pi!==In(a)||(a=pi,"selectionStart"in a&&Ia(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),to&&eo(to,a)||(to=a,a=rl(Ma,"onSelect"),0<a.length&&(n=new xa("onSelect","select",null,n,o),t.push({event:n,listeners:a}),n.target=pi)))}function el(t,n){var o={};return o[t.toLowerCase()]=n.toLowerCase(),o["Webkit"+t]="webkit"+n,o["Moz"+t]="moz"+n,o}var mi={animationend:el("Animation","AnimationEnd"),animationiteration:el("Animation","AnimationIteration"),animationstart:el("Animation","AnimationStart"),transitionend:el("Transition","TransitionEnd")},Da={},Tc={};d&&(Tc=document.createElement("div").style,"AnimationEvent"in window||(delete mi.animationend.animation,delete mi.animationiteration.animation,delete mi.animationstart.animation),"TransitionEvent"in window||delete mi.transitionend.transition);function tl(t){if(Da[t])return Da[t];if(!mi[t])return t;var n=mi[t],o;for(o in n)if(n.hasOwnProperty(o)&&o in Tc)return Da[t]=n[o];return t}var Ac=tl("animationend"),Rc=tl("animationiteration"),Oc=tl("animationstart"),Ic=tl("transitionend"),Mc=new Map,Lc="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function hr(t,n){Mc.set(t,n),c(n,[t])}for(var Pa=0;Pa<Lc.length;Pa++){var za=Lc[Pa],lg=za.toLowerCase(),ag=za[0].toUpperCase()+za.slice(1);hr(lg,"on"+ag)}hr(Ac,"onAnimationEnd"),hr(Rc,"onAnimationIteration"),hr(Oc,"onAnimationStart"),hr("dblclick","onDoubleClick"),hr("focusin","onFocus"),hr("focusout","onBlur"),hr(Ic,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var no="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),sg=new Set("cancel close invalid load scroll toggle".split(" ").concat(no));function Dc(t,n,o){var a=t.type||"unknown-event";t.currentTarget=o,ga(a,n,void 0,t),t.currentTarget=null}function Pc(t,n){n=(n&4)!==0;for(var o=0;o<t.length;o++){var a=t[o],f=a.event;a=a.listeners;e:{var h=void 0;if(n)for(var _=a.length-1;0<=_;_--){var N=a[_],R=N.instance,U=N.currentTarget;if(N=N.listener,R!==h&&f.isPropagationStopped())break e;Dc(f,N,U),h=R}else for(_=0;_<a.length;_++){if(N=a[_],R=N.instance,U=N.currentTarget,N=N.listener,R!==h&&f.isPropagationStopped())break e;Dc(f,N,U),h=R}}}if(ur)throw t=Lr,ur=!1,Lr=null,t}function it(t,n){var o=n[Ga];o===void 0&&(o=n[Ga]=new Set);var a=t+"__bubble";o.has(a)||(zc(n,t,2,!1),o.add(a))}function Fa(t,n,o){var a=0;n&&(a|=4),zc(o,t,a,n)}var nl="_reactListening"+Math.random().toString(36).slice(2);function ro(t){if(!t[nl]){t[nl]=!0,l.forEach(function(o){o!=="selectionchange"&&(sg.has(o)||Fa(o,!1,t),Fa(o,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[nl]||(n[nl]=!0,Fa("selectionchange",!1,n))}}function zc(t,n,o,a){switch(lc(n)){case 1:var f=kh;break;case 4:f=wh;break;default:f=va}o=f.bind(null,n,o,t),f=void 0,!me||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),a?f!==void 0?t.addEventListener(n,o,{capture:!0,passive:f}):t.addEventListener(n,o,!0):f!==void 0?t.addEventListener(n,o,{passive:f}):t.addEventListener(n,o,!1)}function Ba(t,n,o,a,f){var h=a;if((n&1)===0&&(n&2)===0&&a!==null)e:for(;;){if(a===null)return;var _=a.tag;if(_===3||_===4){var N=a.stateNode.containerInfo;if(N===f||N.nodeType===8&&N.parentNode===f)break;if(_===4)for(_=a.return;_!==null;){var R=_.tag;if((R===3||R===4)&&(R=_.stateNode.containerInfo,R===f||R.nodeType===8&&R.parentNode===f))return;_=_.return}for(;N!==null;){if(_=Ur(N),_===null)return;if(R=_.tag,R===5||R===6){a=h=_;continue e}N=N.parentNode}}a=a.return}lt(function(){var U=h,Q=oi(o),J=[];e:{var Y=Mc.get(t);if(Y!==void 0){var pe=xa,be=t;switch(t){case"keypress":if(Qo(o)===0)break e;case"keydown":case"keyup":pe=Fh;break;case"focusin":be="focus",pe=Ca;break;case"focusout":be="blur",pe=Ca;break;case"beforeblur":case"afterblur":pe=Ca;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":pe=uc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":pe=Nh;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":pe=$h;break;case Ac:case Rc:case Oc:pe=Ah;break;case Ic:pe=Hh;break;case"scroll":pe=xh;break;case"wheel":pe=Gh;break;case"copy":case"cut":case"paste":pe=Oh;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":pe=dc}var Ee=(n&4)!==0,gt=!Ee&&t==="scroll",z=Ee?Y!==null?Y+"Capture":null:Y;Ee=[];for(var M=U,B;M!==null;){B=M;var ie=B.stateNode;if(B.tag===5&&ie!==null&&(B=ie,z!==null&&(ie=he(M,z),ie!=null&&Ee.push(io(M,ie,B)))),gt)break;M=M.return}0<Ee.length&&(Y=new pe(Y,be,null,o,Q),J.push({event:Y,listeners:Ee}))}}if((n&7)===0){e:{if(Y=t==="mouseover"||t==="pointerover",pe=t==="mouseout"||t==="pointerout",Y&&o!==Tt&&(be=o.relatedTarget||o.fromElement)&&(Ur(be)||be[Xn]))break e;if((pe||Y)&&(Y=Q.window===Q?Q:(Y=Q.ownerDocument)?Y.defaultView||Y.parentWindow:window,pe?(be=o.relatedTarget||o.toElement,pe=U,be=be?Ur(be):null,be!==null&&(gt=Zn(be),be!==gt||be.tag!==5&&be.tag!==6)&&(be=null)):(pe=null,be=U),pe!==be)){if(Ee=uc,ie="onMouseLeave",z="onMouseEnter",M="mouse",(t==="pointerout"||t==="pointerover")&&(Ee=dc,ie="onPointerLeave",z="onPointerEnter",M="pointer"),gt=pe==null?Y:yi(pe),B=be==null?Y:yi(be),Y=new Ee(ie,M+"leave",pe,o,Q),Y.target=gt,Y.relatedTarget=B,ie=null,Ur(Q)===U&&(Ee=new Ee(z,M+"enter",be,o,Q),Ee.target=B,Ee.relatedTarget=gt,ie=Ee),gt=ie,pe&&be)t:{for(Ee=pe,z=be,M=0,B=Ee;B;B=hi(B))M++;for(B=0,ie=z;ie;ie=hi(ie))B++;for(;0<M-B;)Ee=hi(Ee),M--;for(;0<B-M;)z=hi(z),B--;for(;M--;){if(Ee===z||z!==null&&Ee===z.alternate)break t;Ee=hi(Ee),z=hi(z)}Ee=null}else Ee=null;pe!==null&&Fc(J,Y,pe,Ee,!1),be!==null&>!==null&&Fc(J,gt,be,Ee,!0)}}e:{if(Y=U?yi(U):window,pe=Y.nodeName&&Y.nodeName.toLowerCase(),pe==="select"||pe==="input"&&Y.type==="file")var _e=Xh;else if(yc(Y))if(Ec)_e=ng;else{_e=eg;var Se=Jh}else(pe=Y.nodeName)&&pe.toLowerCase()==="input"&&(Y.type==="checkbox"||Y.type==="radio")&&(_e=tg);if(_e&&(_e=_e(t,U))){bc(J,_e,o,Q);break e}Se&&Se(t,Y,U),t==="focusout"&&(Se=Y._wrapperState)&&Se.controlled&&Y.type==="number"&&Mn(Y,"number",Y.value)}switch(Se=U?yi(U):window,t){case"focusin":(yc(Se)||Se.contentEditable==="true")&&(pi=Se,Ma=U,to=null);break;case"focusout":to=Ma=pi=null;break;case"mousedown":La=!0;break;case"contextmenu":case"mouseup":case"dragend":La=!1,Cc(J,o,Q);break;case"selectionchange":if(og)break;case"keydown":case"keyup":Cc(J,o,Q)}var Ne;if(Aa)e:{switch(t){case"compositionstart":var Oe="onCompositionStart";break e;case"compositionend":Oe="onCompositionEnd";break e;case"compositionupdate":Oe="onCompositionUpdate";break e}Oe=void 0}else fi?hc(t,o)&&(Oe="onCompositionEnd"):t==="keydown"&&o.keyCode===229&&(Oe="onCompositionStart");Oe&&(fc&&o.locale!=="ko"&&(fi||Oe!=="onCompositionStart"?Oe==="onCompositionEnd"&&fi&&(Ne=ac()):(mr=Q,wa="value"in mr?mr.value:mr.textContent,fi=!0)),Se=rl(U,Oe),0<Se.length&&(Oe=new cc(Oe,t,null,o,Q),J.push({event:Oe,listeners:Se}),Ne?Oe.data=Ne:(Ne=gc(o),Ne!==null&&(Oe.data=Ne)))),(Ne=Vh?qh(t,o):Yh(t,o))&&(U=rl(U,"onBeforeInput"),0<U.length&&(Q=new cc("onBeforeInput","beforeinput",null,o,Q),J.push({event:Q,listeners:U}),Q.data=Ne))}Pc(J,n)})}function io(t,n,o){return{instance:t,listener:n,currentTarget:o}}function rl(t,n){for(var o=n+"Capture",a=[];t!==null;){var f=t,h=f.stateNode;f.tag===5&&h!==null&&(f=h,h=he(t,o),h!=null&&a.unshift(io(t,h,f)),h=he(t,n),h!=null&&a.push(io(t,h,f))),t=t.return}return a}function hi(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Fc(t,n,o,a,f){for(var h=n._reactName,_=[];o!==null&&o!==a;){var N=o,R=N.alternate,U=N.stateNode;if(R!==null&&R===a)break;N.tag===5&&U!==null&&(N=U,f?(R=he(o,h),R!=null&&_.unshift(io(o,R,N))):f||(R=he(o,h),R!=null&&_.push(io(o,R,N)))),o=o.return}_.length!==0&&t.push({event:n,listeners:_})}var ug=/\r\n?/g,cg=/\u0000|\uFFFD/g;function Bc(t){return(typeof t=="string"?t:""+t).replace(ug,` +`).replace(cg,"")}function il(t,n,o){if(n=Bc(n),Bc(t)!==n&&o)throw Error(r(425))}function ol(){}var Ua=null,$a=null;function ja(t,n){return t==="textarea"||t==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Ha=typeof setTimeout=="function"?setTimeout:void 0,dg=typeof clearTimeout=="function"?clearTimeout:void 0,Uc=typeof Promise=="function"?Promise:void 0,fg=typeof queueMicrotask=="function"?queueMicrotask:typeof Uc<"u"?function(t){return Uc.resolve(null).then(t).catch(pg)}:Ha;function pg(t){setTimeout(function(){throw t})}function Ka(t,n){var o=n,a=0;do{var f=o.nextSibling;if(t.removeChild(o),f&&f.nodeType===8)if(o=f.data,o==="/$"){if(a===0){t.removeChild(f),qi(n);return}a--}else o!=="$"&&o!=="$?"&&o!=="$!"||a++;o=f}while(o);qi(n)}function gr(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?")break;if(n==="/$")return null}}return t}function $c(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var o=t.data;if(o==="$"||o==="$!"||o==="$?"){if(n===0)return t;n--}else o==="/$"&&n++}t=t.previousSibling}return null}var gi=Math.random().toString(36).slice(2),Fn="__reactFiber$"+gi,oo="__reactProps$"+gi,Xn="__reactContainer$"+gi,Ga="__reactEvents$"+gi,mg="__reactListeners$"+gi,hg="__reactHandles$"+gi;function Ur(t){var n=t[Fn];if(n)return n;for(var o=t.parentNode;o;){if(n=o[Xn]||o[Fn]){if(o=n.alternate,n.child!==null||o!==null&&o.child!==null)for(t=$c(t);t!==null;){if(o=t[Fn])return o;t=$c(t)}return n}t=o,o=t.parentNode}return null}function lo(t){return t=t[Fn]||t[Xn],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function yi(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(r(33))}function ll(t){return t[oo]||null}var Wa=[],bi=-1;function yr(t){return{current:t}}function ot(t){0>bi||(t.current=Wa[bi],Wa[bi]=null,bi--)}function nt(t,n){bi++,Wa[bi]=t.current,t.current=n}var br={},Ot=yr(br),Wt=yr(!1),$r=br;function Ei(t,n){var o=t.type.contextTypes;if(!o)return br;var a=t.stateNode;if(a&&a.__reactInternalMemoizedUnmaskedChildContext===n)return a.__reactInternalMemoizedMaskedChildContext;var f={},h;for(h in o)f[h]=n[h];return a&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=n,t.__reactInternalMemoizedMaskedChildContext=f),f}function Vt(t){return t=t.childContextTypes,t!=null}function al(){ot(Wt),ot(Ot)}function jc(t,n,o){if(Ot.current!==br)throw Error(r(168));nt(Ot,n),nt(Wt,o)}function Hc(t,n,o){var a=t.stateNode;if(n=n.childContextTypes,typeof a.getChildContext!="function")return o;a=a.getChildContext();for(var f in a)if(!(f in n))throw Error(r(108,$e(t)||"Unknown",f));return v({},o,a)}function sl(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||br,$r=Ot.current,nt(Ot,t),nt(Wt,Wt.current),!0}function Kc(t,n,o){var a=t.stateNode;if(!a)throw Error(r(169));o?(t=Hc(t,n,$r),a.__reactInternalMemoizedMergedChildContext=t,ot(Wt),ot(Ot),nt(Ot,t)):ot(Wt),nt(Wt,o)}var Jn=null,ul=!1,Va=!1;function Gc(t){Jn===null?Jn=[t]:Jn.push(t)}function gg(t){ul=!0,Gc(t)}function Er(){if(!Va&&Jn!==null){Va=!0;var t=0,n=Ve;try{var o=Jn;for(Ve=1;t<o.length;t++){var a=o[t];do a=a(!0);while(a!==null)}Jn=null,ul=!1}catch(f){throw Jn!==null&&(Jn=Jn.slice(t+1)),$o(ji,Er),f}finally{Ve=n,Va=!1}}return null}var _i=[],vi=0,cl=null,dl=0,pn=[],mn=0,jr=null,er=1,tr="";function Hr(t,n){_i[vi++]=dl,_i[vi++]=cl,cl=t,dl=n}function Wc(t,n,o){pn[mn++]=er,pn[mn++]=tr,pn[mn++]=jr,jr=t;var a=er;t=tr;var f=32-ut(a)-1;a&=~(1<<f),o+=1;var h=32-ut(n)+f;if(30<h){var _=f-f%5;h=(a&(1<<_)-1).toString(32),a>>=_,f-=_,er=1<<32-ut(n)+f|o<<f|a,tr=h+t}else er=1<<h|o<<f|a,tr=t}function qa(t){t.return!==null&&(Hr(t,1),Wc(t,1,0))}function Ya(t){for(;t===cl;)cl=_i[--vi],_i[vi]=null,dl=_i[--vi],_i[vi]=null;for(;t===jr;)jr=pn[--mn],pn[mn]=null,tr=pn[--mn],pn[mn]=null,er=pn[--mn],pn[mn]=null}var rn=null,on=null,at=!1,Sn=null;function Vc(t,n){var o=bn(5,null,null,0);o.elementType="DELETED",o.stateNode=n,o.return=t,n=t.deletions,n===null?(t.deletions=[o],t.flags|=16):n.push(o)}function qc(t,n){switch(t.tag){case 5:var o=t.type;return n=n.nodeType!==1||o.toLowerCase()!==n.nodeName.toLowerCase()?null:n,n!==null?(t.stateNode=n,rn=t,on=gr(n.firstChild),!0):!1;case 6:return n=t.pendingProps===""||n.nodeType!==3?null:n,n!==null?(t.stateNode=n,rn=t,on=null,!0):!1;case 13:return n=n.nodeType!==8?null:n,n!==null?(o=jr!==null?{id:er,overflow:tr}:null,t.memoizedState={dehydrated:n,treeContext:o,retryLane:1073741824},o=bn(18,null,null,0),o.stateNode=n,o.return=t,t.child=o,rn=t,on=null,!0):!1;default:return!1}}function Qa(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Za(t){if(at){var n=on;if(n){var o=n;if(!qc(t,n)){if(Qa(t))throw Error(r(418));n=gr(o.nextSibling);var a=rn;n&&qc(t,n)?Vc(a,o):(t.flags=t.flags&-4097|2,at=!1,rn=t)}}else{if(Qa(t))throw Error(r(418));t.flags=t.flags&-4097|2,at=!1,rn=t}}}function Yc(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;rn=t}function fl(t){if(t!==rn)return!1;if(!at)return Yc(t),at=!0,!1;var n;if((n=t.tag!==3)&&!(n=t.tag!==5)&&(n=t.type,n=n!=="head"&&n!=="body"&&!ja(t.type,t.memoizedProps)),n&&(n=on)){if(Qa(t))throw Qc(),Error(r(418));for(;n;)Vc(t,n),n=gr(n.nextSibling)}if(Yc(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));e:{for(t=t.nextSibling,n=0;t;){if(t.nodeType===8){var o=t.data;if(o==="/$"){if(n===0){on=gr(t.nextSibling);break e}n--}else o!=="$"&&o!=="$!"&&o!=="$?"||n++}t=t.nextSibling}on=null}}else on=rn?gr(t.stateNode.nextSibling):null;return!0}function Qc(){for(var t=on;t;)t=gr(t.nextSibling)}function ki(){on=rn=null,at=!1}function Xa(t){Sn===null?Sn=[t]:Sn.push(t)}var yg=$.ReactCurrentBatchConfig;function ao(t,n,o){if(t=o.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(o._owner){if(o=o._owner,o){if(o.tag!==1)throw Error(r(309));var a=o.stateNode}if(!a)throw Error(r(147,t));var f=a,h=""+t;return n!==null&&n.ref!==null&&typeof n.ref=="function"&&n.ref._stringRef===h?n.ref:(n=function(_){var N=f.refs;_===null?delete N[h]:N[h]=_},n._stringRef=h,n)}if(typeof t!="string")throw Error(r(284));if(!o._owner)throw Error(r(290,t))}return t}function pl(t,n){throw t=Object.prototype.toString.call(n),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t))}function Zc(t){var n=t._init;return n(t._payload)}function Xc(t){function n(z,M){if(t){var B=z.deletions;B===null?(z.deletions=[M],z.flags|=16):B.push(M)}}function o(z,M){if(!t)return null;for(;M!==null;)n(z,M),M=M.sibling;return null}function a(z,M){for(z=new Map;M!==null;)M.key!==null?z.set(M.key,M):z.set(M.index,M),M=M.sibling;return z}function f(z,M){return z=Cr(z,M),z.index=0,z.sibling=null,z}function h(z,M,B){return z.index=B,t?(B=z.alternate,B!==null?(B=B.index,B<M?(z.flags|=2,M):B):(z.flags|=2,M)):(z.flags|=1048576,M)}function _(z){return t&&z.alternate===null&&(z.flags|=2),z}function N(z,M,B,ie){return M===null||M.tag!==6?(M=Hs(B,z.mode,ie),M.return=z,M):(M=f(M,B),M.return=z,M)}function R(z,M,B,ie){var _e=B.type;return _e===Z?Q(z,M,B.props.children,ie,B.key):M!==null&&(M.elementType===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===le&&Zc(_e)===M.type)?(ie=f(M,B.props),ie.ref=ao(z,M,B),ie.return=z,ie):(ie=zl(B.type,B.key,B.props,null,z.mode,ie),ie.ref=ao(z,M,B),ie.return=z,ie)}function U(z,M,B,ie){return M===null||M.tag!==4||M.stateNode.containerInfo!==B.containerInfo||M.stateNode.implementation!==B.implementation?(M=Ks(B,z.mode,ie),M.return=z,M):(M=f(M,B.children||[]),M.return=z,M)}function Q(z,M,B,ie,_e){return M===null||M.tag!==7?(M=Zr(B,z.mode,ie,_e),M.return=z,M):(M=f(M,B),M.return=z,M)}function J(z,M,B){if(typeof M=="string"&&M!==""||typeof M=="number")return M=Hs(""+M,z.mode,B),M.return=z,M;if(typeof M=="object"&&M!==null){switch(M.$$typeof){case K:return B=zl(M.type,M.key,M.props,null,z.mode,B),B.ref=ao(z,null,M),B.return=z,B;case I:return M=Ks(M,z.mode,B),M.return=z,M;case le:var ie=M._init;return J(z,ie(M._payload),B)}if(_n(M)||de(M))return M=Zr(M,z.mode,B,null),M.return=z,M;pl(z,M)}return null}function Y(z,M,B,ie){var _e=M!==null?M.key:null;if(typeof B=="string"&&B!==""||typeof B=="number")return _e!==null?null:N(z,M,""+B,ie);if(typeof B=="object"&&B!==null){switch(B.$$typeof){case K:return B.key===_e?R(z,M,B,ie):null;case I:return B.key===_e?U(z,M,B,ie):null;case le:return _e=B._init,Y(z,M,_e(B._payload),ie)}if(_n(B)||de(B))return _e!==null?null:Q(z,M,B,ie,null);pl(z,B)}return null}function pe(z,M,B,ie,_e){if(typeof ie=="string"&&ie!==""||typeof ie=="number")return z=z.get(B)||null,N(M,z,""+ie,_e);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case K:return z=z.get(ie.key===null?B:ie.key)||null,R(M,z,ie,_e);case I:return z=z.get(ie.key===null?B:ie.key)||null,U(M,z,ie,_e);case le:var Se=ie._init;return pe(z,M,B,Se(ie._payload),_e)}if(_n(ie)||de(ie))return z=z.get(B)||null,Q(M,z,ie,_e,null);pl(M,ie)}return null}function be(z,M,B,ie){for(var _e=null,Se=null,Ne=M,Oe=M=0,Ct=null;Ne!==null&&Oe<B.length;Oe++){Ne.index>Oe?(Ct=Ne,Ne=null):Ct=Ne.sibling;var Ye=Y(z,Ne,B[Oe],ie);if(Ye===null){Ne===null&&(Ne=Ct);break}t&&Ne&&Ye.alternate===null&&n(z,Ne),M=h(Ye,M,Oe),Se===null?_e=Ye:Se.sibling=Ye,Se=Ye,Ne=Ct}if(Oe===B.length)return o(z,Ne),at&&Hr(z,Oe),_e;if(Ne===null){for(;Oe<B.length;Oe++)Ne=J(z,B[Oe],ie),Ne!==null&&(M=h(Ne,M,Oe),Se===null?_e=Ne:Se.sibling=Ne,Se=Ne);return at&&Hr(z,Oe),_e}for(Ne=a(z,Ne);Oe<B.length;Oe++)Ct=pe(Ne,z,Oe,B[Oe],ie),Ct!==null&&(t&&Ct.alternate!==null&&Ne.delete(Ct.key===null?Oe:Ct.key),M=h(Ct,M,Oe),Se===null?_e=Ct:Se.sibling=Ct,Se=Ct);return t&&Ne.forEach(function(Tr){return n(z,Tr)}),at&&Hr(z,Oe),_e}function Ee(z,M,B,ie){var _e=de(B);if(typeof _e!="function")throw Error(r(150));if(B=_e.call(B),B==null)throw Error(r(151));for(var Se=_e=null,Ne=M,Oe=M=0,Ct=null,Ye=B.next();Ne!==null&&!Ye.done;Oe++,Ye=B.next()){Ne.index>Oe?(Ct=Ne,Ne=null):Ct=Ne.sibling;var Tr=Y(z,Ne,Ye.value,ie);if(Tr===null){Ne===null&&(Ne=Ct);break}t&&Ne&&Tr.alternate===null&&n(z,Ne),M=h(Tr,M,Oe),Se===null?_e=Tr:Se.sibling=Tr,Se=Tr,Ne=Ct}if(Ye.done)return o(z,Ne),at&&Hr(z,Oe),_e;if(Ne===null){for(;!Ye.done;Oe++,Ye=B.next())Ye=J(z,Ye.value,ie),Ye!==null&&(M=h(Ye,M,Oe),Se===null?_e=Ye:Se.sibling=Ye,Se=Ye);return at&&Hr(z,Oe),_e}for(Ne=a(z,Ne);!Ye.done;Oe++,Ye=B.next())Ye=pe(Ne,z,Oe,Ye.value,ie),Ye!==null&&(t&&Ye.alternate!==null&&Ne.delete(Ye.key===null?Oe:Ye.key),M=h(Ye,M,Oe),Se===null?_e=Ye:Se.sibling=Ye,Se=Ye);return t&&Ne.forEach(function(Qg){return n(z,Qg)}),at&&Hr(z,Oe),_e}function gt(z,M,B,ie){if(typeof B=="object"&&B!==null&&B.type===Z&&B.key===null&&(B=B.props.children),typeof B=="object"&&B!==null){switch(B.$$typeof){case K:e:{for(var _e=B.key,Se=M;Se!==null;){if(Se.key===_e){if(_e=B.type,_e===Z){if(Se.tag===7){o(z,Se.sibling),M=f(Se,B.props.children),M.return=z,z=M;break e}}else if(Se.elementType===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===le&&Zc(_e)===Se.type){o(z,Se.sibling),M=f(Se,B.props),M.ref=ao(z,Se,B),M.return=z,z=M;break e}o(z,Se);break}else n(z,Se);Se=Se.sibling}B.type===Z?(M=Zr(B.props.children,z.mode,ie,B.key),M.return=z,z=M):(ie=zl(B.type,B.key,B.props,null,z.mode,ie),ie.ref=ao(z,M,B),ie.return=z,z=ie)}return _(z);case I:e:{for(Se=B.key;M!==null;){if(M.key===Se)if(M.tag===4&&M.stateNode.containerInfo===B.containerInfo&&M.stateNode.implementation===B.implementation){o(z,M.sibling),M=f(M,B.children||[]),M.return=z,z=M;break e}else{o(z,M);break}else n(z,M);M=M.sibling}M=Ks(B,z.mode,ie),M.return=z,z=M}return _(z);case le:return Se=B._init,gt(z,M,Se(B._payload),ie)}if(_n(B))return be(z,M,B,ie);if(de(B))return Ee(z,M,B,ie);pl(z,B)}return typeof B=="string"&&B!==""||typeof B=="number"?(B=""+B,M!==null&&M.tag===6?(o(z,M.sibling),M=f(M,B),M.return=z,z=M):(o(z,M),M=Hs(B,z.mode,ie),M.return=z,z=M),_(z)):o(z,M)}return gt}var wi=Xc(!0),Jc=Xc(!1),ml=yr(null),hl=null,xi=null,Ja=null;function es(){Ja=xi=hl=null}function ts(t){var n=ml.current;ot(ml),t._currentValue=n}function ns(t,n,o){for(;t!==null;){var a=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,a!==null&&(a.childLanes|=n)):a!==null&&(a.childLanes&n)!==n&&(a.childLanes|=n),t===o)break;t=t.return}}function Si(t,n){hl=t,Ja=xi=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&n)!==0&&(qt=!0),t.firstContext=null)}function hn(t){var n=t._currentValue;if(Ja!==t)if(t={context:t,memoizedValue:n,next:null},xi===null){if(hl===null)throw Error(r(308));xi=t,hl.dependencies={lanes:0,firstContext:t}}else xi=xi.next=t;return n}var Kr=null;function rs(t){Kr===null?Kr=[t]:Kr.push(t)}function ed(t,n,o,a){var f=n.interleaved;return f===null?(o.next=o,rs(n)):(o.next=f.next,f.next=o),n.interleaved=o,nr(t,a)}function nr(t,n){t.lanes|=n;var o=t.alternate;for(o!==null&&(o.lanes|=n),o=t,t=t.return;t!==null;)t.childLanes|=n,o=t.alternate,o!==null&&(o.childLanes|=n),o=t,t=t.return;return o.tag===3?o.stateNode:null}var _r=!1;function is(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function td(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function rr(t,n){return{eventTime:t,lane:n,tag:0,payload:null,callback:null,next:null}}function vr(t,n,o){var a=t.updateQueue;if(a===null)return null;if(a=a.shared,(qe&2)!==0){var f=a.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),a.pending=n,nr(t,o)}return f=a.interleaved,f===null?(n.next=n,rs(a)):(n.next=f.next,f.next=n),a.interleaved=n,nr(t,o)}function gl(t,n,o){if(n=n.updateQueue,n!==null&&(n=n.shared,(o&4194240)!==0)){var a=n.lanes;a&=t.pendingLanes,o|=a,n.lanes=o,Ki(t,o)}}function nd(t,n){var o=t.updateQueue,a=t.alternate;if(a!==null&&(a=a.updateQueue,o===a)){var f=null,h=null;if(o=o.firstBaseUpdate,o!==null){do{var _={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};h===null?f=h=_:h=h.next=_,o=o.next}while(o!==null);h===null?f=h=n:h=h.next=n}else f=h=n;o={baseState:a.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:a.shared,effects:a.effects},t.updateQueue=o;return}t=o.lastBaseUpdate,t===null?o.firstBaseUpdate=n:t.next=n,o.lastBaseUpdate=n}function yl(t,n,o,a){var f=t.updateQueue;_r=!1;var h=f.firstBaseUpdate,_=f.lastBaseUpdate,N=f.shared.pending;if(N!==null){f.shared.pending=null;var R=N,U=R.next;R.next=null,_===null?h=U:_.next=U,_=R;var Q=t.alternate;Q!==null&&(Q=Q.updateQueue,N=Q.lastBaseUpdate,N!==_&&(N===null?Q.firstBaseUpdate=U:N.next=U,Q.lastBaseUpdate=R))}if(h!==null){var J=f.baseState;_=0,Q=U=R=null,N=h;do{var Y=N.lane,pe=N.eventTime;if((a&Y)===Y){Q!==null&&(Q=Q.next={eventTime:pe,lane:0,tag:N.tag,payload:N.payload,callback:N.callback,next:null});e:{var be=t,Ee=N;switch(Y=n,pe=o,Ee.tag){case 1:if(be=Ee.payload,typeof be=="function"){J=be.call(pe,J,Y);break e}J=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Ee.payload,Y=typeof be=="function"?be.call(pe,J,Y):be,Y==null)break e;J=v({},J,Y);break e;case 2:_r=!0}}N.callback!==null&&N.lane!==0&&(t.flags|=64,Y=f.effects,Y===null?f.effects=[N]:Y.push(N))}else pe={eventTime:pe,lane:Y,tag:N.tag,payload:N.payload,callback:N.callback,next:null},Q===null?(U=Q=pe,R=J):Q=Q.next=pe,_|=Y;if(N=N.next,N===null){if(N=f.shared.pending,N===null)break;Y=N,N=Y.next,Y.next=null,f.lastBaseUpdate=Y,f.shared.pending=null}}while(!0);if(Q===null&&(R=J),f.baseState=R,f.firstBaseUpdate=U,f.lastBaseUpdate=Q,n=f.shared.interleaved,n!==null){f=n;do _|=f.lane,f=f.next;while(f!==n)}else h===null&&(f.shared.lanes=0);Vr|=_,t.lanes=_,t.memoizedState=J}}function rd(t,n,o){if(t=n.effects,n.effects=null,t!==null)for(n=0;n<t.length;n++){var a=t[n],f=a.callback;if(f!==null){if(a.callback=null,a=o,typeof f!="function")throw Error(r(191,f));f.call(a)}}}var so={},Bn=yr(so),uo=yr(so),co=yr(so);function Gr(t){if(t===so)throw Error(r(174));return t}function os(t,n){switch(nt(co,n),nt(uo,t),nt(Bn,so),t=n.nodeType,t){case 9:case 11:n=(n=n.documentElement)?n.namespaceURI:oe(null,"");break;default:t=t===8?n.parentNode:n,n=t.namespaceURI||null,t=t.tagName,n=oe(n,t)}ot(Bn),nt(Bn,n)}function Ni(){ot(Bn),ot(uo),ot(co)}function id(t){Gr(co.current);var n=Gr(Bn.current),o=oe(n,t.type);n!==o&&(nt(uo,t),nt(Bn,o))}function ls(t){uo.current===t&&(ot(Bn),ot(uo))}var ct=yr(0);function bl(t){for(var n=t;n!==null;){if(n.tag===13){var o=n.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||o.data==="$?"||o.data==="$!"))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!==void 0){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var as=[];function ss(){for(var t=0;t<as.length;t++)as[t]._workInProgressVersionPrimary=null;as.length=0}var El=$.ReactCurrentDispatcher,us=$.ReactCurrentBatchConfig,Wr=0,dt=null,kt=null,St=null,_l=!1,fo=!1,po=0,bg=0;function It(){throw Error(r(321))}function cs(t,n){if(n===null)return!1;for(var o=0;o<n.length&&o<t.length;o++)if(!xn(t[o],n[o]))return!1;return!0}function ds(t,n,o,a,f,h){if(Wr=h,dt=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,El.current=t===null||t.memoizedState===null?kg:wg,t=o(a,f),fo){h=0;do{if(fo=!1,po=0,25<=h)throw Error(r(301));h+=1,St=kt=null,n.updateQueue=null,El.current=xg,t=o(a,f)}while(fo)}if(El.current=wl,n=kt!==null&&kt.next!==null,Wr=0,St=kt=dt=null,_l=!1,n)throw Error(r(300));return t}function fs(){var t=po!==0;return po=0,t}function Un(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return St===null?dt.memoizedState=St=t:St=St.next=t,St}function gn(){if(kt===null){var t=dt.alternate;t=t!==null?t.memoizedState:null}else t=kt.next;var n=St===null?dt.memoizedState:St.next;if(n!==null)St=n,kt=t;else{if(t===null)throw Error(r(310));kt=t,t={memoizedState:kt.memoizedState,baseState:kt.baseState,baseQueue:kt.baseQueue,queue:kt.queue,next:null},St===null?dt.memoizedState=St=t:St=St.next=t}return St}function mo(t,n){return typeof n=="function"?n(t):n}function ps(t){var n=gn(),o=n.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=t;var a=kt,f=a.baseQueue,h=o.pending;if(h!==null){if(f!==null){var _=f.next;f.next=h.next,h.next=_}a.baseQueue=f=h,o.pending=null}if(f!==null){h=f.next,a=a.baseState;var N=_=null,R=null,U=h;do{var Q=U.lane;if((Wr&Q)===Q)R!==null&&(R=R.next={lane:0,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),a=U.hasEagerState?U.eagerState:t(a,U.action);else{var J={lane:Q,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null};R===null?(N=R=J,_=a):R=R.next=J,dt.lanes|=Q,Vr|=Q}U=U.next}while(U!==null&&U!==h);R===null?_=a:R.next=N,xn(a,n.memoizedState)||(qt=!0),n.memoizedState=a,n.baseState=_,n.baseQueue=R,o.lastRenderedState=a}if(t=o.interleaved,t!==null){f=t;do h=f.lane,dt.lanes|=h,Vr|=h,f=f.next;while(f!==t)}else f===null&&(o.lanes=0);return[n.memoizedState,o.dispatch]}function ms(t){var n=gn(),o=n.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=t;var a=o.dispatch,f=o.pending,h=n.memoizedState;if(f!==null){o.pending=null;var _=f=f.next;do h=t(h,_.action),_=_.next;while(_!==f);xn(h,n.memoizedState)||(qt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),o.lastRenderedState=h}return[h,a]}function od(){}function ld(t,n){var o=dt,a=gn(),f=n(),h=!xn(a.memoizedState,f);if(h&&(a.memoizedState=f,qt=!0),a=a.queue,hs(ud.bind(null,o,a,t),[t]),a.getSnapshot!==n||h||St!==null&&St.memoizedState.tag&1){if(o.flags|=2048,ho(9,sd.bind(null,o,a,f,n),void 0,null),Nt===null)throw Error(r(349));(Wr&30)!==0||ad(o,n,f)}return f}function ad(t,n,o){t.flags|=16384,t={getSnapshot:n,value:o},n=dt.updateQueue,n===null?(n={lastEffect:null,stores:null},dt.updateQueue=n,n.stores=[t]):(o=n.stores,o===null?n.stores=[t]:o.push(t))}function sd(t,n,o,a){n.value=o,n.getSnapshot=a,cd(n)&&dd(t)}function ud(t,n,o){return o(function(){cd(n)&&dd(t)})}function cd(t){var n=t.getSnapshot;t=t.value;try{var o=n();return!xn(t,o)}catch{return!0}}function dd(t){var n=nr(t,1);n!==null&&An(n,t,1,-1)}function fd(t){var n=Un();return typeof t=="function"&&(t=t()),n.memoizedState=n.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:mo,lastRenderedState:t},n.queue=t,t=t.dispatch=vg.bind(null,dt,t),[n.memoizedState,t]}function ho(t,n,o,a){return t={tag:t,create:n,destroy:o,deps:a,next:null},n=dt.updateQueue,n===null?(n={lastEffect:null,stores:null},dt.updateQueue=n,n.lastEffect=t.next=t):(o=n.lastEffect,o===null?n.lastEffect=t.next=t:(a=o.next,o.next=t,t.next=a,n.lastEffect=t)),t}function pd(){return gn().memoizedState}function vl(t,n,o,a){var f=Un();dt.flags|=t,f.memoizedState=ho(1|n,o,void 0,a===void 0?null:a)}function kl(t,n,o,a){var f=gn();a=a===void 0?null:a;var h=void 0;if(kt!==null){var _=kt.memoizedState;if(h=_.destroy,a!==null&&cs(a,_.deps)){f.memoizedState=ho(n,o,h,a);return}}dt.flags|=t,f.memoizedState=ho(1|n,o,h,a)}function md(t,n){return vl(8390656,8,t,n)}function hs(t,n){return kl(2048,8,t,n)}function hd(t,n){return kl(4,2,t,n)}function gd(t,n){return kl(4,4,t,n)}function yd(t,n){if(typeof n=="function")return t=t(),n(t),function(){n(null)};if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function bd(t,n,o){return o=o!=null?o.concat([t]):null,kl(4,4,yd.bind(null,n,t),o)}function gs(){}function Ed(t,n){var o=gn();n=n===void 0?null:n;var a=o.memoizedState;return a!==null&&n!==null&&cs(n,a[1])?a[0]:(o.memoizedState=[t,n],t)}function _d(t,n){var o=gn();n=n===void 0?null:n;var a=o.memoizedState;return a!==null&&n!==null&&cs(n,a[1])?a[0]:(t=t(),o.memoizedState=[t,n],t)}function vd(t,n,o){return(Wr&21)===0?(t.baseState&&(t.baseState=!1,qt=!0),t.memoizedState=o):(xn(o,n)||(o=Ko(),dt.lanes|=o,Vr|=o,t.baseState=!0),n)}function Eg(t,n){var o=Ve;Ve=o!==0&&4>o?o:4,t(!0);var a=us.transition;us.transition={};try{t(!1),n()}finally{Ve=o,us.transition=a}}function kd(){return gn().memoizedState}function _g(t,n,o){var a=Sr(t);if(o={lane:a,action:o,hasEagerState:!1,eagerState:null,next:null},wd(t))xd(n,o);else if(o=ed(t,n,o,a),o!==null){var f=Ut();An(o,t,a,f),Sd(o,n,a)}}function vg(t,n,o){var a=Sr(t),f={lane:a,action:o,hasEagerState:!1,eagerState:null,next:null};if(wd(t))xd(n,f);else{var h=t.alternate;if(t.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var _=n.lastRenderedState,N=h(_,o);if(f.hasEagerState=!0,f.eagerState=N,xn(N,_)){var R=n.interleaved;R===null?(f.next=f,rs(n)):(f.next=R.next,R.next=f),n.interleaved=f;return}}catch{}finally{}o=ed(t,n,f,a),o!==null&&(f=Ut(),An(o,t,a,f),Sd(o,n,a))}}function wd(t){var n=t.alternate;return t===dt||n!==null&&n===dt}function xd(t,n){fo=_l=!0;var o=t.pending;o===null?n.next=n:(n.next=o.next,o.next=n),t.pending=n}function Sd(t,n,o){if((o&4194240)!==0){var a=n.lanes;a&=t.pendingLanes,o|=a,n.lanes=o,Ki(t,o)}}var wl={readContext:hn,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useInsertionEffect:It,useLayoutEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useMutableSource:It,useSyncExternalStore:It,useId:It,unstable_isNewReconciler:!1},kg={readContext:hn,useCallback:function(t,n){return Un().memoizedState=[t,n===void 0?null:n],t},useContext:hn,useEffect:md,useImperativeHandle:function(t,n,o){return o=o!=null?o.concat([t]):null,vl(4194308,4,yd.bind(null,n,t),o)},useLayoutEffect:function(t,n){return vl(4194308,4,t,n)},useInsertionEffect:function(t,n){return vl(4,2,t,n)},useMemo:function(t,n){var o=Un();return n=n===void 0?null:n,t=t(),o.memoizedState=[t,n],t},useReducer:function(t,n,o){var a=Un();return n=o!==void 0?o(n):n,a.memoizedState=a.baseState=n,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:n},a.queue=t,t=t.dispatch=_g.bind(null,dt,t),[a.memoizedState,t]},useRef:function(t){var n=Un();return t={current:t},n.memoizedState=t},useState:fd,useDebugValue:gs,useDeferredValue:function(t){return Un().memoizedState=t},useTransition:function(){var t=fd(!1),n=t[0];return t=Eg.bind(null,t[1]),Un().memoizedState=t,[n,t]},useMutableSource:function(){},useSyncExternalStore:function(t,n,o){var a=dt,f=Un();if(at){if(o===void 0)throw Error(r(407));o=o()}else{if(o=n(),Nt===null)throw Error(r(349));(Wr&30)!==0||ad(a,n,o)}f.memoizedState=o;var h={value:o,getSnapshot:n};return f.queue=h,md(ud.bind(null,a,h,t),[t]),a.flags|=2048,ho(9,sd.bind(null,a,h,o,n),void 0,null),o},useId:function(){var t=Un(),n=Nt.identifierPrefix;if(at){var o=tr,a=er;o=(a&~(1<<32-ut(a)-1)).toString(32)+o,n=":"+n+"R"+o,o=po++,0<o&&(n+="H"+o.toString(32)),n+=":"}else o=bg++,n=":"+n+"r"+o.toString(32)+":";return t.memoizedState=n},unstable_isNewReconciler:!1},wg={readContext:hn,useCallback:Ed,useContext:hn,useEffect:hs,useImperativeHandle:bd,useInsertionEffect:hd,useLayoutEffect:gd,useMemo:_d,useReducer:ps,useRef:pd,useState:function(){return ps(mo)},useDebugValue:gs,useDeferredValue:function(t){var n=gn();return vd(n,kt.memoizedState,t)},useTransition:function(){var t=ps(mo)[0],n=gn().memoizedState;return[t,n]},useMutableSource:od,useSyncExternalStore:ld,useId:kd,unstable_isNewReconciler:!1},xg={readContext:hn,useCallback:Ed,useContext:hn,useEffect:hs,useImperativeHandle:bd,useInsertionEffect:hd,useLayoutEffect:gd,useMemo:_d,useReducer:ms,useRef:pd,useState:function(){return ms(mo)},useDebugValue:gs,useDeferredValue:function(t){var n=gn();return kt===null?n.memoizedState=t:vd(n,kt.memoizedState,t)},useTransition:function(){var t=ms(mo)[0],n=gn().memoizedState;return[t,n]},useMutableSource:od,useSyncExternalStore:ld,useId:kd,unstable_isNewReconciler:!1};function Nn(t,n){if(t&&t.defaultProps){n=v({},n),t=t.defaultProps;for(var o in t)n[o]===void 0&&(n[o]=t[o]);return n}return n}function ys(t,n,o,a){n=t.memoizedState,o=o(a,n),o=o==null?n:v({},n,o),t.memoizedState=o,t.lanes===0&&(t.updateQueue.baseState=o)}var xl={isMounted:function(t){return(t=t._reactInternals)?Zn(t)===t:!1},enqueueSetState:function(t,n,o){t=t._reactInternals;var a=Ut(),f=Sr(t),h=rr(a,f);h.payload=n,o!=null&&(h.callback=o),n=vr(t,h,f),n!==null&&(An(n,t,f,a),gl(n,t,f))},enqueueReplaceState:function(t,n,o){t=t._reactInternals;var a=Ut(),f=Sr(t),h=rr(a,f);h.tag=1,h.payload=n,o!=null&&(h.callback=o),n=vr(t,h,f),n!==null&&(An(n,t,f,a),gl(n,t,f))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var o=Ut(),a=Sr(t),f=rr(o,a);f.tag=2,n!=null&&(f.callback=n),n=vr(t,f,a),n!==null&&(An(n,t,a,o),gl(n,t,a))}};function Nd(t,n,o,a,f,h,_){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(a,h,_):n.prototype&&n.prototype.isPureReactComponent?!eo(o,a)||!eo(f,h):!0}function Cd(t,n,o){var a=!1,f=br,h=n.contextType;return typeof h=="object"&&h!==null?h=hn(h):(f=Vt(n)?$r:Ot.current,a=n.contextTypes,h=(a=a!=null)?Ei(t,f):br),n=new n(o,h),t.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,n.updater=xl,t.stateNode=n,n._reactInternals=t,a&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=f,t.__reactInternalMemoizedMaskedChildContext=h),n}function Td(t,n,o,a){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(o,a),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(o,a),n.state!==t&&xl.enqueueReplaceState(n,n.state,null)}function bs(t,n,o,a){var f=t.stateNode;f.props=o,f.state=t.memoizedState,f.refs={},is(t);var h=n.contextType;typeof h=="object"&&h!==null?f.context=hn(h):(h=Vt(n)?$r:Ot.current,f.context=Ei(t,h)),f.state=t.memoizedState,h=n.getDerivedStateFromProps,typeof h=="function"&&(ys(t,n,h,o),f.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(n=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),n!==f.state&&xl.enqueueReplaceState(f,f.state,null),yl(t,o,f,a),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308)}function Ci(t,n){try{var o="",a=n;do o+=Me(a),a=a.return;while(a);var f=o}catch(h){f=` +Error generating stack: `+h.message+` +`+h.stack}return{value:t,source:n,stack:f,digest:null}}function Es(t,n,o){return{value:t,source:null,stack:o??null,digest:n??null}}function _s(t,n){try{console.error(n.value)}catch(o){setTimeout(function(){throw o})}}var Sg=typeof WeakMap=="function"?WeakMap:Map;function Ad(t,n,o){o=rr(-1,o),o.tag=3,o.payload={element:null};var a=n.value;return o.callback=function(){Ol||(Ol=!0,Ds=a),_s(t,n)},o}function Rd(t,n,o){o=rr(-1,o),o.tag=3;var a=t.type.getDerivedStateFromError;if(typeof a=="function"){var f=n.value;o.payload=function(){return a(f)},o.callback=function(){_s(t,n)}}var h=t.stateNode;return h!==null&&typeof h.componentDidCatch=="function"&&(o.callback=function(){_s(t,n),typeof a!="function"&&(wr===null?wr=new Set([this]):wr.add(this));var _=n.stack;this.componentDidCatch(n.value,{componentStack:_!==null?_:""})}),o}function Od(t,n,o){var a=t.pingCache;if(a===null){a=t.pingCache=new Sg;var f=new Set;a.set(n,f)}else f=a.get(n),f===void 0&&(f=new Set,a.set(n,f));f.has(o)||(f.add(o),t=Bg.bind(null,t,n,o),n.then(t,t))}function Id(t){do{var n;if((n=t.tag===13)&&(n=t.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return t;t=t.return}while(t!==null);return null}function Md(t,n,o,a,f){return(t.mode&1)===0?(t===n?t.flags|=65536:(t.flags|=128,o.flags|=131072,o.flags&=-52805,o.tag===1&&(o.alternate===null?o.tag=17:(n=rr(-1,1),n.tag=2,vr(o,n,1))),o.lanes|=1),t):(t.flags|=65536,t.lanes=f,t)}var Ng=$.ReactCurrentOwner,qt=!1;function Bt(t,n,o,a){n.child=t===null?Jc(n,null,o,a):wi(n,t.child,o,a)}function Ld(t,n,o,a,f){o=o.render;var h=n.ref;return Si(n,f),a=ds(t,n,o,a,h,f),o=fs(),t!==null&&!qt?(n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~f,ir(t,n,f)):(at&&o&&qa(n),n.flags|=1,Bt(t,n,a,f),n.child)}function Dd(t,n,o,a,f){if(t===null){var h=o.type;return typeof h=="function"&&!js(h)&&h.defaultProps===void 0&&o.compare===null&&o.defaultProps===void 0?(n.tag=15,n.type=h,Pd(t,n,h,a,f)):(t=zl(o.type,null,a,n,n.mode,f),t.ref=n.ref,t.return=n,n.child=t)}if(h=t.child,(t.lanes&f)===0){var _=h.memoizedProps;if(o=o.compare,o=o!==null?o:eo,o(_,a)&&t.ref===n.ref)return ir(t,n,f)}return n.flags|=1,t=Cr(h,a),t.ref=n.ref,t.return=n,n.child=t}function Pd(t,n,o,a,f){if(t!==null){var h=t.memoizedProps;if(eo(h,a)&&t.ref===n.ref)if(qt=!1,n.pendingProps=a=h,(t.lanes&f)!==0)(t.flags&131072)!==0&&(qt=!0);else return n.lanes=t.lanes,ir(t,n,f)}return vs(t,n,o,a,f)}function zd(t,n,o){var a=n.pendingProps,f=a.children,h=t!==null?t.memoizedState:null;if(a.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},nt(Ai,ln),ln|=o;else{if((o&1073741824)===0)return t=h!==null?h.baseLanes|o:o,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:t,cachePool:null,transitions:null},n.updateQueue=null,nt(Ai,ln),ln|=t,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},a=h!==null?h.baseLanes:o,nt(Ai,ln),ln|=a}else h!==null?(a=h.baseLanes|o,n.memoizedState=null):a=o,nt(Ai,ln),ln|=a;return Bt(t,n,f,o),n.child}function Fd(t,n){var o=n.ref;(t===null&&o!==null||t!==null&&t.ref!==o)&&(n.flags|=512,n.flags|=2097152)}function vs(t,n,o,a,f){var h=Vt(o)?$r:Ot.current;return h=Ei(n,h),Si(n,f),o=ds(t,n,o,a,h,f),a=fs(),t!==null&&!qt?(n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~f,ir(t,n,f)):(at&&a&&qa(n),n.flags|=1,Bt(t,n,o,f),n.child)}function Bd(t,n,o,a,f){if(Vt(o)){var h=!0;sl(n)}else h=!1;if(Si(n,f),n.stateNode===null)Nl(t,n),Cd(n,o,a),bs(n,o,a,f),a=!0;else if(t===null){var _=n.stateNode,N=n.memoizedProps;_.props=N;var R=_.context,U=o.contextType;typeof U=="object"&&U!==null?U=hn(U):(U=Vt(o)?$r:Ot.current,U=Ei(n,U));var Q=o.getDerivedStateFromProps,J=typeof Q=="function"||typeof _.getSnapshotBeforeUpdate=="function";J||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(N!==a||R!==U)&&Td(n,_,a,U),_r=!1;var Y=n.memoizedState;_.state=Y,yl(n,a,_,f),R=n.memoizedState,N!==a||Y!==R||Wt.current||_r?(typeof Q=="function"&&(ys(n,o,Q,a),R=n.memoizedState),(N=_r||Nd(n,o,N,a,Y,R,U))?(J||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount()),typeof _.componentDidMount=="function"&&(n.flags|=4194308)):(typeof _.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=a,n.memoizedState=R),_.props=a,_.state=R,_.context=U,a=N):(typeof _.componentDidMount=="function"&&(n.flags|=4194308),a=!1)}else{_=n.stateNode,td(t,n),N=n.memoizedProps,U=n.type===n.elementType?N:Nn(n.type,N),_.props=U,J=n.pendingProps,Y=_.context,R=o.contextType,typeof R=="object"&&R!==null?R=hn(R):(R=Vt(o)?$r:Ot.current,R=Ei(n,R));var pe=o.getDerivedStateFromProps;(Q=typeof pe=="function"||typeof _.getSnapshotBeforeUpdate=="function")||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(N!==J||Y!==R)&&Td(n,_,a,R),_r=!1,Y=n.memoizedState,_.state=Y,yl(n,a,_,f);var be=n.memoizedState;N!==J||Y!==be||Wt.current||_r?(typeof pe=="function"&&(ys(n,o,pe,a),be=n.memoizedState),(U=_r||Nd(n,o,U,a,Y,be,R)||!1)?(Q||typeof _.UNSAFE_componentWillUpdate!="function"&&typeof _.componentWillUpdate!="function"||(typeof _.componentWillUpdate=="function"&&_.componentWillUpdate(a,be,R),typeof _.UNSAFE_componentWillUpdate=="function"&&_.UNSAFE_componentWillUpdate(a,be,R)),typeof _.componentDidUpdate=="function"&&(n.flags|=4),typeof _.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof _.componentDidUpdate!="function"||N===t.memoizedProps&&Y===t.memoizedState||(n.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||N===t.memoizedProps&&Y===t.memoizedState||(n.flags|=1024),n.memoizedProps=a,n.memoizedState=be),_.props=a,_.state=be,_.context=R,a=U):(typeof _.componentDidUpdate!="function"||N===t.memoizedProps&&Y===t.memoizedState||(n.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||N===t.memoizedProps&&Y===t.memoizedState||(n.flags|=1024),a=!1)}return ks(t,n,o,a,h,f)}function ks(t,n,o,a,f,h){Fd(t,n);var _=(n.flags&128)!==0;if(!a&&!_)return f&&Kc(n,o,!1),ir(t,n,h);a=n.stateNode,Ng.current=n;var N=_&&typeof o.getDerivedStateFromError!="function"?null:a.render();return n.flags|=1,t!==null&&_?(n.child=wi(n,t.child,null,h),n.child=wi(n,null,N,h)):Bt(t,n,N,h),n.memoizedState=a.state,f&&Kc(n,o,!0),n.child}function Ud(t){var n=t.stateNode;n.pendingContext?jc(t,n.pendingContext,n.pendingContext!==n.context):n.context&&jc(t,n.context,!1),os(t,n.containerInfo)}function $d(t,n,o,a,f){return ki(),Xa(f),n.flags|=256,Bt(t,n,o,a),n.child}var ws={dehydrated:null,treeContext:null,retryLane:0};function xs(t){return{baseLanes:t,cachePool:null,transitions:null}}function jd(t,n,o){var a=n.pendingProps,f=ct.current,h=!1,_=(n.flags&128)!==0,N;if((N=_)||(N=t!==null&&t.memoizedState===null?!1:(f&2)!==0),N?(h=!0,n.flags&=-129):(t===null||t.memoizedState!==null)&&(f|=1),nt(ct,f&1),t===null)return Za(n),t=n.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((n.mode&1)===0?n.lanes=1:t.data==="$!"?n.lanes=8:n.lanes=1073741824,null):(_=a.children,t=a.fallback,h?(a=n.mode,h=n.child,_={mode:"hidden",children:_},(a&1)===0&&h!==null?(h.childLanes=0,h.pendingProps=_):h=Fl(_,a,0,null),t=Zr(t,a,o,null),h.return=n,t.return=n,h.sibling=t,n.child=h,n.child.memoizedState=xs(o),n.memoizedState=ws,t):Ss(n,_));if(f=t.memoizedState,f!==null&&(N=f.dehydrated,N!==null))return Cg(t,n,_,a,N,f,o);if(h){h=a.fallback,_=n.mode,f=t.child,N=f.sibling;var R={mode:"hidden",children:a.children};return(_&1)===0&&n.child!==f?(a=n.child,a.childLanes=0,a.pendingProps=R,n.deletions=null):(a=Cr(f,R),a.subtreeFlags=f.subtreeFlags&14680064),N!==null?h=Cr(N,h):(h=Zr(h,_,o,null),h.flags|=2),h.return=n,a.return=n,a.sibling=h,n.child=a,a=h,h=n.child,_=t.child.memoizedState,_=_===null?xs(o):{baseLanes:_.baseLanes|o,cachePool:null,transitions:_.transitions},h.memoizedState=_,h.childLanes=t.childLanes&~o,n.memoizedState=ws,a}return h=t.child,t=h.sibling,a=Cr(h,{mode:"visible",children:a.children}),(n.mode&1)===0&&(a.lanes=o),a.return=n,a.sibling=null,t!==null&&(o=n.deletions,o===null?(n.deletions=[t],n.flags|=16):o.push(t)),n.child=a,n.memoizedState=null,a}function Ss(t,n){return n=Fl({mode:"visible",children:n},t.mode,0,null),n.return=t,t.child=n}function Sl(t,n,o,a){return a!==null&&Xa(a),wi(n,t.child,null,o),t=Ss(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function Cg(t,n,o,a,f,h,_){if(o)return n.flags&256?(n.flags&=-257,a=Es(Error(r(422))),Sl(t,n,_,a)):n.memoizedState!==null?(n.child=t.child,n.flags|=128,null):(h=a.fallback,f=n.mode,a=Fl({mode:"visible",children:a.children},f,0,null),h=Zr(h,f,_,null),h.flags|=2,a.return=n,h.return=n,a.sibling=h,n.child=a,(n.mode&1)!==0&&wi(n,t.child,null,_),n.child.memoizedState=xs(_),n.memoizedState=ws,h);if((n.mode&1)===0)return Sl(t,n,_,null);if(f.data==="$!"){if(a=f.nextSibling&&f.nextSibling.dataset,a)var N=a.dgst;return a=N,h=Error(r(419)),a=Es(h,a,void 0),Sl(t,n,_,a)}if(N=(_&t.childLanes)!==0,qt||N){if(a=Nt,a!==null){switch(_&-_){case 4:f=2;break;case 16:f=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:f=32;break;case 536870912:f=268435456;break;default:f=0}f=(f&(a.suspendedLanes|_))!==0?0:f,f!==0&&f!==h.retryLane&&(h.retryLane=f,nr(t,f),An(a,t,f,-1))}return $s(),a=Es(Error(r(421))),Sl(t,n,_,a)}return f.data==="$?"?(n.flags|=128,n.child=t.child,n=Ug.bind(null,t),f._reactRetry=n,null):(t=h.treeContext,on=gr(f.nextSibling),rn=n,at=!0,Sn=null,t!==null&&(pn[mn++]=er,pn[mn++]=tr,pn[mn++]=jr,er=t.id,tr=t.overflow,jr=n),n=Ss(n,a.children),n.flags|=4096,n)}function Hd(t,n,o){t.lanes|=n;var a=t.alternate;a!==null&&(a.lanes|=n),ns(t.return,n,o)}function Ns(t,n,o,a,f){var h=t.memoizedState;h===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:a,tail:o,tailMode:f}:(h.isBackwards=n,h.rendering=null,h.renderingStartTime=0,h.last=a,h.tail=o,h.tailMode=f)}function Kd(t,n,o){var a=n.pendingProps,f=a.revealOrder,h=a.tail;if(Bt(t,n,a.children,o),a=ct.current,(a&2)!==0)a=a&1|2,n.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Hd(t,o,n);else if(t.tag===19)Hd(t,o,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}a&=1}if(nt(ct,a),(n.mode&1)===0)n.memoizedState=null;else switch(f){case"forwards":for(o=n.child,f=null;o!==null;)t=o.alternate,t!==null&&bl(t)===null&&(f=o),o=o.sibling;o=f,o===null?(f=n.child,n.child=null):(f=o.sibling,o.sibling=null),Ns(n,!1,f,o,h);break;case"backwards":for(o=null,f=n.child,n.child=null;f!==null;){if(t=f.alternate,t!==null&&bl(t)===null){n.child=f;break}t=f.sibling,f.sibling=o,o=f,f=t}Ns(n,!0,o,null,h);break;case"together":Ns(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function Nl(t,n){(n.mode&1)===0&&t!==null&&(t.alternate=null,n.alternate=null,n.flags|=2)}function ir(t,n,o){if(t!==null&&(n.dependencies=t.dependencies),Vr|=n.lanes,(o&n.childLanes)===0)return null;if(t!==null&&n.child!==t.child)throw Error(r(153));if(n.child!==null){for(t=n.child,o=Cr(t,t.pendingProps),n.child=o,o.return=n;t.sibling!==null;)t=t.sibling,o=o.sibling=Cr(t,t.pendingProps),o.return=n;o.sibling=null}return n.child}function Tg(t,n,o){switch(n.tag){case 3:Ud(n),ki();break;case 5:id(n);break;case 1:Vt(n.type)&&sl(n);break;case 4:os(n,n.stateNode.containerInfo);break;case 10:var a=n.type._context,f=n.memoizedProps.value;nt(ml,a._currentValue),a._currentValue=f;break;case 13:if(a=n.memoizedState,a!==null)return a.dehydrated!==null?(nt(ct,ct.current&1),n.flags|=128,null):(o&n.child.childLanes)!==0?jd(t,n,o):(nt(ct,ct.current&1),t=ir(t,n,o),t!==null?t.sibling:null);nt(ct,ct.current&1);break;case 19:if(a=(o&n.childLanes)!==0,(t.flags&128)!==0){if(a)return Kd(t,n,o);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),nt(ct,ct.current),a)break;return null;case 22:case 23:return n.lanes=0,zd(t,n,o)}return ir(t,n,o)}var Gd,Cs,Wd,Vd;Gd=function(t,n){for(var o=n.child;o!==null;){if(o.tag===5||o.tag===6)t.appendChild(o.stateNode);else if(o.tag!==4&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===n)break;for(;o.sibling===null;){if(o.return===null||o.return===n)return;o=o.return}o.sibling.return=o.return,o=o.sibling}},Cs=function(){},Wd=function(t,n,o,a){var f=t.memoizedProps;if(f!==a){t=n.stateNode,Gr(Bn.current);var h=null;switch(o){case"input":f=Wn(t,f),a=Wn(t,a),h=[];break;case"select":f=v({},f,{value:void 0}),a=v({},a,{value:void 0}),h=[];break;case"textarea":f=Or(t,f),a=Or(t,a),h=[];break;default:typeof f.onClick!="function"&&typeof a.onClick=="function"&&(t.onclick=ol)}vt(o,a);var _;o=null;for(U in f)if(!a.hasOwnProperty(U)&&f.hasOwnProperty(U)&&f[U]!=null)if(U==="style"){var N=f[U];for(_ in N)N.hasOwnProperty(_)&&(o||(o={}),o[_]="")}else U!=="dangerouslySetInnerHTML"&&U!=="children"&&U!=="suppressContentEditableWarning"&&U!=="suppressHydrationWarning"&&U!=="autoFocus"&&(s.hasOwnProperty(U)?h||(h=[]):(h=h||[]).push(U,null));for(U in a){var R=a[U];if(N=f!=null?f[U]:void 0,a.hasOwnProperty(U)&&R!==N&&(R!=null||N!=null))if(U==="style")if(N){for(_ in N)!N.hasOwnProperty(_)||R&&R.hasOwnProperty(_)||(o||(o={}),o[_]="");for(_ in R)R.hasOwnProperty(_)&&N[_]!==R[_]&&(o||(o={}),o[_]=R[_])}else o||(h||(h=[]),h.push(U,o)),o=R;else U==="dangerouslySetInnerHTML"?(R=R?R.__html:void 0,N=N?N.__html:void 0,R!=null&&N!==R&&(h=h||[]).push(U,R)):U==="children"?typeof R!="string"&&typeof R!="number"||(h=h||[]).push(U,""+R):U!=="suppressContentEditableWarning"&&U!=="suppressHydrationWarning"&&(s.hasOwnProperty(U)?(R!=null&&U==="onScroll"&&it("scroll",t),h||N===R||(h=[])):(h=h||[]).push(U,R))}o&&(h=h||[]).push("style",o);var U=h;(n.updateQueue=U)&&(n.flags|=4)}},Vd=function(t,n,o,a){o!==a&&(n.flags|=4)};function go(t,n){if(!at)switch(t.tailMode){case"hidden":n=t.tail;for(var o=null;n!==null;)n.alternate!==null&&(o=n),n=n.sibling;o===null?t.tail=null:o.sibling=null;break;case"collapsed":o=t.tail;for(var a=null;o!==null;)o.alternate!==null&&(a=o),o=o.sibling;a===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:a.sibling=null}}function Mt(t){var n=t.alternate!==null&&t.alternate.child===t.child,o=0,a=0;if(n)for(var f=t.child;f!==null;)o|=f.lanes|f.childLanes,a|=f.subtreeFlags&14680064,a|=f.flags&14680064,f.return=t,f=f.sibling;else for(f=t.child;f!==null;)o|=f.lanes|f.childLanes,a|=f.subtreeFlags,a|=f.flags,f.return=t,f=f.sibling;return t.subtreeFlags|=a,t.childLanes=o,n}function Ag(t,n,o){var a=n.pendingProps;switch(Ya(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mt(n),null;case 1:return Vt(n.type)&&al(),Mt(n),null;case 3:return a=n.stateNode,Ni(),ot(Wt),ot(Ot),ss(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(fl(n)?n.flags|=4:t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Sn!==null&&(Fs(Sn),Sn=null))),Cs(t,n),Mt(n),null;case 5:ls(n);var f=Gr(co.current);if(o=n.type,t!==null&&n.stateNode!=null)Wd(t,n,o,a,f),t.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!a){if(n.stateNode===null)throw Error(r(166));return Mt(n),null}if(t=Gr(Bn.current),fl(n)){a=n.stateNode,o=n.type;var h=n.memoizedProps;switch(a[Fn]=n,a[oo]=h,t=(n.mode&1)!==0,o){case"dialog":it("cancel",a),it("close",a);break;case"iframe":case"object":case"embed":it("load",a);break;case"video":case"audio":for(f=0;f<no.length;f++)it(no[f],a);break;case"source":it("error",a);break;case"img":case"image":case"link":it("error",a),it("load",a);break;case"details":it("toggle",a);break;case"input":Vn(a,h),it("invalid",a);break;case"select":a._wrapperState={wasMultiple:!!h.multiple},it("invalid",a);break;case"textarea":Ir(a,h),it("invalid",a)}vt(o,h),f=null;for(var _ in h)if(h.hasOwnProperty(_)){var N=h[_];_==="children"?typeof N=="string"?a.textContent!==N&&(h.suppressHydrationWarning!==!0&&il(a.textContent,N,t),f=["children",N]):typeof N=="number"&&a.textContent!==""+N&&(h.suppressHydrationWarning!==!0&&il(a.textContent,N,t),f=["children",""+N]):s.hasOwnProperty(_)&&N!=null&&_==="onScroll"&&it("scroll",a)}switch(o){case"input":en(a),un(a,h,!0);break;case"textarea":en(a),Mr(a);break;case"select":case"option":break;default:typeof h.onClick=="function"&&(a.onclick=ol)}a=f,n.updateQueue=a,a!==null&&(n.flags|=4)}else{_=f.nodeType===9?f:f.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=H(o)),t==="http://www.w3.org/1999/xhtml"?o==="script"?(t=_.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof a.is=="string"?t=_.createElement(o,{is:a.is}):(t=_.createElement(o),o==="select"&&(_=t,a.multiple?_.multiple=!0:a.size&&(_.size=a.size))):t=_.createElementNS(t,o),t[Fn]=n,t[oo]=a,Gd(t,n,!1,!1),n.stateNode=t;e:{switch(_=dn(o,a),o){case"dialog":it("cancel",t),it("close",t),f=a;break;case"iframe":case"object":case"embed":it("load",t),f=a;break;case"video":case"audio":for(f=0;f<no.length;f++)it(no[f],t);f=a;break;case"source":it("error",t),f=a;break;case"img":case"image":case"link":it("error",t),it("load",t),f=a;break;case"details":it("toggle",t),f=a;break;case"input":Vn(t,a),f=Wn(t,a),it("invalid",t);break;case"option":f=a;break;case"select":t._wrapperState={wasMultiple:!!a.multiple},f=v({},a,{value:void 0}),it("invalid",t);break;case"textarea":Ir(t,a),f=Or(t,a),it("invalid",t);break;default:f=a}vt(o,f),N=f;for(h in N)if(N.hasOwnProperty(h)){var R=N[h];h==="style"?kn(t,R):h==="dangerouslySetInnerHTML"?(R=R?R.__html:void 0,R!=null&&Pe(t,R)):h==="children"?typeof R=="string"?(o!=="textarea"||R!=="")&&je(t,R):typeof R=="number"&&je(t,""+R):h!=="suppressContentEditableWarning"&&h!=="suppressHydrationWarning"&&h!=="autoFocus"&&(s.hasOwnProperty(h)?R!=null&&h==="onScroll"&&it("scroll",t):R!=null&&L(t,h,R,_))}switch(o){case"input":en(t),un(t,a,!1);break;case"textarea":en(t),Mr(t);break;case"option":a.value!=null&&t.setAttribute("value",""+De(a.value));break;case"select":t.multiple=!!a.multiple,h=a.value,h!=null?Ln(t,!!a.multiple,h,!1):a.defaultValue!=null&&Ln(t,!!a.multiple,a.defaultValue,!0);break;default:typeof f.onClick=="function"&&(t.onclick=ol)}switch(o){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}}a&&(n.flags|=4)}n.ref!==null&&(n.flags|=512,n.flags|=2097152)}return Mt(n),null;case 6:if(t&&n.stateNode!=null)Vd(t,n,t.memoizedProps,a);else{if(typeof a!="string"&&n.stateNode===null)throw Error(r(166));if(o=Gr(co.current),Gr(Bn.current),fl(n)){if(a=n.stateNode,o=n.memoizedProps,a[Fn]=n,(h=a.nodeValue!==o)&&(t=rn,t!==null))switch(t.tag){case 3:il(a.nodeValue,o,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&il(a.nodeValue,o,(t.mode&1)!==0)}h&&(n.flags|=4)}else a=(o.nodeType===9?o:o.ownerDocument).createTextNode(a),a[Fn]=n,n.stateNode=a}return Mt(n),null;case 13:if(ot(ct),a=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(at&&on!==null&&(n.mode&1)!==0&&(n.flags&128)===0)Qc(),ki(),n.flags|=98560,h=!1;else if(h=fl(n),a!==null&&a.dehydrated!==null){if(t===null){if(!h)throw Error(r(318));if(h=n.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(r(317));h[Fn]=n}else ki(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Mt(n),h=!1}else Sn!==null&&(Fs(Sn),Sn=null),h=!0;if(!h)return n.flags&65536?n:null}return(n.flags&128)!==0?(n.lanes=o,n):(a=a!==null,a!==(t!==null&&t.memoizedState!==null)&&a&&(n.child.flags|=8192,(n.mode&1)!==0&&(t===null||(ct.current&1)!==0?wt===0&&(wt=3):$s())),n.updateQueue!==null&&(n.flags|=4),Mt(n),null);case 4:return Ni(),Cs(t,n),t===null&&ro(n.stateNode.containerInfo),Mt(n),null;case 10:return ts(n.type._context),Mt(n),null;case 17:return Vt(n.type)&&al(),Mt(n),null;case 19:if(ot(ct),h=n.memoizedState,h===null)return Mt(n),null;if(a=(n.flags&128)!==0,_=h.rendering,_===null)if(a)go(h,!1);else{if(wt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(_=bl(t),_!==null){for(n.flags|=128,go(h,!1),a=_.updateQueue,a!==null&&(n.updateQueue=a,n.flags|=4),n.subtreeFlags=0,a=o,o=n.child;o!==null;)h=o,t=a,h.flags&=14680066,_=h.alternate,_===null?(h.childLanes=0,h.lanes=t,h.child=null,h.subtreeFlags=0,h.memoizedProps=null,h.memoizedState=null,h.updateQueue=null,h.dependencies=null,h.stateNode=null):(h.childLanes=_.childLanes,h.lanes=_.lanes,h.child=_.child,h.subtreeFlags=0,h.deletions=null,h.memoizedProps=_.memoizedProps,h.memoizedState=_.memoizedState,h.updateQueue=_.updateQueue,h.type=_.type,t=_.dependencies,h.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),o=o.sibling;return nt(ct,ct.current&1|2),n.child}t=t.sibling}h.tail!==null&&st()>Ri&&(n.flags|=128,a=!0,go(h,!1),n.lanes=4194304)}else{if(!a)if(t=bl(_),t!==null){if(n.flags|=128,a=!0,o=t.updateQueue,o!==null&&(n.updateQueue=o,n.flags|=4),go(h,!0),h.tail===null&&h.tailMode==="hidden"&&!_.alternate&&!at)return Mt(n),null}else 2*st()-h.renderingStartTime>Ri&&o!==1073741824&&(n.flags|=128,a=!0,go(h,!1),n.lanes=4194304);h.isBackwards?(_.sibling=n.child,n.child=_):(o=h.last,o!==null?o.sibling=_:n.child=_,h.last=_)}return h.tail!==null?(n=h.tail,h.rendering=n,h.tail=n.sibling,h.renderingStartTime=st(),n.sibling=null,o=ct.current,nt(ct,a?o&1|2:o&1),n):(Mt(n),null);case 22:case 23:return Us(),a=n.memoizedState!==null,t!==null&&t.memoizedState!==null!==a&&(n.flags|=8192),a&&(n.mode&1)!==0?(ln&1073741824)!==0&&(Mt(n),n.subtreeFlags&6&&(n.flags|=8192)):Mt(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function Rg(t,n){switch(Ya(n),n.tag){case 1:return Vt(n.type)&&al(),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return Ni(),ot(Wt),ot(Ot),ss(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 5:return ls(n),null;case 13:if(ot(ct),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(r(340));ki()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return ot(ct),null;case 4:return Ni(),null;case 10:return ts(n.type._context),null;case 22:case 23:return Us(),null;case 24:return null;default:return null}}var Cl=!1,Lt=!1,Og=typeof WeakSet=="function"?WeakSet:Set,ye=null;function Ti(t,n){var o=t.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(a){pt(t,n,a)}else o.current=null}function Ts(t,n,o){try{o()}catch(a){pt(t,n,a)}}var qd=!1;function Ig(t,n){if(Ua=Vo,t=Nc(),Ia(t)){if("selectionStart"in t)var o={start:t.selectionStart,end:t.selectionEnd};else e:{o=(o=t.ownerDocument)&&o.defaultView||window;var a=o.getSelection&&o.getSelection();if(a&&a.rangeCount!==0){o=a.anchorNode;var f=a.anchorOffset,h=a.focusNode;a=a.focusOffset;try{o.nodeType,h.nodeType}catch{o=null;break e}var _=0,N=-1,R=-1,U=0,Q=0,J=t,Y=null;t:for(;;){for(var pe;J!==o||f!==0&&J.nodeType!==3||(N=_+f),J!==h||a!==0&&J.nodeType!==3||(R=_+a),J.nodeType===3&&(_+=J.nodeValue.length),(pe=J.firstChild)!==null;)Y=J,J=pe;for(;;){if(J===t)break t;if(Y===o&&++U===f&&(N=_),Y===h&&++Q===a&&(R=_),(pe=J.nextSibling)!==null)break;J=Y,Y=J.parentNode}J=pe}o=N===-1||R===-1?null:{start:N,end:R}}else o=null}o=o||{start:0,end:0}}else o=null;for($a={focusedElem:t,selectionRange:o},Vo=!1,ye=n;ye!==null;)if(n=ye,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,ye=t;else for(;ye!==null;){n=ye;try{var be=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(be!==null){var Ee=be.memoizedProps,gt=be.memoizedState,z=n.stateNode,M=z.getSnapshotBeforeUpdate(n.elementType===n.type?Ee:Nn(n.type,Ee),gt);z.__reactInternalSnapshotBeforeUpdate=M}break;case 3:var B=n.stateNode.containerInfo;B.nodeType===1?B.textContent="":B.nodeType===9&&B.documentElement&&B.removeChild(B.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ie){pt(n,n.return,ie)}if(t=n.sibling,t!==null){t.return=n.return,ye=t;break}ye=n.return}return be=qd,qd=!1,be}function yo(t,n,o){var a=n.updateQueue;if(a=a!==null?a.lastEffect:null,a!==null){var f=a=a.next;do{if((f.tag&t)===t){var h=f.destroy;f.destroy=void 0,h!==void 0&&Ts(n,o,h)}f=f.next}while(f!==a)}}function Tl(t,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var o=n=n.next;do{if((o.tag&t)===t){var a=o.create;o.destroy=a()}o=o.next}while(o!==n)}}function As(t){var n=t.ref;if(n!==null){var o=t.stateNode;switch(t.tag){case 5:t=o;break;default:t=o}typeof n=="function"?n(t):n.current=t}}function Yd(t){var n=t.alternate;n!==null&&(t.alternate=null,Yd(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&(delete n[Fn],delete n[oo],delete n[Ga],delete n[mg],delete n[hg])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Qd(t){return t.tag===5||t.tag===3||t.tag===4}function Zd(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Qd(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Rs(t,n,o){var a=t.tag;if(a===5||a===6)t=t.stateNode,n?o.nodeType===8?o.parentNode.insertBefore(t,n):o.insertBefore(t,n):(o.nodeType===8?(n=o.parentNode,n.insertBefore(t,o)):(n=o,n.appendChild(t)),o=o._reactRootContainer,o!=null||n.onclick!==null||(n.onclick=ol));else if(a!==4&&(t=t.child,t!==null))for(Rs(t,n,o),t=t.sibling;t!==null;)Rs(t,n,o),t=t.sibling}function Os(t,n,o){var a=t.tag;if(a===5||a===6)t=t.stateNode,n?o.insertBefore(t,n):o.appendChild(t);else if(a!==4&&(t=t.child,t!==null))for(Os(t,n,o),t=t.sibling;t!==null;)Os(t,n,o),t=t.sibling}var At=null,Cn=!1;function kr(t,n,o){for(o=o.child;o!==null;)Xd(t,n,o),o=o.sibling}function Xd(t,n,o){if(Be&&typeof Be.onCommitFiberUnmount=="function")try{Be.onCommitFiberUnmount(ze,o)}catch{}switch(o.tag){case 5:Lt||Ti(o,n);case 6:var a=At,f=Cn;At=null,kr(t,n,o),At=a,Cn=f,At!==null&&(Cn?(t=At,o=o.stateNode,t.nodeType===8?t.parentNode.removeChild(o):t.removeChild(o)):At.removeChild(o.stateNode));break;case 18:At!==null&&(Cn?(t=At,o=o.stateNode,t.nodeType===8?Ka(t.parentNode,o):t.nodeType===1&&Ka(t,o),qi(t)):Ka(At,o.stateNode));break;case 4:a=At,f=Cn,At=o.stateNode.containerInfo,Cn=!0,kr(t,n,o),At=a,Cn=f;break;case 0:case 11:case 14:case 15:if(!Lt&&(a=o.updateQueue,a!==null&&(a=a.lastEffect,a!==null))){f=a=a.next;do{var h=f,_=h.destroy;h=h.tag,_!==void 0&&((h&2)!==0||(h&4)!==0)&&Ts(o,n,_),f=f.next}while(f!==a)}kr(t,n,o);break;case 1:if(!Lt&&(Ti(o,n),a=o.stateNode,typeof a.componentWillUnmount=="function"))try{a.props=o.memoizedProps,a.state=o.memoizedState,a.componentWillUnmount()}catch(N){pt(o,n,N)}kr(t,n,o);break;case 21:kr(t,n,o);break;case 22:o.mode&1?(Lt=(a=Lt)||o.memoizedState!==null,kr(t,n,o),Lt=a):kr(t,n,o);break;default:kr(t,n,o)}}function Jd(t){var n=t.updateQueue;if(n!==null){t.updateQueue=null;var o=t.stateNode;o===null&&(o=t.stateNode=new Og),n.forEach(function(a){var f=$g.bind(null,t,a);o.has(a)||(o.add(a),a.then(f,f))})}}function Tn(t,n){var o=n.deletions;if(o!==null)for(var a=0;a<o.length;a++){var f=o[a];try{var h=t,_=n,N=_;e:for(;N!==null;){switch(N.tag){case 5:At=N.stateNode,Cn=!1;break e;case 3:At=N.stateNode.containerInfo,Cn=!0;break e;case 4:At=N.stateNode.containerInfo,Cn=!0;break e}N=N.return}if(At===null)throw Error(r(160));Xd(h,_,f),At=null,Cn=!1;var R=f.alternate;R!==null&&(R.return=null),f.return=null}catch(U){pt(f,n,U)}}if(n.subtreeFlags&12854)for(n=n.child;n!==null;)ef(n,t),n=n.sibling}function ef(t,n){var o=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Tn(n,t),$n(t),a&4){try{yo(3,t,t.return),Tl(3,t)}catch(Ee){pt(t,t.return,Ee)}try{yo(5,t,t.return)}catch(Ee){pt(t,t.return,Ee)}}break;case 1:Tn(n,t),$n(t),a&512&&o!==null&&Ti(o,o.return);break;case 5:if(Tn(n,t),$n(t),a&512&&o!==null&&Ti(o,o.return),t.flags&32){var f=t.stateNode;try{je(f,"")}catch(Ee){pt(t,t.return,Ee)}}if(a&4&&(f=t.stateNode,f!=null)){var h=t.memoizedProps,_=o!==null?o.memoizedProps:h,N=t.type,R=t.updateQueue;if(t.updateQueue=null,R!==null)try{N==="input"&&h.type==="radio"&&h.name!=null&&Ge(f,h),dn(N,_);var U=dn(N,h);for(_=0;_<R.length;_+=2){var Q=R[_],J=R[_+1];Q==="style"?kn(f,J):Q==="dangerouslySetInnerHTML"?Pe(f,J):Q==="children"?je(f,J):L(f,Q,J,U)}switch(N){case"input":tn(f,h);break;case"textarea":cn(f,h);break;case"select":var Y=f._wrapperState.wasMultiple;f._wrapperState.wasMultiple=!!h.multiple;var pe=h.value;pe!=null?Ln(f,!!h.multiple,pe,!1):Y!==!!h.multiple&&(h.defaultValue!=null?Ln(f,!!h.multiple,h.defaultValue,!0):Ln(f,!!h.multiple,h.multiple?[]:"",!1))}f[oo]=h}catch(Ee){pt(t,t.return,Ee)}}break;case 6:if(Tn(n,t),$n(t),a&4){if(t.stateNode===null)throw Error(r(162));f=t.stateNode,h=t.memoizedProps;try{f.nodeValue=h}catch(Ee){pt(t,t.return,Ee)}}break;case 3:if(Tn(n,t),$n(t),a&4&&o!==null&&o.memoizedState.isDehydrated)try{qi(n.containerInfo)}catch(Ee){pt(t,t.return,Ee)}break;case 4:Tn(n,t),$n(t);break;case 13:Tn(n,t),$n(t),f=t.child,f.flags&8192&&(h=f.memoizedState!==null,f.stateNode.isHidden=h,!h||f.alternate!==null&&f.alternate.memoizedState!==null||(Ls=st())),a&4&&Jd(t);break;case 22:if(Q=o!==null&&o.memoizedState!==null,t.mode&1?(Lt=(U=Lt)||Q,Tn(n,t),Lt=U):Tn(n,t),$n(t),a&8192){if(U=t.memoizedState!==null,(t.stateNode.isHidden=U)&&!Q&&(t.mode&1)!==0)for(ye=t,Q=t.child;Q!==null;){for(J=ye=Q;ye!==null;){switch(Y=ye,pe=Y.child,Y.tag){case 0:case 11:case 14:case 15:yo(4,Y,Y.return);break;case 1:Ti(Y,Y.return);var be=Y.stateNode;if(typeof be.componentWillUnmount=="function"){a=Y,o=Y.return;try{n=a,be.props=n.memoizedProps,be.state=n.memoizedState,be.componentWillUnmount()}catch(Ee){pt(a,o,Ee)}}break;case 5:Ti(Y,Y.return);break;case 22:if(Y.memoizedState!==null){rf(J);continue}}pe!==null?(pe.return=Y,ye=pe):rf(J)}Q=Q.sibling}e:for(Q=null,J=t;;){if(J.tag===5){if(Q===null){Q=J;try{f=J.stateNode,U?(h=f.style,typeof h.setProperty=="function"?h.setProperty("display","none","important"):h.display="none"):(N=J.stateNode,R=J.memoizedProps.style,_=R!=null&&R.hasOwnProperty("display")?R.display:null,N.style.display=Gt("display",_))}catch(Ee){pt(t,t.return,Ee)}}}else if(J.tag===6){if(Q===null)try{J.stateNode.nodeValue=U?"":J.memoizedProps}catch(Ee){pt(t,t.return,Ee)}}else if((J.tag!==22&&J.tag!==23||J.memoizedState===null||J===t)&&J.child!==null){J.child.return=J,J=J.child;continue}if(J===t)break e;for(;J.sibling===null;){if(J.return===null||J.return===t)break e;Q===J&&(Q=null),J=J.return}Q===J&&(Q=null),J.sibling.return=J.return,J=J.sibling}}break;case 19:Tn(n,t),$n(t),a&4&&Jd(t);break;case 21:break;default:Tn(n,t),$n(t)}}function $n(t){var n=t.flags;if(n&2){try{e:{for(var o=t.return;o!==null;){if(Qd(o)){var a=o;break e}o=o.return}throw Error(r(160))}switch(a.tag){case 5:var f=a.stateNode;a.flags&32&&(je(f,""),a.flags&=-33);var h=Zd(t);Os(t,h,f);break;case 3:case 4:var _=a.stateNode.containerInfo,N=Zd(t);Rs(t,N,_);break;default:throw Error(r(161))}}catch(R){pt(t,t.return,R)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function Mg(t,n,o){ye=t,tf(t)}function tf(t,n,o){for(var a=(t.mode&1)!==0;ye!==null;){var f=ye,h=f.child;if(f.tag===22&&a){var _=f.memoizedState!==null||Cl;if(!_){var N=f.alternate,R=N!==null&&N.memoizedState!==null||Lt;N=Cl;var U=Lt;if(Cl=_,(Lt=R)&&!U)for(ye=f;ye!==null;)_=ye,R=_.child,_.tag===22&&_.memoizedState!==null?of(f):R!==null?(R.return=_,ye=R):of(f);for(;h!==null;)ye=h,tf(h),h=h.sibling;ye=f,Cl=N,Lt=U}nf(t)}else(f.subtreeFlags&8772)!==0&&h!==null?(h.return=f,ye=h):nf(t)}}function nf(t){for(;ye!==null;){var n=ye;if((n.flags&8772)!==0){var o=n.alternate;try{if((n.flags&8772)!==0)switch(n.tag){case 0:case 11:case 15:Lt||Tl(5,n);break;case 1:var a=n.stateNode;if(n.flags&4&&!Lt)if(o===null)a.componentDidMount();else{var f=n.elementType===n.type?o.memoizedProps:Nn(n.type,o.memoizedProps);a.componentDidUpdate(f,o.memoizedState,a.__reactInternalSnapshotBeforeUpdate)}var h=n.updateQueue;h!==null&&rd(n,h,a);break;case 3:var _=n.updateQueue;if(_!==null){if(o=null,n.child!==null)switch(n.child.tag){case 5:o=n.child.stateNode;break;case 1:o=n.child.stateNode}rd(n,_,o)}break;case 5:var N=n.stateNode;if(o===null&&n.flags&4){o=N;var R=n.memoizedProps;switch(n.type){case"button":case"input":case"select":case"textarea":R.autoFocus&&o.focus();break;case"img":R.src&&(o.src=R.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(n.memoizedState===null){var U=n.alternate;if(U!==null){var Q=U.memoizedState;if(Q!==null){var J=Q.dehydrated;J!==null&&qi(J)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Lt||n.flags&512&&As(n)}catch(Y){pt(n,n.return,Y)}}if(n===t){ye=null;break}if(o=n.sibling,o!==null){o.return=n.return,ye=o;break}ye=n.return}}function rf(t){for(;ye!==null;){var n=ye;if(n===t){ye=null;break}var o=n.sibling;if(o!==null){o.return=n.return,ye=o;break}ye=n.return}}function of(t){for(;ye!==null;){var n=ye;try{switch(n.tag){case 0:case 11:case 15:var o=n.return;try{Tl(4,n)}catch(R){pt(n,o,R)}break;case 1:var a=n.stateNode;if(typeof a.componentDidMount=="function"){var f=n.return;try{a.componentDidMount()}catch(R){pt(n,f,R)}}var h=n.return;try{As(n)}catch(R){pt(n,h,R)}break;case 5:var _=n.return;try{As(n)}catch(R){pt(n,_,R)}}}catch(R){pt(n,n.return,R)}if(n===t){ye=null;break}var N=n.sibling;if(N!==null){N.return=n.return,ye=N;break}ye=n.return}}var Lg=Math.ceil,Al=$.ReactCurrentDispatcher,Is=$.ReactCurrentOwner,yn=$.ReactCurrentBatchConfig,qe=0,Nt=null,bt=null,Rt=0,ln=0,Ai=yr(0),wt=0,bo=null,Vr=0,Rl=0,Ms=0,Eo=null,Yt=null,Ls=0,Ri=1/0,or=null,Ol=!1,Ds=null,wr=null,Il=!1,xr=null,Ml=0,_o=0,Ps=null,Ll=-1,Dl=0;function Ut(){return(qe&6)!==0?st():Ll!==-1?Ll:Ll=st()}function Sr(t){return(t.mode&1)===0?1:(qe&2)!==0&&Rt!==0?Rt&-Rt:yg.transition!==null?(Dl===0&&(Dl=Ko()),Dl):(t=Ve,t!==0||(t=window.event,t=t===void 0?16:lc(t.type)),t)}function An(t,n,o,a){if(50<_o)throw _o=0,Ps=null,Error(r(185));fr(t,o,a),((qe&2)===0||t!==Nt)&&(t===Nt&&((qe&2)===0&&(Rl|=o),wt===4&&Nr(t,Rt)),Qt(t,a),o===1&&qe===0&&(n.mode&1)===0&&(Ri=st()+500,ul&&Er()))}function Qt(t,n){var o=t.callbackNode;Ea(t,n);var a=zr(t,t===Nt?Rt:0);if(a===0)o!==null&&wn(o),t.callbackNode=null,t.callbackPriority=0;else if(n=a&-a,t.callbackPriority!==n){if(o!=null&&wn(o),n===1)t.tag===0?gg(af.bind(null,t)):Gc(af.bind(null,t)),fg(function(){(qe&6)===0&&Er()}),o=null;else{switch(Ie(a)){case 1:o=ji;break;case 4:o=Dr;break;case 16:o=si;break;case 536870912:o=ve;break;default:o=si}o=hf(o,lf.bind(null,t))}t.callbackPriority=n,t.callbackNode=o}}function lf(t,n){if(Ll=-1,Dl=0,(qe&6)!==0)throw Error(r(327));var o=t.callbackNode;if(Oi()&&t.callbackNode!==o)return null;var a=zr(t,t===Nt?Rt:0);if(a===0)return null;if((a&30)!==0||(a&t.expiredLanes)!==0||n)n=Pl(t,a);else{n=a;var f=qe;qe|=2;var h=uf();(Nt!==t||Rt!==n)&&(or=null,Ri=st()+500,Yr(t,n));do try{zg();break}catch(N){sf(t,N)}while(!0);es(),Al.current=h,qe=f,bt!==null?n=0:(Nt=null,Rt=0,n=wt)}if(n!==0){if(n===2&&(f=Hi(t),f!==0&&(a=f,n=zs(t,f))),n===1)throw o=bo,Yr(t,0),Nr(t,a),Qt(t,st()),o;if(n===6)Nr(t,a);else{if(f=t.current.alternate,(a&30)===0&&!Dg(f)&&(n=Pl(t,a),n===2&&(h=Hi(t),h!==0&&(a=h,n=zs(t,h))),n===1))throw o=bo,Yr(t,0),Nr(t,a),Qt(t,st()),o;switch(t.finishedWork=f,t.finishedLanes=a,n){case 0:case 1:throw Error(r(345));case 2:Qr(t,Yt,or);break;case 3:if(Nr(t,a),(a&130023424)===a&&(n=Ls+500-st(),10<n)){if(zr(t,0)!==0)break;if(f=t.suspendedLanes,(f&a)!==a){Ut(),t.pingedLanes|=t.suspendedLanes&f;break}t.timeoutHandle=Ha(Qr.bind(null,t,Yt,or),n);break}Qr(t,Yt,or);break;case 4:if(Nr(t,a),(a&4194240)===a)break;for(n=t.eventTimes,f=-1;0<a;){var _=31-ut(a);h=1<<_,_=n[_],_>f&&(f=_),a&=~h}if(a=f,a=st()-a,a=(120>a?120:480>a?480:1080>a?1080:1920>a?1920:3e3>a?3e3:4320>a?4320:1960*Lg(a/1960))-a,10<a){t.timeoutHandle=Ha(Qr.bind(null,t,Yt,or),a);break}Qr(t,Yt,or);break;case 5:Qr(t,Yt,or);break;default:throw Error(r(329))}}}return Qt(t,st()),t.callbackNode===o?lf.bind(null,t):null}function zs(t,n){var o=Eo;return t.current.memoizedState.isDehydrated&&(Yr(t,n).flags|=256),t=Pl(t,n),t!==2&&(n=Yt,Yt=o,n!==null&&Fs(n)),t}function Fs(t){Yt===null?Yt=t:Yt.push.apply(Yt,t)}function Dg(t){for(var n=t;;){if(n.flags&16384){var o=n.updateQueue;if(o!==null&&(o=o.stores,o!==null))for(var a=0;a<o.length;a++){var f=o[a],h=f.getSnapshot;f=f.value;try{if(!xn(h(),f))return!1}catch{return!1}}}if(o=n.child,n.subtreeFlags&16384&&o!==null)o.return=n,n=o;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Nr(t,n){for(n&=~Ms,n&=~Rl,t.suspendedLanes|=n,t.pingedLanes&=~n,t=t.expirationTimes;0<n;){var o=31-ut(n),a=1<<o;t[o]=-1,n&=~a}}function af(t){if((qe&6)!==0)throw Error(r(327));Oi();var n=zr(t,0);if((n&1)===0)return Qt(t,st()),null;var o=Pl(t,n);if(t.tag!==0&&o===2){var a=Hi(t);a!==0&&(n=a,o=zs(t,a))}if(o===1)throw o=bo,Yr(t,0),Nr(t,n),Qt(t,st()),o;if(o===6)throw Error(r(345));return t.finishedWork=t.current.alternate,t.finishedLanes=n,Qr(t,Yt,or),Qt(t,st()),null}function Bs(t,n){var o=qe;qe|=1;try{return t(n)}finally{qe=o,qe===0&&(Ri=st()+500,ul&&Er())}}function qr(t){xr!==null&&xr.tag===0&&(qe&6)===0&&Oi();var n=qe;qe|=1;var o=yn.transition,a=Ve;try{if(yn.transition=null,Ve=1,t)return t()}finally{Ve=a,yn.transition=o,qe=n,(qe&6)===0&&Er()}}function Us(){ln=Ai.current,ot(Ai)}function Yr(t,n){t.finishedWork=null,t.finishedLanes=0;var o=t.timeoutHandle;if(o!==-1&&(t.timeoutHandle=-1,dg(o)),bt!==null)for(o=bt.return;o!==null;){var a=o;switch(Ya(a),a.tag){case 1:a=a.type.childContextTypes,a!=null&&al();break;case 3:Ni(),ot(Wt),ot(Ot),ss();break;case 5:ls(a);break;case 4:Ni();break;case 13:ot(ct);break;case 19:ot(ct);break;case 10:ts(a.type._context);break;case 22:case 23:Us()}o=o.return}if(Nt=t,bt=t=Cr(t.current,null),Rt=ln=n,wt=0,bo=null,Ms=Rl=Vr=0,Yt=Eo=null,Kr!==null){for(n=0;n<Kr.length;n++)if(o=Kr[n],a=o.interleaved,a!==null){o.interleaved=null;var f=a.next,h=o.pending;if(h!==null){var _=h.next;h.next=f,a.next=_}o.pending=a}Kr=null}return t}function sf(t,n){do{var o=bt;try{if(es(),El.current=wl,_l){for(var a=dt.memoizedState;a!==null;){var f=a.queue;f!==null&&(f.pending=null),a=a.next}_l=!1}if(Wr=0,St=kt=dt=null,fo=!1,po=0,Is.current=null,o===null||o.return===null){wt=1,bo=n,bt=null;break}e:{var h=t,_=o.return,N=o,R=n;if(n=Rt,N.flags|=32768,R!==null&&typeof R=="object"&&typeof R.then=="function"){var U=R,Q=N,J=Q.tag;if((Q.mode&1)===0&&(J===0||J===11||J===15)){var Y=Q.alternate;Y?(Q.updateQueue=Y.updateQueue,Q.memoizedState=Y.memoizedState,Q.lanes=Y.lanes):(Q.updateQueue=null,Q.memoizedState=null)}var pe=Id(_);if(pe!==null){pe.flags&=-257,Md(pe,_,N,h,n),pe.mode&1&&Od(h,U,n),n=pe,R=U;var be=n.updateQueue;if(be===null){var Ee=new Set;Ee.add(R),n.updateQueue=Ee}else be.add(R);break e}else{if((n&1)===0){Od(h,U,n),$s();break e}R=Error(r(426))}}else if(at&&N.mode&1){var gt=Id(_);if(gt!==null){(gt.flags&65536)===0&&(gt.flags|=256),Md(gt,_,N,h,n),Xa(Ci(R,N));break e}}h=R=Ci(R,N),wt!==4&&(wt=2),Eo===null?Eo=[h]:Eo.push(h),h=_;do{switch(h.tag){case 3:h.flags|=65536,n&=-n,h.lanes|=n;var z=Ad(h,R,n);nd(h,z);break e;case 1:N=R;var M=h.type,B=h.stateNode;if((h.flags&128)===0&&(typeof M.getDerivedStateFromError=="function"||B!==null&&typeof B.componentDidCatch=="function"&&(wr===null||!wr.has(B)))){h.flags|=65536,n&=-n,h.lanes|=n;var ie=Rd(h,N,n);nd(h,ie);break e}}h=h.return}while(h!==null)}df(o)}catch(_e){n=_e,bt===o&&o!==null&&(bt=o=o.return);continue}break}while(!0)}function uf(){var t=Al.current;return Al.current=wl,t===null?wl:t}function $s(){(wt===0||wt===3||wt===2)&&(wt=4),Nt===null||(Vr&268435455)===0&&(Rl&268435455)===0||Nr(Nt,Rt)}function Pl(t,n){var o=qe;qe|=2;var a=uf();(Nt!==t||Rt!==n)&&(or=null,Yr(t,n));do try{Pg();break}catch(f){sf(t,f)}while(!0);if(es(),qe=o,Al.current=a,bt!==null)throw Error(r(261));return Nt=null,Rt=0,wt}function Pg(){for(;bt!==null;)cf(bt)}function zg(){for(;bt!==null&&!jo();)cf(bt)}function cf(t){var n=mf(t.alternate,t,ln);t.memoizedProps=t.pendingProps,n===null?df(t):bt=n,Is.current=null}function df(t){var n=t;do{var o=n.alternate;if(t=n.return,(n.flags&32768)===0){if(o=Ag(o,n,ln),o!==null){bt=o;return}}else{if(o=Rg(o,n),o!==null){o.flags&=32767,bt=o;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{wt=6,bt=null;return}}if(n=n.sibling,n!==null){bt=n;return}bt=n=t}while(n!==null);wt===0&&(wt=5)}function Qr(t,n,o){var a=Ve,f=yn.transition;try{yn.transition=null,Ve=1,Fg(t,n,o,a)}finally{yn.transition=f,Ve=a}return null}function Fg(t,n,o,a){do Oi();while(xr!==null);if((qe&6)!==0)throw Error(r(327));o=t.finishedWork;var f=t.finishedLanes;if(o===null)return null;if(t.finishedWork=null,t.finishedLanes=0,o===t.current)throw Error(r(177));t.callbackNode=null,t.callbackPriority=0;var h=o.lanes|o.childLanes;if(fn(t,h),t===Nt&&(bt=Nt=null,Rt=0),(o.subtreeFlags&2064)===0&&(o.flags&2064)===0||Il||(Il=!0,hf(si,function(){return Oi(),null})),h=(o.flags&15990)!==0,(o.subtreeFlags&15990)!==0||h){h=yn.transition,yn.transition=null;var _=Ve;Ve=1;var N=qe;qe|=4,Is.current=null,Ig(t,o),ef(o,t),ig($a),Vo=!!Ua,$a=Ua=null,t.current=o,Mg(o),Ho(),qe=N,Ve=_,yn.transition=h}else t.current=o;if(Il&&(Il=!1,xr=t,Ml=f),h=t.pendingLanes,h===0&&(wr=null),mt(o.stateNode),Qt(t,st()),n!==null)for(a=t.onRecoverableError,o=0;o<n.length;o++)f=n[o],a(f.value,{componentStack:f.stack,digest:f.digest});if(Ol)throw Ol=!1,t=Ds,Ds=null,t;return(Ml&1)!==0&&t.tag!==0&&Oi(),h=t.pendingLanes,(h&1)!==0?t===Ps?_o++:(_o=0,Ps=t):_o=0,Er(),null}function Oi(){if(xr!==null){var t=Ie(Ml),n=yn.transition,o=Ve;try{if(yn.transition=null,Ve=16>t?16:t,xr===null)var a=!1;else{if(t=xr,xr=null,Ml=0,(qe&6)!==0)throw Error(r(331));var f=qe;for(qe|=4,ye=t.current;ye!==null;){var h=ye,_=h.child;if((ye.flags&16)!==0){var N=h.deletions;if(N!==null){for(var R=0;R<N.length;R++){var U=N[R];for(ye=U;ye!==null;){var Q=ye;switch(Q.tag){case 0:case 11:case 15:yo(8,Q,h)}var J=Q.child;if(J!==null)J.return=Q,ye=J;else for(;ye!==null;){Q=ye;var Y=Q.sibling,pe=Q.return;if(Yd(Q),Q===U){ye=null;break}if(Y!==null){Y.return=pe,ye=Y;break}ye=pe}}}var be=h.alternate;if(be!==null){var Ee=be.child;if(Ee!==null){be.child=null;do{var gt=Ee.sibling;Ee.sibling=null,Ee=gt}while(Ee!==null)}}ye=h}}if((h.subtreeFlags&2064)!==0&&_!==null)_.return=h,ye=_;else e:for(;ye!==null;){if(h=ye,(h.flags&2048)!==0)switch(h.tag){case 0:case 11:case 15:yo(9,h,h.return)}var z=h.sibling;if(z!==null){z.return=h.return,ye=z;break e}ye=h.return}}var M=t.current;for(ye=M;ye!==null;){_=ye;var B=_.child;if((_.subtreeFlags&2064)!==0&&B!==null)B.return=_,ye=B;else e:for(_=M;ye!==null;){if(N=ye,(N.flags&2048)!==0)try{switch(N.tag){case 0:case 11:case 15:Tl(9,N)}}catch(_e){pt(N,N.return,_e)}if(N===_){ye=null;break e}var ie=N.sibling;if(ie!==null){ie.return=N.return,ye=ie;break e}ye=N.return}}if(qe=f,Er(),Be&&typeof Be.onPostCommitFiberRoot=="function")try{Be.onPostCommitFiberRoot(ze,t)}catch{}a=!0}return a}finally{Ve=o,yn.transition=n}}return!1}function ff(t,n,o){n=Ci(o,n),n=Ad(t,n,1),t=vr(t,n,1),n=Ut(),t!==null&&(fr(t,1,n),Qt(t,n))}function pt(t,n,o){if(t.tag===3)ff(t,t,o);else for(;n!==null;){if(n.tag===3){ff(n,t,o);break}else if(n.tag===1){var a=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(wr===null||!wr.has(a))){t=Ci(o,t),t=Rd(n,t,1),n=vr(n,t,1),t=Ut(),n!==null&&(fr(n,1,t),Qt(n,t));break}}n=n.return}}function Bg(t,n,o){var a=t.pingCache;a!==null&&a.delete(n),n=Ut(),t.pingedLanes|=t.suspendedLanes&o,Nt===t&&(Rt&o)===o&&(wt===4||wt===3&&(Rt&130023424)===Rt&&500>st()-Ls?Yr(t,0):Ms|=o),Qt(t,n)}function pf(t,n){n===0&&((t.mode&1)===0?n=1:(n=Pr,Pr<<=1,(Pr&130023424)===0&&(Pr=4194304)));var o=Ut();t=nr(t,n),t!==null&&(fr(t,n,o),Qt(t,o))}function Ug(t){var n=t.memoizedState,o=0;n!==null&&(o=n.retryLane),pf(t,o)}function $g(t,n){var o=0;switch(t.tag){case 13:var a=t.stateNode,f=t.memoizedState;f!==null&&(o=f.retryLane);break;case 19:a=t.stateNode;break;default:throw Error(r(314))}a!==null&&a.delete(n),pf(t,o)}var mf;mf=function(t,n,o){if(t!==null)if(t.memoizedProps!==n.pendingProps||Wt.current)qt=!0;else{if((t.lanes&o)===0&&(n.flags&128)===0)return qt=!1,Tg(t,n,o);qt=(t.flags&131072)!==0}else qt=!1,at&&(n.flags&1048576)!==0&&Wc(n,dl,n.index);switch(n.lanes=0,n.tag){case 2:var a=n.type;Nl(t,n),t=n.pendingProps;var f=Ei(n,Ot.current);Si(n,o),f=ds(null,n,a,t,f,o);var h=fs();return n.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,Vt(a)?(h=!0,sl(n)):h=!1,n.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,is(n),f.updater=xl,n.stateNode=f,f._reactInternals=n,bs(n,a,t,o),n=ks(null,n,a,!0,h,o)):(n.tag=0,at&&h&&qa(n),Bt(null,n,f,o),n=n.child),n;case 16:a=n.elementType;e:{switch(Nl(t,n),t=n.pendingProps,f=a._init,a=f(a._payload),n.type=a,f=n.tag=Hg(a),t=Nn(a,t),f){case 0:n=vs(null,n,a,t,o);break e;case 1:n=Bd(null,n,a,t,o);break e;case 11:n=Ld(null,n,a,t,o);break e;case 14:n=Dd(null,n,a,Nn(a.type,t),o);break e}throw Error(r(306,a,""))}return n;case 0:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Nn(a,f),vs(t,n,a,f,o);case 1:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Nn(a,f),Bd(t,n,a,f,o);case 3:e:{if(Ud(n),t===null)throw Error(r(387));a=n.pendingProps,h=n.memoizedState,f=h.element,td(t,n),yl(n,a,null,o);var _=n.memoizedState;if(a=_.element,h.isDehydrated)if(h={element:a,isDehydrated:!1,cache:_.cache,pendingSuspenseBoundaries:_.pendingSuspenseBoundaries,transitions:_.transitions},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){f=Ci(Error(r(423)),n),n=$d(t,n,a,o,f);break e}else if(a!==f){f=Ci(Error(r(424)),n),n=$d(t,n,a,o,f);break e}else for(on=gr(n.stateNode.containerInfo.firstChild),rn=n,at=!0,Sn=null,o=Jc(n,null,a,o),n.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(ki(),a===f){n=ir(t,n,o);break e}Bt(t,n,a,o)}n=n.child}return n;case 5:return id(n),t===null&&Za(n),a=n.type,f=n.pendingProps,h=t!==null?t.memoizedProps:null,_=f.children,ja(a,f)?_=null:h!==null&&ja(a,h)&&(n.flags|=32),Fd(t,n),Bt(t,n,_,o),n.child;case 6:return t===null&&Za(n),null;case 13:return jd(t,n,o);case 4:return os(n,n.stateNode.containerInfo),a=n.pendingProps,t===null?n.child=wi(n,null,a,o):Bt(t,n,a,o),n.child;case 11:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Nn(a,f),Ld(t,n,a,f,o);case 7:return Bt(t,n,n.pendingProps,o),n.child;case 8:return Bt(t,n,n.pendingProps.children,o),n.child;case 12:return Bt(t,n,n.pendingProps.children,o),n.child;case 10:e:{if(a=n.type._context,f=n.pendingProps,h=n.memoizedProps,_=f.value,nt(ml,a._currentValue),a._currentValue=_,h!==null)if(xn(h.value,_)){if(h.children===f.children&&!Wt.current){n=ir(t,n,o);break e}}else for(h=n.child,h!==null&&(h.return=n);h!==null;){var N=h.dependencies;if(N!==null){_=h.child;for(var R=N.firstContext;R!==null;){if(R.context===a){if(h.tag===1){R=rr(-1,o&-o),R.tag=2;var U=h.updateQueue;if(U!==null){U=U.shared;var Q=U.pending;Q===null?R.next=R:(R.next=Q.next,Q.next=R),U.pending=R}}h.lanes|=o,R=h.alternate,R!==null&&(R.lanes|=o),ns(h.return,o,n),N.lanes|=o;break}R=R.next}}else if(h.tag===10)_=h.type===n.type?null:h.child;else if(h.tag===18){if(_=h.return,_===null)throw Error(r(341));_.lanes|=o,N=_.alternate,N!==null&&(N.lanes|=o),ns(_,o,n),_=h.sibling}else _=h.child;if(_!==null)_.return=h;else for(_=h;_!==null;){if(_===n){_=null;break}if(h=_.sibling,h!==null){h.return=_.return,_=h;break}_=_.return}h=_}Bt(t,n,f.children,o),n=n.child}return n;case 9:return f=n.type,a=n.pendingProps.children,Si(n,o),f=hn(f),a=a(f),n.flags|=1,Bt(t,n,a,o),n.child;case 14:return a=n.type,f=Nn(a,n.pendingProps),f=Nn(a.type,f),Dd(t,n,a,f,o);case 15:return Pd(t,n,n.type,n.pendingProps,o);case 17:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Nn(a,f),Nl(t,n),n.tag=1,Vt(a)?(t=!0,sl(n)):t=!1,Si(n,o),Cd(n,a,f),bs(n,a,f,o),ks(null,n,a,!0,t,o);case 19:return Kd(t,n,o);case 22:return zd(t,n,o)}throw Error(r(156,n.tag))};function hf(t,n){return $o(t,n)}function jg(t,n,o,a){this.tag=t,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bn(t,n,o,a){return new jg(t,n,o,a)}function js(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Hg(t){if(typeof t=="function")return js(t)?1:0;if(t!=null){if(t=t.$$typeof,t===X)return 11;if(t===P)return 14}return 2}function Cr(t,n){var o=t.alternate;return o===null?(o=bn(t.tag,n,t.key,t.mode),o.elementType=t.elementType,o.type=t.type,o.stateNode=t.stateNode,o.alternate=t,t.alternate=o):(o.pendingProps=n,o.type=t.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=t.flags&14680064,o.childLanes=t.childLanes,o.lanes=t.lanes,o.child=t.child,o.memoizedProps=t.memoizedProps,o.memoizedState=t.memoizedState,o.updateQueue=t.updateQueue,n=t.dependencies,o.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},o.sibling=t.sibling,o.index=t.index,o.ref=t.ref,o}function zl(t,n,o,a,f,h){var _=2;if(a=t,typeof t=="function")js(t)&&(_=1);else if(typeof t=="string")_=5;else e:switch(t){case Z:return Zr(o.children,f,h,n);case G:_=8,f|=8;break;case te:return t=bn(12,o,n,f|2),t.elementType=te,t.lanes=h,t;case fe:return t=bn(13,o,n,f),t.elementType=fe,t.lanes=h,t;case q:return t=bn(19,o,n,f),t.elementType=q,t.lanes=h,t;case ae:return Fl(o,f,h,n);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case D:_=10;break e;case ne:_=9;break e;case X:_=11;break e;case P:_=14;break e;case le:_=16,a=null;break e}throw Error(r(130,t==null?t:typeof t,""))}return n=bn(_,o,n,f),n.elementType=t,n.type=a,n.lanes=h,n}function Zr(t,n,o,a){return t=bn(7,t,a,n),t.lanes=o,t}function Fl(t,n,o,a){return t=bn(22,t,a,n),t.elementType=ae,t.lanes=o,t.stateNode={isHidden:!1},t}function Hs(t,n,o){return t=bn(6,t,null,n),t.lanes=o,t}function Ks(t,n,o){return n=bn(4,t.children!==null?t.children:[],t.key,n),n.lanes=o,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}function Kg(t,n,o,a,f){this.tag=n,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=dr(0),this.expirationTimes=dr(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dr(0),this.identifierPrefix=a,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function Gs(t,n,o,a,f,h,_,N,R){return t=new Kg(t,n,o,N,R),n===1?(n=1,h===!0&&(n|=8)):n=0,h=bn(3,null,null,n),t.current=h,h.stateNode=t,h.memoizedState={element:a,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},is(h),t}function Gg(t,n,o){var a=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:I,key:a==null?null:""+a,children:t,containerInfo:n,implementation:o}}function gf(t){if(!t)return br;t=t._reactInternals;e:{if(Zn(t)!==t||t.tag!==1)throw Error(r(170));var n=t;do{switch(n.tag){case 3:n=n.stateNode.context;break e;case 1:if(Vt(n.type)){n=n.stateNode.__reactInternalMemoizedMergedChildContext;break e}}n=n.return}while(n!==null);throw Error(r(171))}if(t.tag===1){var o=t.type;if(Vt(o))return Hc(t,o,n)}return n}function yf(t,n,o,a,f,h,_,N,R){return t=Gs(o,a,!0,t,f,h,_,N,R),t.context=gf(null),o=t.current,a=Ut(),f=Sr(o),h=rr(a,f),h.callback=n??null,vr(o,h,f),t.current.lanes=f,fr(t,f,a),Qt(t,a),t}function Bl(t,n,o,a){var f=n.current,h=Ut(),_=Sr(f);return o=gf(o),n.context===null?n.context=o:n.pendingContext=o,n=rr(h,_),n.payload={element:t},a=a===void 0?null:a,a!==null&&(n.callback=a),t=vr(f,n,_),t!==null&&(An(t,f,_,h),gl(t,f,_)),_}function Ul(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function bf(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var o=t.retryLane;t.retryLane=o!==0&&o<n?o:n}}function Ws(t,n){bf(t,n),(t=t.alternate)&&bf(t,n)}function Wg(){return null}var Ef=typeof reportError=="function"?reportError:function(t){console.error(t)};function Vs(t){this._internalRoot=t}$l.prototype.render=Vs.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(r(409));Bl(t,n,null,null)},$l.prototype.unmount=Vs.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;qr(function(){Bl(null,t,null,null)}),n[Xn]=null}};function $l(t){this._internalRoot=t}$l.prototype.unstable_scheduleHydration=function(t){if(t){var n=Fr();t={blockedOn:null,target:t,priority:n};for(var o=0;o<xt.length&&n!==0&&n<xt[o].priority;o++);xt.splice(o,0,t),o===0&&ic(t)}};function qs(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function jl(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function _f(){}function Vg(t,n,o,a,f){if(f){if(typeof a=="function"){var h=a;a=function(){var U=Ul(_);h.call(U)}}var _=yf(n,a,t,0,null,!1,!1,"",_f);return t._reactRootContainer=_,t[Xn]=_.current,ro(t.nodeType===8?t.parentNode:t),qr(),_}for(;f=t.lastChild;)t.removeChild(f);if(typeof a=="function"){var N=a;a=function(){var U=Ul(R);N.call(U)}}var R=Gs(t,0,!1,null,null,!1,!1,"",_f);return t._reactRootContainer=R,t[Xn]=R.current,ro(t.nodeType===8?t.parentNode:t),qr(function(){Bl(n,R,o,a)}),R}function Hl(t,n,o,a,f){var h=o._reactRootContainer;if(h){var _=h;if(typeof f=="function"){var N=f;f=function(){var R=Ul(_);N.call(R)}}Bl(n,_,t,f)}else _=Vg(o,n,t,f,a);return Ul(_)}Gi=function(t){switch(t.tag){case 3:var n=t.stateNode;if(n.current.memoizedState.isDehydrated){var o=cr(n.pendingLanes);o!==0&&(Ki(n,o|1),Qt(n,st()),(qe&6)===0&&(Ri=st()+500,Er()))}break;case 13:qr(function(){var a=nr(t,1);if(a!==null){var f=Ut();An(a,t,1,f)}}),Ws(t,1)}},ht=function(t){if(t.tag===13){var n=nr(t,134217728);if(n!==null){var o=Ut();An(n,t,134217728,o)}Ws(t,134217728)}},Qe=function(t){if(t.tag===13){var n=Sr(t),o=nr(t,n);if(o!==null){var a=Ut();An(o,t,n,a)}Ws(t,n)}},Fr=function(){return Ve},zn=function(t,n){var o=Ve;try{return Ve=t,n()}finally{Ve=o}},li=function(t,n,o){switch(n){case"input":if(tn(t,o),n=o.name,o.type==="radio"&&n!=null){for(o=t;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll("input[name="+JSON.stringify(""+n)+'][type="radio"]'),n=0;n<o.length;n++){var a=o[n];if(a!==t&&a.form===t.form){var f=ll(a);if(!f)throw Error(r(90));ar(a),tn(a,f)}}}break;case"textarea":cn(t,o);break;case"select":n=o.value,n!=null&&Ln(t,!!o.multiple,n,!1)}},ce=Bs,Re=qr;var qg={usingClientEntryPoint:!1,Events:[lo,yi,ll,A,V,Bs]},vo={findFiberByHostInstance:Ur,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Yg={bundleType:vo.bundleType,version:vo.version,rendererPackageName:vo.rendererPackageName,rendererConfig:vo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:$.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Bo(t),t===null?null:t.stateNode},findFiberByHostInstance:vo.findFiberByHostInstance||Wg,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Kl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kl.isDisabled&&Kl.supportsFiber)try{ze=Kl.inject(Yg),Be=Kl}catch{}}return Zt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qg,Zt.createPortal=function(t,n){var o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!qs(n))throw Error(r(200));return Gg(t,n,null,o)},Zt.createRoot=function(t,n){if(!qs(t))throw Error(r(299));var o=!1,a="",f=Ef;return n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onRecoverableError!==void 0&&(f=n.onRecoverableError)),n=Gs(t,1,!1,null,null,o,!1,a,f),t[Xn]=n.current,ro(t.nodeType===8?t.parentNode:t),new Vs(n)},Zt.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=Bo(n),t=t===null?null:t.stateNode,t},Zt.flushSync=function(t){return qr(t)},Zt.hydrate=function(t,n,o){if(!jl(n))throw Error(r(200));return Hl(null,t,n,!0,o)},Zt.hydrateRoot=function(t,n,o){if(!qs(t))throw Error(r(405));var a=o!=null&&o.hydratedSources||null,f=!1,h="",_=Ef;if(o!=null&&(o.unstable_strictMode===!0&&(f=!0),o.identifierPrefix!==void 0&&(h=o.identifierPrefix),o.onRecoverableError!==void 0&&(_=o.onRecoverableError)),n=yf(n,null,t,1,o??null,f,!1,h,_),t[Xn]=n.current,ro(t),a)for(t=0;t<a.length;t++)o=a[t],f=o._getVersion,f=f(o._source),n.mutableSourceEagerHydrationData==null?n.mutableSourceEagerHydrationData=[o,f]:n.mutableSourceEagerHydrationData.push(o,f);return new $l(n)},Zt.render=function(t,n,o){if(!jl(n))throw Error(r(200));return Hl(null,t,n,!1,o)},Zt.unmountComponentAtNode=function(t){if(!jl(t))throw Error(r(40));return t._reactRootContainer?(qr(function(){Hl(null,null,t,!1,function(){t._reactRootContainer=null,t[Xn]=null})}),!0):!1},Zt.unstable_batchedUpdates=Bs,Zt.unstable_renderSubtreeIntoContainer=function(t,n,o,a){if(!jl(o))throw Error(r(200));if(t==null||t._reactInternals===void 0)throw Error(r(38));return Hl(t,n,o,!1,a)},Zt.version="18.3.1-next-f1338f8080-20240426",Zt}var Tf;function iy(){if(Tf)return Zs.exports;Tf=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(i){console.error(i)}}return e(),Zs.exports=ry(),Zs.exports}var Af;function oy(){if(Af)return Gl;Af=1;var e=iy();return Gl.createRoot=e.createRoot,Gl.hydrateRoot=e.hydrateRoot,Gl}var ly=oy();const ay=Mo(ly);/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sy=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Mp=(...e)=>e.filter((i,r,l)=>!!i&&i.trim()!==""&&l.indexOf(i)===r).join(" ").trim();/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var uy={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.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cy=ue.forwardRef(({color:e="currentColor",size:i=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:s="",children:c,iconNode:u,...d},p)=>ue.createElement("svg",{ref:p,...uy,width:i,height:i,stroke:e,strokeWidth:l?Number(r)*24/Number(i):r,className:Mp("lucide",s),...d},[...u.map(([m,g])=>ue.createElement(m,g)),...Array.isArray(c)?c:[c]]));/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Kt=(e,i)=>{const r=ue.forwardRef(({className:l,...s},c)=>ue.createElement(cy,{ref:c,iconNode:i,className:Mp(`lucide-${sy(e)}`,l),...s}));return r.displayName=`${e}`,r};/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dy=Kt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Lp=Kt("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fy=Kt("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const py=Kt("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.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const my=Kt("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hy=Kt("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Dp=Kt("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ku=Kt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gy=Kt("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.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Pp=Kt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zp=Kt("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yy=Kt("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const by=Kt("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.469.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=Kt("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _y=Kt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Fp="openkb_api_base",Bp="openkb_token";function Up(){return localStorage.getItem(Fp)||""}function ua(){return localStorage.getItem(Bp)||""}function vy(e,i){localStorage.setItem(Fp,e),localStorage.setItem(Bp,i)}function $p(){return!!ua()}function Pu(){return Up().replace(/\/$/,"")}function zu(){window.dispatchEvent(new CustomEvent("openkb:unauthorized"))}async function Rn(e,{method:i="GET",body:r,headers:l}={}){const s=ua(),c={...r&&!(r instanceof FormData)?{"Content-Type":"application/json"}:{},...s?{Authorization:`Bearer ${s}`}:{},...l},u={method:i,headers:c};r!==void 0&&(u.body=r instanceof FormData?r:JSON.stringify(r));const d=await fetch(Pu()+e,u);if(!d.ok){let m=`${d.status} ${d.statusText}`;try{const y=await d.json();m=typeof y.detail=="string"?y.detail:JSON.stringify(y.detail||y)}catch{}const g=new Error(m);throw g.status=d.status,d.status===401&&zu(),g}return(d.headers.get("content-type")||"").includes("application/json")?d.json():d.text()}const jt={listKbs:()=>Rn("/api/v1/kbs"),initKb:e=>Rn("/api/v1/init",{method:"POST",body:{kb:e}}),status:e=>Rn("/api/v1/status",{method:"POST",body:{kb:e}}),list:e=>Rn("/api/v1/list",{method:"POST",body:{kb:e}}),lint:(e,i)=>Rn("/api/v1/lint",{method:"POST",body:{kb:e,fix:i}}),watchStatus:e=>Rn("/api/v1/watch/status",{method:"POST",body:{kb:e}}),watchStart:(e,i)=>Rn("/api/v1/watch/start",{method:"POST",body:{kb:e,debounce:i}}),watchStop:e=>Rn("/api/v1/watch/stop",{method:"POST",body:{kb:e}}),chatSessions:e=>Rn("/api/v1/chat/sessions",{method:"POST",body:{kb:e}}),chatSessionLoad:(e,i)=>Rn("/api/v1/chat/sessions/load",{method:"POST",body:{kb:e,session_id:i}}),chatSessionDelete:(e,i)=>Rn("/api/v1/chat/sessions/delete",{method:"POST",body:{kb:e,session_id:i}})},jp=ue.createContext(null);function ky({children:e}){const[i,r]=ue.useState(Up()),[l,s]=ue.useState(ua()),[c,u]=ue.useState([]),[d,p]=ue.useState(null),[m,g]=ue.useState("overview"),[y,E]=ue.useState(!$p()),[b,x]=ue.useState([]),[C,T]=ue.useState(!1),[w,F]=ue.useState(null),L=ue.useRef(null),[$,K]=ue.useState(!1),I=ue.useCallback((fe,q)=>{const P=(fe||"").trim().replace(/\/$/,"");vy(P,(q||"").trim()),r(P),s((q||"").trim())},[]),Z=ue.useCallback(fe=>{g(fe),K(!1)},[]),G=ue.useCallback((fe,q="")=>{F({message:fe,kind:q}),clearTimeout(L.current),L.current=setTimeout(()=>F(null),3200)},[]),te=ue.useCallback(fe=>{x(fe?[{kind:"start",tag:"开始",body:"启动推理检索…"}]:[]),T(!!fe)},[]),D=ue.useCallback((fe,q,P)=>{fe!=="delta"&&x(le=>[...le,{kind:fe,tag:q,body:P}])},[]),ne=ue.useCallback(()=>{T(!1)},[]),X={apiBase:i,token:l,kbs:c,setKbs:u,kb:d,setKb:p,view:m,setView:Z,settingsOpen:y,setSettingsOpen:E,sidebarOpen:$,setSidebarOpen:K,saveConnection:I,toast:w,toastMsg:G,inspItems:b,inspBusy:C,inspReset:te,inspAdd:D,inspDone:ne};return k.jsx(jp.Provider,{value:X,children:e})}function Kn(){const e=ue.useContext(jp);if(!e)throw new Error("useApp must be used within AppProvider");return e}const wy=[{view:"overview",label:"概览",icon:my},{view:"documents",label:"文档",icon:py},{view:"query",label:"查询",icon:Pp},{view:"chat",label:"对话",icon:Dp},{view:"maintenance",label:"维护",icon:Ey}];function xy(){const{kbs:e,kb:i,setKb:r,view:l,setView:s,setSettingsOpen:c,sidebarOpen:u,setSidebarOpen:d,toastMsg:p}=Kn(),[m,g]=ue.useState(!1),[y,E]=ue.useState(!1),b=ue.useRef(null);ue.useEffect(()=>{function C(T){b.current&&!b.current.contains(T.target)&&g(!1)}return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[]);async function x(){const C=window.prompt("新知识库名称(字母/数字/下划线/连字符):");if(C){E(!0);try{await jt.initKb(C.trim()),r(C.trim()),g(!1),window.dispatchEvent(new CustomEvent("openkb:reload-kbs")),p("已创建:"+C.trim(),"ok")}catch(T){p(T.message,"err")}finally{E(!1)}}}return k.jsxs(k.Fragment,{children:[u&&k.jsx("div",{className:"sidebar-overlay",onClick:()=>d(!1)}),k.jsxs("aside",{className:`sidebar ${u?"open":""}`,children:[k.jsxs("div",{className:"brand",children:[k.jsx("span",{className:"brand-mark",children:"OK"}),k.jsx("span",{className:"brand-name",children:"OpenKB"})]}),k.jsxs("div",{className:"kb-switcher",ref:b,children:[k.jsxs("button",{className:"kb-current",type:"button",onClick:()=>g(C=>!C),children:[k.jsx("span",{className:"kb-current-dot"}),k.jsx("span",{className:"kb-current-name",children:i||"未选择知识库"}),k.jsx(dy,{className:"kb-chev",size:14})]}),m&&k.jsxs("div",{className:"kb-menu",children:[k.jsxs("div",{className:"kb-menu-list",children:[e.length===0&&k.jsx("div",{className:"kb-menu-item",style:{color:"var(--text-3)"},children:k.jsx("span",{className:"mi-name",children:"暂无知识库"})}),e.map(C=>k.jsxs("button",{className:`kb-menu-item ${C.name===i?"active":""}`,onClick:()=>{r(C.name),g(!1)},children:[k.jsx("span",{className:"mi-name",children:C.name}),k.jsxs("span",{className:"mi-meta",children:[C.document_count," 篇"]})]},C.name))]}),k.jsxs("button",{className:"kb-menu-new",onClick:x,disabled:y,children:[k.jsx(ku,{size:14}),"新建知识库"]})]})]}),k.jsx("nav",{className:"nav",children:wy.map(({view:C,label:T,icon:w})=>k.jsxs("button",{className:`nav-item ${l===C?"active":""}`,onClick:()=>s(C),children:[k.jsx(w,{size:16}),k.jsx("span",{children:T})]},C))}),k.jsx("div",{className:"sidebar-foot",children:k.jsx("button",{className:"icon-btn",title:"连接设置",onClick:()=>c(!0),children:k.jsx(yy,{size:16})})})]})]})}function Sy(){const{inspItems:e,inspBusy:i}=Kn(),r=ue.useRef(null);return ue.useEffect(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[e]),k.jsxs("aside",{className:"inspector",children:[k.jsxs("div",{className:"insp-head",children:[k.jsx("span",{className:"insp-title",children:"检索与推理"}),k.jsx("span",{className:`insp-status ${i?"busy":""}`,children:i?"推理中…":"空闲"})]}),k.jsx("div",{className:"insp-body",ref:r,children:e.length===0?k.jsxs("div",{className:"insp-empty",children:["发起查询或对话后,",k.jsx("br",{}),"无向量检索与推理过程将在此实时呈现。"]}):e.map((l,s)=>k.jsxs("div",{className:`timeline-item ${l.kind}`,children:[k.jsx("span",{className:"tl-tag",children:l.tag}),k.jsx("div",{className:"tl-body",dangerouslySetInnerHTML:{__html:l.body}})]},s))})]})}function Ny(){const{settingsOpen:e,setSettingsOpen:i,saveConnection:r,apiBase:l,token:s,toastMsg:c}=Kn(),[u,d]=ue.useState(l),[p,m]=ue.useState(s);if(ue.useEffect(()=>{d(l),m(s)},[l,s,e]),!e)return null;function g(){const y=(u||"").trim().replace(/\/$/,"");r(y,p),i(!1),c("已保存,正在刷新…","ok"),window.dispatchEvent(new CustomEvent("openkb:reload-kbs"))}return k.jsx("div",{className:"overlay",onClick:()=>i(!1),children:k.jsxs("div",{className:"modal",onClick:y=>y.stopPropagation(),children:[k.jsxs("div",{className:"modal-head",children:[k.jsx("h2",{children:"连接设置"}),k.jsx("button",{className:"icon-btn",onClick:()=>i(!1),children:k.jsx(_y,{size:18})})]}),k.jsxs("div",{className:"modal-body",children:[k.jsxs("label",{className:"field",children:[k.jsx("span",{className:"field-label",children:"API 地址"}),k.jsx("input",{value:u,onChange:y=>d(y.target.value),placeholder:"留空则同源访问(如 http://127.0.0.1:8000)"})]}),k.jsxs("label",{className:"field",children:[k.jsx("span",{className:"field-label",children:"Bearer Token"}),k.jsx("input",{type:"password",value:p,onChange:y=>m(y.target.value),placeholder:"OPENKB_API_TOKEN"})]}),k.jsx("p",{className:"field-hint",children:"配置信息仅保存在本浏览器本地。"})]}),k.jsxs("div",{className:"modal-foot",children:[k.jsx("button",{className:"btn btn-ghost",onClick:()=>i(!1),children:"取消"}),k.jsx("button",{className:"btn btn-primary",onClick:g,children:"保存"})]})]})})}function Cy(){const{toast:e}=Kn();return e?k.jsx("div",{className:`toast ${e.kind||""}`,children:e.message}):null}function Pi({title:e,desc:i,icon:r}){return k.jsxs("div",{className:"empty-state",children:[r||null,e&&k.jsx("h3",{children:e}),i&&k.jsx("p",{children:i})]})}function Hp({size:e=18}){return k.jsx("span",{className:"spinner",style:{width:e,height:e},"aria-label":"加载中"})}function Wl({label:e,value:i,sub:r,color:l}){return k.jsxs("div",{className:`stat-card ${l||""}`,children:[k.jsx("div",{className:"stat-label",children:e}),k.jsx("div",{className:"stat-value",children:i}),k.jsx("div",{className:"stat-sub",children:r})]})}function Rf(e){if(!e)return null;try{const i=new Date(e);return isNaN(i)?e:i.toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return e}}function Ty({kb:e}){const{setView:i,toastMsg:r}=Kn(),[l,s]=ue.useState(null),[c,u]=ue.useState(null);if(ue.useEffect(()=>{let g=!0;return s(null),u(null),Promise.all([jt.status(e),jt.list(e)]).then(([y,E])=>{g&&s({status:y,list:E})}).catch(y=>{g&&u(y.message)}),()=>{g=!1}},[e]),c)return k.jsx(Pi,{title:"加载失败",desc:c});if(!l)return k.jsx("div",{className:"empty-state",children:k.jsx(Hp,{})});const{status:d,list:p}=l,m=d.directories||{};return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"stat-grid",children:[k.jsx(Wl,{label:"已索引文档",value:d.total_indexed,sub:`原始文件 ${d.raw_count}`,color:"accent"}),k.jsx(Wl,{label:"概念页",value:m.concepts||0,sub:"跨文档综合",color:"cyan"}),k.jsx(Wl,{label:"摘要页",value:m.summaries||0,sub:"每篇一摘要",color:"green"}),k.jsx(Wl,{label:"报告页",value:m.reports||0,sub:"检查与合成",color:"purple"})]}),p.concepts&&p.concepts.length>0&&k.jsxs("div",{className:"panel",children:[k.jsxs("div",{className:"panel-head",children:[k.jsx("span",{className:"panel-title",children:"核心概念"}),k.jsx("span",{className:"tag",children:p.concepts.length})]}),k.jsx("div",{className:"concept-chips",children:p.concepts.slice(0,40).map(g=>k.jsx("button",{className:"concept-chip",onClick:()=>{i("query"),setTimeout(()=>window.dispatchEvent(new CustomEvent("openkb:prefill-query",{detail:`什么是「${g}」?请基于知识库解释。`})),30)},children:g},g))})]}),k.jsxs("div",{className:"panel",children:[k.jsx("div",{className:"panel-head",children:k.jsx("span",{className:"panel-title",children:"最近文档"})}),k.jsx("div",{className:"panel-body",children:p.documents&&p.documents.length>0?k.jsxs("table",{className:"table",children:[k.jsx("thead",{children:k.jsxs("tr",{children:[k.jsx("th",{children:"文档"}),k.jsx("th",{children:"类型"}),k.jsx("th",{children:"页数"})]})}),k.jsx("tbody",{children:p.documents.slice(-8).reverse().map(g=>k.jsxs("tr",{children:[k.jsx("td",{children:k.jsxs("span",{className:"icon-cell",children:[k.jsx("span",{className:"file-ico",children:g.display_type||g.type||"FILE"}),k.jsx("span",{className:"cell-name",children:g.name})]})}),k.jsx("td",{children:k.jsx("span",{className:"tag",children:g.display_type||g.type||"—"})}),k.jsx("td",{className:"cell-meta",children:g.pages!=null?g.pages:"—"})]},g.hash))})]}):k.jsx(Pi,{title:"暂无文档",desc:"去「文档」页添加文件开始编译。"})})]}),(d.last_compile||d.last_lint)&&k.jsxs("div",{className:"panel",children:[k.jsx("div",{className:"panel-head",children:k.jsx("span",{className:"panel-title",children:"活动"})}),k.jsxs("div",{className:"panel-body",children:[d.last_compile&&k.jsxs("div",{className:"log-line ok",style:{padding:"4px 16px"},children:["上次编译:",Rf(d.last_compile)]}),d.last_lint&&k.jsxs("div",{className:"log-line ok",style:{padding:"4px 16px"},children:["上次检查:",Rf(d.last_lint)]})]})]})]})}function Ay(e){const i=e.split(` + +`),r=i.pop(),l=[];for(const s of i){const c=s.match(/^event:\s*(.+)$/m),u=s.match(/^data:\s*(.+)$/m);if(c&&u){let d;try{d=JSON.parse(u[1])}catch{d={raw:u[1]}}l.push({event:c[1].trim(),data:d})}}return[l,r]}async function Kp(e,i){const r=e.body.getReader(),l=new TextDecoder;let s="";for(;;){const{value:c,done:u}=await r.read();if(u)break;s+=l.decode(c,{stream:!0});const[d,p]=Ay(s);s=p;for(const{event:m,data:g}of d)if(i(m,g)===!1)return}}function Gp(e,i={}){const r=ua(),l=e instanceof FormData;return{...e&&!l?{"Content-Type":"application/json"}:{},Accept:"text/event-stream",...r?{Authorization:`Bearer ${r}`}:{},...i}}async function Fu(e,i,r,l={}){const s=await fetch(Pu()+e,{method:"POST",headers:Gp(i),body:JSON.stringify(i),signal:l.signal});if(!s.ok){let c=`${s.status} ${s.statusText}`;try{const d=await s.json();c=typeof d.detail=="string"?d.detail:JSON.stringify(d.detail||d)}catch{}const u=new Error(c);throw u.status=s.status,s.status===401&&zu(),u}await Kp(s,r)}async function Wp(e,i,r,l={}){const s=await fetch(Pu()+e,{method:"POST",headers:Gp(i),body:i,signal:l.signal});if(!s.ok){let c=`${s.status} ${s.statusText}`;try{const d=await s.json();c=typeof d.detail=="string"?d.detail:JSON.stringify(d.detail||d)}catch{}const u=new Error(c);throw u.status=s.status,s.status===401&&zu(),u}await Kp(s,r)}function Ry(e){const i=(e.name.split(".").pop()||"").toLowerCase(),r=e.type==="url"?"URL":i.toUpperCase().slice(0,4)||"FILE";return k.jsxs("tr",{children:[k.jsx("td",{children:k.jsxs("span",{className:"icon-cell",children:[k.jsx("span",{className:"file-ico",children:r}),k.jsx("span",{className:"cell-name",children:e.name})]})}),k.jsx("td",{children:k.jsx("span",{className:"tag",children:e.display_type||e.type||"—"})}),k.jsx("td",{className:"cell-meta",children:e.pages!=null?e.pages:"—"}),k.jsx("td",{className:"cell-meta",children:e.hash.slice(0,8)}),k.jsx("td",{children:k.jsx("div",{className:"row-actions",children:k.jsx("button",{className:"btn btn-danger btn-sm","data-rm":e.name,children:"删除"})})})]},e.hash)}function Oy({kb:e}){const{inspReset:i,inspAdd:r,inspDone:l,toastMsg:s}=Kn(),[c,u]=ue.useState(null),[d,p]=ue.useState(null),[m,g]=ue.useState([]),[y,E]=ue.useState(!1),b=ue.useRef(null),x=ue.useCallback(()=>{u(null),p(null),jt.list(e).then(w=>u(w.documents||[])).catch(w=>p(w.message))},[e]);ue.useEffect(x,[x]);function C(w){if(!w||!w.length)return;const F=Array.from(w).map($=>({name:$.name,pct:10,status:"上传中"}));g(F),i(!0);const L=new FormData;L.append("kb",e),L.append("stream","true"),Array.from(w).forEach($=>L.append("files",$)),Wp("/api/v1/add",L,($,K)=>{if($==="file_start")g(I=>I.map(Z=>Z.name===K.original_name?{...Z,pct:50,status:"编译中"}:Z)),r("tool","编译",`处理 <code>${K.original_name}</code>`);else if($==="file_done"){const I=K.status==="added";g(Z=>Z.map(G=>G.name===K.original_name?{...G,pct:100,status:I?"已添加":K.status}:G)),r(I?"done":"tool",I?"完成":"跳过",`${K.original_name}:${K.message||K.status}`)}else $==="final"?s(`已添加 ${K.added_count},跳过 ${K.skipped_count},失败 ${K.failed_count}`,K.failed_count?"err":"ok"):$==="error"&&(s(K.message||"上传失败","err"),r("error","错误",K.message||""))}).then(()=>{r("done","结束","编译流程结束"),x()}).catch($=>{s($.message,"err"),r("error","错误",$.message)}).finally(()=>{l()})}async function T(w){if(window.confirm(`确定删除文档「${w}」并清理其 wiki 页面?`)){i(!0);try{await Fu("/api/v1/remove",{kb:e,identifier:w,stream:!0},(F,L)=>{F==="plan"?r("tool","计划",`将清理 ${L.name||w} 相关页面`):F==="final"?r("done","完成",`已删除 ${L.name||w}`):F==="error"&&(s(L.message||"删除失败","err"),r("error","错误",L.message||""))}),s("已删除","ok"),x()}catch(F){s(F.message,"err"),r("error","错误",F.message)}finally{l()}}}return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:`dropzone ${y?"drag":""}`,onClick:()=>b.current&&b.current.click(),onDragOver:w=>{w.preventDefault(),E(!0)},onDragLeave:()=>E(!1),onDrop:w=>{w.preventDefault(),E(!1),w.dataTransfer.files.length&&C(w.dataTransfer.files)},children:[k.jsx(fy,{size:28,style:{margin:"0 auto 8px",color:"var(--text-2)"}}),k.jsx("div",{className:"dz-title",children:"拖入文件或点击上传"}),k.jsx("div",{children:"PDF · Word · Markdown · PPT · HTML · Excel · CSV · TXT · URL"}),k.jsx("input",{ref:b,type:"file",multiple:!0,style:{display:"none"},onChange:w=>{w.target.files.length&&C(w.target.files),w.target.value=""}})]}),m.length>0&&k.jsxs("div",{className:"panel",children:[k.jsx("div",{className:"panel-head",children:k.jsx("span",{className:"panel-title",children:"上传进度"})}),k.jsx("div",{className:"panel-body",children:m.map((w,F)=>k.jsxs("div",{className:"upload-item",children:[k.jsx("span",{className:"up-name",children:w.name}),k.jsx("div",{className:"progress",children:k.jsx("span",{style:{width:`${w.pct}%`}})}),k.jsx("span",{className:"cell-meta",children:w.status})]},F))})]}),k.jsxs("div",{className:"panel",children:[k.jsxs("div",{className:"panel-head",children:[k.jsx("span",{className:"panel-title",children:"已索引文档"}),k.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:x,children:[k.jsx(gy,{size:14})," 刷新"]})]}),k.jsx("div",{className:"panel-body",children:d?k.jsx(Pi,{title:"加载失败",desc:d}):c===null?k.jsx("div",{className:"empty-state",children:k.jsx(Hp,{})}):c.length===0?k.jsx(Pi,{title:"暂无文档",desc:"上传文件后将自动编译为 wiki。"}):k.jsxs("table",{className:"table",children:[k.jsx("thead",{children:k.jsxs("tr",{children:[k.jsx("th",{children:"文档"}),k.jsx("th",{children:"类型"}),k.jsx("th",{children:"页数"}),k.jsx("th",{children:"哈希"}),k.jsx("th",{})]})}),k.jsx("tbody",{children:c.map(w=>{const F=Ry(w);return k.jsx("tr",{onClick:L=>{const $=L.target.closest("[data-rm]");$&&T($.getAttribute("data-rm"))},children:F.props.children},w.hash)})})]})})]})]})}function Vp(){const[e,i]=ue.useState(!1),r=ue.useRef(null),l=ue.useCallback(()=>{r.current&&r.current.abort()},[]),s=ue.useCallback(async(c,u,d)=>{if(r.current)return;const p=new AbortController;r.current=p,i(!0);try{c.form?await Wp(c.path,c.form,u,{signal:p.signal}):await Fu(c.path,c.payload,u,{signal:p.signal})}catch(m){p.signal.aborted?d&&d():u("error",{message:(m==null?void 0:m.message)||"请求失败"})}finally{r.current=null,i(!1)}},[]);return{busy:e,start:s,stop:l}}function Iy(e,i){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const My=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ly=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Dy={};function Of(e,i){return(Dy.jsx?Ly:My).test(e)}const Py=/[ \t\n\f\r]/g;function zy(e){return typeof e=="object"?e.type==="text"?If(e.value):!1:If(e)}function If(e){return e.replace(Py,"")===""}class Lo{constructor(i,r,l){this.normal=r,this.property=i,l&&(this.space=l)}}Lo.prototype.normal={};Lo.prototype.property={};Lo.prototype.space=void 0;function qp(e,i){const r={},l={};for(const s of e)Object.assign(r,s.property),Object.assign(l,s.normal);return new Lo(r,l,i)}function wu(e){return e.toLowerCase()}class Jt{constructor(i,r){this.attribute=r,this.property=i}}Jt.prototype.attribute="";Jt.prototype.booleanish=!1;Jt.prototype.boolean=!1;Jt.prototype.commaOrSpaceSeparated=!1;Jt.prototype.commaSeparated=!1;Jt.prototype.defined=!1;Jt.prototype.mustUseProperty=!1;Jt.prototype.number=!1;Jt.prototype.overloadedBoolean=!1;Jt.prototype.property="";Jt.prototype.spaceSeparated=!1;Jt.prototype.space=void 0;let Fy=0;const Le=ri(),Et=ri(),xu=ri(),ee=ri(),Je=ri(),ti=ri(),an=ri();function ri(){return 2**++Fy}const Su=Object.freeze(Object.defineProperty({__proto__:null,boolean:Le,booleanish:Et,commaOrSpaceSeparated:an,commaSeparated:ti,number:ee,overloadedBoolean:xu,spaceSeparated:Je},Symbol.toStringTag,{value:"Module"})),eu=Object.keys(Su);class Bu extends Jt{constructor(i,r,l,s){let c=-1;if(super(i,r),Mf(this,"space",s),typeof l=="number")for(;++c<eu.length;){const u=eu[c];Mf(this,eu[c],(l&Su[u])===Su[u])}}}Bu.prototype.defined=!0;function Mf(e,i,r){r&&(e[i]=r)}function Fi(e){const i={},r={};for(const[l,s]of Object.entries(e.properties)){const c=new Bu(l,e.transform(e.attributes||{},l),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(l)&&(c.mustUseProperty=!0),i[l]=c,r[wu(l)]=l,r[wu(c.attribute)]=l}return new Lo(i,r,e.space)}const Yp=Fi({properties:{ariaActiveDescendant:null,ariaAtomic:Et,ariaAutoComplete:null,ariaBusy:Et,ariaChecked:Et,ariaColCount:ee,ariaColIndex:ee,ariaColSpan:ee,ariaControls:Je,ariaCurrent:null,ariaDescribedBy:Je,ariaDetails:null,ariaDisabled:Et,ariaDropEffect:Je,ariaErrorMessage:null,ariaExpanded:Et,ariaFlowTo:Je,ariaGrabbed:Et,ariaHasPopup:null,ariaHidden:Et,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Je,ariaLevel:ee,ariaLive:null,ariaModal:Et,ariaMultiLine:Et,ariaMultiSelectable:Et,ariaOrientation:null,ariaOwns:Je,ariaPlaceholder:null,ariaPosInSet:ee,ariaPressed:Et,ariaReadOnly:Et,ariaRelevant:null,ariaRequired:Et,ariaRoleDescription:Je,ariaRowCount:ee,ariaRowIndex:ee,ariaRowSpan:ee,ariaSelected:Et,ariaSetSize:ee,ariaSort:null,ariaValueMax:ee,ariaValueMin:ee,ariaValueNow:ee,ariaValueText:null,role:null},transform(e,i){return i==="role"?i:"aria-"+i.slice(4).toLowerCase()}});function Qp(e,i){return i in e?e[i]:i}function Zp(e,i){return Qp(e,i.toLowerCase())}const By=Fi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ti,acceptCharset:Je,accessKey:Je,action:null,allow:null,allowFullScreen:Le,allowPaymentRequest:Le,allowUserMedia:Le,alpha:Le,alt:null,as:null,async:Le,autoCapitalize:null,autoComplete:Je,autoFocus:Le,autoPlay:Le,blocking:Je,capture:null,charSet:null,checked:Le,cite:null,className:Je,closedBy:null,colorSpace:null,cols:ee,colSpan:ee,command:null,commandFor:null,content:null,contentEditable:Et,controls:Le,controlsList:Je,coords:ee|ti,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Le,defer:Le,dir:null,dirName:null,disabled:Le,download:xu,draggable:Et,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Le,formTarget:null,headers:Je,height:ee,hidden:xu,high:ee,href:null,hrefLang:null,htmlFor:Je,httpEquiv:Je,id:null,imageSizes:null,imageSrcSet:null,inert:Le,inputMode:null,integrity:null,is:null,isMap:Le,itemId:null,itemProp:Je,itemRef:Je,itemScope:Le,itemType:Je,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Le,low:ee,manifest:null,max:null,maxLength:ee,media:null,method:null,min:null,minLength:ee,multiple:Le,muted:Le,name:null,nonce:null,noModule:Le,noValidate:Le,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Le,optimum:ee,pattern:null,ping:Je,placeholder:null,playsInline:Le,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Le,referrerPolicy:null,rel:Je,required:Le,reversed:Le,rows:ee,rowSpan:ee,sandbox:Je,scope:null,scoped:Le,seamless:Le,selected:Le,shadowRootClonable:Le,shadowRootCustomElementRegistry:Le,shadowRootDelegatesFocus:Le,shadowRootMode:null,shadowRootSerializable:Le,shape:null,size:ee,sizes:null,slot:null,span:ee,spellCheck:Et,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ee,step:null,style:null,tabIndex:ee,target:null,title:null,translate:null,type:null,typeMustMatch:Le,useMap:null,value:Et,width:ee,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Je,axis:null,background:null,bgColor:null,border:ee,borderColor:null,bottomMargin:ee,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Le,declare:Le,event:null,face:null,frame:null,frameBorder:null,hSpace:ee,leftMargin:ee,link:null,longDesc:null,lowSrc:null,marginHeight:ee,marginWidth:ee,noResize:Le,noHref:Le,noShade:Le,noWrap:Le,object:null,profile:null,prompt:null,rev:null,rightMargin:ee,rules:null,scheme:null,scrolling:Et,standby:null,summary:null,text:null,topMargin:ee,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ee,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Le,disablePictureInPicture:Le,disableRemotePlayback:Le,exportParts:ti,part:Je,prefix:null,property:null,results:ee,security:null,unselectable:null},space:"html",transform:Zp}),Uy=Fi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:an,accentHeight:ee,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ee,amplitude:ee,arabicForm:null,ascent:ee,attributeName:null,attributeType:null,azimuth:ee,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ee,by:null,calcMode:null,capHeight:ee,className:Je,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ee,diffuseConstant:ee,direction:null,display:null,dur:null,divisor:ee,dominantBaseline:null,download:Le,dx:null,dy:null,edgeMode:null,editable:null,elevation:ee,enableBackground:null,end:null,event:null,exponent:ee,externalResourcesRequired:null,fill:null,fillOpacity:ee,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ti,g2:ti,glyphName:ti,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ee,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ee,horizOriginX:ee,horizOriginY:ee,id:null,ideographic:ee,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ee,k:ee,k1:ee,k2:ee,k3:ee,k4:ee,kernelMatrix:an,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ee,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ee,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ee,overlineThickness:ee,paintOrder:null,panose1:null,path:null,pathLength:ee,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Je,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ee,pointsAtY:ee,pointsAtZ:ee,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:an,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:an,rev:an,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:an,requiredFeatures:an,requiredFonts:an,requiredFormats:an,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ee,specularExponent:ee,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ee,strikethroughThickness:ee,string:null,stroke:null,strokeDashArray:an,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ee,strokeOpacity:ee,strokeWidth:null,style:null,surfaceScale:ee,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:an,tabIndex:ee,tableValues:null,target:null,targetX:ee,targetY:ee,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:an,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ee,underlineThickness:ee,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ee,values:null,vAlphabetic:ee,vMathematical:ee,vectorEffect:null,vHanging:ee,vIdeographic:ee,version:null,vertAdvY:ee,vertOriginX:ee,vertOriginY:ee,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ee,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Qp}),Xp=Fi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,i){return"xlink:"+i.slice(5).toLowerCase()}}),Jp=Fi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Zp}),em=Fi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,i){return"xml:"+i.slice(3).toLowerCase()}}),$y={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},jy=/[A-Z]/g,Lf=/-[a-z]/g,Hy=/^data[-\w.:]+$/i;function Ky(e,i){const r=wu(i);let l=i,s=Jt;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&Hy.test(i)){if(i.charAt(4)==="-"){const c=i.slice(5).replace(Lf,Wy);l="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=i.slice(4);if(!Lf.test(c)){let u=c.replace(jy,Gy);u.charAt(0)!=="-"&&(u="-"+u),i="data"+u}}s=Bu}return new s(l,i)}function Gy(e){return"-"+e.toLowerCase()}function Wy(e){return e.charAt(1).toUpperCase()}const Vy=qp([Yp,By,Xp,Jp,em],"html"),Uu=qp([Yp,Uy,Xp,Jp,em],"svg");function qy(e){return e.join(" ").trim()}var Ii={},tu,Df;function Yy(){if(Df)return tu;Df=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i=/\n/g,r=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,d=/^\s+|\s+$/g,p=` +`,m="/",g="*",y="",E="comment",b="declaration";function x(T,w){if(typeof T!="string")throw new TypeError("First argument must be a string");if(!T)return[];w=w||{};var F=1,L=1;function $(q){var P=q.match(i);P&&(F+=P.length);var le=q.lastIndexOf(p);L=~le?q.length-le:L+q.length}function K(){var q={line:F,column:L};return function(P){return P.position=new I(q),te(),P}}function I(q){this.start=q,this.end={line:F,column:L},this.source=w.source}I.prototype.content=T;function Z(q){var P=new Error(w.source+":"+F+":"+L+": "+q);if(P.reason=q,P.filename=w.source,P.line=F,P.column=L,P.source=T,!w.silent)throw P}function G(q){var P=q.exec(T);if(P){var le=P[0];return $(le),T=T.slice(le.length),P}}function te(){G(r)}function D(q){var P;for(q=q||[];P=ne();)P!==!1&&q.push(P);return q}function ne(){var q=K();if(!(m!=T.charAt(0)||g!=T.charAt(1))){for(var P=2;y!=T.charAt(P)&&(g!=T.charAt(P)||m!=T.charAt(P+1));)++P;if(P+=2,y===T.charAt(P-1))return Z("End of comment missing");var le=T.slice(2,P-2);return L+=2,$(le),T=T.slice(P),L+=2,q({type:E,comment:le})}}function X(){var q=K(),P=G(l);if(P){if(ne(),!G(s))return Z("property missing ':'");var le=G(c),ae=q({type:b,property:C(P[0].replace(e,y)),value:le?C(le[0].replace(e,y)):y});return G(u),ae}}function fe(){var q=[];D(q);for(var P;P=X();)P!==!1&&(q.push(P),D(q));return q}return te(),fe()}function C(T){return T?T.replace(d,y):y}return tu=x,tu}var Pf;function Qy(){if(Pf)return Ii;Pf=1;var e=Ii&&Ii.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(Ii,"__esModule",{value:!0}),Ii.default=r;const i=e(Yy());function r(l,s){let c=null;if(!l||typeof l!="string")return c;const u=(0,i.default)(l),d=typeof s=="function";return u.forEach(p=>{if(p.type!=="declaration")return;const{property:m,value:g}=p;d?s(m,g,p):g&&(c=c||{},c[m]=g)}),c}return Ii}var wo={},zf;function Zy(){if(zf)return wo;zf=1,Object.defineProperty(wo,"__esModule",{value:!0}),wo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,i=/-([a-z])/g,r=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,c=function(m){return!m||r.test(m)||e.test(m)},u=function(m,g){return g.toUpperCase()},d=function(m,g){return"".concat(g,"-")},p=function(m,g){return g===void 0&&(g={}),c(m)?m:(m=m.toLowerCase(),g.reactCompat?m=m.replace(s,d):m=m.replace(l,d),m.replace(i,u))};return wo.camelCase=p,wo}var xo,Ff;function Xy(){if(Ff)return xo;Ff=1;var e=xo&&xo.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},i=e(Qy()),r=Zy();function l(s,c){var u={};return!s||typeof s!="string"||(0,i.default)(s,function(d,p){d&&p&&(u[(0,r.camelCase)(d,c)]=p)}),u}return l.default=l,xo=l,xo}var Jy=Xy();const eb=Mo(Jy),tm=nm("end"),$u=nm("start");function nm(e){return i;function i(r){const l=r&&r.position&&r.position[e]||{};if(typeof l.line=="number"&&l.line>0&&typeof l.column=="number"&&l.column>0)return{line:l.line,column:l.column,offset:typeof l.offset=="number"&&l.offset>-1?l.offset:void 0}}}function tb(e){const i=$u(e),r=tm(e);if(i&&r)return{start:i,end:r}}function To(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Bf(e.position):"start"in e||"end"in e?Bf(e):"line"in e||"column"in e?Nu(e):""}function Nu(e){return Uf(e&&e.line)+":"+Uf(e&&e.column)}function Bf(e){return Nu(e&&e.start)+"-"+Nu(e&&e.end)}function Uf(e){return e&&typeof e=="number"?e:1}class Pt extends Error{constructor(i,r,l){super(),typeof r=="string"&&(l=r,r=void 0);let s="",c={},u=!1;if(r&&("line"in r&&"column"in r?c={place:r}:"start"in r&&"end"in r?c={place:r}:"type"in r?c={ancestors:[r],place:r.position}:c={...r}),typeof i=="string"?s=i:!c.cause&&i&&(u=!0,s=i.message,c.cause=i),!c.ruleId&&!c.source&&typeof l=="string"){const p=l.indexOf(":");p===-1?c.ruleId=l:(c.source=l.slice(0,p),c.ruleId=l.slice(p+1))}if(!c.place&&c.ancestors&&c.ancestors){const p=c.ancestors[c.ancestors.length-1];p&&(c.place=p.position)}const d=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=d?d.line:void 0,this.name=To(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=u&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Pt.prototype.file="";Pt.prototype.name="";Pt.prototype.reason="";Pt.prototype.message="";Pt.prototype.stack="";Pt.prototype.column=void 0;Pt.prototype.line=void 0;Pt.prototype.ancestors=void 0;Pt.prototype.cause=void 0;Pt.prototype.fatal=void 0;Pt.prototype.place=void 0;Pt.prototype.ruleId=void 0;Pt.prototype.source=void 0;const ju={}.hasOwnProperty,nb=new Map,rb=/[A-Z]/g,ib=new Set(["table","tbody","thead","tfoot","tr"]),ob=new Set(["td","th"]),rm="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function lb(e,i){if(!i||i.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=i.filePath||void 0;let l;if(i.development){if(typeof i.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");l=mb(r,i.jsxDEV)}else{if(typeof i.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof i.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");l=pb(r,i.jsx,i.jsxs)}const s={Fragment:i.Fragment,ancestors:[],components:i.components||{},create:l,elementAttributeNameCase:i.elementAttributeNameCase||"react",evaluater:i.createEvaluater?i.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:i.ignoreInvalidStyle||!1,passKeys:i.passKeys!==!1,passNode:i.passNode||!1,schema:i.space==="svg"?Uu:Vy,stylePropertyNameCase:i.stylePropertyNameCase||"dom",tableCellAlignToStyle:i.tableCellAlignToStyle!==!1},c=im(s,e,void 0);return c&&typeof c!="string"?c:s.create(e,s.Fragment,{children:c||void 0},void 0)}function im(e,i,r){if(i.type==="element")return ab(e,i,r);if(i.type==="mdxFlowExpression"||i.type==="mdxTextExpression")return sb(e,i);if(i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement")return cb(e,i,r);if(i.type==="mdxjsEsm")return ub(e,i);if(i.type==="root")return db(e,i,r);if(i.type==="text")return fb(e,i)}function ab(e,i,r){const l=e.schema;let s=l;i.tagName.toLowerCase()==="svg"&&l.space==="html"&&(s=Uu,e.schema=s),e.ancestors.push(i);const c=lm(e,i.tagName,!1),u=hb(e,i);let d=Ku(e,i);return ib.has(i.tagName)&&(d=d.filter(function(p){return typeof p=="string"?!zy(p):!0})),om(e,u,c,i),Hu(u,d),e.ancestors.pop(),e.schema=l,e.create(i,c,u,r)}function sb(e,i){if(i.data&&i.data.estree&&e.evaluater){const l=i.data.estree.body[0];return l.type,e.evaluater.evaluateExpression(l.expression)}Oo(e,i.position)}function ub(e,i){if(i.data&&i.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(i.data.estree);Oo(e,i.position)}function cb(e,i,r){const l=e.schema;let s=l;i.name==="svg"&&l.space==="html"&&(s=Uu,e.schema=s),e.ancestors.push(i);const c=i.name===null?e.Fragment:lm(e,i.name,!0),u=gb(e,i),d=Ku(e,i);return om(e,u,c,i),Hu(u,d),e.ancestors.pop(),e.schema=l,e.create(i,c,u,r)}function db(e,i,r){const l={};return Hu(l,Ku(e,i)),e.create(i,e.Fragment,l,r)}function fb(e,i){return i.value}function om(e,i,r,l){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(i.node=l)}function Hu(e,i){if(i.length>0){const r=i.length>1?i:i[0];r&&(e.children=r)}}function pb(e,i,r){return l;function l(s,c,u,d){const m=Array.isArray(u.children)?r:i;return d?m(c,u,d):m(c,u)}}function mb(e,i){return r;function r(l,s,c,u){const d=Array.isArray(c.children),p=$u(l);return i(s,c,u,d,{columnNumber:p?p.column-1:void 0,fileName:e,lineNumber:p?p.line:void 0},void 0)}}function hb(e,i){const r={};let l,s;for(s in i.properties)if(s!=="children"&&ju.call(i.properties,s)){const c=yb(e,s,i.properties[s]);if(c){const[u,d]=c;e.tableCellAlignToStyle&&u==="align"&&typeof d=="string"&&ob.has(i.tagName)?l=d:r[u]=d}}if(l){const c=r.style||(r.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return r}function gb(e,i){const r={};for(const l of i.attributes)if(l.type==="mdxJsxExpressionAttribute")if(l.data&&l.data.estree&&e.evaluater){const c=l.data.estree.body[0];c.type;const u=c.expression;u.type;const d=u.properties[0];d.type,Object.assign(r,e.evaluater.evaluateExpression(d.argument))}else Oo(e,i.position);else{const s=l.name;let c;if(l.value&&typeof l.value=="object")if(l.value.data&&l.value.data.estree&&e.evaluater){const d=l.value.data.estree.body[0];d.type,c=e.evaluater.evaluateExpression(d.expression)}else Oo(e,i.position);else c=l.value===null?!0:l.value;r[s]=c}return r}function Ku(e,i){const r=[];let l=-1;const s=e.passKeys?new Map:nb;for(;++l<i.children.length;){const c=i.children[l];let u;if(e.passKeys){const p=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(p){const m=s.get(p)||0;u=p+"-"+m,s.set(p,m+1)}}const d=im(e,c,u);d!==void 0&&r.push(d)}return r}function yb(e,i,r){const l=Ky(e.schema,i);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=l.commaSeparated?Iy(r):qy(r)),l.property==="style"){let s=typeof r=="object"?r:bb(e,String(r));return e.stylePropertyNameCase==="css"&&(s=Eb(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&l.space?$y[l.property]||l.property:l.attribute,r]}}function bb(e,i){try{return eb(i,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const l=r,s=new Pt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:l,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=rm+"#cannot-parse-style-attribute",s}}function lm(e,i,r){let l;if(!r)l={type:"Literal",value:i};else if(i.includes(".")){const s=i.split(".");let c=-1,u;for(;++c<s.length;){const d=Of(s[c])?{type:"Identifier",name:s[c]}:{type:"Literal",value:s[c]};u=u?{type:"MemberExpression",object:u,property:d,computed:!!(c&&d.type==="Literal"),optional:!1}:d}l=u}else l=Of(i)&&!/^[a-z]/.test(i)?{type:"Identifier",name:i}:{type:"Literal",value:i};if(l.type==="Literal"){const s=l.value;return ju.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(l);Oo(e)}function Oo(e,i){const r=new Pt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:i,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=rm+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Eb(e){const i={};let r;for(r in e)ju.call(e,r)&&(i[_b(r)]=e[r]);return i}function _b(e){let i=e.replace(rb,vb);return i.slice(0,3)==="ms-"&&(i="-"+i),i}function vb(e){return"-"+e.toLowerCase()}const nu={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},kb={};function Gu(e,i){const r=kb,l=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,s=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return am(e,l,s)}function am(e,i,r){if(wb(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(i&&"alt"in e&&e.alt)return e.alt;if("children"in e)return $f(e.children,i,r)}return Array.isArray(e)?$f(e,i,r):""}function $f(e,i,r){const l=[];let s=-1;for(;++s<e.length;)l[s]=am(e[s],i,r);return l.join("")}function wb(e){return!!(e&&typeof e=="object")}const jf=document.createElement("i");function Wu(e){const i="&"+e+";";jf.innerHTML=i;const r=jf.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===i?!1:r}function sn(e,i,r,l){const s=e.length;let c=0,u;if(i<0?i=-i>s?0:s+i:i=i>s?s:i,r=r>0?r:0,l.length<1e4)u=Array.from(l),u.unshift(i,r),e.splice(...u);else for(r&&e.splice(i,r);c<l.length;)u=l.slice(c,c+1e4),u.unshift(i,0),e.splice(...u),c+=1e4,i+=1e4}function En(e,i){return e.length>0?(sn(e,e.length,0,i),e):i}const Hf={}.hasOwnProperty;function sm(e){const i={};let r=-1;for(;++r<e.length;)xb(i,e[r]);return i}function xb(e,i){let r;for(r in i){const s=(Hf.call(e,r)?e[r]:void 0)||(e[r]={}),c=i[r];let u;if(c)for(u in c){Hf.call(s,u)||(s[u]=[]);const d=c[u];Sb(s[u],Array.isArray(d)?d:d?[d]:[])}}}function Sb(e,i){let r=-1;const l=[];for(;++r<i.length;)(i[r].add==="after"?e:l).push(i[r]);sn(e,0,0,l)}function um(e,i){const r=Number.parseInt(e,i);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function On(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ht=Rr(/[A-Za-z]/),Dt=Rr(/[\dA-Za-z]/),Nb=Rr(/[#-'*+\--9=?A-Z^-~]/);function ra(e){return e!==null&&(e<32||e===127)}const Cu=Rr(/\d/),Cb=Rr(/[\dA-Fa-f]/),Tb=Rr(/[!-/:-@[-`{-~]/);function Ce(e){return e!==null&&e<-2}function et(e){return e!==null&&(e<0||e===32)}function Ue(e){return e===-2||e===-1||e===32}const ca=Rr(new RegExp("\\p{P}|\\p{S}","u")),ni=Rr(/\s/);function Rr(e){return i;function i(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Bi(e){const i=[];let r=-1,l=0,s=0;for(;++r<e.length;){const c=e.charCodeAt(r);let u="";if(c===37&&Dt(e.charCodeAt(r+1))&&Dt(e.charCodeAt(r+2)))s=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(u=String.fromCharCode(c));else if(c>55295&&c<57344){const d=e.charCodeAt(r+1);c<56320&&d>56319&&d<57344?(u=String.fromCharCode(c,d),s=1):u="�"}else u=String.fromCharCode(c);u&&(i.push(e.slice(l,r),encodeURIComponent(u)),l=r+s+1,u=""),s&&(r+=s,s=0)}return i.join("")+e.slice(l)}function We(e,i,r,l){const s=l?l-1:Number.POSITIVE_INFINITY;let c=0;return u;function u(p){return Ue(p)?(e.enter(r),d(p)):i(p)}function d(p){return Ue(p)&&c++<s?(e.consume(p),d):(e.exit(r),i(p))}}const Ab={tokenize:Rb};function Rb(e){const i=e.attempt(this.parser.constructs.contentInitial,l,s);let r;return i;function l(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),We(e,i,"linePrefix")}function s(d){return e.enter("paragraph"),c(d)}function c(d){const p=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=p),r=p,u(d)}function u(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return Ce(d)?(e.consume(d),e.exit("chunkText"),c):(e.consume(d),u)}}const Ob={tokenize:Ib},Kf={tokenize:Mb};function Ib(e){const i=this,r=[];let l=0,s,c,u;return d;function d(L){if(l<r.length){const $=r[l];return i.containerState=$[1],e.attempt($[0].continuation,p,m)(L)}return m(L)}function p(L){if(l++,i.containerState._closeFlow){i.containerState._closeFlow=void 0,s&&F();const $=i.events.length;let K=$,I;for(;K--;)if(i.events[K][0]==="exit"&&i.events[K][1].type==="chunkFlow"){I=i.events[K][1].end;break}w(l);let Z=$;for(;Z<i.events.length;)i.events[Z][1].end={...I},Z++;return sn(i.events,K+1,0,i.events.slice($)),i.events.length=Z,m(L)}return d(L)}function m(L){if(l===r.length){if(!s)return E(L);if(s.currentConstruct&&s.currentConstruct.concrete)return x(L);i.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(Kf,g,y)(L)}function g(L){return s&&F(),w(l),E(L)}function y(L){return i.parser.lazy[i.now().line]=l!==r.length,u=i.now().offset,x(L)}function E(L){return i.containerState={},e.attempt(Kf,b,x)(L)}function b(L){return l++,r.push([i.currentConstruct,i.containerState]),E(L)}function x(L){if(L===null){s&&F(),w(0),e.consume(L);return}return s=s||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:c}),C(L)}function C(L){if(L===null){T(e.exit("chunkFlow"),!0),w(0),e.consume(L);return}return Ce(L)?(e.consume(L),T(e.exit("chunkFlow")),l=0,i.interrupt=void 0,d):(e.consume(L),C)}function T(L,$){const K=i.sliceStream(L);if($&&K.push(null),L.previous=c,c&&(c.next=L),c=L,s.defineSkip(L.start),s.write(K),i.parser.lazy[L.start.line]){let I=s.events.length;for(;I--;)if(s.events[I][1].start.offset<u&&(!s.events[I][1].end||s.events[I][1].end.offset>u))return;const Z=i.events.length;let G=Z,te,D;for(;G--;)if(i.events[G][0]==="exit"&&i.events[G][1].type==="chunkFlow"){if(te){D=i.events[G][1].end;break}te=!0}for(w(l),I=Z;I<i.events.length;)i.events[I][1].end={...D},I++;sn(i.events,G+1,0,i.events.slice(Z)),i.events.length=I}}function w(L){let $=r.length;for(;$-- >L;){const K=r[$];i.containerState=K[1],K[0].exit.call(i,e)}r.length=L}function F(){s.write([null]),c=void 0,s=void 0,i.containerState._closeFlow=void 0}}function Mb(e,i,r){return We(e,e.attempt(this.parser.constructs.document,i,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function zi(e){if(e===null||et(e)||ni(e))return 1;if(ca(e))return 2}function da(e,i,r){const l=[];let s=-1;for(;++s<e.length;){const c=e[s].resolveAll;c&&!l.includes(c)&&(i=c(i,r),l.push(c))}return i}const Tu={name:"attention",resolveAll:Lb,tokenize:Db};function Lb(e,i){let r=-1,l,s,c,u,d,p,m,g;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(l=r;l--;)if(e[l][0]==="exit"&&e[l][1].type==="attentionSequence"&&e[l][1]._open&&i.sliceSerialize(e[l][1]).charCodeAt(0)===i.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[l][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[l][1].end.offset-e[l][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;p=e[l][1].end.offset-e[l][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const y={...e[l][1].end},E={...e[r][1].start};Gf(y,-p),Gf(E,p),u={type:p>1?"strongSequence":"emphasisSequence",start:y,end:{...e[l][1].end}},d={type:p>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:E},c={type:p>1?"strongText":"emphasisText",start:{...e[l][1].end},end:{...e[r][1].start}},s={type:p>1?"strong":"emphasis",start:{...u.start},end:{...d.end}},e[l][1].end={...u.start},e[r][1].start={...d.end},m=[],e[l][1].end.offset-e[l][1].start.offset&&(m=En(m,[["enter",e[l][1],i],["exit",e[l][1],i]])),m=En(m,[["enter",s,i],["enter",u,i],["exit",u,i],["enter",c,i]]),m=En(m,da(i.parser.constructs.insideSpan.null,e.slice(l+1,r),i)),m=En(m,[["exit",c,i],["enter",d,i],["exit",d,i],["exit",s,i]]),e[r][1].end.offset-e[r][1].start.offset?(g=2,m=En(m,[["enter",e[r][1],i],["exit",e[r][1],i]])):g=0,sn(e,l-1,r-l+3,m),r=l+m.length-g-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function Db(e,i){const r=this.parser.constructs.attentionMarkers.null,l=this.previous,s=zi(l);let c;return u;function u(p){return c=p,e.enter("attentionSequence"),d(p)}function d(p){if(p===c)return e.consume(p),d;const m=e.exit("attentionSequence"),g=zi(p),y=!g||g===2&&s||r.includes(p),E=!s||s===2&&g||r.includes(l);return m._open=!!(c===42?y:y&&(s||!E)),m._close=!!(c===42?E:E&&(g||!y)),i(p)}}function Gf(e,i){e.column+=i,e.offset+=i,e._bufferIndex+=i}const Pb={name:"autolink",tokenize:zb};function zb(e,i,r){let l=0;return s;function s(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(b){return Ht(b)?(e.consume(b),u):b===64?r(b):m(b)}function u(b){return b===43||b===45||b===46||Dt(b)?(l=1,d(b)):m(b)}function d(b){return b===58?(e.consume(b),l=0,p):(b===43||b===45||b===46||Dt(b))&&l++<32?(e.consume(b),d):(l=0,m(b))}function p(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),i):b===null||b===32||b===60||ra(b)?r(b):(e.consume(b),p)}function m(b){return b===64?(e.consume(b),g):Nb(b)?(e.consume(b),m):r(b)}function g(b){return Dt(b)?y(b):r(b)}function y(b){return b===46?(e.consume(b),l=0,g):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),i):E(b)}function E(b){if((b===45||Dt(b))&&l++<63){const x=b===45?E:y;return e.consume(b),x}return r(b)}}const Do={partial:!0,tokenize:Fb};function Fb(e,i,r){return l;function l(c){return Ue(c)?We(e,s,"linePrefix")(c):s(c)}function s(c){return c===null||Ce(c)?i(c):r(c)}}const cm={continuation:{tokenize:Ub},exit:$b,name:"blockQuote",tokenize:Bb};function Bb(e,i,r){const l=this;return s;function s(u){if(u===62){const d=l.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),c}return r(u)}function c(u){return Ue(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),i):(e.exit("blockQuotePrefix"),i(u))}}function Ub(e,i,r){const l=this;return s;function s(u){return Ue(u)?We(e,c,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):c(u)}function c(u){return e.attempt(cm,i,r)(u)}}function $b(e){e.exit("blockQuote")}const dm={name:"characterEscape",tokenize:jb};function jb(e,i,r){return l;function l(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),s}function s(c){return Tb(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),i):r(c)}}const fm={name:"characterReference",tokenize:Hb};function Hb(e,i,r){const l=this;let s=0,c,u;return d;function d(y){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),p}function p(y){return y===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(y),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),c=31,u=Dt,g(y))}function m(y){return y===88||y===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(y),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,u=Cb,g):(e.enter("characterReferenceValue"),c=7,u=Cu,g(y))}function g(y){if(y===59&&s){const E=e.exit("characterReferenceValue");return u===Dt&&!Wu(l.sliceSerialize(E))?r(y):(e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),e.exit("characterReference"),i)}return u(y)&&s++<c?(e.consume(y),g):r(y)}}const Wf={partial:!0,tokenize:Gb},Vf={concrete:!0,name:"codeFenced",tokenize:Kb};function Kb(e,i,r){const l=this,s={partial:!0,tokenize:K};let c=0,u=0,d;return p;function p(I){return m(I)}function m(I){const Z=l.events[l.events.length-1];return c=Z&&Z[1].type==="linePrefix"?Z[2].sliceSerialize(Z[1],!0).length:0,d=I,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(I)}function g(I){return I===d?(u++,e.consume(I),g):u<3?r(I):(e.exit("codeFencedFenceSequence"),Ue(I)?We(e,y,"whitespace")(I):y(I))}function y(I){return I===null||Ce(I)?(e.exit("codeFencedFence"),l.interrupt?i(I):e.check(Wf,C,$)(I)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),E(I))}function E(I){return I===null||Ce(I)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),y(I)):Ue(I)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),We(e,b,"whitespace")(I)):I===96&&I===d?r(I):(e.consume(I),E)}function b(I){return I===null||Ce(I)?y(I):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(I))}function x(I){return I===null||Ce(I)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),y(I)):I===96&&I===d?r(I):(e.consume(I),x)}function C(I){return e.attempt(s,$,T)(I)}function T(I){return e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),w}function w(I){return c>0&&Ue(I)?We(e,F,"linePrefix",c+1)(I):F(I)}function F(I){return I===null||Ce(I)?e.check(Wf,C,$)(I):(e.enter("codeFlowValue"),L(I))}function L(I){return I===null||Ce(I)?(e.exit("codeFlowValue"),F(I)):(e.consume(I),L)}function $(I){return e.exit("codeFenced"),i(I)}function K(I,Z,G){let te=0;return D;function D(P){return I.enter("lineEnding"),I.consume(P),I.exit("lineEnding"),ne}function ne(P){return I.enter("codeFencedFence"),Ue(P)?We(I,X,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):X(P)}function X(P){return P===d?(I.enter("codeFencedFenceSequence"),fe(P)):G(P)}function fe(P){return P===d?(te++,I.consume(P),fe):te>=u?(I.exit("codeFencedFenceSequence"),Ue(P)?We(I,q,"whitespace")(P):q(P)):G(P)}function q(P){return P===null||Ce(P)?(I.exit("codeFencedFence"),Z(P)):G(P)}}}function Gb(e,i,r){const l=this;return s;function s(u){return u===null?r(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c)}function c(u){return l.parser.lazy[l.now().line]?r(u):i(u)}}const ru={name:"codeIndented",tokenize:Vb},Wb={partial:!0,tokenize:qb};function Vb(e,i,r){const l=this;return s;function s(m){return e.enter("codeIndented"),We(e,c,"linePrefix",5)(m)}function c(m){const g=l.events[l.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?u(m):r(m)}function u(m){return m===null?p(m):Ce(m)?e.attempt(Wb,u,p)(m):(e.enter("codeFlowValue"),d(m))}function d(m){return m===null||Ce(m)?(e.exit("codeFlowValue"),u(m)):(e.consume(m),d)}function p(m){return e.exit("codeIndented"),i(m)}}function qb(e,i,r){const l=this;return s;function s(u){return l.parser.lazy[l.now().line]?r(u):Ce(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s):We(e,c,"linePrefix",5)(u)}function c(u){const d=l.events[l.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?i(u):Ce(u)?s(u):r(u)}}const Yb={name:"codeText",previous:Zb,resolve:Qb,tokenize:Xb};function Qb(e){let i=e.length-4,r=3,l,s;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[i][1].type==="lineEnding"||e[i][1].type==="space")){for(l=r;++l<i;)if(e[l][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[i][1].type="codeTextPadding",r+=2,i-=2;break}}for(l=r-1,i++;++l<=i;)s===void 0?l!==i&&e[l][1].type!=="lineEnding"&&(s=l):(l===i||e[l][1].type==="lineEnding")&&(e[s][1].type="codeTextData",l!==s+2&&(e[s][1].end=e[l-1][1].end,e.splice(s+2,l-s-2),i-=l-s-2,l=s+2),s=void 0);return e}function Zb(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Xb(e,i,r){let l=0,s,c;return u;function u(y){return e.enter("codeText"),e.enter("codeTextSequence"),d(y)}function d(y){return y===96?(e.consume(y),l++,d):(e.exit("codeTextSequence"),p(y))}function p(y){return y===null?r(y):y===32?(e.enter("space"),e.consume(y),e.exit("space"),p):y===96?(c=e.enter("codeTextSequence"),s=0,g(y)):Ce(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),p):(e.enter("codeTextData"),m(y))}function m(y){return y===null||y===32||y===96||Ce(y)?(e.exit("codeTextData"),p(y)):(e.consume(y),m)}function g(y){return y===96?(e.consume(y),s++,g):s===l?(e.exit("codeTextSequence"),e.exit("codeText"),i(y)):(c.type="codeTextData",m(y))}}class Jb{constructor(i){this.left=i?[...i]:[],this.right=[]}get(i){if(i<0||i>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+i+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return i<this.left.length?this.left[i]:this.right[this.right.length-i+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(i,r){const l=r??Number.POSITIVE_INFINITY;return l<this.left.length?this.left.slice(i,l):i>this.left.length?this.right.slice(this.right.length-l+this.left.length,this.right.length-i+this.left.length).reverse():this.left.slice(i).concat(this.right.slice(this.right.length-l+this.left.length).reverse())}splice(i,r,l){const s=r||0;this.setCursor(Math.trunc(i));const c=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return l&&So(this.left,l),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(i){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(i)}pushMany(i){this.setCursor(Number.POSITIVE_INFINITY),So(this.left,i)}unshift(i){this.setCursor(0),this.right.push(i)}unshiftMany(i){this.setCursor(0),So(this.right,i.reverse())}setCursor(i){if(!(i===this.left.length||i>this.left.length&&this.right.length===0||i<0&&this.left.length===0))if(i<this.left.length){const r=this.left.splice(i,Number.POSITIVE_INFINITY);So(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-i,Number.POSITIVE_INFINITY);So(this.left,r.reverse())}}}function So(e,i){let r=0;if(i.length<1e4)e.push(...i);else for(;r<i.length;)e.push(...i.slice(r,r+1e4)),r+=1e4}function pm(e){const i={};let r=-1,l,s,c,u,d,p,m;const g=new Jb(e);for(;++r<g.length;){for(;r in i;)r=i[r];if(l=g.get(r),r&&l[1].type==="chunkFlow"&&g.get(r-1)[1].type==="listItemPrefix"&&(p=l[1]._tokenizer.events,c=0,c<p.length&&p[c][1].type==="lineEndingBlank"&&(c+=2),c<p.length&&p[c][1].type==="content"))for(;++c<p.length&&p[c][1].type!=="content";)p[c][1].type==="chunkText"&&(p[c][1]._isInFirstContentOfListItem=!0,c++);if(l[0]==="enter")l[1].contentType&&(Object.assign(i,eE(g,r)),r=i[r],m=!0);else if(l[1]._container){for(c=r,s=void 0;c--;)if(u=g.get(c),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(s&&(g.get(s)[1].type="lineEndingBlank"),u[1].type="lineEnding",s=c);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;s&&(l[1].end={...g.get(s)[1].start},d=g.slice(s,r),d.unshift(l),g.splice(s,r-s+1,d))}}return sn(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!m}function eE(e,i){const r=e.get(i)[1],l=e.get(i)[2];let s=i-1;const c=[];let u=r._tokenizer;u||(u=l.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const d=u.events,p=[],m={};let g,y,E=-1,b=r,x=0,C=0;const T=[C];for(;b;){for(;e.get(++s)[1]!==b;);c.push(s),b._tokenizer||(g=l.sliceStream(b),b.next||g.push(null),y&&u.defineSkip(b.start),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(g),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),y=b,b=b.next}for(b=r;++E<d.length;)d[E][0]==="exit"&&d[E-1][0]==="enter"&&d[E][1].type===d[E-1][1].type&&d[E][1].start.line!==d[E][1].end.line&&(C=E+1,T.push(C),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(u.events=[],b?(b._tokenizer=void 0,b.previous=void 0):T.pop(),E=T.length;E--;){const w=d.slice(T[E],T[E+1]),F=c.pop();p.push([F,F+w.length-1]),e.splice(F,2,w)}for(p.reverse(),E=-1;++E<p.length;)m[x+p[E][0]]=x+p[E][1],x+=p[E][1]-p[E][0]-1;return m}const tE={resolve:rE,tokenize:iE},nE={partial:!0,tokenize:oE};function rE(e){return pm(e),e}function iE(e,i){let r;return l;function l(d){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),s(d)}function s(d){return d===null?c(d):Ce(d)?e.check(nE,u,c)(d):(e.consume(d),s)}function c(d){return e.exit("chunkContent"),e.exit("content"),i(d)}function u(d){return e.consume(d),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,s}}function oE(e,i,r){const l=this;return s;function s(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),We(e,c,"linePrefix")}function c(u){if(u===null||Ce(u))return r(u);const d=l.events[l.events.length-1];return!l.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?i(u):e.interrupt(l.parser.constructs.flow,r,i)(u)}}function mm(e,i,r,l,s,c,u,d,p){const m=p||Number.POSITIVE_INFINITY;let g=0;return y;function y(w){return w===60?(e.enter(l),e.enter(s),e.enter(c),e.consume(w),e.exit(c),E):w===null||w===32||w===41||ra(w)?r(w):(e.enter(l),e.enter(u),e.enter(d),e.enter("chunkString",{contentType:"string"}),C(w))}function E(w){return w===62?(e.enter(c),e.consume(w),e.exit(c),e.exit(s),e.exit(l),i):(e.enter(d),e.enter("chunkString",{contentType:"string"}),b(w))}function b(w){return w===62?(e.exit("chunkString"),e.exit(d),E(w)):w===null||w===60||Ce(w)?r(w):(e.consume(w),w===92?x:b)}function x(w){return w===60||w===62||w===92?(e.consume(w),b):b(w)}function C(w){return!g&&(w===null||w===41||et(w))?(e.exit("chunkString"),e.exit(d),e.exit(u),e.exit(l),i(w)):g<m&&w===40?(e.consume(w),g++,C):w===41?(e.consume(w),g--,C):w===null||w===32||w===40||ra(w)?r(w):(e.consume(w),w===92?T:C)}function T(w){return w===40||w===41||w===92?(e.consume(w),C):C(w)}}function hm(e,i,r,l,s,c){const u=this;let d=0,p;return m;function m(b){return e.enter(l),e.enter(s),e.consume(b),e.exit(s),e.enter(c),g}function g(b){return d>999||b===null||b===91||b===93&&!p||b===94&&!d&&"_hiddenFootnoteSupport"in u.parser.constructs?r(b):b===93?(e.exit(c),e.enter(s),e.consume(b),e.exit(s),e.exit(l),i):Ce(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===null||b===91||b===93||Ce(b)||d++>999?(e.exit("chunkString"),g(b)):(e.consume(b),p||(p=!Ue(b)),b===92?E:y)}function E(b){return b===91||b===92||b===93?(e.consume(b),d++,y):y(b)}}function gm(e,i,r,l,s,c){let u;return d;function d(E){return E===34||E===39||E===40?(e.enter(l),e.enter(s),e.consume(E),e.exit(s),u=E===40?41:E,p):r(E)}function p(E){return E===u?(e.enter(s),e.consume(E),e.exit(s),e.exit(l),i):(e.enter(c),m(E))}function m(E){return E===u?(e.exit(c),p(u)):E===null?r(E):Ce(E)?(e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),We(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(E))}function g(E){return E===u||E===null||Ce(E)?(e.exit("chunkString"),m(E)):(e.consume(E),E===92?y:g)}function y(E){return E===u||E===92?(e.consume(E),g):g(E)}}function Ao(e,i){let r;return l;function l(s){return Ce(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),r=!0,l):Ue(s)?We(e,l,r?"linePrefix":"lineSuffix")(s):i(s)}}const lE={name:"definition",tokenize:sE},aE={partial:!0,tokenize:uE};function sE(e,i,r){const l=this;let s;return c;function c(b){return e.enter("definition"),u(b)}function u(b){return hm.call(l,e,d,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function d(b){return s=On(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),p):r(b)}function p(b){return et(b)?Ao(e,m)(b):m(b)}function m(b){return mm(e,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function g(b){return e.attempt(aE,y,y)(b)}function y(b){return Ue(b)?We(e,E,"whitespace")(b):E(b)}function E(b){return b===null||Ce(b)?(e.exit("definition"),l.parser.defined.push(s),i(b)):r(b)}}function uE(e,i,r){return l;function l(d){return et(d)?Ao(e,s)(d):r(d)}function s(d){return gm(e,c,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function c(d){return Ue(d)?We(e,u,"whitespace")(d):u(d)}function u(d){return d===null||Ce(d)?i(d):r(d)}}const cE={name:"hardBreakEscape",tokenize:dE};function dE(e,i,r){return l;function l(c){return e.enter("hardBreakEscape"),e.consume(c),s}function s(c){return Ce(c)?(e.exit("hardBreakEscape"),i(c)):r(c)}}const fE={name:"headingAtx",resolve:pE,tokenize:mE};function pE(e,i){let r=e.length-2,l=3,s,c;return e[l][1].type==="whitespace"&&(l+=2),r-2>l&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(l===r-1||r-4>l&&e[r-2][1].type==="whitespace")&&(r-=l+1===r?2:4),r>l&&(s={type:"atxHeadingText",start:e[l][1].start,end:e[r][1].end},c={type:"chunkText",start:e[l][1].start,end:e[r][1].end,contentType:"text"},sn(e,l,r-l+1,[["enter",s,i],["enter",c,i],["exit",c,i],["exit",s,i]])),e}function mE(e,i,r){let l=0;return s;function s(g){return e.enter("atxHeading"),c(g)}function c(g){return e.enter("atxHeadingSequence"),u(g)}function u(g){return g===35&&l++<6?(e.consume(g),u):g===null||et(g)?(e.exit("atxHeadingSequence"),d(g)):r(g)}function d(g){return g===35?(e.enter("atxHeadingSequence"),p(g)):g===null||Ce(g)?(e.exit("atxHeading"),i(g)):Ue(g)?We(e,d,"whitespace")(g):(e.enter("atxHeadingText"),m(g))}function p(g){return g===35?(e.consume(g),p):(e.exit("atxHeadingSequence"),d(g))}function m(g){return g===null||g===35||et(g)?(e.exit("atxHeadingText"),d(g)):(e.consume(g),m)}}const hE=["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"],qf=["pre","script","style","textarea"],gE={concrete:!0,name:"htmlFlow",resolveTo:EE,tokenize:_E},yE={partial:!0,tokenize:kE},bE={partial:!0,tokenize:vE};function EE(e){let i=e.length;for(;i--&&!(e[i][0]==="enter"&&e[i][1].type==="htmlFlow"););return i>1&&e[i-2][1].type==="linePrefix"&&(e[i][1].start=e[i-2][1].start,e[i+1][1].start=e[i-2][1].start,e.splice(i-2,2)),e}function _E(e,i,r){const l=this;let s,c,u,d,p;return m;function m(S){return g(S)}function g(S){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(S),y}function y(S){return S===33?(e.consume(S),E):S===47?(e.consume(S),c=!0,C):S===63?(e.consume(S),s=3,l.interrupt?i:v):Ht(S)?(e.consume(S),u=String.fromCharCode(S),T):r(S)}function E(S){return S===45?(e.consume(S),s=2,b):S===91?(e.consume(S),s=5,d=0,x):Ht(S)?(e.consume(S),s=4,l.interrupt?i:v):r(S)}function b(S){return S===45?(e.consume(S),l.interrupt?i:v):r(S)}function x(S){const we="CDATA[";return S===we.charCodeAt(d++)?(e.consume(S),d===we.length?l.interrupt?i:X:x):r(S)}function C(S){return Ht(S)?(e.consume(S),u=String.fromCharCode(S),T):r(S)}function T(S){if(S===null||S===47||S===62||et(S)){const we=S===47,Me=u.toLowerCase();return!we&&!c&&qf.includes(Me)?(s=1,l.interrupt?i(S):X(S)):hE.includes(u.toLowerCase())?(s=6,we?(e.consume(S),w):l.interrupt?i(S):X(S)):(s=7,l.interrupt&&!l.parser.lazy[l.now().line]?r(S):c?F(S):L(S))}return S===45||Dt(S)?(e.consume(S),u+=String.fromCharCode(S),T):r(S)}function w(S){return S===62?(e.consume(S),l.interrupt?i:X):r(S)}function F(S){return Ue(S)?(e.consume(S),F):D(S)}function L(S){return S===47?(e.consume(S),D):S===58||S===95||Ht(S)?(e.consume(S),$):Ue(S)?(e.consume(S),L):D(S)}function $(S){return S===45||S===46||S===58||S===95||Dt(S)?(e.consume(S),$):K(S)}function K(S){return S===61?(e.consume(S),I):Ue(S)?(e.consume(S),K):L(S)}function I(S){return S===null||S===60||S===61||S===62||S===96?r(S):S===34||S===39?(e.consume(S),p=S,Z):Ue(S)?(e.consume(S),I):G(S)}function Z(S){return S===p?(e.consume(S),p=null,te):S===null||Ce(S)?r(S):(e.consume(S),Z)}function G(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||et(S)?K(S):(e.consume(S),G)}function te(S){return S===47||S===62||Ue(S)?L(S):r(S)}function D(S){return S===62?(e.consume(S),ne):r(S)}function ne(S){return S===null||Ce(S)?X(S):Ue(S)?(e.consume(S),ne):r(S)}function X(S){return S===45&&s===2?(e.consume(S),le):S===60&&s===1?(e.consume(S),ae):S===62&&s===4?(e.consume(S),O):S===63&&s===3?(e.consume(S),v):S===93&&s===5?(e.consume(S),de):Ce(S)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(yE,j,fe)(S)):S===null||Ce(S)?(e.exit("htmlFlowData"),fe(S)):(e.consume(S),X)}function fe(S){return e.check(bE,q,j)(S)}function q(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),P}function P(S){return S===null||Ce(S)?fe(S):(e.enter("htmlFlowData"),X(S))}function le(S){return S===45?(e.consume(S),v):X(S)}function ae(S){return S===47?(e.consume(S),u="",W):X(S)}function W(S){if(S===62){const we=u.toLowerCase();return qf.includes(we)?(e.consume(S),O):X(S)}return Ht(S)&&u.length<8?(e.consume(S),u+=String.fromCharCode(S),W):X(S)}function de(S){return S===93?(e.consume(S),v):X(S)}function v(S){return S===62?(e.consume(S),O):S===45&&s===2?(e.consume(S),v):X(S)}function O(S){return S===null||Ce(S)?(e.exit("htmlFlowData"),j(S)):(e.consume(S),O)}function j(S){return e.exit("htmlFlow"),i(S)}}function vE(e,i,r){const l=this;return s;function s(u){return Ce(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):r(u)}function c(u){return l.parser.lazy[l.now().line]?r(u):i(u)}}function kE(e,i,r){return l;function l(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Do,i,r)}}const wE={name:"htmlText",tokenize:xE};function xE(e,i,r){const l=this;let s,c,u;return d;function d(v){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(v),p}function p(v){return v===33?(e.consume(v),m):v===47?(e.consume(v),K):v===63?(e.consume(v),L):Ht(v)?(e.consume(v),G):r(v)}function m(v){return v===45?(e.consume(v),g):v===91?(e.consume(v),c=0,x):Ht(v)?(e.consume(v),F):r(v)}function g(v){return v===45?(e.consume(v),b):r(v)}function y(v){return v===null?r(v):v===45?(e.consume(v),E):Ce(v)?(u=y,ae(v)):(e.consume(v),y)}function E(v){return v===45?(e.consume(v),b):y(v)}function b(v){return v===62?le(v):v===45?E(v):y(v)}function x(v){const O="CDATA[";return v===O.charCodeAt(c++)?(e.consume(v),c===O.length?C:x):r(v)}function C(v){return v===null?r(v):v===93?(e.consume(v),T):Ce(v)?(u=C,ae(v)):(e.consume(v),C)}function T(v){return v===93?(e.consume(v),w):C(v)}function w(v){return v===62?le(v):v===93?(e.consume(v),w):C(v)}function F(v){return v===null||v===62?le(v):Ce(v)?(u=F,ae(v)):(e.consume(v),F)}function L(v){return v===null?r(v):v===63?(e.consume(v),$):Ce(v)?(u=L,ae(v)):(e.consume(v),L)}function $(v){return v===62?le(v):L(v)}function K(v){return Ht(v)?(e.consume(v),I):r(v)}function I(v){return v===45||Dt(v)?(e.consume(v),I):Z(v)}function Z(v){return Ce(v)?(u=Z,ae(v)):Ue(v)?(e.consume(v),Z):le(v)}function G(v){return v===45||Dt(v)?(e.consume(v),G):v===47||v===62||et(v)?te(v):r(v)}function te(v){return v===47?(e.consume(v),le):v===58||v===95||Ht(v)?(e.consume(v),D):Ce(v)?(u=te,ae(v)):Ue(v)?(e.consume(v),te):le(v)}function D(v){return v===45||v===46||v===58||v===95||Dt(v)?(e.consume(v),D):ne(v)}function ne(v){return v===61?(e.consume(v),X):Ce(v)?(u=ne,ae(v)):Ue(v)?(e.consume(v),ne):te(v)}function X(v){return v===null||v===60||v===61||v===62||v===96?r(v):v===34||v===39?(e.consume(v),s=v,fe):Ce(v)?(u=X,ae(v)):Ue(v)?(e.consume(v),X):(e.consume(v),q)}function fe(v){return v===s?(e.consume(v),s=void 0,P):v===null?r(v):Ce(v)?(u=fe,ae(v)):(e.consume(v),fe)}function q(v){return v===null||v===34||v===39||v===60||v===61||v===96?r(v):v===47||v===62||et(v)?te(v):(e.consume(v),q)}function P(v){return v===47||v===62||et(v)?te(v):r(v)}function le(v){return v===62?(e.consume(v),e.exit("htmlTextData"),e.exit("htmlText"),i):r(v)}function ae(v){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),W}function W(v){return Ue(v)?We(e,de,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(v):de(v)}function de(v){return e.enter("htmlTextData"),u(v)}}const Vu={name:"labelEnd",resolveAll:TE,resolveTo:AE,tokenize:RE},SE={tokenize:OE},NE={tokenize:IE},CE={tokenize:ME};function TE(e){let i=-1;const r=[];for(;++i<e.length;){const l=e[i][1];if(r.push(e[i]),l.type==="labelImage"||l.type==="labelLink"||l.type==="labelEnd"){const s=l.type==="labelImage"?4:2;l.type="data",i+=s}}return e.length!==r.length&&sn(e,0,e.length,r),e}function AE(e,i){let r=e.length,l=0,s,c,u,d;for(;r--;)if(s=e[r][1],c){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[r][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(u){if(e[r][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(c=r,s.type!=="labelLink")){l=2;break}}else s.type==="labelEnd"&&(u=r);const p={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[c][1].start},end:{...e[u][1].end}},g={type:"labelText",start:{...e[c+l+2][1].end},end:{...e[u-2][1].start}};return d=[["enter",p,i],["enter",m,i]],d=En(d,e.slice(c+1,c+l+3)),d=En(d,[["enter",g,i]]),d=En(d,da(i.parser.constructs.insideSpan.null,e.slice(c+l+4,u-3),i)),d=En(d,[["exit",g,i],e[u-2],e[u-1],["exit",m,i]]),d=En(d,e.slice(u+1)),d=En(d,[["exit",p,i]]),sn(e,c,e.length,d),e}function RE(e,i,r){const l=this;let s=l.events.length,c,u;for(;s--;)if((l.events[s][1].type==="labelImage"||l.events[s][1].type==="labelLink")&&!l.events[s][1]._balanced){c=l.events[s][1];break}return d;function d(E){return c?c._inactive?y(E):(u=l.parser.defined.includes(On(l.sliceSerialize({start:c.end,end:l.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(E),e.exit("labelMarker"),e.exit("labelEnd"),p):r(E)}function p(E){return E===40?e.attempt(SE,g,u?g:y)(E):E===91?e.attempt(NE,g,u?m:y)(E):u?g(E):y(E)}function m(E){return e.attempt(CE,g,y)(E)}function g(E){return i(E)}function y(E){return c._balanced=!0,r(E)}}function OE(e,i,r){return l;function l(y){return e.enter("resource"),e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),s}function s(y){return et(y)?Ao(e,c)(y):c(y)}function c(y){return y===41?g(y):mm(e,u,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function u(y){return et(y)?Ao(e,p)(y):g(y)}function d(y){return r(y)}function p(y){return y===34||y===39||y===40?gm(e,m,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function m(y){return et(y)?Ao(e,g)(y):g(y)}function g(y){return y===41?(e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),e.exit("resource"),i):r(y)}}function IE(e,i,r){const l=this;return s;function s(d){return hm.call(l,e,c,u,"reference","referenceMarker","referenceString")(d)}function c(d){return l.parser.defined.includes(On(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)))?i(d):r(d)}function u(d){return r(d)}}function ME(e,i,r){return l;function l(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),s}function s(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),i):r(c)}}const LE={name:"labelStartImage",resolveAll:Vu.resolveAll,tokenize:DE};function DE(e,i,r){const l=this;return s;function s(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),c}function c(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),u):r(d)}function u(d){return d===94&&"_hiddenFootnoteSupport"in l.parser.constructs?r(d):i(d)}}const PE={name:"labelStartLink",resolveAll:Vu.resolveAll,tokenize:zE};function zE(e,i,r){const l=this;return s;function s(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),c}function c(u){return u===94&&"_hiddenFootnoteSupport"in l.parser.constructs?r(u):i(u)}}const iu={name:"lineEnding",tokenize:FE};function FE(e,i){return r;function r(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),We(e,i,"linePrefix")}}const na={name:"thematicBreak",tokenize:BE};function BE(e,i,r){let l=0,s;return c;function c(m){return e.enter("thematicBreak"),u(m)}function u(m){return s=m,d(m)}function d(m){return m===s?(e.enter("thematicBreakSequence"),p(m)):l>=3&&(m===null||Ce(m))?(e.exit("thematicBreak"),i(m)):r(m)}function p(m){return m===s?(e.consume(m),l++,p):(e.exit("thematicBreakSequence"),Ue(m)?We(e,d,"whitespace")(m):d(m))}}const Xt={continuation:{tokenize:HE},exit:GE,name:"list",tokenize:jE},UE={partial:!0,tokenize:WE},$E={partial:!0,tokenize:KE};function jE(e,i,r){const l=this,s=l.events[l.events.length-1];let c=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,u=0;return d;function d(b){const x=l.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!l.containerState.marker||b===l.containerState.marker:Cu(b)){if(l.containerState.type||(l.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(na,r,m)(b):m(b);if(!l.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(b)}return r(b)}function p(b){return Cu(b)&&++u<10?(e.consume(b),p):(!l.interrupt||u<2)&&(l.containerState.marker?b===l.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),m(b)):r(b)}function m(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||b,e.check(Do,l.interrupt?r:g,e.attempt(UE,E,y))}function g(b){return l.containerState.initialBlankLine=!0,c++,E(b)}function y(b){return Ue(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),E):r(b)}function E(b){return l.containerState.size=c+l.sliceSerialize(e.exit("listItemPrefix"),!0).length,i(b)}}function HE(e,i,r){const l=this;return l.containerState._closeFlow=void 0,e.check(Do,s,c);function s(d){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,We(e,i,"listItemIndent",l.containerState.size+1)(d)}function c(d){return l.containerState.furtherBlankLines||!Ue(d)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,u(d)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,e.attempt($E,i,u)(d))}function u(d){return l.containerState._closeFlow=!0,l.interrupt=void 0,We(e,e.attempt(Xt,i,r),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function KE(e,i,r){const l=this;return We(e,s,"listItemIndent",l.containerState.size+1);function s(c){const u=l.events[l.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===l.containerState.size?i(c):r(c)}}function GE(e){e.exit(this.containerState.type)}function WE(e,i,r){const l=this;return We(e,s,"listItemPrefixWhitespace",l.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(c){const u=l.events[l.events.length-1];return!Ue(c)&&u&&u[1].type==="listItemPrefixWhitespace"?i(c):r(c)}}const Yf={name:"setextUnderline",resolveTo:VE,tokenize:qE};function VE(e,i){let r=e.length,l,s,c;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){l=r;break}e[r][1].type==="paragraph"&&(s=r)}else e[r][1].type==="content"&&e.splice(r,1),!c&&e[r][1].type==="definition"&&(c=r);const u={type:"setextHeading",start:{...e[l][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",c?(e.splice(s,0,["enter",u,i]),e.splice(c+1,0,["exit",e[l][1],i]),e[l][1].end={...e[c][1].end}):e[l][1]=u,e.push(["exit",u,i]),e}function qE(e,i,r){const l=this;let s;return c;function c(m){let g=l.events.length,y;for(;g--;)if(l.events[g][1].type!=="lineEnding"&&l.events[g][1].type!=="linePrefix"&&l.events[g][1].type!=="content"){y=l.events[g][1].type==="paragraph";break}return!l.parser.lazy[l.now().line]&&(l.interrupt||y)?(e.enter("setextHeadingLine"),s=m,u(m)):r(m)}function u(m){return e.enter("setextHeadingLineSequence"),d(m)}function d(m){return m===s?(e.consume(m),d):(e.exit("setextHeadingLineSequence"),Ue(m)?We(e,p,"lineSuffix")(m):p(m))}function p(m){return m===null||Ce(m)?(e.exit("setextHeadingLine"),i(m)):r(m)}}const YE={tokenize:QE};function QE(e){const i=this,r=e.attempt(Do,l,e.attempt(this.parser.constructs.flowInitial,s,We(e,e.attempt(this.parser.constructs.flow,s,e.attempt(tE,s)),"linePrefix")));return r;function l(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),i.currentConstruct=void 0,r}function s(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),i.currentConstruct=void 0,r}}const ZE={resolveAll:bm()},XE=ym("string"),JE=ym("text");function ym(e){return{resolveAll:bm(e==="text"?e_:void 0),tokenize:i};function i(r){const l=this,s=this.parser.constructs[e],c=r.attempt(s,u,d);return u;function u(g){return m(g)?c(g):d(g)}function d(g){if(g===null){r.consume(g);return}return r.enter("data"),r.consume(g),p}function p(g){return m(g)?(r.exit("data"),c(g)):(r.consume(g),p)}function m(g){if(g===null)return!0;const y=s[g];let E=-1;if(y)for(;++E<y.length;){const b=y[E];if(!b.previous||b.previous.call(l,l.previous))return!0}return!1}}}function bm(e){return i;function i(r,l){let s=-1,c;for(;++s<=r.length;)c===void 0?r[s]&&r[s][1].type==="data"&&(c=s,s++):(!r[s]||r[s][1].type!=="data")&&(s!==c+2&&(r[c][1].end=r[s-1][1].end,r.splice(c+2,s-c-2),s=c+2),c=void 0);return e?e(r,l):r}}function e_(e,i){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const l=e[r-1][1],s=i.sliceStream(l);let c=s.length,u=-1,d=0,p;for(;c--;){const m=s[c];if(typeof m=="string"){for(u=m.length;m.charCodeAt(u-1)===32;)d++,u--;if(u)break;u=-1}else if(m===-2)p=!0,d++;else if(m!==-1){c++;break}}if(i._contentTypeTextTrailing&&r===e.length&&(d=0),d){const m={type:r===e.length||p||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?u:l.start._bufferIndex+u,_index:l.start._index+c,line:l.end.line,column:l.end.column-d,offset:l.end.offset-d},end:{...l.end}};l.end={...m.start},l.start.offset===l.end.offset?Object.assign(l,m):(e.splice(r,0,["enter",m,i],["exit",m,i]),r+=2)}r++}return e}const t_={42:Xt,43:Xt,45:Xt,48:Xt,49:Xt,50:Xt,51:Xt,52:Xt,53:Xt,54:Xt,55:Xt,56:Xt,57:Xt,62:cm},n_={91:lE},r_={[-2]:ru,[-1]:ru,32:ru},i_={35:fE,42:na,45:[Yf,na],60:gE,61:Yf,95:na,96:Vf,126:Vf},o_={38:fm,92:dm},l_={[-5]:iu,[-4]:iu,[-3]:iu,33:LE,38:fm,42:Tu,60:[Pb,wE],91:PE,92:[cE,dm],93:Vu,95:Tu,96:Yb},a_={null:[Tu,ZE]},s_={null:[42,95]},u_={null:[]},c_=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:s_,contentInitial:n_,disable:u_,document:t_,flow:i_,flowInitial:r_,insideSpan:a_,string:o_,text:l_},Symbol.toStringTag,{value:"Module"}));function d_(e,i,r){let l={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const s={},c=[];let u=[],d=[];const p={attempt:Z(K),check:Z(I),consume:F,enter:L,exit:$,interrupt:Z(I,{interrupt:!0})},m={code:null,containerState:{},defineSkip:C,events:[],now:x,parser:e,previous:null,sliceSerialize:E,sliceStream:b,write:y};let g=i.tokenize.call(m,p);return i.resolveAll&&c.push(i),m;function y(ne){return u=En(u,ne),T(),u[u.length-1]!==null?[]:(G(i,0),m.events=da(c,m.events,m),m.events)}function E(ne,X){return p_(b(ne),X)}function b(ne){return f_(u,ne)}function x(){const{_bufferIndex:ne,_index:X,line:fe,column:q,offset:P}=l;return{_bufferIndex:ne,_index:X,line:fe,column:q,offset:P}}function C(ne){s[ne.line]=ne.column,D()}function T(){let ne;for(;l._index<u.length;){const X=u[l._index];if(typeof X=="string")for(ne=l._index,l._bufferIndex<0&&(l._bufferIndex=0);l._index===ne&&l._bufferIndex<X.length;)w(X.charCodeAt(l._bufferIndex));else w(X)}}function w(ne){g=g(ne)}function F(ne){Ce(ne)?(l.line++,l.column=1,l.offset+=ne===-3?2:1,D()):ne!==-1&&(l.column++,l.offset++),l._bufferIndex<0?l._index++:(l._bufferIndex++,l._bufferIndex===u[l._index].length&&(l._bufferIndex=-1,l._index++)),m.previous=ne}function L(ne,X){const fe=X||{};return fe.type=ne,fe.start=x(),m.events.push(["enter",fe,m]),d.push(fe),fe}function $(ne){const X=d.pop();return X.end=x(),m.events.push(["exit",X,m]),X}function K(ne,X){G(ne,X.from)}function I(ne,X){X.restore()}function Z(ne,X){return fe;function fe(q,P,le){let ae,W,de,v;return Array.isArray(q)?j(q):"tokenize"in q?j([q]):O(q);function O(ke){return $e;function $e(De){const Ke=De!==null&&ke[De],Xe=De!==null&&ke.null,en=[...Array.isArray(Ke)?Ke:Ke?[Ke]:[],...Array.isArray(Xe)?Xe:Xe?[Xe]:[]];return j(en)(De)}}function j(ke){return ae=ke,W=0,ke.length===0?le:S(ke[W])}function S(ke){return $e;function $e(De){return v=te(),de=ke,ke.partial||(m.currentConstruct=ke),ke.name&&m.parser.constructs.disable.null.includes(ke.name)?Me():ke.tokenize.call(X?Object.assign(Object.create(m),X):m,p,we,Me)(De)}}function we(ke){return ne(de,v),P}function Me(ke){return v.restore(),++W<ae.length?S(ae[W]):le}}}function G(ne,X){ne.resolveAll&&!c.includes(ne)&&c.push(ne),ne.resolve&&sn(m.events,X,m.events.length-X,ne.resolve(m.events.slice(X),m)),ne.resolveTo&&(m.events=ne.resolveTo(m.events,m))}function te(){const ne=x(),X=m.previous,fe=m.currentConstruct,q=m.events.length,P=Array.from(d);return{from:q,restore:le};function le(){l=ne,m.previous=X,m.currentConstruct=fe,m.events.length=q,d=P,D()}}function D(){l.line in s&&l.column<2&&(l.column=s[l.line],l.offset+=s[l.line]-1)}}function f_(e,i){const r=i.start._index,l=i.start._bufferIndex,s=i.end._index,c=i.end._bufferIndex;let u;if(r===s)u=[e[r].slice(l,c)];else{if(u=e.slice(r,s),l>-1){const d=u[0];typeof d=="string"?u[0]=d.slice(l):u.shift()}c>0&&u.push(e[s].slice(0,c))}return u}function p_(e,i){let r=-1;const l=[];let s;for(;++r<e.length;){const c=e[r];let u;if(typeof c=="string")u=c;else switch(c){case-5:{u="\r";break}case-4:{u=` +`;break}case-3:{u=`\r +`;break}case-2:{u=i?" ":" ";break}case-1:{if(!i&&s)continue;u=" ";break}default:u=String.fromCharCode(c)}s=c===-2,l.push(u)}return l.join("")}function m_(e){const l={constructs:sm([c_,...(e||{}).extensions||[]]),content:s(Ab),defined:[],document:s(Ob),flow:s(YE),lazy:{},string:s(XE),text:s(JE)};return l;function s(c){return u;function u(d){return d_(l,c,d)}}}function h_(e){for(;!pm(e););return e}const Qf=/[\0\t\n\r]/g;function g_(){let e=1,i="",r=!0,l;return s;function s(c,u,d){const p=[];let m,g,y,E,b;for(c=i+(typeof c=="string"?c.toString():new TextDecoder(u||void 0).decode(c)),y=0,i="",r&&(c.charCodeAt(0)===65279&&y++,r=void 0);y<c.length;){if(Qf.lastIndex=y,m=Qf.exec(c),E=m&&m.index!==void 0?m.index:c.length,b=c.charCodeAt(E),!m){i=c.slice(y);break}if(b===10&&y===E&&l)p.push(-3),l=void 0;else switch(l&&(p.push(-5),l=void 0),y<E&&(p.push(c.slice(y,E)),e+=E-y),b){case 0:{p.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,p.push(-2);e++<g;)p.push(-1);break}case 10:{p.push(-4),e=1;break}default:l=!0,e=1}y=E+1}return d&&(l&&p.push(-5),i&&p.push(i),p.push(null)),p}}const y_=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function b_(e){return e.replace(y_,E_)}function E_(e,i,r){if(i)return i;if(r.charCodeAt(0)===35){const s=r.charCodeAt(1),c=s===120||s===88;return um(r.slice(c?2:1),c?16:10)}return Wu(r)||e}const Em={}.hasOwnProperty;function __(e,i,r){return i&&typeof i=="object"&&(r=i,i=void 0),v_(r)(h_(m_(r).document().write(g_()(e,i,!0))))}function v_(e){const i={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(Mn),autolinkProtocol:te,autolinkEmail:te,atxHeading:c(Vn),blockQuote:c(Xe),characterEscape:te,characterReference:te,codeFenced:c(en),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:c(en,u),codeText:c(ar,u),codeTextData:te,data:te,codeFlowValue:te,definition:c(In),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:c(Wn),hardBreakEscape:c(Ge),hardBreakTrailing:c(Ge),htmlFlow:c(tn,u),htmlFlowData:te,htmlText:c(tn,u),htmlTextData:te,image:c(un),label:u,link:c(Mn),listItem:c(Ln),listItemValue:E,listOrdered:c(_n,y),listUnordered:c(_n),paragraph:c(Or),reference:S,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:c(Vn),strong:c(Ir),thematicBreak:c(Mr)},exit:{atxHeading:p(),atxHeadingSequence:K,autolink:p(),autolinkEmail:Ke,autolinkProtocol:De,blockQuote:p(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:Me,characterReferenceMarkerNumeric:Me,characterReferenceValue:ke,characterReference:$e,codeFenced:p(T),codeFencedFence:C,codeFencedFenceInfo:b,codeFencedFenceMeta:x,codeFlowValue:D,codeIndented:p(w),codeText:p(P),codeTextData:D,data:D,definition:p(),definitionDestinationString:$,definitionLabelString:F,definitionTitleString:L,emphasis:p(),hardBreakEscape:p(X),hardBreakTrailing:p(X),htmlFlow:p(fe),htmlFlowData:D,htmlText:p(q),htmlTextData:D,image:p(ae),label:de,labelText:W,lineEnding:ne,link:p(le),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:we,resourceDestinationString:v,resourceTitleString:O,resource:j,setextHeading:p(G),setextHeadingLineSequence:Z,setextHeadingText:I,strong:p(),thematicBreak:p()}};_m(i,(e||{}).mdastExtensions||[]);const r={};return l;function l(H){let oe={type:"root",children:[]};const Te={stack:[oe],tokenStack:[],config:i,enter:d,exit:m,buffer:u,resume:g,data:r},Pe=[];let je=-1;for(;++je<H.length;)if(H[je][1].type==="listOrdered"||H[je][1].type==="listUnordered")if(H[je][0]==="enter")Pe.push(je);else{const _t=Pe.pop();je=s(H,_t,je)}for(je=-1;++je<H.length;){const _t=i[H[je][0]];Em.call(_t,H[je][1].type)&&_t[H[je][1].type].call(Object.assign({sliceSerialize:H[je][2].sliceSerialize},Te),H[je][1])}if(Te.tokenStack.length>0){const _t=Te.tokenStack[Te.tokenStack.length-1];(_t[1]||Zf).call(Te,void 0,_t[0])}for(oe.position={start:Ar(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:Ar(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},je=-1;++je<i.transforms.length;)oe=i.transforms[je](oe)||oe;return oe}function s(H,oe,Te){let Pe=oe-1,je=-1,_t=!1,vn,Gt,kn,qn;for(;++Pe<=Te;){const vt=H[Pe];switch(vt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{vt[0]==="enter"?je++:je--,qn=void 0;break}case"lineEndingBlank":{vt[0]==="enter"&&(vn&&!qn&&!je&&!kn&&(kn=Pe),qn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:qn=void 0}if(!je&&vt[0]==="enter"&&vt[1].type==="listItemPrefix"||je===-1&&vt[0]==="exit"&&(vt[1].type==="listUnordered"||vt[1].type==="listOrdered")){if(vn){let dn=Pe;for(Gt=void 0;dn--;){const Tt=H[dn];if(Tt[1].type==="lineEnding"||Tt[1].type==="lineEndingBlank"){if(Tt[0]==="exit")continue;Gt&&(H[Gt][1].type="lineEndingBlank",_t=!0),Tt[1].type="lineEnding",Gt=dn}else if(!(Tt[1].type==="linePrefix"||Tt[1].type==="blockQuotePrefix"||Tt[1].type==="blockQuotePrefixWhitespace"||Tt[1].type==="blockQuoteMarker"||Tt[1].type==="listItemIndent"))break}kn&&(!Gt||kn<Gt)&&(vn._spread=!0),vn.end=Object.assign({},Gt?H[Gt][1].start:vt[1].end),H.splice(Gt||Pe,0,["exit",vn,vt[2]]),Pe++,Te++}if(vt[1].type==="listItemPrefix"){const dn={type:"listItem",_spread:!1,start:Object.assign({},vt[1].start),end:void 0};vn=dn,H.splice(Pe,0,["enter",dn,vt[2]]),Pe++,Te++,kn=void 0,qn=!0}}}return H[oe][1]._spread=_t,Te}function c(H,oe){return Te;function Te(Pe){d.call(this,H(Pe),Pe),oe&&oe.call(this,Pe)}}function u(){this.stack.push({type:"fragment",children:[]})}function d(H,oe,Te){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([oe,Te||void 0]),H.position={start:Ar(oe.start),end:void 0}}function p(H){return oe;function oe(Te){H&&H.call(this,Te),m.call(this,Te)}}function m(H,oe){const Te=this.stack.pop(),Pe=this.tokenStack.pop();if(Pe)Pe[0].type!==H.type&&(oe?oe.call(this,H,Pe[0]):(Pe[1]||Zf).call(this,H,Pe[0]));else throw new Error("Cannot close `"+H.type+"` ("+To({start:H.start,end:H.end})+"): it’s not open");Te.position.end=Ar(H.end)}function g(){return Gu(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function E(H){if(this.data.expectingFirstListItemValue){const oe=this.stack[this.stack.length-2];oe.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function b(){const H=this.resume(),oe=this.stack[this.stack.length-1];oe.lang=H}function x(){const H=this.resume(),oe=this.stack[this.stack.length-1];oe.meta=H}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function T(){const H=this.resume(),oe=this.stack[this.stack.length-1];oe.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const H=this.resume(),oe=this.stack[this.stack.length-1];oe.value=H.replace(/(\r?\n|\r)$/g,"")}function F(H){const oe=this.resume(),Te=this.stack[this.stack.length-1];Te.label=oe,Te.identifier=On(this.sliceSerialize(H)).toLowerCase()}function L(){const H=this.resume(),oe=this.stack[this.stack.length-1];oe.title=H}function $(){const H=this.resume(),oe=this.stack[this.stack.length-1];oe.url=H}function K(H){const oe=this.stack[this.stack.length-1];if(!oe.depth){const Te=this.sliceSerialize(H).length;oe.depth=Te}}function I(){this.data.setextHeadingSlurpLineEnding=!0}function Z(H){const oe=this.stack[this.stack.length-1];oe.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function G(){this.data.setextHeadingSlurpLineEnding=void 0}function te(H){const Te=this.stack[this.stack.length-1].children;let Pe=Te[Te.length-1];(!Pe||Pe.type!=="text")&&(Pe=cn(),Pe.position={start:Ar(H.start),end:void 0},Te.push(Pe)),this.stack.push(Pe)}function D(H){const oe=this.stack.pop();oe.value+=this.sliceSerialize(H),oe.position.end=Ar(H.end)}function ne(H){const oe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Te=oe.children[oe.children.length-1];Te.position.end=Ar(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&i.canContainEols.includes(oe.type)&&(te.call(this,H),D.call(this,H))}function X(){this.data.atHardBreak=!0}function fe(){const H=this.resume(),oe=this.stack[this.stack.length-1];oe.value=H}function q(){const H=this.resume(),oe=this.stack[this.stack.length-1];oe.value=H}function P(){const H=this.resume(),oe=this.stack[this.stack.length-1];oe.value=H}function le(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=oe,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function ae(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=oe,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function W(H){const oe=this.sliceSerialize(H),Te=this.stack[this.stack.length-2];Te.label=b_(oe),Te.identifier=On(oe).toLowerCase()}function de(){const H=this.stack[this.stack.length-1],oe=this.resume(),Te=this.stack[this.stack.length-1];if(this.data.inReference=!0,Te.type==="link"){const Pe=H.children;Te.children=Pe}else Te.alt=oe}function v(){const H=this.resume(),oe=this.stack[this.stack.length-1];oe.url=H}function O(){const H=this.resume(),oe=this.stack[this.stack.length-1];oe.title=H}function j(){this.data.inReference=void 0}function S(){this.data.referenceType="collapsed"}function we(H){const oe=this.resume(),Te=this.stack[this.stack.length-1];Te.label=oe,Te.identifier=On(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function Me(H){this.data.characterReferenceType=H.type}function ke(H){const oe=this.sliceSerialize(H),Te=this.data.characterReferenceType;let Pe;Te?(Pe=um(oe,Te==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Pe=Wu(oe);const je=this.stack[this.stack.length-1];je.value+=Pe}function $e(H){const oe=this.stack.pop();oe.position.end=Ar(H.end)}function De(H){D.call(this,H);const oe=this.stack[this.stack.length-1];oe.url=this.sliceSerialize(H)}function Ke(H){D.call(this,H);const oe=this.stack[this.stack.length-1];oe.url="mailto:"+this.sliceSerialize(H)}function Xe(){return{type:"blockquote",children:[]}}function en(){return{type:"code",lang:null,meta:null,value:""}}function ar(){return{type:"inlineCode",value:""}}function In(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Wn(){return{type:"emphasis",children:[]}}function Vn(){return{type:"heading",depth:0,children:[]}}function Ge(){return{type:"break"}}function tn(){return{type:"html",value:""}}function un(){return{type:"image",title:null,url:"",alt:null}}function Mn(){return{type:"link",title:null,url:"",children:[]}}function _n(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function Ln(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function Or(){return{type:"paragraph",children:[]}}function Ir(){return{type:"strong",children:[]}}function cn(){return{type:"text",value:""}}function Mr(){return{type:"thematicBreak"}}}function Ar(e){return{line:e.line,column:e.column,offset:e.offset}}function _m(e,i){let r=-1;for(;++r<i.length;){const l=i[r];Array.isArray(l)?_m(e,l):k_(e,l)}}function k_(e,i){let r;for(r in i)if(Em.call(i,r))switch(r){case"canContainEols":{const l=i[r];l&&e[r].push(...l);break}case"transforms":{const l=i[r];l&&e[r].push(...l);break}case"enter":case"exit":{const l=i[r];l&&Object.assign(e[r],l);break}}}function Zf(e,i){throw e?new Error("Cannot close `"+e.type+"` ("+To({start:e.start,end:e.end})+"): a different token (`"+i.type+"`, "+To({start:i.start,end:i.end})+") is open"):new Error("Cannot close document, a token (`"+i.type+"`, "+To({start:i.start,end:i.end})+") is still open")}function w_(e){const i=this;i.parser=r;function r(l){return __(l,{...i.data("settings"),...e,extensions:i.data("micromarkExtensions")||[],mdastExtensions:i.data("fromMarkdownExtensions")||[]})}}function x_(e,i){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(i),!0)};return e.patch(i,r),e.applyData(i,r)}function S_(e,i){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(i,r),[e.applyData(i,r),{type:"text",value:` +`}]}function N_(e,i){const r=i.value?i.value+` +`:"",l={},s=i.lang?i.lang.split(/\s+/):[];s.length>0&&(l.className=["language-"+s[0]]);let c={type:"element",tagName:"code",properties:l,children:[{type:"text",value:r}]};return i.meta&&(c.data={meta:i.meta}),e.patch(i,c),c=e.applyData(i,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(i,c),c}function C_(e,i){const r={type:"element",tagName:"del",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)}function T_(e,i){const r={type:"element",tagName:"em",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)}function A_(e,i){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",l=String(i.identifier).toUpperCase(),s=Bi(l.toLowerCase()),c=e.footnoteOrder.indexOf(l);let u,d=e.footnoteCounts.get(l);d===void 0?(d=0,e.footnoteOrder.push(l),u=e.footnoteOrder.length):u=c+1,d+=1,e.footnoteCounts.set(l,d);const p={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+s,id:r+"fnref-"+s+(d>1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(i,p);const m={type:"element",tagName:"sup",properties:{},children:[p]};return e.patch(i,m),e.applyData(i,m)}function R_(e,i){const r={type:"element",tagName:"h"+i.depth,properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)}function O_(e,i){if(e.options.allowDangerousHtml){const r={type:"raw",value:i.value};return e.patch(i,r),e.applyData(i,r)}}function vm(e,i){const r=i.referenceType;let l="]";if(r==="collapsed"?l+="[]":r==="full"&&(l+="["+(i.label||i.identifier)+"]"),i.type==="imageReference")return[{type:"text",value:"!["+i.alt+l}];const s=e.all(i),c=s[0];c&&c.type==="text"?c.value="["+c.value:s.unshift({type:"text",value:"["});const u=s[s.length-1];return u&&u.type==="text"?u.value+=l:s.push({type:"text",value:l}),s}function I_(e,i){const r=String(i.identifier).toUpperCase(),l=e.definitionById.get(r);if(!l)return vm(e,i);const s={src:Bi(l.url||""),alt:i.alt};l.title!==null&&l.title!==void 0&&(s.title=l.title);const c={type:"element",tagName:"img",properties:s,children:[]};return e.patch(i,c),e.applyData(i,c)}function M_(e,i){const r={src:Bi(i.url)};i.alt!==null&&i.alt!==void 0&&(r.alt=i.alt),i.title!==null&&i.title!==void 0&&(r.title=i.title);const l={type:"element",tagName:"img",properties:r,children:[]};return e.patch(i,l),e.applyData(i,l)}function L_(e,i){const r={type:"text",value:i.value.replace(/\r?\n|\r/g," ")};e.patch(i,r);const l={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(i,l),e.applyData(i,l)}function D_(e,i){const r=String(i.identifier).toUpperCase(),l=e.definitionById.get(r);if(!l)return vm(e,i);const s={href:Bi(l.url||"")};l.title!==null&&l.title!==void 0&&(s.title=l.title);const c={type:"element",tagName:"a",properties:s,children:e.all(i)};return e.patch(i,c),e.applyData(i,c)}function P_(e,i){const r={href:Bi(i.url)};i.title!==null&&i.title!==void 0&&(r.title=i.title);const l={type:"element",tagName:"a",properties:r,children:e.all(i)};return e.patch(i,l),e.applyData(i,l)}function z_(e,i,r){const l=e.all(i),s=r?F_(r):km(i),c={},u=[];if(typeof i.checked=="boolean"){const g=l[0];let y;g&&g.type==="element"&&g.tagName==="p"?y=g:(y={type:"element",tagName:"p",properties:{},children:[]},l.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:i.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let d=-1;for(;++d<l.length;){const g=l[d];(s||d!==0||g.type!=="element"||g.tagName!=="p")&&u.push({type:"text",value:` +`}),g.type==="element"&&g.tagName==="p"&&!s?u.push(...g.children):u.push(g)}const p=l[l.length-1];p&&(s||p.type!=="element"||p.tagName!=="p")&&u.push({type:"text",value:` +`});const m={type:"element",tagName:"li",properties:c,children:u};return e.patch(i,m),e.applyData(i,m)}function F_(e){let i=!1;if(e.type==="list"){i=e.spread||!1;const r=e.children;let l=-1;for(;!i&&++l<r.length;)i=km(r[l])}return i}function km(e){const i=e.spread;return i??e.children.length>1}function B_(e,i){const r={},l=e.all(i);let s=-1;for(typeof i.start=="number"&&i.start!==1&&(r.start=i.start);++s<l.length;){const u=l[s];if(u.type==="element"&&u.tagName==="li"&&u.properties&&Array.isArray(u.properties.className)&&u.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const c={type:"element",tagName:i.ordered?"ol":"ul",properties:r,children:e.wrap(l,!0)};return e.patch(i,c),e.applyData(i,c)}function U_(e,i){const r={type:"element",tagName:"p",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)}function $_(e,i){const r={type:"root",children:e.wrap(e.all(i))};return e.patch(i,r),e.applyData(i,r)}function j_(e,i){const r={type:"element",tagName:"strong",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)}function H_(e,i){const r=e.all(i),l=r.shift(),s=[];if(l){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([l],!0)};e.patch(i.children[0],u),s.push(u)}if(r.length>0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},d=$u(i.children[1]),p=tm(i.children[i.children.length-1]);d&&p&&(u.position={start:d,end:p}),s.push(u)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(i,c),e.applyData(i,c)}function K_(e,i,r){const l=r?r.children:void 0,c=(l?l.indexOf(i):1)===0?"th":"td",u=r&&r.type==="table"?r.align:void 0,d=u?u.length:i.children.length;let p=-1;const m=[];for(;++p<d;){const y=i.children[p],E={},b=u?u[p]:void 0;b&&(E.align=b);let x={type:"element",tagName:c,properties:E,children:[]};y&&(x.children=e.all(y),e.patch(y,x),x=e.applyData(y,x)),m.push(x)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(i,g),e.applyData(i,g)}function G_(e,i){const r={type:"element",tagName:"td",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)}const Xf=9,Jf=32;function W_(e){const i=String(e),r=/\r?\n|\r/g;let l=r.exec(i),s=0;const c=[];for(;l;)c.push(ep(i.slice(s,l.index),s>0,!0),l[0]),s=l.index+l[0].length,l=r.exec(i);return c.push(ep(i.slice(s),s>0,!1)),c.join("")}function ep(e,i,r){let l=0,s=e.length;if(i){let c=e.codePointAt(l);for(;c===Xf||c===Jf;)l++,c=e.codePointAt(l)}if(r){let c=e.codePointAt(s-1);for(;c===Xf||c===Jf;)s--,c=e.codePointAt(s-1)}return s>l?e.slice(l,s):""}function V_(e,i){const r={type:"text",value:W_(String(i.value))};return e.patch(i,r),e.applyData(i,r)}function q_(e,i){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(i,r),e.applyData(i,r)}const Y_={blockquote:x_,break:S_,code:N_,delete:C_,emphasis:T_,footnoteReference:A_,heading:R_,html:O_,imageReference:I_,image:M_,inlineCode:L_,linkReference:D_,link:P_,listItem:z_,list:B_,paragraph:U_,root:$_,strong:j_,table:H_,tableCell:G_,tableRow:K_,text:V_,thematicBreak:q_,toml:Vl,yaml:Vl,definition:Vl,footnoteDefinition:Vl};function Vl(){}const wm=-1,fa=0,Ro=1,ia=2,qu=3,Yu=4,Qu=5,Zu=6,xm=7,Sm=8,Q_=typeof self=="object"?self:globalThis,tp=(e,i)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new Q_[e](i)},Z_=(e,i)=>{const r=(s,c)=>(e.set(c,s),s),l=s=>{if(e.has(s))return e.get(s);const[c,u]=i[s];switch(c){case fa:case wm:return r(u,s);case Ro:{const d=r([],s);for(const p of u)d.push(l(p));return d}case ia:{const d=r({},s);for(const[p,m]of u)d[l(p)]=l(m);return d}case qu:return r(new Date(u),s);case Yu:{const{source:d,flags:p}=u;return r(new RegExp(d,p),s)}case Qu:{const d=r(new Map,s);for(const[p,m]of u)d.set(l(p),l(m));return d}case Zu:{const d=r(new Set,s);for(const p of u)d.add(l(p));return d}case xm:{const{name:d,message:p}=u;return r(tp(d,p),s)}case Sm:return r(BigInt(u),s);case"BigInt":return r(Object(BigInt(u)),s);case"ArrayBuffer":return r(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:d}=new Uint8Array(u);return r(new DataView(d),u)}}return r(tp(c,u),s)};return l},np=e=>Z_(new Map,e)(0),ei="",{toString:X_}={},{keys:J_}=Object,No=e=>{const i=typeof e;if(i!=="object"||!e)return[fa,i];const r=X_.call(e).slice(8,-1);switch(r){case"Array":return[Ro,ei];case"Object":return[ia,ei];case"Date":return[qu,ei];case"RegExp":return[Yu,ei];case"Map":return[Qu,ei];case"Set":return[Zu,ei];case"DataView":return[Ro,r]}return r.includes("Array")?[Ro,r]:r.includes("Error")?[xm,r]:[ia,r]},ql=([e,i])=>e===fa&&(i==="function"||i==="symbol"),ev=(e,i,r,l)=>{const s=(u,d)=>{const p=l.push(u)-1;return r.set(d,p),p},c=u=>{if(r.has(u))return r.get(u);let[d,p]=No(u);switch(d){case fa:{let g=u;switch(p){case"bigint":d=Sm,g=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);g=null;break;case"undefined":return s([wm],u)}return s([d,g],u)}case Ro:{if(p){let E=u;return p==="DataView"?E=new Uint8Array(u.buffer):p==="ArrayBuffer"&&(E=new Uint8Array(u)),s([p,[...E]],u)}const g=[],y=s([d,g],u);for(const E of u)g.push(c(E));return y}case ia:{if(p)switch(p){case"BigInt":return s([p,u.toString()],u);case"Boolean":case"Number":case"String":return s([p,u.valueOf()],u)}if(i&&"toJSON"in u)return c(u.toJSON());const g=[],y=s([d,g],u);for(const E of J_(u))(e||!ql(No(u[E])))&&g.push([c(E),c(u[E])]);return y}case qu:return s([d,isNaN(u.getTime())?ei:u.toISOString()],u);case Yu:{const{source:g,flags:y}=u;return s([d,{source:g,flags:y}],u)}case Qu:{const g=[],y=s([d,g],u);for(const[E,b]of u)(e||!(ql(No(E))||ql(No(b))))&&g.push([c(E),c(b)]);return y}case Zu:{const g=[],y=s([d,g],u);for(const E of u)(e||!ql(No(E)))&&g.push(c(E));return y}}const{message:m}=u;return s([d,{name:p,message:m}],u)};return c},rp=(e,{json:i,lossy:r}={})=>{const l=[];return ev(!(i||r),!!i,new Map,l)(e),l},oa=typeof structuredClone=="function"?(e,i)=>i&&("json"in i||"lossy"in i)?np(rp(e,i)):structuredClone(e):(e,i)=>np(rp(e,i));function tv(e,i){const r=[{type:"text",value:"↩"}];return i>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(i)}]}),r}function nv(e,i){return"Back to reference "+(e+1)+(i>1?"-"+i:"")}function rv(e){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||tv,l=e.options.footnoteBackLabel||nv,s=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let p=-1;for(;++p<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[p]);if(!m)continue;const g=e.all(m),y=String(m.identifier).toUpperCase(),E=Bi(y.toLowerCase());let b=0;const x=[],C=e.footnoteCounts.get(y);for(;C!==void 0&&++b<=C;){x.length>0&&x.push({type:"text",value:" "});let F=typeof r=="string"?r:r(p,b);typeof F=="string"&&(F={type:"text",value:F}),x.push({type:"element",tagName:"a",properties:{href:"#"+i+"fnref-"+E+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof l=="string"?l:l(p,b),className:["data-footnote-backref"]},children:Array.isArray(F)?F:[F]})}const T=g[g.length-1];if(T&&T.type==="element"&&T.tagName==="p"){const F=T.children[T.children.length-1];F&&F.type==="text"?F.value+=" ":T.children.push({type:"text",value:" "}),T.children.push(...x)}else g.push(...x);const w={type:"element",tagName:"li",properties:{id:i+"fn-"+E},children:e.wrap(g,!0)};e.patch(m,w),d.push(w)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...oa(u),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:` +`}]}}const Po=(function(e){if(e==null)return av;if(typeof e=="function")return pa(e);if(typeof e=="object")return Array.isArray(e)?iv(e):ov(e);if(typeof e=="string")return lv(e);throw new Error("Expected function, string, or object as test")});function iv(e){const i=[];let r=-1;for(;++r<e.length;)i[r]=Po(e[r]);return pa(l);function l(...s){let c=-1;for(;++c<i.length;)if(i[c].apply(this,s))return!0;return!1}}function ov(e){const i=e;return pa(r);function r(l){const s=l;let c;for(c in e)if(s[c]!==i[c])return!1;return!0}}function lv(e){return pa(i);function i(r){return r&&r.type===e}}function pa(e){return i;function i(r,l,s){return!!(sv(r)&&e.call(this,r,typeof l=="number"?l:void 0,s||void 0))}}function av(){return!0}function sv(e){return e!==null&&typeof e=="object"&&"type"in e}const Nm=[],uv=!0,Au=!1,cv="skip";function Cm(e,i,r,l){let s;typeof i=="function"&&typeof r!="function"?(l=r,r=i):s=i;const c=Po(s),u=l?-1:1;d(e,void 0,[])();function d(p,m,g){const y=p&&typeof p=="object"?p:{};if(typeof y.type=="string"){const b=typeof y.tagName=="string"?y.tagName:typeof y.name=="string"?y.name:void 0;Object.defineProperty(E,"name",{value:"node ("+(p.type+(b?"<"+b+">":""))+")"})}return E;function E(){let b=Nm,x,C,T;if((!i||c(p,m,g[g.length-1]||void 0))&&(b=dv(r(p,g)),b[0]===Au))return b;if("children"in p&&p.children){const w=p;if(w.children&&b[0]!==cv)for(C=(l?w.children.length:-1)+u,T=g.concat(w);C>-1&&C<w.children.length;){const F=w.children[C];if(x=d(F,C,T)(),x[0]===Au)return x;C=typeof x[1]=="number"?x[1]:C+u}}return b}}}function dv(e){return Array.isArray(e)?e:typeof e=="number"?[uv,e]:e==null?Nm:[e]}function ma(e,i,r,l){let s,c,u;typeof i=="function"&&typeof r!="function"?(c=void 0,u=i,s=r):(c=i,u=r,s=l),Cm(e,c,d,s);function d(p,m){const g=m[m.length-1],y=g?g.children.indexOf(p):void 0;return u(p,y,g)}}const Ru={}.hasOwnProperty,fv={};function pv(e,i){const r=i||fv,l=new Map,s=new Map,c=new Map,u={...Y_,...r.handlers},d={all:m,applyData:hv,definitionById:l,footnoteById:s,footnoteCounts:c,footnoteOrder:[],handlers:u,one:p,options:r,patch:mv,wrap:yv};return ma(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const y=g.type==="definition"?l:s,E=String(g.identifier).toUpperCase();y.has(E)||y.set(E,g)}}),d;function p(g,y){const E=g.type,b=d.handlers[E];if(Ru.call(d.handlers,E)&&b)return b(d,g,y);if(d.options.passThrough&&d.options.passThrough.includes(E)){if("children"in g){const{children:C,...T}=g,w=oa(T);return w.children=d.all(g),w}return oa(g)}return(d.options.unknownHandler||gv)(d,g,y)}function m(g){const y=[];if("children"in g){const E=g.children;let b=-1;for(;++b<E.length;){const x=d.one(E[b],g);if(x){if(b&&E[b-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=ip(x.value)),!Array.isArray(x)&&x.type==="element")){const C=x.children[0];C&&C.type==="text"&&(C.value=ip(C.value))}Array.isArray(x)?y.push(...x):y.push(x)}}}return y}}function mv(e,i){e.position&&(i.position=tb(e))}function hv(e,i){let r=i;if(e&&e.data){const l=e.data.hName,s=e.data.hChildren,c=e.data.hProperties;if(typeof l=="string")if(r.type==="element")r.tagName=l;else{const u="children"in r?r.children:[r];r={type:"element",tagName:l,properties:{},children:u}}r.type==="element"&&c&&Object.assign(r.properties,oa(c)),"children"in r&&r.children&&s!==null&&s!==void 0&&(r.children=s)}return r}function gv(e,i){const r=i.data||{},l="value"in i&&!(Ru.call(r,"hProperties")||Ru.call(r,"hChildren"))?{type:"text",value:i.value}:{type:"element",tagName:"div",properties:{},children:e.all(i)};return e.patch(i,l),e.applyData(i,l)}function yv(e,i){const r=[];let l=-1;for(i&&r.push({type:"text",value:` +`});++l<e.length;)l&&r.push({type:"text",value:` +`}),r.push(e[l]);return i&&e.length>0&&r.push({type:"text",value:` +`}),r}function ip(e){let i=0,r=e.charCodeAt(i);for(;r===9||r===32;)i++,r=e.charCodeAt(i);return e.slice(i)}function op(e,i){const r=pv(e,i),l=r.one(e,void 0),s=rv(r),c=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return s&&c.children.push({type:"text",value:` +`},s),c}function bv(e,i){return e&&"run"in e?async function(r,l){const s=op(r,{file:l,...i});await e.run(s,l)}:function(r,l){return op(r,{file:l,...e||i})}}function lp(e){if(e)throw e}var ou,ap;function Ev(){if(ap)return ou;ap=1;var e=Object.prototype.hasOwnProperty,i=Object.prototype.toString,r=Object.defineProperty,l=Object.getOwnPropertyDescriptor,s=function(m){return typeof Array.isArray=="function"?Array.isArray(m):i.call(m)==="[object Array]"},c=function(m){if(!m||i.call(m)!=="[object Object]")return!1;var g=e.call(m,"constructor"),y=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!g&&!y)return!1;var E;for(E in m);return typeof E>"u"||e.call(m,E)},u=function(m,g){r&&g.name==="__proto__"?r(m,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):m[g.name]=g.newValue},d=function(m,g){if(g==="__proto__")if(e.call(m,g)){if(l)return l(m,g).value}else return;return m[g]};return ou=function p(){var m,g,y,E,b,x,C=arguments[0],T=1,w=arguments.length,F=!1;for(typeof C=="boolean"&&(F=C,C=arguments[1]||{},T=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});T<w;++T)if(m=arguments[T],m!=null)for(g in m)y=d(C,g),E=d(m,g),C!==E&&(F&&E&&(c(E)||(b=s(E)))?(b?(b=!1,x=y&&s(y)?y:[]):x=y&&c(y)?y:{},u(C,{name:g,newValue:p(F,x,E)})):typeof E<"u"&&u(C,{name:g,newValue:E}));return C},ou}var _v=Ev();const lu=Mo(_v);function Ou(e){if(typeof e!="object"||e===null)return!1;const i=Object.getPrototypeOf(e);return(i===null||i===Object.prototype||Object.getPrototypeOf(i)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function vv(){const e=[],i={run:r,use:l};return i;function r(...s){let c=-1;const u=s.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);d(null,...s);function d(p,...m){const g=e[++c];let y=-1;if(p){u(p);return}for(;++y<s.length;)(m[y]===null||m[y]===void 0)&&(m[y]=s[y]);s=m,g?kv(g,d)(...m):u(null,...m)}}function l(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),i}}function kv(e,i){let r;return l;function l(...u){const d=e.length>u.length;let p;d&&u.push(s);try{p=e.apply(this,u)}catch(m){const g=m;if(d&&r)throw g;return s(g)}d||(p&&p.then&&typeof p.then=="function"?p.then(c,s):p instanceof Error?s(p):c(p))}function s(u,...d){r||(r=!0,i(u,...d))}function c(u){s(null,u)}}const Hn={basename:wv,dirname:xv,extname:Sv,join:Nv,sep:"/"};function wv(e,i){if(i!==void 0&&typeof i!="string")throw new TypeError('"ext" argument must be a string');zo(e);let r=0,l=-1,s=e.length,c;if(i===void 0||i.length===0||i.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(c){r=s+1;break}}else l<0&&(c=!0,l=s+1);return l<0?"":e.slice(r,l)}if(i===e)return"";let u=-1,d=i.length-1;for(;s--;)if(e.codePointAt(s)===47){if(c){r=s+1;break}}else u<0&&(c=!0,u=s+1),d>-1&&(e.codePointAt(s)===i.codePointAt(d--)?d<0&&(l=s):(d=-1,l=u));return r===l?l=u:l<0&&(l=e.length),e.slice(r,l)}function xv(e){if(zo(e),e.length===0)return".";let i=-1,r=e.length,l;for(;--r;)if(e.codePointAt(r)===47){if(l){i=r;break}}else l||(l=!0);return i<0?e.codePointAt(0)===47?"/":".":i===1&&e.codePointAt(0)===47?"//":e.slice(0,i)}function Sv(e){zo(e);let i=e.length,r=-1,l=0,s=-1,c=0,u;for(;i--;){const d=e.codePointAt(i);if(d===47){if(u){l=i+1;break}continue}r<0&&(u=!0,r=i+1),d===46?s<0?s=i:c!==1&&(c=1):s>-1&&(c=-1)}return s<0||r<0||c===0||c===1&&s===r-1&&s===l+1?"":e.slice(s,r)}function Nv(...e){let i=-1,r;for(;++i<e.length;)zo(e[i]),e[i]&&(r=r===void 0?e[i]:r+"/"+e[i]);return r===void 0?".":Cv(r)}function Cv(e){zo(e);const i=e.codePointAt(0)===47;let r=Tv(e,!i);return r.length===0&&!i&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),i?"/"+r:r}function Tv(e,i){let r="",l=0,s=-1,c=0,u=-1,d,p;for(;++u<=e.length;){if(u<e.length)d=e.codePointAt(u);else{if(d===47)break;d=47}if(d===47){if(!(s===u-1||c===1))if(s!==u-1&&c===2){if(r.length<2||l!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(p=r.lastIndexOf("/"),p!==r.length-1){p<0?(r="",l=0):(r=r.slice(0,p),l=r.length-1-r.lastIndexOf("/")),s=u,c=0;continue}}else if(r.length>0){r="",l=0,s=u,c=0;continue}}i&&(r=r.length>0?r+"/..":"..",l=2)}else r.length>0?r+="/"+e.slice(s+1,u):r=e.slice(s+1,u),l=u-s-1;s=u,c=0}else d===46&&c>-1?c++:c=-1}return r}function zo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Av={cwd:Rv};function Rv(){return"/"}function Iu(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Ov(e){if(typeof e=="string")e=new URL(e);else if(!Iu(e)){const i=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw i.code="ERR_INVALID_ARG_TYPE",i}if(e.protocol!=="file:"){const i=new TypeError("The URL must be of scheme file");throw i.code="ERR_INVALID_URL_SCHEME",i}return Iv(e)}function Iv(e){if(e.hostname!==""){const l=new TypeError('File URL host must be "localhost" or empty on darwin');throw l.code="ERR_INVALID_FILE_URL_HOST",l}const i=e.pathname;let r=-1;for(;++r<i.length;)if(i.codePointAt(r)===37&&i.codePointAt(r+1)===50){const l=i.codePointAt(r+2);if(l===70||l===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(i)}const au=["history","path","basename","stem","extname","dirname"];class Tm{constructor(i){let r;i?Iu(i)?r={path:i}:typeof i=="string"||Mv(i)?r={value:i}:r=i:r={},this.cwd="cwd"in r?"":Av.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let l=-1;for(;++l<au.length;){const c=au[l];c in r&&r[c]!==void 0&&r[c]!==null&&(this[c]=c==="history"?[...r[c]]:r[c])}let s;for(s in r)au.includes(s)||(this[s]=r[s])}get basename(){return typeof this.path=="string"?Hn.basename(this.path):void 0}set basename(i){uu(i,"basename"),su(i,"basename"),this.path=Hn.join(this.dirname||"",i)}get dirname(){return typeof this.path=="string"?Hn.dirname(this.path):void 0}set dirname(i){sp(this.basename,"dirname"),this.path=Hn.join(i||"",this.basename)}get extname(){return typeof this.path=="string"?Hn.extname(this.path):void 0}set extname(i){if(su(i,"extname"),sp(this.dirname,"extname"),i){if(i.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(i.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Hn.join(this.dirname,this.stem+(i||""))}get path(){return this.history[this.history.length-1]}set path(i){Iu(i)&&(i=Ov(i)),uu(i,"path"),this.path!==i&&this.history.push(i)}get stem(){return typeof this.path=="string"?Hn.basename(this.path,this.extname):void 0}set stem(i){uu(i,"stem"),su(i,"stem"),this.path=Hn.join(this.dirname||"",i+(this.extname||""))}fail(i,r,l){const s=this.message(i,r,l);throw s.fatal=!0,s}info(i,r,l){const s=this.message(i,r,l);return s.fatal=void 0,s}message(i,r,l){const s=new Pt(i,r,l);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(i){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(i||void 0).decode(this.value)}}function su(e,i){if(e&&e.includes(Hn.sep))throw new Error("`"+i+"` cannot be a path: did not expect `"+Hn.sep+"`")}function uu(e,i){if(!e)throw new Error("`"+i+"` cannot be empty")}function sp(e,i){if(!e)throw new Error("Setting `"+i+"` requires `path` to be set too")}function Mv(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Lv=(function(e){const l=this.constructor.prototype,s=l[e],c=function(){return s.apply(c,arguments)};return Object.setPrototypeOf(c,l),c}),Dv={}.hasOwnProperty;class Xu extends Lv{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=vv()}copy(){const i=new Xu;let r=-1;for(;++r<this.attachers.length;){const l=this.attachers[r];i.use(...l)}return i.data(lu(!0,{},this.namespace)),i}data(i,r){return typeof i=="string"?arguments.length===2?(fu("data",this.frozen),this.namespace[i]=r,this):Dv.call(this.namespace,i)&&this.namespace[i]||void 0:i?(fu("data",this.frozen),this.namespace=i,this):this.namespace}freeze(){if(this.frozen)return this;const i=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...l]=this.attachers[this.freezeIndex];if(l[0]===!1)continue;l[0]===!0&&(l[0]=void 0);const s=r.call(i,...l);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(i){this.freeze();const r=Yl(i),l=this.parser||this.Parser;return cu("parse",l),l(String(r),r)}process(i,r){const l=this;return this.freeze(),cu("process",this.parser||this.Parser),du("process",this.compiler||this.Compiler),r?s(void 0,r):new Promise(s);function s(c,u){const d=Yl(i),p=l.parse(d);l.run(p,d,function(g,y,E){if(g||!y||!E)return m(g);const b=y,x=l.stringify(b,E);Fv(x)?E.value=x:E.result=x,m(g,E)});function m(g,y){g||!y?u(g):c?c(y):r(void 0,y)}}}processSync(i){let r=!1,l;return this.freeze(),cu("processSync",this.parser||this.Parser),du("processSync",this.compiler||this.Compiler),this.process(i,s),cp("processSync","process",r),l;function s(c,u){r=!0,lp(c),l=u}}run(i,r,l){up(i),this.freeze();const s=this.transformers;return!l&&typeof r=="function"&&(l=r,r=void 0),l?c(void 0,l):new Promise(c);function c(u,d){const p=Yl(r);s.run(i,p,m);function m(g,y,E){const b=y||i;g?d(g):u?u(b):l(void 0,b,E)}}}runSync(i,r){let l=!1,s;return this.run(i,r,c),cp("runSync","run",l),s;function c(u,d){lp(u),s=d,l=!0}}stringify(i,r){this.freeze();const l=Yl(r),s=this.compiler||this.Compiler;return du("stringify",s),up(i),s(i,l)}use(i,...r){const l=this.attachers,s=this.namespace;if(fu("use",this.frozen),i!=null)if(typeof i=="function")p(i,r);else if(typeof i=="object")Array.isArray(i)?d(i):u(i);else throw new TypeError("Expected usable value, not `"+i+"`");return this;function c(m){if(typeof m=="function")p(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[g,...y]=m;p(g,y)}else u(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function u(m){if(!("plugins"in m)&&!("settings"in m))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");d(m.plugins),m.settings&&(s.settings=lu(!0,s.settings,m.settings))}function d(m){let g=-1;if(m!=null)if(Array.isArray(m))for(;++g<m.length;){const y=m[g];c(y)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function p(m,g){let y=-1,E=-1;for(;++y<l.length;)if(l[y][0]===m){E=y;break}if(E===-1)l.push([m,...g]);else if(g.length>0){let[b,...x]=g;const C=l[E][1];Ou(C)&&Ou(b)&&(b=lu(!0,C,b)),l[E]=[m,b,...x]}}}}const Pv=new Xu().freeze();function cu(e,i){if(typeof i!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function du(e,i){if(typeof i!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function fu(e,i){if(i)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function up(e){if(!Ou(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function cp(e,i,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+i+"` instead")}function Yl(e){return zv(e)?e:new Tm(e)}function zv(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Fv(e){return typeof e=="string"||Bv(e)}function Bv(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Uv="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",dp=[],fp={allowDangerousHtml:!0},$v=/^(https?|ircs?|mailto|xmpp)$/i,jv=[{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:"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 Hv(e){const i=Kv(e),r=Gv(e);return Wv(i.runSync(i.parse(r),r),e)}function Kv(e){const i=e.rehypePlugins||dp,r=e.remarkPlugins||dp,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...fp}:fp;return Pv().use(w_).use(r).use(bv,l).use(i)}function Gv(e){const i=e.children||"",r=new Tm;return typeof i=="string"&&(r.value=i),r}function Wv(e,i){const r=i.allowedElements,l=i.allowElement,s=i.components,c=i.disallowedElements,u=i.skipHtml,d=i.unwrapDisallowed,p=i.urlTransform||Vv;for(const g of jv)Object.hasOwn(i,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+Uv+g.id,void 0);return i.className&&(e={type:"element",tagName:"div",properties:{className:i.className},children:e.type==="root"?e.children:[e]}),ma(e,m),lb(e,{Fragment:k.Fragment,components:s,ignoreInvalidStyle:!0,jsx:k.jsx,jsxs:k.jsxs,passKeys:!0,passNode:!0});function m(g,y,E){if(g.type==="raw"&&E&&typeof y=="number")return u?E.children.splice(y,1):E.children[y]={type:"text",value:g.value},y;if(g.type==="element"){let b;for(b in nu)if(Object.hasOwn(nu,b)&&Object.hasOwn(g.properties,b)){const x=g.properties[b],C=nu[b];(C===null||C.includes(g.tagName))&&(g.properties[b]=p(String(x||""),b,g))}}if(g.type==="element"){let b=r?!r.includes(g.tagName):c?c.includes(g.tagName):!1;if(!b&&l&&typeof y=="number"&&(b=!l(g,y,E)),b&&E&&typeof y=="number")return d&&g.children?E.children.splice(y,1,...g.children):E.children.splice(y,1),y}}}function Vv(e){const i=e.indexOf(":"),r=e.indexOf("?"),l=e.indexOf("#"),s=e.indexOf("/");return i===-1||s!==-1&&i>s||r!==-1&&i>r||l!==-1&&i>l||$v.test(e.slice(0,i))?e:""}function pp(e,i){const r=String(e);if(typeof i!="string")throw new TypeError("Expected character");let l=0,s=r.indexOf(i);for(;s!==-1;)l++,s=r.indexOf(i,s+i.length);return l}function qv(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Yv(e,i,r){const s=Po((r||{}).ignore||[]),c=Qv(i);let u=-1;for(;++u<c.length;)Cm(e,"text",d);function d(m,g){let y=-1,E;for(;++y<g.length;){const b=g[y],x=E?E.children:void 0;if(s(b,x?x.indexOf(b):void 0,E))return;E=b}if(E)return p(m,g)}function p(m,g){const y=g[g.length-1],E=c[u][0],b=c[u][1];let x=0;const T=y.children.indexOf(m);let w=!1,F=[];E.lastIndex=0;let L=E.exec(m.value);for(;L;){const $=L.index,K={index:L.index,input:L.input,stack:[...g,m]};let I=b(...L,K);if(typeof I=="string"&&(I=I.length>0?{type:"text",value:I}:void 0),I===!1?E.lastIndex=$+1:(x!==$&&F.push({type:"text",value:m.value.slice(x,$)}),Array.isArray(I)?F.push(...I):I&&F.push(I),x=$+L[0].length,w=!0),!E.global)break;L=E.exec(m.value)}return w?(x<m.value.length&&F.push({type:"text",value:m.value.slice(x)}),y.children.splice(T,1,...F)):F=[m],T+F.length}}function Qv(e){const i=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let l=-1;for(;++l<r.length;){const s=r[l];i.push([Zv(s[0]),Xv(s[1])])}return i}function Zv(e){return typeof e=="string"?new RegExp(qv(e),"g"):e}function Xv(e){return typeof e=="function"?e:function(){return e}}const pu="phrasing",mu=["autolink","link","image","label"];function Jv(){return{transforms:[lk],enter:{literalAutolink:tk,literalAutolinkEmail:hu,literalAutolinkHttp:hu,literalAutolinkWww:hu},exit:{literalAutolink:ok,literalAutolinkEmail:ik,literalAutolinkHttp:nk,literalAutolinkWww:rk}}}function ek(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:pu,notInConstruct:mu},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:pu,notInConstruct:mu},{character:":",before:"[ps]",after:"\\/",inConstruct:pu,notInConstruct:mu}]}}function tk(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function hu(e){this.config.enter.autolinkProtocol.call(this,e)}function nk(e){this.config.exit.autolinkProtocol.call(this,e)}function rk(e){this.config.exit.data.call(this,e);const i=this.stack[this.stack.length-1];i.type,i.url="http://"+this.sliceSerialize(e)}function ik(e){this.config.exit.autolinkEmail.call(this,e)}function ok(e){this.exit(e)}function lk(e){Yv(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,ak],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),sk]],{ignore:["link","linkReference"]})}function ak(e,i,r,l,s){let c="";if(!Am(s)||(/^w/i.test(i)&&(r=i+r,i="",c="http://"),!uk(r)))return!1;const u=ck(r+l);if(!u[0])return!1;const d={type:"link",title:null,url:c+i+u[0],children:[{type:"text",value:i+u[0]}]};return u[1]?[d,{type:"text",value:u[1]}]:d}function sk(e,i,r,l){return!Am(l,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+i+"@"+r,children:[{type:"text",value:i+"@"+r}]}}function uk(e){const i=e.split(".");return!(i.length<2||i[i.length-1]&&(/_/.test(i[i.length-1])||!/[a-zA-Z\d]/.test(i[i.length-1]))||i[i.length-2]&&(/_/.test(i[i.length-2])||!/[a-zA-Z\d]/.test(i[i.length-2])))}function ck(e){const i=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!i)return[e,void 0];e=e.slice(0,i.index);let r=i[0],l=r.indexOf(")");const s=pp(e,"(");let c=pp(e,")");for(;l!==-1&&s>c;)e+=r.slice(0,l+1),r=r.slice(l+1),l=r.indexOf(")"),c++;return[e,r]}function Am(e,i){const r=e.input.charCodeAt(e.index-1);return(e.index===0||ni(r)||ca(r))&&(!i||r!==47)}Rm.peek=Ek;function dk(){this.buffer()}function fk(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function pk(){this.buffer()}function mk(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function hk(e){const i=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=On(this.sliceSerialize(e)).toLowerCase(),r.label=i}function gk(e){this.exit(e)}function yk(e){const i=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=On(this.sliceSerialize(e)).toLowerCase(),r.label=i}function bk(e){this.exit(e)}function Ek(){return"["}function Rm(e,i,r,l){const s=r.createTracker(l);let c=s.move("[^");const u=r.enter("footnoteReference"),d=r.enter("reference");return c+=s.move(r.safe(r.associationId(e),{after:"]",before:c})),d(),u(),c+=s.move("]"),c}function _k(){return{enter:{gfmFootnoteCallString:dk,gfmFootnoteCall:fk,gfmFootnoteDefinitionLabelString:pk,gfmFootnoteDefinition:mk},exit:{gfmFootnoteCallString:hk,gfmFootnoteCall:gk,gfmFootnoteDefinitionLabelString:yk,gfmFootnoteDefinition:bk}}}function vk(e){let i=!1;return e&&e.firstLineBlank&&(i=!0),{handlers:{footnoteDefinition:r,footnoteReference:Rm},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(l,s,c,u){const d=c.createTracker(u);let p=d.move("[^");const m=c.enter("footnoteDefinition"),g=c.enter("label");return p+=d.move(c.safe(c.associationId(l),{before:p,after:"]"})),g(),p+=d.move("]:"),l.children&&l.children.length>0&&(d.shift(4),p+=d.move((i?` +`:" ")+c.indentLines(c.containerFlow(l,d.current()),i?Om:kk))),m(),p}}function kk(e,i,r){return i===0?e:Om(e,i,r)}function Om(e,i,r){return(r?"":" ")+e}const wk=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Im.peek=Tk;function xk(){return{canContainEols:["delete"],enter:{strikethrough:Nk},exit:{strikethrough:Ck}}}function Sk(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:wk}],handlers:{delete:Im}}}function Nk(e){this.enter({type:"delete",children:[]},e)}function Ck(e){this.exit(e)}function Im(e,i,r,l){const s=r.createTracker(l),c=r.enter("strikethrough");let u=s.move("~~");return u+=r.containerPhrasing(e,{...s.current(),before:u,after:"~"}),u+=s.move("~~"),c(),u}function Tk(){return"~"}function Ak(e){return e.length}function Rk(e,i){const r=i||{},l=(r.align||[]).concat(),s=r.stringLength||Ak,c=[],u=[],d=[],p=[];let m=0,g=-1;for(;++g<e.length;){const C=[],T=[];let w=-1;for(e[g].length>m&&(m=e[g].length);++w<e[g].length;){const F=Ok(e[g][w]);if(r.alignDelimiters!==!1){const L=s(F);T[w]=L,(p[w]===void 0||L>p[w])&&(p[w]=L)}C.push(F)}u[g]=C,d[g]=T}let y=-1;if(typeof l=="object"&&"length"in l)for(;++y<m;)c[y]=mp(l[y]);else{const C=mp(l);for(;++y<m;)c[y]=C}y=-1;const E=[],b=[];for(;++y<m;){const C=c[y];let T="",w="";C===99?(T=":",w=":"):C===108?T=":":C===114&&(w=":");let F=r.alignDelimiters===!1?1:Math.max(1,p[y]-T.length-w.length);const L=T+"-".repeat(F)+w;r.alignDelimiters!==!1&&(F=T.length+F+w.length,F>p[y]&&(p[y]=F),b[y]=F),E[y]=L}u.splice(1,0,E),d.splice(1,0,b),g=-1;const x=[];for(;++g<u.length;){const C=u[g],T=d[g];y=-1;const w=[];for(;++y<m;){const F=C[y]||"";let L="",$="";if(r.alignDelimiters!==!1){const K=p[y]-(T[y]||0),I=c[y];I===114?L=" ".repeat(K):I===99?K%2?(L=" ".repeat(K/2+.5),$=" ".repeat(K/2-.5)):(L=" ".repeat(K/2),$=L):$=" ".repeat(K)}r.delimiterStart!==!1&&!y&&w.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&F==="")&&(r.delimiterStart!==!1||y)&&w.push(" "),r.alignDelimiters!==!1&&w.push(L),w.push(F),r.alignDelimiters!==!1&&w.push($),r.padding!==!1&&w.push(" "),(r.delimiterEnd!==!1||y!==m-1)&&w.push("|")}x.push(r.delimiterEnd===!1?w.join("").replace(/ +$/,""):w.join(""))}return x.join(` +`)}function Ok(e){return e==null?"":String(e)}function mp(e){const i=typeof e=="string"?e.codePointAt(0):0;return i===67||i===99?99:i===76||i===108?108:i===82||i===114?114:0}function Ik(e,i,r,l){const s=r.enter("blockquote"),c=r.createTracker(l);c.move("> "),c.shift(2);const u=r.indentLines(r.containerFlow(e,c.current()),Mk);return s(),u}function Mk(e,i,r){return">"+(r?"":" ")+e}function Lk(e,i){return hp(e,i.inConstruct,!0)&&!hp(e,i.notInConstruct,!1)}function hp(e,i,r){if(typeof i=="string"&&(i=[i]),!i||i.length===0)return r;let l=-1;for(;++l<i.length;)if(e.includes(i[l]))return!0;return!1}function gp(e,i,r,l){let s=-1;for(;++s<r.unsafe.length;)if(r.unsafe[s].character===` +`&&Lk(r.stack,r.unsafe[s]))return/[ \t]/.test(l.before)?"":" ";return`\\ +`}function Dk(e,i){const r=String(e);let l=r.indexOf(i),s=l,c=0,u=0;if(typeof i!="string")throw new TypeError("Expected substring");for(;l!==-1;)l===s?++c>u&&(u=c):c=1,s=l+i.length,l=r.indexOf(i,s);return u}function Pk(e,i){return!!(i.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function zk(e){const i=e.options.fence||"`";if(i!=="`"&&i!=="~")throw new Error("Cannot serialize code with `"+i+"` for `options.fence`, expected `` ` `` or `~`");return i}function Fk(e,i,r,l){const s=zk(r),c=e.value||"",u=s==="`"?"GraveAccent":"Tilde";if(Pk(e,r)){const y=r.enter("codeIndented"),E=r.indentLines(c,Bk);return y(),E}const d=r.createTracker(l),p=s.repeat(Math.max(Dk(c,s)+1,3)),m=r.enter("codeFenced");let g=d.move(p);if(e.lang){const y=r.enter(`codeFencedLang${u}`);g+=d.move(r.safe(e.lang,{before:g,after:" ",encode:["`"],...d.current()})),y()}if(e.lang&&e.meta){const y=r.enter(`codeFencedMeta${u}`);g+=d.move(" "),g+=d.move(r.safe(e.meta,{before:g,after:` +`,encode:["`"],...d.current()})),y()}return g+=d.move(` +`),c&&(g+=d.move(c+` +`)),g+=d.move(p),m(),g}function Bk(e,i,r){return(r?"":" ")+e}function Ju(e){const i=e.options.quote||'"';if(i!=='"'&&i!=="'")throw new Error("Cannot serialize title with `"+i+"` for `options.quote`, expected `\"`, or `'`");return i}function Uk(e,i,r,l){const s=Ju(r),c=s==='"'?"Quote":"Apostrophe",u=r.enter("definition");let d=r.enter("label");const p=r.createTracker(l);let m=p.move("[");return m+=p.move(r.safe(r.associationId(e),{before:m,after:"]",...p.current()})),m+=p.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=r.enter("destinationLiteral"),m+=p.move("<"),m+=p.move(r.safe(e.url,{before:m,after:">",...p.current()})),m+=p.move(">")):(d=r.enter("destinationRaw"),m+=p.move(r.safe(e.url,{before:m,after:e.title?" ":` +`,...p.current()}))),d(),e.title&&(d=r.enter(`title${c}`),m+=p.move(" "+s),m+=p.move(r.safe(e.title,{before:m,after:s,...p.current()})),m+=p.move(s),d()),u(),m}function $k(e){const i=e.options.emphasis||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize emphasis with `"+i+"` for `options.emphasis`, expected `*`, or `_`");return i}function Io(e){return"&#x"+e.toString(16).toUpperCase()+";"}function la(e,i,r){const l=zi(e),s=zi(i);return l===void 0?s===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:l===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Mm.peek=jk;function Mm(e,i,r,l){const s=$k(r),c=r.enter("emphasis"),u=r.createTracker(l),d=u.move(s);let p=u.move(r.containerPhrasing(e,{after:s,before:d,...u.current()}));const m=p.charCodeAt(0),g=la(l.before.charCodeAt(l.before.length-1),m,s);g.inside&&(p=Io(m)+p.slice(1));const y=p.charCodeAt(p.length-1),E=la(l.after.charCodeAt(0),y,s);E.inside&&(p=p.slice(0,-1)+Io(y));const b=u.move(s);return c(),r.attentionEncodeSurroundingInfo={after:E.outside,before:g.outside},d+p+b}function jk(e,i,r){return r.options.emphasis||"*"}function Hk(e,i){let r=!1;return ma(e,function(l){if("value"in l&&/\r?\n|\r/.test(l.value)||l.type==="break")return r=!0,Au}),!!((!e.depth||e.depth<3)&&Gu(e)&&(i.options.setext||r))}function Kk(e,i,r,l){const s=Math.max(Math.min(6,e.depth||1),1),c=r.createTracker(l);if(Hk(e,r)){const g=r.enter("headingSetext"),y=r.enter("phrasing"),E=r.containerPhrasing(e,{...c.current(),before:` +`,after:` +`});return y(),g(),E+` +`+(s===1?"=":"-").repeat(E.length-(Math.max(E.lastIndexOf("\r"),E.lastIndexOf(` +`))+1))}const u="#".repeat(s),d=r.enter("headingAtx"),p=r.enter("phrasing");c.move(u+" ");let m=r.containerPhrasing(e,{before:"# ",after:` +`,...c.current()});return/^[\t ]/.test(m)&&(m=Io(m.charCodeAt(0))+m.slice(1)),m=m?u+" "+m:u,r.options.closeAtx&&(m+=" "+u),p(),d(),m}Lm.peek=Gk;function Lm(e){return e.value||""}function Gk(){return"<"}Dm.peek=Wk;function Dm(e,i,r,l){const s=Ju(r),c=s==='"'?"Quote":"Apostrophe",u=r.enter("image");let d=r.enter("label");const p=r.createTracker(l);let m=p.move("![");return m+=p.move(r.safe(e.alt,{before:m,after:"]",...p.current()})),m+=p.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=r.enter("destinationLiteral"),m+=p.move("<"),m+=p.move(r.safe(e.url,{before:m,after:">",...p.current()})),m+=p.move(">")):(d=r.enter("destinationRaw"),m+=p.move(r.safe(e.url,{before:m,after:e.title?" ":")",...p.current()}))),d(),e.title&&(d=r.enter(`title${c}`),m+=p.move(" "+s),m+=p.move(r.safe(e.title,{before:m,after:s,...p.current()})),m+=p.move(s),d()),m+=p.move(")"),u(),m}function Wk(){return"!"}Pm.peek=Vk;function Pm(e,i,r,l){const s=e.referenceType,c=r.enter("imageReference");let u=r.enter("label");const d=r.createTracker(l);let p=d.move("![");const m=r.safe(e.alt,{before:p,after:"]",...d.current()});p+=d.move(m+"]["),u();const g=r.stack;r.stack=[],u=r.enter("reference");const y=r.safe(r.associationId(e),{before:p,after:"]",...d.current()});return u(),r.stack=g,c(),s==="full"||!m||m!==y?p+=d.move(y+"]"):s==="shortcut"?p=p.slice(0,-1):p+=d.move("]"),p}function Vk(){return"!"}zm.peek=qk;function zm(e,i,r){let l=e.value||"",s="`",c=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(l);)s+="`";for(/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^`|`$/.test(l))&&(l=" "+l+" ");++c<r.unsafe.length;){const u=r.unsafe[c],d=r.compilePattern(u);let p;if(u.atBreak)for(;p=d.exec(l);){let m=p.index;l.charCodeAt(m)===10&&l.charCodeAt(m-1)===13&&m--,l=l.slice(0,m)+" "+l.slice(p.index+1)}}return s+l+s}function qk(){return"`"}function Fm(e,i){const r=Gu(e);return!!(!i.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Bm.peek=Yk;function Bm(e,i,r,l){const s=Ju(r),c=s==='"'?"Quote":"Apostrophe",u=r.createTracker(l);let d,p;if(Fm(e,r)){const g=r.stack;r.stack=[],d=r.enter("autolink");let y=u.move("<");return y+=u.move(r.containerPhrasing(e,{before:y,after:">",...u.current()})),y+=u.move(">"),d(),r.stack=g,y}d=r.enter("link"),p=r.enter("label");let m=u.move("[");return m+=u.move(r.containerPhrasing(e,{before:m,after:"](",...u.current()})),m+=u.move("]("),p(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(p=r.enter("destinationLiteral"),m+=u.move("<"),m+=u.move(r.safe(e.url,{before:m,after:">",...u.current()})),m+=u.move(">")):(p=r.enter("destinationRaw"),m+=u.move(r.safe(e.url,{before:m,after:e.title?" ":")",...u.current()}))),p(),e.title&&(p=r.enter(`title${c}`),m+=u.move(" "+s),m+=u.move(r.safe(e.title,{before:m,after:s,...u.current()})),m+=u.move(s),p()),m+=u.move(")"),d(),m}function Yk(e,i,r){return Fm(e,r)?"<":"["}Um.peek=Qk;function Um(e,i,r,l){const s=e.referenceType,c=r.enter("linkReference");let u=r.enter("label");const d=r.createTracker(l);let p=d.move("[");const m=r.containerPhrasing(e,{before:p,after:"]",...d.current()});p+=d.move(m+"]["),u();const g=r.stack;r.stack=[],u=r.enter("reference");const y=r.safe(r.associationId(e),{before:p,after:"]",...d.current()});return u(),r.stack=g,c(),s==="full"||!m||m!==y?p+=d.move(y+"]"):s==="shortcut"?p=p.slice(0,-1):p+=d.move("]"),p}function Qk(){return"["}function ec(e){const i=e.options.bullet||"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bullet`, expected `*`, `+`, or `-`");return i}function Zk(e){const i=ec(e),r=e.options.bulletOther;if(!r)return i==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===i)throw new Error("Expected `bullet` (`"+i+"`) and `bulletOther` (`"+r+"`) to be different");return r}function Xk(e){const i=e.options.bulletOrdered||".";if(i!=="."&&i!==")")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOrdered`, expected `.` or `)`");return i}function $m(e){const i=e.options.rule||"*";if(i!=="*"&&i!=="-"&&i!=="_")throw new Error("Cannot serialize rules with `"+i+"` for `options.rule`, expected `*`, `-`, or `_`");return i}function Jk(e,i,r,l){const s=r.enter("list"),c=r.bulletCurrent;let u=e.ordered?Xk(r):ec(r);const d=e.ordered?u==="."?")":".":Zk(r);let p=i&&r.bulletLastUsed?u===r.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&g&&(!g.children||!g.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(p=!0),$m(r)===u&&g){let y=-1;for(;++y<e.children.length;){const E=e.children[y];if(E&&E.type==="listItem"&&E.children&&E.children[0]&&E.children[0].type==="thematicBreak"){p=!0;break}}}}p&&(u=d),r.bulletCurrent=u;const m=r.containerFlow(e,l);return r.bulletLastUsed=u,r.bulletCurrent=c,s(),m}function ew(e){const i=e.options.listItemIndent||"one";if(i!=="tab"&&i!=="one"&&i!=="mixed")throw new Error("Cannot serialize items with `"+i+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return i}function tw(e,i,r,l){const s=ew(r);let c=r.bulletCurrent||ec(r);i&&i.type==="list"&&i.ordered&&(c=(typeof i.start=="number"&&i.start>-1?i.start:1)+(r.options.incrementListMarker===!1?0:i.children.indexOf(e))+c);let u=c.length+1;(s==="tab"||s==="mixed"&&(i&&i.type==="list"&&i.spread||e.spread))&&(u=Math.ceil(u/4)*4);const d=r.createTracker(l);d.move(c+" ".repeat(u-c.length)),d.shift(u);const p=r.enter("listItem"),m=r.indentLines(r.containerFlow(e,d.current()),g);return p(),m;function g(y,E,b){return E?(b?"":" ".repeat(u))+y:(b?c:c+" ".repeat(u-c.length))+y}}function nw(e,i,r,l){const s=r.enter("paragraph"),c=r.enter("phrasing"),u=r.containerPhrasing(e,l);return c(),s(),u}const rw=Po(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function iw(e,i,r,l){return(e.children.some(function(u){return rw(u)})?r.containerPhrasing:r.containerFlow).call(r,e,l)}function ow(e){const i=e.options.strong||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize strong with `"+i+"` for `options.strong`, expected `*`, or `_`");return i}jm.peek=lw;function jm(e,i,r,l){const s=ow(r),c=r.enter("strong"),u=r.createTracker(l),d=u.move(s+s);let p=u.move(r.containerPhrasing(e,{after:s,before:d,...u.current()}));const m=p.charCodeAt(0),g=la(l.before.charCodeAt(l.before.length-1),m,s);g.inside&&(p=Io(m)+p.slice(1));const y=p.charCodeAt(p.length-1),E=la(l.after.charCodeAt(0),y,s);E.inside&&(p=p.slice(0,-1)+Io(y));const b=u.move(s+s);return c(),r.attentionEncodeSurroundingInfo={after:E.outside,before:g.outside},d+p+b}function lw(e,i,r){return r.options.strong||"*"}function aw(e,i,r,l){return r.safe(e.value,l)}function sw(e){const i=e.options.ruleRepetition||3;if(i<3)throw new Error("Cannot serialize rules with repetition `"+i+"` for `options.ruleRepetition`, expected `3` or more");return i}function uw(e,i,r){const l=($m(r)+(r.options.ruleSpaces?" ":"")).repeat(sw(r));return r.options.ruleSpaces?l.slice(0,-1):l}const Hm={blockquote:Ik,break:gp,code:Fk,definition:Uk,emphasis:Mm,hardBreak:gp,heading:Kk,html:Lm,image:Dm,imageReference:Pm,inlineCode:zm,link:Bm,linkReference:Um,list:Jk,listItem:tw,paragraph:nw,root:iw,strong:jm,text:aw,thematicBreak:uw};function cw(){return{enter:{table:dw,tableData:yp,tableHeader:yp,tableRow:pw},exit:{codeText:mw,table:fw,tableData:gu,tableHeader:gu,tableRow:gu}}}function dw(e){const i=e._align;this.enter({type:"table",align:i.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function fw(e){this.exit(e),this.data.inTable=void 0}function pw(e){this.enter({type:"tableRow",children:[]},e)}function gu(e){this.exit(e)}function yp(e){this.enter({type:"tableCell",children:[]},e)}function mw(e){let i=this.resume();this.data.inTable&&(i=i.replace(/\\([\\|])/g,hw));const r=this.stack[this.stack.length-1];r.type,r.value=i,this.exit(e)}function hw(e,i){return i==="|"?i:e}function gw(e){const i=e||{},r=i.tableCellPadding,l=i.tablePipeAlign,s=i.stringLength,c=r?" ":"|";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:E,table:u,tableCell:p,tableRow:d}};function u(b,x,C,T){return m(g(b,C,T),b.align)}function d(b,x,C,T){const w=y(b,C,T),F=m([w]);return F.slice(0,F.indexOf(` +`))}function p(b,x,C,T){const w=C.enter("tableCell"),F=C.enter("phrasing"),L=C.containerPhrasing(b,{...T,before:c,after:c});return F(),w(),L}function m(b,x){return Rk(b,{align:x,alignDelimiters:l,padding:r,stringLength:s})}function g(b,x,C){const T=b.children;let w=-1;const F=[],L=x.enter("table");for(;++w<T.length;)F[w]=y(T[w],x,C);return L(),F}function y(b,x,C){const T=b.children;let w=-1;const F=[],L=x.enter("tableRow");for(;++w<T.length;)F[w]=p(T[w],b,x,C);return L(),F}function E(b,x,C){let T=Hm.inlineCode(b,x,C);return C.stack.includes("tableCell")&&(T=T.replace(/\|/g,"\\$&")),T}}function yw(){return{exit:{taskListCheckValueChecked:bp,taskListCheckValueUnchecked:bp,paragraph:Ew}}}function bw(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:_w}}}function bp(e){const i=this.stack[this.stack.length-2];i.type,i.checked=e.type==="taskListCheckValueChecked"}function Ew(e){const i=this.stack[this.stack.length-2];if(i&&i.type==="listItem"&&typeof i.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const l=r.children[0];if(l&&l.type==="text"){const s=i.children;let c=-1,u;for(;++c<s.length;){const d=s[c];if(d.type==="paragraph"){u=d;break}}u===r&&(l.value=l.value.slice(1),l.value.length===0?r.children.shift():r.position&&l.position&&typeof l.position.start.offset=="number"&&(l.position.start.column++,l.position.start.offset++,r.position.start=Object.assign({},l.position.start)))}}this.exit(e)}function _w(e,i,r,l){const s=e.children[0],c=typeof e.checked=="boolean"&&s&&s.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",d=r.createTracker(l);c&&d.move(u);let p=Hm.listItem(e,i,r,{...l,...d.current()});return c&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),p;function m(g){return g+u}}function vw(){return[Jv(),_k(),xk(),cw(),yw()]}function kw(e){return{extensions:[ek(),vk(e),Sk(),gw(e),bw()]}}const ww={tokenize:Aw,partial:!0},Km={tokenize:Rw,partial:!0},Gm={tokenize:Ow,partial:!0},Wm={tokenize:Iw,partial:!0},xw={tokenize:Mw,partial:!0},Vm={name:"wwwAutolink",tokenize:Cw,previous:Ym},qm={name:"protocolAutolink",tokenize:Tw,previous:Qm},lr={name:"emailAutolink",tokenize:Nw,previous:Zm},Gn={};function Sw(){return{text:Gn}}let Xr=48;for(;Xr<123;)Gn[Xr]=lr,Xr++,Xr===58?Xr=65:Xr===91&&(Xr=97);Gn[43]=lr;Gn[45]=lr;Gn[46]=lr;Gn[95]=lr;Gn[72]=[lr,qm];Gn[104]=[lr,qm];Gn[87]=[lr,Vm];Gn[119]=[lr,Vm];function Nw(e,i,r){const l=this;let s,c;return u;function u(y){return!Mu(y)||!Zm.call(l,l.previous)||tc(l.events)?r(y):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(y))}function d(y){return Mu(y)?(e.consume(y),d):y===64?(e.consume(y),p):r(y)}function p(y){return y===46?e.check(xw,g,m)(y):y===45||y===95||Dt(y)?(c=!0,e.consume(y),p):g(y)}function m(y){return e.consume(y),s=!0,p}function g(y){return c&&s&&Ht(l.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),i(y)):r(y)}}function Cw(e,i,r){const l=this;return s;function s(u){return u!==87&&u!==119||!Ym.call(l,l.previous)||tc(l.events)?r(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(ww,e.attempt(Km,e.attempt(Gm,c),r),r)(u))}function c(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),i(u)}}function Tw(e,i,r){const l=this;let s="",c=!1;return u;function u(y){return(y===72||y===104)&&Qm.call(l,l.previous)&&!tc(l.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(y),e.consume(y),d):r(y)}function d(y){if(Ht(y)&&s.length<5)return s+=String.fromCodePoint(y),e.consume(y),d;if(y===58){const E=s.toLowerCase();if(E==="http"||E==="https")return e.consume(y),p}return r(y)}function p(y){return y===47?(e.consume(y),c?m:(c=!0,p)):r(y)}function m(y){return y===null||ra(y)||et(y)||ni(y)||ca(y)?r(y):e.attempt(Km,e.attempt(Gm,g),r)(y)}function g(y){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),i(y)}}function Aw(e,i,r){let l=0;return s;function s(u){return(u===87||u===119)&&l<3?(l++,e.consume(u),s):u===46&&l===3?(e.consume(u),c):r(u)}function c(u){return u===null?r(u):i(u)}}function Rw(e,i,r){let l,s,c;return u;function u(m){return m===46||m===95?e.check(Wm,p,d)(m):m===null||et(m)||ni(m)||m!==45&&ca(m)?p(m):(c=!0,e.consume(m),u)}function d(m){return m===95?l=!0:(s=l,l=void 0),e.consume(m),u}function p(m){return s||l||!c?r(m):i(m)}}function Ow(e,i){let r=0,l=0;return s;function s(u){return u===40?(r++,e.consume(u),s):u===41&&l<r?c(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(Wm,i,c)(u):u===null||et(u)||ni(u)?i(u):(e.consume(u),s)}function c(u){return u===41&&l++,e.consume(u),s}}function Iw(e,i,r){return l;function l(d){return d===33||d===34||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===63||d===95||d===126?(e.consume(d),l):d===38?(e.consume(d),c):d===93?(e.consume(d),s):d===60||d===null||et(d)||ni(d)?i(d):r(d)}function s(d){return d===null||d===40||d===91||et(d)||ni(d)?i(d):l(d)}function c(d){return Ht(d)?u(d):r(d)}function u(d){return d===59?(e.consume(d),l):Ht(d)?(e.consume(d),u):r(d)}}function Mw(e,i,r){return l;function l(c){return e.consume(c),s}function s(c){return Dt(c)?r(c):i(c)}}function Ym(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||et(e)}function Qm(e){return!Ht(e)}function Zm(e){return!(e===47||Mu(e))}function Mu(e){return e===43||e===45||e===46||e===95||Dt(e)}function tc(e){let i=e.length,r=!1;for(;i--;){const l=e[i][1];if((l.type==="labelLink"||l.type==="labelImage")&&!l._balanced){r=!0;break}if(l._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const Lw={tokenize:jw,partial:!0};function Dw(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Bw,continuation:{tokenize:Uw},exit:$w}},text:{91:{name:"gfmFootnoteCall",tokenize:Fw},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Pw,resolveTo:zw}}}}function Pw(e,i,r){const l=this;let s=l.events.length;const c=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u;for(;s--;){const p=l.events[s][1];if(p.type==="labelImage"){u=p;break}if(p.type==="gfmFootnoteCall"||p.type==="labelLink"||p.type==="label"||p.type==="image"||p.type==="link")break}return d;function d(p){if(!u||!u._balanced)return r(p);const m=On(l.sliceSerialize({start:u.end,end:l.now()}));return m.codePointAt(0)!==94||!c.includes(m.slice(1))?r(p):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),i(p))}}function zw(e,i){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const l={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},d=[e[r+1],e[r+2],["enter",l,i],e[r+3],e[r+4],["enter",s,i],["exit",s,i],["enter",c,i],["enter",u,i],["exit",u,i],["exit",c,i],e[e.length-2],e[e.length-1],["exit",l,i]];return e.splice(r,e.length-r+1,...d),e}function Fw(e,i,r){const l=this,s=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let c=0,u;return d;function d(y){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),p}function p(y){return y!==94?r(y):(e.enter("gfmFootnoteCallMarker"),e.consume(y),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(y){if(c>999||y===93&&!u||y===null||y===91||et(y))return r(y);if(y===93){e.exit("chunkString");const E=e.exit("gfmFootnoteCallString");return s.includes(On(l.sliceSerialize(E)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),i):r(y)}return et(y)||(u=!0),c++,e.consume(y),y===92?g:m}function g(y){return y===91||y===92||y===93?(e.consume(y),c++,m):m(y)}}function Bw(e,i,r){const l=this,s=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let c,u=0,d;return p;function p(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):r(x)}function g(x){if(u>999||x===93&&!d||x===null||x===91||et(x))return r(x);if(x===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return c=On(l.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),E}return et(x)||(d=!0),u++,e.consume(x),x===92?y:g}function y(x){return x===91||x===92||x===93?(e.consume(x),u++,g):g(x)}function E(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),s.includes(c)||s.push(c),We(e,b,"gfmFootnoteDefinitionWhitespace")):r(x)}function b(x){return i(x)}}function Uw(e,i,r){return e.check(Do,i,e.attempt(Lw,i,r))}function $w(e){e.exit("gfmFootnoteDefinition")}function jw(e,i,r){const l=this;return We(e,s,"gfmFootnoteDefinitionIndent",5);function s(c){const u=l.events[l.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?i(c):r(c)}}function Hw(e){let r=(e||{}).singleTilde;const l={name:"strikethrough",tokenize:c,resolveAll:s};return r==null&&(r=!0),{text:{126:l},insideSpan:{null:[l]},attentionMarkers:{null:[126]}};function s(u,d){let p=-1;for(;++p<u.length;)if(u[p][0]==="enter"&&u[p][1].type==="strikethroughSequenceTemporary"&&u[p][1]._close){let m=p;for(;m--;)if(u[m][0]==="exit"&&u[m][1].type==="strikethroughSequenceTemporary"&&u[m][1]._open&&u[p][1].end.offset-u[p][1].start.offset===u[m][1].end.offset-u[m][1].start.offset){u[p][1].type="strikethroughSequence",u[m][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},u[m][1].start),end:Object.assign({},u[p][1].end)},y={type:"strikethroughText",start:Object.assign({},u[m][1].end),end:Object.assign({},u[p][1].start)},E=[["enter",g,d],["enter",u[m][1],d],["exit",u[m][1],d],["enter",y,d]],b=d.parser.constructs.insideSpan.null;b&&sn(E,E.length,0,da(b,u.slice(m+1,p),d)),sn(E,E.length,0,[["exit",y,d],["enter",u[p][1],d],["exit",u[p][1],d],["exit",g,d]]),sn(u,m-1,p-m+3,E),p=m+E.length-2;break}}for(p=-1;++p<u.length;)u[p][1].type==="strikethroughSequenceTemporary"&&(u[p][1].type="data");return u}function c(u,d,p){const m=this.previous,g=this.events;let y=0;return E;function E(x){return m===126&&g[g.length-1][1].type!=="characterEscape"?p(x):(u.enter("strikethroughSequenceTemporary"),b(x))}function b(x){const C=zi(m);if(x===126)return y>1?p(x):(u.consume(x),y++,b);if(y<2&&!r)return p(x);const T=u.exit("strikethroughSequenceTemporary"),w=zi(x);return T._open=!w||w===2&&!!C,T._close=!C||C===2&&!!w,d(x)}}}class Kw{constructor(){this.map=[]}add(i,r,l){Gw(this,i,r,l)}consume(i){if(this.map.sort(function(c,u){return c[0]-u[0]}),this.map.length===0)return;let r=this.map.length;const l=[];for(;r>0;)r-=1,l.push(i.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),i.length=this.map[r][0];l.push(i.slice()),i.length=0;let s=l.pop();for(;s;){for(const c of s)i.push(c);s=l.pop()}this.map.length=0}}function Gw(e,i,r,l){let s=0;if(!(r===0&&l.length===0)){for(;s<e.map.length;){if(e.map[s][0]===i){e.map[s][1]+=r,e.map[s][2].push(...l);return}s+=1}e.map.push([i,r,l])}}function Ww(e,i){let r=!1;const l=[];for(;i<e.length;){const s=e[i];if(r){if(s[0]==="enter")s[1].type==="tableContent"&&l.push(e[i+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[i-1][1].type==="tableDelimiterMarker"){const c=l.length-1;l[c]=l[c]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(r=!0);i+=1}return l}function Vw(){return{flow:{null:{name:"table",tokenize:qw,resolveAll:Yw}}}}function qw(e,i,r){const l=this;let s=0,c=0,u;return d;function d(D){let ne=l.events.length-1;for(;ne>-1;){const q=l.events[ne][1].type;if(q==="lineEnding"||q==="linePrefix")ne--;else break}const X=ne>-1?l.events[ne][1].type:null,fe=X==="tableHead"||X==="tableRow"?I:p;return fe===I&&l.parser.lazy[l.now().line]?r(D):fe(D)}function p(D){return e.enter("tableHead"),e.enter("tableRow"),m(D)}function m(D){return D===124||(u=!0,c+=1),g(D)}function g(D){return D===null?r(D):Ce(D)?c>1?(c=0,l.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),b):r(D):Ue(D)?We(e,g,"whitespace")(D):(c+=1,u&&(u=!1,s+=1),D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),u=!0,g):(e.enter("data"),y(D)))}function y(D){return D===null||D===124||et(D)?(e.exit("data"),g(D)):(e.consume(D),D===92?E:y)}function E(D){return D===92||D===124?(e.consume(D),y):y(D)}function b(D){return l.interrupt=!1,l.parser.lazy[l.now().line]?r(D):(e.enter("tableDelimiterRow"),u=!1,Ue(D)?We(e,x,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):x(D))}function x(D){return D===45||D===58?T(D):D===124?(u=!0,e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),C):K(D)}function C(D){return Ue(D)?We(e,T,"whitespace")(D):T(D)}function T(D){return D===58?(c+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),w):D===45?(c+=1,w(D)):D===null||Ce(D)?$(D):K(D)}function w(D){return D===45?(e.enter("tableDelimiterFiller"),F(D)):K(D)}function F(D){return D===45?(e.consume(D),F):D===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),L):(e.exit("tableDelimiterFiller"),L(D))}function L(D){return Ue(D)?We(e,$,"whitespace")(D):$(D)}function $(D){return D===124?x(D):D===null||Ce(D)?!u||s!==c?K(D):(e.exit("tableDelimiterRow"),e.exit("tableHead"),i(D)):K(D)}function K(D){return r(D)}function I(D){return e.enter("tableRow"),Z(D)}function Z(D){return D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),Z):D===null||Ce(D)?(e.exit("tableRow"),i(D)):Ue(D)?We(e,Z,"whitespace")(D):(e.enter("data"),G(D))}function G(D){return D===null||D===124||et(D)?(e.exit("data"),Z(D)):(e.consume(D),D===92?te:G)}function te(D){return D===92||D===124?(e.consume(D),G):G(D)}}function Yw(e,i){let r=-1,l=!0,s=0,c=[0,0,0,0],u=[0,0,0,0],d=!1,p=0,m,g,y;const E=new Kw;for(;++r<e.length;){const b=e[r],x=b[1];b[0]==="enter"?x.type==="tableHead"?(d=!1,p!==0&&(Ep(E,i,p,m,g),g=void 0,p=0),m={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},E.add(r,0,[["enter",m,i]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(l=!0,y=void 0,c=[0,0,0,0],u=[0,r+1,0,0],d&&(d=!1,g={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},E.add(r,0,[["enter",g,i]])),s=x.type==="tableDelimiterRow"?2:g?3:1):s&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(l=!1,u[2]===0&&(c[1]!==0&&(u[0]=u[1],y=Ql(E,i,c,s,void 0,y),c=[0,0,0,0]),u[2]=r)):x.type==="tableCellDivider"&&(l?l=!1:(c[1]!==0&&(u[0]=u[1],y=Ql(E,i,c,s,void 0,y)),c=u,u=[c[1],r,0,0])):x.type==="tableHead"?(d=!0,p=r):x.type==="tableRow"||x.type==="tableDelimiterRow"?(p=r,c[1]!==0?(u[0]=u[1],y=Ql(E,i,c,s,r,y)):u[1]!==0&&(y=Ql(E,i,u,s,r,y)),s=0):s&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(u[3]=r)}for(p!==0&&Ep(E,i,p,m,g),E.consume(i.events),r=-1;++r<i.events.length;){const b=i.events[r];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=Ww(i.events,r))}return e}function Ql(e,i,r,l,s,c){const u=l===1?"tableHeader":l===2?"tableDelimiter":"tableData",d="tableContent";r[0]!==0&&(c.end=Object.assign({},Mi(i.events,r[0])),e.add(r[0],0,[["exit",c,i]]));const p=Mi(i.events,r[1]);if(c={type:u,start:Object.assign({},p),end:Object.assign({},p)},e.add(r[1],0,[["enter",c,i]]),r[2]!==0){const m=Mi(i.events,r[2]),g=Mi(i.events,r[3]),y={type:d,start:Object.assign({},m),end:Object.assign({},g)};if(e.add(r[2],0,[["enter",y,i]]),l!==2){const E=i.events[r[2]],b=i.events[r[3]];if(E[1].end=Object.assign({},b[1].end),E[1].type="chunkText",E[1].contentType="text",r[3]>r[2]+1){const x=r[2]+1,C=r[3]-r[2]-1;e.add(x,C,[])}}e.add(r[3]+1,0,[["exit",y,i]])}return s!==void 0&&(c.end=Object.assign({},Mi(i.events,s)),e.add(s,0,[["exit",c,i]]),c=void 0),c}function Ep(e,i,r,l,s){const c=[],u=Mi(i.events,r);s&&(s.end=Object.assign({},u),c.push(["exit",s,i])),l.end=Object.assign({},u),c.push(["exit",l,i]),e.add(r+1,0,c)}function Mi(e,i){const r=e[i],l=r[0]==="enter"?"start":"end";return r[1][l]}const Qw={name:"tasklistCheck",tokenize:Xw};function Zw(){return{text:{91:Qw}}}function Xw(e,i,r){const l=this;return s;function s(p){return l.previous!==null||!l._gfmTasklistFirstContentOfListItem?r(p):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),c)}function c(p){return et(p)?(e.enter("taskListCheckValueUnchecked"),e.consume(p),e.exit("taskListCheckValueUnchecked"),u):p===88||p===120?(e.enter("taskListCheckValueChecked"),e.consume(p),e.exit("taskListCheckValueChecked"),u):r(p)}function u(p){return p===93?(e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),d):r(p)}function d(p){return Ce(p)?i(p):Ue(p)?e.check({tokenize:Jw},i,r)(p):r(p)}}function Jw(e,i,r){return We(e,l,"whitespace");function l(s){return s===null?r(s):i(s)}}function ex(e){return sm([Sw(),Dw(),Hw(e),Vw(),Zw()])}const tx={};function nx(e){const i=this,r=e||tx,l=i.data(),s=l.micromarkExtensions||(l.micromarkExtensions=[]),c=l.fromMarkdownExtensions||(l.fromMarkdownExtensions=[]),u=l.toMarkdownExtensions||(l.toMarkdownExtensions=[]);s.push(ex(r)),c.push(vw()),u.push(kw(r))}const _p=(function(e,i,r){const l=Po(r);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof i=="number"){if(i<0||i===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(i=e.children.indexOf(i),i<0)throw new Error("Expected child node or index");for(;++i<e.children.length;)if(l(e.children[i],i,e))return e.children[i]}),ii=(function(e){if(e==null)return ox;if(typeof e=="string")return ix(e);if(typeof e=="object")return rx(e);if(typeof e=="function")return nc(e);throw new Error("Expected function, string, or array as `test`")});function rx(e){const i=[];let r=-1;for(;++r<e.length;)i[r]=ii(e[r]);return nc(l);function l(...s){let c=-1;for(;++c<i.length;)if(i[c].apply(this,s))return!0;return!1}}function ix(e){return nc(i);function i(r){return r.tagName===e}}function nc(e){return i;function i(r,l,s){return!!(lx(r)&&e.call(this,r,typeof l=="number"?l:void 0,s||void 0))}}function ox(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function lx(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const vp=/\n/g,kp=/[\t ]+/g,Lu=ii("br"),wp=ii(mx),ax=ii("p"),xp=ii("tr"),sx=ii(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",px,hx]),Xm=ii(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function ux(e,i){const r=i||{},l="children"in e?e.children:[],s=Xm(e),c=th(e,{whitespace:r.whitespace||"normal"}),u=[];(e.type==="text"||e.type==="comment")&&u.push(...eh(e,{breakBefore:!0,breakAfter:!0}));let d=-1;for(;++d<l.length;)u.push(...Jm(l[d],e,{whitespace:c,breakBefore:d?void 0:s,breakAfter:d<l.length-1?Lu(l[d+1]):s}));const p=[];let m;for(d=-1;++d<u.length;){const g=u[d];typeof g=="number"?m!==void 0&&g>m&&(m=g):g&&(m!==void 0&&m>-1&&p.push(` +`.repeat(m)||" "),m=-1,p.push(g))}return p.join("")}function Jm(e,i,r){return e.type==="element"?cx(e,i,r):e.type==="text"?r.whitespace==="normal"?eh(e,r):dx(e):[]}function cx(e,i,r){const l=th(e,r),s=e.children||[];let c=-1,u=[];if(sx(e))return u;let d,p;for(Lu(e)||xp(e)&&_p(i,e,xp)?p=` +`:ax(e)?(d=2,p=2):Xm(e)&&(d=1,p=1);++c<s.length;)u=u.concat(Jm(s[c],e,{whitespace:l,breakBefore:c?void 0:d,breakAfter:c<s.length-1?Lu(s[c+1]):p}));return wp(e)&&_p(i,e,wp)&&u.push(" "),d&&u.unshift(d),p&&u.push(p),u}function eh(e,i){const r=String(e.value),l=[],s=[];let c=0;for(;c<=r.length;){vp.lastIndex=c;const p=vp.exec(r),m=p&&"index"in p?p.index:r.length;l.push(fx(r.slice(c,m).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),c===0?i.breakBefore:!0,m===r.length?i.breakAfter:!0)),c=m+1}let u=-1,d;for(;++u<l.length;)l[u].charCodeAt(l[u].length-1)===8203||u<l.length-1&&l[u+1].charCodeAt(0)===8203?(s.push(l[u]),d=void 0):l[u]?(typeof d=="number"&&s.push(d),s.push(l[u]),d=0):(u===0||u===l.length-1)&&s.push(0);return s}function dx(e){return[String(e.value)]}function fx(e,i,r){const l=[];let s=0,c;for(;s<e.length;){kp.lastIndex=s;const u=kp.exec(e);c=u?u.index:e.length,!s&&!c&&u&&!i&&l.push(""),s!==c&&l.push(e.slice(s,c)),s=u?c+u[0].length:c}return s!==c&&!r&&l.push(""),l.join(" ")}function th(e,i){if(e.type==="element"){const r=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return r.wrap?"pre-wrap":"pre";case"td":case"th":return r.noWrap?"nowrap":i.whitespace;case"textarea":return"pre-wrap"}}return i.whitespace}function px(e){return!!(e.properties||{}).hidden}function mx(e){return e.tagName==="td"||e.tagName==="th"}function hx(e){return e.tagName==="dialog"&&!(e.properties||{}).open}function gx(e){const i=e.regex,r=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),l="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",u="(?!struct)("+l+"|"+i.optional(s)+"[a-zA-Z_]\\w*"+i.optional("<[^<>]+>")+")",d={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},m={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},g={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},y={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(m,{className:"string"}),{className:"string",begin:/<.*?>/},r,e.C_BLOCK_COMMENT_MODE]},E={className:"title",begin:i.optional(s)+e.IDENT_RE,relevance:0},b=i.optional(s)+e.IDENT_RE+"\\s*\\(",x=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],C=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],T=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],w=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],$={type:C,keyword:x,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:T},K={className:"function.dispatch",relevance:0,keywords:{_hint:w},begin:i.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,i.lookahead(/(<[^<>]+>|)\s*\(/))},I=[K,y,d,r,e.C_BLOCK_COMMENT_MODE,g,m],Z={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:$,contains:I.concat([{begin:/\(/,end:/\)/,keywords:$,contains:I.concat(["self"]),relevance:0}]),relevance:0},G={className:"function",begin:"("+u+"[\\*&\\s]+)+"+b,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:$,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:l,keywords:$,relevance:0},{begin:b,returnBegin:!0,contains:[E],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[m,g]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:$,relevance:0,contains:[r,e.C_BLOCK_COMMENT_MODE,m,g,d,{begin:/\(/,end:/\)/,keywords:$,relevance:0,contains:["self",r,e.C_BLOCK_COMMENT_MODE,m,g,d]}]},d,r,e.C_BLOCK_COMMENT_MODE,y]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:$,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(Z,G,K,I,[y,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:$,contains:["self",d]},{begin:e.IDENT_RE+"::",keywords:$},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function yx(e){const i={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},r=gx(e),l=r.keywords;return l.type=[...l.type,...i.type],l.literal=[...l.literal,...i.literal],l.built_in=[...l.built_in,...i.built_in],l._hints=i._hints,r.name="Arduino",r.aliases=["ino"],r.supersetOf="cpp",r}function bx(e){const i=e.regex,r={},l={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[r]}]};Object.assign(r,{className:"variable",variants:[{begin:i.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},l]});const s={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},c=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),u={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},d={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,r,s]};s.contains.push(d);const p={match:/\\"/},m={className:"string",begin:/'/,end:/'/},g={match:/\\'/},y={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,r]},E=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],b=e.SHEBANG({binary:`(${E.join("|")})`,relevance:10}),x={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},C=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],T=["true","false"],w={match:/(\/[a-z._-]+)+/},F=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],L=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],$=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],K=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:C,literal:T,built_in:[...F,...L,"set","shopt",...$,...K]},contains:[b,e.SHEBANG(),x,y,c,u,w,d,p,m,g,r]}}function Ex(e){const i=e.regex,r=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),l="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",u="("+l+"|"+i.optional(s)+"[a-zA-Z_]\\w*"+i.optional("<[^<>]+>")+")",d={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},m={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},g={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},y={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(m,{className:"string"}),{className:"string",begin:/<.*?>/},r,e.C_BLOCK_COMMENT_MODE]},E={className:"title",begin:i.optional(s)+e.IDENT_RE,relevance:0},b=i.optional(s)+e.IDENT_RE+"\\s*\\(",T={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},w=[y,d,r,e.C_BLOCK_COMMENT_MODE,g,m],F={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:T,contains:w.concat([{begin:/\(/,end:/\)/,keywords:T,contains:w.concat(["self"]),relevance:0}]),relevance:0},L={begin:"("+u+"[\\*&\\s]+)+"+b,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:T,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:l,keywords:T,relevance:0},{begin:b,returnBegin:!0,contains:[e.inherit(E,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:[r,e.C_BLOCK_COMMENT_MODE,m,g,d,{begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:["self",r,e.C_BLOCK_COMMENT_MODE,m,g,d]}]},d,r,e.C_BLOCK_COMMENT_MODE,y]};return{name:"C",aliases:["h"],keywords:T,disableAutodetect:!0,illegal:"</",contains:[].concat(F,L,w,[y,{begin:e.IDENT_RE+"::",keywords:T},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:y,strings:m,keywords:T}}}function _x(e){const i=e.regex,r=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),l="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",u="(?!struct)("+l+"|"+i.optional(s)+"[a-zA-Z_]\\w*"+i.optional("<[^<>]+>")+")",d={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},m={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},g={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},y={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(m,{className:"string"}),{className:"string",begin:/<.*?>/},r,e.C_BLOCK_COMMENT_MODE]},E={className:"title",begin:i.optional(s)+e.IDENT_RE,relevance:0},b=i.optional(s)+e.IDENT_RE+"\\s*\\(",x=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],C=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],T=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],w=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],$={type:C,keyword:x,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:T},K={className:"function.dispatch",relevance:0,keywords:{_hint:w},begin:i.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,i.lookahead(/(<[^<>]+>|)\s*\(/))},I=[K,y,d,r,e.C_BLOCK_COMMENT_MODE,g,m],Z={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:$,contains:I.concat([{begin:/\(/,end:/\)/,keywords:$,contains:I.concat(["self"]),relevance:0}]),relevance:0},G={className:"function",begin:"("+u+"[\\*&\\s]+)+"+b,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:$,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:l,keywords:$,relevance:0},{begin:b,returnBegin:!0,contains:[E],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[m,g]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:$,relevance:0,contains:[r,e.C_BLOCK_COMMENT_MODE,m,g,d,{begin:/\(/,end:/\)/,keywords:$,relevance:0,contains:["self",r,e.C_BLOCK_COMMENT_MODE,m,g,d]}]},d,r,e.C_BLOCK_COMMENT_MODE,y]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:$,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(Z,G,K,I,[y,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:$,contains:["self",d]},{begin:e.IDENT_RE+"::",keywords:$},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function vx(e){const i=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],r=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],l=["default","false","null","true"],s=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],c=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],u={keyword:s.concat(c),built_in:i,literal:l},d=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),p={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},m={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},g={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},y=e.inherit(g,{illegal:/\n/}),E={className:"subst",begin:/\{/,end:/\}/,keywords:u},b=e.inherit(E,{illegal:/\n/}),x={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,b]},C={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},E]},T=e.inherit(C,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},b]});E.contains=[C,x,g,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,e.C_BLOCK_COMMENT_MODE],b.contains=[T,x,y,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const w={variants:[m,C,x,g,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},F={begin:"<",end:">",contains:[{beginKeywords:"in out"},d]},L=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",$={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:u,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},w,p,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},d,F,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[d,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[d,F,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+L+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:u,contains:[{beginKeywords:r.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,F],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,relevance:0,contains:[w,p,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},$]}}const kx=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),wx=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],xx=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],Sx=[...wx,...xx],Nx=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Cx=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Tx=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Ax=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function Rx(e){const i=e.regex,r=kx(e),l={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="and or not only",c=/@-?\w[\w]*(-\w+)*/,u="[a-zA-Z-][a-zA-Z0-9_-]*",d=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[r.BLOCK_COMMENT,l,r.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+u,relevance:0},r.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+Cx.join("|")+")"},{begin:":(:)?("+Tx.join("|")+")"}]},r.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Ax.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[r.BLOCK_COMMENT,r.HEXCOLOR,r.IMPORTANT,r.CSS_NUMBER_MODE,...d,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...d,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},r.FUNCTION_DISPATCH]},{begin:i.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:c},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:Nx.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...d,r.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+Sx.join("|")+")\\b"}]}}function Ox(e){const i=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:i.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:i.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function Ix(e){const c={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:c,illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:c,illegal:/["']/}]}]}}function Mx(e){const i=e.regex,r=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:i.concat(r,i.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function Lx(e){const i=e.regex,r={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},l=e.COMMENT();l.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const s={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},c={className:"literal",begin:/\bon|off|true|false|yes|no\b/},u={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},d={begin:/\[/,end:/\]/,contains:[l,c,s,u,r,"self"],relevance:0},p=/[A-Za-z0-9_-]+/,m=/"(\\"|[^"])*"/,g=/'[^']*'/,y=i.either(p,m,g),E=i.concat(y,"(\\s*\\.\\s*",y,")*",i.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[l,{className:"section",begin:/\[+/,end:/\]+/},{begin:E,className:"attr",starts:{end:/$/,contains:[l,d,c,s,u,r]}}]}}var Li="[0-9](_*[0-9])*",Zl=`\\.(${Li})`,Xl="[0-9a-fA-F](_*[0-9a-fA-F])*",Sp={className:"number",variants:[{begin:`(\\b(${Li})((${Zl})|\\.)?|(${Zl}))[eE][+-]?(${Li})[fFdD]?\\b`},{begin:`\\b(${Li})((${Zl})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Zl})[fFdD]?\\b`},{begin:`\\b(${Li})[fFdD]\\b`},{begin:`\\b0[xX]((${Xl})\\.?|(${Xl})?\\.(${Xl}))[pP][+-]?(${Li})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Xl})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function nh(e,i,r){return r===-1?"":e.replace(i,l=>nh(e,i,r-1))}function Dx(e){const i=e.regex,r="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",l=r+nh("(?:<"+r+"~~~(?:\\s*,\\s*"+r+"~~~)*>)?",/~~~/g,2),p={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},m={className:"meta",begin:"@"+r,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},g={className:"params",begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:p,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[i.concat(/(?!else)/,r),/\s+/,r,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,r],className:{1:"keyword",3:"title.class"},contains:[g,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+l+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:p,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:[m,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,Sp,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Sp,m]}}const Np="[A-Za-z$_][0-9A-Za-z$_]*",Px=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],zx=["true","false","null","undefined","NaN","Infinity"],rh=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],ih=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],oh=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Fx=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Bx=[].concat(oh,rh,ih);function Ux(e){const i=e.regex,r=(W,{after:de})=>{const v="</"+W[0].slice(1);return W.input.indexOf(v,de)!==-1},l=Np,s={begin:"<>",end:"</>"},c=/<[A-Za-z0-9\\._:-]+\s*\/>/,u={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(W,de)=>{const v=W[0].length+W.index,O=W.input[v];if(O==="<"||O===","){de.ignoreMatch();return}O===">"&&(r(W,{after:v})||de.ignoreMatch());let j;const S=W.input.substring(v);if(j=S.match(/^\s*=/)){de.ignoreMatch();return}if((j=S.match(/^\s+extends\s+/))&&j.index===0){de.ignoreMatch();return}}},d={$pattern:Np,keyword:Px,literal:zx,built_in:Bx,"variable.language":Fx},p="[0-9](_?[0-9])*",m=`\\.(${p})`,g="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",y={className:"number",variants:[{begin:`(\\b(${g})((${m})|\\.)?|(${m}))[eE][+-]?(${p})\\b`},{begin:`\\b(${g})\\b((${m})\\b|\\.)?|(${m})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},E={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},b={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,E],subLanguage:"xml"}},x={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,E],subLanguage:"css"}},C={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,E],subLanguage:"graphql"}},T={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,E]},F={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:l+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},L=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,b,x,C,T,{match:/\$\d+/},y];E.contains=L.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(L)});const $=[].concat(F,E.contains),K=$.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat($)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:K},Z={variants:[{match:[/class/,/\s+/,l,/\s+/,/extends/,/\s+/,i.concat(l,"(",i.concat(/\./,l),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,l],scope:{1:"keyword",3:"title.class"}}]},G={relevance:0,match:i.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...rh,...ih]}},te={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},D={variants:[{match:[/function/,/\s+/,l,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[I],illegal:/%/},ne={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function X(W){return i.concat("(?!",W.join("|"),")")}const fe={match:i.concat(/\b/,X([...oh,"super","import"].map(W=>`${W}\\s*\\(`)),l,i.lookahead(/\s*\(/)),className:"title.function",relevance:0},q={begin:i.concat(/\./,i.lookahead(i.concat(l,/(?![0-9A-Za-z$_(])/))),end:l,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},P={match:[/get|set/,/\s+/,l,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},le="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",ae={match:[/const|var|let/,/\s+/,l,/\s*/,/=\s*/,/(async\s*)?/,i.lookahead(le)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:K,CLASS_REFERENCE:G},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),te,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,b,x,C,T,F,{match:/\$\d+/},y,G,{scope:"attr",match:l+i.lookahead(":"),relevance:0},ae,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[F,e.REGEXP_MODE,{className:"function",begin:le,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:K}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:c},{begin:u.begin,"on:begin":u.isTrulyOpeningTag,end:u.end}],subLanguage:"xml",contains:[{begin:u.begin,end:u.end,skip:!0,contains:["self"]}]}]},D,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[I,e.inherit(e.TITLE_MODE,{begin:l,className:"title.function"})]},{match:/\.\.\./,relevance:0},q,{match:"\\$"+l,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[I]},fe,ne,Z,P,{match:/\$[(.]/}]}}function $x(e){const i={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},r={match:/[{}[\],:]/,className:"punctuation",relevance:0},l=["true","false","null"],s={scope:"literal",beginKeywords:l.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:l},contains:[i,r,e.QUOTE_STRING_MODE,s,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Di="[0-9](_*[0-9])*",Jl=`\\.(${Di})`,ea="[0-9a-fA-F](_*[0-9a-fA-F])*",jx={className:"number",variants:[{begin:`(\\b(${Di})((${Jl})|\\.)?|(${Jl}))[eE][+-]?(${Di})[fFdD]?\\b`},{begin:`\\b(${Di})((${Jl})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Jl})[fFdD]?\\b`},{begin:`\\b(${Di})[fFdD]\\b`},{begin:`\\b0[xX]((${ea})\\.?|(${ea})?\\.(${ea}))[pP][+-]?(${Di})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${ea})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Hx(e){const i={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},r={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},l={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},s={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},c={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},u={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[c,s]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,c,s]}]};s.contains.push(u);const d={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},p={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(u,{className:"string"}),"self"]}]},m=jx,g=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),y={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},E=y;return E.variants[1].contains=[y],y.variants[1].contains=[E],{name:"Kotlin",aliases:["kt","kts"],keywords:i,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,g,r,l,d,p,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:i,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:i,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[y,e.C_LINE_COMMENT_MODE,g],relevance:0},e.C_LINE_COMMENT_MODE,g,d,p,u,e.C_NUMBER_MODE]},g]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},d,p]},u,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` +`},m]}}const Kx=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Gx=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],Wx=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],Vx=[...Gx,...Wx],qx=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),lh=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),ah=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Yx=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),Qx=lh.concat(ah).sort().reverse();function Zx(e){const i=Kx(e),r=Qx,l="and or not only",s="[\\w-]+",c="("+s+"|@\\{"+s+"\\})",u=[],d=[],p=function(L){return{className:"string",begin:"~?"+L+".*?"+L}},m=function(L,$,K){return{className:L,begin:$,relevance:K}},g={$pattern:/[a-z-]+/,keyword:l,attribute:qx.join(" ")},y={begin:"\\(",end:"\\)",contains:d,keywords:g,relevance:0};d.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p("'"),p('"'),i.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},i.HEXCOLOR,y,m("variable","@@?"+s,10),m("variable","@\\{"+s+"\\}"),m("built_in","~?`[^`]*?`"),{className:"attribute",begin:s+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},i.IMPORTANT,{beginKeywords:"and not"},i.FUNCTION_DISPATCH);const E=d.concat({begin:/\{/,end:/\}/,contains:u}),b={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(d)},x={begin:c+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},i.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Yx.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:d}}]},C={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:g,returnEnd:!0,contains:d,relevance:0}},T={className:"variable",variants:[{begin:"@"+s+"\\s*:",relevance:15},{begin:"@"+s}],starts:{end:"[;}]",returnEnd:!0,contains:E}},w={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:c,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,m("keyword","all\\b"),m("variable","@\\{"+s+"\\}"),{begin:"\\b("+Vx.join("|")+")\\b",className:"selector-tag"},i.CSS_NUMBER_MODE,m("selector-tag",c,0),m("selector-id","#"+c),m("selector-class","\\."+c,0),m("selector-tag","&",0),i.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+lh.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+ah.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:E},{begin:"!important"},i.FUNCTION_DISPATCH]},F={begin:s+`:(:)?(${r.join("|")})`,returnBegin:!0,contains:[w]};return u.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,C,T,F,x,w,b,i.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:u}}function Xx(e){const i="\\[=*\\[",r="\\]=*\\]",l={begin:i,end:r,contains:["self"]},s=[e.COMMENT("--(?!"+i+")","$"),e.COMMENT("--"+i,r,{contains:[l],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:s.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:s}].concat(s)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:i,end:r,contains:[l],relevance:5}])}}function Jx(e){const i={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},r={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,i]},l={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[i,r]},s={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},c={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},u={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[i]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[e.HASH_COMMENT_MODE,i,r,l,s,c,u]}}function e0(e){const i=e.regex,r={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},l={begin:"^[-\\*]{3,}",end:"$"},s={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},c={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},u={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},d=/[A-Za-z][A-Za-z0-9+.-]*/,p={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:i.concat(/\[.+?\]\(/,d,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},m={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},g={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},y=e.inherit(m,{contains:[]}),E=e.inherit(g,{contains:[]});m.contains.push(E),g.contains.push(y);let b=[r,p];return[m,g,y,E].forEach(w=>{w.contains=w.contains.concat(b)}),b=b.concat(m,g),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:b},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:b}]}]},r,c,m,g,{className:"quote",begin:"^>\\s+",contains:b,end:"$"},s,l,p,u,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function t0(e){const i={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},r=/[a-zA-Z@][a-zA-Z0-9_]*/,d={"variable.language":["this","super"],$pattern:r,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},p={$pattern:r,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:d,illegal:"</",contains:[i,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+p.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:p,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function n0(e){const i=e.regex,r=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],l=/[dualxmsipngr]{0,12}/,s={$pattern:/[\w.]+/,keyword:r.join(" ")},c={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:s},u={begin:/->\{/,end:/\}/},d={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},p={scope:"variable",variants:[{begin:/\$\d/},{begin:i.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[d]},m={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},g=[e.BACKSLASH_ESCAPE,c,p],y=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],E=(C,T,w="\\1")=>{const F=w==="\\1"?w:i.concat(w,T);return i.concat(i.concat("(?:",C,")"),T,/(?:\\.|[^\\\/])*?/,F,/(?:\\.|[^\\\/])*?/,w,l)},b=(C,T,w)=>i.concat(i.concat("(?:",C,")"),T,/(?:\\.|[^\\\/])*?/,w,l),x=[p,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),u,{className:"string",contains:g,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},m,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:E("s|tr|y",i.either(...y,{capture:!0}))},{begin:E("s|tr|y","\\(","\\)")},{begin:E("s|tr|y","\\[","\\]")},{begin:E("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:b("(?:m|qr)?",/\//,/\//)},{begin:b("m|qr",i.either(...y,{capture:!0}),/\1/)},{begin:b("m|qr",/\(/,/\)/)},{begin:b("m|qr",/\[/,/\]/)},{begin:b("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,d]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,d,m]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return c.contains=x,u.contains=x,{name:"Perl",aliases:["pl","pm"],keywords:s,contains:x}}function r0(e){const i=e.regex,r=/(?![A-Za-z0-9])(?![$])/,l=i.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,r),s=i.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,r),c=i.concat(/[A-Z]+/,r),u={scope:"variable",match:"\\$+"+l},d={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},p={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},m=e.inherit(e.APOS_STRING_MODE,{illegal:null}),g=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(p)}),y={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(p),"on:begin":(q,P)=>{P.data._beginMatch=q[1]||q[2]},"on:end":(q,P)=>{P.data._beginMatch!==q[1]&&P.ignoreMatch()}},E=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),b=`[ +]`,x={scope:"string",variants:[g,m,y,E]},C={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},T=["false","null","true"],w=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],F=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],$={keyword:w,literal:(q=>{const P=[];return q.forEach(le=>{P.push(le),le.toLowerCase()===le?P.push(le.toUpperCase()):P.push(le.toLowerCase())}),P})(T),built_in:F},K=q=>q.map(P=>P.replace(/\|\d+$/,"")),I={variants:[{match:[/new/,i.concat(b,"+"),i.concat("(?!",K(F).join("\\b|"),"\\b)"),s],scope:{1:"keyword",4:"title.class"}}]},Z=i.concat(l,"\\b(?!\\()"),G={variants:[{match:[i.concat(/::/,i.lookahead(/(?!class\b)/)),Z],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[s,i.concat(/::/,i.lookahead(/(?!class\b)/)),Z],scope:{1:"title.class",3:"variable.constant"}},{match:[s,i.concat("::",i.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[s,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},te={scope:"attr",match:i.concat(l,i.lookahead(":"),i.lookahead(/(?!::)/))},D={relevance:0,begin:/\(/,end:/\)/,keywords:$,contains:[te,u,G,e.C_BLOCK_COMMENT_MODE,x,C,I]},ne={relevance:0,match:[/\b/,i.concat("(?!fn\\b|function\\b|",K(w).join("\\b|"),"|",K(F).join("\\b|"),"\\b)"),l,i.concat(b,"*"),i.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[D]};D.contains.push(ne);const X=[te,G,e.C_BLOCK_COMMENT_MODE,x,C,I],fe={begin:i.concat(/#\[\s*\\?/,i.either(s,c)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:T,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:T,keyword:["new","array"]},contains:["self",...X]},...X,{scope:"meta",variants:[{match:s},{match:c}]}]};return{case_insensitive:!1,keywords:$,contains:[fe,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},d,{scope:"variable.language",match:/\$this\b/},u,ne,G,{match:[/const/,/\s/,l],scope:{1:"keyword",3:"variable.constant"}},I,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:$,contains:["self",fe,u,G,e.C_BLOCK_COMMENT_MODE,x,C]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},x,C]}}function i0(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function o0(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function l0(e){const i=e.regex,r=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),l=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],d={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:l,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},p={className:"meta",begin:/^(>>>|\.\.\.) /},m={className:"subst",begin:/\{/,end:/\}/,keywords:d,illegal:/#/},g={begin:/\{\{/,relevance:0},y={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,p],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,p],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,p,g,m]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,p,g,m]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,g,m]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,g,m]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},E="[0-9](_?[0-9])*",b=`(\\b(${E}))?\\.(${E})|\\b(${E})\\.`,x=`\\b|${l.join("|")}`,C={className:"number",relevance:0,variants:[{begin:`(\\b(${E})|(${b}))[eE][+-]?(${E})[jJ]?(?=${x})`},{begin:`(${b})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${x})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${x})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${x})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${x})`},{begin:`\\b(${E})[jJ](?=${x})`}]},T={className:"comment",begin:i.lookahead(/# type:/),end:/$/,keywords:d,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},w={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:["self",p,C,y,e.HASH_COMMENT_MODE]}]};return m.contains=[y,C,p],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:d,illegal:/(<\/|\?)|=>/,contains:[p,C,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},y,T,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,r],scope:{1:"keyword",3:"title.function"},contains:[w]},{variants:[{match:[/\bclass/,/\s+/,r,/\s*/,/\(\s*/,r,/\s*\)/]},{match:[/\bclass/,/\s+/,r]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[C,w,y]}]}}function a0(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function s0(e){const i=e.regex,r=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,l=i.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),s=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,c=i.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:r,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:i.lookahead(i.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:r},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[s,l]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,l]},{scope:{1:"punctuation",2:"number"},match:[c,l]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,l]}]},{scope:{3:"operator"},match:[r,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:s},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:c},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function u0(e){const i=e.regex,r="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",l=i.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),s=i.concat(l,/(::\w+)*/),u={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},d={className:"doctag",begin:"@[A-Za-z]+"},p={begin:"#<",end:">"},m=[e.COMMENT("#","$",{contains:[d]}),e.COMMENT("^=begin","^=end",{contains:[d],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],g={className:"subst",begin:/#\{/,end:/\}/,keywords:u},y={className:"string",contains:[e.BACKSLASH_ESCAPE,g],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:i.concat(/<<[-~]?'?/,i.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,g]})]}]},E="[1-9](_?[0-9])*|0",b="[0-9](_?[0-9])*",x={className:"number",relevance:0,variants:[{begin:`\\b(${E})(\\.(${b}))?([eE][+-]?(${b})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},C={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:u}]},I=[y,{variants:[{match:[/class\s+/,s,/\s+<\s+/,s]},{match:[/\b(class|module)\s+/,s]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:u},{match:[/(include|extend)\s+/,s],scope:{2:"title.class"},keywords:u},{relevance:0,match:[s,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:l,scope:"title.class"},{match:[/def/,/\s+/,r],scope:{1:"keyword",3:"title.function"},contains:[C]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[y,{begin:r}],relevance:0},x,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:u},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,g],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(p,m),relevance:0}].concat(p,m);g.contains=I,C.contains=I;const D=[{begin:/^\s*=>/,starts:{end:"$",contains:I}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:u,contains:I}}];return m.unshift(p),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:u,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(D).concat(m).concat(I)}}function c0(e){const i=e.regex,r=/(r#)?/,l=i.concat(r,e.UNDERSCORE_IDENT_RE),s=i.concat(r,e.IDENT_RE),c={className:"title.function.invoke",relevance:0,begin:i.concat(/\b/,/(?!let|for|while|if|else|match\b)/,s,i.lookahead(/\s*\(/))},u="([ui](8|16|32|64|128|size)|f(32|64))?",d=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],p=["true","false","Some","None","Ok","Err"],m=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],g=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:g,keyword:d,literal:p,built_in:m},illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+u},{begin:"\\b0o([0-7_]+)"+u},{begin:"\\b0x([A-Fa-f0-9_]+)"+u},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+u}],relevance:0},{begin:[/fn/,/\s+/,l],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,l],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,l,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,l],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,l],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:m,type:g}},{className:"punctuation",begin:"->"},c]}}const d0=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),f0=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],p0=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],m0=[...f0,...p0],h0=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),g0=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),y0=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),b0=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function E0(e){const i=d0(e),r=y0,l=g0,s="@[a-z-]+",c="and or not only",d={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,i.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},i.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+m0.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+l.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+r.join("|")+")"},d,{begin:/\(/,end:/\)/,contains:[i.CSS_NUMBER_MODE]},i.CSS_VARIABLE,{className:"attribute",begin:"\\b("+b0.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[i.BLOCK_COMMENT,d,i.HEXCOLOR,i.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,i.IMPORTANT,i.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:s,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:c,attribute:h0.join(" ")},contains:[{begin:s,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},d,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,i.HEXCOLOR,i.CSS_NUMBER_MODE]},i.FUNCTION_DISPATCH]}}function _0(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function v0(e){const i=e.regex,r=e.COMMENT("--","$"),l={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={begin:/"/,end:/"/,contains:[{match:/""/}]},c=["true","false","unknown"],u=["double precision","large object","with timezone","without timezone"],d=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],p=["add","asc","collation","desc","final","first","last","view"],m=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],g=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],y=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],E=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],b=g,x=[...m,...p].filter(K=>!g.includes(K)),C={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},T={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},w={match:i.concat(/\b/,i.either(...b),/\s*\(/),relevance:0,keywords:{built_in:b}};function F(K){return i.concat(/\b/,i.either(...K.map(I=>I.replace(/\s+/,"\\s+"))),/\b/)}const L={scope:"keyword",match:F(E),relevance:0};function $(K,{exceptions:I,when:Z}={}){const G=Z;return I=I||[],K.map(te=>te.match(/\|\d+$/)||I.includes(te)?te:G(te)?`${te}|0`:te)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:$(x,{when:K=>K.length<3}),literal:c,type:d,built_in:y},contains:[{scope:"type",match:F(u)},L,w,C,l,s,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,r,T]}}function sh(e){return e?typeof e=="string"?e:e.source:null}function Co(e){return Ze("(?=",e,")")}function Ze(...e){return e.map(r=>sh(r)).join("")}function k0(e){const i=e[e.length-1];return typeof i=="object"&&i.constructor===Object?(e.splice(e.length-1,1),i):{}}function $t(...e){return"("+(k0(e).capture?"":"?:")+e.map(l=>sh(l)).join("|")+")"}const rc=e=>Ze(/\b/,e,/\w$/.test(e)?/\b/:/\B/),w0=["Protocol","Type"].map(rc),Cp=["init","self"].map(rc),x0=["Any","Self"],yu=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],Tp=["false","nil","true"],S0=["assignment","associativity","higherThan","left","lowerThan","none","right"],N0=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Ap=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],uh=$t(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),ch=$t(uh,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),bu=Ze(uh,ch,"*"),dh=$t(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),aa=$t(dh,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),jn=Ze(dh,aa,"*"),ta=Ze(/[A-Z]/,aa,"*"),C0=["attached","autoclosure",Ze(/convention\(/,$t("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Ze(/objc\(/,jn,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],T0=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function A0(e){const i={match:/\s+/,relevance:0},r=e.COMMENT("/\\*","\\*/",{contains:["self"]}),l=[e.C_LINE_COMMENT_MODE,r],s={match:[/\./,$t(...w0,...Cp)],className:{2:"keyword"}},c={match:Ze(/\./,$t(...yu)),relevance:0},u=yu.filter(Ge=>typeof Ge=="string").concat(["_|0"]),d=yu.filter(Ge=>typeof Ge!="string").concat(x0).map(rc),p={variants:[{className:"keyword",match:$t(...d,...Cp)}]},m={$pattern:$t(/\b\w+/,/#\w+/),keyword:u.concat(N0),literal:Tp},g=[s,c,p],y={match:Ze(/\./,$t(...Ap)),relevance:0},E={className:"built_in",match:Ze(/\b/,$t(...Ap),/(?=\()/)},b=[y,E],x={match:/->/,relevance:0},C={className:"operator",relevance:0,variants:[{match:bu},{match:`\\.(\\.|${ch})+`}]},T=[x,C],w="([0-9]_*)+",F="([0-9a-fA-F]_*)+",L={className:"number",relevance:0,variants:[{match:`\\b(${w})(\\.(${w}))?([eE][+-]?(${w}))?\\b`},{match:`\\b0x(${F})(\\.(${F}))?([pP][+-]?(${w}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},$=(Ge="")=>({className:"subst",variants:[{match:Ze(/\\/,Ge,/[0\\tnr"']/)},{match:Ze(/\\/,Ge,/u\{[0-9a-fA-F]{1,8}\}/)}]}),K=(Ge="")=>({className:"subst",match:Ze(/\\/,Ge,/[\t ]*(?:[\r\n]|\r\n)/)}),I=(Ge="")=>({className:"subst",label:"interpol",begin:Ze(/\\/,Ge,/\(/),end:/\)/}),Z=(Ge="")=>({begin:Ze(Ge,/"""/),end:Ze(/"""/,Ge),contains:[$(Ge),K(Ge),I(Ge)]}),G=(Ge="")=>({begin:Ze(Ge,/"/),end:Ze(/"/,Ge),contains:[$(Ge),I(Ge)]}),te={className:"string",variants:[Z(),Z("#"),Z("##"),Z("###"),G(),G("#"),G("##"),G("###")]},D=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],ne={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:D},X=Ge=>{const tn=Ze(Ge,/\//),un=Ze(/\//,Ge);return{begin:tn,end:un,contains:[...D,{scope:"comment",begin:`#(?!.*${un})`,end:/$/}]}},fe={scope:"regexp",variants:[X("###"),X("##"),X("#"),ne]},q={match:Ze(/`/,jn,/`/)},P={className:"variable",match:/\$\d+/},le={className:"variable",match:`\\$${aa}+`},ae=[q,P,le],W={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:T0,contains:[...T,L,te]}]}},de={scope:"keyword",match:Ze(/@/,$t(...C0),Co($t(/\(/,/\s+/)))},v={scope:"meta",match:Ze(/@/,jn)},O=[W,de,v],j={match:Co(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Ze(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,aa,"+")},{className:"type",match:ta,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Ze(/\s+&\s+/,Co(ta)),relevance:0}]},S={begin:/</,end:/>/,keywords:m,contains:[...l,...g,...O,x,j]};j.contains.push(S);const we={match:Ze(jn,/\s*:/),keywords:"_|0",relevance:0},Me={begin:/\(/,end:/\)/,relevance:0,keywords:m,contains:["self",we,...l,fe,...g,...b,...T,L,te,...ae,...O,j]},ke={begin:/</,end:/>/,keywords:"repeat each",contains:[...l,j]},$e={begin:$t(Co(Ze(jn,/\s*:/)),Co(Ze(jn,/\s+/,jn,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:jn}]},De={begin:/\(/,end:/\)/,keywords:m,contains:[$e,...l,...g,...T,L,te,...O,j,Me],endsParent:!0,illegal:/["']/},Ke={match:[/(func|macro)/,/\s+/,$t(q.match,jn,bu)],className:{1:"keyword",3:"title.function"},contains:[ke,De,i],illegal:[/\[/,/%/]},Xe={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[ke,De,i],illegal:/\[|%/},en={match:[/operator/,/\s+/,bu],className:{1:"keyword",3:"title"}},ar={begin:[/precedencegroup/,/\s+/,ta],className:{1:"keyword",3:"title"},contains:[j],keywords:[...S0,...Tp],end:/}/},In={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Wn={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Vn={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,jn,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:m,contains:[ke,...g,{begin:/:/,end:/\{/,keywords:m,contains:[{scope:"title.class.inherited",match:ta},...g],relevance:0}]};for(const Ge of te.variants){const tn=Ge.contains.find(Mn=>Mn.label==="interpol");tn.keywords=m;const un=[...g,...b,...T,L,te,...ae];tn.contains=[...un,{begin:/\(/,end:/\)/,contains:["self",...un]}]}return{name:"Swift",keywords:m,contains:[...l,Ke,Xe,In,Wn,Vn,en,ar,{beginKeywords:"import",end:/$/,contains:[...l],relevance:0},fe,...g,...b,...T,L,te,...ae,...O,j,Me]}}const sa="[A-Za-z$_][0-9A-Za-z$_]*",fh=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],ph=["true","false","null","undefined","NaN","Infinity"],mh=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],hh=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],gh=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],yh=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],bh=[].concat(gh,mh,hh);function R0(e){const i=e.regex,r=(W,{after:de})=>{const v="</"+W[0].slice(1);return W.input.indexOf(v,de)!==-1},l=sa,s={begin:"<>",end:"</>"},c=/<[A-Za-z0-9\\._:-]+\s*\/>/,u={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(W,de)=>{const v=W[0].length+W.index,O=W.input[v];if(O==="<"||O===","){de.ignoreMatch();return}O===">"&&(r(W,{after:v})||de.ignoreMatch());let j;const S=W.input.substring(v);if(j=S.match(/^\s*=/)){de.ignoreMatch();return}if((j=S.match(/^\s+extends\s+/))&&j.index===0){de.ignoreMatch();return}}},d={$pattern:sa,keyword:fh,literal:ph,built_in:bh,"variable.language":yh},p="[0-9](_?[0-9])*",m=`\\.(${p})`,g="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",y={className:"number",variants:[{begin:`(\\b(${g})((${m})|\\.)?|(${m}))[eE][+-]?(${p})\\b`},{begin:`\\b(${g})\\b((${m})\\b|\\.)?|(${m})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},E={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},b={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,E],subLanguage:"xml"}},x={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,E],subLanguage:"css"}},C={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,E],subLanguage:"graphql"}},T={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,E]},F={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:l+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},L=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,b,x,C,T,{match:/\$\d+/},y];E.contains=L.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(L)});const $=[].concat(F,E.contains),K=$.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat($)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:K},Z={variants:[{match:[/class/,/\s+/,l,/\s+/,/extends/,/\s+/,i.concat(l,"(",i.concat(/\./,l),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,l],scope:{1:"keyword",3:"title.class"}}]},G={relevance:0,match:i.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...mh,...hh]}},te={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},D={variants:[{match:[/function/,/\s+/,l,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[I],illegal:/%/},ne={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function X(W){return i.concat("(?!",W.join("|"),")")}const fe={match:i.concat(/\b/,X([...gh,"super","import"].map(W=>`${W}\\s*\\(`)),l,i.lookahead(/\s*\(/)),className:"title.function",relevance:0},q={begin:i.concat(/\./,i.lookahead(i.concat(l,/(?![0-9A-Za-z$_(])/))),end:l,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},P={match:[/get|set/,/\s+/,l,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},le="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",ae={match:[/const|var|let/,/\s+/,l,/\s*/,/=\s*/,/(async\s*)?/,i.lookahead(le)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:K,CLASS_REFERENCE:G},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),te,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,b,x,C,T,F,{match:/\$\d+/},y,G,{scope:"attr",match:l+i.lookahead(":"),relevance:0},ae,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[F,e.REGEXP_MODE,{className:"function",begin:le,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:K}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:c},{begin:u.begin,"on:begin":u.isTrulyOpeningTag,end:u.end}],subLanguage:"xml",contains:[{begin:u.begin,end:u.end,skip:!0,contains:["self"]}]}]},D,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[I,e.inherit(e.TITLE_MODE,{begin:l,className:"title.function"})]},{match:/\.\.\./,relevance:0},q,{match:"\\$"+l,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[I]},fe,ne,Z,P,{match:/\$[(.]/}]}}function O0(e){const i=e.regex,r=R0(e),l=sa,s=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],c={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},u={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:s},contains:[r.exports.CLASS_REFERENCE]},d={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},p=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],m={$pattern:sa,keyword:fh.concat(p),literal:ph,built_in:bh.concat(s),"variable.language":yh},g={className:"meta",begin:"@"+l},y=(C,T,w)=>{const F=C.contains.findIndex(L=>L.label===T);if(F===-1)throw new Error("can not find mode to replace");C.contains.splice(F,1,w)};Object.assign(r.keywords,m),r.exports.PARAMS_CONTAINS.push(g);const E=r.contains.find(C=>C.scope==="attr"),b=Object.assign({},E,{match:i.concat(l,i.lookahead(/\s*\?:/))});r.exports.PARAMS_CONTAINS.push([r.exports.CLASS_REFERENCE,E,b]),r.contains=r.contains.concat([g,c,u,b]),y(r,"shebang",e.SHEBANG()),y(r,"use_strict",d);const x=r.contains.find(C=>C.label==="func.def");return x.relevance=0,Object.assign(r,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),r}function I0(e){const i=e.regex,r={className:"string",begin:/"(""|[^/n])"C\b/},l={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},s=/\d{1,2}\/\d{1,2}\/\d{4}/,c=/\d{4}-\d{1,2}-\d{1,2}/,u=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,d=/\d{1,2}(:\d{1,2}){1,2}/,p={className:"literal",variants:[{begin:i.concat(/# */,i.either(c,s),/ *#/)},{begin:i.concat(/# */,d,/ *#/)},{begin:i.concat(/# */,u,/ *#/)},{begin:i.concat(/# */,i.either(c,s),/ +/,i.either(u,d),/ *#/)}]},m={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},g={className:"label",begin:/^\w+:/},y=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),E=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[r,l,p,m,g,y,E,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[E]}]}}function M0(e){e.regex;const i=e.COMMENT(/\(;/,/;\)/);i.contains.push("self");const r=e.COMMENT(/;;/,/$/),l=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],s={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},c={className:"variable",begin:/\$[\w_]+/},u={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},d={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},p={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},m={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:l},contains:[r,i,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},c,u,s,e.QUOTE_STRING_MODE,p,m,d]}}function L0(e){const i=e.regex,r=i.concat(/[\p{L}_]/u,i.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),l=/[\p{L}0-9._:-]+/u,s={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},c={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},u=e.inherit(c,{begin:/\(/,end:/\)/}),d=e.inherit(e.APOS_STRING_MODE,{className:"string"}),p=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),m={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:l,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[s]},{begin:/'/,end:/'/,contains:[s]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[c,p,d,u,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[c,u,p,d]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[p]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[m],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[m],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:i.concat(/</,i.lookahead(i.concat(r,i.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:r,relevance:0,starts:m}]},{className:"tag",begin:i.concat(/<\//,i.lookahead(i.concat(r,/>/))),contains:[{className:"name",begin:r,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function D0(e){const i="true false yes no null",r="[\\w#;/?:@&=+$,.~*'()[\\]]+",l={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},s={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},c={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},u={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,s]},d=e.inherit(u,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),E={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},b={end:",",endsWithParent:!0,excludeEnd:!0,keywords:i,relevance:0},x={begin:/\{/,end:/\}/,contains:[b],illegal:"\\n",relevance:0},C={begin:"\\[",end:"\\]",contains:[b],illegal:"\\n",relevance:0},T=[l,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+r},{className:"type",begin:"!<"+r+">"},{className:"type",begin:"!"+r},{className:"type",begin:"!!"+r},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:i,keywords:{literal:i}},E,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},x,C,c,u],w=[...T];return w.pop(),w.push(d),b.contains=w,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:T}}const P0={arduino:yx,bash:bx,c:Ex,cpp:_x,csharp:vx,css:Rx,diff:Ox,go:Ix,graphql:Mx,ini:Lx,java:Dx,javascript:Ux,json:$x,kotlin:Hx,less:Zx,lua:Xx,makefile:Jx,markdown:e0,objectivec:t0,perl:n0,php:r0,"php-template":i0,plaintext:o0,python:l0,"python-repl":a0,r:s0,ruby:u0,rust:c0,scss:E0,shell:_0,sql:v0,swift:A0,typescript:O0,vbnet:I0,wasm:M0,xml:L0,yaml:D0};var Eu,Rp;function z0(){if(Rp)return Eu;Rp=1;function e(A){return A instanceof Map?A.clear=A.delete=A.set=function(){throw new Error("map is read-only")}:A instanceof Set&&(A.add=A.clear=A.delete=function(){throw new Error("set is read-only")}),Object.freeze(A),Object.getOwnPropertyNames(A).forEach(V=>{const ce=A[V],Re=typeof ce;(Re==="object"||Re==="function")&&!Object.isFrozen(ce)&&e(ce)}),A}class i{constructor(V){V.data===void 0&&(V.data={}),this.data=V.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function r(A){return A.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function l(A,...V){const ce=Object.create(null);for(const Re in A)ce[Re]=A[Re];return V.forEach(function(Re){for(const rt in Re)ce[rt]=Re[rt]}),ce}const s="</span>",c=A=>!!A.scope,u=(A,{prefix:V})=>{if(A.startsWith("language:"))return A.replace("language:","language-");if(A.includes(".")){const ce=A.split(".");return[`${V}${ce.shift()}`,...ce.map((Re,rt)=>`${Re}${"_".repeat(rt+1)}`)].join(" ")}return`${V}${A}`};class d{constructor(V,ce){this.buffer="",this.classPrefix=ce.classPrefix,V.walk(this)}addText(V){this.buffer+=r(V)}openNode(V){if(!c(V))return;const ce=u(V.scope,{prefix:this.classPrefix});this.span(ce)}closeNode(V){c(V)&&(this.buffer+=s)}value(){return this.buffer}span(V){this.buffer+=`<span class="${V}">`}}const p=(A={})=>{const V={children:[]};return Object.assign(V,A),V};class m{constructor(){this.rootNode=p(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(V){this.top.children.push(V)}openNode(V){const ce=p({scope:V});this.add(ce),this.stack.push(ce)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(V){return this.constructor._walk(V,this.rootNode)}static _walk(V,ce){return typeof ce=="string"?V.addText(ce):ce.children&&(V.openNode(ce),ce.children.forEach(Re=>this._walk(V,Re)),V.closeNode(ce)),V}static _collapse(V){typeof V!="string"&&V.children&&(V.children.every(ce=>typeof ce=="string")?V.children=[V.children.join("")]:V.children.forEach(ce=>{m._collapse(ce)}))}}class g extends m{constructor(V){super(),this.options=V}addText(V){V!==""&&this.add(V)}startScope(V){this.openNode(V)}endScope(){this.closeNode()}__addSublanguage(V,ce){const Re=V.root;ce&&(Re.scope=`language:${ce}`),this.add(Re)}toHTML(){return new d(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function y(A){return A?typeof A=="string"?A:A.source:null}function E(A){return C("(?=",A,")")}function b(A){return C("(?:",A,")*")}function x(A){return C("(?:",A,")?")}function C(...A){return A.map(ce=>y(ce)).join("")}function T(A){const V=A[A.length-1];return typeof V=="object"&&V.constructor===Object?(A.splice(A.length-1,1),V):{}}function w(...A){return"("+(T(A).capture?"":"?:")+A.map(Re=>y(Re)).join("|")+")"}function F(A){return new RegExp(A.toString()+"|").exec("").length-1}function L(A,V){const ce=A&&A.exec(V);return ce&&ce.index===0}const $=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function K(A,{joinWith:V}){let ce=0;return A.map(Re=>{ce+=1;const rt=ce;let lt=y(Re),he="";for(;lt.length>0;){const me=$.exec(lt);if(!me){he+=lt;break}he+=lt.substring(0,me.index),lt=lt.substring(me.index+me[0].length),me[0][0]==="\\"&&me[1]?he+="\\"+String(Number(me[1])+rt):(he+=me[0],me[0]==="("&&ce++)}return he}).map(Re=>`(${Re})`).join(V)}const I=/\b\B/,Z="[a-zA-Z]\\w*",G="[a-zA-Z_]\\w*",te="\\b\\d+(\\.\\d+)?",D="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",ne="\\b(0b[01]+)",X="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",fe=(A={})=>{const V=/^#![ ]*\//;return A.binary&&(A.begin=C(V,/.*\b/,A.binary,/\b.*/)),l({scope:"meta",begin:V,end:/$/,relevance:0,"on:begin":(ce,Re)=>{ce.index!==0&&Re.ignoreMatch()}},A)},q={begin:"\\\\[\\s\\S]",relevance:0},P={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[q]},le={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[q]},ae={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},W=function(A,V,ce={}){const Re=l({scope:"comment",begin:A,end:V,contains:[]},ce);Re.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const rt=w("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return Re.contains.push({begin:C(/[ ]+/,"(",rt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Re},de=W("//","$"),v=W("/\\*","\\*/"),O=W("#","$"),j={scope:"number",begin:te,relevance:0},S={scope:"number",begin:D,relevance:0},we={scope:"number",begin:ne,relevance:0},Me={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[q,{begin:/\[/,end:/\]/,relevance:0,contains:[q]}]},ke={scope:"title",begin:Z,relevance:0},$e={scope:"title",begin:G,relevance:0},De={begin:"\\.\\s*"+G,relevance:0};var Xe=Object.freeze({__proto__:null,APOS_STRING_MODE:P,BACKSLASH_ESCAPE:q,BINARY_NUMBER_MODE:we,BINARY_NUMBER_RE:ne,COMMENT:W,C_BLOCK_COMMENT_MODE:v,C_LINE_COMMENT_MODE:de,C_NUMBER_MODE:S,C_NUMBER_RE:D,END_SAME_AS_BEGIN:function(A){return Object.assign(A,{"on:begin":(V,ce)=>{ce.data._beginMatch=V[1]},"on:end":(V,ce)=>{ce.data._beginMatch!==V[1]&&ce.ignoreMatch()}})},HASH_COMMENT_MODE:O,IDENT_RE:Z,MATCH_NOTHING_RE:I,METHOD_GUARD:De,NUMBER_MODE:j,NUMBER_RE:te,PHRASAL_WORDS_MODE:ae,QUOTE_STRING_MODE:le,REGEXP_MODE:Me,RE_STARTERS_RE:X,SHEBANG:fe,TITLE_MODE:ke,UNDERSCORE_IDENT_RE:G,UNDERSCORE_TITLE_MODE:$e});function en(A,V){A.input[A.index-1]==="."&&V.ignoreMatch()}function ar(A,V){A.className!==void 0&&(A.scope=A.className,delete A.className)}function In(A,V){V&&A.beginKeywords&&(A.begin="\\b("+A.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",A.__beforeBegin=en,A.keywords=A.keywords||A.beginKeywords,delete A.beginKeywords,A.relevance===void 0&&(A.relevance=0))}function Wn(A,V){Array.isArray(A.illegal)&&(A.illegal=w(...A.illegal))}function Vn(A,V){if(A.match){if(A.begin||A.end)throw new Error("begin & end are not supported with match");A.begin=A.match,delete A.match}}function Ge(A,V){A.relevance===void 0&&(A.relevance=1)}const tn=(A,V)=>{if(!A.beforeMatch)return;if(A.starts)throw new Error("beforeMatch cannot be used with starts");const ce=Object.assign({},A);Object.keys(A).forEach(Re=>{delete A[Re]}),A.keywords=ce.keywords,A.begin=C(ce.beforeMatch,E(ce.begin)),A.starts={relevance:0,contains:[Object.assign(ce,{endsParent:!0})]},A.relevance=0,delete ce.beforeMatch},un=["of","and","for","in","not","or","if","then","parent","list","value"],Mn="keyword";function _n(A,V,ce=Mn){const Re=Object.create(null);return typeof A=="string"?rt(ce,A.split(" ")):Array.isArray(A)?rt(ce,A):Object.keys(A).forEach(function(lt){Object.assign(Re,_n(A[lt],V,lt))}),Re;function rt(lt,he){V&&(he=he.map(me=>me.toLowerCase())),he.forEach(function(me){const xe=me.split("|");Re[xe[0]]=[lt,Ln(xe[0],xe[1])]})}}function Ln(A,V){return V?Number(V):Or(A)?0:1}function Or(A){return un.includes(A.toLowerCase())}const Ir={},cn=A=>{console.error(A)},Mr=(A,...V)=>{console.log(`WARN: ${A}`,...V)},H=(A,V)=>{Ir[`${A}/${V}`]||(console.log(`Deprecated as of ${A}. ${V}`),Ir[`${A}/${V}`]=!0)},oe=new Error;function Te(A,V,{key:ce}){let Re=0;const rt=A[ce],lt={},he={};for(let me=1;me<=V.length;me++)he[me+Re]=rt[me],lt[me+Re]=!0,Re+=F(V[me-1]);A[ce]=he,A[ce]._emit=lt,A[ce]._multi=!0}function Pe(A){if(Array.isArray(A.begin)){if(A.skip||A.excludeBegin||A.returnBegin)throw cn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),oe;if(typeof A.beginScope!="object"||A.beginScope===null)throw cn("beginScope must be object"),oe;Te(A,A.begin,{key:"beginScope"}),A.begin=K(A.begin,{joinWith:""})}}function je(A){if(Array.isArray(A.end)){if(A.skip||A.excludeEnd||A.returnEnd)throw cn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),oe;if(typeof A.endScope!="object"||A.endScope===null)throw cn("endScope must be object"),oe;Te(A,A.end,{key:"endScope"}),A.end=K(A.end,{joinWith:""})}}function _t(A){A.scope&&typeof A.scope=="object"&&A.scope!==null&&(A.beginScope=A.scope,delete A.scope)}function vn(A){_t(A),typeof A.beginScope=="string"&&(A.beginScope={_wrap:A.beginScope}),typeof A.endScope=="string"&&(A.endScope={_wrap:A.endScope}),Pe(A),je(A)}function Gt(A){function V(he,me){return new RegExp(y(he),"m"+(A.case_insensitive?"i":"")+(A.unicodeRegex?"u":"")+(me?"g":""))}class ce{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(me,xe){xe.position=this.position++,this.matchIndexes[this.matchAt]=xe,this.regexes.push([xe,me]),this.matchAt+=F(me)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const me=this.regexes.map(xe=>xe[1]);this.matcherRe=V(K(me,{joinWith:"|"}),!0),this.lastIndex=0}exec(me){this.matcherRe.lastIndex=this.lastIndex;const xe=this.matcherRe.exec(me);if(!xe)return null;const yt=xe.findIndex((Dn,ur)=>ur>0&&Dn!==void 0),tt=this.matchIndexes[yt];return xe.splice(0,yt),Object.assign(xe,tt)}}class Re{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(me){if(this.multiRegexes[me])return this.multiRegexes[me];const xe=new ce;return this.rules.slice(me).forEach(([yt,tt])=>xe.addRule(yt,tt)),xe.compile(),this.multiRegexes[me]=xe,xe}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(me,xe){this.rules.push([me,xe]),xe.type==="begin"&&this.count++}exec(me){const xe=this.getMatcher(this.regexIndex);xe.lastIndex=this.lastIndex;let yt=xe.exec(me);if(this.resumingScanAtSamePosition()&&!(yt&&yt.index===this.lastIndex)){const tt=this.getMatcher(0);tt.lastIndex=this.lastIndex+1,yt=tt.exec(me)}return yt&&(this.regexIndex+=yt.position+1,this.regexIndex===this.count&&this.considerAll()),yt}}function rt(he){const me=new Re;return he.contains.forEach(xe=>me.addRule(xe.begin,{rule:xe,type:"begin"})),he.terminatorEnd&&me.addRule(he.terminatorEnd,{type:"end"}),he.illegal&&me.addRule(he.illegal,{type:"illegal"}),me}function lt(he,me){const xe=he;if(he.isCompiled)return xe;[ar,Vn,vn,tn].forEach(tt=>tt(he,me)),A.compilerExtensions.forEach(tt=>tt(he,me)),he.__beforeBegin=null,[In,Wn,Ge].forEach(tt=>tt(he,me)),he.isCompiled=!0;let yt=null;return typeof he.keywords=="object"&&he.keywords.$pattern&&(he.keywords=Object.assign({},he.keywords),yt=he.keywords.$pattern,delete he.keywords.$pattern),yt=yt||/\w+/,he.keywords&&(he.keywords=_n(he.keywords,A.case_insensitive)),xe.keywordPatternRe=V(yt,!0),me&&(he.begin||(he.begin=/\B|\b/),xe.beginRe=V(xe.begin),!he.end&&!he.endsWithParent&&(he.end=/\B|\b/),he.end&&(xe.endRe=V(xe.end)),xe.terminatorEnd=y(xe.end)||"",he.endsWithParent&&me.terminatorEnd&&(xe.terminatorEnd+=(he.end?"|":"")+me.terminatorEnd)),he.illegal&&(xe.illegalRe=V(he.illegal)),he.contains||(he.contains=[]),he.contains=[].concat(...he.contains.map(function(tt){return qn(tt==="self"?he:tt)})),he.contains.forEach(function(tt){lt(tt,xe)}),he.starts&<(he.starts,me),xe.matcher=rt(xe),xe}if(A.compilerExtensions||(A.compilerExtensions=[]),A.contains&&A.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return A.classNameAliases=l(A.classNameAliases||{}),lt(A)}function kn(A){return A?A.endsWithParent||kn(A.starts):!1}function qn(A){return A.variants&&!A.cachedVariants&&(A.cachedVariants=A.variants.map(function(V){return l(A,{variants:null},V)})),A.cachedVariants?A.cachedVariants:kn(A)?l(A,{starts:A.starts?l(A.starts):null}):Object.isFrozen(A)?l(A):A}var vt="11.11.1";class dn extends Error{constructor(V,ce){super(V),this.name="HTMLInjectionError",this.html=ce}}const Tt=r,oi=l,li=Symbol("nomatch"),sr=7,Yn=function(A){const V=Object.create(null),ce=Object.create(null),Re=[];let rt=!0;const lt="Could not find the language '{}', did you forget to load/include a language module?",he={disableAutodetect:!0,name:"Plain text",contains:[]};let me={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:g};function xe(re){return me.noHighlightRe.test(re)}function yt(re){let ve=re.className+" ";ve+=re.parentNode?re.parentNode.className:"";const ze=me.languageDetectRe.exec(ve);if(ze){const Be=wn(ze[1]);return Be||(Mr(lt.replace("{}",ze[1])),Mr("Falling back to no-highlight mode for this block.",re)),Be?ze[1]:"no-highlight"}return ve.split(/\s+/).find(Be=>xe(Be)||wn(Be))}function tt(re,ve,ze){let Be="",mt="";typeof ve=="object"?(Be=re,ze=ve.ignoreIllegals,mt=ve.language):(H("10.7.0","highlight(lang, code, ...args) has been deprecated."),H("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),mt=re,Be=ve),ze===void 0&&(ze=!0);const ut={code:Be,language:mt};Dr("before:highlight",ut);const Pn=ut.result?ut.result:Dn(ut.language,ut.code,ze);return Pn.code=ut.code,Dr("after:highlight",Pn),Pn}function Dn(re,ve,ze,Be){const mt=Object.create(null);function ut(se,ge){return se.keywords[ge]}function Pn(){if(!Ie.keywords){ht.addText(Qe);return}let se=0;Ie.keywordPatternRe.lastIndex=0;let ge=Ie.keywordPatternRe.exec(Qe),Ae="";for(;ge;){Ae+=Qe.substring(se,ge.index);const He=fn.case_insensitive?ge[0].toLowerCase():ge[0],ft=ut(Ie,He);if(ft){const[xt,_a]=ft;if(ht.addText(Ae),Ae="",mt[He]=(mt[He]||0)+1,mt[He]<=sr&&(Fr+=_a),xt.startsWith("_"))Ae+=ge[0];else{const Go=fn.classNameAliases[xt]||xt;Ft(ge[0],Go)}}else Ae+=ge[0];se=Ie.keywordPatternRe.lastIndex,ge=Ie.keywordPatternRe.exec(Qe)}Ae+=Qe.substring(se),ht.addText(Ae)}function ui(){if(Qe==="")return;let se=null;if(typeof Ie.subLanguage=="string"){if(!V[Ie.subLanguage]){ht.addText(Qe);return}se=Dn(Ie.subLanguage,Qe,!0,Gi[Ie.subLanguage]),Gi[Ie.subLanguage]=se._top}else se=Lr(Qe,Ie.subLanguage.length?Ie.subLanguage:null);Ie.relevance>0&&(Fr+=se.relevance),ht.__addSublanguage(se._emitter,se.language)}function zt(){Ie.subLanguage!=null?ui():Pn(),Qe=""}function Ft(se,ge){se!==""&&(ht.startScope(ge),ht.addText(se),ht.endScope())}function Pr(se,ge){let Ae=1;const He=ge.length-1;for(;Ae<=He;){if(!se._emit[Ae]){Ae++;continue}const ft=fn.classNameAliases[se[Ae]]||se[Ae],xt=ge[Ae];ft?Ft(xt,ft):(Qe=xt,Pn(),Qe=""),Ae++}}function cr(se,ge){return se.scope&&typeof se.scope=="string"&&ht.openNode(fn.classNameAliases[se.scope]||se.scope),se.beginScope&&(se.beginScope._wrap?(Ft(Qe,fn.classNameAliases[se.beginScope._wrap]||se.beginScope._wrap),Qe=""):se.beginScope._multi&&(Pr(se.beginScope,ge),Qe="")),Ie=Object.create(se,{parent:{value:Ie}}),Ie}function zr(se,ge,Ae){let He=L(se.endRe,Ae);if(He){if(se["on:end"]){const ft=new i(se);se["on:end"](ge,ft),ft.isMatchIgnored&&(He=!1)}if(He){for(;se.endsParent&&se.parent;)se=se.parent;return se}}if(se.endsWithParent)return zr(se.parent,ge,Ae)}function ba(se){return Ie.matcher.regexIndex===0?(Qe+=se[0],1):(pr=!0,0)}function Ea(se){const ge=se[0],Ae=se.rule,He=new i(Ae),ft=[Ae.__beforeBegin,Ae["on:begin"]];for(const xt of ft)if(xt&&(xt(se,He),He.isMatchIgnored))return ba(ge);return Ae.skip?Qe+=ge:(Ae.excludeBegin&&(Qe+=ge),zt(),!Ae.returnBegin&&!Ae.excludeBegin&&(Qe=ge)),cr(Ae,se),Ae.returnBegin?0:ge.length}function Hi(se){const ge=se[0],Ae=ve.substring(se.index),He=zr(Ie,se,Ae);if(!He)return li;const ft=Ie;Ie.endScope&&Ie.endScope._wrap?(zt(),Ft(ge,Ie.endScope._wrap)):Ie.endScope&&Ie.endScope._multi?(zt(),Pr(Ie.endScope,se)):ft.skip?Qe+=ge:(ft.returnEnd||ft.excludeEnd||(Qe+=ge),zt(),ft.excludeEnd&&(Qe=ge));do Ie.scope&&ht.closeNode(),!Ie.skip&&!Ie.subLanguage&&(Fr+=Ie.relevance),Ie=Ie.parent;while(Ie!==He.parent);return He.starts&&cr(He.starts,se),ft.returnEnd?0:ge.length}function Ko(){const se=[];for(let ge=Ie;ge!==fn;ge=ge.parent)ge.scope&&se.unshift(ge.scope);se.forEach(ge=>ht.openNode(ge))}let dr={};function fr(se,ge){const Ae=ge&&ge[0];if(Qe+=se,Ae==null)return zt(),0;if(dr.type==="begin"&&ge.type==="end"&&dr.index===ge.index&&Ae===""){if(Qe+=ve.slice(ge.index,ge.index+1),!rt){const He=new Error(`0 width match regex (${re})`);throw He.languageName=re,He.badRule=dr.rule,He}return 1}if(dr=ge,ge.type==="begin")return Ea(ge);if(ge.type==="illegal"&&!ze){const He=new Error('Illegal lexeme "'+Ae+'" for mode "'+(Ie.scope||"<unnamed>")+'"');throw He.mode=Ie,He}else if(ge.type==="end"){const He=Hi(ge);if(He!==li)return He}if(ge.type==="illegal"&&Ae==="")return Qe+=` +`,1;if(Br>1e5&&Br>ge.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Qe+=Ae,Ae.length}const fn=wn(re);if(!fn)throw cn(lt.replace("{}",re)),new Error('Unknown language: "'+re+'"');const Ki=Gt(fn);let Ve="",Ie=Be||Ki;const Gi={},ht=new me.__emitter(me);Ko();let Qe="",Fr=0,zn=0,Br=0,pr=!1;try{if(fn.__emitTokens)fn.__emitTokens(ve,ht);else{for(Ie.matcher.considerAll();;){Br++,pr?pr=!1:Ie.matcher.considerAll(),Ie.matcher.lastIndex=zn;const se=Ie.matcher.exec(ve);if(!se)break;const ge=ve.substring(zn,se.index),Ae=fr(ge,se);zn=se.index+Ae}fr(ve.substring(zn))}return ht.finalize(),Ve=ht.toHTML(),{language:re,value:Ve,relevance:Fr,illegal:!1,_emitter:ht,_top:Ie}}catch(se){if(se.message&&se.message.includes("Illegal"))return{language:re,value:Tt(ve),illegal:!0,relevance:0,_illegalBy:{message:se.message,index:zn,context:ve.slice(zn-100,zn+100),mode:se.mode,resultSoFar:Ve},_emitter:ht};if(rt)return{language:re,value:Tt(ve),illegal:!1,relevance:0,errorRaised:se,_emitter:ht,_top:Ie};throw se}}function ur(re){const ve={value:Tt(re),illegal:!1,relevance:0,_top:he,_emitter:new me.__emitter(me)};return ve._emitter.addText(re),ve}function Lr(re,ve){ve=ve||me.languages||Object.keys(V);const ze=ur(re),Be=ve.filter(wn).filter(Ho).map(zt=>Dn(zt,re,!1));Be.unshift(ze);const mt=Be.sort((zt,Ft)=>{if(zt.relevance!==Ft.relevance)return Ft.relevance-zt.relevance;if(zt.language&&Ft.language){if(wn(zt.language).supersetOf===Ft.language)return 1;if(wn(Ft.language).supersetOf===zt.language)return-1}return 0}),[ut,Pn]=mt,ui=ut;return ui.secondBest=Pn,ui}function ha(re,ve,ze){const Be=ve&&ce[ve]||ze;re.classList.add("hljs"),re.classList.add(`language-${Be}`)}function Ui(re){let ve=null;const ze=yt(re);if(xe(ze))return;if(Dr("before:highlightElement",{el:re,language:ze}),re.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",re);return}if(re.children.length>0&&(me.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(re)),me.throwUnescapedHTML))throw new dn("One of your code blocks includes unescaped HTML.",re.innerHTML);ve=re;const Be=ve.textContent,mt=ze?tt(Be,{language:ze,ignoreIllegals:!0}):Lr(Be);re.innerHTML=mt.value,re.dataset.highlighted="yes",ha(re,ze,mt.language),re.result={language:mt.language,re:mt.relevance,relevance:mt.relevance},mt.secondBest&&(re.secondBest={language:mt.secondBest.language,relevance:mt.secondBest.relevance}),Dr("after:highlightElement",{el:re,result:mt,text:Be})}function ga(re){me=oi(me,re)}const Zn=()=>{ai(),H("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Fo(){ai(),H("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let $i=!1;function ai(){function re(){ai()}if(document.readyState==="loading"){$i||window.addEventListener("DOMContentLoaded",re,!1),$i=!0;return}document.querySelectorAll(me.cssSelector).forEach(Ui)}function Bo(re,ve){let ze=null;try{ze=ve(A)}catch(Be){if(cn("Language definition for '{}' could not be registered.".replace("{}",re)),rt)cn(Be);else throw Be;ze=he}ze.name||(ze.name=re),V[re]=ze,ze.rawDefinition=ve.bind(null,A),ze.aliases&&jo(ze.aliases,{languageName:re})}function Uo(re){delete V[re];for(const ve of Object.keys(ce))ce[ve]===re&&delete ce[ve]}function $o(){return Object.keys(V)}function wn(re){return re=(re||"").toLowerCase(),V[re]||V[ce[re]]}function jo(re,{languageName:ve}){typeof re=="string"&&(re=[re]),re.forEach(ze=>{ce[ze.toLowerCase()]=ve})}function Ho(re){const ve=wn(re);return ve&&!ve.disableAutodetect}function st(re){re["before:highlightBlock"]&&!re["before:highlightElement"]&&(re["before:highlightElement"]=ve=>{re["before:highlightBlock"](Object.assign({block:ve.el},ve))}),re["after:highlightBlock"]&&!re["after:highlightElement"]&&(re["after:highlightElement"]=ve=>{re["after:highlightBlock"](Object.assign({block:ve.el},ve))})}function ya(re){st(re),Re.push(re)}function ji(re){const ve=Re.indexOf(re);ve!==-1&&Re.splice(ve,1)}function Dr(re,ve){const ze=re;Re.forEach(function(Be){Be[ze]&&Be[ze](ve)})}function si(re){return H("10.7.0","highlightBlock will be removed entirely in v12.0"),H("10.7.0","Please use highlightElement now."),Ui(re)}Object.assign(A,{highlight:tt,highlightAuto:Lr,highlightAll:ai,highlightElement:Ui,highlightBlock:si,configure:ga,initHighlighting:Zn,initHighlightingOnLoad:Fo,registerLanguage:Bo,unregisterLanguage:Uo,listLanguages:$o,getLanguage:wn,registerAliases:jo,autoDetection:Ho,inherit:oi,addPlugin:ya,removePlugin:ji}),A.debugMode=function(){rt=!1},A.safeMode=function(){rt=!0},A.versionString=vt,A.regex={concat:C,lookahead:E,either:w,optional:x,anyNumberOfTimes:b};for(const re in Xe)typeof Xe[re]=="object"&&e(Xe[re]);return Object.assign(A,Xe),A},Qn=Yn({});return Qn.newInstance=()=>Yn({}),Eu=Qn,Qn.HighlightJS=Qn,Qn.default=Qn,Eu}var F0=z0();const B0=Mo(F0),Op={},U0="hljs-";function $0(e){const i=B0.newInstance();return e&&c(e),{highlight:r,highlightAuto:l,listLanguages:s,register:c,registerAlias:u,registered:d};function r(p,m,g){const y=g||Op,E=typeof y.prefix=="string"?y.prefix:U0;if(!i.getLanguage(p))throw new Error("Unknown language: `"+p+"` is not registered");i.configure({__emitter:j0,classPrefix:E});const b=i.highlight(m,{ignoreIllegals:!0,language:p});if(b.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:b.errorRaised});const x=b._emitter.root,C=x.data;return C.language=b.language,C.relevance=b.relevance,x}function l(p,m){const y=(m||Op).subset||s();let E=-1,b=0,x;for(;++E<y.length;){const C=y[E];if(!i.getLanguage(C))continue;const T=r(C,p,m);T.data&&T.data.relevance!==void 0&&T.data.relevance>b&&(b=T.data.relevance,x=T)}return x||{type:"root",children:[],data:{language:void 0,relevance:b}}}function s(){return i.listLanguages()}function c(p,m){if(typeof p=="string")i.registerLanguage(p,m);else{let g;for(g in p)Object.hasOwn(p,g)&&i.registerLanguage(g,p[g])}}function u(p,m){if(typeof p=="string")i.registerAliases(typeof m=="string"?m:[...m],{languageName:p});else{let g;for(g in p)if(Object.hasOwn(p,g)){const y=p[g];i.registerAliases(typeof y=="string"?y:[...y],{languageName:g})}}}function d(p){return!!i.getLanguage(p)}}class j0{constructor(i){this.options=i,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(i){if(i==="")return;const r=this.stack[this.stack.length-1],l=r.children[r.children.length-1];l&&l.type==="text"?l.value+=i:r.children.push({type:"text",value:i})}startScope(i){this.openNode(String(i))}endScope(){this.closeNode()}__addSublanguage(i,r){const l=this.stack[this.stack.length-1],s=i.root.children;r?l.children.push({type:"element",tagName:"span",properties:{className:[r]},children:s}):l.children.push(...s)}openNode(i){const r=this,l=i.split(".").map(function(u,d){return d?u+"_".repeat(d):r.options.classPrefix+u}),s=this.stack[this.stack.length-1],c={type:"element",tagName:"span",properties:{className:l},children:[]};s.children.push(c),this.stack.push(c)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const H0={};function K0(e){const i=e||H0,r=i.aliases,l=i.detect||!1,s=i.languages||P0,c=i.plainText,u=i.prefix,d=i.subset;let p="hljs";const m=$0(s);if(r&&m.registerAlias(r),u){const g=u.indexOf("-");p=g===-1?u:u.slice(0,g)}return function(g,y){ma(g,"element",function(E,b,x){if(E.tagName!=="code"||!x||x.type!=="element"||x.tagName!=="pre")return;const C=G0(E);if(C===!1||!C&&!l||C&&c&&c.includes(C))return;Array.isArray(E.properties.className)||(E.properties.className=[]),E.properties.className.includes(p)||E.properties.className.unshift(p);const T=ux(E,{whitespace:"pre"});let w;try{w=C?m.highlight(C,T,{prefix:u}):m.highlightAuto(T,{prefix:u,subset:d})}catch(F){const L=F;if(C&&/Unknown language/.test(L.message)){y.message("Cannot highlight as `"+C+"`, it’s not registered",{ancestors:[x,E],cause:L,place:E.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw L}!C&&w.data&&w.data.language&&E.properties.className.push("language-"+w.data.language),w.children.length>0&&(E.children=w.children)})}}function G0(e){const i=e.properties.className;let r=-1;if(!Array.isArray(i))return;let l;for(;++r<i.length;){const s=String(i[r]);if(s==="no-highlight"||s==="nohighlight")return!1;!l&&s.slice(0,5)==="lang-"&&(l=s.slice(5)),!l&&s.slice(0,9)==="language-"&&(l=s.slice(9))}return l}const W0=({children:e})=>k.jsx("div",{className:"md",children:k.jsx(Hv,{remarkPlugins:[nx],rehypePlugins:[[K0,{detect:!0,ignoreMissing:!0}]],components:{a:({node:i,...r})=>k.jsx("a",{...r,target:"_blank",rel:"noopener noreferrer"})},children:e})}),Eh=ue.memo(W0);function _u(e){return String(e??"").replace(/[&<>]/g,i=>({"&":"&","<":"<",">":">"})[i])}function V0({kb:e}){const{inspReset:i,inspAdd:r,inspDone:l,toastMsg:s}=Kn(),{busy:c,start:u,stop:d}=Vp(),[p,m]=ue.useState(""),[g,y]=ue.useState([]),E=ue.useRef(null),b=ue.useRef(null);ue.useEffect(()=>{function T(w){m(w.detail),E.current&&E.current.focus()}return window.addEventListener("openkb:prefill-query",T),()=>window.removeEventListener("openkb:prefill-query",T)},[]),ue.useEffect(()=>{b.current&&(b.current.scrollTop=b.current.scrollHeight)},[g]);function x(){const T=E.current;T&&(T.style.height="auto",T.style.height=Math.min(T.scrollHeight,140)+"px")}async function C(){const T=p.trim();if(!T||c)return;m(""),E.current&&(E.current.style.height="auto"),i(!0);const w={user:T,acc:""};y($=>[...$,w]);const F=g.length,L=()=>{y($=>{const K=[...$];return K[F]={...w,aborted:!0},K}),r("tool","已停止","用户中断生成")};try{await u({path:"/api/v1/query",payload:{kb:e,question:T,stream:!0}},($,K)=>{$==="tool_call"?r("tool","检索 · "+(K.name||"tool"),`<code>${_u((K.arguments||"").slice(0,120))}</code>`):$==="delta"?(w.acc+=K.text||"",y(I=>{const Z=[...I];return Z[F]={...w},Z})):$==="final"?(w.acc=K.answer||w.acc,y(I=>{const Z=[...I];return Z[F]={...w},Z}),r("done","完成","推理检索结束")):$==="error"&&(w.acc=`<span style="color:var(--red)">${_u(K.message)}</span>`,y(I=>{const Z=[...I];return Z[F]={...w},Z}),r("error","错误",_u(K.message)))},L)}finally{l()}}return k.jsxs("div",{className:"qa-wrap",children:[k.jsx("div",{className:"qa-stream",ref:b,children:g.length===0?k.jsx(Pi,{icon:k.jsx(Pp,{size:40,strokeWidth:1.5}),title:"向知识库提问",desc:"基于无向量推理检索,答案附推理过程。"}):g.map((T,w)=>k.jsxs("div",{className:"msg",children:[k.jsxs("div",{className:"msg-role user",children:[k.jsx("span",{className:"role-dot"}),"你"]}),k.jsx("div",{className:"msg-bubble user",children:T.user}),k.jsxs("div",{className:"msg-role",children:[k.jsx("span",{className:"role-dot"}),"OpenKB"]}),k.jsx("div",{className:"msg-bubble",children:T.acc?k.jsx(Eh,{children:T.acc}):T.aborted?k.jsx("span",{className:"cell-meta",children:"已停止生成"}):k.jsx("span",{className:"spinner-wrap",children:k.jsx("span",{className:"spinner"})})})]},w))}),k.jsxs("div",{className:"qa-input-bar",children:[k.jsx("textarea",{ref:E,className:"qa-input",placeholder:"例如:这篇文章的主要结论是什么?",rows:1,value:p,onChange:T=>{m(T.target.value),x()},onKeyDown:T=>{T.key==="Enter"&&!T.shiftKey&&!T.nativeEvent.isComposing&&(T.preventDefault(),C())}}),c?k.jsxs("button",{className:"btn btn-ghost",onClick:d,children:[k.jsx(Lp,{size:15})," 停止生成"]}):k.jsxs("button",{className:"btn btn-primary",onClick:C,children:[k.jsx(zp,{size:15})," 提问"]})]})]})}function vu(e){return String(e??"").replace(/[&<>]/g,i=>({"&":"&","<":"<",">":">"})[i])}function q0({kb:e}){const{inspReset:i,inspAdd:r,inspDone:l,toastMsg:s}=Kn(),{busy:c,start:u,stop:d}=Vp(),[p,m]=ue.useState([]),[g,y]=ue.useState(null),[E,b]=ue.useState([]),[x,C]=ue.useState(""),T=ue.useRef(null),w=ue.useRef(null),F=ue.useCallback(()=>{jt.chatSessions(e).then(G=>m(G.sessions||[])).catch(()=>m([]))},[e]);ue.useEffect(F,[F]),ue.useEffect(()=>{w.current&&(w.current.scrollTop=w.current.scrollHeight)},[E]);function L(){y(null),b([])}async function $(G){y(G),b([]);try{const te=await jt.chatSessionLoad(e,G),D=[],ne=Math.max(te.user_turns.length,te.assistant_texts.length);for(let X=0;X<ne;X++)X<te.user_turns.length&&D.push({role:"user",text:te.user_turns[X]}),X<te.assistant_texts.length&&D.push({role:"assistant",text:te.assistant_texts[X]});b(D)}catch(te){s(te.message,"err")}}async function K(G,te){if(te.stopPropagation(),!!window.confirm("删除此会话?"))try{await jt.chatSessionDelete(e,G),G===g&&L(),F(),s("已删除","ok")}catch(D){s(D.message,"err")}}function I(){const G=T.current;G&&(G.style.height="auto",G.style.height=Math.min(G.scrollHeight,140)+"px")}async function Z(){const G=x.trim();if(!G||c)return;C(""),T.current&&(T.current.style.height="auto"),i(!0);const te={role:"user",text:G},D={role:"assistant",text:"",pending:!0};b(q=>[...q,te,D]);const ne=E.length+1;let X="";const fe=()=>{b(q=>{const P=[...q];return P[ne]={role:"assistant",text:X,pending:!1,aborted:!0},P}),r("tool","已停止","用户中断生成")};try{await u({path:"/api/v1/chat",payload:{kb:e,message:G,session_id:g,stream:!0}},(q,P)=>{q==="start"&&P.session_id?y(P.session_id):q==="tool_call"?r("tool","检索 · "+(P.name||"tool"),`<code>${vu((P.arguments||"").slice(0,120))}</code>`):q==="delta"?(X+=P.text||"",b(le=>{const ae=[...le];return ae[ne]={role:"assistant",text:X,pending:!0},ae})):q==="final"?(X=P.answer||X,b(le=>{const ae=[...le];return ae[ne]={role:"assistant",text:X,pending:!1},ae}),r("done","完成",`第 ${P.turn_count||""} 轮`)):q==="error"&&(b(le=>{const ae=[...le];return ae[ne]={role:"assistant",text:`<span style="color:var(--red)">${vu(P.message)}</span>`,pending:!1},ae}),r("error","错误",vu(P.message)))},fe),F()}finally{l()}}return k.jsxs("div",{className:"qa-wrap",children:[k.jsxs("div",{className:"chat-sessions",children:[k.jsxs("button",{className:`session-item ${g?"":"active"}`,onClick:L,children:[k.jsx(ku,{size:13})," 本次新会话"]}),p.map(G=>k.jsxs("button",{className:`session-item ${G.id===g?"active":""}`,onClick:()=>$(G.id),children:[k.jsx("span",{className:"session-title",children:G.title||G.id}),k.jsx(by,{size:13,className:"session-del",onClick:te=>K(G.id,te)})]},G.id))]}),k.jsx("div",{className:"qa-stream",ref:w,children:E.length===0?k.jsx(Pi,{icon:k.jsx(Dp,{size:40,strokeWidth:1.5}),title:"多轮对话",desc:"会话自动持久化,可跨次恢复。"}):E.map((G,te)=>k.jsxs("div",{className:"msg",children:[k.jsxs("div",{className:`msg-role ${G.role==="user"?"user":""}`,children:[k.jsx("span",{className:"role-dot"}),G.role==="user"?"你":"OpenKB"]}),k.jsx("div",{className:`msg-bubble ${G.role==="user"?"user":""}`,children:G.role==="user"?G.text:G.text?k.jsx(Eh,{children:G.text}):G.aborted?k.jsx("span",{className:"cell-meta",children:"已停止生成"}):k.jsx("span",{className:"spinner-wrap",children:k.jsx("span",{className:"spinner"})})})]},te))}),k.jsxs("div",{className:"qa-input-bar",children:[k.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:L,children:[k.jsx(ku,{size:14})," 新会话"]}),k.jsx("textarea",{ref:T,className:"qa-input",placeholder:"继续对话…",rows:1,value:x,onChange:G=>{C(G.target.value),I()},onKeyDown:G=>{G.key==="Enter"&&!G.shiftKey&&!G.nativeEvent.isComposing&&(G.preventDefault(),Z())}}),c?k.jsxs("button",{className:"btn btn-ghost",onClick:d,children:[k.jsx(Lp,{size:15})," 停止生成"]}):k.jsxs("button",{className:"btn btn-primary",onClick:Z,children:[k.jsx(zp,{size:15})," 发送"]})]})]})}function Jr(e){return String(e??"").replace(/[&<>]/g,i=>({"&":"&","<":"<",">":">"})[i])}function Ip(e){if(!e)return null;try{const i=new Date(e);return isNaN(i)?e:i.toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return e}}function Y0({kb:e}){const{inspReset:i,inspAdd:r,inspDone:l,toastMsg:s}=Kn(),[c,u]=ue.useState(!1),[d,p]=ue.useState([]),[m,g]=ue.useState("all"),[y,E]=ue.useState([]),[b,x]=ue.useState(""),[C,T]=ue.useState([]),[w,F]=ue.useState(!1),[L,$]=ue.useState(null),K=ue.useRef(null),I=ue.useRef([]),Z=ue.useRef([]);ue.useEffect(()=>{jt.status(e).then($).catch(()=>$(null)),jt.watchStatus(e).then(P=>F(!!P.active)).catch(()=>{})},[e]),ue.useEffect(()=>{let P=!0;return jt.list(e).then(le=>{if(!P)return;const ae=(le.documents||[]).map(W=>W.name).filter(Boolean);E(ae),x(W=>W&&ae.includes(W)?W:ae[0]||"")}).catch(()=>{P&&(E([]),x(""))}),()=>{P=!1}},[e]),ue.useEffect(()=>{K.current&&(K.current.scrollTop=K.current.scrollHeight)},[C]);function G(P){I.current=[...I.current,P],p(I.current)}function te(P){Z.current=[...Z.current,P],T(Z.current)}async function D(){I.current=[{kind:"plain",text:`运行中${c?"(自动修复)":""}…`}],p(I.current),i(!0);try{const P=await jt.lint(e,c);I.current=[],P.skipped&&G({kind:"warn",text:P.reason||"已跳过"}),G({kind:"ok",text:P.message}),P.lint_files_changed!=null&&G({kind:"plain",text:`修改文件:${P.lint_files_changed},清理幽灵链接:${P.lint_ghosts_removed}`}),P.structural_report&&G({kind:"plain",text:Jr(P.structural_report).slice(0,600)}),r("done","Lint",Jr(P.message)),s("检查完成","ok")}catch(P){G({kind:"err",text:Jr(P.message)}),s(P.message,"err"),r("error","错误",Jr(P.message))}finally{l()}}async function ne(){Z.current=[{kind:"plain",text:"重编译中…"}],T(Z.current),i(!0);const P=m==="one"?{kb:e,doc_name:b,stream:!0}:{kb:e,all_docs:!0,stream:!0};try{await Fu("/api/v1/recompile",P,(le,ae)=>{le==="plan"?te({kind:"plain",text:`目标 ${ae.targets?ae.targets.length:0} 个`}):le==="doc"?te({kind:ae.status==="ok"?"ok":ae.status==="error"?"err":"warn",text:`${ae.name||ae.doc_name||""} → ${ae.status}${ae.message?","+ae.message:""}`}):le==="final"?(te({kind:"ok",text:`完成:重编译 ${ae.recompiled},跳过 ${ae.skipped}`}),s("重编译完成","ok"),r("done","完成",`重编译 ${ae.recompiled},跳过 ${ae.skipped}`)):le==="error"&&(te({kind:"err",text:ae.message}),s(ae.message,"err"),r("error","错误",Jr(ae.message)))})}catch(le){te({kind:"err",text:Jr(le.message)}),s(le.message,"err"),r("error","错误",Jr(le.message))}finally{l(),jt.status(e).then($).catch(()=>{})}}async function X(){const P=!w;try{P?await jt.watchStart(e,2):await jt.watchStop(e),F(P),s(P?"已开启监听":"已停止监听","ok")}catch(le){s(le.message,"err")}}const fe=(L==null?void 0:L.directories)||{},q=m==="one"&&!b;return k.jsxs("div",{className:"maint-grid",children:[k.jsxs("div",{className:"maint-card",children:[k.jsx("h3",{children:"健康检查 · Lint"}),k.jsx("p",{children:"检测结构完整性与知识一致性,可自动修复失效的 wikilink。"}),k.jsxs("div",{className:"toggle-row",children:[k.jsx("span",{className:"cell-meta",children:"自动修复"}),k.jsx("div",{className:`toggle ${c?"on":""}`,onClick:()=>u(P=>!P)})]}),k.jsx("div",{className:"row-actions",children:k.jsx("button",{className:"btn btn-primary btn-sm",onClick:D,children:"运行检查"})}),k.jsx("div",{className:"maint-log",children:d.map((P,le)=>k.jsx("div",{className:`log-line ${P.kind}`,children:P.text},le))})]}),k.jsxs("div",{className:"maint-card",children:[k.jsx("h3",{children:"重新编译 · Recompile"}),k.jsx("p",{children:"对已索引文档重跑编译,重生成摘要并改写概念页(手动编辑会被覆盖)。"}),k.jsxs("div",{className:"toggle-row",children:[k.jsx("span",{className:"cell-meta",children:"范围"}),k.jsxs("select",{className:"select",style:{width:"auto"},value:m,onChange:P=>g(P.target.value),children:[k.jsx("option",{value:"all",children:"全部文档"}),k.jsx("option",{value:"one",children:"指定文档"})]}),m==="one"&&k.jsx("select",{className:"select",style:{width:"auto",marginLeft:8},value:b,onChange:P=>x(P.target.value),disabled:y.length===0,children:y.length===0?k.jsx("option",{value:"",children:"(无文档)"}):y.map(P=>k.jsx("option",{value:P,children:P},P))})]}),k.jsx("div",{className:"row-actions",children:k.jsx("button",{className:"btn btn-ghost btn-sm",onClick:ne,disabled:q,children:"开始重编译"})}),k.jsx("div",{className:"maint-log",ref:K,children:C.map((P,le)=>k.jsx("div",{className:`log-line ${P.kind}`,children:P.text},le))})]}),k.jsxs("div",{className:"maint-card",children:[k.jsx("h3",{children:"文件监听 · Watch"}),k.jsx("p",{children:"监听 raw/ 目录,新增文件自动编译为 wiki。"}),k.jsxs("div",{className:"toggle-row",children:[k.jsx("span",{className:"cell-meta",children:"监听状态"}),k.jsx("div",{className:`toggle ${w?"on":""}`,onClick:X})]})]}),k.jsxs("div",{className:"maint-card",children:[k.jsx("h3",{children:"知识库状态"}),k.jsx("p",{children:"目录结构与索引概况。"}),k.jsxs("div",{className:"maint-log",children:[Object.entries(fe).map(([P,le])=>k.jsxs("div",{className:"log-line",children:[P,":",le," 篇"]},P)),L&&k.jsxs("div",{className:"log-line",children:["原始文件:",L.raw_count]}),L&&k.jsxs("div",{className:"log-line",children:["已索引:",L.total_indexed]}),(L==null?void 0:L.last_compile)&&k.jsxs("div",{className:"log-line ok",children:["上次编译:",Ip(L.last_compile)]}),(L==null?void 0:L.last_lint)&&k.jsxs("div",{className:"log-line ok",children:["上次检查:",Ip(L.last_lint)]})]})]})]})}const Q0={overview:"概览",documents:"文档管理",query:"查询",chat:"对话",maintenance:"维护"};function Z0(){const{kb:e,view:i,setKbs:r,setKb:l,kbs:s,setSidebarOpen:c,setSettingsOpen:u,toastMsg:d}=Kn(),p=ue.useCallback(async()=>{if($p())try{const g=await jt.listKbs();r(g.knowledge_bases||[]),l(y=>{var E,b;return y||(((b=(E=g.knowledge_bases)==null?void 0:E[0])==null?void 0:b.name)??null)})}catch{r([])}},[r,l]);ue.useEffect(()=>{p();function g(){p()}function y(b){d(b.detail.message,b.detail.kind)}function E(){u(!0)}return window.addEventListener("openkb:reload-kbs",g),window.addEventListener("openkb:toast",y),window.addEventListener("openkb:unauthorized",E),()=>{window.removeEventListener("openkb:reload-kbs",g),window.removeEventListener("openkb:toast",y),window.removeEventListener("openkb:unauthorized",E)}},[p,d,u]);function m(){return e?i==="overview"?k.jsx(Ty,{kb:e}):i==="documents"?k.jsx(Oy,{kb:e}):i==="query"?k.jsx(V0,{kb:e}):i==="chat"?k.jsx(q0,{kb:e}):i==="maintenance"?k.jsx(Y0,{kb:e}):null:k.jsxs("div",{className:"empty-state",children:[k.jsx("h3",{children:"未选择知识库"}),k.jsx("p",{children:"请在左侧选择或新建一个知识库。"})]})}return k.jsxs("div",{className:"app",children:[k.jsx("button",{className:"mobile-menu-btn",onClick:()=>c(!0),"aria-label":"菜单",children:k.jsx(hy,{size:20})}),k.jsx(xy,{}),k.jsxs("main",{className:"workspace",children:[k.jsx("header",{className:"ws-header",children:k.jsx("h1",{className:"ws-title",children:Q0[i]})}),k.jsx("section",{className:"ws-body",children:m()})]}),k.jsx(Sy,{}),k.jsx(Ny,{}),k.jsx(Cy,{})]})}function X0(){return k.jsx(ky,{children:k.jsx(Z0,{})})}document.title="OpenKB · 知识工作台";ay.createRoot(document.getElementById("root")).render(k.jsx(ey.StrictMode,{children:k.jsx(X0,{})})); diff --git a/web/assets/index-I-GkV6Af.css b/web/assets/index-I-GkV6Af.css new file mode 100644 index 000000000..544e74b54 --- /dev/null +++ b/web/assets/index-I-GkV6Af.css @@ -0,0 +1 @@ +:root{--bg: #0e1015;--bg-1: #14171f;--bg-2: #1a1e28;--bg-3: #222734;--border: #2a2f3c;--border-soft: #232834;--text: #e7eaf0;--text-2: #9aa3b2;--text-3: #6b7280;--accent: #5b8def;--accent-soft: rgba(91, 141, 239, .14);--cyan: #22d3ee;--green: #34d399;--amber: #fbbf24;--red: #f87171;--purple: #a78bfa;--radius: 10px;--radius-sm: 7px;--shadow: 0 8px 30px rgba(0, 0, 0, .35);--font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;--mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, monospace}*{box-sizing:border-box;margin:0;padding:0}html,body,#root{height:100%}body{font-family:var(--font);background:var(--bg);color:var(--text);font-size:14px;line-height:1.55;letter-spacing:0;-webkit-font-smoothing:antialiased}.app{display:grid;grid-template-columns:232px 1fr 340px;height:100vh;overflow:hidden}.hidden{display:none!important}button{font-family:inherit;cursor:pointer;border:none;background:none;color:inherit}input,textarea,select{font-family:inherit;font-size:14px}svg{display:block;flex-shrink:0}a{color:var(--accent)}.sidebar{background:var(--bg-1);border-right:1px solid var(--border);display:flex;flex-direction:column;padding:16px 12px;gap:16px;min-height:0}.brand{display:flex;align-items:center;gap:9px;padding:2px 6px}.brand-mark{width:26px;height:26px;border-radius:7px;background:linear-gradient(135deg,var(--accent),var(--cyan));color:#fff;font-weight:700;font-size:12px;display:grid;place-items:center;letter-spacing:.5px}.brand-name{font-weight:600;font-size:15px}.kb-switcher{position:relative}.kb-current{width:100%;display:flex;align-items:center;gap:9px;padding:9px 10px;border-radius:var(--radius-sm);background:var(--bg-2);border:1px solid var(--border);transition:background .15s}.kb-current:hover{background:var(--bg-3)}.kb-current-dot{width:7px;height:7px;border-radius:50%;background:var(--green);flex-shrink:0;box-shadow:0 0 8px var(--green)}.kb-current-name{flex:1;text-align:left;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.kb-current .kb-chev{color:var(--text-2)}.kb-menu{position:absolute;top:calc(100% + 6px);left:0;right:0;z-index:40;background:var(--bg-2);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);padding:6px;max-height:320px;overflow-y:auto}.kb-menu-item{width:100%;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 10px;border-radius:var(--radius-sm);text-align:left;transition:background .15s}.kb-menu-item:hover{background:var(--bg-3)}.kb-menu-item.active{background:var(--accent-soft);color:var(--accent)}.kb-menu-item .mi-name{font-weight:500}.kb-menu-item .mi-meta{font-size:11px;color:var(--text-3)}.kb-menu-item.active .mi-meta{color:var(--accent);opacity:.8}.kb-menu-new{width:100%;display:flex;align-items:center;gap:7px;padding:8px 10px;border-radius:var(--radius-sm);color:var(--accent);border-top:1px solid var(--border-soft);margin-top:4px;font-weight:500}.kb-menu-new:hover{background:var(--bg-3)}.kb-menu-new:disabled{opacity:.5;cursor:not-allowed}.nav{display:flex;flex-direction:column;gap:2px;flex:1;min-height:0}.nav-item{display:flex;align-items:center;gap:10px;padding:9px 11px;border-radius:var(--radius-sm);text-align:left;color:var(--text-2);font-weight:500;transition:background .15s,color .15s}.nav-item:hover{background:var(--bg-2);color:var(--text)}.nav-item.active{background:var(--accent-soft);color:var(--accent)}.sidebar-foot{display:flex;justify-content:flex-end}.icon-btn{display:grid;place-items:center;width:32px;height:32px;border-radius:var(--radius-sm);color:var(--text-2);transition:background .15s,color .15s}.icon-btn:hover{background:var(--bg-2);color:var(--text)}.workspace{display:flex;flex-direction:column;min-width:0;min-height:0;background:var(--bg)}.ws-header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:18px 28px;border-bottom:1px solid var(--border);flex-shrink:0}.ws-title{font-size:19px;font-weight:650;letter-spacing:-.01em}.ws-body{flex:1;overflow-y:auto;padding:24px 28px 40px}.inspector{background:var(--bg-1);border-left:1px solid var(--border);display:flex;flex-direction:column;min-height:0}.insp-head{display:flex;align-items:center;justify-content:space-between;padding:16px 18px;border-bottom:1px solid var(--border);flex-shrink:0}.insp-title{font-weight:600;font-size:13px}.insp-status{font-size:12px;color:var(--text-3)}.insp-status.busy{color:var(--cyan)}.insp-body{flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:8px}.insp-empty{color:var(--text-3);font-size:13px;text-align:center;margin:auto;line-height:1.7}.timeline-item{background:var(--bg-2);border:1px solid var(--border-soft);border-radius:var(--radius-sm);padding:10px 12px;font-size:13px;animation:fadein .2s ease}.timeline-item.tool{border-left:2px solid var(--cyan)}.timeline-item.done{border-left-color:var(--green)}.timeline-item.error{border-left-color:var(--red)}.timeline-item.start{border-left:2px solid var(--accent)}.timeline-item .tl-tag{font-size:11px;font-weight:600;color:var(--cyan);text-transform:uppercase;letter-spacing:.04em;margin-bottom:4px;display:block}.timeline-item.done .tl-tag{color:var(--green)}.timeline-item.error .tl-tag{color:var(--red)}.timeline-item.start .tl-tag{color:var(--accent)}.timeline-item .tl-body{color:var(--text-2);word-break:break-word}.timeline-item .tl-body code{font-family:var(--mono);font-size:11px;background:var(--bg-3);padding:1px 5px;border-radius:4px}@keyframes fadein{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.btn{display:inline-flex;align-items:center;gap:7px;justify-content:center;padding:8px 14px;border-radius:var(--radius-sm);font-weight:550;font-size:13px;border:1px solid var(--border);background:var(--bg-2);color:var(--text);transition:background .15s,border-color .15s,opacity .15s}.btn:hover{background:var(--bg-3)}.btn:disabled{opacity:.5;cursor:not-allowed}.btn-primary{background:var(--accent);border-color:var(--accent);color:#fff}.btn-primary:hover{background:#4f80e6}.btn-ghost{background:transparent;border-color:var(--border)}.btn-ghost:hover{background:var(--bg-2)}.btn-danger{background:transparent;border-color:var(--border);color:var(--red)}.btn-danger:hover{background:#f871711a;border-color:var(--red)}.btn-sm{padding:5px 10px;font-size:12px}.stat-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:24px}.stat-card{background:var(--bg-1);border:1px solid var(--border);border-radius:var(--radius);padding:18px}.stat-label{font-size:12px;color:var(--text-2);margin-bottom:8px}.stat-value{font-size:28px;font-weight:680;letter-spacing:-.02em}.stat-sub{font-size:11px;color:var(--text-3);margin-top:4px}.stat-card.accent .stat-value{color:var(--accent)}.stat-card.cyan .stat-value{color:var(--cyan)}.stat-card.green .stat-value{color:var(--green)}.stat-card.purple .stat-value{color:var(--purple)}.panel{background:var(--bg-1);border:1px solid var(--border);border-radius:var(--radius);margin-bottom:18px}.panel-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px;border-bottom:1px solid var(--border-soft)}.panel-title{font-weight:600;font-size:14px}.panel-body{padding:8px 0}.table{width:100%;border-collapse:collapse}.table th,.table td{text-align:left;padding:10px 16px;font-size:13px;border-bottom:1px solid var(--border-soft)}.table th{color:var(--text-2);font-weight:550;font-size:12px}.table tr:last-child td{border-bottom:none}.table tbody tr{transition:background .12s;cursor:default}.table tbody tr:hover{background:var(--bg-2)}.cell-name{font-weight:550}.cell-meta{color:var(--text-2);font-size:12px}.tag{display:inline-flex;align-items:center;gap:4px;font-size:11px;font-weight:550;padding:2px 8px;border-radius:20px;background:var(--bg-3);color:var(--text-2)}.tag.green{background:#34d39924;color:var(--green)}.tag.cyan{background:#22d3ee24;color:var(--cyan)}.tag.amber{background:#fbbf2424;color:var(--amber)}.tag.red{background:#f8717124;color:var(--red)}.tag.purple{background:#a78bfa24;color:var(--purple)}.icon-cell{display:inline-flex;align-items:center;gap:8px}.file-ico{width:28px;height:28px;border-radius:6px;background:var(--bg-3);display:grid;place-items:center;color:var(--text-2);font-size:10px;font-weight:600}.dropzone{border:1.5px dashed var(--border);border-radius:var(--radius);padding:26px;text-align:center;color:var(--text-2);transition:border-color .15s,background .15s;cursor:pointer;margin-bottom:18px}.dropzone:hover,.dropzone.drag{border-color:var(--accent);background:var(--accent-soft);color:var(--text)}.dropzone .dz-title{font-weight:550;margin-bottom:4px;color:var(--text)}.upload-item{display:flex;align-items:center;gap:10px;padding:8px 16px;font-size:13px}.upload-item .up-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.progress{height:4px;background:var(--bg-3);border-radius:4px;overflow:hidden;flex:1}.progress>span{display:block;height:100%;background:var(--accent);transition:width .3s}.qa-wrap{display:flex;flex-direction:column;height:100%;gap:16px}.qa-input-bar{display:flex;gap:10px;flex-shrink:0;align-items:flex-end}.qa-input{flex:1;background:var(--bg-1);border:1px solid var(--border);border-radius:var(--radius);padding:12px 14px;color:var(--text);resize:none;min-height:46px;transition:border-color .15s}.qa-input:focus{outline:none;border-color:var(--accent)}.qa-stream{flex:1;overflow-y:auto}.msg{margin-bottom:18px;animation:fadein .2s ease}.msg-role{font-size:12px;font-weight:600;color:var(--text-2);margin-bottom:6px;display:flex;align-items:center;gap:7px}.msg-role .role-dot{width:6px;height:6px;border-radius:50%;background:var(--accent)}.msg-role.user .role-dot{background:var(--text-2)}.msg-bubble{background:var(--bg-1);border:1px solid var(--border);border-radius:var(--radius);padding:14px 16px}.msg-bubble.user{background:var(--accent-soft);border-color:transparent}.spinner-wrap{display:inline-flex;align-items:center;gap:8px}.chat-sessions{display:flex;flex-direction:column;gap:2px;max-height:160px;overflow-y:auto;flex-shrink:0}.session-item{padding:7px 10px;border-radius:var(--radius-sm);font-size:12px;color:var(--text-2);text-align:left;display:flex;gap:8px;align-items:center;justify-content:space-between}.session-item:hover{background:var(--bg-2);color:var(--text)}.session-item.active{background:var(--accent-soft);color:var(--accent)}.session-title{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-del{color:var(--text-3);flex-shrink:0;opacity:0;transition:opacity .15s}.session-item:hover .session-del{opacity:1}.session-del:hover{color:var(--red)}.md{font-size:14px;line-height:1.65;color:var(--text);word-break:break-word}.md>:first-child{margin-top:0}.md>:last-child{margin-bottom:0}.md p{margin:0 0 10px}.md h1,.md h2,.md h3,.md h4{margin:16px 0 8px;font-weight:650;line-height:1.3}.md h1{font-size:18px}.md h2{font-size:16px}.md h3{font-size:15px}.md h4{font-size:14px}.md ul,.md ol{margin:0 0 10px;padding-left:22px}.md li{margin:2px 0}.md a{color:var(--accent);text-decoration:none}.md a:hover{text-decoration:underline}.md code{font-family:var(--mono);font-size:12.5px;background:var(--bg-3);padding:1px 6px;border-radius:4px;color:var(--cyan)}.md pre{background:var(--bg);border:1px solid var(--border-soft);border-radius:var(--radius-sm);padding:12px 14px;overflow-x:auto;margin:8px 0}.md pre code{background:none;padding:0;color:var(--text);font-size:12.5px;line-height:1.5}.md blockquote{border-left:3px solid var(--border);margin:8px 0;padding:4px 14px;color:var(--text-2)}.md table{border-collapse:collapse;margin:8px 0;width:100%;font-size:13px}.md th,.md td{border:1px solid var(--border);padding:6px 10px;text-align:left}.md th{background:var(--bg-2);font-weight:600}.md hr{border:none;border-top:1px solid var(--border);margin:14px 0}.md img{max-width:100%;border-radius:var(--radius-sm)}.md input[type=checkbox]{margin-right:6px;accent-color:var(--accent)}.maint-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.maint-card{background:var(--bg-1);border:1px solid var(--border);border-radius:var(--radius);padding:18px}.maint-card h3{font-size:14px;font-weight:600;margin-bottom:4px}.maint-card p{font-size:12.5px;color:var(--text-2);margin-bottom:14px}.maint-log{background:var(--bg);border:1px solid var(--border-soft);border-radius:var(--radius-sm);padding:12px 14px;font-family:var(--mono);font-size:12px;color:var(--text-2);max-height:240px;overflow-y:auto;margin-top:12px;white-space:pre-wrap}.maint-log .log-line{padding:1px 0}.maint-log .log-line.ok{color:var(--green)}.maint-log .log-line.warn{color:var(--amber)}.maint-log .log-line.err{color:var(--red)}.toggle-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.toggle{position:relative;width:38px;height:22px;background:var(--bg-3);border-radius:20px;cursor:pointer;transition:background .18s;flex-shrink:0}.toggle:after{content:"";position:absolute;top:2px;left:2px;width:18px;height:18px;background:var(--text);border-radius:50%;transition:transform .18s}.toggle.on{background:var(--green)}.toggle.on:after{transform:translate(16px)}.overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#08090ca6;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);display:grid;place-items:center;z-index:100}.modal{background:var(--bg-1);border:1px solid var(--border);border-radius:var(--radius);width:420px;max-width:92vw;box-shadow:var(--shadow)}.modal-head{display:flex;align-items:center;justify-content:space-between;padding:16px 18px;border-bottom:1px solid var(--border-soft)}.modal-head h2{font-size:16px;font-weight:650}.modal-body{padding:18px;display:flex;flex-direction:column;gap:14px}.modal-foot{display:flex;justify-content:flex-end;gap:10px;padding:14px 18px;border-top:1px solid var(--border-soft)}.field{display:flex;flex-direction:column;gap:6px}.field-label{font-size:12px;color:var(--text-2);font-weight:550}.field input,.field textarea,.field select{background:var(--bg-2);border:1px solid var(--border);border-radius:var(--radius-sm);padding:9px 11px;color:var(--text);transition:border-color .15s}.field input:focus,.field textarea:focus{outline:none;border-color:var(--accent)}.field-hint{font-size:11px;color:var(--text-3)}.toast{position:fixed;bottom:24px;left:50%;transform:translate(-50%);background:var(--bg-3);border:1px solid var(--border);color:var(--text);padding:11px 18px;border-radius:var(--radius-sm);font-size:13px;box-shadow:var(--shadow);z-index:200;animation:fadein .2s ease}.toast.ok{border-color:var(--green)}.toast.err{border-color:var(--red)}.empty-state{text-align:center;color:var(--text-3);padding:60px 20px}.empty-state svg{margin:0 auto 14px;color:var(--text-3)}.empty-state h3{font-size:15px;font-weight:600;margin-bottom:6px;color:var(--text-2)}.empty-state p{font-size:13px}.spinner{width:18px;height:18px;border:2px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:spin .7s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.concept-chips{display:flex;flex-wrap:wrap;gap:6px;padding:14px 16px}.concept-chip{font-size:12px;padding:4px 11px;border-radius:20px;background:var(--bg-2);border:1px solid var(--border-soft);color:var(--text-2);cursor:pointer;transition:background .15s,color .15s}.concept-chip:hover{background:var(--accent-soft);color:var(--accent);border-color:transparent}.row-actions{display:flex;gap:6px;justify-content:flex-end}.select{background:var(--bg-2);border:1px solid var(--border);border-radius:var(--radius-sm);padding:8px 11px;color:var(--text);font-size:13px}.select:focus{outline:none;border-color:var(--accent)}.mobile-menu-btn,.sidebar-overlay{display:none}@media(max-width:960px){.app{grid-template-columns:1fr}.sidebar{position:fixed;top:0;left:0;bottom:0;width:232px;z-index:60;transform:translate(-100%);transition:transform .22s ease}.sidebar.open{transform:translate(0)}.sidebar-overlay{display:block;position:fixed;top:0;right:0;bottom:0;left:0;background:#00000080;z-index:55}.mobile-menu-btn{display:grid;place-items:center;position:fixed;top:14px;left:14px;z-index:50;width:38px;height:38px;border-radius:var(--radius-sm);background:var(--bg-2);border:1px solid var(--border);color:var(--text)}.workspace{padding-top:44px}.inspector{display:none}.stat-grid{grid-template-columns:repeat(2,1fr)}.maint-grid{grid-template-columns:1fr}.ws-header{padding:14px 20px 14px 64px}.ws-body{padding:18px 20px 32px}}::-webkit-scrollbar{width:9px;height:9px}::-webkit-scrollbar-thumb{background:var(--bg-3);border-radius:8px;border:2px solid transparent;background-clip:padding-box}::-webkit-scrollbar-thumb:hover{background:#2e3445}::-webkit-scrollbar-track{background:transparent} diff --git a/web/index.html b/web/index.html new file mode 100644 index 000000000..0587d8cbc --- /dev/null +++ b/web/index.html @@ -0,0 +1,14 @@ +<!doctype html> +<html lang="zh-CN"> + <head> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <title>OpenKB · 知识工作台 + + + + + +
+ + \ No newline at end of file From 3d3e0862faecb8109e930c80ec3e5938ce160800 Mon Sep 17 00:00:00 2001 From: jidechao <408645320@qq.com> Date: Mon, 29 Jun 2026 21:00:24 +0800 Subject: [PATCH 2/3] =?UTF-8?q?chore:=20address=20PR=20#150=20review=20?= =?UTF-8?q?=E2=80=94=20revert=20config=20defaults,=20strip=20BOM,=20unvend?= =?UTF-8?q?or=20web/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - config.yaml.example: restore gpt-5.4 / en (unintentional flip to local dev values openai/deepseek-v4-flash / zh) - openkb/cli.py, tests/test_api.py: remove stray UTF-8 BOM - web/: stop vendoring the built bundle; add web/ to .gitignore; README notes the Workbench UI requires `npm run build` (API-only otherwise) Refs: PR #150 --- .gitignore | 3 + README.md | 2 + config.yaml.example | 4 +- openkb/cli.py | 2 +- tests/test_api.py | 2 +- web/assets/index-B95kof3N.js | 171 ---------------------------------- web/assets/index-I-GkV6Af.css | 1 - web/index.html | 14 --- 8 files changed, 9 insertions(+), 190 deletions(-) delete mode 100644 web/assets/index-B95kof3N.js delete mode 100644 web/assets/index-I-GkV6Af.css delete mode 100644 web/index.html diff --git a/.gitignore b/.gitignore index 28f24bb59..cd334f0b6 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,6 @@ kbs/ # Local only docs/ .claude/ + +# Built Workbench web bundle (regenerate with `cd frontend && npm install && npm run build`) +web/ diff --git a/README.md b/README.md index 333d91f99..055277d76 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,8 @@ pip install -e ".[api]" python -m openkb.api --host 127.0.0.1 --port 8000 # serves the API + Workbench at http://127.0.0.1:8000/ ``` +> **No build, no UI.** If you skip `npm run build`, the `web/` bundle is absent and `openkb-api` serves only the REST API under `/api/v1` — visiting `/` returns a 404. The Workbench web UI appears only after you build `frontend/` at least once. + Open `http://127.0.0.1:8000/` in your browser. On first launch a **Connection Settings** dialog asks for the API base (leave blank for same-origin) and the bearer token. The Workbench then provides: - **Overview** — index/concept/summary/report stat cards, clickable concept chips, recent documents, and last-compile/lint activity. diff --git a/config.yaml.example b/config.yaml.example index df239c6a4..eebf3bf64 100644 --- a/config.yaml.example +++ b/config.yaml.example @@ -1,5 +1,5 @@ -model: openai/deepseek-v4-flash # LLM model (any LiteLLM-supported provider) -language: zh # Wiki output language +model: gpt-5.4 # LLM model (any LiteLLM-supported provider) +language: en # Wiki output language pageindex_threshold: 20 # PDF pages threshold for PageIndex # Optional: override the entity-type vocabulary used for entity pages. diff --git a/openkb/cli.py b/openkb/cli.py index b4e3364c6..927e80417 100644 --- a/openkb/cli.py +++ b/openkb/cli.py @@ -1,4 +1,4 @@ -"""OpenKB CLI — command-line interface for the knowledge base workflow.""" +"""OpenKB CLI — command-line interface for the knowledge base workflow.""" from __future__ import annotations # Silence import-time warnings (e.g. pydub's missing-ffmpeg warning emitted diff --git a/tests/test_api.py b/tests/test_api.py index e3c21c0bd..4d4c9cd07 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -1,4 +1,4 @@ -from __future__ import annotations +from __future__ import annotations import json from typing import Any diff --git a/web/assets/index-B95kof3N.js b/web/assets/index-B95kof3N.js deleted file mode 100644 index fb275e561..000000000 --- a/web/assets/index-B95kof3N.js +++ /dev/null @@ -1,171 +0,0 @@ -(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))l(s);new MutationObserver(s=>{for(const c of s)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&l(u)}).observe(document,{childList:!0,subtree:!0});function r(s){const c={};return s.integrity&&(c.integrity=s.integrity),s.referrerPolicy&&(c.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?c.credentials="include":s.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function l(s){if(s.ep)return;s.ep=!0;const c=r(s);fetch(s.href,c)}})();function Mo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ys={exports:{}},ko={},Qs={exports:{}},Fe={};/** - * @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 vf;function Zg(){if(vf)return Fe;vf=1;var e=Symbol.for("react.element"),i=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.iterator;function E(O){return O===null||typeof O!="object"?null:(O=y&&O[y]||O["@@iterator"],typeof O=="function"?O:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,C={};function T(O,j,S){this.props=O,this.context=j,this.refs=C,this.updater=S||b}T.prototype.isReactComponent={},T.prototype.setState=function(O,j){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,j,"setState")},T.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function w(){}w.prototype=T.prototype;function F(O,j,S){this.props=O,this.context=j,this.refs=C,this.updater=S||b}var L=F.prototype=new w;L.constructor=F,x(L,T.prototype),L.isPureReactComponent=!0;var $=Array.isArray,K=Object.prototype.hasOwnProperty,I={current:null},Z={key:!0,ref:!0,__self:!0,__source:!0};function G(O,j,S){var we,Me={},ke=null,$e=null;if(j!=null)for(we in j.ref!==void 0&&($e=j.ref),j.key!==void 0&&(ke=""+j.key),j)K.call(j,we)&&!Z.hasOwnProperty(we)&&(Me[we]=j[we]);var De=arguments.length-2;if(De===1)Me.children=S;else if(1>>1,j=W[O];if(0>>1;Os(Me,v))kes($e,Me)?(W[O]=$e,W[ke]=v,O=ke):(W[O]=Me,W[we]=v,O=we);else if(kes($e,v))W[O]=$e,W[ke]=v,O=ke;else break e}}return de}function s(W,de){var v=W.sortIndex-de.sortIndex;return v!==0?v:W.id-de.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var p=[],m=[],g=1,y=null,E=3,b=!1,x=!1,C=!1,T=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function L(W){for(var de=r(m);de!==null;){if(de.callback===null)l(m);else if(de.startTime<=W)l(m),de.sortIndex=de.expirationTime,i(p,de);else break;de=r(m)}}function $(W){if(C=!1,L(W),!x)if(r(p)!==null)x=!0,le(K);else{var de=r(m);de!==null&&ae($,de.startTime-W)}}function K(W,de){x=!1,C&&(C=!1,w(G),G=-1),b=!0;var v=E;try{for(L(de),y=r(p);y!==null&&(!(y.expirationTime>de)||W&&!ne());){var O=y.callback;if(typeof O=="function"){y.callback=null,E=y.priorityLevel;var j=O(y.expirationTime<=de);de=e.unstable_now(),typeof j=="function"?y.callback=j:y===r(p)&&l(p),L(de)}else l(p);y=r(p)}if(y!==null)var S=!0;else{var we=r(m);we!==null&&ae($,we.startTime-de),S=!1}return S}finally{y=null,E=v,b=!1}}var I=!1,Z=null,G=-1,te=5,D=-1;function ne(){return!(e.unstable_now()-DW||125O?(W.sortIndex=v,i(m,W),r(p)===null&&W===r(m)&&(C?(w(G),G=-1):C=!0,ae($,v-O))):(W.sortIndex=j,i(p,W),x||b||(x=!0,le(K))),W},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(W){var de=E;return function(){var v=E;E=de;try{return W.apply(this,arguments)}finally{E=v}}}})(Js)),Js}var Nf;function ny(){return Nf||(Nf=1,Xs.exports=ty()),Xs.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 Cf;function ry(){if(Cf)return Zt;Cf=1;var e=Du(),i=ny();function r(t){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+t,o=1;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,m=/^[: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]*$/,g={},y={};function E(t){return p.call(y,t)?!0:p.call(g,t)?!1:m.test(t)?y[t]=!0:(g[t]=!0,!1)}function b(t,n,o,a){if(o!==null&&o.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return a?!1:o!==null?!o.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function x(t,n,o,a){if(n===null||typeof n>"u"||b(t,n,o,a))return!0;if(a)return!1;if(o!==null)switch(o.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function C(t,n,o,a,f,h,_){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=a,this.attributeNamespace=f,this.mustUseProperty=o,this.propertyName=t,this.type=n,this.sanitizeURL=h,this.removeEmptyString=_}var T={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){T[t]=new C(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var n=t[0];T[n]=new C(n,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){T[t]=new C(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){T[t]=new C(t,2,!1,t,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(t){T[t]=new C(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){T[t]=new C(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){T[t]=new C(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){T[t]=new C(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){T[t]=new C(t,5,!1,t.toLowerCase(),null,!1,!1)});var w=/[\-:]([a-z])/g;function F(t){return t[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(t){var n=t.replace(w,F);T[n]=new C(n,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var n=t.replace(w,F);T[n]=new C(n,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var n=t.replace(w,F);T[n]=new C(n,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){T[t]=new C(t,1,!1,t.toLowerCase(),null,!1,!1)}),T.xlinkHref=new C("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){T[t]=new C(t,1,!1,t.toLowerCase(),null,!0,!0)});function L(t,n,o,a){var f=T.hasOwnProperty(n)?T[n]:null;(f!==null?f.type!==0:a||!(2N||f[_]!==h[N]){var R=` -`+f[_].replace(" at new "," at ");return t.displayName&&R.includes("")&&(R=R.replace("",t.displayName)),R}while(1<=_&&0<=N);break}}}finally{S=!1,Error.prepareStackTrace=o}return(t=t?t.displayName||t.name:"")?j(t):""}function Me(t){switch(t.tag){case 5:return j(t.type);case 16:return j("Lazy");case 13:return j("Suspense");case 19:return j("SuspenseList");case 0:case 2:case 15:return t=we(t.type,!1),t;case 11:return t=we(t.type.render,!1),t;case 1:return t=we(t.type,!0),t;default:return""}}function ke(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Z:return"Fragment";case I:return"Portal";case te:return"Profiler";case G:return"StrictMode";case fe:return"Suspense";case q:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case ne:return(t.displayName||"Context")+".Consumer";case D:return(t._context.displayName||"Context")+".Provider";case X:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case P:return n=t.displayName||null,n!==null?n:ke(t.type)||"Memo";case le:n=t._payload,t=t._init;try{return ke(t(n))}catch{}}return null}function $e(t){var n=t.type;switch(t.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=n.render,t=t.displayName||t.name||"",n.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ke(n);case 8:return n===G?"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 n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function De(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Ke(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Xe(t){var n=Ke(t)?"checked":"value",o=Object.getOwnPropertyDescriptor(t.constructor.prototype,n),a=""+t[n];if(!t.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var f=o.get,h=o.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return f.call(this)},set:function(_){a=""+_,h.call(this,_)}}),Object.defineProperty(t,n,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(_){a=""+_},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function en(t){t._valueTracker||(t._valueTracker=Xe(t))}function ar(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var o=n.getValue(),a="";return t&&(a=Ke(t)?t.checked?"true":"false":t.value),t=a,t!==o?(n.setValue(t),!0):!1}function In(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Wn(t,n){var o=n.checked;return v({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??t._wrapperState.initialChecked})}function Vn(t,n){var o=n.defaultValue==null?"":n.defaultValue,a=n.checked!=null?n.checked:n.defaultChecked;o=De(n.value!=null?n.value:o),t._wrapperState={initialChecked:a,initialValue:o,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Ge(t,n){n=n.checked,n!=null&&L(t,"checked",n,!1)}function tn(t,n){Ge(t,n);var o=De(n.value),a=n.type;if(o!=null)a==="number"?(o===0&&t.value===""||t.value!=o)&&(t.value=""+o):t.value!==""+o&&(t.value=""+o);else if(a==="submit"||a==="reset"){t.removeAttribute("value");return}n.hasOwnProperty("value")?Mn(t,n.type,o):n.hasOwnProperty("defaultValue")&&Mn(t,n.type,De(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(t.defaultChecked=!!n.defaultChecked)}function un(t,n,o){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var a=n.type;if(!(a!=="submit"&&a!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+t._wrapperState.initialValue,o||n===t.value||(t.value=n),t.defaultValue=n}o=t.name,o!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,o!==""&&(t.name=o)}function Mn(t,n,o){(n!=="number"||In(t.ownerDocument)!==t)&&(o==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+o&&(t.defaultValue=""+o))}var _n=Array.isArray;function Ln(t,n,o,a){if(t=t.options,n){n={};for(var f=0;f"+n.valueOf().toString()+"",n=Te.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;n.firstChild;)t.appendChild(n.firstChild)}});function je(t,n){if(n){var o=t.firstChild;if(o&&o===t.lastChild&&o.nodeType===3){o.nodeValue=n;return}}t.textContent=n}var _t={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},vn=["Webkit","ms","Moz","O"];Object.keys(_t).forEach(function(t){vn.forEach(function(n){n=n+t.charAt(0).toUpperCase()+t.substring(1),_t[n]=_t[t]})});function Gt(t,n,o){return n==null||typeof n=="boolean"||n===""?"":o||typeof n!="number"||n===0||_t.hasOwnProperty(t)&&_t[t]?(""+n).trim():n+"px"}function kn(t,n){t=t.style;for(var o in n)if(n.hasOwnProperty(o)){var a=o.indexOf("--")===0,f=Gt(o,n[o],a);o==="float"&&(o="cssFloat"),a?t.setProperty(o,f):t[o]=f}}var qn=v({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 vt(t,n){if(n){if(qn[t]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(r(137,t));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(r(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(r(61))}if(n.style!=null&&typeof n.style!="object")throw Error(r(62))}}function dn(t,n){if(t.indexOf("-")===-1)return typeof n.is=="string";switch(t){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 Tt=null;function oi(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var li=null,sr=null,Yn=null;function Qn(t){if(t=lo(t)){if(typeof li!="function")throw Error(r(280));var n=t.stateNode;n&&(n=ll(n),li(t.stateNode,t.type,n))}}function A(t){sr?Yn?Yn.push(t):Yn=[t]:sr=t}function V(){if(sr){var t=sr,n=Yn;if(Yn=sr=null,Qn(t),n)for(t=0;t>>=0,t===0?32:31-(Pn(t)/ui|0)|0}var Ft=64,Pr=4194304;function cr(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function zr(t,n){var o=t.pendingLanes;if(o===0)return 0;var a=0,f=t.suspendedLanes,h=t.pingedLanes,_=o&268435455;if(_!==0){var N=_&~f;N!==0?a=cr(N):(h&=_,h!==0&&(a=cr(h)))}else _=o&~f,_!==0?a=cr(_):h!==0&&(a=cr(h));if(a===0)return 0;if(n!==0&&n!==a&&(n&f)===0&&(f=a&-a,h=n&-n,f>=h||f===16&&(h&4194240)!==0))return n;if((a&4)!==0&&(a|=o&16),n=t.entangledLanes,n!==0)for(t=t.entanglements,n&=a;0o;o++)n.push(t);return n}function fr(t,n,o){t.pendingLanes|=n,n!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,n=31-ut(n),t[n]=o}function fn(t,n){var o=t.pendingLanes&~n;t.pendingLanes=n,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=n,t.mutableReadLanes&=n,t.entangledLanes&=n,n=t.entanglements;var a=t.eventTimes;for(t=t.expirationTimes;0=Zi),pc=" ",mc=!1;function hc(t,n){switch(t){case"keyup":return Wh.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gc(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var fi=!1;function qh(t,n){switch(t){case"compositionend":return gc(n);case"keypress":return n.which!==32?null:(mc=!0,pc);case"textInput":return t=n.data,t===pc&&mc?null:t;default:return null}}function Yh(t,n){if(fi)return t==="compositionend"||!Aa&&hc(t,n)?(t=ac(),Yo=wa=mr=null,fi=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:o,offset:n-t};t=a}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=wc(o)}}function Sc(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Sc(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Nc(){for(var t=window,n=In();n instanceof t.HTMLIFrameElement;){try{var o=typeof n.contentWindow.location.href=="string"}catch{o=!1}if(o)t=n.contentWindow;else break;n=In(t.document)}return n}function Ia(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}function ig(t){var n=Nc(),o=t.focusedElem,a=t.selectionRange;if(n!==o&&o&&o.ownerDocument&&Sc(o.ownerDocument.documentElement,o)){if(a!==null&&Ia(o)){if(n=a.start,t=a.end,t===void 0&&(t=n),"selectionStart"in o)o.selectionStart=n,o.selectionEnd=Math.min(t,o.value.length);else if(t=(n=o.ownerDocument||document)&&n.defaultView||window,t.getSelection){t=t.getSelection();var f=o.textContent.length,h=Math.min(a.start,f);a=a.end===void 0?h:Math.min(a.end,f),!t.extend&&h>a&&(f=a,a=h,h=f),f=xc(o,h);var _=xc(o,a);f&&_&&(t.rangeCount!==1||t.anchorNode!==f.node||t.anchorOffset!==f.offset||t.focusNode!==_.node||t.focusOffset!==_.offset)&&(n=n.createRange(),n.setStart(f.node,f.offset),t.removeAllRanges(),h>a?(t.addRange(n),t.extend(_.node,_.offset)):(n.setEnd(_.node,_.offset),t.addRange(n)))}}for(n=[],t=o;t=t.parentNode;)t.nodeType===1&&n.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o=document.documentMode,pi=null,Ma=null,to=null,La=!1;function Cc(t,n,o){var a=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;La||pi==null||pi!==In(a)||(a=pi,"selectionStart"in a&&Ia(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),to&&eo(to,a)||(to=a,a=rl(Ma,"onSelect"),0bi||(t.current=Wa[bi],Wa[bi]=null,bi--)}function nt(t,n){bi++,Wa[bi]=t.current,t.current=n}var br={},Ot=yr(br),Wt=yr(!1),$r=br;function Ei(t,n){var o=t.type.contextTypes;if(!o)return br;var a=t.stateNode;if(a&&a.__reactInternalMemoizedUnmaskedChildContext===n)return a.__reactInternalMemoizedMaskedChildContext;var f={},h;for(h in o)f[h]=n[h];return a&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=n,t.__reactInternalMemoizedMaskedChildContext=f),f}function Vt(t){return t=t.childContextTypes,t!=null}function al(){ot(Wt),ot(Ot)}function jc(t,n,o){if(Ot.current!==br)throw Error(r(168));nt(Ot,n),nt(Wt,o)}function Hc(t,n,o){var a=t.stateNode;if(n=n.childContextTypes,typeof a.getChildContext!="function")return o;a=a.getChildContext();for(var f in a)if(!(f in n))throw Error(r(108,$e(t)||"Unknown",f));return v({},o,a)}function sl(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||br,$r=Ot.current,nt(Ot,t),nt(Wt,Wt.current),!0}function Kc(t,n,o){var a=t.stateNode;if(!a)throw Error(r(169));o?(t=Hc(t,n,$r),a.__reactInternalMemoizedMergedChildContext=t,ot(Wt),ot(Ot),nt(Ot,t)):ot(Wt),nt(Wt,o)}var Jn=null,ul=!1,Va=!1;function Gc(t){Jn===null?Jn=[t]:Jn.push(t)}function gg(t){ul=!0,Gc(t)}function Er(){if(!Va&&Jn!==null){Va=!0;var t=0,n=Ve;try{var o=Jn;for(Ve=1;t>=_,f-=_,er=1<<32-ut(n)+f|o<Oe?(Ct=Ne,Ne=null):Ct=Ne.sibling;var Ye=Y(z,Ne,B[Oe],ie);if(Ye===null){Ne===null&&(Ne=Ct);break}t&&Ne&&Ye.alternate===null&&n(z,Ne),M=h(Ye,M,Oe),Se===null?_e=Ye:Se.sibling=Ye,Se=Ye,Ne=Ct}if(Oe===B.length)return o(z,Ne),at&&Hr(z,Oe),_e;if(Ne===null){for(;OeOe?(Ct=Ne,Ne=null):Ct=Ne.sibling;var Tr=Y(z,Ne,Ye.value,ie);if(Tr===null){Ne===null&&(Ne=Ct);break}t&&Ne&&Tr.alternate===null&&n(z,Ne),M=h(Tr,M,Oe),Se===null?_e=Tr:Se.sibling=Tr,Se=Tr,Ne=Ct}if(Ye.done)return o(z,Ne),at&&Hr(z,Oe),_e;if(Ne===null){for(;!Ye.done;Oe++,Ye=B.next())Ye=J(z,Ye.value,ie),Ye!==null&&(M=h(Ye,M,Oe),Se===null?_e=Ye:Se.sibling=Ye,Se=Ye);return at&&Hr(z,Oe),_e}for(Ne=a(z,Ne);!Ye.done;Oe++,Ye=B.next())Ye=pe(Ne,z,Oe,Ye.value,ie),Ye!==null&&(t&&Ye.alternate!==null&&Ne.delete(Ye.key===null?Oe:Ye.key),M=h(Ye,M,Oe),Se===null?_e=Ye:Se.sibling=Ye,Se=Ye);return t&&Ne.forEach(function(Qg){return n(z,Qg)}),at&&Hr(z,Oe),_e}function gt(z,M,B,ie){if(typeof B=="object"&&B!==null&&B.type===Z&&B.key===null&&(B=B.props.children),typeof B=="object"&&B!==null){switch(B.$$typeof){case K:e:{for(var _e=B.key,Se=M;Se!==null;){if(Se.key===_e){if(_e=B.type,_e===Z){if(Se.tag===7){o(z,Se.sibling),M=f(Se,B.props.children),M.return=z,z=M;break e}}else if(Se.elementType===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===le&&Zc(_e)===Se.type){o(z,Se.sibling),M=f(Se,B.props),M.ref=ao(z,Se,B),M.return=z,z=M;break e}o(z,Se);break}else n(z,Se);Se=Se.sibling}B.type===Z?(M=Zr(B.props.children,z.mode,ie,B.key),M.return=z,z=M):(ie=zl(B.type,B.key,B.props,null,z.mode,ie),ie.ref=ao(z,M,B),ie.return=z,z=ie)}return _(z);case I:e:{for(Se=B.key;M!==null;){if(M.key===Se)if(M.tag===4&&M.stateNode.containerInfo===B.containerInfo&&M.stateNode.implementation===B.implementation){o(z,M.sibling),M=f(M,B.children||[]),M.return=z,z=M;break e}else{o(z,M);break}else n(z,M);M=M.sibling}M=Ks(B,z.mode,ie),M.return=z,z=M}return _(z);case le:return Se=B._init,gt(z,M,Se(B._payload),ie)}if(_n(B))return be(z,M,B,ie);if(de(B))return Ee(z,M,B,ie);pl(z,B)}return typeof B=="string"&&B!==""||typeof B=="number"?(B=""+B,M!==null&&M.tag===6?(o(z,M.sibling),M=f(M,B),M.return=z,z=M):(o(z,M),M=Hs(B,z.mode,ie),M.return=z,z=M),_(z)):o(z,M)}return gt}var wi=Xc(!0),Jc=Xc(!1),ml=yr(null),hl=null,xi=null,Ja=null;function es(){Ja=xi=hl=null}function ts(t){var n=ml.current;ot(ml),t._currentValue=n}function ns(t,n,o){for(;t!==null;){var a=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,a!==null&&(a.childLanes|=n)):a!==null&&(a.childLanes&n)!==n&&(a.childLanes|=n),t===o)break;t=t.return}}function Si(t,n){hl=t,Ja=xi=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&n)!==0&&(qt=!0),t.firstContext=null)}function hn(t){var n=t._currentValue;if(Ja!==t)if(t={context:t,memoizedValue:n,next:null},xi===null){if(hl===null)throw Error(r(308));xi=t,hl.dependencies={lanes:0,firstContext:t}}else xi=xi.next=t;return n}var Kr=null;function rs(t){Kr===null?Kr=[t]:Kr.push(t)}function ed(t,n,o,a){var f=n.interleaved;return f===null?(o.next=o,rs(n)):(o.next=f.next,f.next=o),n.interleaved=o,nr(t,a)}function nr(t,n){t.lanes|=n;var o=t.alternate;for(o!==null&&(o.lanes|=n),o=t,t=t.return;t!==null;)t.childLanes|=n,o=t.alternate,o!==null&&(o.childLanes|=n),o=t,t=t.return;return o.tag===3?o.stateNode:null}var _r=!1;function is(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function td(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function rr(t,n){return{eventTime:t,lane:n,tag:0,payload:null,callback:null,next:null}}function vr(t,n,o){var a=t.updateQueue;if(a===null)return null;if(a=a.shared,(qe&2)!==0){var f=a.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),a.pending=n,nr(t,o)}return f=a.interleaved,f===null?(n.next=n,rs(a)):(n.next=f.next,f.next=n),a.interleaved=n,nr(t,o)}function gl(t,n,o){if(n=n.updateQueue,n!==null&&(n=n.shared,(o&4194240)!==0)){var a=n.lanes;a&=t.pendingLanes,o|=a,n.lanes=o,Ki(t,o)}}function nd(t,n){var o=t.updateQueue,a=t.alternate;if(a!==null&&(a=a.updateQueue,o===a)){var f=null,h=null;if(o=o.firstBaseUpdate,o!==null){do{var _={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};h===null?f=h=_:h=h.next=_,o=o.next}while(o!==null);h===null?f=h=n:h=h.next=n}else f=h=n;o={baseState:a.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:a.shared,effects:a.effects},t.updateQueue=o;return}t=o.lastBaseUpdate,t===null?o.firstBaseUpdate=n:t.next=n,o.lastBaseUpdate=n}function yl(t,n,o,a){var f=t.updateQueue;_r=!1;var h=f.firstBaseUpdate,_=f.lastBaseUpdate,N=f.shared.pending;if(N!==null){f.shared.pending=null;var R=N,U=R.next;R.next=null,_===null?h=U:_.next=U,_=R;var Q=t.alternate;Q!==null&&(Q=Q.updateQueue,N=Q.lastBaseUpdate,N!==_&&(N===null?Q.firstBaseUpdate=U:N.next=U,Q.lastBaseUpdate=R))}if(h!==null){var J=f.baseState;_=0,Q=U=R=null,N=h;do{var Y=N.lane,pe=N.eventTime;if((a&Y)===Y){Q!==null&&(Q=Q.next={eventTime:pe,lane:0,tag:N.tag,payload:N.payload,callback:N.callback,next:null});e:{var be=t,Ee=N;switch(Y=n,pe=o,Ee.tag){case 1:if(be=Ee.payload,typeof be=="function"){J=be.call(pe,J,Y);break e}J=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Ee.payload,Y=typeof be=="function"?be.call(pe,J,Y):be,Y==null)break e;J=v({},J,Y);break e;case 2:_r=!0}}N.callback!==null&&N.lane!==0&&(t.flags|=64,Y=f.effects,Y===null?f.effects=[N]:Y.push(N))}else pe={eventTime:pe,lane:Y,tag:N.tag,payload:N.payload,callback:N.callback,next:null},Q===null?(U=Q=pe,R=J):Q=Q.next=pe,_|=Y;if(N=N.next,N===null){if(N=f.shared.pending,N===null)break;Y=N,N=Y.next,Y.next=null,f.lastBaseUpdate=Y,f.shared.pending=null}}while(!0);if(Q===null&&(R=J),f.baseState=R,f.firstBaseUpdate=U,f.lastBaseUpdate=Q,n=f.shared.interleaved,n!==null){f=n;do _|=f.lane,f=f.next;while(f!==n)}else h===null&&(f.shared.lanes=0);Vr|=_,t.lanes=_,t.memoizedState=J}}function rd(t,n,o){if(t=n.effects,n.effects=null,t!==null)for(n=0;no?o:4,t(!0);var a=us.transition;us.transition={};try{t(!1),n()}finally{Ve=o,us.transition=a}}function kd(){return gn().memoizedState}function _g(t,n,o){var a=Sr(t);if(o={lane:a,action:o,hasEagerState:!1,eagerState:null,next:null},wd(t))xd(n,o);else if(o=ed(t,n,o,a),o!==null){var f=Ut();An(o,t,a,f),Sd(o,n,a)}}function vg(t,n,o){var a=Sr(t),f={lane:a,action:o,hasEagerState:!1,eagerState:null,next:null};if(wd(t))xd(n,f);else{var h=t.alternate;if(t.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var _=n.lastRenderedState,N=h(_,o);if(f.hasEagerState=!0,f.eagerState=N,xn(N,_)){var R=n.interleaved;R===null?(f.next=f,rs(n)):(f.next=R.next,R.next=f),n.interleaved=f;return}}catch{}finally{}o=ed(t,n,f,a),o!==null&&(f=Ut(),An(o,t,a,f),Sd(o,n,a))}}function wd(t){var n=t.alternate;return t===dt||n!==null&&n===dt}function xd(t,n){fo=_l=!0;var o=t.pending;o===null?n.next=n:(n.next=o.next,o.next=n),t.pending=n}function Sd(t,n,o){if((o&4194240)!==0){var a=n.lanes;a&=t.pendingLanes,o|=a,n.lanes=o,Ki(t,o)}}var wl={readContext:hn,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useInsertionEffect:It,useLayoutEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useMutableSource:It,useSyncExternalStore:It,useId:It,unstable_isNewReconciler:!1},kg={readContext:hn,useCallback:function(t,n){return Un().memoizedState=[t,n===void 0?null:n],t},useContext:hn,useEffect:md,useImperativeHandle:function(t,n,o){return o=o!=null?o.concat([t]):null,vl(4194308,4,yd.bind(null,n,t),o)},useLayoutEffect:function(t,n){return vl(4194308,4,t,n)},useInsertionEffect:function(t,n){return vl(4,2,t,n)},useMemo:function(t,n){var o=Un();return n=n===void 0?null:n,t=t(),o.memoizedState=[t,n],t},useReducer:function(t,n,o){var a=Un();return n=o!==void 0?o(n):n,a.memoizedState=a.baseState=n,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:n},a.queue=t,t=t.dispatch=_g.bind(null,dt,t),[a.memoizedState,t]},useRef:function(t){var n=Un();return t={current:t},n.memoizedState=t},useState:fd,useDebugValue:gs,useDeferredValue:function(t){return Un().memoizedState=t},useTransition:function(){var t=fd(!1),n=t[0];return t=Eg.bind(null,t[1]),Un().memoizedState=t,[n,t]},useMutableSource:function(){},useSyncExternalStore:function(t,n,o){var a=dt,f=Un();if(at){if(o===void 0)throw Error(r(407));o=o()}else{if(o=n(),Nt===null)throw Error(r(349));(Wr&30)!==0||ad(a,n,o)}f.memoizedState=o;var h={value:o,getSnapshot:n};return f.queue=h,md(ud.bind(null,a,h,t),[t]),a.flags|=2048,ho(9,sd.bind(null,a,h,o,n),void 0,null),o},useId:function(){var t=Un(),n=Nt.identifierPrefix;if(at){var o=tr,a=er;o=(a&~(1<<32-ut(a)-1)).toString(32)+o,n=":"+n+"R"+o,o=po++,0<\/script>",t=t.removeChild(t.firstChild)):typeof a.is=="string"?t=_.createElement(o,{is:a.is}):(t=_.createElement(o),o==="select"&&(_=t,a.multiple?_.multiple=!0:a.size&&(_.size=a.size))):t=_.createElementNS(t,o),t[Fn]=n,t[oo]=a,Gd(t,n,!1,!1),n.stateNode=t;e:{switch(_=dn(o,a),o){case"dialog":it("cancel",t),it("close",t),f=a;break;case"iframe":case"object":case"embed":it("load",t),f=a;break;case"video":case"audio":for(f=0;fRi&&(n.flags|=128,a=!0,go(h,!1),n.lanes=4194304)}else{if(!a)if(t=bl(_),t!==null){if(n.flags|=128,a=!0,o=t.updateQueue,o!==null&&(n.updateQueue=o,n.flags|=4),go(h,!0),h.tail===null&&h.tailMode==="hidden"&&!_.alternate&&!at)return Mt(n),null}else 2*st()-h.renderingStartTime>Ri&&o!==1073741824&&(n.flags|=128,a=!0,go(h,!1),n.lanes=4194304);h.isBackwards?(_.sibling=n.child,n.child=_):(o=h.last,o!==null?o.sibling=_:n.child=_,h.last=_)}return h.tail!==null?(n=h.tail,h.rendering=n,h.tail=n.sibling,h.renderingStartTime=st(),n.sibling=null,o=ct.current,nt(ct,a?o&1|2:o&1),n):(Mt(n),null);case 22:case 23:return Us(),a=n.memoizedState!==null,t!==null&&t.memoizedState!==null!==a&&(n.flags|=8192),a&&(n.mode&1)!==0?(ln&1073741824)!==0&&(Mt(n),n.subtreeFlags&6&&(n.flags|=8192)):Mt(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function Rg(t,n){switch(Ya(n),n.tag){case 1:return Vt(n.type)&&al(),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return Ni(),ot(Wt),ot(Ot),ss(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 5:return ls(n),null;case 13:if(ot(ct),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(r(340));ki()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return ot(ct),null;case 4:return Ni(),null;case 10:return ts(n.type._context),null;case 22:case 23:return Us(),null;case 24:return null;default:return null}}var Cl=!1,Lt=!1,Og=typeof WeakSet=="function"?WeakSet:Set,ye=null;function Ti(t,n){var o=t.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(a){pt(t,n,a)}else o.current=null}function Ts(t,n,o){try{o()}catch(a){pt(t,n,a)}}var qd=!1;function Ig(t,n){if(Ua=Vo,t=Nc(),Ia(t)){if("selectionStart"in t)var o={start:t.selectionStart,end:t.selectionEnd};else e:{o=(o=t.ownerDocument)&&o.defaultView||window;var a=o.getSelection&&o.getSelection();if(a&&a.rangeCount!==0){o=a.anchorNode;var f=a.anchorOffset,h=a.focusNode;a=a.focusOffset;try{o.nodeType,h.nodeType}catch{o=null;break e}var _=0,N=-1,R=-1,U=0,Q=0,J=t,Y=null;t:for(;;){for(var pe;J!==o||f!==0&&J.nodeType!==3||(N=_+f),J!==h||a!==0&&J.nodeType!==3||(R=_+a),J.nodeType===3&&(_+=J.nodeValue.length),(pe=J.firstChild)!==null;)Y=J,J=pe;for(;;){if(J===t)break t;if(Y===o&&++U===f&&(N=_),Y===h&&++Q===a&&(R=_),(pe=J.nextSibling)!==null)break;J=Y,Y=J.parentNode}J=pe}o=N===-1||R===-1?null:{start:N,end:R}}else o=null}o=o||{start:0,end:0}}else o=null;for($a={focusedElem:t,selectionRange:o},Vo=!1,ye=n;ye!==null;)if(n=ye,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,ye=t;else for(;ye!==null;){n=ye;try{var be=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(be!==null){var Ee=be.memoizedProps,gt=be.memoizedState,z=n.stateNode,M=z.getSnapshotBeforeUpdate(n.elementType===n.type?Ee:Nn(n.type,Ee),gt);z.__reactInternalSnapshotBeforeUpdate=M}break;case 3:var B=n.stateNode.containerInfo;B.nodeType===1?B.textContent="":B.nodeType===9&&B.documentElement&&B.removeChild(B.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ie){pt(n,n.return,ie)}if(t=n.sibling,t!==null){t.return=n.return,ye=t;break}ye=n.return}return be=qd,qd=!1,be}function yo(t,n,o){var a=n.updateQueue;if(a=a!==null?a.lastEffect:null,a!==null){var f=a=a.next;do{if((f.tag&t)===t){var h=f.destroy;f.destroy=void 0,h!==void 0&&Ts(n,o,h)}f=f.next}while(f!==a)}}function Tl(t,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var o=n=n.next;do{if((o.tag&t)===t){var a=o.create;o.destroy=a()}o=o.next}while(o!==n)}}function As(t){var n=t.ref;if(n!==null){var o=t.stateNode;switch(t.tag){case 5:t=o;break;default:t=o}typeof n=="function"?n(t):n.current=t}}function Yd(t){var n=t.alternate;n!==null&&(t.alternate=null,Yd(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&(delete n[Fn],delete n[oo],delete n[Ga],delete n[mg],delete n[hg])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Qd(t){return t.tag===5||t.tag===3||t.tag===4}function Zd(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Qd(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Rs(t,n,o){var a=t.tag;if(a===5||a===6)t=t.stateNode,n?o.nodeType===8?o.parentNode.insertBefore(t,n):o.insertBefore(t,n):(o.nodeType===8?(n=o.parentNode,n.insertBefore(t,o)):(n=o,n.appendChild(t)),o=o._reactRootContainer,o!=null||n.onclick!==null||(n.onclick=ol));else if(a!==4&&(t=t.child,t!==null))for(Rs(t,n,o),t=t.sibling;t!==null;)Rs(t,n,o),t=t.sibling}function Os(t,n,o){var a=t.tag;if(a===5||a===6)t=t.stateNode,n?o.insertBefore(t,n):o.appendChild(t);else if(a!==4&&(t=t.child,t!==null))for(Os(t,n,o),t=t.sibling;t!==null;)Os(t,n,o),t=t.sibling}var At=null,Cn=!1;function kr(t,n,o){for(o=o.child;o!==null;)Xd(t,n,o),o=o.sibling}function Xd(t,n,o){if(Be&&typeof Be.onCommitFiberUnmount=="function")try{Be.onCommitFiberUnmount(ze,o)}catch{}switch(o.tag){case 5:Lt||Ti(o,n);case 6:var a=At,f=Cn;At=null,kr(t,n,o),At=a,Cn=f,At!==null&&(Cn?(t=At,o=o.stateNode,t.nodeType===8?t.parentNode.removeChild(o):t.removeChild(o)):At.removeChild(o.stateNode));break;case 18:At!==null&&(Cn?(t=At,o=o.stateNode,t.nodeType===8?Ka(t.parentNode,o):t.nodeType===1&&Ka(t,o),qi(t)):Ka(At,o.stateNode));break;case 4:a=At,f=Cn,At=o.stateNode.containerInfo,Cn=!0,kr(t,n,o),At=a,Cn=f;break;case 0:case 11:case 14:case 15:if(!Lt&&(a=o.updateQueue,a!==null&&(a=a.lastEffect,a!==null))){f=a=a.next;do{var h=f,_=h.destroy;h=h.tag,_!==void 0&&((h&2)!==0||(h&4)!==0)&&Ts(o,n,_),f=f.next}while(f!==a)}kr(t,n,o);break;case 1:if(!Lt&&(Ti(o,n),a=o.stateNode,typeof a.componentWillUnmount=="function"))try{a.props=o.memoizedProps,a.state=o.memoizedState,a.componentWillUnmount()}catch(N){pt(o,n,N)}kr(t,n,o);break;case 21:kr(t,n,o);break;case 22:o.mode&1?(Lt=(a=Lt)||o.memoizedState!==null,kr(t,n,o),Lt=a):kr(t,n,o);break;default:kr(t,n,o)}}function Jd(t){var n=t.updateQueue;if(n!==null){t.updateQueue=null;var o=t.stateNode;o===null&&(o=t.stateNode=new Og),n.forEach(function(a){var f=$g.bind(null,t,a);o.has(a)||(o.add(a),a.then(f,f))})}}function Tn(t,n){var o=n.deletions;if(o!==null)for(var a=0;af&&(f=_),a&=~h}if(a=f,a=st()-a,a=(120>a?120:480>a?480:1080>a?1080:1920>a?1920:3e3>a?3e3:4320>a?4320:1960*Lg(a/1960))-a,10t?16:t,xr===null)var a=!1;else{if(t=xr,xr=null,Ml=0,(qe&6)!==0)throw Error(r(331));var f=qe;for(qe|=4,ye=t.current;ye!==null;){var h=ye,_=h.child;if((ye.flags&16)!==0){var N=h.deletions;if(N!==null){for(var R=0;Rst()-Ls?Yr(t,0):Ms|=o),Qt(t,n)}function pf(t,n){n===0&&((t.mode&1)===0?n=1:(n=Pr,Pr<<=1,(Pr&130023424)===0&&(Pr=4194304)));var o=Ut();t=nr(t,n),t!==null&&(fr(t,n,o),Qt(t,o))}function Ug(t){var n=t.memoizedState,o=0;n!==null&&(o=n.retryLane),pf(t,o)}function $g(t,n){var o=0;switch(t.tag){case 13:var a=t.stateNode,f=t.memoizedState;f!==null&&(o=f.retryLane);break;case 19:a=t.stateNode;break;default:throw Error(r(314))}a!==null&&a.delete(n),pf(t,o)}var mf;mf=function(t,n,o){if(t!==null)if(t.memoizedProps!==n.pendingProps||Wt.current)qt=!0;else{if((t.lanes&o)===0&&(n.flags&128)===0)return qt=!1,Tg(t,n,o);qt=(t.flags&131072)!==0}else qt=!1,at&&(n.flags&1048576)!==0&&Wc(n,dl,n.index);switch(n.lanes=0,n.tag){case 2:var a=n.type;Nl(t,n),t=n.pendingProps;var f=Ei(n,Ot.current);Si(n,o),f=ds(null,n,a,t,f,o);var h=fs();return n.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,Vt(a)?(h=!0,sl(n)):h=!1,n.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,is(n),f.updater=xl,n.stateNode=f,f._reactInternals=n,bs(n,a,t,o),n=ks(null,n,a,!0,h,o)):(n.tag=0,at&&h&&qa(n),Bt(null,n,f,o),n=n.child),n;case 16:a=n.elementType;e:{switch(Nl(t,n),t=n.pendingProps,f=a._init,a=f(a._payload),n.type=a,f=n.tag=Hg(a),t=Nn(a,t),f){case 0:n=vs(null,n,a,t,o);break e;case 1:n=Bd(null,n,a,t,o);break e;case 11:n=Ld(null,n,a,t,o);break e;case 14:n=Dd(null,n,a,Nn(a.type,t),o);break e}throw Error(r(306,a,""))}return n;case 0:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Nn(a,f),vs(t,n,a,f,o);case 1:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Nn(a,f),Bd(t,n,a,f,o);case 3:e:{if(Ud(n),t===null)throw Error(r(387));a=n.pendingProps,h=n.memoizedState,f=h.element,td(t,n),yl(n,a,null,o);var _=n.memoizedState;if(a=_.element,h.isDehydrated)if(h={element:a,isDehydrated:!1,cache:_.cache,pendingSuspenseBoundaries:_.pendingSuspenseBoundaries,transitions:_.transitions},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){f=Ci(Error(r(423)),n),n=$d(t,n,a,o,f);break e}else if(a!==f){f=Ci(Error(r(424)),n),n=$d(t,n,a,o,f);break e}else for(on=gr(n.stateNode.containerInfo.firstChild),rn=n,at=!0,Sn=null,o=Jc(n,null,a,o),n.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(ki(),a===f){n=ir(t,n,o);break e}Bt(t,n,a,o)}n=n.child}return n;case 5:return id(n),t===null&&Za(n),a=n.type,f=n.pendingProps,h=t!==null?t.memoizedProps:null,_=f.children,ja(a,f)?_=null:h!==null&&ja(a,h)&&(n.flags|=32),Fd(t,n),Bt(t,n,_,o),n.child;case 6:return t===null&&Za(n),null;case 13:return jd(t,n,o);case 4:return os(n,n.stateNode.containerInfo),a=n.pendingProps,t===null?n.child=wi(n,null,a,o):Bt(t,n,a,o),n.child;case 11:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Nn(a,f),Ld(t,n,a,f,o);case 7:return Bt(t,n,n.pendingProps,o),n.child;case 8:return Bt(t,n,n.pendingProps.children,o),n.child;case 12:return Bt(t,n,n.pendingProps.children,o),n.child;case 10:e:{if(a=n.type._context,f=n.pendingProps,h=n.memoizedProps,_=f.value,nt(ml,a._currentValue),a._currentValue=_,h!==null)if(xn(h.value,_)){if(h.children===f.children&&!Wt.current){n=ir(t,n,o);break e}}else for(h=n.child,h!==null&&(h.return=n);h!==null;){var N=h.dependencies;if(N!==null){_=h.child;for(var R=N.firstContext;R!==null;){if(R.context===a){if(h.tag===1){R=rr(-1,o&-o),R.tag=2;var U=h.updateQueue;if(U!==null){U=U.shared;var Q=U.pending;Q===null?R.next=R:(R.next=Q.next,Q.next=R),U.pending=R}}h.lanes|=o,R=h.alternate,R!==null&&(R.lanes|=o),ns(h.return,o,n),N.lanes|=o;break}R=R.next}}else if(h.tag===10)_=h.type===n.type?null:h.child;else if(h.tag===18){if(_=h.return,_===null)throw Error(r(341));_.lanes|=o,N=_.alternate,N!==null&&(N.lanes|=o),ns(_,o,n),_=h.sibling}else _=h.child;if(_!==null)_.return=h;else for(_=h;_!==null;){if(_===n){_=null;break}if(h=_.sibling,h!==null){h.return=_.return,_=h;break}_=_.return}h=_}Bt(t,n,f.children,o),n=n.child}return n;case 9:return f=n.type,a=n.pendingProps.children,Si(n,o),f=hn(f),a=a(f),n.flags|=1,Bt(t,n,a,o),n.child;case 14:return a=n.type,f=Nn(a,n.pendingProps),f=Nn(a.type,f),Dd(t,n,a,f,o);case 15:return Pd(t,n,n.type,n.pendingProps,o);case 17:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Nn(a,f),Nl(t,n),n.tag=1,Vt(a)?(t=!0,sl(n)):t=!1,Si(n,o),Cd(n,a,f),bs(n,a,f,o),ks(null,n,a,!0,t,o);case 19:return Kd(t,n,o);case 22:return zd(t,n,o)}throw Error(r(156,n.tag))};function hf(t,n){return $o(t,n)}function jg(t,n,o,a){this.tag=t,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bn(t,n,o,a){return new jg(t,n,o,a)}function js(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Hg(t){if(typeof t=="function")return js(t)?1:0;if(t!=null){if(t=t.$$typeof,t===X)return 11;if(t===P)return 14}return 2}function Cr(t,n){var o=t.alternate;return o===null?(o=bn(t.tag,n,t.key,t.mode),o.elementType=t.elementType,o.type=t.type,o.stateNode=t.stateNode,o.alternate=t,t.alternate=o):(o.pendingProps=n,o.type=t.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=t.flags&14680064,o.childLanes=t.childLanes,o.lanes=t.lanes,o.child=t.child,o.memoizedProps=t.memoizedProps,o.memoizedState=t.memoizedState,o.updateQueue=t.updateQueue,n=t.dependencies,o.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},o.sibling=t.sibling,o.index=t.index,o.ref=t.ref,o}function zl(t,n,o,a,f,h){var _=2;if(a=t,typeof t=="function")js(t)&&(_=1);else if(typeof t=="string")_=5;else e:switch(t){case Z:return Zr(o.children,f,h,n);case G:_=8,f|=8;break;case te:return t=bn(12,o,n,f|2),t.elementType=te,t.lanes=h,t;case fe:return t=bn(13,o,n,f),t.elementType=fe,t.lanes=h,t;case q:return t=bn(19,o,n,f),t.elementType=q,t.lanes=h,t;case ae:return Fl(o,f,h,n);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case D:_=10;break e;case ne:_=9;break e;case X:_=11;break e;case P:_=14;break e;case le:_=16,a=null;break e}throw Error(r(130,t==null?t:typeof t,""))}return n=bn(_,o,n,f),n.elementType=t,n.type=a,n.lanes=h,n}function Zr(t,n,o,a){return t=bn(7,t,a,n),t.lanes=o,t}function Fl(t,n,o,a){return t=bn(22,t,a,n),t.elementType=ae,t.lanes=o,t.stateNode={isHidden:!1},t}function Hs(t,n,o){return t=bn(6,t,null,n),t.lanes=o,t}function Ks(t,n,o){return n=bn(4,t.children!==null?t.children:[],t.key,n),n.lanes=o,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}function Kg(t,n,o,a,f){this.tag=n,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=dr(0),this.expirationTimes=dr(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dr(0),this.identifierPrefix=a,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function Gs(t,n,o,a,f,h,_,N,R){return t=new Kg(t,n,o,N,R),n===1?(n=1,h===!0&&(n|=8)):n=0,h=bn(3,null,null,n),t.current=h,h.stateNode=t,h.memoizedState={element:a,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},is(h),t}function Gg(t,n,o){var a=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(i){console.error(i)}}return e(),Zs.exports=ry(),Zs.exports}var Af;function oy(){if(Af)return Gl;Af=1;var e=iy();return Gl.createRoot=e.createRoot,Gl.hydrateRoot=e.hydrateRoot,Gl}var ly=oy();const ay=Mo(ly);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sy=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Mp=(...e)=>e.filter((i,r,l)=>!!i&&i.trim()!==""&&l.indexOf(i)===r).join(" ").trim();/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var uy={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.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cy=ue.forwardRef(({color:e="currentColor",size:i=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:s="",children:c,iconNode:u,...d},p)=>ue.createElement("svg",{ref:p,...uy,width:i,height:i,stroke:e,strokeWidth:l?Number(r)*24/Number(i):r,className:Mp("lucide",s),...d},[...u.map(([m,g])=>ue.createElement(m,g)),...Array.isArray(c)?c:[c]]));/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Kt=(e,i)=>{const r=ue.forwardRef(({className:l,...s},c)=>ue.createElement(cy,{ref:c,iconNode:i,className:Mp(`lucide-${sy(e)}`,l),...s}));return r.displayName=`${e}`,r};/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dy=Kt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Lp=Kt("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fy=Kt("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const py=Kt("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.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const my=Kt("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hy=Kt("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Dp=Kt("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ku=Kt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gy=Kt("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.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Pp=Kt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zp=Kt("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yy=Kt("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const by=Kt("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.469.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=Kt("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** - * @license lucide-react v0.469.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _y=Kt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Fp="openkb_api_base",Bp="openkb_token";function Up(){return localStorage.getItem(Fp)||""}function ua(){return localStorage.getItem(Bp)||""}function vy(e,i){localStorage.setItem(Fp,e),localStorage.setItem(Bp,i)}function $p(){return!!ua()}function Pu(){return Up().replace(/\/$/,"")}function zu(){window.dispatchEvent(new CustomEvent("openkb:unauthorized"))}async function Rn(e,{method:i="GET",body:r,headers:l}={}){const s=ua(),c={...r&&!(r instanceof FormData)?{"Content-Type":"application/json"}:{},...s?{Authorization:`Bearer ${s}`}:{},...l},u={method:i,headers:c};r!==void 0&&(u.body=r instanceof FormData?r:JSON.stringify(r));const d=await fetch(Pu()+e,u);if(!d.ok){let m=`${d.status} ${d.statusText}`;try{const y=await d.json();m=typeof y.detail=="string"?y.detail:JSON.stringify(y.detail||y)}catch{}const g=new Error(m);throw g.status=d.status,d.status===401&&zu(),g}return(d.headers.get("content-type")||"").includes("application/json")?d.json():d.text()}const jt={listKbs:()=>Rn("/api/v1/kbs"),initKb:e=>Rn("/api/v1/init",{method:"POST",body:{kb:e}}),status:e=>Rn("/api/v1/status",{method:"POST",body:{kb:e}}),list:e=>Rn("/api/v1/list",{method:"POST",body:{kb:e}}),lint:(e,i)=>Rn("/api/v1/lint",{method:"POST",body:{kb:e,fix:i}}),watchStatus:e=>Rn("/api/v1/watch/status",{method:"POST",body:{kb:e}}),watchStart:(e,i)=>Rn("/api/v1/watch/start",{method:"POST",body:{kb:e,debounce:i}}),watchStop:e=>Rn("/api/v1/watch/stop",{method:"POST",body:{kb:e}}),chatSessions:e=>Rn("/api/v1/chat/sessions",{method:"POST",body:{kb:e}}),chatSessionLoad:(e,i)=>Rn("/api/v1/chat/sessions/load",{method:"POST",body:{kb:e,session_id:i}}),chatSessionDelete:(e,i)=>Rn("/api/v1/chat/sessions/delete",{method:"POST",body:{kb:e,session_id:i}})},jp=ue.createContext(null);function ky({children:e}){const[i,r]=ue.useState(Up()),[l,s]=ue.useState(ua()),[c,u]=ue.useState([]),[d,p]=ue.useState(null),[m,g]=ue.useState("overview"),[y,E]=ue.useState(!$p()),[b,x]=ue.useState([]),[C,T]=ue.useState(!1),[w,F]=ue.useState(null),L=ue.useRef(null),[$,K]=ue.useState(!1),I=ue.useCallback((fe,q)=>{const P=(fe||"").trim().replace(/\/$/,"");vy(P,(q||"").trim()),r(P),s((q||"").trim())},[]),Z=ue.useCallback(fe=>{g(fe),K(!1)},[]),G=ue.useCallback((fe,q="")=>{F({message:fe,kind:q}),clearTimeout(L.current),L.current=setTimeout(()=>F(null),3200)},[]),te=ue.useCallback(fe=>{x(fe?[{kind:"start",tag:"开始",body:"启动推理检索…"}]:[]),T(!!fe)},[]),D=ue.useCallback((fe,q,P)=>{fe!=="delta"&&x(le=>[...le,{kind:fe,tag:q,body:P}])},[]),ne=ue.useCallback(()=>{T(!1)},[]),X={apiBase:i,token:l,kbs:c,setKbs:u,kb:d,setKb:p,view:m,setView:Z,settingsOpen:y,setSettingsOpen:E,sidebarOpen:$,setSidebarOpen:K,saveConnection:I,toast:w,toastMsg:G,inspItems:b,inspBusy:C,inspReset:te,inspAdd:D,inspDone:ne};return k.jsx(jp.Provider,{value:X,children:e})}function Kn(){const e=ue.useContext(jp);if(!e)throw new Error("useApp must be used within AppProvider");return e}const wy=[{view:"overview",label:"概览",icon:my},{view:"documents",label:"文档",icon:py},{view:"query",label:"查询",icon:Pp},{view:"chat",label:"对话",icon:Dp},{view:"maintenance",label:"维护",icon:Ey}];function xy(){const{kbs:e,kb:i,setKb:r,view:l,setView:s,setSettingsOpen:c,sidebarOpen:u,setSidebarOpen:d,toastMsg:p}=Kn(),[m,g]=ue.useState(!1),[y,E]=ue.useState(!1),b=ue.useRef(null);ue.useEffect(()=>{function C(T){b.current&&!b.current.contains(T.target)&&g(!1)}return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[]);async function x(){const C=window.prompt("新知识库名称(字母/数字/下划线/连字符):");if(C){E(!0);try{await jt.initKb(C.trim()),r(C.trim()),g(!1),window.dispatchEvent(new CustomEvent("openkb:reload-kbs")),p("已创建:"+C.trim(),"ok")}catch(T){p(T.message,"err")}finally{E(!1)}}}return k.jsxs(k.Fragment,{children:[u&&k.jsx("div",{className:"sidebar-overlay",onClick:()=>d(!1)}),k.jsxs("aside",{className:`sidebar ${u?"open":""}`,children:[k.jsxs("div",{className:"brand",children:[k.jsx("span",{className:"brand-mark",children:"OK"}),k.jsx("span",{className:"brand-name",children:"OpenKB"})]}),k.jsxs("div",{className:"kb-switcher",ref:b,children:[k.jsxs("button",{className:"kb-current",type:"button",onClick:()=>g(C=>!C),children:[k.jsx("span",{className:"kb-current-dot"}),k.jsx("span",{className:"kb-current-name",children:i||"未选择知识库"}),k.jsx(dy,{className:"kb-chev",size:14})]}),m&&k.jsxs("div",{className:"kb-menu",children:[k.jsxs("div",{className:"kb-menu-list",children:[e.length===0&&k.jsx("div",{className:"kb-menu-item",style:{color:"var(--text-3)"},children:k.jsx("span",{className:"mi-name",children:"暂无知识库"})}),e.map(C=>k.jsxs("button",{className:`kb-menu-item ${C.name===i?"active":""}`,onClick:()=>{r(C.name),g(!1)},children:[k.jsx("span",{className:"mi-name",children:C.name}),k.jsxs("span",{className:"mi-meta",children:[C.document_count," 篇"]})]},C.name))]}),k.jsxs("button",{className:"kb-menu-new",onClick:x,disabled:y,children:[k.jsx(ku,{size:14}),"新建知识库"]})]})]}),k.jsx("nav",{className:"nav",children:wy.map(({view:C,label:T,icon:w})=>k.jsxs("button",{className:`nav-item ${l===C?"active":""}`,onClick:()=>s(C),children:[k.jsx(w,{size:16}),k.jsx("span",{children:T})]},C))}),k.jsx("div",{className:"sidebar-foot",children:k.jsx("button",{className:"icon-btn",title:"连接设置",onClick:()=>c(!0),children:k.jsx(yy,{size:16})})})]})]})}function Sy(){const{inspItems:e,inspBusy:i}=Kn(),r=ue.useRef(null);return ue.useEffect(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[e]),k.jsxs("aside",{className:"inspector",children:[k.jsxs("div",{className:"insp-head",children:[k.jsx("span",{className:"insp-title",children:"检索与推理"}),k.jsx("span",{className:`insp-status ${i?"busy":""}`,children:i?"推理中…":"空闲"})]}),k.jsx("div",{className:"insp-body",ref:r,children:e.length===0?k.jsxs("div",{className:"insp-empty",children:["发起查询或对话后,",k.jsx("br",{}),"无向量检索与推理过程将在此实时呈现。"]}):e.map((l,s)=>k.jsxs("div",{className:`timeline-item ${l.kind}`,children:[k.jsx("span",{className:"tl-tag",children:l.tag}),k.jsx("div",{className:"tl-body",dangerouslySetInnerHTML:{__html:l.body}})]},s))})]})}function Ny(){const{settingsOpen:e,setSettingsOpen:i,saveConnection:r,apiBase:l,token:s,toastMsg:c}=Kn(),[u,d]=ue.useState(l),[p,m]=ue.useState(s);if(ue.useEffect(()=>{d(l),m(s)},[l,s,e]),!e)return null;function g(){const y=(u||"").trim().replace(/\/$/,"");r(y,p),i(!1),c("已保存,正在刷新…","ok"),window.dispatchEvent(new CustomEvent("openkb:reload-kbs"))}return k.jsx("div",{className:"overlay",onClick:()=>i(!1),children:k.jsxs("div",{className:"modal",onClick:y=>y.stopPropagation(),children:[k.jsxs("div",{className:"modal-head",children:[k.jsx("h2",{children:"连接设置"}),k.jsx("button",{className:"icon-btn",onClick:()=>i(!1),children:k.jsx(_y,{size:18})})]}),k.jsxs("div",{className:"modal-body",children:[k.jsxs("label",{className:"field",children:[k.jsx("span",{className:"field-label",children:"API 地址"}),k.jsx("input",{value:u,onChange:y=>d(y.target.value),placeholder:"留空则同源访问(如 http://127.0.0.1:8000)"})]}),k.jsxs("label",{className:"field",children:[k.jsx("span",{className:"field-label",children:"Bearer Token"}),k.jsx("input",{type:"password",value:p,onChange:y=>m(y.target.value),placeholder:"OPENKB_API_TOKEN"})]}),k.jsx("p",{className:"field-hint",children:"配置信息仅保存在本浏览器本地。"})]}),k.jsxs("div",{className:"modal-foot",children:[k.jsx("button",{className:"btn btn-ghost",onClick:()=>i(!1),children:"取消"}),k.jsx("button",{className:"btn btn-primary",onClick:g,children:"保存"})]})]})})}function Cy(){const{toast:e}=Kn();return e?k.jsx("div",{className:`toast ${e.kind||""}`,children:e.message}):null}function Pi({title:e,desc:i,icon:r}){return k.jsxs("div",{className:"empty-state",children:[r||null,e&&k.jsx("h3",{children:e}),i&&k.jsx("p",{children:i})]})}function Hp({size:e=18}){return k.jsx("span",{className:"spinner",style:{width:e,height:e},"aria-label":"加载中"})}function Wl({label:e,value:i,sub:r,color:l}){return k.jsxs("div",{className:`stat-card ${l||""}`,children:[k.jsx("div",{className:"stat-label",children:e}),k.jsx("div",{className:"stat-value",children:i}),k.jsx("div",{className:"stat-sub",children:r})]})}function Rf(e){if(!e)return null;try{const i=new Date(e);return isNaN(i)?e:i.toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return e}}function Ty({kb:e}){const{setView:i,toastMsg:r}=Kn(),[l,s]=ue.useState(null),[c,u]=ue.useState(null);if(ue.useEffect(()=>{let g=!0;return s(null),u(null),Promise.all([jt.status(e),jt.list(e)]).then(([y,E])=>{g&&s({status:y,list:E})}).catch(y=>{g&&u(y.message)}),()=>{g=!1}},[e]),c)return k.jsx(Pi,{title:"加载失败",desc:c});if(!l)return k.jsx("div",{className:"empty-state",children:k.jsx(Hp,{})});const{status:d,list:p}=l,m=d.directories||{};return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"stat-grid",children:[k.jsx(Wl,{label:"已索引文档",value:d.total_indexed,sub:`原始文件 ${d.raw_count}`,color:"accent"}),k.jsx(Wl,{label:"概念页",value:m.concepts||0,sub:"跨文档综合",color:"cyan"}),k.jsx(Wl,{label:"摘要页",value:m.summaries||0,sub:"每篇一摘要",color:"green"}),k.jsx(Wl,{label:"报告页",value:m.reports||0,sub:"检查与合成",color:"purple"})]}),p.concepts&&p.concepts.length>0&&k.jsxs("div",{className:"panel",children:[k.jsxs("div",{className:"panel-head",children:[k.jsx("span",{className:"panel-title",children:"核心概念"}),k.jsx("span",{className:"tag",children:p.concepts.length})]}),k.jsx("div",{className:"concept-chips",children:p.concepts.slice(0,40).map(g=>k.jsx("button",{className:"concept-chip",onClick:()=>{i("query"),setTimeout(()=>window.dispatchEvent(new CustomEvent("openkb:prefill-query",{detail:`什么是「${g}」?请基于知识库解释。`})),30)},children:g},g))})]}),k.jsxs("div",{className:"panel",children:[k.jsx("div",{className:"panel-head",children:k.jsx("span",{className:"panel-title",children:"最近文档"})}),k.jsx("div",{className:"panel-body",children:p.documents&&p.documents.length>0?k.jsxs("table",{className:"table",children:[k.jsx("thead",{children:k.jsxs("tr",{children:[k.jsx("th",{children:"文档"}),k.jsx("th",{children:"类型"}),k.jsx("th",{children:"页数"})]})}),k.jsx("tbody",{children:p.documents.slice(-8).reverse().map(g=>k.jsxs("tr",{children:[k.jsx("td",{children:k.jsxs("span",{className:"icon-cell",children:[k.jsx("span",{className:"file-ico",children:g.display_type||g.type||"FILE"}),k.jsx("span",{className:"cell-name",children:g.name})]})}),k.jsx("td",{children:k.jsx("span",{className:"tag",children:g.display_type||g.type||"—"})}),k.jsx("td",{className:"cell-meta",children:g.pages!=null?g.pages:"—"})]},g.hash))})]}):k.jsx(Pi,{title:"暂无文档",desc:"去「文档」页添加文件开始编译。"})})]}),(d.last_compile||d.last_lint)&&k.jsxs("div",{className:"panel",children:[k.jsx("div",{className:"panel-head",children:k.jsx("span",{className:"panel-title",children:"活动"})}),k.jsxs("div",{className:"panel-body",children:[d.last_compile&&k.jsxs("div",{className:"log-line ok",style:{padding:"4px 16px"},children:["上次编译:",Rf(d.last_compile)]}),d.last_lint&&k.jsxs("div",{className:"log-line ok",style:{padding:"4px 16px"},children:["上次检查:",Rf(d.last_lint)]})]})]})]})}function Ay(e){const i=e.split(` - -`),r=i.pop(),l=[];for(const s of i){const c=s.match(/^event:\s*(.+)$/m),u=s.match(/^data:\s*(.+)$/m);if(c&&u){let d;try{d=JSON.parse(u[1])}catch{d={raw:u[1]}}l.push({event:c[1].trim(),data:d})}}return[l,r]}async function Kp(e,i){const r=e.body.getReader(),l=new TextDecoder;let s="";for(;;){const{value:c,done:u}=await r.read();if(u)break;s+=l.decode(c,{stream:!0});const[d,p]=Ay(s);s=p;for(const{event:m,data:g}of d)if(i(m,g)===!1)return}}function Gp(e,i={}){const r=ua(),l=e instanceof FormData;return{...e&&!l?{"Content-Type":"application/json"}:{},Accept:"text/event-stream",...r?{Authorization:`Bearer ${r}`}:{},...i}}async function Fu(e,i,r,l={}){const s=await fetch(Pu()+e,{method:"POST",headers:Gp(i),body:JSON.stringify(i),signal:l.signal});if(!s.ok){let c=`${s.status} ${s.statusText}`;try{const d=await s.json();c=typeof d.detail=="string"?d.detail:JSON.stringify(d.detail||d)}catch{}const u=new Error(c);throw u.status=s.status,s.status===401&&zu(),u}await Kp(s,r)}async function Wp(e,i,r,l={}){const s=await fetch(Pu()+e,{method:"POST",headers:Gp(i),body:i,signal:l.signal});if(!s.ok){let c=`${s.status} ${s.statusText}`;try{const d=await s.json();c=typeof d.detail=="string"?d.detail:JSON.stringify(d.detail||d)}catch{}const u=new Error(c);throw u.status=s.status,s.status===401&&zu(),u}await Kp(s,r)}function Ry(e){const i=(e.name.split(".").pop()||"").toLowerCase(),r=e.type==="url"?"URL":i.toUpperCase().slice(0,4)||"FILE";return k.jsxs("tr",{children:[k.jsx("td",{children:k.jsxs("span",{className:"icon-cell",children:[k.jsx("span",{className:"file-ico",children:r}),k.jsx("span",{className:"cell-name",children:e.name})]})}),k.jsx("td",{children:k.jsx("span",{className:"tag",children:e.display_type||e.type||"—"})}),k.jsx("td",{className:"cell-meta",children:e.pages!=null?e.pages:"—"}),k.jsx("td",{className:"cell-meta",children:e.hash.slice(0,8)}),k.jsx("td",{children:k.jsx("div",{className:"row-actions",children:k.jsx("button",{className:"btn btn-danger btn-sm","data-rm":e.name,children:"删除"})})})]},e.hash)}function Oy({kb:e}){const{inspReset:i,inspAdd:r,inspDone:l,toastMsg:s}=Kn(),[c,u]=ue.useState(null),[d,p]=ue.useState(null),[m,g]=ue.useState([]),[y,E]=ue.useState(!1),b=ue.useRef(null),x=ue.useCallback(()=>{u(null),p(null),jt.list(e).then(w=>u(w.documents||[])).catch(w=>p(w.message))},[e]);ue.useEffect(x,[x]);function C(w){if(!w||!w.length)return;const F=Array.from(w).map($=>({name:$.name,pct:10,status:"上传中"}));g(F),i(!0);const L=new FormData;L.append("kb",e),L.append("stream","true"),Array.from(w).forEach($=>L.append("files",$)),Wp("/api/v1/add",L,($,K)=>{if($==="file_start")g(I=>I.map(Z=>Z.name===K.original_name?{...Z,pct:50,status:"编译中"}:Z)),r("tool","编译",`处理 ${K.original_name}`);else if($==="file_done"){const I=K.status==="added";g(Z=>Z.map(G=>G.name===K.original_name?{...G,pct:100,status:I?"已添加":K.status}:G)),r(I?"done":"tool",I?"完成":"跳过",`${K.original_name}:${K.message||K.status}`)}else $==="final"?s(`已添加 ${K.added_count},跳过 ${K.skipped_count},失败 ${K.failed_count}`,K.failed_count?"err":"ok"):$==="error"&&(s(K.message||"上传失败","err"),r("error","错误",K.message||""))}).then(()=>{r("done","结束","编译流程结束"),x()}).catch($=>{s($.message,"err"),r("error","错误",$.message)}).finally(()=>{l()})}async function T(w){if(window.confirm(`确定删除文档「${w}」并清理其 wiki 页面?`)){i(!0);try{await Fu("/api/v1/remove",{kb:e,identifier:w,stream:!0},(F,L)=>{F==="plan"?r("tool","计划",`将清理 ${L.name||w} 相关页面`):F==="final"?r("done","完成",`已删除 ${L.name||w}`):F==="error"&&(s(L.message||"删除失败","err"),r("error","错误",L.message||""))}),s("已删除","ok"),x()}catch(F){s(F.message,"err"),r("error","错误",F.message)}finally{l()}}}return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:`dropzone ${y?"drag":""}`,onClick:()=>b.current&&b.current.click(),onDragOver:w=>{w.preventDefault(),E(!0)},onDragLeave:()=>E(!1),onDrop:w=>{w.preventDefault(),E(!1),w.dataTransfer.files.length&&C(w.dataTransfer.files)},children:[k.jsx(fy,{size:28,style:{margin:"0 auto 8px",color:"var(--text-2)"}}),k.jsx("div",{className:"dz-title",children:"拖入文件或点击上传"}),k.jsx("div",{children:"PDF · Word · Markdown · PPT · HTML · Excel · CSV · TXT · URL"}),k.jsx("input",{ref:b,type:"file",multiple:!0,style:{display:"none"},onChange:w=>{w.target.files.length&&C(w.target.files),w.target.value=""}})]}),m.length>0&&k.jsxs("div",{className:"panel",children:[k.jsx("div",{className:"panel-head",children:k.jsx("span",{className:"panel-title",children:"上传进度"})}),k.jsx("div",{className:"panel-body",children:m.map((w,F)=>k.jsxs("div",{className:"upload-item",children:[k.jsx("span",{className:"up-name",children:w.name}),k.jsx("div",{className:"progress",children:k.jsx("span",{style:{width:`${w.pct}%`}})}),k.jsx("span",{className:"cell-meta",children:w.status})]},F))})]}),k.jsxs("div",{className:"panel",children:[k.jsxs("div",{className:"panel-head",children:[k.jsx("span",{className:"panel-title",children:"已索引文档"}),k.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:x,children:[k.jsx(gy,{size:14})," 刷新"]})]}),k.jsx("div",{className:"panel-body",children:d?k.jsx(Pi,{title:"加载失败",desc:d}):c===null?k.jsx("div",{className:"empty-state",children:k.jsx(Hp,{})}):c.length===0?k.jsx(Pi,{title:"暂无文档",desc:"上传文件后将自动编译为 wiki。"}):k.jsxs("table",{className:"table",children:[k.jsx("thead",{children:k.jsxs("tr",{children:[k.jsx("th",{children:"文档"}),k.jsx("th",{children:"类型"}),k.jsx("th",{children:"页数"}),k.jsx("th",{children:"哈希"}),k.jsx("th",{})]})}),k.jsx("tbody",{children:c.map(w=>{const F=Ry(w);return k.jsx("tr",{onClick:L=>{const $=L.target.closest("[data-rm]");$&&T($.getAttribute("data-rm"))},children:F.props.children},w.hash)})})]})})]})]})}function Vp(){const[e,i]=ue.useState(!1),r=ue.useRef(null),l=ue.useCallback(()=>{r.current&&r.current.abort()},[]),s=ue.useCallback(async(c,u,d)=>{if(r.current)return;const p=new AbortController;r.current=p,i(!0);try{c.form?await Wp(c.path,c.form,u,{signal:p.signal}):await Fu(c.path,c.payload,u,{signal:p.signal})}catch(m){p.signal.aborted?d&&d():u("error",{message:(m==null?void 0:m.message)||"请求失败"})}finally{r.current=null,i(!1)}},[]);return{busy:e,start:s,stop:l}}function Iy(e,i){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const My=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ly=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Dy={};function Of(e,i){return(Dy.jsx?Ly:My).test(e)}const Py=/[ \t\n\f\r]/g;function zy(e){return typeof e=="object"?e.type==="text"?If(e.value):!1:If(e)}function If(e){return e.replace(Py,"")===""}class Lo{constructor(i,r,l){this.normal=r,this.property=i,l&&(this.space=l)}}Lo.prototype.normal={};Lo.prototype.property={};Lo.prototype.space=void 0;function qp(e,i){const r={},l={};for(const s of e)Object.assign(r,s.property),Object.assign(l,s.normal);return new Lo(r,l,i)}function wu(e){return e.toLowerCase()}class Jt{constructor(i,r){this.attribute=r,this.property=i}}Jt.prototype.attribute="";Jt.prototype.booleanish=!1;Jt.prototype.boolean=!1;Jt.prototype.commaOrSpaceSeparated=!1;Jt.prototype.commaSeparated=!1;Jt.prototype.defined=!1;Jt.prototype.mustUseProperty=!1;Jt.prototype.number=!1;Jt.prototype.overloadedBoolean=!1;Jt.prototype.property="";Jt.prototype.spaceSeparated=!1;Jt.prototype.space=void 0;let Fy=0;const Le=ri(),Et=ri(),xu=ri(),ee=ri(),Je=ri(),ti=ri(),an=ri();function ri(){return 2**++Fy}const Su=Object.freeze(Object.defineProperty({__proto__:null,boolean:Le,booleanish:Et,commaOrSpaceSeparated:an,commaSeparated:ti,number:ee,overloadedBoolean:xu,spaceSeparated:Je},Symbol.toStringTag,{value:"Module"})),eu=Object.keys(Su);class Bu extends Jt{constructor(i,r,l,s){let c=-1;if(super(i,r),Mf(this,"space",s),typeof l=="number")for(;++c4&&r.slice(0,4)==="data"&&Hy.test(i)){if(i.charAt(4)==="-"){const c=i.slice(5).replace(Lf,Wy);l="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=i.slice(4);if(!Lf.test(c)){let u=c.replace(jy,Gy);u.charAt(0)!=="-"&&(u="-"+u),i="data"+u}}s=Bu}return new s(l,i)}function Gy(e){return"-"+e.toLowerCase()}function Wy(e){return e.charAt(1).toUpperCase()}const Vy=qp([Yp,By,Xp,Jp,em],"html"),Uu=qp([Yp,Uy,Xp,Jp,em],"svg");function qy(e){return e.join(" ").trim()}var Ii={},tu,Df;function Yy(){if(Df)return tu;Df=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i=/\n/g,r=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,d=/^\s+|\s+$/g,p=` -`,m="/",g="*",y="",E="comment",b="declaration";function x(T,w){if(typeof T!="string")throw new TypeError("First argument must be a string");if(!T)return[];w=w||{};var F=1,L=1;function $(q){var P=q.match(i);P&&(F+=P.length);var le=q.lastIndexOf(p);L=~le?q.length-le:L+q.length}function K(){var q={line:F,column:L};return function(P){return P.position=new I(q),te(),P}}function I(q){this.start=q,this.end={line:F,column:L},this.source=w.source}I.prototype.content=T;function Z(q){var P=new Error(w.source+":"+F+":"+L+": "+q);if(P.reason=q,P.filename=w.source,P.line=F,P.column=L,P.source=T,!w.silent)throw P}function G(q){var P=q.exec(T);if(P){var le=P[0];return $(le),T=T.slice(le.length),P}}function te(){G(r)}function D(q){var P;for(q=q||[];P=ne();)P!==!1&&q.push(P);return q}function ne(){var q=K();if(!(m!=T.charAt(0)||g!=T.charAt(1))){for(var P=2;y!=T.charAt(P)&&(g!=T.charAt(P)||m!=T.charAt(P+1));)++P;if(P+=2,y===T.charAt(P-1))return Z("End of comment missing");var le=T.slice(2,P-2);return L+=2,$(le),T=T.slice(P),L+=2,q({type:E,comment:le})}}function X(){var q=K(),P=G(l);if(P){if(ne(),!G(s))return Z("property missing ':'");var le=G(c),ae=q({type:b,property:C(P[0].replace(e,y)),value:le?C(le[0].replace(e,y)):y});return G(u),ae}}function fe(){var q=[];D(q);for(var P;P=X();)P!==!1&&(q.push(P),D(q));return q}return te(),fe()}function C(T){return T?T.replace(d,y):y}return tu=x,tu}var Pf;function Qy(){if(Pf)return Ii;Pf=1;var e=Ii&&Ii.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(Ii,"__esModule",{value:!0}),Ii.default=r;const i=e(Yy());function r(l,s){let c=null;if(!l||typeof l!="string")return c;const u=(0,i.default)(l),d=typeof s=="function";return u.forEach(p=>{if(p.type!=="declaration")return;const{property:m,value:g}=p;d?s(m,g,p):g&&(c=c||{},c[m]=g)}),c}return Ii}var wo={},zf;function Zy(){if(zf)return wo;zf=1,Object.defineProperty(wo,"__esModule",{value:!0}),wo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,i=/-([a-z])/g,r=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,c=function(m){return!m||r.test(m)||e.test(m)},u=function(m,g){return g.toUpperCase()},d=function(m,g){return"".concat(g,"-")},p=function(m,g){return g===void 0&&(g={}),c(m)?m:(m=m.toLowerCase(),g.reactCompat?m=m.replace(s,d):m=m.replace(l,d),m.replace(i,u))};return wo.camelCase=p,wo}var xo,Ff;function Xy(){if(Ff)return xo;Ff=1;var e=xo&&xo.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},i=e(Qy()),r=Zy();function l(s,c){var u={};return!s||typeof s!="string"||(0,i.default)(s,function(d,p){d&&p&&(u[(0,r.camelCase)(d,c)]=p)}),u}return l.default=l,xo=l,xo}var Jy=Xy();const eb=Mo(Jy),tm=nm("end"),$u=nm("start");function nm(e){return i;function i(r){const l=r&&r.position&&r.position[e]||{};if(typeof l.line=="number"&&l.line>0&&typeof l.column=="number"&&l.column>0)return{line:l.line,column:l.column,offset:typeof l.offset=="number"&&l.offset>-1?l.offset:void 0}}}function tb(e){const i=$u(e),r=tm(e);if(i&&r)return{start:i,end:r}}function To(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Bf(e.position):"start"in e||"end"in e?Bf(e):"line"in e||"column"in e?Nu(e):""}function Nu(e){return Uf(e&&e.line)+":"+Uf(e&&e.column)}function Bf(e){return Nu(e&&e.start)+"-"+Nu(e&&e.end)}function Uf(e){return e&&typeof e=="number"?e:1}class Pt extends Error{constructor(i,r,l){super(),typeof r=="string"&&(l=r,r=void 0);let s="",c={},u=!1;if(r&&("line"in r&&"column"in r?c={place:r}:"start"in r&&"end"in r?c={place:r}:"type"in r?c={ancestors:[r],place:r.position}:c={...r}),typeof i=="string"?s=i:!c.cause&&i&&(u=!0,s=i.message,c.cause=i),!c.ruleId&&!c.source&&typeof l=="string"){const p=l.indexOf(":");p===-1?c.ruleId=l:(c.source=l.slice(0,p),c.ruleId=l.slice(p+1))}if(!c.place&&c.ancestors&&c.ancestors){const p=c.ancestors[c.ancestors.length-1];p&&(c.place=p.position)}const d=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=d?d.line:void 0,this.name=To(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=u&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Pt.prototype.file="";Pt.prototype.name="";Pt.prototype.reason="";Pt.prototype.message="";Pt.prototype.stack="";Pt.prototype.column=void 0;Pt.prototype.line=void 0;Pt.prototype.ancestors=void 0;Pt.prototype.cause=void 0;Pt.prototype.fatal=void 0;Pt.prototype.place=void 0;Pt.prototype.ruleId=void 0;Pt.prototype.source=void 0;const ju={}.hasOwnProperty,nb=new Map,rb=/[A-Z]/g,ib=new Set(["table","tbody","thead","tfoot","tr"]),ob=new Set(["td","th"]),rm="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function lb(e,i){if(!i||i.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=i.filePath||void 0;let l;if(i.development){if(typeof i.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");l=mb(r,i.jsxDEV)}else{if(typeof i.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof i.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");l=pb(r,i.jsx,i.jsxs)}const s={Fragment:i.Fragment,ancestors:[],components:i.components||{},create:l,elementAttributeNameCase:i.elementAttributeNameCase||"react",evaluater:i.createEvaluater?i.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:i.ignoreInvalidStyle||!1,passKeys:i.passKeys!==!1,passNode:i.passNode||!1,schema:i.space==="svg"?Uu:Vy,stylePropertyNameCase:i.stylePropertyNameCase||"dom",tableCellAlignToStyle:i.tableCellAlignToStyle!==!1},c=im(s,e,void 0);return c&&typeof c!="string"?c:s.create(e,s.Fragment,{children:c||void 0},void 0)}function im(e,i,r){if(i.type==="element")return ab(e,i,r);if(i.type==="mdxFlowExpression"||i.type==="mdxTextExpression")return sb(e,i);if(i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement")return cb(e,i,r);if(i.type==="mdxjsEsm")return ub(e,i);if(i.type==="root")return db(e,i,r);if(i.type==="text")return fb(e,i)}function ab(e,i,r){const l=e.schema;let s=l;i.tagName.toLowerCase()==="svg"&&l.space==="html"&&(s=Uu,e.schema=s),e.ancestors.push(i);const c=lm(e,i.tagName,!1),u=hb(e,i);let d=Ku(e,i);return ib.has(i.tagName)&&(d=d.filter(function(p){return typeof p=="string"?!zy(p):!0})),om(e,u,c,i),Hu(u,d),e.ancestors.pop(),e.schema=l,e.create(i,c,u,r)}function sb(e,i){if(i.data&&i.data.estree&&e.evaluater){const l=i.data.estree.body[0];return l.type,e.evaluater.evaluateExpression(l.expression)}Oo(e,i.position)}function ub(e,i){if(i.data&&i.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(i.data.estree);Oo(e,i.position)}function cb(e,i,r){const l=e.schema;let s=l;i.name==="svg"&&l.space==="html"&&(s=Uu,e.schema=s),e.ancestors.push(i);const c=i.name===null?e.Fragment:lm(e,i.name,!0),u=gb(e,i),d=Ku(e,i);return om(e,u,c,i),Hu(u,d),e.ancestors.pop(),e.schema=l,e.create(i,c,u,r)}function db(e,i,r){const l={};return Hu(l,Ku(e,i)),e.create(i,e.Fragment,l,r)}function fb(e,i){return i.value}function om(e,i,r,l){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(i.node=l)}function Hu(e,i){if(i.length>0){const r=i.length>1?i:i[0];r&&(e.children=r)}}function pb(e,i,r){return l;function l(s,c,u,d){const m=Array.isArray(u.children)?r:i;return d?m(c,u,d):m(c,u)}}function mb(e,i){return r;function r(l,s,c,u){const d=Array.isArray(c.children),p=$u(l);return i(s,c,u,d,{columnNumber:p?p.column-1:void 0,fileName:e,lineNumber:p?p.line:void 0},void 0)}}function hb(e,i){const r={};let l,s;for(s in i.properties)if(s!=="children"&&ju.call(i.properties,s)){const c=yb(e,s,i.properties[s]);if(c){const[u,d]=c;e.tableCellAlignToStyle&&u==="align"&&typeof d=="string"&&ob.has(i.tagName)?l=d:r[u]=d}}if(l){const c=r.style||(r.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return r}function gb(e,i){const r={};for(const l of i.attributes)if(l.type==="mdxJsxExpressionAttribute")if(l.data&&l.data.estree&&e.evaluater){const c=l.data.estree.body[0];c.type;const u=c.expression;u.type;const d=u.properties[0];d.type,Object.assign(r,e.evaluater.evaluateExpression(d.argument))}else Oo(e,i.position);else{const s=l.name;let c;if(l.value&&typeof l.value=="object")if(l.value.data&&l.value.data.estree&&e.evaluater){const d=l.value.data.estree.body[0];d.type,c=e.evaluater.evaluateExpression(d.expression)}else Oo(e,i.position);else c=l.value===null?!0:l.value;r[s]=c}return r}function Ku(e,i){const r=[];let l=-1;const s=e.passKeys?new Map:nb;for(;++ls?0:s+i:i=i>s?s:i,r=r>0?r:0,l.length<1e4)u=Array.from(l),u.unshift(i,r),e.splice(...u);else for(r&&e.splice(i,r);c0?(sn(e,e.length,0,i),e):i}const Hf={}.hasOwnProperty;function sm(e){const i={};let r=-1;for(;++r13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function On(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ht=Rr(/[A-Za-z]/),Dt=Rr(/[\dA-Za-z]/),Nb=Rr(/[#-'*+\--9=?A-Z^-~]/);function ra(e){return e!==null&&(e<32||e===127)}const Cu=Rr(/\d/),Cb=Rr(/[\dA-Fa-f]/),Tb=Rr(/[!-/:-@[-`{-~]/);function Ce(e){return e!==null&&e<-2}function et(e){return e!==null&&(e<0||e===32)}function Ue(e){return e===-2||e===-1||e===32}const ca=Rr(new RegExp("\\p{P}|\\p{S}","u")),ni=Rr(/\s/);function Rr(e){return i;function i(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Bi(e){const i=[];let r=-1,l=0,s=0;for(;++r55295&&c<57344){const d=e.charCodeAt(r+1);c<56320&&d>56319&&d<57344?(u=String.fromCharCode(c,d),s=1):u="�"}else u=String.fromCharCode(c);u&&(i.push(e.slice(l,r),encodeURIComponent(u)),l=r+s+1,u=""),s&&(r+=s,s=0)}return i.join("")+e.slice(l)}function We(e,i,r,l){const s=l?l-1:Number.POSITIVE_INFINITY;let c=0;return u;function u(p){return Ue(p)?(e.enter(r),d(p)):i(p)}function d(p){return Ue(p)&&c++u))return;const Z=i.events.length;let G=Z,te,D;for(;G--;)if(i.events[G][0]==="exit"&&i.events[G][1].type==="chunkFlow"){if(te){D=i.events[G][1].end;break}te=!0}for(w(l),I=Z;IL;){const K=r[$];i.containerState=K[1],K[0].exit.call(i,e)}r.length=L}function F(){s.write([null]),c=void 0,s=void 0,i.containerState._closeFlow=void 0}}function Mb(e,i,r){return We(e,e.attempt(this.parser.constructs.document,i,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function zi(e){if(e===null||et(e)||ni(e))return 1;if(ca(e))return 2}function da(e,i,r){const l=[];let s=-1;for(;++s1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const y={...e[l][1].end},E={...e[r][1].start};Gf(y,-p),Gf(E,p),u={type:p>1?"strongSequence":"emphasisSequence",start:y,end:{...e[l][1].end}},d={type:p>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:E},c={type:p>1?"strongText":"emphasisText",start:{...e[l][1].end},end:{...e[r][1].start}},s={type:p>1?"strong":"emphasis",start:{...u.start},end:{...d.end}},e[l][1].end={...u.start},e[r][1].start={...d.end},m=[],e[l][1].end.offset-e[l][1].start.offset&&(m=En(m,[["enter",e[l][1],i],["exit",e[l][1],i]])),m=En(m,[["enter",s,i],["enter",u,i],["exit",u,i],["enter",c,i]]),m=En(m,da(i.parser.constructs.insideSpan.null,e.slice(l+1,r),i)),m=En(m,[["exit",c,i],["enter",d,i],["exit",d,i],["exit",s,i]]),e[r][1].end.offset-e[r][1].start.offset?(g=2,m=En(m,[["enter",e[r][1],i],["exit",e[r][1],i]])):g=0,sn(e,l-1,r-l+3,m),r=l+m.length-g-2;break}}for(r=-1;++r0&&Ue(I)?We(e,F,"linePrefix",c+1)(I):F(I)}function F(I){return I===null||Ce(I)?e.check(Wf,C,$)(I):(e.enter("codeFlowValue"),L(I))}function L(I){return I===null||Ce(I)?(e.exit("codeFlowValue"),F(I)):(e.consume(I),L)}function $(I){return e.exit("codeFenced"),i(I)}function K(I,Z,G){let te=0;return D;function D(P){return I.enter("lineEnding"),I.consume(P),I.exit("lineEnding"),ne}function ne(P){return I.enter("codeFencedFence"),Ue(P)?We(I,X,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):X(P)}function X(P){return P===d?(I.enter("codeFencedFenceSequence"),fe(P)):G(P)}function fe(P){return P===d?(te++,I.consume(P),fe):te>=u?(I.exit("codeFencedFenceSequence"),Ue(P)?We(I,q,"whitespace")(P):q(P)):G(P)}function q(P){return P===null||Ce(P)?(I.exit("codeFencedFence"),Z(P)):G(P)}}}function Gb(e,i,r){const l=this;return s;function s(u){return u===null?r(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c)}function c(u){return l.parser.lazy[l.now().line]?r(u):i(u)}}const ru={name:"codeIndented",tokenize:Vb},Wb={partial:!0,tokenize:qb};function Vb(e,i,r){const l=this;return s;function s(m){return e.enter("codeIndented"),We(e,c,"linePrefix",5)(m)}function c(m){const g=l.events[l.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?u(m):r(m)}function u(m){return m===null?p(m):Ce(m)?e.attempt(Wb,u,p)(m):(e.enter("codeFlowValue"),d(m))}function d(m){return m===null||Ce(m)?(e.exit("codeFlowValue"),u(m)):(e.consume(m),d)}function p(m){return e.exit("codeIndented"),i(m)}}function qb(e,i,r){const l=this;return s;function s(u){return l.parser.lazy[l.now().line]?r(u):Ce(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s):We(e,c,"linePrefix",5)(u)}function c(u){const d=l.events[l.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?i(u):Ce(u)?s(u):r(u)}}const Yb={name:"codeText",previous:Zb,resolve:Qb,tokenize:Xb};function Qb(e){let i=e.length-4,r=3,l,s;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[i][1].type==="lineEnding"||e[i][1].type==="space")){for(l=r;++l=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+i+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ithis.left.length?this.right.slice(this.right.length-l+this.left.length,this.right.length-i+this.left.length).reverse():this.left.slice(i).concat(this.right.slice(this.right.length-l+this.left.length).reverse())}splice(i,r,l){const s=r||0;this.setCursor(Math.trunc(i));const c=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return l&&So(this.left,l),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(i){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(i)}pushMany(i){this.setCursor(Number.POSITIVE_INFINITY),So(this.left,i)}unshift(i){this.setCursor(0),this.right.push(i)}unshiftMany(i){this.setCursor(0),So(this.right,i.reverse())}setCursor(i){if(!(i===this.left.length||i>this.left.length&&this.right.length===0||i<0&&this.left.length===0))if(i=4?i(u):e.interrupt(l.parser.constructs.flow,r,i)(u)}}function mm(e,i,r,l,s,c,u,d,p){const m=p||Number.POSITIVE_INFINITY;let g=0;return y;function y(w){return w===60?(e.enter(l),e.enter(s),e.enter(c),e.consume(w),e.exit(c),E):w===null||w===32||w===41||ra(w)?r(w):(e.enter(l),e.enter(u),e.enter(d),e.enter("chunkString",{contentType:"string"}),C(w))}function E(w){return w===62?(e.enter(c),e.consume(w),e.exit(c),e.exit(s),e.exit(l),i):(e.enter(d),e.enter("chunkString",{contentType:"string"}),b(w))}function b(w){return w===62?(e.exit("chunkString"),e.exit(d),E(w)):w===null||w===60||Ce(w)?r(w):(e.consume(w),w===92?x:b)}function x(w){return w===60||w===62||w===92?(e.consume(w),b):b(w)}function C(w){return!g&&(w===null||w===41||et(w))?(e.exit("chunkString"),e.exit(d),e.exit(u),e.exit(l),i(w)):g999||b===null||b===91||b===93&&!p||b===94&&!d&&"_hiddenFootnoteSupport"in u.parser.constructs?r(b):b===93?(e.exit(c),e.enter(s),e.consume(b),e.exit(s),e.exit(l),i):Ce(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===null||b===91||b===93||Ce(b)||d++>999?(e.exit("chunkString"),g(b)):(e.consume(b),p||(p=!Ue(b)),b===92?E:y)}function E(b){return b===91||b===92||b===93?(e.consume(b),d++,y):y(b)}}function gm(e,i,r,l,s,c){let u;return d;function d(E){return E===34||E===39||E===40?(e.enter(l),e.enter(s),e.consume(E),e.exit(s),u=E===40?41:E,p):r(E)}function p(E){return E===u?(e.enter(s),e.consume(E),e.exit(s),e.exit(l),i):(e.enter(c),m(E))}function m(E){return E===u?(e.exit(c),p(u)):E===null?r(E):Ce(E)?(e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),We(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(E))}function g(E){return E===u||E===null||Ce(E)?(e.exit("chunkString"),m(E)):(e.consume(E),E===92?y:g)}function y(E){return E===u||E===92?(e.consume(E),g):g(E)}}function Ao(e,i){let r;return l;function l(s){return Ce(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),r=!0,l):Ue(s)?We(e,l,r?"linePrefix":"lineSuffix")(s):i(s)}}const lE={name:"definition",tokenize:sE},aE={partial:!0,tokenize:uE};function sE(e,i,r){const l=this;let s;return c;function c(b){return e.enter("definition"),u(b)}function u(b){return hm.call(l,e,d,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function d(b){return s=On(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),p):r(b)}function p(b){return et(b)?Ao(e,m)(b):m(b)}function m(b){return mm(e,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function g(b){return e.attempt(aE,y,y)(b)}function y(b){return Ue(b)?We(e,E,"whitespace")(b):E(b)}function E(b){return b===null||Ce(b)?(e.exit("definition"),l.parser.defined.push(s),i(b)):r(b)}}function uE(e,i,r){return l;function l(d){return et(d)?Ao(e,s)(d):r(d)}function s(d){return gm(e,c,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function c(d){return Ue(d)?We(e,u,"whitespace")(d):u(d)}function u(d){return d===null||Ce(d)?i(d):r(d)}}const cE={name:"hardBreakEscape",tokenize:dE};function dE(e,i,r){return l;function l(c){return e.enter("hardBreakEscape"),e.consume(c),s}function s(c){return Ce(c)?(e.exit("hardBreakEscape"),i(c)):r(c)}}const fE={name:"headingAtx",resolve:pE,tokenize:mE};function pE(e,i){let r=e.length-2,l=3,s,c;return e[l][1].type==="whitespace"&&(l+=2),r-2>l&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(l===r-1||r-4>l&&e[r-2][1].type==="whitespace")&&(r-=l+1===r?2:4),r>l&&(s={type:"atxHeadingText",start:e[l][1].start,end:e[r][1].end},c={type:"chunkText",start:e[l][1].start,end:e[r][1].end,contentType:"text"},sn(e,l,r-l+1,[["enter",s,i],["enter",c,i],["exit",c,i],["exit",s,i]])),e}function mE(e,i,r){let l=0;return s;function s(g){return e.enter("atxHeading"),c(g)}function c(g){return e.enter("atxHeadingSequence"),u(g)}function u(g){return g===35&&l++<6?(e.consume(g),u):g===null||et(g)?(e.exit("atxHeadingSequence"),d(g)):r(g)}function d(g){return g===35?(e.enter("atxHeadingSequence"),p(g)):g===null||Ce(g)?(e.exit("atxHeading"),i(g)):Ue(g)?We(e,d,"whitespace")(g):(e.enter("atxHeadingText"),m(g))}function p(g){return g===35?(e.consume(g),p):(e.exit("atxHeadingSequence"),d(g))}function m(g){return g===null||g===35||et(g)?(e.exit("atxHeadingText"),d(g)):(e.consume(g),m)}}const hE=["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"],qf=["pre","script","style","textarea"],gE={concrete:!0,name:"htmlFlow",resolveTo:EE,tokenize:_E},yE={partial:!0,tokenize:kE},bE={partial:!0,tokenize:vE};function EE(e){let i=e.length;for(;i--&&!(e[i][0]==="enter"&&e[i][1].type==="htmlFlow"););return i>1&&e[i-2][1].type==="linePrefix"&&(e[i][1].start=e[i-2][1].start,e[i+1][1].start=e[i-2][1].start,e.splice(i-2,2)),e}function _E(e,i,r){const l=this;let s,c,u,d,p;return m;function m(S){return g(S)}function g(S){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(S),y}function y(S){return S===33?(e.consume(S),E):S===47?(e.consume(S),c=!0,C):S===63?(e.consume(S),s=3,l.interrupt?i:v):Ht(S)?(e.consume(S),u=String.fromCharCode(S),T):r(S)}function E(S){return S===45?(e.consume(S),s=2,b):S===91?(e.consume(S),s=5,d=0,x):Ht(S)?(e.consume(S),s=4,l.interrupt?i:v):r(S)}function b(S){return S===45?(e.consume(S),l.interrupt?i:v):r(S)}function x(S){const we="CDATA[";return S===we.charCodeAt(d++)?(e.consume(S),d===we.length?l.interrupt?i:X:x):r(S)}function C(S){return Ht(S)?(e.consume(S),u=String.fromCharCode(S),T):r(S)}function T(S){if(S===null||S===47||S===62||et(S)){const we=S===47,Me=u.toLowerCase();return!we&&!c&&qf.includes(Me)?(s=1,l.interrupt?i(S):X(S)):hE.includes(u.toLowerCase())?(s=6,we?(e.consume(S),w):l.interrupt?i(S):X(S)):(s=7,l.interrupt&&!l.parser.lazy[l.now().line]?r(S):c?F(S):L(S))}return S===45||Dt(S)?(e.consume(S),u+=String.fromCharCode(S),T):r(S)}function w(S){return S===62?(e.consume(S),l.interrupt?i:X):r(S)}function F(S){return Ue(S)?(e.consume(S),F):D(S)}function L(S){return S===47?(e.consume(S),D):S===58||S===95||Ht(S)?(e.consume(S),$):Ue(S)?(e.consume(S),L):D(S)}function $(S){return S===45||S===46||S===58||S===95||Dt(S)?(e.consume(S),$):K(S)}function K(S){return S===61?(e.consume(S),I):Ue(S)?(e.consume(S),K):L(S)}function I(S){return S===null||S===60||S===61||S===62||S===96?r(S):S===34||S===39?(e.consume(S),p=S,Z):Ue(S)?(e.consume(S),I):G(S)}function Z(S){return S===p?(e.consume(S),p=null,te):S===null||Ce(S)?r(S):(e.consume(S),Z)}function G(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||et(S)?K(S):(e.consume(S),G)}function te(S){return S===47||S===62||Ue(S)?L(S):r(S)}function D(S){return S===62?(e.consume(S),ne):r(S)}function ne(S){return S===null||Ce(S)?X(S):Ue(S)?(e.consume(S),ne):r(S)}function X(S){return S===45&&s===2?(e.consume(S),le):S===60&&s===1?(e.consume(S),ae):S===62&&s===4?(e.consume(S),O):S===63&&s===3?(e.consume(S),v):S===93&&s===5?(e.consume(S),de):Ce(S)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(yE,j,fe)(S)):S===null||Ce(S)?(e.exit("htmlFlowData"),fe(S)):(e.consume(S),X)}function fe(S){return e.check(bE,q,j)(S)}function q(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),P}function P(S){return S===null||Ce(S)?fe(S):(e.enter("htmlFlowData"),X(S))}function le(S){return S===45?(e.consume(S),v):X(S)}function ae(S){return S===47?(e.consume(S),u="",W):X(S)}function W(S){if(S===62){const we=u.toLowerCase();return qf.includes(we)?(e.consume(S),O):X(S)}return Ht(S)&&u.length<8?(e.consume(S),u+=String.fromCharCode(S),W):X(S)}function de(S){return S===93?(e.consume(S),v):X(S)}function v(S){return S===62?(e.consume(S),O):S===45&&s===2?(e.consume(S),v):X(S)}function O(S){return S===null||Ce(S)?(e.exit("htmlFlowData"),j(S)):(e.consume(S),O)}function j(S){return e.exit("htmlFlow"),i(S)}}function vE(e,i,r){const l=this;return s;function s(u){return Ce(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):r(u)}function c(u){return l.parser.lazy[l.now().line]?r(u):i(u)}}function kE(e,i,r){return l;function l(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Do,i,r)}}const wE={name:"htmlText",tokenize:xE};function xE(e,i,r){const l=this;let s,c,u;return d;function d(v){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(v),p}function p(v){return v===33?(e.consume(v),m):v===47?(e.consume(v),K):v===63?(e.consume(v),L):Ht(v)?(e.consume(v),G):r(v)}function m(v){return v===45?(e.consume(v),g):v===91?(e.consume(v),c=0,x):Ht(v)?(e.consume(v),F):r(v)}function g(v){return v===45?(e.consume(v),b):r(v)}function y(v){return v===null?r(v):v===45?(e.consume(v),E):Ce(v)?(u=y,ae(v)):(e.consume(v),y)}function E(v){return v===45?(e.consume(v),b):y(v)}function b(v){return v===62?le(v):v===45?E(v):y(v)}function x(v){const O="CDATA[";return v===O.charCodeAt(c++)?(e.consume(v),c===O.length?C:x):r(v)}function C(v){return v===null?r(v):v===93?(e.consume(v),T):Ce(v)?(u=C,ae(v)):(e.consume(v),C)}function T(v){return v===93?(e.consume(v),w):C(v)}function w(v){return v===62?le(v):v===93?(e.consume(v),w):C(v)}function F(v){return v===null||v===62?le(v):Ce(v)?(u=F,ae(v)):(e.consume(v),F)}function L(v){return v===null?r(v):v===63?(e.consume(v),$):Ce(v)?(u=L,ae(v)):(e.consume(v),L)}function $(v){return v===62?le(v):L(v)}function K(v){return Ht(v)?(e.consume(v),I):r(v)}function I(v){return v===45||Dt(v)?(e.consume(v),I):Z(v)}function Z(v){return Ce(v)?(u=Z,ae(v)):Ue(v)?(e.consume(v),Z):le(v)}function G(v){return v===45||Dt(v)?(e.consume(v),G):v===47||v===62||et(v)?te(v):r(v)}function te(v){return v===47?(e.consume(v),le):v===58||v===95||Ht(v)?(e.consume(v),D):Ce(v)?(u=te,ae(v)):Ue(v)?(e.consume(v),te):le(v)}function D(v){return v===45||v===46||v===58||v===95||Dt(v)?(e.consume(v),D):ne(v)}function ne(v){return v===61?(e.consume(v),X):Ce(v)?(u=ne,ae(v)):Ue(v)?(e.consume(v),ne):te(v)}function X(v){return v===null||v===60||v===61||v===62||v===96?r(v):v===34||v===39?(e.consume(v),s=v,fe):Ce(v)?(u=X,ae(v)):Ue(v)?(e.consume(v),X):(e.consume(v),q)}function fe(v){return v===s?(e.consume(v),s=void 0,P):v===null?r(v):Ce(v)?(u=fe,ae(v)):(e.consume(v),fe)}function q(v){return v===null||v===34||v===39||v===60||v===61||v===96?r(v):v===47||v===62||et(v)?te(v):(e.consume(v),q)}function P(v){return v===47||v===62||et(v)?te(v):r(v)}function le(v){return v===62?(e.consume(v),e.exit("htmlTextData"),e.exit("htmlText"),i):r(v)}function ae(v){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),W}function W(v){return Ue(v)?We(e,de,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(v):de(v)}function de(v){return e.enter("htmlTextData"),u(v)}}const Vu={name:"labelEnd",resolveAll:TE,resolveTo:AE,tokenize:RE},SE={tokenize:OE},NE={tokenize:IE},CE={tokenize:ME};function TE(e){let i=-1;const r=[];for(;++i=3&&(m===null||Ce(m))?(e.exit("thematicBreak"),i(m)):r(m)}function p(m){return m===s?(e.consume(m),l++,p):(e.exit("thematicBreakSequence"),Ue(m)?We(e,d,"whitespace")(m):d(m))}}const Xt={continuation:{tokenize:HE},exit:GE,name:"list",tokenize:jE},UE={partial:!0,tokenize:WE},$E={partial:!0,tokenize:KE};function jE(e,i,r){const l=this,s=l.events[l.events.length-1];let c=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,u=0;return d;function d(b){const x=l.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!l.containerState.marker||b===l.containerState.marker:Cu(b)){if(l.containerState.type||(l.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(na,r,m)(b):m(b);if(!l.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(b)}return r(b)}function p(b){return Cu(b)&&++u<10?(e.consume(b),p):(!l.interrupt||u<2)&&(l.containerState.marker?b===l.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),m(b)):r(b)}function m(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||b,e.check(Do,l.interrupt?r:g,e.attempt(UE,E,y))}function g(b){return l.containerState.initialBlankLine=!0,c++,E(b)}function y(b){return Ue(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),E):r(b)}function E(b){return l.containerState.size=c+l.sliceSerialize(e.exit("listItemPrefix"),!0).length,i(b)}}function HE(e,i,r){const l=this;return l.containerState._closeFlow=void 0,e.check(Do,s,c);function s(d){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,We(e,i,"listItemIndent",l.containerState.size+1)(d)}function c(d){return l.containerState.furtherBlankLines||!Ue(d)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,u(d)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,e.attempt($E,i,u)(d))}function u(d){return l.containerState._closeFlow=!0,l.interrupt=void 0,We(e,e.attempt(Xt,i,r),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function KE(e,i,r){const l=this;return We(e,s,"listItemIndent",l.containerState.size+1);function s(c){const u=l.events[l.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===l.containerState.size?i(c):r(c)}}function GE(e){e.exit(this.containerState.type)}function WE(e,i,r){const l=this;return We(e,s,"listItemPrefixWhitespace",l.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(c){const u=l.events[l.events.length-1];return!Ue(c)&&u&&u[1].type==="listItemPrefixWhitespace"?i(c):r(c)}}const Yf={name:"setextUnderline",resolveTo:VE,tokenize:qE};function VE(e,i){let r=e.length,l,s,c;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){l=r;break}e[r][1].type==="paragraph"&&(s=r)}else e[r][1].type==="content"&&e.splice(r,1),!c&&e[r][1].type==="definition"&&(c=r);const u={type:"setextHeading",start:{...e[l][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",c?(e.splice(s,0,["enter",u,i]),e.splice(c+1,0,["exit",e[l][1],i]),e[l][1].end={...e[c][1].end}):e[l][1]=u,e.push(["exit",u,i]),e}function qE(e,i,r){const l=this;let s;return c;function c(m){let g=l.events.length,y;for(;g--;)if(l.events[g][1].type!=="lineEnding"&&l.events[g][1].type!=="linePrefix"&&l.events[g][1].type!=="content"){y=l.events[g][1].type==="paragraph";break}return!l.parser.lazy[l.now().line]&&(l.interrupt||y)?(e.enter("setextHeadingLine"),s=m,u(m)):r(m)}function u(m){return e.enter("setextHeadingLineSequence"),d(m)}function d(m){return m===s?(e.consume(m),d):(e.exit("setextHeadingLineSequence"),Ue(m)?We(e,p,"lineSuffix")(m):p(m))}function p(m){return m===null||Ce(m)?(e.exit("setextHeadingLine"),i(m)):r(m)}}const YE={tokenize:QE};function QE(e){const i=this,r=e.attempt(Do,l,e.attempt(this.parser.constructs.flowInitial,s,We(e,e.attempt(this.parser.constructs.flow,s,e.attempt(tE,s)),"linePrefix")));return r;function l(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),i.currentConstruct=void 0,r}function s(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),i.currentConstruct=void 0,r}}const ZE={resolveAll:bm()},XE=ym("string"),JE=ym("text");function ym(e){return{resolveAll:bm(e==="text"?e_:void 0),tokenize:i};function i(r){const l=this,s=this.parser.constructs[e],c=r.attempt(s,u,d);return u;function u(g){return m(g)?c(g):d(g)}function d(g){if(g===null){r.consume(g);return}return r.enter("data"),r.consume(g),p}function p(g){return m(g)?(r.exit("data"),c(g)):(r.consume(g),p)}function m(g){if(g===null)return!0;const y=s[g];let E=-1;if(y)for(;++E-1){const d=u[0];typeof d=="string"?u[0]=d.slice(l):u.shift()}c>0&&u.push(e[s].slice(0,c))}return u}function p_(e,i){let r=-1;const l=[];let s;for(;++r0){const _t=Te.tokenStack[Te.tokenStack.length-1];(_t[1]||Zf).call(Te,void 0,_t[0])}for(oe.position={start:Ar(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:Ar(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},je=-1;++je0&&(l.className=["language-"+s[0]]);let c={type:"element",tagName:"code",properties:l,children:[{type:"text",value:r}]};return i.meta&&(c.data={meta:i.meta}),e.patch(i,c),c=e.applyData(i,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(i,c),c}function C_(e,i){const r={type:"element",tagName:"del",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)}function T_(e,i){const r={type:"element",tagName:"em",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)}function A_(e,i){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",l=String(i.identifier).toUpperCase(),s=Bi(l.toLowerCase()),c=e.footnoteOrder.indexOf(l);let u,d=e.footnoteCounts.get(l);d===void 0?(d=0,e.footnoteOrder.push(l),u=e.footnoteOrder.length):u=c+1,d+=1,e.footnoteCounts.set(l,d);const p={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+s,id:r+"fnref-"+s+(d>1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(i,p);const m={type:"element",tagName:"sup",properties:{},children:[p]};return e.patch(i,m),e.applyData(i,m)}function R_(e,i){const r={type:"element",tagName:"h"+i.depth,properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)}function O_(e,i){if(e.options.allowDangerousHtml){const r={type:"raw",value:i.value};return e.patch(i,r),e.applyData(i,r)}}function vm(e,i){const r=i.referenceType;let l="]";if(r==="collapsed"?l+="[]":r==="full"&&(l+="["+(i.label||i.identifier)+"]"),i.type==="imageReference")return[{type:"text",value:"!["+i.alt+l}];const s=e.all(i),c=s[0];c&&c.type==="text"?c.value="["+c.value:s.unshift({type:"text",value:"["});const u=s[s.length-1];return u&&u.type==="text"?u.value+=l:s.push({type:"text",value:l}),s}function I_(e,i){const r=String(i.identifier).toUpperCase(),l=e.definitionById.get(r);if(!l)return vm(e,i);const s={src:Bi(l.url||""),alt:i.alt};l.title!==null&&l.title!==void 0&&(s.title=l.title);const c={type:"element",tagName:"img",properties:s,children:[]};return e.patch(i,c),e.applyData(i,c)}function M_(e,i){const r={src:Bi(i.url)};i.alt!==null&&i.alt!==void 0&&(r.alt=i.alt),i.title!==null&&i.title!==void 0&&(r.title=i.title);const l={type:"element",tagName:"img",properties:r,children:[]};return e.patch(i,l),e.applyData(i,l)}function L_(e,i){const r={type:"text",value:i.value.replace(/\r?\n|\r/g," ")};e.patch(i,r);const l={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(i,l),e.applyData(i,l)}function D_(e,i){const r=String(i.identifier).toUpperCase(),l=e.definitionById.get(r);if(!l)return vm(e,i);const s={href:Bi(l.url||"")};l.title!==null&&l.title!==void 0&&(s.title=l.title);const c={type:"element",tagName:"a",properties:s,children:e.all(i)};return e.patch(i,c),e.applyData(i,c)}function P_(e,i){const r={href:Bi(i.url)};i.title!==null&&i.title!==void 0&&(r.title=i.title);const l={type:"element",tagName:"a",properties:r,children:e.all(i)};return e.patch(i,l),e.applyData(i,l)}function z_(e,i,r){const l=e.all(i),s=r?F_(r):km(i),c={},u=[];if(typeof i.checked=="boolean"){const g=l[0];let y;g&&g.type==="element"&&g.tagName==="p"?y=g:(y={type:"element",tagName:"p",properties:{},children:[]},l.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:i.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let d=-1;for(;++d1}function B_(e,i){const r={},l=e.all(i);let s=-1;for(typeof i.start=="number"&&i.start!==1&&(r.start=i.start);++s0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},d=$u(i.children[1]),p=tm(i.children[i.children.length-1]);d&&p&&(u.position={start:d,end:p}),s.push(u)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(i,c),e.applyData(i,c)}function K_(e,i,r){const l=r?r.children:void 0,c=(l?l.indexOf(i):1)===0?"th":"td",u=r&&r.type==="table"?r.align:void 0,d=u?u.length:i.children.length;let p=-1;const m=[];for(;++p0,!0),l[0]),s=l.index+l[0].length,l=r.exec(i);return c.push(ep(i.slice(s),s>0,!1)),c.join("")}function ep(e,i,r){let l=0,s=e.length;if(i){let c=e.codePointAt(l);for(;c===Xf||c===Jf;)l++,c=e.codePointAt(l)}if(r){let c=e.codePointAt(s-1);for(;c===Xf||c===Jf;)s--,c=e.codePointAt(s-1)}return s>l?e.slice(l,s):""}function V_(e,i){const r={type:"text",value:W_(String(i.value))};return e.patch(i,r),e.applyData(i,r)}function q_(e,i){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(i,r),e.applyData(i,r)}const Y_={blockquote:x_,break:S_,code:N_,delete:C_,emphasis:T_,footnoteReference:A_,heading:R_,html:O_,imageReference:I_,image:M_,inlineCode:L_,linkReference:D_,link:P_,listItem:z_,list:B_,paragraph:U_,root:$_,strong:j_,table:H_,tableCell:G_,tableRow:K_,text:V_,thematicBreak:q_,toml:Vl,yaml:Vl,definition:Vl,footnoteDefinition:Vl};function Vl(){}const wm=-1,fa=0,Ro=1,ia=2,qu=3,Yu=4,Qu=5,Zu=6,xm=7,Sm=8,Q_=typeof self=="object"?self:globalThis,tp=(e,i)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new Q_[e](i)},Z_=(e,i)=>{const r=(s,c)=>(e.set(c,s),s),l=s=>{if(e.has(s))return e.get(s);const[c,u]=i[s];switch(c){case fa:case wm:return r(u,s);case Ro:{const d=r([],s);for(const p of u)d.push(l(p));return d}case ia:{const d=r({},s);for(const[p,m]of u)d[l(p)]=l(m);return d}case qu:return r(new Date(u),s);case Yu:{const{source:d,flags:p}=u;return r(new RegExp(d,p),s)}case Qu:{const d=r(new Map,s);for(const[p,m]of u)d.set(l(p),l(m));return d}case Zu:{const d=r(new Set,s);for(const p of u)d.add(l(p));return d}case xm:{const{name:d,message:p}=u;return r(tp(d,p),s)}case Sm:return r(BigInt(u),s);case"BigInt":return r(Object(BigInt(u)),s);case"ArrayBuffer":return r(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:d}=new Uint8Array(u);return r(new DataView(d),u)}}return r(tp(c,u),s)};return l},np=e=>Z_(new Map,e)(0),ei="",{toString:X_}={},{keys:J_}=Object,No=e=>{const i=typeof e;if(i!=="object"||!e)return[fa,i];const r=X_.call(e).slice(8,-1);switch(r){case"Array":return[Ro,ei];case"Object":return[ia,ei];case"Date":return[qu,ei];case"RegExp":return[Yu,ei];case"Map":return[Qu,ei];case"Set":return[Zu,ei];case"DataView":return[Ro,r]}return r.includes("Array")?[Ro,r]:r.includes("Error")?[xm,r]:[ia,r]},ql=([e,i])=>e===fa&&(i==="function"||i==="symbol"),ev=(e,i,r,l)=>{const s=(u,d)=>{const p=l.push(u)-1;return r.set(d,p),p},c=u=>{if(r.has(u))return r.get(u);let[d,p]=No(u);switch(d){case fa:{let g=u;switch(p){case"bigint":d=Sm,g=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);g=null;break;case"undefined":return s([wm],u)}return s([d,g],u)}case Ro:{if(p){let E=u;return p==="DataView"?E=new Uint8Array(u.buffer):p==="ArrayBuffer"&&(E=new Uint8Array(u)),s([p,[...E]],u)}const g=[],y=s([d,g],u);for(const E of u)g.push(c(E));return y}case ia:{if(p)switch(p){case"BigInt":return s([p,u.toString()],u);case"Boolean":case"Number":case"String":return s([p,u.valueOf()],u)}if(i&&"toJSON"in u)return c(u.toJSON());const g=[],y=s([d,g],u);for(const E of J_(u))(e||!ql(No(u[E])))&&g.push([c(E),c(u[E])]);return y}case qu:return s([d,isNaN(u.getTime())?ei:u.toISOString()],u);case Yu:{const{source:g,flags:y}=u;return s([d,{source:g,flags:y}],u)}case Qu:{const g=[],y=s([d,g],u);for(const[E,b]of u)(e||!(ql(No(E))||ql(No(b))))&&g.push([c(E),c(b)]);return y}case Zu:{const g=[],y=s([d,g],u);for(const E of u)(e||!ql(No(E)))&&g.push(c(E));return y}}const{message:m}=u;return s([d,{name:p,message:m}],u)};return c},rp=(e,{json:i,lossy:r}={})=>{const l=[];return ev(!(i||r),!!i,new Map,l)(e),l},oa=typeof structuredClone=="function"?(e,i)=>i&&("json"in i||"lossy"in i)?np(rp(e,i)):structuredClone(e):(e,i)=>np(rp(e,i));function tv(e,i){const r=[{type:"text",value:"↩"}];return i>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(i)}]}),r}function nv(e,i){return"Back to reference "+(e+1)+(i>1?"-"+i:"")}function rv(e){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||tv,l=e.options.footnoteBackLabel||nv,s=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let p=-1;for(;++p0&&x.push({type:"text",value:" "});let F=typeof r=="string"?r:r(p,b);typeof F=="string"&&(F={type:"text",value:F}),x.push({type:"element",tagName:"a",properties:{href:"#"+i+"fnref-"+E+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof l=="string"?l:l(p,b),className:["data-footnote-backref"]},children:Array.isArray(F)?F:[F]})}const T=g[g.length-1];if(T&&T.type==="element"&&T.tagName==="p"){const F=T.children[T.children.length-1];F&&F.type==="text"?F.value+=" ":T.children.push({type:"text",value:" "}),T.children.push(...x)}else g.push(...x);const w={type:"element",tagName:"li",properties:{id:i+"fn-"+E},children:e.wrap(g,!0)};e.patch(m,w),d.push(w)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...oa(u),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` -`},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:` -`}]}}const Po=(function(e){if(e==null)return av;if(typeof e=="function")return pa(e);if(typeof e=="object")return Array.isArray(e)?iv(e):ov(e);if(typeof e=="string")return lv(e);throw new Error("Expected function, string, or object as test")});function iv(e){const i=[];let r=-1;for(;++r":""))+")"})}return E;function E(){let b=Nm,x,C,T;if((!i||c(p,m,g[g.length-1]||void 0))&&(b=dv(r(p,g)),b[0]===Au))return b;if("children"in p&&p.children){const w=p;if(w.children&&b[0]!==cv)for(C=(l?w.children.length:-1)+u,T=g.concat(w);C>-1&&C0&&r.push({type:"text",value:` -`}),r}function ip(e){let i=0,r=e.charCodeAt(i);for(;r===9||r===32;)i++,r=e.charCodeAt(i);return e.slice(i)}function op(e,i){const r=pv(e,i),l=r.one(e,void 0),s=rv(r),c=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return s&&c.children.push({type:"text",value:` -`},s),c}function bv(e,i){return e&&"run"in e?async function(r,l){const s=op(r,{file:l,...i});await e.run(s,l)}:function(r,l){return op(r,{file:l,...e||i})}}function lp(e){if(e)throw e}var ou,ap;function Ev(){if(ap)return ou;ap=1;var e=Object.prototype.hasOwnProperty,i=Object.prototype.toString,r=Object.defineProperty,l=Object.getOwnPropertyDescriptor,s=function(m){return typeof Array.isArray=="function"?Array.isArray(m):i.call(m)==="[object Array]"},c=function(m){if(!m||i.call(m)!=="[object Object]")return!1;var g=e.call(m,"constructor"),y=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!g&&!y)return!1;var E;for(E in m);return typeof E>"u"||e.call(m,E)},u=function(m,g){r&&g.name==="__proto__"?r(m,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):m[g.name]=g.newValue},d=function(m,g){if(g==="__proto__")if(e.call(m,g)){if(l)return l(m,g).value}else return;return m[g]};return ou=function p(){var m,g,y,E,b,x,C=arguments[0],T=1,w=arguments.length,F=!1;for(typeof C=="boolean"&&(F=C,C=arguments[1]||{},T=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});Tu.length;let p;d&&u.push(s);try{p=e.apply(this,u)}catch(m){const g=m;if(d&&r)throw g;return s(g)}d||(p&&p.then&&typeof p.then=="function"?p.then(c,s):p instanceof Error?s(p):c(p))}function s(u,...d){r||(r=!0,i(u,...d))}function c(u){s(null,u)}}const Hn={basename:wv,dirname:xv,extname:Sv,join:Nv,sep:"/"};function wv(e,i){if(i!==void 0&&typeof i!="string")throw new TypeError('"ext" argument must be a string');zo(e);let r=0,l=-1,s=e.length,c;if(i===void 0||i.length===0||i.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(c){r=s+1;break}}else l<0&&(c=!0,l=s+1);return l<0?"":e.slice(r,l)}if(i===e)return"";let u=-1,d=i.length-1;for(;s--;)if(e.codePointAt(s)===47){if(c){r=s+1;break}}else u<0&&(c=!0,u=s+1),d>-1&&(e.codePointAt(s)===i.codePointAt(d--)?d<0&&(l=s):(d=-1,l=u));return r===l?l=u:l<0&&(l=e.length),e.slice(r,l)}function xv(e){if(zo(e),e.length===0)return".";let i=-1,r=e.length,l;for(;--r;)if(e.codePointAt(r)===47){if(l){i=r;break}}else l||(l=!0);return i<0?e.codePointAt(0)===47?"/":".":i===1&&e.codePointAt(0)===47?"//":e.slice(0,i)}function Sv(e){zo(e);let i=e.length,r=-1,l=0,s=-1,c=0,u;for(;i--;){const d=e.codePointAt(i);if(d===47){if(u){l=i+1;break}continue}r<0&&(u=!0,r=i+1),d===46?s<0?s=i:c!==1&&(c=1):s>-1&&(c=-1)}return s<0||r<0||c===0||c===1&&s===r-1&&s===l+1?"":e.slice(s,r)}function Nv(...e){let i=-1,r;for(;++i0&&e.codePointAt(e.length-1)===47&&(r+="/"),i?"/"+r:r}function Tv(e,i){let r="",l=0,s=-1,c=0,u=-1,d,p;for(;++u<=e.length;){if(u2){if(p=r.lastIndexOf("/"),p!==r.length-1){p<0?(r="",l=0):(r=r.slice(0,p),l=r.length-1-r.lastIndexOf("/")),s=u,c=0;continue}}else if(r.length>0){r="",l=0,s=u,c=0;continue}}i&&(r=r.length>0?r+"/..":"..",l=2)}else r.length>0?r+="/"+e.slice(s+1,u):r=e.slice(s+1,u),l=u-s-1;s=u,c=0}else d===46&&c>-1?c++:c=-1}return r}function zo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Av={cwd:Rv};function Rv(){return"/"}function Iu(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Ov(e){if(typeof e=="string")e=new URL(e);else if(!Iu(e)){const i=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw i.code="ERR_INVALID_ARG_TYPE",i}if(e.protocol!=="file:"){const i=new TypeError("The URL must be of scheme file");throw i.code="ERR_INVALID_URL_SCHEME",i}return Iv(e)}function Iv(e){if(e.hostname!==""){const l=new TypeError('File URL host must be "localhost" or empty on darwin');throw l.code="ERR_INVALID_FILE_URL_HOST",l}const i=e.pathname;let r=-1;for(;++r0){let[b,...x]=g;const C=l[E][1];Ou(C)&&Ou(b)&&(b=lu(!0,C,b)),l[E]=[m,b,...x]}}}}const Pv=new Xu().freeze();function cu(e,i){if(typeof i!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function du(e,i){if(typeof i!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function fu(e,i){if(i)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function up(e){if(!Ou(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function cp(e,i,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+i+"` instead")}function Yl(e){return zv(e)?e:new Tm(e)}function zv(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Fv(e){return typeof e=="string"||Bv(e)}function Bv(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Uv="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",dp=[],fp={allowDangerousHtml:!0},$v=/^(https?|ircs?|mailto|xmpp)$/i,jv=[{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:"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 Hv(e){const i=Kv(e),r=Gv(e);return Wv(i.runSync(i.parse(r),r),e)}function Kv(e){const i=e.rehypePlugins||dp,r=e.remarkPlugins||dp,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...fp}:fp;return Pv().use(w_).use(r).use(bv,l).use(i)}function Gv(e){const i=e.children||"",r=new Tm;return typeof i=="string"&&(r.value=i),r}function Wv(e,i){const r=i.allowedElements,l=i.allowElement,s=i.components,c=i.disallowedElements,u=i.skipHtml,d=i.unwrapDisallowed,p=i.urlTransform||Vv;for(const g of jv)Object.hasOwn(i,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+Uv+g.id,void 0);return i.className&&(e={type:"element",tagName:"div",properties:{className:i.className},children:e.type==="root"?e.children:[e]}),ma(e,m),lb(e,{Fragment:k.Fragment,components:s,ignoreInvalidStyle:!0,jsx:k.jsx,jsxs:k.jsxs,passKeys:!0,passNode:!0});function m(g,y,E){if(g.type==="raw"&&E&&typeof y=="number")return u?E.children.splice(y,1):E.children[y]={type:"text",value:g.value},y;if(g.type==="element"){let b;for(b in nu)if(Object.hasOwn(nu,b)&&Object.hasOwn(g.properties,b)){const x=g.properties[b],C=nu[b];(C===null||C.includes(g.tagName))&&(g.properties[b]=p(String(x||""),b,g))}}if(g.type==="element"){let b=r?!r.includes(g.tagName):c?c.includes(g.tagName):!1;if(!b&&l&&typeof y=="number"&&(b=!l(g,y,E)),b&&E&&typeof y=="number")return d&&g.children?E.children.splice(y,1,...g.children):E.children.splice(y,1),y}}}function Vv(e){const i=e.indexOf(":"),r=e.indexOf("?"),l=e.indexOf("#"),s=e.indexOf("/");return i===-1||s!==-1&&i>s||r!==-1&&i>r||l!==-1&&i>l||$v.test(e.slice(0,i))?e:""}function pp(e,i){const r=String(e);if(typeof i!="string")throw new TypeError("Expected character");let l=0,s=r.indexOf(i);for(;s!==-1;)l++,s=r.indexOf(i,s+i.length);return l}function qv(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Yv(e,i,r){const s=Po((r||{}).ignore||[]),c=Qv(i);let u=-1;for(;++u0?{type:"text",value:I}:void 0),I===!1?E.lastIndex=$+1:(x!==$&&F.push({type:"text",value:m.value.slice(x,$)}),Array.isArray(I)?F.push(...I):I&&F.push(I),x=$+L[0].length,w=!0),!E.global)break;L=E.exec(m.value)}return w?(x?\]}]+$/.exec(e);if(!i)return[e,void 0];e=e.slice(0,i.index);let r=i[0],l=r.indexOf(")");const s=pp(e,"(");let c=pp(e,")");for(;l!==-1&&s>c;)e+=r.slice(0,l+1),r=r.slice(l+1),l=r.indexOf(")"),c++;return[e,r]}function Am(e,i){const r=e.input.charCodeAt(e.index-1);return(e.index===0||ni(r)||ca(r))&&(!i||r!==47)}Rm.peek=Ek;function dk(){this.buffer()}function fk(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function pk(){this.buffer()}function mk(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function hk(e){const i=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=On(this.sliceSerialize(e)).toLowerCase(),r.label=i}function gk(e){this.exit(e)}function yk(e){const i=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=On(this.sliceSerialize(e)).toLowerCase(),r.label=i}function bk(e){this.exit(e)}function Ek(){return"["}function Rm(e,i,r,l){const s=r.createTracker(l);let c=s.move("[^");const u=r.enter("footnoteReference"),d=r.enter("reference");return c+=s.move(r.safe(r.associationId(e),{after:"]",before:c})),d(),u(),c+=s.move("]"),c}function _k(){return{enter:{gfmFootnoteCallString:dk,gfmFootnoteCall:fk,gfmFootnoteDefinitionLabelString:pk,gfmFootnoteDefinition:mk},exit:{gfmFootnoteCallString:hk,gfmFootnoteCall:gk,gfmFootnoteDefinitionLabelString:yk,gfmFootnoteDefinition:bk}}}function vk(e){let i=!1;return e&&e.firstLineBlank&&(i=!0),{handlers:{footnoteDefinition:r,footnoteReference:Rm},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(l,s,c,u){const d=c.createTracker(u);let p=d.move("[^");const m=c.enter("footnoteDefinition"),g=c.enter("label");return p+=d.move(c.safe(c.associationId(l),{before:p,after:"]"})),g(),p+=d.move("]:"),l.children&&l.children.length>0&&(d.shift(4),p+=d.move((i?` -`:" ")+c.indentLines(c.containerFlow(l,d.current()),i?Om:kk))),m(),p}}function kk(e,i,r){return i===0?e:Om(e,i,r)}function Om(e,i,r){return(r?"":" ")+e}const wk=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Im.peek=Tk;function xk(){return{canContainEols:["delete"],enter:{strikethrough:Nk},exit:{strikethrough:Ck}}}function Sk(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:wk}],handlers:{delete:Im}}}function Nk(e){this.enter({type:"delete",children:[]},e)}function Ck(e){this.exit(e)}function Im(e,i,r,l){const s=r.createTracker(l),c=r.enter("strikethrough");let u=s.move("~~");return u+=r.containerPhrasing(e,{...s.current(),before:u,after:"~"}),u+=s.move("~~"),c(),u}function Tk(){return"~"}function Ak(e){return e.length}function Rk(e,i){const r=i||{},l=(r.align||[]).concat(),s=r.stringLength||Ak,c=[],u=[],d=[],p=[];let m=0,g=-1;for(;++gm&&(m=e[g].length);++wp[w])&&(p[w]=L)}C.push(F)}u[g]=C,d[g]=T}let y=-1;if(typeof l=="object"&&"length"in l)for(;++yp[y]&&(p[y]=F),b[y]=F),E[y]=L}u.splice(1,0,E),d.splice(1,0,b),g=-1;const x=[];for(;++g "),c.shift(2);const u=r.indentLines(r.containerFlow(e,c.current()),Mk);return s(),u}function Mk(e,i,r){return">"+(r?"":" ")+e}function Lk(e,i){return hp(e,i.inConstruct,!0)&&!hp(e,i.notInConstruct,!1)}function hp(e,i,r){if(typeof i=="string"&&(i=[i]),!i||i.length===0)return r;let l=-1;for(;++lu&&(u=c):c=1,s=l+i.length,l=r.indexOf(i,s);return u}function Pk(e,i){return!!(i.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function zk(e){const i=e.options.fence||"`";if(i!=="`"&&i!=="~")throw new Error("Cannot serialize code with `"+i+"` for `options.fence`, expected `` ` `` or `~`");return i}function Fk(e,i,r,l){const s=zk(r),c=e.value||"",u=s==="`"?"GraveAccent":"Tilde";if(Pk(e,r)){const y=r.enter("codeIndented"),E=r.indentLines(c,Bk);return y(),E}const d=r.createTracker(l),p=s.repeat(Math.max(Dk(c,s)+1,3)),m=r.enter("codeFenced");let g=d.move(p);if(e.lang){const y=r.enter(`codeFencedLang${u}`);g+=d.move(r.safe(e.lang,{before:g,after:" ",encode:["`"],...d.current()})),y()}if(e.lang&&e.meta){const y=r.enter(`codeFencedMeta${u}`);g+=d.move(" "),g+=d.move(r.safe(e.meta,{before:g,after:` -`,encode:["`"],...d.current()})),y()}return g+=d.move(` -`),c&&(g+=d.move(c+` -`)),g+=d.move(p),m(),g}function Bk(e,i,r){return(r?"":" ")+e}function Ju(e){const i=e.options.quote||'"';if(i!=='"'&&i!=="'")throw new Error("Cannot serialize title with `"+i+"` for `options.quote`, expected `\"`, or `'`");return i}function Uk(e,i,r,l){const s=Ju(r),c=s==='"'?"Quote":"Apostrophe",u=r.enter("definition");let d=r.enter("label");const p=r.createTracker(l);let m=p.move("[");return m+=p.move(r.safe(r.associationId(e),{before:m,after:"]",...p.current()})),m+=p.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=r.enter("destinationLiteral"),m+=p.move("<"),m+=p.move(r.safe(e.url,{before:m,after:">",...p.current()})),m+=p.move(">")):(d=r.enter("destinationRaw"),m+=p.move(r.safe(e.url,{before:m,after:e.title?" ":` -`,...p.current()}))),d(),e.title&&(d=r.enter(`title${c}`),m+=p.move(" "+s),m+=p.move(r.safe(e.title,{before:m,after:s,...p.current()})),m+=p.move(s),d()),u(),m}function $k(e){const i=e.options.emphasis||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize emphasis with `"+i+"` for `options.emphasis`, expected `*`, or `_`");return i}function Io(e){return"&#x"+e.toString(16).toUpperCase()+";"}function la(e,i,r){const l=zi(e),s=zi(i);return l===void 0?s===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:l===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Mm.peek=jk;function Mm(e,i,r,l){const s=$k(r),c=r.enter("emphasis"),u=r.createTracker(l),d=u.move(s);let p=u.move(r.containerPhrasing(e,{after:s,before:d,...u.current()}));const m=p.charCodeAt(0),g=la(l.before.charCodeAt(l.before.length-1),m,s);g.inside&&(p=Io(m)+p.slice(1));const y=p.charCodeAt(p.length-1),E=la(l.after.charCodeAt(0),y,s);E.inside&&(p=p.slice(0,-1)+Io(y));const b=u.move(s);return c(),r.attentionEncodeSurroundingInfo={after:E.outside,before:g.outside},d+p+b}function jk(e,i,r){return r.options.emphasis||"*"}function Hk(e,i){let r=!1;return ma(e,function(l){if("value"in l&&/\r?\n|\r/.test(l.value)||l.type==="break")return r=!0,Au}),!!((!e.depth||e.depth<3)&&Gu(e)&&(i.options.setext||r))}function Kk(e,i,r,l){const s=Math.max(Math.min(6,e.depth||1),1),c=r.createTracker(l);if(Hk(e,r)){const g=r.enter("headingSetext"),y=r.enter("phrasing"),E=r.containerPhrasing(e,{...c.current(),before:` -`,after:` -`});return y(),g(),E+` -`+(s===1?"=":"-").repeat(E.length-(Math.max(E.lastIndexOf("\r"),E.lastIndexOf(` -`))+1))}const u="#".repeat(s),d=r.enter("headingAtx"),p=r.enter("phrasing");c.move(u+" ");let m=r.containerPhrasing(e,{before:"# ",after:` -`,...c.current()});return/^[\t ]/.test(m)&&(m=Io(m.charCodeAt(0))+m.slice(1)),m=m?u+" "+m:u,r.options.closeAtx&&(m+=" "+u),p(),d(),m}Lm.peek=Gk;function Lm(e){return e.value||""}function Gk(){return"<"}Dm.peek=Wk;function Dm(e,i,r,l){const s=Ju(r),c=s==='"'?"Quote":"Apostrophe",u=r.enter("image");let d=r.enter("label");const p=r.createTracker(l);let m=p.move("![");return m+=p.move(r.safe(e.alt,{before:m,after:"]",...p.current()})),m+=p.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=r.enter("destinationLiteral"),m+=p.move("<"),m+=p.move(r.safe(e.url,{before:m,after:">",...p.current()})),m+=p.move(">")):(d=r.enter("destinationRaw"),m+=p.move(r.safe(e.url,{before:m,after:e.title?" ":")",...p.current()}))),d(),e.title&&(d=r.enter(`title${c}`),m+=p.move(" "+s),m+=p.move(r.safe(e.title,{before:m,after:s,...p.current()})),m+=p.move(s),d()),m+=p.move(")"),u(),m}function Wk(){return"!"}Pm.peek=Vk;function Pm(e,i,r,l){const s=e.referenceType,c=r.enter("imageReference");let u=r.enter("label");const d=r.createTracker(l);let p=d.move("![");const m=r.safe(e.alt,{before:p,after:"]",...d.current()});p+=d.move(m+"]["),u();const g=r.stack;r.stack=[],u=r.enter("reference");const y=r.safe(r.associationId(e),{before:p,after:"]",...d.current()});return u(),r.stack=g,c(),s==="full"||!m||m!==y?p+=d.move(y+"]"):s==="shortcut"?p=p.slice(0,-1):p+=d.move("]"),p}function Vk(){return"!"}zm.peek=qk;function zm(e,i,r){let l=e.value||"",s="`",c=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(l);)s+="`";for(/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^`|`$/.test(l))&&(l=" "+l+" ");++c\u007F]/.test(e.url))}Bm.peek=Yk;function Bm(e,i,r,l){const s=Ju(r),c=s==='"'?"Quote":"Apostrophe",u=r.createTracker(l);let d,p;if(Fm(e,r)){const g=r.stack;r.stack=[],d=r.enter("autolink");let y=u.move("<");return y+=u.move(r.containerPhrasing(e,{before:y,after:">",...u.current()})),y+=u.move(">"),d(),r.stack=g,y}d=r.enter("link"),p=r.enter("label");let m=u.move("[");return m+=u.move(r.containerPhrasing(e,{before:m,after:"](",...u.current()})),m+=u.move("]("),p(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(p=r.enter("destinationLiteral"),m+=u.move("<"),m+=u.move(r.safe(e.url,{before:m,after:">",...u.current()})),m+=u.move(">")):(p=r.enter("destinationRaw"),m+=u.move(r.safe(e.url,{before:m,after:e.title?" ":")",...u.current()}))),p(),e.title&&(p=r.enter(`title${c}`),m+=u.move(" "+s),m+=u.move(r.safe(e.title,{before:m,after:s,...u.current()})),m+=u.move(s),p()),m+=u.move(")"),d(),m}function Yk(e,i,r){return Fm(e,r)?"<":"["}Um.peek=Qk;function Um(e,i,r,l){const s=e.referenceType,c=r.enter("linkReference");let u=r.enter("label");const d=r.createTracker(l);let p=d.move("[");const m=r.containerPhrasing(e,{before:p,after:"]",...d.current()});p+=d.move(m+"]["),u();const g=r.stack;r.stack=[],u=r.enter("reference");const y=r.safe(r.associationId(e),{before:p,after:"]",...d.current()});return u(),r.stack=g,c(),s==="full"||!m||m!==y?p+=d.move(y+"]"):s==="shortcut"?p=p.slice(0,-1):p+=d.move("]"),p}function Qk(){return"["}function ec(e){const i=e.options.bullet||"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bullet`, expected `*`, `+`, or `-`");return i}function Zk(e){const i=ec(e),r=e.options.bulletOther;if(!r)return i==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===i)throw new Error("Expected `bullet` (`"+i+"`) and `bulletOther` (`"+r+"`) to be different");return r}function Xk(e){const i=e.options.bulletOrdered||".";if(i!=="."&&i!==")")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOrdered`, expected `.` or `)`");return i}function $m(e){const i=e.options.rule||"*";if(i!=="*"&&i!=="-"&&i!=="_")throw new Error("Cannot serialize rules with `"+i+"` for `options.rule`, expected `*`, `-`, or `_`");return i}function Jk(e,i,r,l){const s=r.enter("list"),c=r.bulletCurrent;let u=e.ordered?Xk(r):ec(r);const d=e.ordered?u==="."?")":".":Zk(r);let p=i&&r.bulletLastUsed?u===r.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&g&&(!g.children||!g.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(p=!0),$m(r)===u&&g){let y=-1;for(;++y-1?i.start:1)+(r.options.incrementListMarker===!1?0:i.children.indexOf(e))+c);let u=c.length+1;(s==="tab"||s==="mixed"&&(i&&i.type==="list"&&i.spread||e.spread))&&(u=Math.ceil(u/4)*4);const d=r.createTracker(l);d.move(c+" ".repeat(u-c.length)),d.shift(u);const p=r.enter("listItem"),m=r.indentLines(r.containerFlow(e,d.current()),g);return p(),m;function g(y,E,b){return E?(b?"":" ".repeat(u))+y:(b?c:c+" ".repeat(u-c.length))+y}}function nw(e,i,r,l){const s=r.enter("paragraph"),c=r.enter("phrasing"),u=r.containerPhrasing(e,l);return c(),s(),u}const rw=Po(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function iw(e,i,r,l){return(e.children.some(function(u){return rw(u)})?r.containerPhrasing:r.containerFlow).call(r,e,l)}function ow(e){const i=e.options.strong||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize strong with `"+i+"` for `options.strong`, expected `*`, or `_`");return i}jm.peek=lw;function jm(e,i,r,l){const s=ow(r),c=r.enter("strong"),u=r.createTracker(l),d=u.move(s+s);let p=u.move(r.containerPhrasing(e,{after:s,before:d,...u.current()}));const m=p.charCodeAt(0),g=la(l.before.charCodeAt(l.before.length-1),m,s);g.inside&&(p=Io(m)+p.slice(1));const y=p.charCodeAt(p.length-1),E=la(l.after.charCodeAt(0),y,s);E.inside&&(p=p.slice(0,-1)+Io(y));const b=u.move(s+s);return c(),r.attentionEncodeSurroundingInfo={after:E.outside,before:g.outside},d+p+b}function lw(e,i,r){return r.options.strong||"*"}function aw(e,i,r,l){return r.safe(e.value,l)}function sw(e){const i=e.options.ruleRepetition||3;if(i<3)throw new Error("Cannot serialize rules with repetition `"+i+"` for `options.ruleRepetition`, expected `3` or more");return i}function uw(e,i,r){const l=($m(r)+(r.options.ruleSpaces?" ":"")).repeat(sw(r));return r.options.ruleSpaces?l.slice(0,-1):l}const Hm={blockquote:Ik,break:gp,code:Fk,definition:Uk,emphasis:Mm,hardBreak:gp,heading:Kk,html:Lm,image:Dm,imageReference:Pm,inlineCode:zm,link:Bm,linkReference:Um,list:Jk,listItem:tw,paragraph:nw,root:iw,strong:jm,text:aw,thematicBreak:uw};function cw(){return{enter:{table:dw,tableData:yp,tableHeader:yp,tableRow:pw},exit:{codeText:mw,table:fw,tableData:gu,tableHeader:gu,tableRow:gu}}}function dw(e){const i=e._align;this.enter({type:"table",align:i.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function fw(e){this.exit(e),this.data.inTable=void 0}function pw(e){this.enter({type:"tableRow",children:[]},e)}function gu(e){this.exit(e)}function yp(e){this.enter({type:"tableCell",children:[]},e)}function mw(e){let i=this.resume();this.data.inTable&&(i=i.replace(/\\([\\|])/g,hw));const r=this.stack[this.stack.length-1];r.type,r.value=i,this.exit(e)}function hw(e,i){return i==="|"?i:e}function gw(e){const i=e||{},r=i.tableCellPadding,l=i.tablePipeAlign,s=i.stringLength,c=r?" ":"|";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:E,table:u,tableCell:p,tableRow:d}};function u(b,x,C,T){return m(g(b,C,T),b.align)}function d(b,x,C,T){const w=y(b,C,T),F=m([w]);return F.slice(0,F.indexOf(` -`))}function p(b,x,C,T){const w=C.enter("tableCell"),F=C.enter("phrasing"),L=C.containerPhrasing(b,{...T,before:c,after:c});return F(),w(),L}function m(b,x){return Rk(b,{align:x,alignDelimiters:l,padding:r,stringLength:s})}function g(b,x,C){const T=b.children;let w=-1;const F=[],L=x.enter("table");for(;++w0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const Lw={tokenize:jw,partial:!0};function Dw(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Bw,continuation:{tokenize:Uw},exit:$w}},text:{91:{name:"gfmFootnoteCall",tokenize:Fw},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Pw,resolveTo:zw}}}}function Pw(e,i,r){const l=this;let s=l.events.length;const c=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u;for(;s--;){const p=l.events[s][1];if(p.type==="labelImage"){u=p;break}if(p.type==="gfmFootnoteCall"||p.type==="labelLink"||p.type==="label"||p.type==="image"||p.type==="link")break}return d;function d(p){if(!u||!u._balanced)return r(p);const m=On(l.sliceSerialize({start:u.end,end:l.now()}));return m.codePointAt(0)!==94||!c.includes(m.slice(1))?r(p):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),i(p))}}function zw(e,i){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const l={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},d=[e[r+1],e[r+2],["enter",l,i],e[r+3],e[r+4],["enter",s,i],["exit",s,i],["enter",c,i],["enter",u,i],["exit",u,i],["exit",c,i],e[e.length-2],e[e.length-1],["exit",l,i]];return e.splice(r,e.length-r+1,...d),e}function Fw(e,i,r){const l=this,s=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let c=0,u;return d;function d(y){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),p}function p(y){return y!==94?r(y):(e.enter("gfmFootnoteCallMarker"),e.consume(y),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(y){if(c>999||y===93&&!u||y===null||y===91||et(y))return r(y);if(y===93){e.exit("chunkString");const E=e.exit("gfmFootnoteCallString");return s.includes(On(l.sliceSerialize(E)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),i):r(y)}return et(y)||(u=!0),c++,e.consume(y),y===92?g:m}function g(y){return y===91||y===92||y===93?(e.consume(y),c++,m):m(y)}}function Bw(e,i,r){const l=this,s=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let c,u=0,d;return p;function p(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):r(x)}function g(x){if(u>999||x===93&&!d||x===null||x===91||et(x))return r(x);if(x===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return c=On(l.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),E}return et(x)||(d=!0),u++,e.consume(x),x===92?y:g}function y(x){return x===91||x===92||x===93?(e.consume(x),u++,g):g(x)}function E(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),s.includes(c)||s.push(c),We(e,b,"gfmFootnoteDefinitionWhitespace")):r(x)}function b(x){return i(x)}}function Uw(e,i,r){return e.check(Do,i,e.attempt(Lw,i,r))}function $w(e){e.exit("gfmFootnoteDefinition")}function jw(e,i,r){const l=this;return We(e,s,"gfmFootnoteDefinitionIndent",5);function s(c){const u=l.events[l.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?i(c):r(c)}}function Hw(e){let r=(e||{}).singleTilde;const l={name:"strikethrough",tokenize:c,resolveAll:s};return r==null&&(r=!0),{text:{126:l},insideSpan:{null:[l]},attentionMarkers:{null:[126]}};function s(u,d){let p=-1;for(;++p1?p(x):(u.consume(x),y++,b);if(y<2&&!r)return p(x);const T=u.exit("strikethroughSequenceTemporary"),w=zi(x);return T._open=!w||w===2&&!!C,T._close=!C||C===2&&!!w,d(x)}}}class Kw{constructor(){this.map=[]}add(i,r,l){Gw(this,i,r,l)}consume(i){if(this.map.sort(function(c,u){return c[0]-u[0]}),this.map.length===0)return;let r=this.map.length;const l=[];for(;r>0;)r-=1,l.push(i.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),i.length=this.map[r][0];l.push(i.slice()),i.length=0;let s=l.pop();for(;s;){for(const c of s)i.push(c);s=l.pop()}this.map.length=0}}function Gw(e,i,r,l){let s=0;if(!(r===0&&l.length===0)){for(;s-1;){const q=l.events[ne][1].type;if(q==="lineEnding"||q==="linePrefix")ne--;else break}const X=ne>-1?l.events[ne][1].type:null,fe=X==="tableHead"||X==="tableRow"?I:p;return fe===I&&l.parser.lazy[l.now().line]?r(D):fe(D)}function p(D){return e.enter("tableHead"),e.enter("tableRow"),m(D)}function m(D){return D===124||(u=!0,c+=1),g(D)}function g(D){return D===null?r(D):Ce(D)?c>1?(c=0,l.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),b):r(D):Ue(D)?We(e,g,"whitespace")(D):(c+=1,u&&(u=!1,s+=1),D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),u=!0,g):(e.enter("data"),y(D)))}function y(D){return D===null||D===124||et(D)?(e.exit("data"),g(D)):(e.consume(D),D===92?E:y)}function E(D){return D===92||D===124?(e.consume(D),y):y(D)}function b(D){return l.interrupt=!1,l.parser.lazy[l.now().line]?r(D):(e.enter("tableDelimiterRow"),u=!1,Ue(D)?We(e,x,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):x(D))}function x(D){return D===45||D===58?T(D):D===124?(u=!0,e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),C):K(D)}function C(D){return Ue(D)?We(e,T,"whitespace")(D):T(D)}function T(D){return D===58?(c+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),w):D===45?(c+=1,w(D)):D===null||Ce(D)?$(D):K(D)}function w(D){return D===45?(e.enter("tableDelimiterFiller"),F(D)):K(D)}function F(D){return D===45?(e.consume(D),F):D===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),L):(e.exit("tableDelimiterFiller"),L(D))}function L(D){return Ue(D)?We(e,$,"whitespace")(D):$(D)}function $(D){return D===124?x(D):D===null||Ce(D)?!u||s!==c?K(D):(e.exit("tableDelimiterRow"),e.exit("tableHead"),i(D)):K(D)}function K(D){return r(D)}function I(D){return e.enter("tableRow"),Z(D)}function Z(D){return D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),Z):D===null||Ce(D)?(e.exit("tableRow"),i(D)):Ue(D)?We(e,Z,"whitespace")(D):(e.enter("data"),G(D))}function G(D){return D===null||D===124||et(D)?(e.exit("data"),Z(D)):(e.consume(D),D===92?te:G)}function te(D){return D===92||D===124?(e.consume(D),G):G(D)}}function Yw(e,i){let r=-1,l=!0,s=0,c=[0,0,0,0],u=[0,0,0,0],d=!1,p=0,m,g,y;const E=new Kw;for(;++rr[2]+1){const x=r[2]+1,C=r[3]-r[2]-1;e.add(x,C,[])}}e.add(r[3]+1,0,[["exit",y,i]])}return s!==void 0&&(c.end=Object.assign({},Mi(i.events,s)),e.add(s,0,[["exit",c,i]]),c=void 0),c}function Ep(e,i,r,l,s){const c=[],u=Mi(i.events,r);s&&(s.end=Object.assign({},u),c.push(["exit",s,i])),l.end=Object.assign({},u),c.push(["exit",l,i]),e.add(r+1,0,c)}function Mi(e,i){const r=e[i],l=r[0]==="enter"?"start":"end";return r[1][l]}const Qw={name:"tasklistCheck",tokenize:Xw};function Zw(){return{text:{91:Qw}}}function Xw(e,i,r){const l=this;return s;function s(p){return l.previous!==null||!l._gfmTasklistFirstContentOfListItem?r(p):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),c)}function c(p){return et(p)?(e.enter("taskListCheckValueUnchecked"),e.consume(p),e.exit("taskListCheckValueUnchecked"),u):p===88||p===120?(e.enter("taskListCheckValueChecked"),e.consume(p),e.exit("taskListCheckValueChecked"),u):r(p)}function u(p){return p===93?(e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),d):r(p)}function d(p){return Ce(p)?i(p):Ue(p)?e.check({tokenize:Jw},i,r)(p):r(p)}}function Jw(e,i,r){return We(e,l,"whitespace");function l(s){return s===null?r(s):i(s)}}function ex(e){return sm([Sw(),Dw(),Hw(e),Vw(),Zw()])}const tx={};function nx(e){const i=this,r=e||tx,l=i.data(),s=l.micromarkExtensions||(l.micromarkExtensions=[]),c=l.fromMarkdownExtensions||(l.fromMarkdownExtensions=[]),u=l.toMarkdownExtensions||(l.toMarkdownExtensions=[]);s.push(ex(r)),c.push(vw()),u.push(kw(r))}const _p=(function(e,i,r){const l=Po(r);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof i=="number"){if(i<0||i===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(i=e.children.indexOf(i),i<0)throw new Error("Expected child node or index");for(;++im&&(m=g):g&&(m!==void 0&&m>-1&&p.push(` -`.repeat(m)||" "),m=-1,p.push(g))}return p.join("")}function Jm(e,i,r){return e.type==="element"?cx(e,i,r):e.type==="text"?r.whitespace==="normal"?eh(e,r):dx(e):[]}function cx(e,i,r){const l=th(e,r),s=e.children||[];let c=-1,u=[];if(sx(e))return u;let d,p;for(Lu(e)||xp(e)&&_p(i,e,xp)?p=` -`:ax(e)?(d=2,p=2):Xm(e)&&(d=1,p=1);++c]+>")+")",d={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},m={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},g={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},y={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(m,{className:"string"}),{className:"string",begin:/<.*?>/},r,e.C_BLOCK_COMMENT_MODE]},E={className:"title",begin:i.optional(s)+e.IDENT_RE,relevance:0},b=i.optional(s)+e.IDENT_RE+"\\s*\\(",x=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],C=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],T=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],w=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],$={type:C,keyword:x,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:T},K={className:"function.dispatch",relevance:0,keywords:{_hint:w},begin:i.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,i.lookahead(/(<[^<>]+>|)\s*\(/))},I=[K,y,d,r,e.C_BLOCK_COMMENT_MODE,g,m],Z={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:$,contains:I.concat([{begin:/\(/,end:/\)/,keywords:$,contains:I.concat(["self"]),relevance:0}]),relevance:0},G={className:"function",begin:"("+u+"[\\*&\\s]+)+"+b,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:$,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:l,keywords:$,relevance:0},{begin:b,returnBegin:!0,contains:[E],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[m,g]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:$,relevance:0,contains:[r,e.C_BLOCK_COMMENT_MODE,m,g,d,{begin:/\(/,end:/\)/,keywords:$,relevance:0,contains:["self",r,e.C_BLOCK_COMMENT_MODE,m,g,d]}]},d,r,e.C_BLOCK_COMMENT_MODE,y]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:$,illegal:"",keywords:$,contains:["self",d]},{begin:e.IDENT_RE+"::",keywords:$},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function yx(e){const i={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},r=gx(e),l=r.keywords;return l.type=[...l.type,...i.type],l.literal=[...l.literal,...i.literal],l.built_in=[...l.built_in,...i.built_in],l._hints=i._hints,r.name="Arduino",r.aliases=["ino"],r.supersetOf="cpp",r}function bx(e){const i=e.regex,r={},l={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[r]}]};Object.assign(r,{className:"variable",variants:[{begin:i.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},l]});const s={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},c=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),u={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},d={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,r,s]};s.contains.push(d);const p={match:/\\"/},m={className:"string",begin:/'/,end:/'/},g={match:/\\'/},y={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,r]},E=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],b=e.SHEBANG({binary:`(${E.join("|")})`,relevance:10}),x={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},C=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],T=["true","false"],w={match:/(\/[a-z._-]+)+/},F=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],L=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],$=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],K=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:C,literal:T,built_in:[...F,...L,"set","shopt",...$,...K]},contains:[b,e.SHEBANG(),x,y,c,u,w,d,p,m,g,r]}}function Ex(e){const i=e.regex,r=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),l="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",u="("+l+"|"+i.optional(s)+"[a-zA-Z_]\\w*"+i.optional("<[^<>]+>")+")",d={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},m={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},g={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},y={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(m,{className:"string"}),{className:"string",begin:/<.*?>/},r,e.C_BLOCK_COMMENT_MODE]},E={className:"title",begin:i.optional(s)+e.IDENT_RE,relevance:0},b=i.optional(s)+e.IDENT_RE+"\\s*\\(",T={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},w=[y,d,r,e.C_BLOCK_COMMENT_MODE,g,m],F={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:T,contains:w.concat([{begin:/\(/,end:/\)/,keywords:T,contains:w.concat(["self"]),relevance:0}]),relevance:0},L={begin:"("+u+"[\\*&\\s]+)+"+b,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:T,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:l,keywords:T,relevance:0},{begin:b,returnBegin:!0,contains:[e.inherit(E,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:[r,e.C_BLOCK_COMMENT_MODE,m,g,d,{begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:["self",r,e.C_BLOCK_COMMENT_MODE,m,g,d]}]},d,r,e.C_BLOCK_COMMENT_MODE,y]};return{name:"C",aliases:["h"],keywords:T,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:y,strings:m,keywords:T}}}function _x(e){const i=e.regex,r=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),l="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",u="(?!struct)("+l+"|"+i.optional(s)+"[a-zA-Z_]\\w*"+i.optional("<[^<>]+>")+")",d={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},m={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},g={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},y={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(m,{className:"string"}),{className:"string",begin:/<.*?>/},r,e.C_BLOCK_COMMENT_MODE]},E={className:"title",begin:i.optional(s)+e.IDENT_RE,relevance:0},b=i.optional(s)+e.IDENT_RE+"\\s*\\(",x=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],C=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],T=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],w=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],$={type:C,keyword:x,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:T},K={className:"function.dispatch",relevance:0,keywords:{_hint:w},begin:i.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,i.lookahead(/(<[^<>]+>|)\s*\(/))},I=[K,y,d,r,e.C_BLOCK_COMMENT_MODE,g,m],Z={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:$,contains:I.concat([{begin:/\(/,end:/\)/,keywords:$,contains:I.concat(["self"]),relevance:0}]),relevance:0},G={className:"function",begin:"("+u+"[\\*&\\s]+)+"+b,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:$,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:l,keywords:$,relevance:0},{begin:b,returnBegin:!0,contains:[E],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[m,g]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:$,relevance:0,contains:[r,e.C_BLOCK_COMMENT_MODE,m,g,d,{begin:/\(/,end:/\)/,keywords:$,relevance:0,contains:["self",r,e.C_BLOCK_COMMENT_MODE,m,g,d]}]},d,r,e.C_BLOCK_COMMENT_MODE,y]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:$,illegal:"",keywords:$,contains:["self",d]},{begin:e.IDENT_RE+"::",keywords:$},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function vx(e){const i=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],r=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],l=["default","false","null","true"],s=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],c=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],u={keyword:s.concat(c),built_in:i,literal:l},d=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),p={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},m={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},g={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},y=e.inherit(g,{illegal:/\n/}),E={className:"subst",begin:/\{/,end:/\}/,keywords:u},b=e.inherit(E,{illegal:/\n/}),x={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,b]},C={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},E]},T=e.inherit(C,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},b]});E.contains=[C,x,g,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,e.C_BLOCK_COMMENT_MODE],b.contains=[T,x,y,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const w={variants:[m,C,x,g,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},F={begin:"<",end:">",contains:[{beginKeywords:"in out"},d]},L=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",$={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:u,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},w,p,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},d,F,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[d,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[d,F,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+L+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:u,contains:[{beginKeywords:r.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,F],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:u,relevance:0,contains:[w,p,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},$]}}const kx=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),wx=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],xx=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],Sx=[...wx,...xx],Nx=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Cx=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Tx=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Ax=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function Rx(e){const i=e.regex,r=kx(e),l={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="and or not only",c=/@-?\w[\w]*(-\w+)*/,u="[a-zA-Z-][a-zA-Z0-9_-]*",d=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[r.BLOCK_COMMENT,l,r.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+u,relevance:0},r.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+Cx.join("|")+")"},{begin:":(:)?("+Tx.join("|")+")"}]},r.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Ax.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[r.BLOCK_COMMENT,r.HEXCOLOR,r.IMPORTANT,r.CSS_NUMBER_MODE,...d,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...d,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},r.FUNCTION_DISPATCH]},{begin:i.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:c},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:Nx.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...d,r.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+Sx.join("|")+")\\b"}]}}function Ox(e){const i=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:i.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:i.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function Ix(e){const c={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:c,illegal:"nh(e,i,r-1))}function Dx(e){const i=e.regex,r="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",l=r+nh("(?:<"+r+"~~~(?:\\s*,\\s*"+r+"~~~)*>)?",/~~~/g,2),p={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},m={className:"meta",begin:"@"+r,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},g={className:"params",begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:p,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[i.concat(/(?!else)/,r),/\s+/,r,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,r],className:{1:"keyword",3:"title.class"},contains:[g,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+l+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:p,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:[m,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,Sp,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Sp,m]}}const Np="[A-Za-z$_][0-9A-Za-z$_]*",Px=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],zx=["true","false","null","undefined","NaN","Infinity"],rh=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],ih=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],oh=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Fx=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Bx=[].concat(oh,rh,ih);function Ux(e){const i=e.regex,r=(W,{after:de})=>{const v="",end:""},c=/<[A-Za-z0-9\\._:-]+\s*\/>/,u={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(W,de)=>{const v=W[0].length+W.index,O=W.input[v];if(O==="<"||O===","){de.ignoreMatch();return}O===">"&&(r(W,{after:v})||de.ignoreMatch());let j;const S=W.input.substring(v);if(j=S.match(/^\s*=/)){de.ignoreMatch();return}if((j=S.match(/^\s+extends\s+/))&&j.index===0){de.ignoreMatch();return}}},d={$pattern:Np,keyword:Px,literal:zx,built_in:Bx,"variable.language":Fx},p="[0-9](_?[0-9])*",m=`\\.(${p})`,g="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",y={className:"number",variants:[{begin:`(\\b(${g})((${m})|\\.)?|(${m}))[eE][+-]?(${p})\\b`},{begin:`\\b(${g})\\b((${m})\\b|\\.)?|(${m})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},E={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},b={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,E],subLanguage:"xml"}},x={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,E],subLanguage:"css"}},C={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,E],subLanguage:"graphql"}},T={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,E]},F={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:l+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},L=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,b,x,C,T,{match:/\$\d+/},y];E.contains=L.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(L)});const $=[].concat(F,E.contains),K=$.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat($)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:K},Z={variants:[{match:[/class/,/\s+/,l,/\s+/,/extends/,/\s+/,i.concat(l,"(",i.concat(/\./,l),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,l],scope:{1:"keyword",3:"title.class"}}]},G={relevance:0,match:i.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...rh,...ih]}},te={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},D={variants:[{match:[/function/,/\s+/,l,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[I],illegal:/%/},ne={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function X(W){return i.concat("(?!",W.join("|"),")")}const fe={match:i.concat(/\b/,X([...oh,"super","import"].map(W=>`${W}\\s*\\(`)),l,i.lookahead(/\s*\(/)),className:"title.function",relevance:0},q={begin:i.concat(/\./,i.lookahead(i.concat(l,/(?![0-9A-Za-z$_(])/))),end:l,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},P={match:[/get|set/,/\s+/,l,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},le="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",ae={match:[/const|var|let/,/\s+/,l,/\s*/,/=\s*/,/(async\s*)?/,i.lookahead(le)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:K,CLASS_REFERENCE:G},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),te,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,b,x,C,T,F,{match:/\$\d+/},y,G,{scope:"attr",match:l+i.lookahead(":"),relevance:0},ae,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[F,e.REGEXP_MODE,{className:"function",begin:le,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:K}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:c},{begin:u.begin,"on:begin":u.isTrulyOpeningTag,end:u.end}],subLanguage:"xml",contains:[{begin:u.begin,end:u.end,skip:!0,contains:["self"]}]}]},D,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[I,e.inherit(e.TITLE_MODE,{begin:l,className:"title.function"})]},{match:/\.\.\./,relevance:0},q,{match:"\\$"+l,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[I]},fe,ne,Z,P,{match:/\$[(.]/}]}}function $x(e){const i={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},r={match:/[{}[\],:]/,className:"punctuation",relevance:0},l=["true","false","null"],s={scope:"literal",beginKeywords:l.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:l},contains:[i,r,e.QUOTE_STRING_MODE,s,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Di="[0-9](_*[0-9])*",Jl=`\\.(${Di})`,ea="[0-9a-fA-F](_*[0-9a-fA-F])*",jx={className:"number",variants:[{begin:`(\\b(${Di})((${Jl})|\\.)?|(${Jl}))[eE][+-]?(${Di})[fFdD]?\\b`},{begin:`\\b(${Di})((${Jl})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Jl})[fFdD]?\\b`},{begin:`\\b(${Di})[fFdD]\\b`},{begin:`\\b0[xX]((${ea})\\.?|(${ea})?\\.(${ea}))[pP][+-]?(${Di})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${ea})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Hx(e){const i={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},r={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},l={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},s={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},c={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},u={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[c,s]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,c,s]}]};s.contains.push(u);const d={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},p={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(u,{className:"string"}),"self"]}]},m=jx,g=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),y={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},E=y;return E.variants[1].contains=[y],y.variants[1].contains=[E],{name:"Kotlin",aliases:["kt","kts"],keywords:i,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,g,r,l,d,p,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:i,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:i,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[y,e.C_LINE_COMMENT_MODE,g],relevance:0},e.C_LINE_COMMENT_MODE,g,d,p,u,e.C_NUMBER_MODE]},g]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},d,p]},u,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` -`},m]}}const Kx=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Gx=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],Wx=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],Vx=[...Gx,...Wx],qx=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),lh=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),ah=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Yx=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),Qx=lh.concat(ah).sort().reverse();function Zx(e){const i=Kx(e),r=Qx,l="and or not only",s="[\\w-]+",c="("+s+"|@\\{"+s+"\\})",u=[],d=[],p=function(L){return{className:"string",begin:"~?"+L+".*?"+L}},m=function(L,$,K){return{className:L,begin:$,relevance:K}},g={$pattern:/[a-z-]+/,keyword:l,attribute:qx.join(" ")},y={begin:"\\(",end:"\\)",contains:d,keywords:g,relevance:0};d.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p("'"),p('"'),i.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},i.HEXCOLOR,y,m("variable","@@?"+s,10),m("variable","@\\{"+s+"\\}"),m("built_in","~?`[^`]*?`"),{className:"attribute",begin:s+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},i.IMPORTANT,{beginKeywords:"and not"},i.FUNCTION_DISPATCH);const E=d.concat({begin:/\{/,end:/\}/,contains:u}),b={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(d)},x={begin:c+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},i.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Yx.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:d}}]},C={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:g,returnEnd:!0,contains:d,relevance:0}},T={className:"variable",variants:[{begin:"@"+s+"\\s*:",relevance:15},{begin:"@"+s}],starts:{end:"[;}]",returnEnd:!0,contains:E}},w={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:c,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,m("keyword","all\\b"),m("variable","@\\{"+s+"\\}"),{begin:"\\b("+Vx.join("|")+")\\b",className:"selector-tag"},i.CSS_NUMBER_MODE,m("selector-tag",c,0),m("selector-id","#"+c),m("selector-class","\\."+c,0),m("selector-tag","&",0),i.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+lh.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+ah.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:E},{begin:"!important"},i.FUNCTION_DISPATCH]},F={begin:s+`:(:)?(${r.join("|")})`,returnBegin:!0,contains:[w]};return u.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,C,T,F,x,w,b,i.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:u}}function Xx(e){const i="\\[=*\\[",r="\\]=*\\]",l={begin:i,end:r,contains:["self"]},s=[e.COMMENT("--(?!"+i+")","$"),e.COMMENT("--"+i,r,{contains:[l],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:s.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:s}].concat(s)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:i,end:r,contains:[l],relevance:5}])}}function Jx(e){const i={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},l={begin:"^[-\\*]{3,}",end:"$"},s={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},c={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},u={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},d=/[A-Za-z][A-Za-z0-9+.-]*/,p={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:i.concat(/\[.+?\]\(/,d,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},m={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},g={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},y=e.inherit(m,{contains:[]}),E=e.inherit(g,{contains:[]});m.contains.push(E),g.contains.push(y);let b=[r,p];return[m,g,y,E].forEach(w=>{w.contains=w.contains.concat(b)}),b=b.concat(m,g),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:b},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:b}]}]},r,c,m,g,{className:"quote",begin:"^>\\s+",contains:b,end:"$"},s,l,p,u,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function t0(e){const i={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},r=/[a-zA-Z@][a-zA-Z0-9_]*/,d={"variable.language":["this","super"],$pattern:r,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},p={$pattern:r,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:d,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+p.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:p,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function n0(e){const i=e.regex,r=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],l=/[dualxmsipngr]{0,12}/,s={$pattern:/[\w.]+/,keyword:r.join(" ")},c={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:s},u={begin:/->\{/,end:/\}/},d={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},p={scope:"variable",variants:[{begin:/\$\d/},{begin:i.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[d]},m={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},g=[e.BACKSLASH_ESCAPE,c,p],y=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],E=(C,T,w="\\1")=>{const F=w==="\\1"?w:i.concat(w,T);return i.concat(i.concat("(?:",C,")"),T,/(?:\\.|[^\\\/])*?/,F,/(?:\\.|[^\\\/])*?/,w,l)},b=(C,T,w)=>i.concat(i.concat("(?:",C,")"),T,/(?:\\.|[^\\\/])*?/,w,l),x=[p,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),u,{className:"string",contains:g,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},m,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:E("s|tr|y",i.either(...y,{capture:!0}))},{begin:E("s|tr|y","\\(","\\)")},{begin:E("s|tr|y","\\[","\\]")},{begin:E("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:b("(?:m|qr)?",/\//,/\//)},{begin:b("m|qr",i.either(...y,{capture:!0}),/\1/)},{begin:b("m|qr",/\(/,/\)/)},{begin:b("m|qr",/\[/,/\]/)},{begin:b("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,d]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,d,m]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return c.contains=x,u.contains=x,{name:"Perl",aliases:["pl","pm"],keywords:s,contains:x}}function r0(e){const i=e.regex,r=/(?![A-Za-z0-9])(?![$])/,l=i.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,r),s=i.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,r),c=i.concat(/[A-Z]+/,r),u={scope:"variable",match:"\\$+"+l},d={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},p={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},m=e.inherit(e.APOS_STRING_MODE,{illegal:null}),g=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(p)}),y={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(p),"on:begin":(q,P)=>{P.data._beginMatch=q[1]||q[2]},"on:end":(q,P)=>{P.data._beginMatch!==q[1]&&P.ignoreMatch()}},E=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),b=`[ -]`,x={scope:"string",variants:[g,m,y,E]},C={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},T=["false","null","true"],w=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],F=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],$={keyword:w,literal:(q=>{const P=[];return q.forEach(le=>{P.push(le),le.toLowerCase()===le?P.push(le.toUpperCase()):P.push(le.toLowerCase())}),P})(T),built_in:F},K=q=>q.map(P=>P.replace(/\|\d+$/,"")),I={variants:[{match:[/new/,i.concat(b,"+"),i.concat("(?!",K(F).join("\\b|"),"\\b)"),s],scope:{1:"keyword",4:"title.class"}}]},Z=i.concat(l,"\\b(?!\\()"),G={variants:[{match:[i.concat(/::/,i.lookahead(/(?!class\b)/)),Z],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[s,i.concat(/::/,i.lookahead(/(?!class\b)/)),Z],scope:{1:"title.class",3:"variable.constant"}},{match:[s,i.concat("::",i.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[s,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},te={scope:"attr",match:i.concat(l,i.lookahead(":"),i.lookahead(/(?!::)/))},D={relevance:0,begin:/\(/,end:/\)/,keywords:$,contains:[te,u,G,e.C_BLOCK_COMMENT_MODE,x,C,I]},ne={relevance:0,match:[/\b/,i.concat("(?!fn\\b|function\\b|",K(w).join("\\b|"),"|",K(F).join("\\b|"),"\\b)"),l,i.concat(b,"*"),i.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[D]};D.contains.push(ne);const X=[te,G,e.C_BLOCK_COMMENT_MODE,x,C,I],fe={begin:i.concat(/#\[\s*\\?/,i.either(s,c)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:T,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:T,keyword:["new","array"]},contains:["self",...X]},...X,{scope:"meta",variants:[{match:s},{match:c}]}]};return{case_insensitive:!1,keywords:$,contains:[fe,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},d,{scope:"variable.language",match:/\$this\b/},u,ne,G,{match:[/const/,/\s/,l],scope:{1:"keyword",3:"variable.constant"}},I,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:$,contains:["self",fe,u,G,e.C_BLOCK_COMMENT_MODE,x,C]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},x,C]}}function i0(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function o0(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function l0(e){const i=e.regex,r=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),l=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],d={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:l,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},p={className:"meta",begin:/^(>>>|\.\.\.) /},m={className:"subst",begin:/\{/,end:/\}/,keywords:d,illegal:/#/},g={begin:/\{\{/,relevance:0},y={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,p],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,p],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,p,g,m]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,p,g,m]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,g,m]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,g,m]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},E="[0-9](_?[0-9])*",b=`(\\b(${E}))?\\.(${E})|\\b(${E})\\.`,x=`\\b|${l.join("|")}`,C={className:"number",relevance:0,variants:[{begin:`(\\b(${E})|(${b}))[eE][+-]?(${E})[jJ]?(?=${x})`},{begin:`(${b})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${x})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${x})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${x})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${x})`},{begin:`\\b(${E})[jJ](?=${x})`}]},T={className:"comment",begin:i.lookahead(/# type:/),end:/$/,keywords:d,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},w={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:["self",p,C,y,e.HASH_COMMENT_MODE]}]};return m.contains=[y,C,p],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:d,illegal:/(<\/|\?)|=>/,contains:[p,C,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},y,T,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,r],scope:{1:"keyword",3:"title.function"},contains:[w]},{variants:[{match:[/\bclass/,/\s+/,r,/\s*/,/\(\s*/,r,/\s*\)/]},{match:[/\bclass/,/\s+/,r]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[C,w,y]}]}}function a0(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function s0(e){const i=e.regex,r=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,l=i.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),s=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,c=i.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:r,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:i.lookahead(i.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:r},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[s,l]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,l]},{scope:{1:"punctuation",2:"number"},match:[c,l]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,l]}]},{scope:{3:"operator"},match:[r,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:s},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:c},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function u0(e){const i=e.regex,r="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",l=i.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),s=i.concat(l,/(::\w+)*/),u={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},d={className:"doctag",begin:"@[A-Za-z]+"},p={begin:"#<",end:">"},m=[e.COMMENT("#","$",{contains:[d]}),e.COMMENT("^=begin","^=end",{contains:[d],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],g={className:"subst",begin:/#\{/,end:/\}/,keywords:u},y={className:"string",contains:[e.BACKSLASH_ESCAPE,g],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:i.concat(/<<[-~]?'?/,i.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,g]})]}]},E="[1-9](_?[0-9])*|0",b="[0-9](_?[0-9])*",x={className:"number",relevance:0,variants:[{begin:`\\b(${E})(\\.(${b}))?([eE][+-]?(${b})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},C={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:u}]},I=[y,{variants:[{match:[/class\s+/,s,/\s+<\s+/,s]},{match:[/\b(class|module)\s+/,s]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:u},{match:[/(include|extend)\s+/,s],scope:{2:"title.class"},keywords:u},{relevance:0,match:[s,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:l,scope:"title.class"},{match:[/def/,/\s+/,r],scope:{1:"keyword",3:"title.function"},contains:[C]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[y,{begin:r}],relevance:0},x,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:u},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,g],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(p,m),relevance:0}].concat(p,m);g.contains=I,C.contains=I;const D=[{begin:/^\s*=>/,starts:{end:"$",contains:I}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:u,contains:I}}];return m.unshift(p),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:u,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(D).concat(m).concat(I)}}function c0(e){const i=e.regex,r=/(r#)?/,l=i.concat(r,e.UNDERSCORE_IDENT_RE),s=i.concat(r,e.IDENT_RE),c={className:"title.function.invoke",relevance:0,begin:i.concat(/\b/,/(?!let|for|while|if|else|match\b)/,s,i.lookahead(/\s*\(/))},u="([ui](8|16|32|64|128|size)|f(32|64))?",d=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],p=["true","false","Some","None","Ok","Err"],m=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],g=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:g,keyword:d,literal:p,built_in:m},illegal:""},c]}}const d0=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),f0=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],p0=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],m0=[...f0,...p0],h0=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),g0=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),y0=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),b0=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function E0(e){const i=d0(e),r=y0,l=g0,s="@[a-z-]+",c="and or not only",d={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,i.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},i.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+m0.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+l.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+r.join("|")+")"},d,{begin:/\(/,end:/\)/,contains:[i.CSS_NUMBER_MODE]},i.CSS_VARIABLE,{className:"attribute",begin:"\\b("+b0.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[i.BLOCK_COMMENT,d,i.HEXCOLOR,i.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,i.IMPORTANT,i.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:s,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:c,attribute:h0.join(" ")},contains:[{begin:s,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},d,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,i.HEXCOLOR,i.CSS_NUMBER_MODE]},i.FUNCTION_DISPATCH]}}function _0(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function v0(e){const i=e.regex,r=e.COMMENT("--","$"),l={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={begin:/"/,end:/"/,contains:[{match:/""/}]},c=["true","false","unknown"],u=["double precision","large object","with timezone","without timezone"],d=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],p=["add","asc","collation","desc","final","first","last","view"],m=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],g=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],y=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],E=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],b=g,x=[...m,...p].filter(K=>!g.includes(K)),C={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},T={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},w={match:i.concat(/\b/,i.either(...b),/\s*\(/),relevance:0,keywords:{built_in:b}};function F(K){return i.concat(/\b/,i.either(...K.map(I=>I.replace(/\s+/,"\\s+"))),/\b/)}const L={scope:"keyword",match:F(E),relevance:0};function $(K,{exceptions:I,when:Z}={}){const G=Z;return I=I||[],K.map(te=>te.match(/\|\d+$/)||I.includes(te)?te:G(te)?`${te}|0`:te)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:$(x,{when:K=>K.length<3}),literal:c,type:d,built_in:y},contains:[{scope:"type",match:F(u)},L,w,C,l,s,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,r,T]}}function sh(e){return e?typeof e=="string"?e:e.source:null}function Co(e){return Ze("(?=",e,")")}function Ze(...e){return e.map(r=>sh(r)).join("")}function k0(e){const i=e[e.length-1];return typeof i=="object"&&i.constructor===Object?(e.splice(e.length-1,1),i):{}}function $t(...e){return"("+(k0(e).capture?"":"?:")+e.map(l=>sh(l)).join("|")+")"}const rc=e=>Ze(/\b/,e,/\w$/.test(e)?/\b/:/\B/),w0=["Protocol","Type"].map(rc),Cp=["init","self"].map(rc),x0=["Any","Self"],yu=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],Tp=["false","nil","true"],S0=["assignment","associativity","higherThan","left","lowerThan","none","right"],N0=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Ap=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],uh=$t(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),ch=$t(uh,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),bu=Ze(uh,ch,"*"),dh=$t(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),aa=$t(dh,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),jn=Ze(dh,aa,"*"),ta=Ze(/[A-Z]/,aa,"*"),C0=["attached","autoclosure",Ze(/convention\(/,$t("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Ze(/objc\(/,jn,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],T0=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function A0(e){const i={match:/\s+/,relevance:0},r=e.COMMENT("/\\*","\\*/",{contains:["self"]}),l=[e.C_LINE_COMMENT_MODE,r],s={match:[/\./,$t(...w0,...Cp)],className:{2:"keyword"}},c={match:Ze(/\./,$t(...yu)),relevance:0},u=yu.filter(Ge=>typeof Ge=="string").concat(["_|0"]),d=yu.filter(Ge=>typeof Ge!="string").concat(x0).map(rc),p={variants:[{className:"keyword",match:$t(...d,...Cp)}]},m={$pattern:$t(/\b\w+/,/#\w+/),keyword:u.concat(N0),literal:Tp},g=[s,c,p],y={match:Ze(/\./,$t(...Ap)),relevance:0},E={className:"built_in",match:Ze(/\b/,$t(...Ap),/(?=\()/)},b=[y,E],x={match:/->/,relevance:0},C={className:"operator",relevance:0,variants:[{match:bu},{match:`\\.(\\.|${ch})+`}]},T=[x,C],w="([0-9]_*)+",F="([0-9a-fA-F]_*)+",L={className:"number",relevance:0,variants:[{match:`\\b(${w})(\\.(${w}))?([eE][+-]?(${w}))?\\b`},{match:`\\b0x(${F})(\\.(${F}))?([pP][+-]?(${w}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},$=(Ge="")=>({className:"subst",variants:[{match:Ze(/\\/,Ge,/[0\\tnr"']/)},{match:Ze(/\\/,Ge,/u\{[0-9a-fA-F]{1,8}\}/)}]}),K=(Ge="")=>({className:"subst",match:Ze(/\\/,Ge,/[\t ]*(?:[\r\n]|\r\n)/)}),I=(Ge="")=>({className:"subst",label:"interpol",begin:Ze(/\\/,Ge,/\(/),end:/\)/}),Z=(Ge="")=>({begin:Ze(Ge,/"""/),end:Ze(/"""/,Ge),contains:[$(Ge),K(Ge),I(Ge)]}),G=(Ge="")=>({begin:Ze(Ge,/"/),end:Ze(/"/,Ge),contains:[$(Ge),I(Ge)]}),te={className:"string",variants:[Z(),Z("#"),Z("##"),Z("###"),G(),G("#"),G("##"),G("###")]},D=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],ne={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:D},X=Ge=>{const tn=Ze(Ge,/\//),un=Ze(/\//,Ge);return{begin:tn,end:un,contains:[...D,{scope:"comment",begin:`#(?!.*${un})`,end:/$/}]}},fe={scope:"regexp",variants:[X("###"),X("##"),X("#"),ne]},q={match:Ze(/`/,jn,/`/)},P={className:"variable",match:/\$\d+/},le={className:"variable",match:`\\$${aa}+`},ae=[q,P,le],W={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:T0,contains:[...T,L,te]}]}},de={scope:"keyword",match:Ze(/@/,$t(...C0),Co($t(/\(/,/\s+/)))},v={scope:"meta",match:Ze(/@/,jn)},O=[W,de,v],j={match:Co(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Ze(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,aa,"+")},{className:"type",match:ta,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Ze(/\s+&\s+/,Co(ta)),relevance:0}]},S={begin://,keywords:m,contains:[...l,...g,...O,x,j]};j.contains.push(S);const we={match:Ze(jn,/\s*:/),keywords:"_|0",relevance:0},Me={begin:/\(/,end:/\)/,relevance:0,keywords:m,contains:["self",we,...l,fe,...g,...b,...T,L,te,...ae,...O,j]},ke={begin://,keywords:"repeat each",contains:[...l,j]},$e={begin:$t(Co(Ze(jn,/\s*:/)),Co(Ze(jn,/\s+/,jn,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:jn}]},De={begin:/\(/,end:/\)/,keywords:m,contains:[$e,...l,...g,...T,L,te,...O,j,Me],endsParent:!0,illegal:/["']/},Ke={match:[/(func|macro)/,/\s+/,$t(q.match,jn,bu)],className:{1:"keyword",3:"title.function"},contains:[ke,De,i],illegal:[/\[/,/%/]},Xe={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[ke,De,i],illegal:/\[|%/},en={match:[/operator/,/\s+/,bu],className:{1:"keyword",3:"title"}},ar={begin:[/precedencegroup/,/\s+/,ta],className:{1:"keyword",3:"title"},contains:[j],keywords:[...S0,...Tp],end:/}/},In={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Wn={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Vn={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,jn,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:m,contains:[ke,...g,{begin:/:/,end:/\{/,keywords:m,contains:[{scope:"title.class.inherited",match:ta},...g],relevance:0}]};for(const Ge of te.variants){const tn=Ge.contains.find(Mn=>Mn.label==="interpol");tn.keywords=m;const un=[...g,...b,...T,L,te,...ae];tn.contains=[...un,{begin:/\(/,end:/\)/,contains:["self",...un]}]}return{name:"Swift",keywords:m,contains:[...l,Ke,Xe,In,Wn,Vn,en,ar,{beginKeywords:"import",end:/$/,contains:[...l],relevance:0},fe,...g,...b,...T,L,te,...ae,...O,j,Me]}}const sa="[A-Za-z$_][0-9A-Za-z$_]*",fh=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],ph=["true","false","null","undefined","NaN","Infinity"],mh=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],hh=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],gh=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],yh=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],bh=[].concat(gh,mh,hh);function R0(e){const i=e.regex,r=(W,{after:de})=>{const v="",end:""},c=/<[A-Za-z0-9\\._:-]+\s*\/>/,u={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(W,de)=>{const v=W[0].length+W.index,O=W.input[v];if(O==="<"||O===","){de.ignoreMatch();return}O===">"&&(r(W,{after:v})||de.ignoreMatch());let j;const S=W.input.substring(v);if(j=S.match(/^\s*=/)){de.ignoreMatch();return}if((j=S.match(/^\s+extends\s+/))&&j.index===0){de.ignoreMatch();return}}},d={$pattern:sa,keyword:fh,literal:ph,built_in:bh,"variable.language":yh},p="[0-9](_?[0-9])*",m=`\\.(${p})`,g="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",y={className:"number",variants:[{begin:`(\\b(${g})((${m})|\\.)?|(${m}))[eE][+-]?(${p})\\b`},{begin:`\\b(${g})\\b((${m})\\b|\\.)?|(${m})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},E={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},b={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,E],subLanguage:"xml"}},x={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,E],subLanguage:"css"}},C={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,E],subLanguage:"graphql"}},T={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,E]},F={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:l+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},L=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,b,x,C,T,{match:/\$\d+/},y];E.contains=L.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(L)});const $=[].concat(F,E.contains),K=$.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat($)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:K},Z={variants:[{match:[/class/,/\s+/,l,/\s+/,/extends/,/\s+/,i.concat(l,"(",i.concat(/\./,l),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,l],scope:{1:"keyword",3:"title.class"}}]},G={relevance:0,match:i.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...mh,...hh]}},te={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},D={variants:[{match:[/function/,/\s+/,l,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[I],illegal:/%/},ne={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function X(W){return i.concat("(?!",W.join("|"),")")}const fe={match:i.concat(/\b/,X([...gh,"super","import"].map(W=>`${W}\\s*\\(`)),l,i.lookahead(/\s*\(/)),className:"title.function",relevance:0},q={begin:i.concat(/\./,i.lookahead(i.concat(l,/(?![0-9A-Za-z$_(])/))),end:l,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},P={match:[/get|set/,/\s+/,l,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},le="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",ae={match:[/const|var|let/,/\s+/,l,/\s*/,/=\s*/,/(async\s*)?/,i.lookahead(le)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:K,CLASS_REFERENCE:G},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),te,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,b,x,C,T,F,{match:/\$\d+/},y,G,{scope:"attr",match:l+i.lookahead(":"),relevance:0},ae,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[F,e.REGEXP_MODE,{className:"function",begin:le,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:K}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:c},{begin:u.begin,"on:begin":u.isTrulyOpeningTag,end:u.end}],subLanguage:"xml",contains:[{begin:u.begin,end:u.end,skip:!0,contains:["self"]}]}]},D,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[I,e.inherit(e.TITLE_MODE,{begin:l,className:"title.function"})]},{match:/\.\.\./,relevance:0},q,{match:"\\$"+l,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[I]},fe,ne,Z,P,{match:/\$[(.]/}]}}function O0(e){const i=e.regex,r=R0(e),l=sa,s=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],c={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},u={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:s},contains:[r.exports.CLASS_REFERENCE]},d={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},p=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],m={$pattern:sa,keyword:fh.concat(p),literal:ph,built_in:bh.concat(s),"variable.language":yh},g={className:"meta",begin:"@"+l},y=(C,T,w)=>{const F=C.contains.findIndex(L=>L.label===T);if(F===-1)throw new Error("can not find mode to replace");C.contains.splice(F,1,w)};Object.assign(r.keywords,m),r.exports.PARAMS_CONTAINS.push(g);const E=r.contains.find(C=>C.scope==="attr"),b=Object.assign({},E,{match:i.concat(l,i.lookahead(/\s*\?:/))});r.exports.PARAMS_CONTAINS.push([r.exports.CLASS_REFERENCE,E,b]),r.contains=r.contains.concat([g,c,u,b]),y(r,"shebang",e.SHEBANG()),y(r,"use_strict",d);const x=r.contains.find(C=>C.label==="func.def");return x.relevance=0,Object.assign(r,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),r}function I0(e){const i=e.regex,r={className:"string",begin:/"(""|[^/n])"C\b/},l={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},s=/\d{1,2}\/\d{1,2}\/\d{4}/,c=/\d{4}-\d{1,2}-\d{1,2}/,u=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,d=/\d{1,2}(:\d{1,2}){1,2}/,p={className:"literal",variants:[{begin:i.concat(/# */,i.either(c,s),/ *#/)},{begin:i.concat(/# */,d,/ *#/)},{begin:i.concat(/# */,u,/ *#/)},{begin:i.concat(/# */,i.either(c,s),/ +/,i.either(u,d),/ *#/)}]},m={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},g={className:"label",begin:/^\w+:/},y=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),E=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[r,l,p,m,g,y,E,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[E]}]}}function M0(e){e.regex;const i=e.COMMENT(/\(;/,/;\)/);i.contains.push("self");const r=e.COMMENT(/;;/,/$/),l=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],s={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},c={className:"variable",begin:/\$[\w_]+/},u={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},d={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},p={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},m={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:l},contains:[r,i,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},c,u,s,e.QUOTE_STRING_MODE,p,m,d]}}function L0(e){const i=e.regex,r=i.concat(/[\p{L}_]/u,i.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),l=/[\p{L}0-9._:-]+/u,s={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},c={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},u=e.inherit(c,{begin:/\(/,end:/\)/}),d=e.inherit(e.APOS_STRING_MODE,{className:"string"}),p=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),m={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[c,p,d,u,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[c,u,p,d]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[p]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[m],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[m],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:i.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:r,relevance:0,starts:m}]},{className:"tag",begin:i.concat(/<\//,i.lookahead(i.concat(r,/>/))),contains:[{className:"name",begin:r,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function D0(e){const i="true false yes no null",r="[\\w#;/?:@&=+$,.~*'()[\\]]+",l={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},s={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},c={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},u={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,s]},d=e.inherit(u,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),E={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},b={end:",",endsWithParent:!0,excludeEnd:!0,keywords:i,relevance:0},x={begin:/\{/,end:/\}/,contains:[b],illegal:"\\n",relevance:0},C={begin:"\\[",end:"\\]",contains:[b],illegal:"\\n",relevance:0},T=[l,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+r},{className:"type",begin:"!<"+r+">"},{className:"type",begin:"!"+r},{className:"type",begin:"!!"+r},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:i,keywords:{literal:i}},E,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},x,C,c,u],w=[...T];return w.pop(),w.push(d),b.contains=w,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:T}}const P0={arduino:yx,bash:bx,c:Ex,cpp:_x,csharp:vx,css:Rx,diff:Ox,go:Ix,graphql:Mx,ini:Lx,java:Dx,javascript:Ux,json:$x,kotlin:Hx,less:Zx,lua:Xx,makefile:Jx,markdown:e0,objectivec:t0,perl:n0,php:r0,"php-template":i0,plaintext:o0,python:l0,"python-repl":a0,r:s0,ruby:u0,rust:c0,scss:E0,shell:_0,sql:v0,swift:A0,typescript:O0,vbnet:I0,wasm:M0,xml:L0,yaml:D0};var Eu,Rp;function z0(){if(Rp)return Eu;Rp=1;function e(A){return A instanceof Map?A.clear=A.delete=A.set=function(){throw new Error("map is read-only")}:A instanceof Set&&(A.add=A.clear=A.delete=function(){throw new Error("set is read-only")}),Object.freeze(A),Object.getOwnPropertyNames(A).forEach(V=>{const ce=A[V],Re=typeof ce;(Re==="object"||Re==="function")&&!Object.isFrozen(ce)&&e(ce)}),A}class i{constructor(V){V.data===void 0&&(V.data={}),this.data=V.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function r(A){return A.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function l(A,...V){const ce=Object.create(null);for(const Re in A)ce[Re]=A[Re];return V.forEach(function(Re){for(const rt in Re)ce[rt]=Re[rt]}),ce}const s="
",c=A=>!!A.scope,u=(A,{prefix:V})=>{if(A.startsWith("language:"))return A.replace("language:","language-");if(A.includes(".")){const ce=A.split(".");return[`${V}${ce.shift()}`,...ce.map((Re,rt)=>`${Re}${"_".repeat(rt+1)}`)].join(" ")}return`${V}${A}`};class d{constructor(V,ce){this.buffer="",this.classPrefix=ce.classPrefix,V.walk(this)}addText(V){this.buffer+=r(V)}openNode(V){if(!c(V))return;const ce=u(V.scope,{prefix:this.classPrefix});this.span(ce)}closeNode(V){c(V)&&(this.buffer+=s)}value(){return this.buffer}span(V){this.buffer+=``}}const p=(A={})=>{const V={children:[]};return Object.assign(V,A),V};class m{constructor(){this.rootNode=p(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(V){this.top.children.push(V)}openNode(V){const ce=p({scope:V});this.add(ce),this.stack.push(ce)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(V){return this.constructor._walk(V,this.rootNode)}static _walk(V,ce){return typeof ce=="string"?V.addText(ce):ce.children&&(V.openNode(ce),ce.children.forEach(Re=>this._walk(V,Re)),V.closeNode(ce)),V}static _collapse(V){typeof V!="string"&&V.children&&(V.children.every(ce=>typeof ce=="string")?V.children=[V.children.join("")]:V.children.forEach(ce=>{m._collapse(ce)}))}}class g extends m{constructor(V){super(),this.options=V}addText(V){V!==""&&this.add(V)}startScope(V){this.openNode(V)}endScope(){this.closeNode()}__addSublanguage(V,ce){const Re=V.root;ce&&(Re.scope=`language:${ce}`),this.add(Re)}toHTML(){return new d(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function y(A){return A?typeof A=="string"?A:A.source:null}function E(A){return C("(?=",A,")")}function b(A){return C("(?:",A,")*")}function x(A){return C("(?:",A,")?")}function C(...A){return A.map(ce=>y(ce)).join("")}function T(A){const V=A[A.length-1];return typeof V=="object"&&V.constructor===Object?(A.splice(A.length-1,1),V):{}}function w(...A){return"("+(T(A).capture?"":"?:")+A.map(Re=>y(Re)).join("|")+")"}function F(A){return new RegExp(A.toString()+"|").exec("").length-1}function L(A,V){const ce=A&&A.exec(V);return ce&&ce.index===0}const $=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function K(A,{joinWith:V}){let ce=0;return A.map(Re=>{ce+=1;const rt=ce;let lt=y(Re),he="";for(;lt.length>0;){const me=$.exec(lt);if(!me){he+=lt;break}he+=lt.substring(0,me.index),lt=lt.substring(me.index+me[0].length),me[0][0]==="\\"&&me[1]?he+="\\"+String(Number(me[1])+rt):(he+=me[0],me[0]==="("&&ce++)}return he}).map(Re=>`(${Re})`).join(V)}const I=/\b\B/,Z="[a-zA-Z]\\w*",G="[a-zA-Z_]\\w*",te="\\b\\d+(\\.\\d+)?",D="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",ne="\\b(0b[01]+)",X="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",fe=(A={})=>{const V=/^#![ ]*\//;return A.binary&&(A.begin=C(V,/.*\b/,A.binary,/\b.*/)),l({scope:"meta",begin:V,end:/$/,relevance:0,"on:begin":(ce,Re)=>{ce.index!==0&&Re.ignoreMatch()}},A)},q={begin:"\\\\[\\s\\S]",relevance:0},P={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[q]},le={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[q]},ae={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},W=function(A,V,ce={}){const Re=l({scope:"comment",begin:A,end:V,contains:[]},ce);Re.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const rt=w("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return Re.contains.push({begin:C(/[ ]+/,"(",rt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Re},de=W("//","$"),v=W("/\\*","\\*/"),O=W("#","$"),j={scope:"number",begin:te,relevance:0},S={scope:"number",begin:D,relevance:0},we={scope:"number",begin:ne,relevance:0},Me={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[q,{begin:/\[/,end:/\]/,relevance:0,contains:[q]}]},ke={scope:"title",begin:Z,relevance:0},$e={scope:"title",begin:G,relevance:0},De={begin:"\\.\\s*"+G,relevance:0};var Xe=Object.freeze({__proto__:null,APOS_STRING_MODE:P,BACKSLASH_ESCAPE:q,BINARY_NUMBER_MODE:we,BINARY_NUMBER_RE:ne,COMMENT:W,C_BLOCK_COMMENT_MODE:v,C_LINE_COMMENT_MODE:de,C_NUMBER_MODE:S,C_NUMBER_RE:D,END_SAME_AS_BEGIN:function(A){return Object.assign(A,{"on:begin":(V,ce)=>{ce.data._beginMatch=V[1]},"on:end":(V,ce)=>{ce.data._beginMatch!==V[1]&&ce.ignoreMatch()}})},HASH_COMMENT_MODE:O,IDENT_RE:Z,MATCH_NOTHING_RE:I,METHOD_GUARD:De,NUMBER_MODE:j,NUMBER_RE:te,PHRASAL_WORDS_MODE:ae,QUOTE_STRING_MODE:le,REGEXP_MODE:Me,RE_STARTERS_RE:X,SHEBANG:fe,TITLE_MODE:ke,UNDERSCORE_IDENT_RE:G,UNDERSCORE_TITLE_MODE:$e});function en(A,V){A.input[A.index-1]==="."&&V.ignoreMatch()}function ar(A,V){A.className!==void 0&&(A.scope=A.className,delete A.className)}function In(A,V){V&&A.beginKeywords&&(A.begin="\\b("+A.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",A.__beforeBegin=en,A.keywords=A.keywords||A.beginKeywords,delete A.beginKeywords,A.relevance===void 0&&(A.relevance=0))}function Wn(A,V){Array.isArray(A.illegal)&&(A.illegal=w(...A.illegal))}function Vn(A,V){if(A.match){if(A.begin||A.end)throw new Error("begin & end are not supported with match");A.begin=A.match,delete A.match}}function Ge(A,V){A.relevance===void 0&&(A.relevance=1)}const tn=(A,V)=>{if(!A.beforeMatch)return;if(A.starts)throw new Error("beforeMatch cannot be used with starts");const ce=Object.assign({},A);Object.keys(A).forEach(Re=>{delete A[Re]}),A.keywords=ce.keywords,A.begin=C(ce.beforeMatch,E(ce.begin)),A.starts={relevance:0,contains:[Object.assign(ce,{endsParent:!0})]},A.relevance=0,delete ce.beforeMatch},un=["of","and","for","in","not","or","if","then","parent","list","value"],Mn="keyword";function _n(A,V,ce=Mn){const Re=Object.create(null);return typeof A=="string"?rt(ce,A.split(" ")):Array.isArray(A)?rt(ce,A):Object.keys(A).forEach(function(lt){Object.assign(Re,_n(A[lt],V,lt))}),Re;function rt(lt,he){V&&(he=he.map(me=>me.toLowerCase())),he.forEach(function(me){const xe=me.split("|");Re[xe[0]]=[lt,Ln(xe[0],xe[1])]})}}function Ln(A,V){return V?Number(V):Or(A)?0:1}function Or(A){return un.includes(A.toLowerCase())}const Ir={},cn=A=>{console.error(A)},Mr=(A,...V)=>{console.log(`WARN: ${A}`,...V)},H=(A,V)=>{Ir[`${A}/${V}`]||(console.log(`Deprecated as of ${A}. ${V}`),Ir[`${A}/${V}`]=!0)},oe=new Error;function Te(A,V,{key:ce}){let Re=0;const rt=A[ce],lt={},he={};for(let me=1;me<=V.length;me++)he[me+Re]=rt[me],lt[me+Re]=!0,Re+=F(V[me-1]);A[ce]=he,A[ce]._emit=lt,A[ce]._multi=!0}function Pe(A){if(Array.isArray(A.begin)){if(A.skip||A.excludeBegin||A.returnBegin)throw cn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),oe;if(typeof A.beginScope!="object"||A.beginScope===null)throw cn("beginScope must be object"),oe;Te(A,A.begin,{key:"beginScope"}),A.begin=K(A.begin,{joinWith:""})}}function je(A){if(Array.isArray(A.end)){if(A.skip||A.excludeEnd||A.returnEnd)throw cn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),oe;if(typeof A.endScope!="object"||A.endScope===null)throw cn("endScope must be object"),oe;Te(A,A.end,{key:"endScope"}),A.end=K(A.end,{joinWith:""})}}function _t(A){A.scope&&typeof A.scope=="object"&&A.scope!==null&&(A.beginScope=A.scope,delete A.scope)}function vn(A){_t(A),typeof A.beginScope=="string"&&(A.beginScope={_wrap:A.beginScope}),typeof A.endScope=="string"&&(A.endScope={_wrap:A.endScope}),Pe(A),je(A)}function Gt(A){function V(he,me){return new RegExp(y(he),"m"+(A.case_insensitive?"i":"")+(A.unicodeRegex?"u":"")+(me?"g":""))}class ce{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(me,xe){xe.position=this.position++,this.matchIndexes[this.matchAt]=xe,this.regexes.push([xe,me]),this.matchAt+=F(me)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const me=this.regexes.map(xe=>xe[1]);this.matcherRe=V(K(me,{joinWith:"|"}),!0),this.lastIndex=0}exec(me){this.matcherRe.lastIndex=this.lastIndex;const xe=this.matcherRe.exec(me);if(!xe)return null;const yt=xe.findIndex((Dn,ur)=>ur>0&&Dn!==void 0),tt=this.matchIndexes[yt];return xe.splice(0,yt),Object.assign(xe,tt)}}class Re{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(me){if(this.multiRegexes[me])return this.multiRegexes[me];const xe=new ce;return this.rules.slice(me).forEach(([yt,tt])=>xe.addRule(yt,tt)),xe.compile(),this.multiRegexes[me]=xe,xe}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(me,xe){this.rules.push([me,xe]),xe.type==="begin"&&this.count++}exec(me){const xe=this.getMatcher(this.regexIndex);xe.lastIndex=this.lastIndex;let yt=xe.exec(me);if(this.resumingScanAtSamePosition()&&!(yt&&yt.index===this.lastIndex)){const tt=this.getMatcher(0);tt.lastIndex=this.lastIndex+1,yt=tt.exec(me)}return yt&&(this.regexIndex+=yt.position+1,this.regexIndex===this.count&&this.considerAll()),yt}}function rt(he){const me=new Re;return he.contains.forEach(xe=>me.addRule(xe.begin,{rule:xe,type:"begin"})),he.terminatorEnd&&me.addRule(he.terminatorEnd,{type:"end"}),he.illegal&&me.addRule(he.illegal,{type:"illegal"}),me}function lt(he,me){const xe=he;if(he.isCompiled)return xe;[ar,Vn,vn,tn].forEach(tt=>tt(he,me)),A.compilerExtensions.forEach(tt=>tt(he,me)),he.__beforeBegin=null,[In,Wn,Ge].forEach(tt=>tt(he,me)),he.isCompiled=!0;let yt=null;return typeof he.keywords=="object"&&he.keywords.$pattern&&(he.keywords=Object.assign({},he.keywords),yt=he.keywords.$pattern,delete he.keywords.$pattern),yt=yt||/\w+/,he.keywords&&(he.keywords=_n(he.keywords,A.case_insensitive)),xe.keywordPatternRe=V(yt,!0),me&&(he.begin||(he.begin=/\B|\b/),xe.beginRe=V(xe.begin),!he.end&&!he.endsWithParent&&(he.end=/\B|\b/),he.end&&(xe.endRe=V(xe.end)),xe.terminatorEnd=y(xe.end)||"",he.endsWithParent&&me.terminatorEnd&&(xe.terminatorEnd+=(he.end?"|":"")+me.terminatorEnd)),he.illegal&&(xe.illegalRe=V(he.illegal)),he.contains||(he.contains=[]),he.contains=[].concat(...he.contains.map(function(tt){return qn(tt==="self"?he:tt)})),he.contains.forEach(function(tt){lt(tt,xe)}),he.starts&<(he.starts,me),xe.matcher=rt(xe),xe}if(A.compilerExtensions||(A.compilerExtensions=[]),A.contains&&A.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return A.classNameAliases=l(A.classNameAliases||{}),lt(A)}function kn(A){return A?A.endsWithParent||kn(A.starts):!1}function qn(A){return A.variants&&!A.cachedVariants&&(A.cachedVariants=A.variants.map(function(V){return l(A,{variants:null},V)})),A.cachedVariants?A.cachedVariants:kn(A)?l(A,{starts:A.starts?l(A.starts):null}):Object.isFrozen(A)?l(A):A}var vt="11.11.1";class dn extends Error{constructor(V,ce){super(V),this.name="HTMLInjectionError",this.html=ce}}const Tt=r,oi=l,li=Symbol("nomatch"),sr=7,Yn=function(A){const V=Object.create(null),ce=Object.create(null),Re=[];let rt=!0;const lt="Could not find the language '{}', did you forget to load/include a language module?",he={disableAutodetect:!0,name:"Plain text",contains:[]};let me={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:g};function xe(re){return me.noHighlightRe.test(re)}function yt(re){let ve=re.className+" ";ve+=re.parentNode?re.parentNode.className:"";const ze=me.languageDetectRe.exec(ve);if(ze){const Be=wn(ze[1]);return Be||(Mr(lt.replace("{}",ze[1])),Mr("Falling back to no-highlight mode for this block.",re)),Be?ze[1]:"no-highlight"}return ve.split(/\s+/).find(Be=>xe(Be)||wn(Be))}function tt(re,ve,ze){let Be="",mt="";typeof ve=="object"?(Be=re,ze=ve.ignoreIllegals,mt=ve.language):(H("10.7.0","highlight(lang, code, ...args) has been deprecated."),H("10.7.0",`Please use highlight(code, options) instead. -https://github.com/highlightjs/highlight.js/issues/2277`),mt=re,Be=ve),ze===void 0&&(ze=!0);const ut={code:Be,language:mt};Dr("before:highlight",ut);const Pn=ut.result?ut.result:Dn(ut.language,ut.code,ze);return Pn.code=ut.code,Dr("after:highlight",Pn),Pn}function Dn(re,ve,ze,Be){const mt=Object.create(null);function ut(se,ge){return se.keywords[ge]}function Pn(){if(!Ie.keywords){ht.addText(Qe);return}let se=0;Ie.keywordPatternRe.lastIndex=0;let ge=Ie.keywordPatternRe.exec(Qe),Ae="";for(;ge;){Ae+=Qe.substring(se,ge.index);const He=fn.case_insensitive?ge[0].toLowerCase():ge[0],ft=ut(Ie,He);if(ft){const[xt,_a]=ft;if(ht.addText(Ae),Ae="",mt[He]=(mt[He]||0)+1,mt[He]<=sr&&(Fr+=_a),xt.startsWith("_"))Ae+=ge[0];else{const Go=fn.classNameAliases[xt]||xt;Ft(ge[0],Go)}}else Ae+=ge[0];se=Ie.keywordPatternRe.lastIndex,ge=Ie.keywordPatternRe.exec(Qe)}Ae+=Qe.substring(se),ht.addText(Ae)}function ui(){if(Qe==="")return;let se=null;if(typeof Ie.subLanguage=="string"){if(!V[Ie.subLanguage]){ht.addText(Qe);return}se=Dn(Ie.subLanguage,Qe,!0,Gi[Ie.subLanguage]),Gi[Ie.subLanguage]=se._top}else se=Lr(Qe,Ie.subLanguage.length?Ie.subLanguage:null);Ie.relevance>0&&(Fr+=se.relevance),ht.__addSublanguage(se._emitter,se.language)}function zt(){Ie.subLanguage!=null?ui():Pn(),Qe=""}function Ft(se,ge){se!==""&&(ht.startScope(ge),ht.addText(se),ht.endScope())}function Pr(se,ge){let Ae=1;const He=ge.length-1;for(;Ae<=He;){if(!se._emit[Ae]){Ae++;continue}const ft=fn.classNameAliases[se[Ae]]||se[Ae],xt=ge[Ae];ft?Ft(xt,ft):(Qe=xt,Pn(),Qe=""),Ae++}}function cr(se,ge){return se.scope&&typeof se.scope=="string"&&ht.openNode(fn.classNameAliases[se.scope]||se.scope),se.beginScope&&(se.beginScope._wrap?(Ft(Qe,fn.classNameAliases[se.beginScope._wrap]||se.beginScope._wrap),Qe=""):se.beginScope._multi&&(Pr(se.beginScope,ge),Qe="")),Ie=Object.create(se,{parent:{value:Ie}}),Ie}function zr(se,ge,Ae){let He=L(se.endRe,Ae);if(He){if(se["on:end"]){const ft=new i(se);se["on:end"](ge,ft),ft.isMatchIgnored&&(He=!1)}if(He){for(;se.endsParent&&se.parent;)se=se.parent;return se}}if(se.endsWithParent)return zr(se.parent,ge,Ae)}function ba(se){return Ie.matcher.regexIndex===0?(Qe+=se[0],1):(pr=!0,0)}function Ea(se){const ge=se[0],Ae=se.rule,He=new i(Ae),ft=[Ae.__beforeBegin,Ae["on:begin"]];for(const xt of ft)if(xt&&(xt(se,He),He.isMatchIgnored))return ba(ge);return Ae.skip?Qe+=ge:(Ae.excludeBegin&&(Qe+=ge),zt(),!Ae.returnBegin&&!Ae.excludeBegin&&(Qe=ge)),cr(Ae,se),Ae.returnBegin?0:ge.length}function Hi(se){const ge=se[0],Ae=ve.substring(se.index),He=zr(Ie,se,Ae);if(!He)return li;const ft=Ie;Ie.endScope&&Ie.endScope._wrap?(zt(),Ft(ge,Ie.endScope._wrap)):Ie.endScope&&Ie.endScope._multi?(zt(),Pr(Ie.endScope,se)):ft.skip?Qe+=ge:(ft.returnEnd||ft.excludeEnd||(Qe+=ge),zt(),ft.excludeEnd&&(Qe=ge));do Ie.scope&&ht.closeNode(),!Ie.skip&&!Ie.subLanguage&&(Fr+=Ie.relevance),Ie=Ie.parent;while(Ie!==He.parent);return He.starts&&cr(He.starts,se),ft.returnEnd?0:ge.length}function Ko(){const se=[];for(let ge=Ie;ge!==fn;ge=ge.parent)ge.scope&&se.unshift(ge.scope);se.forEach(ge=>ht.openNode(ge))}let dr={};function fr(se,ge){const Ae=ge&&ge[0];if(Qe+=se,Ae==null)return zt(),0;if(dr.type==="begin"&&ge.type==="end"&&dr.index===ge.index&&Ae===""){if(Qe+=ve.slice(ge.index,ge.index+1),!rt){const He=new Error(`0 width match regex (${re})`);throw He.languageName=re,He.badRule=dr.rule,He}return 1}if(dr=ge,ge.type==="begin")return Ea(ge);if(ge.type==="illegal"&&!ze){const He=new Error('Illegal lexeme "'+Ae+'" for mode "'+(Ie.scope||"")+'"');throw He.mode=Ie,He}else if(ge.type==="end"){const He=Hi(ge);if(He!==li)return He}if(ge.type==="illegal"&&Ae==="")return Qe+=` -`,1;if(Br>1e5&&Br>ge.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Qe+=Ae,Ae.length}const fn=wn(re);if(!fn)throw cn(lt.replace("{}",re)),new Error('Unknown language: "'+re+'"');const Ki=Gt(fn);let Ve="",Ie=Be||Ki;const Gi={},ht=new me.__emitter(me);Ko();let Qe="",Fr=0,zn=0,Br=0,pr=!1;try{if(fn.__emitTokens)fn.__emitTokens(ve,ht);else{for(Ie.matcher.considerAll();;){Br++,pr?pr=!1:Ie.matcher.considerAll(),Ie.matcher.lastIndex=zn;const se=Ie.matcher.exec(ve);if(!se)break;const ge=ve.substring(zn,se.index),Ae=fr(ge,se);zn=se.index+Ae}fr(ve.substring(zn))}return ht.finalize(),Ve=ht.toHTML(),{language:re,value:Ve,relevance:Fr,illegal:!1,_emitter:ht,_top:Ie}}catch(se){if(se.message&&se.message.includes("Illegal"))return{language:re,value:Tt(ve),illegal:!0,relevance:0,_illegalBy:{message:se.message,index:zn,context:ve.slice(zn-100,zn+100),mode:se.mode,resultSoFar:Ve},_emitter:ht};if(rt)return{language:re,value:Tt(ve),illegal:!1,relevance:0,errorRaised:se,_emitter:ht,_top:Ie};throw se}}function ur(re){const ve={value:Tt(re),illegal:!1,relevance:0,_top:he,_emitter:new me.__emitter(me)};return ve._emitter.addText(re),ve}function Lr(re,ve){ve=ve||me.languages||Object.keys(V);const ze=ur(re),Be=ve.filter(wn).filter(Ho).map(zt=>Dn(zt,re,!1));Be.unshift(ze);const mt=Be.sort((zt,Ft)=>{if(zt.relevance!==Ft.relevance)return Ft.relevance-zt.relevance;if(zt.language&&Ft.language){if(wn(zt.language).supersetOf===Ft.language)return 1;if(wn(Ft.language).supersetOf===zt.language)return-1}return 0}),[ut,Pn]=mt,ui=ut;return ui.secondBest=Pn,ui}function ha(re,ve,ze){const Be=ve&&ce[ve]||ze;re.classList.add("hljs"),re.classList.add(`language-${Be}`)}function Ui(re){let ve=null;const ze=yt(re);if(xe(ze))return;if(Dr("before:highlightElement",{el:re,language:ze}),re.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",re);return}if(re.children.length>0&&(me.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(re)),me.throwUnescapedHTML))throw new dn("One of your code blocks includes unescaped HTML.",re.innerHTML);ve=re;const Be=ve.textContent,mt=ze?tt(Be,{language:ze,ignoreIllegals:!0}):Lr(Be);re.innerHTML=mt.value,re.dataset.highlighted="yes",ha(re,ze,mt.language),re.result={language:mt.language,re:mt.relevance,relevance:mt.relevance},mt.secondBest&&(re.secondBest={language:mt.secondBest.language,relevance:mt.secondBest.relevance}),Dr("after:highlightElement",{el:re,result:mt,text:Be})}function ga(re){me=oi(me,re)}const Zn=()=>{ai(),H("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Fo(){ai(),H("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let $i=!1;function ai(){function re(){ai()}if(document.readyState==="loading"){$i||window.addEventListener("DOMContentLoaded",re,!1),$i=!0;return}document.querySelectorAll(me.cssSelector).forEach(Ui)}function Bo(re,ve){let ze=null;try{ze=ve(A)}catch(Be){if(cn("Language definition for '{}' could not be registered.".replace("{}",re)),rt)cn(Be);else throw Be;ze=he}ze.name||(ze.name=re),V[re]=ze,ze.rawDefinition=ve.bind(null,A),ze.aliases&&jo(ze.aliases,{languageName:re})}function Uo(re){delete V[re];for(const ve of Object.keys(ce))ce[ve]===re&&delete ce[ve]}function $o(){return Object.keys(V)}function wn(re){return re=(re||"").toLowerCase(),V[re]||V[ce[re]]}function jo(re,{languageName:ve}){typeof re=="string"&&(re=[re]),re.forEach(ze=>{ce[ze.toLowerCase()]=ve})}function Ho(re){const ve=wn(re);return ve&&!ve.disableAutodetect}function st(re){re["before:highlightBlock"]&&!re["before:highlightElement"]&&(re["before:highlightElement"]=ve=>{re["before:highlightBlock"](Object.assign({block:ve.el},ve))}),re["after:highlightBlock"]&&!re["after:highlightElement"]&&(re["after:highlightElement"]=ve=>{re["after:highlightBlock"](Object.assign({block:ve.el},ve))})}function ya(re){st(re),Re.push(re)}function ji(re){const ve=Re.indexOf(re);ve!==-1&&Re.splice(ve,1)}function Dr(re,ve){const ze=re;Re.forEach(function(Be){Be[ze]&&Be[ze](ve)})}function si(re){return H("10.7.0","highlightBlock will be removed entirely in v12.0"),H("10.7.0","Please use highlightElement now."),Ui(re)}Object.assign(A,{highlight:tt,highlightAuto:Lr,highlightAll:ai,highlightElement:Ui,highlightBlock:si,configure:ga,initHighlighting:Zn,initHighlightingOnLoad:Fo,registerLanguage:Bo,unregisterLanguage:Uo,listLanguages:$o,getLanguage:wn,registerAliases:jo,autoDetection:Ho,inherit:oi,addPlugin:ya,removePlugin:ji}),A.debugMode=function(){rt=!1},A.safeMode=function(){rt=!0},A.versionString=vt,A.regex={concat:C,lookahead:E,either:w,optional:x,anyNumberOfTimes:b};for(const re in Xe)typeof Xe[re]=="object"&&e(Xe[re]);return Object.assign(A,Xe),A},Qn=Yn({});return Qn.newInstance=()=>Yn({}),Eu=Qn,Qn.HighlightJS=Qn,Qn.default=Qn,Eu}var F0=z0();const B0=Mo(F0),Op={},U0="hljs-";function $0(e){const i=B0.newInstance();return e&&c(e),{highlight:r,highlightAuto:l,listLanguages:s,register:c,registerAlias:u,registered:d};function r(p,m,g){const y=g||Op,E=typeof y.prefix=="string"?y.prefix:U0;if(!i.getLanguage(p))throw new Error("Unknown language: `"+p+"` is not registered");i.configure({__emitter:j0,classPrefix:E});const b=i.highlight(m,{ignoreIllegals:!0,language:p});if(b.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:b.errorRaised});const x=b._emitter.root,C=x.data;return C.language=b.language,C.relevance=b.relevance,x}function l(p,m){const y=(m||Op).subset||s();let E=-1,b=0,x;for(;++Eb&&(b=T.data.relevance,x=T)}return x||{type:"root",children:[],data:{language:void 0,relevance:b}}}function s(){return i.listLanguages()}function c(p,m){if(typeof p=="string")i.registerLanguage(p,m);else{let g;for(g in p)Object.hasOwn(p,g)&&i.registerLanguage(g,p[g])}}function u(p,m){if(typeof p=="string")i.registerAliases(typeof m=="string"?m:[...m],{languageName:p});else{let g;for(g in p)if(Object.hasOwn(p,g)){const y=p[g];i.registerAliases(typeof y=="string"?y:[...y],{languageName:g})}}}function d(p){return!!i.getLanguage(p)}}class j0{constructor(i){this.options=i,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(i){if(i==="")return;const r=this.stack[this.stack.length-1],l=r.children[r.children.length-1];l&&l.type==="text"?l.value+=i:r.children.push({type:"text",value:i})}startScope(i){this.openNode(String(i))}endScope(){this.closeNode()}__addSublanguage(i,r){const l=this.stack[this.stack.length-1],s=i.root.children;r?l.children.push({type:"element",tagName:"span",properties:{className:[r]},children:s}):l.children.push(...s)}openNode(i){const r=this,l=i.split(".").map(function(u,d){return d?u+"_".repeat(d):r.options.classPrefix+u}),s=this.stack[this.stack.length-1],c={type:"element",tagName:"span",properties:{className:l},children:[]};s.children.push(c),this.stack.push(c)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const H0={};function K0(e){const i=e||H0,r=i.aliases,l=i.detect||!1,s=i.languages||P0,c=i.plainText,u=i.prefix,d=i.subset;let p="hljs";const m=$0(s);if(r&&m.registerAlias(r),u){const g=u.indexOf("-");p=g===-1?u:u.slice(0,g)}return function(g,y){ma(g,"element",function(E,b,x){if(E.tagName!=="code"||!x||x.type!=="element"||x.tagName!=="pre")return;const C=G0(E);if(C===!1||!C&&!l||C&&c&&c.includes(C))return;Array.isArray(E.properties.className)||(E.properties.className=[]),E.properties.className.includes(p)||E.properties.className.unshift(p);const T=ux(E,{whitespace:"pre"});let w;try{w=C?m.highlight(C,T,{prefix:u}):m.highlightAuto(T,{prefix:u,subset:d})}catch(F){const L=F;if(C&&/Unknown language/.test(L.message)){y.message("Cannot highlight as `"+C+"`, it’s not registered",{ancestors:[x,E],cause:L,place:E.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw L}!C&&w.data&&w.data.language&&E.properties.className.push("language-"+w.data.language),w.children.length>0&&(E.children=w.children)})}}function G0(e){const i=e.properties.className;let r=-1;if(!Array.isArray(i))return;let l;for(;++rk.jsx("div",{className:"md",children:k.jsx(Hv,{remarkPlugins:[nx],rehypePlugins:[[K0,{detect:!0,ignoreMissing:!0}]],components:{a:({node:i,...r})=>k.jsx("a",{...r,target:"_blank",rel:"noopener noreferrer"})},children:e})}),Eh=ue.memo(W0);function _u(e){return String(e??"").replace(/[&<>]/g,i=>({"&":"&","<":"<",">":">"})[i])}function V0({kb:e}){const{inspReset:i,inspAdd:r,inspDone:l,toastMsg:s}=Kn(),{busy:c,start:u,stop:d}=Vp(),[p,m]=ue.useState(""),[g,y]=ue.useState([]),E=ue.useRef(null),b=ue.useRef(null);ue.useEffect(()=>{function T(w){m(w.detail),E.current&&E.current.focus()}return window.addEventListener("openkb:prefill-query",T),()=>window.removeEventListener("openkb:prefill-query",T)},[]),ue.useEffect(()=>{b.current&&(b.current.scrollTop=b.current.scrollHeight)},[g]);function x(){const T=E.current;T&&(T.style.height="auto",T.style.height=Math.min(T.scrollHeight,140)+"px")}async function C(){const T=p.trim();if(!T||c)return;m(""),E.current&&(E.current.style.height="auto"),i(!0);const w={user:T,acc:""};y($=>[...$,w]);const F=g.length,L=()=>{y($=>{const K=[...$];return K[F]={...w,aborted:!0},K}),r("tool","已停止","用户中断生成")};try{await u({path:"/api/v1/query",payload:{kb:e,question:T,stream:!0}},($,K)=>{$==="tool_call"?r("tool","检索 · "+(K.name||"tool"),`${_u((K.arguments||"").slice(0,120))}`):$==="delta"?(w.acc+=K.text||"",y(I=>{const Z=[...I];return Z[F]={...w},Z})):$==="final"?(w.acc=K.answer||w.acc,y(I=>{const Z=[...I];return Z[F]={...w},Z}),r("done","完成","推理检索结束")):$==="error"&&(w.acc=`${_u(K.message)}`,y(I=>{const Z=[...I];return Z[F]={...w},Z}),r("error","错误",_u(K.message)))},L)}finally{l()}}return k.jsxs("div",{className:"qa-wrap",children:[k.jsx("div",{className:"qa-stream",ref:b,children:g.length===0?k.jsx(Pi,{icon:k.jsx(Pp,{size:40,strokeWidth:1.5}),title:"向知识库提问",desc:"基于无向量推理检索,答案附推理过程。"}):g.map((T,w)=>k.jsxs("div",{className:"msg",children:[k.jsxs("div",{className:"msg-role user",children:[k.jsx("span",{className:"role-dot"}),"你"]}),k.jsx("div",{className:"msg-bubble user",children:T.user}),k.jsxs("div",{className:"msg-role",children:[k.jsx("span",{className:"role-dot"}),"OpenKB"]}),k.jsx("div",{className:"msg-bubble",children:T.acc?k.jsx(Eh,{children:T.acc}):T.aborted?k.jsx("span",{className:"cell-meta",children:"已停止生成"}):k.jsx("span",{className:"spinner-wrap",children:k.jsx("span",{className:"spinner"})})})]},w))}),k.jsxs("div",{className:"qa-input-bar",children:[k.jsx("textarea",{ref:E,className:"qa-input",placeholder:"例如:这篇文章的主要结论是什么?",rows:1,value:p,onChange:T=>{m(T.target.value),x()},onKeyDown:T=>{T.key==="Enter"&&!T.shiftKey&&!T.nativeEvent.isComposing&&(T.preventDefault(),C())}}),c?k.jsxs("button",{className:"btn btn-ghost",onClick:d,children:[k.jsx(Lp,{size:15})," 停止生成"]}):k.jsxs("button",{className:"btn btn-primary",onClick:C,children:[k.jsx(zp,{size:15})," 提问"]})]})]})}function vu(e){return String(e??"").replace(/[&<>]/g,i=>({"&":"&","<":"<",">":">"})[i])}function q0({kb:e}){const{inspReset:i,inspAdd:r,inspDone:l,toastMsg:s}=Kn(),{busy:c,start:u,stop:d}=Vp(),[p,m]=ue.useState([]),[g,y]=ue.useState(null),[E,b]=ue.useState([]),[x,C]=ue.useState(""),T=ue.useRef(null),w=ue.useRef(null),F=ue.useCallback(()=>{jt.chatSessions(e).then(G=>m(G.sessions||[])).catch(()=>m([]))},[e]);ue.useEffect(F,[F]),ue.useEffect(()=>{w.current&&(w.current.scrollTop=w.current.scrollHeight)},[E]);function L(){y(null),b([])}async function $(G){y(G),b([]);try{const te=await jt.chatSessionLoad(e,G),D=[],ne=Math.max(te.user_turns.length,te.assistant_texts.length);for(let X=0;X[...q,te,D]);const ne=E.length+1;let X="";const fe=()=>{b(q=>{const P=[...q];return P[ne]={role:"assistant",text:X,pending:!1,aborted:!0},P}),r("tool","已停止","用户中断生成")};try{await u({path:"/api/v1/chat",payload:{kb:e,message:G,session_id:g,stream:!0}},(q,P)=>{q==="start"&&P.session_id?y(P.session_id):q==="tool_call"?r("tool","检索 · "+(P.name||"tool"),`${vu((P.arguments||"").slice(0,120))}`):q==="delta"?(X+=P.text||"",b(le=>{const ae=[...le];return ae[ne]={role:"assistant",text:X,pending:!0},ae})):q==="final"?(X=P.answer||X,b(le=>{const ae=[...le];return ae[ne]={role:"assistant",text:X,pending:!1},ae}),r("done","完成",`第 ${P.turn_count||""} 轮`)):q==="error"&&(b(le=>{const ae=[...le];return ae[ne]={role:"assistant",text:`${vu(P.message)}`,pending:!1},ae}),r("error","错误",vu(P.message)))},fe),F()}finally{l()}}return k.jsxs("div",{className:"qa-wrap",children:[k.jsxs("div",{className:"chat-sessions",children:[k.jsxs("button",{className:`session-item ${g?"":"active"}`,onClick:L,children:[k.jsx(ku,{size:13})," 本次新会话"]}),p.map(G=>k.jsxs("button",{className:`session-item ${G.id===g?"active":""}`,onClick:()=>$(G.id),children:[k.jsx("span",{className:"session-title",children:G.title||G.id}),k.jsx(by,{size:13,className:"session-del",onClick:te=>K(G.id,te)})]},G.id))]}),k.jsx("div",{className:"qa-stream",ref:w,children:E.length===0?k.jsx(Pi,{icon:k.jsx(Dp,{size:40,strokeWidth:1.5}),title:"多轮对话",desc:"会话自动持久化,可跨次恢复。"}):E.map((G,te)=>k.jsxs("div",{className:"msg",children:[k.jsxs("div",{className:`msg-role ${G.role==="user"?"user":""}`,children:[k.jsx("span",{className:"role-dot"}),G.role==="user"?"你":"OpenKB"]}),k.jsx("div",{className:`msg-bubble ${G.role==="user"?"user":""}`,children:G.role==="user"?G.text:G.text?k.jsx(Eh,{children:G.text}):G.aborted?k.jsx("span",{className:"cell-meta",children:"已停止生成"}):k.jsx("span",{className:"spinner-wrap",children:k.jsx("span",{className:"spinner"})})})]},te))}),k.jsxs("div",{className:"qa-input-bar",children:[k.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:L,children:[k.jsx(ku,{size:14})," 新会话"]}),k.jsx("textarea",{ref:T,className:"qa-input",placeholder:"继续对话…",rows:1,value:x,onChange:G=>{C(G.target.value),I()},onKeyDown:G=>{G.key==="Enter"&&!G.shiftKey&&!G.nativeEvent.isComposing&&(G.preventDefault(),Z())}}),c?k.jsxs("button",{className:"btn btn-ghost",onClick:d,children:[k.jsx(Lp,{size:15})," 停止生成"]}):k.jsxs("button",{className:"btn btn-primary",onClick:Z,children:[k.jsx(zp,{size:15})," 发送"]})]})]})}function Jr(e){return String(e??"").replace(/[&<>]/g,i=>({"&":"&","<":"<",">":">"})[i])}function Ip(e){if(!e)return null;try{const i=new Date(e);return isNaN(i)?e:i.toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return e}}function Y0({kb:e}){const{inspReset:i,inspAdd:r,inspDone:l,toastMsg:s}=Kn(),[c,u]=ue.useState(!1),[d,p]=ue.useState([]),[m,g]=ue.useState("all"),[y,E]=ue.useState([]),[b,x]=ue.useState(""),[C,T]=ue.useState([]),[w,F]=ue.useState(!1),[L,$]=ue.useState(null),K=ue.useRef(null),I=ue.useRef([]),Z=ue.useRef([]);ue.useEffect(()=>{jt.status(e).then($).catch(()=>$(null)),jt.watchStatus(e).then(P=>F(!!P.active)).catch(()=>{})},[e]),ue.useEffect(()=>{let P=!0;return jt.list(e).then(le=>{if(!P)return;const ae=(le.documents||[]).map(W=>W.name).filter(Boolean);E(ae),x(W=>W&&ae.includes(W)?W:ae[0]||"")}).catch(()=>{P&&(E([]),x(""))}),()=>{P=!1}},[e]),ue.useEffect(()=>{K.current&&(K.current.scrollTop=K.current.scrollHeight)},[C]);function G(P){I.current=[...I.current,P],p(I.current)}function te(P){Z.current=[...Z.current,P],T(Z.current)}async function D(){I.current=[{kind:"plain",text:`运行中${c?"(自动修复)":""}…`}],p(I.current),i(!0);try{const P=await jt.lint(e,c);I.current=[],P.skipped&&G({kind:"warn",text:P.reason||"已跳过"}),G({kind:"ok",text:P.message}),P.lint_files_changed!=null&&G({kind:"plain",text:`修改文件:${P.lint_files_changed},清理幽灵链接:${P.lint_ghosts_removed}`}),P.structural_report&&G({kind:"plain",text:Jr(P.structural_report).slice(0,600)}),r("done","Lint",Jr(P.message)),s("检查完成","ok")}catch(P){G({kind:"err",text:Jr(P.message)}),s(P.message,"err"),r("error","错误",Jr(P.message))}finally{l()}}async function ne(){Z.current=[{kind:"plain",text:"重编译中…"}],T(Z.current),i(!0);const P=m==="one"?{kb:e,doc_name:b,stream:!0}:{kb:e,all_docs:!0,stream:!0};try{await Fu("/api/v1/recompile",P,(le,ae)=>{le==="plan"?te({kind:"plain",text:`目标 ${ae.targets?ae.targets.length:0} 个`}):le==="doc"?te({kind:ae.status==="ok"?"ok":ae.status==="error"?"err":"warn",text:`${ae.name||ae.doc_name||""} → ${ae.status}${ae.message?","+ae.message:""}`}):le==="final"?(te({kind:"ok",text:`完成:重编译 ${ae.recompiled},跳过 ${ae.skipped}`}),s("重编译完成","ok"),r("done","完成",`重编译 ${ae.recompiled},跳过 ${ae.skipped}`)):le==="error"&&(te({kind:"err",text:ae.message}),s(ae.message,"err"),r("error","错误",Jr(ae.message)))})}catch(le){te({kind:"err",text:Jr(le.message)}),s(le.message,"err"),r("error","错误",Jr(le.message))}finally{l(),jt.status(e).then($).catch(()=>{})}}async function X(){const P=!w;try{P?await jt.watchStart(e,2):await jt.watchStop(e),F(P),s(P?"已开启监听":"已停止监听","ok")}catch(le){s(le.message,"err")}}const fe=(L==null?void 0:L.directories)||{},q=m==="one"&&!b;return k.jsxs("div",{className:"maint-grid",children:[k.jsxs("div",{className:"maint-card",children:[k.jsx("h3",{children:"健康检查 · Lint"}),k.jsx("p",{children:"检测结构完整性与知识一致性,可自动修复失效的 wikilink。"}),k.jsxs("div",{className:"toggle-row",children:[k.jsx("span",{className:"cell-meta",children:"自动修复"}),k.jsx("div",{className:`toggle ${c?"on":""}`,onClick:()=>u(P=>!P)})]}),k.jsx("div",{className:"row-actions",children:k.jsx("button",{className:"btn btn-primary btn-sm",onClick:D,children:"运行检查"})}),k.jsx("div",{className:"maint-log",children:d.map((P,le)=>k.jsx("div",{className:`log-line ${P.kind}`,children:P.text},le))})]}),k.jsxs("div",{className:"maint-card",children:[k.jsx("h3",{children:"重新编译 · Recompile"}),k.jsx("p",{children:"对已索引文档重跑编译,重生成摘要并改写概念页(手动编辑会被覆盖)。"}),k.jsxs("div",{className:"toggle-row",children:[k.jsx("span",{className:"cell-meta",children:"范围"}),k.jsxs("select",{className:"select",style:{width:"auto"},value:m,onChange:P=>g(P.target.value),children:[k.jsx("option",{value:"all",children:"全部文档"}),k.jsx("option",{value:"one",children:"指定文档"})]}),m==="one"&&k.jsx("select",{className:"select",style:{width:"auto",marginLeft:8},value:b,onChange:P=>x(P.target.value),disabled:y.length===0,children:y.length===0?k.jsx("option",{value:"",children:"(无文档)"}):y.map(P=>k.jsx("option",{value:P,children:P},P))})]}),k.jsx("div",{className:"row-actions",children:k.jsx("button",{className:"btn btn-ghost btn-sm",onClick:ne,disabled:q,children:"开始重编译"})}),k.jsx("div",{className:"maint-log",ref:K,children:C.map((P,le)=>k.jsx("div",{className:`log-line ${P.kind}`,children:P.text},le))})]}),k.jsxs("div",{className:"maint-card",children:[k.jsx("h3",{children:"文件监听 · Watch"}),k.jsx("p",{children:"监听 raw/ 目录,新增文件自动编译为 wiki。"}),k.jsxs("div",{className:"toggle-row",children:[k.jsx("span",{className:"cell-meta",children:"监听状态"}),k.jsx("div",{className:`toggle ${w?"on":""}`,onClick:X})]})]}),k.jsxs("div",{className:"maint-card",children:[k.jsx("h3",{children:"知识库状态"}),k.jsx("p",{children:"目录结构与索引概况。"}),k.jsxs("div",{className:"maint-log",children:[Object.entries(fe).map(([P,le])=>k.jsxs("div",{className:"log-line",children:[P,":",le," 篇"]},P)),L&&k.jsxs("div",{className:"log-line",children:["原始文件:",L.raw_count]}),L&&k.jsxs("div",{className:"log-line",children:["已索引:",L.total_indexed]}),(L==null?void 0:L.last_compile)&&k.jsxs("div",{className:"log-line ok",children:["上次编译:",Ip(L.last_compile)]}),(L==null?void 0:L.last_lint)&&k.jsxs("div",{className:"log-line ok",children:["上次检查:",Ip(L.last_lint)]})]})]})]})}const Q0={overview:"概览",documents:"文档管理",query:"查询",chat:"对话",maintenance:"维护"};function Z0(){const{kb:e,view:i,setKbs:r,setKb:l,kbs:s,setSidebarOpen:c,setSettingsOpen:u,toastMsg:d}=Kn(),p=ue.useCallback(async()=>{if($p())try{const g=await jt.listKbs();r(g.knowledge_bases||[]),l(y=>{var E,b;return y||(((b=(E=g.knowledge_bases)==null?void 0:E[0])==null?void 0:b.name)??null)})}catch{r([])}},[r,l]);ue.useEffect(()=>{p();function g(){p()}function y(b){d(b.detail.message,b.detail.kind)}function E(){u(!0)}return window.addEventListener("openkb:reload-kbs",g),window.addEventListener("openkb:toast",y),window.addEventListener("openkb:unauthorized",E),()=>{window.removeEventListener("openkb:reload-kbs",g),window.removeEventListener("openkb:toast",y),window.removeEventListener("openkb:unauthorized",E)}},[p,d,u]);function m(){return e?i==="overview"?k.jsx(Ty,{kb:e}):i==="documents"?k.jsx(Oy,{kb:e}):i==="query"?k.jsx(V0,{kb:e}):i==="chat"?k.jsx(q0,{kb:e}):i==="maintenance"?k.jsx(Y0,{kb:e}):null:k.jsxs("div",{className:"empty-state",children:[k.jsx("h3",{children:"未选择知识库"}),k.jsx("p",{children:"请在左侧选择或新建一个知识库。"})]})}return k.jsxs("div",{className:"app",children:[k.jsx("button",{className:"mobile-menu-btn",onClick:()=>c(!0),"aria-label":"菜单",children:k.jsx(hy,{size:20})}),k.jsx(xy,{}),k.jsxs("main",{className:"workspace",children:[k.jsx("header",{className:"ws-header",children:k.jsx("h1",{className:"ws-title",children:Q0[i]})}),k.jsx("section",{className:"ws-body",children:m()})]}),k.jsx(Sy,{}),k.jsx(Ny,{}),k.jsx(Cy,{})]})}function X0(){return k.jsx(ky,{children:k.jsx(Z0,{})})}document.title="OpenKB · 知识工作台";ay.createRoot(document.getElementById("root")).render(k.jsx(ey.StrictMode,{children:k.jsx(X0,{})})); diff --git a/web/assets/index-I-GkV6Af.css b/web/assets/index-I-GkV6Af.css deleted file mode 100644 index 544e74b54..000000000 --- a/web/assets/index-I-GkV6Af.css +++ /dev/null @@ -1 +0,0 @@ -:root{--bg: #0e1015;--bg-1: #14171f;--bg-2: #1a1e28;--bg-3: #222734;--border: #2a2f3c;--border-soft: #232834;--text: #e7eaf0;--text-2: #9aa3b2;--text-3: #6b7280;--accent: #5b8def;--accent-soft: rgba(91, 141, 239, .14);--cyan: #22d3ee;--green: #34d399;--amber: #fbbf24;--red: #f87171;--purple: #a78bfa;--radius: 10px;--radius-sm: 7px;--shadow: 0 8px 30px rgba(0, 0, 0, .35);--font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;--mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, monospace}*{box-sizing:border-box;margin:0;padding:0}html,body,#root{height:100%}body{font-family:var(--font);background:var(--bg);color:var(--text);font-size:14px;line-height:1.55;letter-spacing:0;-webkit-font-smoothing:antialiased}.app{display:grid;grid-template-columns:232px 1fr 340px;height:100vh;overflow:hidden}.hidden{display:none!important}button{font-family:inherit;cursor:pointer;border:none;background:none;color:inherit}input,textarea,select{font-family:inherit;font-size:14px}svg{display:block;flex-shrink:0}a{color:var(--accent)}.sidebar{background:var(--bg-1);border-right:1px solid var(--border);display:flex;flex-direction:column;padding:16px 12px;gap:16px;min-height:0}.brand{display:flex;align-items:center;gap:9px;padding:2px 6px}.brand-mark{width:26px;height:26px;border-radius:7px;background:linear-gradient(135deg,var(--accent),var(--cyan));color:#fff;font-weight:700;font-size:12px;display:grid;place-items:center;letter-spacing:.5px}.brand-name{font-weight:600;font-size:15px}.kb-switcher{position:relative}.kb-current{width:100%;display:flex;align-items:center;gap:9px;padding:9px 10px;border-radius:var(--radius-sm);background:var(--bg-2);border:1px solid var(--border);transition:background .15s}.kb-current:hover{background:var(--bg-3)}.kb-current-dot{width:7px;height:7px;border-radius:50%;background:var(--green);flex-shrink:0;box-shadow:0 0 8px var(--green)}.kb-current-name{flex:1;text-align:left;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.kb-current .kb-chev{color:var(--text-2)}.kb-menu{position:absolute;top:calc(100% + 6px);left:0;right:0;z-index:40;background:var(--bg-2);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);padding:6px;max-height:320px;overflow-y:auto}.kb-menu-item{width:100%;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 10px;border-radius:var(--radius-sm);text-align:left;transition:background .15s}.kb-menu-item:hover{background:var(--bg-3)}.kb-menu-item.active{background:var(--accent-soft);color:var(--accent)}.kb-menu-item .mi-name{font-weight:500}.kb-menu-item .mi-meta{font-size:11px;color:var(--text-3)}.kb-menu-item.active .mi-meta{color:var(--accent);opacity:.8}.kb-menu-new{width:100%;display:flex;align-items:center;gap:7px;padding:8px 10px;border-radius:var(--radius-sm);color:var(--accent);border-top:1px solid var(--border-soft);margin-top:4px;font-weight:500}.kb-menu-new:hover{background:var(--bg-3)}.kb-menu-new:disabled{opacity:.5;cursor:not-allowed}.nav{display:flex;flex-direction:column;gap:2px;flex:1;min-height:0}.nav-item{display:flex;align-items:center;gap:10px;padding:9px 11px;border-radius:var(--radius-sm);text-align:left;color:var(--text-2);font-weight:500;transition:background .15s,color .15s}.nav-item:hover{background:var(--bg-2);color:var(--text)}.nav-item.active{background:var(--accent-soft);color:var(--accent)}.sidebar-foot{display:flex;justify-content:flex-end}.icon-btn{display:grid;place-items:center;width:32px;height:32px;border-radius:var(--radius-sm);color:var(--text-2);transition:background .15s,color .15s}.icon-btn:hover{background:var(--bg-2);color:var(--text)}.workspace{display:flex;flex-direction:column;min-width:0;min-height:0;background:var(--bg)}.ws-header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:18px 28px;border-bottom:1px solid var(--border);flex-shrink:0}.ws-title{font-size:19px;font-weight:650;letter-spacing:-.01em}.ws-body{flex:1;overflow-y:auto;padding:24px 28px 40px}.inspector{background:var(--bg-1);border-left:1px solid var(--border);display:flex;flex-direction:column;min-height:0}.insp-head{display:flex;align-items:center;justify-content:space-between;padding:16px 18px;border-bottom:1px solid var(--border);flex-shrink:0}.insp-title{font-weight:600;font-size:13px}.insp-status{font-size:12px;color:var(--text-3)}.insp-status.busy{color:var(--cyan)}.insp-body{flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:8px}.insp-empty{color:var(--text-3);font-size:13px;text-align:center;margin:auto;line-height:1.7}.timeline-item{background:var(--bg-2);border:1px solid var(--border-soft);border-radius:var(--radius-sm);padding:10px 12px;font-size:13px;animation:fadein .2s ease}.timeline-item.tool{border-left:2px solid var(--cyan)}.timeline-item.done{border-left-color:var(--green)}.timeline-item.error{border-left-color:var(--red)}.timeline-item.start{border-left:2px solid var(--accent)}.timeline-item .tl-tag{font-size:11px;font-weight:600;color:var(--cyan);text-transform:uppercase;letter-spacing:.04em;margin-bottom:4px;display:block}.timeline-item.done .tl-tag{color:var(--green)}.timeline-item.error .tl-tag{color:var(--red)}.timeline-item.start .tl-tag{color:var(--accent)}.timeline-item .tl-body{color:var(--text-2);word-break:break-word}.timeline-item .tl-body code{font-family:var(--mono);font-size:11px;background:var(--bg-3);padding:1px 5px;border-radius:4px}@keyframes fadein{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.btn{display:inline-flex;align-items:center;gap:7px;justify-content:center;padding:8px 14px;border-radius:var(--radius-sm);font-weight:550;font-size:13px;border:1px solid var(--border);background:var(--bg-2);color:var(--text);transition:background .15s,border-color .15s,opacity .15s}.btn:hover{background:var(--bg-3)}.btn:disabled{opacity:.5;cursor:not-allowed}.btn-primary{background:var(--accent);border-color:var(--accent);color:#fff}.btn-primary:hover{background:#4f80e6}.btn-ghost{background:transparent;border-color:var(--border)}.btn-ghost:hover{background:var(--bg-2)}.btn-danger{background:transparent;border-color:var(--border);color:var(--red)}.btn-danger:hover{background:#f871711a;border-color:var(--red)}.btn-sm{padding:5px 10px;font-size:12px}.stat-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:24px}.stat-card{background:var(--bg-1);border:1px solid var(--border);border-radius:var(--radius);padding:18px}.stat-label{font-size:12px;color:var(--text-2);margin-bottom:8px}.stat-value{font-size:28px;font-weight:680;letter-spacing:-.02em}.stat-sub{font-size:11px;color:var(--text-3);margin-top:4px}.stat-card.accent .stat-value{color:var(--accent)}.stat-card.cyan .stat-value{color:var(--cyan)}.stat-card.green .stat-value{color:var(--green)}.stat-card.purple .stat-value{color:var(--purple)}.panel{background:var(--bg-1);border:1px solid var(--border);border-radius:var(--radius);margin-bottom:18px}.panel-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px;border-bottom:1px solid var(--border-soft)}.panel-title{font-weight:600;font-size:14px}.panel-body{padding:8px 0}.table{width:100%;border-collapse:collapse}.table th,.table td{text-align:left;padding:10px 16px;font-size:13px;border-bottom:1px solid var(--border-soft)}.table th{color:var(--text-2);font-weight:550;font-size:12px}.table tr:last-child td{border-bottom:none}.table tbody tr{transition:background .12s;cursor:default}.table tbody tr:hover{background:var(--bg-2)}.cell-name{font-weight:550}.cell-meta{color:var(--text-2);font-size:12px}.tag{display:inline-flex;align-items:center;gap:4px;font-size:11px;font-weight:550;padding:2px 8px;border-radius:20px;background:var(--bg-3);color:var(--text-2)}.tag.green{background:#34d39924;color:var(--green)}.tag.cyan{background:#22d3ee24;color:var(--cyan)}.tag.amber{background:#fbbf2424;color:var(--amber)}.tag.red{background:#f8717124;color:var(--red)}.tag.purple{background:#a78bfa24;color:var(--purple)}.icon-cell{display:inline-flex;align-items:center;gap:8px}.file-ico{width:28px;height:28px;border-radius:6px;background:var(--bg-3);display:grid;place-items:center;color:var(--text-2);font-size:10px;font-weight:600}.dropzone{border:1.5px dashed var(--border);border-radius:var(--radius);padding:26px;text-align:center;color:var(--text-2);transition:border-color .15s,background .15s;cursor:pointer;margin-bottom:18px}.dropzone:hover,.dropzone.drag{border-color:var(--accent);background:var(--accent-soft);color:var(--text)}.dropzone .dz-title{font-weight:550;margin-bottom:4px;color:var(--text)}.upload-item{display:flex;align-items:center;gap:10px;padding:8px 16px;font-size:13px}.upload-item .up-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.progress{height:4px;background:var(--bg-3);border-radius:4px;overflow:hidden;flex:1}.progress>span{display:block;height:100%;background:var(--accent);transition:width .3s}.qa-wrap{display:flex;flex-direction:column;height:100%;gap:16px}.qa-input-bar{display:flex;gap:10px;flex-shrink:0;align-items:flex-end}.qa-input{flex:1;background:var(--bg-1);border:1px solid var(--border);border-radius:var(--radius);padding:12px 14px;color:var(--text);resize:none;min-height:46px;transition:border-color .15s}.qa-input:focus{outline:none;border-color:var(--accent)}.qa-stream{flex:1;overflow-y:auto}.msg{margin-bottom:18px;animation:fadein .2s ease}.msg-role{font-size:12px;font-weight:600;color:var(--text-2);margin-bottom:6px;display:flex;align-items:center;gap:7px}.msg-role .role-dot{width:6px;height:6px;border-radius:50%;background:var(--accent)}.msg-role.user .role-dot{background:var(--text-2)}.msg-bubble{background:var(--bg-1);border:1px solid var(--border);border-radius:var(--radius);padding:14px 16px}.msg-bubble.user{background:var(--accent-soft);border-color:transparent}.spinner-wrap{display:inline-flex;align-items:center;gap:8px}.chat-sessions{display:flex;flex-direction:column;gap:2px;max-height:160px;overflow-y:auto;flex-shrink:0}.session-item{padding:7px 10px;border-radius:var(--radius-sm);font-size:12px;color:var(--text-2);text-align:left;display:flex;gap:8px;align-items:center;justify-content:space-between}.session-item:hover{background:var(--bg-2);color:var(--text)}.session-item.active{background:var(--accent-soft);color:var(--accent)}.session-title{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-del{color:var(--text-3);flex-shrink:0;opacity:0;transition:opacity .15s}.session-item:hover .session-del{opacity:1}.session-del:hover{color:var(--red)}.md{font-size:14px;line-height:1.65;color:var(--text);word-break:break-word}.md>:first-child{margin-top:0}.md>:last-child{margin-bottom:0}.md p{margin:0 0 10px}.md h1,.md h2,.md h3,.md h4{margin:16px 0 8px;font-weight:650;line-height:1.3}.md h1{font-size:18px}.md h2{font-size:16px}.md h3{font-size:15px}.md h4{font-size:14px}.md ul,.md ol{margin:0 0 10px;padding-left:22px}.md li{margin:2px 0}.md a{color:var(--accent);text-decoration:none}.md a:hover{text-decoration:underline}.md code{font-family:var(--mono);font-size:12.5px;background:var(--bg-3);padding:1px 6px;border-radius:4px;color:var(--cyan)}.md pre{background:var(--bg);border:1px solid var(--border-soft);border-radius:var(--radius-sm);padding:12px 14px;overflow-x:auto;margin:8px 0}.md pre code{background:none;padding:0;color:var(--text);font-size:12.5px;line-height:1.5}.md blockquote{border-left:3px solid var(--border);margin:8px 0;padding:4px 14px;color:var(--text-2)}.md table{border-collapse:collapse;margin:8px 0;width:100%;font-size:13px}.md th,.md td{border:1px solid var(--border);padding:6px 10px;text-align:left}.md th{background:var(--bg-2);font-weight:600}.md hr{border:none;border-top:1px solid var(--border);margin:14px 0}.md img{max-width:100%;border-radius:var(--radius-sm)}.md input[type=checkbox]{margin-right:6px;accent-color:var(--accent)}.maint-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.maint-card{background:var(--bg-1);border:1px solid var(--border);border-radius:var(--radius);padding:18px}.maint-card h3{font-size:14px;font-weight:600;margin-bottom:4px}.maint-card p{font-size:12.5px;color:var(--text-2);margin-bottom:14px}.maint-log{background:var(--bg);border:1px solid var(--border-soft);border-radius:var(--radius-sm);padding:12px 14px;font-family:var(--mono);font-size:12px;color:var(--text-2);max-height:240px;overflow-y:auto;margin-top:12px;white-space:pre-wrap}.maint-log .log-line{padding:1px 0}.maint-log .log-line.ok{color:var(--green)}.maint-log .log-line.warn{color:var(--amber)}.maint-log .log-line.err{color:var(--red)}.toggle-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.toggle{position:relative;width:38px;height:22px;background:var(--bg-3);border-radius:20px;cursor:pointer;transition:background .18s;flex-shrink:0}.toggle:after{content:"";position:absolute;top:2px;left:2px;width:18px;height:18px;background:var(--text);border-radius:50%;transition:transform .18s}.toggle.on{background:var(--green)}.toggle.on:after{transform:translate(16px)}.overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#08090ca6;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);display:grid;place-items:center;z-index:100}.modal{background:var(--bg-1);border:1px solid var(--border);border-radius:var(--radius);width:420px;max-width:92vw;box-shadow:var(--shadow)}.modal-head{display:flex;align-items:center;justify-content:space-between;padding:16px 18px;border-bottom:1px solid var(--border-soft)}.modal-head h2{font-size:16px;font-weight:650}.modal-body{padding:18px;display:flex;flex-direction:column;gap:14px}.modal-foot{display:flex;justify-content:flex-end;gap:10px;padding:14px 18px;border-top:1px solid var(--border-soft)}.field{display:flex;flex-direction:column;gap:6px}.field-label{font-size:12px;color:var(--text-2);font-weight:550}.field input,.field textarea,.field select{background:var(--bg-2);border:1px solid var(--border);border-radius:var(--radius-sm);padding:9px 11px;color:var(--text);transition:border-color .15s}.field input:focus,.field textarea:focus{outline:none;border-color:var(--accent)}.field-hint{font-size:11px;color:var(--text-3)}.toast{position:fixed;bottom:24px;left:50%;transform:translate(-50%);background:var(--bg-3);border:1px solid var(--border);color:var(--text);padding:11px 18px;border-radius:var(--radius-sm);font-size:13px;box-shadow:var(--shadow);z-index:200;animation:fadein .2s ease}.toast.ok{border-color:var(--green)}.toast.err{border-color:var(--red)}.empty-state{text-align:center;color:var(--text-3);padding:60px 20px}.empty-state svg{margin:0 auto 14px;color:var(--text-3)}.empty-state h3{font-size:15px;font-weight:600;margin-bottom:6px;color:var(--text-2)}.empty-state p{font-size:13px}.spinner{width:18px;height:18px;border:2px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:spin .7s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.concept-chips{display:flex;flex-wrap:wrap;gap:6px;padding:14px 16px}.concept-chip{font-size:12px;padding:4px 11px;border-radius:20px;background:var(--bg-2);border:1px solid var(--border-soft);color:var(--text-2);cursor:pointer;transition:background .15s,color .15s}.concept-chip:hover{background:var(--accent-soft);color:var(--accent);border-color:transparent}.row-actions{display:flex;gap:6px;justify-content:flex-end}.select{background:var(--bg-2);border:1px solid var(--border);border-radius:var(--radius-sm);padding:8px 11px;color:var(--text);font-size:13px}.select:focus{outline:none;border-color:var(--accent)}.mobile-menu-btn,.sidebar-overlay{display:none}@media(max-width:960px){.app{grid-template-columns:1fr}.sidebar{position:fixed;top:0;left:0;bottom:0;width:232px;z-index:60;transform:translate(-100%);transition:transform .22s ease}.sidebar.open{transform:translate(0)}.sidebar-overlay{display:block;position:fixed;top:0;right:0;bottom:0;left:0;background:#00000080;z-index:55}.mobile-menu-btn{display:grid;place-items:center;position:fixed;top:14px;left:14px;z-index:50;width:38px;height:38px;border-radius:var(--radius-sm);background:var(--bg-2);border:1px solid var(--border);color:var(--text)}.workspace{padding-top:44px}.inspector{display:none}.stat-grid{grid-template-columns:repeat(2,1fr)}.maint-grid{grid-template-columns:1fr}.ws-header{padding:14px 20px 14px 64px}.ws-body{padding:18px 20px 32px}}::-webkit-scrollbar{width:9px;height:9px}::-webkit-scrollbar-thumb{background:var(--bg-3);border-radius:8px;border:2px solid transparent;background-clip:padding-box}::-webkit-scrollbar-thumb:hover{background:#2e3445}::-webkit-scrollbar-track{background:transparent} diff --git a/web/index.html b/web/index.html deleted file mode 100644 index 0587d8cbc..000000000 --- a/web/index.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - OpenKB · 知识工作台 - - - - - -
- - \ No newline at end of file From d7e82b8be36ee7c47eccdac2a84bc6e67c2cc166 Mon Sep 17 00:00:00 2001 From: jidechao <408645320@qq.com> Date: Fri, 3 Jul 2026 23:18:38 +0800 Subject: [PATCH 3/3] fix(rest-api): address all PR #150 review feedback (#150) Must-fix (correctness/data): - Serialize same-KB mutations with an asyncio.Lock before kb_ingest_lock. The ingest lock tracks reentrancy in threading.local, but the event loop runs every request on one thread, so concurrent same-KB requests were mis-counted as re-entrant and bypassed mutual exclusion. [init/lint --fix/recompile] - Watcher stop() now joins the worker before clearing state and leaves a draining marker, so a restart can no longer orphan an in-flight compile and double-ingest raw/. [watch_service.py] - Extract a shared save_exploration() used by both CLI and REST: strips ghost wikilinks, generates a CJK-safe slug (hash fallback), uniquifies on collision, and escapes the question for YAML frontmatter. [cli.py] Should-fix: - Cap /watch/events SSE with a default timeout and an is_disconnected check. - Abort the in-flight SSE on component unmount / KB switch (AbortController). - Force allow_credentials off when CORS origins is a wildcard. - Constant-time token compare (hmac.compare_digest); the SPA warns when the configured API base is cross-origin and non-HTTPS. - Isolate per-KB LLM credentials via LlmCredentialBundle (dotenv_values, no os.environ pollution; a per-request LitellmModel instance). Regression (introduced by the per-KB bundle isolation above): - build_run_config_from_bundle passed model=f"litellm/{model}" to LitellmModel, but LitellmModel feeds model verbatim to litellm.acompletion, so the prefix produced "litellm/openai/deepseek-v4-flash" and litellm rejected it as an unknown provider. CLI was unaffected (bundle=None); all REST query/chat failed. Refactor/cleanup: - Extract _is_kb_dir; move _setup_llm_key to cli; model_dump() (pydantic v2). - Drop the hand-maintained openkb-postman.json (OpenAPI is served at /docs). - Slim README to short subsections + links; move the REST reference and Workbench tour to examples/rest-api/README.md. Frontend: - Default the UI to English with a zh/en toggle (i18n.jsx). - index.html lang/title default to English. Tests: 118 passed (query/api/api_watch/watch_service/per_request_overrides/save_exploration). --- README.md | 413 +---------- examples/rest-api/README.md | 419 +++++++++++ frontend/index.html | 6 +- frontend/src/App.jsx | 23 +- frontend/src/api/client.js | 37 + frontend/src/api/sse.js | 4 +- frontend/src/components/Inspector.jsx | 8 +- frontend/src/components/SettingsModal.jsx | 16 +- frontend/src/components/Sidebar.jsx | 35 +- frontend/src/components/Spinner.jsx | 5 +- frontend/src/hooks/useSSEStream.js | 29 +- frontend/src/i18n.jsx | 192 +++++ frontend/src/main.jsx | 7 +- frontend/src/state/AppContext.jsx | 6 +- frontend/src/views/Chat.jsx | 51 +- frontend/src/views/Documents.jsx | 75 +- frontend/src/views/Maintenance.jsx | 68 +- frontend/src/views/Overview.jsx | 31 +- frontend/src/views/Query.jsx | 40 +- openkb-postman.json | 845 ---------------------- openkb/agent/chat.py | 12 +- openkb/agent/compiler.py | 70 +- openkb/agent/linter.py | 19 +- openkb/agent/query.py | 55 +- openkb/api.py | 254 ++++--- openkb/cli.py | 107 +-- openkb/config.py | 81 +++ openkb/watch_service.py | 76 +- tests/test_api.py | 309 +++++++- tests/test_api_watch.py | 60 ++ tests/test_per_request_overrides.py | 85 +++ tests/test_query.py | 31 + tests/test_save_exploration.py | 54 ++ tests/test_watch_service.py | 103 ++- 34 files changed, 2000 insertions(+), 1626 deletions(-) create mode 100644 examples/rest-api/README.md create mode 100644 frontend/src/i18n.jsx delete mode 100644 openkb-postman.json create mode 100644 tests/test_per_request_overrides.py create mode 100644 tests/test_save_exploration.py diff --git a/README.md b/README.md index 055277d76..ddbf85a89 100644 --- a/README.md +++ b/README.md @@ -118,39 +118,14 @@ LLM_API_KEY=your_llm_api_key ### Knowledge Workbench (Web UI) -OpenKB ships a bundled React single-page app — the **Knowledge Workbench** — served directly by the REST server at `/`, so you get a full browser interface with no separate frontend process. +OpenKB ships a bundled React SPA served by the REST API at `/`. Build it with `cd frontend && npm install && npm run build`, then start the server: ```bash -# 1. build front web -cd frontend/ -npm install -npm run build - -# back project root -cd .. - -# 2. Set server variables (in .env or your shell) -OPENKB_API_TOKEN=test-token # bearer token the browser sends -OPENKB_KB_ROOT=/path/to/kbs # where REST /init creates KBs - -OR Edit .env and config.yaml - -# 3. Install with the API extra and start the server pip install -e ".[api]" -python -m openkb.api --host 127.0.0.1 --port 8000 # serves the API + Workbench at http://127.0.0.1:8000/ +OPENKB_API_TOKEN=test-token python -m openkb.api --host 127.0.0.1 --port 8000 ``` -> **No build, no UI.** If you skip `npm run build`, the `web/` bundle is absent and `openkb-api` serves only the REST API under `/api/v1` — visiting `/` returns a 404. The Workbench web UI appears only after you build `frontend/` at least once. - -Open `http://127.0.0.1:8000/` in your browser. On first launch a **Connection Settings** dialog asks for the API base (leave blank for same-origin) and the bearer token. The Workbench then provides: - -- **Overview** — index/concept/summary/report stat cards, clickable concept chips, recent documents, and last-compile/lint activity. -- **Documents** — drag-and-drop multi-file upload with per-file SSE progress, hash table, and delete with confirmation. -- **Query** — streamed answers with `tool_call` reasoning shown live in the right-pane timeline; GFM Markdown rendering (bold, tables, code, etc.). -- **Chat** — multi-turn streaming with a persisted session list: load history, resume a session, delete it. -- **Maintenance** — lint (with optional auto-fix), recompile (all or single doc, SSE log), and a file-watcher toggle. - -A right-pane **Inspector** timeline shows the vectorless retrieval & reasoning steps for every streamed operation. Creating a new KB from the Workbench inherits the project-root `config.yaml` and LLM credentials (`.env`) so it runs queries out of the box. The UI is responsive — on narrow screens the three panes collapse to a single column with a hamburger nav. +Open `http://127.0.0.1:8000/` for the Workbench, or see the [full Web UI guide](examples/rest-api/README.md#knowledge-workbench-web-ui). # 🧩 How OpenKB Works @@ -338,387 +313,9 @@ The skill is read-only. It won't run `openkb add`, `remove`, or `lint --fix` wit # REST API -OpenKB also ships a FastAPI service for using a knowledge base from Postman, -frontends, or other HTTP clients. - -Install the API dependencies if needed: - -```bash -pip install -e ".[api]" -``` - -Start the API server: - -```powershell -$env:OPENKB_API_TOKEN="test-token" -$env:OPENKB_KB_ROOT="D:\project\OpenKB\kbs" -.\.venv\Scripts\python.exe -m openkb.api --host 127.0.0.1 --port 8000 -``` - -### Authentication and common behavior - -`OPENKB_API_TOKEN` is required. Send it on every request: - -```text -Authorization: Bearer test-token -``` - -`OPENKB_KB_ROOT` is optional. It controls where REST-created knowledge bases -are stored. If unset, OpenKB uses `~/.config/openkb/kbs`. - -REST clients identify a knowledge base with `kb`, not a filesystem path. For -example, `postman-kb` resolves to `$OPENKB_KB_ROOT/postman-kb`. - -Common status codes across all endpoints: - -- `200` — success. -- `400` — invalid request body, unknown `kb`, or a KB that isn't an OpenKB dir - (missing `.openkb/` or `wiki/`). -- `401` — missing or wrong bearer token. -- `404` — referenced document/watcher not found (remove/recompile/watch-stop). -- `409` — ambiguous identifier (remove/recompile) with `candidates` in `detail`. -- `500` — server error, or `OPENKB_API_TOKEN` not configured on the server. - -All JSON endpoints use `Content-Type: application/json`. `/api/v1/add` is the -only `multipart/form-data` endpoint. - -### Streaming (SSE) - -Endpoints that accept `"stream": true` (`query`, `chat`, `remove`, `recompile`), -plus `add` (via a `stream` form field) and `watch/events` (always), return -Server-Sent Events (`Content-Type: text/event-stream`). Each frame is: - -```text -event: -data: -``` - -SSE event names: - -- `start` — stream opened; `data` includes the `endpoint`. -- `delta` — incremental answer text (query/chat), `{"text": "..."}`. -- `tool_call` — agent tool invocation (query/chat), with the call details. -- `uploaded` / `file_start` / `file_done` — per-file progress (add). -- `plan` — execution plan (remove: full plan; recompile: target list). -- `progress` — stage progress (remove: `wiki_cleanup`). -- `doc` — one document recompiled (recompile stream). -- `final` — terminal success payload (matches the non-streaming JSON body). -- `error` — failure, `{"message": "..."}` (may carry `code` for remove). -- `done` — stream closed; always emitted last. - -### Endpoints - -All endpoints are under `/api/v1`. - -| Method | Path | Body | Streams | Purpose | -| ------ | ----------------------- | ------------ | -------- | -------------------------------------- | -| GET | `/kbs` | — | no | List knowledge bases under the KB root | -| POST | `/init` | JSON | no | Create a knowledge base | -| POST | `/add` | multipart | optional | Upload + compile documents | -| POST | `/query` | JSON | yes | Ask a one-shot question | -| POST | `/chat` | JSON | yes | Multi-turn chat session | -| POST | `/chat/sessions` | JSON | no | List persisted chat sessions | -| POST | `/chat/sessions/load` | JSON | no | Load a session's history | -| POST | `/chat/sessions/delete` | JSON | no | Delete a session | -| POST | `/list` | JSON | no | List documents, summaries, concepts | -| POST | `/status` | JSON | no | KB directory/index stats | -| POST | `/lint` | JSON | no | Structural + semantic lint report | -| POST | `/remove` | JSON | yes | Remove a document + cleanup | -| POST | `/recompile` | JSON | yes | Recompile one or all docs | -| POST | `/watch/start` | JSON | no | Start a filesystem watcher | -| POST | `/watch/stop` | JSON | no | Stop a watcher | -| POST | `/watch/status` | JSON | no | Watcher status + recent events | -| GET | `/watch/events` | query params | always | SSE feed of watcher events | - -#### Initialize a KB - -```http -POST /api/v1/init -Content-Type: application/json -Authorization: Bearer test-token -``` - -Request (`InitRequest`): - -| Field | Type | Required | Default | Notes | -| ----------------- | ------ | -------- | ------- | ----------------------------- | -| `kb` | string | yes | — | new KB name | -| `model` | string | no | `null` | LLM model override | -| `api_key` | string | no | `null` | written to KB-local `.env` | -| `openai_api_base` | string | no | `null` | OpenAI-compatible gateway URL | - -`api_key` and `openai_api_base` are written to the KB-local `.env` when the KB -is created; secret values are not echoed back in the response. - -When `model`, `api_key`, and `openai_api_base` are all omitted (the Workbench's -default), the new KB inherits the operator's project-root `config.yaml` and LLM -credentials from the server's working-directory `.env` (server-level `OPENKB_*` -vars are filtered out), so a KB created from the UI runs queries out of the box. - -Response (`InitResponse`, `200`): `kb` (string), `created` (bool, `false` if the -KB already existed), `env_written` (`{api_key: bool, openai_api_base: bool}`), -`message` (string). Errors: `400` invalid/existing KB, `500` other. - -#### Add Documents - -```http -POST /api/v1/add -Authorization: Bearer test-token -``` - -`multipart/form-data`: - -| Field | Type | Value | -| -------- | ---- | --------------------- | -| `kb` | Text | `postman-kb` | -| `stream` | Text | `true` or `false` | -| `files` | File | one or more documents | - -Supported types match the CLI: `.pdf`, `.md`, `.markdown`, `.docx`, `.pptx`, -`.xlsx`, `.xls`, `.html`, `.htm`, `.txt`, `.csv`. `stream: true` emits per-file -SSE events (`uploaded`, `file_start`, `file_done`, `final`); `stream: false` -returns one JSON body. `400` if no files are uploaded. - -Response (`AddResponse`, `200`): `kb`, `files` (each -`{original_name, saved_path, status, message}`), `added_count`, `skipped_count` -(already indexed), `failed_count`. - -#### Query - -```http -POST /api/v1/query -Content-Type: application/json -Authorization: Bearer test-token -``` - -Request (`QueryRequest`): - -| Field | Type | Required | Default | Notes | -| ---------- | ------ | -------- | ------- | ------------------------------------ | -| `kb` | string | yes | — | | -| `question` | string | yes | — | | -| `stream` | bool | no | `true` | SSE vs single JSON | -| `save` | bool | no | `false` | write answer to `wiki/explorations/` | - -Non-streaming response (`QueryResponse`, `200`): `answer` (string), `saved_path` -(string\|null, set when `save: true`). Stream events: `start`, `delta`, -`tool_call`, `final` (`{answer, saved_path}`), `error`, `done`. `500` on failure. - -#### Chat - -```http -POST /api/v1/chat -Content-Type: application/json -Authorization: Bearer test-token -``` - -Request (`ChatRequest`): - -| Field | Type | Required | Default | Notes | -| ------------ | ------ | -------- | ------- | -------------------------- | -| `kb` | string | yes | — | | -| `message` | string | yes | — | | -| `session_id` | string | no | `null` | resume an existing session | -| `stream` | bool | no | `true` | SSE vs single JSON | - -Non-streaming response (`ChatResponse`, `200`): `session_id` (pass back to -continue), `answer`, `turn_count` (total turns in the session). Stream events: -`start` (includes `session_id`), `delta`, `tool_call`, `final`, `error`, `done`. - -#### Chat Sessions - -List, load, or delete persisted multi-turn sessions for a KB. These power the -session sidebar in the Workbench. - -```http -POST /api/v1/chat/sessions -Authorization: Bearer test-token -``` - -Request (`KbRequest`): `{ "kb": "postman-kb" }`. -Response (`ChatSessionListResponse`): `{ "kb", "sessions": [{ id, title, turn_count, updated_at, model }] }`, -ordered by `updated_at` descending. - -```http -POST /api/v1/chat/sessions/load -Authorization: Bearer test-token -``` - -Request (`ChatSessionLoadRequest`): `{ "kb", "session_id" }`. -Response (`ChatSessionLoadResponse`): `{ session_id, title, turn_count, user_turns: [...], assistant_texts: [...] }`. -Clients interleave `user_turns` and `assistant_texts` to render the history. -`404` if the session does not exist. - -```http -POST /api/v1/chat/sessions/delete -Authorization: Bearer test-token -``` - -Request (`ChatSessionDeleteRequest`): `{ "kb", "session_id" }`. -Response (`ChatSessionDeleteResponse`): `{ deleted: true }`. Returns `404` if not found. - -#### List - -```http -POST /api/v1/list -Content-Type: application/json -Authorization: Bearer test-token -``` - -Request (`KbRequest`): `kb`. - -Response (`ListResponse`, `200`): `documents` -(`[{hash, name, type, display_type, pages}]`), `document_count`, `summaries`, -`concepts`, `reports` (lists of page names). - -#### Status - -```http -POST /api/v1/status -Content-Type: application/json -Authorization: Bearer test-token -``` - -Request (`KbRequest`): `kb`. - -Response (`StatusResponse`, `200`): `directories` (per-folder file counts), -`raw_count`, `total_indexed`, `last_compile` and `last_lint` (ISO timestamps or -`null`). - -#### Lint - -```http -POST /api/v1/lint -Content-Type: application/json -Authorization: Bearer test-token -``` - -Request (`LintRequest`): - -| Field | Type | Required | Default | Notes | -| ----- | ------ | -------- | ------- | ------------------------------------------ | -| `kb` | string | yes | — | | -| `fix` | bool | no | `false` | rewrite/strip broken `[[wikilinks]]` first | - -When `fix: true`, broken wikilinks are rewritten/stripped under the KB ingest -lock (mirroring `openkb lint --fix`) before the report runs, so the report -reflects the post-fix state. The semantic lint is a multi-turn LLM agent run, so -the response can take tens of seconds to minutes regardless of `fix`; the `fix` -pass itself is a local, millisecond file rewrite. - -Response (`LintResponse`, `200`): - -| Field | Type | Notes | -| --------------------- | ------------ | ------------------------------------------- | -| `skipped` | bool | `true` when no documents are indexed | -| `reason` | string\|null | e.g. `no_documents_indexed` | -| `message` | string | status + fix summary when `fix: true` | -| `structural_report` | string\|null | local structural lint markdown | -| `knowledge_report` | string\|null | LLM semantic lint markdown | -| `report_path` | string\|null | report under `wiki/reports/` | -| `lint_files_changed` | int\|null | files rewritten by `fix` (else `null`) | -| `lint_ghosts_removed` | int\|null | ghost links stripped by `fix` (else `null`) | - -#### Remove Documents - -Remove a document and clean up its wiki pages, images, registry, and PageIndex -state, the same pipeline as `openkb remove`. - -```http -POST /api/v1/remove -Content-Type: application/json -Authorization: Bearer test-token -``` - -Request (`RemoveRequest`): - -| Field | Type | Required | Default | Notes | -| ------------ | ------ | -------- | ------- | --------------------------------------- | -| `kb` | string | yes | — | | -| `identifier` | string | yes | — | filename, `doc_name` slug, or substring | -| `keep_raw` | bool | no | `false` | keep the source file | -| `keep_empty` | bool | no | `false` | keep now-empty concept/entity pages | -| `dry_run` | bool | no | `false` | preview only | -| `stream` | bool | no | `false` | SSE vs single JSON | - -Response (`RemoveResponse`, `200`): `status` (`removed`, `partial`, `dry_run`), -`name`, `doc_name`, `actions` (each `{tag, target}`), `concepts_deleted`, -`entities_deleted`, `lint_files_changed` and `lint_ghosts_removed` (scoped -`lint --fix` counts after removal), `pageindex_message`/`pageindex_error`, -`message`, `candidates`. Errors: `404` no match, `409` multiple matches (with -`candidates`). Stream events: `start`, `plan`, `progress`, `final`, `error`, -`done`. - -#### Recompile - -Re-compile one or all documents, mirroring `openkb recompile`. - -```http -POST /api/v1/recompile -Content-Type: application/json -Authorization: Bearer test-token -``` - -Request (`RecompileRequest`): - -| Field | Type | Required | Default | Notes | -| ---------------- | ------ | -------- | ------- | --------------------------------- | -| `kb` | string | yes | — | | -| `doc_name` | string | no | `null` | one doc; omit with `all_docs` | -| `all_docs` | bool | no | `false` | recompile every document | -| `dry_run` | bool | no | `false` | preview only | -| `refresh_schema` | bool | no | `false` | re-extract PageIndex schema first | -| `stream` | bool | no | `false` | SSE vs single JSON | - -Response (`RecompileResponse`, `200`): `status` (`done`), `total`, `recompiled`, -`skipped`, `docs` (each `{name, doc_name, type, status, elapsed, message}`), -`targets`/`candidates` (present for plans/ambiguity). Errors: `404` no match, -`409` ambiguous (with `candidates`), `500` otherwise. Stream events: `start`, -`plan` (`{targets}`), `doc` (per-document result), `final`, `error`, `done`. - -#### Watch (auto-compile on file change) - -Start/stop/inspect a filesystem watcher that auto-compiles files dropped into -`raw/` (same as `openkb watch`), plus an SSE feed of watcher events. - -```http -POST /api/v1/watch/start -POST /api/v1/watch/stop -POST /api/v1/watch/status -GET /api/v1/watch/events -Content-Type: application/json -Authorization: Bearer test-token -``` - -`watch/start` (`WatchStartRequest`): `kb`, `debounce` (seconds, default `2.0`, -must be `> 0`). `watch/stop` and `watch/status` take only `kb`. - -```json -{ "kb": "postman-kb", "debounce": 2.0 } -``` - -All three return `WatchStatusResponse`: `kb`, `active` (bool), `started_at` -(epoch or `null`), `raw_dir`, `debounce`, `counters` (`{added, updated, failed, -...}`), `recent_events` (`[{ts, event, data}]`). `watch/stop` returns `404` if -no watcher is active for that KB. - -`GET /api/v1/watch/events` is always SSE. Query params: `kb` (required), -`max_events` (int, `>=1`, stop after N events), `timeout_seconds` (float, `>=0`, -stop after this many seconds). Stream events: `start`, the watcher's own events -(e.g. `added`, `updated`, `failed`, `final`), `error`, `done`. - -A Postman collection is included at [`openkb-postman.json`](openkb-postman.json). - -### Postman Tips +OpenKB ships a FastAPI service for HTTP clients. Install with `pip install -e ".[api]"`, then start with `python -m openkb.api`. The interactive API reference is at [`/docs`](http://127.0.0.1:8000/docs) (importable into Postman). -- For JSON endpoints, choose **Body -> raw -> JSON** and set - `Content-Type: application/json`. -- For `/api/v1/add`, choose **Body -> form-data**. Set `files` to type - **File** and let Postman generate the multipart `Content-Type`. -- For `GET /api/v1/watch/events`, put `kb`, `max_events`, and `timeout_seconds` - in **Params**, not the body. -- Verify non-streaming requests first with `"stream": false`, then test SSE - streaming once the JSON path works. +See the [full REST API reference](examples/rest-api/README.md#rest-api) for endpoints, auth, and SSE streaming. # 🧭 Learn More diff --git a/examples/rest-api/README.md b/examples/rest-api/README.md new file mode 100644 index 000000000..f7494b04c --- /dev/null +++ b/examples/rest-api/README.md @@ -0,0 +1,419 @@ +# REST API & Knowledge Workbench + +This guide covers the OpenKB REST API (FastAPI) and the bundled Knowledge Workbench web UI. + +> The interactive API reference is served live at [`/docs`](http://127.0.0.1:8000/docs) (OpenAPI/Swagger) once the server is running — you can import `/openapi.json` directly into Postman. + +## Knowledge Workbench (Web UI) + + +OpenKB ships a bundled React single-page app — the **Knowledge Workbench** — served directly by the REST server at `/`, so you get a full browser interface with no separate frontend process. + +```bash +# 1. build front web +cd frontend/ +npm install +npm run build + +# back project root +cd .. + +# 2. Set server variables (in .env or your shell) +OPENKB_API_TOKEN=test-token # bearer token the browser sends +OPENKB_KB_ROOT=/path/to/kbs # where REST /init creates KBs + +OR Edit .env and config.yaml + +# 3. Install with the API extra and start the server +pip install -e ".[api]" +python -m openkb.api --host 127.0.0.1 --port 8000 # serves the API + Workbench at http://127.0.0.1:8000/ +``` + +> **No build, no UI.** If you skip `npm run build`, the `web/` bundle is absent and `openkb-api` serves only the REST API under `/api/v1` — visiting `/` returns a 404. The Workbench web UI appears only after you build `frontend/` at least once. + +Open `http://127.0.0.1:8000/` in your browser. On first launch a **Connection Settings** dialog asks for the API base (leave blank for same-origin) and the bearer token. The Workbench then provides: + +- **Overview** — index/concept/summary/report stat cards, clickable concept chips, recent documents, and last-compile/lint activity. +- **Documents** — drag-and-drop multi-file upload with per-file SSE progress, hash table, and delete with confirmation. +- **Query** — streamed answers with `tool_call` reasoning shown live in the right-pane timeline; GFM Markdown rendering (bold, tables, code, etc.). +- **Chat** — multi-turn streaming with a persisted session list: load history, resume a session, delete it. +- **Maintenance** — lint (with optional auto-fix), recompile (all or single doc, SSE log), and a file-watcher toggle. + +A right-pane **Inspector** timeline shows the vectorless retrieval & reasoning steps for every streamed operation. Creating a new KB from the Workbench inherits the project-root `config.yaml` and LLM credentials (`.env`) so it runs queries out of the box. The UI is responsive — on narrow screens the three panes collapse to a single column with a hamburger nav. + + +## REST API + + +OpenKB also ships a FastAPI service for using a knowledge base from Postman, +frontends, or other HTTP clients. + +Install the API dependencies if needed: + +```bash +pip install -e ".[api]" +``` + +Start the API server: + +```powershell +$env:OPENKB_API_TOKEN="test-token" +$env:OPENKB_KB_ROOT="D:\project\OpenKB\kbs" +.\.venv\Scripts\python.exe -m openkb.api --host 127.0.0.1 --port 8000 +``` + +### Authentication and common behavior + +`OPENKB_API_TOKEN` is required. Send it on every request: + +```text +Authorization: Bearer test-token +``` + +`OPENKB_KB_ROOT` is optional. It controls where REST-created knowledge bases +are stored. If unset, OpenKB uses `~/.config/openkb/kbs`. + +REST clients identify a knowledge base with `kb`, not a filesystem path. For +example, `postman-kb` resolves to `$OPENKB_KB_ROOT/postman-kb`. + +Common status codes across all endpoints: + +- `200` — success. +- `400` — invalid request body, unknown `kb`, or a KB that isn't an OpenKB dir + (missing `.openkb/` or `wiki/`). +- `401` — missing or wrong bearer token. +- `404` — referenced document/watcher not found (remove/recompile/watch-stop). +- `409` — ambiguous identifier (remove/recompile) with `candidates` in `detail`. +- `500` — server error, or `OPENKB_API_TOKEN` not configured on the server. + +All JSON endpoints use `Content-Type: application/json`. `/api/v1/add` is the +only `multipart/form-data` endpoint. + +### Streaming (SSE) + +Endpoints that accept `"stream": true` (`query`, `chat`, `remove`, `recompile`), +plus `add` (via a `stream` form field) and `watch/events` (always), return +Server-Sent Events (`Content-Type: text/event-stream`). Each frame is: + +```text +event: +data: +``` + +SSE event names: + +- `start` — stream opened; `data` includes the `endpoint`. +- `delta` — incremental answer text (query/chat), `{"text": "..."}`. +- `tool_call` — agent tool invocation (query/chat), with the call details. +- `uploaded` / `file_start` / `file_done` — per-file progress (add). +- `plan` — execution plan (remove: full plan; recompile: target list). +- `progress` — stage progress (remove: `wiki_cleanup`). +- `doc` — one document recompiled (recompile stream). +- `final` — terminal success payload (matches the non-streaming JSON body). +- `error` — failure, `{"message": "..."}` (may carry `code` for remove). +- `done` — stream closed; always emitted last. + +### Endpoints + +All endpoints are under `/api/v1`. + +| Method | Path | Body | Streams | Purpose | +| ------ | ----------------------- | ------------ | -------- | -------------------------------------- | +| GET | `/kbs` | — | no | List knowledge bases under the KB root | +| POST | `/init` | JSON | no | Create a knowledge base | +| POST | `/add` | multipart | optional | Upload + compile documents | +| POST | `/query` | JSON | yes | Ask a one-shot question | +| POST | `/chat` | JSON | yes | Multi-turn chat session | +| POST | `/chat/sessions` | JSON | no | List persisted chat sessions | +| POST | `/chat/sessions/load` | JSON | no | Load a session's history | +| POST | `/chat/sessions/delete` | JSON | no | Delete a session | +| POST | `/list` | JSON | no | List documents, summaries, concepts | +| POST | `/status` | JSON | no | KB directory/index stats | +| POST | `/lint` | JSON | no | Structural + semantic lint report | +| POST | `/remove` | JSON | yes | Remove a document + cleanup | +| POST | `/recompile` | JSON | yes | Recompile one or all docs | +| POST | `/watch/start` | JSON | no | Start a filesystem watcher | +| POST | `/watch/stop` | JSON | no | Stop a watcher | +| POST | `/watch/status` | JSON | no | Watcher status + recent events | +| GET | `/watch/events` | query params | always | SSE feed of watcher events | + +#### Initialize a KB + +```http +POST /api/v1/init +Content-Type: application/json +Authorization: Bearer test-token +``` + +Request (`InitRequest`): + +| Field | Type | Required | Default | Notes | +| ----------------- | ------ | -------- | ------- | ----------------------------- | +| `kb` | string | yes | — | new KB name | +| `model` | string | no | `null` | LLM model override | +| `api_key` | string | no | `null` | written to KB-local `.env` | +| `openai_api_base` | string | no | `null` | OpenAI-compatible gateway URL | + +`api_key` and `openai_api_base` are written to the KB-local `.env` when the KB +is created; secret values are not echoed back in the response. + +When `model`, `api_key`, and `openai_api_base` are all omitted (the Workbench's +default), the new KB inherits the operator's project-root `config.yaml` and LLM +credentials from the server's working-directory `.env` (server-level `OPENKB_*` +vars are filtered out), so a KB created from the UI runs queries out of the box. + +Response (`InitResponse`, `200`): `kb` (string), `created` (bool, `false` if the +KB already existed), `env_written` (`{api_key: bool, openai_api_base: bool}`), +`message` (string). Errors: `400` invalid/existing KB, `500` other. + +#### Add Documents + +```http +POST /api/v1/add +Authorization: Bearer test-token +``` + +`multipart/form-data`: + +| Field | Type | Value | +| -------- | ---- | --------------------- | +| `kb` | Text | `postman-kb` | +| `stream` | Text | `true` or `false` | +| `files` | File | one or more documents | + +Supported types match the CLI: `.pdf`, `.md`, `.markdown`, `.docx`, `.pptx`, +`.xlsx`, `.xls`, `.html`, `.htm`, `.txt`, `.csv`. `stream: true` emits per-file +SSE events (`uploaded`, `file_start`, `file_done`, `final`); `stream: false` +returns one JSON body. `400` if no files are uploaded. + +Response (`AddResponse`, `200`): `kb`, `files` (each +`{original_name, saved_path, status, message}`), `added_count`, `skipped_count` +(already indexed), `failed_count`. + +#### Query + +```http +POST /api/v1/query +Content-Type: application/json +Authorization: Bearer test-token +``` + +Request (`QueryRequest`): + +| Field | Type | Required | Default | Notes | +| ---------- | ------ | -------- | ------- | ------------------------------------ | +| `kb` | string | yes | — | | +| `question` | string | yes | — | | +| `stream` | bool | no | `true` | SSE vs single JSON | +| `save` | bool | no | `false` | write answer to `wiki/explorations/` | + +Non-streaming response (`QueryResponse`, `200`): `answer` (string), `saved_path` +(string\|null, set when `save: true`). Stream events: `start`, `delta`, +`tool_call`, `final` (`{answer, saved_path}`), `error`, `done`. `500` on failure. + +#### Chat + +```http +POST /api/v1/chat +Content-Type: application/json +Authorization: Bearer test-token +``` + +Request (`ChatRequest`): + +| Field | Type | Required | Default | Notes | +| ------------ | ------ | -------- | ------- | -------------------------- | +| `kb` | string | yes | — | | +| `message` | string | yes | — | | +| `session_id` | string | no | `null` | resume an existing session | +| `stream` | bool | no | `true` | SSE vs single JSON | + +Non-streaming response (`ChatResponse`, `200`): `session_id` (pass back to +continue), `answer`, `turn_count` (total turns in the session). Stream events: +`start` (includes `session_id`), `delta`, `tool_call`, `final`, `error`, `done`. + +#### Chat Sessions + +List, load, or delete persisted multi-turn sessions for a KB. These power the +session sidebar in the Workbench. + +```http +POST /api/v1/chat/sessions +Authorization: Bearer test-token +``` + +Request (`KbRequest`): `{ "kb": "postman-kb" }`. +Response (`ChatSessionListResponse`): `{ "kb", "sessions": [{ id, title, turn_count, updated_at, model }] }`, +ordered by `updated_at` descending. + +```http +POST /api/v1/chat/sessions/load +Authorization: Bearer test-token +``` + +Request (`ChatSessionLoadRequest`): `{ "kb", "session_id" }`. +Response (`ChatSessionLoadResponse`): `{ session_id, title, turn_count, user_turns: [...], assistant_texts: [...] }`. +Clients interleave `user_turns` and `assistant_texts` to render the history. +`404` if the session does not exist. + +```http +POST /api/v1/chat/sessions/delete +Authorization: Bearer test-token +``` + +Request (`ChatSessionDeleteRequest`): `{ "kb", "session_id" }`. +Response (`ChatSessionDeleteResponse`): `{ deleted: true }`. Returns `404` if not found. + +#### List + +```http +POST /api/v1/list +Content-Type: application/json +Authorization: Bearer test-token +``` + +Request (`KbRequest`): `kb`. + +Response (`ListResponse`, `200`): `documents` +(`[{hash, name, type, display_type, pages}]`), `document_count`, `summaries`, +`concepts`, `reports` (lists of page names). + +#### Status + +```http +POST /api/v1/status +Content-Type: application/json +Authorization: Bearer test-token +``` + +Request (`KbRequest`): `kb`. + +Response (`StatusResponse`, `200`): `directories` (per-folder file counts), +`raw_count`, `total_indexed`, `last_compile` and `last_lint` (ISO timestamps or +`null`). + +#### Lint + +```http +POST /api/v1/lint +Content-Type: application/json +Authorization: Bearer test-token +``` + +Request (`LintRequest`): + +| Field | Type | Required | Default | Notes | +| ----- | ------ | -------- | ------- | ------------------------------------------ | +| `kb` | string | yes | — | | +| `fix` | bool | no | `false` | rewrite/strip broken `[[wikilinks]]` first | + +When `fix: true`, broken wikilinks are rewritten/stripped under the KB ingest +lock (mirroring `openkb lint --fix`) before the report runs, so the report +reflects the post-fix state. The semantic lint is a multi-turn LLM agent run, so +the response can take tens of seconds to minutes regardless of `fix`; the `fix` +pass itself is a local, millisecond file rewrite. + +Response (`LintResponse`, `200`): + +| Field | Type | Notes | +| --------------------- | ------------ | ------------------------------------------- | +| `skipped` | bool | `true` when no documents are indexed | +| `reason` | string\|null | e.g. `no_documents_indexed` | +| `message` | string | status + fix summary when `fix: true` | +| `structural_report` | string\|null | local structural lint markdown | +| `knowledge_report` | string\|null | LLM semantic lint markdown | +| `report_path` | string\|null | report under `wiki/reports/` | +| `lint_files_changed` | int\|null | files rewritten by `fix` (else `null`) | +| `lint_ghosts_removed` | int\|null | ghost links stripped by `fix` (else `null`) | + +#### Remove Documents + +Remove a document and clean up its wiki pages, images, registry, and PageIndex +state, the same pipeline as `openkb remove`. + +```http +POST /api/v1/remove +Content-Type: application/json +Authorization: Bearer test-token +``` + +Request (`RemoveRequest`): + +| Field | Type | Required | Default | Notes | +| ------------ | ------ | -------- | ------- | --------------------------------------- | +| `kb` | string | yes | — | | +| `identifier` | string | yes | — | filename, `doc_name` slug, or substring | +| `keep_raw` | bool | no | `false` | keep the source file | +| `keep_empty` | bool | no | `false` | keep now-empty concept/entity pages | +| `dry_run` | bool | no | `false` | preview only | +| `stream` | bool | no | `false` | SSE vs single JSON | + +Response (`RemoveResponse`, `200`): `status` (`removed`, `partial`, `dry_run`), +`name`, `doc_name`, `actions` (each `{tag, target}`), `concepts_deleted`, +`entities_deleted`, `lint_files_changed` and `lint_ghosts_removed` (scoped +`lint --fix` counts after removal), `pageindex_message`/`pageindex_error`, +`message`, `candidates`. Errors: `404` no match, `409` multiple matches (with +`candidates`). Stream events: `start`, `plan`, `progress`, `final`, `error`, +`done`. + +#### Recompile + +Re-compile one or all documents, mirroring `openkb recompile`. + +```http +POST /api/v1/recompile +Content-Type: application/json +Authorization: Bearer test-token +``` + +Request (`RecompileRequest`): + +| Field | Type | Required | Default | Notes | +| ---------------- | ------ | -------- | ------- | --------------------------------- | +| `kb` | string | yes | — | | +| `doc_name` | string | no | `null` | one doc; omit with `all_docs` | +| `all_docs` | bool | no | `false` | recompile every document | +| `dry_run` | bool | no | `false` | preview only | +| `refresh_schema` | bool | no | `false` | re-extract PageIndex schema first | +| `stream` | bool | no | `false` | SSE vs single JSON | + +Response (`RecompileResponse`, `200`): `status` (`done`), `total`, `recompiled`, +`skipped`, `docs` (each `{name, doc_name, type, status, elapsed, message}`), +`targets`/`candidates` (present for plans/ambiguity). Errors: `404` no match, +`409` ambiguous (with `candidates`), `500` otherwise. Stream events: `start`, +`plan` (`{targets}`), `doc` (per-document result), `final`, `error`, `done`. + +#### Watch (auto-compile on file change) + +Start/stop/inspect a filesystem watcher that auto-compiles files dropped into +`raw/` (same as `openkb watch`), plus an SSE feed of watcher events. + +```http +POST /api/v1/watch/start +POST /api/v1/watch/stop +POST /api/v1/watch/status +GET /api/v1/watch/events +Content-Type: application/json +Authorization: Bearer test-token +``` + +`watch/start` (`WatchStartRequest`): `kb`, `debounce` (seconds, default `2.0`, +must be `> 0`). `watch/stop` and `watch/status` take only `kb`. + +```json +{ "kb": "postman-kb", "debounce": 2.0 } +``` + +All three return `WatchStatusResponse`: `kb`, `active` (bool), `started_at` +(epoch or `null`), `raw_dir`, `debounce`, `counters` (`{added, updated, failed, +...}`), `recent_events` (`[{ts, event, data}]`). `watch/stop` returns `404` if +no watcher is active for that KB. + +`GET /api/v1/watch/events` is always SSE. Query params: `kb` (required), +`max_events` (int, `>=1`, stop after N events), `timeout_seconds` (float, `>=0`, +stop after this many seconds). Stream events: `start`, the watcher's own events +(e.g. `added`, `updated`, `failed`, `final`), `error`, `done`. + +The full OpenAPI schema is at [`/openapi.json`](http://127.0.0.1:8000/openapi.json) — importable into Postman or any OpenAPI-compatible client. + + diff --git a/frontend/index.html b/frontend/index.html index eec773b38..dca79a9e3 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1,13 +1,13 @@ - + - OpenKB · 知识工作台 + OpenKB · Knowledge Workbench
- \ No newline at end of file + diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 4a9c5a1e9..cf01ed724 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -1,6 +1,7 @@ import { useEffect, useCallback } from "react"; import { Menu } from "lucide-react"; import { AppProvider, useApp } from "./state/AppContext.jsx"; +import { I18nProvider, useI18n } from "./i18n.jsx"; import { api, hasConnection } from "./api/client.js"; import Sidebar from "./components/Sidebar.jsx"; import Inspector from "./components/Inspector.jsx"; @@ -12,10 +13,9 @@ import Query from "./views/Query.jsx"; import Chat from "./views/Chat.jsx"; import Maintenance from "./views/Maintenance.jsx"; -const TITLES = { overview: "概览", documents: "文档管理", query: "查询", chat: "对话", maintenance: "维护" }; - function Shell() { const { kb, view, setKbs, setKb, kbs, setSidebarOpen, setSettingsOpen, toastMsg } = useApp(); + const { t, lang } = useI18n(); const loadKbs = useCallback(async () => { if (!hasConnection()) return; @@ -43,8 +43,13 @@ function Shell() { }; }, [loadKbs, toastMsg, setSettingsOpen]); + // Keep the browser tab title in sync with the active language. + useEffect(() => { + document.title = t("appTitle"); + }, [lang, t]); + function renderView() { - if (!kb) return

未选择知识库

请在左侧选择或新建一个知识库。

; + if (!kb) return

{t("noKbSelected")}

{t("selectOrCreate")}

; if (view === "overview") return ; if (view === "documents") return ; if (view === "query") return ; @@ -55,13 +60,13 @@ function Shell() { return (
-
-

{TITLES[view]}

+

{t(view)}

{renderView()}
@@ -74,8 +79,10 @@ function Shell() { export default function App() { return ( - - - + + + + + ); } diff --git a/frontend/src/api/client.js b/frontend/src/api/client.js index dc26fa668..0704044d6 100644 --- a/frontend/src/api/client.js +++ b/frontend/src/api/client.js @@ -27,6 +27,42 @@ export function baseUrl() { return getApiBase().replace(/\/$/, ""); } +// Warn when the configured base is cross-origin and not HTTPS. The bearer +// token is attached to every request, so a typo'd or malicious base would +// leak the token to an attacker-controlled host. This is advisory only — +// same-origin (empty base, the production mount at /) is always safe. +let _baseWarned = false; +export function isBaseUrlSafe() { + const base = baseUrl(); + if (!base) return true; // same-origin, always safe + try { + const url = new URL(base, window.location.origin); + if (url.origin === window.location.origin) return true; + return url.protocol === "https:"; + } catch { + return false; + } +} + +export function checkBaseSafety() { + if (_baseWarned) return; + const base = baseUrl(); + if (!base) return; // same-origin + try { + const url = new URL(base, window.location.origin); + if (url.origin !== window.location.origin && url.protocol !== "https:") { + console.warn( + `[OpenKB] API base "${base}" is cross-origin and non-HTTPS. ` + + "Your API token will be sent to this host on every request. " + + "Verify this URL is trusted before proceeding.", + ); + _baseWarned = true; + } + } catch { + // invalid URL — will fail at fetch time + } +} + // Surface 401s to the UI so the connection modal can reopen for re-entry. export function notifyUnauthorized() { window.dispatchEvent(new CustomEvent("openkb:unauthorized")); @@ -41,6 +77,7 @@ export async function request(path, { method = "GET", body, headers } = {}) { }; const init = { method, headers: finalHeaders }; if (body !== undefined) init.body = body instanceof FormData ? body : JSON.stringify(body); + checkBaseSafety(); const res = await fetch(baseUrl() + path, init); if (!res.ok) { let msg = `${res.status} ${res.statusText}`; diff --git a/frontend/src/api/sse.js b/frontend/src/api/sse.js index 7219af90e..ecc072787 100644 --- a/frontend/src/api/sse.js +++ b/frontend/src/api/sse.js @@ -1,7 +1,7 @@ // SSE streaming over fetch (EventSource cannot set Authorization headers). // Parses `event:` / `data:` blocks from a ReadableStream and invokes handlers. -import { baseUrl, getToken, notifyUnauthorized } from "./client.js"; +import { baseUrl, getToken, notifyUnauthorized, checkBaseSafety } from "./client.js"; // Parse raw text buffer into complete SSE blocks, returning [events, remainder]. function parseBuffer(buf) { @@ -54,6 +54,7 @@ function buildHeaders(body, extra = {}) { // Stream a JSON-POST endpoint. Returns an AbortController-like handle via opts.signal. export async function streamSSE(path, payload, onEvent, opts = {}) { + checkBaseSafety(); const res = await fetch(baseUrl() + path, { method: "POST", headers: buildHeaders(payload), @@ -78,6 +79,7 @@ await readStream(res, onEvent); // Stream a multipart upload (FormData) endpoint. export async function streamUpload(path, form, onEvent, opts = {}) { + checkBaseSafety(); const res = await fetch(baseUrl() + path, { method: "POST", headers: buildHeaders(form), diff --git a/frontend/src/components/Inspector.jsx b/frontend/src/components/Inspector.jsx index 0a1eaafa3..70bdf1e56 100644 --- a/frontend/src/components/Inspector.jsx +++ b/frontend/src/components/Inspector.jsx @@ -1,8 +1,10 @@ import { useEffect, useRef } from "react"; import { useApp } from "../state/AppContext.jsx"; +import { useI18n } from "../i18n.jsx"; export default function Inspector() { const { inspItems, inspBusy } = useApp(); + const { t } = useI18n(); const bodyRef = useRef(null); useEffect(() => { @@ -12,13 +14,13 @@ export default function Inspector() { return (