From 86778e664631c434bb10af4355be9944f532e21a Mon Sep 17 00:00:00 2001 From: qingnian108 <44261124+qingnian108@users.noreply.github.com> Date: Fri, 6 Nov 2026 22:01:43 +0800 Subject: [PATCH] agent-console 1.3.7: auto-detect unlabelled code blocks, html-only sanitize, Windows desktop reconnect through Magpie's Try again (#792) Code blocks are drawn in the same pass as the Markdown, so a streaming reply no longer flickers. Two fixes from the review on 40eb3027: - An unlabelled fence is detected by highlight.js again (`highlightAuto`, behind a 128-entry LRU). Only a fence that is still open at the end of a streaming message stays plain "text" (`isClosedFence`, which follows marked's fence rule). - DOMPurify is back to the html profile only. The code-block icons are per-load random placeholders until after sanitize, and `codeBlockKey` is gone. The Windows desktop reconnect is also fixed. `safeBackUrl` (gate, wrapper and web) takes loopback Magpie pages only, never `http://wails.localhost`. WebView2 can't route a 127.0.0.1 frame's request there, so it showed its gray error page. In the desktop window the wrapper, or an unwrapped daemon page, posts `{magpie:1, method:"error"}` instead, and Magpie's pluginpages.js answers with its Try again card. A stale stored wails back URL is dropped. Reviewed at c520fa46 (merge base 1eb9473f = main) on mote (mote-run, HOME=$(mktemp -d), package copied out of the workspace): - npm ci; `npm run check` clean; `npm run verify:build` OK for all 5 files. - `npx vitest run` with CHROME_PATH set to Playwright's Chromium 1248: 77 files, 567 passed, 17 skipped, 0 failed. markdown-render-browser ran (it went red under the hand-breaks). - `bun scripts/check.mjs agent-console` ok. Repo `bun test`: 6449 pass, 0 fail. - Broken by hand, each red: - autoDetect forced on while streaming: markdown-render-browser red. - `svg: true` put back in the profile: markdown-render-browser red. - Auto-detection removed: codeBlock and markdown-render-browser red. - LRU eviction removed: codeBlock red. - `isClosedFence` accepting any backtick run: codeBlock red. - wails.localhost accepted again in gate.mjs, then in backToMagpie.ts: ac11 red (3 and 2 tests). - The same in wrapper.mjs: wrapper red (4 tests). - The stale stored back kept: wrapper red. - Read magpie's pluginpages.js on main: `method:"error"` from the page's own frame calls `broke(key, why)`. Not tried: a real WebView2 on Windows (the reconnect path), or a real streaming reply in the desktop app. --- packages/agent-console/README.md | 4 +- packages/agent-console/app/app.css | 2 +- packages/agent-console/app/app.js | 126 ++--- packages/agent-console/daemon/dist/main.js | 21 + .../agent-console/daemon/dist/main.js.map | 2 +- .../daemon/src/providers/mock.ts | 20 + packages/agent-console/lib/gate.mjs | 19 +- packages/agent-console/lib/wrapper.mjs | 31 +- packages/agent-console/package-lock.json | 4 +- packages/agent-console/package.json | 2 +- packages/agent-console/test/v1/ac11.test.ts | 52 ++- .../v1/chat-stream-flicker-browser.test.ts | 434 ++++++++++++++++++ .../test/v1/markdown-render-browser.test.ts | 128 ++++++ .../agent-console/test/v1/wrapper.test.ts | 54 ++- packages/agent-console/web/src/App.tsx | 19 +- .../agent-console/web/src/api/backToMagpie.ts | 25 +- .../agent-console/web/src/components/Chat.tsx | 6 +- .../web/src/components/Composer.tsx | 34 +- .../web/src/components/Markdown.tsx | 186 +++----- .../web/src/components/QuoteSelect.tsx | 7 +- packages/agent-console/web/src/main.tsx | 8 +- .../web/src/stores/timeline.test.ts | 86 ++++ .../agent-console/web/src/stores/timeline.ts | 36 +- .../agent-console/web/src/styles/layout.css | 11 +- .../web/src/util/codeBlock.test.ts | 174 +++++++ .../agent-console/web/src/util/codeBlock.ts | 197 ++++++++ .../web/src/util/renderMarkdown.ts | 44 ++ 27 files changed, 1461 insertions(+), 271 deletions(-) create mode 100644 packages/agent-console/test/v1/chat-stream-flicker-browser.test.ts create mode 100644 packages/agent-console/test/v1/markdown-render-browser.test.ts create mode 100644 packages/agent-console/web/src/stores/timeline.test.ts create mode 100644 packages/agent-console/web/src/util/codeBlock.test.ts create mode 100644 packages/agent-console/web/src/util/codeBlock.ts create mode 100644 packages/agent-console/web/src/util/renderMarkdown.ts diff --git a/packages/agent-console/README.md b/packages/agent-console/README.md index c05d54d..caf4e8f 100644 --- a/packages/agent-console/README.md +++ b/packages/agent-console/README.md @@ -55,7 +55,7 @@ UI principle: **obvious at a glance, nothing extra**. Three columns — sidebar The daemon only ever answers with the option for that one request (allow once / accept), never allow-always, so no lasting rule is written into the Agent's own config; when a request offers nothing narrower, the card stays for you. Plan approvals and questions are never answered for you. Every approval it gives is saved in the conversation (`permission_request` + `permission_resolved`, both `auto: true`) and shown as a quiet row after its tool calls, 已自动同意 3 项 · npm test · git status, that opens to each request's title, command or file and the answer. Turning the mode on also approves a card that is already waiting. Only the page (with its token) can switch it on. **Upgrading from 1.2.** 1.2's 全部放行 (`bypassPermissions`) did nothing for Cursor and OpenCode (they had no such mode, so it fell back to 每次询问) and dsh still asked; from 1.3 the same setting would really auto-approve for them. It is not escalated silently: on the first 1.3 start, Cursor / OpenCode / dsh conversations saved in that mode go back to 每次询问 with a notice in the conversation, and if your default permission mode was 全部放行, new Cursor / OpenCode / dsh conversations keep starting in 每次询问; the first one shows a notice that the new mode exists, with a button to turn it on there. Claude Code, Codex, Copilot and Devin keep the mode, which already meant the same in 1.2. Choosing the default permission mode again in Settings ends this. -- **Structured timeline**: user message → thinking (expandable) → tool calls (read / edit / command, with line-level diffs) → todos → usage and duration; answer permission requests (tools / plan / questions) on the card. Since 1.3 every tool call is one compact row: a type icon, the command or path (monospace, relative to the project, never wrapping), `+N -M` for an edit and the status on the right; click a row for its output or diff, and a failed step opens by itself. A run of more than 6 tool calls (with the short thinking between them) folds into one summary row (改动 2 · 运行 3 · 读取 4 · 搜索 1 · 1 失败) that expands to the same rows; while it runs, one line shows the current step (正在运行:npm test…). The Agent's step list (Claude Code TodoWrite, Codex plan updates, an ACP agent's plan) is a checklist with N/M, and while it has open items an "N/M 个任务" pill above the composer jumps to it. Each reply ends with 复制 · model · time · duration (plus tokens / cost when the Agent reports them). Code blocks have a language label, line numbers, a wrap toggle and a copy button (the copy is the raw code). The look is grayscale and was inspired by [Better Paseo](https://github.com/RoundRedDot/better-paseo) (MIT); no code was copied +- **Structured timeline**: user message → thinking (expandable) → tool calls (read / edit / command, with line-level diffs) → todos → usage and duration; answer permission requests (tools / plan / questions) on the card. Since 1.3 every tool call is one compact row: a type icon, the command or path (monospace, relative to the project, never wrapping), `+N -M` for an edit and the status on the right; click a row for its output or diff, and a failed step opens by itself. A run of more than 6 tool calls (with the short thinking between them) folds into one summary row (改动 2 · 运行 3 · 读取 4 · 搜索 1 · 1 失败) that expands to the same rows; while it runs, one line shows the current step (正在运行:npm test…). The Agent's step list (Claude Code TodoWrite, Codex plan updates, an ACP agent's plan) is a checklist with N/M, and while it has open items an "N/M 个任务" pill above the composer jumps to it. Each reply ends with 复制 · model · time · duration (plus tokens / cost when the Agent reports them). Code blocks have a language label, line numbers, a wrap toggle and a copy button (the copy is the raw code). A block written without a language is detected by highlight.js (`highlightAuto`), coloured and labelled with what it found; while a reply streams, that happens as soon as the block's closing fence arrives (an open block stays plain "text" so its colours and label don't flip with every token), and results are cached so a closed block isn't detected again on every frame (1.3.7). Since 1.3.7 code blocks are drawn in the same pass as the Markdown, so a streaming reply no longer flickers; the Agent's Markdown is sanitized by DOMPurify with the HTML profile only (an `` the Agent writes is dropped), and the code block icons are added after sanitizing. The look is grayscale and was inspired by [Better Paseo](https://github.com/RoundRedDot/better-paseo) (MIT); no code was copied - **Instant send (1.3)**: your message shows in the timeline the moment you click 发送 and the composer switches to working at once. The daemon saves and pushes the message before it starts the Agent (spawn + ACP `initialize` / `session/new`, seconds on Windows) instead of after; the page draws it right away and swaps in the daemon's copy by a client message id, so it neither doubles nor jumps. A send that fails stays in place marked 发送失败 with 重试 / 移除. A message sent while a turn runs still goes to the queue list - **Steer and queue**: steer while running, queue the next message, interrupt - **Changes panel**: git status refresh every 3s, unified per-file diffs; discarded untracked files go to trash instead of a hard delete @@ -104,7 +104,7 @@ The daemon can run Agents with full access to your machine, so the token that un - The gate answers only `GET /open?k=` (the daemon token is not accepted there) and `GET /app` (1.3, below), refuses any request that carries an `Origin` header, and sends `Cache-Control: no-store`, `X-Content-Type-Options: nosniff`, `Referrer-Policy: no-referrer`. - WebSocket connections must send `hello` with the token within 5 seconds, otherwise they are closed with code 4401. - **Coming back after sleep / a daemon restart (1.3).** Before 1.3 the plugin frame sat on the daemon's random port; when the daemon was gone after sleep and the WebView reloaded the frame, it showed "127.0.0.1 拒绝连接" with none of our script left to recover. Now `/open` redirects to the gate's own `GET /app`, a static page that frames the daemon page, so a reload lands on the stable gate port. The daemon page (told by `w=1`) posts `{ac_console:"alive"}` to it every 2 s while its WebSocket is open and `{ac_console:"lost"}` after 5 s without it; no alive within 12 s (6 s after the child frame loaded), a lost, or 15 s of silence while visible (time the wrapper's own timers were suspended doesn't count) sends the frame back through the Magpie page (`b`, as below), which restarts the daemon. At most 3 automatic tries in 2 minutes (`ac_try`), then a button. Coming back to the page (`visibilitychange` → visible, or window focus) checks at once instead of waiting out the timers pushed back while hidden: if the child never said alive within 12 s of loading or its last real alive is older than 15 s, it gets 4 s (two heartbeats) to speak up before the same recovery runs; a child that answers is left alone. If a disconnect end state is showing, coming back counts as clicking Reconnect, also when the automatic tries are used up. The wrapper holds no secret of its own: the token arrives only in its fragment and goes on only in the child's fragment, the gate key never reaches it, the child is always `http://127.0.0.1:/`, `b` passes the same loopback Magpie-page check, only the Magpie theme protocol is relayed (theme events and hello answers down, the hello call up, messages checked by `event.source`), and it is served with a per-response nonce CSP (`default-src 'none'`, `frame-src http://127.0.0.1:*`, and `frame-ancestors 'self' http://127.0.0.1:* http://localhost:* http://[::1]:* http://wails.localhost:* wails:`, so only a loopback page or Magpie's own desktop window can frame it). Host and Origin checks apply to `/app` like to `/open`. -- **Coming back after a plugin host restart.** Magpie restarts its plugin host from time to time; the old host's daemon exits with it and the new host has a new gate key. `boot.js` passes its own page URL to the gate as `back`; the gate accepts it only if it is a loopback `/_magpie/plugin//index.html` URL and forwards it **only in the fragment** (`#t=…&b=…`). When the daemon page can't reconnect for 5 seconds (or on 重试 / Retry) it navigates back to that page, which reads the fresh `session.js` and opens the new gate. To tell a live host's `session.js` from one a killed host left behind (a hard kill can't delete it), the file carries `ts` and `beat`: from the first page open on, the host rewrites it every 4 s, and after a lost connection `boot.js` only takes a file written after the loss; a host that was never opened doesn't rewrite it, and a new host deletes a file whose writer (pid in `session-owner.json`, outside the page folder) is gone before Magpie serves the page. The daemon page checks the URL again before following it, so it is never an open redirect, and the token never leaves its own fragment. +- **Coming back after a plugin host restart.** Magpie restarts its plugin host from time to time; the old host's daemon exits with it and the new host has a new gate key. `boot.js` passes its own page URL to the gate as `back`; the gate accepts it only if it is a loopback `/_magpie/plugin//index.html` URL and forwards it **only in the fragment** (`#t=…&b=…`). When the daemon page can't reconnect for 5 seconds (or on 重试 / Retry) it navigates back to that page, which reads the fresh `session.js` and opens the new gate. In Magpie's desktop window (`wails://localhost` on macOS / Linux, `http://wails.localhost` on Windows) there is no loopback `back`, and none is ever taken: the wrapper posts `{magpie: 1, method: "error"}` to the window instead, Magpie swaps the frame for its "This page stopped working" card at once, and its Try again builds a new frame on the Magpie page (fresh `session.js` → new gate → new daemon). 1.3.5 / 1.3.6 also took `http://wails.localhost` as `back` on Windows, but WebView2 doesn't route that request from a frame that is on `127.0.0.1` (Wails intercepts `wails.localhost` with the filter that skips out-of-process iframes), so the frame ended on WebView2's gray error page with nothing of ours left to recover. To tell a live host's `session.js` from one a killed host left behind (a hard kill can't delete it), the file carries `ts` and `beat`: from the first page open on, the host rewrites it every 4 s, and after a lost connection `boot.js` only takes a file written after the loss; a host that was never opened doesn't rewrite it, and a new host deletes a file whose writer (pid in `session-owner.json`, outside the page folder) is gone before Magpie serves the page. The daemon page checks the URL again before following it, so it is never an open redirect, and the token never leaves its own fragment. ### Preview proxy (1.2) diff --git a/packages/agent-console/app/app.css b/packages/agent-console/app/app.css index d1fe0e1..3de2e65 100644 --- a/packages/agent-console/app/app.css +++ b/packages/agent-console/app/app.css @@ -1,4 +1,4 @@ -:root{--own-bg: #ffffff;--own-sb: #f8f8f7;--own-fg: #1f1f1f;--own-muted: #737373;--own-line: #ececec;--bg: var(--own-bg);--sb-bg: var(--own-sb);--fg: var(--own-fg);--muted: var(--own-muted);--line: var(--own-line);--meta: #a3a3a3;--text: #262626;--accent: #262626;--accent-2: #525252;--accent-fg: #ffffff;--accent-soft: #f0f0f0;--surface: color-mix(in oklab, var(--fg) 3%, var(--bg));--surface-hover: color-mix(in oklab, var(--fg) 6%, var(--bg));--chip-bg: #f4f5f5;--chip-line: #ececec;--pill-fg: #525252;--search-bg: #efefee;--tile-bg: color-mix(in oklab, var(--fg) 90%, var(--bg));--tile-fg: var(--bg);--badge-bg: color-mix(in oklab, var(--fg) 7%, var(--bg));--badge-fg: color-mix(in oklab, var(--fg) 80%, var(--bg));--run-bg: #f0f0f0;--run-fg: #404040;--cp-line: color-mix(in oklab, var(--fg) 11%, var(--bg));--cp-focus: #a3a3a3;--cp-ring: rgb(0 0 0 / .06);--active-bg: #ffffff;--active-line: #e6e6e6;--ok: #16a34a;--warn: #d97706;--danger: #dc2626;--info: #2563eb;--code-bg: #f4f5f5;--code-line: #eaeceb;--code-fg: #404040;--add-bg: #ecfdf3;--del-bg: #fef2f2;--r-s: 6px;--r-m: 8px;--r-l: 12px;--r-full: 999px;--font-ui: var(--magpie-font, "Segoe UI Variable Text", "Segoe UI", -apple-system, "PingFang SC", "Microsoft YaHei UI", system-ui, sans-serif);--font-mono: var(--magpie-code, "Cascadia Code", "Cascadia Mono", "JetBrains Mono", ui-monospace, Consolas, monospace);--fs-xs: 11px;--fs-s: 12px;--fs-m: 13px;--fs-l: 14px;--fs-hero: 18px;--lh: 1.6;--col: 720px;--chat-fs: 13px;--chat-fs-s: max(12px, calc(var(--chat-fs) - 1px));--chat-code-fs: max(11.5px, calc(var(--chat-fs) - 1px));--chat-lh: 1.7;--row: 26px;--shadow-pop: 0 8px 24px -6px rgb(0 0 0 / .16), 0 0 0 1px var(--line);--term-bg: #ffffff;--term-fg: #1e1e1e;--ease: cubic-bezier(.2,.7,.2,1);--dur-1: .12s;--dur-2: .2s;color-scheme:light}:root[data-theme=dark]{--own-bg: #1a1a1a;--own-sb: #151515;--own-fg: #ececec;--own-muted: #9b9b9b;--own-line: #2c2c2c;--meta: #7c7c7c;--text: #e2e2e2;--accent: #e5e5e5;--accent-2: #b3b3b3;--accent-fg: #171717;--accent-soft: #2e2e2e;--chip-bg: #252727;--chip-line: #323434;--pill-fg: #bdbdbd;--search-bg: #242424;--run-bg: #2e2e2e;--run-fg: #d4d4d4;--cp-focus: #6b6b6b;--cp-ring: rgb(255 255 255 / .07);--active-bg: #242424;--active-line: #333333;--info: #60a5fa;--code-bg: #232323;--code-line: #303030;--code-fg: #d4d4d4;--add-bg: rgb(22 163 74 / .16);--del-bg: rgb(220 38 38 / .16);--shadow-pop: 0 8px 24px -6px rgb(0 0 0 / .5), 0 0 0 1px var(--line);--term-bg: #0c0c0c;--term-fg: #cccccc;color-scheme:dark}:root[data-host-colors]{--bg: var(--magpie-card, var(--magpie-bg, var(--own-bg)));--sb-bg: var(--magpie-bg, var(--own-sb));--fg: var(--magpie-fg, var(--own-fg));--muted: var(--magpie-muted, var(--own-muted));--line: var(--magpie-line, var(--own-line))}@layer reset{html,body{margin:0;padding:0;height:100%}body{background:var(--bg);color:var(--fg);font-family:var(--font-ui);font-size:var(--fs-m);line-height:var(--lh);-webkit-font-smoothing:antialiased}*{box-sizing:border-box}#root{height:100%}button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}input,textarea{font:inherit;color:inherit}a{color:var(--accent)}:focus-visible{outline:2px solid color-mix(in oklab,var(--accent) 55%,var(--bg));outline-offset:-1px}}*{scrollbar-width:thin;scrollbar-color:color-mix(in oklab,var(--fg) 18%,transparent) transparent}*::-webkit-scrollbar{width:8px;height:8px}*::-webkit-scrollbar-thumb{background:color-mix(in oklab,var(--fg) 18%,transparent);border-radius:4px}*::-webkit-scrollbar-thumb:hover{background:color-mix(in oklab,var(--fg) 30%,transparent)}*::-webkit-scrollbar-track{background:transparent}.ibtn{width:28px;height:28px;flex:none;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--r-s);color:var(--muted);transition:background var(--dur-1),color var(--dur-1)}.ibtn:hover{background:var(--surface-hover);color:var(--fg)}.ibtn[disabled]{opacity:.35;cursor:default}.ibtn.on{color:var(--accent)}.ibtn svg{width:16px;height:16px}.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:30px;padding:0 14px;border-radius:var(--r-s);font-size:var(--fs-m);background:var(--surface-hover);color:var(--fg);transition:background var(--dur-1),filter var(--dur-1)}.btn:hover{filter:brightness(1.03)}.btn[disabled]{opacity:.4;cursor:default}.btn.primary{background:var(--accent);color:var(--accent-fg)}.btn.primary:hover{filter:brightness(1.08)}.btn.danger{color:var(--danger)}.btn.ghost{background:none}.btn.ghost:hover{background:var(--surface-hover)}.tinput{width:100%;height:30px;padding:0 10px;border:1px solid var(--line);border-radius:var(--r-s);background:var(--bg);font-size:var(--fs-m);outline:none}.tinput:focus{border-color:color-mix(in oklab,var(--accent) 55%,var(--bg))}.tinput.err{border-color:var(--danger)}.tinput::placeholder{color:var(--muted)}textarea.tinput{height:auto;min-height:60px;padding:6px 10px;resize:vertical}.menu{position:fixed;z-index:60;min-width:160px;max-width:280px;background:var(--bg);border-radius:var(--r-m);box-shadow:var(--shadow-pop);padding:4px;font-size:var(--fs-m)}.mi{display:flex;align-items:center;gap:8px;width:100%;height:28px;padding:0 10px;border-radius:var(--r-s);text-align:left;color:var(--fg)}.mi:hover:not([disabled]){background:var(--surface-hover)}.mi[disabled]{color:var(--muted);cursor:default}.mi.danger{color:var(--danger)}.mi .mi-check{margin-left:auto;color:var(--accent)}.msep{height:1px;margin:4px 6px;background:var(--line)}.mlabel{padding:6px 10px 2px;font-size:var(--fs-s);color:var(--muted)}.dlg-scrim{position:fixed;inset:0;z-index:70;background:#00000052;display:flex;align-items:center;justify-content:center;padding:24px}.dlg{width:440px;max-width:100%;max-height:80vh;display:flex;flex-direction:column;background:var(--bg);border-radius:var(--r-l);box-shadow:var(--shadow-pop)}.dlg-title{flex:none;padding:14px 16px 4px;font-size:var(--fs-l);font-weight:600}.dlg-body{flex:1;min-height:0;overflow-y:auto;padding:8px 16px}.dlg-foot{flex:none;display:flex;justify-content:flex-end;gap:8px;padding:10px 16px 14px}.dlg-row{margin:10px 0}.dlg-row-top{align-items:flex-start}.dlg-row>label{display:block;margin-bottom:4px;font-size:var(--fs-s);color:var(--muted)}.provider-list{display:flex;flex-direction:column;gap:6px;width:100%;max-height:280px;overflow:auto}.provider-list{display:flex;flex-direction:column;gap:6px;flex:1;min-width:0}.provider-redetect{align-self:flex-start;margin-bottom:4px}.provider-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px;padding:6px 8px;border-radius:var(--r-m);background:var(--bg-2)}.provider-row.open{padding-bottom:10px}.provider-head{display:flex;align-items:center;gap:10px;flex:1;min-width:0;border:0;background:none;text-align:left;cursor:pointer;color:inherit;padding:0}.provider-detail{flex:1 1 100%;display:flex;flex-direction:column;gap:6px;padding:4px 0 0 28px}.provider-hint-row{display:flex;gap:8px;align-items:flex-start;flex-wrap:wrap}.btn.sm{font-size:var(--fs-s);padding:4px 10px;height:auto}.provider-meta{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.provider-name{font-size:var(--fs-m);font-weight:500}.provider-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.provider-dot-on{background:var(--ok, #3ecf8e)}.provider-dot-off{background:var(--muted);opacity:.5}.provider-dot-pending{background:var(--warn, #e6a817)}.provider-switch input{width:16px;height:16px;cursor:pointer}.dlg-hint{font-size:var(--fs-s);color:var(--muted)}.dlg-hint.err{color:var(--danger)}.bash-set{display:flex;flex-direction:column;gap:4px;min-width:0}.bash-row{display:flex;gap:8px;align-items:center}.bash-row .tinput{flex:1;min-width:0;font-family:var(--font-mono)}.toasts{position:fixed;left:50%;bottom:24px;transform:translate(-50%);z-index:80;display:flex;flex-direction:column;gap:8px;align-items:center}.toast{max-width:480px;padding:8px 14px;border-radius:var(--r-m);background:var(--fg);color:var(--bg);font-size:var(--fs-m);box-shadow:var(--shadow-pop);animation:toast-in var(--dur-2) var(--ease)}.toast.err{background:var(--danger);color:#fff}@keyframes toast-in{0%{opacity:0;transform:translateY(8px)}}.dot{width:6px;height:6px;border-radius:50%;flex:none;background:var(--muted)}.dot.ok{background:var(--ok)}.dot.run{background:var(--fg);animation:dot-blink 1s steps(1,end) infinite;box-shadow:0 0 0 1px color-mix(in oklab,var(--fg) 45%,transparent)}@keyframes dot-blink{50%{background:var(--bg)}}.dot.err{background:var(--danger)}.dot.wait{background:var(--warn);animation:breathe 1.6s infinite}@keyframes breathe{50%{opacity:.35}}.boot-screen{height:100%;display:flex;align-items:center;justify-content:center;gap:8px;color:var(--muted);font-size:var(--fs-m)}.boot-screen .btn{margin-top:12px}.boot-wrap{display:flex;flex-direction:column;align-items:center}.boot-dot{width:8px;height:8px;border-radius:50%;background:var(--muted)}.boot-dot[data-state=open]{background:var(--ok)}.boot-dot[data-state=reconnecting]{background:var(--warn)}.boot-dot[data-state=down]{background:var(--danger)}.vh{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}.menu.select-menu{z-index:80;overflow-y:auto;outline:none;max-width:320px}.sm-opt{cursor:pointer;user-select:none;height:auto;min-height:28px;padding:4px 8px 4px 10px}.sm-opt.on{background:var(--surface-hover)}.sm-opt.off{color:var(--muted);cursor:default}.sm-opt.off:hover{background:none}.sm-text{display:flex;flex-direction:column;min-width:0;flex:1 1 auto}.sm-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sm-label>svg{vertical-align:-2px;margin-right:5px}.sm-hint{font-size:var(--fs-s);color:var(--muted);white-space:normal;line-height:1.4}.sm-check{flex:none;width:14px;display:inline-flex;color:var(--accent)}.sm-opt[aria-selected=true] .sm-label{font-weight:500}.tinput.sm-field{display:flex;align-items:center;text-align:left;padding-right:26px;cursor:pointer;position:relative;color:var(--fg);background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);background-position:calc(100% - 14px) 50%,calc(100% - 10px) 50%;background-size:4px 4px;background-repeat:no-repeat}.tinput.sm-field[aria-expanded=true]{border-color:color-mix(in oklab,var(--accent) 55%,var(--bg))}.sm-field .sm-val{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.app{display:flex;height:100vh;min-width:480px;overflow:hidden}.sidebar{width:var(--sb-w, 248px);flex:none;display:flex;flex-direction:column;background:var(--sb-bg);border-right:1px solid var(--line)}.sb-row{display:flex;align-items:center;gap:2px;height:40px;padding:8px 8px 4px;flex:none}.sb-row-search{height:36px;padding:0 8px 4px}.sb-new{flex:1;display:flex;align-items:center;gap:8px;height:28px;min-width:0;padding:0 8px 0 5px;border-radius:var(--r-s);font-size:var(--fs-m);font-weight:500;text-align:left;transition:background var(--dur-1);white-space:nowrap;overflow:hidden}.sb-new-tile{width:18px;height:18px;flex:none;border-radius:5px;background:var(--tile-bg);color:var(--tile-fg);display:inline-flex;align-items:center;justify-content:center}.sb-new-tile svg{stroke-width:2.2}.sb-new:hover{background:var(--surface-hover)}.sb-row .ibtn{width:28px;height:28px}.sb-search{flex:1;display:flex;align-items:center;gap:6px;height:28px;padding:0 8px;border-radius:var(--r-s);background:var(--search-bg);color:var(--meta)}.sb-search input::placeholder{color:var(--meta)}.sb-search input{flex:1;min-width:0;border:0;background:none;font-size:var(--fs-s);outline:none;color:var(--fg)}.sb-list{flex:1;overflow-y:auto;padding:0 8px 8px}.pj-group{margin-top:2px}.pj{display:flex;align-items:center;gap:2px;height:var(--row);padding:0 4px 0 0;border-radius:var(--r-s)}.pj:hover{background:var(--surface-hover)}.pj-toggle{flex:1;min-width:0;height:100%;display:flex;align-items:center;gap:6px;padding-left:2px;text-align:left;font-size:var(--fs-m);font-weight:500}.pj-caret{width:14px;flex:none;display:inline-flex;justify-content:center;color:var(--muted);transition:transform var(--dur-1)}.pj-caret.open{transform:rotate(90deg)}.pj-badge{width:18px;height:18px;flex:none;border-radius:5px;display:inline-flex;align-items:center;justify-content:center;background:var(--badge-bg);color:var(--badge-fg);font-size:var(--fs-xs);font-weight:600;line-height:1;text-transform:uppercase}.pj-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pj-count{flex:none;padding:0 6px;font-size:var(--fs-s);color:var(--meta)}.pj-act{width:22px;height:22px;flex:none;display:none;align-items:center;justify-content:center;border-radius:var(--r-s);color:var(--muted)}.pj:hover .pj-act,.pj-act:focus-visible{display:inline-flex}.pj:hover .pj-count{display:none}.pj-act:hover{background:var(--bg);color:var(--fg)}.pj-sessions{padding:1px 0 4px 22px;display:flex;flex-direction:column;gap:1px}.pj-more,.pj-empty{display:flex;align-items:center;width:100%;height:26px;padding:0 8px 0 21px;font-size:var(--fs-s);color:var(--muted);text-align:left;border-radius:var(--r-s)}.pj-more:hover{background:var(--surface-hover);color:var(--fg)}.t-item{display:flex;align-items:center;gap:8px;width:100%;height:var(--row);padding:0 4px 0 8px;border-radius:var(--r-s);position:relative;text-align:left;font-size:var(--fs-m);transition:background var(--dur-1)}.t-item:hover{background:var(--surface-hover)}.t-item.on{background:var(--active-bg);box-shadow:0 0 0 1px var(--active-line),0 1px 2px #0000000a;font-weight:500}.t-item.on:before{content:"";position:absolute;left:-1px;top:7px;bottom:7px;width:2px;border-radius:2px;background:var(--accent-2)}.t-item.archived{opacity:.55}.t-item.archived .t-title{font-style:italic}.t-item .dot{width:6px;height:6px}.t-pin{width:12px;flex:none;display:inline-flex;color:var(--muted)}.t-pin svg{width:10px;height:10px}.t-title{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.t-time{flex:none;font-size:var(--fs-xs);color:var(--meta);font-weight:400}.t-item:hover .t-time{display:none}.t-more{flex:none;width:22px;height:22px;display:none;align-items:center;justify-content:center;border-radius:var(--r-s);color:var(--muted)}.t-item:hover .t-more{display:inline-flex}.t-more:hover{background:var(--bg);color:var(--fg)}.t-rename{flex:1;min-width:0;height:24px;font-size:var(--fs-m);border:1px solid var(--accent);border-radius:var(--r-s);padding:0 6px;background:var(--bg)}.sb-empty{padding:20px 12px;text-align:center;color:var(--muted);font-size:var(--fs-s)}.sb-start{padding:28px 12px;text-align:center}.sb-start-t{font-size:var(--fs-m);font-weight:500}.sb-start-s{margin:4px 0 12px;font-size:var(--fs-s);color:var(--muted)}.rs{width:5px;flex:none;cursor:col-resize;position:relative}.rs:after{content:"";position:absolute;inset:0}.rs:hover:after,.rs.drag:after{background:color-mix(in oklab,var(--accent) 30%,transparent)}.rs-l{margin-left:-3px}.rs-r{margin-right:-3px}body.col-drag{cursor:col-resize;user-select:none}body.col-drag iframe,body.col-drag .xterm{pointer-events:none}.scrim{position:fixed;inset:0;z-index:45;background:#00000052;display:none}.scrim.show{display:block}.main{flex:1;min-width:0;display:flex;flex-direction:column;background:var(--bg);position:relative}.topbar{height:40px;flex:none;display:flex;align-items:center;gap:6px;padding:0 10px;border-bottom:1px solid var(--line)}.tb-menu-btn{display:none}.tb-menu-btn.tb-sb-collapsed{display:inline-flex;margin-right:2px}.tb-crumb{flex:none;max-width:26%;font-size:var(--fs-m);color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tb-sep{flex:none;color:var(--muted)}.tb-title{font-size:var(--fs-l);font-weight:500;max-width:40%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;border-radius:var(--r-s);padding:2px 6px;cursor:text}.tb-title:hover{background:var(--surface)}.tb-title.ghost{color:var(--muted);cursor:default}.tb-title.ghost:hover{background:none}.tb-rename{font-size:var(--fs-l);font-weight:500;border:1px solid var(--accent);border-radius:var(--r-s);padding:1px 6px;background:var(--bg);width:300px;max-width:46vw}.tb-pill{flex:none;display:inline-flex;align-items:center;gap:6px;height:22px;padding:0 9px;border-radius:var(--r-full);font-size:var(--fs-s);background:var(--surface);color:var(--muted)}.tb-pill.run{background:var(--run-bg);color:var(--run-fg)}.tb-pill-dot{width:7px;height:7px;border-radius:50%;background:var(--accent-2);box-shadow:0 0 0 3px color-mix(in oklab,var(--accent-2) 20%,transparent);animation:breathe 1.6s infinite}.tb-pill.wait{color:var(--warn)}button.tb-pill{border:0;font-family:inherit;cursor:pointer}.tb-pill.err{color:var(--danger)}.tb-right{margin-left:auto;display:flex;align-items:center;gap:2px}.tb-model{font-size:var(--fs-s);color:var(--muted);margin-right:4px;white-space:nowrap;max-width:160px;overflow:hidden;text-overflow:ellipsis}.connbar{flex:none;height:26px;display:flex;align-items:center;justify-content:center;font-size:var(--fs-s);background:color-mix(in oklab,var(--warn) 14%,var(--bg));color:var(--warn)}.scroll{flex:1;overflow-y:auto;overscroll-behavior:contain;position:relative}.tl-wrap{max-width:calc(var(--col) + 40px);min-width:0;margin:0 auto;padding:24px 20px 16px}.jump{position:absolute;right:24px;bottom:150px;width:34px;height:34px;border-radius:50%;background:var(--bg);box-shadow:var(--shadow-pop);display:flex;align-items:center;justify-content:center;color:var(--muted);z-index:5}.jump:hover{color:var(--fg)}.jump svg{transform:rotate(90deg)}.jump .jd{position:absolute;top:4px;right:4px;width:7px;height:7px;border-radius:50%;background:var(--accent)}.panel{width:var(--pn-w, 440px);flex:none;display:flex;flex-direction:column;background:var(--bg);border-left:1px solid var(--line)}.pn-head{flex:none;display:flex;align-items:center;gap:2px;height:40px;padding:0 6px;border-bottom:1px solid var(--line)}.pn-tabs{display:flex;gap:2px}.pn-tab{height:28px;padding:0 10px;border-radius:var(--r-s);font-size:var(--fs-m);color:var(--muted);display:inline-flex;align-items:center;gap:6px}.pn-tab:hover{background:var(--surface-hover);color:var(--fg)}.pn-tab.on{background:var(--surface-hover);color:var(--fg);font-weight:500}.pn-body{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.pn-close{margin-left:auto}.pn-empty{padding:20px;color:var(--muted);font-size:var(--fs-m);text-align:center}.pn-empty-sub{margin-top:6px;font-size:var(--fs-s);opacity:.8}.chg-head{flex:none;display:flex;align-items:center;gap:6px;height:34px;padding:0 8px;border-bottom:1px solid var(--line);font-size:var(--fs-m)}.chg-branch{display:inline-flex;align-items:center;gap:5px;color:var(--muted);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chg-head .ibtn{margin-left:auto}.chg-list{flex:none;max-height:40%;overflow-y:auto;border-bottom:1px solid var(--line)}.chg-list:empty{border-bottom:none}.chg-row{display:flex;align-items:center;gap:7px;padding:4px 8px;cursor:pointer;font-size:var(--fs-m);min-height:28px}.chg-row:hover,.chg-row.on{background:var(--surface-hover)}.chg-kind{flex:none;width:18px;height:18px;border-radius:var(--r-s);font-size:10px;display:inline-flex;align-items:center;justify-content:center;background:var(--surface);color:var(--muted)}.chg-kind.k-modified{color:var(--warn, #b45309)}.chg-kind.k-added,.chg-kind.k-untracked{color:var(--ok, #15803d)}.chg-kind.k-deleted{color:var(--danger)}.chg-kind.k-renamed{color:var(--accent)}.chg-path{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;direction:rtl;text-align:left}.chg-stat{flex:none;font-style:normal;font-size:var(--fs-s);font-variant-numeric:tabular-nums}.chg-stat .add{color:var(--ok, #15803d);font-style:normal}.chg-stat .del{color:var(--danger);font-style:normal}.chg-discard{flex:none;opacity:0}.chg-row:hover .chg-discard{opacity:1}.chg-diff{flex:1;min-height:0;overflow:auto}.ft-crumbs{flex:none;display:flex;align-items:center;gap:4px;min-height:34px;padding:0 8px;border-bottom:1px solid var(--line);font-size:var(--fs-m);overflow-x:auto;white-space:nowrap}.ft-crumb{color:var(--muted);font-size:var(--fs-m);padding:2px 4px;border-radius:var(--r-s)}.ft-crumb:hover{background:var(--surface-hover);color:var(--fg)}.ft-crumb-t{color:var(--fg)}.ft-crumb-t.muted{color:var(--muted)}.ft-tree{flex:none;max-height:45%;overflow-y:auto;padding:4px 0}.ft-row{display:flex;align-items:center;gap:5px;padding:3px 8px;cursor:pointer;font-size:var(--fs-m);min-height:24px}.ft-row:hover,.ft-row.on{background:var(--surface-hover)}.ft-row .caret{font-size:var(--fs-xs);color:var(--muted);display:inline-block;transition:transform var(--dur-1) var(--ease)}.ft-row .caret.open{transform:rotate(90deg)}.ft-dot{width:13px;flex:none}.ft-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ft-err{color:var(--danger);font-size:var(--fs-s);padding:2px 0}.ft-view{flex:1;min-height:0;overflow:auto;border-top:1px solid var(--line)}.ft-pre{margin:0;padding:10px 12px;font-family:var(--font-mono);font-size:var(--chat-code-fs);line-height:1.55}.ft-pre code{background:none;padding:0;display:block;white-space:pre}.tm-tabs{flex:none;display:flex;align-items:center;gap:2px;padding:4px 6px;border-bottom:1px solid var(--line);overflow-x:auto}.tm-tab{display:inline-flex;align-items:center;gap:6px;height:26px;padding:0 6px 0 10px;border-radius:var(--r-s);font-size:var(--fs-m);color:var(--muted);white-space:nowrap}.tm-tab:hover,.tm-tab.on{background:var(--surface-hover);color:var(--fg)}.tm-x{color:var(--muted);padding:0 3px;border-radius:3px}.tm-x:hover{color:var(--danger);background:var(--surface-hover)}.tm-note{flex:none;padding:4px 10px;font-size:var(--fs-s);color:var(--warn);background:color-mix(in oklab,var(--warn) 10%,var(--bg));border-bottom:1px solid var(--line)}.tm-body{flex:1;min-height:0;position:relative;background:var(--term-bg)}.tm-view{position:absolute;inset:0;padding:6px 8px;background:var(--term-bg)}.tm-view .xterm{height:100%}.tm-view .xterm-viewport{background:var(--term-bg)!important}.tm-view .xterm-screen{padding:2px 0}.imp-list{max-height:320px;overflow-y:auto;display:flex;flex-direction:column;gap:2px}.imp-row{display:flex;align-items:center;gap:8px;padding:5px 6px;border-radius:var(--r-s);font-size:var(--fs-m);cursor:pointer}.imp-row:hover{background:var(--surface-hover)}.imp-row.done{opacity:.55;cursor:default}.imp-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.imp-meta{flex:none;color:var(--muted);font-size:var(--fs-s)}.info-grid{display:flex;flex-direction:column;gap:2px}.info-row{display:flex;align-items:center;gap:10px;padding:3px 2px;font-size:var(--fs-m)}.info-k{flex:none;width:74px;color:var(--muted)}.info-v{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--font-mono);font-size:var(--fs-s)}@media(min-width:760px){.sidebar{transition:margin-left var(--dur-2) var(--ease),visibility 0s linear 0s}.sidebar.w-hide{margin-left:calc(-1 * var(--sb-w, 248px));visibility:hidden;transition:margin-left var(--dur-2) var(--ease),visibility 0s linear var(--dur-2)}.sidebar.w-hide+.rs-l{display:none}}@media(prefers-reduced-motion:reduce){.sidebar,.sidebar.w-hide{transition:none}}.sb-row .sb-toggle{flex:none;color:var(--muted)}.sb-toggle:hover{color:var(--fg)}@media(min-width:900px){.panel.w-hide{display:none}}@media(max-width:899px){.panel{position:fixed;right:0;top:0;bottom:0;z-index:46;width:min(var(--pn-w, 440px),92vw);transform:translate(100%);transition:transform var(--dur-2) var(--ease);box-shadow:var(--shadow-pop)}.panel.open{transform:none}.rs-r{display:none}}@media(max-width:759px){.sidebar{position:fixed;left:0;top:0;bottom:0;z-index:46;width:min(var(--sb-w, 248px),84vw);transform:translate(-100%);transition:transform var(--dur-2) var(--ease);box-shadow:var(--shadow-pop)}.sidebar.open{transform:none}.sidebar~.rs-l{display:none}.tb-menu-btn{display:inline-flex}.tl-wrap{padding:16px 14px 8px}.tb-model{display:none}}.dlg.cpal{width:520px;padding:6px}.cpal-in{width:100%;height:36px;padding:0 12px;border:0;background:none;outline:none;font-size:var(--fs-l);color:var(--fg)}.cpal-list{max-height:46vh;overflow-y:auto;padding:4px}.cpal-item{display:flex;align-items:center;gap:8px;width:100%;height:30px;padding:0 10px;border-radius:var(--r-s);text-align:left;font-size:var(--fs-m)}.cpal-item.on{background:var(--surface-hover)}.cpal-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cpal-hint{flex:none;font-size:var(--fs-s);color:var(--muted)}.pv{flex:1;min-height:0;display:flex;flex-direction:column}.pv-bar{flex:none;display:flex;align-items:center;gap:2px;height:38px;padding:0 6px;border-bottom:1px solid var(--line)}.pv-bar .ibtn{width:26px;height:26px;flex:none;color:var(--muted)}.pv-bar .ibtn:hover:not(:disabled){color:var(--fg)}.pv-bar .ibtn:disabled{opacity:.35;cursor:default}.pv-addr{flex:1;min-width:0;height:26px;padding:0 8px;margin:0 2px;border-radius:var(--r-s);background:var(--search-bg);border:1px solid transparent;color:var(--fg);font-family:var(--font-mono);font-size:var(--fs-s);outline:none}.pv-addr:focus{border-color:var(--cp-focus);background:var(--bg)}.pv-addr.err{border-color:color-mix(in oklab,var(--danger) 60%,var(--bg))}.pv-note{flex:none;display:flex;align-items:center;gap:8px;padding:6px 10px;font-size:var(--fs-s);color:var(--muted);border-bottom:1px solid var(--line)}.pv-note.err{color:var(--danger)}.pv-note .btn{height:24px;font-size:var(--fs-s)}.pv-frame-wrap{flex:1;min-height:0;position:relative;background:var(--bg)}.pv-frame{position:absolute;inset:0;width:100%;height:100%;border:0;background:#fff}.pv-loading{position:absolute;top:0;left:0;right:0;height:2px;background:var(--accent-2);opacity:.5;animation:breathe 1s infinite}.pv-empty{padding:28px 22px;color:var(--muted);font-size:var(--fs-m);text-align:center;line-height:1.7}.pv-empty code{font-family:var(--font-mono);font-size:var(--fs-s);background:var(--code-bg);border:1px solid var(--code-line);border-radius:4px;padding:0 4px;color:var(--code-fg)}.pv-hint{margin-top:10px;font-size:var(--fs-s);color:var(--meta)}.ft-row[draggable=true]{cursor:default}.ft-row.dragging{opacity:.5}.um-row{display:flex;flex-direction:column;align-items:flex-end;margin:4px 0 8px}.um{position:relative;max-width:78%;background:var(--accent-soft);border-radius:14px 14px 4px;color:var(--fg);padding:6px 12px;font-size:var(--chat-fs);line-height:1.6;white-space:pre-wrap;word-break:normal;overflow-wrap:break-word}.um-act{display:flex;gap:2px;margin-top:2px;height:24px;opacity:0;transition:opacity var(--dur-1)}.um-row:hover .um-act,.um-act:focus-within{opacity:1}@media(hover:none){.um-act{opacity:1}}.um-act .ibtn{width:24px;height:24px;color:var(--meta)}.um-act .ibtn:hover,.um-act .ibtn:focus-visible{color:var(--fg)}.um-act .ibtn.done,.te-act.done{color:var(--fg)}.um-img{display:block;max-width:200px;max-height:140px;border-radius:var(--r-s);margin-bottom:6px;cursor:zoom-in}.um-tag{font-size:var(--chat-fs-s);color:var(--muted);margin-top:2px}.um-row.fresh .um{animation:um-in .14s var(--ease, ease-out) both}@keyframes um-in{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.um-row.fresh .um{animation:none}}.um-row.failed .um{box-shadow:inset 0 0 0 1px var(--danger)}.um-fail{display:flex;align-items:center;gap:8px;margin-top:4px;font-size:var(--chat-fs-s);color:var(--danger)}.um-fail-t{display:inline-flex;align-items:center;gap:4px}.um-fail-b{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:6px;border:1px solid var(--line);background:transparent;color:var(--fg);font:inherit;cursor:pointer}.um-fail-b:hover,.um-fail-b:focus-visible{background:var(--surface-hover)}.as{margin:4px 0}.md.streaming:after{content:"\258d";color:var(--accent);animation:breathe 1s infinite}.md{font-size:var(--chat-fs);line-height:var(--chat-lh);color:var(--text);word-break:normal;overflow-wrap:break-word}.md p{margin:0 0 .6em}.md>:last-child{margin-bottom:0}.md a{color:var(--accent);text-decoration:underline;text-underline-offset:2px;text-decoration-color:color-mix(in oklab,var(--accent) 40%,transparent)}.md a:hover{text-decoration:underline}.md pre{position:relative;background:var(--code-bg);border:1px solid var(--code-line);border-radius:var(--r-m);padding:10px 12px;overflow-x:auto;font-family:var(--font-mono);font-size:var(--chat-code-fs);line-height:1.55}.md code{font-family:var(--font-mono);font-size:var(--chat-code-fs);background:var(--code-bg);color:var(--code-fg);padding:1px 5px;border-radius:4px;border:1px solid var(--code-line)}.md pre code{background:none;padding:0;border:0;color:inherit;font-size:inherit}.md ul,.md ol{margin:.45em 0;padding-left:1.7em}.md li+li{margin-top:.15em}.md h1,.md h2,.md h3,.md h4{margin:.95em 0 .4em;font-weight:600;line-height:1.4}.md h1{font-size:calc(var(--chat-fs) + 4px)}.md h2{font-size:calc(var(--chat-fs) + 2px)}.md h3{font-size:calc(var(--chat-fs) + 1px)}.md h4{font-size:var(--chat-fs)}.md>h1:first-child,.md>h2:first-child,.md>h3:first-child,.md>h4:first-child{margin-top:.2em}.md blockquote{margin:6px 0;padding-left:12px;border-left:3px solid var(--line);color:var(--muted)}.md table{border-collapse:collapse;margin:8px 0}.md th,.md td{border:1px solid var(--line);padding:4px 10px;font-size:var(--chat-fs-s)}.md .cb{margin:.5em 0 .7em;border:1px solid var(--code-line);border-radius:var(--r-m);background:var(--code-bg);overflow:hidden}.md .cb pre{margin:0;border:0;border-radius:0;background:none;padding:2px 12px 10px}.cb-head{display:flex;align-items:center;gap:8px;height:28px;padding:0 6px 0 12px;font-size:var(--fs-xs);color:var(--meta);user-select:none;-webkit-user-select:none}.cb-lang{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--font-mono)}.cb-acts{flex:none;display:inline-flex;gap:2px}.cb-btn{width:24px;height:22px;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--r-s);color:var(--meta)}.cb-btn:hover,.cb-btn:focus-visible{background:var(--surface-hover);color:var(--fg)}.cb-btn[aria-pressed=true],.cb-btn.done{color:var(--fg)}.md .cb pre code{display:block;min-width:max-content}.md .cb.wrap pre code{min-width:0;white-space:pre-wrap;overflow-wrap:anywhere}.md .cb.numbered pre code{counter-reset:cb-line}.cb-l{display:block;min-height:1.55em}.cb.numbered .cb-l{position:relative;padding-left:3em}.cb.numbered .cb-l:before{counter-increment:cb-line;content:counter(cb-line);position:absolute;left:0;width:2em;text-align:right;color:var(--meta);opacity:.8;user-select:none;-webkit-user-select:none;font-variant-numeric:tabular-nums}.md .hljs-keyword,.md .hljs-built_in,.md .hljs-selector-tag,.md .hljs-type{color:var(--fg);font-weight:600}.md .hljs-string,.md .hljs-regexp,.md .hljs-attr,.md .hljs-symbol{color:color-mix(in oklab,var(--fg) 62%,var(--bg))}.md .hljs-comment,.md .hljs-quote{color:var(--meta);font-style:italic}.md .hljs-number,.md .hljs-literal{color:color-mix(in oklab,var(--fg) 75%,var(--bg))}.md .hljs-title,.md .hljs-title.function_,.md .hljs-section{color:var(--fg)}.md .hljs-meta,.md .hljs-variable.language_{color:var(--muted)}.rs-item{margin:4px 0 6px}.rs-head{display:inline-flex;align-items:center;gap:4px;min-height:22px;max-width:100%;padding:0;color:var(--meta);font-size:var(--chat-fs-s);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rs-head:hover{color:var(--fg)}.rs-head .caret{display:inline-block;transition:transform var(--dur-1)}.rs-head .caret.open{transform:rotate(90deg)}.rs-body{margin:2px 0 6px 5px;padding-left:12px;border-left:1px solid var(--line);color:var(--muted);font-size:var(--chat-fs-s);line-height:1.65;white-space:pre-wrap}.ck{margin:4px 0 8px;font-size:var(--chat-fs-s);border-radius:var(--r-m);transition:background var(--dur-2)}.ck.flash{animation:ck-flash 1.2s var(--ease)}@keyframes ck-flash{0%,40%{background:var(--surface-hover)}to{background:transparent}}.ck-head{display:flex;align-items:center;gap:6px;min-height:24px;padding:0 6px;color:var(--muted);white-space:nowrap;overflow:hidden}.ck-head svg{flex:none;color:var(--meta)}.ck-n{font-variant-numeric:tabular-nums;color:var(--fg);font-weight:500}.ck-list{list-style:none;margin:0;padding:0}.ck-i{display:flex;align-items:flex-start;gap:8px;padding:2px 6px;line-height:1.55;color:var(--muted)}.ck-box{flex:none;width:14px;height:calc(var(--chat-fs-s) * 1.55);display:inline-flex;align-items:center;justify-content:center;color:var(--meta)}.ck-i.done .ck-box{color:var(--muted)}.ck-i.done .ck-t{color:var(--meta)}.ck-i.doing .ck-t{color:var(--fg)}.ck-t{min-width:0;overflow-wrap:anywhere}.tg{margin:2px 0 8px;min-width:0}.tg-head{display:flex;align-items:center;gap:8px;width:100%;min-height:26px;padding:0 6px;overflow:hidden;border-radius:var(--r-s);color:var(--muted);font-size:var(--chat-fs-s);text-align:left;white-space:nowrap}.tg-head:hover{color:var(--fg);background:var(--surface-hover)}.tg-ic{width:14px;flex:none;display:inline-flex;justify-content:center;color:var(--meta)}.tg-head .caret{flex:none;color:var(--meta);transition:transform var(--dur-1)}.tg-head .caret.open{transform:rotate(90deg)}.tg-sum{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tg-fail{flex:none;color:var(--danger)}.tg-fail:before{content:"\b7";margin-right:6px;color:var(--meta)}.tg-run{display:flex;align-items:center;gap:8px;min-height:22px;padding-left:6px;color:var(--muted);font-size:var(--chat-fs-s);min-width:0;overflow:hidden;white-space:nowrap}.tg-run-text{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ts-noerr{color:var(--meta);font-size:var(--chat-fs-s);margin-bottom:4px}.tg-list{margin:0;padding:0}.tg.open>.tg-list{margin:2px 0 0 13px;padding-left:6px;border-left:1px solid var(--line)}.ts-head{display:flex;align-items:center;gap:8px;width:100%;min-height:26px;padding:0 6px;overflow:hidden;border-radius:var(--r-s);font-size:var(--chat-fs-s);text-align:left;color:var(--muted);white-space:nowrap}.ts-head:hover,.ts.open>.ts-head{background:var(--surface-hover);color:var(--fg)}.ts-ic{width:14px;flex:none;display:inline-flex;justify-content:center;color:var(--meta)}.ts-head:hover .ts-ic{color:var(--muted)}.ts-title{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ts-title.mono{font-family:var(--font-mono);font-size:var(--chat-code-fs)}.ts-think .ts-head{color:var(--meta)}.ts-think .rs-body{margin-left:28px}.ts-diff{flex:none;display:inline-flex;gap:5px;font-family:var(--font-mono);font-size:var(--chat-code-fs);font-variant-numeric:tabular-nums;color:var(--meta)}.ts-diff .add{color:var(--muted)}.ts-meta{flex:none;color:var(--meta);font-variant-numeric:tabular-nums}.ts-meta.err{color:var(--danger)}.ts-st{flex:none;width:14px;display:inline-flex;align-items:center;justify-content:center;margin-left:auto;color:var(--meta)}.ts-st.ok{color:var(--muted)}.ts-st.fail{color:var(--danger)}.ts.failed>.ts-head .ts-title{color:var(--fg)}.spin{display:inline-block;width:10px;height:10px;flex:none;border-radius:50%;border:1.5px solid color-mix(in oklab,var(--fg) 18%,transparent);border-top-color:var(--accent-2);animation:ac-spin .8s linear infinite}@keyframes ac-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spin{animation-duration:2.4s}}.ts-out{margin:2px 6px 6px 28px}.ts-out pre{background:var(--code-bg);border-radius:var(--r-s);padding:8px 10px;font-family:var(--font-mono);font-size:var(--chat-code-fs);line-height:1.5;overflow-x:auto;white-space:pre-wrap;word-break:break-all;margin:0}.ts-more{font-size:var(--chat-fs-s);color:var(--accent);margin-bottom:4px}.diff{margin:2px 6px 6px 28px;border:1px solid var(--line);border-radius:var(--r-m);overflow:hidden}.diff-path{padding:4px 10px;font-size:var(--chat-code-fs);color:var(--muted);background:var(--surface);border-bottom:1px solid var(--line);font-family:var(--font-mono)}.diff-pre{margin:0;padding:6px 0;font-family:var(--font-mono);font-size:var(--chat-code-fs);line-height:1.5;overflow-x:auto}.dh-head{display:block;color:var(--muted);padding:0 10px}.dl{display:block;padding:0 10px;white-space:pre-wrap;word-break:break-all}.dl.add{background:var(--add-bg)}.dl.del{background:var(--del-bg)}.card{margin:8px 0;border-radius:10px;padding:12px 14px}.card.plan{border:1px solid var(--line)}.card.perm{border:1px solid color-mix(in oklab,var(--warn) 30%,var(--bg));background:color-mix(in oklab,var(--warn) 3%,var(--bg))}.card.perm.done{border-color:var(--line);opacity:.75}.card.ask{border:1px solid color-mix(in oklab,var(--info) 45%,var(--bg))}.card.ask.done{border-color:var(--line);opacity:.75}.err-card{border:1px solid color-mix(in oklab,var(--danger) 45%,var(--bg))}.err-line{color:var(--danger);font-size:var(--chat-fs)}.perm-title{font-size:var(--chat-fs);font-weight:500}.perm-cmd{margin:8px 0 0;background:var(--code-bg);border-radius:var(--r-s);padding:8px 10px;font-family:var(--font-mono);font-size:var(--chat-code-fs);white-space:pre-wrap;word-break:break-all}.perm-path{margin-top:6px;font-family:var(--font-mono);font-size:var(--chat-code-fs);color:var(--muted)}.perm-btns{display:flex;gap:8px;margin-top:10px}.perm-done{margin-top:8px;font-size:var(--chat-fs-s);color:var(--muted)}.ask-q{margin-bottom:10px}.ask-t{font-size:var(--chat-fs);font-weight:500;margin-bottom:6px}.ask-opts{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:6px}.ask-free,.ask .btn.primary{margin-top:4px}.nt{margin:8px 0;text-align:center;font-size:var(--chat-fs-s);color:var(--muted)}.nt.warn{color:var(--warn)}.nt.error{color:var(--danger)}.nt-bash{text-align:left;padding:10px 12px;border:1px solid var(--line);border-radius:var(--r-m);line-height:1.6}.nt-actions{display:flex;gap:8px;margin-top:8px;flex-wrap:wrap}.te{display:flex;flex-wrap:wrap;justify-content:flex-start;align-items:center;gap:2px 4px;margin:6px 0 18px -6px;font-size:var(--chat-fs-s);color:var(--meta);min-width:0}.te-m{display:inline-flex;align-items:center;gap:4px;padding:0 4px;height:24px;font-variant-numeric:tabular-nums;white-space:nowrap;min-width:0;max-width:100%}.te-m>span{overflow:hidden;text-overflow:ellipsis}.te-m svg{flex:none}.te-act{height:24px;min-width:24px;display:inline-flex;align-items:center;justify-content:center;gap:4px;padding:0 6px;border-radius:var(--r-s);color:var(--meta);white-space:nowrap}.te-act:hover{background:var(--surface-hover);color:var(--fg)}.te-files{color:var(--accent);font-size:inherit;margin-left:6px}.te-files:hover{text-decoration:underline}.empty-wrap{min-height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding-bottom:14vh}.cp-hero-t{font-size:var(--fs-hero);font-weight:600}.cp-hero-s{margin-top:6px;font-size:var(--fs-s);color:var(--muted)}.empty-actions{margin-top:16px}.workspace-empty{padding-bottom:10vh}.q-list{max-width:var(--col);margin:0 auto 6px;display:flex;flex-direction:column;gap:4px}.q-item{display:flex;align-items:center;gap:8px;padding:4px 10px;background:var(--surface);border-radius:var(--r-s);font-size:var(--fs-s)}.q-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.q-item .ibtn{width:20px;height:20px}a.ac-local{cursor:pointer}.ts-out pre a.ac-local,.md pre a.ac-local{color:inherit;text-decoration:underline;text-decoration-color:color-mix(in oklab,currentColor 45%,transparent);text-underline-offset:2px}.md code a.ac-local{color:inherit}.mention{display:inline-flex;align-items:center;gap:4px;max-width:260px;height:22px;padding:0 6px;border-radius:var(--r-s);background:var(--chip-bg);border:1px solid var(--chip-line);color:var(--pill-fg);font-size:var(--fs-s);font-family:var(--font-mono);white-space:nowrap;vertical-align:middle}.mention svg{flex:none}.mention-name{min-width:0;overflow:hidden;text-overflow:ellipsis}.um-mentions{display:flex;flex-wrap:wrap;gap:4px;margin:2px 0 4px;white-space:normal}.um .mention{background:color-mix(in oklab,var(--fg) 5%,var(--accent-soft))}.qs-pop{position:fixed;z-index:60;display:inline-flex;align-items:center;gap:5px;height:30px;padding:0 10px;border-radius:8px;border:1px solid var(--line);background:var(--bg);color:var(--fg);font-size:var(--fs-s);box-shadow:0 4px 14px #0000001f,0 1px 2px #00000014;white-space:nowrap;cursor:pointer;user-select:none;-webkit-user-select:none}.qs-pop:hover{background:var(--surface-hover)}.qs-pop svg{flex:none;color:var(--muted)}.um-quote{display:block;margin:2px 0 6px;padding-left:8px;border-left:2px solid color-mix(in oklab,var(--fg) 30%,transparent);color:var(--muted);font-size:var(--chat-fs-s);max-height:7.5em;overflow:hidden}.apv{margin:0 0 8px;min-width:0}.apv-head{display:flex;align-items:center;gap:8px;width:100%;min-height:26px;padding:0 6px;overflow:hidden;border-radius:var(--r-s);color:var(--muted);font-size:var(--chat-fs-s);text-align:left;white-space:nowrap}.apv-head:hover,.apv.open>.apv-head{color:var(--fg);background:var(--surface-hover)}.apv-head .caret{flex:none;color:var(--meta);transition:transform var(--dur-1)}.apv-head .caret.open{transform:rotate(90deg)}.apv-ic{width:14px;flex:none;display:inline-flex;justify-content:center;color:var(--auto-fg, var(--warn))}.apv-n{flex:none}.apv-peek{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--meta);font-family:var(--font-mono);font-size:var(--chat-code-fs)}.apv-peek:before{content:"\b7";margin-right:8px;font-family:var(--font-ui)}.apv-list{margin:2px 0 0 13px;padding-left:6px;border-left:1px solid var(--line)}.apv-row{display:flex;align-items:center;gap:8px;min-height:26px;padding:0 6px;min-width:0;overflow:hidden;white-space:nowrap;border-radius:var(--r-s);color:var(--muted);font-size:var(--chat-fs-s)}.apv-row:hover{background:var(--surface-hover);color:var(--fg)}.apv-cmd,.apv-path,.apv-title{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.apv-cmd,.apv-path{font-family:var(--font-mono);font-size:var(--chat-code-fs)}.apv-meta{flex:none;margin-left:auto;color:var(--meta);font-size:var(--fs-xs)}.nt-auto{text-align:left;padding:10px 12px;border:1px solid var(--line);border-radius:var(--r-m);line-height:1.6;color:var(--text)}.nt-auto-h{display:flex;align-items:center;gap:6px;margin-bottom:2px}.composer{flex:none;padding:0 16px 16px}.cp-card{width:100%;max-width:var(--col);margin:0 auto;background:var(--bg);border-radius:14px;border:1px solid var(--cp-line);padding:12px 12px 8px 14px;box-shadow:0 1px 2px #0000000a;transition:border-color var(--dur-2) var(--ease),box-shadow var(--dur-2) var(--ease)}.cp-card:focus-within{border-color:var(--cp-focus);box-shadow:0 0 0 3px var(--cp-ring),0 1px 2px #0000000a}.cp-card.waiting{border-color:color-mix(in oklab,var(--warn) 45%,var(--bg))}:root{--auto-fg: #b45309;--auto-bg: color-mix(in oklab, #f59e0b 10%, var(--bg));--auto-line: color-mix(in oklab, #d97706 40%, var(--bg))}:root[data-theme=dark]{--auto-fg: #fbbf24;--auto-bg: color-mix(in oklab, #f59e0b 13%, var(--bg));--auto-line: color-mix(in oklab, #f59e0b 42%, var(--bg))}.cp-auto-on{max-width:var(--col);margin:0 auto 4px;display:flex;align-items:center;gap:6px;min-width:0;height:22px;padding:0 4px;white-space:nowrap;overflow:hidden;color:var(--muted);font-size:var(--fs-s);line-height:22px}.cp-auto-ic{flex:none;display:inline-flex;color:var(--auto-fg)}.cp-auto-t{flex:0 1 auto;min-width:0;display:inline-flex;align-items:center;gap:6px;overflow:hidden;cursor:help;border-radius:var(--r-s)}.cp-auto-t:focus-visible{outline:2px solid var(--auto-line);outline-offset:1px}.cp-auto-t b{min-width:0;overflow:hidden;text-overflow:ellipsis;color:var(--auto-fg);font-weight:600}.cp-auto-on .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.cp-auto-back{flex:none;margin-left:auto;padding:0 2px;border:0;background:none;white-space:nowrap;color:var(--fg);font-size:var(--fs-s);text-decoration:underline;text-underline-offset:2px;text-decoration-color:color-mix(in oklab,var(--fg) 35%,transparent);cursor:pointer}.cp-auto-back:hover{text-decoration-color:currentColor}.cp-card.auto-on{border-color:var(--auto-line)}.cp-card.auto-on:focus-within{border-color:var(--auto-fg)}.cp-hint{max-width:var(--col);margin:6px auto 0;font-size:var(--fs-xs);color:var(--meta);text-align:center}.att-note{padding:6px 10px 0;color:var(--muted);font-size:var(--fs-s)}.cp-ta-wrap{position:relative}.slash-pop{position:absolute;left:0;right:0;bottom:100%;margin-bottom:6px;max-height:min(240px,40vh);overflow:hidden;display:flex;flex-direction:column;z-index:20}.slash-pop .ap-scroll{max-height:inherit}.slash-pop .slash-h{padding:4px 10px 2px;font-size:var(--fs-xs);color:var(--muted);text-transform:uppercase;letter-spacing:.04em}.slash-pop .mi.slash-item{height:auto;min-height:28px;padding:4px 10px;flex-direction:column;align-items:flex-start;gap:0}.slash-pop .slash-name{font-weight:500}.slash-pop .slash-desc{font-size:var(--fs-s);color:var(--muted);line-height:1.3}.slash-pop .slash-hint{font-size:var(--fs-s);color:var(--muted);font-family:var(--font-mono)}.slash-pop .mi.slash-item.sel{background:var(--surface-hover)}.cp-ta{width:100%;border:0;resize:none;background:none;outline:none;color:var(--text);font-size:var(--chat-fs);line-height:calc(var(--chat-fs) * 1.62);min-height:34px;max-height:calc(var(--chat-fs) * 1.62 * 12);overflow-y:auto;display:block;padding:0}.cp-ta::placeholder{color:var(--meta)}.cp-bar{display:flex;align-items:center;flex-wrap:wrap;gap:2px;margin:4px 0 0 -6px;min-width:0}.pill-wrap{position:relative;flex:0 1 auto;min-width:0;max-width:100%}.pill{position:relative;display:inline-flex;align-items:center;gap:5px;height:26px;padding:0 8px;border-radius:7px;background:none;color:var(--pill-fg, var(--muted));border:1px solid transparent;font-size:var(--fs-s);max-width:min(240px,100%);min-width:0;white-space:nowrap;cursor:pointer;transition:background var(--dur-1)}.pill:hover{background:var(--surface-hover)}.pill svg{flex:none}.pill.chip{background:var(--chip-bg);border-color:var(--chip-line);padding:0 8px 0 4px;gap:6px;max-width:min(300px,100%)}.pill.chip:hover{background:var(--surface-hover)}.chip-logo{border-radius:5px}.chip-caret{color:var(--meta)}.pill .p-a{font-weight:500;color:var(--fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex:0 0 auto;max-width:120px}.pill .p-t{color:var(--meta);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex:1 1 auto}.pill .p-t:before{content:"\b7";margin-right:5px}.ipill .ip-l{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.ipill:focus-visible{outline:2px solid color-mix(in oklab,var(--accent) 45%,var(--bg));outline-offset:-1px}.ipill[aria-expanded=true]{background:var(--surface-hover)}.ipill.danger{color:var(--danger)}.cp-bar .pill{height:24px;border-radius:6px;background:var(--chip-bg);border-color:var(--chip-line);padding:0 6px 0 7px;gap:5px}.cp-bar .pill:hover,.cp-bar .pill[aria-expanded=true]{background:var(--surface-hover)}.cp-bar .pill.chip{padding:0 6px 0 3px}.cp-bar .pill.chip .chip-logo{width:16px;height:16px}.cp-bar .ipill.danger{border-color:color-mix(in oklab,var(--danger) 35%,var(--chip-line))}.cp-bar{gap:4px}.cp-tasks{max-width:var(--col);margin:0 auto 6px;display:flex}.tasks-pill{display:inline-flex;align-items:center;gap:5px;height:22px;padding:0 8px;border-radius:var(--r-full);border:1px solid var(--chip-line);background:var(--bg);color:var(--muted);font-size:var(--fs-xs);font-variant-numeric:tabular-nums}.tasks-pill:hover{color:var(--fg);background:var(--surface-hover)}.tasks-pill svg{flex:none;color:var(--meta)}.ipill.auto,.cp-bar .ipill.auto{color:var(--auto-fg);background:var(--auto-bg);border-color:var(--auto-line);font-weight:600}.ipill.auto:hover,.ipill.auto[aria-expanded=true],.cp-bar .ipill.auto:hover,.cp-bar .ipill.auto[aria-expanded=true]{background:color-mix(in oklab,var(--auto-fg) 16%,var(--bg))}.ipill.auto svg{color:var(--auto-fg)}.mi.warn .sm-label{color:var(--auto-fg)}.ipill.static{cursor:default}.mode-menu{max-width:300px}.cp-div{width:1px;height:14px;background:var(--line);margin:0 4px;flex:none}.cp-bar>.ibtn{flex:none}.cp-attach{color:var(--pill-fg, var(--muted))}.cp-card{container-type:inline-size;container-name:composer}@container composer (max-width: 520px){.pill .p-t{display:none}.pill{max-width:min(160px,100%)}.ipill .ip-l{max-width:64px}}@container composer (max-width: 380px){.pill{max-width:min(120px,100%);padding:0 6px}.ipill .ip-l{display:none}}.pop{position:absolute;bottom:32px;left:0;z-index:55;width:260px;background:var(--bg);border-radius:var(--r-m);box-shadow:var(--shadow-pop);padding:4px;max-height:60vh;overflow-y:auto}.agent-picker{width:min(300px,calc(100vw - 32px));padding:0;overflow:hidden;display:flex;flex-direction:column;max-height:min(420px,60vh)}.agent-picker .ap-search{display:flex;align-items:center;gap:8px;padding:8px 10px;border-bottom:1px solid var(--line);flex:none;color:var(--muted)}.agent-picker .ap-search-in{flex:1;min-width:0;border:0;background:none;outline:none;font-size:var(--fs-s);color:var(--fg)}.agent-picker .ap-search-in::placeholder{color:var(--muted)}.agent-picker .ap-refresh{flex:none;width:24px;height:24px;margin:-2px -4px -2px 0;padding:0;border:0;border-radius:var(--r-s);background:transparent;color:var(--muted);display:inline-flex;align-items:center;justify-content:center;cursor:pointer}.agent-picker .ap-refresh:hover:not(:disabled){color:var(--fg);background:var(--surface-hover)}.agent-picker .ap-refresh:disabled{opacity:.45;cursor:default}.agent-picker .ap-refresh.spinning svg{animation:ac-spin .8s linear infinite}@media(prefers-reduced-motion:reduce){.agent-picker .ap-refresh.spinning svg{animation-duration:2.4s}}.agent-picker .ap-scroll{overflow-y:auto;padding:4px;flex:1;min-height:0}.agent-picker .ap-empty{padding:12px 10px;font-size:var(--fs-s);color:var(--muted);text-align:center}.agent-picker .ap-back{font-weight:600;margin-bottom:2px}.agent-picker .ap-back-icon{display:inline-flex;transform:rotate(180deg);margin-right:2px}.agent-picker .mi-row{display:flex;align-items:center;gap:6px;width:100%;text-align:left}.agent-picker .provider-pick-row{justify-content:space-between;gap:8px}.agent-picker .provider-pick-name{flex:0 1 auto;min-width:5.5rem;max-width:58%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500;color:inherit}.agent-picker .provider-pick-meta{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:flex-end;gap:6px;min-width:0;margin-left:auto}.agent-picker .provider-pick-meta .dlg-hint{flex:none;font-size:10px;max-width:5rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.agent-picker .mi-row .mi-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.agent-picker .mi-row .mi-sub{flex:none;max-width:38%;font-size:var(--fs-xs);color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.agent-picker .model-pick-row{min-width:0}.agent-picker .model-pick-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.agent-picker .model-pick-default{flex:0 1 58%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.agent-picker .mi-meta{flex:none;font-size:var(--fs-xs);color:var(--muted);white-space:nowrap}.agent-picker .mi-tag{flex:none;font-size:10px;color:var(--accent)}.agent-picker .mi-caret{flex:none;color:var(--muted);display:inline-flex}.agent-picker .mi-check{flex:none;margin-left:auto;color:var(--accent)}.ap-sec{padding:4px 0}.ap-sec .tinput{height:26px;margin-bottom:4px}.ap-sec .mi{height:26px;font-size:var(--fs-s)}.att-bar{display:flex;flex-wrap:wrap;gap:6px;padding:0 0 6px}.att{display:inline-flex;align-items:center;gap:6px;height:26px;padding:0 8px;background:var(--surface-hover);border-radius:var(--r-s);font-size:var(--fs-s)}.att img{width:22px;height:22px;object-fit:cover;border-radius:4px}.att.up{opacity:.6}.att-name{max-width:160px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.att-x{color:var(--muted);font-size:14px;line-height:1}.att-x:hover{color:var(--fg)}.cp-right{margin-left:auto;flex:none;display:flex;align-items:center;gap:8px}.cp-clock{font-size:var(--fs-s);color:var(--meta);font-variant-numeric:tabular-nums}.cp-send,.cp-stop{width:30px;height:30px;border-radius:50%;flex:none;display:inline-flex;align-items:center;justify-content:center;transition:filter var(--dur-1),opacity var(--dur-1)}.cp-send{background:var(--accent);color:var(--accent-fg)}.cp-send:hover{filter:brightness(1.08)}.cp-send[disabled]{opacity:.35;cursor:default;filter:none}.cp-stop{background:var(--fg);color:var(--bg)}.cp-stop:hover{filter:brightness(1.15)}@media(max-width:560px){.composer{padding:0 10px 10px}}.cp-card.drop-on{outline:1.5px dashed var(--cp-focus);outline-offset:2px}.cp-drop-hint{padding:4px 10px 0;font-size:var(--fs-s);color:var(--muted)}.att-bar .mention{height:24px}.qchip{display:inline-flex;align-items:center;gap:5px;height:24px;max-width:260px;padding:0 4px 0 8px;border-radius:6px;background:var(--surface-hover);color:var(--fg);font-size:var(--fs-s);min-width:0;border-left:2px solid color-mix(in oklab,var(--fg) 35%,transparent)}.qchip svg{flex:none;color:var(--muted)}.qchip-t{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.qchip-n{flex:none;color:var(--meta)}.qchip .att-x{flex:none;width:18px;height:18px;border-radius:4px}.qchip .att-x:hover{background:color-mix(in oklab,var(--fg) 10%,transparent)}.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;inset:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;inset:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{font-family:monospace;user-select:text;white-space:pre}.xterm .xterm-accessibility-tree>div{transform-origin:left;width:fit-content}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;background:#0000;transition:opacity .1s linear;z-index:11}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{position:absolute;display:none}.xterm .xterm-scrollable-element>.shadow.top{display:block;top:0;left:3px;height:3px;width:100%;box-shadow:var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.left{display:block;top:3px;left:0;height:100%;width:3px;box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.top-left-corner{display:block;top:0;left:0;height:3px;width:3px}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset} +:root{--own-bg: #ffffff;--own-sb: #f8f8f7;--own-fg: #1f1f1f;--own-muted: #737373;--own-line: #ececec;--bg: var(--own-bg);--sb-bg: var(--own-sb);--fg: var(--own-fg);--muted: var(--own-muted);--line: var(--own-line);--meta: #a3a3a3;--text: #262626;--accent: #262626;--accent-2: #525252;--accent-fg: #ffffff;--accent-soft: #f0f0f0;--surface: color-mix(in oklab, var(--fg) 3%, var(--bg));--surface-hover: color-mix(in oklab, var(--fg) 6%, var(--bg));--chip-bg: #f4f5f5;--chip-line: #ececec;--pill-fg: #525252;--search-bg: #efefee;--tile-bg: color-mix(in oklab, var(--fg) 90%, var(--bg));--tile-fg: var(--bg);--badge-bg: color-mix(in oklab, var(--fg) 7%, var(--bg));--badge-fg: color-mix(in oklab, var(--fg) 80%, var(--bg));--run-bg: #f0f0f0;--run-fg: #404040;--cp-line: color-mix(in oklab, var(--fg) 11%, var(--bg));--cp-focus: #a3a3a3;--cp-ring: rgb(0 0 0 / .06);--active-bg: #ffffff;--active-line: #e6e6e6;--ok: #16a34a;--warn: #d97706;--danger: #dc2626;--info: #2563eb;--code-bg: #f4f5f5;--code-line: #eaeceb;--code-fg: #404040;--add-bg: #ecfdf3;--del-bg: #fef2f2;--r-s: 6px;--r-m: 8px;--r-l: 12px;--r-full: 999px;--font-ui: var(--magpie-font, "Segoe UI Variable Text", "Segoe UI", -apple-system, "PingFang SC", "Microsoft YaHei UI", system-ui, sans-serif);--font-mono: var(--magpie-code, "Cascadia Code", "Cascadia Mono", "JetBrains Mono", ui-monospace, Consolas, monospace);--fs-xs: 11px;--fs-s: 12px;--fs-m: 13px;--fs-l: 14px;--fs-hero: 18px;--lh: 1.6;--col: 720px;--chat-fs: 13px;--chat-fs-s: max(12px, calc(var(--chat-fs) - 1px));--chat-code-fs: max(11.5px, calc(var(--chat-fs) - 1px));--chat-lh: 1.7;--row: 26px;--shadow-pop: 0 8px 24px -6px rgb(0 0 0 / .16), 0 0 0 1px var(--line);--term-bg: #ffffff;--term-fg: #1e1e1e;--ease: cubic-bezier(.2,.7,.2,1);--dur-1: .12s;--dur-2: .2s;color-scheme:light}:root[data-theme=dark]{--own-bg: #1a1a1a;--own-sb: #151515;--own-fg: #ececec;--own-muted: #9b9b9b;--own-line: #2c2c2c;--meta: #7c7c7c;--text: #e2e2e2;--accent: #e5e5e5;--accent-2: #b3b3b3;--accent-fg: #171717;--accent-soft: #2e2e2e;--chip-bg: #252727;--chip-line: #323434;--pill-fg: #bdbdbd;--search-bg: #242424;--run-bg: #2e2e2e;--run-fg: #d4d4d4;--cp-focus: #6b6b6b;--cp-ring: rgb(255 255 255 / .07);--active-bg: #242424;--active-line: #333333;--info: #60a5fa;--code-bg: #232323;--code-line: #303030;--code-fg: #d4d4d4;--add-bg: rgb(22 163 74 / .16);--del-bg: rgb(220 38 38 / .16);--shadow-pop: 0 8px 24px -6px rgb(0 0 0 / .5), 0 0 0 1px var(--line);--term-bg: #0c0c0c;--term-fg: #cccccc;color-scheme:dark}:root[data-host-colors]{--bg: var(--magpie-card, var(--magpie-bg, var(--own-bg)));--sb-bg: var(--magpie-bg, var(--own-sb));--fg: var(--magpie-fg, var(--own-fg));--muted: var(--magpie-muted, var(--own-muted));--line: var(--magpie-line, var(--own-line))}@layer reset{html,body{margin:0;padding:0;height:100%}body{background:var(--bg);color:var(--fg);font-family:var(--font-ui);font-size:var(--fs-m);line-height:var(--lh);-webkit-font-smoothing:antialiased}*{box-sizing:border-box}#root{height:100%}button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}input,textarea{font:inherit;color:inherit}a{color:var(--accent)}:focus-visible{outline:2px solid color-mix(in oklab,var(--accent) 55%,var(--bg));outline-offset:-1px}}*{scrollbar-width:thin;scrollbar-color:color-mix(in oklab,var(--fg) 18%,transparent) transparent}*::-webkit-scrollbar{width:8px;height:8px}*::-webkit-scrollbar-thumb{background:color-mix(in oklab,var(--fg) 18%,transparent);border-radius:4px}*::-webkit-scrollbar-thumb:hover{background:color-mix(in oklab,var(--fg) 30%,transparent)}*::-webkit-scrollbar-track{background:transparent}.ibtn{width:28px;height:28px;flex:none;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--r-s);color:var(--muted);transition:background var(--dur-1),color var(--dur-1)}.ibtn:hover{background:var(--surface-hover);color:var(--fg)}.ibtn[disabled]{opacity:.35;cursor:default}.ibtn.on{color:var(--accent)}.ibtn svg{width:16px;height:16px}.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:30px;padding:0 14px;border-radius:var(--r-s);font-size:var(--fs-m);background:var(--surface-hover);color:var(--fg);transition:background var(--dur-1),filter var(--dur-1)}.btn:hover{filter:brightness(1.03)}.btn[disabled]{opacity:.4;cursor:default}.btn.primary{background:var(--accent);color:var(--accent-fg)}.btn.primary:hover{filter:brightness(1.08)}.btn.danger{color:var(--danger)}.btn.ghost{background:none}.btn.ghost:hover{background:var(--surface-hover)}.tinput{width:100%;height:30px;padding:0 10px;border:1px solid var(--line);border-radius:var(--r-s);background:var(--bg);font-size:var(--fs-m);outline:none}.tinput:focus{border-color:color-mix(in oklab,var(--accent) 55%,var(--bg))}.tinput.err{border-color:var(--danger)}.tinput::placeholder{color:var(--muted)}textarea.tinput{height:auto;min-height:60px;padding:6px 10px;resize:vertical}.menu{position:fixed;z-index:60;min-width:160px;max-width:280px;background:var(--bg);border-radius:var(--r-m);box-shadow:var(--shadow-pop);padding:4px;font-size:var(--fs-m)}.mi{display:flex;align-items:center;gap:8px;width:100%;height:28px;padding:0 10px;border-radius:var(--r-s);text-align:left;color:var(--fg)}.mi:hover:not([disabled]){background:var(--surface-hover)}.mi[disabled]{color:var(--muted);cursor:default}.mi.danger{color:var(--danger)}.mi .mi-check{margin-left:auto;color:var(--accent)}.msep{height:1px;margin:4px 6px;background:var(--line)}.mlabel{padding:6px 10px 2px;font-size:var(--fs-s);color:var(--muted)}.dlg-scrim{position:fixed;inset:0;z-index:70;background:#00000052;display:flex;align-items:center;justify-content:center;padding:24px}.dlg{width:440px;max-width:100%;max-height:80vh;display:flex;flex-direction:column;background:var(--bg);border-radius:var(--r-l);box-shadow:var(--shadow-pop)}.dlg-title{flex:none;padding:14px 16px 4px;font-size:var(--fs-l);font-weight:600}.dlg-body{flex:1;min-height:0;overflow-y:auto;padding:8px 16px}.dlg-foot{flex:none;display:flex;justify-content:flex-end;gap:8px;padding:10px 16px 14px}.dlg-row{margin:10px 0}.dlg-row-top{align-items:flex-start}.dlg-row>label{display:block;margin-bottom:4px;font-size:var(--fs-s);color:var(--muted)}.provider-list{display:flex;flex-direction:column;gap:6px;width:100%;max-height:280px;overflow:auto}.provider-list{display:flex;flex-direction:column;gap:6px;flex:1;min-width:0}.provider-redetect{align-self:flex-start;margin-bottom:4px}.provider-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px;padding:6px 8px;border-radius:var(--r-m);background:var(--bg-2)}.provider-row.open{padding-bottom:10px}.provider-head{display:flex;align-items:center;gap:10px;flex:1;min-width:0;border:0;background:none;text-align:left;cursor:pointer;color:inherit;padding:0}.provider-detail{flex:1 1 100%;display:flex;flex-direction:column;gap:6px;padding:4px 0 0 28px}.provider-hint-row{display:flex;gap:8px;align-items:flex-start;flex-wrap:wrap}.btn.sm{font-size:var(--fs-s);padding:4px 10px;height:auto}.provider-meta{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.provider-name{font-size:var(--fs-m);font-weight:500}.provider-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.provider-dot-on{background:var(--ok, #3ecf8e)}.provider-dot-off{background:var(--muted);opacity:.5}.provider-dot-pending{background:var(--warn, #e6a817)}.provider-switch input{width:16px;height:16px;cursor:pointer}.dlg-hint{font-size:var(--fs-s);color:var(--muted)}.dlg-hint.err{color:var(--danger)}.bash-set{display:flex;flex-direction:column;gap:4px;min-width:0}.bash-row{display:flex;gap:8px;align-items:center}.bash-row .tinput{flex:1;min-width:0;font-family:var(--font-mono)}.toasts{position:fixed;left:50%;bottom:24px;transform:translate(-50%);z-index:80;display:flex;flex-direction:column;gap:8px;align-items:center}.toast{max-width:480px;padding:8px 14px;border-radius:var(--r-m);background:var(--fg);color:var(--bg);font-size:var(--fs-m);box-shadow:var(--shadow-pop);animation:toast-in var(--dur-2) var(--ease)}.toast.err{background:var(--danger);color:#fff}@keyframes toast-in{0%{opacity:0;transform:translateY(8px)}}.dot{width:6px;height:6px;border-radius:50%;flex:none;background:var(--muted)}.dot.ok{background:var(--ok)}.dot.run{background:var(--fg);animation:dot-blink 1s steps(1,end) infinite;box-shadow:0 0 0 1px color-mix(in oklab,var(--fg) 45%,transparent)}@keyframes dot-blink{50%{background:var(--bg)}}.dot.err{background:var(--danger)}.dot.wait{background:var(--warn);animation:breathe 1.6s infinite}@keyframes breathe{50%{opacity:.35}}.boot-screen{height:100%;display:flex;align-items:center;justify-content:center;gap:8px;color:var(--muted);font-size:var(--fs-m)}.boot-screen .btn{margin-top:12px}.boot-wrap{display:flex;flex-direction:column;align-items:center}.boot-dot{width:8px;height:8px;border-radius:50%;background:var(--muted)}.boot-dot[data-state=open]{background:var(--ok)}.boot-dot[data-state=reconnecting]{background:var(--warn)}.boot-dot[data-state=down]{background:var(--danger)}.vh{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}.menu.select-menu{z-index:80;overflow-y:auto;outline:none;max-width:320px}.sm-opt{cursor:pointer;user-select:none;height:auto;min-height:28px;padding:4px 8px 4px 10px}.sm-opt.on{background:var(--surface-hover)}.sm-opt.off{color:var(--muted);cursor:default}.sm-opt.off:hover{background:none}.sm-text{display:flex;flex-direction:column;min-width:0;flex:1 1 auto}.sm-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sm-label>svg{vertical-align:-2px;margin-right:5px}.sm-hint{font-size:var(--fs-s);color:var(--muted);white-space:normal;line-height:1.4}.sm-check{flex:none;width:14px;display:inline-flex;color:var(--accent)}.sm-opt[aria-selected=true] .sm-label{font-weight:500}.tinput.sm-field{display:flex;align-items:center;text-align:left;padding-right:26px;cursor:pointer;position:relative;color:var(--fg);background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);background-position:calc(100% - 14px) 50%,calc(100% - 10px) 50%;background-size:4px 4px;background-repeat:no-repeat}.tinput.sm-field[aria-expanded=true]{border-color:color-mix(in oklab,var(--accent) 55%,var(--bg))}.sm-field .sm-val{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.app{display:flex;height:100vh;min-width:480px;overflow:hidden}.sidebar{width:var(--sb-w, 248px);flex:none;display:flex;flex-direction:column;background:var(--sb-bg);border-right:1px solid var(--line)}.sb-row{display:flex;align-items:center;gap:2px;height:40px;padding:8px 8px 4px;flex:none}.sb-row-search{height:36px;padding:0 8px 4px}.sb-new{flex:1;display:flex;align-items:center;gap:8px;height:28px;min-width:0;padding:0 8px 0 5px;border-radius:var(--r-s);font-size:var(--fs-m);font-weight:500;text-align:left;transition:background var(--dur-1);white-space:nowrap;overflow:hidden}.sb-new-tile{width:18px;height:18px;flex:none;border-radius:5px;background:var(--tile-bg);color:var(--tile-fg);display:inline-flex;align-items:center;justify-content:center}.sb-new-tile svg{stroke-width:2.2}.sb-new:hover{background:var(--surface-hover)}.sb-row .ibtn{width:28px;height:28px}.sb-search{flex:1;display:flex;align-items:center;gap:6px;height:28px;padding:0 8px;border-radius:var(--r-s);background:var(--search-bg);color:var(--meta)}.sb-search input::placeholder{color:var(--meta)}.sb-search input{flex:1;min-width:0;border:0;background:none;font-size:var(--fs-s);outline:none;color:var(--fg)}.sb-list{flex:1;overflow-y:auto;padding:0 8px 8px}.pj-group{margin-top:2px}.pj{display:flex;align-items:center;gap:2px;height:var(--row);padding:0 4px 0 0;border-radius:var(--r-s)}.pj:hover{background:var(--surface-hover)}.pj-toggle{flex:1;min-width:0;height:100%;display:flex;align-items:center;gap:6px;padding-left:2px;text-align:left;font-size:var(--fs-m);font-weight:500}.pj-caret{width:14px;flex:none;display:inline-flex;justify-content:center;color:var(--muted);transition:transform var(--dur-1)}.pj-caret.open{transform:rotate(90deg)}.pj-badge{width:18px;height:18px;flex:none;border-radius:5px;display:inline-flex;align-items:center;justify-content:center;background:var(--badge-bg);color:var(--badge-fg);font-size:var(--fs-xs);font-weight:600;line-height:1;text-transform:uppercase}.pj-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pj-count{flex:none;padding:0 6px;font-size:var(--fs-s);color:var(--meta)}.pj-act{width:22px;height:22px;flex:none;display:none;align-items:center;justify-content:center;border-radius:var(--r-s);color:var(--muted)}.pj:hover .pj-act,.pj-act:focus-visible{display:inline-flex}.pj:hover .pj-count{display:none}.pj-act:hover{background:var(--bg);color:var(--fg)}.pj-sessions{padding:1px 0 4px 22px;display:flex;flex-direction:column;gap:1px}.pj-more,.pj-empty{display:flex;align-items:center;width:100%;height:26px;padding:0 8px 0 21px;font-size:var(--fs-s);color:var(--muted);text-align:left;border-radius:var(--r-s)}.pj-more:hover{background:var(--surface-hover);color:var(--fg)}.t-item{display:flex;align-items:center;gap:8px;width:100%;height:var(--row);padding:0 4px 0 8px;border-radius:var(--r-s);position:relative;text-align:left;font-size:var(--fs-m);transition:background var(--dur-1)}.t-item:hover{background:var(--surface-hover)}.t-item.on{background:var(--active-bg);box-shadow:0 0 0 1px var(--active-line),0 1px 2px #0000000a;font-weight:500}.t-item.on:before{content:"";position:absolute;left:-1px;top:7px;bottom:7px;width:2px;border-radius:2px;background:var(--accent-2)}.t-item.archived{opacity:.55}.t-item.archived .t-title{font-style:italic}.t-item .dot{width:6px;height:6px}.t-pin{width:12px;flex:none;display:inline-flex;color:var(--muted)}.t-pin svg{width:10px;height:10px}.t-title{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.t-time{flex:none;font-size:var(--fs-xs);color:var(--meta);font-weight:400}.t-item:hover .t-time{display:none}.t-more{flex:none;width:22px;height:22px;display:none;align-items:center;justify-content:center;border-radius:var(--r-s);color:var(--muted)}.t-item:hover .t-more{display:inline-flex}.t-more:hover{background:var(--bg);color:var(--fg)}.t-rename{flex:1;min-width:0;height:24px;font-size:var(--fs-m);border:1px solid var(--accent);border-radius:var(--r-s);padding:0 6px;background:var(--bg)}.sb-empty{padding:20px 12px;text-align:center;color:var(--muted);font-size:var(--fs-s)}.sb-start{padding:28px 12px;text-align:center}.sb-start-t{font-size:var(--fs-m);font-weight:500}.sb-start-s{margin:4px 0 12px;font-size:var(--fs-s);color:var(--muted)}.rs{width:5px;flex:none;cursor:col-resize;position:relative}.rs:after{content:"";position:absolute;inset:0}.rs:hover:after,.rs.drag:after{background:color-mix(in oklab,var(--accent) 30%,transparent)}.rs-l{margin-left:-3px}.rs-r{margin-right:-3px}body.col-drag{cursor:col-resize;user-select:none}body.col-drag iframe,body.col-drag .xterm{pointer-events:none}.scrim{position:fixed;inset:0;z-index:45;background:#00000052;display:none}.scrim.show{display:block}.main{flex:1;min-width:0;display:flex;flex-direction:column;background:var(--bg);position:relative}.topbar{height:40px;flex:none;display:flex;align-items:center;gap:6px;padding:0 10px;border-bottom:1px solid var(--line)}.tb-menu-btn{display:none}.tb-menu-btn.tb-sb-collapsed{display:inline-flex;margin-right:2px}.tb-crumb{flex:none;max-width:26%;font-size:var(--fs-m);color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tb-sep{flex:none;color:var(--muted)}.tb-title{font-size:var(--fs-l);font-weight:500;max-width:40%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;border-radius:var(--r-s);padding:2px 6px;cursor:text}.tb-title:hover{background:var(--surface)}.tb-title.ghost{color:var(--muted);cursor:default}.tb-title.ghost:hover{background:none}.tb-rename{font-size:var(--fs-l);font-weight:500;border:1px solid var(--accent);border-radius:var(--r-s);padding:1px 6px;background:var(--bg);width:300px;max-width:46vw}.tb-pill{flex:none;display:inline-flex;align-items:center;gap:6px;height:22px;padding:0 9px;border-radius:var(--r-full);font-size:var(--fs-s);background:var(--surface);color:var(--muted)}.tb-pill.run{background:var(--run-bg);color:var(--run-fg)}.tb-pill-dot{width:7px;height:7px;border-radius:50%;background:var(--accent-2);box-shadow:0 0 0 3px color-mix(in oklab,var(--accent-2) 20%,transparent);animation:breathe 1.6s infinite}.tb-pill.wait{color:var(--warn)}button.tb-pill{border:0;font-family:inherit;cursor:pointer}.tb-pill.err{color:var(--danger)}.tb-right{margin-left:auto;display:flex;align-items:center;gap:2px}.tb-model{font-size:var(--fs-s);color:var(--muted);margin-right:4px;white-space:nowrap;max-width:160px;overflow:hidden;text-overflow:ellipsis}.connbar{flex:none;height:26px;display:flex;align-items:center;justify-content:center;font-size:var(--fs-s);background:color-mix(in oklab,var(--warn) 14%,var(--bg));color:var(--warn)}.scroll{flex:1;overflow-y:auto;overscroll-behavior:contain;position:relative;scrollbar-gutter:stable}.tl-wrap{--tl-pad-b: 16px;display:flow-root;max-width:calc(var(--col) + 40px);min-width:0;margin:0 auto;padding:24px 20px 0}.tl-wrap>.nt,.tl-wrap>.sb-empty{margin-bottom:var(--tl-pad-b)}.jump{position:absolute;right:24px;bottom:150px;width:34px;height:34px;border-radius:50%;background:var(--bg);box-shadow:var(--shadow-pop);display:flex;align-items:center;justify-content:center;color:var(--muted);z-index:5}.jump:hover{color:var(--fg)}.jump svg{transform:rotate(90deg)}.jump .jd{position:absolute;top:4px;right:4px;width:7px;height:7px;border-radius:50%;background:var(--accent)}.panel{width:var(--pn-w, 440px);flex:none;display:flex;flex-direction:column;background:var(--bg);border-left:1px solid var(--line)}.pn-head{flex:none;display:flex;align-items:center;gap:2px;height:40px;padding:0 6px;border-bottom:1px solid var(--line)}.pn-tabs{display:flex;gap:2px}.pn-tab{height:28px;padding:0 10px;border-radius:var(--r-s);font-size:var(--fs-m);color:var(--muted);display:inline-flex;align-items:center;gap:6px}.pn-tab:hover{background:var(--surface-hover);color:var(--fg)}.pn-tab.on{background:var(--surface-hover);color:var(--fg);font-weight:500}.pn-body{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.pn-close{margin-left:auto}.pn-empty{padding:20px;color:var(--muted);font-size:var(--fs-m);text-align:center}.pn-empty-sub{margin-top:6px;font-size:var(--fs-s);opacity:.8}.chg-head{flex:none;display:flex;align-items:center;gap:6px;height:34px;padding:0 8px;border-bottom:1px solid var(--line);font-size:var(--fs-m)}.chg-branch{display:inline-flex;align-items:center;gap:5px;color:var(--muted);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chg-head .ibtn{margin-left:auto}.chg-list{flex:none;max-height:40%;overflow-y:auto;border-bottom:1px solid var(--line)}.chg-list:empty{border-bottom:none}.chg-row{display:flex;align-items:center;gap:7px;padding:4px 8px;cursor:pointer;font-size:var(--fs-m);min-height:28px}.chg-row:hover,.chg-row.on{background:var(--surface-hover)}.chg-kind{flex:none;width:18px;height:18px;border-radius:var(--r-s);font-size:10px;display:inline-flex;align-items:center;justify-content:center;background:var(--surface);color:var(--muted)}.chg-kind.k-modified{color:var(--warn, #b45309)}.chg-kind.k-added,.chg-kind.k-untracked{color:var(--ok, #15803d)}.chg-kind.k-deleted{color:var(--danger)}.chg-kind.k-renamed{color:var(--accent)}.chg-path{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;direction:rtl;text-align:left}.chg-stat{flex:none;font-style:normal;font-size:var(--fs-s);font-variant-numeric:tabular-nums}.chg-stat .add{color:var(--ok, #15803d);font-style:normal}.chg-stat .del{color:var(--danger);font-style:normal}.chg-discard{flex:none;opacity:0}.chg-row:hover .chg-discard{opacity:1}.chg-diff{flex:1;min-height:0;overflow:auto}.ft-crumbs{flex:none;display:flex;align-items:center;gap:4px;min-height:34px;padding:0 8px;border-bottom:1px solid var(--line);font-size:var(--fs-m);overflow-x:auto;white-space:nowrap}.ft-crumb{color:var(--muted);font-size:var(--fs-m);padding:2px 4px;border-radius:var(--r-s)}.ft-crumb:hover{background:var(--surface-hover);color:var(--fg)}.ft-crumb-t{color:var(--fg)}.ft-crumb-t.muted{color:var(--muted)}.ft-tree{flex:none;max-height:45%;overflow-y:auto;padding:4px 0}.ft-row{display:flex;align-items:center;gap:5px;padding:3px 8px;cursor:pointer;font-size:var(--fs-m);min-height:24px}.ft-row:hover,.ft-row.on{background:var(--surface-hover)}.ft-row .caret{font-size:var(--fs-xs);color:var(--muted);display:inline-block;transition:transform var(--dur-1) var(--ease)}.ft-row .caret.open{transform:rotate(90deg)}.ft-dot{width:13px;flex:none}.ft-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ft-err{color:var(--danger);font-size:var(--fs-s);padding:2px 0}.ft-view{flex:1;min-height:0;overflow:auto;border-top:1px solid var(--line)}.ft-pre{margin:0;padding:10px 12px;font-family:var(--font-mono);font-size:var(--chat-code-fs);line-height:1.55}.ft-pre code{background:none;padding:0;display:block;white-space:pre}.tm-tabs{flex:none;display:flex;align-items:center;gap:2px;padding:4px 6px;border-bottom:1px solid var(--line);overflow-x:auto}.tm-tab{display:inline-flex;align-items:center;gap:6px;height:26px;padding:0 6px 0 10px;border-radius:var(--r-s);font-size:var(--fs-m);color:var(--muted);white-space:nowrap}.tm-tab:hover,.tm-tab.on{background:var(--surface-hover);color:var(--fg)}.tm-x{color:var(--muted);padding:0 3px;border-radius:3px}.tm-x:hover{color:var(--danger);background:var(--surface-hover)}.tm-note{flex:none;padding:4px 10px;font-size:var(--fs-s);color:var(--warn);background:color-mix(in oklab,var(--warn) 10%,var(--bg));border-bottom:1px solid var(--line)}.tm-body{flex:1;min-height:0;position:relative;background:var(--term-bg)}.tm-view{position:absolute;inset:0;padding:6px 8px;background:var(--term-bg)}.tm-view .xterm{height:100%}.tm-view .xterm-viewport{background:var(--term-bg)!important}.tm-view .xterm-screen{padding:2px 0}.imp-list{max-height:320px;overflow-y:auto;display:flex;flex-direction:column;gap:2px}.imp-row{display:flex;align-items:center;gap:8px;padding:5px 6px;border-radius:var(--r-s);font-size:var(--fs-m);cursor:pointer}.imp-row:hover{background:var(--surface-hover)}.imp-row.done{opacity:.55;cursor:default}.imp-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.imp-meta{flex:none;color:var(--muted);font-size:var(--fs-s)}.info-grid{display:flex;flex-direction:column;gap:2px}.info-row{display:flex;align-items:center;gap:10px;padding:3px 2px;font-size:var(--fs-m)}.info-k{flex:none;width:74px;color:var(--muted)}.info-v{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--font-mono);font-size:var(--fs-s)}@media(min-width:760px){.sidebar{transition:margin-left var(--dur-2) var(--ease),visibility 0s linear 0s}.sidebar.w-hide{margin-left:calc(-1 * var(--sb-w, 248px));visibility:hidden;transition:margin-left var(--dur-2) var(--ease),visibility 0s linear var(--dur-2)}.sidebar.w-hide+.rs-l{display:none}}@media(prefers-reduced-motion:reduce){.sidebar,.sidebar.w-hide{transition:none}}.sb-row .sb-toggle{flex:none;color:var(--muted)}.sb-toggle:hover{color:var(--fg)}@media(min-width:900px){.panel.w-hide{display:none}}@media(max-width:899px){.panel{position:fixed;right:0;top:0;bottom:0;z-index:46;width:min(var(--pn-w, 440px),92vw);transform:translate(100%);transition:transform var(--dur-2) var(--ease);box-shadow:var(--shadow-pop)}.panel.open{transform:none}.rs-r{display:none}}@media(max-width:759px){.sidebar{position:fixed;left:0;top:0;bottom:0;z-index:46;width:min(var(--sb-w, 248px),84vw);transform:translate(-100%);transition:transform var(--dur-2) var(--ease);box-shadow:var(--shadow-pop)}.sidebar.open{transform:none}.sidebar~.rs-l{display:none}.tb-menu-btn{display:inline-flex}.tl-wrap{--tl-pad-b: 8px;padding:16px 14px 0}.tb-model{display:none}}.dlg.cpal{width:520px;padding:6px}.cpal-in{width:100%;height:36px;padding:0 12px;border:0;background:none;outline:none;font-size:var(--fs-l);color:var(--fg)}.cpal-list{max-height:46vh;overflow-y:auto;padding:4px}.cpal-item{display:flex;align-items:center;gap:8px;width:100%;height:30px;padding:0 10px;border-radius:var(--r-s);text-align:left;font-size:var(--fs-m)}.cpal-item.on{background:var(--surface-hover)}.cpal-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cpal-hint{flex:none;font-size:var(--fs-s);color:var(--muted)}.pv{flex:1;min-height:0;display:flex;flex-direction:column}.pv-bar{flex:none;display:flex;align-items:center;gap:2px;height:38px;padding:0 6px;border-bottom:1px solid var(--line)}.pv-bar .ibtn{width:26px;height:26px;flex:none;color:var(--muted)}.pv-bar .ibtn:hover:not(:disabled){color:var(--fg)}.pv-bar .ibtn:disabled{opacity:.35;cursor:default}.pv-addr{flex:1;min-width:0;height:26px;padding:0 8px;margin:0 2px;border-radius:var(--r-s);background:var(--search-bg);border:1px solid transparent;color:var(--fg);font-family:var(--font-mono);font-size:var(--fs-s);outline:none}.pv-addr:focus{border-color:var(--cp-focus);background:var(--bg)}.pv-addr.err{border-color:color-mix(in oklab,var(--danger) 60%,var(--bg))}.pv-note{flex:none;display:flex;align-items:center;gap:8px;padding:6px 10px;font-size:var(--fs-s);color:var(--muted);border-bottom:1px solid var(--line)}.pv-note.err{color:var(--danger)}.pv-note .btn{height:24px;font-size:var(--fs-s)}.pv-frame-wrap{flex:1;min-height:0;position:relative;background:var(--bg)}.pv-frame{position:absolute;inset:0;width:100%;height:100%;border:0;background:#fff}.pv-loading{position:absolute;top:0;left:0;right:0;height:2px;background:var(--accent-2);opacity:.5;animation:breathe 1s infinite}.pv-empty{padding:28px 22px;color:var(--muted);font-size:var(--fs-m);text-align:center;line-height:1.7}.pv-empty code{font-family:var(--font-mono);font-size:var(--fs-s);background:var(--code-bg);border:1px solid var(--code-line);border-radius:4px;padding:0 4px;color:var(--code-fg)}.pv-hint{margin-top:10px;font-size:var(--fs-s);color:var(--meta)}.ft-row[draggable=true]{cursor:default}.ft-row.dragging{opacity:.5}.um-row{display:flex;flex-direction:column;align-items:flex-end;margin:4px 0 8px}.um{position:relative;max-width:78%;background:var(--accent-soft);border-radius:14px 14px 4px;color:var(--fg);padding:6px 12px;font-size:var(--chat-fs);line-height:1.6;white-space:pre-wrap;word-break:normal;overflow-wrap:break-word}.um-act{display:flex;gap:2px;margin-top:2px;height:24px;opacity:0;transition:opacity var(--dur-1)}.um-row:hover .um-act,.um-act:focus-within{opacity:1}@media(hover:none){.um-act{opacity:1}}.um-act .ibtn{width:24px;height:24px;color:var(--meta)}.um-act .ibtn:hover,.um-act .ibtn:focus-visible{color:var(--fg)}.um-act .ibtn.done,.te-act.done{color:var(--fg)}.um-img{display:block;max-width:200px;max-height:140px;border-radius:var(--r-s);margin-bottom:6px;cursor:zoom-in}.um-tag{font-size:var(--chat-fs-s);color:var(--muted);margin-top:2px}.um-row.fresh .um{animation:um-in .14s var(--ease, ease-out) both}@keyframes um-in{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.um-row.fresh .um{animation:none}}.um-row.failed .um{box-shadow:inset 0 0 0 1px var(--danger)}.um-fail{display:flex;align-items:center;gap:8px;margin-top:4px;font-size:var(--chat-fs-s);color:var(--danger)}.um-fail-t{display:inline-flex;align-items:center;gap:4px}.um-fail-b{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:6px;border:1px solid var(--line);background:transparent;color:var(--fg);font:inherit;cursor:pointer}.um-fail-b:hover,.um-fail-b:focus-visible{background:var(--surface-hover)}.as{margin:4px 0}.md.streaming:after{content:"\258d";color:var(--accent);animation:breathe 1s infinite}.md{font-size:var(--chat-fs);line-height:var(--chat-lh);color:var(--text);word-break:normal;overflow-wrap:break-word}.md p{margin:0 0 .6em}.md>:last-child{margin-bottom:0}.md a{color:var(--accent);text-decoration:underline;text-underline-offset:2px;text-decoration-color:color-mix(in oklab,var(--accent) 40%,transparent)}.md a:hover{text-decoration:underline}.md pre{position:relative;background:var(--code-bg);border:1px solid var(--code-line);border-radius:var(--r-m);padding:10px 12px;overflow-x:auto;font-family:var(--font-mono);font-size:var(--chat-code-fs);line-height:1.55}.md code{font-family:var(--font-mono);font-size:var(--chat-code-fs);background:var(--code-bg);color:var(--code-fg);padding:1px 5px;border-radius:4px;border:1px solid var(--code-line)}.md pre code{background:none;padding:0;border:0;color:inherit;font-size:inherit}.md ul,.md ol{margin:.45em 0;padding-left:1.7em}.md li+li{margin-top:.15em}.md h1,.md h2,.md h3,.md h4{margin:.95em 0 .4em;font-weight:600;line-height:1.4}.md h1{font-size:calc(var(--chat-fs) + 4px)}.md h2{font-size:calc(var(--chat-fs) + 2px)}.md h3{font-size:calc(var(--chat-fs) + 1px)}.md h4{font-size:var(--chat-fs)}.md>h1:first-child,.md>h2:first-child,.md>h3:first-child,.md>h4:first-child{margin-top:.2em}.md blockquote{margin:6px 0;padding-left:12px;border-left:3px solid var(--line);color:var(--muted)}.md table{border-collapse:collapse;margin:8px 0}.md th,.md td{border:1px solid var(--line);padding:4px 10px;font-size:var(--chat-fs-s)}.md .cb{margin:.5em 0 .7em;border:1px solid var(--code-line);border-radius:var(--r-m);background:var(--code-bg);overflow:hidden}.md .cb pre{margin:0;border:0;border-radius:0;background:none;padding:2px 12px 10px}.cb-head{display:flex;align-items:center;gap:8px;height:28px;padding:0 6px 0 12px;font-size:var(--fs-xs);color:var(--meta);user-select:none;-webkit-user-select:none}.cb-lang{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--font-mono)}.cb-acts{flex:none;display:inline-flex;gap:2px}.cb-btn{width:24px;height:22px;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--r-s);color:var(--meta)}.cb-btn:hover,.cb-btn:focus-visible{background:var(--surface-hover);color:var(--fg)}.cb-btn[aria-pressed=true],.cb-btn.done{color:var(--fg)}.md .cb pre code{display:block;min-width:max-content}.md .cb.wrap pre code{min-width:0;white-space:pre-wrap;overflow-wrap:anywhere}.md .cb.numbered pre code{counter-reset:cb-line}.cb-l{display:block;min-height:1.55em}.cb.numbered .cb-l{position:relative;padding-left:3em}.cb.numbered .cb-l:before{counter-increment:cb-line;content:counter(cb-line);position:absolute;left:0;width:2em;text-align:right;color:var(--meta);opacity:.8;user-select:none;-webkit-user-select:none;font-variant-numeric:tabular-nums}.md .hljs-keyword,.md .hljs-built_in,.md .hljs-selector-tag,.md .hljs-type{color:var(--fg);font-weight:600}.md .hljs-string,.md .hljs-regexp,.md .hljs-attr,.md .hljs-symbol{color:color-mix(in oklab,var(--fg) 62%,var(--bg))}.md .hljs-comment,.md .hljs-quote{color:var(--meta);font-style:italic}.md .hljs-number,.md .hljs-literal{color:color-mix(in oklab,var(--fg) 75%,var(--bg))}.md .hljs-title,.md .hljs-title.function_,.md .hljs-section{color:var(--fg)}.md .hljs-meta,.md .hljs-variable.language_{color:var(--muted)}.rs-item{margin:4px 0 6px}.rs-head{display:inline-flex;align-items:center;gap:4px;min-height:22px;max-width:100%;padding:0;color:var(--meta);font-size:var(--chat-fs-s);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rs-head:hover{color:var(--fg)}.rs-head .caret{display:inline-block;transition:transform var(--dur-1)}.rs-head .caret.open{transform:rotate(90deg)}.rs-body{margin:2px 0 6px 5px;padding-left:12px;border-left:1px solid var(--line);color:var(--muted);font-size:var(--chat-fs-s);line-height:1.65;white-space:pre-wrap}.ck{margin:4px 0 8px;font-size:var(--chat-fs-s);border-radius:var(--r-m);transition:background var(--dur-2)}.ck.flash{animation:ck-flash 1.2s var(--ease)}@keyframes ck-flash{0%,40%{background:var(--surface-hover)}to{background:transparent}}.ck-head{display:flex;align-items:center;gap:6px;min-height:24px;padding:0 6px;color:var(--muted);white-space:nowrap;overflow:hidden}.ck-head svg{flex:none;color:var(--meta)}.ck-n{font-variant-numeric:tabular-nums;color:var(--fg);font-weight:500}.ck-list{list-style:none;margin:0;padding:0}.ck-i{display:flex;align-items:flex-start;gap:8px;padding:2px 6px;line-height:1.55;color:var(--muted)}.ck-box{flex:none;width:14px;height:calc(var(--chat-fs-s) * 1.55);display:inline-flex;align-items:center;justify-content:center;color:var(--meta)}.ck-i.done .ck-box{color:var(--muted)}.ck-i.done .ck-t{color:var(--meta)}.ck-i.doing .ck-t{color:var(--fg)}.ck-t{min-width:0;overflow-wrap:anywhere}.tg{margin:2px 0 8px;min-width:0}.tg-head{display:flex;align-items:center;gap:8px;width:100%;min-height:26px;padding:0 6px;overflow:hidden;border-radius:var(--r-s);color:var(--muted);font-size:var(--chat-fs-s);text-align:left;white-space:nowrap}.tg-head:hover{color:var(--fg);background:var(--surface-hover)}.tg-ic{width:14px;flex:none;display:inline-flex;justify-content:center;color:var(--meta)}.tg-head .caret{flex:none;color:var(--meta);transition:transform var(--dur-1)}.tg-head .caret.open{transform:rotate(90deg)}.tg-sum{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tg-fail{flex:none;color:var(--danger)}.tg-fail:before{content:"\b7";margin-right:6px;color:var(--meta)}.tg-run{display:flex;align-items:center;gap:8px;min-height:22px;padding-left:6px;color:var(--muted);font-size:var(--chat-fs-s);min-width:0;overflow:hidden;white-space:nowrap}.tg-run-text{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ts-noerr{color:var(--meta);font-size:var(--chat-fs-s);margin-bottom:4px}.tg-list{margin:0;padding:0}.tg.open>.tg-list{margin:2px 0 0 13px;padding-left:6px;border-left:1px solid var(--line)}.ts-head{display:flex;align-items:center;gap:8px;width:100%;min-height:26px;padding:0 6px;overflow:hidden;border-radius:var(--r-s);font-size:var(--chat-fs-s);text-align:left;color:var(--muted);white-space:nowrap}.ts-head:hover,.ts.open>.ts-head{background:var(--surface-hover);color:var(--fg)}.ts-ic{width:14px;flex:none;display:inline-flex;justify-content:center;color:var(--meta)}.ts-head:hover .ts-ic{color:var(--muted)}.ts-title{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ts-title.mono{font-family:var(--font-mono);font-size:var(--chat-code-fs)}.ts-think .ts-head{color:var(--meta)}.ts-think .rs-body{margin-left:28px}.ts-diff{flex:none;display:inline-flex;gap:5px;font-family:var(--font-mono);font-size:var(--chat-code-fs);font-variant-numeric:tabular-nums;color:var(--meta)}.ts-diff .add{color:var(--muted)}.ts-meta{flex:none;color:var(--meta);font-variant-numeric:tabular-nums}.ts-meta.err{color:var(--danger)}.ts-st{flex:none;width:14px;display:inline-flex;align-items:center;justify-content:center;margin-left:auto;color:var(--meta)}.ts-st.ok{color:var(--muted)}.ts-st.fail{color:var(--danger)}.ts.failed>.ts-head .ts-title{color:var(--fg)}.spin{display:inline-block;width:10px;height:10px;flex:none;border-radius:50%;border:1.5px solid color-mix(in oklab,var(--fg) 18%,transparent);border-top-color:var(--accent-2);animation:ac-spin .8s linear infinite}@keyframes ac-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spin{animation-duration:2.4s}}.ts-out{margin:2px 6px 6px 28px}.ts-out pre{background:var(--code-bg);border-radius:var(--r-s);padding:8px 10px;font-family:var(--font-mono);font-size:var(--chat-code-fs);line-height:1.5;overflow-x:auto;white-space:pre-wrap;word-break:break-all;margin:0}.ts-more{font-size:var(--chat-fs-s);color:var(--accent);margin-bottom:4px}.diff{margin:2px 6px 6px 28px;border:1px solid var(--line);border-radius:var(--r-m);overflow:hidden}.diff-path{padding:4px 10px;font-size:var(--chat-code-fs);color:var(--muted);background:var(--surface);border-bottom:1px solid var(--line);font-family:var(--font-mono)}.diff-pre{margin:0;padding:6px 0;font-family:var(--font-mono);font-size:var(--chat-code-fs);line-height:1.5;overflow-x:auto}.dh-head{display:block;color:var(--muted);padding:0 10px}.dl{display:block;padding:0 10px;white-space:pre-wrap;word-break:break-all}.dl.add{background:var(--add-bg)}.dl.del{background:var(--del-bg)}.card{margin:8px 0;border-radius:10px;padding:12px 14px}.card.plan{border:1px solid var(--line)}.card.perm{border:1px solid color-mix(in oklab,var(--warn) 30%,var(--bg));background:color-mix(in oklab,var(--warn) 3%,var(--bg))}.card.perm.done{border-color:var(--line);opacity:.75}.card.ask{border:1px solid color-mix(in oklab,var(--info) 45%,var(--bg))}.card.ask.done{border-color:var(--line);opacity:.75}.err-card{border:1px solid color-mix(in oklab,var(--danger) 45%,var(--bg))}.err-line{color:var(--danger);font-size:var(--chat-fs)}.perm-title{font-size:var(--chat-fs);font-weight:500}.perm-cmd{margin:8px 0 0;background:var(--code-bg);border-radius:var(--r-s);padding:8px 10px;font-family:var(--font-mono);font-size:var(--chat-code-fs);white-space:pre-wrap;word-break:break-all}.perm-path{margin-top:6px;font-family:var(--font-mono);font-size:var(--chat-code-fs);color:var(--muted)}.perm-btns{display:flex;gap:8px;margin-top:10px}.perm-done{margin-top:8px;font-size:var(--chat-fs-s);color:var(--muted)}.ask-q{margin-bottom:10px}.ask-t{font-size:var(--chat-fs);font-weight:500;margin-bottom:6px}.ask-opts{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:6px}.ask-free,.ask .btn.primary{margin-top:4px}.nt{margin:8px 0;text-align:center;font-size:var(--chat-fs-s);color:var(--muted)}.nt.warn{color:var(--warn)}.nt.error{color:var(--danger)}.nt-bash{text-align:left;padding:10px 12px;border:1px solid var(--line);border-radius:var(--r-m);line-height:1.6}.nt-actions{display:flex;gap:8px;margin-top:8px;flex-wrap:wrap}.te{display:flex;flex-wrap:wrap;justify-content:flex-start;align-items:center;gap:2px 4px;margin:6px 0 18px -6px;font-size:var(--chat-fs-s);color:var(--meta);min-width:0}.te-m{display:inline-flex;align-items:center;gap:4px;padding:0 4px;height:24px;font-variant-numeric:tabular-nums;white-space:nowrap;min-width:0;max-width:100%}.te-m>span{overflow:hidden;text-overflow:ellipsis}.te-m svg{flex:none}.te-act{height:24px;min-width:24px;display:inline-flex;align-items:center;justify-content:center;gap:4px;padding:0 6px;border-radius:var(--r-s);color:var(--meta);white-space:nowrap}.te-act:hover{background:var(--surface-hover);color:var(--fg)}.te-files{color:var(--accent);font-size:inherit;margin-left:6px}.te-files:hover{text-decoration:underline}.empty-wrap{min-height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding-bottom:14vh}.cp-hero-t{font-size:var(--fs-hero);font-weight:600}.cp-hero-s{margin-top:6px;font-size:var(--fs-s);color:var(--muted)}.empty-actions{margin-top:16px}.workspace-empty{padding-bottom:10vh}.q-list{max-width:var(--col);margin:0 auto 6px;display:flex;flex-direction:column;gap:4px}.q-item{display:flex;align-items:center;gap:8px;padding:4px 10px;background:var(--surface);border-radius:var(--r-s);font-size:var(--fs-s)}.q-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.q-item .ibtn{width:20px;height:20px}a.ac-local{cursor:pointer}.ts-out pre a.ac-local,.md pre a.ac-local{color:inherit;text-decoration:underline;text-decoration-color:color-mix(in oklab,currentColor 45%,transparent);text-underline-offset:2px}.md code a.ac-local{color:inherit}.mention{display:inline-flex;align-items:center;gap:4px;max-width:260px;height:22px;padding:0 6px;border-radius:var(--r-s);background:var(--chip-bg);border:1px solid var(--chip-line);color:var(--pill-fg);font-size:var(--fs-s);font-family:var(--font-mono);white-space:nowrap;vertical-align:middle}.mention svg{flex:none}.mention-name{min-width:0;overflow:hidden;text-overflow:ellipsis}.um-mentions{display:flex;flex-wrap:wrap;gap:4px;margin:2px 0 4px;white-space:normal}.um .mention{background:color-mix(in oklab,var(--fg) 5%,var(--accent-soft))}.qs-pop{position:fixed;z-index:60;display:inline-flex;align-items:center;gap:5px;height:30px;padding:0 10px;border-radius:8px;border:1px solid var(--line);background:var(--bg);color:var(--fg);font-size:var(--fs-s);box-shadow:0 4px 14px #0000001f,0 1px 2px #00000014;white-space:nowrap;cursor:pointer;user-select:none;-webkit-user-select:none}.qs-pop:hover{background:var(--surface-hover)}.qs-pop svg{flex:none;color:var(--muted)}.um-quote{display:block;margin:2px 0 6px;padding-left:8px;border-left:2px solid color-mix(in oklab,var(--fg) 30%,transparent);color:var(--muted);font-size:var(--chat-fs-s);max-height:7.5em;overflow:hidden}.apv{margin:0 0 8px;min-width:0}.apv-head{display:flex;align-items:center;gap:8px;width:100%;min-height:26px;padding:0 6px;overflow:hidden;border-radius:var(--r-s);color:var(--muted);font-size:var(--chat-fs-s);text-align:left;white-space:nowrap}.apv-head:hover,.apv.open>.apv-head{color:var(--fg);background:var(--surface-hover)}.apv-head .caret{flex:none;color:var(--meta);transition:transform var(--dur-1)}.apv-head .caret.open{transform:rotate(90deg)}.apv-ic{width:14px;flex:none;display:inline-flex;justify-content:center;color:var(--auto-fg, var(--warn))}.apv-n{flex:none}.apv-peek{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--meta);font-family:var(--font-mono);font-size:var(--chat-code-fs)}.apv-peek:before{content:"\b7";margin-right:8px;font-family:var(--font-ui)}.apv-list{margin:2px 0 0 13px;padding-left:6px;border-left:1px solid var(--line)}.apv-row{display:flex;align-items:center;gap:8px;min-height:26px;padding:0 6px;min-width:0;overflow:hidden;white-space:nowrap;border-radius:var(--r-s);color:var(--muted);font-size:var(--chat-fs-s)}.apv-row:hover{background:var(--surface-hover);color:var(--fg)}.apv-cmd,.apv-path,.apv-title{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.apv-cmd,.apv-path{font-family:var(--font-mono);font-size:var(--chat-code-fs)}.apv-meta{flex:none;margin-left:auto;color:var(--meta);font-size:var(--fs-xs)}.nt-auto{text-align:left;padding:10px 12px;border:1px solid var(--line);border-radius:var(--r-m);line-height:1.6;color:var(--text)}.nt-auto-h{display:flex;align-items:center;gap:6px;margin-bottom:2px}.composer{flex:none;padding:0 16px 16px}.cp-card{width:100%;max-width:var(--col);margin:0 auto;background:var(--bg);border-radius:14px;border:1px solid var(--cp-line);padding:12px 12px 8px 14px;box-shadow:0 1px 2px #0000000a;transition:border-color var(--dur-2) var(--ease),box-shadow var(--dur-2) var(--ease)}.cp-card:focus-within{border-color:var(--cp-focus);box-shadow:0 0 0 3px var(--cp-ring),0 1px 2px #0000000a}.cp-card.waiting{border-color:color-mix(in oklab,var(--warn) 45%,var(--bg))}:root{--auto-fg: #b45309;--auto-bg: color-mix(in oklab, #f59e0b 10%, var(--bg));--auto-line: color-mix(in oklab, #d97706 40%, var(--bg))}:root[data-theme=dark]{--auto-fg: #fbbf24;--auto-bg: color-mix(in oklab, #f59e0b 13%, var(--bg));--auto-line: color-mix(in oklab, #f59e0b 42%, var(--bg))}.cp-auto-on{max-width:var(--col);margin:0 auto 4px;display:flex;align-items:center;gap:6px;min-width:0;height:22px;padding:0 4px;white-space:nowrap;overflow:hidden;color:var(--muted);font-size:var(--fs-s);line-height:22px}.cp-auto-ic{flex:none;display:inline-flex;color:var(--auto-fg)}.cp-auto-t{flex:0 1 auto;min-width:0;display:inline-flex;align-items:center;gap:6px;overflow:hidden;cursor:help;border-radius:var(--r-s)}.cp-auto-t:focus-visible{outline:2px solid var(--auto-line);outline-offset:1px}.cp-auto-t b{min-width:0;overflow:hidden;text-overflow:ellipsis;color:var(--auto-fg);font-weight:600}.cp-auto-on .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.cp-auto-back{flex:none;margin-left:auto;padding:0 2px;border:0;background:none;white-space:nowrap;color:var(--fg);font-size:var(--fs-s);text-decoration:underline;text-underline-offset:2px;text-decoration-color:color-mix(in oklab,var(--fg) 35%,transparent);cursor:pointer}.cp-auto-back:hover{text-decoration-color:currentColor}.cp-card.auto-on{border-color:var(--auto-line)}.cp-card.auto-on:focus-within{border-color:var(--auto-fg)}.cp-hint{max-width:var(--col);margin:6px auto 0;font-size:var(--fs-xs);color:var(--meta);text-align:center}.att-note{padding:6px 10px 0;color:var(--muted);font-size:var(--fs-s)}.cp-ta-wrap{position:relative}.slash-pop{position:absolute;left:0;right:0;bottom:100%;margin-bottom:6px;max-height:min(240px,40vh);overflow:hidden;display:flex;flex-direction:column;z-index:20}.slash-pop .ap-scroll{max-height:inherit}.slash-pop .slash-h{padding:4px 10px 2px;font-size:var(--fs-xs);color:var(--muted);text-transform:uppercase;letter-spacing:.04em}.slash-pop .mi.slash-item{height:auto;min-height:28px;padding:4px 10px;flex-direction:column;align-items:flex-start;gap:0}.slash-pop .slash-name{font-weight:500}.slash-pop .slash-desc{font-size:var(--fs-s);color:var(--muted);line-height:1.3}.slash-pop .slash-hint{font-size:var(--fs-s);color:var(--muted);font-family:var(--font-mono)}.slash-pop .mi.slash-item.sel{background:var(--surface-hover)}.cp-ta{width:100%;border:0;resize:none;background:none;outline:none;color:var(--text);font-size:var(--chat-fs);line-height:calc(var(--chat-fs) * 1.62);min-height:34px;max-height:calc(var(--chat-fs) * 1.62 * 12);overflow-y:auto;display:block;padding:0}.cp-ta::placeholder{color:var(--meta)}.cp-bar{display:flex;align-items:center;flex-wrap:wrap;gap:2px;margin:4px 0 0 -6px;min-width:0}.pill-wrap{position:relative;flex:0 1 auto;min-width:0;max-width:100%}.pill{position:relative;display:inline-flex;align-items:center;gap:5px;height:26px;padding:0 8px;border-radius:7px;background:none;color:var(--pill-fg, var(--muted));border:1px solid transparent;font-size:var(--fs-s);max-width:min(240px,100%);min-width:0;white-space:nowrap;cursor:pointer;transition:background var(--dur-1)}.pill:hover{background:var(--surface-hover)}.pill svg{flex:none}.pill.chip{background:var(--chip-bg);border-color:var(--chip-line);padding:0 8px 0 4px;gap:6px;max-width:min(300px,100%)}.pill.chip:hover{background:var(--surface-hover)}.chip-logo{border-radius:5px}.chip-caret{color:var(--meta)}.pill .p-a{font-weight:500;color:var(--fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex:0 0 auto;max-width:120px}.pill .p-t{color:var(--meta);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex:1 1 auto}.pill .p-t:before{content:"\b7";margin-right:5px}.ipill .ip-l{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.ipill:focus-visible{outline:2px solid color-mix(in oklab,var(--accent) 45%,var(--bg));outline-offset:-1px}.ipill[aria-expanded=true]{background:var(--surface-hover)}.ipill.danger{color:var(--danger)}.cp-bar .pill{height:24px;border-radius:6px;background:var(--chip-bg);border-color:var(--chip-line);padding:0 6px 0 7px;gap:5px}.cp-bar .pill:hover,.cp-bar .pill[aria-expanded=true]{background:var(--surface-hover)}.cp-bar .pill.chip{padding:0 6px 0 3px}.cp-bar .pill.chip .chip-logo{width:16px;height:16px}.cp-bar .ipill.danger{border-color:color-mix(in oklab,var(--danger) 35%,var(--chip-line))}.cp-bar{gap:4px}.cp-tasks{max-width:var(--col);margin:0 auto 6px;display:flex}.tasks-pill{display:inline-flex;align-items:center;gap:5px;height:22px;padding:0 8px;border-radius:var(--r-full);border:1px solid var(--chip-line);background:var(--bg);color:var(--muted);font-size:var(--fs-xs);font-variant-numeric:tabular-nums}.tasks-pill:hover{color:var(--fg);background:var(--surface-hover)}.tasks-pill svg{flex:none;color:var(--meta)}.ipill.auto,.cp-bar .ipill.auto{color:var(--auto-fg);background:var(--auto-bg);border-color:var(--auto-line);font-weight:600}.ipill.auto:hover,.ipill.auto[aria-expanded=true],.cp-bar .ipill.auto:hover,.cp-bar .ipill.auto[aria-expanded=true]{background:color-mix(in oklab,var(--auto-fg) 16%,var(--bg))}.ipill.auto svg{color:var(--auto-fg)}.mi.warn .sm-label{color:var(--auto-fg)}.ipill.static{cursor:default}.mode-menu{max-width:300px}.cp-div{width:1px;height:14px;background:var(--line);margin:0 4px;flex:none}.cp-bar>.ibtn{flex:none}.cp-attach{color:var(--pill-fg, var(--muted))}.cp-card{container-type:inline-size;container-name:composer}@container composer (max-width: 520px){.pill .p-t{display:none}.pill{max-width:min(160px,100%)}.ipill .ip-l{max-width:64px}}@container composer (max-width: 380px){.pill{max-width:min(120px,100%);padding:0 6px}.ipill .ip-l{display:none}}.pop{position:absolute;bottom:32px;left:0;z-index:55;width:260px;background:var(--bg);border-radius:var(--r-m);box-shadow:var(--shadow-pop);padding:4px;max-height:60vh;overflow-y:auto}.agent-picker{width:min(300px,calc(100vw - 32px));padding:0;overflow:hidden;display:flex;flex-direction:column;max-height:min(420px,60vh)}.agent-picker .ap-search{display:flex;align-items:center;gap:8px;padding:8px 10px;border-bottom:1px solid var(--line);flex:none;color:var(--muted)}.agent-picker .ap-search-in{flex:1;min-width:0;border:0;background:none;outline:none;font-size:var(--fs-s);color:var(--fg)}.agent-picker .ap-search-in::placeholder{color:var(--muted)}.agent-picker .ap-refresh{flex:none;width:24px;height:24px;margin:-2px -4px -2px 0;padding:0;border:0;border-radius:var(--r-s);background:transparent;color:var(--muted);display:inline-flex;align-items:center;justify-content:center;cursor:pointer}.agent-picker .ap-refresh:hover:not(:disabled){color:var(--fg);background:var(--surface-hover)}.agent-picker .ap-refresh:disabled{opacity:.45;cursor:default}.agent-picker .ap-refresh.spinning svg{animation:ac-spin .8s linear infinite}@media(prefers-reduced-motion:reduce){.agent-picker .ap-refresh.spinning svg{animation-duration:2.4s}}.agent-picker .ap-scroll{overflow-y:auto;padding:4px;flex:1;min-height:0}.agent-picker .ap-empty{padding:12px 10px;font-size:var(--fs-s);color:var(--muted);text-align:center}.agent-picker .ap-back{font-weight:600;margin-bottom:2px}.agent-picker .ap-back-icon{display:inline-flex;transform:rotate(180deg);margin-right:2px}.agent-picker .mi-row{display:flex;align-items:center;gap:6px;width:100%;text-align:left}.agent-picker .provider-pick-row{justify-content:space-between;gap:8px}.agent-picker .provider-pick-name{flex:0 1 auto;min-width:5.5rem;max-width:58%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500;color:inherit}.agent-picker .provider-pick-meta{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:flex-end;gap:6px;min-width:0;margin-left:auto}.agent-picker .provider-pick-meta .dlg-hint{flex:none;font-size:10px;max-width:5rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.agent-picker .mi-row .mi-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.agent-picker .mi-row .mi-sub{flex:none;max-width:38%;font-size:var(--fs-xs);color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.agent-picker .model-pick-row{min-width:0}.agent-picker .model-pick-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.agent-picker .model-pick-default{flex:0 1 58%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.agent-picker .mi-meta{flex:none;font-size:var(--fs-xs);color:var(--muted);white-space:nowrap}.agent-picker .mi-tag{flex:none;font-size:10px;color:var(--accent)}.agent-picker .mi-caret{flex:none;color:var(--muted);display:inline-flex}.agent-picker .mi-check{flex:none;margin-left:auto;color:var(--accent)}.ap-sec{padding:4px 0}.ap-sec .tinput{height:26px;margin-bottom:4px}.ap-sec .mi{height:26px;font-size:var(--fs-s)}.att-bar{display:flex;flex-wrap:wrap;gap:6px;padding:0 0 6px}.att{display:inline-flex;align-items:center;gap:6px;height:26px;padding:0 8px;background:var(--surface-hover);border-radius:var(--r-s);font-size:var(--fs-s)}.att img{width:22px;height:22px;object-fit:cover;border-radius:4px}.att.up{opacity:.6}.att-name{max-width:160px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.att-x{color:var(--muted);font-size:14px;line-height:1}.att-x:hover{color:var(--fg)}.cp-right{margin-left:auto;flex:none;display:flex;align-items:center;gap:8px}.cp-clock{font-size:var(--fs-s);color:var(--meta);font-variant-numeric:tabular-nums}.cp-send,.cp-stop{width:30px;height:30px;border-radius:50%;flex:none;display:inline-flex;align-items:center;justify-content:center;transition:filter var(--dur-1),opacity var(--dur-1)}.cp-send{background:var(--accent);color:var(--accent-fg)}.cp-send:hover{filter:brightness(1.08)}.cp-send[disabled]{opacity:.35;cursor:default;filter:none}.cp-stop{background:var(--fg);color:var(--bg)}.cp-stop:hover{filter:brightness(1.15)}@media(max-width:560px){.composer{padding:0 10px 10px}}.cp-card.drop-on{outline:1.5px dashed var(--cp-focus);outline-offset:2px}.cp-drop-hint{padding:4px 10px 0;font-size:var(--fs-s);color:var(--muted)}.att-bar .mention{height:24px}.qchip{display:inline-flex;align-items:center;gap:5px;height:24px;max-width:260px;padding:0 4px 0 8px;border-radius:6px;background:var(--surface-hover);color:var(--fg);font-size:var(--fs-s);min-width:0;border-left:2px solid color-mix(in oklab,var(--fg) 35%,transparent)}.qchip svg{flex:none;color:var(--muted)}.qchip-t{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.qchip-n{flex:none;color:var(--meta)}.qchip .att-x{flex:none;width:18px;height:18px;border-radius:4px}.qchip .att-x:hover{background:color-mix(in oklab,var(--fg) 10%,transparent)}.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;inset:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;inset:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{font-family:monospace;user-select:text;white-space:pre}.xterm .xterm-accessibility-tree>div{transform-origin:left;width:fit-content}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;background:#0000;transition:opacity .1s linear;z-index:11}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{position:absolute;display:none}.xterm .xterm-scrollable-element>.shadow.top{display:block;top:0;left:3px;height:3px;width:100%;box-shadow:var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.left{display:block;top:3px;left:0;height:100%;width:3px;box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.top-left-corner{display:block;top:0;left:0;height:3px;width:3px}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset} /*! Bundled license information: @xterm/xterm/css/xterm.css: diff --git a/packages/agent-console/app/app.js b/packages/agent-console/app/app.js index 61ad5f0..f99db70 100644 --- a/packages/agent-console/app/app.js +++ b/packages/agent-console/app/app.js @@ -1,25 +1,30 @@ -(()=>{var L2=Object.create;var kd=Object.defineProperty;var I2=Object.getOwnPropertyDescriptor;var z2=Object.getOwnPropertyNames;var B2=Object.getPrototypeOf,P2=Object.prototype.hasOwnProperty;var ky=e=>{throw TypeError(e)};var H2=(e,t,i)=>t in e?kd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var ae=(e,t,i)=>()=>{if(i)throw i[0];try{return e&&(t=e(e=0)),t}catch(n){throw i=[n],n}};var we=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(i){throw t=0,i}},U2=(e,t)=>{for(var i in t)kd(e,i,{get:t[i],enumerable:!0})},q2=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of z2(t))!P2.call(e,r)&&r!==i&&kd(e,r,{get:()=>t[r],enumerable:!(n=I2(t,r))||n.enumerable});return e};var ne=(e,t,i)=>(i=e!=null?L2(B2(e)):{},q2(t||!e||!e.__esModule?kd(i,"default",{value:e,enumerable:!0}):i,e));var me=(e,t,i)=>H2(e,typeof t!="symbol"?t+"":t,i),F2=(e,t,i)=>t.has(e)||ky("Cannot "+i);var Cy=(e,t,i)=>t.has(e)?ky("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i);var dm=(e,t,i)=>(F2(e,t,"access private method"),i);var Ty,Ny,hm=ae(()=>{Ty=e=>{let t,i=new Set,n=(c,u)=>{let d=typeof c=="function"?c(t):c;if(!Object.is(d,t)){let h=t;t=u??(typeof d!="object"||d===null)?d:Object.assign({},t,d),i.forEach(f=>f(t,h))}},r=()=>t,o={setState:n,getState:r,getInitialState:()=>l,subscribe:c=>(i.add(c),()=>i.delete(c))},l=t=e(n,r,o);return o},Ny=(e=>e?Ty(e):Ty)});var qy=we(Te=>{"use strict";var mm=Symbol.for("react.transitional.element"),W2=Symbol.for("react.portal"),$2=Symbol.for("react.fragment"),K2=Symbol.for("react.strict_mode"),G2=Symbol.for("react.profiler"),j2=Symbol.for("react.consumer"),Y2=Symbol.for("react.context"),V2=Symbol.for("react.forward_ref"),X2=Symbol.for("react.suspense"),Z2=Symbol.for("react.memo"),Dy=Symbol.for("react.lazy"),Q2=Symbol.for("react.activity"),J2=Symbol.for("react.view_transition"),Ay=Symbol.iterator;function eD(e){return e===null||typeof e!="object"?null:(e=Ay&&e[Ay]||e["@@iterator"],typeof e=="function"?e:null)}var Ly={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Iy=Object.assign,zy={};function Fo(e,t,i){this.props=e,this.context=t,this.refs=zy,this.updater=i||Ly}Fo.prototype.isReactComponent={};Fo.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Fo.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function By(){}By.prototype=Fo.prototype;function gm(e,t,i){this.props=e,this.context=t,this.refs=zy,this.updater=i||Ly}var _m=gm.prototype=new By;_m.constructor=gm;Iy(_m,Fo.prototype);_m.isPureReactComponent=!0;var My=Array.isArray;function pm(){}var ft={H:null,A:null,T:null,S:null},Py=Object.prototype.hasOwnProperty;function vm(e,t,i){var n=i.ref;return{$$typeof:mm,type:e,key:t,ref:n!==void 0?n:null,props:i}}function tD(e,t){return vm(e.type,t,e.props)}function bm(e){return typeof e=="object"&&e!==null&&e.$$typeof===mm}function iD(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(i){return t[i]})}var Oy=/\/+/g;function fm(e,t){return typeof e=="object"&&e!==null&&e.key!=null?iD(""+e.key):t.toString(36)}function nD(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(pm,pm):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function qo(e,t,i,n,r){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(s){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case mm:case W2:a=!0;break;case Dy:return a=e._init,qo(a(e._payload),t,i,n,r)}}if(a)return r=r(e),a=n===""?"."+fm(e,0):n,My(r)?(i="",a!=null&&(i=a.replace(Oy,"$&/")+"/"),qo(r,t,i,"",function(c){return c})):r!=null&&(bm(r)&&(r=tD(r,i+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(Oy,"$&/")+"/")+a)),t.push(r)),1;a=0;var o=n===""?".":n+":";if(My(e))for(var l=0;l{"use strict";Fy.exports=qy()});function oD(e,t=aD){let i=Td.default.useSyncExternalStore(e.subscribe,Td.default.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return Td.default.useDebugValue(i),i}var Td,aD,Wy,qn,$y=ae(()=>{Td=ne(pt(),1);hm();aD=e=>e;Wy=e=>{let t=Ny(e),i=n=>oD(t,n);return Object.assign(i,t),i},qn=(e=>e?Wy(e):Wy)});var Ra=ae(()=>{hm();$y()});function lD(e){let t=e.toLowerCase().replace(/^\[|\]$/g,"");if(t==="localhost"||t.endsWith(".localhost"))return/^[a-z0-9.-]+$/.test(t)&&!t.includes("..");if(t==="0.0.0.0"||t==="::1"||t==="::")return!0;let i=/^127\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(t);return!!i&&i.slice(1).every(n=>Number(n)<=255)}function cD(e){return e==="localhost"||e.endsWith(".localhost")?["127.0.0.1","::1"]:e==="0.0.0.0"?["127.0.0.1"]:e==="::1"?["::1"]:e==="::"?["::1","127.0.0.1"]:[e]}function uD(e){let t=e.trim();return/^\d{1,5}$/.test(t)?`http://localhost:${t}/`:/^:\d{1,5}(?:[/?#].*)?$/.test(t)?`http://localhost${t}`:/^[a-z][a-z0-9+.-]*:\/\//i.test(t)||/^[a-z][a-z0-9+.-]*:(?!\d)/i.test(t)?t:`http://${t}`}function ns(e){if(typeof e!="string"||!e.trim())return{ok:!1,reason:"empty"};if(e.length>2048)return{ok:!1,reason:"too_long"};let t;try{t=new URL(uD(e))}catch{return{ok:!1,reason:"bad_url"}}if(t.protocol!=="http:"&&t.protocol!=="https:")return{ok:!1,reason:"scheme"};if(t.username||t.password)return{ok:!1,reason:"userinfo"};let i=t.hostname.toLowerCase().replace(/^\[|\]$/g,"");if(!lD(i))return{ok:!1,reason:"not_local"};let n=t.protocol==="https:",r=t.port?Number(t.port):n?443:80;if(!Number.isInteger(r)||r<1||r>65535)return{ok:!1,reason:"port"};let s=t.href;if(s.length>2048)return{ok:!1,reason:"too_long"};let a=i.includes(":")?`[${i}]`:i;return{ok:!0,target:{href:s,origin:`${t.protocol}//${a}:${r}`,path:`${t.pathname}${t.search}${t.hash}`,secure:n,hostname:i,port:r,connect:cD(i),hostHeader:`${a}:${r}`}}}function Ky(e,t,i){return e.startsWith(t)?ym(i)+e.slice(t.length):e}function ym(e){return e.replace(/^http:\/\/(.+):80$/,"http://$1").replace(/^https:\/\/(.+):443$/,"https://$1")}function Sm(e){if(typeof e!="string"||!e||e.length>2048)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!=="http:"&&t.protocol!=="https:"||!t.hostname)return null;let i=t.href;return/[\s"'<>`\\^{|}]/.test(i)||i.length>2048?null:i}var Nd=ae(()=>{});var wm,Gy=ae(()=>{wm={zh:{app:{title:"Agent \u63A7\u5236\u53F0",subtitle:"\u5148\u5728\u5DE6\u4FA7\u65B0\u5EFA\u6216\u9009\u62E9\u4E00\u4E2A\u9879\u76EE"},common:{cancel:"\u53D6\u6D88",ok:"\u786E\u5B9A",save:"\u4FDD\u5B58",add:"\u6DFB\u52A0",browse:"\u6D4F\u89C8\u2026",more:"\u66F4\u591A",copy:"\u590D\u5236",copied:"\u5DF2\u590D\u5236",copyPath:"\u590D\u5236\u8DEF\u5F84",copiedPath:"\u5DF2\u590D\u5236\u8DEF\u5F84",search:"\u641C\u7D22",settings:"\u8BBE\u7F6E",remove:"\u79FB\u9664",close:"\u5173\u95ED",retry:"\u91CD\u8BD5",details:"\u8BE6\u60C5 \u203A",submit:"\u63D0\u4EA4",other:"\u5176\u4ED6\u2026",default:"\u9ED8\u8BA4",done:"\u5B8C\u6210",loading:"\u52A0\u8F7D\u4E2D\u2026",send:"\u53D1\u9001",stop:"\u505C\u6B62",refresh:"\u5237\u65B0",rename:"\u91CD\u547D\u540D",delete:"\u5220\u9664",discard:"\u653E\u5F03",notInstalled:"\uFF08\u672A\u5B89\u88C5\uFF09",notDetected:"\uFF08\u672A\u68C0\u6D4B\u5230\uFF09",current:"\uFF08\u5F53\u524D\uFF09",messages:"\u6761",imported:" \xB7 \u5DF2\u5BFC\u5165",justNow:"\u521A\u521A",minutesAgo:"{n} \u5206\u949F\u524D",hoursAgo:"{n} \u5C0F\u65F6\u524D",daysAgo:"{n} \u5929\u524D"},boot:{connecting:"\u6B63\u5728\u8FDE\u63A5\u2026",serviceDown:"\u672C\u5730\u670D\u52A1\u672A\u542F\u52A8",retry:"\u91CD\u8BD5",reconnecting:"\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u6B63\u5728\u91CD\u65B0\u8FDE\u63A5\u2026",starting:"\u6B63\u5728\u542F\u52A8\u672C\u5730\u670D\u52A1\u2026",reopening:"\u672C\u5730\u670D\u52A1\u5DF2\u91CD\u542F\uFF0C\u6B63\u5728\u91CD\u65B0\u8FDE\u63A5\u2026"},topbar:{pickThread:"\u9009\u62E9\u4E00\u4E2A\u5BF9\u8BDD",sidebar:"\u4FA7\u680F\uFF08Ctrl+B\uFF09",clickRename:"\u70B9\u51FB\u6539\u540D",waitAuth:"\u7B49\u5F85\u6388\u6743",showRequest:"\u67E5\u770B\u6388\u6743\u8BF7\u6C42",running:"\u8FD0\u884C\u4E2D {s}s",error:"\u51FA\u9519",closedResume:"\u5DF2\u5173\u95ED \xB7 \u53D1\u9001\u6D88\u606F\u5C06\u7EED\u63A5",threadInfo:"\u5BF9\u8BDD\u4FE1\u606F",panelChanges:"\u6539\u52A8\uFF08Ctrl+J\uFF09",panelFiles:"\u6587\u4EF6",panelTerminal:"\u7EC8\u7AEF"},sidebar:{newProject:"\u65B0\u5EFA\u9879\u76EE",collapse:"\u6536\u8D77\u4FA7\u680F",expand:"\u5C55\u5F00\u4FA7\u680F",filterPlaceholder:"\u8FC7\u6EE4\u5BF9\u8BDD\u6807\u9898",searchTitle:"\u641C\u7D22\uFF08Ctrl+K\uFF09",noProjectsTitle:"\u8FD8\u6CA1\u6709\u9879\u76EE",noProjectsSub:"\u9879\u76EE\u5BF9\u5E94\u4E00\u4E2A\u672C\u673A\u76EE\u5F55\uFF0C\u5BF9\u8BDD\u90FD\u5728\u76EE\u5F55\u91CC\u5E72\u6D3B\u3002",newThread:"\u65B0\u5EFA\u5BF9\u8BDD",projectMenu:"\u9879\u76EE\u83DC\u5355",showAll:"\u663E\u793A\u5168\u90E8 {n} \u6761",noThreads:"\u8FD8\u6CA1\u6709\u5BF9\u8BDD",rename:"\u91CD\u547D\u540D",pin:"\u7F6E\u9876",unpin:"\u53D6\u6D88\u7F6E\u9876",archive:"\u5F52\u6863",unarchive:"\u53D6\u6D88\u5F52\u6863",exportMd:"\u5BFC\u51FA Markdown",deleteThread:"\u5220\u9664\u5BF9\u8BDD",deleteThreadBody:"\u300C{title}\u300D\u5C06\u88AB\u79FB\u5230\u56DE\u6536\u76EE\u5F55\uFF0C\u786E\u5B9A\u5417\uFF1F",importHist:"\u5BFC\u5165\u5DF2\u6709\u5BF9\u8BDD\u2026",openExplorer:"\u5728\u8D44\u6E90\u7BA1\u7406\u5668\u6253\u5F00",showArchived:"\u663E\u793A\u5DF2\u5F52\u6863",hideArchived:"\u9690\u85CF\u5DF2\u5F52\u6863",archivedN:"\u5DF2\u5F52\u6863 {n} \u6761",archivedHint:"\u5DF2\u5F52\u6863\uFF0C\u53EF\u5728\u9879\u76EE\u5217\u8868\u5E95\u90E8\u67E5\u770B",unarchived:"\u5DF2\u53D6\u6D88\u5F52\u6863",exportSaved:"\u5DF2\u5BFC\u51FA\u5230 {path}",removeProject:"\u79FB\u9664\u9879\u76EE",removeProjectBody:"\u300C{name}\u300D\u5C06\u4ECE\u5217\u8868\u79FB\u9664\uFF0C\u5176\u5BF9\u8BDD\u79FB\u5230\u56DE\u6536\u76EE\u5F55\uFF08\u6587\u4EF6\u4E0D\u4F1A\u88AB\u5220\u9664\uFF09\u3002",renameProject:"\u91CD\u547D\u540D\u9879\u76EE",projectName:"\u9879\u76EE\u540D",newProjectDlg:"\u65B0\u5EFA\u9879\u76EE",dirLabel:"\u9879\u76EE\u76EE\u5F55\uFF08\u5FC5\u987B\u662F\u5DF2\u5B58\u5728\u7684\u6587\u4EF6\u5939\uFF09",dirMissing:"\u76EE\u5F55\u4E0D\u5B58\u5728",notDir:"\u8FD9\u662F\u4E00\u4E2A\u6587\u4EF6\uFF0C\u4E0D\u662F\u76EE\u5F55",dirOk:"\u2713 \u76EE\u5F55\u53EF\u7528\uFF0C\u9879\u76EE\u540D\u53D6\u76EE\u5F55\u540D",recent:"\u6700\u8FD1\u4F7F\u7528",pickFolderUnsupported:"\u5F53\u524D\u7CFB\u7EDF\u4E0D\u652F\u6301\u5F39\u7A97\u9009\u76EE\u5F55\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165",pickFolderFailed:"\u6253\u5F00\u6587\u4EF6\u5939\u9009\u62E9\u6846\u5931\u8D25",importTitle:"\u5BFC\u5165\u5DF2\u6709\u5BF9\u8BDD \u2014 {name}",scanning:"\u6B63\u5728\u626B\u63CF\u672C\u673A\u5386\u53F2\u4F1A\u8BDD\u2026",importEmpty:"\u6CA1\u6709\u627E\u5230\u5BF9\u5E94\u8FD9\u4E2A\u9879\u76EE\u76EE\u5F55\u7684\u5386\u53F2\u4F1A\u8BDD\u3002",importing:"\u5BFC\u5165\u4E2D\u2026",importN:"\u5BFC\u5165 {n} \u4E2A\u5BF9\u8BDD",importedN:"\u5DF2\u5BFC\u5165 {n} \u4E2A\u5BF9\u8BDD",failNewThread:"\u65B0\u5EFA\u5BF9\u8BDD\u5931\u8D25\uFF1A",failRename:"\u91CD\u547D\u540D\u5931\u8D25\uFF1A",failAddProject:"\u6DFB\u52A0\u9879\u76EE\u5931\u8D25\uFF1A",failImportList:"\u8BFB\u53D6\u5386\u53F2\u5931\u8D25\uFF1A",failImport:"\u5BFC\u5165\u5931\u8D25\uFF1A",failExport:"\u5BFC\u51FA\u5931\u8D25\uFF1A"},chat:{newInProject:"\u5728 {name} \u4E2D\u65B0\u5EFA\u5BF9\u8BDD",emptyHint:"\u5BF9\u8BDD\u8FD8\u6CA1\u6709\u6D88\u606F\uFF0C\u4E0B\u9762\u8F93\u5165\u5F00\u59CB\u3002",jumpBottom:"\u56DE\u5230\u5E95\u90E8",emptyPlaceholder:"\u8F93\u5165\u4EFB\u52A1\uFF0CEnter \u53D1\u9001",autoNewThread:"\u5C06\u81EA\u52A8\u65B0\u5EFA\u5BF9\u8BDD",pickProjectTitle:"\u9009\u62E9\u4E00\u4E2A\u9879\u76EE",pickProjectSub:"\u5728\u5DE6\u4FA7\u9009\u4E00\u4E2A\u9879\u76EE\uFF0C\u6216\u65B0\u5EFA\u4E00\u4E2A\uFF0C\u7136\u540E\u5F00\u59CB\u5BF9\u8BDD\u3002",failSend:"\u53D1\u9001\u5931\u8D25\uFF1A"},composer:{waitPerm:"\u7B49\u5F85\u4F60\u786E\u8BA4\u4E0A\u9762\u7684\u6388\u6743\u8BF7\u6C42",queuePlaceholder:"\u8F93\u5165\u6392\u961F\u6D88\u606F\uFF08Ctrl+Enter \u63D2\u8BDD\uFF09",queuePlaceholderNoSteer:"\u7EE7\u7EED\u8865\u5145\u8981\u6C42\uFF0C\u56DE\u8F66\u6392\u961F\u53D1\u9001\u2026",steerUnsupported:"{agent} \u4E0D\u652F\u6301\u63D2\u8BDD\uFF1A\u8FD0\u884C\u4E2D\u53D1\u7684\u6D88\u606F\u4F1A\u6392\u961F\uFF0C\u672C\u56DE\u5408\u7ED3\u675F\u540E\u518D\u53D1\u9001\u3002",queuedToast:"\u5DF2\u6392\u961F\uFF1A\u672C\u56DE\u5408\u7ED3\u675F\u540E\u53D1\u9001",steeredToast:"\u5DF2\u63D2\u8BDD",inputPlaceholder:"\u8F93\u5165\u6D88\u606F\uFF0C/ \u4F7F\u7528\u547D\u4EE4\u2026",autoWarn:"\u5168\u90E8\u81EA\u52A8\u540C\u610F\u4F1A\u8BA9 Agent \u4E0D\u7ECF\u8BE2\u95EE\u76F4\u63A5\u8FD0\u884C\u547D\u4EE4\u3001\u4FEE\u6539\u6587\u4EF6\uFF1ACodex \u5173\u95ED\u6C99\u7BB1\uFF08danger-full-access\uFF09\uFF0CClaude Code \u8DF3\u8FC7\u6240\u6709\u6743\u9650\u68C0\u67E5\uFF0C\u5176\u4ED6 Agent \u7684\u6388\u6743\u8BF7\u6C42\u7531\u63A7\u5236\u53F0\u81EA\u52A8\u300C\u5141\u8BB8\u4E00\u6B21\u300D\u3002\u8BF7\u8C28\u614E\u4F7F\u7528\u3002",autoOn:{title:"\u5168\u90E8\u81EA\u52A8\u540C\u610F\u5DF2\u5F00\u542F",back:"\u6539\u56DE\u6BCF\u6B21\u8BE2\u95EE",keeps:"\u8BA1\u5212\u786E\u8BA4\u548C\u63D0\u95EE\u4ECD\u4F1A\u95EE\u4F60\uFF1B\u6BCF\u6B21\u53EA\u540C\u610F\u5F53\u524D\u8FD9\u4E00\u4E2A\u8BF7\u6C42\uFF0C\u4E0D\u4F1A\u5199\u5165\u6C38\u4E45\u89C4\u5219\u3002"},autoDesc:{claude:"Claude Code \u4EE5 bypassPermissions \u8FD0\u884C\uFF1A\u8DF3\u8FC7\u6240\u6709\u6743\u9650\u68C0\u67E5\uFF0C\u547D\u4EE4\u548C\u6539\u6587\u4EF6\u90FD\u4E0D\u518D\u8BE2\u95EE\uFF08\u8BF7\u8C28\u614E\u4F7F\u7528\uFF09",codex:"Codex \u6C99\u7BB1\u5173\u95ED\uFF08danger-full-access\uFF09\u4E14\u4ECE\u4E0D\u8BE2\u95EE\uFF1A\u547D\u4EE4\u53EF\u8BFB\u5199\u6574\u53F0\u7535\u8111\u3001\u53EF\u8054\u7F51\uFF08\u8BF7\u8C28\u614E\u4F7F\u7528\uFF09",copilot:"Copilot Allow All\uFF1A\u6240\u6709\u5DE5\u5177\u8C03\u7528\u90FD\u4E0D\u518D\u786E\u8BA4\uFF08\u8BF7\u8C28\u614E\u4F7F\u7528\uFF09",devin:"Devin Bypass Permissions\uFF1A\u8DF3\u8FC7\u6240\u6709\u6743\u9650\u68C0\u67E5\uFF08\u8BF7\u8C28\u614E\u4F7F\u7528\uFF09",cursor:"Agent \u6A21\u5F0F\uFF0C\u6BCF\u4E2A\u6388\u6743\u8BF7\u6C42\u90FD\u7531\u63A7\u5236\u53F0\u81EA\u52A8\u300C\u5141\u8BB8\u4E00\u6B21\u300D\uFF1A\u547D\u4EE4\u548C\u6539\u6587\u4EF6\u76F4\u63A5\u6267\u884C\uFF08\u8BF7\u8C28\u614E\u4F7F\u7528\uFF09",opencode:"Build \u6A21\u5F0F\uFF0C\u6BCF\u4E2A\u6388\u6743\u8BF7\u6C42\u90FD\u7531\u63A7\u5236\u53F0\u81EA\u52A8\u300C\u5141\u8BB8\u4E00\u6B21\u300D\uFF1A\u547D\u4EE4\u548C\u6539\u6587\u4EF6\u76F4\u63A5\u6267\u884C\uFF08\u8BF7\u8C28\u614E\u4F7F\u7528\uFF09",generic:"\u6BCF\u4E2A\u6388\u6743\u8BF7\u6C42\u90FD\u7531\u63A7\u5236\u53F0\u81EA\u52A8\u300C\u5141\u8BB8\u4E00\u6B21\u300D\uFF1A\u547D\u4EE4\u548C\u6539\u6587\u4EF6\u76F4\u63A5\u6267\u884C\uFF0C\u4E0D\u518D\u8BE2\u95EE\uFF08\u8BF7\u8C28\u614E\u4F7F\u7528\uFF09",pi:"Pi \u672C\u8EAB\u4ECE\u4E0D\u8BE2\u95EE\uFF1A\u547D\u4EE4\u548C\u6539\u6587\u4EF6\u76F4\u63A5\u6267\u884C\uFF08\u6269\u5C55\u53D1\u8D77\u7684\u786E\u8BA4\u4ECD\u4F1A\u95EE\u4F60\uFF09"},imagesByPath:"{agent} \u4E0D\u80FD\u76F4\u63A5\u770B\u56FE\u7247\uFF1A\u4F1A\u628A\u56FE\u7247\u7684\u6587\u4EF6\u8DEF\u5F84\u53D1\u7ED9\u5B83\uFF08\u5B83\u80FD\u7528\u6587\u4EF6\u5DE5\u5177\u6253\u5F00\uFF09\u3002",agentModel:"Agent & model",agentLocked:"Agent (locked)",agent:"Agent",model:"Model",searchModel:"Search",searchAllModels:"Search models\u2026",providers:"Agent",agentLockedHint:"\u5DF2\u5F00\u59CB\u7684\u5BF9\u8BDD\u4E0D\u80FD\u66F4\u6362 Agent\uFF1B\u8981\u7528\u522B\u7684 Agent \u8BF7\u65B0\u5EFA\u5BF9\u8BDD\u3002",providersLoading:"\u6B63\u5728\u68C0\u6D4B Agent\u2026",moreModels:"\u8FD8\u6709 {n} \u4E2A\u6A21\u578B\uFF0C\u8BF7\u7528\u4E0A\u65B9\u641C\u7D22",pickModel:"\u9009\u62E9\u6A21\u578B",noModelMatch:"\u6CA1\u6709\u5339\u914D\u7684\u6A21\u578B",refreshModels:"\u5237\u65B0\u6A21\u578B\u5217\u8868",refreshingModels:"\u6B63\u5728\u5237\u65B0\u2026",defaultModel:"\u9ED8\u8BA4",defaultEffort:"\u9ED8\u8BA4",defaultEffortNamed:"\u9ED8\u8BA4\uFF08{level}\uFF09",effortTitle:"\u601D\u8003\u5F3A\u5EA6",modeTitle:"\u6743\u9650\u6A21\u5F0F",attachTitle:"\u9644\u4EF6\uFF08\u56FE\u7247/\u6587\u672C\uFF09",failSwitchAgent:"\u5207\u6362 Agent \u5931\u8D25\uFF1A",failSend:"\u53D1\u9001\u5931\u8D25\uFF1A",failUpload:"\u9644\u4EF6\u4E0A\u4F20\u5931\u8D25\uFF1A",uploadFailed:"\u4E0A\u4F20\u5931\u8D25",steerTag:"\u63D2\u8BDD",cursorAutoReview:"\u81EA\u52A8\u63A5\u53D7\u6743\u9650\u63D0\u793A\uFF08Auto-review\uFF09",cursorFastOff:"\u6807\u51C6\u901F\u5EA6",cursorFastOn:"Fast",slashGroupCommand:"\u547D\u4EE4",slashGroupSkill:"Skill",slashNoCommands:"\u8BE5 Agent \u672A\u63D0\u4F9B\u547D\u4EE4",slashLoading:"\u6B63\u5728\u83B7\u53D6\u547D\u4EE4\u2026",mode:{plan:{label:"\u89C4\u5212",desc:"\u53EA\u5206\u6790\u4EE3\u7801\u5E93\uFF0C\u4E0D\u6267\u884C\u5DE5\u5177\u6216\u4FEE\u6539"},default:{label:"\u6BCF\u6B21\u8BE2\u95EE",desc:"\u9996\u6B21\u4F7F\u7528\u5DE5\u5177\u65F6\u4F1A\u8BF7\u6C42\u6388\u6743"},acceptEdits:{label:"\u63A5\u53D7\u7F16\u8F91",desc:"\u81EA\u52A8\u6279\u51C6\u7F16\u8F91\u7C7B\u5DE5\u5177\uFF0C\u4E0D\u518D\u9010\u9879\u8BE2\u95EE"},bypass:{label:"\u5168\u90E8\u81EA\u52A8\u540C\u610F",desc:"\u4E0D\u518D\u8BE2\u95EE\uFF1ACodex \u5173\u95ED\u6C99\u7BB1\uFF0CClaude Code \u8DF3\u8FC7\u6240\u6709\u6743\u9650\u68C0\u67E5\uFF0C\u5176\u4ED6 Agent \u7684\u8BF7\u6C42\u81EA\u52A8\u300C\u5141\u8BB8\u4E00\u6B21\u300D\uFF08\u8BF7\u8C28\u614E\u4F7F\u7528\uFF09"},cursorBypass:{label:"\u5168\u90E8\u81EA\u52A8\u540C\u610F",desc:"Agent \u6A21\u5F0F\uFF0C\u6BCF\u4E2A\u6388\u6743\u8BF7\u6C42\u90FD\u7531\u63A7\u5236\u53F0\u81EA\u52A8\u300C\u5141\u8BB8\u4E00\u6B21\u300D\uFF08\u8BF7\u8C28\u614E\u4F7F\u7528\uFF09"},cursorAgent:{label:"Agent",desc:"\u5B8C\u6574 Agent\uFF1A\u53EF\u8BFB\u5199\u3001\u6267\u884C\u5DE5\u5177"},cursorPlan:{label:"\u89C4\u5212",desc:"\u53EA\u8BFB\u89C4\u5212\uFF1A\u5206\u6790\u5E76\u63D0\u51FA\u65B9\u6848\uFF0C\u4E0D\u6539\u6587\u4EF6"},cursorAsk:{label:"\u95EE\u7B54",desc:"\u95EE\u7B54\u6A21\u5F0F\uFF1A\u89E3\u91CA\u4E0E\u8BA8\u8BBA\uFF0C\u53EA\u8BFB"},pi:{label:"Pi \u672C\u8EAB\u4ECE\u4E0D\u8BE2\u95EE",desc:"Pi \u672C\u8EAB\u4ECE\u4E0D\u8BE2\u95EE\uFF1A\u547D\u4EE4\u548C\u6539\u6587\u4EF6\u76F4\u63A5\u6267\u884C\uFF08\u6269\u5C55\u53D1\u8D77\u7684\u786E\u8BA4\u4ECD\u4F1A\u95EE\u4F60\uFF09"}},agentMode:{Plan:"\u89C4\u5212",Build:"\u6784\u5EFA",Ask:"\u8BE2\u95EE",Code:"\u7F16\u7801",Agent:"Agent","Allow All":"\u5168\u90E8\u5141\u8BB8","Bypass Permissions":"\u8DF3\u8FC7\u6388\u6743","Read Only":"\u53EA\u8BFB",Auto:"\u81EA\u52A8","Full Access":"\u5B8C\u5168\u8BBF\u95EE"},effort:{low:"\u4F4E",medium:"\u4E2D",high:"\u9AD8",xhigh:"\u8D85\u9AD8",max:"\u6700\u9AD8",minimal:"\u6700\u4F4E",none:"\u5173\u95ED"}},settings:{contentWidth:"\u5185\u5BB9\u5BBD\u5EA6",widthNarrow:"\u7A84\uFF08640\uFF09",widthDefault:"\u9ED8\u8BA4\uFF08720\uFF09",widthWide:"\u5BBD\uFF08880\uFF09",widthFull:"\u94FA\u6EE1",bashPath:"Bash \u8DEF\u5F84\uFF08Windows\uFF09",bashCheck:"\u68C0\u6D4B",bashOk:"\u53EF\u7528\uFF1A{path}",bashUsing:"\u5F53\u524D\u4F7F\u7528\uFF1A{path}\uFF08{src}\uFF09",bashNone:"\u6CA1\u6709\u627E\u5230 Git Bash\u3002",bashManualBad:"\u624B\u52A8\u8DEF\u5F84\u4E0D\u53EF\u7528\uFF08{why}\uFF09\uFF0C\u5DF2\u6539\u7528\u81EA\u52A8\u68C0\u6D4B",bashHint:"Claude Code\u3001Pi\u3001dsh \u5728 Windows \u4E0A\u7528 Git Bash \u6267\u884C\u547D\u4EE4\u3002\u7559\u7A7A\u5C31\u81EA\u52A8\u68C0\u6D4B\uFF08git.exe \u65C1\u8FB9\u3001Program Files\u3001\u5404\u76D8\u7684 \\Git\uFF09\uFF1B\u88C5\u5728\u522B\u5904\u65F6\u586B bash.exe \u7684\u5B8C\u6574\u8DEF\u5F84\u3002",bashNotWindows:"\u53EA\u5728 Windows \u4E0A\u9700\u8981\u3002macOS \u548C Linux \u76F4\u63A5\u7528\u7CFB\u7EDF\u81EA\u5E26\u7684 bash\u3002",bashSrc:{manual:"\u624B\u52A8\u8BBE\u7F6E",env:"\u73AF\u5883\u53D8\u91CF",git:"git.exe \u65C1\u8FB9",known:"\u9ED8\u8BA4\u5B89\u88C5\u4F4D\u7F6E",drive:"\u5176\u4ED6\u76D8",path:"PATH"},bashBad:{empty:"\u8DEF\u5F84\u4E3A\u7A7A",relative:"\u8981\u586B\u5B8C\u6574\u8DEF\u5F84\uFF0C\u6BD4\u5982 E:\\Git\\bin\\bash.exe",notBash:"\u8981\u6307\u5411 bash.exe\uFF08\u6216 sh.exe\uFF09",wsl:"\u8FD9\u662F WSL \u7684 bash\uFF0C\u4E0D\u80FD\u7528",missing:"\u6587\u4EF6\u4E0D\u5B58\u5728"},chatFont:"\u804A\u5929\u5B57\u53F7",chatFontDefault:"\uFF08\u9ED8\u8BA4\uFF09",chatFontHint:"\u5BF9\u8BDD\u6B63\u6587\u3001\u8F93\u5165\u6846\u3001\u5DE5\u5177\u8F93\u51FA\u548C\u4EE3\u7801\u4E00\u8D77\u7F29\u653E\uFF08\u4EE3\u7801\u5C0F 1px\uFF09",title:"\u8BBE\u7F6E",defaultAgent:"\u9ED8\u8BA4 Agent",defaultMode:"\u9ED8\u8BA4\u6743\u9650\u6A21\u5F0F",theme:"\u4E3B\u9898",themeAuto:"\u8DDF\u968F\u7CFB\u7EDF",themeMagpie:"\u8DDF\u968F Magpie",themeLight:"\u6D45\u8272",themeDark:"\u6DF1\u8272",sendKey:"\u53D1\u9001\u952E",sendEnter:"Enter \u53D1\u9001 / Shift+Enter \u6362\u884C",sendCtrl:"Ctrl+Enter \u53D1\u9001 / Enter \u6362\u884C",runningSend:"\u8FD0\u884C\u4E2D\u518D\u53D1\u9001",queue:"\u6392\u961F\uFF08\u53D1\u5B8C\u81EA\u52A8\u7EE7\u7EED\uFF09",steer:"\u63D2\u8BDD\uFF08\u7ACB\u5373\u6253\u65AD\u5F53\u524D\u601D\u8DEF\uFF09",steerHint:"\u63D2\u8BDD\u53EA\u5BF9\u652F\u6301\u7684 Agent \u751F\u6548\uFF08\u76EE\u524D\u662F Codex\uFF09\uFF1B\u5176\u4ED6 Agent \u4ECD\u4F1A\u6392\u961F\uFF0C\u8F93\u5165\u6846\u4E0B\u65B9\u4F1A\u63D0\u793A\u3002",defaultModeHint:"\u65B0\u5BF9\u8BDD\u4F7F\u7528\uFF1B\u6BCF\u4E2A Agent \u4F1A\u6362\u6210\u81EA\u5DF1\u6700\u63A5\u8FD1\u7684\u6A21\u5F0F\uFF08\u4F8B\u5982 OpenCode \u53EA\u6709 Plan / Build\uFF0CBuild \u4F1A\u76F4\u63A5\u6539\u6587\u4EF6\uFF09\u3002\u9009\u300C\u5168\u90E8\u81EA\u52A8\u540C\u610F\u300D\u540E\uFF0C\u6240\u6709 Agent \u90FD\u4E0D\u518D\u5F39\u6388\u6743\u3002",thinking:"\u601D\u8003\u8FC7\u7A0B",showThinking:"\u663E\u793A Agent \u7684\u601D\u8003/\u63A8\u7406\u5185\u5BB9",idleClose:"\u7A7A\u95F2\u56DE\u6536",idleMinutes:"\u5206\u949F\u540E\u81EA\u52A8\u5173\u95ED\u7A7A\u95F2\u4F1A\u8BDD\uFF085\u2013240\uFF1B\u6700\u591A\u4FDD\u7559 3 \u4E2A\u7A7A\u95F2 Agent \u8FDB\u7A0B\uFF09",idleInvalid:"\u8BF7\u8F93\u5165 5 \u5230 240 \u4E4B\u95F4\u7684\u6574\u6570",versionLine:"\u7248\u672C v{ver} \xB7 PID {pid}",dataDir:"\u6570\u636E\u76EE\u5F55\uFF1A",failSave:"\u4FDD\u5B58\u5931\u8D25\uFF1A",providers:"Agent",providerOn:"\u53EF\u7528",providerOff:"\u5DF2\u7981\u7528",providerPending:"\u5C1A\u672A\u63A5\u5165",providerVerified:"\u5DF2\u9A8C\u8BC1",providerExperimental:"\u5B9E\u9A8C\u6027",providerPlanned:"\u672A\u63A5\u5165",providerModels:"{n} \u4E2A Model",providerRedetect:"\u91CD\u65B0\u68C0\u6D4B",providerCopyHint:"\u590D\u5236\u5B89\u88C5\u63D0\u793A",providerLaunchCmd:"\u81EA\u5B9A\u4E49\u542F\u52A8\uFF08\u9AD8\u7EA7\uFF09",providerLaunchExe:"\u53EF\u6267\u884C\u6587\u4EF6\u8DEF\u5F84\uFF08\u7559\u7A7A = \u81EA\u52A8\u67E5\u627E\uFF09",providerLaunchArgs:"\u9644\u52A0\u53C2\u6570\uFF08JSON \u6570\u7EC4\uFF09",providerLaunchArgsHint:'\u8FFD\u52A0\u5728\u5185\u7F6E\u53C2\u6570\u4E4B\u540E\uFF0C\u4F8B\u5982 ["--foo"]\uFF1B\u56DE\u8F66\u6216\u79BB\u5F00\u8F93\u5165\u6846\u65F6\u4FDD\u5B58\u3002\u65B0\u5BF9\u8BDD\u751F\u6548\u3002',providerArgsInvalid:'\u9700\u8981 JSON \u5B57\u7B26\u4E32\u6570\u7EC4\uFF0C\u4F8B\u5982 ["--foo"]',providerToggleFailed:"\u5207\u6362\u5931\u8D25\uFF0C\u5DF2\u6062\u590D\uFF1A"},palette:{aria:"\u547D\u4EE4\u9762\u677F",placeholder:"\u641C\u7D22\u5BF9\u8BDD\u3001\u9879\u76EE\u6216\u52A8\u4F5C\u2026",noMatch:"\u6CA1\u6709\u5339\u914D\u9879",hintAction:"\u52A8\u4F5C",hintThread:"\u5BF9\u8BDD",hintProject:"\u9879\u76EE",actNewThread:"\u65B0\u5EFA\u5BF9\u8BDD",actSettings:"\u6253\u5F00\u8BBE\u7F6E",actTheme:"\u5207\u6362\u4E3B\u9898",actChanges:"\u6253\u5F00\u6539\u52A8\u9762\u677F",actFiles:"\u6253\u5F00\u6587\u4EF6\u9762\u677F",actTerminal:"\u6253\u5F00\u7EC8\u7AEF\u9762\u677F",actImport:"\u5BFC\u5165\u5DF2\u6709\u5BF9\u8BDD\u2026",failNew:"\u65B0\u5EFA\u5931\u8D25\uFF1A"},panel:{changes:"\u6539\u52A8",files:"\u6587\u4EF6",terminal:"\u7EC8\u7AEF",closeTitle:"\u5173\u95ED\uFF08Ctrl+J\uFF09",pickProject:"\u5148\u9009\u4E00\u4E2A\u9879\u76EE",notGit:"\u8FD9\u4E2A\u9879\u76EE\u4E0D\u662F git \u4ED3\u5E93",clean:"\u5DE5\u4F5C\u533A\u5E72\u51C0",branch:"\u5F53\u524D\u5206\u652F",loadingDiff:"\u52A0\u8F7D diff\u2026",diffTooLarge:"diff \u8D85\u8FC7 1MB\uFF0C\u4E0D\u663E\u793A",discardTitle:"\u653E\u5F03\u6539\u52A8",discardUntracked:`\u653E\u5F03 {path} \u7684\u6539\u52A8\uFF1F +(()=>{var Z2=Object.create;var zd=Object.defineProperty;var Q2=Object.getOwnPropertyDescriptor;var J2=Object.getOwnPropertyNames;var eD=Object.getPrototypeOf,tD=Object.prototype.hasOwnProperty;var Iy=e=>{throw TypeError(e)};var iD=(e,t,i)=>t in e?zd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var te=(e,t,i)=>()=>{if(i)throw i[0];try{return e&&(t=e(e=0)),t}catch(n){throw i=[n],n}};var xe=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(i){throw t=0,i}},nD=(e,t)=>{for(var i in t)zd(e,i,{get:t[i],enumerable:!0})},rD=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of J2(t))!tD.call(e,r)&&r!==i&&zd(e,r,{get:()=>t[r],enumerable:!(n=Q2(t,r))||n.enumerable});return e};var ie=(e,t,i)=>(i=e!=null?Z2(eD(e)):{},rD(t||!e||!e.__esModule?zd(i,"default",{value:e,enumerable:!0}):i,e));var ge=(e,t,i)=>iD(e,typeof t!="symbol"?t+"":t,i),sD=(e,t,i)=>t.has(e)||Iy("Cannot "+i);var zy=(e,t,i)=>t.has(e)?Iy("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i);var _m=(e,t,i)=>(sD(e,t,"access private method"),i);var By,Py,vm=te(()=>{By=e=>{let t,i=new Set,n=(c,u)=>{let d=typeof c=="function"?c(t):c;if(!Object.is(d,t)){let h=t;t=u??(typeof d!="object"||d===null)?d:Object.assign({},t,d),i.forEach(f=>f(t,h))}},r=()=>t,o={setState:n,getState:r,getInitialState:()=>l,subscribe:c=>(i.add(c),()=>i.delete(c))},l=t=e(n,r,o);return o},Py=(e=>e?By(e):By)});var Zy=xe(Ne=>{"use strict";var Sm=Symbol.for("react.transitional.element"),aD=Symbol.for("react.portal"),oD=Symbol.for("react.fragment"),lD=Symbol.for("react.strict_mode"),cD=Symbol.for("react.profiler"),uD=Symbol.for("react.consumer"),dD=Symbol.for("react.context"),hD=Symbol.for("react.forward_ref"),fD=Symbol.for("react.suspense"),pD=Symbol.for("react.memo"),$y=Symbol.for("react.lazy"),mD=Symbol.for("react.activity"),gD=Symbol.for("react.view_transition"),Hy=Symbol.iterator;function _D(e){return e===null||typeof e!="object"?null:(e=Hy&&e[Hy]||e["@@iterator"],typeof e=="function"?e:null)}var Wy={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ky=Object.assign,Gy={};function Ko(e,t,i){this.props=e,this.context=t,this.refs=Gy,this.updater=i||Wy}Ko.prototype.isReactComponent={};Ko.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ko.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function jy(){}jy.prototype=Ko.prototype;function wm(e,t,i){this.props=e,this.context=t,this.refs=Gy,this.updater=i||Wy}var xm=wm.prototype=new jy;xm.constructor=wm;Ky(xm,Ko.prototype);xm.isPureReactComponent=!0;var Uy=Array.isArray;function ym(){}var vt={H:null,A:null,T:null,S:null},Yy=Object.prototype.hasOwnProperty;function Em(e,t,i){var n=i.ref;return{$$typeof:Sm,type:e,key:t,ref:n!==void 0?n:null,props:i}}function vD(e,t){return Em(e.type,t,e.props)}function km(e){return typeof e=="object"&&e!==null&&e.$$typeof===Sm}function bD(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(i){return t[i]})}var qy=/\/+/g;function bm(e,t){return typeof e=="object"&&e!==null&&e.key!=null?bD(""+e.key):t.toString(36)}function yD(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(ym,ym):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function Wo(e,t,i,n,r){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(s){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Sm:case aD:a=!0;break;case $y:return a=e._init,Wo(a(e._payload),t,i,n,r)}}if(a)return r=r(e),a=n===""?"."+bm(e,0):n,Uy(r)?(i="",a!=null&&(i=a.replace(qy,"$&/")+"/"),Wo(r,t,i,"",function(c){return c})):r!=null&&(km(r)&&(r=vD(r,i+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(qy,"$&/")+"/")+a)),t.push(r)),1;a=0;var o=n===""?".":n+":";if(Uy(e))for(var l=0;l{"use strict";Qy.exports=Zy()});function ED(e,t=xD){let i=Pd.default.useSyncExternalStore(e.subscribe,Pd.default.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return Pd.default.useDebugValue(i),i}var Pd,xD,Jy,$n,eS=te(()=>{Pd=ie(bt(),1);vm();xD=e=>e;Jy=e=>{let t=Py(e),i=n=>ED(t,n);return Object.assign(i,t),i},$n=(e=>e?Jy(e):Jy)});var Pa=te(()=>{vm();eS()});function kD(e){let t=e.toLowerCase().replace(/^\[|\]$/g,"");if(t==="localhost"||t.endsWith(".localhost"))return/^[a-z0-9.-]+$/.test(t)&&!t.includes("..");if(t==="0.0.0.0"||t==="::1"||t==="::")return!0;let i=/^127\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(t);return!!i&&i.slice(1).every(n=>Number(n)<=255)}function CD(e){return e==="localhost"||e.endsWith(".localhost")?["127.0.0.1","::1"]:e==="0.0.0.0"?["127.0.0.1"]:e==="::1"?["::1"]:e==="::"?["::1","127.0.0.1"]:[e]}function TD(e){let t=e.trim();return/^\d{1,5}$/.test(t)?`http://localhost:${t}/`:/^:\d{1,5}(?:[/?#].*)?$/.test(t)?`http://localhost${t}`:/^[a-z][a-z0-9+.-]*:\/\//i.test(t)||/^[a-z][a-z0-9+.-]*:(?!\d)/i.test(t)?t:`http://${t}`}function ss(e){if(typeof e!="string"||!e.trim())return{ok:!1,reason:"empty"};if(e.length>2048)return{ok:!1,reason:"too_long"};let t;try{t=new URL(TD(e))}catch{return{ok:!1,reason:"bad_url"}}if(t.protocol!=="http:"&&t.protocol!=="https:")return{ok:!1,reason:"scheme"};if(t.username||t.password)return{ok:!1,reason:"userinfo"};let i=t.hostname.toLowerCase().replace(/^\[|\]$/g,"");if(!kD(i))return{ok:!1,reason:"not_local"};let n=t.protocol==="https:",r=t.port?Number(t.port):n?443:80;if(!Number.isInteger(r)||r<1||r>65535)return{ok:!1,reason:"port"};let s=t.href;if(s.length>2048)return{ok:!1,reason:"too_long"};let a=i.includes(":")?`[${i}]`:i;return{ok:!0,target:{href:s,origin:`${t.protocol}//${a}:${r}`,path:`${t.pathname}${t.search}${t.hash}`,secure:n,hostname:i,port:r,connect:CD(i),hostHeader:`${a}:${r}`}}}function tS(e,t,i){return e.startsWith(t)?Cm(i)+e.slice(t.length):e}function Cm(e){return e.replace(/^http:\/\/(.+):80$/,"http://$1").replace(/^https:\/\/(.+):443$/,"https://$1")}function Tm(e){if(typeof e!="string"||!e||e.length>2048)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!=="http:"&&t.protocol!=="https:"||!t.hostname)return null;let i=t.href;return/[\s"'<>`\\^{|}]/.test(i)||i.length>2048?null:i}var Hd=te(()=>{});var Nm,iS=te(()=>{Nm={zh:{app:{title:"Agent \u63A7\u5236\u53F0",subtitle:"\u5148\u5728\u5DE6\u4FA7\u65B0\u5EFA\u6216\u9009\u62E9\u4E00\u4E2A\u9879\u76EE"},common:{cancel:"\u53D6\u6D88",ok:"\u786E\u5B9A",save:"\u4FDD\u5B58",add:"\u6DFB\u52A0",browse:"\u6D4F\u89C8\u2026",more:"\u66F4\u591A",copy:"\u590D\u5236",copied:"\u5DF2\u590D\u5236",copyPath:"\u590D\u5236\u8DEF\u5F84",copiedPath:"\u5DF2\u590D\u5236\u8DEF\u5F84",search:"\u641C\u7D22",settings:"\u8BBE\u7F6E",remove:"\u79FB\u9664",close:"\u5173\u95ED",retry:"\u91CD\u8BD5",details:"\u8BE6\u60C5 \u203A",submit:"\u63D0\u4EA4",other:"\u5176\u4ED6\u2026",default:"\u9ED8\u8BA4",done:"\u5B8C\u6210",loading:"\u52A0\u8F7D\u4E2D\u2026",send:"\u53D1\u9001",stop:"\u505C\u6B62",refresh:"\u5237\u65B0",rename:"\u91CD\u547D\u540D",delete:"\u5220\u9664",discard:"\u653E\u5F03",notInstalled:"\uFF08\u672A\u5B89\u88C5\uFF09",notDetected:"\uFF08\u672A\u68C0\u6D4B\u5230\uFF09",current:"\uFF08\u5F53\u524D\uFF09",messages:"\u6761",imported:" \xB7 \u5DF2\u5BFC\u5165",justNow:"\u521A\u521A",minutesAgo:"{n} \u5206\u949F\u524D",hoursAgo:"{n} \u5C0F\u65F6\u524D",daysAgo:"{n} \u5929\u524D"},boot:{connecting:"\u6B63\u5728\u8FDE\u63A5\u2026",serviceDown:"\u672C\u5730\u670D\u52A1\u672A\u542F\u52A8",retry:"\u91CD\u8BD5",reconnecting:"\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u6B63\u5728\u91CD\u65B0\u8FDE\u63A5\u2026",starting:"\u6B63\u5728\u542F\u52A8\u672C\u5730\u670D\u52A1\u2026",reopening:"\u672C\u5730\u670D\u52A1\u5DF2\u91CD\u542F\uFF0C\u6B63\u5728\u91CD\u65B0\u8FDE\u63A5\u2026"},topbar:{pickThread:"\u9009\u62E9\u4E00\u4E2A\u5BF9\u8BDD",sidebar:"\u4FA7\u680F\uFF08Ctrl+B\uFF09",clickRename:"\u70B9\u51FB\u6539\u540D",waitAuth:"\u7B49\u5F85\u6388\u6743",showRequest:"\u67E5\u770B\u6388\u6743\u8BF7\u6C42",running:"\u8FD0\u884C\u4E2D {s}s",error:"\u51FA\u9519",closedResume:"\u5DF2\u5173\u95ED \xB7 \u53D1\u9001\u6D88\u606F\u5C06\u7EED\u63A5",threadInfo:"\u5BF9\u8BDD\u4FE1\u606F",panelChanges:"\u6539\u52A8\uFF08Ctrl+J\uFF09",panelFiles:"\u6587\u4EF6",panelTerminal:"\u7EC8\u7AEF"},sidebar:{newProject:"\u65B0\u5EFA\u9879\u76EE",collapse:"\u6536\u8D77\u4FA7\u680F",expand:"\u5C55\u5F00\u4FA7\u680F",filterPlaceholder:"\u8FC7\u6EE4\u5BF9\u8BDD\u6807\u9898",searchTitle:"\u641C\u7D22\uFF08Ctrl+K\uFF09",noProjectsTitle:"\u8FD8\u6CA1\u6709\u9879\u76EE",noProjectsSub:"\u9879\u76EE\u5BF9\u5E94\u4E00\u4E2A\u672C\u673A\u76EE\u5F55\uFF0C\u5BF9\u8BDD\u90FD\u5728\u76EE\u5F55\u91CC\u5E72\u6D3B\u3002",newThread:"\u65B0\u5EFA\u5BF9\u8BDD",projectMenu:"\u9879\u76EE\u83DC\u5355",showAll:"\u663E\u793A\u5168\u90E8 {n} \u6761",noThreads:"\u8FD8\u6CA1\u6709\u5BF9\u8BDD",rename:"\u91CD\u547D\u540D",pin:"\u7F6E\u9876",unpin:"\u53D6\u6D88\u7F6E\u9876",archive:"\u5F52\u6863",unarchive:"\u53D6\u6D88\u5F52\u6863",exportMd:"\u5BFC\u51FA Markdown",deleteThread:"\u5220\u9664\u5BF9\u8BDD",deleteThreadBody:"\u300C{title}\u300D\u5C06\u88AB\u79FB\u5230\u56DE\u6536\u76EE\u5F55\uFF0C\u786E\u5B9A\u5417\uFF1F",importHist:"\u5BFC\u5165\u5DF2\u6709\u5BF9\u8BDD\u2026",openExplorer:"\u5728\u8D44\u6E90\u7BA1\u7406\u5668\u6253\u5F00",showArchived:"\u663E\u793A\u5DF2\u5F52\u6863",hideArchived:"\u9690\u85CF\u5DF2\u5F52\u6863",archivedN:"\u5DF2\u5F52\u6863 {n} \u6761",archivedHint:"\u5DF2\u5F52\u6863\uFF0C\u53EF\u5728\u9879\u76EE\u5217\u8868\u5E95\u90E8\u67E5\u770B",unarchived:"\u5DF2\u53D6\u6D88\u5F52\u6863",exportSaved:"\u5DF2\u5BFC\u51FA\u5230 {path}",removeProject:"\u79FB\u9664\u9879\u76EE",removeProjectBody:"\u300C{name}\u300D\u5C06\u4ECE\u5217\u8868\u79FB\u9664\uFF0C\u5176\u5BF9\u8BDD\u79FB\u5230\u56DE\u6536\u76EE\u5F55\uFF08\u6587\u4EF6\u4E0D\u4F1A\u88AB\u5220\u9664\uFF09\u3002",renameProject:"\u91CD\u547D\u540D\u9879\u76EE",projectName:"\u9879\u76EE\u540D",newProjectDlg:"\u65B0\u5EFA\u9879\u76EE",dirLabel:"\u9879\u76EE\u76EE\u5F55\uFF08\u5FC5\u987B\u662F\u5DF2\u5B58\u5728\u7684\u6587\u4EF6\u5939\uFF09",dirMissing:"\u76EE\u5F55\u4E0D\u5B58\u5728",notDir:"\u8FD9\u662F\u4E00\u4E2A\u6587\u4EF6\uFF0C\u4E0D\u662F\u76EE\u5F55",dirOk:"\u2713 \u76EE\u5F55\u53EF\u7528\uFF0C\u9879\u76EE\u540D\u53D6\u76EE\u5F55\u540D",recent:"\u6700\u8FD1\u4F7F\u7528",pickFolderUnsupported:"\u5F53\u524D\u7CFB\u7EDF\u4E0D\u652F\u6301\u5F39\u7A97\u9009\u76EE\u5F55\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165",pickFolderFailed:"\u6253\u5F00\u6587\u4EF6\u5939\u9009\u62E9\u6846\u5931\u8D25",importTitle:"\u5BFC\u5165\u5DF2\u6709\u5BF9\u8BDD \u2014 {name}",scanning:"\u6B63\u5728\u626B\u63CF\u672C\u673A\u5386\u53F2\u4F1A\u8BDD\u2026",importEmpty:"\u6CA1\u6709\u627E\u5230\u5BF9\u5E94\u8FD9\u4E2A\u9879\u76EE\u76EE\u5F55\u7684\u5386\u53F2\u4F1A\u8BDD\u3002",importing:"\u5BFC\u5165\u4E2D\u2026",importN:"\u5BFC\u5165 {n} \u4E2A\u5BF9\u8BDD",importedN:"\u5DF2\u5BFC\u5165 {n} \u4E2A\u5BF9\u8BDD",failNewThread:"\u65B0\u5EFA\u5BF9\u8BDD\u5931\u8D25\uFF1A",failRename:"\u91CD\u547D\u540D\u5931\u8D25\uFF1A",failAddProject:"\u6DFB\u52A0\u9879\u76EE\u5931\u8D25\uFF1A",failImportList:"\u8BFB\u53D6\u5386\u53F2\u5931\u8D25\uFF1A",failImport:"\u5BFC\u5165\u5931\u8D25\uFF1A",failExport:"\u5BFC\u51FA\u5931\u8D25\uFF1A"},chat:{newInProject:"\u5728 {name} \u4E2D\u65B0\u5EFA\u5BF9\u8BDD",emptyHint:"\u5BF9\u8BDD\u8FD8\u6CA1\u6709\u6D88\u606F\uFF0C\u4E0B\u9762\u8F93\u5165\u5F00\u59CB\u3002",jumpBottom:"\u56DE\u5230\u5E95\u90E8",emptyPlaceholder:"\u8F93\u5165\u4EFB\u52A1\uFF0CEnter \u53D1\u9001",autoNewThread:"\u5C06\u81EA\u52A8\u65B0\u5EFA\u5BF9\u8BDD",pickProjectTitle:"\u9009\u62E9\u4E00\u4E2A\u9879\u76EE",pickProjectSub:"\u5728\u5DE6\u4FA7\u9009\u4E00\u4E2A\u9879\u76EE\uFF0C\u6216\u65B0\u5EFA\u4E00\u4E2A\uFF0C\u7136\u540E\u5F00\u59CB\u5BF9\u8BDD\u3002",failSend:"\u53D1\u9001\u5931\u8D25\uFF1A"},composer:{waitPerm:"\u7B49\u5F85\u4F60\u786E\u8BA4\u4E0A\u9762\u7684\u6388\u6743\u8BF7\u6C42",queuePlaceholder:"\u8F93\u5165\u6392\u961F\u6D88\u606F\uFF08Ctrl+Enter \u63D2\u8BDD\uFF09",queuePlaceholderNoSteer:"\u7EE7\u7EED\u8865\u5145\u8981\u6C42\uFF0C\u56DE\u8F66\u6392\u961F\u53D1\u9001\u2026",steerUnsupported:"{agent} \u4E0D\u652F\u6301\u63D2\u8BDD\uFF1A\u8FD0\u884C\u4E2D\u53D1\u7684\u6D88\u606F\u4F1A\u6392\u961F\uFF0C\u672C\u56DE\u5408\u7ED3\u675F\u540E\u518D\u53D1\u9001\u3002",queuedToast:"\u5DF2\u6392\u961F\uFF1A\u672C\u56DE\u5408\u7ED3\u675F\u540E\u53D1\u9001",steeredToast:"\u5DF2\u63D2\u8BDD",inputPlaceholder:"\u8F93\u5165\u6D88\u606F\uFF0C/ \u4F7F\u7528\u547D\u4EE4\u2026",autoWarn:"\u5168\u90E8\u81EA\u52A8\u540C\u610F\u4F1A\u8BA9 Agent \u4E0D\u7ECF\u8BE2\u95EE\u76F4\u63A5\u8FD0\u884C\u547D\u4EE4\u3001\u4FEE\u6539\u6587\u4EF6\uFF1ACodex \u5173\u95ED\u6C99\u7BB1\uFF08danger-full-access\uFF09\uFF0CClaude Code \u8DF3\u8FC7\u6240\u6709\u6743\u9650\u68C0\u67E5\uFF0C\u5176\u4ED6 Agent \u7684\u6388\u6743\u8BF7\u6C42\u7531\u63A7\u5236\u53F0\u81EA\u52A8\u300C\u5141\u8BB8\u4E00\u6B21\u300D\u3002\u8BF7\u8C28\u614E\u4F7F\u7528\u3002",autoOn:{title:"\u5168\u90E8\u81EA\u52A8\u540C\u610F\u5DF2\u5F00\u542F",back:"\u6539\u56DE\u6BCF\u6B21\u8BE2\u95EE",keeps:"\u8BA1\u5212\u786E\u8BA4\u548C\u63D0\u95EE\u4ECD\u4F1A\u95EE\u4F60\uFF1B\u6BCF\u6B21\u53EA\u540C\u610F\u5F53\u524D\u8FD9\u4E00\u4E2A\u8BF7\u6C42\uFF0C\u4E0D\u4F1A\u5199\u5165\u6C38\u4E45\u89C4\u5219\u3002"},autoDesc:{claude:"Claude Code \u4EE5 bypassPermissions \u8FD0\u884C\uFF1A\u8DF3\u8FC7\u6240\u6709\u6743\u9650\u68C0\u67E5\uFF0C\u547D\u4EE4\u548C\u6539\u6587\u4EF6\u90FD\u4E0D\u518D\u8BE2\u95EE\uFF08\u8BF7\u8C28\u614E\u4F7F\u7528\uFF09",codex:"Codex \u6C99\u7BB1\u5173\u95ED\uFF08danger-full-access\uFF09\u4E14\u4ECE\u4E0D\u8BE2\u95EE\uFF1A\u547D\u4EE4\u53EF\u8BFB\u5199\u6574\u53F0\u7535\u8111\u3001\u53EF\u8054\u7F51\uFF08\u8BF7\u8C28\u614E\u4F7F\u7528\uFF09",copilot:"Copilot Allow All\uFF1A\u6240\u6709\u5DE5\u5177\u8C03\u7528\u90FD\u4E0D\u518D\u786E\u8BA4\uFF08\u8BF7\u8C28\u614E\u4F7F\u7528\uFF09",devin:"Devin Bypass Permissions\uFF1A\u8DF3\u8FC7\u6240\u6709\u6743\u9650\u68C0\u67E5\uFF08\u8BF7\u8C28\u614E\u4F7F\u7528\uFF09",cursor:"Agent \u6A21\u5F0F\uFF0C\u6BCF\u4E2A\u6388\u6743\u8BF7\u6C42\u90FD\u7531\u63A7\u5236\u53F0\u81EA\u52A8\u300C\u5141\u8BB8\u4E00\u6B21\u300D\uFF1A\u547D\u4EE4\u548C\u6539\u6587\u4EF6\u76F4\u63A5\u6267\u884C\uFF08\u8BF7\u8C28\u614E\u4F7F\u7528\uFF09",opencode:"Build \u6A21\u5F0F\uFF0C\u6BCF\u4E2A\u6388\u6743\u8BF7\u6C42\u90FD\u7531\u63A7\u5236\u53F0\u81EA\u52A8\u300C\u5141\u8BB8\u4E00\u6B21\u300D\uFF1A\u547D\u4EE4\u548C\u6539\u6587\u4EF6\u76F4\u63A5\u6267\u884C\uFF08\u8BF7\u8C28\u614E\u4F7F\u7528\uFF09",generic:"\u6BCF\u4E2A\u6388\u6743\u8BF7\u6C42\u90FD\u7531\u63A7\u5236\u53F0\u81EA\u52A8\u300C\u5141\u8BB8\u4E00\u6B21\u300D\uFF1A\u547D\u4EE4\u548C\u6539\u6587\u4EF6\u76F4\u63A5\u6267\u884C\uFF0C\u4E0D\u518D\u8BE2\u95EE\uFF08\u8BF7\u8C28\u614E\u4F7F\u7528\uFF09",pi:"Pi \u672C\u8EAB\u4ECE\u4E0D\u8BE2\u95EE\uFF1A\u547D\u4EE4\u548C\u6539\u6587\u4EF6\u76F4\u63A5\u6267\u884C\uFF08\u6269\u5C55\u53D1\u8D77\u7684\u786E\u8BA4\u4ECD\u4F1A\u95EE\u4F60\uFF09"},imagesByPath:"{agent} \u4E0D\u80FD\u76F4\u63A5\u770B\u56FE\u7247\uFF1A\u4F1A\u628A\u56FE\u7247\u7684\u6587\u4EF6\u8DEF\u5F84\u53D1\u7ED9\u5B83\uFF08\u5B83\u80FD\u7528\u6587\u4EF6\u5DE5\u5177\u6253\u5F00\uFF09\u3002",agentModel:"Agent & model",agentLocked:"Agent (locked)",agent:"Agent",model:"Model",searchModel:"Search",searchAllModels:"Search models\u2026",providers:"Agent",agentLockedHint:"\u5DF2\u5F00\u59CB\u7684\u5BF9\u8BDD\u4E0D\u80FD\u66F4\u6362 Agent\uFF1B\u8981\u7528\u522B\u7684 Agent \u8BF7\u65B0\u5EFA\u5BF9\u8BDD\u3002",providersLoading:"\u6B63\u5728\u68C0\u6D4B Agent\u2026",moreModels:"\u8FD8\u6709 {n} \u4E2A\u6A21\u578B\uFF0C\u8BF7\u7528\u4E0A\u65B9\u641C\u7D22",pickModel:"\u9009\u62E9\u6A21\u578B",noModelMatch:"\u6CA1\u6709\u5339\u914D\u7684\u6A21\u578B",refreshModels:"\u5237\u65B0\u6A21\u578B\u5217\u8868",refreshingModels:"\u6B63\u5728\u5237\u65B0\u2026",defaultModel:"\u9ED8\u8BA4",defaultEffort:"\u9ED8\u8BA4",defaultEffortNamed:"\u9ED8\u8BA4\uFF08{level}\uFF09",effortTitle:"\u601D\u8003\u5F3A\u5EA6",modeTitle:"\u6743\u9650\u6A21\u5F0F",attachTitle:"\u9644\u4EF6\uFF08\u56FE\u7247/\u6587\u672C\uFF09",failSwitchAgent:"\u5207\u6362 Agent \u5931\u8D25\uFF1A",failSend:"\u53D1\u9001\u5931\u8D25\uFF1A",failUpload:"\u9644\u4EF6\u4E0A\u4F20\u5931\u8D25\uFF1A",uploadFailed:"\u4E0A\u4F20\u5931\u8D25",steerTag:"\u63D2\u8BDD",cursorAutoReview:"\u81EA\u52A8\u63A5\u53D7\u6743\u9650\u63D0\u793A\uFF08Auto-review\uFF09",cursorFastOff:"\u6807\u51C6\u901F\u5EA6",cursorFastOn:"Fast",slashGroupCommand:"\u547D\u4EE4",slashGroupSkill:"Skill",slashNoCommands:"\u8BE5 Agent \u672A\u63D0\u4F9B\u547D\u4EE4",slashLoading:"\u6B63\u5728\u83B7\u53D6\u547D\u4EE4\u2026",mode:{plan:{label:"\u89C4\u5212",desc:"\u53EA\u5206\u6790\u4EE3\u7801\u5E93\uFF0C\u4E0D\u6267\u884C\u5DE5\u5177\u6216\u4FEE\u6539"},default:{label:"\u6BCF\u6B21\u8BE2\u95EE",desc:"\u9996\u6B21\u4F7F\u7528\u5DE5\u5177\u65F6\u4F1A\u8BF7\u6C42\u6388\u6743"},acceptEdits:{label:"\u63A5\u53D7\u7F16\u8F91",desc:"\u81EA\u52A8\u6279\u51C6\u7F16\u8F91\u7C7B\u5DE5\u5177\uFF0C\u4E0D\u518D\u9010\u9879\u8BE2\u95EE"},bypass:{label:"\u5168\u90E8\u81EA\u52A8\u540C\u610F",desc:"\u4E0D\u518D\u8BE2\u95EE\uFF1ACodex \u5173\u95ED\u6C99\u7BB1\uFF0CClaude Code \u8DF3\u8FC7\u6240\u6709\u6743\u9650\u68C0\u67E5\uFF0C\u5176\u4ED6 Agent \u7684\u8BF7\u6C42\u81EA\u52A8\u300C\u5141\u8BB8\u4E00\u6B21\u300D\uFF08\u8BF7\u8C28\u614E\u4F7F\u7528\uFF09"},cursorBypass:{label:"\u5168\u90E8\u81EA\u52A8\u540C\u610F",desc:"Agent \u6A21\u5F0F\uFF0C\u6BCF\u4E2A\u6388\u6743\u8BF7\u6C42\u90FD\u7531\u63A7\u5236\u53F0\u81EA\u52A8\u300C\u5141\u8BB8\u4E00\u6B21\u300D\uFF08\u8BF7\u8C28\u614E\u4F7F\u7528\uFF09"},cursorAgent:{label:"Agent",desc:"\u5B8C\u6574 Agent\uFF1A\u53EF\u8BFB\u5199\u3001\u6267\u884C\u5DE5\u5177"},cursorPlan:{label:"\u89C4\u5212",desc:"\u53EA\u8BFB\u89C4\u5212\uFF1A\u5206\u6790\u5E76\u63D0\u51FA\u65B9\u6848\uFF0C\u4E0D\u6539\u6587\u4EF6"},cursorAsk:{label:"\u95EE\u7B54",desc:"\u95EE\u7B54\u6A21\u5F0F\uFF1A\u89E3\u91CA\u4E0E\u8BA8\u8BBA\uFF0C\u53EA\u8BFB"},pi:{label:"Pi \u672C\u8EAB\u4ECE\u4E0D\u8BE2\u95EE",desc:"Pi \u672C\u8EAB\u4ECE\u4E0D\u8BE2\u95EE\uFF1A\u547D\u4EE4\u548C\u6539\u6587\u4EF6\u76F4\u63A5\u6267\u884C\uFF08\u6269\u5C55\u53D1\u8D77\u7684\u786E\u8BA4\u4ECD\u4F1A\u95EE\u4F60\uFF09"}},agentMode:{Plan:"\u89C4\u5212",Build:"\u6784\u5EFA",Ask:"\u8BE2\u95EE",Code:"\u7F16\u7801",Agent:"Agent","Allow All":"\u5168\u90E8\u5141\u8BB8","Bypass Permissions":"\u8DF3\u8FC7\u6388\u6743","Read Only":"\u53EA\u8BFB",Auto:"\u81EA\u52A8","Full Access":"\u5B8C\u5168\u8BBF\u95EE"},effort:{low:"\u4F4E",medium:"\u4E2D",high:"\u9AD8",xhigh:"\u8D85\u9AD8",max:"\u6700\u9AD8",minimal:"\u6700\u4F4E",none:"\u5173\u95ED"}},settings:{contentWidth:"\u5185\u5BB9\u5BBD\u5EA6",widthNarrow:"\u7A84\uFF08640\uFF09",widthDefault:"\u9ED8\u8BA4\uFF08720\uFF09",widthWide:"\u5BBD\uFF08880\uFF09",widthFull:"\u94FA\u6EE1",bashPath:"Bash \u8DEF\u5F84\uFF08Windows\uFF09",bashCheck:"\u68C0\u6D4B",bashOk:"\u53EF\u7528\uFF1A{path}",bashUsing:"\u5F53\u524D\u4F7F\u7528\uFF1A{path}\uFF08{src}\uFF09",bashNone:"\u6CA1\u6709\u627E\u5230 Git Bash\u3002",bashManualBad:"\u624B\u52A8\u8DEF\u5F84\u4E0D\u53EF\u7528\uFF08{why}\uFF09\uFF0C\u5DF2\u6539\u7528\u81EA\u52A8\u68C0\u6D4B",bashHint:"Claude Code\u3001Pi\u3001dsh \u5728 Windows \u4E0A\u7528 Git Bash \u6267\u884C\u547D\u4EE4\u3002\u7559\u7A7A\u5C31\u81EA\u52A8\u68C0\u6D4B\uFF08git.exe \u65C1\u8FB9\u3001Program Files\u3001\u5404\u76D8\u7684 \\Git\uFF09\uFF1B\u88C5\u5728\u522B\u5904\u65F6\u586B bash.exe \u7684\u5B8C\u6574\u8DEF\u5F84\u3002",bashNotWindows:"\u53EA\u5728 Windows \u4E0A\u9700\u8981\u3002macOS \u548C Linux \u76F4\u63A5\u7528\u7CFB\u7EDF\u81EA\u5E26\u7684 bash\u3002",bashSrc:{manual:"\u624B\u52A8\u8BBE\u7F6E",env:"\u73AF\u5883\u53D8\u91CF",git:"git.exe \u65C1\u8FB9",known:"\u9ED8\u8BA4\u5B89\u88C5\u4F4D\u7F6E",drive:"\u5176\u4ED6\u76D8",path:"PATH"},bashBad:{empty:"\u8DEF\u5F84\u4E3A\u7A7A",relative:"\u8981\u586B\u5B8C\u6574\u8DEF\u5F84\uFF0C\u6BD4\u5982 E:\\Git\\bin\\bash.exe",notBash:"\u8981\u6307\u5411 bash.exe\uFF08\u6216 sh.exe\uFF09",wsl:"\u8FD9\u662F WSL \u7684 bash\uFF0C\u4E0D\u80FD\u7528",missing:"\u6587\u4EF6\u4E0D\u5B58\u5728"},chatFont:"\u804A\u5929\u5B57\u53F7",chatFontDefault:"\uFF08\u9ED8\u8BA4\uFF09",chatFontHint:"\u5BF9\u8BDD\u6B63\u6587\u3001\u8F93\u5165\u6846\u3001\u5DE5\u5177\u8F93\u51FA\u548C\u4EE3\u7801\u4E00\u8D77\u7F29\u653E\uFF08\u4EE3\u7801\u5C0F 1px\uFF09",title:"\u8BBE\u7F6E",defaultAgent:"\u9ED8\u8BA4 Agent",defaultMode:"\u9ED8\u8BA4\u6743\u9650\u6A21\u5F0F",theme:"\u4E3B\u9898",themeAuto:"\u8DDF\u968F\u7CFB\u7EDF",themeMagpie:"\u8DDF\u968F Magpie",themeLight:"\u6D45\u8272",themeDark:"\u6DF1\u8272",sendKey:"\u53D1\u9001\u952E",sendEnter:"Enter \u53D1\u9001 / Shift+Enter \u6362\u884C",sendCtrl:"Ctrl+Enter \u53D1\u9001 / Enter \u6362\u884C",runningSend:"\u8FD0\u884C\u4E2D\u518D\u53D1\u9001",queue:"\u6392\u961F\uFF08\u53D1\u5B8C\u81EA\u52A8\u7EE7\u7EED\uFF09",steer:"\u63D2\u8BDD\uFF08\u7ACB\u5373\u6253\u65AD\u5F53\u524D\u601D\u8DEF\uFF09",steerHint:"\u63D2\u8BDD\u53EA\u5BF9\u652F\u6301\u7684 Agent \u751F\u6548\uFF08\u76EE\u524D\u662F Codex\uFF09\uFF1B\u5176\u4ED6 Agent \u4ECD\u4F1A\u6392\u961F\uFF0C\u8F93\u5165\u6846\u4E0B\u65B9\u4F1A\u63D0\u793A\u3002",defaultModeHint:"\u65B0\u5BF9\u8BDD\u4F7F\u7528\uFF1B\u6BCF\u4E2A Agent \u4F1A\u6362\u6210\u81EA\u5DF1\u6700\u63A5\u8FD1\u7684\u6A21\u5F0F\uFF08\u4F8B\u5982 OpenCode \u53EA\u6709 Plan / Build\uFF0CBuild \u4F1A\u76F4\u63A5\u6539\u6587\u4EF6\uFF09\u3002\u9009\u300C\u5168\u90E8\u81EA\u52A8\u540C\u610F\u300D\u540E\uFF0C\u6240\u6709 Agent \u90FD\u4E0D\u518D\u5F39\u6388\u6743\u3002",thinking:"\u601D\u8003\u8FC7\u7A0B",showThinking:"\u663E\u793A Agent \u7684\u601D\u8003/\u63A8\u7406\u5185\u5BB9",idleClose:"\u7A7A\u95F2\u56DE\u6536",idleMinutes:"\u5206\u949F\u540E\u81EA\u52A8\u5173\u95ED\u7A7A\u95F2\u4F1A\u8BDD\uFF085\u2013240\uFF1B\u6700\u591A\u4FDD\u7559 3 \u4E2A\u7A7A\u95F2 Agent \u8FDB\u7A0B\uFF09",idleInvalid:"\u8BF7\u8F93\u5165 5 \u5230 240 \u4E4B\u95F4\u7684\u6574\u6570",versionLine:"\u7248\u672C v{ver} \xB7 PID {pid}",dataDir:"\u6570\u636E\u76EE\u5F55\uFF1A",failSave:"\u4FDD\u5B58\u5931\u8D25\uFF1A",providers:"Agent",providerOn:"\u53EF\u7528",providerOff:"\u5DF2\u7981\u7528",providerPending:"\u5C1A\u672A\u63A5\u5165",providerVerified:"\u5DF2\u9A8C\u8BC1",providerExperimental:"\u5B9E\u9A8C\u6027",providerPlanned:"\u672A\u63A5\u5165",providerModels:"{n} \u4E2A Model",providerRedetect:"\u91CD\u65B0\u68C0\u6D4B",providerCopyHint:"\u590D\u5236\u5B89\u88C5\u63D0\u793A",providerLaunchCmd:"\u81EA\u5B9A\u4E49\u542F\u52A8\uFF08\u9AD8\u7EA7\uFF09",providerLaunchExe:"\u53EF\u6267\u884C\u6587\u4EF6\u8DEF\u5F84\uFF08\u7559\u7A7A = \u81EA\u52A8\u67E5\u627E\uFF09",providerLaunchArgs:"\u9644\u52A0\u53C2\u6570\uFF08JSON \u6570\u7EC4\uFF09",providerLaunchArgsHint:'\u8FFD\u52A0\u5728\u5185\u7F6E\u53C2\u6570\u4E4B\u540E\uFF0C\u4F8B\u5982 ["--foo"]\uFF1B\u56DE\u8F66\u6216\u79BB\u5F00\u8F93\u5165\u6846\u65F6\u4FDD\u5B58\u3002\u65B0\u5BF9\u8BDD\u751F\u6548\u3002',providerArgsInvalid:'\u9700\u8981 JSON \u5B57\u7B26\u4E32\u6570\u7EC4\uFF0C\u4F8B\u5982 ["--foo"]',providerToggleFailed:"\u5207\u6362\u5931\u8D25\uFF0C\u5DF2\u6062\u590D\uFF1A"},palette:{aria:"\u547D\u4EE4\u9762\u677F",placeholder:"\u641C\u7D22\u5BF9\u8BDD\u3001\u9879\u76EE\u6216\u52A8\u4F5C\u2026",noMatch:"\u6CA1\u6709\u5339\u914D\u9879",hintAction:"\u52A8\u4F5C",hintThread:"\u5BF9\u8BDD",hintProject:"\u9879\u76EE",actNewThread:"\u65B0\u5EFA\u5BF9\u8BDD",actSettings:"\u6253\u5F00\u8BBE\u7F6E",actTheme:"\u5207\u6362\u4E3B\u9898",actChanges:"\u6253\u5F00\u6539\u52A8\u9762\u677F",actFiles:"\u6253\u5F00\u6587\u4EF6\u9762\u677F",actTerminal:"\u6253\u5F00\u7EC8\u7AEF\u9762\u677F",actImport:"\u5BFC\u5165\u5DF2\u6709\u5BF9\u8BDD\u2026",failNew:"\u65B0\u5EFA\u5931\u8D25\uFF1A"},panel:{changes:"\u6539\u52A8",files:"\u6587\u4EF6",terminal:"\u7EC8\u7AEF",closeTitle:"\u5173\u95ED\uFF08Ctrl+J\uFF09",pickProject:"\u5148\u9009\u4E00\u4E2A\u9879\u76EE",notGit:"\u8FD9\u4E2A\u9879\u76EE\u4E0D\u662F git \u4ED3\u5E93",clean:"\u5DE5\u4F5C\u533A\u5E72\u51C0",branch:"\u5F53\u524D\u5206\u652F",loadingDiff:"\u52A0\u8F7D diff\u2026",diffTooLarge:"diff \u8D85\u8FC7 1MB\uFF0C\u4E0D\u663E\u793A",discardTitle:"\u653E\u5F03\u6539\u52A8",discardUntracked:`\u653E\u5F03 {path} \u7684\u6539\u52A8\uFF1F \u672A\u8DDF\u8E2A\u6587\u4EF6\u4F1A\u88AB\u79FB\u5230\u56DE\u6536\u76EE\u5F55\uFF08trash/discarded\uFF09\uFF0C\u4E0D\u4F1A\u76F4\u63A5\u5220\u9664\u3002`,discardTracked:"\u653E\u5F03 {path} \u7684\u6539\u52A8\uFF1F\u8BE5\u6587\u4EF6\u4F1A\u6062\u590D\u5230 git \u91CC\u7684\u7248\u672C\u3002",discardBtn:"\u653E\u5F03\u6539\u52A8",failDiscard:"\u653E\u5F03\u5931\u8D25\uFF1A",closePreview:"\u5173\u95ED\u9884\u89C8",reading:"\u8BFB\u53D6\u4E2D\u2026",binary:"\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C\u4E0D\u9884\u89C8",tooLarge:"\u8D85\u8FC7 1MB\uFF0C\u4E0D\u9884\u89C8",gitKind:{modified:"\u6539",added:"\u589E",deleted:"\u5220",untracked:"\u65B0",renamed:"\u79FB"}},terminal:{new:"\u65B0\u5EFA\u7EC8\u7AEF",noTerm:"\u8FD8\u6CA1\u6709\u7EC8\u7AEF",closeTitle:"\u5173\u95ED\u7EC8\u7AEF",closeBody:"\u5173\u95ED\u300C{title}\u300D\uFF1F\u91CC\u9762\u8FD0\u884C\u7684\u8FDB\u7A0B\u4F1A\u88AB\u7ED3\u675F\u3002",closeOk:"\u5173\u95ED",simpleNote:"\u7B80\u5316\u7EC8\u7AEF\uFF08\u65E0\u4EA4\u4E92\u7A0B\u5E8F\u652F\u6301\uFF09",ended:"\uFF08\u7EC8\u7AEF\u5DF2\u7ED3\u675F\uFF09",failNew:"\u65B0\u5EFA\u7EC8\u7AEF\u5931\u8D25\uFF1A",failKill:"\u5173\u95ED\u5931\u8D25\uFF1A"},thread:{new:"\u65B0\u5BF9\u8BDD",info:"\u5BF9\u8BDD\u4FE1\u606F",agent:"Agent",model:"\u6A21\u578B",mode:"\u6A21\u5F0F",effort:"\u601D\u8003\u5F3A\u5EA6",sessionId:"\u4F1A\u8BDD ID",tokens:"\u7D2F\u8BA1 token",cost:"\u7D2F\u8BA1\u8D39\u7528",created:"\u521B\u5EFA\u4E8E",workdir:"\u5DE5\u4F5C\u76EE\u5F55",importedFrom:"\u5BFC\u5165\u81EA",sessionNone:"\uFF08\u672A\u5EFA\u7ACB\uFF09",tokensFmt:"{in} \u5165 / {out} \u51FA / {cache} \u7F13\u5B58"},timeline:{thinking:"\u601D\u8003 {s}s",todo:"\u5F85\u529E {done}/{total}",steer:"\u63D2\u8BDD",tasks:"\u4EFB\u52A1",tasksPill:"{done}/{total} \u4E2A\u4EFB\u52A1",tasksPillTitle:"\u67E5\u770B\u4EFB\u52A1\u6E05\u5355",codeWrap:"\u81EA\u52A8\u6362\u884C",permAllowSession:"\u672C\u5BF9\u8BDD\u90FD\u5141\u8BB8",permDenied:"\u5DF2\u62D2\u7EDD",permAllowed:"\u5DF2\u5141\u8BB8",permAutoAllowed:"\u5DF2\u81EA\u52A8\u540C\u610F\uFF08\u5168\u90E8\u81EA\u52A8\u540C\u610F\uFF09",permCancelled:"\u5DF2\u53D6\u6D88",autoUpgrade:{title:"1.3 \u65B0\u589E\uFF1A\u5168\u90E8\u81EA\u52A8\u540C\u610F",body:"\u73B0\u5728\u300C\u5168\u90E8\u81EA\u52A8\u540C\u610F\u300D\u5BF9 Cursor\u3001OpenCode\u3001dsh \u4E5F\u4F1A\u771F\u6B63\u751F\u6548\uFF1A\u6388\u6743\u8BF7\u6C42\u7531\u63A7\u5236\u53F0\u81EA\u52A8\u300C\u5141\u8BB8\u4E00\u6B21\u300D\uFF0C\u547D\u4EE4\u548C\u6539\u6587\u4EF6\u76F4\u63A5\u6267\u884C\u30021.2 \u7684\u300C\u5168\u90E8\u653E\u884C\u300D\u5BF9\u5B83\u4EEC\u4E0D\u751F\u6548\uFF08\u4ECD\u4F1A\u8BE2\u95EE\uFF09\u3002\u4F60\u4E4B\u524D\u628A\u9ED8\u8BA4\u6743\u9650\u6A21\u5F0F\u8BBE\u6210\u4E86\u5B83\uFF0C\u4E3A\u5B89\u5168\u8D77\u89C1\uFF0C\u8FD9\u4E2A\u5BF9\u8BDD\u4ECD\u4ECE\u300C\u6BCF\u6B21\u8BE2\u95EE\u300D\u5F00\u59CB\u3002\u5728\u8BBE\u7F6E\u91CC\u91CD\u65B0\u9009\u62E9\u4E00\u6B21\u9ED8\u8BA4\u6743\u9650\u6A21\u5F0F\u540E\uFF0C\u65B0\u5BF9\u8BDD\u5C31\u6309\u4F60\u7684\u9009\u62E9\u6765\u3002",migrated:"\u8FD9\u4E2A\u5BF9\u8BDD\u5728 1.2 \u91CC\u8BBE\u6210\u4E86\u300C\u5168\u90E8\u653E\u884C\u300D\uFF0C\u5F53\u65F6\u8FD9\u4E2A Agent \u5B9E\u9645\u4ECD\u4F1A\u8BE2\u95EE\u30021.3 \u8D77\u300C\u5168\u90E8\u81EA\u52A8\u540C\u610F\u300D\u4F1A\u771F\u6B63\u81EA\u52A8\u540C\u610F\uFF08\u547D\u4EE4\u548C\u6539\u6587\u4EF6\u76F4\u63A5\u6267\u884C\uFF09\uFF0C\u6240\u4EE5\u5DF2\u6539\u56DE\u300C\u6BCF\u6B21\u8BE2\u95EE\u300D\u3002",turnOn:"\u5728\u6B64\u5BF9\u8BDD\u5F00\u542F\u5168\u90E8\u81EA\u52A8\u540C\u610F",settings:"\u6253\u5F00\u8BBE\u7F6E"},autoApproved:{count:"\u5DF2\u81EA\u52A8\u540C\u610F {n} \u9879",title:"\u5168\u90E8\u81EA\u52A8\u540C\u610F\u66FF\u4F60\u540C\u610F\u4E86\u8FD9\u4E9B\u8BF7\u6C42\uFF08\u70B9\u5F00\u67E5\u770B\uFF09",answer:"{opt} \xB7 \u5168\u90E8\u81EA\u52A8\u540C\u610F",pending:"\u6B63\u5728\u81EA\u52A8\u540C\u610F\u2026"},submitted:"\u5DF2\u63D0\u4EA4\uFF1A{ans}",turnError:"\u51FA\u9519\uFF1A{err}",unknownError:"\u672A\u77E5\u9519\u8BEF",interrupted:"\u5DF2\u6253\u65AD",filesChanged:"\u6539\u52A8 {n} \u4E2A\u6587\u4EF6 \u203A",editMsg:"\u7F16\u8F91\uFF08\u586B\u56DE\u8F93\u5165\u6846\uFF0C\u4E0D\u4F1A\u9A6C\u4E0A\u53D1\u9001\uFF09",sendFailed:"\u53D1\u9001\u5931\u8D25",sendRetry:"\u91CD\u65B0\u53D1\u9001",sendDismiss:"\u79FB\u9664\u8FD9\u6761\u6CA1\u53D1\u51FA\u7684\u6D88\u606F",resend:"\u91CD\u65B0\u53D1\u9001\u8FD9\u6761\u6D88\u606F",retryHint:"\u91CD\u8BD5\uFF1A\u91CD\u65B0\u53D1\u9001\u4E0A\u4E00\u6761\u6D88\u606F",msgActions:"\u6D88\u606F\u64CD\u4F5C",editBusy:"\u8F93\u5165\u6846\u91CC\u8FD8\u6709\u6CA1\u53D1\u9001\u7684\u5185\u5BB9\uFF1A\u5148\u53D1\u9001\u6216\u6E05\u7A7A\uFF0C\u518D\u70B9\u7F16\u8F91",tool:{read:"\u8BFB\u53D6",edit:"\u4FEE\u6539",write:"\u5199\u5165",bash:"\u8FD0\u884C",search:"\u641C\u7D22",glob:"\u641C\u7D22",web:"\u8054\u7F51",task:"\u5B50\u4EFB\u52A1",mcp:"\u5DE5\u5177",todo:"\u5F85\u529E",other:"\u5DE5\u5177",processing:"\u5904\u7406"},cat:{edit:"\u6539\u52A8 {n}",run:"\u8FD0\u884C {n}",read:"\u8BFB\u53D6 {n}",search:"\u641C\u7D22 {n}",other:"\u5176\u4ED6 {n}"},failedCount:"{n} \u5931\u8D25",noErrorOutput:"\u6CA1\u6709\u9519\u8BEF\u8F93\u51FA",nowThinking:"\u6B63\u5728\u601D\u8003\u2026",now:{edit:"\u6B63\u5728\u6539\u52A8\uFF1A{x}\u2026",run:"\u6B63\u5728\u8FD0\u884C\uFF1A{x}\u2026",read:"\u6B63\u5728\u8BFB\u53D6\uFF1A{x}\u2026",search:"\u6B63\u5728\u641C\u7D22\uFF1A{x}\u2026",other:"\u6B63\u5728\u6267\u884C\uFF1A{x}\u2026"},bashMissing:"\u6CA1\u6709\u627E\u5230 Git Bash\u3002Claude Code\u3001Pi \u7B49 Agent \u5728 Windows \u4E0A\u8981\u7528\u5B83\u6267\u884C\u547D\u4EE4\u3002\uFF08C:\\Windows\\System32\\bash.exe \u662F WSL \u542F\u52A8\u5668\uFF0C\u4E0D\u80FD\u7528\u3002\uFF09\u88C5\u597D Git for Windows \u540E\u91CD\u65B0\u53D1\u9001\uFF1B\u88C5\u5728\u522B\u5904\u53EF\u4EE5\u5728\u300C\u8BBE\u7F6E \u2192 Bash \u8DEF\u5F84\u300D\u91CC\u6307\u5B9A bash.exe\u3002",bashDownload:"\u4E0B\u8F7D Git for Windows",bashSetting:"\u6253\u5F00\u8BBE\u7F6E",showAllLines:"\u663E\u793A\u5168\u90E8 {n} \u884C",diffClip:"\uFF08\u53EA\u663E\u793A\u524D {n} \u884C\uFF09"},api:{requestFailed:"\u8BF7\u6C42\u5931\u8D25",bad_params:"\u53C2\u6570\u4E0D\u6B63\u786E",not_found:"\u672A\u627E\u5230",busy:"\u6B63\u5FD9\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",bad_path:"\u8DEF\u5F84\u65E0\u6548",connClosed:"\u8FDE\u63A5\u4E2D\u65AD",notConnected:"\u8FDE\u63A5\u672A\u5EFA\u7ACB",timeout:"\u8BF7\u6C42\u8D85\u65F6"},preview:{tab:"\u9884\u89C8",address:"\u9884\u89C8\u5730\u5740",placeholder:"localhost:5173",back:"\u540E\u9000",forward:"\u524D\u8FDB",reload:"\u5237\u65B0",openExternal:"\u7528\u7CFB\u7EDF\u6D4F\u89C8\u5668\u6253\u5F00",widen:"\u52A0\u5BBD\u9762\u677F",onlyLocal:"\u9884\u89C8\u53EA\u652F\u6301\u672C\u673A\u5730\u5740\uFF08localhost\u3001127.0.0.1 \u7B49\uFF09",failed:"\u6253\u4E0D\u5F00\u9884\u89C8\uFF1A",empty:"\u8FD8\u6CA1\u6709\u9884\u89C8\u5730\u5740\u3002\u5728\u5BF9\u8BDD\u91CC\u70B9 localhost \u94FE\u63A5\uFF0C\u6216\u5728\u4E0A\u65B9\u8F93\u5165\uFF0C\u4F8B\u5982 localhost:5173",limits:"\u9884\u89C8\u5728\u6C99\u7BB1\u91CC\u8FD0\u884C\uFF1A\u5F39\u7A97\u3001alert \u548C\u539F\u751F\u8868\u5355\u63D0\u4EA4\u4E0D\u53EF\u7528\uFF1BlocalStorage \u548C\u767B\u5F55 cookie \u5237\u65B0\u540E\u4F1A\u4E22\u5931\uFF0C\u9700\u8981\u65F6\u8BF7\u7528\u7CFB\u7EDF\u6D4F\u89C8\u5668\u6253\u5F00\u3002",noLocalhost:"\u8FD9\u53F0\u7535\u8111\u7684\u7F51\u9875\u5185\u6838\u6253\u4E0D\u5F00 *.localhost \u5730\u5740\uFF08macOS 26 \u4EE5\u524D\u7684\u7CFB\u7EDF\u4F1A\u8FD9\u6837\uFF09\u3002\u9884\u89C8\u9760\u8FD9\u4E2A\u5730\u5740\u6321\u4F4F\u522B\u7684\u7F51\u9875\u8BFB\u53D6\u4F60\u7684 dev server\uFF0C\u6240\u4EE5\u8FD9\u91CC\u4E0D\u80FD\u9884\u89C8\uFF0C\u8BF7\u7528\u7CFB\u7EDF\u6D4F\u89C8\u5668\u6253\u5F00\u3002"},links:{openPreviewTitle:"\u5728\u9884\u89C8\u4E2D\u6253\u5F00\uFF08Ctrl/\u2318+\u70B9\u51FB\u7528\u6D4F\u89C8\u5668\u6253\u5F00\uFF09",externalFailed:"\u6253\u4E0D\u5F00\u7CFB\u7EDF\u6D4F\u89C8\u5668\uFF0C\u5DF2\u590D\u5236\u94FE\u63A5"},quote:{add:"\u6DFB\u52A0\u5230\u5BF9\u8BDD",addHint:"\u628A\u9009\u4E2D\u7684\u6587\u5B57\u4F5C\u4E3A\u5F15\u7528\u653E\u8FDB\u8F93\u5165\u6846\uFF08\u4E0D\u4F1A\u9A6C\u4E0A\u53D1\u9001\uFF09",chipTitle:"\u5F15\u7528\u7684\u6587\u5B57\uFF08\u53D1\u9001\u65F6\u4EE5\u5F15\u7528\u7684\u5F62\u5F0F\u653E\u5728\u4F60\u7684\u6D88\u606F\u524D\u9762\uFF09",remove:"\u79FB\u9664\u5F15\u7528",full:"\u6700\u591A {n} \u6761\u5F15\u7528",lines:"{n} \u884C"},mention:{drop:"\u677E\u5F00\u4EE5\u63D2\u5165\u5230\u804A\u5929",add:"\u63D2\u5165\u5230\u804A\u5929",copyRel:"\u590D\u5236\u76F8\u5BF9\u8DEF\u5F84",remove:"\u79FB\u9664",otherProject:"\u53EA\u80FD\u63D2\u5165\u5F53\u524D\u5BF9\u8BDD\u6240\u5728\u9879\u76EE\u91CC\u7684\u6587\u4EF6"}},en:{app:{title:"Agent Console",subtitle:"Create or select a project in the sidebar"},common:{cancel:"Cancel",ok:"OK",save:"Save",add:"Add",browse:"Browse\u2026",more:"More",copy:"Copy",copied:"Copied",copyPath:"Copy path",copiedPath:"Path copied",search:"Search",settings:"Settings",remove:"Remove",close:"Close",retry:"Retry",details:"Details \u203A",submit:"Submit",other:"Other\u2026",default:"Default",done:"Done",loading:"Loading\u2026",send:"Send",stop:"Stop",refresh:"Refresh",rename:"Rename",delete:"Delete",discard:"Discard",notInstalled:" (not installed)",notDetected:" (not detected)",current:" (current)",messages:" msgs",imported:" \xB7 imported",justNow:"Just now",minutesAgo:"{n}m ago",hoursAgo:"{n}h ago",daysAgo:"{n}d ago"},boot:{connecting:"Connecting\u2026",serviceDown:"Local service is not running",retry:"Retry",reconnecting:"Connection lost. Reconnecting\u2026",starting:"Starting local service\u2026",reopening:"The local service restarted. Reconnecting\u2026"},topbar:{pickThread:"Select a conversation",sidebar:"Sidebar (Ctrl+B)",clickRename:"Click to rename",waitAuth:"Waiting for approval",showRequest:"Show the request",running:"Running {s}s",error:"Error",closedResume:"Closed \xB7 send a message to resume",threadInfo:"Conversation info",panelChanges:"Changes (Ctrl+J)",panelFiles:"Files",panelTerminal:"Terminal"},sidebar:{newProject:"New project",collapse:"Collapse sidebar",expand:"Expand sidebar",filterPlaceholder:"Filter conversations",searchTitle:"Search (Ctrl+K)",noProjectsTitle:"No projects yet",noProjectsSub:"A project maps to a folder on this machine.",newThread:"New conversation",projectMenu:"Project menu",showAll:"Show all {n}",noThreads:"No conversations yet",rename:"Rename",pin:"Pin",unpin:"Unpin",archive:"Archive",unarchive:"Unarchive",exportMd:"Export Markdown",deleteThread:"Delete conversation",deleteThreadBody:"Move \u201C{title}\u201D to trash?",importHist:"Import existing conversations\u2026",openExplorer:"Open in Explorer",showArchived:"Show archived",hideArchived:"Hide archived",archivedN:"{n} archived",archivedHint:"Archived \u2014 see the bottom of the project list",unarchived:"Unarchived",exportSaved:"Exported to {path}",removeProject:"Remove project",removeProjectBody:"Remove \u201C{name}\u201D from the list? Conversations move to trash (files stay on disk).",renameProject:"Rename project",projectName:"Project name",newProjectDlg:"New project",dirLabel:"Project folder (must already exist)",dirMissing:"Folder does not exist",notDir:"This path is a file, not a folder",dirOk:"\u2713 Folder OK \u2014 name comes from the folder",recent:"Recent",pickFolderUnsupported:"Folder picker is not available \u2014 type the path",pickFolderFailed:"Could not open folder picker",importTitle:"Import conversations \u2014 {name}",scanning:"Scanning local history\u2026",importEmpty:"No history found for this project folder.",importing:"Importing\u2026",importN:"Import {n} conversation(s)",importedN:"Imported {n} conversation(s)",failNewThread:"Could not create conversation: ",failRename:"Rename failed: ",failAddProject:"Could not add project: ",failImportList:"Could not read history: ",failImport:"Import failed: ",failExport:"Export failed: "},chat:{newInProject:"New conversation in {name}",emptyHint:"No messages yet \u2014 type below to start.",jumpBottom:"Jump to bottom",emptyPlaceholder:"Describe a task \u2014 Enter to send",autoNewThread:"A new conversation will be created",failSend:"Send failed: ",pickProjectTitle:"Pick a project",pickProjectSub:"Choose a project in the sidebar, or create one, to start a conversation."},composer:{waitPerm:"Waiting for your approval above",queuePlaceholder:"Queue a message (Ctrl+Enter to steer)",queuePlaceholderNoSteer:"Add to the task \u2014 Enter queues it\u2026",steerUnsupported:"{agent} can't steer: messages sent while it runs are queued and sent after this turn.",queuedToast:"Queued \u2014 sends after this turn",steeredToast:"Steered",inputPlaceholder:"Message the agent, / for commands\u2026",autoWarn:`Auto-approve all lets the agent run commands and edit files without asking: Codex turns its sandbox off (danger-full-access), Claude Code skips all permission checks, and every other agent's approval requests are answered "allow once" by the console. Use with care.`,autoOn:{title:"Auto-approve all is on",back:"Back to Always Ask",keeps:"Plan approvals and questions still ask you; each approval covers only that one request and never saves a lasting rule."},autoDesc:{claude:"Claude Code runs with bypassPermissions: skips all permission checks, commands and edits never ask (use with care)",codex:"Codex sandbox off (danger-full-access) and never asks: commands can read and write your whole machine and use the network (use with care)",copilot:"Copilot Allow All: no tool call asks for confirmation (use with care)",devin:"Devin Bypass Permissions: skips all permission checks (use with care)",cursor:'Agent mode, every approval request answered "allow once" by the console: commands and edits run without asking (use with care)',opencode:'Build mode, every approval request answered "allow once" by the console: commands and edits run without asking (use with care)',generic:'Every approval request is answered "allow once" by the console: commands and edits run without asking (use with care)',pi:"Pi itself never asks: commands and edits run directly (dialogs from Pi extensions still ask you)"},imagesByPath:"{agent} can't see images directly: it gets the image's file path instead (it can open it with its file tools).",agentModel:"Agent & model",agentLocked:"Agent (locked after first message)",agent:"Agent",model:"Model",searchModel:"Search",searchAllModels:"Search all models\u2026",providers:"Providers",agentLockedHint:"The agent can't change after the conversation starts. Start a new conversation to use another agent.",providersLoading:"Detecting agents\u2026",moreModels:"{n} more models \u2014 use search above",pickModel:"Choose model",noModelMatch:"No matching models",refreshModels:"Refresh models",refreshingModels:"Refreshing\u2026",defaultModel:"Default",defaultEffort:"Default",defaultEffortNamed:"Default ({level})",effortTitle:"Reasoning effort",modeTitle:"Permission mode",attachTitle:"Attachments (images / text)",failSwitchAgent:"Could not switch agent: ",failSend:"Send failed: ",failUpload:"Upload failed: ",uploadFailed:"Upload failed",steerTag:"Steer",cursorAutoReview:"Auto accept permission prompts",cursorFastOff:"Off",cursorFastOn:"Fast",slashGroupCommand:"Commands",slashGroupSkill:"Skills",slashNoCommands:"This agent has no slash commands",slashLoading:"Loading commands\u2026",mode:{plan:{label:"Plan Mode",desc:"Analyze the codebase without running tools or edits"},default:{label:"Always Ask",desc:"Ask permission the first time a tool is used"},acceptEdits:{label:"Accept File Edits",desc:"Auto-approve edit tools without prompting"},bypass:{label:"Auto-approve all",desc:`Never asks: Codex turns its sandbox off, Claude Code skips all permission checks, other agents' requests are answered "allow once" (use with care)`},cursorBypass:{label:"Auto-approve all",desc:'Agent mode, every approval request answered "allow once" by the console (use with care)'},cursorAgent:{label:"Agent",desc:"Full agent: tools and edits"},cursorPlan:{label:"Plan",desc:"Read-only planning and analysis"},cursorAsk:{label:"Ask",desc:"Q&A style explanations (read-only)"},pi:{label:"Pi never asks",desc:"Pi itself never asks: commands and edits run directly (dialogs from Pi extensions still ask you)"}},agentMode:{},effort:{low:"Low",medium:"Medium",high:"High",xhigh:"Extra high",max:"Max",minimal:"Minimal",none:"Off"}},settings:{contentWidth:"Content width",widthNarrow:"Narrow (640)",widthDefault:"Default (720)",widthWide:"Wide (880)",widthFull:"Full",bashPath:"Bash path (Windows)",bashCheck:"Check",bashOk:"Works: {path}",bashUsing:"In use: {path} ({src})",bashNone:"Git Bash was not found.",bashManualBad:"The manual path can't be used ({why}); using auto-detection",bashHint:"Claude Code, Pi and dsh run commands with Git Bash on Windows. Leave empty to auto-detect (next to git.exe, Program Files, \\Git on each drive); fill in the full bash.exe path if it lives elsewhere.",bashNotWindows:"Only needed on Windows. macOS and Linux use the system bash.",bashSrc:{manual:"set manually",env:"environment variable",git:"next to git.exe",known:"default install folder",drive:"another drive",path:"PATH"},bashBad:{empty:"The path is empty",relative:"Use a full path, e.g. E:\\Git\\bin\\bash.exe",notBash:"It must point to bash.exe (or sh.exe)",wsl:"That is the WSL bash, which won't work",missing:"File not found"},chatFont:"Chat font size",chatFontDefault:" (default)",chatFontHint:"Scales the conversation, the input, tool output and code (code 1px smaller)",title:"Settings",defaultAgent:"Default agent",defaultMode:"Default permission mode",theme:"Theme",themeAuto:"System",themeMagpie:"Follow Magpie",themeLight:"Light",themeDark:"Dark",sendKey:"Send shortcut",sendEnter:"Enter sends / Shift+Enter newline",sendCtrl:"Ctrl+Enter sends / Enter newline",runningSend:"While running",queue:"Queue (run after current turn)",steer:"Steer (interrupt now)",steerHint:"Steer only works for agents that support it (Codex today); other agents still queue, and the composer says so.",defaultModeHint:"For new conversations. Each agent maps it to its own nearest mode (OpenCode only has Plan / Build, and Build edits without asking). With Auto-approve all, no agent asks for approval.",thinking:"Reasoning",showThinking:"Show agent reasoning/thinking",idleClose:"Idle cleanup",idleMinutes:"minutes before closing idle sessions (5\u2013240; at most 3 idle agent processes are kept)",idleInvalid:"Enter a whole number from 5 to 240",versionLine:"Version v{ver} \xB7 PID {pid}",dataDir:"Data: ",failSave:"Could not save: ",providers:"Providers",providerOn:"Available",providerOff:"Disabled",providerPending:"Not wired yet",providerVerified:"Verified",providerExperimental:"Experimental",providerPlanned:"Planned",providerModels:"{n} models",providerRedetect:"Re-detect",providerCopyHint:"Copy install hint",providerLaunchCmd:"Custom launch (advanced)",providerLaunchExe:"Executable path (empty = find it automatically)",providerLaunchArgs:"Extra args (JSON array)",providerLaunchArgsHint:'Added after the built-in arguments, e.g. ["--foo"]. Saved on Enter or when you leave the field. Applies to new sessions.',providerArgsInvalid:'Needs a JSON array of strings, e.g. ["--foo"]',providerToggleFailed:"Could not switch it; reverted: "},palette:{aria:"Command palette",placeholder:"Search conversations, projects, actions\u2026",noMatch:"No matches",hintAction:"Action",hintThread:"Conversation",hintProject:"Project",actNewThread:"New conversation",actSettings:"Open settings",actTheme:"Toggle theme",actChanges:"Open changes panel",actFiles:"Open files panel",actTerminal:"Open terminal panel",actImport:"Import existing conversations\u2026",failNew:"Could not create: "},panel:{changes:"Changes",files:"Files",terminal:"Terminal",closeTitle:"Close (Ctrl+J)",pickProject:"Select a project first",notGit:"This folder is not a git repository",clean:"Working tree clean",branch:"Current branch",loadingDiff:"Loading diff\u2026",diffTooLarge:"Diff is over 1MB \u2014 not shown",discardTitle:"Discard changes",discardUntracked:`Discard changes to {path}? -Untracked files move to trash/discarded.`,discardTracked:"Discard changes to {path}? The file reverts to the git version.",discardBtn:"Discard",failDiscard:"Discard failed: ",closePreview:"Close preview",reading:"Reading\u2026",binary:"Binary file \u2014 no preview",tooLarge:"Over 1MB \u2014 no preview",gitKind:{modified:"M",added:"A",deleted:"D",untracked:"?",renamed:"R"}},terminal:{new:"New terminal",noTerm:"No terminals yet",closeTitle:"Close terminal",closeBody:"Close \u201C{title}\u201D? Running processes will be killed.",closeOk:"Close",simpleNote:"Simple terminal (no full TTY programs)",ended:"(Terminal ended)",failNew:"Could not create terminal: ",failKill:"Could not close: "},thread:{new:"New chat",info:"Conversation info",agent:"Agent",model:"Model",mode:"Mode",effort:"Effort",sessionId:"Session ID",tokens:"Total tokens",cost:"Total cost",created:"Created",workdir:"Working directory",importedFrom:"Imported from",sessionNone:"(none)",tokensFmt:"{in} in / {out} out / {cache} cache"},timeline:{thinking:"Thinking {s}s",todo:"Todos {done}/{total}",steer:"Steer",tasks:"tasks",tasksPill:"{done}/{total} tasks",tasksPillTitle:"Show the task list",codeWrap:"Wrap lines",permAllowSession:"Allowed for this chat",permDenied:"Denied",permAllowed:"Allowed",permAutoAllowed:"Auto-approved (Auto-approve all)",permCancelled:"Cancelled",autoUpgrade:{title:"New in 1.3: Auto-approve all",body:`Auto-approve all now really works for Cursor, OpenCode and dsh: the console answers their approval requests "allow once", so commands and edits run without asking. 1.2's bypass mode did nothing for them (they still asked). Your default permission mode was set to it, so to be safe this conversation starts in Always Ask. Pick the default permission mode again in Settings and new conversations follow your choice.`,migrated:"This conversation was set to bypass permissions in 1.2, where this agent still asked anyway. From 1.3 Auto-approve all really auto-approves (commands and edits run without asking), so it was put back to Always Ask.",turnOn:"Turn on Auto-approve all here",settings:"Open Settings"},autoApproved:{count:"Auto-approved {n}",title:"Requests Auto-approve all approved for you (click to see them)",answer:"{opt} \xB7 Auto-approve all",pending:"Auto-approving\u2026"},submitted:"Submitted: {ans}",turnError:"Error: {err}",unknownError:"Unknown error",interrupted:"Interrupted",filesChanged:"{n} file(s) changed \u203A",editMsg:"Edit (puts it back in the input; nothing is sent yet)",sendFailed:"Not sent",sendRetry:"Send again",sendDismiss:"Remove this unsent message",resend:"Send this message again",retryHint:"Retry: send the last message again",msgActions:"Message actions",editBusy:"The input still has unsent text: send or clear it first, then click Edit",tool:{read:"Read",edit:"Edit",write:"Write",bash:"Run",search:"Search",glob:"Search",web:"Web",task:"Subtask",mcp:"Tool",todo:"Todo",other:"Tool",processing:"Working"},cat:{edit:"Edited {n}",run:"Ran {n}",read:"Read {n}",search:"Searched {n}",other:"Other {n}"},failedCount:"{n} failed",noErrorOutput:"No error output",nowThinking:"Thinking\u2026",now:{edit:"Editing: {x}\u2026",run:"Running: {x}\u2026",read:"Reading: {x}\u2026",search:"Searching: {x}\u2026",other:"Working: {x}\u2026"},bashMissing:"Git Bash was not found. Claude Code, Pi and similar agents need it to run commands on Windows. (C:\\Windows\\System32\\bash.exe is the WSL launcher and won't work.) Install Git for Windows and send again; if it is installed elsewhere, set bash.exe under Settings \u2192 Bash path.",bashDownload:"Download Git for Windows",bashSetting:"Open Settings",showAllLines:"Show all {n} lines",diffClip:"(first {n} lines only)"},api:{requestFailed:"Request failed",bad_params:"Invalid parameters",not_found:"Not found",busy:"Busy \u2014 try again later",bad_path:"Invalid path",connClosed:"Connection lost",notConnected:"Not connected",timeout:"Request timed out"},preview:{tab:"Preview",address:"Preview address",placeholder:"localhost:5173",back:"Back",forward:"Forward",reload:"Reload",openExternal:"Open in browser",widen:"Widen panel",onlyLocal:"Preview only supports local addresses (localhost, 127.0.0.1, \u2026)",failed:"Can't open the preview: ",empty:"Nothing to preview yet. Click a localhost link in the chat, or type an address above, e.g. localhost:5173",limits:"The preview runs sandboxed: popups, alert and native form posts don't work; localStorage and login cookies are lost on reload. Open it in your browser when you need them.",noLocalhost:"This system's web view can't open *.localhost addresses (macOS before 26 can't). The preview needs one to keep other web pages out of your dev server, so it can't run here: open it in your browser instead."},links:{openPreviewTitle:"Open in Preview (Ctrl/\u2318+click opens the browser)",externalFailed:"Couldn't open the browser; the link was copied"},quote:{add:"Add to chat",addHint:"Quote the selected text in the input (nothing is sent yet)",chipTitle:"Quoted text (sent in front of your message as a quote)",remove:"Remove quote",full:"{n} quotes at most",lines:"{n} lines"},mention:{drop:"Drop to add to the chat",add:"Add to chat",copyRel:"Copy relative path",remove:"Remove",otherProject:"Only files of this conversation's project can be added"}}}});function xm(e){let t=String(e??"").trim().toLowerCase();return t?t==="zh"||t.startsWith("zh-")?"zh":"en":dD()}function dD(){let e=typeof navigator<"u"?navigator.language:"";return xm(e||"zh")}function Yy(e){let t=new URLSearchParams(e).get("lang");Cr=xm(t);let i=Cr==="zh"?"zh-CN":"en";return typeof document<"u"&&(document.documentElement.lang=i),Cr}function Vy(e){let t=xm(e);return t===Cr?!1:(Cr=t,typeof document<"u"&&(document.documentElement.lang=Cr==="zh"?"zh-CN":"en"),!0)}function Da(){return Cr}function Ad(){return Cr==="zh"?"zh-CN":"en-US"}function jy(e,t){let i=t.split("."),n=e;for(let r of i){if(typeof n!="object"||n==null||!(r in n))return;n=n[r]}return typeof n=="string"?n:void 0}function g(e){return jy(wm[Cr],e)??jy(wm.en,e)??e}function _e(e,t){let i=g(e);for(let[n,r]of Object.entries(t))i=i.replaceAll(`{${n}}`,String(r));return i}function Ze(e){let t=e,i=t?.code;if(i){let r=g(`api.${i}`);if(r!==`api.${i}`)return r}let n=String(t?.message??e);return Tr(n)}function Tr(e){if(Cr==="zh")return e;if(e==="\u540E\u53F0\u5DF2\u91CD\u542F\uFF0C\u672C\u8F6E\u5DF2\u4E2D\u65AD")return"Daemon restarted \u2014 this turn was interrupted";if(e.startsWith("\u4F1A\u8BDD\u542F\u52A8\u5931\u8D25\uFF1A"))return"Session start failed: "+e.slice(7);if(e.startsWith("\u53D1\u9001\u5931\u8D25\uFF1A"))return"Send failed: "+e.slice(5);if(e==="Agent \u8FDB\u7A0B\u610F\u5916\u9000\u51FA")return"Agent process exited unexpectedly";let t=e.match(/^附件不存在或已失效((.+)),请重新上传$/);if(t)return`Attachment missing or expired (${t[1]}) \u2014 upload again`;let i=e.match(/^(.+) 不能直接看图片(它的 ACP 初始化未声明支持图片输入),已改为发送图片的文件路径:(.+)$/s);return i?`${i[1]} can't see images directly (its ACP initialize doesn't advertise image input); sent the image file path instead: ${i[2]}`:e.startsWith("\u9644\u4EF6\u95EE\u9898\uFF1A")?"Attachment issue: "+e.slice(5):e}function Md(e,t){return t&&(e==="\u65B0\u5BF9\u8BDD"||e==="New chat")?g("thread.new"):e}var Cr,Ct=ae(()=>{Gy();Cr="zh"});function pD(e=typeof navigator<"u"?navigator.userAgent:""){return/AppleWebKit\//i.test(e)&&/Macintosh|iPhone|iPad|iPod/i.test(e)&&!/Chrome\//i.test(e)&&!/Chromium\//i.test(e)&&!/Edg(?:e|A|iOS)?\//i.test(e)&&!/OPR\//i.test(e)&&!/CriOS\//i.test(e)&&!/FxiOS\//i.test(e)}function mD(e,t=typeof navigator<"u"?navigator.userAgent:""){if(!pD(t))return!1;if(!e||typeof e.platform!="string"||!e.platform)return!0;if(e.platform!=="darwin")return!1;let i=e.darwinMajor;return typeof i!="number"||!Number.isInteger(i)?!0:in.abort(),i);try{let s=await fetch(e+hD,{cache:"no-store",credentials:"omit",referrerPolicy:"no-referrer",signal:n.signal});return s.ok?await s.text()===t:!1}catch{return!1}finally{clearTimeout(r)}}async function gD(e,t=5e3){return await Zy(e.canaryOrigin,e.canaryNonce,t)?Zy(e.proxyOrigin,e.nonce,t):!1}function Od(e){let t=ns(e);return t.ok?ym(t.target.origin)+t.target.path:e}var Xy,_c,Em,hD,fD,xi,Rd=ae(()=>{Ra();Nd();Ct();Xy=()=>g("preview.noLocalhost"),_c=e=>e??"_",Em=new Map,hD="/__agent_console__/ping",fD=25;xi=qn((e,t)=>({byThread:{},navigate:async(i,n,r,s,a)=>{let o=ns(s);if(!o.ok)return!1;let l=o.target,c=t().byThread[n],u=c&&c.origin===l.origin&&c.proxyOrigin,d=c?.stack??[],h=c?.idx??-1;if(a?.push!==!1?d[h]!==l.href&&(d=[...d.slice(0,h+1),l.href].slice(-50),h=d.length-1):d.length||(d=[l.href],h=0),u)return e(_=>({byThread:{..._.byThread,[n]:{...c,url:l.href,proxyHref:c.proxyOrigin+l.path,error:null,nonce:c.nonce+1,stack:d,idx:h}}})),r&&i("threads.update",{id:r,previewUrl:l.href}).catch(()=>{}),!0;e(_=>({byThread:{..._.byThread,[n]:{url:l.href,origin:l.origin,proxyOrigin:null,proxyHref:null,title:c?.origin===l.origin?c.title:"",loading:!0,error:null,nonce:(c?.nonce??0)+1,bridged:!1,stack:d,idx:h}}}));let f=`${n} -${l.href}`,p=Em.get(f);return p||(p=(async()=>{try{let _=await i("preview.open",{url:l.href,...r?{threadId:r}:{}});if(mD(_?.host))throw i("preview.release",{url:l.origin}).catch(()=>{}),new Error(Xy());if(!await gD(_))throw i("preview.release",{url:l.origin}).catch(()=>{}),new Error(Xy());return e(y=>{let m=y.byThread[n];return!m||m.url!==l.href?y:{byThread:{...y.byThread,[n]:{...m,proxyOrigin:_.proxyOrigin,proxyHref:_.proxyHref,loading:!1,error:null}}}}),!0}catch(_){let y=String(_?.message??_);return e(m=>{let v=m.byThread[n];return!v||v.url!==l.href?m:{byThread:{...m.byThread,[n]:{...v,loading:!1,error:y}}}}),!1}finally{Em.delete(f)}})(),Em.set(f,p)),p},reported:(i,n,r)=>{e(s=>{let a=s.byThread[i];if(!a)return s;let{stack:o,idx:l}=a;return o[l]!==n&&(o[l-1]===n?l-=1:o[l+1]===n?l+=1:(o=[...o.slice(0,l+1),n].slice(-50),l=o.length-1)),{byThread:{...s.byThread,[i]:{...a,url:n,title:r,bridged:!0,stack:o,idx:l}}}})},detach:i=>{e(n=>{let r=n.byThread[i];return r?{byThread:{...n.byThread,[i]:{...r,proxyOrigin:null,proxyHref:null,bridged:!1}}}:n})},reload:i=>{e(n=>{let r=n.byThread[i];return r?{byThread:{...n.byThread,[i]:{...r,nonce:r.nonce+1,error:null}}}:n})},step:(i,n)=>{let r=t().byThread[i];if(!r)return null;let s=r.idx+n;return s<0||s>=r.stack.length?null:(e(a=>({byThread:{...a.byThread,[i]:{...r,idx:s}}})),r.stack[s])}}))});var Qy=ae(()=>{});var Jy=ae(()=>{});var eS=ae(()=>{});var tS=ae(()=>{});var iS=ae(()=>{});var hS=we(Tt=>{"use strict";function Nm(e,t){var i=e.length;e.push(t);e:for(;0>>1,r=e[n];if(0>>1;nDd(o,i))lDd(c,o)?(e[n]=c,e[l]=i,n=l):(e[n]=o,e[a]=i,n=a);else if(lDd(c,i))e[n]=c,e[l]=i,n=l;else break e}}return t}function Dd(e,t){var i=e.sortIndex-t.sortIndex;return i!==0?i:e.id-t.id}Tt.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(nS=performance,Tt.unstable_now=function(){return nS.now()}):(km=Date,rS=km.now(),Tt.unstable_now=function(){return km.now()-rS});var nS,km,rS,rs=[],Hs=[],_D=1,Fn=null,zi=3,Am=!1,vc=!1,bc=!1,Mm=!1,oS=typeof setTimeout=="function"?setTimeout:null,lS=typeof clearTimeout=="function"?clearTimeout:null,sS=typeof setImmediate<"u"?setImmediate:null;function Ld(e){for(var t=Nr(Hs);t!==null;){if(t.callback===null)Id(Hs);else if(t.startTime<=e)Id(Hs),t.sortIndex=t.expirationTime,Nm(rs,t);else break;t=Nr(Hs)}}function Om(e){if(bc=!1,Ld(e),!vc)if(Nr(rs)!==null)vc=!0,$o||($o=!0,Wo());else{var t=Nr(Hs);t!==null&&Rm(Om,t.startTime-e)}}var $o=!1,yc=-1,cS=5,uS=-1;function dS(){return Mm?!0:!(Tt.unstable_now()-uSe&&dS());){var n=Fn.callback;if(typeof n=="function"){Fn.callback=null,zi=Fn.priorityLevel;var r=n(Fn.expirationTime<=e);if(e=Tt.unstable_now(),typeof r=="function"){Fn.callback=r,Ld(e),t=!0;break t}Fn===Nr(rs)&&Id(rs),Ld(e)}else Id(rs);Fn=Nr(rs)}if(Fn!==null)t=!0;else{var s=Nr(Hs);s!==null&&Rm(Om,s.startTime-e),t=!1}}break e}finally{Fn=null,zi=i,Am=!1}t=void 0}}finally{t?Wo():$o=!1}}}var Wo;typeof sS=="function"?Wo=function(){sS(Cm)}:typeof MessageChannel<"u"?(Tm=new MessageChannel,aS=Tm.port2,Tm.port1.onmessage=Cm,Wo=function(){aS.postMessage(null)}):Wo=function(){oS(Cm,0)};var Tm,aS;function Rm(e,t){yc=oS(function(){e(Tt.unstable_now())},t)}Tt.unstable_IdlePriority=5;Tt.unstable_ImmediatePriority=1;Tt.unstable_LowPriority=4;Tt.unstable_NormalPriority=3;Tt.unstable_Profiling=null;Tt.unstable_UserBlockingPriority=2;Tt.unstable_cancelCallback=function(e){e.callback=null};Tt.unstable_forceFrameRate=function(e){0>e||125n?(e.sortIndex=i,Nm(Hs,e),Nr(rs)===null&&e===Nr(Hs)&&(bc?(lS(yc),yc=-1):bc=!0,Rm(Om,i-n))):(e.sortIndex=r,Nm(rs,e),vc||Am||(vc=!0,$o||($o=!0,Wo()))),e};Tt.unstable_shouldYield=dS;Tt.unstable_wrapCallback=function(e){var t=zi;return function(){var i=zi;zi=t;try{return e.apply(this,arguments)}finally{zi=i}}}});var pS=we((g9,fS)=>{"use strict";fS.exports=hS()});var _S=we(Bi=>{"use strict";var vD=pt();function gS(e){var t="https://react.dev/errors/"+e;if(1{"use strict";function vS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(vS)}catch(e){console.error(e)}}vS(),bS.exports=_S()});var sk=we(vf=>{"use strict";var ii=pS(),r1=pt(),wD=qs();function F(e){var t="https://react.dev/errors/"+e;if(1Jo||(e.current=vg[Jo],vg[Jo]=null,Jo--)}function _t(e,t){Jo++,vg[Jo]=e.current,e.current=t}var Pr=qr(null),Gc=qr(null),ea=qr(null),xh=qr(null);function Eh(e,t){switch(_t(ea,t),_t(Gc,e),_t(Pr,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Bw(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Bw(t),e=LE(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ti(Pr),_t(Pr,e)}function bl(){Ti(Pr),Ti(Gc),Ti(ea)}function bg(e){var t=e.memoizedState;t!==null&&(Al._currentValue=t.memoizedState,_t(xh,e)),t=Pr.current;var i=LE(t,e.type);t!==i&&(_t(Gc,e),_t(Pr,i))}function kh(e){Gc.current===e&&(Ti(Pr),Ti(Gc)),xh.current===e&&(Ti(xh),Al._currentValue=qa)}var Dm,ES;function Ws(e){if(Dm===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Dm=t&&t[1]||"",ES=-1{iS();Nr="zh"});function OD(e=typeof navigator<"u"?navigator.userAgent:""){return/AppleWebKit\//i.test(e)&&/Macintosh|iPhone|iPad|iPod/i.test(e)&&!/Chrome\//i.test(e)&&!/Chromium\//i.test(e)&&!/Edg(?:e|A|iOS)?\//i.test(e)&&!/OPR\//i.test(e)&&!/CriOS\//i.test(e)&&!/FxiOS\//i.test(e)}function RD(e,t=typeof navigator<"u"?navigator.userAgent:""){if(!OD(t))return!1;if(!e||typeof e.platform!="string"||!e.platform)return!0;if(e.platform!=="darwin")return!1;let i=e.darwinMajor;return typeof i!="number"||!Number.isInteger(i)?!0:in.abort(),i);try{let s=await fetch(e+AD,{cache:"no-store",credentials:"omit",referrerPolicy:"no-referrer",signal:n.signal});return s.ok?await s.text()===t:!1}catch{return!1}finally{clearTimeout(r)}}async function DD(e,t=5e3){return await oS(e.canaryOrigin,e.canaryNonce,t)?oS(e.proxyOrigin,e.nonce,t):!1}function Fd(e){let t=ss(e);return t.ok?Cm(t.target.origin)+t.target.path:e}var aS,Ec,Mm,AD,MD,ki,$d=te(()=>{Pa();Hd();kt();aS=()=>g("preview.noLocalhost"),Ec=e=>e??"_",Mm=new Map,AD="/__agent_console__/ping",MD=25;ki=$n((e,t)=>({byThread:{},navigate:async(i,n,r,s,a)=>{let o=ss(s);if(!o.ok)return!1;let l=o.target,c=t().byThread[n],u=c&&c.origin===l.origin&&c.proxyOrigin,d=c?.stack??[],h=c?.idx??-1;if(a?.push!==!1?d[h]!==l.href&&(d=[...d.slice(0,h+1),l.href].slice(-50),h=d.length-1):d.length||(d=[l.href],h=0),u)return e(_=>({byThread:{..._.byThread,[n]:{...c,url:l.href,proxyHref:c.proxyOrigin+l.path,error:null,nonce:c.nonce+1,stack:d,idx:h}}})),r&&i("threads.update",{id:r,previewUrl:l.href}).catch(()=>{}),!0;e(_=>({byThread:{..._.byThread,[n]:{url:l.href,origin:l.origin,proxyOrigin:null,proxyHref:null,title:c?.origin===l.origin?c.title:"",loading:!0,error:null,nonce:(c?.nonce??0)+1,bridged:!1,stack:d,idx:h}}}));let f=`${n} +${l.href}`,p=Mm.get(f);return p||(p=(async()=>{try{let _=await i("preview.open",{url:l.href,...r?{threadId:r}:{}});if(RD(_?.host))throw i("preview.release",{url:l.origin}).catch(()=>{}),new Error(aS());if(!await DD(_))throw i("preview.release",{url:l.origin}).catch(()=>{}),new Error(aS());return e(y=>{let m=y.byThread[n];return!m||m.url!==l.href?y:{byThread:{...y.byThread,[n]:{...m,proxyOrigin:_.proxyOrigin,proxyHref:_.proxyHref,loading:!1,error:null}}}}),!0}catch(_){let y=String(_?.message??_);return e(m=>{let v=m.byThread[n];return!v||v.url!==l.href?m:{byThread:{...m.byThread,[n]:{...v,loading:!1,error:y}}}}),!1}finally{Mm.delete(f)}})(),Mm.set(f,p)),p},reported:(i,n,r)=>{e(s=>{let a=s.byThread[i];if(!a)return s;let{stack:o,idx:l}=a;return o[l]!==n&&(o[l-1]===n?l-=1:o[l+1]===n?l+=1:(o=[...o.slice(0,l+1),n].slice(-50),l=o.length-1)),{byThread:{...s.byThread,[i]:{...a,url:n,title:r,bridged:!0,stack:o,idx:l}}}})},detach:i=>{e(n=>{let r=n.byThread[i];return r?{byThread:{...n.byThread,[i]:{...r,proxyOrigin:null,proxyHref:null,bridged:!1}}}:n})},reload:i=>{e(n=>{let r=n.byThread[i];return r?{byThread:{...n.byThread,[i]:{...r,nonce:r.nonce+1,error:null}}}:n})},step:(i,n)=>{let r=t().byThread[i];if(!r)return null;let s=r.idx+n;return s<0||s>=r.stack.length?null:(e(a=>({byThread:{...a.byThread,[i]:{...r,idx:s}}})),r.stack[s])}}))});var lS=te(()=>{});var cS=te(()=>{});var uS=te(()=>{});var dS=te(()=>{});var hS=te(()=>{});var wS=xe(At=>{"use strict";function Lm(e,t){var i=e.length;e.push(t);e:for(;0>>1,r=e[n];if(0>>1;nWd(o,i))lWd(c,o)?(e[n]=c,e[l]=i,n=l):(e[n]=o,e[a]=i,n=a);else if(lWd(c,i))e[n]=c,e[l]=i,n=l;else break e}}return t}function Wd(e,t){var i=e.sortIndex-t.sortIndex;return i!==0?i:e.id-t.id}At.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(fS=performance,At.unstable_now=function(){return fS.now()}):(Om=Date,pS=Om.now(),At.unstable_now=function(){return Om.now()-pS});var fS,Om,pS,as=[],$s=[],LD=1,Wn=null,Pi=3,Im=!1,kc=!1,Cc=!1,zm=!1,_S=typeof setTimeout=="function"?setTimeout:null,vS=typeof clearTimeout=="function"?clearTimeout:null,mS=typeof setImmediate<"u"?setImmediate:null;function Kd(e){for(var t=Mr($s);t!==null;){if(t.callback===null)Gd($s);else if(t.startTime<=e)Gd($s),t.sortIndex=t.expirationTime,Lm(as,t);else break;t=Mr($s)}}function Bm(e){if(Cc=!1,Kd(e),!kc)if(Mr(as)!==null)kc=!0,jo||(jo=!0,Go());else{var t=Mr($s);t!==null&&Pm(Bm,t.startTime-e)}}var jo=!1,Tc=-1,bS=5,yS=-1;function SS(){return zm?!0:!(At.unstable_now()-ySe&&SS());){var n=Wn.callback;if(typeof n=="function"){Wn.callback=null,Pi=Wn.priorityLevel;var r=n(Wn.expirationTime<=e);if(e=At.unstable_now(),typeof r=="function"){Wn.callback=r,Kd(e),t=!0;break t}Wn===Mr(as)&&Gd(as),Kd(e)}else Gd(as);Wn=Mr(as)}if(Wn!==null)t=!0;else{var s=Mr($s);s!==null&&Pm(Bm,s.startTime-e),t=!1}}break e}finally{Wn=null,Pi=i,Im=!1}t=void 0}}finally{t?Go():jo=!1}}}var Go;typeof mS=="function"?Go=function(){mS(Rm)}:typeof MessageChannel<"u"?(Dm=new MessageChannel,gS=Dm.port2,Dm.port1.onmessage=Rm,Go=function(){gS.postMessage(null)}):Go=function(){_S(Rm,0)};var Dm,gS;function Pm(e,t){Tc=_S(function(){e(At.unstable_now())},t)}At.unstable_IdlePriority=5;At.unstable_ImmediatePriority=1;At.unstable_LowPriority=4;At.unstable_NormalPriority=3;At.unstable_Profiling=null;At.unstable_UserBlockingPriority=2;At.unstable_cancelCallback=function(e){e.callback=null};At.unstable_forceFrameRate=function(e){0>e||125n?(e.sortIndex=i,Lm($s,e),Mr(as)===null&&e===Mr($s)&&(Cc?(vS(Tc),Tc=-1):Cc=!0,Pm(Bm,i-n))):(e.sortIndex=r,Lm(as,e),kc||Im||(kc=!0,jo||(jo=!0,Go()))),e};At.unstable_shouldYield=SS;At.unstable_wrapCallback=function(e){var t=Pi;return function(){var i=Pi;Pi=t;try{return e.apply(this,arguments)}finally{Pi=i}}}});var ES=xe((z9,xS)=>{"use strict";xS.exports=wS()});var TS=xe(Hi=>{"use strict";var ID=bt();function CS(e){var t="https://react.dev/errors/"+e;if(1{"use strict";function NS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(NS)}catch(e){console.error(e)}}NS(),AS.exports=TS()});var mk=xe(Af=>{"use strict";var ri=ES(),p1=bt(),HD=Ks();function F(e){var t="https://react.dev/errors/"+e;if(1il||(e.current=Eg[il],Eg[il]=null,il--)}function wt(e,t){il++,Eg[il]=e.current,e.current=t}var Ur=$r(null),Jc=$r(null),ra=$r(null),Lh=$r(null);function Ih(e,t){switch(wt(ra,t),wt(Jc,e),wt(Ur,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?jw(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=jw(t),e=WE(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ai(Ur),wt(Ur,e)}function wl(){Ai(Ur),Ai(Jc),Ai(ra)}function kg(e){var t=e.memoizedState;t!==null&&(Rl._currentValue=t.memoizedState,wt(Lh,e)),t=Ur.current;var i=WE(t,e.type);t!==i&&(wt(Jc,e),wt(Ur,i))}function zh(e){Jc.current===e&&(Ai(Ur),Ai(Jc)),Lh.current===e&&(Ai(Lh),Rl._currentValue=Ga)}var Hm,LS;function js(e){if(Hm===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Hm=t&&t[1]||"",LS=-1)":-1r||l[n]!==c[r]){var u=` -`+l[n].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=n&&0<=r);break}}}finally{Lm=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?Ws(i):""}function OD(e,t){switch(e.tag){case 26:case 27:case 5:return Ws(e.type);case 16:return Ws("Lazy");case 13:return e.child!==t&&t!==null?Ws("Suspense Fallback"):Ws("Suspense");case 19:return Ws("SuspenseList");case 0:case 15:return Im(e.type,!1);case 11:return Im(e.type.render,!1);case 1:return Im(e.type,!0);case 31:return Ws("Activity");case 30:return Ws("ViewTransition");default:return""}}function kS(e){try{var t="",i=null;do t+=OD(e,i),i=e,e=e.return;while(e);return t}catch(n){return` +`+l[n].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=n&&0<=r);break}}}finally{Um=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?js(i):""}function YD(e,t){switch(e.tag){case 26:case 27:case 5:return js(e.type);case 16:return js("Lazy");case 13:return e.child!==t&&t!==null?js("Suspense Fallback"):js("Suspense");case 19:return js("SuspenseList");case 0:case 15:return qm(e.type,!1);case 11:return qm(e.type.render,!1);case 1:return qm(e.type,!0);case 31:return js("Activity");case 30:return js("ViewTransition");default:return""}}function IS(e){try{var t="",i=null;do t+=YD(e,i),i=e,e=e.return;while(e);return t}catch(n){return` Error generating stack: `+n.message+` -`+n.stack}}var yg=Object.prototype.hasOwnProperty,x_=ii.unstable_scheduleCallback,zm=ii.unstable_cancelCallback,RD=ii.unstable_shouldYield,DD=ii.unstable_requestPaint,xn=ii.unstable_now,LD=ii.unstable_getCurrentPriorityLevel,f1=ii.unstable_ImmediatePriority,p1=ii.unstable_UserBlockingPriority,Ch=ii.unstable_NormalPriority,ID=ii.unstable_LowPriority,m1=ii.unstable_IdlePriority,zD=ii.log,BD=ii.unstable_setDisableYieldValue,cu=null,En=null;function Ys(e){if(typeof zD=="function"&&BD(e),En&&typeof En.setStrictMode=="function")try{En.setStrictMode(cu,e)}catch{}}var kn=Math.clz32?Math.clz32:UD,PD=Math.log,HD=Math.LN2;function UD(e){return e>>>=0,e===0?32:31-(PD(e)/HD|0)|0}var Pd=256,Hd=262144,Ud=4194304;function za(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Qh(e,t,i){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var o=n&134217727;return o!==0?(n=o&~s,n!==0?r=za(n):(a&=o,a!==0?r=za(a):i||(i=o&~e,i!==0&&(r=za(i))))):(o=n&~s,o!==0?r=za(o):a!==0?r=za(a):i||(i=n&~e,i!==0&&(r=za(i)))),r===0?0:t!==0&&t!==r&&(t&s)===0&&(s=r&-r,i=t&-t,s>=i||s===32&&(i&4194048)!==0)?t:r}function uu(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function g1(e,t){(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0i;i++)t.push(e);return t}function du(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function FD(e,t,i,n,r,s){var a=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var o=e.entanglements,l=e.expirationTimes,c=e.hiddenUpdates;for(i=a&~i;0"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Eg=!1;if(ds)try{Ko={},Object.defineProperty(Ko,"passive",{get:function(){Eg=!0}}),window.addEventListener("test",Ko,Ko),window.removeEventListener("test",Ko,Ko)}catch{Eg=!1}var Ko,Vs=null,N_=null,ah=null;function R1(){if(ah)return ah;var e,t=N_,i=t.length,n,r="value"in Vs?Vs.value:Vs.textContent,s=r.length;for(e=0;e=Dc),PS=" ",HS=!1;function L1(e,t){switch(e){case"keyup":return EL.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function I1(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var tl=!1;function CL(e,t){switch(e){case"compositionend":return I1(t);case"keypress":return t.which!==32?null:(HS=!0,PS);case"textInput":return e=t.data,e===PS&&HS?null:e;default:return null}}function TL(e,t){if(tl)return e==="compositionend"||!M_&&L1(e,t)?(e=R1(),ah=N_=Vs=null,tl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function WS(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function $S(e,t){var i=WS(e);e=0;for(var n;i;){if(i.nodeType===3){if(n=e+i.textContent.length,e<=t&&n>=t)return{node:i,offset:t-e};e=n}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=WS(i)}}function H1(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?H1(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function U1(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=kg(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=kg(e.document)}return t}function O_(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var IL=ds&&"documentMode"in document&&11>=document.documentMode,il=null,Cg=null,Ic=null,Tg=!1;function KS(e,t,i){var n=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Tg||il==null||il!==kg(n)||(n=il,"selectionStart"in n&&O_(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Ic&&Vc(Ic,n)||(Ic=n,n=Vh(Cg,"onSelect"),0>=a,r-=a,zr=1<<32-kn(t)+r|i<A?(I=T,T=null):I=T.sibling;var B=h(m,T,b[A],w);if(B===null){T===null&&(T=I);break}e&&T&&B.alternate===null&&t(m,T),v=s(B,v,A),M===null?k=B:M.sibling=B,M=B,T=I}if(A===b.length)return i(m,T),Ie&&os(m,A),k;if(T===null){for(;AA?(I=T,T=null):I=T.sibling;var q=h(m,T,B.value,w);if(q===null){T===null&&(T=I);break}e&&T&&q.alternate===null&&t(m,T),v=s(q,v,A),M===null?k=q:M.sibling=q,M=q,T=I}if(B.done)return i(m,T),Ie&&os(m,A),k;if(T===null){for(;!B.done;A++,B=b.next())B=d(m,B.value,w),B!==null&&(v=s(B,v,A),M===null?k=B:M.sibling=B,M=B);return Ie&&os(m,A),k}for(T=n(T);!B.done;A++,B=b.next())B=f(T,m,A,B.value,w),B!==null&&(e&&(I=B.alternate,I!==null&&T.delete(I.key===null?A:I.key)),v=s(B,v,A),M===null?k=B:M.sibling=B,M=B);return e&&T.forEach(function(H){return t(m,H)}),Ie&&os(m,A),k}function y(m,v,b,w){if(typeof b=="object"&&b!==null&&b.type===Qo&&b.key===null&&b.props.ref===void 0&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Bd:e:{for(var k=b.key;v!==null;){if(v.key===k){if(k=b.type,k===Qo){if(v.tag===7){i(m,v.sibling),w=r(v,b.props.children),Fs(w,b),w.return=m,m=w;break e}}else if(v.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Ks&&Ba(k)===v.type){i(m,v.sibling),w=r(v,b.props),Fs(w,b),w.return=m,m=w;break e}i(m,v);break}else t(m,v);v=v.sibling}b.type===Qo?(w=Fa(b.props.children,m.mode,w,b.key),Fs(w,b),w.return=m,m=w):(w=lh(b.type,b.key,b.props,null,m.mode,w),Fs(w,b),w.return=m,m=w)}return a(m);case Nc:e:{for(k=b.key;v!==null;){if(v.key===k)if(v.tag===4&&v.stateNode.containerInfo===b.containerInfo&&v.stateNode.implementation===b.implementation){i(m,v.sibling),w=r(v,b.children||[]),w.return=m,m=w;break e}else{i(m,v);break}else t(m,v);v=v.sibling}w=Gm(b,m.mode,w),w.return=m,m=w}return a(m);case Ks:return b=Ba(b),y(m,v,b,w)}if(Ac(b))return p(m,v,b,w);if(wc(b)){if(k=wc(b),typeof k!="function")throw Error(F(150));return b=k.call(b),_(m,v,b,w)}if(typeof b.then=="function")return y(m,v,Gd(b),w);if(b.$$typeof===Lr)return y(m,v,Kd(m,b),w);jd(m,b)}return typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint"?(b=""+b,v!==null&&v.tag===6?(i(m,v.sibling),w=r(v,b),w.return=m,m=w):(i(m,v),w=Km(b,m.mode,w),w.return=m,m=w),a(m)):i(m,v)}return function(m,v,b,w){try{Qc=0;var k=y(m,v,b,w);return fl=null,k}catch(T){if(T===Ll||T===of)throw T;var M=ln(29,T,null,m.mode);return M.lanes=w,M.return=m,M}}}var Xa=tx(!0),ix=tx(!1),Gs=!1;function H_(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Dg(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ia(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function na(e,t,i){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(Ve&2)!==0){var r=n.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),n.pending=t,t=Ah(e),j1(e,null,i),t}return sf(e,n,t,i),Ah(e)}function Bc(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var n=t.lanes;n&=e.pendingLanes,i|=n,t.lanes=i,b1(e,i)}}function Ym(e,t){var i=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,i===n)){var r=null,s=null;if(i=i.firstBaseUpdate,i!==null){do{var a={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};s===null?r=s=a:s=s.next=a,i=i.next}while(i!==null);s===null?r=s=t:s=s.next=t}else r=s=t;i={baseState:n.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:n.shared,callbacks:n.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var Lg=!1;function Pc(){if(Lg){var e=hl;if(e!==null)throw e}}function Hc(e,t,i,n){Lg=!1;var r=e.updateQueue;Gs=!1;var s=r.firstBaseUpdate,a=r.lastBaseUpdate,o=r.shared.pending;if(o!==null){r.shared.pending=null;var l=o,c=l.next;l.next=null,a===null?s=c:a.next=c,a=l;var u=e.alternate;u!==null&&(u=u.updateQueue,o=u.lastBaseUpdate,o!==a&&(o===null?u.firstBaseUpdate=c:o.next=c,u.lastBaseUpdate=l))}if(s!==null){var d=r.baseState;a=0,u=c=l=null,o=s;do{var h=o.lane&-536870913,f=h!==o.lane;if(f?(Ue&h)===h:(n&h)===h){h!==0&&h===Va&&(Lg=!0),u!==null&&(u=u.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var p=e,_=o;h=t;var y=i;switch(_.tag){case 1:if(p=_.payload,typeof p=="function"){d=p.call(y,d,h);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=_.payload,h=typeof p=="function"?p.call(y,d,h):p,h==null)break e;d=ut({},d,h);break e;case 2:Gs=!0}}h=o.callback,h!==null&&(e.flags|=64,f&&(e.flags|=8192),f=r.callbacks,f===null?r.callbacks=[h]:f.push(h))}else f={lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},u===null?(c=u=f,l=d):u=u.next=f,a|=h;if(o=o.next,o===null){if(o=r.shared.pending,o===null)break;f=o,o=f.next,f.next=null,r.lastBaseUpdate=f,r.shared.pending=null}}while(!0);u===null&&(l=d),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=u,s===null&&(r.shared.lanes=0),pa|=a,e.lanes=a,e.memoizedState=d}}function nx(e,t){if(typeof e!="function")throw Error(F(191,e));e.call(t)}function rx(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;es?s:8;var a=xe.T,o={};o.types=a!==null?a.types:null,xe.T=o,J_(e,!1,t,i);try{var l=r(),c=xe.S;if(c!==null&&c(o,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=GL(l,n);Uc(e,t,u,Cn(e))}else Uc(e,t,n,Cn(e))}catch(d){Uc(e,t,{then:function(){},status:"rejected",reason:d},Cn())}finally{Xe.p=s,a!==null&&o.types!==null&&(a.types=o.types),xe.T=a}}function QL(){}function Hg(e,t,i,n){if(e.tag!==5)throw Error(F(476));var r=Ax(e).queue;Nx(e,r,t,qa,i===null?QL:function(){return Mx(e),i(n)})}function Ax(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:qa,baseState:qa,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ps,lastRenderedState:qa},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ps,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Mx(e){var t=Ax(e);t.next===null&&(t=e.alternate.memoizedState),Uc(e,t.next.queue,{},Cn())}function Q_(){return Ci(Al)}function Ox(){return qt().memoizedState}function Rx(){return qt().memoizedState}function JL(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Cn();e=ia(i);var n=na(t,e,i);n!==null&&(cn(n,t,i),Bc(n,t,i)),t={cache:z_()},e.payload=t;return}t=t.return}}function e3(e,t,i){var n=Cn();i={lane:n,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},df(e)?Lx(t,i):(i=D_(e,t,i,n),i!==null&&(cn(i,e,n),Ix(i,t,n)))}function Dx(e,t,i){var n=Cn();Uc(e,t,i,n)}function Uc(e,t,i,n){var r={lane:n,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(df(e))Lx(t,r);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var a=t.lastRenderedState,o=s(a,i);if(r.hasEagerState=!0,r.eagerState=o,Tn(o,a))return sf(e,t,r,0),ct===null&&rf(),!1}catch{}if(i=D_(e,t,r,n),i!==null)return cn(i,e,n),Ix(i,t,n),!0}return!1}function J_(e,t,i,n){if(n={lane:2,revertLane:uv(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},df(e)){if(t)throw Error(F(479))}else t=D_(e,i,n,2),t!==null&&cn(t,e,2)}function df(e){var t=e.alternate;return e===Oe||t!==null&&t===Oe}function Lx(e,t){pl=zh=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Ix(e,t,i){if((i&4194048)!==0){var n=t.lanes;n&=e.pendingLanes,i|=n,t.lanes=i,b1(e,i)}}var Ph={readContext:Ci,use:cf,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useLayoutEffect:Lt,useInsertionEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useSyncExternalStore:Lt,useId:Lt,useHostTransitionStatus:Lt,useFormState:Lt,useActionState:Lt,useOptimistic:Lt,useMemoCache:Lt,useCacheRefresh:Lt,useEffectEvent:Lt},zx={readContext:Ci,use:cf,useCallback:function(e,t){return Xi().memoizedState=[e,t===void 0?null:t],e},useContext:Ci,useEffect:ow,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,hh(4194308,4,xx.bind(null,t,e),i)},useLayoutEffect:function(e,t){return hh(4194308,4,e,t)},useInsertionEffect:function(e,t){hh(4,2,e,t)},useMemo:function(e,t){var i=Xi();t=t===void 0?null:t;var n=e();if(Za){Ys(!0);try{e()}finally{Ys(!1)}}return i.memoizedState=[n,t],n},useReducer:function(e,t,i){var n=Xi();if(i!==void 0){var r=i(t);if(Za){Ys(!0);try{i(t)}finally{Ys(!1)}}}else r=t;return n.memoizedState=n.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},n.queue=e,e=e.dispatch=e3.bind(null,Oe,e),[n.memoizedState,e]},useRef:function(e){var t=Xi();return e={current:e},t.memoizedState=e},useState:function(e){e=Bg(e);var t=e.queue,i=Dx.bind(null,Oe,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:X_,useDeferredValue:function(e,t){var i=Xi();return Z_(i,e,t)},useTransition:function(){var e=Bg(!1);return e=Nx.bind(null,Oe,e.queue,!0,!1),Xi().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var n=Oe,r=Xi();if(Ie){if(i===void 0)throw Error(F(407));i=i()}else{if(i=t(),ct===null)throw Error(F(349));(Ue&127)!==0||cx(n,t,i)}r.memoizedState=i;var s={value:i,getSnapshot:t};return r.queue=s,ow(dx.bind(null,n,s,e),[e]),n.flags|=2048,wl(9,{destroy:void 0},ux.bind(null,n,s,i,t),null),i},useId:function(){var e=Xi(),t=ct.identifierPrefix;if(Ie){var i=Br,n=zr;i=(n&~(1<<32-kn(n)-1)).toString(32)+i,t="_"+t+"R_"+i,i=Bh++,0<\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof n.is=="string"?a.createElement("select",{is:n.is}):a.createElement("select"),n.multiple?s.multiple=!0:n.size&&(s.size=n.size);break;default:s=typeof n.is=="string"?a.createElement(r,{is:n.is}):a.createElement(r)}}s[ki]=t,s[dn]=n;e:for(a=t.child;a!==null;){if(a.tag===5||a.tag===6)s.appendChild(a.stateNode);else if(a.tag!==4&&a.tag!==27&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}t.stateNode=s;e:switch(Ai(s,r,n),r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&as(t)}}return mt(t),t.subtreeFlags&=-33554433,Qm(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==n&&as(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(F(166));if(e=ea.current,Go(t)){if(e=t.stateNode,i=t.memoizedProps,n=null,r=hi,r!==null)switch(r.tag){case 27:case 5:n=r.memoizedProps}e[ki]=t,e=!!(e.nodeValue===i||n!==null&&n.suppressHydrationWarning===!0||DE(e.nodeValue,i)),e||da(t,!0)}else e=nu(e).createTextNode(n),e[ki]=t,t.stateNode=e}return mt(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(n=Go(t),i!==null){if(e===null){if(!n)throw Error(F(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(F(557));e[ki]=t}else Ga(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;mt(t),e=!1}else i=jm(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(yn(t),t):(yn(t),null);if((t.flags&128)!==0)throw Error(F(558))}return mt(t),null;case 13:if(n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=Go(t),n!==null&&n.dehydrated!==null){if(e===null){if(!r)throw Error(F(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(F(317));r[ki]=t}else Ga(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;mt(t),r=!1}else r=jm(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(yn(t),t):(yn(t),null)}return yn(t),(t.flags&128)!==0?(t.lanes=i,t):(i=n!==null,e=e!==null&&e.memoizedState!==null,i&&(n=t.child,r=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(r=n.alternate.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==r&&(n.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),Xd(t,t.updateQueue),mt(t),null);case 4:return bl(),e===null&&dv(t.stateNode.containerInfo),t.flags|=67108864,mt(t),null;case 10:return us(t.type),mt(t),null;case 19:if(q_(t),n=t.memoizedState,n===null)return mt(t),null;if(r=(t.flags&128)!==0,s=n.rendering,s===null)if(r)Ec(n,!1);else{if(It!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(s=Ih(e),s!==null){for(t.flags|=128,Ec(n,!1),e=s.updateQueue,t.updateQueue=e,Xd(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)Y1(i,e),i=i.sibling;return Jc(t,Ni.current&1|2),Ie&&os(t,n.treeForkCount),t.child}e=e.sibling}n.tail!==null&&xn()>Kh&&(t.flags|=128,r=!0,Ec(n,!1),t.lanes=4194304)}else{if(!r)if(e=Ih(s),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,Xd(t,e),Ec(n,!0),n.tail===null&&n.tailMode!=="collapsed"&&n.tailMode!=="visible"&&!s.alternate&&!Ie)return mt(t),null}else 2*xn()-n.renderingStartTime>Kh&&i!==536870912&&(t.flags|=128,r=!0,Ec(n,!1),t.lanes=4194304);n.isBackwards?(s.sibling=t.child,t.child=s):(e=n.last,e!==null?e.sibling=s:t.child=s,n.last=s)}if(n.tail!==null){e=n.tail;e:{for(i=e;i!==null;){if(i.alternate!==null){i=!1;break e}i=i.sibling}i=!0}return n.rendering=e,n.tail=e.sibling,n.renderingStartTime=xn(),e.sibling=null,s=Ni.current,s=r?s&1|2:s&1,n.tailMode==="visible"||n.tailMode==="collapsed"||!i||Ie?Jc(t,s):(i=s,_t(Mi,t),_t(Ni,i),Pi===null&&(Pi=t)),Ie&&os(t,n.treeForkCount),e}return mt(t),null;case 22:case 23:return yn(t),U_(),n=t.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(i&536870912)!==0&&(t.flags&128)===0&&(mt(t),t.subtreeFlags&6&&(t.flags|=8192)):mt(t),i=t.updateQueue,i!==null&&Xd(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==i&&(t.flags|=2048),e!==null&&Ti(Wa),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),us(Yt),mt(t),null;case 25:return null;case 30:return t.flags|=33554432,mt(t),null}throw Error(F(156,t.tag))}function o3(e,t){switch(I_(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return us(Yt),bl(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return kh(t),null;case 31:if(t.memoizedState!==null){if(yn(t),t.alternate===null)throw Error(F(340));Ga()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(yn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(F(340));Ga()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return q_(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return bl(),null;case 10:return us(t.type),null;case 22:case 23:return yn(t),U_(),e!==null&&Ti(Wa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return us(Yt),null;case 25:return null;default:return null}}function jx(e,t){switch(I_(t),t.tag){case 3:us(Yt),bl();break;case 26:case 27:case 5:kh(t);break;case 4:bl();break;case 31:t.memoizedState!==null&&yn(t);break;case 13:yn(t);break;case 19:q_(t);break;case 10:us(t.type);break;case 22:case 23:yn(t),U_(),e!==null&&Ti(Wa);break;case 24:us(Yt)}}function gu(e,t){try{var i=t.updateQueue,n=i!==null?i.lastEffect:null;if(n!==null){var r=n.next;i=r;do{if((i.tag&e)===e){n=void 0;var s=i.create,a=i.inst;n=s(),a.destroy=n}i=i.next}while(i!==r)}}catch(o){nt(t,t.return,o)}}function fa(e,t,i){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var s=r.next;n=s;do{if((n.tag&e)===e){var a=n.inst,o=a.destroy;if(o!==void 0){a.destroy=void 0,r=t;var l=i,c=o;try{c()}catch(u){nt(r,l,u)}}}n=n.next}while(n!==s)}}catch(u){nt(t,t.return,u)}}function Yx(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{rx(t,i)}catch(n){nt(e,e.return,n)}}}function Vx(e,t,i){i.props=Qa(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(n){nt(e,t,n)}}function Rr(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;case 30:var r=e.stateNode,s=hs(e.memoizedProps,r);(r.ref===null||r.ref.name!==s)&&(r.ref=HE(s)),n=r.ref;break;case 7:if(e.stateNode===null){var a=new Nn(e);un(e.child,!1,V3,a,void 0,void 0),e.stateNode=a}n=e.stateNode;break;default:n=e.stateNode}typeof i=="function"?e.refCleanup=i(n):i.current=n}}catch(o){nt(e,t,o)}}function Ei(e,t){var i=e.ref,n=e.refCleanup;if(i!==null)if(typeof n=="function")try{n()}catch(r){nt(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(r){nt(e,t,r)}else i.current=null}function Uh(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var i=0;i title"))),Ai(n,t,i),n[ki]=e,di(n),t=n;break e;case"link":if(s=Vw("link","href",r).get(t+(i.href||""))){for(a=0;ay&&(a=y,y=_,_=a);var m=$S(o,_),v=$S(o,y);if(m&&v&&(f.rangeCount!==1||f.anchorNode!==m.node||f.anchorOffset!==m.offset||f.focusNode!==v.node||f.focusOffset!==v.offset)){var b=d.createRange();b.setStart(m.node,m.offset),f.removeAllRanges(),_>y?(f.addRange(b),f.extend(v.node,v.offset)):(b.setEnd(v.node,v.offset),f.addRange(b))}}}}for(d=[],f=o;f=f.parentNode;)f.nodeType===1&&d.push({element:f,left:f.scrollLeft,top:f.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;oi?32:i,xe.T=null,i=r_,r_=null;var s=dr,a=Hr;if(Ot=0,Ja=dr=null,Hr=0,(Ve&6)!==0)throw Error(F(331));var o=Ve;if(Ve|=4,pE(s.current),dE(s,s.current,a,i),Ve=o,_u(0,!1),En&&typeof En.onPostCommitFiberRoot=="function")try{En.onPostCommitFiberRoot(cu,s)}catch{}return!0}finally{Xe.p=r,xe.T=n,CE(e,t)}}function Aw(e,t,i){t=Yn(i,t),t=qg(e.stateNode,t,2),e=na(e,t,2),e!==null&&(du(e,2),Fr(e))}function nt(e,t,i){if(e.tag===3)Aw(e,e,i);else for(;t!==null;){if(t.tag===3){Aw(t,e,i);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(aa===null||!aa.has(n))){e=Yn(i,e),i=qx(2),n=na(t,i,2),n!==null&&(Fx(i,n,t,e),du(n,2),Fr(n));break}}t=t.return}}function ng(e,t,i){var n=e.pingCache;if(n===null){n=e.pingCache=new d3;var r=new Set;n.set(t,r)}else r=n.get(t),r===void 0&&(r=new Set,n.set(t,r));r.has(i)||(lv=!0,r.add(i),e=b3.bind(null,e,t,i),t.then(e,e))}function b3(e,t,i){var n=e.pingCache;n!==null&&n.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,ct===e&&(Ue&i)===i&&((It===4||It===3&&(Ue&62914560)===Ue&&300>xn()-ff)&&(Ve&2)===0?kl(e,0):$h|=i,xl===Ue&&(xl=0)),Fr(e)}function TE(e,t){t===0&&(t=_1()),e=no(e,t),e!==null&&(du(e,t),Fr(e))}function y3(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),TE(e,i)}function S3(e,t){var i=0;switch(e.tag){case 31:case 13:var n=e.stateNode,r=e.memoizedState;r!==null&&(i=r.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(F(314))}n!==null&&n.delete(t),TE(e,i)}function w3(e,t){return x_(e,t)}var Cl=null,Xo=null,c_=!1,Yh=!1,rg=!1,Js=0;function Fr(e){e!==Xo&&e.next===null&&(Xo===null?Cl=Xo=e:Xo=Xo.next=e),Yh=!0,c_||(c_=!0,E3())}function _u(e,t){if(!rg&&Yh){rg=!0;do for(var i=!1,n=Cl;n!==null;){if(!t)if(e!==0){var r=n.pendingLanes;if(r===0)var s=0;else{var a=n.suspendedLanes,o=n.pingedLanes;s=(1<<31-kn(42|e)+1)-1,s&=r&~(a&~o),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(i=!0,Mw(n,s))}else s=Ue,s=Qh(n,n===ct?s:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(s&3)===0||uu(n,s)||(i=!0,Mw(n,s));n=n.next}while(i);rg=!1}}function x3(){NE()}function NE(){Yh=c_=!1;var e=0;Js!==0&&D3()&&(e=Js);for(var t=xn(),i=null,n=Cl;n!==null;){var r=n.next,s=AE(n,t);s===0?(n.next=null,i===null?Cl=r:i.next=r,r===null&&(Xo=i)):(i=n,(e!==0||(s&3)!==0)&&(Yh=!0)),n=r}Ot!==0&&Ot!==5||_u(e,!1),Js!==0&&(Js=0)}function AE(e,t){for(var i=e.suspendedLanes,n=e.pingedLanes,r=e.expirationTimes,s=e.pendingLanes&-62914561;0o)break;var u=l.transferSize,d=l.initiatorType;u&&zw(d)&&(l=l.responseEnd,a+=u*(lyh){_.length=p;break}b=new Promise(H3.bind(b)),_.push(b)}}}if(0<_.length)return h=Promise.race([Promise.all(_),new Promise(function(k){return setTimeout(k,500)})]).then(r,r),(f?Promise.allSettled([f.finished,h]):h).then(s,s);if(r(),f)return f.finished.then(s,s);s()},types:i});c.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var h=c.documentElement.getAnimations({subtree:!0}),f=0;f"u"?null:document;function jE(e,t,i){var n=Bl;if(n&&typeof t=="string"&&t){var r=jn(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof i=="string"&&(r+='[crossorigin="'+i+'"]'),Gw.has(r)||(Gw.add(r),e={rel:e,crossOrigin:i,href:t},n.querySelector(r)===null&&(t=n.createElement("link"),Ai(t,"link",e),di(t),n.head.appendChild(t)))}}function rI(e){bs.D(e),jE("dns-prefetch",e,null)}function sI(e,t){bs.C(e,t),jE("preconnect",e,t)}function aI(e,t,i){bs.L(e,t,i);var n=Bl;if(n&&e&&t){var r='link[rel="preload"][as="'+jn(t)+'"]';t==="image"&&i&&i.imageSrcSet?(r+='[imagesrcset="'+jn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(r+='[imagesizes="'+jn(i.imageSizes)+'"]')):r+='[href="'+jn(e)+'"]';var s=r;switch(t){case"style":s=Nl(e);break;case"script":s=Pl(e)}if(!(Zn.has(s)||(e=ut({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),Zn.set(s,e),n.querySelector(r)!==null||t==="style"&&n.querySelector(vu(s))||t==="script"&&n.querySelector(bu(s))))){var a=n.createElement("link");Ai(a,"link",e),t==="style"&&(a[Th]=!0,a.onload=a.onerror=function(){w1(a)}),di(a),n.head.appendChild(a)}}}function oI(e,t){bs.m(e,t);var i=Bl;if(i&&e){var n=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+jn(n)+'"][href="'+jn(e)+'"]',s=r;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=Pl(e)}if(!Zn.has(s)&&(e=ut({rel:"modulepreload",href:e},t),Zn.set(s,e),i.querySelector(r)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(bu(s)))return}n=i.createElement("link"),Ai(n,"link",e),di(n),i.head.appendChild(n)}}}function lI(e,t,i){bs.S(e,t,i);var n=Bl;if(n&&e){var r=cl(n).hoistableStyles,s=Nl(e);t=t||"default";var a=r.get(s);if(!a){var o={loading:0,preload:null};if(a=n.querySelector(vu(s)))o.loading=5;else{e=ut({rel:"stylesheet",href:e,"data-precedence":t},i),(i=Zn.get(s))&&mv(e,i);var l=a=n.createElement("link");di(l),Ai(l,"link",e),l._p=new Promise(function(c,u){l.onload=c,l.onerror=u}),l.addEventListener("load",function(){o.loading|=1}),l.addEventListener("error",function(){o.loading|=2}),o.loading|=4,vh(a,t,n)}a={type:"stylesheet",instance:a,count:1,state:o},r.set(s,a)}}}function cI(e,t){bs.X(e,t);var i=Bl;if(i&&e){var n=cl(i).hoistableScripts,r=Pl(e),s=n.get(r);s||(s=i.querySelector(bu(r)),s||(e=ut({src:e,async:!0},t),(t=Zn.get(r))&&gv(e,t),s=i.createElement("script"),di(s),Ai(s,"link",e),i.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},n.set(r,s))}}function uI(e,t){bs.M(e,t);var i=Bl;if(i&&e){var n=cl(i).hoistableScripts,r=Pl(e),s=n.get(r);s||(s=i.querySelector(bu(r)),s||(e=ut({src:e,async:!0,type:"module"},t),(t=Zn.get(r))&&gv(e,t),s=i.createElement("script"),di(s),Ai(s,"link",e),i.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},n.set(r,s))}}function jw(e,t,i,n){var r=(r=ea.current)?ru(r):null;if(!r)throw Error(F(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(i=Nl(i.href),t=cl(r).hoistableStyles,n=t.get(i),n||(n={type:"style",instance:null,count:0,state:null},t.set(i,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=Nl(i.href);var s=cl(r).hoistableStyles,a=s.get(e);if(a||(r=r.ownerDocument||r,a={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,a),(s=r.querySelector(vu(e)))?s._p||(a.instance=s,a.state.loading=5):(s=Zn.get(e),s||(s={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Zn.set(e,s)),dI(r,e,s,a.state))),t&&n===null)throw Error(F(528,""));return a}if(t&&n!==null)throw Error(F(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(i=Pl(i),t=cl(r).hoistableScripts,n=t.get(i),n||(n={type:"script",instance:null,count:0,state:null},t.set(i,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(F(444,e))}}function Nl(e){return'href="'+jn(e)+'"'}function vu(e){return'link[rel="stylesheet"]['+e+"]"}function YE(e){return ut({},e,{"data-precedence":e.precedence,precedence:null})}function dI(e,t,i,n){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[Th]!==!0){n.loading=1;return}}else t=e.createElement("link"),t[Th]=!0,t.onload=t.onerror=w1.bind(null,t),Ai(t,"link",i),di(t),e.head.appendChild(t);n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2})}function Pl(e){return'[src="'+jn(e)+'"]'}function bu(e){return"script[async]"+e}function Yw(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+jn(i.href)+'"]');if(n)return t.instance=n,di(n),n;var r=ut({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),di(n),Ai(n,"style",r),vh(n,i.precedence,e),t.instance=n;case"stylesheet":r=Nl(i.href);var s=e.querySelector(vu(r));if(s)return t.state.loading|=4,t.instance=s,di(s),s;n=YE(i),(r=Zn.get(r))&&mv(n,r),s=(e.ownerDocument||e).createElement("link"),di(s);var a=s;return a._p=new Promise(function(o,l){a.onload=o,a.onerror=l}),Ai(s,"link",n),t.state.loading|=4,vh(s,i.precedence,e),t.instance=s;case"script":return s=Pl(i.src),(r=e.querySelector(bu(s)))?(t.instance=r,di(r),r):(n=i,(r=Zn.get(s))&&(n=ut({},i),gv(n,r)),e=e.ownerDocument||e,r=e.createElement("script"),di(r),Ai(r,"link",n),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(F(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,vh(n,i.precedence,e));return t.instance}function vh(e,t,i){for(var n=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=n.length?n[n.length-1]:null,s=r,a=0;a title"):null)}function hI(e,t,i){if(i===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Xw(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function VE(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function XE(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function Zw(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=XE(t),e.suspenseyImages.push(t)),e=mI.bind(e),t.decode().then(e,e))}function fI(e,t,i,n){if(i.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var r=Nl(n.href),s=t.querySelector(vu(r));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=su.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=s,di(s);return}s=t.ownerDocument||t,n=YE(n),(r=Zn.get(r))&&mv(n,r),s=s.createElement("link"),di(s);var a=s;a._p=new Promise(function(o,l){a.onload=o,a.onerror=l}),Ai(s,"link",n),i.instance=s}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=su.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var yh=0;function pI(e,t){return e.stylesheets&&e.count===0&&Sh(e,e.stylesheets),0yh?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(r)}}:null}function ZE(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)Sh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function su(){this.count--,ZE(this)}function mI(){this.imgCount--,ZE(this)}var Xh=null;function Sh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Xh=new Map,t.forEach(gI,e),Xh=null,su.call(e))}function gI(e,t){if(!(t.state.loading&4)){var i=Xh.get(e);if(i)var n=i.get(null);else{i=new Map,Xh.set(e,i);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s{"use strict";function ak(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ak)}catch(e){console.error(e)}}ak(),ok.exports=sk()});function EI(e){return/^accent(-|$)/i.test(e.replace(/^--/,"").replace(/^magpie-/i,""))}function ck(e){let t=new URLSearchParams(e).get("tokens");if(!t)return;let i;try{i=JSON.parse(decodeURIComponent(escape(atob(t))))}catch{return}Sv(i)}function kI(e){let t={};if(!e||typeof e!="object")return t;for(let[i,n]of Object.entries(e)){if(typeof n!="string"&&typeof n!="number")continue;let r=String(n).trim();if(!r||r.length>300||/[;{}<>]/.test(r)||EI(i))continue;let s=i.replace(/^--/,"").replace(/^magpie-/i,"");/^[a-zA-Z0-9-]{1,48}$/.test(s)&&(t[`--magpie-${s}`]=r)}return t}function Sv(e){let t=document.documentElement;for(let[i,n]of Object.entries(kI(e)))t.style.setProperty(i,n)}var wv=ae(()=>{});function CI(){return typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}function xv(e){return e==="light"||e==="dark"?e:"auto"}function TI(e,t,i){let n=e==="light"||e==="dark"?e:t??i;return{theme:n,hostColors:t!==null&&n===t}}function dk(e){let t=new URLSearchParams(e).get("theme");yf=t==="light"||t==="dark"?t:null,Wr("auto"),typeof window<"u"&&window.matchMedia&&(uk=window.matchMedia("(prefers-color-scheme: dark)"),uk.addEventListener?.("change",()=>Wr(bf)))}function hk(){return yf!==null}function fk(e){yf=e,Wr(bf)}function Wr(e){bf=xv(e);let{theme:t,hostColors:i}=TI(bf,yf,CI()),n=document.documentElement;n.dataset.theme=t,i?n.dataset.hostColors="1":delete n.dataset.hostColors}function pk(){return document.documentElement.dataset.theme==="dark"?"dark":"light"}var yf,bf,uk,yu=ae(()=>{yf=null,bf="auto",uk=null});function mk(e){if(!e||typeof e!="object")return null;let t=e;if(typeof t.dark!="boolean")return null;let i=t.tokens&&typeof t.tokens=="object"&&!Array.isArray(t.tokens)?t.tokens:{},n={dark:t.dark,tokens:i};return typeof t.lang=="string"&&t.lang.length<=32&&(n.lang=t.lang),n}function NI(e,t){if(!e||typeof e!="object")return null;let i=e;return i.magpie!==1?null:i.event==="theme"?mk(i.data):i.id===t&&i.result?mk(i.result):null}function _k(e){if(gk||typeof window>"u")return;let t=window.parent;if(!t||t===window)return;gk=!0;let i=1e6+Math.floor(Math.random()*1e6);window.addEventListener("message",n=>{if(n.source!==t)return;let r=NI(n.data,i);r&&(Sv(r.tokens),fk(r.dark?"dark":"light"),e?.(r))});try{t.postMessage({magpie:1,id:i,method:"hello"},"*")}catch{}}var gk,vk=ae(()=>{wv();yu();gk=!1});function wf(e){return e==="narrow"||e==="wide"||e==="full"?e:"default"}function MI(e){let t=wf(e);return t==="full"?"100%":`${AI[t]}px`}function Cv(e){let t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?Math.min(Ev,Math.max(Sf,Math.round(t))):kv}function Su(e){let t=document.documentElement;t.style.setProperty("--col",MI(e.contentWidth)),t.style.setProperty("--chat-fs",`${Cv(e.chatFontSize)}px`),t.dataset.contentWidth=wf(e.contentWidth)}var AI,Sf,Ev,kv,Tv=ae(()=>{AI={narrow:640,default:720,wide:880},Sf=12,Ev=18,kv=13});function OI(e,t=typeof navigator<"u"?navigator.userAgent:""){if(typeof e!="string"||!e||e.length>2048)return null;let i;try{i=new URL(e)}catch{return null}if(i.protocol!=="http:"&&i.protocol!=="https:"||i.username||i.password)return null;let n=i.hostname.toLowerCase(),r=n==="127.0.0.1"||n==="localhost"||n==="[::1]",s=/Windows/.test(t)&&n==="wails.localhost"&&i.protocol==="http:"&&i.port==="";return!r&&!s||!/^\/_magpie\/plugin\/[A-Za-z0-9_-]{1,128}\/(?:page\/)?index\.html$/.test(i.pathname)?null:`${i.protocol}//${i.host}${i.pathname}${i.search}`}function RI(e){let t=e.startsWith("#")?e.slice(1):e;return OI(new URLSearchParams(t).get("b"))}function DI(e,t){let i=RI(e);if(!i)return null;let n=new URL(i);return t>0&&n.searchParams.set("ac_lost",String(Math.floor(t))),n.toString()}function xf(){let e=DI(location.hash,wu);return e?(location.replace(e),!0):!1}function bk(e,t,i=5e3){let n=null,r=e.onState(s=>{s==="reconnecting"||s==="down"?(wu||(wu=Date.now()),n||(n=setTimeout(()=>{n=null,e.getState()!=="open"&&t()},i))):s==="open"&&(wu=0,n&&(clearTimeout(n),n=null))});return()=>{r(),n&&clearTimeout(n)}}function Ef(e=location.hash){let t=e.startsWith("#")?e.slice(1):e;return new URLSearchParams(t).get("w")==="1"&&typeof window<"u"&&window.parent!==window}function yk(e,t=2e3){let i=()=>{if(e.getState()==="open")try{window.parent.postMessage({ac_console:"alive"},"*")}catch{}};i();let n=setInterval(i,t);return()=>clearInterval(n)}function kf(){try{window.parent.postMessage({ac_console:"lost",at:wu||Date.now()},"*")}catch{}}var wu,Nv=ae(()=>{wu=0});var Cf,Sk=ae(()=>{Ct();Cf=class{constructor(t,i="zh"){me(this,"token",t);me(this,"lang",i);me(this,"ws",null);me(this,"seq",0);me(this,"pending",new Map);me(this,"subs",new Map);me(this,"binHandlers",[]);me(this,"stateListeners",new Set);me(this,"state","connecting");me(this,"retry",0);me(this,"closed",!1);me(this,"helloOk",null);me(this,"helloWaiters",[])}setLang(t){this.lang=t}onState(t){return this.stateListeners.add(t),t(this.state),()=>this.stateListeners.delete(t)}getState(){return this.state}setState(t){this.state=t;for(let i of this.stateListeners)i(t)}connect(){if(this.closed)return;this.setState(this.retry===0?"connecting":"reconnecting");let t=new WebSocket(`ws://${location.host}/ws`);t.binaryType="arraybuffer",this.ws=t,t.onopen=()=>{t.send(JSON.stringify({t:"hello",token:this.token,v:1,lang:this.lang}))},t.onmessage=i=>{if(typeof i.data!="string"){this.onBinary(new Uint8Array(i.data));return}let n;try{n=JSON.parse(i.data)}catch{return}if(n.t==="hello.ok"){this.retry=0,this.helloOk=n,this.setState("open");let r=this.helloWaiters.splice(0);for(let s of r)s(n);for(let[s,a]of this.subs)this.call("sub.add",{ch:s,afterSeq:a.afterSeq?.()}).catch(()=>{});return}if(n.t==="res"){let r=n.id,s=this.pending.get(r);if(s)if(this.pending.delete(r),clearTimeout(s.timer),n.ok)s.res(n.r);else{let a=n.e,o=new Error(a?.message??g("api.requestFailed"));o.code=a?.code,s.rej(o)}return}if(n.t==="evt"){this.subs.get(n.ch)?.handler(n.ch,n.d);return}},t.onclose=()=>{this.ws=null;for(let[n,r]of this.pending)clearTimeout(r.timer),r.rej(new Error(g("api.connClosed"))),this.pending.delete(n);if(this.closed)return;this.retry++;let i=Math.min(1e3*Math.pow(2,this.retry-1),1e4);this.setState(this.retry>20?"down":"reconnecting"),setTimeout(()=>this.connect(),i)},t.onerror=()=>{}}waitHello(){return this.helloOk?Promise.resolve(this.helloOk):new Promise(t=>this.helloWaiters.push(t))}call(t,i,n=6e4){return new Promise((r,s)=>{let a=this.ws;if(!a||a.readyState!==WebSocket.OPEN){s(new Error(g("api.notConnected")));return}let o=++this.seq,l=setTimeout(()=>{this.pending.delete(o),s(new Error(g("api.timeout")))},n);this.pending.set(o,{res:r,rej:s,timer:l}),a.send(JSON.stringify({t:"req",id:o,m:t,p:i??{}}))})}subscribe(t,i,n){return this.subs.set(t,{handler:i,afterSeq:n}),this.state==="open"&&this.call("sub.add",{ch:t,afterSeq:n?.()}).catch(()=>{}),()=>{this.subs.delete(t),this.state==="open"&&this.call("sub.remove",{ch:t}).catch(()=>{})}}onBinaryFrame(t){return this.binHandlers.push(t),()=>{this.binHandlers=this.binHandlers.filter(i=>i!==t)}}onBinary(t){if(t.length<3)return;let i=t[0],n=t[1]<<8|t[2];for(let r of this.binHandlers)r(i,n,t.subarray(3))}sendBinary(t,i,n){let r=this.ws;if(!r||r.readyState!==WebSocket.OPEN)return;let s=new Uint8Array(3+n.length);s[0]=t,s[1]=i>>8&255,s[2]=i&255,s.set(n,3),r.send(s)}ping(){try{this.ws?.send(JSON.stringify({t:"ping"}))}catch{}}close(){this.closed=!0,this.ws?.close()}}});var $r,xu=ae(()=>{Ra();$r=qn(e=>({state:"connecting",version:null,set:t=>e(t)}))});function ys(e,t=window.innerWidth){if(t<900)return Eu;let i=e.sbHidden?0:e.sidebarWidth;return Hl(t-i-xk-wk,_a,Eu)}function Ul(e,t=window.innerWidth){if(t<760)return Av;let i=e.panelOpen?e.panelWidth:0;return Hl(t-i-xk-wk,so,Av)}function Tf(e,t=window.innerWidth){let i=Hl(e.sidebarWidth,so,Ul(e,t)),n=Hl(e.panelWidth,_a,ys({...e,sidebarWidth:i},t));return i=Hl(i,so,Ul({...e,sidebarWidth:i,panelWidth:n},t)),n=Hl(n,_a,ys({...e,sidebarWidth:i,panelWidth:n},t)),{sidebarWidth:i,panelWidth:n}}var wk,xk,Hl,Nf=ae(()=>{Qi();wk=300,xk=10,Hl=(e,t,i)=>Math.max(t,Math.min(i,e))});function va(e,t){let i=e().ws;i&&i.call("settings.set",{patch:t}).catch(()=>{})}var LI,so,Av,_a,Eu,Mv,he,Qi=ae(()=>{Ra();Nf();LI=["changes","files","terminal","preview"],so=200,Av=360,_a=320,Eu=900,Mv=(e,t,i)=>Math.max(t,Math.min(i,e));he=qn((e,t)=>({ws:null,sidebarWidth:248,sbHidden:!1,sbOpen:!1,panelOpen:!1,panelTab:"changes",panelWidth:440,collapsed:{},currentProjectId:null,currentThreadId:null,bind:i=>e({ws:i}),hydrate:i=>{let n={};for(let a of i.collapsedProjects??[])n[a]=!0;let r={sidebarWidth:i.sidebarWidth??248,panelWidth:i.panel?.width??440,panelOpen:i.panel?.open??!1,sbHidden:i.sidebarHidden===!0},s=Tf(r);e({sidebarWidth:s.sidebarWidth,sbHidden:r.sbHidden,panelOpen:r.panelOpen,panelTab:LI.includes(i.panel?.tab)?i.panel.tab:"changes",panelWidth:s.panelWidth,collapsed:n,currentProjectId:i.lastProjectId??null,currentThreadId:i.lastThreadId??null})},setSidebarWidth:i=>{let n=t(),r=Ul(n);i=Mv(Math.round(i),so,r),e({sidebarWidth:i}),va(t,{sidebarWidth:i})},setPanelWidth:i=>{let n=t(),r=ys(n);i=Mv(Math.round(i),_a,r),e({panelWidth:i}),va(t,{panel:{open:t().panelOpen,tab:t().panelTab,width:i}})},openPanel:i=>{let n=i??t().panelTab,r=t(),s=Mv(r.panelWidth,_a,ys({...r,panelOpen:!0}));e({panelOpen:!0,panelTab:n,panelWidth:s}),va(t,{panel:{open:!0,tab:n,width:s}})},closePanel:()=>{e({panelOpen:!1}),va(t,{panel:{open:!1,tab:t().panelTab,width:t().panelWidth}})},setPanelTab:i=>{e({panelTab:i}),va(t,{panel:{open:t().panelOpen,tab:i,width:t().panelWidth}})},toggleSidebarHidden:()=>{let i=!t().sbHidden;e({sbHidden:i}),va(t,{sidebarHidden:i})},toggleSidebar:()=>{typeof window<"u"&&window.matchMedia?.("(max-width: 759px)").matches?t().setSbOpen(!t().sbOpen):t().toggleSidebarHidden()},setSbOpen:i=>e({sbOpen:i}),toggleCollapsed:i=>{let n={...t().collapsed};n[i]?delete n[i]:n[i]=!0,e({collapsed:n}),va(t,{collapsedProjects:Object.keys(n)})},select:(i,n)=>{e({currentProjectId:i,currentThreadId:n,sbOpen:!1}),va(t,{lastProjectId:i,lastThreadId:n})},reconcileSelection:(i,n)=>{let{currentProjectId:r,currentThreadId:s}=t();if(i.length===0){(r||s)&&t().select(null,null);return}let a=r;(!a||!i.some(l=>l.id===a))&&(a=null);let o=s;if(o){let l=n.find(c=>c.id===o);!l||!i.some(c=>c.id===l.projectId)||a&&l.projectId!==a?o=null:a||(a=l.projectId)}(a!==r||o!==s)&&t().select(a,o)}}))});async function ql(){let e="claude";try{e=(await Ke.getState().ws.call("settings.get")).defaultProvider??"claude"}catch{}let t=Ke.getState().providers;return t.length?t.find(i=>i.id===e&&Ek(i))?.id??t.find(i=>Ek(i))?.id??e:e}function Ek(e){return e.enabled===!1||!e.available||e.status==="planned"?!1:e.status==="verified"||e.status==="experimental"?!0:e.ready!==!1}var Ke,An=ae(()=>{Ra();Qi();Ke=qn((e,t)=>({ws:null,loaded:!1,projects:[],threads:[],providers:[],bind:async i=>{if(t().ws===i&&t().loaded)return;e({ws:i}),i.subscribe("sidebar",(l,c)=>{let u=c;!u||typeof u!="object"||(u.type==="project.upsert"?t().upsertProject(u.project):u.type==="project.remove"?(e({projects:t().projects.filter(d=>d.id!==u.id)}),he.getState().reconcileSelection(t().projects,t().threads)):u.type==="thread.upsert"?t().upsertThread(u.thread):u.type==="thread.remove"&&(e({threads:t().threads.filter(d=>d.id!==u.id)}),he.getState().reconcileSelection(t().projects,t().threads)))}),i.call("providers.list").then(l=>e({providers:l})).catch(()=>{});let[n,r]=await Promise.all([i.call("projects.list"),i.call("threads.list")]),s=t(),a=new Map(n.map(l=>[l.id,l]));for(let l of s.projects)a.set(l.id,l);let o=new Map(r.map(l=>[l.id,l]));for(let l of s.threads)o.set(l.id,l);e({projects:[...a.values()].sort((l,c)=>l.createdAt-c.createdAt),threads:[...o.values()],loaded:!0}),he.getState().reconcileSelection(t().projects,t().threads)},upsertProject:i=>{let n=t().projects.filter(r=>r.id!==i.id);e({projects:[...n,i].sort((r,s)=>r.createdAt-s.createdAt)})},upsertThread:i=>{let n=t().threads.filter(r=>r.id!==i.id);e({threads:[...n,i]})}}))});var Ck=we(Af=>{"use strict";var II=Symbol.for("react.transitional.element"),zI=Symbol.for("react.fragment");function kk(e,t,i){var n=null;if(i!==void 0&&(n=""+i),t.key!==void 0&&(n=""+t.key),"key"in t){i={};for(var r in t)r!=="key"&&(i[r]=t[r])}else i=t;return t=i.ref,{$$typeof:II,type:e,key:n,ref:t!==void 0?t:null,props:i}}Af.Fragment=zI;Af.jsx=kk;Af.jsxs=kk});var be=we((F9,Tk)=>{"use strict";Tk.exports=Ck()});function Ak(e){let[t,i]=(0,zt.useState)(()=>window.matchMedia?.(e).matches??!1);return(0,zt.useEffect)(()=>{let n=window.matchMedia?.(e);if(!n)return;let r=()=>i(n.matches);return n.addEventListener?.("change",r),r(),()=>n.removeEventListener?.("change",r)},[e]),t}function Mk(e,t,i){let n=(0,zt.useRef)(0),r=(0,zt.useRef)(0),[s,a]=(0,zt.useState)(!1),o=(0,zt.useCallback)(l=>{l.preventDefault(),n.current=l.clientX,r.current=e(),a(!0),document.body.classList.add("col-drag");let c=d=>t(r.current,d.clientX-n.current),u=()=>{window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",u),document.body.classList.remove("col-drag"),a(!1),i()};window.addEventListener("pointermove",c),window.addEventListener("pointerup",u)},[e,t,i]);return{drag:s,down:o}}function Ok({sidebar:e,topbar:t,children:i,panel:n}){let r=he(),s=Ak("(max-width: 759px)"),a=Ak("(max-width: 899px)"),o=(0,zt.useRef)(!1),l=(0,zt.useRef)(!1),c=Mk((0,zt.useCallback)(()=>he.getState().sidebarWidth,[]),(0,zt.useCallback)((h,f)=>{o.current=!0;let p=he.getState(),_=Ul(p);he.setState({sidebarWidth:Nk(Math.round(h+f),so,_)})},[]),(0,zt.useCallback)(()=>{o.current&&(o.current=!1,he.getState().setSidebarWidth(he.getState().sidebarWidth))},[])),u=Mk((0,zt.useCallback)(()=>he.getState().panelWidth,[]),(0,zt.useCallback)((h,f)=>{l.current=!0;let p=he.getState(),_=ys(p);he.setState({panelWidth:Nk(Math.round(h-f),_a,_)})},[]),(0,zt.useCallback)(()=>{l.current&&(l.current=!1,he.getState().setPanelWidth(he.getState().panelWidth))},[]));(0,zt.useEffect)(()=>{let h=f=>{if(!(f.ctrlKey||f.metaKey))return;let p=f.key.toLowerCase();if(p==="b")f.preventDefault(),he.getState().toggleSidebar();else if(p==="j"){f.preventDefault();let _=he.getState();_.panelOpen?_.closePanel():_.openPanel()}};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[]),(0,zt.useEffect)(()=>{document.documentElement.style.setProperty("--sb-w",`${r.sidebarWidth}px`)},[r.sidebarWidth]),(0,zt.useEffect)(()=>{document.documentElement.style.setProperty("--pn-w",`${r.panelWidth}px`)},[r.panelWidth]),(0,zt.useEffect)(()=>{let h=()=>{let f=he.getState(),p=Tf(f);p.sidebarWidth!==f.sidebarWidth&&he.getState().setSidebarWidth(p.sidebarWidth),p.panelWidth!==f.panelWidth&&he.getState().setPanelWidth(p.panelWidth)};return window.addEventListener("resize",h),h(),()=>window.removeEventListener("resize",h)},[]);let d=r.sbOpen||r.panelOpen&&a;return(0,Ss.jsxs)("div",{className:"app",children:[(0,Ss.jsx)("aside",{className:`sidebar${r.sbHidden&&!s?" w-hide":""}${r.sbOpen?" open":""}`,children:e}),(0,Ss.jsx)("div",{className:`rs rs-l${c.drag?" drag":""}`,onPointerDown:c.down}),(0,Ss.jsxs)("main",{className:"main",children:[t,i]}),(0,Ss.jsx)("div",{className:`rs rs-r${u.drag?" drag":""}`,onPointerDown:u.down}),(0,Ss.jsx)("section",{className:`panel${r.panelOpen?" open":" w-hide"}`,"aria-hidden":!r.panelOpen,children:n}),(0,Ss.jsx)("div",{className:`scrim${d?" show":""}`,onClick:()=>{he.getState().setSbOpen(!1),he.getState().panelOpen&&a&&he.getState().closePanel()}})]})}var zt,Ss,Nk,Rk=ae(()=>{zt=ne(pt(),1);Qi();Nf();Ss=ne(be(),1),Nk=(e,t,i)=>Math.max(t,Math.min(i,e))});function Qn(e){return!!e.isComposing||e.keyCode===229}var Fl=ae(()=>{});function Ov(e,t=Date.now()){let i=Math.max(0,t-e),n=Math.floor(i/6e4);if(n<1)return g("common.justNow");if(n<60)return _e("common.minutesAgo",{n});let r=Math.floor(n/60);if(r<24)return _e("common.hoursAgo",{n:r});let s=Math.floor(r/24);if(s<7)return _e("common.daysAgo",{n:s});let a=new Date(e),o=Ad();return Da()==="zh"?`${a.getMonth()+1}/${a.getDate()}`:a.toLocaleDateString(o,{month:"short",day:"numeric"})}function Wl(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Mf(e){return`$${e.toFixed(2)}`}function Rv(e){let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m${t%60?` ${t%60}s`:""}`}var Of=ae(()=>{Ct()});function Dk(e,t){return t.has(e.id)?"dot wait":e.status==="running"||e.status==="initializing"?"dot run":e.status==="error"||e.lastTurnStatus==="failed"?"dot err":e.lastTurnStatus==="completed"?"dot ok":"dot"}var Lk=ae(()=>{});function ao({x:e,y:t,items:i,onClose:n}){let r=(0,ws.useRef)(null),[s,a]=(0,ws.useState)({left:e,top:t});return(0,ws.useLayoutEffect)(()=>{let o=r.current;if(!o)return;let l=o.getBoundingClientRect(),{left:c,top:u}=s;c+l.width>window.innerWidth-8&&(c=Math.max(8,window.innerWidth-l.width-8)),u+l.height>window.innerHeight-8&&(u=Math.max(8,window.innerHeight-l.height-8)),(c!==s.left||u!==s.top)&&a({left:c,top:u})},[e,t]),(0,ws.useEffect)(()=>{let o=c=>{r.current&&!r.current.contains(c.target)&&n()},l=c=>{c.key==="Escape"&&(c.stopPropagation(),n())};return window.addEventListener("pointerdown",o,!0),window.addEventListener("keydown",l,!0),()=>{window.removeEventListener("pointerdown",o,!0),window.removeEventListener("keydown",l,!0)}},[n]),(0,Ik.createPortal)((0,ba.jsx)("div",{ref:r,className:"menu",style:s,role:"menu",children:i.map((o,l)=>o.kind==="sep"?(0,ba.jsx)("div",{className:"msep"},l):o.kind==="label"?(0,ba.jsx)("div",{className:"mlabel",children:o.text},l):(0,ba.jsxs)("button",{className:`mi${o.danger?" danger":""}`,disabled:o.disabled,role:"menuitem",onClick:()=>{n(),o.onClick()},children:[(0,ba.jsx)("span",{children:o.label}),o.checked&&(0,ba.jsx)("span",{className:"mi-check",children:"\u2713"})]},l))}),document.body)}function ku(){let[e,t]=(0,ws.useState)(null);return[e,n=>{n.preventDefault(),n.stopPropagation(),t({x:n.clientX,y:n.clientY})},()=>t(null)]}var ws,Ik,ba,Rf=ae(()=>{ws=ne(pt(),1),Ik=ne(qs(),1),ba=ne(be(),1)});function Kr({title:e,children:t,footer:i,onClose:n,wide:r}){return(0,zk.useEffect)(()=>{let s=a=>{a.key==="Escape"&&!document.querySelector("[data-select-menu]")&&(a.stopPropagation(),n())};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[n]),(0,Bk.createPortal)((0,hn.jsx)("div",{className:"dlg-scrim",onPointerDown:s=>{s.target===s.currentTarget&&n()},children:(0,hn.jsxs)("div",{className:"dlg",style:r?{width:560}:void 0,role:"dialog","aria-label":e,children:[(0,hn.jsx)("div",{className:"dlg-title",children:e}),(0,hn.jsx)("div",{className:"dlg-body",children:t}),i&&(0,hn.jsx)("div",{className:"dlg-foot",children:i})]})}),document.body)}function $l({title:e,body:t,okLabel:i,danger:n,onOk:r,onClose:s}){let a=i??g("common.ok");return(0,hn.jsx)(Kr,{title:e,onClose:s,footer:(0,hn.jsxs)(hn.Fragment,{children:[(0,hn.jsx)("button",{className:"btn ghost",onClick:s,children:g("common.cancel")}),(0,hn.jsx)("button",{className:`btn${n?" danger":" primary"}`,onClick:()=>{s(),r()},children:a})]}),children:(0,hn.jsx)("div",{className:"dlg-hint",style:{fontSize:"var(--fs-m)",color:"var(--fg)"},children:t})})}var zk,Bk,hn,Kl=ae(()=>{zk=ne(pt(),1),Bk=ne(qs(),1);Ct();hn=ne(be(),1)});function re({name:e,size:t=16}){let i=BI[e];return i?(0,Dv.jsx)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:PI.has(e)?"currentColor":"none",stroke:"currentColor",strokeWidth:HI.has(e)?"2.2":"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,Dv.jsx)("path",{d:i})}):null}var Dv,BI,PI,HI,Mn=ae(()=>{Dv=ne(be(),1),BI={plus:"M12 5v14M5 12h14",file:"M6 3h8l4 4v14H6zM14 3v4h4",arrowLeft:"M19 12H5m6-6-6 6 6 6",arrowRight:"M5 12h14m-6-6 6 6-6 6",external:"M14 4h6v6M20 4l-9 9M18 14v6H4V6h6",globe:"M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18Zm-9 9h18M12 3c2.5 2.6 3.8 5.6 3.8 9s-1.3 6.4-3.8 9c-2.5-2.6-3.8-5.6-3.8-9S9.5 5.6 12 3Z",panelLeft:"M4 5h16v14H4zM9.5 5v14",widen:"M4 12h16M8 8l-4 4 4 4M16 8l4 4-4 4",search:"M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14Zm10 17-4.5-4.5",caret:"M9 6l6 6-6 6",dots:"M5 12h.01M12 12h.01M19 12h.01",pin:"M9 4h6l1 7 3 3v2H5v-2l3-3 1-7Zm3 12v4",send:"M4 12 20 4l-4 8 4 8-16-8Zm0 0h8",stop:"M7 7h10v10H7z",attach:"M8 12l6-6a3.5 3.5 0 0 1 5 5l-7 7a5 5 0 0 1-7-7l6-6",menu:"M4 6h16M4 12h16M4 18h16",changes:"M7 4v13m0 0a3 3 0 1 0 .01 0M7 17a3 3 0 1 1-.01 0M17 7v13m0-13a3 3 0 1 0 .01 0M17 7a3 3 0 1 1-.01 0",files:"M4 4h6l2 3h8v13H4V4Z",term:"M4 5h16v14H4zM7 9l3 3-3 3m5 0h5",x:"M6 6l12 12M18 6 6 18",refresh:"M20 11a8 8 0 1 0-2.3 6.3M20 5v6h-6",copy:"M8 8h11v12H8zM5 16V4h11",check:"M5 13l4 4L19 7",gauge:"M5.6 18.4a9 9 0 1 1 12.8 0M12 13l3.5-3.5M12 13h.01",arrowUp:"M12 19V5m-6 6 6-6 6 6",stopFill:"M8 8h8v8H8z",shield:"M12 3l8 3v6c0 5-3.5 9-8 11-4.5-2-8-6-8-11V6l8-3z",quote:"M5 7h5v5H7c0 2 1 3 3 4M14 7h5v5h-3c0 2 1 3 3 4",chat:"M5 5h14v10H9l-4 4V5zM9 10h.01M12 10h.01M15 10h.01",pencil:"M4 20h4L19 9a2.1 2.1 0 0 0-3-3L5 17v3zM14 7l3 3",shieldCheck:"M12 3l8 3v6c0 5-3.5 9-8 11-4.5-2-8-6-8-11V6l8-3zM8.5 12.2l2.4 2.4 4.6-4.8",zap:"M13 2L4 14h7l-1 8 9-12h-7l1-8z",prompt:"M5 7l5 5-5 5M12 17h7",fileText:"M6 3h8l4 4v14H6zM14 3v4h4M9 12h6M9 16h6",layers:"M12 3l9 5-9 5-9-5 9-5zM3 13l9 5 9-5",wrench:"M14.7 6.3a4 4 0 0 0-5.4 5.4L4 17l3 3 5.3-5.3a4 4 0 0 0 5.4-5.4l-2.5 2.5-2.4-.6-.6-2.4z",spark:"M12 4v4M12 16v4M4 12h4M16 12h4M6.6 6.6l2.2 2.2M15.2 15.2l2.2 2.2M6.6 17.4l2.2-2.2M15.2 8.8l2.2-2.2",clock:"M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18zM12 7v5l3 2",hourglass:"M7 3h10M7 21h10M8 3c0 4.5 8 4.5 8 9s-8 4.5-8 9M16 3c0 4.5-8 4.5-8 9s8 4.5 8 9",cpu:"M6 6h12v12H6zM10 10h4v4h-4zM9 3v3M15 3v3M9 18v3M15 18v3M3 9h3M3 15h3M18 9h3M18 15h3",wrap:"M4 6h16M4 12h13a3 3 0 0 1 0 6h-4m2-2-2 2 2 2M4 18h5",listChecks:"M4 7l2 2 3-3M4 15l2 2 3-3M12 8h8M12 16h8",circle:"M12 4.5a7.5 7.5 0 1 0 0 15 7.5 7.5 0 0 0 0-15z",settings:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"},PI=new Set(["stopFill"]),HI=new Set(["arrowUp"])});function Hk(){let e=Pk(t=>t.list);return e.length===0?null:(0,Lv.jsx)("div",{className:"toasts",children:e.map(t=>(0,Lv.jsx)("div",{className:`toast${t.err?" err":""}`,children:t.text},t.id))})}var Lv,UI,Pk,Ee,fr=ae(()=>{Ra();Lv=ne(be(),1),UI=0,Pk=qn(e=>({list:[],push:(t,i)=>{let n=++UI;e(r=>({list:[...r.list,{id:n,text:t,err:i}]})),setTimeout(()=>e(r=>({list:r.list.filter(s=>s.id!==n)})),3500)}})),Ee=(e,t=!1)=>Pk.getState().push(e,t)});function qk({pendingByThread:e}){let{projects:t,threads:i}=Ke(),n=he(),[r,s]=(0,Je.useState)(""),[a,o]=(0,Je.useState)({}),[l,c]=(0,Je.useState)({}),[u,d]=(0,Je.useState)(null),[h,f]=(0,Je.useState)(""),[p,_]=(0,Je.useState)(!1),[y,m]=(0,Je.useState)(null),[v,b]=(0,Je.useState)(null),[w,k]=(0,Je.useState)(null),[M,T,A]=ku(),[I,B,q]=ku(),H=(0,Je.useRef)({}),P=(0,Je.useRef)(null);(0,Je.useEffect)(()=>{let L=X=>{let oe=X.detail?.projectId,ge=t.find(te=>te.id===oe)??t[0];ge&&m(ge)},K=()=>_(!0);return window.addEventListener("open-import",L),window.addEventListener("open-new-project",K),()=>{window.removeEventListener("open-import",L),window.removeEventListener("open-new-project",K)}},[t]);let x=(0,Je.useMemo)(()=>{let L=r.trim().toLowerCase();return L?i.filter(K=>K.title.toLowerCase().includes(L)):i},[i,r]),U=(0,Je.useMemo)(()=>{let L=new Map;for(let K of x)(!K.archived||a[K.projectId])&&(L.get(K.projectId)??L.set(K.projectId,[]).get(K.projectId)).push(K);for(let K of L.values())K.sort((X,oe)=>Number(X.archived)-Number(oe.archived)||Number(oe.pinned)-Number(X.pinned)||oe.updatedAt-X.updatedAt);return L},[x,a]),C=(0,Je.useMemo)(()=>{let L=new Map;for(let K of x)K.archived&&L.set(K.projectId,(L.get(K.projectId)??0)+1);return L},[x]);async function D(L){try{let K=await WI(),X=await ql(),oe=await Q.call("threads.create",{projectId:L,provider:X,model:null,mode:K.defaultMode??"default"});n.select(L,oe.id)}catch(K){Ee(g("sidebar.failNewThread")+Ze(K),!0)}}function R(L){return[{kind:"item",label:g("common.rename"),onClick:()=>{d(L.id),f(L.title)}},{kind:"item",label:L.pinned?g("sidebar.unpin"):g("sidebar.pin"),onClick:()=>{Q.call("threads.update",{id:L.id,pinned:!L.pinned})}},{kind:"item",label:L.archived?g("sidebar.unarchive"):g("sidebar.archive"),onClick:()=>{V(L)}},{kind:"item",label:g("sidebar.exportMd"),onClick:()=>{GI(L)}},{kind:"sep"},{kind:"item",label:g("common.delete"),danger:!0,onClick:()=>b({title:g("sidebar.deleteThread"),body:_e("sidebar.deleteThreadBody",{title:L.title}),onOk:()=>{Q.call("threads.delete",{id:L.id})}})}]}async function V(L){try{await Q.call("threads.update",{id:L.id,archived:!L.archived}),L.archived?Ee(g("sidebar.unarchived")):(o(K=>({...K,[L.projectId]:!0})),Ee(g("sidebar.archivedHint")))}catch(K){Ee(Ze(K),!0)}}function z(L){return[{kind:"item",label:g("sidebar.newThread"),onClick:()=>{D(L.id)}},{kind:"item",label:g("sidebar.importHist"),onClick:()=>m(L)},{kind:"item",label:g("common.rename"),onClick:()=>k(L)},{kind:"item",label:g("sidebar.openExplorer"),onClick:()=>{Q.call("projects.open",{id:L.id})}},{kind:"sep"},{kind:"item",label:a[L.id]?g("sidebar.hideArchived"):g("sidebar.showArchived"),onClick:()=>o(K=>({...K,[L.id]:!K[L.id]}))},{kind:"sep"},{kind:"item",label:g("sidebar.removeProject"),danger:!0,onClick:()=>b({title:g("sidebar.removeProject"),body:_e("sidebar.removeProjectBody",{name:L.name}),onOk:()=>{Q.call("projects.remove",{id:L.id})}})}]}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)("div",{className:"sb-row",children:[(0,J.jsx)(Iv,{}),(0,J.jsxs)("button",{className:"sb-new",onClick:()=>_(!0),children:[(0,J.jsx)("span",{className:"sb-new-tile",children:(0,J.jsx)(re,{name:"plus",size:12})}),g("sidebar.newProject")]}),(0,J.jsx)("button",{className:"ibtn",title:g("common.settings"),onClick:()=>window.dispatchEvent(new CustomEvent("open-settings")),children:(0,J.jsx)(re,{name:"settings"})}),(0,J.jsx)("button",{className:"ibtn",title:g("sidebar.searchTitle"),onClick:()=>P.current?.focus(),children:(0,J.jsx)(re,{name:"search"})})]}),(0,J.jsx)("div",{className:"sb-row sb-row-search",children:(0,J.jsxs)("div",{className:"sb-search",children:[(0,J.jsx)(re,{name:"search",size:13}),(0,J.jsx)("input",{ref:P,placeholder:g("sidebar.filterPlaceholder"),value:r,onChange:L=>s(L.target.value),onKeyDown:L=>{L.key==="Escape"&&s("")}})]})}),(0,J.jsxs)("div",{className:"sb-list",children:[t.length===0&&(0,J.jsxs)("div",{className:"sb-start",children:[(0,J.jsx)("div",{className:"sb-start-t",children:g("sidebar.noProjectsTitle")}),(0,J.jsx)("div",{className:"sb-start-s",children:g("sidebar.noProjectsSub")}),(0,J.jsx)("button",{className:"btn primary",onClick:()=>_(!0),children:g("sidebar.newProject")})]}),t.map(L=>{let K=U.get(L.id)??[],X=n.collapsed[L.id],oe=C.get(L.id)??0,ge=l[L.id]?K:K.slice(0,Uk);return(0,J.jsxs)("div",{className:"pj-group",children:[(0,J.jsxs)("div",{className:"pj",onContextMenu:te=>{H.current.project=L,T(te)},children:[(0,J.jsxs)("button",{className:"pj-toggle",onClick:()=>n.toggleCollapsed(L.id),children:[(0,J.jsx)("span",{className:`pj-caret${X?"":" open"}`,children:(0,J.jsx)(re,{name:"caret"})}),(0,J.jsx)("span",{className:"pj-badge",children:L.name.slice(0,1)}),(0,J.jsx)("span",{className:"pj-name",children:L.name})]}),(0,J.jsx)("span",{className:"pj-count",children:K.length||""}),(0,J.jsx)("button",{className:"pj-act",title:g("sidebar.newThread"),onClick:()=>{D(L.id)},children:(0,J.jsx)(re,{name:"plus"})}),(0,J.jsx)("button",{className:"pj-act",title:g("sidebar.projectMenu"),onClick:te=>{H.current.project=L,T(te)},children:(0,J.jsx)(re,{name:"dots"})})]}),!X&&(0,J.jsxs)("div",{className:"pj-sessions",children:[ge.map(te=>u===te.id?(0,J.jsx)("div",{className:"t-item",children:(0,J.jsx)("input",{className:"t-rename",autoFocus:!0,value:h,onChange:We=>f(We.target.value),onBlur:()=>d(null),onKeyDown:We=>{We.key==="Enter"&&!Qn(We.nativeEvent)&&h.trim()?(Q.call("threads.update",{id:te.id,title:h.trim()}),d(null)):We.key==="Escape"&&d(null)}})},te.id):(0,J.jsxs)("button",{className:`t-item${n.currentThreadId===te.id?" on":""}${te.archived?" archived":""}`,onClick:()=>n.select(L.id,te.id),onContextMenu:We=>{H.current.thread=te,B(We)},children:[(0,J.jsx)("span",{className:qI(te,e)}),te.pinned&&(0,J.jsx)("span",{className:"t-pin",children:(0,J.jsx)(re,{name:"pin"})}),(0,J.jsx)("span",{className:"t-title",children:Md(te.title,te.titleAuto)}),(0,J.jsx)("span",{className:"t-time",children:Ov(te.updatedAt)}),(0,J.jsx)("span",{className:"t-more",role:"button",onClick:We=>{We.stopPropagation(),H.current.thread=te,B(We)},children:(0,J.jsx)(re,{name:"dots"})})]},te.id)),K.length>Uk&&!l[L.id]&&(0,J.jsx)("button",{className:"pj-more",onClick:()=>c(te=>({...te,[L.id]:!0})),children:_e("sidebar.showAll",{n:K.length})}),oe>0&&(0,J.jsx)("button",{className:"pj-more",onClick:()=>o(te=>({...te,[L.id]:!te[L.id]})),children:a[L.id]?g("sidebar.hideArchived"):_e("sidebar.archivedN",{n:oe})}),K.length===0&&oe===0&&(0,J.jsx)("div",{className:"pj-empty",children:g("sidebar.noThreads")})]})]},L.id)})]}),M&&H.current.project&&(0,J.jsx)(ao,{x:M.x,y:M.y,items:z(H.current.project),onClose:A}),I&&H.current.thread&&(0,J.jsx)(ao,{x:I.x,y:I.y,items:R(H.current.thread),onClose:q}),p&&(0,J.jsx)($I,{onClose:()=>_(!1)}),y&&(0,J.jsx)(KI,{project:y,onClose:()=>m(null)}),v&&(0,J.jsx)($l,{title:v.title,body:v.body,danger:!0,onOk:v.onOk,onClose:()=>b(null)}),w&&(0,J.jsx)(FI,{project:w,onClose:()=>k(null)})]})}function FI({project:e,onClose:t}){let[i,n]=(0,Je.useState)(e.name),r=i.trim().length>0&&i.trim()!==e.name,s=()=>{r&&Q.call("projects.rename",{id:e.id,name:i.trim()}).then(t).catch(a=>Ee(g("sidebar.failRename")+Ze(a),!0))};return(0,J.jsx)(Kr,{title:g("sidebar.renameProject"),onClose:t,footer:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("button",{className:"btn ghost",onClick:t,children:g("common.cancel")}),(0,J.jsx)("button",{className:"btn primary",disabled:!r,onClick:s,children:g("common.save")})]}),children:(0,J.jsxs)("div",{className:"dlg-row",children:[(0,J.jsx)("label",{children:g("sidebar.projectName")}),(0,J.jsx)("input",{className:"tinput",autoFocus:!0,value:i,onChange:a=>n(a.target.value),onKeyDown:a=>{a.key==="Enter"&&!Qn(a.nativeEvent)&&s()}})]})})}function WI(){return Q.call("settings.get").then(e=>e).catch(()=>({}))}function $I({onClose:e}){let[t,i]=(0,Je.useState)(""),[n,r]=(0,Je.useState)(null),[s,a]=(0,Je.useState)([]),[o,l]=(0,Je.useState)(!1),c=he();(0,Je.useEffect)(()=>{Q.call("fs.recentDirs").then(h=>a(h)).catch(()=>{})},[]),(0,Je.useEffect)(()=>{let h=t.trim();if(!h){r(null);return}let f=setTimeout(()=>{Q.call("fs.check",{path:h}).then(p=>r(p)).catch(()=>r(null))},200);return()=>clearTimeout(f)},[t]);let u=n?.exists&&n.isDir;async function d(){if(!(!u||o)){l(!0);try{let h=await Q.call("projects.create",{path:t.trim()});c.select(h.id,null),e()}catch(h){Ee(g("sidebar.failAddProject")+Ze(h),!0),l(!1)}}}return(0,J.jsxs)(Kr,{title:g("sidebar.newProjectDlg"),onClose:e,footer:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("button",{className:"btn ghost",onClick:e,children:g("common.cancel")}),(0,J.jsx)("button",{className:"btn primary",disabled:!u||o,onClick:()=>{d()},children:g("common.add")})]}),children:[(0,J.jsxs)("div",{className:"dlg-row",children:[(0,J.jsx)("label",{children:g("sidebar.dirLabel")}),(0,J.jsxs)("div",{style:{display:"flex",gap:6},children:[(0,J.jsx)("input",{className:`tinput${n&&!u?" err":""}`,style:{flex:1},autoFocus:!0,placeholder:"D:\\\\path\\\\to\\\\project",value:t,onChange:h=>i(h.target.value),onKeyDown:h=>{h.key==="Enter"&&!Qn(h.nativeEvent)&&d()}}),(0,J.jsx)("button",{className:"btn",style:{flex:"none",whiteSpace:"nowrap"},onClick:()=>{Q.call("fs.pickFolder",{initial:t.trim()||void 0}).then(h=>{let f=h;f?.path?i(f.path):f&&!f.available&&Ee(g("sidebar.pickFolderUnsupported"))}).catch(()=>Ee(g("sidebar.pickFolderFailed")))},children:g("common.browse")})]}),n&&!n.exists&&(0,J.jsx)("div",{className:"dlg-hint err",children:g("sidebar.dirMissing")}),n&&n.exists&&!n.isDir&&(0,J.jsx)("div",{className:"dlg-hint err",children:g("sidebar.notDir")}),u&&(0,J.jsx)("div",{className:"dlg-hint",children:g("sidebar.dirOk")})]}),s.length>0&&(0,J.jsxs)("div",{className:"dlg-row",children:[(0,J.jsx)("label",{children:g("sidebar.recent")}),s.map(h=>(0,J.jsx)("button",{className:"mi",style:{height:26},onClick:()=>i(h),children:h},h))]})]})}function KI({project:e,onClose:t}){let[i,n]=(0,Je.useState)(null),[r,s]=(0,Je.useState)(new Set),[a,o]=(0,Je.useState)(!1),l=he();(0,Je.useEffect)(()=>{Q.call("history.list",{projectId:e.id}).then(d=>n(d)).catch(d=>{Ee(g("sidebar.failImportList")+Ze(d),!0),n([])})},[e.id]);let c=d=>{s(h=>{let f=new Set(h);return f.has(d)?f.delete(d):f.add(d),f})};async function u(){if(!(a||r.size===0||!i)){o(!0);try{let d=i.filter(f=>r.has(f.sessionId)&&!f.imported),h=await Q.call("history.import",{projectId:e.id,items:d.map(f=>({provider:f.provider,sessionId:f.sessionId,title:f.title}))});Ee(_e("sidebar.importedN",{n:h.length})),h.length>0&&l.select(e.id,h[h.length-1].id),t()}catch(d){Ee(g("sidebar.failImport")+Ze(d),!0)}finally{o(!1)}}}return(0,J.jsxs)(Kr,{title:_e("sidebar.importTitle",{name:e.name}),onClose:t,wide:!0,footer:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("button",{className:"btn ghost",onClick:t,children:g("common.cancel")}),(0,J.jsx)("button",{className:"btn primary",disabled:a||r.size===0,onClick:()=>{u()},children:a?g("sidebar.importing"):_e("sidebar.importN",{n:r.size||0})})]}),children:[i===null&&(0,J.jsx)("div",{className:"dlg-hint",children:g("sidebar.scanning")}),i!==null&&i.length===0&&(0,J.jsx)("div",{className:"dlg-hint",children:g("sidebar.importEmpty")}),i!==null&&i.length>0&&(0,J.jsx)("div",{className:"imp-list",children:i.map(d=>(0,J.jsxs)("label",{className:`imp-row${d.imported?" done":""}`,children:[(0,J.jsx)("input",{type:"checkbox",disabled:d.imported,checked:r.has(d.sessionId),onChange:()=>c(d.sessionId)}),(0,J.jsx)("span",{className:"imp-title",children:d.title}),(0,J.jsxs)("span",{className:"imp-meta",children:[d.provider," \xB7 ",d.messageCount,g("common.messages")," \xB7 ",Ov(d.updatedAt),d.imported?g("common.imported"):""]})]},d.sessionId))})]})}async function GI(e){try{let t=await Q.call("thread.exportMarkdown",{id:e.id});if(t.path){Ee(_e("sidebar.exportSaved",{path:t.path}));return}let i=new Blob([t.markdown],{type:"text/markdown;charset=utf-8"}),n=document.createElement("a");n.href=URL.createObjectURL(i),n.download=t.filename||`${e.title}.md`,n.style.display="none",document.body.appendChild(n),n.click(),setTimeout(()=>{URL.revokeObjectURL(n.href),n.remove()},5e3)}catch(t){Ee(g("sidebar.failExport")+Ze(t),!0)}}function Iv({className:e=""}){let t=he(r=>r.sbHidden),i=he(r=>r.sbOpen),n=g(t&&!i?"sidebar.expand":"sidebar.collapse");return(0,J.jsx)("button",{type:"button",className:`ibtn sb-toggle ${e}`,title:`${n} (Ctrl+B)`,"aria-label":n,"aria-expanded":!t||i,onClick:()=>he.getState().toggleSidebar(),children:(0,J.jsx)(re,{name:"panelLeft"})})}var Je,J,Uk,qI,zv=ae(()=>{Je=ne(pt(),1);Fl();An();Qi();Hi();Of();Lk();Rf();Kl();Mn();fr();Ct();J=ne(be(),1),Uk=10,qI=Dk});function Hv(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function Qk(e){fo=e}function oo(e){let t=[];return i=>{let n=Math.max(0,Math.min(3,i-1)),r=t[n];return r||(r=e(n),t[n]=r),r}}function Ae(e,t=""){let i=typeof e=="string"?e:e.source,n={replace:(r,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(fi.caret,"$1"),i=i.replace(r,a),n},getRegex:()=>new RegExp(i,t)};return n}function On(e,t){if(t){if(fi.escapeTest.test(e))return e.replace(fi.escapeReplace,Kk)}else if(fi.escapeTestNoEncode.test(e))return e.replace(fi.escapeReplaceNoEncode,Kk);return e}function Kz(e){return fi.numericCharacterReference.test(e)?e.replace(fi.numericCharacterReferenceOrAmpersand,(t,i,n)=>{if(i===void 0&&n===void 0)return"&";let r=i===void 0?Number.parseInt(n,16):Number.parseInt(i,10);return r===0||r>1114111||r>=55296&&r<=57343?"\uFFFD":r===38?"&":String.fromCodePoint(r)}):e}function Gk(e){try{e=encodeURI(e).replace(fi.percentDecode,"%")}catch{return null}return e}function jk(e,t){let i=e.replace(fi.findPipe,(s,a,o)=>{let l=!1,c=a;for(;--c>=0&&o[c]==="\\";)l=!l;return l?"|":" |"}),n=i.split(fi.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length>>=0,e===0?32:31-(tL(e)/iL|0)|0}var Vd=256,Xd=262144,Zd=4194304;function qa(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function uf(e,t,i){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var o=n&134217727;return o!==0?(n=o&~s,n!==0?r=qa(n):(a&=o,a!==0?r=qa(a):i||(i=o&~e,i!==0&&(r=qa(i))))):(o=n&~s,o!==0?r=qa(o):a!==0?r=qa(a):i||(i=n&~e,i!==0&&(r=qa(i)))),r===0?0:t!==0&&t!==r&&(t&s)===0&&(s=r&-r,i=t&-t,s>=i||s===32&&(i&4194048)!==0)?t:r}function _u(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function C1(e,t){(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0i;i++)t.push(e);return t}function vu(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function sL(e,t,i,n,r,s){var a=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var o=e.entanglements,l=e.expirationTimes,c=e.hiddenUpdates;for(i=a&~i;0"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Mg=!1;if(fs)try{Yo={},Object.defineProperty(Yo,"passive",{get:function(){Mg=!0}}),window.addEventListener("test",Yo,Yo),window.removeEventListener("test",Yo,Yo)}catch{Mg=!1}var Yo,Js=null,L_=null,_h=null;function F1(){if(_h)return _h;var e,t=L_,i=t.length,n,r="value"in Js?Js.value:Js.textContent,s=r.length;for(e=0;e=Uc),YS=" ",VS=!1;function W1(e,t){switch(e){case"keyup":return qL.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function K1(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var rl=!1;function $L(e,t){switch(e){case"compositionend":return K1(t);case"keypress":return t.which!==32?null:(VS=!0,YS);case"textInput":return e=t.data,e===YS&&VS?null:e;default:return null}}function WL(e,t){if(rl)return e==="compositionend"||!z_&&W1(e,t)?(e=F1(),_h=L_=Js=null,rl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function JS(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ew(e,t){var i=JS(e);e=0;for(var n;i;){if(i.nodeType===3){if(n=e+i.textContent.length,e<=t&&n>=t)return{node:i,offset:t-e};e=n}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=JS(i)}}function V1(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?V1(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function X1(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Og(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=Og(e.document)}return t}function B_(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var QL=fs&&"documentMode"in document&&11>=document.documentMode,sl=null,Rg=null,Fc=null,Dg=!1;function tw(e,t,i){var n=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Dg||sl==null||sl!==Og(n)||(n=sl,"selectionStart"in n&&B_(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Fc&&iu(Fc,n)||(Fc=n,n=of(Rg,"onSelect"),0>=a,r-=a,Pr=1<<32-Tn(t)+r|i<A?(L=T,T=null):L=T.sibling;var B=h(m,T,b[A],w);if(B===null){T===null&&(T=L);break}e&&T&&B.alternate===null&&t(m,T),v=s(B,v,A),M===null?k=B:M.sibling=B,M=B,T=L}if(A===b.length)return i(m,T),ze&&cs(m,A),k;if(T===null){for(;AA?(L=T,T=null):L=T.sibling;var q=h(m,T,B.value,w);if(q===null){T===null&&(T=L);break}e&&T&&q.alternate===null&&t(m,T),v=s(q,v,A),M===null?k=q:M.sibling=q,M=q,T=L}if(B.done)return i(m,T),ze&&cs(m,A),k;if(T===null){for(;!B.done;A++,B=b.next())B=d(m,B.value,w),B!==null&&(v=s(B,v,A),M===null?k=B:M.sibling=B,M=B);return ze&&cs(m,A),k}for(T=n(T);!B.done;A++,B=b.next())B=f(T,m,A,B.value,w),B!==null&&(e&&(L=B.alternate,L!==null&&T.delete(L.key===null?A:L.key)),v=s(B,v,A),M===null?k=B:M.sibling=B,M=B);return e&&T.forEach(function(H){return t(m,H)}),ze&&cs(m,A),k}function y(m,v,b,w){if(typeof b=="object"&&b!==null&&b.type===tl&&b.key===null&&b.props.ref===void 0&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Yd:e:{for(var k=b.key;v!==null;){if(v.key===k){if(k=b.type,k===tl){if(v.tag===7){i(m,v.sibling),w=r(v,b.props.children),Gs(w,b),w.return=m,m=w;break e}}else if(v.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Vs&&Fa(k)===v.type){i(m,v.sibling),w=r(v,b.props),Gs(w,b),w.return=m,m=w;break e}i(m,v);break}else t(m,v);v=v.sibling}b.type===tl?(w=ja(b.props.children,m.mode,w,b.key),Gs(w,b),w.return=m,m=w):(w=bh(b.type,b.key,b.props,null,m.mode,w),Gs(w,b),w.return=m,m=w)}return a(m);case Ic:e:{for(k=b.key;v!==null;){if(v.key===k)if(v.tag===4&&v.stateNode.containerInfo===b.containerInfo&&v.stateNode.implementation===b.implementation){i(m,v.sibling),w=r(v,b.children||[]),w.return=m,m=w;break e}else{i(m,v);break}else t(m,v);v=v.sibling}w=Qm(b,m.mode,w),w.return=m,m=w}return a(m);case Vs:return b=Fa(b),y(m,v,b,w)}if(zc(b))return p(m,v,b,w);if(Ac(b)){if(k=Ac(b),typeof k!="function")throw Error(F(150));return b=k.call(b),_(m,v,b,w)}if(typeof b.then=="function")return y(m,v,nh(b),w);if(b.$$typeof===zr)return y(m,v,ih(m,b),w);rh(m,b)}return typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint"?(b=""+b,v!==null&&v.tag===6?(i(m,v.sibling),w=r(v,b),w.return=m,m=w):(i(m,v),w=Zm(b,m.mode,w),w.return=m,m=w),a(m)):i(m,v)}return function(m,v,b,w){try{su=0;var k=y(m,v,b,w);return gl=null,k}catch(T){if(T===Bl||T===vf)throw T;var M=un(29,T,null,m.mode);return M.lanes=w,M.return=m,M}}}var to=dx(!0),hx=dx(!1),Xs=!1;function K_(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hg(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function aa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function oa(e,t,i){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(Ve&2)!==0){var r=n.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),n.pending=t,t=Uh(e),nx(e,null,i),t}return gf(e,n,t,i),Uh(e)}function Wc(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var n=t.lanes;n&=e.pendingLanes,i|=n,t.lanes=i,A1(e,i)}}function eg(e,t){var i=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,i===n)){var r=null,s=null;if(i=i.firstBaseUpdate,i!==null){do{var a={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};s===null?r=s=a:s=s.next=a,i=i.next}while(i!==null);s===null?r=s=t:s=s.next=t}else r=s=t;i={baseState:n.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:n.shared,callbacks:n.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var Ug=!1;function Kc(){if(Ug){var e=ml;if(e!==null)throw e}}function Gc(e,t,i,n){Ug=!1;var r=e.updateQueue;Xs=!1;var s=r.firstBaseUpdate,a=r.lastBaseUpdate,o=r.shared.pending;if(o!==null){r.shared.pending=null;var l=o,c=l.next;l.next=null,a===null?s=c:a.next=c,a=l;var u=e.alternate;u!==null&&(u=u.updateQueue,o=u.lastBaseUpdate,o!==a&&(o===null?u.firstBaseUpdate=c:o.next=c,u.lastBaseUpdate=l))}if(s!==null){var d=r.baseState;a=0,u=c=l=null,o=s;do{var h=o.lane&-536870913,f=h!==o.lane;if(f?(Fe&h)===h:(n&h)===h){h!==0&&h===eo&&(Ug=!0),u!==null&&(u=u.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var p=e,_=o;h=t;var y=i;switch(_.tag){case 1:if(p=_.payload,typeof p=="function"){d=p.call(y,d,h);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=_.payload,h=typeof p=="function"?p.call(y,d,h):p,h==null)break e;d=ft({},d,h);break e;case 2:Xs=!0}}h=o.callback,h!==null&&(e.flags|=64,f&&(e.flags|=8192),f=r.callbacks,f===null?r.callbacks=[h]:f.push(h))}else f={lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},u===null?(c=u=f,l=d):u=u.next=f,a|=h;if(o=o.next,o===null){if(o=r.shared.pending,o===null)break;f=o,o=f.next,f.next=null,r.lastBaseUpdate=f,r.shared.pending=null}}while(!0);u===null&&(l=d),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=u,s===null&&(r.shared.lanes=0),va|=a,e.lanes=a,e.memoizedState=d}}function fx(e,t){if(typeof e!="function")throw Error(F(191,e));e.call(t)}function px(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;es?s:8;var a=Ee.T,o={};o.types=a!==null?a.types:null,Ee.T=o,sv(e,!1,t,i);try{var l=r(),c=Ee.S;if(c!==null&&c(o,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=c3(l,n);jc(e,t,u,Nn(e))}else jc(e,t,n,Nn(e))}catch(d){jc(e,t,{then:function(){},status:"rejected",reason:d},Nn())}finally{Xe.p=s,a!==null&&o.types!==null&&(a.types=o.types),Ee.T=a}}function m3(){}function Kg(e,t,i,n){if(e.tag!==5)throw Error(F(476));var r=Hx(e).queue;Px(e,r,t,Ga,i===null?m3:function(){return Ux(e),i(n)})}function Hx(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Ga,baseState:Ga,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gs,lastRenderedState:Ga},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gs,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ux(e){var t=Hx(e);t.next===null&&(t=e.alternate.memoizedState),jc(e,t.next.queue,{},Nn())}function rv(){return Ni(Rl)}function qx(){return Kt().memoizedState}function Fx(){return Kt().memoizedState}function g3(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Nn();e=aa(i);var n=oa(t,e,i);n!==null&&(dn(n,t,i),Wc(n,t,i)),t={cache:F_()},e.payload=t;return}t=t.return}}function _3(e,t,i){var n=Nn();i={lane:n,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},wf(e)?Wx(t,i):(i=H_(e,t,i,n),i!==null&&(dn(i,e,n),Kx(i,t,n)))}function $x(e,t,i){var n=Nn();jc(e,t,i,n)}function jc(e,t,i,n){var r={lane:n,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(wf(e))Wx(t,r);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var a=t.lastRenderedState,o=s(a,i);if(r.hasEagerState=!0,r.eagerState=o,An(o,a))return gf(e,t,r,0),ht===null&&mf(),!1}catch{}if(i=H_(e,t,r,n),i!==null)return dn(i,e,n),Kx(i,t,n),!0}return!1}function sv(e,t,i,n){if(n={lane:2,revertLane:gv(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},wf(e)){if(t)throw Error(F(479))}else t=H_(e,i,n,2),t!==null&&dn(t,e,2)}function wf(e){var t=e.alternate;return e===De||t!==null&&t===De}function Wx(e,t){_l=jh=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Kx(e,t,i){if((i&4194048)!==0){var n=t.lanes;n&=e.pendingLanes,i|=n,t.lanes=i,A1(e,i)}}var Vh={readContext:Ni,use:yf,useCallback:Pt,useContext:Pt,useEffect:Pt,useImperativeHandle:Pt,useLayoutEffect:Pt,useInsertionEffect:Pt,useMemo:Pt,useReducer:Pt,useRef:Pt,useState:Pt,useDebugValue:Pt,useDeferredValue:Pt,useTransition:Pt,useSyncExternalStore:Pt,useId:Pt,useHostTransitionStatus:Pt,useFormState:Pt,useActionState:Pt,useOptimistic:Pt,useMemoCache:Pt,useCacheRefresh:Pt,useEffectEvent:Pt},Gx={readContext:Ni,use:yf,useCallback:function(e,t){return Qi().memoizedState=[e,t===void 0?null:t],e},useContext:Ni,useEffect:_w,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,xh(4194308,4,Dx.bind(null,t,e),i)},useLayoutEffect:function(e,t){return xh(4194308,4,e,t)},useInsertionEffect:function(e,t){xh(4,2,e,t)},useMemo:function(e,t){var i=Qi();t=t===void 0?null:t;var n=e();if(io){Qs(!0);try{e()}finally{Qs(!1)}}return i.memoizedState=[n,t],n},useReducer:function(e,t,i){var n=Qi();if(i!==void 0){var r=i(t);if(io){Qs(!0);try{i(t)}finally{Qs(!1)}}}else r=t;return n.memoizedState=n.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},n.queue=e,e=e.dispatch=_3.bind(null,De,e),[n.memoizedState,e]},useRef:function(e){var t=Qi();return e={current:e},t.memoizedState=e},useState:function(e){e=$g(e);var t=e.queue,i=$x.bind(null,De,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:iv,useDeferredValue:function(e,t){var i=Qi();return nv(i,e,t)},useTransition:function(){var e=$g(!1);return e=Px.bind(null,De,e.queue,!0,!1),Qi().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var n=De,r=Qi();if(ze){if(i===void 0)throw Error(F(407));i=i()}else{if(i=t(),ht===null)throw Error(F(349));(Fe&127)!==0||bx(n,t,i)}r.memoizedState=i;var s={value:i,getSnapshot:t};return r.queue=s,_w(Sx.bind(null,n,s,e),[e]),n.flags|=2048,kl(9,{destroy:void 0},yx.bind(null,n,s,i,t),null),i},useId:function(){var e=Qi(),t=ht.identifierPrefix;if(ze){var i=Hr,n=Pr;i=(n&~(1<<32-Tn(n)-1)).toString(32)+i,t="_"+t+"R_"+i,i=Yh++,0<\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof n.is=="string"?a.createElement("select",{is:n.is}):a.createElement("select"),n.multiple?s.multiple=!0:n.size&&(s.size=n.size);break;default:s=typeof n.is=="string"?a.createElement(r,{is:n.is}):a.createElement(r)}}s[Ti]=t,s[fn]=n;e:for(a=t.child;a!==null;){if(a.tag===5||a.tag===6)s.appendChild(a.stateNode);else if(a.tag!==4&&a.tag!==27&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}t.stateNode=s;e:switch(Oi(s,r,n),r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&ls(t)}}return yt(t),t.subtreeFlags&=-33554433,rg(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==n&&ls(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(F(166));if(e=ra.current,Vo(t)){if(e=t.stateNode,i=t.memoizedProps,n=null,r=hi,r!==null)switch(r.tag){case 27:case 5:n=r.memoizedProps}e[Ti]=t,e=!!(e.nodeValue===i||n!==null&&n.suppressHydrationWarning===!0||$E(e.nodeValue,i)),e||ma(t,!0)}else e=uu(e).createTextNode(n),e[Ti]=t,t.stateNode=e}return yt(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(n=Vo(t),i!==null){if(e===null){if(!n)throw Error(F(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(F(557));e[Ti]=t}else Za(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;yt(t),e=!1}else i=Jm(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(wn(t),t):(wn(t),null);if((t.flags&128)!==0)throw Error(F(558))}return yt(t),null;case 13:if(n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=Vo(t),n!==null&&n.dehydrated!==null){if(e===null){if(!r)throw Error(F(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(F(317));r[Ti]=t}else Za(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;yt(t),r=!1}else r=Jm(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(wn(t),t):(wn(t),null)}return wn(t),(t.flags&128)!==0?(t.lanes=i,t):(i=n!==null,e=e!==null&&e.memoizedState!==null,i&&(n=t.child,r=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(r=n.alternate.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==r&&(n.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),oh(t,t.updateQueue),yt(t),null);case 4:return wl(),e===null&&_v(t.stateNode.containerInfo),t.flags|=67108864,yt(t),null;case 10:return hs(t.type),yt(t),null;case 19:if(j_(t),n=t.memoizedState,n===null)return yt(t),null;if(r=(t.flags&128)!==0,s=n.rendering,s===null)if(r)Oc(n,!1);else{if(Ht!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(s=Gh(e),s!==null){for(t.flags|=128,Oc(n,!1),e=s.updateQueue,t.updateQueue=e,oh(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)rx(i,e),i=i.sibling;return au(t,Mi.current&1|2),ze&&cs(t,n.treeForkCount),t.child}e=e.sibling}n.tail!==null&&kn()>nf&&(t.flags|=128,r=!0,Oc(n,!1),t.lanes=4194304)}else{if(!r)if(e=Gh(s),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,oh(t,e),Oc(n,!0),n.tail===null&&n.tailMode!=="collapsed"&&n.tailMode!=="visible"&&!s.alternate&&!ze)return yt(t),null}else 2*kn()-n.renderingStartTime>nf&&i!==536870912&&(t.flags|=128,r=!0,Oc(n,!1),t.lanes=4194304);n.isBackwards?(s.sibling=t.child,t.child=s):(e=n.last,e!==null?e.sibling=s:t.child=s,n.last=s)}if(n.tail!==null){e=n.tail;e:{for(i=e;i!==null;){if(i.alternate!==null){i=!1;break e}i=i.sibling}i=!0}return n.rendering=e,n.tail=e.sibling,n.renderingStartTime=kn(),e.sibling=null,s=Mi.current,s=r?s&1|2:s&1,n.tailMode==="visible"||n.tailMode==="collapsed"||!i||ze?au(t,s):(i=s,wt(Ri,t),wt(Mi,i),Ui===null&&(Ui=t)),ze&&cs(t,n.treeForkCount),e}return yt(t),null;case 22:case 23:return wn(t),G_(),n=t.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(i&536870912)!==0&&(t.flags&128)===0&&(yt(t),t.subtreeFlags&6&&(t.flags|=8192)):yt(t),i=t.updateQueue,i!==null&&oh(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==i&&(t.flags|=2048),e!==null&&Ai(Ya),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),hs(Xt),yt(t),null;case 25:return null;case 30:return t.flags|=33554432,yt(t),null}throw Error(F(156,t.tag))}function E3(e,t){switch(q_(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return hs(Xt),wl(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return zh(t),null;case 31:if(t.memoizedState!==null){if(wn(t),t.alternate===null)throw Error(F(340));Za()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(wn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(F(340));Za()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return j_(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return wl(),null;case 10:return hs(t.type),null;case 22:case 23:return wn(t),G_(),e!==null&&Ai(Ya),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return hs(Xt),null;case 25:return null;default:return null}}function nE(e,t){switch(q_(t),t.tag){case 3:hs(Xt),wl();break;case 26:case 27:case 5:zh(t);break;case 4:wl();break;case 31:t.memoizedState!==null&&wn(t);break;case 13:wn(t);break;case 19:j_(t);break;case 10:hs(t.type);break;case 22:case 23:wn(t),G_(),e!==null&&Ai(Ya);break;case 24:hs(Xt)}}function xu(e,t){try{var i=t.updateQueue,n=i!==null?i.lastEffect:null;if(n!==null){var r=n.next;i=r;do{if((i.tag&e)===e){n=void 0;var s=i.create,a=i.inst;n=s(),a.destroy=n}i=i.next}while(i!==r)}}catch(o){rt(t,t.return,o)}}function _a(e,t,i){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var s=r.next;n=s;do{if((n.tag&e)===e){var a=n.inst,o=a.destroy;if(o!==void 0){a.destroy=void 0,r=t;var l=i,c=o;try{c()}catch(u){rt(r,l,u)}}}n=n.next}while(n!==s)}}catch(u){rt(t,t.return,u)}}function rE(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{px(t,i)}catch(n){rt(e,e.return,n)}}}function sE(e,t,i){i.props=no(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(n){rt(e,t,n)}}function Lr(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;case 30:var r=e.stateNode,s=ps(e.memoizedProps,r);(r.ref===null||r.ref.name!==s)&&(r.ref=VE(s)),n=r.ref;break;case 7:if(e.stateNode===null){var a=new Mn(e);hn(e.child,!1,hI,a,void 0,void 0),e.stateNode=a}n=e.stateNode;break;default:n=e.stateNode}typeof i=="function"?e.refCleanup=i(n):i.current=n}}catch(o){rt(e,t,o)}}function Ci(e,t){var i=e.ref,n=e.refCleanup;if(i!==null)if(typeof n=="function")try{n()}catch(r){rt(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(r){rt(e,t,r)}else i.current=null}function Zh(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var i=0;i title"))),Oi(n,t,i),n[Ti]=e,di(n),t=n;break e;case"link":if(s=s1("link","href",r).get(t+(i.href||""))){for(a=0;ay&&(a=y,y=_,_=a);var m=ew(o,_),v=ew(o,y);if(m&&v&&(f.rangeCount!==1||f.anchorNode!==m.node||f.anchorOffset!==m.offset||f.focusNode!==v.node||f.focusOffset!==v.offset)){var b=d.createRange();b.setStart(m.node,m.offset),f.removeAllRanges(),_>y?(f.addRange(b),f.extend(v.node,v.offset)):(b.setEnd(v.node,v.offset),f.addRange(b))}}}}for(d=[],f=o;f=f.parentNode;)f.nodeType===1&&d.push({element:f,left:f.scrollLeft,top:f.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;oi?32:i,Ee.T=null,i=u_,u_=null;var s=mr,a=qr;if(It=0,ro=mr=null,qr=0,(Ve&6)!==0)throw Error(F(331));var o=Ve;if(Ve|=4,EE(s.current),SE(s,s.current,a,i),Ve=o,Eu(0,!1),Cn&&typeof Cn.onPostCommitFiberRoot=="function")try{Cn.onPostCommitFiberRoot(gu,s)}catch{}return!0}finally{Xe.p=r,Ee.T=n,zE(e,t)}}function Hw(e,t,i){t=Xn(i,t),t=jg(e.stateNode,t,2),e=oa(e,t,2),e!==null&&(vu(e,2),Wr(e))}function rt(e,t,i){if(e.tag===3)Hw(e,e,i);else for(;t!==null;){if(t.tag===3){Hw(t,e,i);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(ua===null||!ua.has(n))){e=Xn(i,e),i=Zx(2),n=oa(t,i,2),n!==null&&(Qx(i,n,t,e),vu(n,2),Wr(n));break}}t=t.return}}function cg(e,t,i){var n=e.pingCache;if(n===null){n=e.pingCache=new N3;var r=new Set;n.set(t,r)}else r=n.get(t),r===void 0&&(r=new Set,n.set(t,r));r.has(i)||(pv=!0,r.add(i),e=z3.bind(null,e,t,i),t.then(e,e))}function z3(e,t,i){var n=e.pingCache;n!==null&&n.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,ht===e&&(Fe&i)===i&&((Ht===4||Ht===3&&(Fe&62914560)===Fe&&300>kn()-Ef)&&(Ve&2)===0?Nl(e,0):tf|=i,Cl===Fe&&(Cl=0)),Wr(e)}function BE(e,t){t===0&&(t=T1()),e=lo(e,t),e!==null&&(vu(e,t),Wr(e))}function B3(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),BE(e,i)}function P3(e,t){var i=0;switch(e.tag){case 31:case 13:var n=e.stateNode,r=e.memoizedState;r!==null&&(i=r.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(F(314))}n!==null&&n.delete(t),BE(e,i)}function H3(e,t){return A_(e,t)}var Al=null,Jo=null,m_=!1,af=!1,ug=!1,na=0;function Wr(e){e!==Jo&&e.next===null&&(Jo===null?Al=Jo=e:Jo=Jo.next=e),af=!0,m_||(m_=!0,q3())}function Eu(e,t){if(!ug&&af){ug=!0;do for(var i=!1,n=Al;n!==null;){if(!t)if(e!==0){var r=n.pendingLanes;if(r===0)var s=0;else{var a=n.suspendedLanes,o=n.pingedLanes;s=(1<<31-Tn(42|e)+1)-1,s&=r&~(a&~o),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(i=!0,Uw(n,s))}else s=Fe,s=uf(n,n===ht?s:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(s&3)===0||_u(n,s)||(i=!0,Uw(n,s));n=n.next}while(i);ug=!1}}function U3(){PE()}function PE(){af=m_=!1;var e=0;na!==0&&X3()&&(e=na);for(var t=kn(),i=null,n=Al;n!==null;){var r=n.next,s=HE(n,t);s===0?(n.next=null,i===null?Al=r:i.next=r,r===null&&(Jo=i)):(i=n,(e!==0||(s&3)!==0)&&(af=!0)),n=r}It!==0&&It!==5||Eu(e,!1),na!==0&&(na=0)}function HE(e,t){for(var i=e.suspendedLanes,n=e.pingedLanes,r=e.expirationTimes,s=e.pendingLanes&-62914561;0o)break;var u=l.transferSize,d=l.initiatorType;u&&Gw(d)&&(l=l.responseEnd,a+=u*(lOh){_.length=p;break}b=new Promise(iI.bind(b)),_.push(b)}}}if(0<_.length)return h=Promise.race([Promise.all(_),new Promise(function(k){return setTimeout(k,500)})]).then(r,r),(f?Promise.allSettled([f.finished,h]):h).then(s,s);if(r(),f)return f.finished.then(s,s);s()},types:i});c.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var h=c.documentElement.getAnimations({subtree:!0}),f=0;f"u"?null:document;function nk(e,t,i){var n=Ul;if(n&&typeof t=="string"&&t){var r=Vn(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof i=="string"&&(r+='[crossorigin="'+i+'"]'),i1.has(r)||(i1.add(r),e={rel:e,crossOrigin:i,href:t},n.querySelector(r)===null&&(t=n.createElement("link"),Oi(t,"link",e),di(t),n.head.appendChild(t)))}}function SI(e){Ss.D(e),nk("dns-prefetch",e,null)}function wI(e,t){Ss.C(e,t),nk("preconnect",e,t)}function xI(e,t,i){Ss.L(e,t,i);var n=Ul;if(n&&e&&t){var r='link[rel="preload"][as="'+Vn(t)+'"]';t==="image"&&i&&i.imageSrcSet?(r+='[imagesrcset="'+Vn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(r+='[imagesizes="'+Vn(i.imageSizes)+'"]')):r+='[href="'+Vn(e)+'"]';var s=r;switch(t){case"style":s=Ol(e);break;case"script":s=ql(e)}if(!(Jn.has(s)||(e=ft({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),Jn.set(s,e),n.querySelector(r)!==null||t==="style"&&n.querySelector(ku(s))||t==="script"&&n.querySelector(Cu(s))))){var a=n.createElement("link");Oi(a,"link",e),t==="style"&&(a[Ph]=!0,a.onload=a.onerror=function(){R1(a)}),di(a),n.head.appendChild(a)}}}function EI(e,t){Ss.m(e,t);var i=Ul;if(i&&e){var n=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+Vn(n)+'"][href="'+Vn(e)+'"]',s=r;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=ql(e)}if(!Jn.has(s)&&(e=ft({rel:"modulepreload",href:e},t),Jn.set(s,e),i.querySelector(r)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Cu(s)))return}n=i.createElement("link"),Oi(n,"link",e),di(n),i.head.appendChild(n)}}}function kI(e,t,i){Ss.S(e,t,i);var n=Ul;if(n&&e){var r=hl(n).hoistableStyles,s=Ol(e);t=t||"default";var a=r.get(s);if(!a){var o={loading:0,preload:null};if(a=n.querySelector(ku(s)))o.loading=5;else{e=ft({rel:"stylesheet",href:e,"data-precedence":t},i),(i=Jn.get(s))&&Sv(e,i);var l=a=n.createElement("link");di(l),Oi(l,"link",e),l._p=new Promise(function(c,u){l.onload=c,l.onerror=u}),l.addEventListener("load",function(){o.loading|=1}),l.addEventListener("error",function(){o.loading|=2}),o.loading|=4,Ah(a,t,n)}a={type:"stylesheet",instance:a,count:1,state:o},r.set(s,a)}}}function CI(e,t){Ss.X(e,t);var i=Ul;if(i&&e){var n=hl(i).hoistableScripts,r=ql(e),s=n.get(r);s||(s=i.querySelector(Cu(r)),s||(e=ft({src:e,async:!0},t),(t=Jn.get(r))&&wv(e,t),s=i.createElement("script"),di(s),Oi(s,"link",e),i.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},n.set(r,s))}}function TI(e,t){Ss.M(e,t);var i=Ul;if(i&&e){var n=hl(i).hoistableScripts,r=ql(e),s=n.get(r);s||(s=i.querySelector(Cu(r)),s||(e=ft({src:e,async:!0,type:"module"},t),(t=Jn.get(r))&&wv(e,t),s=i.createElement("script"),di(s),Oi(s,"link",e),i.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},n.set(r,s))}}function n1(e,t,i,n){var r=(r=ra.current)?du(r):null;if(!r)throw Error(F(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(i=Ol(i.href),t=hl(r).hoistableStyles,n=t.get(i),n||(n={type:"style",instance:null,count:0,state:null},t.set(i,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=Ol(i.href);var s=hl(r).hoistableStyles,a=s.get(e);if(a||(r=r.ownerDocument||r,a={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,a),(s=r.querySelector(ku(e)))?s._p||(a.instance=s,a.state.loading=5):(s=Jn.get(e),s||(s={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Jn.set(e,s)),NI(r,e,s,a.state))),t&&n===null)throw Error(F(528,""));return a}if(t&&n!==null)throw Error(F(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(i=ql(i),t=hl(r).hoistableScripts,n=t.get(i),n||(n={type:"script",instance:null,count:0,state:null},t.set(i,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(F(444,e))}}function Ol(e){return'href="'+Vn(e)+'"'}function ku(e){return'link[rel="stylesheet"]['+e+"]"}function rk(e){return ft({},e,{"data-precedence":e.precedence,precedence:null})}function NI(e,t,i,n){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[Ph]!==!0){n.loading=1;return}}else t=e.createElement("link"),t[Ph]=!0,t.onload=t.onerror=R1.bind(null,t),Oi(t,"link",i),di(t),e.head.appendChild(t);n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2})}function ql(e){return'[src="'+Vn(e)+'"]'}function Cu(e){return"script[async]"+e}function r1(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+Vn(i.href)+'"]');if(n)return t.instance=n,di(n),n;var r=ft({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),di(n),Oi(n,"style",r),Ah(n,i.precedence,e),t.instance=n;case"stylesheet":r=Ol(i.href);var s=e.querySelector(ku(r));if(s)return t.state.loading|=4,t.instance=s,di(s),s;n=rk(i),(r=Jn.get(r))&&Sv(n,r),s=(e.ownerDocument||e).createElement("link"),di(s);var a=s;return a._p=new Promise(function(o,l){a.onload=o,a.onerror=l}),Oi(s,"link",n),t.state.loading|=4,Ah(s,i.precedence,e),t.instance=s;case"script":return s=ql(i.src),(r=e.querySelector(Cu(s)))?(t.instance=r,di(r),r):(n=i,(r=Jn.get(s))&&(n=ft({},i),wv(n,r)),e=e.ownerDocument||e,r=e.createElement("script"),di(r),Oi(r,"link",n),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(F(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,Ah(n,i.precedence,e));return t.instance}function Ah(e,t,i){for(var n=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=n.length?n[n.length-1]:null,s=r,a=0;a title"):null)}function AI(e,t,i){if(i===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function a1(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function sk(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function ak(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function o1(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=ak(t),e.suspenseyImages.push(t)),e=RI.bind(e),t.decode().then(e,e))}function MI(e,t,i,n){if(i.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var r=Ol(n.href),s=t.querySelector(ku(r));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=hu.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=s,di(s);return}s=t.ownerDocument||t,n=rk(n),(r=Jn.get(r))&&Sv(n,r),s=s.createElement("link"),di(s);var a=s;a._p=new Promise(function(o,l){a.onload=o,a.onerror=l}),Oi(s,"link",n),i.instance=s}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=hu.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Oh=0;function OI(e,t){return e.stylesheets&&e.count===0&&Rh(e,e.stylesheets),0Oh?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(r)}}:null}function ok(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)Rh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function hu(){this.count--,ok(this)}function RI(){this.imgCount--,ok(this)}var lf=null;function Rh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,lf=new Map,t.forEach(DI,e),lf=null,hu.call(e))}function DI(e,t){if(!(t.state.loading&4)){var i=lf.get(e);if(i)var n=i.get(null);else{i=new Map,lf.set(e,i);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s{"use strict";function gk(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(gk)}catch(e){console.error(e)}}gk(),_k.exports=mk()});function qI(e){return/^accent(-|$)/i.test(e.replace(/^--/,"").replace(/^magpie-/i,""))}function bk(e){let t=new URLSearchParams(e).get("tokens");if(!t)return;let i;try{i=JSON.parse(decodeURIComponent(escape(atob(t))))}catch{return}Tv(i)}function FI(e){let t={};if(!e||typeof e!="object")return t;for(let[i,n]of Object.entries(e)){if(typeof n!="string"&&typeof n!="number")continue;let r=String(n).trim();if(!r||r.length>300||/[;{}<>]/.test(r)||qI(i))continue;let s=i.replace(/^--/,"").replace(/^magpie-/i,"");/^[a-zA-Z0-9-]{1,48}$/.test(s)&&(t[`--magpie-${s}`]=r)}return t}function Tv(e){let t=document.documentElement;for(let[i,n]of Object.entries(FI(e)))t.style.setProperty(i,n)}var Nv=te(()=>{});function $I(){return typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}function Av(e){return e==="light"||e==="dark"?e:"auto"}function WI(e,t,i){let n=e==="light"||e==="dark"?e:t??i;return{theme:n,hostColors:t!==null&&n===t}}function Sk(e){let t=new URLSearchParams(e).get("theme");Of=t==="light"||t==="dark"?t:null,Kr("auto"),typeof window<"u"&&window.matchMedia&&(yk=window.matchMedia("(prefers-color-scheme: dark)"),yk.addEventListener?.("change",()=>Kr(Mf)))}function wk(){return Of!==null}function xk(e){Of=e,Kr(Mf)}function Kr(e){Mf=Av(e);let{theme:t,hostColors:i}=WI(Mf,Of,$I()),n=document.documentElement;n.dataset.theme=t,i?n.dataset.hostColors="1":delete n.dataset.hostColors}function Ek(){return document.documentElement.dataset.theme==="dark"?"dark":"light"}var Of,Mf,yk,Tu=te(()=>{Of=null,Mf="auto",yk=null});function kk(e){if(!e||typeof e!="object")return null;let t=e;if(typeof t.dark!="boolean")return null;let i=t.tokens&&typeof t.tokens=="object"&&!Array.isArray(t.tokens)?t.tokens:{},n={dark:t.dark,tokens:i};return typeof t.lang=="string"&&t.lang.length<=32&&(n.lang=t.lang),n}function KI(e,t){if(!e||typeof e!="object")return null;let i=e;return i.magpie!==1?null:i.event==="theme"?kk(i.data):i.id===t&&i.result?kk(i.result):null}function Tk(e){if(Ck||typeof window>"u")return;let t=window.parent;if(!t||t===window)return;Ck=!0;let i=1e6+Math.floor(Math.random()*1e6);window.addEventListener("message",n=>{if(n.source!==t)return;let r=KI(n.data,i);r&&(Tv(r.tokens),xk(r.dark?"dark":"light"),e?.(r))});try{t.postMessage({magpie:1,id:i,method:"hello"},"*")}catch{}}var Ck,Nk=te(()=>{Nv();Tu();Ck=!1});function Df(e){return e==="narrow"||e==="wide"||e==="full"?e:"default"}function jI(e){let t=Df(e);return t==="full"?"100%":`${GI[t]}px`}function Rv(e){let t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?Math.min(Mv,Math.max(Rf,Math.round(t))):Ov}function Nu(e){let t=document.documentElement;t.style.setProperty("--col",jI(e.contentWidth)),t.style.setProperty("--chat-fs",`${Rv(e.chatFontSize)}px`),t.dataset.contentWidth=Df(e.contentWidth)}var GI,Rf,Mv,Ov,Dv=te(()=>{GI={narrow:640,default:720,wide:880},Rf=12,Mv=18,Ov=13});function YI(e){if(typeof e!="string"||!e||e.length>2048)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!=="http:"&&t.protocol!=="https:"||t.username||t.password)return null;let i=t.hostname.toLowerCase();return!(i==="127.0.0.1"||i==="localhost"||i==="[::1]")||!/^\/_magpie\/plugin\/[A-Za-z0-9_-]{1,128}\/(?:page\/)?index\.html$/.test(t.pathname)?null:`${t.protocol}//${t.host}${t.pathname}${t.search}`}function VI(e){let t=e.startsWith("#")?e.slice(1):e;return YI(new URLSearchParams(t).get("b"))}function XI(e,t){let i=VI(e);if(!i)return null;let n=new URL(i);return t>0&&n.searchParams.set("ac_lost",String(Math.floor(t))),n.toString()}function Lf(){let e=XI(location.hash,Au);return e?(location.replace(e),!0):!1}function Ak(e){if(typeof window>"u"||window.parent===window)return!1;try{return window.parent.postMessage({magpie:1,method:"error",params:{message:e}},"*"),!0}catch{return!1}}function Mk(e,t,i=5e3){let n=null,r=e.onState(s=>{s==="reconnecting"||s==="down"?(Au||(Au=Date.now()),n||(n=setTimeout(()=>{n=null,e.getState()!=="open"&&t()},i))):s==="open"&&(Au=0,n&&(clearTimeout(n),n=null))});return()=>{r(),n&&clearTimeout(n)}}function If(e=location.hash){let t=e.startsWith("#")?e.slice(1):e;return new URLSearchParams(t).get("w")==="1"&&typeof window<"u"&&window.parent!==window}function Ok(e,t=2e3){let i=()=>{if(e.getState()==="open")try{window.parent.postMessage({ac_console:"alive"},"*")}catch{}};i();let n=setInterval(i,t);return()=>clearInterval(n)}function zf(){try{window.parent.postMessage({ac_console:"lost",at:Au||Date.now()},"*")}catch{}}var Au,Lv=te(()=>{Au=0});var Bf,Rk=te(()=>{kt();Bf=class{constructor(t,i="zh"){ge(this,"token",t);ge(this,"lang",i);ge(this,"ws",null);ge(this,"seq",0);ge(this,"pending",new Map);ge(this,"subs",new Map);ge(this,"binHandlers",[]);ge(this,"stateListeners",new Set);ge(this,"state","connecting");ge(this,"retry",0);ge(this,"closed",!1);ge(this,"helloOk",null);ge(this,"helloWaiters",[])}setLang(t){this.lang=t}onState(t){return this.stateListeners.add(t),t(this.state),()=>this.stateListeners.delete(t)}getState(){return this.state}setState(t){this.state=t;for(let i of this.stateListeners)i(t)}connect(){if(this.closed)return;this.setState(this.retry===0?"connecting":"reconnecting");let t=new WebSocket(`ws://${location.host}/ws`);t.binaryType="arraybuffer",this.ws=t,t.onopen=()=>{t.send(JSON.stringify({t:"hello",token:this.token,v:1,lang:this.lang}))},t.onmessage=i=>{if(typeof i.data!="string"){this.onBinary(new Uint8Array(i.data));return}let n;try{n=JSON.parse(i.data)}catch{return}if(n.t==="hello.ok"){this.retry=0,this.helloOk=n,this.setState("open");let r=this.helloWaiters.splice(0);for(let s of r)s(n);for(let[s,a]of this.subs)this.call("sub.add",{ch:s,afterSeq:a.afterSeq?.()}).catch(()=>{});return}if(n.t==="res"){let r=n.id,s=this.pending.get(r);if(s)if(this.pending.delete(r),clearTimeout(s.timer),n.ok)s.res(n.r);else{let a=n.e,o=new Error(a?.message??g("api.requestFailed"));o.code=a?.code,s.rej(o)}return}if(n.t==="evt"){this.subs.get(n.ch)?.handler(n.ch,n.d);return}},t.onclose=()=>{this.ws=null;for(let[n,r]of this.pending)clearTimeout(r.timer),r.rej(new Error(g("api.connClosed"))),this.pending.delete(n);if(this.closed)return;this.retry++;let i=Math.min(1e3*Math.pow(2,this.retry-1),1e4);this.setState(this.retry>20?"down":"reconnecting"),setTimeout(()=>this.connect(),i)},t.onerror=()=>{}}waitHello(){return this.helloOk?Promise.resolve(this.helloOk):new Promise(t=>this.helloWaiters.push(t))}call(t,i,n=6e4){return new Promise((r,s)=>{let a=this.ws;if(!a||a.readyState!==WebSocket.OPEN){s(new Error(g("api.notConnected")));return}let o=++this.seq,l=setTimeout(()=>{this.pending.delete(o),s(new Error(g("api.timeout")))},n);this.pending.set(o,{res:r,rej:s,timer:l}),a.send(JSON.stringify({t:"req",id:o,m:t,p:i??{}}))})}subscribe(t,i,n){return this.subs.set(t,{handler:i,afterSeq:n}),this.state==="open"&&this.call("sub.add",{ch:t,afterSeq:n?.()}).catch(()=>{}),()=>{this.subs.delete(t),this.state==="open"&&this.call("sub.remove",{ch:t}).catch(()=>{})}}onBinaryFrame(t){return this.binHandlers.push(t),()=>{this.binHandlers=this.binHandlers.filter(i=>i!==t)}}onBinary(t){if(t.length<3)return;let i=t[0],n=t[1]<<8|t[2];for(let r of this.binHandlers)r(i,n,t.subarray(3))}sendBinary(t,i,n){let r=this.ws;if(!r||r.readyState!==WebSocket.OPEN)return;let s=new Uint8Array(3+n.length);s[0]=t,s[1]=i>>8&255,s[2]=i&255,s.set(n,3),r.send(s)}ping(){try{this.ws?.send(JSON.stringify({t:"ping"}))}catch{}}close(){this.closed=!0,this.ws?.close()}}});var Gr,Mu=te(()=>{Pa();Gr=$n(e=>({state:"connecting",version:null,set:t=>e(t)}))});function ws(e,t=window.innerWidth){if(t<900)return Ou;let i=e.sbHidden?0:e.sidebarWidth;return Fl(t-i-Lk-Dk,Sa,Ou)}function $l(e,t=window.innerWidth){if(t<760)return Iv;let i=e.panelOpen?e.panelWidth:0;return Fl(t-i-Lk-Dk,uo,Iv)}function Pf(e,t=window.innerWidth){let i=Fl(e.sidebarWidth,uo,$l(e,t)),n=Fl(e.panelWidth,Sa,ws({...e,sidebarWidth:i},t));return i=Fl(i,uo,$l({...e,sidebarWidth:i,panelWidth:n},t)),n=Fl(n,Sa,ws({...e,sidebarWidth:i,panelWidth:n},t)),{sidebarWidth:i,panelWidth:n}}var Dk,Lk,Fl,Hf=te(()=>{en();Dk=300,Lk=10,Fl=(e,t,i)=>Math.max(t,Math.min(i,e))});function wa(e,t){let i=e().ws;i&&i.call("settings.set",{patch:t}).catch(()=>{})}var ZI,uo,Iv,Sa,Ou,zv,he,en=te(()=>{Pa();Hf();ZI=["changes","files","terminal","preview"],uo=200,Iv=360,Sa=320,Ou=900,zv=(e,t,i)=>Math.max(t,Math.min(i,e));he=$n((e,t)=>({ws:null,sidebarWidth:248,sbHidden:!1,sbOpen:!1,panelOpen:!1,panelTab:"changes",panelWidth:440,collapsed:{},currentProjectId:null,currentThreadId:null,bind:i=>e({ws:i}),hydrate:i=>{let n={};for(let a of i.collapsedProjects??[])n[a]=!0;let r={sidebarWidth:i.sidebarWidth??248,panelWidth:i.panel?.width??440,panelOpen:i.panel?.open??!1,sbHidden:i.sidebarHidden===!0},s=Pf(r);e({sidebarWidth:s.sidebarWidth,sbHidden:r.sbHidden,panelOpen:r.panelOpen,panelTab:ZI.includes(i.panel?.tab)?i.panel.tab:"changes",panelWidth:s.panelWidth,collapsed:n,currentProjectId:i.lastProjectId??null,currentThreadId:i.lastThreadId??null})},setSidebarWidth:i=>{let n=t(),r=$l(n);i=zv(Math.round(i),uo,r),e({sidebarWidth:i}),wa(t,{sidebarWidth:i})},setPanelWidth:i=>{let n=t(),r=ws(n);i=zv(Math.round(i),Sa,r),e({panelWidth:i}),wa(t,{panel:{open:t().panelOpen,tab:t().panelTab,width:i}})},openPanel:i=>{let n=i??t().panelTab,r=t(),s=zv(r.panelWidth,Sa,ws({...r,panelOpen:!0}));e({panelOpen:!0,panelTab:n,panelWidth:s}),wa(t,{panel:{open:!0,tab:n,width:s}})},closePanel:()=>{e({panelOpen:!1}),wa(t,{panel:{open:!1,tab:t().panelTab,width:t().panelWidth}})},setPanelTab:i=>{e({panelTab:i}),wa(t,{panel:{open:t().panelOpen,tab:i,width:t().panelWidth}})},toggleSidebarHidden:()=>{let i=!t().sbHidden;e({sbHidden:i}),wa(t,{sidebarHidden:i})},toggleSidebar:()=>{typeof window<"u"&&window.matchMedia?.("(max-width: 759px)").matches?t().setSbOpen(!t().sbOpen):t().toggleSidebarHidden()},setSbOpen:i=>e({sbOpen:i}),toggleCollapsed:i=>{let n={...t().collapsed};n[i]?delete n[i]:n[i]=!0,e({collapsed:n}),wa(t,{collapsedProjects:Object.keys(n)})},select:(i,n)=>{e({currentProjectId:i,currentThreadId:n,sbOpen:!1}),wa(t,{lastProjectId:i,lastThreadId:n})},reconcileSelection:(i,n)=>{let{currentProjectId:r,currentThreadId:s}=t();if(i.length===0){(r||s)&&t().select(null,null);return}let a=r;(!a||!i.some(l=>l.id===a))&&(a=null);let o=s;if(o){let l=n.find(c=>c.id===o);!l||!i.some(c=>c.id===l.projectId)||a&&l.projectId!==a?o=null:a||(a=l.projectId)}(a!==r||o!==s)&&t().select(a,o)}}))});async function Wl(){let e="claude";try{e=(await Ge.getState().ws.call("settings.get")).defaultProvider??"claude"}catch{}let t=Ge.getState().providers;return t.length?t.find(i=>i.id===e&&Ik(i))?.id??t.find(i=>Ik(i))?.id??e:e}function Ik(e){return e.enabled===!1||!e.available||e.status==="planned"?!1:e.status==="verified"||e.status==="experimental"?!0:e.ready!==!1}var Ge,On=te(()=>{Pa();en();Ge=$n((e,t)=>({ws:null,loaded:!1,projects:[],threads:[],providers:[],bind:async i=>{if(t().ws===i&&t().loaded)return;e({ws:i}),i.subscribe("sidebar",(l,c)=>{let u=c;!u||typeof u!="object"||(u.type==="project.upsert"?t().upsertProject(u.project):u.type==="project.remove"?(e({projects:t().projects.filter(d=>d.id!==u.id)}),he.getState().reconcileSelection(t().projects,t().threads)):u.type==="thread.upsert"?t().upsertThread(u.thread):u.type==="thread.remove"&&(e({threads:t().threads.filter(d=>d.id!==u.id)}),he.getState().reconcileSelection(t().projects,t().threads)))}),i.call("providers.list").then(l=>e({providers:l})).catch(()=>{});let[n,r]=await Promise.all([i.call("projects.list"),i.call("threads.list")]),s=t(),a=new Map(n.map(l=>[l.id,l]));for(let l of s.projects)a.set(l.id,l);let o=new Map(r.map(l=>[l.id,l]));for(let l of s.threads)o.set(l.id,l);e({projects:[...a.values()].sort((l,c)=>l.createdAt-c.createdAt),threads:[...o.values()],loaded:!0}),he.getState().reconcileSelection(t().projects,t().threads)},upsertProject:i=>{let n=t().projects.filter(r=>r.id!==i.id);e({projects:[...n,i].sort((r,s)=>r.createdAt-s.createdAt)})},upsertThread:i=>{let n=t().threads.filter(r=>r.id!==i.id);e({threads:[...n,i]})}}))});var Bk=xe(Uf=>{"use strict";var QI=Symbol.for("react.transitional.element"),JI=Symbol.for("react.fragment");function zk(e,t,i){var n=null;if(i!==void 0&&(n=""+i),t.key!==void 0&&(n=""+t.key),"key"in t){i={};for(var r in t)r!=="key"&&(i[r]=t[r])}else i=t;return t=i.ref,{$$typeof:QI,type:e,key:n,ref:t!==void 0?t:null,props:i}}Uf.Fragment=JI;Uf.jsx=zk;Uf.jsxs=zk});var ye=xe((l7,Pk)=>{"use strict";Pk.exports=Bk()});function Uk(e){let[t,i]=(0,Ut.useState)(()=>window.matchMedia?.(e).matches??!1);return(0,Ut.useEffect)(()=>{let n=window.matchMedia?.(e);if(!n)return;let r=()=>i(n.matches);return n.addEventListener?.("change",r),r(),()=>n.removeEventListener?.("change",r)},[e]),t}function qk(e,t,i){let n=(0,Ut.useRef)(0),r=(0,Ut.useRef)(0),[s,a]=(0,Ut.useState)(!1),o=(0,Ut.useCallback)(l=>{l.preventDefault(),n.current=l.clientX,r.current=e(),a(!0),document.body.classList.add("col-drag");let c=d=>t(r.current,d.clientX-n.current),u=()=>{window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",u),document.body.classList.remove("col-drag"),a(!1),i()};window.addEventListener("pointermove",c),window.addEventListener("pointerup",u)},[e,t,i]);return{drag:s,down:o}}function Fk({sidebar:e,topbar:t,children:i,panel:n}){let r=he(),s=Uk("(max-width: 759px)"),a=Uk("(max-width: 899px)"),o=(0,Ut.useRef)(!1),l=(0,Ut.useRef)(!1),c=qk((0,Ut.useCallback)(()=>he.getState().sidebarWidth,[]),(0,Ut.useCallback)((h,f)=>{o.current=!0;let p=he.getState(),_=$l(p);he.setState({sidebarWidth:Hk(Math.round(h+f),uo,_)})},[]),(0,Ut.useCallback)(()=>{o.current&&(o.current=!1,he.getState().setSidebarWidth(he.getState().sidebarWidth))},[])),u=qk((0,Ut.useCallback)(()=>he.getState().panelWidth,[]),(0,Ut.useCallback)((h,f)=>{l.current=!0;let p=he.getState(),_=ws(p);he.setState({panelWidth:Hk(Math.round(h-f),Sa,_)})},[]),(0,Ut.useCallback)(()=>{l.current&&(l.current=!1,he.getState().setPanelWidth(he.getState().panelWidth))},[]));(0,Ut.useEffect)(()=>{let h=f=>{if(!(f.ctrlKey||f.metaKey))return;let p=f.key.toLowerCase();if(p==="b")f.preventDefault(),he.getState().toggleSidebar();else if(p==="j"){f.preventDefault();let _=he.getState();_.panelOpen?_.closePanel():_.openPanel()}};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[]),(0,Ut.useEffect)(()=>{document.documentElement.style.setProperty("--sb-w",`${r.sidebarWidth}px`)},[r.sidebarWidth]),(0,Ut.useEffect)(()=>{document.documentElement.style.setProperty("--pn-w",`${r.panelWidth}px`)},[r.panelWidth]),(0,Ut.useEffect)(()=>{let h=()=>{let f=he.getState(),p=Pf(f);p.sidebarWidth!==f.sidebarWidth&&he.getState().setSidebarWidth(p.sidebarWidth),p.panelWidth!==f.panelWidth&&he.getState().setPanelWidth(p.panelWidth)};return window.addEventListener("resize",h),h(),()=>window.removeEventListener("resize",h)},[]);let d=r.sbOpen||r.panelOpen&&a;return(0,xs.jsxs)("div",{className:"app",children:[(0,xs.jsx)("aside",{className:`sidebar${r.sbHidden&&!s?" w-hide":""}${r.sbOpen?" open":""}`,children:e}),(0,xs.jsx)("div",{className:`rs rs-l${c.drag?" drag":""}`,onPointerDown:c.down}),(0,xs.jsxs)("main",{className:"main",children:[t,i]}),(0,xs.jsx)("div",{className:`rs rs-r${u.drag?" drag":""}`,onPointerDown:u.down}),(0,xs.jsx)("section",{className:`panel${r.panelOpen?" open":" w-hide"}`,"aria-hidden":!r.panelOpen,children:n}),(0,xs.jsx)("div",{className:`scrim${d?" show":""}`,onClick:()=>{he.getState().setSbOpen(!1),he.getState().panelOpen&&a&&he.getState().closePanel()}})]})}var Ut,xs,Hk,$k=te(()=>{Ut=ie(bt(),1);en();Hf();xs=ie(ye(),1),Hk=(e,t,i)=>Math.max(t,Math.min(i,e))});function er(e){return!!e.isComposing||e.keyCode===229}var Kl=te(()=>{});function Bv(e,t=Date.now()){let i=Math.max(0,t-e),n=Math.floor(i/6e4);if(n<1)return g("common.justNow");if(n<60)return _e("common.minutesAgo",{n});let r=Math.floor(n/60);if(r<24)return _e("common.hoursAgo",{n:r});let s=Math.floor(r/24);if(s<7)return _e("common.daysAgo",{n:s});let a=new Date(e),o=Ud();return Fs()==="zh"?`${a.getMonth()+1}/${a.getDate()}`:a.toLocaleDateString(o,{month:"short",day:"numeric"})}function Gl(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function qf(e){return`$${e.toFixed(2)}`}function Pv(e){let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m${t%60?` ${t%60}s`:""}`}var Ff=te(()=>{kt()});function Wk(e,t){return t.has(e.id)?"dot wait":e.status==="running"||e.status==="initializing"?"dot run":e.status==="error"||e.lastTurnStatus==="failed"?"dot err":e.lastTurnStatus==="completed"?"dot ok":"dot"}var Kk=te(()=>{});function ho({x:e,y:t,items:i,onClose:n}){let r=(0,Es.useRef)(null),[s,a]=(0,Es.useState)({left:e,top:t});return(0,Es.useLayoutEffect)(()=>{let o=r.current;if(!o)return;let l=o.getBoundingClientRect(),{left:c,top:u}=s;c+l.width>window.innerWidth-8&&(c=Math.max(8,window.innerWidth-l.width-8)),u+l.height>window.innerHeight-8&&(u=Math.max(8,window.innerHeight-l.height-8)),(c!==s.left||u!==s.top)&&a({left:c,top:u})},[e,t]),(0,Es.useEffect)(()=>{let o=c=>{r.current&&!r.current.contains(c.target)&&n()},l=c=>{c.key==="Escape"&&(c.stopPropagation(),n())};return window.addEventListener("pointerdown",o,!0),window.addEventListener("keydown",l,!0),()=>{window.removeEventListener("pointerdown",o,!0),window.removeEventListener("keydown",l,!0)}},[n]),(0,Gk.createPortal)((0,xa.jsx)("div",{ref:r,className:"menu",style:s,role:"menu",children:i.map((o,l)=>o.kind==="sep"?(0,xa.jsx)("div",{className:"msep"},l):o.kind==="label"?(0,xa.jsx)("div",{className:"mlabel",children:o.text},l):(0,xa.jsxs)("button",{className:`mi${o.danger?" danger":""}`,disabled:o.disabled,role:"menuitem",onClick:()=>{n(),o.onClick()},children:[(0,xa.jsx)("span",{children:o.label}),o.checked&&(0,xa.jsx)("span",{className:"mi-check",children:"\u2713"})]},l))}),document.body)}function Ru(){let[e,t]=(0,Es.useState)(null);return[e,n=>{n.preventDefault(),n.stopPropagation(),t({x:n.clientX,y:n.clientY})},()=>t(null)]}var Es,Gk,xa,$f=te(()=>{Es=ie(bt(),1),Gk=ie(Ks(),1),xa=ie(ye(),1)});function jr({title:e,children:t,footer:i,onClose:n,wide:r}){return(0,jk.useEffect)(()=>{let s=a=>{a.key==="Escape"&&!document.querySelector("[data-select-menu]")&&(a.stopPropagation(),n())};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[n]),(0,Yk.createPortal)((0,pn.jsx)("div",{className:"dlg-scrim",onPointerDown:s=>{s.target===s.currentTarget&&n()},children:(0,pn.jsxs)("div",{className:"dlg",style:r?{width:560}:void 0,role:"dialog","aria-label":e,children:[(0,pn.jsx)("div",{className:"dlg-title",children:e}),(0,pn.jsx)("div",{className:"dlg-body",children:t}),i&&(0,pn.jsx)("div",{className:"dlg-foot",children:i})]})}),document.body)}function jl({title:e,body:t,okLabel:i,danger:n,onOk:r,onClose:s}){let a=i??g("common.ok");return(0,pn.jsx)(jr,{title:e,onClose:s,footer:(0,pn.jsxs)(pn.Fragment,{children:[(0,pn.jsx)("button",{className:"btn ghost",onClick:s,children:g("common.cancel")}),(0,pn.jsx)("button",{className:`btn${n?" danger":" primary"}`,onClick:()=>{s(),r()},children:a})]}),children:(0,pn.jsx)("div",{className:"dlg-hint",style:{fontSize:"var(--fs-m)",color:"var(--fg)"},children:t})})}var jk,Yk,pn,Yl=te(()=>{jk=ie(bt(),1),Yk=ie(Ks(),1);kt();pn=ie(ye(),1)});function ne({name:e,size:t=16}){let i=ez[e];return i?(0,Hv.jsx)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:tz.has(e)?"currentColor":"none",stroke:"currentColor",strokeWidth:iz.has(e)?"2.2":"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,Hv.jsx)("path",{d:i})}):null}var Hv,ez,tz,iz,Rn=te(()=>{Hv=ie(ye(),1),ez={plus:"M12 5v14M5 12h14",file:"M6 3h8l4 4v14H6zM14 3v4h4",arrowLeft:"M19 12H5m6-6-6 6 6 6",arrowRight:"M5 12h14m-6-6 6 6-6 6",external:"M14 4h6v6M20 4l-9 9M18 14v6H4V6h6",globe:"M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18Zm-9 9h18M12 3c2.5 2.6 3.8 5.6 3.8 9s-1.3 6.4-3.8 9c-2.5-2.6-3.8-5.6-3.8-9S9.5 5.6 12 3Z",panelLeft:"M4 5h16v14H4zM9.5 5v14",widen:"M4 12h16M8 8l-4 4 4 4M16 8l4 4-4 4",search:"M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14Zm10 17-4.5-4.5",caret:"M9 6l6 6-6 6",dots:"M5 12h.01M12 12h.01M19 12h.01",pin:"M9 4h6l1 7 3 3v2H5v-2l3-3 1-7Zm3 12v4",send:"M4 12 20 4l-4 8 4 8-16-8Zm0 0h8",stop:"M7 7h10v10H7z",attach:"M8 12l6-6a3.5 3.5 0 0 1 5 5l-7 7a5 5 0 0 1-7-7l6-6",menu:"M4 6h16M4 12h16M4 18h16",changes:"M7 4v13m0 0a3 3 0 1 0 .01 0M7 17a3 3 0 1 1-.01 0M17 7v13m0-13a3 3 0 1 0 .01 0M17 7a3 3 0 1 1-.01 0",files:"M4 4h6l2 3h8v13H4V4Z",term:"M4 5h16v14H4zM7 9l3 3-3 3m5 0h5",x:"M6 6l12 12M18 6 6 18",refresh:"M20 11a8 8 0 1 0-2.3 6.3M20 5v6h-6",copy:"M8 8h11v12H8zM5 16V4h11",check:"M5 13l4 4L19 7",gauge:"M5.6 18.4a9 9 0 1 1 12.8 0M12 13l3.5-3.5M12 13h.01",arrowUp:"M12 19V5m-6 6 6-6 6 6",stopFill:"M8 8h8v8H8z",shield:"M12 3l8 3v6c0 5-3.5 9-8 11-4.5-2-8-6-8-11V6l8-3z",quote:"M5 7h5v5H7c0 2 1 3 3 4M14 7h5v5h-3c0 2 1 3 3 4",chat:"M5 5h14v10H9l-4 4V5zM9 10h.01M12 10h.01M15 10h.01",pencil:"M4 20h4L19 9a2.1 2.1 0 0 0-3-3L5 17v3zM14 7l3 3",shieldCheck:"M12 3l8 3v6c0 5-3.5 9-8 11-4.5-2-8-6-8-11V6l8-3zM8.5 12.2l2.4 2.4 4.6-4.8",zap:"M13 2L4 14h7l-1 8 9-12h-7l1-8z",prompt:"M5 7l5 5-5 5M12 17h7",fileText:"M6 3h8l4 4v14H6zM14 3v4h4M9 12h6M9 16h6",layers:"M12 3l9 5-9 5-9-5 9-5zM3 13l9 5 9-5",wrench:"M14.7 6.3a4 4 0 0 0-5.4 5.4L4 17l3 3 5.3-5.3a4 4 0 0 0 5.4-5.4l-2.5 2.5-2.4-.6-.6-2.4z",spark:"M12 4v4M12 16v4M4 12h4M16 12h4M6.6 6.6l2.2 2.2M15.2 15.2l2.2 2.2M6.6 17.4l2.2-2.2M15.2 8.8l2.2-2.2",clock:"M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18zM12 7v5l3 2",hourglass:"M7 3h10M7 21h10M8 3c0 4.5 8 4.5 8 9s-8 4.5-8 9M16 3c0 4.5-8 4.5-8 9s8 4.5 8 9",cpu:"M6 6h12v12H6zM10 10h4v4h-4zM9 3v3M15 3v3M9 18v3M15 18v3M3 9h3M3 15h3M18 9h3M18 15h3",wrap:"M4 6h16M4 12h13a3 3 0 0 1 0 6h-4m2-2-2 2 2 2M4 18h5",listChecks:"M4 7l2 2 3-3M4 15l2 2 3-3M12 8h8M12 16h8",circle:"M12 4.5a7.5 7.5 0 1 0 0 15 7.5 7.5 0 0 0 0-15z",settings:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"},tz=new Set(["stopFill"]),iz=new Set(["arrowUp"])});function Xk(){let e=Vk(t=>t.list);return e.length===0?null:(0,Uv.jsx)("div",{className:"toasts",children:e.map(t=>(0,Uv.jsx)("div",{className:`toast${t.err?" err":""}`,children:t.text},t.id))})}var Uv,nz,Vk,ke,_r=te(()=>{Pa();Uv=ie(ye(),1),nz=0,Vk=$n(e=>({list:[],push:(t,i)=>{let n=++nz;e(r=>({list:[...r.list,{id:n,text:t,err:i}]})),setTimeout(()=>e(r=>({list:r.list.filter(s=>s.id!==n)})),3500)}})),ke=(e,t=!1)=>Vk.getState().push(e,t)});function Qk({pendingByThread:e}){let{projects:t,threads:i}=Ge(),n=he(),[r,s]=(0,Je.useState)(""),[a,o]=(0,Je.useState)({}),[l,c]=(0,Je.useState)({}),[u,d]=(0,Je.useState)(null),[h,f]=(0,Je.useState)(""),[p,_]=(0,Je.useState)(!1),[y,m]=(0,Je.useState)(null),[v,b]=(0,Je.useState)(null),[w,k]=(0,Je.useState)(null),[M,T,A]=Ru(),[L,B,q]=Ru(),H=(0,Je.useRef)({}),P=(0,Je.useRef)(null);(0,Je.useEffect)(()=>{let I=ve=>{let de=ve.detail?.projectId,Ae=t.find(re=>re.id===de)??t[0];Ae&&m(Ae)},j=()=>_(!0);return window.addEventListener("open-import",I),window.addEventListener("open-new-project",j),()=>{window.removeEventListener("open-import",I),window.removeEventListener("open-new-project",j)}},[t]);let x=(0,Je.useMemo)(()=>{let I=r.trim().toLowerCase();return I?i.filter(j=>j.title.toLowerCase().includes(I)):i},[i,r]),U=(0,Je.useMemo)(()=>{let I=new Map;for(let j of x)(!j.archived||a[j.projectId])&&(I.get(j.projectId)??I.set(j.projectId,[]).get(j.projectId)).push(j);for(let j of I.values())j.sort((ve,de)=>Number(ve.archived)-Number(de.archived)||Number(de.pinned)-Number(ve.pinned)||de.updatedAt-ve.updatedAt);return I},[x,a]),C=(0,Je.useMemo)(()=>{let I=new Map;for(let j of x)j.archived&&I.set(j.projectId,(I.get(j.projectId)??0)+1);return I},[x]);async function D(I){try{let j=await az(),ve=await Wl(),de=await Z.call("threads.create",{projectId:I,provider:ve,model:null,mode:j.defaultMode??"default"});n.select(I,de.id)}catch(j){ke(g("sidebar.failNewThread")+Ze(j),!0)}}function R(I){return[{kind:"item",label:g("common.rename"),onClick:()=>{d(I.id),f(I.title)}},{kind:"item",label:I.pinned?g("sidebar.unpin"):g("sidebar.pin"),onClick:()=>{Z.call("threads.update",{id:I.id,pinned:!I.pinned})}},{kind:"item",label:I.archived?g("sidebar.unarchive"):g("sidebar.archive"),onClick:()=>{Y(I)}},{kind:"item",label:g("sidebar.exportMd"),onClick:()=>{cz(I)}},{kind:"sep"},{kind:"item",label:g("common.delete"),danger:!0,onClick:()=>b({title:g("sidebar.deleteThread"),body:_e("sidebar.deleteThreadBody",{title:I.title}),onOk:()=>{Z.call("threads.delete",{id:I.id})}})}]}async function Y(I){try{await Z.call("threads.update",{id:I.id,archived:!I.archived}),I.archived?ke(g("sidebar.unarchived")):(o(j=>({...j,[I.projectId]:!0})),ke(g("sidebar.archivedHint")))}catch(j){ke(Ze(j),!0)}}function z(I){return[{kind:"item",label:g("sidebar.newThread"),onClick:()=>{D(I.id)}},{kind:"item",label:g("sidebar.importHist"),onClick:()=>m(I)},{kind:"item",label:g("common.rename"),onClick:()=>k(I)},{kind:"item",label:g("sidebar.openExplorer"),onClick:()=>{Z.call("projects.open",{id:I.id})}},{kind:"sep"},{kind:"item",label:a[I.id]?g("sidebar.hideArchived"):g("sidebar.showArchived"),onClick:()=>o(j=>({...j,[I.id]:!j[I.id]}))},{kind:"sep"},{kind:"item",label:g("sidebar.removeProject"),danger:!0,onClick:()=>b({title:g("sidebar.removeProject"),body:_e("sidebar.removeProjectBody",{name:I.name}),onOk:()=>{Z.call("projects.remove",{id:I.id})}})}]}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)("div",{className:"sb-row",children:[(0,Q.jsx)(qv,{}),(0,Q.jsxs)("button",{className:"sb-new",onClick:()=>_(!0),children:[(0,Q.jsx)("span",{className:"sb-new-tile",children:(0,Q.jsx)(ne,{name:"plus",size:12})}),g("sidebar.newProject")]}),(0,Q.jsx)("button",{className:"ibtn",title:g("common.settings"),onClick:()=>window.dispatchEvent(new CustomEvent("open-settings")),children:(0,Q.jsx)(ne,{name:"settings"})}),(0,Q.jsx)("button",{className:"ibtn",title:g("sidebar.searchTitle"),onClick:()=>P.current?.focus(),children:(0,Q.jsx)(ne,{name:"search"})})]}),(0,Q.jsx)("div",{className:"sb-row sb-row-search",children:(0,Q.jsxs)("div",{className:"sb-search",children:[(0,Q.jsx)(ne,{name:"search",size:13}),(0,Q.jsx)("input",{ref:P,placeholder:g("sidebar.filterPlaceholder"),value:r,onChange:I=>s(I.target.value),onKeyDown:I=>{I.key==="Escape"&&s("")}})]})}),(0,Q.jsxs)("div",{className:"sb-list",children:[t.length===0&&(0,Q.jsxs)("div",{className:"sb-start",children:[(0,Q.jsx)("div",{className:"sb-start-t",children:g("sidebar.noProjectsTitle")}),(0,Q.jsx)("div",{className:"sb-start-s",children:g("sidebar.noProjectsSub")}),(0,Q.jsx)("button",{className:"btn primary",onClick:()=>_(!0),children:g("sidebar.newProject")})]}),t.map(I=>{let j=U.get(I.id)??[],ve=n.collapsed[I.id],de=C.get(I.id)??0,Ae=l[I.id]?j:j.slice(0,Zk);return(0,Q.jsxs)("div",{className:"pj-group",children:[(0,Q.jsxs)("div",{className:"pj",onContextMenu:re=>{H.current.project=I,T(re)},children:[(0,Q.jsxs)("button",{className:"pj-toggle",onClick:()=>n.toggleCollapsed(I.id),children:[(0,Q.jsx)("span",{className:`pj-caret${ve?"":" open"}`,children:(0,Q.jsx)(ne,{name:"caret"})}),(0,Q.jsx)("span",{className:"pj-badge",children:I.name.slice(0,1)}),(0,Q.jsx)("span",{className:"pj-name",children:I.name})]}),(0,Q.jsx)("span",{className:"pj-count",children:j.length||""}),(0,Q.jsx)("button",{className:"pj-act",title:g("sidebar.newThread"),onClick:()=>{D(I.id)},children:(0,Q.jsx)(ne,{name:"plus"})}),(0,Q.jsx)("button",{className:"pj-act",title:g("sidebar.projectMenu"),onClick:re=>{H.current.project=I,T(re)},children:(0,Q.jsx)(ne,{name:"dots"})})]}),!ve&&(0,Q.jsxs)("div",{className:"pj-sessions",children:[Ae.map(re=>u===re.id?(0,Q.jsx)("div",{className:"t-item",children:(0,Q.jsx)("input",{className:"t-rename",autoFocus:!0,value:h,onChange:ut=>f(ut.target.value),onBlur:()=>d(null),onKeyDown:ut=>{ut.key==="Enter"&&!er(ut.nativeEvent)&&h.trim()?(Z.call("threads.update",{id:re.id,title:h.trim()}),d(null)):ut.key==="Escape"&&d(null)}})},re.id):(0,Q.jsxs)("button",{className:`t-item${n.currentThreadId===re.id?" on":""}${re.archived?" archived":""}`,onClick:()=>n.select(I.id,re.id),onContextMenu:ut=>{H.current.thread=re,B(ut)},children:[(0,Q.jsx)("span",{className:rz(re,e)}),re.pinned&&(0,Q.jsx)("span",{className:"t-pin",children:(0,Q.jsx)(ne,{name:"pin"})}),(0,Q.jsx)("span",{className:"t-title",children:qd(re.title,re.titleAuto)}),(0,Q.jsx)("span",{className:"t-time",children:Bv(re.updatedAt)}),(0,Q.jsx)("span",{className:"t-more",role:"button",onClick:ut=>{ut.stopPropagation(),H.current.thread=re,B(ut)},children:(0,Q.jsx)(ne,{name:"dots"})})]},re.id)),j.length>Zk&&!l[I.id]&&(0,Q.jsx)("button",{className:"pj-more",onClick:()=>c(re=>({...re,[I.id]:!0})),children:_e("sidebar.showAll",{n:j.length})}),de>0&&(0,Q.jsx)("button",{className:"pj-more",onClick:()=>o(re=>({...re,[I.id]:!re[I.id]})),children:a[I.id]?g("sidebar.hideArchived"):_e("sidebar.archivedN",{n:de})}),j.length===0&&de===0&&(0,Q.jsx)("div",{className:"pj-empty",children:g("sidebar.noThreads")})]})]},I.id)})]}),M&&H.current.project&&(0,Q.jsx)(ho,{x:M.x,y:M.y,items:z(H.current.project),onClose:A}),L&&H.current.thread&&(0,Q.jsx)(ho,{x:L.x,y:L.y,items:R(H.current.thread),onClose:q}),p&&(0,Q.jsx)(oz,{onClose:()=>_(!1)}),y&&(0,Q.jsx)(lz,{project:y,onClose:()=>m(null)}),v&&(0,Q.jsx)(jl,{title:v.title,body:v.body,danger:!0,onOk:v.onOk,onClose:()=>b(null)}),w&&(0,Q.jsx)(sz,{project:w,onClose:()=>k(null)})]})}function sz({project:e,onClose:t}){let[i,n]=(0,Je.useState)(e.name),r=i.trim().length>0&&i.trim()!==e.name,s=()=>{r&&Z.call("projects.rename",{id:e.id,name:i.trim()}).then(t).catch(a=>ke(g("sidebar.failRename")+Ze(a),!0))};return(0,Q.jsx)(jr,{title:g("sidebar.renameProject"),onClose:t,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)("button",{className:"btn ghost",onClick:t,children:g("common.cancel")}),(0,Q.jsx)("button",{className:"btn primary",disabled:!r,onClick:s,children:g("common.save")})]}),children:(0,Q.jsxs)("div",{className:"dlg-row",children:[(0,Q.jsx)("label",{children:g("sidebar.projectName")}),(0,Q.jsx)("input",{className:"tinput",autoFocus:!0,value:i,onChange:a=>n(a.target.value),onKeyDown:a=>{a.key==="Enter"&&!er(a.nativeEvent)&&s()}})]})})}function az(){return Z.call("settings.get").then(e=>e).catch(()=>({}))}function oz({onClose:e}){let[t,i]=(0,Je.useState)(""),[n,r]=(0,Je.useState)(null),[s,a]=(0,Je.useState)([]),[o,l]=(0,Je.useState)(!1),c=he();(0,Je.useEffect)(()=>{Z.call("fs.recentDirs").then(h=>a(h)).catch(()=>{})},[]),(0,Je.useEffect)(()=>{let h=t.trim();if(!h){r(null);return}let f=setTimeout(()=>{Z.call("fs.check",{path:h}).then(p=>r(p)).catch(()=>r(null))},200);return()=>clearTimeout(f)},[t]);let u=n?.exists&&n.isDir;async function d(){if(!(!u||o)){l(!0);try{let h=await Z.call("projects.create",{path:t.trim()});c.select(h.id,null),e()}catch(h){ke(g("sidebar.failAddProject")+Ze(h),!0),l(!1)}}}return(0,Q.jsxs)(jr,{title:g("sidebar.newProjectDlg"),onClose:e,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)("button",{className:"btn ghost",onClick:e,children:g("common.cancel")}),(0,Q.jsx)("button",{className:"btn primary",disabled:!u||o,onClick:()=>{d()},children:g("common.add")})]}),children:[(0,Q.jsxs)("div",{className:"dlg-row",children:[(0,Q.jsx)("label",{children:g("sidebar.dirLabel")}),(0,Q.jsxs)("div",{style:{display:"flex",gap:6},children:[(0,Q.jsx)("input",{className:`tinput${n&&!u?" err":""}`,style:{flex:1},autoFocus:!0,placeholder:"D:\\\\path\\\\to\\\\project",value:t,onChange:h=>i(h.target.value),onKeyDown:h=>{h.key==="Enter"&&!er(h.nativeEvent)&&d()}}),(0,Q.jsx)("button",{className:"btn",style:{flex:"none",whiteSpace:"nowrap"},onClick:()=>{Z.call("fs.pickFolder",{initial:t.trim()||void 0}).then(h=>{let f=h;f?.path?i(f.path):f&&!f.available&&ke(g("sidebar.pickFolderUnsupported"))}).catch(()=>ke(g("sidebar.pickFolderFailed")))},children:g("common.browse")})]}),n&&!n.exists&&(0,Q.jsx)("div",{className:"dlg-hint err",children:g("sidebar.dirMissing")}),n&&n.exists&&!n.isDir&&(0,Q.jsx)("div",{className:"dlg-hint err",children:g("sidebar.notDir")}),u&&(0,Q.jsx)("div",{className:"dlg-hint",children:g("sidebar.dirOk")})]}),s.length>0&&(0,Q.jsxs)("div",{className:"dlg-row",children:[(0,Q.jsx)("label",{children:g("sidebar.recent")}),s.map(h=>(0,Q.jsx)("button",{className:"mi",style:{height:26},onClick:()=>i(h),children:h},h))]})]})}function lz({project:e,onClose:t}){let[i,n]=(0,Je.useState)(null),[r,s]=(0,Je.useState)(new Set),[a,o]=(0,Je.useState)(!1),l=he();(0,Je.useEffect)(()=>{Z.call("history.list",{projectId:e.id}).then(d=>n(d)).catch(d=>{ke(g("sidebar.failImportList")+Ze(d),!0),n([])})},[e.id]);let c=d=>{s(h=>{let f=new Set(h);return f.has(d)?f.delete(d):f.add(d),f})};async function u(){if(!(a||r.size===0||!i)){o(!0);try{let d=i.filter(f=>r.has(f.sessionId)&&!f.imported),h=await Z.call("history.import",{projectId:e.id,items:d.map(f=>({provider:f.provider,sessionId:f.sessionId,title:f.title}))});ke(_e("sidebar.importedN",{n:h.length})),h.length>0&&l.select(e.id,h[h.length-1].id),t()}catch(d){ke(g("sidebar.failImport")+Ze(d),!0)}finally{o(!1)}}}return(0,Q.jsxs)(jr,{title:_e("sidebar.importTitle",{name:e.name}),onClose:t,wide:!0,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)("button",{className:"btn ghost",onClick:t,children:g("common.cancel")}),(0,Q.jsx)("button",{className:"btn primary",disabled:a||r.size===0,onClick:()=>{u()},children:a?g("sidebar.importing"):_e("sidebar.importN",{n:r.size||0})})]}),children:[i===null&&(0,Q.jsx)("div",{className:"dlg-hint",children:g("sidebar.scanning")}),i!==null&&i.length===0&&(0,Q.jsx)("div",{className:"dlg-hint",children:g("sidebar.importEmpty")}),i!==null&&i.length>0&&(0,Q.jsx)("div",{className:"imp-list",children:i.map(d=>(0,Q.jsxs)("label",{className:`imp-row${d.imported?" done":""}`,children:[(0,Q.jsx)("input",{type:"checkbox",disabled:d.imported,checked:r.has(d.sessionId),onChange:()=>c(d.sessionId)}),(0,Q.jsx)("span",{className:"imp-title",children:d.title}),(0,Q.jsxs)("span",{className:"imp-meta",children:[d.provider," \xB7 ",d.messageCount,g("common.messages")," \xB7 ",Bv(d.updatedAt),d.imported?g("common.imported"):""]})]},d.sessionId))})]})}async function cz(e){try{let t=await Z.call("thread.exportMarkdown",{id:e.id});if(t.path){ke(_e("sidebar.exportSaved",{path:t.path}));return}let i=new Blob([t.markdown],{type:"text/markdown;charset=utf-8"}),n=document.createElement("a");n.href=URL.createObjectURL(i),n.download=t.filename||`${e.title}.md`,n.style.display="none",document.body.appendChild(n),n.click(),setTimeout(()=>{URL.revokeObjectURL(n.href),n.remove()},5e3)}catch(t){ke(g("sidebar.failExport")+Ze(t),!0)}}function qv({className:e=""}){let t=he(r=>r.sbHidden),i=he(r=>r.sbOpen),n=g(t&&!i?"sidebar.expand":"sidebar.collapse");return(0,Q.jsx)("button",{type:"button",className:`ibtn sb-toggle ${e}`,title:`${n} (Ctrl+B)`,"aria-label":n,"aria-expanded":!t||i,onClick:()=>he.getState().toggleSidebar(),children:(0,Q.jsx)(ne,{name:"panelLeft"})})}var Je,Q,Zk,rz,Fv=te(()=>{Je=ie(bt(),1);Kl();On();en();qi();Ff();Kk();$f();Yl();Rn();_r();kt();Q=ie(ye(),1),Zk=10,rz=Wk});function iC(e){let t=[];if(!e)return t;$v.lastIndex=0;let i;for(;i=$v.exec(e);){let n=i.index,r=i[0],s=i[1],a=i[2],o=n>0?e[n-1]:"";if(o&&/[\w.@/\\:-]/.test(o)||!s&&!a)continue;let l=r.replace(Jk,"");for(;/[)\]]$/.test(l);){let u=l.endsWith(")")?")":"]",d=u===")"?"(":"[",h=l.split(d).length-1;if(l.split(u).length-1>h)l=l.slice(0,-1).replace(Jk,"");else break}r=l;let c=ss(r);c.ok&&(t.push({start:n,end:n+r.length,text:r,url:c.target.href}),$v.lastIndex=n+Math.max(1,r.length))}return t}function nC(e){let t=iC(e);if(!t.length)return[e];let i=[],n=0;for(let r of t)r.start>n&&i.push(e.slice(n,r.start)),i.push(r),n=r.end;return n{if(n.nodeType===3){t.push(n);return}if(n.nodeType===1&&!dz.has(n.tagName))for(let r=n.firstChild;r;r=r.nextSibling)i(r)};return i(e),t}function tC(e,t){let i=t.map(l=>l.data).join(""),n=iC(i);if(!n.length)return;let r=[],s=0;for(let l of t)r.push(s),s+=l.data.length;let a=(l,c)=>{for(let u=t.length-1;u>=0;u--){let d=r[u];if(c?l>d:l>=d)return[t[u],l-d]}return[t[0],0]},o=e.ownerDocument??document;for(let l of[...n].reverse()){let[c,u]=a(l.start,!1),[d,h]=a(l.end,!0),f=o.createRange();f.setStart(c,u),f.setEnd(d,h);let p=o.createElement("a");p.href=l.url,p.dataset.acLocal=l.url,p.className="ac-local",p.appendChild(f.extractContents()),f.insertNode(p)}}function rC(e,t){for(let i of Array.from(e.querySelectorAll("a[href]"))){let n=Wv(i.getAttribute("href"));n&&(i.dataset.acLocal=n,i.classList.add("ac-local"))}for(let i of Array.from(e.querySelectorAll("pre")))i.dataset.acLinked||(i.dataset.acLinked="1",tC(i,eC(i)));for(let i of eC(e))i.parentElement?.closest("pre")||i.parentNode&&tC(i.parentNode,[i]);if(t)for(let i of Array.from(e.querySelectorAll("a.ac-local")))i.title=t}var uz,$v,Jk,dz,Wf=te(()=>{Hd();uz=String.raw`(?:localhost|[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*\.localhost|127(?:\.\d{1,3}){3}|0\.0\.0\.0|\[::1?\])`,$v=new RegExp(String.raw`(https?:\/\/)?${uz}(:\d{1,5})?((?:[/?#][^\s<>"'\`)】」』,。;!?、]*)?)`,"gi"),Jk=/[.,;:!?。,;:!?…'"’”]+$/;dz=new Set(["A","BUTTON","SCRIPT","STYLE","TEXTAREA"])});function hz(e){let t=he.getState(),i=t.currentThreadId;t.openPanel("preview"),ki.getState().navigate((n,r)=>Z.call(n,r),Ec(i),i,e,{push:!0})}async function ks(e){try{if((await Z.call("app.openExternal",{url:e}))?.ok)return}catch{}await vr(e),ke(g("links.externalFailed"))}function Kf(e){let i=e.target?.closest?.("a");if(!i)return;let n=i.getAttribute("href")??"";e.preventDefault();let r=i.dataset.acLocal||Wv(n),s=e.ctrlKey||e.metaKey;if(r&&!s){hz(r);return}/^https?:\/\//i.test(r||n)&&ks(r||n)}var Du=te(()=>{qi();en();$d();Wf();Lu();_r();kt()});var EC=xe((W7,xC)=>{function dC(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let i=e[t],n=typeof i;(n==="object"||n==="function")&&!Object.isFrozen(i)&&dC(i)}),e}var jf=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function hC(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Ea(e,...t){let i=Object.create(null);for(let n in e)i[n]=e[n];return t.forEach(function(n){for(let r in n)i[r]=n[r]}),i}var fz="",sC=e=>!!e.scope,pz=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){let i=e.split(".");return[`${t}${i.shift()}`,...i.map((n,r)=>`${n}${"_".repeat(r+1)}`)].join(" ")}return`${t}${e}`},Gv=class{constructor(t,i){this.buffer="",this.classPrefix=i.classPrefix,t.walk(this)}addText(t){this.buffer+=hC(t)}openNode(t){if(!sC(t))return;let i=pz(t.scope,{prefix:this.classPrefix});this.span(i)}closeNode(t){sC(t)&&(this.buffer+=fz)}value(){return this.buffer}span(t){this.buffer+=``}},aC=(e={})=>{let t={children:[]};return Object.assign(t,e),t},jv=class e{constructor(){this.rootNode=aC(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){let i=aC({scope:t});this.add(i),this.stack.push(i)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,i){return typeof i=="string"?t.addText(i):i.children&&(t.openNode(i),i.children.forEach(n=>this._walk(t,n)),t.closeNode(i)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(i=>typeof i=="string")?t.children=[t.children.join("")]:t.children.forEach(i=>{e._collapse(i)}))}},Yv=class extends jv{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,i){let n=t.root;i&&(n.scope=`language:${i}`),this.add(n)}toHTML(){return new Gv(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Iu(e){return e?typeof e=="string"?e:e.source:null}function fC(e){return po("(?=",e,")")}function mz(e){return po("(?:",e,")*")}function gz(e){return po("(?:",e,")?")}function po(...e){return e.map(i=>Iu(i)).join("")}function _z(e){let t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Vf(...e){return"("+(_z(e).capture?"":"?:")+e.map(n=>Iu(n)).join("|")+")"}function pC(e){return new RegExp(e.toString()+"|").exec("").length-1}function vz(e,t){let i=e&&e.exec(t);return i&&i.index===0}var bz=new RegExp(Vf(/\[(?:[^\\\]]|\\.)*\]/,/\(\?<(?![=!])[^>]+>/,/\(\?'[^']+'/,/\(\??/,/\\([1-9][0-9]*)/,/\\./));function Xv(e,{joinWith:t}){let i=0;return e.map(n=>{i+=1;let r=i,s=Iu(n),a="";for(;s.length>0;){let o=bz.exec(s);if(!o){a+=s;break}a+=s.substring(0,o.index),s=s.substring(o.index+o[0].length),o[0][0]==="\\"&&o[1]?a+="\\"+String(Number(o[1])+r):(a+=o[0],(o[0]==="("||/^\(\?[<']/.test(o[0]))&&i++)}return a}).map(n=>`(${n})`).join(t)}var yz=/\b\B/,mC="[a-zA-Z]\\w*",Zv="[a-zA-Z_]\\w*",gC="\\b\\d+(\\.\\d+)?",_C="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",vC="\\b(0b[01]+)",Sz="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",wz=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=po(t,/.*\b/,e.binary,/\b.*/)),Ea({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(i,n)=>{i.index!==0&&n.ignoreMatch()}},e)},zu={begin:"\\\\[\\s\\S]",relevance:0},xz={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[zu]},Ez={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[zu]},kz={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/},Xf=function(e,t,i={}){let n=Ea({scope:"comment",begin:e,end:t,contains:[]},i);n.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let r=Vf("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 n.contains.push({begin:po(/[ ]+/,"(",r,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),n},Cz=Xf("//","$"),Tz=Xf("/\\*","\\*/"),Nz=Xf("#","$"),Az={scope:"number",begin:gC,relevance:0},Mz={scope:"number",begin:_C,relevance:0},Oz={scope:"number",begin:vC,relevance:0},Rz={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[zu,{begin:/\[/,end:/\]/,relevance:0,contains:[zu]}]},Dz={scope:"title",begin:mC,relevance:0},Lz={scope:"title",begin:Zv,relevance:0},Iz={begin:"\\.\\s*"+Zv,relevance:0},zz=function(e){return Object.assign(e,{"on:begin":(t,i)=>{i.data._beginMatch=t[1]},"on:end":(t,i)=>{i.data._beginMatch!==t[1]&&i.ignoreMatch()}})},Gf=Object.freeze({__proto__:null,APOS_STRING_MODE:xz,BACKSLASH_ESCAPE:zu,BINARY_NUMBER_MODE:Oz,BINARY_NUMBER_RE:vC,COMMENT:Xf,C_BLOCK_COMMENT_MODE:Tz,C_LINE_COMMENT_MODE:Cz,C_NUMBER_MODE:Mz,C_NUMBER_RE:_C,END_SAME_AS_BEGIN:zz,HASH_COMMENT_MODE:Nz,IDENT_RE:mC,MATCH_NOTHING_RE:yz,METHOD_GUARD:Iz,NUMBER_MODE:Az,NUMBER_RE:gC,PHRASAL_WORDS_MODE:kz,QUOTE_STRING_MODE:Ez,REGEXP_MODE:Rz,RE_STARTERS_RE:Sz,SHEBANG:wz,TITLE_MODE:Dz,UNDERSCORE_IDENT_RE:Zv,UNDERSCORE_TITLE_MODE:Lz});function Bz(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function Pz(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function Hz(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=Bz,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function Uz(e,t){Array.isArray(e.illegal)&&(e.illegal=Vf(...e.illegal))}function qz(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function Fz(e,t){e.relevance===void 0&&(e.relevance=1)}var $z=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");let i=Object.assign({},e);Object.keys(e).forEach(n=>{delete e[n]}),e.keywords=i.keywords,e.begin=po(i.beforeMatch,fC(i.begin)),e.starts={relevance:0,contains:[Object.assign(i,{endsParent:!0})]},e.relevance=0,delete i.beforeMatch},Wz=["of","and","for","in","not","or","if","then","parent","list","value"],Kz="keyword";function bC(e,t,i=Kz){let n=Object.create(null);return typeof e=="string"?r(i,e.split(" ")):Array.isArray(e)?r(i,e):Object.keys(e).forEach(function(s){Object.assign(n,bC(e[s],t,s))}),n;function r(s,a){t&&(a=a.map(o=>o.toLowerCase())),a.forEach(function(o){let l=o.split("|");n[l[0]]=[s,Gz(l[0],l[1])]})}}function Gz(e,t){return t?Number(t):jz(e)?0:1}function jz(e){return Wz.includes(e.toLowerCase())}var oC={},fo=e=>{console.error(e)},lC=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Vl=(e,t)=>{oC[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),oC[`${e}/${t}`]=!0)},Yf=new Error;function yC(e,t,{key:i}){let n=0,r=e[i],s={},a={};for(let o=1;o<=t.length;o++)a[o+n]=r[o],s[o+n]=!0,n+=pC(t[o-1]);e[i]=a,e[i]._emit=s,e[i]._multi=!0}function Yz(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw fo("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Yf;if(typeof e.beginScope!="object"||e.beginScope===null)throw fo("beginScope must be object"),Yf;yC(e,e.begin,{key:"beginScope"}),e.begin=Xv(e.begin,{joinWith:""})}}function Vz(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw fo("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Yf;if(typeof e.endScope!="object"||e.endScope===null)throw fo("endScope must be object"),Yf;yC(e,e.end,{key:"endScope"}),e.end=Xv(e.end,{joinWith:""})}}function Xz(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function Zz(e){Xz(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),Yz(e),Vz(e)}function Qz(e){function t(a,o){return new RegExp(Iu(a),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(o?"g":""))}class i{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(o,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,o]),this.matchAt+=pC(o)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let o=this.regexes.map(l=>l[1]);this.matcherRe=t(Xv(o,{joinWith:"|"}),!0),this.lastIndex=0}exec(o){this.matcherRe.lastIndex=this.lastIndex;let l=this.matcherRe.exec(o);if(!l)return null;let c=l.findIndex((d,h)=>h>0&&d!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class n{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(o){if(this.multiRegexes[o])return this.multiRegexes[o];let l=new i;return this.rules.slice(o).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[o]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(o,l){this.rules.push([o,l]),l.type==="begin"&&this.count++}exec(o){let l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(o);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){let u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(o)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function r(a){let o=new n;return a.contains.forEach(l=>o.addRule(l.begin,{rule:l,type:"begin"})),a.terminatorEnd&&o.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&o.addRule(a.illegal,{type:"illegal"}),o}function s(a,o){let l=a;if(a.isCompiled)return l;[Pz,qz,Zz,$z].forEach(u=>u(a,o)),e.compilerExtensions.forEach(u=>u(a,o)),a.__beforeBegin=null,[Hz,Uz,Fz].forEach(u=>u(a,o)),a.isCompiled=!0;let c=null;return typeof a.keywords=="object"&&a.keywords.$pattern&&(a.keywords=Object.assign({},a.keywords),c=a.keywords.$pattern,delete a.keywords.$pattern),c=c||/\w+/,a.keywords&&(a.keywords=bC(a.keywords,e.case_insensitive)),l.keywordPatternRe=t(c,!0),o&&(a.begin||(a.begin=/\B|\b/),l.beginRe=t(l.begin),!a.end&&!a.endsWithParent&&(a.end=/\B|\b/),a.end&&(l.endRe=t(l.end)),l.terminatorEnd=Iu(l.end)||"",a.endsWithParent&&o.terminatorEnd&&(l.terminatorEnd+=(a.end?"|":"")+o.terminatorEnd)),a.illegal&&(l.illegalRe=t(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(u){return Jz(u==="self"?a:u)})),a.contains.forEach(function(u){s(u,l)}),a.starts&&s(a.starts,o),l.matcher=r(l),l}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=Ea(e.classNameAliases||{}),s(e)}function SC(e){return e?e.endsWithParent||SC(e.starts):!1}function Jz(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Ea(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:SC(e)?Ea(e,{starts:e.starts?Ea(e.starts):null}):Object.isFrozen(e)?Ea(e):e}var eB="11.12.0",Vv=class extends Error{constructor(t,i){super(t),this.name="HTMLInjectionError",this.html=i}},Kv=hC,cC=Ea,uC=Symbol("nomatch"),tB=7,wC=function(e){let t=Object.create(null),i=Object.create(null),n=[],r=!0,s="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]},o={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Yv};function l(C){return o.noHighlightRe.test(C)}function c(C){let D=C.className+" ";D+=C.parentNode?C.parentNode.className:"";let R=o.languageDetectRe.exec(D);if(R){let Y=A(R[1]);return Y||(lC(s.replace("{}",R[1])),lC("Falling back to no-highlight mode for this block.",C)),Y?R[1]:"no-highlight"}return D.split(/\s+/).find(Y=>l(Y)||A(Y))}function u(C,D,R){let Y="",z="";typeof D=="object"?(Y=C,R=D.ignoreIllegals,z=D.language):(Vl("10.7.0","highlight(lang, code, ...args) has been deprecated."),Vl("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),z=C,Y=D),R===void 0&&(R=!0);let I={code:Y,language:z};x("before:highlight",I);let j=I.result?I.result:d(I.language,I.code,R);return j.code=I.code,x("after:highlight",j),j}function d(C,D,R,Y){let z=Object.create(null);function I(J,ce){return J.keywords[ce]}function j(){if(!se.keywords){Ke.addText(We);return}let J=0;se.keywordPatternRe.lastIndex=0;let ce=se.keywordPatternRe.exec(We),be="";for(;ce;){be+=We.substring(J,ce.index);let Re=xi.case_insensitive?ce[0].toLowerCase():ce[0],st=I(se,Re);if(st){let[Bi,is]=st;if(Ke.addText(be),be="",z[Re]=(z[Re]||0)+1,z[Re]<=tB&&(qn+=is),Bi.startsWith("_"))be+=ce[0];else{let bn=xi.classNameAliases[Bi]||Bi;Ae(ce[0],bn)}}else be+=ce[0];J=se.keywordPatternRe.lastIndex,ce=se.keywordPatternRe.exec(We)}be+=We.substring(J),Ke.addText(be)}function ve(){if(We==="")return;let J=null;if(typeof se.subLanguage=="string"){if(!t[se.subLanguage]){Ke.addText(We);return}J=d(se.subLanguage,We,!0,ji[se.subLanguage]),ji[se.subLanguage]=J._top}else J=f(We,se.subLanguage.length?se.subLanguage:null);se.relevance>0&&(qn+=J.relevance),Ke.__addSublanguage(J._emitter,J.language)}function de(){se.subLanguage!=null?ve():j(),We=""}function Ae(J,ce){J!==""&&(Ke.startScope(ce),Ke.addText(J),Ke.endScope())}function re(J,ce){let be=1,Re=ce.length-1;for(;be<=Re;){if(!J._emit[be]){be++;continue}let st=xi.classNameAliases[J[be]]||J[be],Bi=ce[be];st?Ae(Bi,st):(We=Bi,j(),We=""),be++}}function ut(J,ce){return J.scope&&typeof J.scope=="string"&&Ke.openNode(xi.classNameAliases[J.scope]||J.scope),J.beginScope&&(J.beginScope._wrap?(Ae(We,xi.classNameAliases[J.beginScope._wrap]||J.beginScope._wrap),We=""):J.beginScope._multi&&(re(J.beginScope,ce),We="")),se=Object.create(J,{parent:{value:se}}),se}function zi(J,ce,be){let Re=vz(J.endRe,be);if(Re){if(J["on:end"]){let st=new jf(J);J["on:end"](ce,st),st.isMatchIgnored&&(Re=!1)}if(Re){for(;J.endsParent&&J.parent;)J=J.parent;return J}}if(J.endsWithParent)return zi(J.parent,ce,be)}function $t(J){return se.matcher.regexIndex===0?(We+=J[0],1):(vn=!0,0)}function ue(J){let ce=J[0],be=J.rule,Re=new jf(be),st=[be.__beforeBegin,be["on:begin"]];for(let Bi of st)if(Bi&&(Bi(J,Re),Re.isMatchIgnored))return $t(ce);return be.skip?We+=ce:(be.excludeBegin&&(We+=ce),de(),!be.returnBegin&&!be.excludeBegin&&(We=ce)),ut(be,J),be.returnBegin?0:ce.length}function gt(J){let ce=J[0],be=D.substring(J.index),Re=zi(se,J,be);if(!Re)return uC;let st=se;se.endScope&&se.endScope._wrap?(de(),Ae(ce,se.endScope._wrap)):se.endScope&&se.endScope._multi?(de(),re(se.endScope,J)):st.skip?We+=ce:(st.returnEnd||st.excludeEnd||(We+=ce),de(),st.excludeEnd&&(We=ce));do se.scope&&Ke.closeNode(),!se.skip&&!se.subLanguage&&(qn+=se.relevance),se=se.parent;while(se!==Re.parent);return Re.starts&&ut(Re.starts,J),st.returnEnd?0:ce.length}function tt(){let J=[];for(let ce=se;ce!==xi;ce=ce.parent)ce.scope&&J.unshift(ce.scope);J.forEach(ce=>Ke.openNode(ce))}let Ce={};function ei(J,ce){let be=ce&&ce[0];if(We+=J,be==null)return de(),0;if(Ce.type==="begin"&&ce.type==="end"&&Ce.index===ce.index&&be===""){if(We+=D.slice(ce.index,ce.index+1),!r){let Re=new Error(`0 width match regex (${C})`);throw Re.languageName=C,Re.badRule=Ce.rule,Re}return 1}if(Ce=ce,ce.type==="begin")return ue(ce);if(ce.type==="illegal"&&!R){let Re=new Error('Illegal lexeme "'+be+'" for mode "'+(se.scope||"")+'"');throw Re.mode=se,Re}else if(ce.type==="end"){let Re=gt(ce);if(Re!==uC)return Re}if(ce.type==="illegal"&&be==="")return ce.index===D.length||(We+=` +`),1;if(Fn>1e5&&Fn>ce.index*3)throw new Error("potential infinite loop, way more iterations than matches");return We+=be,be.length}let xi=A(C);if(!xi)throw fo(s.replace("{}",C)),new Error('Unknown language: "'+C+'"');let fe=Qz(xi),dt="",se=Y||fe,ji={},Ke=new o.__emitter(o);tt();let We="",qn=0,Lt=0,Fn=0,vn=!1;try{if(xi.__emitTokens)xi.__emitTokens(D,Ke);else{for(se.matcher.considerAll();;){Fn++,vn?vn=!1:se.matcher.considerAll(),se.matcher.lastIndex=Lt;let J=se.matcher.exec(D);if(!J)break;let ce=D.substring(Lt,J.index),be=ei(ce,J);Lt=J.index+be}ei(D.substring(Lt))}return Ke.finalize(),dt=Ke.toHTML(),{language:C,value:dt,relevance:qn,illegal:!1,_emitter:Ke,_top:se}}catch(J){if(J.message&&J.message.includes("Illegal"))return{language:C,value:Kv(D),illegal:!0,relevance:0,_illegalBy:{message:J.message,index:Lt,context:D.slice(Lt-100,Lt+100),mode:J.mode,resultSoFar:dt},_emitter:Ke};if(r)return{language:C,value:Kv(D),illegal:!1,relevance:0,errorRaised:J,_emitter:Ke,_top:se};throw J}}function h(C){let D={value:Kv(C),illegal:!1,relevance:0,_top:a,_emitter:new o.__emitter(o)};return D._emitter.addText(C),D}function f(C,D){D=D||o.languages||Object.keys(t);let R=h(C),Y=D.filter(A).filter(B).map(de=>d(de,C,!1));Y.unshift(R);let z=Y.sort((de,Ae)=>{if(de.relevance!==Ae.relevance)return Ae.relevance-de.relevance;if(de.language&&Ae.language){if(A(de.language).supersetOf===Ae.language)return 1;if(A(Ae.language).supersetOf===de.language)return-1}return 0}),[I,j]=z,ve=I;return ve.secondBest=j,ve}function p(C,D,R){let Y=D&&i[D]||R;C.classList.add("hljs"),C.classList.add(`language-${Y}`)}function _(C){let D=null,R=c(C);if(l(R))return;if(x("before:highlightElement",{el:C,language:R}),C.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",C);return}if(C.children.length>0&&(o.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(C)),o.throwUnescapedHTML))throw new Vv("One of your code blocks includes unescaped HTML.",C.innerHTML);D=C;let Y=D.textContent,z=R?u(Y,{language:R,ignoreIllegals:!0}):f(Y);C.innerHTML=z.value,C.dataset.highlighted="yes",p(C,R,z.language),C.result={language:z.language,re:z.relevance,relevance:z.relevance},z.secondBest&&(C.secondBest={language:z.secondBest.language,relevance:z.secondBest.relevance}),x("after:highlightElement",{el:C,result:z,text:Y})}function y(C){o=cC(o,C)}let m=()=>{w(),Vl("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function v(){w(),Vl("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let b=!1;function w(){function C(){w()}if(document.readyState==="loading"){b||window.addEventListener("DOMContentLoaded",C,!1),b=!0;return}document.querySelectorAll(o.cssSelector).forEach(_)}function k(C,D){let R=null;try{R=D(e)}catch(Y){if(fo("Language definition for '{}' could not be registered.".replace("{}",C)),r)fo(Y);else throw Y;R=a}R.name||(R.name=C),t[C]=R,R.rawDefinition=D.bind(null,e),R.aliases&&L(R.aliases,{languageName:C})}function M(C){delete t[C];for(let D of Object.keys(i))i[D]===C&&delete i[D]}function T(){return Object.keys(t)}function A(C){return C=(C||"").toLowerCase(),t[C]||t[i[C]]}function L(C,{languageName:D}){typeof C=="string"&&(C=[C]),C.forEach(R=>{i[R.toLowerCase()]=D})}function B(C){let D=A(C);return D&&!D.disableAutodetect}function q(C){C["before:highlightBlock"]&&!C["before:highlightElement"]&&(C["before:highlightElement"]=D=>{C["before:highlightBlock"](Object.assign({block:D.el},D))}),C["after:highlightBlock"]&&!C["after:highlightElement"]&&(C["after:highlightElement"]=D=>{C["after:highlightBlock"](Object.assign({block:D.el},D))})}function H(C){q(C),n.push(C)}function P(C){let D=n.indexOf(C);D!==-1&&n.splice(D,1)}function x(C,D){let R=C;n.forEach(function(Y){Y[R]&&Y[R](D)})}function U(C){return Vl("10.7.0","highlightBlock will be removed entirely in v12.0"),Vl("10.7.0","Please use highlightElement now."),_(C)}Object.assign(e,{highlight:u,highlightAuto:f,highlightAll:w,highlightElement:_,highlightBlock:U,configure:y,initHighlighting:m,initHighlightingOnLoad:v,registerLanguage:k,unregisterLanguage:M,listLanguages:T,getLanguage:A,registerAliases:L,autoDetection:B,inherit:cC,addPlugin:H,removePlugin:P}),e.debugMode=function(){r=!1},e.safeMode=function(){r=!0},e.versionString=eB,e.regex={concat:po,lookahead:fC,either:Vf,optional:gz,anyNumberOfTimes:mz};for(let C in Gf)typeof Gf[C]=="object"&&dC(Gf[C]);return Object.assign(e,Gf),e},Xl=wC({});Xl.newInstance=()=>wC({});xC.exports=Xl;Xl.HighlightJS=Xl;Xl.default=Xl});var CC=xe((K7,kC)=>{function iB(e){let t=e.regex,i=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),n=/[\p{L}0-9._:-]+/u,r={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},a=e.inherit(s,{begin:/\(/,end:/\)/}),o=e.inherit(e.APOS_STRING_MODE,{className:"string"}),l=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),c={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:[s,l,o,a,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[s,a,l,o]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},r,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:"css"}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:"javascript"}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:i,relevance:0,starts:c}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(i,/>/))),contains:[{className:"name",begin:i,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}kC.exports=iB});var NC=xe((G7,TC)=>{function nB(e){let t=e.regex,i={},n={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[i]}]};Object.assign(i,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},n]});let r={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},s=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),a={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,i,r]};r.contains.push(o);let l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,i]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=e.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),p={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},_=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],y=["true","false"],m={match:/(\/[a-z._-]+)+/},v=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],b=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],w=["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:_,literal:y,built_in:[...v,...b,"set","shopt",...w,...k]},contains:[f,e.SHEBANG(),p,d,s,a,m,o,l,c,u,i]}}TC.exports=nB});var MC=xe((j7,AC)=>{function rB(e){let t=e.regex,i=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),n="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",a="("+n+"|"+t.optional(r)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",o=t.concat(/\batomic_/,t.either("bool","char","schar","uchar","short","ushort","int","uint","long","ulong","llong","ullong","char16_t","char32_t","wchar_t","int_least8_t","uint_least8_t","int_least16_t","uint_least16_t","int_least32_t","uint_least32_t","int_least64_t","uint_least64_t","int_fast8_t","uint_fast8_t","int_fast16_t","uint_fast16_t","int_fast32_t","uint_fast32_t","int_fast64_t","uint_fast64_t","intptr_t","uintptr_t","size_t","ptrdiff_t","intmax_t","uintmax_t"),/\b/),l={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:o}]},u={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"([^()\\\s"]{0,16})\(/,end:/\)([^()\\\s"]{0,16})"/})]},d={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},h={scope:"meta",begin:/#\s*include\b/,end:/$/,keywords:{keyword:"include"},contains:[{begin:/\\\n/},u,{scope:"string",begin:/<.*?>/},i,e.C_BLOCK_COMMENT_MODE]},f={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(u,{className:"string"}),i,e.C_BLOCK_COMMENT_MODE]},p=[h,f],_={className:"title",begin:t.optional(r)+e.IDENT_RE,relevance:0},y=t.optional(r)+e.IDENT_RE+"\\s*\\(",m=12,w={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"},k=[...p,l,i,e.C_BLOCK_COMMENT_MODE,d,u],M={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:w,contains:k.concat([{begin:/\(/,end:/\)/,keywords:w,contains:k.concat(["self"]),relevance:0}]),relevance:0},T={begin:"("+a+"[\\*&\\s]+){1,"+m+"}"+y,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:n,keywords:w,relevance:0},{begin:y,returnBegin:!0,contains:[e.inherit(_,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[i,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:["self",i,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,i,e.C_BLOCK_COMMENT_MODE,...p]};return{name:"C",aliases:["h"],keywords:w,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:w}}}AC.exports=rB});var RC=xe((Y7,OC)=>{function sB(e){let t=e.regex,i=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),n="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",a="(?!struct)("+n+"|"+t.optional(r)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",o={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={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"([^()\\\s"]{0,16})\(/,end:/\)([^()\\\s"]{0,16})"/})]},u={className:"number",variants:[{begin:"[+-]?(?:(?:\\b[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|\\b[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|\\b0[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},d={scope:"meta",begin:/#\s*include\b/,end:/$/,keywords:{keyword:"include"},contains:[{begin:/\\\n/},c,{scope:"string",begin:/<.*?>/},i,e.C_BLOCK_COMMENT_MODE]},h={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(c,{className:"string"}),i,e.C_BLOCK_COMMENT_MODE]},f=[d,h],p={className:"title",begin:t.optional(r)+e.IDENT_RE,relevance:0},_=t.optional(r)+e.IDENT_RE+"\\s*\\(",y=12,m=["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"],v=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],b=["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"],T={type:v,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:b},A={className:"function.dispatch",relevance:0,keywords:{_hint:w},begin:t.concat(/\b/,`(?!${m.join("|")})`,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},L=[A,...f,o,i,e.C_BLOCK_COMMENT_MODE,u,c],B={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:T,contains:L.concat([{begin:/\(/,end:/\)/,keywords:T,contains:L.concat(["self"]),relevance:0}]),relevance:0},q={className:"function",begin:"("+a+"[\\*&\\s]+){1,"+y+"}"+_,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:T,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:n,keywords:T,relevance:0},{begin:_,returnBegin:!0,contains:[p],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:[i,e.C_BLOCK_COMMENT_MODE,c,u,o,{begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:["self",i,e.C_BLOCK_COMMENT_MODE,c,u,o]}]},o,i,e.C_BLOCK_COMMENT_MODE,...f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:T,illegal:"",keywords:T,contains:["self",o]},{begin:e.IDENT_RE+"::",keywords:T},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}OC.exports=sB});var LC=xe((V7,DC)=>{function aB(e){let t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],i=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],n=["default","false","null","true"],r=["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"],s=["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"],a={keyword:r.concat(s),built_in:t,literal:n},o=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l="\\d(_*\\d)*",c="([uU][lL]?|[lL][uU]?)?",d={className:"number",variants:[{begin:"\\b0[bB]_*[01](_*[01])*"+c},{begin:"(-?)\\b0[xX]_*[a-fA-F0-9](_*[a-fA-F0-9])*"+c},{begin:"(-?)(\\b"+l+"(\\.("+l+")?)?|\\."+l+")([eE][-+]?"+l+")?"+"([fFdDmM]|[uU][lL]?|[lL][uU]?)?"}],relevance:0},h={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},f={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},p=e.inherit(f,{illegal:/\n/}),_={className:"subst",begin:/\{/,end:/\}/,keywords:a},y=e.inherit(_,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,y]},v={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},_]},b=e.inherit(v,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},y]});_.contains=[v,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,d,e.C_BLOCK_COMMENT_MODE],y.contains=[b,m,p,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,d,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let w={variants:[h,v,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},k={begin:"<",end:">",contains:[{beginKeywords:"in out"},o]},M=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",T={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:a,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,d,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},o,k,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[o,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[o,k,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:"("+M+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:a,contains:[{beginKeywords:i.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,k],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,relevance:0,contains:[w,d,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},T]}}DC.exports=aB});var zC=xe((X7,IC)=>{var oB=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/},UNICODE_RANGE:{scope:"number",begin:/\b[Uu]\+[0-9A-Fa-f][0-9A-Fa-f?]{0,5}(-[0-9A-Fa-f][0-9A-Fa-f]{0,5})?/},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_-]*/}}),lB=["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"],cB=["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"],uB=[...lB,...cB],dB=["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(),hB=["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(),fB=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),pB=["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","corner-bottom-left-shape","corner-bottom-right-shape","corner-shape","corner-top-left-shape","corner-top-right-shape","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","unicode-range","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 mB(e){let t=e.regex,i=oB(e),n={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},r="and or not only",s=/@-?\w[\w]*(-\w+)*/,a="[a-zA-Z-][a-zA-Z0-9_-]*",o=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[i.BLOCK_COMMENT,n,i.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+a,relevance:0},i.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+hB.join("|")+")"},{begin:":(:)?("+fB.join("|")+")"}]},i.CSS_VARIABLE,{className:"attribute",begin:"\\b("+pB.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[i.BLOCK_COMMENT,i.HEXCOLOR,i.IMPORTANT,i.CSS_NUMBER_MODE,i.UNICODE_RANGE,...o,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...o,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},i.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:r,attribute:dB.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...o,i.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+uB.join("|")+")\\b"}]}}IC.exports=mB});var PC=xe((Z7,BC)=>{function gB(e){let t=e.regex,i={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},n={match:/^ {0,3}([-*_])[ \t]*(?:\1[ \t]*){2,}$/},r={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}]},s={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},a={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},o=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,o,/:\/\/.*?\)/),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}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},u={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},d=e.inherit(c,{contains:[]}),h=e.inherit(u,{contains:[]});c.contains.push(h),u.contains.push(d);let f=[i,l];return[c,u,d,h].forEach(m=>{m.contains=m.contains.concat(f)}),f=f.concat(c,u),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:f},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:f}]}]},i,s,n,c,u,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},r,l,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}BC.exports=gB});var UC=xe((Q7,HC)=>{function _B(e){let t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^@@ +-\d+ +\+\d+,\d+ +@@/,/^@@ +-\d+,\d+ +\+\d+ +@@/,/^@@ +-\d+ +\+\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}HC.exports=_B});var FC=xe((J7,qC)=>{function vB(e){let t=e.regex,i="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",n=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),r=t.concat(n,/(::\w+)*/),a={"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"]},o={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},c=[e.COMMENT("#","$",{contains:[o]}),e.COMMENT("^=begin","^=end",{contains:[o],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],u={className:"subst",begin:/#\{/,end:/\}/,keywords:a},d={className:"string",contains:[e.BACKSLASH_ESCAPE,u],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:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,u]})]}]},h="[1-9](_?[0-9])*|0",f="[0-9](_?[0-9])*",p={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${f}))?([eE][+-]?(${f})|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"}]},_={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},M=[d,{variants:[{match:[/class\s+/,r,/\s+<\s+/,r]},{match:[/\b(class|module)\s+/,r]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:a},{match:[/(include|extend)\s+/,r],scope:{2:"title.class"},keywords:a},{relevance:0,match:[r,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:n,scope:"title.class"},{match:[/def/,/\s+/,i],scope:{1:"keyword",3:"title.function"},contains:[_]},{begin:"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[d,{begin:i}],relevance:0},p,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:a},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,u],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(l,c),relevance:0}].concat(l,c);u.contains=M,_.contains=M;let B=[{begin:/^\s*=>/,starts:{end:"$",contains:M}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:a,contains:M}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(B).concat(c).concat(M)}}qC.exports=vB});var WC=xe((eq,$C)=>{function bB(e){let s={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:s,illegal:"{function yB(e){let t=e.regex,i=/[_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:t.concat(i,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}KC.exports=yB});var YC=xe((iq,jC)=>{function SB(e){let t=e.regex,i={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},n=e.COMMENT();n.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];let r={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},s={className:"literal",begin:/\bon|off|true|false|yes|no\b/},a={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},o={begin:/\[/,end:/\]/,contains:[n,s,r,a,i,"self"],relevance:0},l=/[A-Za-z0-9_-]+/,c=/"(\\"|[^"])*"/,u=/'[^']*'/,d=t.either(l,c,u),h=t.concat(d,"(\\s*\\.\\s*",d,")*",t.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[n,{className:"section",begin:/\[+/,end:/\]+/},{begin:h,className:"attr",starts:{end:/$/,contains:[n,o,s,r,a,i]}}]}}jC.exports=SB});var QC=xe((nq,ZC)=>{var Zl="[0-9](_*[0-9])*",Zf=`\\.(${Zl})`,Qf="[0-9a-fA-F](_*[0-9a-fA-F])*",VC={className:"number",variants:[{begin:`(\\b(${Zl})((${Zf})|\\.)?|(${Zf}))[eE][+-]?(${Zl})[fFdD]?\\b`},{begin:`\\b(${Zl})((${Zf})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Zf})[fFdD]?\\b`},{begin:`\\b(${Zl})[fFdD]\\b`},{begin:`\\b0[xX]((${Qf})\\.?|(${Qf})?\\.(${Qf}))[pP][+-]?(${Zl})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Qf})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function XC(e,t,i){return i===-1?"":e.replace(t,n=>XC(e,t,i-1))}function wB(e){let t=e.regex,i="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",n="(?:(?:\\s*\\[\\s*])+)?",r=i+"<@@@>"+n,a="(?:"+("\\?(?:\\s+(?:extends|super)\\s+"+r+")?")+"|"+r+")",o=XC("(?:\\s*<\\s*"+a+"(?:\\s*,\\s*"+a+")*\\s*>)?",/<@@@>/g,2),h={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"]},f={className:"meta",begin:"@"+i,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},p={className:"params",begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:h,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+/,i],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{beginKeywords:"new throw return else yield assert",relevance:0},{begin:[i,t.concat(o,n,/\s+/),i,n,/\s*/,/=(?!=)/],className:{1:"type",3:"variable",6:"operator"}},{begin:[/record/,/\s+/,i],className:{1:"keyword",3:"title.class"},contains:[p,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{begin:[i,t.concat(o,n,/\s+/),i,/\s*(?=\()/],className:{1:"type",3:"title.function"},keywords:h,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,VC,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},VC,f]}}ZC.exports=wB});var rT=xe((rq,nT)=>{var JC="[A-Za-z$_][0-9A-Za-z$_]*",xB=["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"],EB=["true","false","null","undefined","NaN","Infinity"],eT=["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"],tT=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],iT=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],kB=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","self","global"],CB=[].concat(iT,eT,tT);function TB(e){let t=e.regex,i=(R,{after:Y})=>{let z="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(R,Y)=>{let z=R[0].length+R.index,I=R.input[z];if(I==="<"||I===","){Y.ignoreMatch();return}I===">"&&(i(R,{after:z})||Y.ignoreMatch());let j,ve=R.input.substring(z);if(j=ve.match(/^\s*=/)){Y.ignoreMatch();return}if((j=ve.match(/^\s+extends\s+/))&&j.index===0){Y.ignoreMatch();return}}},o={$pattern:JC,keyword:xB,literal:EB,built_in:CB,"variable.language":kB},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\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},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},_={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},y={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},v={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:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,_,y,{match:/\$\d+/},d];h.contains=b.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(b)});let w=[].concat(v,h.contains),k=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(w)}]),M={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k},T={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,t.concat(n,"(",t.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}}]},A={relevance:0,match:t.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:{_:[...eT,...tT]}},L={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},B={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[M],illegal:/%/},q={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function H(R){return t.concat("(?!",R.join("|"),")")}let P={match:t.concat(/\b/,H([...iT,"super","import","await"].map(R=>`${R}\\s*\\(`)),n,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},x={begin:t.concat(/\./,t.lookahead(t.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},U={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},M]},C="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",D={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(C)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[M]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:A},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),L,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,_,y,v,{match:/\$\d+/},d,A,{scope:"attr",match:n+t.lookahead(":"),relevance:0},D,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,e.REGEXP_MODE,{className:"function",begin:C,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:o,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:s},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},B,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[M,e.inherit(e.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},x,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[M]},P,q,T,U,{match:/\$[(.]/}]}}nT.exports=TB});var aT=xe((sq,sT)=>{var NB="([-+]?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)|NaN|[-+]?Infinity",AB={scope:"number",match:NB,relevance:0};function MB(e){let t={className:"attr",begin:/(("(\\.|[^\\"\r\n])*")|('(\\.|[^\\'\r\n])*'))(?=\s*:)/,relevance:1.01},i={match:/[{}[\],:]/,className:"punctuation",relevance:0},n=["true","false","null"],r={scope:"literal",beginKeywords:n.join(" ")};return{name:"JSON",aliases:["jsonc","json5"],keywords:{literal:n},contains:[t,i,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,r,AB,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}sT.exports=MB});var lT=xe((aq,oT)=>{var Ql="[0-9](_*[0-9])*",Jf=`\\.(${Ql})`,ep="[0-9a-fA-F](_*[0-9a-fA-F])*",OB={className:"number",variants:[{begin:`(\\b(${Ql})((${Jf})|\\.)?|(${Jf}))[eE][+-]?(${Ql})[fFdD]?\\b`},{begin:`\\b(${Ql})((${Jf})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Jf})[fFdD]?\\b`},{begin:`\\b(${Ql})[fFdD]\\b`},{begin:`\\b0[xX]((${ep})\\.?|(${ep})?\\.(${ep}))[pP][+-]?(${Ql})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${ep})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function RB(e){let t={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"},i={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},n={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},r={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},s={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},a={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[s,r]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,s,r]}]};r.contains.push(a);let o={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},l={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(a,{className:"string"}),"self"]}]},c=OB,u=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),d={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},h=d;return h.variants[1].contains=[d],d.variants[1].contains=[h],{name:"Kotlin",aliases:["kt","kts","ktm","ktx"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,u,i,n,o,l,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,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:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[d,e.C_LINE_COMMENT_MODE,u],relevance:0},e.C_LINE_COMMENT_MODE,u,o,l,a,e.C_NUMBER_MODE]},u]},{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},o,l]},a,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` +`},c]}}oT.exports=RB});var hT=xe((oq,dT)=>{var DB=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/},UNICODE_RANGE:{scope:"number",begin:/\b[Uu]\+[0-9A-Fa-f][0-9A-Fa-f?]{0,5}(-[0-9A-Fa-f][0-9A-Fa-f]{0,5})?/},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_-]*/}}),LB=["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"],IB=["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"],zB=[...LB,...IB],BB=["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(),cT=["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(),uT=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),PB=["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","corner-bottom-left-shape","corner-bottom-right-shape","corner-shape","corner-top-left-shape","corner-top-right-shape","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","unicode-range","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(),HB=cT.concat(uT).sort().reverse();function UB(e){let t=DB(e),i=HB,n="and or not only",r="[\\w-]+",s="("+r+"|@\\{"+r+"\\})",a=[],o=[],l=function(b){return{className:"string",begin:"~?"+b+".*?"+b}},c=function(b,w,k){return{className:b,begin:w,relevance:k}},u={$pattern:/[a-z-]+/,keyword:n,attribute:BB.join(" ")},d={begin:"\\(",end:"\\)",contains:o,keywords:u,relevance:0};o.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,l("'"),l('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.UNICODE_RANGE,t.HEXCOLOR,d,c("variable","@@?"+r,10),c("variable","@\\{"+r+"\\}"),c("built_in","~?`[^`]*?`"),{className:"attribute",begin:r+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);let h=o.concat({begin:/\{/,end:/\}/,contains:a}),f={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(o)},p={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+PB.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:o}}]},_={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:u,returnEnd:!0,contains:o,relevance:0}},y={className:"variable",variants:[{begin:"@"+r+"\\s*:",relevance:15},{begin:"@"+r}],starts:{end:"[;}]",returnEnd:!0,contains:h}},m={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,f,c("keyword","all\\b"),c("variable","@\\{"+r+"\\}"),{begin:"\\b("+zB.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,c("selector-tag",s,0),c("selector-id","#"+s),c("selector-class","\\."+s,0),c("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+cT.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+uT.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},v={begin:r+`:(:)?(${i.join("|")})`,returnBegin:!0,contains:[m]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,_,y,v,p,m,f,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}dT.exports=UB});var pT=xe((lq,fT)=>{function qB(e){let t="\\[=*\\[",i="\\]=*\\]",n={begin:t,end:i,contains:["self"]},r=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,i,{contains:[n],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 global 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:r.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:r}].concat(r)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:i,contains:[n],relevance:5}])}}fT.exports=qB});var gT=xe((cq,mT)=>{function FB(e){let t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%{function $B(e){let t=e.regex,i=["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"],n=/[dualxmsipngr]{0,12}/,r={$pattern:/[\w.]+/,keyword:i.join(" ")},s={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:r},a={begin:/->\{/,end:/\}/},o={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},l={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[o]},c={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},u=[e.BACKSLASH_ESCAPE,s,l],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],h=(_,y,m="\\1")=>{let v=m==="\\1"?m:t.concat(m,y);return t.concat(t.concat("(?:",_,")"),y,/(?:\\.|[^\\\/])*?/,v,/(?:\\.|[^\\\/])*?/,m,n)},f=(_,y,m)=>t.concat(t.concat("(?:",_,")"),y,/(?:\\.|[^\\\/])*?/,m,n),p=[l,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),a,{className:"string",contains:u,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}]},c,{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:h("s|tr|y",t.either(...d,{capture:!0}))},{begin:h("s|tr|y","\\(","\\)")},{begin:h("s|tr|y","\\[","\\]")},{begin:h("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:f("(?:m|qr)?",/\//,/\//)},{begin:f("m|qr",t.either(...d,{capture:!0}),/\1/)},{begin:f("m|qr",/\(/,/\)/)},{begin:f("m|qr",/\[/,/\]/)},{begin:f("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,o]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,o,c]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return s.contains=p,a.contains=p,{name:"Perl",aliases:["pl","pm"],keywords:r,contains:p}}_T.exports=$B});var yT=xe((dq,bT)=>{function WB(e){let t={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+"},i=/[a-zA-Z@][a-zA-Z0-9_]*/,o={"variable.language":["this","super"],$pattern:i,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"]},l={$pattern:i,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:o,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+l.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:l,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}bT.exports=WB});var wT=xe((hq,ST)=>{function KB(e){let t=e.regex,i=/(?![A-Za-z0-9])(?![$])/,n=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,i),r=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,i),s=t.concat(/[A-Z]+/,i),a={scope:"variable",match:"\\$+"+n},o={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=e.inherit(e.APOS_STRING_MODE,{illegal:null}),u=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(l)}),d={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(x,U)=>{U.data._beginMatch=x[1]||x[2]},"on:end":(x,U)=>{U.data._beginMatch!==x[1]&&U.ignoreMatch()}},h=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),f=`[ +]`,p={scope:"string",variants:[u,c,d,h]},_={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},y=["false","null","true"],m=["__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"],v=["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"],w={keyword:m,literal:(x=>{let U=[];return x.forEach(C=>{U.push(C),C.toLowerCase()===C?U.push(C.toUpperCase()):U.push(C.toLowerCase())}),U})(y),built_in:v},k=x=>x.map(U=>U.replace(/\|\d+$/,"")),M={variants:[{match:[/new/,t.concat(f,"+"),t.concat("(?!",k(v).join("\\b|"),"\\b)"),r],scope:{1:"keyword",4:"title.class"}}]},T=t.concat(n,"\\b(?!\\()"),A={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),T],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[r,t.concat(/::/,t.lookahead(/(?!class\b)/)),T],scope:{1:"title.class",3:"variable.constant"}},{match:[r,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[r,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},L={scope:"attr",match:t.concat(n,t.lookahead(":"),t.lookahead(/(?!::)/))},B={relevance:0,begin:/\(/,end:/\)/,keywords:w,contains:[L,a,A,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,p,_,M]},q={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",k(m).join("\\b|"),"|",k(v).join("\\b|"),"\\b)"),n,t.concat(f,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[B]};B.contains.push(q);let H=[L,A,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,p,_,M],P={begin:t.concat(/#\[\s*\\?/,t.either(r,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:y,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:y,keyword:["new","array"]},contains:["self",...H]},...H,{scope:"meta",variants:[{match:r},{match:s}]}]};return{case_insensitive:!1,keywords:w,contains:[P,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}]}},o,{scope:"variable.language",match:/\$this\b/},a,q,A,{match:[/const/,/\s/,n],scope:{1:"keyword",3:"variable.constant"}},M,{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:w,contains:["self",P,a,A,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,p,_]}]},{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]},p,_]}}ST.exports=KB});var ET=xe((fq,xT)=>{function GB(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})]}]}}xT.exports=GB});var CT=xe((pq,kT)=>{function jB(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}kT.exports=jB});var NT=xe((mq,TT)=>{function YB(e){let t=e.regex,i=/[\p{XID_Start}_]\p{XID_Continue}*/u,n=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","lazy","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],o={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:n,built_in:["__import__","abs","aiter","all","anext","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozendict","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","sentinel","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"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:o,illegal:/#/},u={begin:/\{\{/,relevance:0},d={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fFtT][rR]|[rR][fFtT]|[fFtT])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l,u,c]},{begin:/([fFtT][rR]|[rR][fFtT]|[fFtT])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l,u,c]},{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:/([fFtT][rR]|[rR][fFtT]|[fFtT])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,u,c]},{begin:/([fFtT][rR]|[rR][fFtT]|[fFtT])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,u,c]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",f=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,p=`\\b|${n.join("|")}`,_={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${f}))[eE][+-]?(${h})[jJ]?(?=${p})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${p})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${p})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${p})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${p})`},{begin:`\\b(${h})[jJ](?=${p})`}]},y={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:o,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:["self",l,_,d,e.HASH_COMMENT_MODE]}]};return c.contains=[d,_,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:o,illegal:/(<\/|\?)|=>/,contains:[l,_,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},d,y,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,i],scope:{1:"keyword",3:"title.function"},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,i,/\s*/,/\(\s*/,i,/\s*\)/]},{match:[/\bclass/,/\s+/,i]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[_,m,d]}]}}TT.exports=YB});var MT=xe((gq,AT)=>{function VB(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}AT.exports=VB});var RT=xe((_q,OT)=>{function XB(e){let t=e.regex,i=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,n=t.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]?/),r=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:i,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:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:i},{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:[r,n]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,n]},{scope:{1:"punctuation",2:"number"},match:[s,n]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,n]}]},{scope:{3:"operator"},match:[i,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:r},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}OT.exports=XB});var LT=xe((vq,DT)=>{function ZB(e){let t=e.regex,i=/(r#)?/,n=t.concat(i,e.UNDERSCORE_IDENT_RE),r=t.concat(i,e.IDENT_RE),s={scope:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!(?:let|for|while|if|else|match)\b)/,r,t.lookahead(/\s*\(/))},a="([ui](8|16|32|64|128|size)|f(16|32|64|128))?",o=["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","raw","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],c=["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!"],u=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f16","f32","f64","f128","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:u,keyword:o,literal:l,built_in:c},illegal:""},s]}}DT.exports=ZB});var zT=xe((bq,IT)=>{var QB=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/},UNICODE_RANGE:{scope:"number",begin:/\b[Uu]\+[0-9A-Fa-f][0-9A-Fa-f?]{0,5}(-[0-9A-Fa-f][0-9A-Fa-f]{0,5})?/},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_-]*/}}),JB=["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"],e5=["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"],t5=[...JB,...e5],i5=["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(),n5=["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(),r5=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),s5=["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","corner-bottom-left-shape","corner-bottom-right-shape","corner-shape","corner-top-left-shape","corner-top-right-shape","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","unicode-range","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 a5(e){let t=QB(e),i=r5,n=n5,r="@[a-z-]+",s="and or not only",o={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,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+t5.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+n.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+i.join("|")+")"},o,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+s5.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:[t.BLOCK_COMMENT,o,t.HEXCOLOR,t.CSS_NUMBER_MODE,t.UNICODE_RANGE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:r,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:i5.join(" ")},contains:[{begin:r,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},o,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}IT.exports=a5});var PT=xe((yq,BT)=>{function o5(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[./~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}BT.exports=o5});var UT=xe((Sq,HT)=>{function l5(e){let t=e.regex,i=e.COMMENT("--","$"),n={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},r={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],a=["double precision","large object","with timezone","without timezone"],o=["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"],l=["add","asc","collation","desc","final","first","last","view"],c=["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"],u=["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"],d=["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"],h=["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"],f=u,p=[...c,...l].filter(k=>!u.includes(k)),_={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},y={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},m={match:t.concat(/\b/,t.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function v(k){return t.concat(/\b/,t.either(...k.map(M=>M.replace(/\s+/,"\\s+"))),/\b/)}let b={scope:"keyword",match:v(h),relevance:0};function w(k,{exceptions:M,when:T}={}){let A=T;return M=M||[],k.map(L=>L.match(/\|\d+$/)||M.includes(L)?L:A(L)?`${L}|0`:L)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:w(p,{when:k=>k.length<3}),literal:s,type:o,built_in:d},contains:[{scope:"type",match:v(a)},b,m,_,n,r,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,i,y]}}HT.exports=l5});var VT=xe((wq,YT)=>{function WT(e){return e?typeof e=="string"?e:e.source:null}function Bu(e){return ot("(?=",e,")")}function ot(...e){return e.map(i=>WT(i)).join("")}function c5(e){let t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Fi(...e){return"("+(c5(e).capture?"":"?:")+e.map(n=>WT(n)).join("|")+")"}new RegExp(Fi(/\[(?:[^\\\]]|\\.)*\]/,/\(\?<(?![=!])[^>]+>/,/\(\?'[^']+'/,/\(\??/,/\\([1-9][0-9]*)/,/\\./));var eb=e=>ot(/\b/,e,/\w$/.test(e)?/\b/:/\B/),u5=["Protocol","Type"].map(eb),qT=["init","self"].map(eb),d5=["Any","Self"],Qv=["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"],FT=["false","nil","true"],h5=["assignment","associativity","higherThan","left","lowerThan","none","right"],f5=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],$T=["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"],KT=Fi(/[/=\-+!*%<>&|^~?]/,/[\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]/),GT=Fi(KT,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Jv=ot(KT,GT,"*"),jT=Fi(/[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]/),ip=Fi(jT,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Yr=ot(jT,ip,"*"),tp=ot(/[A-Z]/,ip,"*"),p5=["attached","autoclosure",ot(/convention\(/,Fi("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",ot(/objc\(/,Yr,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],m5=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function g5(e){let t={match:/\s+/,relevance:0},i=e.COMMENT("/\\*","\\*/",{contains:["self"]}),n=[e.C_LINE_COMMENT_MODE,i],r={match:[/\./,Fi(...u5,...qT)],className:{2:"keyword"}},s={match:ot(/\./,Fi(...Qv)),relevance:0},a=Qv.filter(fe=>typeof fe=="string").concat(["_|0"]),o=Qv.filter(fe=>typeof fe!="string").concat(d5).map(eb),l={variants:[{className:"keyword",match:Fi(...o,...qT)}]},c={$pattern:Fi(/\b\w+/,/#\w+/),keyword:a.concat(f5),literal:FT},u=[r,s,l],d={match:ot(/\./,Fi(...$T)),relevance:0},h={className:"built_in",match:ot(/\b/,Fi(...$T),/(?=\()/)},f=[d,h],p={match:/->/,relevance:0},_={className:"operator",relevance:0,variants:[{match:Jv},{match:`\\.(\\.|${GT})+`}]},y=[p,_],m="([0-9]_*)+",v="([0-9a-fA-F]_*)+",b={className:"number",relevance:0,variants:[{match:`\\b(${m})(\\.(${m}))?([eE][+-]?(${m}))?\\b`},{match:`\\b0x(${v})(\\.(${v}))?([pP][+-]?(${m}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},w=(fe="")=>({className:"subst",variants:[{match:ot(/\\/,fe,/[0\\tnr"']/)},{match:ot(/\\/,fe,/u\{[0-9a-fA-F]{1,8}\}/)}]}),k=(fe="")=>({className:"subst",match:ot(/\\/,fe,/[\t ]*(?:[\r\n]|\r\n)/)}),M=(fe="")=>({className:"subst",label:"interpol",begin:ot(/\\/,fe,/\(/),end:/\)/}),T=(fe="")=>({begin:ot(fe,/"""/),end:ot(/"""/,fe),contains:[w(fe),k(fe),M(fe)]}),A=(fe="")=>({begin:ot(fe,/"/),end:ot(/"/,fe),contains:[w(fe),M(fe)]}),L={className:"string",variants:[T(),T("#"),T("##"),T("###"),A(),A("#"),A("##"),A("###")]},B=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],q={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:B},H=fe=>{let dt=ot(fe,/\//),se=ot(/\//,fe);return{begin:dt,end:se,contains:[...B,{scope:"comment",begin:`#(?!.*${se})`,end:/$/}]}},P={scope:"regexp",variants:[H("###"),H("##"),H("#"),q]},x={match:ot(/`/,Yr,/`/)},U={className:"variable",match:/\$\d+/},C={className:"variable",match:`\\$${ip}+`},D=[x,U,C],R={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:m5,contains:[...y,b,L]}]}},Y={scope:"keyword",match:ot(/@/,Fi(...p5),Bu(Fi(/\(/,/\s+/)))},z={scope:"meta",match:ot(/@/,Yr)},I=[R,Y,z],j={match:Bu(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:ot(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,ip,"+")},{className:"type",match:tp,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:ot(/\s+&\s+/,Bu(tp)),relevance:0}]},ve={begin://,keywords:c,contains:[...n,...u,...I,p,j]};j.contains.push(ve);let de={match:ot(Yr,/\s*:/),keywords:"_|0",relevance:0},Ae={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",de,...n,P,...u,...f,...y,b,L,...D,...I,j]},re={begin://,keywords:"repeat each",contains:[...n,j]},ut={begin:Fi(Bu(ot(Yr,/\s*:/)),Bu(ot(Yr,/\s+/,Yr,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Yr}]},zi={begin:/\(/,end:/\)/,keywords:c,contains:[ut,...n,...u,...y,b,L,...I,j,Ae],endsParent:!0,illegal:/["']/},$t={match:[/(func|macro)/,/\s+/,Fi(x.match,Yr,Jv)],className:{1:"keyword",3:"title.function"},contains:[re,zi,t],illegal:[/\[/,/%/]},ue={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[re,zi,t],illegal:/\[|%/},gt={match:[/operator/,/\s+/,Jv],className:{1:"keyword",3:"title"}},tt={begin:[/precedencegroup/,/\s+/,tp],className:{1:"keyword",3:"title"},contains:[j],keywords:[...h5,...FT],end:/}/},Ce={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},ei={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},xi={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Yr,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[re,...u,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:tp},...u],relevance:0}]};for(let fe of L.variants){let dt=fe.contains.find(ji=>ji.label==="interpol");dt.keywords=c;let se=[...u,...f,...y,b,L,...D];dt.contains=[...se,{begin:/\(/,end:/\)/,contains:["self",...se]}]}return{name:"Swift",keywords:c,contains:[...n,$t,ue,Ce,ei,xi,gt,tt,{beginKeywords:"import",end:/$/,contains:[...n],relevance:0},P,...u,...f,...y,b,L,...D,...I,j,Ae]}}YT.exports=g5});var ZT=xe((xq,XT)=>{function _5(e){let t="true false yes no null",i="[\\w#;/?:@&=+$,.~*'()[\\]]+",n={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},a={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,r]},o=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={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"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},p={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},_={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},y=[n,{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+!"+i},{className:"type",begin:"!<"+i+">"},{className:"type",begin:"!"+i},{className:"type",begin:"!!"+i},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},h,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},p,_,s,a],m=[...y];return m.pop(),m.push(o),f.contains=m,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:y}}XT.exports=_5});var aN=xe((Eq,sN)=>{var np="[A-Za-z$_][0-9A-Za-z$_]*",QT=["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"],JT=["true","false","null","undefined","NaN","Infinity"],eN=["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"],tN=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],iN=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],nN=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","self","global"],rN=[].concat(iN,eN,tN);function v5(e){let t=e.regex,i=(R,{after:Y})=>{let z="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(R,Y)=>{let z=R[0].length+R.index,I=R.input[z];if(I==="<"||I===","){Y.ignoreMatch();return}I===">"&&(i(R,{after:z})||Y.ignoreMatch());let j,ve=R.input.substring(z);if(j=ve.match(/^\s*=/)){Y.ignoreMatch();return}if((j=ve.match(/^\s+extends\s+/))&&j.index===0){Y.ignoreMatch();return}}},o={$pattern:np,keyword:QT,literal:JT,built_in:rN,"variable.language":nN},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\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},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},_={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},y={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},v={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:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,_,y,{match:/\$\d+/},d];h.contains=b.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(b)});let w=[].concat(v,h.contains),k=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(w)}]),M={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k},T={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,t.concat(n,"(",t.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}}]},A={relevance:0,match:t.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:{_:[...eN,...tN]}},L={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},B={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[M],illegal:/%/},q={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function H(R){return t.concat("(?!",R.join("|"),")")}let P={match:t.concat(/\b/,H([...iN,"super","import","await"].map(R=>`${R}\\s*\\(`)),n,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},x={begin:t.concat(/\./,t.lookahead(t.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},U={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},M]},C="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",D={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(C)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[M]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:A},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),L,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,_,y,v,{match:/\$\d+/},d,A,{scope:"attr",match:n+t.lookahead(":"),relevance:0},D,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,e.REGEXP_MODE,{className:"function",begin:C,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:o,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:s},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},B,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[M,e.inherit(e.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},x,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[M]},P,q,T,U,{match:/\$[(.]/}]}}function b5(e){let t=e.regex,i=v5(e),n=np,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},a={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[i.exports.CLASS_REFERENCE]},o={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:np,keyword:QT.concat(l),literal:JT,built_in:rN.concat(r),"variable.language":nN},u={className:"meta",begin:"@"+n},d=(_,y,m)=>{let v=_.contains.findIndex(b=>b.label===y);if(v===-1)throw new Error("can not find mode to replace");_.contains.splice(v,1,m)};Object.assign(i.keywords,c),i.exports.PARAMS_CONTAINS.push(u);let h=i.contains.find(_=>_.scope==="attr"),f=Object.assign({},h,{match:t.concat(n,t.lookahead(/\s*\?:/))});i.exports.PARAMS_CONTAINS.push([i.exports.CLASS_REFERENCE,h,f]),i.contains=i.contains.concat([u,s,a,f]),d(i,"shebang",e.SHEBANG()),d(i,"use_strict",o);let p=i.contains.find(_=>_.label==="func.def");return p.relevance=0,Object.assign(i,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),i}sN.exports=b5});var lN=xe((kq,oN)=>{function y5(e){let t=e.regex,i={className:"string",begin:/"(""|[^/n])"C\b/},n={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},r=/\d{1,2}\/\d{1,2}\/\d{4}/,s=/\d{4}-\d{1,2}-\d{1,2}/,a=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,o=/\d{1,2}(:\d{1,2}){1,2}/,l={className:"literal",variants:[{begin:t.concat(/# */,t.either(s,r),/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,t.either(s,r),/ +/,t.either(a,o),/ *#/)}]},c={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])|[%&])?/}]},u={className:"label",begin:/^\w+:/},d=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),h=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:[i,n,l,c,u,d,h,{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:[h]}]}}oN.exports=y5});var uN=xe((Cq,cN)=>{function S5(e){e.regex;let t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");let i=e.COMMENT(/;;/,/$/),n=["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"],r={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},s={className:"variable",begin:/\$[\w_]+/},a={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},o={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/},l={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},c={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:n},contains:[i,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},s,a,r,e.QUOTE_STRING_MODE,l,c,o]}}cN.exports=S5});var hN=xe((Tq,dN)=>{var Le=EC();Le.registerLanguage("xml",CC());Le.registerLanguage("bash",NC());Le.registerLanguage("c",MC());Le.registerLanguage("cpp",RC());Le.registerLanguage("csharp",LC());Le.registerLanguage("css",zC());Le.registerLanguage("markdown",PC());Le.registerLanguage("diff",UC());Le.registerLanguage("ruby",FC());Le.registerLanguage("go",WC());Le.registerLanguage("graphql",GC());Le.registerLanguage("ini",YC());Le.registerLanguage("java",QC());Le.registerLanguage("javascript",rT());Le.registerLanguage("json",aT());Le.registerLanguage("kotlin",lT());Le.registerLanguage("less",hT());Le.registerLanguage("lua",pT());Le.registerLanguage("makefile",gT());Le.registerLanguage("perl",vT());Le.registerLanguage("objectivec",yT());Le.registerLanguage("php",wT());Le.registerLanguage("php-template",ET());Le.registerLanguage("plaintext",CT());Le.registerLanguage("python",NT());Le.registerLanguage("python-repl",MT());Le.registerLanguage("r",RT());Le.registerLanguage("rust",LT());Le.registerLanguage("scss",zT());Le.registerLanguage("shell",PT());Le.registerLanguage("sql",UT());Le.registerLanguage("swift",VT());Le.registerLanguage("yaml",ZT());Le.registerLanguage("typescript",aN());Le.registerLanguage("vbnet",lN());Le.registerLanguage("wasm",uN());Le.HighlightJS=Le;Le.default=Le;dN.exports=Le});var fN,Jl,tb=te(()=>{fN=ie(hN(),1),Jl=fN.default});function ec(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function pN(e){return e?/[\w+#.-]+/.exec(e.trim())?.[0]??"":""}function mN(e,t){if(t==="indented")return!1;let i=e.replace(/\n+$/,"").split(` +`);if(i.length<2)return!1;let n=/^ {0,3}(`{3,}|~{3,})/.exec(i[0]);if(!n)return!1;let r=n[1],s=i[i.length-1],a=/^ {0,3}([`~]+) *$/.exec(s);return a?a[1].startsWith(r):!1}function x5(e){let t=mo.get(e);if(t)return mo.delete(e),mo.set(e,t),t;let i;try{let n=Jl.highlightAuto(e);i={value:n.value,language:n.language??""}}catch{i={value:ec(e),language:""}}return mo.set(e,i),mo.size>w5&&mo.delete(mo.keys().next().value),i}function C5(e){let t=[""],i=0,n=[],r=s=>``;for(;i=0;a--)t[t.length-1]+="";t.push("");for(let a of n)t[t.length-1]+=r(a);i+=1;continue}if(e[i]==="<"){let a=e.slice(i),o=E5.exec(a);if(o){n.push(o[1]),t[t.length-1]+=o[0],i+=o[0].length;continue}let l=k5.exec(a);if(l){n.pop(),t[t.length-1]+=l[0],i+=l[0].length;continue}}let s=i+1;for(;s1&&t[t.length-1]==="";)t.pop();return t}function rb(e){return ib(e)}function N5(){let e=new Uint8Array(12);return globalThis.crypto.getRandomValues(e),Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}function yN(e){return e.split(vN).join(ib(T5)).split(bN).join(ib(nb))}function SN(e,t,i,n,r=!1,s=!0){let a=pN(t),o=e.replace(/\n$/,""),l;try{if(a&&Jl.getLanguage(a))l=Jl.highlight(o,{language:a}).value;else if(!a&&s&&o){let y=x5(o);l=y.value,a=pN(y.language)}else l=ec(o)}catch{l=ec(o)}let c=C5(l),u=c.length>1,d=u?c.map(y=>`${y}`).join(""):c[0]??"",h=ec(a||"text"),f=ec(n.wrap),p=ec(n.copy);return`
${h}
${d}
`}var w5,mo,E5,k5,ib,nb,gN,T5,_N,vN,bN,sb=te(()=>{tb();w5=128,mo=new Map;E5=/^/i,k5=/^<\/span>/i;ib=e=>``,nb="M8 8h11v12H8zM5 16V4h11",gN="M5 13l4 4L19 7",T5="M4 6h16M4 12h13a3 3 0 0 1 0 6h-4m2-2-2 2 2 2M4 18h5";_N=N5(),vN=`__AC_CB_WRAP_${_N}__`,bN=`__AC_CB_COPY_${_N}__`});function lb(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function RN(e){So=e}function go(e){let t=[];return i=>{let n=Math.max(0,Math.min(3,i-1)),r=t[n];return r||(r=e(n),t[n]=r),r}}function Me(e,t=""){let i=typeof e=="string"?e:e.source,n={replace:(r,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(fi.caret,"$1"),i=i.replace(r,a),n},getRegex:()=>new RegExp(i,t)};return n}function Dn(e,t){if(t){if(fi.escapeTest.test(e))return e.replace(fi.escapeReplace,kN)}else if(fi.escapeTestNoEncode.test(e))return e.replace(fi.escapeReplaceNoEncode,kN);return e}function T4(e){return fi.numericCharacterReference.test(e)?e.replace(fi.numericCharacterReferenceOrAmpersand,(t,i,n)=>{if(i===void 0&&n===void 0)return"&";let r=i===void 0?Number.parseInt(n,16):Number.parseInt(i,10);return r===0||r>1114111||r>=55296&&r<=57343?"\uFFFD":r===38?"&":String.fromCodePoint(r)}):e}function CN(e){try{e=encodeURI(e).replace(fi.percentDecode,"%")}catch{return null}return e}function TN(e,t){let i=e.replace(fi.findPipe,(s,a,o)=>{let l=!1,c=a;for(;--c>=0&&o[c]==="\\";)l=!l;return l?"|":" |"}),n=i.split(fi.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length=0&&fi.blankLine.test(t[i]);)i--;return t.length-i<=2?e:t.slice(0,i+1).join(` -`)}function Bf(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function Vk(e,t){if(e.indexOf(t[0])===-1&&e.indexOf(t[1])===-1)return-1;let i=0;for(let n=0;n0?-2:-1}function Lf(e,t=0){let i=t,n="";for(let r of e)if(r===" "){let s=4-i%4;n+=" ".repeat(s),i+=s}else n+=r,i++;return n}function Xk(e,t,i,n,r){let s=t.href,a=t.title||null,o=e[1].replace(r.other.outputLinkReplace,"$1"),l=e[0].charAt(0)==="!",c=n.state.inLink,u=n.state.linkEmitted,d=n.state.inRawBlock;n.state.inLink=!0,n.state.linkEmitted=!1;let h=n.inlineTokens(o),f=n.state.linkEmitted;if(n.state.linkEmitted=u,n.state.inLink=c,!l){if(f){n.state.inRawBlock=d;return}n.state.linkEmitted=!0}return{type:l?"image":"link",raw:i,href:s,title:a,text:o,tokens:h}}function Gz(e,t,i){let n=e.match(i.other.indentCodeCompensation);if(n===null)return t;let r=n[1];return t.split(` +`)}function lp(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function AN(e,t){if(e.indexOf(t[0])===-1&&e.indexOf(t[1])===-1)return-1;let i=0;for(let n=0;n0?-2:-1}function sp(e,t=0){let i=t,n="";for(let r of e)if(r===" "){let s=4-i%4;n+=" ".repeat(s),i+=s}else n+=r,i++;return n}function MN(e,t,i,n,r){let s=t.href,a=t.title||null,o=e[1].replace(r.other.outputLinkReplace,"$1"),l=e[0].charAt(0)==="!",c=n.state.inLink,u=n.state.linkEmitted,d=n.state.inRawBlock;n.state.inLink=!0,n.state.linkEmitted=!1;let h=n.inlineTokens(o),f=n.state.linkEmitted;if(n.state.linkEmitted=u,n.state.inLink=c,!l){if(f){n.state.inRawBlock=d;return}n.state.linkEmitted=!0}return{type:l?"image":"link",raw:i,href:s,title:a,text:o,tokens:h}}function N4(e,t,i){let n=e.match(i.other.indentCodeCompensation);if(n===null)return t;let r=n[1];return t.split(` `).map(s=>{let a=s.match(i.other.beginningSpace);if(a===null)return s;let[o]=a;return s.slice(Math.min(o.length,r.length))}).join(` -`)}function Zk(e,t,i,n){if(!t.includes("<"))return!1;for(let r=0;rt.length-r)return!0;r+=a[0].length-1}}return!1}function lo(e,t){if(Array.isArray(t))for(let i=0;i{fo=Hv();co={exec:()=>null};jI=((e="")=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:oo(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:oo(e=>new RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:oo(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:oo(e=>new RegExp(`^ {0,${e}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:oo(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:oo(e=>new RegExp(`^ {0,${e}}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|new RegExp(`^ {0,${e}}>`))},YI=/^(?:[ \t]*(?:\n|$))+/,VI=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,XI=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Nu=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ZI=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Uv=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Jk=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,eC=Ae(Jk).replace(/bull/g,Uv).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),QI=Ae(Jk).replace(/bull/g,Uv).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),qv=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,JI=/^[^\n]+/,Fv=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ez=Ae(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Fv).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),tz=Ae(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Uv).getRegex(),Au="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Wv=/|$))/,iz=Ae("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|[^\\n]*\\n*|$)|[^\\n]*\\n*|$)||$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Wv).replace("tag",Au).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),tC=e=>Ae(qv).replace("hr",Nu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",e).replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?| ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace("paragraph",rz).getRegex(),$v={blockquote:sz,code:VI,def:ez,fences:XI,heading:ZI,hr:Nu,html:iz,lheading:eC,list:tz,newline:YI,paragraph:nz,table:co,text:JI},Fk=Ae("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Nu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?| *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Wv).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:co,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ae(qv).replace("hr",Nu).replace("heading",` *#{1,6} *[^ -]`).replace("lheading",eC).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},lz=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,cz=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,iC=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,uz=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",jI?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),rC=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,gz=Ae(rC,"u").replace(/punct/g,Gr).getRegex(),_z=Ae(rC,"u").replace(/punct/g,nC).getRegex(),vz=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,bz=Ae(vz,"u").replace(/openQuote/g,hz).replace(/punct/g,Gr).getRegex(),sC="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",yz=Ae(sC,"gu").replace(/notPunctSpace/g,Mu).replace(/punctSpace/g,Yl).replace(/punct/g,Gr).getRegex(),Sz=Ae(sC,"gu").replace(/notPunctSpace/g,pz).replace(/punctSpace/g,fz).replace(/punct/g,nC).getRegex(),wz="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",xz=Ae(wz,"gu").replace(/notPunctSpace/g,Mu).replace(/punctSpace/g,Yl).replace(/punct/g,Gr).getRegex(),Ez=Ae("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Mu).replace(/punctSpace/g,Yl).replace(/punct/g,Gr).getRegex(),kz="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Cz=Ae(kz,"gu").replace(/notPunctSpace/g,Mu).replace(/punctSpace/g,Yl).replace(/punct/g,Gr).getRegex(),Tz=Ae(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Gr).getRegex(),Nz="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Az=Ae(Nz,"gu").replace(/notPunctSpace/g,Mu).replace(/punctSpace/g,Yl).replace(/punct/g,Gr).getRegex(),Mz=Ae(/\\(punct)/,"gu").replace(/punct/g,Gr).getRegex(),Oz=Ae(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,Gr).getRegex(),Rz=Ae(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Dz=Ae(Wv).replace("(?:-->|$)","-->").getRegex(),Lz=Ae("^comment|^|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",Dz).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),aC=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,zf=Ae(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",aC).getRegex(),Iz=Ae(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",zf).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),zz=Ae(/^!?\[(label)\]\[(ref)\]/).replace("label",zf).replace("ref",Fv).getRegex(),Bz=Ae(/^!?\[(ref)\](?:\[\])?/).replace("ref",Fv).getRegex(),Wk=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Pz=Ae(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",aC).getRegex(),Hz=Ae("reflink|nolink(?!\\()","g").replace("reflink",Ae(/^!?\[(label)\]\[(ref)\]/).replace("label",Pz).replace("ref",Wk).getRegex()).replace("nolink",Ae(/^!?\[(ref)\](?:\[\])?/).replace("ref",Wk).getRegex()).getRegex(),$k=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Uz=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,qz=Ae(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,Uz).getRegex(),Kv={_backpedal:co,anyPunctuation:Mz,anyPunctuationOutsideCode:Oz,autolink:Rz,blockSkip:mz,br:iC,code:cz,del:co,delLDelim:co,delRDelim:co,emStrongLDelim:gz,emStrongRDelimAst:yz,emStrongRDelimUnd:Ez,escape:lz,link:Iz,nolink:Bz,punctuation:dz,reflink:zz,reflinkSearch:Hz,tag:Lz,text:uz,url:co},Fz={...Kv,emStrongLDelim:bz,emStrongRDelimAst:xz,emStrongRDelimUnd:Cz,link:Ae(/^!?\[(label)\]\((.*?)\)/).replace("label",zf).getRegex(),reflink:Ae(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",zf).getRegex()},Bv={...Kv,emStrongRDelimAst:Sz,emStrongLDelim:_z,delLDelim:Tz,delRDelim:Az,url:Ae(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",qz).replace("protocol",$k).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Ae(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},Kk=e=>$z[e];Gl=class{constructor(e){me(this,"options");me(this,"rules");me(this,"lexer");this.options=e||fo}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let i=this.options.pedantic?t[0]:Yk(t[0]),n=i.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:i,codeBlockStyle:"indented",text:n}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let i=t[0],n=Gz(i,t[3]||"",this.rules);return{type:"code",raw:i,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let i=t[2].trim();if(this.rules.other.endingHash.test(i)){let n=ya(i,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceTabChar.test(n))&&(i=n.trim())}return{type:"heading",raw:ya(t[0],` -`),depth:t[1].length,text:i,tokens:this.lexer.inline(i)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:ya(t[0],` -`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let i=ya(t[0],` +`)}function ON(e,t,i,n){if(!t.includes("<"))return!1;for(let r=0;rt.length-r)return!0;r+=a[0].length-1}}return!1}function _o(e,t){if(Array.isArray(t))for(let i=0;i{So=lb();vo={exec:()=>null};A5=((e="")=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:go(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:go(e=>new RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:go(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:go(e=>new RegExp(`^ {0,${e}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:go(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:go(e=>new RegExp(`^ {0,${e}}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|new RegExp(`^ {0,${e}}>`))},M5=/^(?:[ \t]*(?:\n|$))+/,O5=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,R5=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Uu=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,D5=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,cb=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,DN=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,LN=Me(DN).replace(/bull/g,cb).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),L5=Me(DN).replace(/bull/g,cb).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ub=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,I5=/^[^\n]+/,db=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,z5=Me(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",db).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),B5=Me(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,cb).getRegex(),qu="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",hb=/|$))/,P5=Me("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|[^\\n]*\\n*|$)|[^\\n]*\\n*|$)||$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",hb).replace("tag",qu).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),IN=e=>Me(ub).replace("hr",Uu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",e).replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?| ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace("paragraph",U5).getRegex(),fb={blockquote:q5,code:O5,def:z5,fences:R5,heading:D5,hr:Uu,html:P5,lheading:LN,list:B5,newline:M5,paragraph:H5,table:vo,text:I5},wN=Me("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Uu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?| *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",hb).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:vo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Me(ub).replace("hr",Uu).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",LN).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},W5=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,K5=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,zN=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,G5=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",A5?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),PN=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Q5=Me(PN,"u").replace(/punct/g,Vr).getRegex(),J5=Me(PN,"u").replace(/punct/g,BN).getRegex(),e4=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,t4=Me(e4,"u").replace(/openQuote/g,Y5).replace(/punct/g,Vr).getRegex(),HN="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",i4=Me(HN,"gu").replace(/notPunctSpace/g,Fu).replace(/punctSpace/g,rc).replace(/punct/g,Vr).getRegex(),n4=Me(HN,"gu").replace(/notPunctSpace/g,X5).replace(/punctSpace/g,V5).replace(/punct/g,BN).getRegex(),r4="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",s4=Me(r4,"gu").replace(/notPunctSpace/g,Fu).replace(/punctSpace/g,rc).replace(/punct/g,Vr).getRegex(),a4=Me("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Fu).replace(/punctSpace/g,rc).replace(/punct/g,Vr).getRegex(),o4="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",l4=Me(o4,"gu").replace(/notPunctSpace/g,Fu).replace(/punctSpace/g,rc).replace(/punct/g,Vr).getRegex(),c4=Me(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Vr).getRegex(),u4="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",d4=Me(u4,"gu").replace(/notPunctSpace/g,Fu).replace(/punctSpace/g,rc).replace(/punct/g,Vr).getRegex(),h4=Me(/\\(punct)/,"gu").replace(/punct/g,Vr).getRegex(),f4=Me(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,Vr).getRegex(),p4=Me(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),m4=Me(hb).replace("(?:-->|$)","-->").getRegex(),g4=Me("^comment|^|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",m4).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),UN=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,op=Me(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",UN).getRegex(),_4=Me(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",op).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),v4=Me(/^!?\[(label)\]\[(ref)\]/).replace("label",op).replace("ref",db).getRegex(),b4=Me(/^!?\[(ref)\](?:\[\])?/).replace("ref",db).getRegex(),xN=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,y4=Me(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",UN).getRegex(),S4=Me("reflink|nolink(?!\\()","g").replace("reflink",Me(/^!?\[(label)\]\[(ref)\]/).replace("label",y4).replace("ref",xN).getRegex()).replace("nolink",Me(/^!?\[(ref)\](?:\[\])?/).replace("ref",xN).getRegex()).getRegex(),EN=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,w4=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,x4=Me(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,w4).getRegex(),pb={_backpedal:vo,anyPunctuation:h4,anyPunctuationOutsideCode:f4,autolink:p4,blockSkip:Z5,br:zN,code:K5,del:vo,delLDelim:vo,delRDelim:vo,emStrongLDelim:Q5,emStrongRDelimAst:i4,emStrongRDelimUnd:a4,escape:W5,link:_4,nolink:b4,punctuation:j5,reflink:v4,reflinkSearch:S4,tag:g4,text:G5,url:vo},E4={...pb,emStrongLDelim:t4,emStrongRDelimAst:s4,emStrongRDelimUnd:l4,link:Me(/^!?\[(label)\]\((.*?)\)/).replace("label",op).getRegex(),reflink:Me(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",op).getRegex()},ab={...pb,emStrongRDelimAst:n4,emStrongLDelim:J5,delLDelim:c4,delRDelim:d4,url:Me(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",x4).replace("protocol",EN).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Me(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},kN=e=>C4[e];tc=class{constructor(e){ge(this,"options");ge(this,"rules");ge(this,"lexer");this.options=e||So}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let i=this.options.pedantic?t[0]:NN(t[0]),n=i.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:i,codeBlockStyle:"indented",text:n}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let i=t[0],n=N4(i,t[3]||"",this.rules);return{type:"code",raw:i,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let i=t[2].trim();if(this.rules.other.endingHash.test(i)){let n=ka(i,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceTabChar.test(n))&&(i=n.trim())}return{type:"heading",raw:ka(t[0],` +`),depth:t[1].length,text:i,tokens:this.lexer.inline(i)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:ka(t[0],` +`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let i=ka(t[0],` `).split(` `),n="",r="",s=[];for(;i.length>0;){let a=!1,o=[],l;for(l=0;lp+Lf(_,p.length)).replace(this.rules.other.blockquoteSetextReplace,` +`),u=c.replace(this.rules.other.blockquoteMarkerWhitespace,(f,p,_)=>p+sp(_,p.length)).replace(this.rules.other.blockquoteSetextReplace,` $1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n} ${c}`:c,r=r?`${r} ${u}`:u;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,s,!0),this.lexer.state.top=d,i.length===0)break;let h=s.at(-1);if(h?.type==="code"||h?.type==="heading"||h?.type==="hr"||h?.type==="html")break;if(h?.type==="blockquote"){let f=h,p=i.join(` @@ -34,17 +39,17 @@ ${b.join(` `);n=`${n} ${m}`,r=`${r} ${m}`}i=i.slice(y);continue}}return{type:"blockquote",raw:n,tokens:s,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let i=e,n=()=>i.length-e.length,r=t[1].trim(),s=r.length>1,a={type:"list",raw:"",ordered:s,start:s?+r.slice(0,-1):"",loose:!1,items:[]};r=s?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=s?r:"[*+-]");let o=this.rules.other.listItemRegex(r),l=!1;for(;e;){let u=!1,d="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;let h=n();e=e.substring(t[0].length);let f=t[2].split(` -`,1)[0],p=t[1].length,_=this.options.pedantic?Lf(f,p):f.replace(this.rules.other.leadingSpaceTab,w=>Lf(w,p)),y=e.split(` -`,1)[0],m=!_.trim(),v=0;if(this.options.pedantic?(v=2,d=_.trimStart()):m?v=p+1:(v=_.search(this.rules.other.nonSpaceChar),v=v>4?1:v,d=_.slice(v),v+=p),m&&this.rules.other.blankLine.test(y)&&(e=e.substring(y.length+1),u=!0),!u){let w=this.rules.other.nextBulletRegex(v),k=this.rules.other.hrRegex(v),M=this.rules.other.fencesBeginRegex(v),T=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(v):this.rules.other.headingBeginRegex(v),A=this.rules.other.htmlBeginRegex(v),I=this.rules.other.blockquoteBeginRegex(v);for(;e;){let B=e.split(` -`,1)[0],q;if(y=B,this.options.pedantic?(y=y.replace(this.rules.other.listReplaceNesting," "),q=y):q=y.replace(this.rules.other.leadingSpaceTab,H=>Lf(H)),M.test(y)||T.test(y)||A.test(y)||I.test(y)||w.test(y)||k.test(y))break;if(q.search(this.rules.other.nonSpaceChar)>=v||!y.trim())d+=` +`,1)[0],p=t[1].length,_=this.options.pedantic?sp(f,p):f.replace(this.rules.other.leadingSpaceTab,w=>sp(w,p)),y=e.split(` +`,1)[0],m=!_.trim(),v=0;if(this.options.pedantic?(v=2,d=_.trimStart()):m?v=p+1:(v=_.search(this.rules.other.nonSpaceChar),v=v>4?1:v,d=_.slice(v),v+=p),m&&this.rules.other.blankLine.test(y)&&(e=e.substring(y.length+1),u=!0),!u){let w=this.rules.other.nextBulletRegex(v),k=this.rules.other.hrRegex(v),M=this.rules.other.fencesBeginRegex(v),T=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(v):this.rules.other.headingBeginRegex(v),A=this.rules.other.htmlBeginRegex(v),L=this.rules.other.blockquoteBeginRegex(v);for(;e;){let B=e.split(` +`,1)[0],q;if(y=B,this.options.pedantic?(y=y.replace(this.rules.other.listReplaceNesting," "),q=y):q=y.replace(this.rules.other.leadingSpaceTab,H=>sp(H)),M.test(y)||T.test(y)||A.test(y)||L.test(y)||w.test(y)||k.test(y))break;if(q.search(this.rules.other.nonSpaceChar)>=v||!y.trim())d+=` `+q.slice(v);else{if(m||_.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||M.test(_)||T.test(_)||k.test(_))break;let H=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(y)&&this.rules.block.lheading.test(`${_} ${y}`)?` ${q.replace(/^ {0,3}/,"")}`:y;d+=` -`+H}m=!y.trim(),e=e.substring(B.length+1),_=q.slice(v)}}let b=i.slice(h,n());a.loose||(l?a.loose=!0:this.rules.other.doubleBlankLine.test(b)&&(l=!0)),a.items.push({type:"list_item",raw:b,task:!!this.options.gfm&&this.rules.other.listIsTask.test(d),loose:!1,text:d,tokens:[]})}let c=a.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;a.raw=i.slice(0,n()).trimEnd();for(let u of a.items)if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),!a.loose){let d=u.tokens.filter(f=>f.type==="space"),h=d.length>0&&d.some(f=>this.rules.other.anyLine.test(f.raw));a.loose=h}for(let u of a.items){let d=u.tokens[0];if(u.task&&(d?.type==="text"||d?.type==="paragraph")){u.text=u.text.replace(this.rules.other.listReplaceTask,""),d.raw=d.raw.replace(this.rules.other.listReplaceTask,""),d.text=d.text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}let h=this.rules.other.listTaskCheckbox.exec(u.raw);if(h){let f={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};u.checked=f.checked,a.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=f.raw+u.tokens[0].raw,u.tokens[0].text=f.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(f)):u.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):u.tokens.unshift(f)}}else u.task&&(u.task=!1)}if(a.loose)for(let u of a.items){u.loose=!0;for(let d of u.tokens)d.type==="text"&&(d.type="paragraph")}return a}}html(e){let t=this.rules.block.html.exec(e);if(t){let i=Yk(t[0]);return{type:"html",block:!0,raw:i,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:i}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&Vk(t[2],"()")!==-1)return;let i=Bf(t[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:i,raw:ya(t[0],` -`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let i=jk(t[1]),n=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(` -`):[],s={type:"table",raw:ya(t[0],` -`),header:[],align:[],rows:[]};if(i.length===n.length){for(let a of n)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a({text:o,tokens:this.lexer.inline(o),header:!1,align:s.align[l]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let i=t[1].trim();return{type:"heading",raw:ya(t[0],` +`+H}m=!y.trim(),e=e.substring(B.length+1),_=q.slice(v)}}let b=i.slice(h,n());a.loose||(l?a.loose=!0:this.rules.other.doubleBlankLine.test(b)&&(l=!0)),a.items.push({type:"list_item",raw:b,task:!!this.options.gfm&&this.rules.other.listIsTask.test(d),loose:!1,text:d,tokens:[]})}let c=a.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;a.raw=i.slice(0,n()).trimEnd();for(let u of a.items)if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),!a.loose){let d=u.tokens.filter(f=>f.type==="space"),h=d.length>0&&d.some(f=>this.rules.other.anyLine.test(f.raw));a.loose=h}for(let u of a.items){let d=u.tokens[0];if(u.task&&(d?.type==="text"||d?.type==="paragraph")){u.text=u.text.replace(this.rules.other.listReplaceTask,""),d.raw=d.raw.replace(this.rules.other.listReplaceTask,""),d.text=d.text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}let h=this.rules.other.listTaskCheckbox.exec(u.raw);if(h){let f={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};u.checked=f.checked,a.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=f.raw+u.tokens[0].raw,u.tokens[0].text=f.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(f)):u.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):u.tokens.unshift(f)}}else u.task&&(u.task=!1)}if(a.loose)for(let u of a.items){u.loose=!0;for(let d of u.tokens)d.type==="text"&&(d.type="paragraph")}return a}}html(e){let t=this.rules.block.html.exec(e);if(t){let i=NN(t[0]);return{type:"html",block:!0,raw:i,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:i}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&AN(t[2],"()")!==-1)return;let i=lp(t[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:i,raw:ka(t[0],` +`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let i=TN(t[1]),n=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(` +`):[],s={type:"table",raw:ka(t[0],` +`),header:[],align:[],rows:[]};if(i.length===n.length){for(let a of n)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a({text:o,tokens:this.lexer.inline(o),header:!1,align:s.align[l]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let i=t[1].trim();return{type:"heading",raw:ka(t[0],` `),depth:t[2].charAt(0)==="="?1:2,text:i,tokens:this.lexer.inline(i)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let i=t[1].charAt(t[1].length-1)===` -`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:i,tokens:this.lexer.inline(i)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=this.rules.inline.link.exec(e);if(t){let i=t[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Zk(e,t[1],i,this.rules))return;let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let a=ya(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{let a=Vk(t[2],"()");if(a===-2)return;if(a>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let r=t[2],s="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(r);a&&(r=a[1],s=a[3])}else s=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Xk(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let i;if((i=this.rules.inline.reflink.exec(e))||(i=this.rules.inline.nolink.exec(e))){let n=i[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Zk(e,i[1],n,this.rules))return;let r=(i[2]||i[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=t[Bf(r)];if(!s){let a=i[0].charAt(0);return{type:"text",raw:a,text:a}}return Xk(i,s,i[0],this.lexer,this.rules)}}emStrong(e,t,i=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!n||!n[1]&&!n[2]&&!n[3]&&!n[4])return;let r=n[0][0],s=i===r,a=t.length-e.length,o=a;for(;!this.options.pedantic&&o>0&&t[o-1]===r;)o--;let l=[...t.slice(Math.max(0,o-2),o)].at(-1)??"",c=l==="*"||l==="_"||!!this.rules.inline.punctuation.exec(l);o0)continue;p=Math.min(p,p+_+y);let w=[...n[0]][0].length,k=e.slice(0,h+n.index+w+p);if(Math.min(h,p)%2){let T=k.slice(1,-1);return{type:"em",raw:k,text:T,tokens:this.lexer.inlineTokens(T)}}let M=k.slice(2,-2);return{type:"strong",raw:k,text:M,tokens:this.lexer.inlineTokens(M)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let i=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(i),r=this.rules.other.startingSpaceChar.test(i)&&this.rules.other.endingSpaceChar.test(i);return n&&r&&(i=i.substring(1,i.length-1)),{type:"codespan",raw:t[0],text:i}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,i=""){let n=this.rules.inline.delLDelim.exec(e);if(n&&(!n[1]||!i||this.rules.inline.punctuation.exec(i))){let r=[...n[0]].length-1,s,a,o=r,l=this.rules.inline.delRDelim;for(l.lastIndex=0,t=t.slice(-1*e.length+r);(n=l.exec(t))!==null;){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s||(a=[...s].length,a!==r))continue;if(n[3]||n[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let c=[...n[0]][0].length,u=e.slice(0,r+n.index+c+a),d=u.slice(r,-r);return{type:"del",raw:u,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let i,n;return t[2]==="@"?(i=t[1],n="mailto:"+i):(i=t[1],n=i),{type:"link",raw:t[0],text:i,href:n,autolink:!0,tokens:[{type:"text",raw:i,text:i}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let i,n;if(t[2]==="@")i=t[0],n="mailto:"+i;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);i=t[0],t[1]==="www."?n="http://"+t[0]:n=t[0]}return{type:"link",raw:t[0],text:i,href:n,autolink:!0,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let i=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:i?t[0]:Kz(t[0]),escaped:i}}}},pr=(uo=class{constructor(t){Cy(this,jl);me(this,"tokens");me(this,"options");me(this,"state");me(this,"inlineQueue");me(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||fo,this.options.tokenizer=this.options.tokenizer||new Gl,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let i={other:fi,block:Df.normal,inline:Cu.normal};this.options.pedantic?(i.block=Df.pedantic,i.inline=Cu.pedantic):this.options.gfm&&(i.block=Df.gfm,this.options.breaks?i.inline=Cu.breaks:i.inline=Cu.gfm),this.tokenizer.rules=i}static get rules(){return{block:Df,inline:Cu}}static lex(t,i){return new uo(i).lex(t)}static lexInline(t,i){return new uo(i).inlineTokens(t)}lex(t){t=t.replace(fi.carriageReturn,` +`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:i,tokens:this.lexer.inline(i)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=this.rules.inline.link.exec(e);if(t){let i=t[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&ON(e,t[1],i,this.rules))return;let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let a=ka(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{let a=AN(t[2],"()");if(a===-2)return;if(a>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let r=t[2],s="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(r);a&&(r=a[1],s=a[3])}else s=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),MN(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let i;if((i=this.rules.inline.reflink.exec(e))||(i=this.rules.inline.nolink.exec(e))){let n=i[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&ON(e,i[1],n,this.rules))return;let r=(i[2]||i[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=t[lp(r)];if(!s){let a=i[0].charAt(0);return{type:"text",raw:a,text:a}}return MN(i,s,i[0],this.lexer,this.rules)}}emStrong(e,t,i=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!n||!n[1]&&!n[2]&&!n[3]&&!n[4])return;let r=n[0][0],s=i===r,a=t.length-e.length,o=a;for(;!this.options.pedantic&&o>0&&t[o-1]===r;)o--;let l=[...t.slice(Math.max(0,o-2),o)].at(-1)??"",c=l==="*"||l==="_"||!!this.rules.inline.punctuation.exec(l);o0)continue;p=Math.min(p,p+_+y);let w=[...n[0]][0].length,k=e.slice(0,h+n.index+w+p);if(Math.min(h,p)%2){let T=k.slice(1,-1);return{type:"em",raw:k,text:T,tokens:this.lexer.inlineTokens(T)}}let M=k.slice(2,-2);return{type:"strong",raw:k,text:M,tokens:this.lexer.inlineTokens(M)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let i=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(i),r=this.rules.other.startingSpaceChar.test(i)&&this.rules.other.endingSpaceChar.test(i);return n&&r&&(i=i.substring(1,i.length-1)),{type:"codespan",raw:t[0],text:i}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,i=""){let n=this.rules.inline.delLDelim.exec(e);if(n&&(!n[1]||!i||this.rules.inline.punctuation.exec(i))){let r=[...n[0]].length-1,s,a,o=r,l=this.rules.inline.delRDelim;for(l.lastIndex=0,t=t.slice(-1*e.length+r);(n=l.exec(t))!==null;){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s||(a=[...s].length,a!==r))continue;if(n[3]||n[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let c=[...n[0]][0].length,u=e.slice(0,r+n.index+c+a),d=u.slice(r,-r);return{type:"del",raw:u,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let i,n;return t[2]==="@"?(i=t[1],n="mailto:"+i):(i=t[1],n=i),{type:"link",raw:t[0],text:i,href:n,autolink:!0,tokens:[{type:"text",raw:i,text:i}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let i,n;if(t[2]==="@")i=t[0],n="mailto:"+i;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);i=t[0],t[1]==="www."?n="http://"+t[0]:n=t[0]}return{type:"link",raw:t[0],text:i,href:n,autolink:!0,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let i=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:i?t[0]:T4(t[0]),escaped:i}}}},br=(bo=class{constructor(t){zy(this,nc);ge(this,"tokens");ge(this,"options");ge(this,"state");ge(this,"inlineQueue");ge(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||So,this.options.tokenizer=this.options.tokenizer||new tc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let i={other:fi,block:rp.normal,inline:Pu.normal};this.options.pedantic?(i.block=rp.pedantic,i.inline=Pu.pedantic):this.options.gfm&&(i.block=rp.gfm,this.options.breaks?i.inline=Pu.breaks:i.inline=Pu.gfm),this.tokenizer.rules=i}static get rules(){return{block:rp,inline:Pu}}static lex(t,i){return new bo(i).lex(t)}static lexInline(t,i){return new bo(i).inlineTokens(t)}lex(t){t=t.replace(fi.carriageReturn,` `),this.blockTokens(t,this.tokens);for(let i=0;i(s=o.call({lexer:this},t,i))?(t=t.substring(s.raw.length),i.push(s),!0):!1))continue;if(s=this.tokenizer.space(t)){t=t.substring(s.raw.length);let o=i.at(-1);s.raw.length===1&&o!==void 0?o.raw+=` `:i.push(s);continue}if(s=this.tokenizer.code(t)){t=t.substring(s.raw.length);let o=i.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(` `)?"":` @@ -58,9 +63,9 @@ ${y}`)?` ${q.replace(/^ {0,3}/,"")}`:y;d+=` `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):i.push(s),n=a.length!==t.length,t=t.substring(s.raw.length);continue}if(s=this.tokenizer.text(t)){t=t.substring(s.raw.length);let o=i.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(` `)?"":` `)+s.raw,o.text+=` -`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):i.push(s);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,i}inline(t,i=[]){return this.inlineQueue.push({src:t,tokens:i}),i}linkInText(t){if(!t.includes("["))return!1;let i=this.tokenizer.rules.inline.link;for(let n of t.matchAll(this.tokenizer.rules.inline.blockSkip))if(i.test(n[0])&&t.charAt(n.index-1)!=="!")return!0;for(let n of t.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let r=n[0],s=r.lastIndexOf("[");if(!(r.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,Bf(r.slice(s+1,-1))))&&!(s>1&&this.linkInText(r.slice(1,s-1))))return!0}return!1}inlineTokens(t,i=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&t.includes(")");try{return dm(this,jl,oC).call(this,t,i)}finally{this.state.linkParenPossible=n}}infiniteLoopError(t){let i="Infinite loop on byte: "+t;if(this.options.silent)console.error(i);else throw new Error(i)}},jl=new WeakSet,oC=function(t,i){let n=t.includes("*")||t.includes("_")||t.includes("~")||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==Gl.prototype.emStrong||this.tokenizer.del!==Gl.prototype.del?dm(this,jl,lC).call(this,t):t,r=!1,s="",a=1/0;for(;t;){if(t.length(o=c.call({lexer:this},t,i))?(t=t.substring(o.raw.length),i.push(o),!0):!1))continue;if(o=this.tokenizer.escape(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.tag(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.link(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(o.raw.length);let c=i.at(-1);o.type==="text"&&c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):i.push(o);continue}if(o=this.tokenizer.emStrong(t,n,s)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.codespan(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.br(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.del(t,n,s)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.autolink(t)){t=t.substring(o.raw.length),i.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(t))){t=t.substring(o.raw.length),i.push(o);continue}let l=t;if(this.options.extensions?.startInline){let c=1/0,u=t.slice(1),d;this.options.extensions.startInline.forEach(h=>{d=h.call({lexer:this},u),typeof d=="number"&&d>=0&&(c=Math.min(c,d))}),c<1/0&&c>=0&&(l=t.substring(0,c+1))}if(o=this.tokenizer.inlineText(l)){t=t.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(s=o.raw.slice(-1)),r=!0;let c=i.at(-1);c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):i.push(o);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return i},lC=function(t){let i=t;if(this.tokens.links&&t.includes("[")){let n=this.tokenizer.rules.inline.reflinkSearch,r=s=>{let a=s.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,Bf(s.slice(a+1,-1))))return s;if(a>1&&s.charAt(0)!=="!"){let o=s.slice(1,a-1);if(this.linkInText(o))return"["+o.replace(n,r)+"]["+"a".repeat(s.length-a-2)+"]"}return"["+"a".repeat(s.length-2)+"]"};i=i.replace(n,r)}return i=i.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(n,r,s)=>s?"+".repeat(n.length):r?r+n.slice(r.length,-r.length).replace(/`/g,"+")+r:n),i=i.replace(this.tokenizer.rules.inline.blockSkip,(n,r,s)=>{let a=s?s.length:0;return n.slice(0,a)+"["+"a".repeat(n.length-a-2)+"]"}),i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i,i},uo),Pf=class{constructor(e){me(this,"options");me(this,"parser");this.options=e||fo}space(e){return""}code({text:e,lang:t,escaped:i}){let n=(t||"").match(fi.notSpaceStart)?.[0],r=e?e.replace(fi.endingNewline,"")+` -`:"";return n?'
'+(i?r:On(r,!0))+`
-`:"
"+(i?r:On(r,!0))+`
+`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):i.push(s);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,i}inline(t,i=[]){return this.inlineQueue.push({src:t,tokens:i}),i}linkInText(t){if(!t.includes("["))return!1;let i=this.tokenizer.rules.inline.link;for(let n of t.matchAll(this.tokenizer.rules.inline.blockSkip))if(i.test(n[0])&&t.charAt(n.index-1)!=="!")return!0;for(let n of t.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let r=n[0],s=r.lastIndexOf("[");if(!(r.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,lp(r.slice(s+1,-1))))&&!(s>1&&this.linkInText(r.slice(1,s-1))))return!0}return!1}inlineTokens(t,i=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&t.includes(")");try{return _m(this,nc,qN).call(this,t,i)}finally{this.state.linkParenPossible=n}}infiniteLoopError(t){let i="Infinite loop on byte: "+t;if(this.options.silent)console.error(i);else throw new Error(i)}},nc=new WeakSet,qN=function(t,i){let n=t.includes("*")||t.includes("_")||t.includes("~")||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==tc.prototype.emStrong||this.tokenizer.del!==tc.prototype.del?_m(this,nc,FN).call(this,t):t,r=!1,s="",a=1/0;for(;t;){if(t.length(o=c.call({lexer:this},t,i))?(t=t.substring(o.raw.length),i.push(o),!0):!1))continue;if(o=this.tokenizer.escape(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.tag(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.link(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(o.raw.length);let c=i.at(-1);o.type==="text"&&c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):i.push(o);continue}if(o=this.tokenizer.emStrong(t,n,s)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.codespan(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.br(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.del(t,n,s)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.autolink(t)){t=t.substring(o.raw.length),i.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(t))){t=t.substring(o.raw.length),i.push(o);continue}let l=t;if(this.options.extensions?.startInline){let c=1/0,u=t.slice(1),d;this.options.extensions.startInline.forEach(h=>{d=h.call({lexer:this},u),typeof d=="number"&&d>=0&&(c=Math.min(c,d))}),c<1/0&&c>=0&&(l=t.substring(0,c+1))}if(o=this.tokenizer.inlineText(l)){t=t.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(s=o.raw.slice(-1)),r=!0;let c=i.at(-1);c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):i.push(o);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return i},FN=function(t){let i=t;if(this.tokens.links&&t.includes("[")){let n=this.tokenizer.rules.inline.reflinkSearch,r=s=>{let a=s.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,lp(s.slice(a+1,-1))))return s;if(a>1&&s.charAt(0)!=="!"){let o=s.slice(1,a-1);if(this.linkInText(o))return"["+o.replace(n,r)+"]["+"a".repeat(s.length-a-2)+"]"}return"["+"a".repeat(s.length-2)+"]"};i=i.replace(n,r)}return i=i.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(n,r,s)=>s?"+".repeat(n.length):r?r+n.slice(r.length,-r.length).replace(/`/g,"+")+r:n),i=i.replace(this.tokenizer.rules.inline.blockSkip,(n,r,s)=>{let a=s?s.length:0;return n.slice(0,a)+"["+"a".repeat(n.length-a-2)+"]"}),i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i,i},bo),ic=class{constructor(e){ge(this,"options");ge(this,"parser");this.options=e||So}space(e){return""}code({text:e,lang:t,escaped:i}){let n=(t||"").match(fi.notSpaceStart)?.[0],r=e?e.replace(fi.endingNewline,"")+` +`:"";return n?'
'+(i?r:Dn(r,!0))+`
+`:"
"+(i?r:Dn(r,!0))+`
`}blockquote({tokens:e}){return`
${this.parser.parse(e)}
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`${this.parser.parseInline(e)} @@ -76,52 +81,47 @@ ${this.parser.parse(e)} `}tablerow({text:e}){return` ${e} `}tablecell(e){let t=this.parser.parseInline(e.tokens),i=e.header?"th":"td";return(e.align?`<${i} align="${e.align}">`:`<${i}>`)+t+` -`}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${On(e,!0)}`}br(e){return"
"}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,text:i,tokens:n,autolink:r}){let s=r?On(i,!0):this.parser.parseInline(n),a=Gk(e);if(a===null)return s;e=On(a,r);let o='
",o}image({href:e,title:t,text:i,tokens:n}){n&&(i=this.parser.parseInline(n,this.parser.textRenderer));let r=Gk(e);if(r===null)return On(i);e=r;let s=`${On(i)}{let a=r[s].flat(1/0);lo(i,this.walkTokens(a,t))}):r.tokens&&lo(i,this.walkTokens(r.tokens,t))}}return i}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(i=>{let n={...i};if(n.async=this.defaults.async||n.async||!1,i.extensions&&(i.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let s=t.renderers[r.name];s?t.renderers[r.name]=function(...a){let o=r.renderer.apply(this,a);return o===!1&&(o=s.apply(this,a)),o}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[r.level];s?s.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),n.extensions=t),i.renderer){let r=this.defaults.renderer||new Pf(this.defaults);for(let s in i.renderer){if(!(s in r))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,o=i.renderer[a],l=r[a];r[a]=(...c)=>{let u=o.apply(r,c);return u===!1&&(u=l.apply(r,c)),u||""}}n.renderer=r}if(i.tokenizer){let r=this.defaults.tokenizer||new Gl(this.defaults);for(let s in i.tokenizer){if(!(s in r))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,o=i.tokenizer[a],l=r[a];r[a]=(...c)=>{let u=o.apply(r,c);return u===!1&&(u=l.apply(r,c)),u}}n.tokenizer=r}if(i.hooks){let r=this.defaults.hooks||new Tu;for(let s in i.hooks){if(!(s in r))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let a=s,o=i.hooks[a],l=r[a];Tu.passThroughHooks.has(s)?r[a]=c=>{if(r.options.async&&Tu.passThroughHooksRespectAsync.has(s))return(async()=>{let d=await o.call(r,c);return l.call(r,d)})();let u=o.call(r,c);return l.call(r,u)}:r[a]=(...c)=>{if(r.options.async)return(async()=>{let d=await o.apply(r,c);return d===!1&&(d=await l.apply(r,c)),d})();let u=o.apply(r,c);return u===!1&&(u=l.apply(r,c)),u}}n.hooks=r}if(i.walkTokens){let r=this.defaults.walkTokens,s=i.walkTokens;n.walkTokens=function(a){let o=[];return o.push(s.call(this,a)),r&&lo(o,r.call(this,a)),o}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return pr.lex(e,t??this.defaults)}parser(e,t){return mr.parse(e,t??this.defaults)}parseMarkdown(e){return(t,i)=>{let n={...i},r={...this.defaults,...n},s=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&n.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=e),r.async)return(async()=>{let a=r.hooks?await r.hooks.preprocess(t):t,o=await(r.hooks?await r.hooks.provideLexer(e):e?pr.lex:pr.lexInline)(a,r),l=r.hooks?await r.hooks.processAllTokens(o):o;r.walkTokens&&await Promise.all(this.walkTokens(l,r.walkTokens));let c=await(r.hooks?await r.hooks.provideParser(e):e?mr.parse:mr.parseInline)(l,r);return r.hooks?await r.hooks.postprocess(c):c})().catch(s);try{r.hooks&&(t=r.hooks.preprocess(t));let a=(r.hooks?r.hooks.provideLexer(e):e?pr.lex:pr.lexInline)(t,r);r.hooks&&(a=r.hooks.processAllTokens(a)),r.walkTokens&&this.walkTokens(a,r.walkTokens);let o=(r.hooks?r.hooks.provideParser(e):e?mr.parse:mr.parseInline)(a,r);return r.hooks&&(o=r.hooks.postprocess(o)),o}catch(a){return s(a)}}}onError(e,t){return i=>{if(i.message+=` -Please report this to https://github.com/markedjs/marked.`,e){let n="

An error occurred:

"+On(i.message+"",!0)+"
";return t?Promise.resolve(n):n}if(t)return Promise.reject(i);throw i}}},ho=new jz;et.options=et.setOptions=function(e){return ho.setOptions(e),et.defaults=ho.defaults,Qk(et.defaults),et};et.getDefaults=Hv;et.defaults=fo;et.use=Yz;et.walkTokens=function(e,t){return ho.walkTokens(e,t)};et.parseInline=ho.parseInline;et.Parser=mr;et.parser=mr.parse;et.Renderer=Pf;et.TextRenderer=Gv;et.Lexer=pr;et.lexer=pr.lex;et.Tokenizer=Gl;et.Hooks=Tu;et.parse=et;p7=et.options,m7=et.setOptions,g7=et.walkTokens,_7=et.parseInline,v7=mr.parse,b7=pr.lex});function Vz(e,t){this.v=e,this.k=t}function uC(e,t){(t==null||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i1?i-1:0),r=1;r2&&arguments[2]!==void 0?arguments[2]:po;if(dC&&dC(e,null),!Xl(t))return e;let n=t.length;for(;n--;){let r=t[n];if(typeof r=="string"){let s=i(r);s!==r&&(tB(t)||(t[n]=s),r=s)}e[r]=!0}return e}function lB(e){for(let t=0;t0&&arguments[0]!==void 0?arguments[0]:kB(),t=Y=>MC(Y);if(t.version="3.4.17",t.removed=[],!e||!e.document||e.document.nodeType!==Xt.document||!e.Element)return t.isSupported=!1,t;let i=e.document,n=i,r=n.currentScript;e.DocumentFragment;let s=e.HTMLTemplateElement,a=e.Node,o=e.Element,l=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let c=e.DOMParser,u=e.trustedTypes,d=o.prototype,h=Jn(d,"cloneNode"),f=Jn(d,"remove"),p=Jn(d,"removeAttributeNode"),_=Jn(d,"nextSibling"),y=Jn(d,"childNodes"),m=Jn(d,"parentNode"),v=Jn(d,"shadowRoot"),b=Jn(d,"attributes"),w=a&&a.prototype?Jn(a.prototype,"nodeType"):null,k=a&&a.prototype?Jn(a.prototype,"nodeName"):null,M=a&&a.prototype?Jn(a.prototype,"ownerDocument"):null,T=function(S){return w?w(S):S.nodeType},A=function(S){return k?k(S):S.nodeName},I=uB(d,"namespaceURI"),B=function(S){return I?I(S):S.namespaceURI};if(typeof s=="function"){let Y=i.createElement("template");Y.content&&Y.content.ownerDocument&&(i=Y.content.ownerDocument)}let q,H="",P,x=!1,U=0,C=function(){if(U>0)throw Es('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},D=function(S){C(),U++;try{return q.createHTML(S)}finally{U--}},R=function(S){C(),U++;try{return q.createScriptURL(S)}finally{U--}},V=function(){return x||(P=CB(u,r),x=!0),P},z=i,L=z.implementation,K=z.createNodeIterator,X=z.createDocumentFragment,oe=z.getElementsByTagName,ge=n.importNode,te=EC();t.isSupported=typeof kC=="function"&&typeof m=="function"&&L&&L.createHTMLDocument!==void 0;let We=pB,Ki=mB,oi=gB,yt=_B,Hn=vB,Ht=bB,Ne=yB,gn=wB,$t=SC,fe=null,li=Ge({},[..._C,...Xv,...Zv,...Qv,...vC]),se=null,Kt=Ge({},[...bC,...Jv,...yC,...Uf]),Ye=Object.seal(Vl(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Fe=null,Un=null,Gt=Object.seal(Vl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ts=!0,xr=!0,ie=!1,de=!0,ve=!1,Me=!0,rt=!1,Ii=!1,Is=null,is=null,Mo=!1,zs=!1,Oo=!1,Ro=!1,Do=!0,Lo=!1,Io="user-content-",hc=!0,fc=!1,sr=null,E={},Z=null,ue=Ge({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]),Ce=null,$e=Ge({},["audio","video","img","source","image","track"]),St=null,Qt=Ge({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Er="http://www.w3.org/1998/Math/MathML",_n="http://www.w3.org/2000/svg",kt="http://www.w3.org/1999/xhtml",zo=kt,Zp=!1,Qp=null,p2=Ge({},[Er,_n,kt],Vv),cy=pi(["mi","mo","mn","ms","mtext"]),Jp=Ge({},cy),uy=pi(["annotation-xml"]),em=Ge({},uy),m2=Ge({},["title","style","font","a","script"]),pc=null,g2=["application/xhtml+xml","text/html"],_2="text/html",Ut=null,Bo=null,v2=i.createElement("form"),dy=function(S){return S instanceof RegExp||S instanceof Function},tm=function(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Bo&&Bo===S)return;(!S||typeof S!="object")&&(S={}),S=Rn(S),pc=g2.indexOf(S.PARSER_MEDIA_TYPE)===-1?_2:S.PARSER_MEDIA_TYPE,Ut=pc==="application/xhtml+xml"?Vv:po,fe=Sa(S,"ALLOWED_TAGS",li,{transform:Ut}),se=Sa(S,"ALLOWED_ATTR",Kt,{transform:Ut}),Qp=Sa(S,"ALLOWED_NAMESPACES",p2,{transform:Vv}),St=Sa(S,"ADD_URI_SAFE_ATTR",Qt,{transform:Ut,base:Qt}),Ce=Sa(S,"ADD_DATA_URI_TAGS",$e,{transform:Ut,base:$e}),Z=Sa(S,"FORBID_CONTENTS",ue,{transform:Ut}),Fe=Sa(S,"FORBID_TAGS",Rn({}),{transform:Ut}),Un=Sa(S,"FORBID_ATTR",Rn({}),{transform:Ut}),E=fn(S,"USE_PROFILES")?S.USE_PROFILES&&typeof S.USE_PROFILES=="object"?Rn(S.USE_PROFILES):S.USE_PROFILES:!1,ts=S.ALLOW_ARIA_ATTR!==!1,xr=S.ALLOW_DATA_ATTR!==!1,ie=S.ALLOW_UNKNOWN_PROTOCOLS||!1,de=S.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ve=S.SAFE_FOR_TEMPLATES||!1,Me=S.SAFE_FOR_XML!==!1,rt=S.WHOLE_DOCUMENT||!1,zs=S.RETURN_DOM||!1,Oo=S.RETURN_DOM_FRAGMENT||!1,Ro=S.RETURN_TRUSTED_TYPE||!1,Mo=S.FORCE_BODY||!1,Do=S.SANITIZE_DOM!==!1,Lo=S.SANITIZE_NAMED_PROPS||!1,hc=S.KEEP_CONTENT!==!1,fc=S.IN_PLACE||!1,$t=dB(S.ALLOWED_URI_REGEXP)?S.ALLOWED_URI_REGEXP:SC,zo=typeof S.NAMESPACE=="string"?S.NAMESPACE:kt,Jp=tb(S,"MATHML_TEXT_INTEGRATION_POINTS",()=>Ge({},cy)),em=tb(S,"HTML_INTEGRATION_POINTS",()=>Ge({},uy));let N=tb(S,"CUSTOM_ELEMENT_HANDLING",()=>Vl(null));if(Ye=Vl(null),fn(N,"tagNameCheck")&&dy(N.tagNameCheck)&&(Ye.tagNameCheck=N.tagNameCheck),fn(N,"attributeNameCheck")&&dy(N.attributeNameCheck)&&(Ye.attributeNameCheck=N.attributeNameCheck),fn(N,"allowCustomizedBuiltInElements")&&typeof N.allowCustomizedBuiltInElements=="boolean"&&(Ye.allowCustomizedBuiltInElements=N.allowCustomizedBuiltInElements),Ri(Ye),ve&&(xr=!1),Oo&&(zs=!0),E&&(fe=Ge({},vC),se=Vl(null),E.html===!0&&(Ge(fe,_C),Ge(se,bC)),E.svg===!0&&(Ge(fe,Xv),Ge(se,Jv),Ge(se,Uf)),E.svgFilters===!0&&(Ge(fe,Zv),Ge(se,Jv),Ge(se,Uf)),E.mathMl===!0&&(Ge(fe,Qv),Ge(se,yC),Ge(se,Uf))),Gt.tagCheck=null,Gt.attributeCheck=null,fn(S,"ADD_TAGS")&&(typeof S.ADD_TAGS=="function"?Gt.tagCheck=S.ADD_TAGS:Xl(S.ADD_TAGS)&&(fe===li&&(fe=Rn(fe)),Ge(fe,S.ADD_TAGS,Ut))),fn(S,"ADD_ATTR")&&(typeof S.ADD_ATTR=="function"?Gt.attributeCheck=S.ADD_ATTR:Xl(S.ADD_ATTR)&&(se===Kt&&(se=Rn(se)),Ge(se,S.ADD_ATTR,Ut))),fn(S,"ADD_FORBID_CONTENTS")&&Xl(S.ADD_FORBID_CONTENTS)&&(Z===ue&&(Z=Rn(Z)),Ge(Z,S.ADD_FORBID_CONTENTS,Ut)),hc&&(fe["#text"]=!0),rt&&Ge(fe,["html","head","body"]),fe.table&&(Ge(fe,["tbody"]),delete Fe.tbody),S.TRUSTED_TYPES_POLICY){if(typeof S.TRUSTED_TYPES_POLICY.createHTML!="function")throw Es('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof S.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Es('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let G=q;q=S.TRUSTED_TYPES_POLICY;try{H=D("")}catch(j){throw q=G,j}}else S.TRUSTED_TYPES_POLICY===null?(q=void 0,H=""):(q===void 0&&(q=V()),q&&typeof H=="string"&&(H=D("")));pi&&pi(S),Bo=S},hy=Ge({},[...Xv,...Zv,...hB]),fy=Ge({},[...Qv,...fB]),b2=function(S,N,G){return N.namespaceURI===kt?S==="svg":N.namespaceURI===Er?S==="svg"&&(G==="annotation-xml"||Jp[G]):!!hy[S]},y2=function(S,N,G){return N.namespaceURI===kt?S==="math":N.namespaceURI===_n?S==="math"&&em[G]:!!fy[S]},S2=function(S,N,G){return N.namespaceURI===_n&&!em[G]||N.namespaceURI===Er&&!Jp[G]?!1:!fy[S]&&(m2[S]||!hy[S])},w2=function(S){let N=B(S),G=po(A(S)),j=m(S),pe,Se;return j&&T(j)===Xt.element?(pe={namespaceURI:B(j)},Se=po(A(j))):(pe={namespaceURI:zo},Se="template"),Qp[N]?N===_n?b2(G,pe,Se):N===Er?y2(G,pe,Se):N===kt?S2(G,pe,Se):!!(pc==="application/xhtml+xml"&&Qp[N]):!1},Bs=function(S){Ou(t.removed,{element:S});try{m(S).removeChild(S)}catch{if(f(S),!m(S))throw Es("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},py=function(S,N,G){try{p(S,N)}catch{try{S.removeAttribute(G)}catch{}}},im=function(S){rm(S);let N=y(S);N&&xs(nB(N),j=>{try{f(j)}catch{}});let G=T(S)===Xt.element?b(S):null;if(G)for(let j=G.length-1;j>=0;--j){let pe=G[j],Se=pe&&pe.name;typeof Se=="string"&&py(S,pe,Se)}},Po=function(S,N,G){if(!G)try{G=N.getAttributeNode(S)}catch{G=null}Ou(t.removed,{attribute:G||null,from:N});try{G?p(N,G):N.removeAttribute(S)}catch{try{N.removeAttribute(S)}catch{}}if(S==="is")if(zs||Oo)try{Bs(N)}catch{}else try{N.setAttribute(S,"")}catch{}},my=function(S){let N=b(S);if(N)for(let G=N.length-1;G>=0;--G){let j=N[G],pe=j&&j.name;typeof pe!="string"||se[Ut(pe)]||py(S,j,pe)}},nm=function(S,N){let G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,j=[S];for(;j.length>0;){let pe=j.pop();if(N(pe)===!1)continue;if(G&&T(pe)===Xt.element){let Be=v(pe);Ps(Be)&&j.push(Be)}let Se=y(pe);if(Se)for(let Be=Se.length-1;Be>=0;--Be)j.push(Se[Be])}},rm=function(S){nm(S,N=>{T(N)===Xt.element&&my(N)})},sm=function(S){let N=[];return nm(S,G=>{N.push(G)},!0),N},x2=function(S,N){let G=jv();xs(sm(S),j=>{T(j)===Xt.element&&Yv(G,j)}),xs(N,j=>{T(j)===Xt.element&&!Ru(G,j)&&my(j)})},gy=function(S,N){let G=!1;return xs(t.removed,j=>{j.element&&(G=G||j.element===S,rm(j.element))}),x2(S,N),G},E2=8,k2=function(S,N){let G=sr,j=null,pe=()=>(j||(j=jv(),xs(N,Se=>{Yv(j,Se)})),j);for(let Se=0;;Se++){let Be=sm(S),Jt=[S],kr=!1;if(xs(Be,Gi=>{T(Gi)===Xt.documentFragment?Ou(Jt,Gi):!kr&&!Ru(G,Gi)&&(kr=Ru(pe(),Gi))}),!kr)return;if(Se>=E2)throw Es("the tree kept changing during in-place sanitization; refusing to return it");xs(Jt,(Gi,nn)=>{C2(Gi,nn>0,S,pe())})}},C2=function(S,N,G,j){let pe=am(S),Se;for(;Se=pe.nextNode();)!Ru(j,Se)||Ru(sr,Se)||(N&&ar(te.uponSanitizeShadowNode,Se,null),lm(Se,G),cm(Se,G),Ps(Se.content)&&gc(Se.content))},T2=function(S){sr&&Yv(sr,S)},_y=function(S,N){return Me?S==="patchsrc"?!0:S==="for"&&N!=="label"&&N!=="output":!1},N2=function(S){Me&&nm(S,N=>{let G=T(N);if(G===Xt.processingInstruction||G===Xt.comment&&Oi(wC,N.data)){try{f(N)}catch{}return!1}if(G===Xt.element){let j=N,pe=Ut(A(N));try{j.hasAttribute&&j.hasAttribute("patchsrc")&&j.removeAttribute("patchsrc"),j.hasAttribute&&j.hasAttribute("for")&&_y("for",pe)&&j.removeAttribute("for")}catch{}}return!0})},vy=function(S){let N=null,G=null;if(Mo)S=""+S;else{let Se=fC(S,/^[\r\n\t ]+/);G=Se&&Se[0]}pc==="application/xhtml+xml"&&zo===kt&&(S=''+S+"");let j=q?D(S):S;if(zo===kt)try{N=new c().parseFromString(j,pc)}catch{}if(!N||!N.documentElement){N=L.createDocument(zo,"template",null);try{N.documentElement.innerHTML=Zp?H:j}catch{}}let pe=N.body||N.documentElement;return S&&G&&pe.insertBefore(i.createTextNode(G),pe.childNodes[0]||null),zo===kt?oe.call(N,rt?"html":"body")[0]:rt?N.documentElement:pe},am=function(S){let N=M?M(S):S.ownerDocument;return K.call(N||S,S,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},wd=function(S){return S=Du(S,We," "),S=Du(S,Ki," "),S=Du(S,oi," "),S},om=function(S){var N;by(S);let G=(N=S.querySelectorAll)===null||N===void 0?void 0:N.call(S,"template");G&&xs(G,j=>{Ps(j.content)&&om(j.content)})},by=function(S){S.normalize();let N=M?M(S):S.ownerDocument,G=K.call(N||S,S,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null),j=G.nextNode();for(;j;)j.data=wd(j.data),j=G.nextNode()},xd=function(S){let N=k?k(S):null;return typeof N!="string"||Ut(N)!=="form"?!1:typeof S.nodeName!="string"||typeof S.textContent!="string"||typeof S.removeChild!="function"||S.attributes!==b(S)||typeof S.removeAttribute!="function"||typeof S.removeAttributeNode!="function"||typeof S.getAttributeNode!="function"||typeof S.setAttribute!="function"||typeof S.namespaceURI!="string"||typeof S.insertBefore!="function"||typeof S.hasChildNodes!="function"||S.nodeType!==w(S)||S.childNodes!==y(S)},Ps=function(S){if(!w||typeof S!="object"||S===null)return!1;try{return w(S)===Xt.documentFragment}catch{return!1}},mc=function(S){if(!w||typeof S!="object"||S===null)return!1;try{return typeof w(S)=="number"}catch{return!1}};function ar(Y,S,N){Y.length!==0&&xs(Y,G=>{G.call(t,S,N,Bo)})}let A2=function(S,N){return!!(Me&&S.hasChildNodes()&&!mc(S.firstElementChild)&&Oi(eb,S.textContent)&&Oi(eb,S.innerHTML)||Me&&EB[N]&&T(S)===Xt.element&&B(S)===kt&&(mc(S.firstElementChild)||typeof S.textContent=="string"&&Oi(eb,S.textContent))||S.nodeType===Xt.processingInstruction||Me&&S.nodeType===Xt.comment&&Oi(wC,S.data))},Ed=function(S,N){if(S instanceof RegExp)return Oi(S,N);if(S instanceof Function){for(var G=arguments.length,j=new Array(G>2?G-2:0),pe=2;pe=0;--Be){let Jt=S===G?h(pe[Be],!0):pe[Be];j.insertBefore(Jt,_(S))}}}return Bs(S),!0},yy=function(S,N,G,j){return S.length===0?N:N===G||N===j?Rn(N):N},Ho=function(S,N){return S===N||m(S)!==null?!1:(fc&&rm(S),!0)},lm=function(S,N){if(T2(S),ar(te.beforeSanitizeElements,S,null),Ho(S,N))return!0;if(xd(S))return Bs(S),!0;let G=Ut(A(S));if(fe=yy(te.uponSanitizeElement,fe,li,Is),ar(te.uponSanitizeElement,S,{tagName:G,allowedTags:fe}),Ho(S,N))return!0;if(A2(S,G))return Bs(S),!0;if(Fe[G]||!(Gt.tagCheck instanceof Function&&Gt.tagCheck(G))&&!fe[G]){let j=M2(S,G,N);return j===!1&&(ar(te.afterSanitizeElements,S,null),Ho(S,N))?!0:j}if(T(S)===Xt.element&&!w2(S)||(G==="noscript"||G==="noembed"||G==="noframes")&&Oi(xB,S.innerHTML))return Bs(S),!0;if(ve&&S.nodeType===Xt.text){let j=wd(S.textContent);S.textContent!==j&&(Ou(t.removed,{element:S.cloneNode()}),S.textContent=j)}return ar(te.afterSanitizeElements,S,null),Ho(S,N)},Sy=function(S,N,G){if(Un[N]||_y(N,S)||Do&&(N==="id"||N==="name")&&(G in i||G in v2))return!1;let j=se[N]||Gt.attributeCheck instanceof Function&&Gt.attributeCheck(N,S);return xr&&Oi(yt,N)||ts&&Oi(Hn,N)?!0:j?St[N]||Oi($t,Du(G,Ne,""))||(N==="src"||N==="xlink:href"||N==="href")&&S!=="script"&&pC(G,"data:")===0&&Ce[S]||ie&&!Oi(Ht,Du(G,Ne,""))?!0:!G:wy(S)&&Ed(Ye.tagNameCheck,S)&&Ed(Ye.attributeNameCheck,N,S)||N==="is"&&Ye.allowCustomizedBuiltInElements&&Ed(Ye.tagNameCheck,G)},O2=Ge({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),wy=function(S){return!O2[po(S)]&&Oi(gn,S)},R2=function(S,N,G,j){if(q&&typeof u=="object"&&typeof u.getAttributeType=="function"&&!G)switch(u.getAttributeType(S,N)){case"TrustedHTML":return D(j);case"TrustedScriptURL":return R(j)}return j},D2=function(S,N,G,j){try{return G?S.setAttributeNS(G,N,j):S.setAttribute(N,j),xd(S)?(Bs(S),!1):!0}catch{return Po(N,S),!1}},xy=function(S,N){return Me&&Oi(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,N)?!0:po(S)==="attributename"&&fC(N,"href")!==null},cm=function(S,N){if(ar(te.beforeSanitizeAttributes,S,null),Ho(S,N))return;let G=S.attributes;if(!G||xd(S))return;se=yy(te.uponSanitizeAttribute,se,Kt,is);let j={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:se,forceKeepAttr:void 0},pe=G.length,Se=Ut(S.nodeName);for(;pe--;){let Be=G[pe],Jt=Be.name,kr=Be.namespaceURI,Gi=Be.value,nn=Ut(Jt),Uo=Gi,rn=Jt==="value"?Uo:sB(Uo),Ey=!1;if(j.attrName=nn,j.attrValue=rn,j.keepAttr=!0,j.forceKeepAttr=void 0,ar(te.uponSanitizeAttribute,S,j),rn=j.attrValue,Lo&&(nn==="id"||nn==="name")&&pC(rn,Io)!==0&&(Po(Jt,S,Be),rn=Io+rn,Ey=!0),xy(Jt,rn)){Po(Jt,S,Be);continue}if(!j.forceKeepAttr){if(!j.keepAttr){Po(Jt,S,Be);continue}if(!de&&Oi(xC,rn)){Po(Jt,S,Be);continue}if(ve&&(rn=wd(rn)),!Sy(Se,nn,rn)){Po(Jt,S,Be);continue}rn=R2(Se,nn,kr,rn),rn!==Uo&&D2(S,Jt,kr,rn)&&Ey&&hC(t.removed)}}ar(te.afterSanitizeAttributes,S,null),Ho(S,N)},gc=function(S){let N=null,G=am(S);for(ar(te.beforeSanitizeShadowDOM,S,null);N=G.nextNode();)if(ar(te.uponSanitizeShadowNode,N,null),lm(N,S),cm(N,S),Ps(N.content)&&gc(N.content),T(N)===Xt.element){let j=v(N);Ps(j)&&(um(j),gc(j))}ve&&by(S),ar(te.afterSanitizeShadowDOM,S,null)},um=function(S){let N=[{node:S,shadow:null}];for(;N.length>0;){let G=N.pop();if(G.shadow){gc(G.shadow);continue}let j=G.node,pe=T(j)===Xt.element,Se=y(j);if(Se)for(let Be=Se.length-1;Be>=0;--Be)N.push({node:Se[Be],shadow:null});if(pe){let Be=k?k(j):null;if(typeof Be=="string"&&Ut(Be)==="template"){let Jt=j.content;Ps(Jt)&&N.push({node:Jt,shadow:null})}}if(pe){let Be=v(j);Ps(Be)&&N.push({node:null,shadow:Be},{node:Be,shadow:null})}}};return t.sanitize=function(Y){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},N=null,G=null,j=null,pe=null;if(Zp=!Y,Zp&&(Y=""),typeof Y!="string"&&!mc(Y)&&(Y=cB(Y),typeof Y!="string"))throw Es("dirty is not a string, aborting");if(!t.isSupported)return Y;Ii?(fe=Is,se=is):tm(S),(te.uponSanitizeElement.length>0||te.uponSanitizeAttribute.length>0)&&(fe=Rn(fe)),te.uponSanitizeAttribute.length>0&&(se=Rn(se)),t.removed=[];let Se=fc&&typeof Y!="string"&&mc(Y),Be=[],Jt=sr;if(Se){N2(Y);let nn=A(Y);if(typeof nn=="string"){let Uo=Ut(nn);if(!fe[Uo]||Fe[Uo])throw im(Y),Es("root node is forbidden and cannot be sanitized in-place")}if(xd(Y))throw im(Y),Es("root node is clobbered and cannot be sanitized in-place");Be=sm(Y),sr=jv()}else if(mc(Y))N=vy(""),G=N.ownerDocument.importNode(Y,!0),G.nodeType===Xt.element&&G.nodeName==="BODY"||G.nodeName==="HTML"?N=G:N.appendChild(G),um(N);else{if(!zs&&!ve&&!rt&&Y.indexOf("<")===-1)return q&&Ro?D(Y):Y;if(N=vy(Y),!N)return zs?null:Ro?H:""}N&&Mo&&Bs(N.firstChild);let kr=Se?Y:N;try{Se&&um(Y);let nn=am(kr);for(;j=nn.nextNode();)lm(j,kr),cm(j,kr),Ps(j.content)&&gc(j.content);Se&&k2(Y,Be)}catch(nn){throw Se&&(im(Y),gy(Y,Be)),nn}finally{sr=Jt}if(Se){if(gy(Y,Be))throw Es("a node selected for removal could not be safely returned; refusing to sanitize in place");return ve&&om(Y),Y}if(zs){if(ve&&om(N),Oo)for(pe=X.call(N.ownerDocument);N.firstChild;)pe.appendChild(N.firstChild);else pe=N;return(se.shadowroot||se.shadowrootmode)&&(pe=ge.call(n,pe,!0)),pe}let Gi=rt?N.outerHTML:N.innerHTML;return rt&&fe["!doctype"]&&N.ownerDocument&&N.ownerDocument.doctype&&N.ownerDocument.doctype.name&&Oi(SB,N.ownerDocument.doctype.name)&&(Gi=" -`+Gi),ve&&(Gi=wd(Gi)),q&&Ro?D(Gi):Gi},t.setConfig=function(){let Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};tm(Y),Ii=!0,Is=fe,is=se},t.clearConfig=function(){Bo=null,Ii=!1,Is=null,is=null,q=P,H=""},t.isValidAttribute=function(Y,S,N){Bo||tm({});let G=Ut(Y),j=Ut(S);return typeof N=="string"&&(xy(S,N)||!de&&Oi(xC,N))?!1:Sy(G,j,N)},t.addHook=function(Y,S){typeof S=="function"&&fn(te,Y)&&Ou(te[Y],S)},t.removeHook=function(Y,S){if(fn(te,Y)){if(S!==void 0){let N=iB(te[Y],S);return N===-1?void 0:rB(te[Y],N,1)[0]}return hC(te[Y])}},t.removeHooks=function(Y){fn(te,Y)&&(te[Y]=[])},t.removeAllHooks=function(){te=EC()},t}var kC,dC,tB,CC,TC,pi,Ri,Vl,NC,ib,nb,xs,iB,hC,Ou,nB,rB,Xl,jv,Yv,Ru,po,Vv,fC,Du,pC,sB,aB,oB,mC,gC,fn,Lu,Oi,Es,_C,Xv,Zv,hB,Qv,fB,vC,bC,Jv,yC,Uf,pB,mB,gB,_B,vB,SC,bB,yB,SB,wB,eb,wC,xB,xC,Xt,EB,kB,CB,EC,Sa,tb,OC,RC=ae(()=>{Hf.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Hf.prototype.next=function(e){return this._invoke("next",e)},Hf.prototype.throw=function(e){return this._invoke("throw",e)},Hf.prototype.return=function(e){return this._invoke("return",e)};kC=Object.entries,dC=Object.setPrototypeOf,tB=Object.isFrozen,CC=Object.getPrototypeOf,TC=Object.getOwnPropertyDescriptor,pi=Object.freeze,Ri=Object.seal,Vl=Object.create,NC=typeof Reflect<"u"&&Reflect,ib=NC.apply,nb=NC.construct;pi||(pi=function(t){return t});Ri||(Ri=function(t){return t});ib||(ib=function(t,i){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s1?i-1:0),r=1;r"u"?null:At(BigInt.prototype.toString),gC=typeof Symbol>"u"?null:At(Symbol.prototype.toString),fn=At(Object.prototype.hasOwnProperty),Lu=At(Object.prototype.toString),Oi=At(RegExp.prototype.test),Es=AC(TypeError);_C=pi(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Xv=pi(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Zv=pi(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),hB=pi(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Qv=pi(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),fB=pi(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),vC=pi(["#text"]),bC=pi(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Jv=pi(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),yC=pi(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Uf=pi(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),pB=Ri(/{{[\w\W]*|^[\w\W]*}}/g),mB=Ri(/<%[\w\W]*|^[\w\W]*%>/g),gB=Ri(/\${[\w\W]*/g),_B=Ri(/^data-[\-\w.\u00B7-\uFFFF]+$/),vB=Ri(/^aria-[\-\w]+$/),SC=Ri(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),bB=Ri(/^(?:\w+script|data):/i),yB=Ri(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),SB=Ri(/^html$/i),wB=Ri(/^[a-z][.\w]*(-[.\w]+)+$/i),eb=Ri(/<[/\w!]/g),wC=Ri(/<[/\w]/g),xB=Ri(/<\/no(script|embed|frames)/i),xC=Ri(/\/>/i),Xt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},EB=pi(Ge({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),kB=function(){return typeof window>"u"?null:window},CB=function(t,i){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null,r="data-tt-policy-suffix";i&&i.hasAttribute(r)&&(n=i.getAttribute(r));let s="dompurify"+(n?"#"+n:"");try{return t.createPolicy(s,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},EC=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Sa=function(t,i,n,r){return fn(t,i)&&Xl(t[i])?Ge(r.base?Rn(r.base):{},t[i],r.transform):n},tb=function(t,i,n){let r=fn(t,i)?t[i]:void 0;return r&&typeof r=="object"?Rn(r):n()};OC=MC()});var QC=we((N7,ZC)=>{function HC(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let i=e[t],n=typeof i;(n==="object"||n==="function")&&!Object.isFrozen(i)&&HC(i)}),e}var Ff=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function UC(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function wa(e,...t){let i=Object.create(null);for(let n in e)i[n]=e[n];return t.forEach(function(n){for(let r in n)i[r]=n[r]}),i}var TB="
",DC=e=>!!e.scope,NB=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){let i=e.split(".");return[`${t}${i.shift()}`,...i.map((n,r)=>`${n}${"_".repeat(r+1)}`)].join(" ")}return`${t}${e}`},sb=class{constructor(t,i){this.buffer="",this.classPrefix=i.classPrefix,t.walk(this)}addText(t){this.buffer+=UC(t)}openNode(t){if(!DC(t))return;let i=NB(t.scope,{prefix:this.classPrefix});this.span(i)}closeNode(t){DC(t)&&(this.buffer+=TB)}value(){return this.buffer}span(t){this.buffer+=``}},LC=(e={})=>{let t={children:[]};return Object.assign(t,e),t},ab=class e{constructor(){this.rootNode=LC(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){let i=LC({scope:t});this.add(i),this.stack.push(i)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,i){return typeof i=="string"?t.addText(i):i.children&&(t.openNode(i),i.children.forEach(n=>this._walk(t,n)),t.closeNode(i)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(i=>typeof i=="string")?t.children=[t.children.join("")]:t.children.forEach(i=>{e._collapse(i)}))}},ob=class extends ab{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,i){let n=t.root;i&&(n.scope=`language:${i}`),this.add(n)}toHTML(){return new sb(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Iu(e){return e?typeof e=="string"?e:e.source:null}function qC(e){return go("(?=",e,")")}function AB(e){return go("(?:",e,")*")}function MB(e){return go("(?:",e,")?")}function go(...e){return e.map(i=>Iu(i)).join("")}function OB(e){let t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function $f(...e){return"("+(OB(e).capture?"":"?:")+e.map(n=>Iu(n)).join("|")+")"}function FC(e){return new RegExp(e.toString()+"|").exec("").length-1}function RB(e,t){let i=e&&e.exec(t);return i&&i.index===0}var DB=new RegExp($f(/\[(?:[^\\\]]|\\.)*\]/,/\(\?<(?![=!])[^>]+>/,/\(\?'[^']+'/,/\(\??/,/\\([1-9][0-9]*)/,/\\./));function cb(e,{joinWith:t}){let i=0;return e.map(n=>{i+=1;let r=i,s=Iu(n),a="";for(;s.length>0;){let o=DB.exec(s);if(!o){a+=s;break}a+=s.substring(0,o.index),s=s.substring(o.index+o[0].length),o[0][0]==="\\"&&o[1]?a+="\\"+String(Number(o[1])+r):(a+=o[0],(o[0]==="("||/^\(\?[<']/.test(o[0]))&&i++)}return a}).map(n=>`(${n})`).join(t)}var LB=/\b\B/,WC="[a-zA-Z]\\w*",ub="[a-zA-Z_]\\w*",$C="\\b\\d+(\\.\\d+)?",KC="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",GC="\\b(0b[01]+)",IB="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",zB=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=go(t,/.*\b/,e.binary,/\b.*/)),wa({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(i,n)=>{i.index!==0&&n.ignoreMatch()}},e)},zu={begin:"\\\\[\\s\\S]",relevance:0},BB={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[zu]},PB={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[zu]},HB={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/},Kf=function(e,t,i={}){let n=wa({scope:"comment",begin:e,end:t,contains:[]},i);n.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let r=$f("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 n.contains.push({begin:go(/[ ]+/,"(",r,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),n},UB=Kf("//","$"),qB=Kf("/\\*","\\*/"),FB=Kf("#","$"),WB={scope:"number",begin:$C,relevance:0},$B={scope:"number",begin:KC,relevance:0},KB={scope:"number",begin:GC,relevance:0},GB={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[zu,{begin:/\[/,end:/\]/,relevance:0,contains:[zu]}]},jB={scope:"title",begin:WC,relevance:0},YB={scope:"title",begin:ub,relevance:0},VB={begin:"\\.\\s*"+ub,relevance:0},XB=function(e){return Object.assign(e,{"on:begin":(t,i)=>{i.data._beginMatch=t[1]},"on:end":(t,i)=>{i.data._beginMatch!==t[1]&&i.ignoreMatch()}})},qf=Object.freeze({__proto__:null,APOS_STRING_MODE:BB,BACKSLASH_ESCAPE:zu,BINARY_NUMBER_MODE:KB,BINARY_NUMBER_RE:GC,COMMENT:Kf,C_BLOCK_COMMENT_MODE:qB,C_LINE_COMMENT_MODE:UB,C_NUMBER_MODE:$B,C_NUMBER_RE:KC,END_SAME_AS_BEGIN:XB,HASH_COMMENT_MODE:FB,IDENT_RE:WC,MATCH_NOTHING_RE:LB,METHOD_GUARD:VB,NUMBER_MODE:WB,NUMBER_RE:$C,PHRASAL_WORDS_MODE:HB,QUOTE_STRING_MODE:PB,REGEXP_MODE:GB,RE_STARTERS_RE:IB,SHEBANG:zB,TITLE_MODE:jB,UNDERSCORE_IDENT_RE:ub,UNDERSCORE_TITLE_MODE:YB});function ZB(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function QB(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function JB(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=ZB,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function e5(e,t){Array.isArray(e.illegal)&&(e.illegal=$f(...e.illegal))}function t5(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function i5(e,t){e.relevance===void 0&&(e.relevance=1)}var n5=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");let i=Object.assign({},e);Object.keys(e).forEach(n=>{delete e[n]}),e.keywords=i.keywords,e.begin=go(i.beforeMatch,qC(i.begin)),e.starts={relevance:0,contains:[Object.assign(i,{endsParent:!0})]},e.relevance=0,delete i.beforeMatch},r5=["of","and","for","in","not","or","if","then","parent","list","value"],s5="keyword";function jC(e,t,i=s5){let n=Object.create(null);return typeof e=="string"?r(i,e.split(" ")):Array.isArray(e)?r(i,e):Object.keys(e).forEach(function(s){Object.assign(n,jC(e[s],t,s))}),n;function r(s,a){t&&(a=a.map(o=>o.toLowerCase())),a.forEach(function(o){let l=o.split("|");n[l[0]]=[s,a5(l[0],l[1])]})}}function a5(e,t){return t?Number(t):o5(e)?0:1}function o5(e){return r5.includes(e.toLowerCase())}var IC={},mo=e=>{console.error(e)},zC=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Zl=(e,t)=>{IC[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),IC[`${e}/${t}`]=!0)},Wf=new Error;function YC(e,t,{key:i}){let n=0,r=e[i],s={},a={};for(let o=1;o<=t.length;o++)a[o+n]=r[o],s[o+n]=!0,n+=FC(t[o-1]);e[i]=a,e[i]._emit=s,e[i]._multi=!0}function l5(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw mo("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Wf;if(typeof e.beginScope!="object"||e.beginScope===null)throw mo("beginScope must be object"),Wf;YC(e,e.begin,{key:"beginScope"}),e.begin=cb(e.begin,{joinWith:""})}}function c5(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw mo("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Wf;if(typeof e.endScope!="object"||e.endScope===null)throw mo("endScope must be object"),Wf;YC(e,e.end,{key:"endScope"}),e.end=cb(e.end,{joinWith:""})}}function u5(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function d5(e){u5(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),l5(e),c5(e)}function h5(e){function t(a,o){return new RegExp(Iu(a),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(o?"g":""))}class i{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(o,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,o]),this.matchAt+=FC(o)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let o=this.regexes.map(l=>l[1]);this.matcherRe=t(cb(o,{joinWith:"|"}),!0),this.lastIndex=0}exec(o){this.matcherRe.lastIndex=this.lastIndex;let l=this.matcherRe.exec(o);if(!l)return null;let c=l.findIndex((d,h)=>h>0&&d!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class n{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(o){if(this.multiRegexes[o])return this.multiRegexes[o];let l=new i;return this.rules.slice(o).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[o]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(o,l){this.rules.push([o,l]),l.type==="begin"&&this.count++}exec(o){let l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(o);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){let u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(o)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function r(a){let o=new n;return a.contains.forEach(l=>o.addRule(l.begin,{rule:l,type:"begin"})),a.terminatorEnd&&o.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&o.addRule(a.illegal,{type:"illegal"}),o}function s(a,o){let l=a;if(a.isCompiled)return l;[QB,t5,d5,n5].forEach(u=>u(a,o)),e.compilerExtensions.forEach(u=>u(a,o)),a.__beforeBegin=null,[JB,e5,i5].forEach(u=>u(a,o)),a.isCompiled=!0;let c=null;return typeof a.keywords=="object"&&a.keywords.$pattern&&(a.keywords=Object.assign({},a.keywords),c=a.keywords.$pattern,delete a.keywords.$pattern),c=c||/\w+/,a.keywords&&(a.keywords=jC(a.keywords,e.case_insensitive)),l.keywordPatternRe=t(c,!0),o&&(a.begin||(a.begin=/\B|\b/),l.beginRe=t(l.begin),!a.end&&!a.endsWithParent&&(a.end=/\B|\b/),a.end&&(l.endRe=t(l.end)),l.terminatorEnd=Iu(l.end)||"",a.endsWithParent&&o.terminatorEnd&&(l.terminatorEnd+=(a.end?"|":"")+o.terminatorEnd)),a.illegal&&(l.illegalRe=t(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(u){return f5(u==="self"?a:u)})),a.contains.forEach(function(u){s(u,l)}),a.starts&&s(a.starts,o),l.matcher=r(l),l}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=wa(e.classNameAliases||{}),s(e)}function VC(e){return e?e.endsWithParent||VC(e.starts):!1}function f5(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return wa(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:VC(e)?wa(e,{starts:e.starts?wa(e.starts):null}):Object.isFrozen(e)?wa(e):e}var p5="11.12.0",lb=class extends Error{constructor(t,i){super(t),this.name="HTMLInjectionError",this.html=i}},rb=UC,BC=wa,PC=Symbol("nomatch"),m5=7,XC=function(e){let t=Object.create(null),i=Object.create(null),n=[],r=!0,s="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]},o={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:ob};function l(C){return o.noHighlightRe.test(C)}function c(C){let D=C.className+" ";D+=C.parentNode?C.parentNode.className:"";let R=o.languageDetectRe.exec(D);if(R){let V=A(R[1]);return V||(zC(s.replace("{}",R[1])),zC("Falling back to no-highlight mode for this block.",C)),V?R[1]:"no-highlight"}return D.split(/\s+/).find(V=>l(V)||A(V))}function u(C,D,R){let V="",z="";typeof D=="object"?(V=C,R=D.ignoreIllegals,z=D.language):(Zl("10.7.0","highlight(lang, code, ...args) has been deprecated."),Zl("10.7.0",`Please use highlight(code, options) instead. -https://github.com/highlightjs/highlight.js/issues/2277`),z=C,V=D),R===void 0&&(R=!0);let L={code:V,language:z};x("before:highlight",L);let K=L.result?L.result:d(L.language,L.code,R);return K.code=L.code,x("after:highlight",K),K}function d(C,D,R,V){let z=Object.create(null);function L(ie,de){return ie.keywords[de]}function K(){if(!se.keywords){Ye.addText(Fe);return}let ie=0;se.keywordPatternRe.lastIndex=0;let de=se.keywordPatternRe.exec(Fe),ve="";for(;de;){ve+=Fe.substring(ie,de.index);let Me=$t.case_insensitive?de[0].toLowerCase():de[0],rt=L(se,Me);if(rt){let[Ii,Is]=rt;if(Ye.addText(ve),ve="",z[Me]=(z[Me]||0)+1,z[Me]<=m5&&(Un+=Is),Ii.startsWith("_"))ve+=de[0];else{let is=$t.classNameAliases[Ii]||Ii;ge(de[0],is)}}else ve+=de[0];ie=se.keywordPatternRe.lastIndex,de=se.keywordPatternRe.exec(Fe)}ve+=Fe.substring(ie),Ye.addText(ve)}function X(){if(Fe==="")return;let ie=null;if(typeof se.subLanguage=="string"){if(!t[se.subLanguage]){Ye.addText(Fe);return}ie=d(se.subLanguage,Fe,!0,Kt[se.subLanguage]),Kt[se.subLanguage]=ie._top}else ie=f(Fe,se.subLanguage.length?se.subLanguage:null);se.relevance>0&&(Un+=ie.relevance),Ye.__addSublanguage(ie._emitter,ie.language)}function oe(){se.subLanguage!=null?X():K(),Fe=""}function ge(ie,de){ie!==""&&(Ye.startScope(de),Ye.addText(ie),Ye.endScope())}function te(ie,de){let ve=1,Me=de.length-1;for(;ve<=Me;){if(!ie._emit[ve]){ve++;continue}let rt=$t.classNameAliases[ie[ve]]||ie[ve],Ii=de[ve];rt?ge(Ii,rt):(Fe=Ii,K(),Fe=""),ve++}}function We(ie,de){return ie.scope&&typeof ie.scope=="string"&&Ye.openNode($t.classNameAliases[ie.scope]||ie.scope),ie.beginScope&&(ie.beginScope._wrap?(ge(Fe,$t.classNameAliases[ie.beginScope._wrap]||ie.beginScope._wrap),Fe=""):ie.beginScope._multi&&(te(ie.beginScope,de),Fe="")),se=Object.create(ie,{parent:{value:se}}),se}function Ki(ie,de,ve){let Me=RB(ie.endRe,ve);if(Me){if(ie["on:end"]){let rt=new Ff(ie);ie["on:end"](de,rt),rt.isMatchIgnored&&(Me=!1)}if(Me){for(;ie.endsParent&&ie.parent;)ie=ie.parent;return ie}}if(ie.endsWithParent)return Ki(ie.parent,de,ve)}function oi(ie){return se.matcher.regexIndex===0?(Fe+=ie[0],1):(xr=!0,0)}function yt(ie){let de=ie[0],ve=ie.rule,Me=new Ff(ve),rt=[ve.__beforeBegin,ve["on:begin"]];for(let Ii of rt)if(Ii&&(Ii(ie,Me),Me.isMatchIgnored))return oi(de);return ve.skip?Fe+=de:(ve.excludeBegin&&(Fe+=de),oe(),!ve.returnBegin&&!ve.excludeBegin&&(Fe=de)),We(ve,ie),ve.returnBegin?0:de.length}function Hn(ie){let de=ie[0],ve=D.substring(ie.index),Me=Ki(se,ie,ve);if(!Me)return PC;let rt=se;se.endScope&&se.endScope._wrap?(oe(),ge(de,se.endScope._wrap)):se.endScope&&se.endScope._multi?(oe(),te(se.endScope,ie)):rt.skip?Fe+=de:(rt.returnEnd||rt.excludeEnd||(Fe+=de),oe(),rt.excludeEnd&&(Fe=de));do se.scope&&Ye.closeNode(),!se.skip&&!se.subLanguage&&(Un+=se.relevance),se=se.parent;while(se!==Me.parent);return Me.starts&&We(Me.starts,ie),rt.returnEnd?0:de.length}function Ht(){let ie=[];for(let de=se;de!==$t;de=de.parent)de.scope&&ie.unshift(de.scope);ie.forEach(de=>Ye.openNode(de))}let Ne={};function gn(ie,de){let ve=de&&de[0];if(Fe+=ie,ve==null)return oe(),0;if(Ne.type==="begin"&&de.type==="end"&&Ne.index===de.index&&ve===""){if(Fe+=D.slice(de.index,de.index+1),!r){let Me=new Error(`0 width match regex (${C})`);throw Me.languageName=C,Me.badRule=Ne.rule,Me}return 1}if(Ne=de,de.type==="begin")return yt(de);if(de.type==="illegal"&&!R){let Me=new Error('Illegal lexeme "'+ve+'" for mode "'+(se.scope||"")+'"');throw Me.mode=se,Me}else if(de.type==="end"){let Me=Hn(de);if(Me!==PC)return Me}if(de.type==="illegal"&&ve==="")return de.index===D.length||(Fe+=` -`),1;if(ts>1e5&&ts>de.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Fe+=ve,ve.length}let $t=A(C);if(!$t)throw mo(s.replace("{}",C)),new Error('Unknown language: "'+C+'"');let fe=h5($t),li="",se=V||fe,Kt={},Ye=new o.__emitter(o);Ht();let Fe="",Un=0,Gt=0,ts=0,xr=!1;try{if($t.__emitTokens)$t.__emitTokens(D,Ye);else{for(se.matcher.considerAll();;){ts++,xr?xr=!1:se.matcher.considerAll(),se.matcher.lastIndex=Gt;let ie=se.matcher.exec(D);if(!ie)break;let de=D.substring(Gt,ie.index),ve=gn(de,ie);Gt=ie.index+ve}gn(D.substring(Gt))}return Ye.finalize(),li=Ye.toHTML(),{language:C,value:li,relevance:Un,illegal:!1,_emitter:Ye,_top:se}}catch(ie){if(ie.message&&ie.message.includes("Illegal"))return{language:C,value:rb(D),illegal:!0,relevance:0,_illegalBy:{message:ie.message,index:Gt,context:D.slice(Gt-100,Gt+100),mode:ie.mode,resultSoFar:li},_emitter:Ye};if(r)return{language:C,value:rb(D),illegal:!1,relevance:0,errorRaised:ie,_emitter:Ye,_top:se};throw ie}}function h(C){let D={value:rb(C),illegal:!1,relevance:0,_top:a,_emitter:new o.__emitter(o)};return D._emitter.addText(C),D}function f(C,D){D=D||o.languages||Object.keys(t);let R=h(C),V=D.filter(A).filter(B).map(oe=>d(oe,C,!1));V.unshift(R);let z=V.sort((oe,ge)=>{if(oe.relevance!==ge.relevance)return ge.relevance-oe.relevance;if(oe.language&&ge.language){if(A(oe.language).supersetOf===ge.language)return 1;if(A(ge.language).supersetOf===oe.language)return-1}return 0}),[L,K]=z,X=L;return X.secondBest=K,X}function p(C,D,R){let V=D&&i[D]||R;C.classList.add("hljs"),C.classList.add(`language-${V}`)}function _(C){let D=null,R=c(C);if(l(R))return;if(x("before:highlightElement",{el:C,language:R}),C.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",C);return}if(C.children.length>0&&(o.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(C)),o.throwUnescapedHTML))throw new lb("One of your code blocks includes unescaped HTML.",C.innerHTML);D=C;let V=D.textContent,z=R?u(V,{language:R,ignoreIllegals:!0}):f(V);C.innerHTML=z.value,C.dataset.highlighted="yes",p(C,R,z.language),C.result={language:z.language,re:z.relevance,relevance:z.relevance},z.secondBest&&(C.secondBest={language:z.secondBest.language,relevance:z.secondBest.relevance}),x("after:highlightElement",{el:C,result:z,text:V})}function y(C){o=BC(o,C)}let m=()=>{w(),Zl("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function v(){w(),Zl("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let b=!1;function w(){function C(){w()}if(document.readyState==="loading"){b||window.addEventListener("DOMContentLoaded",C,!1),b=!0;return}document.querySelectorAll(o.cssSelector).forEach(_)}function k(C,D){let R=null;try{R=D(e)}catch(V){if(mo("Language definition for '{}' could not be registered.".replace("{}",C)),r)mo(V);else throw V;R=a}R.name||(R.name=C),t[C]=R,R.rawDefinition=D.bind(null,e),R.aliases&&I(R.aliases,{languageName:C})}function M(C){delete t[C];for(let D of Object.keys(i))i[D]===C&&delete i[D]}function T(){return Object.keys(t)}function A(C){return C=(C||"").toLowerCase(),t[C]||t[i[C]]}function I(C,{languageName:D}){typeof C=="string"&&(C=[C]),C.forEach(R=>{i[R.toLowerCase()]=D})}function B(C){let D=A(C);return D&&!D.disableAutodetect}function q(C){C["before:highlightBlock"]&&!C["before:highlightElement"]&&(C["before:highlightElement"]=D=>{C["before:highlightBlock"](Object.assign({block:D.el},D))}),C["after:highlightBlock"]&&!C["after:highlightElement"]&&(C["after:highlightElement"]=D=>{C["after:highlightBlock"](Object.assign({block:D.el},D))})}function H(C){q(C),n.push(C)}function P(C){let D=n.indexOf(C);D!==-1&&n.splice(D,1)}function x(C,D){let R=C;n.forEach(function(V){V[R]&&V[R](D)})}function U(C){return Zl("10.7.0","highlightBlock will be removed entirely in v12.0"),Zl("10.7.0","Please use highlightElement now."),_(C)}Object.assign(e,{highlight:u,highlightAuto:f,highlightAll:w,highlightElement:_,highlightBlock:U,configure:y,initHighlighting:m,initHighlightingOnLoad:v,registerLanguage:k,unregisterLanguage:M,listLanguages:T,getLanguage:A,registerAliases:I,autoDetection:B,inherit:BC,addPlugin:H,removePlugin:P}),e.debugMode=function(){r=!1},e.safeMode=function(){r=!0},e.versionString=p5,e.regex={concat:go,lookahead:qC,either:$f,optional:MB,anyNumberOfTimes:AB};for(let C in qf)typeof qf[C]=="object"&&HC(qf[C]);return Object.assign(e,qf),e},Ql=XC({});Ql.newInstance=()=>XC({});ZC.exports=Ql;Ql.HighlightJS=Ql;Ql.default=Ql});var eT=we((A7,JC)=>{function g5(e){let t=e.regex,i=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),n=/[\p{L}0-9._:-]+/u,r={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},a=e.inherit(s,{begin:/\(/,end:/\)/}),o=e.inherit(e.APOS_STRING_MODE,{className:"string"}),l=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),c={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:[s,l,o,a,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[s,a,l,o]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},r,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:"css"}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:"javascript"}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:i,relevance:0,starts:c}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(i,/>/))),contains:[{className:"name",begin:i,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}JC.exports=g5});var iT=we((M7,tT)=>{function _5(e){let t=e.regex,i={},n={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[i]}]};Object.assign(i,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},n]});let r={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},s=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),a={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,i,r]};r.contains.push(o);let l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,i]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=e.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),p={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},_=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],y=["true","false"],m={match:/(\/[a-z._-]+)+/},v=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],b=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],w=["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:_,literal:y,built_in:[...v,...b,"set","shopt",...w,...k]},contains:[f,e.SHEBANG(),p,d,s,a,m,o,l,c,u,i]}}tT.exports=_5});var rT=we((O7,nT)=>{function v5(e){let t=e.regex,i=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),n="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",a="("+n+"|"+t.optional(r)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",o=t.concat(/\batomic_/,t.either("bool","char","schar","uchar","short","ushort","int","uint","long","ulong","llong","ullong","char16_t","char32_t","wchar_t","int_least8_t","uint_least8_t","int_least16_t","uint_least16_t","int_least32_t","uint_least32_t","int_least64_t","uint_least64_t","int_fast8_t","uint_fast8_t","int_fast16_t","uint_fast16_t","int_fast32_t","uint_fast32_t","int_fast64_t","uint_fast64_t","intptr_t","uintptr_t","size_t","ptrdiff_t","intmax_t","uintmax_t"),/\b/),l={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:o}]},u={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"([^()\\\s"]{0,16})\(/,end:/\)([^()\\\s"]{0,16})"/})]},d={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},h={scope:"meta",begin:/#\s*include\b/,end:/$/,keywords:{keyword:"include"},contains:[{begin:/\\\n/},u,{scope:"string",begin:/<.*?>/},i,e.C_BLOCK_COMMENT_MODE]},f={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(u,{className:"string"}),i,e.C_BLOCK_COMMENT_MODE]},p=[h,f],_={className:"title",begin:t.optional(r)+e.IDENT_RE,relevance:0},y=t.optional(r)+e.IDENT_RE+"\\s*\\(",m=12,w={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"},k=[...p,l,i,e.C_BLOCK_COMMENT_MODE,d,u],M={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:w,contains:k.concat([{begin:/\(/,end:/\)/,keywords:w,contains:k.concat(["self"]),relevance:0}]),relevance:0},T={begin:"("+a+"[\\*&\\s]+){1,"+m+"}"+y,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:n,keywords:w,relevance:0},{begin:y,returnBegin:!0,contains:[e.inherit(_,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[i,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:["self",i,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,i,e.C_BLOCK_COMMENT_MODE,...p]};return{name:"C",aliases:["h"],keywords:w,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:w}}}nT.exports=v5});var aT=we((R7,sT)=>{function b5(e){let t=e.regex,i=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),n="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",a="(?!struct)("+n+"|"+t.optional(r)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",o={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={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"([^()\\\s"]{0,16})\(/,end:/\)([^()\\\s"]{0,16})"/})]},u={className:"number",variants:[{begin:"[+-]?(?:(?:\\b[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|\\b[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|\\b0[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},d={scope:"meta",begin:/#\s*include\b/,end:/$/,keywords:{keyword:"include"},contains:[{begin:/\\\n/},c,{scope:"string",begin:/<.*?>/},i,e.C_BLOCK_COMMENT_MODE]},h={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(c,{className:"string"}),i,e.C_BLOCK_COMMENT_MODE]},f=[d,h],p={className:"title",begin:t.optional(r)+e.IDENT_RE,relevance:0},_=t.optional(r)+e.IDENT_RE+"\\s*\\(",y=12,m=["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"],v=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],b=["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"],T={type:v,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:b},A={className:"function.dispatch",relevance:0,keywords:{_hint:w},begin:t.concat(/\b/,`(?!${m.join("|")})`,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},I=[A,...f,o,i,e.C_BLOCK_COMMENT_MODE,u,c],B={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:T,contains:I.concat([{begin:/\(/,end:/\)/,keywords:T,contains:I.concat(["self"]),relevance:0}]),relevance:0},q={className:"function",begin:"("+a+"[\\*&\\s]+){1,"+y+"}"+_,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:T,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:n,keywords:T,relevance:0},{begin:_,returnBegin:!0,contains:[p],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:[i,e.C_BLOCK_COMMENT_MODE,c,u,o,{begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:["self",i,e.C_BLOCK_COMMENT_MODE,c,u,o]}]},o,i,e.C_BLOCK_COMMENT_MODE,...f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:T,illegal:"",keywords:T,contains:["self",o]},{begin:e.IDENT_RE+"::",keywords:T},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}sT.exports=b5});var lT=we((D7,oT)=>{function y5(e){let t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],i=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],n=["default","false","null","true"],r=["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"],s=["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"],a={keyword:r.concat(s),built_in:t,literal:n},o=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l="\\d(_*\\d)*",c="([uU][lL]?|[lL][uU]?)?",d={className:"number",variants:[{begin:"\\b0[bB]_*[01](_*[01])*"+c},{begin:"(-?)\\b0[xX]_*[a-fA-F0-9](_*[a-fA-F0-9])*"+c},{begin:"(-?)(\\b"+l+"(\\.("+l+")?)?|\\."+l+")([eE][-+]?"+l+")?"+"([fFdDmM]|[uU][lL]?|[lL][uU]?)?"}],relevance:0},h={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},f={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},p=e.inherit(f,{illegal:/\n/}),_={className:"subst",begin:/\{/,end:/\}/,keywords:a},y=e.inherit(_,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,y]},v={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},_]},b=e.inherit(v,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},y]});_.contains=[v,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,d,e.C_BLOCK_COMMENT_MODE],y.contains=[b,m,p,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,d,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let w={variants:[h,v,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},k={begin:"<",end:">",contains:[{beginKeywords:"in out"},o]},M=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",T={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:a,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,d,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},o,k,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[o,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[o,k,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:"("+M+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:a,contains:[{beginKeywords:i.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,k],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,relevance:0,contains:[w,d,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},T]}}oT.exports=y5});var uT=we((L7,cT)=>{var S5=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/},UNICODE_RANGE:{scope:"number",begin:/\b[Uu]\+[0-9A-Fa-f][0-9A-Fa-f?]{0,5}(-[0-9A-Fa-f][0-9A-Fa-f]{0,5})?/},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_-]*/}}),w5=["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"],x5=["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"],E5=[...w5,...x5],k5=["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(),C5=["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(),T5=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),N5=["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","corner-bottom-left-shape","corner-bottom-right-shape","corner-shape","corner-top-left-shape","corner-top-right-shape","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","unicode-range","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 A5(e){let t=e.regex,i=S5(e),n={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},r="and or not only",s=/@-?\w[\w]*(-\w+)*/,a="[a-zA-Z-][a-zA-Z0-9_-]*",o=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[i.BLOCK_COMMENT,n,i.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+a,relevance:0},i.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+C5.join("|")+")"},{begin:":(:)?("+T5.join("|")+")"}]},i.CSS_VARIABLE,{className:"attribute",begin:"\\b("+N5.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[i.BLOCK_COMMENT,i.HEXCOLOR,i.IMPORTANT,i.CSS_NUMBER_MODE,i.UNICODE_RANGE,...o,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...o,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},i.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:r,attribute:k5.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...o,i.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+E5.join("|")+")\\b"}]}}cT.exports=A5});var hT=we((I7,dT)=>{function M5(e){let t=e.regex,i={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},n={match:/^ {0,3}([-*_])[ \t]*(?:\1[ \t]*){2,}$/},r={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}]},s={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},a={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},o=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,o,/:\/\/.*?\)/),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}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},u={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},d=e.inherit(c,{contains:[]}),h=e.inherit(u,{contains:[]});c.contains.push(h),u.contains.push(d);let f=[i,l];return[c,u,d,h].forEach(m=>{m.contains=m.contains.concat(f)}),f=f.concat(c,u),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:f},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:f}]}]},i,s,n,c,u,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},r,l,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}dT.exports=M5});var pT=we((z7,fT)=>{function O5(e){let t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^@@ +-\d+ +\+\d+,\d+ +@@/,/^@@ +-\d+,\d+ +\+\d+ +@@/,/^@@ +-\d+ +\+\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}fT.exports=O5});var gT=we((B7,mT)=>{function R5(e){let t=e.regex,i="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",n=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),r=t.concat(n,/(::\w+)*/),a={"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"]},o={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},c=[e.COMMENT("#","$",{contains:[o]}),e.COMMENT("^=begin","^=end",{contains:[o],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],u={className:"subst",begin:/#\{/,end:/\}/,keywords:a},d={className:"string",contains:[e.BACKSLASH_ESCAPE,u],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:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,u]})]}]},h="[1-9](_?[0-9])*|0",f="[0-9](_?[0-9])*",p={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${f}))?([eE][+-]?(${f})|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"}]},_={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},M=[d,{variants:[{match:[/class\s+/,r,/\s+<\s+/,r]},{match:[/\b(class|module)\s+/,r]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:a},{match:[/(include|extend)\s+/,r],scope:{2:"title.class"},keywords:a},{relevance:0,match:[r,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:n,scope:"title.class"},{match:[/def/,/\s+/,i],scope:{1:"keyword",3:"title.function"},contains:[_]},{begin:"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[d,{begin:i}],relevance:0},p,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:a},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,u],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(l,c),relevance:0}].concat(l,c);u.contains=M,_.contains=M;let B=[{begin:/^\s*=>/,starts:{end:"$",contains:M}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:a,contains:M}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(B).concat(c).concat(M)}}mT.exports=R5});var vT=we((P7,_T)=>{function D5(e){let s={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:s,illegal:"{function L5(e){let t=e.regex,i=/[_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:t.concat(i,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}bT.exports=L5});var wT=we((U7,ST)=>{function I5(e){let t=e.regex,i={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},n=e.COMMENT();n.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];let r={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},s={className:"literal",begin:/\bon|off|true|false|yes|no\b/},a={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},o={begin:/\[/,end:/\]/,contains:[n,s,r,a,i,"self"],relevance:0},l=/[A-Za-z0-9_-]+/,c=/"(\\"|[^"])*"/,u=/'[^']*'/,d=t.either(l,c,u),h=t.concat(d,"(\\s*\\.\\s*",d,")*",t.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[n,{className:"section",begin:/\[+/,end:/\]+/},{begin:h,className:"attr",starts:{end:/$/,contains:[n,o,s,r,a,i]}}]}}ST.exports=I5});var CT=we((q7,kT)=>{var Jl="[0-9](_*[0-9])*",Gf=`\\.(${Jl})`,jf="[0-9a-fA-F](_*[0-9a-fA-F])*",xT={className:"number",variants:[{begin:`(\\b(${Jl})((${Gf})|\\.)?|(${Gf}))[eE][+-]?(${Jl})[fFdD]?\\b`},{begin:`\\b(${Jl})((${Gf})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Gf})[fFdD]?\\b`},{begin:`\\b(${Jl})[fFdD]\\b`},{begin:`\\b0[xX]((${jf})\\.?|(${jf})?\\.(${jf}))[pP][+-]?(${Jl})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${jf})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function ET(e,t,i){return i===-1?"":e.replace(t,n=>ET(e,t,i-1))}function z5(e){let t=e.regex,i="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",n="(?:(?:\\s*\\[\\s*])+)?",r=i+"<@@@>"+n,a="(?:"+("\\?(?:\\s+(?:extends|super)\\s+"+r+")?")+"|"+r+")",o=ET("(?:\\s*<\\s*"+a+"(?:\\s*,\\s*"+a+")*\\s*>)?",/<@@@>/g,2),h={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"]},f={className:"meta",begin:"@"+i,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},p={className:"params",begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:h,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+/,i],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{beginKeywords:"new throw return else yield assert",relevance:0},{begin:[i,t.concat(o,n,/\s+/),i,n,/\s*/,/=(?!=)/],className:{1:"type",3:"variable",6:"operator"}},{begin:[/record/,/\s+/,i],className:{1:"keyword",3:"title.class"},contains:[p,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{begin:[i,t.concat(o,n,/\s+/),i,/\s*(?=\()/],className:{1:"type",3:"title.function"},keywords:h,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,xT,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},xT,f]}}kT.exports=z5});var RT=we((F7,OT)=>{var TT="[A-Za-z$_][0-9A-Za-z$_]*",B5=["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"],P5=["true","false","null","undefined","NaN","Infinity"],NT=["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"],AT=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],MT=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],H5=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","self","global"],U5=[].concat(MT,NT,AT);function q5(e){let t=e.regex,i=(R,{after:V})=>{let z="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(R,V)=>{let z=R[0].length+R.index,L=R.input[z];if(L==="<"||L===","){V.ignoreMatch();return}L===">"&&(i(R,{after:z})||V.ignoreMatch());let K,X=R.input.substring(z);if(K=X.match(/^\s*=/)){V.ignoreMatch();return}if((K=X.match(/^\s+extends\s+/))&&K.index===0){V.ignoreMatch();return}}},o={$pattern:TT,keyword:B5,literal:P5,built_in:U5,"variable.language":H5},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\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},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},_={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},y={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},v={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:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,_,y,{match:/\$\d+/},d];h.contains=b.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(b)});let w=[].concat(v,h.contains),k=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(w)}]),M={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k},T={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,t.concat(n,"(",t.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}}]},A={relevance:0,match:t.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:{_:[...NT,...AT]}},I={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},B={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[M],illegal:/%/},q={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function H(R){return t.concat("(?!",R.join("|"),")")}let P={match:t.concat(/\b/,H([...MT,"super","import","await"].map(R=>`${R}\\s*\\(`)),n,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},x={begin:t.concat(/\./,t.lookahead(t.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},U={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},M]},C="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",D={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(C)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[M]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:A},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),I,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,_,y,v,{match:/\$\d+/},d,A,{scope:"attr",match:n+t.lookahead(":"),relevance:0},D,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,e.REGEXP_MODE,{className:"function",begin:C,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:o,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:s},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},B,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[M,e.inherit(e.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},x,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[M]},P,q,T,U,{match:/\$[(.]/}]}}OT.exports=q5});var LT=we((W7,DT)=>{var F5="([-+]?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)|NaN|[-+]?Infinity",W5={scope:"number",match:F5,relevance:0};function $5(e){let t={className:"attr",begin:/(("(\\.|[^\\"\r\n])*")|('(\\.|[^\\'\r\n])*'))(?=\s*:)/,relevance:1.01},i={match:/[{}[\],:]/,className:"punctuation",relevance:0},n=["true","false","null"],r={scope:"literal",beginKeywords:n.join(" ")};return{name:"JSON",aliases:["jsonc","json5"],keywords:{literal:n},contains:[t,i,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,r,W5,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}DT.exports=$5});var zT=we(($7,IT)=>{var ec="[0-9](_*[0-9])*",Yf=`\\.(${ec})`,Vf="[0-9a-fA-F](_*[0-9a-fA-F])*",K5={className:"number",variants:[{begin:`(\\b(${ec})((${Yf})|\\.)?|(${Yf}))[eE][+-]?(${ec})[fFdD]?\\b`},{begin:`\\b(${ec})((${Yf})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Yf})[fFdD]?\\b`},{begin:`\\b(${ec})[fFdD]\\b`},{begin:`\\b0[xX]((${Vf})\\.?|(${Vf})?\\.(${Vf}))[pP][+-]?(${ec})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Vf})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function G5(e){let t={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"},i={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},n={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},r={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},s={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},a={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[s,r]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,s,r]}]};r.contains.push(a);let o={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},l={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(a,{className:"string"}),"self"]}]},c=K5,u=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),d={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},h=d;return h.variants[1].contains=[d],d.variants[1].contains=[h],{name:"Kotlin",aliases:["kt","kts","ktm","ktx"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,u,i,n,o,l,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,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:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[d,e.C_LINE_COMMENT_MODE,u],relevance:0},e.C_LINE_COMMENT_MODE,u,o,l,a,e.C_NUMBER_MODE]},u]},{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},o,l]},a,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` -`},c]}}IT.exports=G5});var UT=we((K7,HT)=>{var j5=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/},UNICODE_RANGE:{scope:"number",begin:/\b[Uu]\+[0-9A-Fa-f][0-9A-Fa-f?]{0,5}(-[0-9A-Fa-f][0-9A-Fa-f]{0,5})?/},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_-]*/}}),Y5=["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"],V5=["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"],X5=[...Y5,...V5],Z5=["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(),BT=["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(),PT=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Q5=["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","corner-bottom-left-shape","corner-bottom-right-shape","corner-shape","corner-top-left-shape","corner-top-right-shape","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","unicode-range","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(),J5=BT.concat(PT).sort().reverse();function e4(e){let t=j5(e),i=J5,n="and or not only",r="[\\w-]+",s="("+r+"|@\\{"+r+"\\})",a=[],o=[],l=function(b){return{className:"string",begin:"~?"+b+".*?"+b}},c=function(b,w,k){return{className:b,begin:w,relevance:k}},u={$pattern:/[a-z-]+/,keyword:n,attribute:Z5.join(" ")},d={begin:"\\(",end:"\\)",contains:o,keywords:u,relevance:0};o.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,l("'"),l('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.UNICODE_RANGE,t.HEXCOLOR,d,c("variable","@@?"+r,10),c("variable","@\\{"+r+"\\}"),c("built_in","~?`[^`]*?`"),{className:"attribute",begin:r+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);let h=o.concat({begin:/\{/,end:/\}/,contains:a}),f={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(o)},p={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Q5.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:o}}]},_={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:u,returnEnd:!0,contains:o,relevance:0}},y={className:"variable",variants:[{begin:"@"+r+"\\s*:",relevance:15},{begin:"@"+r}],starts:{end:"[;}]",returnEnd:!0,contains:h}},m={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,f,c("keyword","all\\b"),c("variable","@\\{"+r+"\\}"),{begin:"\\b("+X5.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,c("selector-tag",s,0),c("selector-id","#"+s),c("selector-class","\\."+s,0),c("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+BT.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+PT.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},v={begin:r+`:(:)?(${i.join("|")})`,returnBegin:!0,contains:[m]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,_,y,v,p,m,f,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}HT.exports=e4});var FT=we((G7,qT)=>{function t4(e){let t="\\[=*\\[",i="\\]=*\\]",n={begin:t,end:i,contains:["self"]},r=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,i,{contains:[n],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 global 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:r.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:r}].concat(r)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:i,contains:[n],relevance:5}])}}qT.exports=t4});var $T=we((j7,WT)=>{function i4(e){let t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%{function n4(e){let t=e.regex,i=["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"],n=/[dualxmsipngr]{0,12}/,r={$pattern:/[\w.]+/,keyword:i.join(" ")},s={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:r},a={begin:/->\{/,end:/\}/},o={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},l={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[o]},c={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},u=[e.BACKSLASH_ESCAPE,s,l],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],h=(_,y,m="\\1")=>{let v=m==="\\1"?m:t.concat(m,y);return t.concat(t.concat("(?:",_,")"),y,/(?:\\.|[^\\\/])*?/,v,/(?:\\.|[^\\\/])*?/,m,n)},f=(_,y,m)=>t.concat(t.concat("(?:",_,")"),y,/(?:\\.|[^\\\/])*?/,m,n),p=[l,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),a,{className:"string",contains:u,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}]},c,{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:h("s|tr|y",t.either(...d,{capture:!0}))},{begin:h("s|tr|y","\\(","\\)")},{begin:h("s|tr|y","\\[","\\]")},{begin:h("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:f("(?:m|qr)?",/\//,/\//)},{begin:f("m|qr",t.either(...d,{capture:!0}),/\1/)},{begin:f("m|qr",/\(/,/\)/)},{begin:f("m|qr",/\[/,/\]/)},{begin:f("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,o]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,o,c]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return s.contains=p,a.contains=p,{name:"Perl",aliases:["pl","pm"],keywords:r,contains:p}}KT.exports=n4});var YT=we((V7,jT)=>{function r4(e){let t={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+"},i=/[a-zA-Z@][a-zA-Z0-9_]*/,o={"variable.language":["this","super"],$pattern:i,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"]},l={$pattern:i,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:o,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+l.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:l,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}jT.exports=r4});var XT=we((X7,VT)=>{function s4(e){let t=e.regex,i=/(?![A-Za-z0-9])(?![$])/,n=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,i),r=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,i),s=t.concat(/[A-Z]+/,i),a={scope:"variable",match:"\\$+"+n},o={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=e.inherit(e.APOS_STRING_MODE,{illegal:null}),u=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(l)}),d={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(x,U)=>{U.data._beginMatch=x[1]||x[2]},"on:end":(x,U)=>{U.data._beginMatch!==x[1]&&U.ignoreMatch()}},h=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),f=`[ -]`,p={scope:"string",variants:[u,c,d,h]},_={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},y=["false","null","true"],m=["__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"],v=["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"],w={keyword:m,literal:(x=>{let U=[];return x.forEach(C=>{U.push(C),C.toLowerCase()===C?U.push(C.toUpperCase()):U.push(C.toLowerCase())}),U})(y),built_in:v},k=x=>x.map(U=>U.replace(/\|\d+$/,"")),M={variants:[{match:[/new/,t.concat(f,"+"),t.concat("(?!",k(v).join("\\b|"),"\\b)"),r],scope:{1:"keyword",4:"title.class"}}]},T=t.concat(n,"\\b(?!\\()"),A={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),T],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[r,t.concat(/::/,t.lookahead(/(?!class\b)/)),T],scope:{1:"title.class",3:"variable.constant"}},{match:[r,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[r,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},I={scope:"attr",match:t.concat(n,t.lookahead(":"),t.lookahead(/(?!::)/))},B={relevance:0,begin:/\(/,end:/\)/,keywords:w,contains:[I,a,A,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,p,_,M]},q={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",k(m).join("\\b|"),"|",k(v).join("\\b|"),"\\b)"),n,t.concat(f,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[B]};B.contains.push(q);let H=[I,A,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,p,_,M],P={begin:t.concat(/#\[\s*\\?/,t.either(r,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:y,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:y,keyword:["new","array"]},contains:["self",...H]},...H,{scope:"meta",variants:[{match:r},{match:s}]}]};return{case_insensitive:!1,keywords:w,contains:[P,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}]}},o,{scope:"variable.language",match:/\$this\b/},a,q,A,{match:[/const/,/\s/,n],scope:{1:"keyword",3:"variable.constant"}},M,{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:w,contains:["self",P,a,A,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,p,_]}]},{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]},p,_]}}VT.exports=s4});var QT=we((Z7,ZT)=>{function a4(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})]}]}}ZT.exports=a4});var eN=we((Q7,JT)=>{function o4(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}JT.exports=o4});var iN=we((J7,tN)=>{function l4(e){let t=e.regex,i=/[\p{XID_Start}_]\p{XID_Continue}*/u,n=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","lazy","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],o={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:n,built_in:["__import__","abs","aiter","all","anext","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozendict","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","sentinel","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"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:o,illegal:/#/},u={begin:/\{\{/,relevance:0},d={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fFtT][rR]|[rR][fFtT]|[fFtT])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l,u,c]},{begin:/([fFtT][rR]|[rR][fFtT]|[fFtT])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l,u,c]},{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:/([fFtT][rR]|[rR][fFtT]|[fFtT])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,u,c]},{begin:/([fFtT][rR]|[rR][fFtT]|[fFtT])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,u,c]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",f=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,p=`\\b|${n.join("|")}`,_={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${f}))[eE][+-]?(${h})[jJ]?(?=${p})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${p})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${p})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${p})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${p})`},{begin:`\\b(${h})[jJ](?=${p})`}]},y={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:o,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:["self",l,_,d,e.HASH_COMMENT_MODE]}]};return c.contains=[d,_,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:o,illegal:/(<\/|\?)|=>/,contains:[l,_,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},d,y,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,i],scope:{1:"keyword",3:"title.function"},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,i,/\s*/,/\(\s*/,i,/\s*\)/]},{match:[/\bclass/,/\s+/,i]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[_,m,d]}]}}tN.exports=l4});var rN=we((eq,nN)=>{function c4(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}nN.exports=c4});var aN=we((tq,sN)=>{function u4(e){let t=e.regex,i=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,n=t.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]?/),r=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:i,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:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:i},{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:[r,n]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,n]},{scope:{1:"punctuation",2:"number"},match:[s,n]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,n]}]},{scope:{3:"operator"},match:[i,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:r},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}sN.exports=u4});var lN=we((iq,oN)=>{function d4(e){let t=e.regex,i=/(r#)?/,n=t.concat(i,e.UNDERSCORE_IDENT_RE),r=t.concat(i,e.IDENT_RE),s={scope:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!(?:let|for|while|if|else|match)\b)/,r,t.lookahead(/\s*\(/))},a="([ui](8|16|32|64|128|size)|f(16|32|64|128))?",o=["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","raw","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],c=["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!"],u=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f16","f32","f64","f128","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:u,keyword:o,literal:l,built_in:c},illegal:""},s]}}oN.exports=d4});var uN=we((nq,cN)=>{var h4=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/},UNICODE_RANGE:{scope:"number",begin:/\b[Uu]\+[0-9A-Fa-f][0-9A-Fa-f?]{0,5}(-[0-9A-Fa-f][0-9A-Fa-f]{0,5})?/},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_-]*/}}),f4=["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"],p4=["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"],m4=[...f4,...p4],g4=["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(),_4=["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(),v4=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),b4=["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","corner-bottom-left-shape","corner-bottom-right-shape","corner-shape","corner-top-left-shape","corner-top-right-shape","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","unicode-range","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 y4(e){let t=h4(e),i=v4,n=_4,r="@[a-z-]+",s="and or not only",o={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,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+m4.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+n.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+i.join("|")+")"},o,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+b4.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:[t.BLOCK_COMMENT,o,t.HEXCOLOR,t.CSS_NUMBER_MODE,t.UNICODE_RANGE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:r,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:g4.join(" ")},contains:[{begin:r,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},o,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}cN.exports=y4});var hN=we((rq,dN)=>{function S4(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[./~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}dN.exports=S4});var pN=we((sq,fN)=>{function w4(e){let t=e.regex,i=e.COMMENT("--","$"),n={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},r={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],a=["double precision","large object","with timezone","without timezone"],o=["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"],l=["add","asc","collation","desc","final","first","last","view"],c=["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"],u=["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"],d=["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"],h=["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"],f=u,p=[...c,...l].filter(k=>!u.includes(k)),_={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},y={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},m={match:t.concat(/\b/,t.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function v(k){return t.concat(/\b/,t.either(...k.map(M=>M.replace(/\s+/,"\\s+"))),/\b/)}let b={scope:"keyword",match:v(h),relevance:0};function w(k,{exceptions:M,when:T}={}){let A=T;return M=M||[],k.map(I=>I.match(/\|\d+$/)||M.includes(I)?I:A(I)?`${I}|0`:I)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:w(p,{when:k=>k.length<3}),literal:s,type:o,built_in:d},contains:[{scope:"type",match:v(a)},b,m,_,n,r,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,i,y]}}fN.exports=w4});var xN=we((aq,wN)=>{function vN(e){return e?typeof e=="string"?e:e.source:null}function Bu(e){return at("(?=",e,")")}function at(...e){return e.map(i=>vN(i)).join("")}function x4(e){let t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Ui(...e){return"("+(x4(e).capture?"":"?:")+e.map(n=>vN(n)).join("|")+")"}new RegExp(Ui(/\[(?:[^\\\]]|\\.)*\]/,/\(\?<(?![=!])[^>]+>/,/\(\?'[^']+'/,/\(\??/,/\\([1-9][0-9]*)/,/\\./));var fb=e=>at(/\b/,e,/\w$/.test(e)?/\b/:/\B/),E4=["Protocol","Type"].map(fb),mN=["init","self"].map(fb),k4=["Any","Self"],db=["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"],gN=["false","nil","true"],C4=["assignment","associativity","higherThan","left","lowerThan","none","right"],T4=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],_N=["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"],bN=Ui(/[/=\-+!*%<>&|^~?]/,/[\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]/),yN=Ui(bN,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),hb=at(bN,yN,"*"),SN=Ui(/[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]/),Zf=Ui(SN,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),jr=at(SN,Zf,"*"),Xf=at(/[A-Z]/,Zf,"*"),N4=["attached","autoclosure",at(/convention\(/,Ui("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",at(/objc\(/,jr,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],A4=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function M4(e){let t={match:/\s+/,relevance:0},i=e.COMMENT("/\\*","\\*/",{contains:["self"]}),n=[e.C_LINE_COMMENT_MODE,i],r={match:[/\./,Ui(...E4,...mN)],className:{2:"keyword"}},s={match:at(/\./,Ui(...db)),relevance:0},a=db.filter(fe=>typeof fe=="string").concat(["_|0"]),o=db.filter(fe=>typeof fe!="string").concat(k4).map(fb),l={variants:[{className:"keyword",match:Ui(...o,...mN)}]},c={$pattern:Ui(/\b\w+/,/#\w+/),keyword:a.concat(T4),literal:gN},u=[r,s,l],d={match:at(/\./,Ui(..._N)),relevance:0},h={className:"built_in",match:at(/\b/,Ui(..._N),/(?=\()/)},f=[d,h],p={match:/->/,relevance:0},_={className:"operator",relevance:0,variants:[{match:hb},{match:`\\.(\\.|${yN})+`}]},y=[p,_],m="([0-9]_*)+",v="([0-9a-fA-F]_*)+",b={className:"number",relevance:0,variants:[{match:`\\b(${m})(\\.(${m}))?([eE][+-]?(${m}))?\\b`},{match:`\\b0x(${v})(\\.(${v}))?([pP][+-]?(${m}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},w=(fe="")=>({className:"subst",variants:[{match:at(/\\/,fe,/[0\\tnr"']/)},{match:at(/\\/,fe,/u\{[0-9a-fA-F]{1,8}\}/)}]}),k=(fe="")=>({className:"subst",match:at(/\\/,fe,/[\t ]*(?:[\r\n]|\r\n)/)}),M=(fe="")=>({className:"subst",label:"interpol",begin:at(/\\/,fe,/\(/),end:/\)/}),T=(fe="")=>({begin:at(fe,/"""/),end:at(/"""/,fe),contains:[w(fe),k(fe),M(fe)]}),A=(fe="")=>({begin:at(fe,/"/),end:at(/"/,fe),contains:[w(fe),M(fe)]}),I={className:"string",variants:[T(),T("#"),T("##"),T("###"),A(),A("#"),A("##"),A("###")]},B=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],q={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:B},H=fe=>{let li=at(fe,/\//),se=at(/\//,fe);return{begin:li,end:se,contains:[...B,{scope:"comment",begin:`#(?!.*${se})`,end:/$/}]}},P={scope:"regexp",variants:[H("###"),H("##"),H("#"),q]},x={match:at(/`/,jr,/`/)},U={className:"variable",match:/\$\d+/},C={className:"variable",match:`\\$${Zf}+`},D=[x,U,C],R={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:A4,contains:[...y,b,I]}]}},V={scope:"keyword",match:at(/@/,Ui(...N4),Bu(Ui(/\(/,/\s+/)))},z={scope:"meta",match:at(/@/,jr)},L=[R,V,z],K={match:Bu(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:at(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Zf,"+")},{className:"type",match:Xf,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:at(/\s+&\s+/,Bu(Xf)),relevance:0}]},X={begin://,keywords:c,contains:[...n,...u,...L,p,K]};K.contains.push(X);let oe={match:at(jr,/\s*:/),keywords:"_|0",relevance:0},ge={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",oe,...n,P,...u,...f,...y,b,I,...D,...L,K]},te={begin://,keywords:"repeat each",contains:[...n,K]},We={begin:Ui(Bu(at(jr,/\s*:/)),Bu(at(jr,/\s+/,jr,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:jr}]},Ki={begin:/\(/,end:/\)/,keywords:c,contains:[We,...n,...u,...y,b,I,...L,K,ge],endsParent:!0,illegal:/["']/},oi={match:[/(func|macro)/,/\s+/,Ui(x.match,jr,hb)],className:{1:"keyword",3:"title.function"},contains:[te,Ki,t],illegal:[/\[/,/%/]},yt={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[te,Ki,t],illegal:/\[|%/},Hn={match:[/operator/,/\s+/,hb],className:{1:"keyword",3:"title"}},Ht={begin:[/precedencegroup/,/\s+/,Xf],className:{1:"keyword",3:"title"},contains:[K],keywords:[...C4,...gN],end:/}/},Ne={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},gn={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},$t={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,jr,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[te,...u,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:Xf},...u],relevance:0}]};for(let fe of I.variants){let li=fe.contains.find(Kt=>Kt.label==="interpol");li.keywords=c;let se=[...u,...f,...y,b,I,...D];li.contains=[...se,{begin:/\(/,end:/\)/,contains:["self",...se]}]}return{name:"Swift",keywords:c,contains:[...n,oi,yt,Ne,gn,$t,Hn,Ht,{beginKeywords:"import",end:/$/,contains:[...n],relevance:0},P,...u,...f,...y,b,I,...D,...L,K,ge]}}wN.exports=M4});var kN=we((oq,EN)=>{function O4(e){let t="true false yes no null",i="[\\w#;/?:@&=+$,.~*'()[\\]]+",n={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},a={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,r]},o=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={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"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},p={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},_={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},y=[n,{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+!"+i},{className:"type",begin:"!<"+i+">"},{className:"type",begin:"!"+i},{className:"type",begin:"!!"+i},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},h,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},p,_,s,a],m=[...y];return m.pop(),m.push(o),f.contains=m,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:y}}EN.exports=O4});var LN=we((lq,DN)=>{var Qf="[A-Za-z$_][0-9A-Za-z$_]*",CN=["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"],TN=["true","false","null","undefined","NaN","Infinity"],NN=["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"],AN=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],MN=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],ON=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","self","global"],RN=[].concat(MN,NN,AN);function R4(e){let t=e.regex,i=(R,{after:V})=>{let z="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(R,V)=>{let z=R[0].length+R.index,L=R.input[z];if(L==="<"||L===","){V.ignoreMatch();return}L===">"&&(i(R,{after:z})||V.ignoreMatch());let K,X=R.input.substring(z);if(K=X.match(/^\s*=/)){V.ignoreMatch();return}if((K=X.match(/^\s+extends\s+/))&&K.index===0){V.ignoreMatch();return}}},o={$pattern:Qf,keyword:CN,literal:TN,built_in:RN,"variable.language":ON},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\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},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},_={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},y={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},v={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:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,_,y,{match:/\$\d+/},d];h.contains=b.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(b)});let w=[].concat(v,h.contains),k=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(w)}]),M={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k},T={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,t.concat(n,"(",t.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}}]},A={relevance:0,match:t.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:{_:[...NN,...AN]}},I={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},B={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[M],illegal:/%/},q={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function H(R){return t.concat("(?!",R.join("|"),")")}let P={match:t.concat(/\b/,H([...MN,"super","import","await"].map(R=>`${R}\\s*\\(`)),n,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},x={begin:t.concat(/\./,t.lookahead(t.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},U={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},M]},C="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",D={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(C)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[M]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:A},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),I,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,_,y,v,{match:/\$\d+/},d,A,{scope:"attr",match:n+t.lookahead(":"),relevance:0},D,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,e.REGEXP_MODE,{className:"function",begin:C,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:o,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:s},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},B,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[M,e.inherit(e.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},x,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[M]},P,q,T,U,{match:/\$[(.]/}]}}function D4(e){let t=e.regex,i=R4(e),n=Qf,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},a={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[i.exports.CLASS_REFERENCE]},o={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:Qf,keyword:CN.concat(l),literal:TN,built_in:RN.concat(r),"variable.language":ON},u={className:"meta",begin:"@"+n},d=(_,y,m)=>{let v=_.contains.findIndex(b=>b.label===y);if(v===-1)throw new Error("can not find mode to replace");_.contains.splice(v,1,m)};Object.assign(i.keywords,c),i.exports.PARAMS_CONTAINS.push(u);let h=i.contains.find(_=>_.scope==="attr"),f=Object.assign({},h,{match:t.concat(n,t.lookahead(/\s*\?:/))});i.exports.PARAMS_CONTAINS.push([i.exports.CLASS_REFERENCE,h,f]),i.contains=i.contains.concat([u,s,a,f]),d(i,"shebang",e.SHEBANG()),d(i,"use_strict",o);let p=i.contains.find(_=>_.label==="func.def");return p.relevance=0,Object.assign(i,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),i}DN.exports=D4});var zN=we((cq,IN)=>{function L4(e){let t=e.regex,i={className:"string",begin:/"(""|[^/n])"C\b/},n={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},r=/\d{1,2}\/\d{1,2}\/\d{4}/,s=/\d{4}-\d{1,2}-\d{1,2}/,a=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,o=/\d{1,2}(:\d{1,2}){1,2}/,l={className:"literal",variants:[{begin:t.concat(/# */,t.either(s,r),/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,t.either(s,r),/ +/,t.either(a,o),/ *#/)}]},c={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])|[%&])?/}]},u={className:"label",begin:/^\w+:/},d=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),h=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:[i,n,l,c,u,d,h,{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:[h]}]}}IN.exports=L4});var PN=we((uq,BN)=>{function I4(e){e.regex;let t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");let i=e.COMMENT(/;;/,/$/),n=["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"],r={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},s={className:"variable",begin:/\$[\w_]+/},a={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},o={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/},l={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},c={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:n},contains:[i,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},s,a,r,e.QUOTE_STRING_MODE,l,c,o]}}BN.exports=I4});var UN=we((dq,HN)=>{var Re=QC();Re.registerLanguage("xml",eT());Re.registerLanguage("bash",iT());Re.registerLanguage("c",rT());Re.registerLanguage("cpp",aT());Re.registerLanguage("csharp",lT());Re.registerLanguage("css",uT());Re.registerLanguage("markdown",hT());Re.registerLanguage("diff",pT());Re.registerLanguage("ruby",gT());Re.registerLanguage("go",vT());Re.registerLanguage("graphql",yT());Re.registerLanguage("ini",wT());Re.registerLanguage("java",CT());Re.registerLanguage("javascript",RT());Re.registerLanguage("json",LT());Re.registerLanguage("kotlin",zT());Re.registerLanguage("less",UT());Re.registerLanguage("lua",FT());Re.registerLanguage("makefile",$T());Re.registerLanguage("perl",GT());Re.registerLanguage("objectivec",YT());Re.registerLanguage("php",XT());Re.registerLanguage("php-template",QT());Re.registerLanguage("plaintext",eN());Re.registerLanguage("python",iN());Re.registerLanguage("python-repl",rN());Re.registerLanguage("r",aN());Re.registerLanguage("rust",lN());Re.registerLanguage("scss",uN());Re.registerLanguage("shell",hN());Re.registerLanguage("sql",pN());Re.registerLanguage("swift",xN());Re.registerLanguage("yaml",kN());Re.registerLanguage("typescript",LN());Re.registerLanguage("vbnet",zN());Re.registerLanguage("wasm",PN());Re.HighlightJS=Re;Re.default=Re;HN.exports=Re});var qN,Jf,pb=ae(()=>{qN=ne(UN(),1),Jf=qN.default});function KN(e){let t=[];if(!e)return t;mb.lastIndex=0;let i;for(;i=mb.exec(e);){let n=i.index,r=i[0],s=i[1],a=i[2],o=n>0?e[n-1]:"";if(o&&/[\w.@/\\:-]/.test(o)||!s&&!a)continue;let l=r.replace(FN,"");for(;/[)\]]$/.test(l);){let u=l.endsWith(")")?")":"]",d=u===")"?"(":"[",h=l.split(d).length-1;if(l.split(u).length-1>h)l=l.slice(0,-1).replace(FN,"");else break}r=l;let c=ns(r);c.ok&&(t.push({start:n,end:n+r.length,text:r,url:c.target.href}),mb.lastIndex=n+Math.max(1,r.length))}return t}function GN(e){let t=KN(e);if(!t.length)return[e];let i=[],n=0;for(let r of t)r.start>n&&i.push(e.slice(n,r.start)),i.push(r),n=r.end;return n{if(n.nodeType===3){t.push(n);return}if(n.nodeType===1&&!B4.has(n.tagName))for(let r=n.firstChild;r;r=r.nextSibling)i(r)};return i(e),t}function $N(e,t){let i=t.map(l=>l.data).join(""),n=KN(i);if(!n.length)return;let r=[],s=0;for(let l of t)r.push(s),s+=l.data.length;let a=(l,c)=>{for(let u=t.length-1;u>=0;u--){let d=r[u];if(c?l>d:l>=d)return[t[u],l-d]}return[t[0],0]},o=e.ownerDocument??document;for(let l of[...n].reverse()){let[c,u]=a(l.start,!1),[d,h]=a(l.end,!0),f=o.createRange();f.setStart(c,u),f.setEnd(d,h);let p=o.createElement("a");p.href=l.url,p.dataset.acLocal=l.url,p.className="ac-local",p.appendChild(f.extractContents()),f.insertNode(p)}}function jN(e,t){for(let i of Array.from(e.querySelectorAll("a[href]"))){let n=gb(i.getAttribute("href"));n&&(i.dataset.acLocal=n,i.classList.add("ac-local"))}for(let i of Array.from(e.querySelectorAll("pre")))i.dataset.acLinked||(i.dataset.acLinked="1",$N(i,WN(i)));for(let i of WN(e))i.parentElement?.closest("pre")||i.parentNode&&$N(i.parentNode,[i]);if(t)for(let i of Array.from(e.querySelectorAll("a.ac-local")))i.title=t}var z4,mb,FN,B4,ep=ae(()=>{Nd();z4=String.raw`(?:localhost|[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*\.localhost|127(?:\.\d{1,3}){3}|0\.0\.0\.0|\[::1?\])`,mb=new RegExp(String.raw`(https?:\/\/)?${z4}(:\d{1,5})?((?:[/?#][^\s<>"'\`)】」』,。;!?、]*)?)`,"gi"),FN=/[.,;:!?。,;:!?…'"’”]+$/;B4=new Set(["A","BUTTON","SCRIPT","STYLE","TEXTAREA"])});function P4(e){let t=he.getState(),i=t.currentThreadId;t.openPanel("preview"),xi.getState().navigate((n,r)=>Q.call(n,r),_c(i),i,e,{push:!0})}async function ks(e){try{if((await Q.call("app.openExternal",{url:e}))?.ok)return}catch{}await gr(e),Ee(g("links.externalFailed"))}function tp(e){let i=e.target?.closest?.("a");if(!i)return;let n=i.getAttribute("href")??"";e.preventDefault();let r=i.dataset.acLocal||gb(n),s=e.ctrlKey||e.metaKey;if(r&&!s){P4(r);return}/^https?:\/\//i.test(r||n)&&ks(r||n)}var Pu=ae(()=>{Hi();Qi();Rd();ep();Hu();fr();Ct()});function U4(e){return H4(et.parse(e,{async:!1}))}function vb({text:e,streaming:t}){let i=(0,tc.useRef)(null),n=(0,tc.useMemo)(()=>U4(e),[e]);return(0,tc.useEffect)(()=>{let r=i.current;if(r){for(let s of r.querySelectorAll("pre")){let a=s.querySelector("code");if(!a||a.dataset.hl)continue;a.dataset.hl="1";let o=(a.textContent??"").replace(/\n$/,""),l=/(?:^|\s)language-([\w+#.-]+)/.exec(a.className)?.[1];try{Jf.highlightElement(a)}catch{}let c=l??/(?:^|\s)language-([\w+#.-]+)/.exec(a.className)?.[1]??"";$4(s,a,o,c)}t||jN(r,g("links.openPreviewTitle"))}},[n,t]),(0,XN.jsx)("div",{ref:i,className:`md${t?" streaming":""}`,onClick:tp,dangerouslySetInnerHTML:{__html:n}})}function _b(e){let t=document.createElementNS(YN,"svg");for(let[n,r]of Object.entries({width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"}))t.setAttribute(n,r);let i=document.createElementNS(YN,"path");return i.setAttribute("d",e),t.appendChild(i),t}function W4(e){let t=[],i=()=>{let s=document.createElement("span");return s.className="cb-l",t.push(s),s},n=i(),r=(s,a)=>{if(s.nodeType===Node.TEXT_NODE){(s.textContent??"").split(` -`).forEach((l,c)=>{if(c>0&&(n=i()),!l)return;let u=n;for(let d of a){let h=document.createElement("span");h.className=d,u.appendChild(h),u=h}u.appendChild(document.createTextNode(l))});return}if(s.nodeType===Node.ELEMENT_NODE){let o=s.getAttribute("class");for(let l of[...s.childNodes])r(l,o?[...a,o]:a)}};for(let s of[...e.childNodes])r(s,[]);for(;t.length>1&&!t[t.length-1].textContent;)t.pop();return t}function $4(e,t,i,n){if(e.parentElement?.classList.contains("cb"))return;let r=document.createElement("div");r.className="cb";let s=document.createElement("div");s.className="cb-head";let a=document.createElement("span");a.className="cb-lang",a.textContent=n||"text";let o=document.createElement("span");o.className="cb-acts";let l=(h,f,p)=>{let _=document.createElement("button");return _.type="button",_.className=`cb-btn ${p}`,_.title=h,_.setAttribute("aria-label",h),_.appendChild(_b(f)),_},c=l(g("timeline.codeWrap"),F4,"cb-wrap");c.setAttribute("aria-pressed","false"),c.onclick=()=>{let h=!r.classList.contains("wrap");r.classList.toggle("wrap",h),c.setAttribute("aria-pressed",String(h))};let u=l(g("common.copy"),VN,"cb-copy");u.onclick=()=>{gr(i).then(()=>{u.replaceChildren(_b(q4)),u.classList.add("done"),setTimeout(()=>{u.replaceChildren(_b(VN)),u.classList.remove("done")},1200)})},o.append(c,u),s.append(a,o);let d=W4(t);d.length>1&&(t.replaceChildren(...d),r.classList.add("numbered")),e.replaceWith(r),r.append(s,e)}async function gr(e){try{await navigator.clipboard.writeText(e);return}catch{}try{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy"),t.remove()}catch{}}var tc,XN,H4,YN,VN,q4,F4,Hu=ae(()=>{tc=ne(pt(),1);cC();RC();pb();ep();Pu();Ct();XN=ne(be(),1);et.setOptions({gfm:!0,breaks:!0});H4=e=>OC.sanitize(e,{USE_PROFILES:{html:!0}});YN="http://www.w3.org/2000/svg";VN="M8 8h11v12H8zM5 16V4h11",q4="M5 13l4 4L19 7",F4="M4 6h16M4 12h13a3 3 0 0 1 0 6h-4m2-2-2 2 2 2M4 18h5"});function K4(e){let[t,i]=(0,_o.useState)(Date.now());return(0,_o.useEffect)(()=>{if(!e)return;let n=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(n)},[e]),t}function ZN({pendingCount:e,pendingKey:t}){let{projects:i,threads:n}=Ke(),r=he(),{version:s}=$r(),[a,o]=(0,_o.useState)(!1),[l,c]=(0,_o.useState)(!1),[u,d]=(0,_o.useState)(""),[h,f,p]=ku(),_=n.find(T=>T.id===r.currentThreadId)??null,y=_?i.find(T=>T.id===_.projectId):i.find(T=>T.id===r.currentProjectId),m=_?.status==="running"||_?.status==="initializing",v=K4(m),b=m&&_?Math.max(0,v-_.updatedAt):0,w=_?e>0?{cls:"wait",text:g("topbar.waitAuth")}:m?{cls:"run",text:_e("topbar.running",{s:Math.floor(b/1e3)})}:_.status==="error"?{cls:"err",text:g("topbar.error")}:_.status==="closed"?{cls:"",text:g("topbar.closedResume")}:null:null,k=[{tab:"changes",icon:"changes",title:g("topbar.panelChanges")},{tab:"files",icon:"files",title:g("topbar.panelFiles")},{tab:"terminal",icon:"term",title:g("topbar.panelTerminal")},{tab:"preview",icon:"globe",title:g("preview.tab")}],M=_?[{kind:"item",label:g("common.rename"),onClick:()=>{d(_.title),o(!0)}},{kind:"item",label:g("topbar.threadInfo"),onClick:()=>c(!0)},{kind:"sep"},{kind:"item",label:g("common.settings"),onClick:()=>window.dispatchEvent(new CustomEvent("open-settings"))},{kind:"label",text:s?`v${s}`:""}]:[{kind:"item",label:g("common.settings"),onClick:()=>window.dispatchEvent(new CustomEvent("open-settings"))},{kind:"label",text:s?`v${s}`:""}];return(0,dt.jsxs)("header",{className:"topbar",children:[(0,dt.jsx)(Iv,{className:`tb-menu-btn${r.sbHidden?" tb-sb-collapsed":""}`}),y&&(0,dt.jsx)("span",{className:"tb-crumb",children:y.name}),y&&_&&(0,dt.jsx)("span",{className:"tb-sep",children:"/"}),_?a?(0,dt.jsx)("input",{className:"tb-rename",autoFocus:!0,value:u,onChange:T=>d(T.target.value),onBlur:()=>o(!1),onKeyDown:T=>{T.key==="Enter"&&!Qn(T.nativeEvent)&&u.trim()?(Q.call("threads.update",{id:_.id,title:u.trim()}),o(!1)):T.key==="Escape"&&o(!1)}}):(0,dt.jsx)("span",{className:"tb-title",title:g("topbar.clickRename"),onClick:()=>{d(_.title),o(!0)},children:Md(_.title,_.titleAuto)}):(0,dt.jsx)("span",{className:"tb-title ghost",children:y?g("topbar.pickThread"):g("app.title")}),w&&(w.cls==="wait"&&t?(0,dt.jsx)("button",{type:"button",className:`tb-pill ${w.cls}`,title:g("topbar.showRequest"),onClick:()=>window.dispatchEvent(new CustomEvent("ac-show-item",{detail:{key:t}})),children:w.text}):(0,dt.jsxs)("span",{className:`tb-pill ${w.cls}`,children:[w.cls==="run"&&(0,dt.jsx)("span",{className:"tb-pill-dot"}),w.text]})),(0,dt.jsxs)("div",{className:"tb-right",children:[_?.model&&(0,dt.jsx)("span",{className:"tb-model",children:_.model}),k.map(T=>(0,dt.jsx)("button",{className:`ibtn${r.panelOpen&&r.panelTab===T.tab?" on":""}`,title:T.title,onClick:()=>r.panelOpen&&r.panelTab===T.tab?r.closePanel():r.openPanel(T.tab),children:(0,dt.jsx)(re,{name:T.icon})},T.tab)),(0,dt.jsx)("button",{className:"ibtn",title:g("common.more"),onClick:T=>f(T),children:(0,dt.jsx)(re,{name:"dots"})})]}),h&&(0,dt.jsx)(ao,{x:h.x,y:h.y,items:M,onClose:p}),l&&_&&(0,dt.jsx)(G4,{thread:_,project:y,onClose:()=>c(!1)})]})}function G4({thread:e,project:t,onClose:i}){let n=e.usage,r=Ad(),s=[[g("thread.agent"),e.provider],[g("thread.model"),e.model??g("common.default")],[g("thread.mode"),e.mode],[g("thread.effort"),e.effort??g("common.default")],[g("thread.sessionId"),e.providerSessionId??g("thread.sessionNone")],[g("thread.tokens"),_e("thread.tokensFmt",{in:Wl(n.inputTokens),out:Wl(n.outputTokens),cache:Wl(n.cacheReadTokens)})],[g("thread.cost"),n.costUsd>0?Mf(n.costUsd):"\u2014"],[g("thread.created"),new Date(e.createdAt).toLocaleString(r)],[g("thread.workdir"),t?.path??"\u2014"]];e.importedFrom&&s.push([g("thread.importedFrom"),`${e.importedFrom.provider} / ${e.importedFrom.sessionId.slice(0,8)}\u2026`]);let a=new Set([g("thread.sessionId"),g("thread.workdir")]);return(0,dt.jsx)(Kr,{title:g("thread.info"),onClose:i,children:(0,dt.jsx)("div",{className:"info-grid",children:s.map(([o,l])=>(0,dt.jsxs)("div",{className:"info-row",children:[(0,dt.jsx)("span",{className:"info-k",children:o}),(0,dt.jsx)("span",{className:"info-v",title:l,children:l}),a.has(o)&&l!=="\u2014"&&l!==g("thread.sessionNone")&&(0,dt.jsx)("button",{className:"ibtn",title:g("common.copy"),onClick:()=>{gr(l),Ee(g("common.copied"))},children:(0,dt.jsx)(re,{name:"copy",size:12})})]},o))})})}var _o,dt,QN=ae(()=>{_o=ne(pt(),1);Fl();An();Qi();xu();Hi();Mn();zv();Rf();Kl();Hu();fr();Of();Ct();dt=ne(be(),1)});function JN(e){return typeof e=="object"?e.key:e}function eA(e,t){let i=e.length;return new Proxy(e,{get(n,r,s){if(typeof r=="string"){let a=r.charCodeAt(0);if(a>=48&&a<=57){let o=+r;if(Number.isInteger(o)&&o>=0&&o{});function vo(e,t,i){let n=i.initialDeps??[],r,s=!0;function a(){var o;let c=0,u=e();if(!(u.length!==n.length||u.some((f,p)=>n[p]!==f)))return r;n=u;let h=0;return r=t(...u),i?.onChange&&!(s&&i.skipInitialOnChange)&&i.onChange(r),s=!1,r}return a.updateDeps=o=>{n=o},a}function bb(e,t){if(e===void 0)throw new Error(`Unexpected undefined${t?`: ${t}`:""}`);return e}var Cs,iA,yb=ae(()=>{Cs=(e,t)=>Math.abs(e-t)<1.01,iA=(e,t,i)=>{let n;return Object.assign(function(...r){e.clearTimeout(n),n=e.setTimeout(()=>t.apply(this,r),i)},{cancel:()=>{e.clearTimeout(n)}})}});function nA({offset:e,isScrolling:t,elementMax:i,holdOffset:n,scrollOffset:r,pendingWrite:s,clampedMaxAtWrite:a}){var o;return t&&s===null&&e===r?"spurious":s!==null&&Math.abs(e-s.target)<1.5?"readBack":s!==null&&!s.smooth&&i!==null&&s.target>i+n+.5&&Math.abs(e-(i+n))<1.5||s!==null&&!s.smooth&&((o=s.lowMaxes)!=null&&o.some(l=>Math.abs(e-l)<1.5))?"clampedReadBack":a!==null&&Math.abs(e-a)<1.5?"clampedEcho":"external"}function rA({kind:e,offset:t,command:i,target:n}){return e!=="spurious"&&e!=="readBack"&&e!=="clampedReadBack"&&i?.index!=null&&i.phase!=="queued"&&!j4(i.phase)&&!Cs(t,i.lastTargetOffset)&&!Cs(t,n())&&e!=="clampedEcho"}function sA(e){let t=e[e.length-1];if(t===void 0)return!1;let i=e.length-2;for(;i>=0&&t.t-e[i].t=0&&n.t-e[r].t=0&&Math.abs(a)>=2*Math.abs(o)&&Math.abs(a)-Math.abs(o)>=.8}function aA(e){let t=e[e.length-1];if(t===void 0)return!1;let i=e.length-2;for(;i>=0&&t.t-e[i].t=.05}var j4,Sb,oA=ae(()=>{yb();j4=e=>e==="smooth"||e==="smoothFinishing";Sb=40});var Uu,qu,wb,Y4,lA,ic,ip,cA=ae(()=>{qu=()=>{if(Uu!==void 0)return Uu;if(typeof navigator>"u")return Uu=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Uu=!0;let e=navigator.maxTouchPoints;return Uu=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Y4=()=>wb!==void 0?wb:wb=qu()&&typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("overflow-anchor: auto"),lA=()=>!qu()||Y4(),ic={capture:!0,passive:!0},ip=class{constructor(t){this.host=t,this._touch=null,this.inMotion=()=>this._touch!==null&&this._touch.phase!=="lateFling",this.dragging=()=>{var i;return((i=this._touch)==null?void 0:i.phase)==="down"&&this._touch.moved},this.tail=()=>{var i;return((i=this._touch)==null?void 0:i.phase)==="tail"?this._touch.moved?"fling":"tap":null},this.onScroll=({isScrolling:i,ownReadBack:n,moved:r,external:s})=>{var a,o,l;return i&&((a=this._touch)==null?void 0:a.phase)==="tail"?this._openTail(this._touch.moved||!n,!1):((o=this._touch)==null?void 0:o.phase)==="lateFling"&&(this.host.now()>this._touch.until?this._touch=null:s&&i&&r&&this._openTail(!0,!1)),!n&&i&&r&&((l=this._touch)==null?void 0:l.phase)==="down"?(this._touch.moved=!0,!0):!1},this.touchStart=()=>{this.end(),this._touch={phase:"down",moved:!1}},this.touchEnd=()=>{var i;let n=((i=this._touch)==null?void 0:i.phase)==="down"&&this._touch.moved;this.end(),this._openTail(n,n)},this.end=()=>{var i;let n=this.host.getWindow();((i=this._touch)==null?void 0:i.phase)==="tail"&&n!=null&&n.clearTimeout(this._touch.timerId),this._touch=null},this.listen=i=>{let n=()=>this.touchStart(),r=()=>this.touchEnd();return i.addEventListener("touchstart",n,ic),i.addEventListener("touchend",r,ic),i.addEventListener("touchcancel",r,ic),()=>{i.removeEventListener("touchstart",n,ic),i.removeEventListener("touchend",r,ic),i.removeEventListener("touchcancel",r,ic),this.end()}},this._openTail=(i,n)=>{let r=this.host.getWindow();if(r==null)return;this.end();let s={phase:"tail",moved:i,awaitingFling:n,timerId:r.setTimeout(()=>{if(this.host.tailStillMoving()){this._openTail(s.moved,s.awaitingFling);return}this._touch=s.awaitingFling?{phase:"lateFling",until:this.host.now()+1e3}:null,this.host.onTailClosed()},150)};this._touch=s}}get touch(){return this._touch}}});function t6(e,t,i,n){if(t===0)return!1;let r=n(0),s=new Set,a=0;for(;a=t)return!1;for(let l=0;li)t=r-1;else return r}return n>0?n-1:0}function n6(e,t,i,n,r){let s=e.length-1;if(e.length<=n)return{startIndex:0,endIndex:s};if(n===1&&r!==null){let c=i6(r,s,i),u=c,d=i+t;for(;ue[c].start,i),l=o;if(n===1)for(;l1){let c=Array(n).fill(0);for(;ld=0&&u.some(d=>d>=i);){let d=e[o];u[d.lane]=d.start,o--}o=Math.max(0,o-o%n),l=Math.min(s,l+(n-1-l%n))}return{startIndex:o,endIndex:l}}var uA,fA,V4,X4,pA,dA,Z4,Q4,mA,J4,e6,gA,hA,Fu,np,_A,xb=ae(()=>{tA();yb();oA();cA();uA=e=>{let{clientWidth:t,clientHeight:i}=e;return{width:t,height:i}},fA=e=>{let t=new Set;return{schedule:i=>{let n=e.requestAnimationFrame(()=>{t.delete(n),i()});t.add(n)},cancel:()=>{t.forEach(i=>e.cancelAnimationFrame(i)),t.clear()}}},V4=e=>e,X4=e=>{let t=e.overscan*Math.max(e.lanes??1,1),i=Math.max(e.startIndex-t,0),r=Math.min(e.endIndex+t,e.count-1)-i+1,s=new Array(r);for(let a=0;a{let i=e.scrollElement;if(!i)return;let n=e.targetWindow;if(!n)return;let r=o=>{let{width:l,height:c}=o;t({width:Math.round(l),height:Math.round(c)})};if(r(uA(i)),!n.ResizeObserver)return()=>{};let s=fA(n),a=new n.ResizeObserver(()=>{let o=()=>{r(uA(i))};e.options.useAnimationFrameWithResizeObserver?s.schedule(o):o()});return a.observe(i,{box:"content-box"}),()=>{a.unobserve(i),s.cancel()}},dA={passive:!0},Z4=typeof window>"u"?!0:"onscrollend"in window,Q4=(e,t,i)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let s=e.options.useScrollendEvent&&Z4,a=0,o=s?null:iA(r,()=>t(i(n),!1),e.options.isScrollingResetDelay),l=d=>()=>{a=i(n),o?.(),t(a,d)},c=l(!0),u=l(!1);return n.addEventListener("scroll",c,dA),s&&n.addEventListener("scrollend",u,dA),()=>{n.removeEventListener("scroll",c),s&&n.removeEventListener("scrollend",u),o?.cancel()}},mA=(e,t)=>Q4(e,t,i=>{let{horizontal:n,isRtl:r}=e.options;return n?i.scrollLeft*(r&&-1||1):i.scrollTop}),J4=(e,t,i)=>{if(i.options.useCachedMeasurements){let n=i.indexFromElement(e),r=i.options.getItemKey(n);return i.itemSizeCache.get(r)??i.options.estimateSize(n)}if(t?.borderBoxSize){let n=t.borderBoxSize[0];if(n)return Math.round(n[i.options.horizontal?"inlineSize":"blockSize"])}if(!t){let n=i.indexFromElement(e),r=i.options.getItemKey(n),s=i.itemSizeCache.get(r);if(s!==void 0)return s}return e[i.options.horizontal?"offsetWidth":"offsetHeight"]},e6=(e,{adjustments:t=0,behavior:i},n)=>{var r,s;(s=(r=n.scrollElement)==null?void 0:r.scrollTo)==null||s.call(r,{[n.options.horizontal?"left":"top"]:e+t,behavior:i})},gA=e6,hA=(e,t)=>e==="smooth"?t?"smoothLanded":"smooth":"instant",Fu=e=>e?.phase==="smooth"||e?.phase==="smoothLanded";np=class{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._iosGesture=new ip({getWindow:()=>this.targetWindow,now:()=>this.now(),tailStillMoving:()=>{let i=this.scrollState;if(i?.phase!=="queued"||this.pendingWrite!==null)return!1;let n=this._readElementOffset();return n===null||this._lastElementOffset===null||Math.abs(n-this._lastElementOffset)<1?!1:(this._lastElementOffset=n,i.samples=[...i.samples??[],{t:this.now(),offset:n}],!0)},onTailClosed:()=>{let i=this.scrollState;i?.phase==="queued"&&aA(i.samples??[])&&(this.scrollState=null),this._flushHoldIfReady(!0),this._writeAwaitingCommand(),this._retryClampedAdjustment()}}),this._lastElementOffset=null,this.pendingWrite=null,this._clampedAdjustment=null,this.elementsCache=new Map,this._resizeBatch=null,this.now=()=>{var i,n,r;return((r=(n=(i=this.targetWindow)==null?void 0:i.performance)==null?void 0:n.now)==null?void 0:r.call(n))??Date.now()},this.observer=(()=>{let i=null,n=null,r=!1,s=!1,a=new Set,o=()=>{if(i)return i;let c=this.targetWindow;if(!c||!c.ResizeObserver)return null;let u=n=fA(c);return i=new c.ResizeObserver(d=>{let h=()=>{let f={sync:!1};this._resizeBatch=f;try{d.forEach(l)}finally{this._resizeBatch=null,f.notify&&(this.notify(f.sync),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment(),this.measureElement(null))}};if(this.options.useAnimationFrameWithResizeObserver)u.schedule(h);else{r=!0;try{h()}finally{r=!1}}})},l=c=>{let u=c.target,d=this.indexFromElement(u);if(!u.isConnected){this.observer.unobserve(u);for(let[h,f]of this.elementsCache)if(f===u){this.elementsCache.delete(h);break}return}this.isIndexInRange(d)&&this.shouldMeasureDuringScroll(d)&&this.resizeItem(d,this.options.measureElement(u,c,this))};return{disconnect:()=>{var c;(c=o())==null||c.disconnect(),n?.cancel(),a.clear(),s=!1,i=null,n=null},observe:c=>{let u=o();if(u){if(!r){u.observe(c,{box:"border-box"});return}a.add(c),s||(s=!0,n?.schedule(()=>{s=!1,a.forEach(d=>{d.isConnected&&i?.observe(d,{box:"border-box"})}),a.clear()}))}},unobserve:c=>{var u;a.delete(c),(u=o())==null||u.unobserve(c)}}})(),this.range=null,this.setOptions=i=>{var n;let r={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:V4,rangeExtractor:X4,onChange:()=>{},measureElement:J4,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(let u in i){let d=i[u];d!==void 0&&(r[u]=d)}let s=this.options,a=null,o=null,l=!1;if(s!==void 0&&s.enabled&&r.enabled&&r.anchorTo==="end"&&this.scrollElement!==null){let u=s.count,d=r.count,h=this.getMeasurements(),f=((n=this._singleLaneMeasurements)==null?void 0:n.items)??h,p=b=>JN(f[b]),_=u>0?p(0):null,y=u>0?p(u-1):null;if(d!==u||u>0&&d>0&&(r.getItemKey(0)!==_||r.getItemKey(d-1)!==y)){l=!0;let b=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??h[0]:null;b&&(a=[b.key,this.getScrollOffset()-b.start]);let w=r.followOnAppend===!0?"auto":r.followOnAppend||null;w&&d>0&&this.isAtEnd(s.scrollEndThreshold)&&(u===0||r.getItemKey(d-1)!==y)&&(d>u||t6(u,d,p,r.getItemKey))&&(o=w)}}this.options=r,l&&(this.pendingMin=0,this.itemSizeCacheVersion++);let c=null;if(a&&this.scrollOffset!==null&&!this._awaitingCommandReadBack()){let[u,d]=a,h=this.getMeasurements(),{count:f,getItemKey:p}=this.options,_=0;for(;_{var n,r;(r=(n=this.options).onChange)==null||r.call(n,this,i)},this.maybeNotify=vo(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),i=>{this.notify(i)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{var i;this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,(i=this._momentumStop)==null||i.restore(),this._momentumStop=null,this.isScrolling=!1,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._clampedAdjustment=null,this.pendingWrite=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var i;let n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((i=this.scrollElement)==null?void 0:i.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,a)=>{var o,l,c,u;let d=a?this._elementMaxScrollOffset():null,h=this._reportedOverscroll;this._reportedOverscroll=s<0||d!==null&&s>d+1;let f=s;this._lastElementOffset=f,s=this._toLayoutOffset(s);let p=this._classifyScrollEvent(s,a,d);if(p==="spurious")return;p==="readBack"?s=this.pendingWrite.target:p==="clampedReadBack"&&((o=this.scrollState)==null?void 0:o.index)!=null&&sthis.getScrollStateTarget(this.scrollState)})&&(this.scrollState=null),this.pendingWrite=null,this._clampedAdjustment!==null&&Math.abs(s-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null);let _=this.getScrollOffset(),y=this.scrollDirection;this.scrollDirection=a?_===s?this.scrollDirection:_v-b.t<=200),{t:v,offset:f}],(y!==null&&this.scrollDirection!==y||sA(m.samples))&&(this.scrollState=null)}this._iosGesture.onScroll({isScrolling:a,ownReadBack:p==="readBack",moved:s!==_,external:p==="external"&&((l=this.scrollState)==null?void 0:l.phase)!=="smooth"&&((c=this.scrollState)==null?void 0:c.phase)!=="smoothFinishing"})&&((u=this.scrollState)==null?void 0:u.phase)==="queued"&&(this.scrollState=null),this._flushHoldIfReady(!0),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement&&this.unsubs.push(this._iosGesture.listen(this.scrollElement)),this._scrollToOffset(this.getScrollOffset())}this._noteClampMax();let r=this.pendingScrollAnchor;this.pendingScrollAnchor=null,r&&this.scrollElement&&this.options.enabled&&(r.kind==="anchor"?this._canWriteScroll()?Fu(this.scrollState)&&!Cs(this.getScrollOffset()-r.delta,this.scrollState.lastTargetOffset)||(this._followOffsetTarget(r.delta),this._scrollToOffset(this.getScrollOffset())):(this._holdOffset+=r.delta,this._followOffsetTarget(r.delta),this.notify(!1)):this.scrollToEnd({behavior:r.behavior})),this._flushHoldIfReady(!1),this._retryClampedAdjustment()},this._classifyScrollEvent=(i,n,r)=>{var s;return nA({offset:i,isScrolling:n,elementMax:r,holdOffset:this._holdOffset,scrollOffset:this.scrollOffset,pendingWrite:this.pendingWrite,clampedMaxAtWrite:((s=this._clampedAdjustment)==null?void 0:s.maxAtWrite)??null})},this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled||!this._canWriteScroll())return;let{target:i,maxAtWrite:n}=this._clampedAdjustment,r=this.getMaxScrollOffset();r>n+.5&&(this._clampedAdjustment=i>r+.5?{target:i,maxAtWrite:r}:null,this._scrollToOffset(i))},this._writeAwaitingCommand=()=>{let i=this.scrollState;if(i===null||i.phase!=="queued")return;let{behavior:n}=i;this.getMeasurements();let r=this.getScrollStateTarget(i);i.lastTargetOffset=r,this._clampedAdjustment=null,i.phase=hA(n,i.index!=null&&Cs(r,this.getScrollOffset())),this._scrollToOffset(r,{behavior:n}),this.scheduleScrollReconcile()},this._readElementOffset=()=>{let i=this.scrollElement;if(i==null)return null;let{horizontal:n,isRtl:r}=this.options;return typeof i.scrollTop=="number"?n?i.scrollLeft*(r&&-1||1):i.scrollTop:typeof i.scrollY=="number"?n?i.scrollX:i.scrollY:null},this._canWriteScroll=()=>!(qu()&&this._iosGesture.inMotion())&&!this._reportedOverscroll,this._flushHoldIfReady=i=>{var n;if(this._holdOffset===0||!this.scrollElement||!this.options.enabled||!this._canWriteScroll()||((n=this.scrollState)==null?void 0:n.phase)==="smooth")return;this._holdOffset=0,this.scrollOffset!==null&&this.scrollOffset<0&&(this.scrollOffset=0),this.notify(i);let r=this.getCommandWrittenOffset()??this.getScrollOffset();this._clampedAdjustment=this._clampedBy(r),this._scrollToOffset(r)},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=vo(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(i,n,r,s,a,o,l,c)=>(this.prevLanes!==void 0&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMin=null,{count:i,paddingStart:n,scrollMargin:r,getItemKey:s,enabled:a,lanes:o,laneAssignmentMode:l,gap:c}),{key:!1}),this.isIndexInRange=i=>i>=0&&i[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:i,paddingStart:n,scrollMargin:r,getItemKey:s,enabled:a,lanes:o,laneAssignmentMode:l,gap:c},u)=>{var d;let h=this.itemSizeCache;if(!a)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>i)for(let v of this.laneAssignments.keys())v>=i&&this.laneAssignments.delete(v);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(v=>{this.itemSizeCache.set(v.key,v.size)}));let f=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===i&&(this.lanesSettling=!1),o===1){let v=i*2,b=(d=this._singleLaneMeasurements)==null?void 0:d.flat;if(!b||b.length0&&T.set(b.subarray(0,f*2)),b=T}let w=f===0?new Array(i):this._singleLaneMeasurements.items.slice(),k;if(f===0)k=n+r;else{let T=f-1;k=b[T*2]+b[T*2+1]+c}for(let T=f;T1){k=w;let q=_[k],H=q!==void 0?p[q]:void 0;M=H?H.end+c:n+r}else if(m===o){let q=0,H=y[0],P=_[0];for(let x=1;xthis.options.debug}),this.calculateRange=vo(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(i,n,r,s)=>i.length===0||n===0?(this.range=null,null):(this.range=n6(i,n,r,s,s===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=vo(()=>{let i=null,n=null,r=this.calculateRange();return r&&(i=r.startIndex,n=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,i,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,i,n,this.options.lanes]},(i,n,r,s,a,o)=>s===null||a===null?[]:i({startIndex:s,endIndex:a,overscan:n,count:r,lanes:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=i=>{let n=this.options.indexAttribute,r=i.getAttribute(n);return r?parseInt(r,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=i=>{var n;if(!Fu(this.scrollState))return!0;let r=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(r!==void 0&&this.range){let s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,r-s),o=Math.min(this.options.count-1,r+s);return i>=a&&i<=o}return!0},this.measureElement=i=>{if(!i){this.elementsCache.forEach((a,o)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(o))});return}let n=this.indexFromElement(i);if(!this.isIndexInRange(n))return;let r=this.options.getItemKey(n),s=this.elementsCache.get(r);s!==i&&(s&&this.observer.unobserve(s),this.observer.observe(i),this.elementsCache.set(r,i)),i.isConnected&&(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(i,void 0,this))},this.resizeItem=(i,n)=>{var r,s,a;if(!this.isIndexInRange(i))return;(r=this._resizeBatch)!=null&&r.sync&&this.getMeasurements();let o,l,c,u=(s=this._singleLaneMeasurements)==null?void 0:s.flat;if(this.options.lanes===1&&u!=null)c=this.options.getItemKey(i),l=u[i*2],o=u[i*2+1];else{let f=this.measurementsCache[i];if(!f)return;c=f.key,l=f.start,o=f.size}let d=this.itemSizeCache.get(c)??o,h=n-d;if(h!==0){let f=this.options.anchorTo==="end"&&!Fu(this.scrollState)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=f?this._getLayoutTotalSize():0,_=this.getScrollOffset(),m=!this.itemSizeCache.has(c)?l<_:l+d<=_&&this.scrollDirection!=="backward",v=!Fu(this.scrollState)&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[i]??{index:i,key:c,start:l,size:o,end:l+o,lane:0},h,this):m);(this.pendingMin===null||i[this.getVirtualIndexes(),this.getMeasurements(),this._holdOffset],(i,n,r)=>{let s=[];for(let a=0,o=i.length;athis.options.debug}),this.getVirtualItemForOffset=i=>{var n;let r=this.getMeasurements();if(r.length===0)return;let s=(n=this._singleLaneMeasurements)==null?void 0:n.flat,a=this.options.lanes===1&&s!=null,o=_A(0,r.length-1,a?l=>s[l*2]:l=>bb(r[l]).start,i);return bb(r[o])},this._noteClampMax=()=>{if(!this._awaitingCommandReadBack())return;let i=this._elementMaxScrollOffset();if(i===null)return;let n=this.pendingWrite,r=Math.max(i,0)+this._holdOffset;if(r>=n.target)return;let s=n.lowMaxes??(n.lowMaxes=[]);s[s.length-1]!==r&&s.push(r)},this.getMaxScrollOffset=()=>(this._elementMaxScrollOffset()??0)+this._holdOffset,this._toLayoutOffset=i=>{var n;let r=i+this._holdOffset;return((n=this.pendingScrollAnchor)==null?void 0:n.kind)==="anchor"&&(r+=this.pendingScrollAnchor.delta),r},this._elementMaxScrollOffset=()=>{let i=this.scrollElement;if(i===null)return null;if("scrollHeight"in i)return this.options.horizontal?i.scrollWidth-i.clientWidth:i.scrollHeight-i.clientHeight;if("document"in i){let n=i.document.documentElement;return this.options.horizontal?n.scrollWidth-i.innerWidth:n.scrollHeight-i.innerHeight}return null},this._momentumStop=null,this._stopMomentum=i=>{let n=this.scrollElement,r=this.targetWindow;if(n===null||r===null)return;let s="document"in n?n.document.scrollingElement:n;if(!s?.style)return;if(this._momentumStop){this._momentumStop.done=i;return}let{style:a}=s,o=this.options.horizontal?"overflow-x":"overflow-y",l=a.getPropertyValue(o),c=a.getPropertyPriority(o),u=()=>this.options.horizontal?s.clientHeight:s.clientWidth,d=u();if(a.setProperty(o,"hidden","important"),u()!==d){a.setProperty(o,l,c);return}let h={restore:()=>a.getPropertyValue(o)!=="hidden"||a.getPropertyPriority(o)!=="important"?!1:(a.setProperty(o,l,c),!0),done:i};this._momentumStop=h,r.requestAnimationFrame(()=>r.requestAnimationFrame(()=>{this._momentumStop===h&&(this._momentumStop=null,h.restore()&&h.done())}))},this._clampedBy=i=>{let n=this._elementMaxScrollOffset();if(n===null)return null;let r=n+this._holdOffset;return i>r+.5?{target:i,maxAtWrite:r}:null},this.getVirtualDistanceFromEnd=()=>Math.max(this._getLayoutTotalSize()+this.options.scrollMargin-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(i=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=i,this.getOffsetForAlignment=(i,n,r=0)=>{if(!this.scrollElement)return 0;let s=this.getSize(),a=this.getScrollOffset();n==="auto"&&(n=i>=a+s?"end":"start"),n==="center"?i+=(r-s)/2:n==="end"&&(i-=s);let o=this.getMaxScrollOffset();return Math.max(Math.min(o,i),0)},this.getOffsetForIndex=(i,n="auto")=>{i=Math.max(0,Math.min(i,this.options.count-1));let r=this.getSize(),s=this.getScrollOffset(),a=this.measurementsCache[i];if(!a)return;if(n==="auto")if(a.end>=s+r-this.options.scrollPaddingEnd)n="end";else if(a.start<=s+this.options.scrollPaddingStart)n="start";else return[s,n];if(n==="end"&&i===this.options.count-1){let l=this.getMaxScrollOffset(),c=l-this.options.paddingEnd+this.options.scrollPaddingEnd;return[Math.max(Math.min(c,l),0),n]}let o=n==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,n,a.size),n]},this.scrollToOffset=(i,{align:n="start",behavior:r="auto"}={})=>{this._startScroll({index:null,align:n},this.getOffsetForAlignment(i,n),r,"absolute")},this.scrollToIndex=(i,{align:n="auto",behavior:r="auto"}={})=>{i=Math.max(0,Math.min(i,this.options.count-1));let s=this.getOffsetForIndex(i,n);if(!s)return;let[a,o]=s;this._startScroll({index:i,align:o},a,r,"absolute")},this.scrollBy=(i,{behavior:n="auto"}={})=>{let r=this.getOffsetForAlignment((this.getCommandWrittenOffset()??this.getScrollOffset())+i,"start");this._startScroll({index:null,align:"start"},r,n,"relative")},this.scrollToEnd=({behavior:i="auto"}={})=>{if(this.options.count>0){this._startScroll({index:this.options.count-1,align:"end",toEnd:!0},Math.max(this.getMaxScrollOffset(),0),i,"absolute");return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:i})},this.cancelScroll=()=>{this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null},this.getTotalSize=()=>Math.max(this._getLayoutTotalSize()-this._holdOffset,0),this._getLayoutTotalSize=()=>{var i,n;let r=this.getMeasurements(),s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1){let a=r.length-1,o=(i=this._singleLaneMeasurements)==null?void 0:i.flat;o!=null?s=o[a*2]+o[a*2+1]:s=((n=r[a])==null?void 0:n.end)??0}else{let a=Array(this.options.lanes).fill(null),o=r.length-1;for(;o>=0&&a.some(l=>l===null);){let l=r[o];a[l.lane]===null&&(a[l.lane]=l.end),o--}s=Math.max(...a.filter(l=>l!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let i=[];if(this.itemSizeCache.size===0)return i;let n=this.getMeasurements();for(let r of n)r&&this.itemSizeCache.has(r.key)&&i.push({index:r.index,key:r.key,start:r.start,size:r.size,end:r.end,lane:r.lane});return i},this._scrollToOffset=(i,{adjustments:n,behavior:r}={})=>{let s={target:i+(n??0),smooth:r==="smooth"};return this.pendingWrite=s,this.options.scrollToFn(i-this._holdOffset,{behavior:r,adjustments:n},this),s},this.getCommandWrittenOffset=()=>this.scrollState!==null&&this.pendingWrite!==null&&!this.pendingWrite.smooth?this.pendingWrite.target:null,this._awaitingCommandReadBack=()=>{let i=this.getCommandWrittenOffset();return!(qu()&&this._iosGesture.dragging())&&i!==null&&!Cs(i,this.getScrollOffset())},this._followOffsetTarget=i=>{this.scrollState!==null&&this.scrollState.index==null&&(this.scrollState.lastTargetOffset+=i)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}get scrollAdjustments(){return 0}applyScrollAdjustment(t,i){if(t===0)return!1;if(this._followOffsetTarget(t),this._canWriteScroll()){let n=this.getScrollOffset();this._clampedAdjustment=this._clampedBy(n+t);let r=this._scrollToOffset(n,{adjustments:t,behavior:i});return this.scrollOffset!==null&&(this.pendingWrite===r&&(this.scrollOffset+=t),this.scrollOffset<0&&(this.scrollOffset=0)),!0}else return this._holdOffset+=t,this.scrollOffset!==null&&(this.scrollOffset+=t),!0}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}getScrollStateTarget(t){let i=t.toEnd?[Math.max(this.getMaxScrollOffset(),0)]:t.index!=null?this.getOffsetForIndex(t.index,t.align):void 0;return i?i[0]:t.lastTargetOffset}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}if(this.scrollState.phase==="queued"){this.scheduleScrollReconcile();return}this.getMeasurements();let n=this.getScrollStateTarget(this.scrollState),r=this.scrollState.index==null?1:this.options.useAnimationFrameWithResizeObserver?3:2,s=n!==this.scrollState.lastTargetOffset;if(!s&&Cs(n,this.getScrollOffset())){if(this.scrollState.phase==="smooth"?this.scrollState.phase="smoothLanded":this.scrollState.phase==="smoothFinishing"&&(this.scrollState.phase="instant"),this.scrollState.stableFrames++,this.scrollState.stableFrames>=r){this.getScrollOffset()!==n&&this._scrollToOffset(n,{behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,s){let a=this.getSize()||600,o=Math.abs(n-this.getScrollOffset()),l=Fu(this.scrollState)&&o>a;this.scrollState.lastTargetOffset=n,l?this.scrollState.phase="smooth":this.scrollState.phase==="smooth"?this.scrollState.phase="smoothFinishing":this.scrollState.phase==="smoothLanded"&&(this.scrollState.phase="instant"),this._scrollToOffset(n,{behavior:l?"smooth":"auto"})}this.scheduleScrollReconcile()}_startScroll(t,i,n,r){this.pendingScrollAnchor=null,this._clampedAdjustment=null;let s=this._iosGesture.tail();if(r==="absolute"&&s!==null){if(s==="fling"&&lA()){this._stopMomentum(()=>{let a=this.scrollState;a?.phase!=="queued"||this._iosGesture.tail()!=="fling"||this._reportedOverscroll||(this._iosGesture.end(),this._flushHoldIfReady(!0),this._writeAwaitingCommand())}),this.scrollState={...t,startedAt:this.now(),lastTargetOffset:i,stableFrames:0,phase:"queued",behavior:n,samples:[]},this.scheduleScrollReconcile();return}this._iosGesture.end()}this.scrollState={...t,startedAt:this.now(),lastTargetOffset:i,stableFrames:0,behavior:n,phase:hA(n,t.index!=null&&Cs(i,this.getScrollOffset()))},this._scrollToOffset(i,{behavior:n}),this.scheduleScrollReconcile()}},_A=(e,t,i,n)=>{for(;e<=t;){let r=(e+t)/2|0,s=i(r);if(sn)t=r-1;else return r}return e>0?e-1:0}});function r6({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:i="transform",...n}){let r=_r.useReducer(h=>h+1,0)[1],s=_r.useRef({enabled:t,mode:i,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});s.current.enabled=t,s.current.mode=i;let a=_r.useRef(!1),o=h=>{let f=s.current;if(!f.enabled||!f.container)return;let p=h.getTotalSize();if(p!==f.lastSize){f.lastSize=p;let _=h.options.horizontal?"width":"height";f.container.style[_]=`${p}px`}},l=(h,f,p)=>{let _=s.current,y=!!h.options.horizontal,m=f.start-h.options.scrollMargin;_.lastPositions.get(p)!==m&&(_.lastPositions.set(p,m),_.mode==="transform"?p.style.transform=y?`translate3d(${m}px, 0, 0)`:`translate3d(0, ${m}px, 0)`:p.style[y?"left":"top"]=`${m}px`)},c=h=>{let f=s.current;if(!(!f.enabled||!f.container)){o(h);for(let p of h.getVirtualItems()){let _=h.elementsCache.get(p.key);_&&l(h,p,_)}}},u={...n,onChange:(h,f)=>{var p;let _=s.current,y=!0;if(_.enabled){c(h);let m=h.range,v=_.prevRange;y=!v||v.isScrolling!==h.isScrolling||v.startIndex!==m?.startIndex||v.endIndex!==m?.endIndex,y&&(_.prevRange=m?{startIndex:m.startIndex,endIndex:m.endIndex,isScrolling:h.isScrolling}:null)}y&&(e&&f&&!a.current?(0,vA.flushSync)(r):r()),(p=n.onChange)==null||p.call(n,h,f)}},[d]=_r.useState(()=>{let h=new np(u),f=h.measureElement;return h.measureElement=p=>{a.current=!0;try{f(p)}finally{a.current=!1}let _=s.current;if(p!==null&&_.enabled&&_.container){let y=h.measurementsCache[h.indexFromElement(p)];y&&l(h,y,p)}},Object.assign(h,{containerRef:p=>{let _=s.current;_.container=p,_.lastSize=null,p!==null&&c(h)}})});return d.setOptions(u),Eb(()=>d._didMount(),[]),Eb(()=>(o(d),d._willUpdate())),Eb(()=>{c(d)}),d}function bA(e){return r6({observeElementRect:pA,observeElementOffset:mA,scrollToFn:gA,...e})}var _r,vA,Eb,yA=ae(()=>{_r=ne(pt(),1),vA=ne(qs(),1);xb();xb();Eb=typeof document<"u"?_r.useLayoutEffect:_r.useEffect});function SA(e=Date.now()){return kb=(kb+1)%1e6,`c${e.toString(36)}${kb.toString(36)}${Math.random().toString(36).slice(2,8)}`}function Cb(e,t){return t?`u:c:${t}`:`u:${e}`}function wA(e,t){return t.length?[...e,...t]:e}var kb,rp,Tb=ae(()=>{kb=0;rp=class{constructor(){me(this,"list",[])}add(t){let i={ts:Date.now(),...t,state:"sending",echoed:!1,settled:!1,busySeen:!1};return this.list.push(i),i}get(t){return this.list.find(i=>i.clientId===t)}entries(t){return this.list.filter(i=>i.threadId===t)}remove(t){this.list=this.list.filter(i=>i.clientId!==t)}gc(t){t.echoed&&t.settled&&this.remove(t.clientId)}echo(t){if(!t)return!1;let i=this.get(t);return i?(i.echoed=!0,i.state="sending",i.error=void 0,this.gc(i),!0):!1}ok(t,i){let n=this.get(t);if(n){if(i==="queued"&&!n.echoed){this.remove(t);return}n.settled=!0,this.gc(n)}}fail(t,i){let n=this.get(t);return n?(n.settled=!0,n.echoed?(this.gc(n),!1):(n.state="failed",n.error=i,!0)):!1}busy(t){for(let i of this.list)i.threadId===t&&(i.busySeen=!0)}reconcile(t,i){for(let n of i){let r=this.get(n);r&&r.threadId===t&&this.echo(n)}}items(t){return this.entries(t).filter(i=>!i.echoed).map(i=>({kind:"user",key:Cb(0,i.clientId),text:i.payload.text,...i.display.attachments?.length?{attachments:i.display.attachments}:{},...i.display.mentions?.length?{mentions:i.display.mentions}:{},...i.payload.behavior==="steer"?{steered:!0}:{},ts:i.ts,clientId:i.clientId,sendState:i.state,...i.error?{sendError:i.error}:{}}))}starting(t){return this.entries(t).some(i=>i.startsTurn&&i.state==="sending"&&!i.settled&&!i.busySeen)}}});function nc(){return{items:[],seenSeq:new Set,byItemId:new Map,toolLoc:new Map,openGroup:null,reqLoc:new Map,turnUsage:new Map,lastUserIdx:new Map,turnStart:new Map,turnModel:new Map}}function Ts(e){e.openGroup=null}function xA(e,t,i,n){let r=e.byItemId.get(t);if(r){let o=e.items[r.idx];o.text+=n,o.streaming=!0;return}Ts(e);let s=`${i}:${t}`,a=i==="assistant"?{kind:"assistant",key:s,itemId:t,text:n,streaming:!0}:{kind:"reasoning",key:s,itemId:t,text:n,streaming:!0};e.byItemId.set(t,{idx:e.items.length,field:i}),e.items.push(a)}function s6(e,t,i){let n=/^(.*):[ktx]\d+$/.exec(t);if(!n)return;let r=n[1]+":";for(let[s,a]of[...e.byItemId])a.field===i&&s.startsWith(r)&&s!==t&&(e.items[a.idx]={kind:"gone",key:`gone:${s}`},e.byItemId.delete(s))}function EA(e,t,i,n){s6(e,t,i);let r=e.byItemId.get(t);if(r){let o=e.items[r.idx];o.text=n,o.streaming=!1;return}Ts(e);let s=`${i}:${t}`,a=i==="assistant"?{kind:"assistant",key:s,itemId:t,text:n,streaming:!1}:{kind:"reasoning",key:s,itemId:t,text:n,streaming:!1};e.byItemId.set(t,{idx:e.items.length,field:i}),e.items.push(a)}function a6(e,t){let i=e.toolLoc.get(t.itemId);if(i){let a=e.items[i.group];if(a?.kind==="toolgroup"){let o=a.steps[i.step];a.steps[i.step]={...o,kind:t.kind==="other"&&o.kind!=="other"?o.kind:t.kind,title:t.title||o.title,status:t.status,input:t.input??o.input,detail:t.detail??o.detail,output:t.output??o.output,exitCode:t.exitCode??o.exitCode,durationMs:t.durationMs??o.durationMs}}return}let n={itemId:t.itemId,kind:t.kind,title:t.title,status:t.status,input:t.input,detail:t.detail,output:t.output,exitCode:t.exitCode,durationMs:t.durationMs},r=e.openGroup;(r==null||e.items[r]?.kind!=="toolgroup")&&(r=e.items.length,e.items.push({kind:"toolgroup",key:`tg:${t.itemId}`,steps:[]}),e.openGroup=r);let s=e.items[r];e.toolLoc.set(t.itemId,{group:r,step:s.steps.length}),s.steps.push(n)}function sp(e,t){if(t.seq!=null&&t.seq>0){if(e.seenSeq.has(t.seq))return;e.seenSeq.add(t.seq)}switch(t.type){case"user_message":Ts(e),e.lastUserIdx.set(t.turnId??"",e.items.length),e.items.push({kind:"user",key:Cb(t.seq,t.clientId),text:t.text,attachments:t.attachments,...t.mentions?.length?{mentions:t.mentions}:{},steered:t.steered,ts:t.ts,...t.clientId?{clientId:t.clientId}:{}});return;case"assistant_delta":xA(e,t.itemId,"assistant",t.text);return;case"reasoning_delta":xA(e,t.itemId,"reasoning",t.text);return;case"assistant_message":EA(e,t.itemId,"assistant",t.text);return;case"reasoning":EA(e,t.itemId,"reasoning",t.text);return;case"tool_output_delta":{let i=e.toolLoc.get(t.itemId);if(i){let n=e.items[i.group];if(n?.kind==="toolgroup"){let r=n.steps[i.step];r.output=(r.output??"")+t.text}}return}case"tool_call":a6(e,t);return;case"plan":if(Ts(e),t.entries?.length){e.items.push({kind:"todo",key:`todo:${t.seq}`,items:t.entries.map(i=>({text:i.step,status:i.status==="completed"?"done":i.status||"pending"}))});return}e.items.push({kind:"plan",key:`plan:${t.itemId}`,itemId:t.itemId,markdown:t.markdown});return;case"todo":Ts(e),e.items.push({kind:"todo",key:`todo:${t.seq}`,items:t.items});return;case"permission_request":Ts(e),e.reqLoc.set(t.requestId,e.items.length),e.items.push({kind:"permission",key:`perm:${t.requestId}`,requestId:t.requestId,title:t.title,kindStr:t.kind,detail:t.detail,options:t.options,status:"pending",...t.auto?{auto:!0}:{}});return;case"permission_resolved":{let i=e.reqLoc.get(t.requestId),n=i!=null?e.items[i]:null;n?.kind==="permission"?(n.status=t.cancelled?"cancelled":"resolved",n.choice=t.optionId,t.auto&&(n.auto=!0)):n?.kind==="question"&&t.cancelled&&n.status==="pending"&&(n.status="cancelled");return}case"question":Ts(e),e.reqLoc.set(t.requestId,e.items.length),e.items.push({kind:"question",key:`q:${t.requestId}`,requestId:t.requestId,questions:t.questions,status:"pending"});return;case"question_answered":{let i=e.reqLoc.get(t.requestId),n=i!=null?e.items[i]:null;n?.kind==="question"&&(n.status="answered",n.answers=t.answers);return}case"usage":{let i=t.turnId??"",n=e.turnUsage.get(i)??{inputTokens:0,outputTokens:0,cacheReadTokens:0,costUsd:0};n.inputTokens+=t.inputTokens,n.outputTokens+=t.outputTokens,n.cacheReadTokens+=t.cacheReadTokens,n.costUsd+=t.costUsd,e.turnUsage.set(i,n);return}case"notice":Ts(e),e.items.push({kind:"notice",key:`n:${t.seq}`,level:t.level,message:t.message,...t.code?{code:t.code}:{}});return;case"turn_ended":Ts(e),o6(e),e.items.push({kind:"turnend",key:`te:${t.seq}`,status:t.status,durationMs:t.durationMs??(e.turnStart.has(t.turnId)?Math.max(0,t.ts-e.turnStart.get(t.turnId)):void 0),error:t.error,filesChanged:t.filesChanged,usage:e.turnUsage.get(t.turnId),...e.turnModel.has(t.turnId)?{model:e.turnModel.get(t.turnId)}:{},ts:t.ts});return;case"turn_started":e.turnStart.set(t.turnId,t.ts),e.turnModel.set(t.turnId,t.model??null);return;case"status":return;default:return}}function o6(e){for(let t of e.reqLoc.values()){let i=e.items[t];(i?.kind==="permission"||i?.kind==="question")&&i.status==="pending"&&(i.status="cancelled")}}function Wu(e){let t=[];for(let i of e)(i.kind==="permission"||i.kind==="question")&&i.status==="pending"&&t.push({requestId:i.requestId,kind:i.kind,key:i.key});return t}function kA(e,t={}){let i=nc();for(let s of e)sp(i,s);let n=t.runtimeStatus!=="running"&&t.runtimeStatus!=="initializing",r=null;for(let s of i.items){if(s.kind==="user"&&(r=s.text),n&&s.kind==="permission"&&s.status==="pending"&&(s.status="cancelled"),n&&s.kind==="question"&&s.status==="pending"&&(s.status="cancelled"),n&&s.kind==="toolgroup")for(let a of s.steps)a.status==="running"&&(a.status="failed");(s.kind==="assistant"||s.kind==="reasoning")&&n&&s.streaming&&(s.streaming=!1)}return{items:i.items,lastUserText:r}}var CA=ae(()=>{Tb()});var NA={};U2(NA,{localClientIds:()=>op,useTimeline:()=>Di});function TA(){let e=br!=="running"&&br!=="initializing";for(let t of vr.items)if(e&&t.kind==="permission"&&t.status==="pending"&&(t.status="cancelled"),e&&t.kind==="question"&&t.status==="pending"&&(t.status="cancelled"),e&&(t.kind==="assistant"||t.kind==="reasoning")&&t.streaming&&(t.streaming=!1),e&&t.kind==="toolgroup")for(let i of t.steps)i.status==="running"&&(i.status="failed")}var Dn,op,Nb,vr,bo,br,ap,Di,yo=ae(()=>{Ra();CA();Hi();Tb();Dn=new rp,op=new Set,Nb=e=>e==="running"||e==="initializing",vr=nc(),bo=0,br="idle",ap=null;Di=qn((e,t)=>{let i=s=>({items:wA(vr.items.slice(),Dn.items(s)),status:!Nb(br)&&Dn.starting(s)?"initializing":br}),n=s=>{t().threadId===s&&e(i(s))},r=s=>{ap?.(),ap=Q.subscribe(`thread:${s}`,(a,o)=>{let l=o;if(t().threadId===s){if(l.type==="event"&&l.event){let c=l.event;if(c.seq!=null&&c.seq>0){if(c.seq<=bo)return;bo=Math.max(bo,c.seq)}c.type==="user_message"&&(e({lastUserText:c.text}),Dn.echo(c.clientId)),sp(vr,c),e({...i(s),pending:Wu(vr.items)});return}if(l.type==="status"&&l.status){br=l.status,(Nb(br)||br==="error"||br==="closed")&&Dn.busy(s),TA(),e({...i(s),pending:Wu(vr.items)});return}if(l.type==="queue"&&l.queue){e({queue:l.queue});return}if(l.type==="pending"&&l.pending){e({pending:Wu(vr.items).filter(c=>l.pending.some(u=>u.requestId===c.requestId))});return}if(l.type==="commands"&&l.commands){e({slashCommands:l.commands});return}}},()=>bo)};return{threadId:null,status:"idle",items:[],queue:[],pending:[],lastUserText:null,error:null,slashCommands:[],sentAt:0,open:s=>{t().threadId!==s&&(t().close(),e({threadId:s,status:"initializing",items:Dn.items(s),queue:[],pending:[],lastUserText:null,error:null,slashCommands:[]}),vr=nc(),bo=0,br="initializing",(async()=>{try{let a=await Q.call("threads.get",{id:s});if(t().threadId!==s)return;br=a.runtimeStatus??a.meta.status;let o=kA(a.events,{runtimeStatus:br});vr=nc();for(let l of a.events)sp(vr,l);bo=Math.max(0,...a.events.map(l=>l.seq??0)),Dn.reconcile(s,a.events.flatMap(l=>l.type==="user_message"&&l.clientId?[l.clientId]:[])),TA(),e({...i(s),queue:a.queue??[],pending:Wu(vr.items),lastUserText:o.lastUserText}),t().threadId===s&&r(s)}catch(a){t().threadId===s&&e({error:String(a?.message??a),status:"error"})}})())},close:()=>{ap?.(),ap=null,vr=nc(),bo=0,e({threadId:null,items:[],queue:[],pending:[],lastUserText:null,error:null,status:"idle",slashCommands:[]})},send:async(s,a,o={},l={})=>{let c=SA();if(l.optimistic!==!1){let d=t().threadId===s?t().status:"idle";Dn.add({clientId:c,threadId:s,payload:a,display:o,startsTurn:!Nb(d)&&a.behavior!=="steer"}),op.add(c),t().threadId===s&&e({...i(s),sentAt:Date.now()})}try{let d=await Q.call("thread.send",{id:s,text:a.text,...a.attachments?.length?{attachments:a.attachments}:{},...a.mentions?.length?{mentions:a.mentions}:{},...a.behavior?{behavior:a.behavior}:{},clientId:c});return Dn.ok(c,d?.delivered),n(s),d}catch(d){throw Dn.fail(c,String(d?.message??d)),n(s),d}},retry:s=>{let a=Dn.get(s);!a||a.state!=="failed"||(Dn.remove(s),t().send(a.threadId,a.payload,a.display).catch(()=>{}))},dismiss:s=>{let a=Dn.get(s);!a||a.state!=="failed"||(Dn.remove(s),n(a.threadId))}}})});var lp,AA=ae(()=>{lp=class{constructor(t,i=2,n=8){me(this,"render",t);me(this,"minStep",i);me(this,"frac",n);me(this,"target","");me(this,"shown","");me(this,"raf",0);me(this,"running",!1);me(this,"tick",()=>{if(this.shown===this.target){this.running=!1;return}let t=this.target.length-this.shown.length,i=Math.max(this.minStep,Math.ceil(t/this.frac));this.shown=this.target.slice(0,this.shown.length+i),this.render(this.shown),this.raf=requestAnimationFrame(this.tick)})}push(t){this.target=t,this.shown.length>t.length&&(this.shown=t),this.running||(this.running=!0,this.tick())}flush(){this.shown=this.target,this.render(this.shown),this.running=!1,this.raf&&cancelAnimationFrame(this.raf)}stop(){this.running=!1,this.raf&&cancelAnimationFrame(this.raf)}}});function rc(){let e=location.hash.startsWith("#")?location.hash.slice(1):location.hash;return new URLSearchParams(e).get("t")??""}var cp=ae(()=>{});function l6(e){return e==="+"||e==="-"?e:" "}function MA(e){if(!Array.isArray(e))return[];let t=[];for(let i of e){if(!i||typeof i!="object")continue;let n=i,r=[];for(let a of Array.isArray(n.lines)?n.lines:[]){if(!a||typeof a!="object")continue;let o=typeof a.text=="string"?a.text:typeof a.s=="string"?a.s:"";r.push({t:l6(a.t),text:o})}let s=typeof n.head=="string"?n.head:void 0;s===void 0&&Number.isInteger(n.oldStart)&&Number.isInteger(n.newStart)&&(s=`@@ -${n.oldStart} +${n.newStart} @@`),t.push({head:s,lines:r})}return t}var OA=ae(()=>{});function Ab(e){return e.kind==="reasoning"&&e.text.trim().length<=200}function RA(e){return{itemId:`think:${e.itemId}`,kind:"think",title:"",status:e.streaming?"running":"ok",think:{text:e.text,streaming:e.streaming}}}function c6(e){let t=new Set,i=null;for(let n of e)n.kind==="user"?i=null:n.kind==="todo"&&(i&&t.add(i),i=n);return t}function DA(e,t={}){let i=t.showThinking!==!1,n=c6(e),r=[],s=null,a=[],o=()=>{for(let l of a)(l.streaming||l.text.trim())&&r.push(l);a=[]};for(let l of e)if(!(l.kind==="gone"||n.has(l))){if(l.kind==="toolgroup"){let c=l.steps.filter(u=>u.kind!=="todo");if(!c.length)continue;s?s.steps.push(...c):(s={kind:"toolgroup",key:l.key,steps:[...i?a.map(RA):[],...c]},a=[],r.push(s));continue}if(l.kind==="reasoning"){if(!i)continue;if(Ab(l)){if(!l.streaming&&!l.text.trim())continue;s?s.steps.push(RA(l)):a.push(l);continue}}o(),s=null,r.push(l)}return o(),r}function Mb(e){switch(e){case"think":return"think";case"edit":case"write":return"edit";case"bash":return"run";case"read":return"read";case"search":case"glob":case"web":return"search";default:return"other"}}function LA(e){let t=new Map,i=0,n=0;for(let r of e){let s=Mb(r.kind);if(s==="think"){n+=r.think?.text.length??0;continue}t.set(s,(t.get(s)??0)+1),r.status==="failed"&&i++}return{counts:u6.filter(r=>t.has(r)).map(r=>[r,t.get(r)]),failed:i,thinkSecs:n?Math.max(1,Math.round(n/40)):0}}function Ob(e){let t=e.input??{},i=e.detail??{};return(yr(i.command)||yr(t.command)||yr(t.cmd)||yr(t.file_path)||yr(t.path)||yr(i.path)||yr(t.filePath)||yr(t.pattern)||yr(t.query)||yr(t.url)||yr(e.title)).replace(/\s+/g," ")}function IA(e){for(let i=e.length-1;i>=0;i--){let n=e[i];if(n.status==="running"&&n.kind!=="think")return n}let t=e[e.length-1];return t&&t.kind==="think"&&t.think?.streaming?t:null}function zA(e){let t=0;for(let i of e)i.kind!=="think"&&t++;return t}function BA(e){let t=e.detail??null;if(!t||typeof t!="object")return null;if(typeof t.added=="number"&&typeof t.removed=="number")return{added:t.added,removed:t.removed};let i=Array.isArray(t.hunks)?t.hunks:Array.isArray(t.diff?.hunks)?t.diff.hunks:null;if(!i)return null;let n=0,r=0;for(let s of i)for(let a of s.lines??[])a?.t==="+"?n++:a?.t==="-"&&r++;return{added:n,removed:r}}function dp(e){return{done:e.filter(t=>t.status==="done"||t.status==="completed").length,total:e.length}}function PA(e){for(let t=e.length-1;t>=0;t--){let i=e[t];if(i.kind==="todo")return i.items.some(n=>n.status!=="done")?i:null;if(i.kind==="user")return null}return null}var up,u6,yr,$u=ae(()=>{up=6;u6=["edit","run","read","search","other"];yr=e=>typeof e=="string"&&e.trim()?e.trim():""});function d6(e){let t=e.replace(/\r\n?/g,` +`}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${Dn(e,!0)}`}br(e){return"
"}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,text:i,tokens:n,autolink:r}){let s=r?Dn(i,!0):this.parser.parseInline(n),a=CN(e);if(a===null)return s;e=Dn(a,r);let o='
",o}image({href:e,title:t,text:i,tokens:n}){n&&(i=this.parser.parseInline(n,this.parser.textRenderer));let r=CN(e);if(r===null)return Dn(i);e=r;let s=`${Dn(i)}{let a=r[s].flat(1/0);_o(i,this.walkTokens(a,t))}):r.tokens&&_o(i,this.walkTokens(r.tokens,t))}}return i}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(i=>{let n={...i};if(n.async=this.defaults.async||n.async||!1,i.extensions&&(i.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let s=t.renderers[r.name];s?t.renderers[r.name]=function(...a){let o=r.renderer.apply(this,a);return o===!1&&(o=s.apply(this,a)),o}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[r.level];s?s.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),n.extensions=t),i.renderer){let r=this.defaults.renderer||new ic(this.defaults);for(let s in i.renderer){if(!(s in r))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,o=i.renderer[a],l=r[a];r[a]=(...c)=>{let u=o.apply(r,c);return u===!1&&(u=l.apply(r,c)),u||""}}n.renderer=r}if(i.tokenizer){let r=this.defaults.tokenizer||new tc(this.defaults);for(let s in i.tokenizer){if(!(s in r))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,o=i.tokenizer[a],l=r[a];r[a]=(...c)=>{let u=o.apply(r,c);return u===!1&&(u=l.apply(r,c)),u}}n.tokenizer=r}if(i.hooks){let r=this.defaults.hooks||new Hu;for(let s in i.hooks){if(!(s in r))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let a=s,o=i.hooks[a],l=r[a];Hu.passThroughHooks.has(s)?r[a]=c=>{if(r.options.async&&Hu.passThroughHooksRespectAsync.has(s))return(async()=>{let d=await o.call(r,c);return l.call(r,d)})();let u=o.call(r,c);return l.call(r,u)}:r[a]=(...c)=>{if(r.options.async)return(async()=>{let d=await o.apply(r,c);return d===!1&&(d=await l.apply(r,c)),d})();let u=o.apply(r,c);return u===!1&&(u=l.apply(r,c)),u}}n.hooks=r}if(i.walkTokens){let r=this.defaults.walkTokens,s=i.walkTokens;n.walkTokens=function(a){let o=[];return o.push(s.call(this,a)),r&&_o(o,r.call(this,a)),o}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return br.lex(e,t??this.defaults)}parser(e,t){return yr.parse(e,t??this.defaults)}parseMarkdown(e){return(t,i)=>{let n={...i},r={...this.defaults,...n},s=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&n.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=e),r.async)return(async()=>{let a=r.hooks?await r.hooks.preprocess(t):t,o=await(r.hooks?await r.hooks.provideLexer(e):e?br.lex:br.lexInline)(a,r),l=r.hooks?await r.hooks.processAllTokens(o):o;r.walkTokens&&await Promise.all(this.walkTokens(l,r.walkTokens));let c=await(r.hooks?await r.hooks.provideParser(e):e?yr.parse:yr.parseInline)(l,r);return r.hooks?await r.hooks.postprocess(c):c})().catch(s);try{r.hooks&&(t=r.hooks.preprocess(t));let a=(r.hooks?r.hooks.provideLexer(e):e?br.lex:br.lexInline)(t,r);r.hooks&&(a=r.hooks.processAllTokens(a)),r.walkTokens&&this.walkTokens(a,r.walkTokens);let o=(r.hooks?r.hooks.provideParser(e):e?yr.parse:yr.parseInline)(a,r);return r.hooks&&(o=r.hooks.postprocess(o)),o}catch(a){return s(a)}}}onError(e,t){return i=>{if(i.message+=` +Please report this to https://github.com/markedjs/marked.`,e){let n="

An error occurred:

"+Dn(i.message+"",!0)+"
";return t?Promise.resolve(n):n}if(t)return Promise.reject(i);throw i}}},yo=new A4;et.options=et.setOptions=function(e){return yo.setOptions(e),et.defaults=yo.defaults,RN(et.defaults),et};et.getDefaults=lb;et.defaults=So;et.use=M4;et.walkTokens=function(e,t){return yo.walkTokens(e,t)};et.parseInline=yo.parseInline;et.Parser=yr;et.parser=yr.parse;et.Renderer=ic;et.TextRenderer=mb;et.Lexer=br;et.lexer=br.lex;et.Tokenizer=tc;et.Hooks=Hu;et.parse=et;Oq=et.options,Rq=et.setOptions,Dq=et.walkTokens,Lq=et.parseInline,Iq=yr.parse,zq=br.lex});function O4(e,t){this.v=e,this.k=t}function WN(e,t){(t==null||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i1?i-1:0),r=1;r2&&arguments[2]!==void 0?arguments[2]:wo;if(KN&&KN(e,null),!ac(t))return e;let n=t.length;for(;n--;){let r=t[n];if(typeof r=="string"){let s=i(r);s!==r&&(B4(t)||(t[n]=s),r=s)}e[r]=!0}return e}function W4(e){for(let t=0;t0&&arguments[0]!==void 0?arguments[0]:o6(),t=V=>uA(V);if(t.version="3.4.17",t.removed=[],!e||!e.document||e.document.nodeType!==Qt.document||!e.Element)return t.isSupported=!1,t;let i=e.document,n=i,r=n.currentScript;e.DocumentFragment;let s=e.HTMLTemplateElement,a=e.Node,o=e.Element,l=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let c=e.DOMParser,u=e.trustedTypes,d=o.prototype,h=tr(d,"cloneNode"),f=tr(d,"remove"),p=tr(d,"removeAttributeNode"),_=tr(d,"nextSibling"),y=tr(d,"childNodes"),m=tr(d,"parentNode"),v=tr(d,"shadowRoot"),b=tr(d,"attributes"),w=a&&a.prototype?tr(a.prototype,"nodeType"):null,k=a&&a.prototype?tr(a.prototype,"nodeName"):null,M=a&&a.prototype?tr(a.prototype,"ownerDocument"):null,T=function(S){return w?w(S):S.nodeType},A=function(S){return k?k(S):S.nodeName},L=G4(d,"namespaceURI"),B=function(S){return L?L(S):S.namespaceURI};if(typeof s=="function"){let V=i.createElement("template");V.content&&V.content.ownerDocument&&(i=V.content.ownerDocument)}let q,H="",P,x=!1,U=0,C=function(){if(U>0)throw Ts('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},D=function(S){C(),U++;try{return q.createHTML(S)}finally{U--}},R=function(S){C(),U++;try{return q.createScriptURL(S)}finally{U--}},Y=function(){return x||(P=l6(u,r),x=!0),P},z=i,I=z.implementation,j=z.createNodeIterator,ve=z.createDocumentFragment,de=z.getElementsByTagName,Ae=n.importNode,re=rA();t.isSupported=typeof sA=="function"&&typeof m=="function"&&I&&I.createHTMLDocument!==void 0;let ut=X4,zi=Z4,$t=Q4,ue=J4,gt=e6,tt=t6,Ce=i6,ei=r6,xi=tA,fe=null,dt=je({},[...ZN,...bb,...yb,...Sb,...QN]),se=null,ji=je({},[...JN,...wb,...eA,...up]),Ke=Object.seal(sc(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),We=null,qn=null,Lt=Object.seal(sc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Fn=!0,vn=!0,J=!1,ce=!0,be=!1,Re=!0,st=!1,Bi=!1,is=null,bn=null,_c=!1,Bs=!1,ns=!1,Ps=!1,vc=!0,Md=!1,bc="user-content-",Bo=!0,yc=!1,rs=null,Hs={},lr=null,Po=je({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]),Ho=null,Od=je({},["audio","video","img","source","image","track"]),Rd=null,E=je({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),X="http://www.w3.org/1998/Math/MathML",le="http://www.w3.org/2000/svg",me="http://www.w3.org/1999/xhtml",He=me,_t=!1,Yt=null,Ba=je({},[X,le,me],vb),cr=pi(["mi","mo","mn","ms","mtext"]),Ei=je({},cr),yy=pi(["annotation-xml"]),am=je({},yy),R2=je({},["title","style","font","a","script"]),Sc=null,D2=["application/xhtml+xml","text/html"],L2="text/html",Wt=null,Uo=null,I2=i.createElement("form"),Sy=function(S){return S instanceof RegExp||S instanceof Function},om=function(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Uo&&Uo===S)return;(!S||typeof S!="object")&&(S={}),S=Ln(S),Sc=D2.indexOf(S.PARSER_MEDIA_TYPE)===-1?L2:S.PARSER_MEDIA_TYPE,Wt=Sc==="application/xhtml+xml"?vb:wo,fe=Ca(S,"ALLOWED_TAGS",dt,{transform:Wt}),se=Ca(S,"ALLOWED_ATTR",ji,{transform:Wt}),Yt=Ca(S,"ALLOWED_NAMESPACES",Ba,{transform:vb}),Rd=Ca(S,"ADD_URI_SAFE_ATTR",E,{transform:Wt,base:E}),Ho=Ca(S,"ADD_DATA_URI_TAGS",Od,{transform:Wt,base:Od}),lr=Ca(S,"FORBID_CONTENTS",Po,{transform:Wt}),We=Ca(S,"FORBID_TAGS",Ln({}),{transform:Wt}),qn=Ca(S,"FORBID_ATTR",Ln({}),{transform:Wt}),Hs=mn(S,"USE_PROFILES")?S.USE_PROFILES&&typeof S.USE_PROFILES=="object"?Ln(S.USE_PROFILES):S.USE_PROFILES:!1,Fn=S.ALLOW_ARIA_ATTR!==!1,vn=S.ALLOW_DATA_ATTR!==!1,J=S.ALLOW_UNKNOWN_PROTOCOLS||!1,ce=S.ALLOW_SELF_CLOSE_IN_ATTR!==!1,be=S.SAFE_FOR_TEMPLATES||!1,Re=S.SAFE_FOR_XML!==!1,st=S.WHOLE_DOCUMENT||!1,Bs=S.RETURN_DOM||!1,ns=S.RETURN_DOM_FRAGMENT||!1,Ps=S.RETURN_TRUSTED_TYPE||!1,_c=S.FORCE_BODY||!1,vc=S.SANITIZE_DOM!==!1,Md=S.SANITIZE_NAMED_PROPS||!1,Bo=S.KEEP_CONTENT!==!1,yc=S.IN_PLACE||!1,xi=j4(S.ALLOWED_URI_REGEXP)?S.ALLOWED_URI_REGEXP:tA,He=typeof S.NAMESPACE=="string"?S.NAMESPACE:me,Ei=Eb(S,"MATHML_TEXT_INTEGRATION_POINTS",()=>je({},cr)),am=Eb(S,"HTML_INTEGRATION_POINTS",()=>je({},yy));let N=Eb(S,"CUSTOM_ELEMENT_HANDLING",()=>sc(null));if(Ke=sc(null),mn(N,"tagNameCheck")&&Sy(N.tagNameCheck)&&(Ke.tagNameCheck=N.tagNameCheck),mn(N,"attributeNameCheck")&&Sy(N.attributeNameCheck)&&(Ke.attributeNameCheck=N.attributeNameCheck),mn(N,"allowCustomizedBuiltInElements")&&typeof N.allowCustomizedBuiltInElements=="boolean"&&(Ke.allowCustomizedBuiltInElements=N.allowCustomizedBuiltInElements),Li(Ke),be&&(vn=!1),ns&&(Bs=!0),Hs&&(fe=je({},QN),se=sc(null),Hs.html===!0&&(je(fe,ZN),je(se,JN)),Hs.svg===!0&&(je(fe,bb),je(se,wb),je(se,up)),Hs.svgFilters===!0&&(je(fe,yb),je(se,wb),je(se,up)),Hs.mathMl===!0&&(je(fe,Sb),je(se,eA),je(se,up))),Lt.tagCheck=null,Lt.attributeCheck=null,mn(S,"ADD_TAGS")&&(typeof S.ADD_TAGS=="function"?Lt.tagCheck=S.ADD_TAGS:ac(S.ADD_TAGS)&&(fe===dt&&(fe=Ln(fe)),je(fe,S.ADD_TAGS,Wt))),mn(S,"ADD_ATTR")&&(typeof S.ADD_ATTR=="function"?Lt.attributeCheck=S.ADD_ATTR:ac(S.ADD_ATTR)&&(se===ji&&(se=Ln(se)),je(se,S.ADD_ATTR,Wt))),mn(S,"ADD_FORBID_CONTENTS")&&ac(S.ADD_FORBID_CONTENTS)&&(lr===Po&&(lr=Ln(lr)),je(lr,S.ADD_FORBID_CONTENTS,Wt)),Bo&&(fe["#text"]=!0),st&&je(fe,["html","head","body"]),fe.table&&(je(fe,["tbody"]),delete We.tbody),S.TRUSTED_TYPES_POLICY){if(typeof S.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ts('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof S.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ts('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let K=q;q=S.TRUSTED_TYPES_POLICY;try{H=D("")}catch(G){throw q=K,G}}else S.TRUSTED_TYPES_POLICY===null?(q=void 0,H=""):(q===void 0&&(q=Y()),q&&typeof H=="string"&&(H=D("")));pi&&pi(S),Uo=S},wy=je({},[...bb,...yb,...Y4]),xy=je({},[...Sb,...V4]),z2=function(S,N,K){return N.namespaceURI===me?S==="svg":N.namespaceURI===X?S==="svg"&&(K==="annotation-xml"||Ei[K]):!!wy[S]},B2=function(S,N,K){return N.namespaceURI===me?S==="math":N.namespaceURI===le?S==="math"&&am[K]:!!xy[S]},P2=function(S,N,K){return N.namespaceURI===le&&!am[K]||N.namespaceURI===X&&!Ei[K]?!1:!xy[S]&&(R2[S]||!wy[S])},H2=function(S){let N=B(S),K=wo(A(S)),G=m(S),pe,we;return G&&T(G)===Qt.element?(pe={namespaceURI:B(G)},we=wo(A(G))):(pe={namespaceURI:He},we="template"),Yt[N]?N===le?z2(K,pe,we):N===X?B2(K,pe,we):N===me?P2(K,pe,we):!!(Sc==="application/xhtml+xml"&&Yt[N]):!1},Us=function(S){$u(t.removed,{element:S});try{m(S).removeChild(S)}catch{if(f(S),!m(S))throw Ts("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Ey=function(S,N,K){try{p(S,N)}catch{try{S.removeAttribute(K)}catch{}}},lm=function(S){um(S);let N=y(S);N&&Cs(H4(N),G=>{try{f(G)}catch{}});let K=T(S)===Qt.element?b(S):null;if(K)for(let G=K.length-1;G>=0;--G){let pe=K[G],we=pe&&pe.name;typeof we=="string"&&Ey(S,pe,we)}},qo=function(S,N,K){if(!K)try{K=N.getAttributeNode(S)}catch{K=null}$u(t.removed,{attribute:K||null,from:N});try{K?p(N,K):N.removeAttribute(S)}catch{try{N.removeAttribute(S)}catch{}}if(S==="is")if(Bs||ns)try{Us(N)}catch{}else try{N.setAttribute(S,"")}catch{}},ky=function(S){let N=b(S);if(N)for(let K=N.length-1;K>=0;--K){let G=N[K],pe=G&&G.name;typeof pe!="string"||se[Wt(pe)]||Ey(S,G,pe)}},cm=function(S,N){let K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,G=[S];for(;G.length>0;){let pe=G.pop();if(N(pe)===!1)continue;if(K&&T(pe)===Qt.element){let Pe=v(pe);qs(Pe)&&G.push(Pe)}let we=y(pe);if(we)for(let Pe=we.length-1;Pe>=0;--Pe)G.push(we[Pe])}},um=function(S){cm(S,N=>{T(N)===Qt.element&&ky(N)})},dm=function(S){let N=[];return cm(S,K=>{N.push(K)},!0),N},U2=function(S,N){let K=gb();Cs(dm(S),G=>{T(G)===Qt.element&&_b(K,G)}),Cs(N,G=>{T(G)===Qt.element&&!Wu(K,G)&&ky(G)})},Cy=function(S,N){let K=!1;return Cs(t.removed,G=>{G.element&&(K=K||G.element===S,um(G.element))}),U2(S,N),K},q2=8,F2=function(S,N){let K=rs,G=null,pe=()=>(G||(G=gb(),Cs(N,we=>{_b(G,we)})),G);for(let we=0;;we++){let Pe=dm(S),ti=[S],Tr=!1;if(Cs(Pe,Yi=>{T(Yi)===Qt.documentFragment?$u(ti,Yi):!Tr&&!Wu(K,Yi)&&(Tr=Wu(pe(),Yi))}),!Tr)return;if(we>=q2)throw Ts("the tree kept changing during in-place sanitization; refusing to return it");Cs(ti,(Yi,sn)=>{$2(Yi,sn>0,S,pe())})}},$2=function(S,N,K,G){let pe=hm(S),we;for(;we=pe.nextNode();)!Wu(G,we)||Wu(rs,we)||(N&&ur(re.uponSanitizeShadowNode,we,null),pm(we,K),mm(we,K),qs(we.content)&&xc(we.content))},W2=function(S){rs&&_b(rs,S)},Ty=function(S,N){return Re?S==="patchsrc"?!0:S==="for"&&N!=="label"&&N!=="output":!1},K2=function(S){Re&&cm(S,N=>{let K=T(N);if(K===Qt.processingInstruction||K===Qt.comment&&Di(iA,N.data)){try{f(N)}catch{}return!1}if(K===Qt.element){let G=N,pe=Wt(A(N));try{G.hasAttribute&&G.hasAttribute("patchsrc")&&G.removeAttribute("patchsrc"),G.hasAttribute&&G.hasAttribute("for")&&Ty("for",pe)&&G.removeAttribute("for")}catch{}}return!0})},Ny=function(S){let N=null,K=null;if(_c)S=""+S;else{let we=jN(S,/^[\r\n\t ]+/);K=we&&we[0]}Sc==="application/xhtml+xml"&&He===me&&(S=''+S+"");let G=q?D(S):S;if(He===me)try{N=new c().parseFromString(G,Sc)}catch{}if(!N||!N.documentElement){N=I.createDocument(He,"template",null);try{N.documentElement.innerHTML=_t?H:G}catch{}}let pe=N.body||N.documentElement;return S&&K&&pe.insertBefore(i.createTextNode(K),pe.childNodes[0]||null),He===me?de.call(N,st?"html":"body")[0]:st?N.documentElement:pe},hm=function(S){let N=M?M(S):S.ownerDocument;return j.call(N||S,S,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Dd=function(S){return S=Ku(S,ut," "),S=Ku(S,zi," "),S=Ku(S,$t," "),S},fm=function(S){var N;Ay(S);let K=(N=S.querySelectorAll)===null||N===void 0?void 0:N.call(S,"template");K&&Cs(K,G=>{qs(G.content)&&fm(G.content)})},Ay=function(S){S.normalize();let N=M?M(S):S.ownerDocument,K=j.call(N||S,S,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null),G=K.nextNode();for(;G;)G.data=Dd(G.data),G=K.nextNode()},Ld=function(S){let N=k?k(S):null;return typeof N!="string"||Wt(N)!=="form"?!1:typeof S.nodeName!="string"||typeof S.textContent!="string"||typeof S.removeChild!="function"||S.attributes!==b(S)||typeof S.removeAttribute!="function"||typeof S.removeAttributeNode!="function"||typeof S.getAttributeNode!="function"||typeof S.setAttribute!="function"||typeof S.namespaceURI!="string"||typeof S.insertBefore!="function"||typeof S.hasChildNodes!="function"||S.nodeType!==w(S)||S.childNodes!==y(S)},qs=function(S){if(!w||typeof S!="object"||S===null)return!1;try{return w(S)===Qt.documentFragment}catch{return!1}},wc=function(S){if(!w||typeof S!="object"||S===null)return!1;try{return typeof w(S)=="number"}catch{return!1}};function ur(V,S,N){V.length!==0&&Cs(V,K=>{K.call(t,S,N,Uo)})}let G2=function(S,N){return!!(Re&&S.hasChildNodes()&&!wc(S.firstElementChild)&&Di(xb,S.textContent)&&Di(xb,S.innerHTML)||Re&&a6[N]&&T(S)===Qt.element&&B(S)===me&&(wc(S.firstElementChild)||typeof S.textContent=="string"&&Di(xb,S.textContent))||S.nodeType===Qt.processingInstruction||Re&&S.nodeType===Qt.comment&&Di(iA,S.data))},Id=function(S,N){if(S instanceof RegExp)return Di(S,N);if(S instanceof Function){for(var K=arguments.length,G=new Array(K>2?K-2:0),pe=2;pe=0;--Pe){let ti=S===K?h(pe[Pe],!0):pe[Pe];G.insertBefore(ti,_(S))}}}return Us(S),!0},My=function(S,N,K,G){return S.length===0?N:N===K||N===G?Ln(N):N},Fo=function(S,N){return S===N||m(S)!==null?!1:(yc&&um(S),!0)},pm=function(S,N){if(W2(S),ur(re.beforeSanitizeElements,S,null),Fo(S,N))return!0;if(Ld(S))return Us(S),!0;let K=Wt(A(S));if(fe=My(re.uponSanitizeElement,fe,dt,is),ur(re.uponSanitizeElement,S,{tagName:K,allowedTags:fe}),Fo(S,N))return!0;if(G2(S,K))return Us(S),!0;if(We[K]||!(Lt.tagCheck instanceof Function&&Lt.tagCheck(K))&&!fe[K]){let G=j2(S,K,N);return G===!1&&(ur(re.afterSanitizeElements,S,null),Fo(S,N))?!0:G}if(T(S)===Qt.element&&!H2(S)||(K==="noscript"||K==="noembed"||K==="noframes")&&Di(s6,S.innerHTML))return Us(S),!0;if(be&&S.nodeType===Qt.text){let G=Dd(S.textContent);S.textContent!==G&&($u(t.removed,{element:S.cloneNode()}),S.textContent=G)}return ur(re.afterSanitizeElements,S,null),Fo(S,N)},Oy=function(S,N,K){if(qn[N]||Ty(N,S)||vc&&(N==="id"||N==="name")&&(K in i||K in I2))return!1;let G=se[N]||Lt.attributeCheck instanceof Function&&Lt.attributeCheck(N,S);return vn&&Di(ue,N)||Fn&&Di(gt,N)?!0:G?Rd[N]||Di(xi,Ku(K,Ce,""))||(N==="src"||N==="xlink:href"||N==="href")&&S!=="script"&&YN(K,"data:")===0&&Ho[S]||J&&!Di(tt,Ku(K,Ce,""))?!0:!K:Ry(S)&&Id(Ke.tagNameCheck,S)&&Id(Ke.attributeNameCheck,N,S)||N==="is"&&Ke.allowCustomizedBuiltInElements&&Id(Ke.tagNameCheck,K)},Y2=je({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ry=function(S){return!Y2[wo(S)]&&Di(ei,S)},V2=function(S,N,K,G){if(q&&typeof u=="object"&&typeof u.getAttributeType=="function"&&!K)switch(u.getAttributeType(S,N)){case"TrustedHTML":return D(G);case"TrustedScriptURL":return R(G)}return G},X2=function(S,N,K,G){try{return K?S.setAttributeNS(K,N,G):S.setAttribute(N,G),Ld(S)?(Us(S),!1):!0}catch{return qo(N,S),!1}},Dy=function(S,N){return Re&&Di(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,N)?!0:wo(S)==="attributename"&&jN(N,"href")!==null},mm=function(S,N){if(ur(re.beforeSanitizeAttributes,S,null),Fo(S,N))return;let K=S.attributes;if(!K||Ld(S))return;se=My(re.uponSanitizeAttribute,se,ji,bn);let G={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:se,forceKeepAttr:void 0},pe=K.length,we=Wt(S.nodeName);for(;pe--;){let Pe=K[pe],ti=Pe.name,Tr=Pe.namespaceURI,Yi=Pe.value,sn=Wt(ti),$o=Yi,an=ti==="value"?$o:q4($o),Ly=!1;if(G.attrName=sn,G.attrValue=an,G.keepAttr=!0,G.forceKeepAttr=void 0,ur(re.uponSanitizeAttribute,S,G),an=G.attrValue,Md&&(sn==="id"||sn==="name")&&YN(an,bc)!==0&&(qo(ti,S,Pe),an=bc+an,Ly=!0),Dy(ti,an)){qo(ti,S,Pe);continue}if(!G.forceKeepAttr){if(!G.keepAttr){qo(ti,S,Pe);continue}if(!ce&&Di(nA,an)){qo(ti,S,Pe);continue}if(be&&(an=Dd(an)),!Oy(we,sn,an)){qo(ti,S,Pe);continue}an=V2(we,sn,Tr,an),an!==$o&&X2(S,ti,Tr,an)&&Ly&&GN(t.removed)}}ur(re.afterSanitizeAttributes,S,null),Fo(S,N)},xc=function(S){let N=null,K=hm(S);for(ur(re.beforeSanitizeShadowDOM,S,null);N=K.nextNode();)if(ur(re.uponSanitizeShadowNode,N,null),pm(N,S),mm(N,S),qs(N.content)&&xc(N.content),T(N)===Qt.element){let G=v(N);qs(G)&&(gm(G),xc(G))}be&&Ay(S),ur(re.afterSanitizeShadowDOM,S,null)},gm=function(S){let N=[{node:S,shadow:null}];for(;N.length>0;){let K=N.pop();if(K.shadow){xc(K.shadow);continue}let G=K.node,pe=T(G)===Qt.element,we=y(G);if(we)for(let Pe=we.length-1;Pe>=0;--Pe)N.push({node:we[Pe],shadow:null});if(pe){let Pe=k?k(G):null;if(typeof Pe=="string"&&Wt(Pe)==="template"){let ti=G.content;qs(ti)&&N.push({node:ti,shadow:null})}}if(pe){let Pe=v(G);qs(Pe)&&N.push({node:null,shadow:Pe},{node:Pe,shadow:null})}}};return t.sanitize=function(V){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},N=null,K=null,G=null,pe=null;if(_t=!V,_t&&(V=""),typeof V!="string"&&!wc(V)&&(V=K4(V),typeof V!="string"))throw Ts("dirty is not a string, aborting");if(!t.isSupported)return V;Bi?(fe=is,se=bn):om(S),(re.uponSanitizeElement.length>0||re.uponSanitizeAttribute.length>0)&&(fe=Ln(fe)),re.uponSanitizeAttribute.length>0&&(se=Ln(se)),t.removed=[];let we=yc&&typeof V!="string"&&wc(V),Pe=[],ti=rs;if(we){K2(V);let sn=A(V);if(typeof sn=="string"){let $o=Wt(sn);if(!fe[$o]||We[$o])throw lm(V),Ts("root node is forbidden and cannot be sanitized in-place")}if(Ld(V))throw lm(V),Ts("root node is clobbered and cannot be sanitized in-place");Pe=dm(V),rs=gb()}else if(wc(V))N=Ny(""),K=N.ownerDocument.importNode(V,!0),K.nodeType===Qt.element&&K.nodeName==="BODY"||K.nodeName==="HTML"?N=K:N.appendChild(K),gm(N);else{if(!Bs&&!be&&!st&&V.indexOf("<")===-1)return q&&Ps?D(V):V;if(N=Ny(V),!N)return Bs?null:Ps?H:""}N&&_c&&Us(N.firstChild);let Tr=we?V:N;try{we&&gm(V);let sn=hm(Tr);for(;G=sn.nextNode();)pm(G,Tr),mm(G,Tr),qs(G.content)&&xc(G.content);we&&F2(V,Pe)}catch(sn){throw we&&(lm(V),Cy(V,Pe)),sn}finally{rs=ti}if(we){if(Cy(V,Pe))throw Ts("a node selected for removal could not be safely returned; refusing to sanitize in place");return be&&fm(V),V}if(Bs){if(be&&fm(N),ns)for(pe=ve.call(N.ownerDocument);N.firstChild;)pe.appendChild(N.firstChild);else pe=N;return(se.shadowroot||se.shadowrootmode)&&(pe=Ae.call(n,pe,!0)),pe}let Yi=st?N.outerHTML:N.innerHTML;return st&&fe["!doctype"]&&N.ownerDocument&&N.ownerDocument.doctype&&N.ownerDocument.doctype.name&&Di(n6,N.ownerDocument.doctype.name)&&(Yi=" +`+Yi),be&&(Yi=Dd(Yi)),q&&Ps?D(Yi):Yi},t.setConfig=function(){let V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};om(V),Bi=!0,is=fe,bn=se},t.clearConfig=function(){Uo=null,Bi=!1,is=null,bn=null,q=P,H=""},t.isValidAttribute=function(V,S,N){Uo||om({});let K=Wt(V),G=Wt(S);return typeof N=="string"&&(Dy(S,N)||!ce&&Di(nA,N))?!1:Oy(K,G,N)},t.addHook=function(V,S){typeof S=="function"&&mn(re,V)&&$u(re[V],S)},t.removeHook=function(V,S){if(mn(re,V)){if(S!==void 0){let N=P4(re[V],S);return N===-1?void 0:U4(re[V],N,1)[0]}return GN(re[V])}},t.removeHooks=function(V){mn(re,V)&&(re[V]=[])},t.removeAllHooks=function(){re=rA()},t}var sA,KN,B4,aA,oA,pi,Li,sc,lA,kb,Cb,Cs,P4,GN,$u,H4,U4,ac,gb,_b,Wu,wo,vb,jN,Ku,YN,q4,F4,$4,VN,XN,mn,Gu,Di,Ts,ZN,bb,yb,Y4,Sb,V4,QN,JN,wb,eA,up,X4,Z4,Q4,J4,e6,tA,t6,i6,n6,r6,xb,iA,s6,nA,Qt,a6,o6,l6,rA,Ca,Eb,dA,hA=te(()=>{cp.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},cp.prototype.next=function(e){return this._invoke("next",e)},cp.prototype.throw=function(e){return this._invoke("throw",e)},cp.prototype.return=function(e){return this._invoke("return",e)};sA=Object.entries,KN=Object.setPrototypeOf,B4=Object.isFrozen,aA=Object.getPrototypeOf,oA=Object.getOwnPropertyDescriptor,pi=Object.freeze,Li=Object.seal,sc=Object.create,lA=typeof Reflect<"u"&&Reflect,kb=lA.apply,Cb=lA.construct;pi||(pi=function(t){return t});Li||(Li=function(t){return t});kb||(kb=function(t,i){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s1?i-1:0),r=1;r"u"?null:Ot(BigInt.prototype.toString),XN=typeof Symbol>"u"?null:Ot(Symbol.prototype.toString),mn=Ot(Object.prototype.hasOwnProperty),Gu=Ot(Object.prototype.toString),Di=Ot(RegExp.prototype.test),Ts=cA(TypeError);ZN=pi(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),bb=pi(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),yb=pi(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Y4=pi(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Sb=pi(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),V4=pi(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),QN=pi(["#text"]),JN=pi(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),wb=pi(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),eA=pi(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),up=pi(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),X4=Li(/{{[\w\W]*|^[\w\W]*}}/g),Z4=Li(/<%[\w\W]*|^[\w\W]*%>/g),Q4=Li(/\${[\w\W]*/g),J4=Li(/^data-[\-\w.\u00B7-\uFFFF]+$/),e6=Li(/^aria-[\-\w]+$/),tA=Li(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),t6=Li(/^(?:\w+script|data):/i),i6=Li(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),n6=Li(/^html$/i),r6=Li(/^[a-z][.\w]*(-[.\w]+)+$/i),xb=Li(/<[/\w!]/g),iA=Li(/<[/\w]/g),s6=Li(/<\/no(script|embed|frames)/i),nA=Li(/\/>/i),Qt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},a6=pi(je({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),o6=function(){return typeof window>"u"?null:window},l6=function(t,i){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null,r="data-tt-policy-suffix";i&&i.hasAttribute(r)&&(n=i.getAttribute(r));let s="dompurify"+(n?"#"+n:"");try{return t.createPolicy(s,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},rA=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ca=function(t,i,n,r){return mn(t,i)&&ac(t[i])?je(r.base?Ln(r.base):{},t[i],r.transform):n},Eb=function(t,i,n){let r=mn(t,i)?t[i]:void 0;return r&&typeof r=="object"?Ln(r):n()};dA=uA()});function Tb(e,t={}){let{wrapped:i,streaming:n=!1}=t,r=[],s=new ic;s.code=({text:o,lang:l,raw:c,codeBlockStyle:u})=>{let d=r.length;r.push(o);let h=!n||mN(c,u);return SN(o,l,d,{wrap:g("timeline.codeWrap"),copy:g("common.copy")},i?.has(d)??!1,h)};let a=et.parse(e,{async:!1,renderer:s});return{html:yN(c6(a)),raws:r}}var c6,Nb=te(()=>{$N();hA();kt();sb();et.setOptions({gfm:!0,breaks:!0});c6=e=>dA.sanitize(e,{USE_PROFILES:{html:!0},ADD_ATTR:["target","aria-pressed","aria-label","aria-hidden","data-i"]})});function Ab({text:e,streaming:t}){let i=(0,Ta.useRef)(null),n=(0,Ta.useRef)([]),r=(0,Ta.useRef)(new Set),s=(0,Ta.useMemo)(()=>Tb(e,{wrapped:r.current,streaming:t}),[e,t]);return n.current=s.raws,(0,Ta.useLayoutEffect)(()=>{let o=i.current;if(!o)return;s.raws.length===0&&r.current.clear(),o.querySelectorAll(".cb").forEach((c,u)=>{let d=r.current.has(u);c.classList.contains("wrap")!==d&&c.classList.toggle("wrap",d),c.querySelector(".cb-wrap")?.setAttribute("aria-pressed",String(d))}),t||rC(o,g("links.openPreviewTitle"))},[s.html,t]),(0,fA.jsx)("div",{ref:i,className:`md${t?" streaming":""}`,onClick:o=>{Kf(o);let l=o.target?.closest?.(".cb-btn"),c=i.current;if(!l||!c||!c.contains(l))return;o.preventDefault();let u=l.closest(".cb");if(u){if(l.classList.contains("cb-wrap")){let d=!u.classList.contains("wrap");u.classList.toggle("wrap",d),l.setAttribute("aria-pressed",String(d));let h=[...c.querySelectorAll(".cb")].indexOf(u);if(h<0)return;d?r.current.add(h):r.current.delete(h);return}if(l.classList.contains("cb-copy")){let d=Number(l.getAttribute("data-i")??"-1"),h=n.current[d]??"";vr(h).then(()=>{l.isConnected&&(l.innerHTML=rb(gN),l.classList.add("done"),setTimeout(()=>{l.isConnected&&(l.innerHTML=rb(nb),l.classList.remove("done"))},1200))})}}},dangerouslySetInnerHTML:{__html:s.html}})}async function vr(e){try{await navigator.clipboard.writeText(e);return}catch{}try{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy"),t.remove()}catch{}}var Ta,fA,Lu=te(()=>{Ta=ie(bt(),1);Wf();Du();kt();sb();Nb();Nb();fA=ie(ye(),1)});function u6(e){let[t,i]=(0,xo.useState)(Date.now());return(0,xo.useEffect)(()=>{if(!e)return;let n=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(n)},[e]),t}function pA({pendingCount:e,pendingKey:t}){let{projects:i,threads:n}=Ge(),r=he(),{version:s}=Gr(),[a,o]=(0,xo.useState)(!1),[l,c]=(0,xo.useState)(!1),[u,d]=(0,xo.useState)(""),[h,f,p]=Ru(),_=n.find(T=>T.id===r.currentThreadId)??null,y=_?i.find(T=>T.id===_.projectId):i.find(T=>T.id===r.currentProjectId),m=_?.status==="running"||_?.status==="initializing",v=u6(m),b=m&&_?Math.max(0,v-_.updatedAt):0,w=_?e>0?{cls:"wait",text:g("topbar.waitAuth")}:m?{cls:"run",text:_e("topbar.running",{s:Math.floor(b/1e3)})}:_.status==="error"?{cls:"err",text:g("topbar.error")}:_.status==="closed"?{cls:"",text:g("topbar.closedResume")}:null:null,k=[{tab:"changes",icon:"changes",title:g("topbar.panelChanges")},{tab:"files",icon:"files",title:g("topbar.panelFiles")},{tab:"terminal",icon:"term",title:g("topbar.panelTerminal")},{tab:"preview",icon:"globe",title:g("preview.tab")}],M=_?[{kind:"item",label:g("common.rename"),onClick:()=>{d(_.title),o(!0)}},{kind:"item",label:g("topbar.threadInfo"),onClick:()=>c(!0)},{kind:"sep"},{kind:"item",label:g("common.settings"),onClick:()=>window.dispatchEvent(new CustomEvent("open-settings"))},{kind:"label",text:s?`v${s}`:""}]:[{kind:"item",label:g("common.settings"),onClick:()=>window.dispatchEvent(new CustomEvent("open-settings"))},{kind:"label",text:s?`v${s}`:""}];return(0,pt.jsxs)("header",{className:"topbar",children:[(0,pt.jsx)(qv,{className:`tb-menu-btn${r.sbHidden?" tb-sb-collapsed":""}`}),y&&(0,pt.jsx)("span",{className:"tb-crumb",children:y.name}),y&&_&&(0,pt.jsx)("span",{className:"tb-sep",children:"/"}),_?a?(0,pt.jsx)("input",{className:"tb-rename",autoFocus:!0,value:u,onChange:T=>d(T.target.value),onBlur:()=>o(!1),onKeyDown:T=>{T.key==="Enter"&&!er(T.nativeEvent)&&u.trim()?(Z.call("threads.update",{id:_.id,title:u.trim()}),o(!1)):T.key==="Escape"&&o(!1)}}):(0,pt.jsx)("span",{className:"tb-title",title:g("topbar.clickRename"),onClick:()=>{d(_.title),o(!0)},children:qd(_.title,_.titleAuto)}):(0,pt.jsx)("span",{className:"tb-title ghost",children:y?g("topbar.pickThread"):g("app.title")}),w&&(w.cls==="wait"&&t?(0,pt.jsx)("button",{type:"button",className:`tb-pill ${w.cls}`,title:g("topbar.showRequest"),onClick:()=>window.dispatchEvent(new CustomEvent("ac-show-item",{detail:{key:t}})),children:w.text}):(0,pt.jsxs)("span",{className:`tb-pill ${w.cls}`,children:[w.cls==="run"&&(0,pt.jsx)("span",{className:"tb-pill-dot"}),w.text]})),(0,pt.jsxs)("div",{className:"tb-right",children:[_?.model&&(0,pt.jsx)("span",{className:"tb-model",children:_.model}),k.map(T=>(0,pt.jsx)("button",{className:`ibtn${r.panelOpen&&r.panelTab===T.tab?" on":""}`,title:T.title,onClick:()=>r.panelOpen&&r.panelTab===T.tab?r.closePanel():r.openPanel(T.tab),children:(0,pt.jsx)(ne,{name:T.icon})},T.tab)),(0,pt.jsx)("button",{className:"ibtn",title:g("common.more"),onClick:T=>f(T),children:(0,pt.jsx)(ne,{name:"dots"})})]}),h&&(0,pt.jsx)(ho,{x:h.x,y:h.y,items:M,onClose:p}),l&&_&&(0,pt.jsx)(d6,{thread:_,project:y,onClose:()=>c(!1)})]})}function d6({thread:e,project:t,onClose:i}){let n=e.usage,r=Ud(),s=[[g("thread.agent"),e.provider],[g("thread.model"),e.model??g("common.default")],[g("thread.mode"),e.mode],[g("thread.effort"),e.effort??g("common.default")],[g("thread.sessionId"),e.providerSessionId??g("thread.sessionNone")],[g("thread.tokens"),_e("thread.tokensFmt",{in:Gl(n.inputTokens),out:Gl(n.outputTokens),cache:Gl(n.cacheReadTokens)})],[g("thread.cost"),n.costUsd>0?qf(n.costUsd):"\u2014"],[g("thread.created"),new Date(e.createdAt).toLocaleString(r)],[g("thread.workdir"),t?.path??"\u2014"]];e.importedFrom&&s.push([g("thread.importedFrom"),`${e.importedFrom.provider} / ${e.importedFrom.sessionId.slice(0,8)}\u2026`]);let a=new Set([g("thread.sessionId"),g("thread.workdir")]);return(0,pt.jsx)(jr,{title:g("thread.info"),onClose:i,children:(0,pt.jsx)("div",{className:"info-grid",children:s.map(([o,l])=>(0,pt.jsxs)("div",{className:"info-row",children:[(0,pt.jsx)("span",{className:"info-k",children:o}),(0,pt.jsx)("span",{className:"info-v",title:l,children:l}),a.has(o)&&l!=="\u2014"&&l!==g("thread.sessionNone")&&(0,pt.jsx)("button",{className:"ibtn",title:g("common.copy"),onClick:()=>{vr(l),ke(g("common.copied"))},children:(0,pt.jsx)(ne,{name:"copy",size:12})})]},o))})})}var xo,pt,mA=te(()=>{xo=ie(bt(),1);Kl();On();en();Mu();qi();Rn();Fv();$f();Yl();Lu();_r();Ff();kt();pt=ie(ye(),1)});function gA(e){return typeof e=="object"?e.key:e}function _A(e,t){let i=e.length;return new Proxy(e,{get(n,r,s){if(typeof r=="string"){let a=r.charCodeAt(0);if(a>=48&&a<=57){let o=+r;if(Number.isInteger(o)&&o>=0&&o{});function Eo(e,t,i){let n=i.initialDeps??[],r,s=!0;function a(){var o;let c=0,u=e();if(!(u.length!==n.length||u.some((f,p)=>n[p]!==f)))return r;n=u;let h=0;return r=t(...u),i?.onChange&&!(s&&i.skipInitialOnChange)&&i.onChange(r),s=!1,r}return a.updateDeps=o=>{n=o},a}function Mb(e,t){if(e===void 0)throw new Error(`Unexpected undefined${t?`: ${t}`:""}`);return e}var Ns,bA,Ob=te(()=>{Ns=(e,t)=>Math.abs(e-t)<1.01,bA=(e,t,i)=>{let n;return Object.assign(function(...r){e.clearTimeout(n),n=e.setTimeout(()=>t.apply(this,r),i)},{cancel:()=>{e.clearTimeout(n)}})}});function yA({offset:e,isScrolling:t,elementMax:i,holdOffset:n,scrollOffset:r,pendingWrite:s,clampedMaxAtWrite:a}){var o;return t&&s===null&&e===r?"spurious":s!==null&&Math.abs(e-s.target)<1.5?"readBack":s!==null&&!s.smooth&&i!==null&&s.target>i+n+.5&&Math.abs(e-(i+n))<1.5||s!==null&&!s.smooth&&((o=s.lowMaxes)!=null&&o.some(l=>Math.abs(e-l)<1.5))?"clampedReadBack":a!==null&&Math.abs(e-a)<1.5?"clampedEcho":"external"}function SA({kind:e,offset:t,command:i,target:n}){return e!=="spurious"&&e!=="readBack"&&e!=="clampedReadBack"&&i?.index!=null&&i.phase!=="queued"&&!h6(i.phase)&&!Ns(t,i.lastTargetOffset)&&!Ns(t,n())&&e!=="clampedEcho"}function wA(e){let t=e[e.length-1];if(t===void 0)return!1;let i=e.length-2;for(;i>=0&&t.t-e[i].t=0&&n.t-e[r].t=0&&Math.abs(a)>=2*Math.abs(o)&&Math.abs(a)-Math.abs(o)>=.8}function xA(e){let t=e[e.length-1];if(t===void 0)return!1;let i=e.length-2;for(;i>=0&&t.t-e[i].t=.05}var h6,Rb,EA=te(()=>{Ob();h6=e=>e==="smooth"||e==="smoothFinishing";Rb=40});var ju,Yu,Db,f6,kA,oc,dp,CA=te(()=>{Yu=()=>{if(ju!==void 0)return ju;if(typeof navigator>"u")return ju=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return ju=!0;let e=navigator.maxTouchPoints;return ju=navigator.platform==="MacIntel"&&e!==void 0&&e>0},f6=()=>Db!==void 0?Db:Db=Yu()&&typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("overflow-anchor: auto"),kA=()=>!Yu()||f6(),oc={capture:!0,passive:!0},dp=class{constructor(t){this.host=t,this._touch=null,this.inMotion=()=>this._touch!==null&&this._touch.phase!=="lateFling",this.dragging=()=>{var i;return((i=this._touch)==null?void 0:i.phase)==="down"&&this._touch.moved},this.tail=()=>{var i;return((i=this._touch)==null?void 0:i.phase)==="tail"?this._touch.moved?"fling":"tap":null},this.onScroll=({isScrolling:i,ownReadBack:n,moved:r,external:s})=>{var a,o,l;return i&&((a=this._touch)==null?void 0:a.phase)==="tail"?this._openTail(this._touch.moved||!n,!1):((o=this._touch)==null?void 0:o.phase)==="lateFling"&&(this.host.now()>this._touch.until?this._touch=null:s&&i&&r&&this._openTail(!0,!1)),!n&&i&&r&&((l=this._touch)==null?void 0:l.phase)==="down"?(this._touch.moved=!0,!0):!1},this.touchStart=()=>{this.end(),this._touch={phase:"down",moved:!1}},this.touchEnd=()=>{var i;let n=((i=this._touch)==null?void 0:i.phase)==="down"&&this._touch.moved;this.end(),this._openTail(n,n)},this.end=()=>{var i;let n=this.host.getWindow();((i=this._touch)==null?void 0:i.phase)==="tail"&&n!=null&&n.clearTimeout(this._touch.timerId),this._touch=null},this.listen=i=>{let n=()=>this.touchStart(),r=()=>this.touchEnd();return i.addEventListener("touchstart",n,oc),i.addEventListener("touchend",r,oc),i.addEventListener("touchcancel",r,oc),()=>{i.removeEventListener("touchstart",n,oc),i.removeEventListener("touchend",r,oc),i.removeEventListener("touchcancel",r,oc),this.end()}},this._openTail=(i,n)=>{let r=this.host.getWindow();if(r==null)return;this.end();let s={phase:"tail",moved:i,awaitingFling:n,timerId:r.setTimeout(()=>{if(this.host.tailStillMoving()){this._openTail(s.moved,s.awaitingFling);return}this._touch=s.awaitingFling?{phase:"lateFling",until:this.host.now()+1e3}:null,this.host.onTailClosed()},150)};this._touch=s}}get touch(){return this._touch}}});function y6(e,t,i,n){if(t===0)return!1;let r=n(0),s=new Set,a=0;for(;a=t)return!1;for(let l=0;li)t=r-1;else return r}return n>0?n-1:0}function w6(e,t,i,n,r){let s=e.length-1;if(e.length<=n)return{startIndex:0,endIndex:s};if(n===1&&r!==null){let c=S6(r,s,i),u=c,d=i+t;for(;ue[c].start,i),l=o;if(n===1)for(;l1){let c=Array(n).fill(0);for(;ld=0&&u.some(d=>d>=i);){let d=e[o];u[d.lane]=d.start,o--}o=Math.max(0,o-o%n),l=Math.min(s,l+(n-1-l%n))}return{startIndex:o,endIndex:l}}var TA,MA,p6,m6,OA,NA,g6,_6,RA,v6,b6,DA,AA,Vu,hp,LA,Lb=te(()=>{vA();Ob();EA();CA();TA=e=>{let{clientWidth:t,clientHeight:i}=e;return{width:t,height:i}},MA=e=>{let t=new Set;return{schedule:i=>{let n=e.requestAnimationFrame(()=>{t.delete(n),i()});t.add(n)},cancel:()=>{t.forEach(i=>e.cancelAnimationFrame(i)),t.clear()}}},p6=e=>e,m6=e=>{let t=e.overscan*Math.max(e.lanes??1,1),i=Math.max(e.startIndex-t,0),r=Math.min(e.endIndex+t,e.count-1)-i+1,s=new Array(r);for(let a=0;a{let i=e.scrollElement;if(!i)return;let n=e.targetWindow;if(!n)return;let r=o=>{let{width:l,height:c}=o;t({width:Math.round(l),height:Math.round(c)})};if(r(TA(i)),!n.ResizeObserver)return()=>{};let s=MA(n),a=new n.ResizeObserver(()=>{let o=()=>{r(TA(i))};e.options.useAnimationFrameWithResizeObserver?s.schedule(o):o()});return a.observe(i,{box:"content-box"}),()=>{a.unobserve(i),s.cancel()}},NA={passive:!0},g6=typeof window>"u"?!0:"onscrollend"in window,_6=(e,t,i)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let s=e.options.useScrollendEvent&&g6,a=0,o=s?null:bA(r,()=>t(i(n),!1),e.options.isScrollingResetDelay),l=d=>()=>{a=i(n),o?.(),t(a,d)},c=l(!0),u=l(!1);return n.addEventListener("scroll",c,NA),s&&n.addEventListener("scrollend",u,NA),()=>{n.removeEventListener("scroll",c),s&&n.removeEventListener("scrollend",u),o?.cancel()}},RA=(e,t)=>_6(e,t,i=>{let{horizontal:n,isRtl:r}=e.options;return n?i.scrollLeft*(r&&-1||1):i.scrollTop}),v6=(e,t,i)=>{if(i.options.useCachedMeasurements){let n=i.indexFromElement(e),r=i.options.getItemKey(n);return i.itemSizeCache.get(r)??i.options.estimateSize(n)}if(t?.borderBoxSize){let n=t.borderBoxSize[0];if(n)return Math.round(n[i.options.horizontal?"inlineSize":"blockSize"])}if(!t){let n=i.indexFromElement(e),r=i.options.getItemKey(n),s=i.itemSizeCache.get(r);if(s!==void 0)return s}return e[i.options.horizontal?"offsetWidth":"offsetHeight"]},b6=(e,{adjustments:t=0,behavior:i},n)=>{var r,s;(s=(r=n.scrollElement)==null?void 0:r.scrollTo)==null||s.call(r,{[n.options.horizontal?"left":"top"]:e+t,behavior:i})},DA=b6,AA=(e,t)=>e==="smooth"?t?"smoothLanded":"smooth":"instant",Vu=e=>e?.phase==="smooth"||e?.phase==="smoothLanded";hp=class{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._iosGesture=new dp({getWindow:()=>this.targetWindow,now:()=>this.now(),tailStillMoving:()=>{let i=this.scrollState;if(i?.phase!=="queued"||this.pendingWrite!==null)return!1;let n=this._readElementOffset();return n===null||this._lastElementOffset===null||Math.abs(n-this._lastElementOffset)<1?!1:(this._lastElementOffset=n,i.samples=[...i.samples??[],{t:this.now(),offset:n}],!0)},onTailClosed:()=>{let i=this.scrollState;i?.phase==="queued"&&xA(i.samples??[])&&(this.scrollState=null),this._flushHoldIfReady(!0),this._writeAwaitingCommand(),this._retryClampedAdjustment()}}),this._lastElementOffset=null,this.pendingWrite=null,this._clampedAdjustment=null,this.elementsCache=new Map,this._resizeBatch=null,this.now=()=>{var i,n,r;return((r=(n=(i=this.targetWindow)==null?void 0:i.performance)==null?void 0:n.now)==null?void 0:r.call(n))??Date.now()},this.observer=(()=>{let i=null,n=null,r=!1,s=!1,a=new Set,o=()=>{if(i)return i;let c=this.targetWindow;if(!c||!c.ResizeObserver)return null;let u=n=MA(c);return i=new c.ResizeObserver(d=>{let h=()=>{let f={sync:!1};this._resizeBatch=f;try{d.forEach(l)}finally{this._resizeBatch=null,f.notify&&(this.notify(f.sync),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment(),this.measureElement(null))}};if(this.options.useAnimationFrameWithResizeObserver)u.schedule(h);else{r=!0;try{h()}finally{r=!1}}})},l=c=>{let u=c.target,d=this.indexFromElement(u);if(!u.isConnected){this.observer.unobserve(u);for(let[h,f]of this.elementsCache)if(f===u){this.elementsCache.delete(h);break}return}this.isIndexInRange(d)&&this.shouldMeasureDuringScroll(d)&&this.resizeItem(d,this.options.measureElement(u,c,this))};return{disconnect:()=>{var c;(c=o())==null||c.disconnect(),n?.cancel(),a.clear(),s=!1,i=null,n=null},observe:c=>{let u=o();if(u){if(!r){u.observe(c,{box:"border-box"});return}a.add(c),s||(s=!0,n?.schedule(()=>{s=!1,a.forEach(d=>{d.isConnected&&i?.observe(d,{box:"border-box"})}),a.clear()}))}},unobserve:c=>{var u;a.delete(c),(u=o())==null||u.unobserve(c)}}})(),this.range=null,this.setOptions=i=>{var n;let r={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:p6,rangeExtractor:m6,onChange:()=>{},measureElement:v6,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(let u in i){let d=i[u];d!==void 0&&(r[u]=d)}let s=this.options,a=null,o=null,l=!1;if(s!==void 0&&s.enabled&&r.enabled&&r.anchorTo==="end"&&this.scrollElement!==null){let u=s.count,d=r.count,h=this.getMeasurements(),f=((n=this._singleLaneMeasurements)==null?void 0:n.items)??h,p=b=>gA(f[b]),_=u>0?p(0):null,y=u>0?p(u-1):null;if(d!==u||u>0&&d>0&&(r.getItemKey(0)!==_||r.getItemKey(d-1)!==y)){l=!0;let b=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??h[0]:null;b&&(a=[b.key,this.getScrollOffset()-b.start]);let w=r.followOnAppend===!0?"auto":r.followOnAppend||null;w&&d>0&&this.isAtEnd(s.scrollEndThreshold)&&(u===0||r.getItemKey(d-1)!==y)&&(d>u||y6(u,d,p,r.getItemKey))&&(o=w)}}this.options=r,l&&(this.pendingMin=0,this.itemSizeCacheVersion++);let c=null;if(a&&this.scrollOffset!==null&&!this._awaitingCommandReadBack()){let[u,d]=a,h=this.getMeasurements(),{count:f,getItemKey:p}=this.options,_=0;for(;_{var n,r;(r=(n=this.options).onChange)==null||r.call(n,this,i)},this.maybeNotify=Eo(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),i=>{this.notify(i)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{var i;this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,(i=this._momentumStop)==null||i.restore(),this._momentumStop=null,this.isScrolling=!1,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._clampedAdjustment=null,this.pendingWrite=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var i;let n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((i=this.scrollElement)==null?void 0:i.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,a)=>{var o,l,c,u;let d=a?this._elementMaxScrollOffset():null,h=this._reportedOverscroll;this._reportedOverscroll=s<0||d!==null&&s>d+1;let f=s;this._lastElementOffset=f,s=this._toLayoutOffset(s);let p=this._classifyScrollEvent(s,a,d);if(p==="spurious")return;p==="readBack"?s=this.pendingWrite.target:p==="clampedReadBack"&&((o=this.scrollState)==null?void 0:o.index)!=null&&sthis.getScrollStateTarget(this.scrollState)})&&(this.scrollState=null),this.pendingWrite=null,this._clampedAdjustment!==null&&Math.abs(s-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null);let _=this.getScrollOffset(),y=this.scrollDirection;this.scrollDirection=a?_===s?this.scrollDirection:_v-b.t<=200),{t:v,offset:f}],(y!==null&&this.scrollDirection!==y||wA(m.samples))&&(this.scrollState=null)}this._iosGesture.onScroll({isScrolling:a,ownReadBack:p==="readBack",moved:s!==_,external:p==="external"&&((l=this.scrollState)==null?void 0:l.phase)!=="smooth"&&((c=this.scrollState)==null?void 0:c.phase)!=="smoothFinishing"})&&((u=this.scrollState)==null?void 0:u.phase)==="queued"&&(this.scrollState=null),this._flushHoldIfReady(!0),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement&&this.unsubs.push(this._iosGesture.listen(this.scrollElement)),this._scrollToOffset(this.getScrollOffset())}this._noteClampMax();let r=this.pendingScrollAnchor;this.pendingScrollAnchor=null,r&&this.scrollElement&&this.options.enabled&&(r.kind==="anchor"?this._canWriteScroll()?Vu(this.scrollState)&&!Ns(this.getScrollOffset()-r.delta,this.scrollState.lastTargetOffset)||(this._followOffsetTarget(r.delta),this._scrollToOffset(this.getScrollOffset())):(this._holdOffset+=r.delta,this._followOffsetTarget(r.delta),this.notify(!1)):this.scrollToEnd({behavior:r.behavior})),this._flushHoldIfReady(!1),this._retryClampedAdjustment()},this._classifyScrollEvent=(i,n,r)=>{var s;return yA({offset:i,isScrolling:n,elementMax:r,holdOffset:this._holdOffset,scrollOffset:this.scrollOffset,pendingWrite:this.pendingWrite,clampedMaxAtWrite:((s=this._clampedAdjustment)==null?void 0:s.maxAtWrite)??null})},this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled||!this._canWriteScroll())return;let{target:i,maxAtWrite:n}=this._clampedAdjustment,r=this.getMaxScrollOffset();r>n+.5&&(this._clampedAdjustment=i>r+.5?{target:i,maxAtWrite:r}:null,this._scrollToOffset(i))},this._writeAwaitingCommand=()=>{let i=this.scrollState;if(i===null||i.phase!=="queued")return;let{behavior:n}=i;this.getMeasurements();let r=this.getScrollStateTarget(i);i.lastTargetOffset=r,this._clampedAdjustment=null,i.phase=AA(n,i.index!=null&&Ns(r,this.getScrollOffset())),this._scrollToOffset(r,{behavior:n}),this.scheduleScrollReconcile()},this._readElementOffset=()=>{let i=this.scrollElement;if(i==null)return null;let{horizontal:n,isRtl:r}=this.options;return typeof i.scrollTop=="number"?n?i.scrollLeft*(r&&-1||1):i.scrollTop:typeof i.scrollY=="number"?n?i.scrollX:i.scrollY:null},this._canWriteScroll=()=>!(Yu()&&this._iosGesture.inMotion())&&!this._reportedOverscroll,this._flushHoldIfReady=i=>{var n;if(this._holdOffset===0||!this.scrollElement||!this.options.enabled||!this._canWriteScroll()||((n=this.scrollState)==null?void 0:n.phase)==="smooth")return;this._holdOffset=0,this.scrollOffset!==null&&this.scrollOffset<0&&(this.scrollOffset=0),this.notify(i);let r=this.getCommandWrittenOffset()??this.getScrollOffset();this._clampedAdjustment=this._clampedBy(r),this._scrollToOffset(r)},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=Eo(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(i,n,r,s,a,o,l,c)=>(this.prevLanes!==void 0&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMin=null,{count:i,paddingStart:n,scrollMargin:r,getItemKey:s,enabled:a,lanes:o,laneAssignmentMode:l,gap:c}),{key:!1}),this.isIndexInRange=i=>i>=0&&i[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:i,paddingStart:n,scrollMargin:r,getItemKey:s,enabled:a,lanes:o,laneAssignmentMode:l,gap:c},u)=>{var d;let h=this.itemSizeCache;if(!a)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>i)for(let v of this.laneAssignments.keys())v>=i&&this.laneAssignments.delete(v);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(v=>{this.itemSizeCache.set(v.key,v.size)}));let f=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===i&&(this.lanesSettling=!1),o===1){let v=i*2,b=(d=this._singleLaneMeasurements)==null?void 0:d.flat;if(!b||b.length0&&T.set(b.subarray(0,f*2)),b=T}let w=f===0?new Array(i):this._singleLaneMeasurements.items.slice(),k;if(f===0)k=n+r;else{let T=f-1;k=b[T*2]+b[T*2+1]+c}for(let T=f;T1){k=w;let q=_[k],H=q!==void 0?p[q]:void 0;M=H?H.end+c:n+r}else if(m===o){let q=0,H=y[0],P=_[0];for(let x=1;xthis.options.debug}),this.calculateRange=Eo(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(i,n,r,s)=>i.length===0||n===0?(this.range=null,null):(this.range=w6(i,n,r,s,s===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Eo(()=>{let i=null,n=null,r=this.calculateRange();return r&&(i=r.startIndex,n=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,i,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,i,n,this.options.lanes]},(i,n,r,s,a,o)=>s===null||a===null?[]:i({startIndex:s,endIndex:a,overscan:n,count:r,lanes:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=i=>{let n=this.options.indexAttribute,r=i.getAttribute(n);return r?parseInt(r,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=i=>{var n;if(!Vu(this.scrollState))return!0;let r=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(r!==void 0&&this.range){let s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,r-s),o=Math.min(this.options.count-1,r+s);return i>=a&&i<=o}return!0},this.measureElement=i=>{if(!i){this.elementsCache.forEach((a,o)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(o))});return}let n=this.indexFromElement(i);if(!this.isIndexInRange(n))return;let r=this.options.getItemKey(n),s=this.elementsCache.get(r);s!==i&&(s&&this.observer.unobserve(s),this.observer.observe(i),this.elementsCache.set(r,i)),i.isConnected&&(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(i,void 0,this))},this.resizeItem=(i,n)=>{var r,s,a;if(!this.isIndexInRange(i))return;(r=this._resizeBatch)!=null&&r.sync&&this.getMeasurements();let o,l,c,u=(s=this._singleLaneMeasurements)==null?void 0:s.flat;if(this.options.lanes===1&&u!=null)c=this.options.getItemKey(i),l=u[i*2],o=u[i*2+1];else{let f=this.measurementsCache[i];if(!f)return;c=f.key,l=f.start,o=f.size}let d=this.itemSizeCache.get(c)??o,h=n-d;if(h!==0){let f=this.options.anchorTo==="end"&&!Vu(this.scrollState)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=f?this._getLayoutTotalSize():0,_=this.getScrollOffset(),m=!this.itemSizeCache.has(c)?l<_:l+d<=_&&this.scrollDirection!=="backward",v=!Vu(this.scrollState)&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[i]??{index:i,key:c,start:l,size:o,end:l+o,lane:0},h,this):m);(this.pendingMin===null||i[this.getVirtualIndexes(),this.getMeasurements(),this._holdOffset],(i,n,r)=>{let s=[];for(let a=0,o=i.length;athis.options.debug}),this.getVirtualItemForOffset=i=>{var n;let r=this.getMeasurements();if(r.length===0)return;let s=(n=this._singleLaneMeasurements)==null?void 0:n.flat,a=this.options.lanes===1&&s!=null,o=LA(0,r.length-1,a?l=>s[l*2]:l=>Mb(r[l]).start,i);return Mb(r[o])},this._noteClampMax=()=>{if(!this._awaitingCommandReadBack())return;let i=this._elementMaxScrollOffset();if(i===null)return;let n=this.pendingWrite,r=Math.max(i,0)+this._holdOffset;if(r>=n.target)return;let s=n.lowMaxes??(n.lowMaxes=[]);s[s.length-1]!==r&&s.push(r)},this.getMaxScrollOffset=()=>(this._elementMaxScrollOffset()??0)+this._holdOffset,this._toLayoutOffset=i=>{var n;let r=i+this._holdOffset;return((n=this.pendingScrollAnchor)==null?void 0:n.kind)==="anchor"&&(r+=this.pendingScrollAnchor.delta),r},this._elementMaxScrollOffset=()=>{let i=this.scrollElement;if(i===null)return null;if("scrollHeight"in i)return this.options.horizontal?i.scrollWidth-i.clientWidth:i.scrollHeight-i.clientHeight;if("document"in i){let n=i.document.documentElement;return this.options.horizontal?n.scrollWidth-i.innerWidth:n.scrollHeight-i.innerHeight}return null},this._momentumStop=null,this._stopMomentum=i=>{let n=this.scrollElement,r=this.targetWindow;if(n===null||r===null)return;let s="document"in n?n.document.scrollingElement:n;if(!s?.style)return;if(this._momentumStop){this._momentumStop.done=i;return}let{style:a}=s,o=this.options.horizontal?"overflow-x":"overflow-y",l=a.getPropertyValue(o),c=a.getPropertyPriority(o),u=()=>this.options.horizontal?s.clientHeight:s.clientWidth,d=u();if(a.setProperty(o,"hidden","important"),u()!==d){a.setProperty(o,l,c);return}let h={restore:()=>a.getPropertyValue(o)!=="hidden"||a.getPropertyPriority(o)!=="important"?!1:(a.setProperty(o,l,c),!0),done:i};this._momentumStop=h,r.requestAnimationFrame(()=>r.requestAnimationFrame(()=>{this._momentumStop===h&&(this._momentumStop=null,h.restore()&&h.done())}))},this._clampedBy=i=>{let n=this._elementMaxScrollOffset();if(n===null)return null;let r=n+this._holdOffset;return i>r+.5?{target:i,maxAtWrite:r}:null},this.getVirtualDistanceFromEnd=()=>Math.max(this._getLayoutTotalSize()+this.options.scrollMargin-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(i=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=i,this.getOffsetForAlignment=(i,n,r=0)=>{if(!this.scrollElement)return 0;let s=this.getSize(),a=this.getScrollOffset();n==="auto"&&(n=i>=a+s?"end":"start"),n==="center"?i+=(r-s)/2:n==="end"&&(i-=s);let o=this.getMaxScrollOffset();return Math.max(Math.min(o,i),0)},this.getOffsetForIndex=(i,n="auto")=>{i=Math.max(0,Math.min(i,this.options.count-1));let r=this.getSize(),s=this.getScrollOffset(),a=this.measurementsCache[i];if(!a)return;if(n==="auto")if(a.end>=s+r-this.options.scrollPaddingEnd)n="end";else if(a.start<=s+this.options.scrollPaddingStart)n="start";else return[s,n];if(n==="end"&&i===this.options.count-1){let l=this.getMaxScrollOffset(),c=l-this.options.paddingEnd+this.options.scrollPaddingEnd;return[Math.max(Math.min(c,l),0),n]}let o=n==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,n,a.size),n]},this.scrollToOffset=(i,{align:n="start",behavior:r="auto"}={})=>{this._startScroll({index:null,align:n},this.getOffsetForAlignment(i,n),r,"absolute")},this.scrollToIndex=(i,{align:n="auto",behavior:r="auto"}={})=>{i=Math.max(0,Math.min(i,this.options.count-1));let s=this.getOffsetForIndex(i,n);if(!s)return;let[a,o]=s;this._startScroll({index:i,align:o},a,r,"absolute")},this.scrollBy=(i,{behavior:n="auto"}={})=>{let r=this.getOffsetForAlignment((this.getCommandWrittenOffset()??this.getScrollOffset())+i,"start");this._startScroll({index:null,align:"start"},r,n,"relative")},this.scrollToEnd=({behavior:i="auto"}={})=>{if(this.options.count>0){this._startScroll({index:this.options.count-1,align:"end",toEnd:!0},Math.max(this.getMaxScrollOffset(),0),i,"absolute");return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:i})},this.cancelScroll=()=>{this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null},this.getTotalSize=()=>Math.max(this._getLayoutTotalSize()-this._holdOffset,0),this._getLayoutTotalSize=()=>{var i,n;let r=this.getMeasurements(),s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1){let a=r.length-1,o=(i=this._singleLaneMeasurements)==null?void 0:i.flat;o!=null?s=o[a*2]+o[a*2+1]:s=((n=r[a])==null?void 0:n.end)??0}else{let a=Array(this.options.lanes).fill(null),o=r.length-1;for(;o>=0&&a.some(l=>l===null);){let l=r[o];a[l.lane]===null&&(a[l.lane]=l.end),o--}s=Math.max(...a.filter(l=>l!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let i=[];if(this.itemSizeCache.size===0)return i;let n=this.getMeasurements();for(let r of n)r&&this.itemSizeCache.has(r.key)&&i.push({index:r.index,key:r.key,start:r.start,size:r.size,end:r.end,lane:r.lane});return i},this._scrollToOffset=(i,{adjustments:n,behavior:r}={})=>{let s={target:i+(n??0),smooth:r==="smooth"};return this.pendingWrite=s,this.options.scrollToFn(i-this._holdOffset,{behavior:r,adjustments:n},this),s},this.getCommandWrittenOffset=()=>this.scrollState!==null&&this.pendingWrite!==null&&!this.pendingWrite.smooth?this.pendingWrite.target:null,this._awaitingCommandReadBack=()=>{let i=this.getCommandWrittenOffset();return!(Yu()&&this._iosGesture.dragging())&&i!==null&&!Ns(i,this.getScrollOffset())},this._followOffsetTarget=i=>{this.scrollState!==null&&this.scrollState.index==null&&(this.scrollState.lastTargetOffset+=i)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}get scrollAdjustments(){return 0}applyScrollAdjustment(t,i){if(t===0)return!1;if(this._followOffsetTarget(t),this._canWriteScroll()){let n=this.getScrollOffset();this._clampedAdjustment=this._clampedBy(n+t);let r=this._scrollToOffset(n,{adjustments:t,behavior:i});return this.scrollOffset!==null&&(this.pendingWrite===r&&(this.scrollOffset+=t),this.scrollOffset<0&&(this.scrollOffset=0)),!0}else return this._holdOffset+=t,this.scrollOffset!==null&&(this.scrollOffset+=t),!0}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}getScrollStateTarget(t){let i=t.toEnd?[Math.max(this.getMaxScrollOffset(),0)]:t.index!=null?this.getOffsetForIndex(t.index,t.align):void 0;return i?i[0]:t.lastTargetOffset}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}if(this.scrollState.phase==="queued"){this.scheduleScrollReconcile();return}this.getMeasurements();let n=this.getScrollStateTarget(this.scrollState),r=this.scrollState.index==null?1:this.options.useAnimationFrameWithResizeObserver?3:2,s=n!==this.scrollState.lastTargetOffset;if(!s&&Ns(n,this.getScrollOffset())){if(this.scrollState.phase==="smooth"?this.scrollState.phase="smoothLanded":this.scrollState.phase==="smoothFinishing"&&(this.scrollState.phase="instant"),this.scrollState.stableFrames++,this.scrollState.stableFrames>=r){this.getScrollOffset()!==n&&this._scrollToOffset(n,{behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,s){let a=this.getSize()||600,o=Math.abs(n-this.getScrollOffset()),l=Vu(this.scrollState)&&o>a;this.scrollState.lastTargetOffset=n,l?this.scrollState.phase="smooth":this.scrollState.phase==="smooth"?this.scrollState.phase="smoothFinishing":this.scrollState.phase==="smoothLanded"&&(this.scrollState.phase="instant"),this._scrollToOffset(n,{behavior:l?"smooth":"auto"})}this.scheduleScrollReconcile()}_startScroll(t,i,n,r){this.pendingScrollAnchor=null,this._clampedAdjustment=null;let s=this._iosGesture.tail();if(r==="absolute"&&s!==null){if(s==="fling"&&kA()){this._stopMomentum(()=>{let a=this.scrollState;a?.phase!=="queued"||this._iosGesture.tail()!=="fling"||this._reportedOverscroll||(this._iosGesture.end(),this._flushHoldIfReady(!0),this._writeAwaitingCommand())}),this.scrollState={...t,startedAt:this.now(),lastTargetOffset:i,stableFrames:0,phase:"queued",behavior:n,samples:[]},this.scheduleScrollReconcile();return}this._iosGesture.end()}this.scrollState={...t,startedAt:this.now(),lastTargetOffset:i,stableFrames:0,behavior:n,phase:AA(n,t.index!=null&&Ns(i,this.getScrollOffset()))},this._scrollToOffset(i,{behavior:n}),this.scheduleScrollReconcile()}},LA=(e,t,i,n)=>{for(;e<=t;){let r=(e+t)/2|0,s=i(r);if(sn)t=r-1;else return r}return e>0?e-1:0}});function x6({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:i="transform",...n}){let r=Sr.useReducer(h=>h+1,0)[1],s=Sr.useRef({enabled:t,mode:i,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});s.current.enabled=t,s.current.mode=i;let a=Sr.useRef(!1),o=h=>{let f=s.current;if(!f.enabled||!f.container)return;let p=h.getTotalSize();if(p!==f.lastSize){f.lastSize=p;let _=h.options.horizontal?"width":"height";f.container.style[_]=`${p}px`}},l=(h,f,p)=>{let _=s.current,y=!!h.options.horizontal,m=f.start-h.options.scrollMargin;_.lastPositions.get(p)!==m&&(_.lastPositions.set(p,m),_.mode==="transform"?p.style.transform=y?`translate3d(${m}px, 0, 0)`:`translate3d(0, ${m}px, 0)`:p.style[y?"left":"top"]=`${m}px`)},c=h=>{let f=s.current;if(!(!f.enabled||!f.container)){o(h);for(let p of h.getVirtualItems()){let _=h.elementsCache.get(p.key);_&&l(h,p,_)}}},u={...n,onChange:(h,f)=>{var p;let _=s.current,y=!0;if(_.enabled){c(h);let m=h.range,v=_.prevRange;y=!v||v.isScrolling!==h.isScrolling||v.startIndex!==m?.startIndex||v.endIndex!==m?.endIndex,y&&(_.prevRange=m?{startIndex:m.startIndex,endIndex:m.endIndex,isScrolling:h.isScrolling}:null)}y&&(e&&f&&!a.current?(0,IA.flushSync)(r):r()),(p=n.onChange)==null||p.call(n,h,f)}},[d]=Sr.useState(()=>{let h=new hp(u),f=h.measureElement;return h.measureElement=p=>{a.current=!0;try{f(p)}finally{a.current=!1}let _=s.current;if(p!==null&&_.enabled&&_.container){let y=h.measurementsCache[h.indexFromElement(p)];y&&l(h,y,p)}},Object.assign(h,{containerRef:p=>{let _=s.current;_.container=p,_.lastSize=null,p!==null&&c(h)}})});return d.setOptions(u),Ib(()=>d._didMount(),[]),Ib(()=>(o(d),d._willUpdate())),Ib(()=>{c(d)}),d}function zA(e){return x6({observeElementRect:OA,observeElementOffset:RA,scrollToFn:DA,...e})}var Sr,IA,Ib,BA=te(()=>{Sr=ie(bt(),1),IA=ie(Ks(),1);Lb();Lb();Ib=typeof document<"u"?Sr.useLayoutEffect:Sr.useEffect});function PA(e=Date.now()){return zb=(zb+1)%1e6,`c${e.toString(36)}${zb.toString(36)}${Math.random().toString(36).slice(2,8)}`}function Bb(e,t){return t?`u:c:${t}`:`u:${e}`}function HA(e,t){return t.length?[...e,...t]:e}var zb,fp,Pb=te(()=>{zb=0;fp=class{constructor(){ge(this,"list",[])}add(t){let i={ts:Date.now(),...t,state:"sending",echoed:!1,settled:!1,busySeen:!1};return this.list.push(i),i}get(t){return this.list.find(i=>i.clientId===t)}entries(t){return this.list.filter(i=>i.threadId===t)}remove(t){this.list=this.list.filter(i=>i.clientId!==t)}gc(t){t.echoed&&t.settled&&this.remove(t.clientId)}echo(t){if(!t)return!1;let i=this.get(t);return i?(i.echoed=!0,i.state="sending",i.error=void 0,this.gc(i),!0):!1}ok(t,i){let n=this.get(t);if(n){if(i==="queued"&&!n.echoed){this.remove(t);return}n.settled=!0,this.gc(n)}}fail(t,i){let n=this.get(t);return n?(n.settled=!0,n.echoed?(this.gc(n),!1):(n.state="failed",n.error=i,!0)):!1}busy(t){for(let i of this.list)i.threadId===t&&(i.busySeen=!0)}reconcile(t,i){for(let n of i){let r=this.get(n);r&&r.threadId===t&&this.echo(n)}}items(t){return this.entries(t).filter(i=>!i.echoed).map(i=>({kind:"user",key:Bb(0,i.clientId),text:i.payload.text,...i.display.attachments?.length?{attachments:i.display.attachments}:{},...i.display.mentions?.length?{mentions:i.display.mentions}:{},...i.payload.behavior==="steer"?{steered:!0}:{},ts:i.ts,clientId:i.clientId,sendState:i.state,...i.error?{sendError:i.error}:{}}))}starting(t){return this.entries(t).some(i=>i.startsTurn&&i.state==="sending"&&!i.settled&&!i.busySeen)}}});function lc(){return{items:[],seenSeq:new Set,byItemId:new Map,toolLoc:new Map,openGroup:null,reqLoc:new Map,turnUsage:new Map,lastUserIdx:new Map,turnStart:new Map,turnModel:new Map}}function As(e){e.openGroup=null}function UA(e,t,i,n){let r=e.byItemId.get(t);if(r){let o=e.items[r.idx];o.text+=n,o.streaming=!0;return}As(e);let s=`${i}:${t}`,a=i==="assistant"?{kind:"assistant",key:s,itemId:t,text:n,streaming:!0}:{kind:"reasoning",key:s,itemId:t,text:n,streaming:!0};e.byItemId.set(t,{idx:e.items.length,field:i}),e.items.push(a)}function E6(e,t,i){let n=/^(.*):[ktx]\d+$/.exec(t);if(!n)return;let r=n[1]+":";for(let[s,a]of[...e.byItemId])a.field===i&&s.startsWith(r)&&s!==t&&(e.items[a.idx]={kind:"gone",key:`gone:${s}`},e.byItemId.delete(s))}function qA(e,t,i,n){E6(e,t,i);let r=e.byItemId.get(t);if(r){let o=e.items[r.idx];o.text=n,o.streaming=!1;return}As(e);let s=`${i}:${t}`,a=i==="assistant"?{kind:"assistant",key:s,itemId:t,text:n,streaming:!1}:{kind:"reasoning",key:s,itemId:t,text:n,streaming:!1};e.byItemId.set(t,{idx:e.items.length,field:i}),e.items.push(a)}function k6(e,t){let i=e.toolLoc.get(t.itemId);if(i){let a=e.items[i.group];if(a?.kind==="toolgroup"){let o=a.steps[i.step];a.steps[i.step]={...o,kind:t.kind==="other"&&o.kind!=="other"?o.kind:t.kind,title:t.title||o.title,status:t.status,input:t.input??o.input,detail:t.detail??o.detail,output:t.output??o.output,exitCode:t.exitCode??o.exitCode,durationMs:t.durationMs??o.durationMs}}return}let n={itemId:t.itemId,kind:t.kind,title:t.title,status:t.status,input:t.input,detail:t.detail,output:t.output,exitCode:t.exitCode,durationMs:t.durationMs},r=e.openGroup;(r==null||e.items[r]?.kind!=="toolgroup")&&(r=e.items.length,e.items.push({kind:"toolgroup",key:`tg:${t.itemId}`,steps:[]}),e.openGroup=r);let s=e.items[r];e.toolLoc.set(t.itemId,{group:r,step:s.steps.length}),s.steps.push(n)}function pp(e,t){if(t.seq!=null&&t.seq>0){if(e.seenSeq.has(t.seq))return;e.seenSeq.add(t.seq)}switch(t.type){case"user_message":As(e),e.lastUserIdx.set(t.turnId??"",e.items.length),e.items.push({kind:"user",key:Bb(t.seq,t.clientId),text:t.text,attachments:t.attachments,...t.mentions?.length?{mentions:t.mentions}:{},steered:t.steered,ts:t.ts,...t.clientId?{clientId:t.clientId}:{}});return;case"assistant_delta":UA(e,t.itemId,"assistant",t.text);return;case"reasoning_delta":UA(e,t.itemId,"reasoning",t.text);return;case"assistant_message":qA(e,t.itemId,"assistant",t.text);return;case"reasoning":qA(e,t.itemId,"reasoning",t.text);return;case"tool_output_delta":{let i=e.toolLoc.get(t.itemId);if(i){let n=e.items[i.group];if(n?.kind==="toolgroup"){let r=n.steps[i.step];r.output=(r.output??"")+t.text}}return}case"tool_call":k6(e,t);return;case"plan":if(As(e),t.entries?.length){e.items.push({kind:"todo",key:`todo:${t.seq}`,items:t.entries.map(i=>({text:i.step,status:i.status==="completed"?"done":i.status||"pending"}))});return}e.items.push({kind:"plan",key:`plan:${t.itemId}`,itemId:t.itemId,markdown:t.markdown});return;case"todo":As(e),e.items.push({kind:"todo",key:`todo:${t.seq}`,items:t.items});return;case"permission_request":As(e),e.reqLoc.set(t.requestId,e.items.length),e.items.push({kind:"permission",key:`perm:${t.requestId}`,requestId:t.requestId,title:t.title,kindStr:t.kind,detail:t.detail,options:t.options,status:"pending",...t.auto?{auto:!0}:{}});return;case"permission_resolved":{let i=e.reqLoc.get(t.requestId),n=i!=null?e.items[i]:null;n?.kind==="permission"?(n.status=t.cancelled?"cancelled":"resolved",n.choice=t.optionId,t.auto&&(n.auto=!0)):n?.kind==="question"&&t.cancelled&&n.status==="pending"&&(n.status="cancelled");return}case"question":As(e),e.reqLoc.set(t.requestId,e.items.length),e.items.push({kind:"question",key:`q:${t.requestId}`,requestId:t.requestId,questions:t.questions,status:"pending"});return;case"question_answered":{let i=e.reqLoc.get(t.requestId),n=i!=null?e.items[i]:null;n?.kind==="question"&&(n.status="answered",n.answers=t.answers);return}case"usage":{let i=t.turnId??"",n=e.turnUsage.get(i)??{inputTokens:0,outputTokens:0,cacheReadTokens:0,costUsd:0};n.inputTokens+=t.inputTokens,n.outputTokens+=t.outputTokens,n.cacheReadTokens+=t.cacheReadTokens,n.costUsd+=t.costUsd,e.turnUsage.set(i,n);return}case"notice":As(e),e.items.push({kind:"notice",key:`n:${t.seq}`,level:t.level,message:t.message,...t.code?{code:t.code}:{}});return;case"turn_ended":As(e),C6(e),e.items.push({kind:"turnend",key:`te:${t.seq}`,status:t.status,durationMs:t.durationMs??(e.turnStart.has(t.turnId)?Math.max(0,t.ts-e.turnStart.get(t.turnId)):void 0),error:t.error,filesChanged:t.filesChanged,usage:e.turnUsage.get(t.turnId),...e.turnModel.has(t.turnId)?{model:e.turnModel.get(t.turnId)}:{},ts:t.ts});return;case"turn_started":e.turnStart.set(t.turnId,t.ts),e.turnModel.set(t.turnId,t.model??null);return;case"status":return;default:return}}function C6(e){for(let t of e.reqLoc.values()){let i=e.items[t];(i?.kind==="permission"||i?.kind==="question")&&i.status==="pending"&&(i.status="cancelled")}}function Xu(e){let t=[];for(let i of e)(i.kind==="permission"||i.kind==="question")&&i.status==="pending"&&t.push({requestId:i.requestId,kind:i.kind,key:i.key});return t}function FA(e,t={}){let i=lc();for(let s of e)pp(i,s);let n=t.runtimeStatus!=="running"&&t.runtimeStatus!=="initializing",r=null;for(let s of i.items){if(s.kind==="user"&&(r=s.text),n&&s.kind==="permission"&&s.status==="pending"&&(s.status="cancelled"),n&&s.kind==="question"&&s.status==="pending"&&(s.status="cancelled"),n&&s.kind==="toolgroup")for(let a of s.steps)a.status==="running"&&(a.status="failed");(s.kind==="assistant"||s.kind==="reasoning")&&n&&s.streaming&&(s.streaming=!1)}return{items:i.items,lastUserText:r}}var $A=te(()=>{Pb()});var GA={};nD(GA,{EMPTY_PENDING:()=>Qu,localClientIds:()=>gp,samePending:()=>KA,stablePending:()=>Zu,useTimeline:()=>Rt});function KA(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let i=0;i{Pa();$A();qi();Pb();Qu=[];In=new fp,gp=new Set,Hb=e=>e==="running"||e==="initializing",wr=lc(),ko=0,xr="idle",mp=null;Rt=$n((e,t)=>{let i=s=>({items:HA(wr.items.slice(),In.items(s)),status:!Hb(xr)&&In.starting(s)?"initializing":xr}),n=s=>{t().threadId===s&&e(i(s))},r=s=>{mp?.(),mp=Z.subscribe(`thread:${s}`,(a,o)=>{let l=o;if(t().threadId===s){if(l.type==="event"&&l.event){let c=l.event;if(c.seq!=null&&c.seq>0){if(c.seq<=ko)return;ko=Math.max(ko,c.seq)}c.type==="user_message"&&(e({lastUserText:c.text}),In.echo(c.clientId)),pp(wr,c),e({...i(s),pending:Zu(t().pending,Xu(wr.items))});return}if(l.type==="status"&&l.status){xr=l.status,(Hb(xr)||xr==="error"||xr==="closed")&&In.busy(s),WA(),e({...i(s),pending:Zu(t().pending,Xu(wr.items))});return}if(l.type==="queue"&&l.queue){e({queue:l.queue});return}if(l.type==="pending"&&l.pending){let c=Xu(wr.items).filter(u=>l.pending.some(d=>d.requestId===u.requestId));e({pending:Zu(t().pending,c)});return}if(l.type==="commands"&&l.commands){e({slashCommands:l.commands});return}}},()=>ko)};return{threadId:null,status:"idle",items:[],queue:[],pending:Qu,lastUserText:null,error:null,slashCommands:[],sentAt:0,open:s=>{t().threadId!==s&&(t().close(),e({threadId:s,status:"initializing",items:In.items(s),queue:[],pending:Qu,lastUserText:null,error:null,slashCommands:[]}),wr=lc(),ko=0,xr="initializing",(async()=>{try{let a=await Z.call("threads.get",{id:s});if(t().threadId!==s)return;xr=a.runtimeStatus??a.meta.status;let o=FA(a.events,{runtimeStatus:xr});wr=lc();for(let l of a.events)pp(wr,l);ko=Math.max(0,...a.events.map(l=>l.seq??0)),In.reconcile(s,a.events.flatMap(l=>l.type==="user_message"&&l.clientId?[l.clientId]:[])),WA(),e({...i(s),queue:a.queue??[],pending:Zu(t().pending,Xu(wr.items)),lastUserText:o.lastUserText}),t().threadId===s&&r(s)}catch(a){t().threadId===s&&e({error:String(a?.message??a),status:"error"})}})())},close:()=>{mp?.(),mp=null,wr=lc(),ko=0,e({threadId:null,items:[],queue:[],pending:Qu,lastUserText:null,error:null,status:"idle",slashCommands:[]})},send:async(s,a,o={},l={})=>{let c=PA();if(l.optimistic!==!1){let d=t().threadId===s?t().status:"idle";In.add({clientId:c,threadId:s,payload:a,display:o,startsTurn:!Hb(d)&&a.behavior!=="steer"}),gp.add(c),t().threadId===s&&e({...i(s),sentAt:Date.now()})}try{let d=await Z.call("thread.send",{id:s,text:a.text,...a.attachments?.length?{attachments:a.attachments}:{},...a.mentions?.length?{mentions:a.mentions}:{},...a.behavior?{behavior:a.behavior}:{},clientId:c});return In.ok(c,d?.delivered),n(s),d}catch(d){throw In.fail(c,String(d?.message??d)),n(s),d}},retry:s=>{let a=In.get(s);!a||a.state!=="failed"||(In.remove(s),t().send(a.threadId,a.payload,a.display).catch(()=>{}))},dismiss:s=>{let a=In.get(s);!a||a.state!=="failed"||(In.remove(s),n(a.threadId))}}})});var _p,jA=te(()=>{_p=class{constructor(t,i=2,n=8){ge(this,"render",t);ge(this,"minStep",i);ge(this,"frac",n);ge(this,"target","");ge(this,"shown","");ge(this,"raf",0);ge(this,"running",!1);ge(this,"tick",()=>{if(this.shown===this.target){this.running=!1;return}let t=this.target.length-this.shown.length,i=Math.max(this.minStep,Math.ceil(t/this.frac));this.shown=this.target.slice(0,this.shown.length+i),this.render(this.shown),this.raf=requestAnimationFrame(this.tick)})}push(t){this.target=t,this.shown.length>t.length&&(this.shown=t),this.running||(this.running=!0,this.tick())}flush(){this.shown=this.target,this.render(this.shown),this.running=!1,this.raf&&cancelAnimationFrame(this.raf)}stop(){this.running=!1,this.raf&&cancelAnimationFrame(this.raf)}}});function cc(){let e=location.hash.startsWith("#")?location.hash.slice(1):location.hash;return new URLSearchParams(e).get("t")??""}var vp=te(()=>{});function T6(e){return e==="+"||e==="-"?e:" "}function YA(e){if(!Array.isArray(e))return[];let t=[];for(let i of e){if(!i||typeof i!="object")continue;let n=i,r=[];for(let a of Array.isArray(n.lines)?n.lines:[]){if(!a||typeof a!="object")continue;let o=typeof a.text=="string"?a.text:typeof a.s=="string"?a.s:"";r.push({t:T6(a.t),text:o})}let s=typeof n.head=="string"?n.head:void 0;s===void 0&&Number.isInteger(n.oldStart)&&Number.isInteger(n.newStart)&&(s=`@@ -${n.oldStart} +${n.newStart} @@`),t.push({head:s,lines:r})}return t}var VA=te(()=>{});function Ub(e){return e.kind==="reasoning"&&e.text.trim().length<=200}function XA(e){return{itemId:`think:${e.itemId}`,kind:"think",title:"",status:e.streaming?"running":"ok",think:{text:e.text,streaming:e.streaming}}}function N6(e){let t=new Set,i=null;for(let n of e)n.kind==="user"?i=null:n.kind==="todo"&&(i&&t.add(i),i=n);return t}function ZA(e,t={}){let i=t.showThinking!==!1,n=N6(e),r=[],s=null,a=[],o=()=>{for(let l of a)(l.streaming||l.text.trim())&&r.push(l);a=[]};for(let l of e)if(!(l.kind==="gone"||n.has(l))){if(l.kind==="toolgroup"){let c=l.steps.filter(u=>u.kind!=="todo");if(!c.length)continue;s?s.steps.push(...c):(s={kind:"toolgroup",key:l.key,steps:[...i?a.map(XA):[],...c]},a=[],r.push(s));continue}if(l.kind==="reasoning"){if(!i)continue;if(Ub(l)){if(!l.streaming&&!l.text.trim())continue;s?s.steps.push(XA(l)):a.push(l);continue}}o(),s=null,r.push(l)}return o(),r}function qb(e){switch(e){case"think":return"think";case"edit":case"write":return"edit";case"bash":return"run";case"read":return"read";case"search":case"glob":case"web":return"search";default:return"other"}}function QA(e){let t=new Map,i=0,n=0;for(let r of e){let s=qb(r.kind);if(s==="think"){n+=r.think?.text.length??0;continue}t.set(s,(t.get(s)??0)+1),r.status==="failed"&&i++}return{counts:A6.filter(r=>t.has(r)).map(r=>[r,t.get(r)]),failed:i,thinkSecs:n?Math.max(1,Math.round(n/40)):0}}function Fb(e){let t=e.input??{},i=e.detail??{};return(Er(i.command)||Er(t.command)||Er(t.cmd)||Er(t.file_path)||Er(t.path)||Er(i.path)||Er(t.filePath)||Er(t.pattern)||Er(t.query)||Er(t.url)||Er(e.title)).replace(/\s+/g," ")}function JA(e){for(let i=e.length-1;i>=0;i--){let n=e[i];if(n.status==="running"&&n.kind!=="think")return n}let t=e[e.length-1];return t&&t.kind==="think"&&t.think?.streaming?t:null}function eM(e){let t=0;for(let i of e)i.kind!=="think"&&t++;return t}function tM(e){let t=e.detail??null;if(!t||typeof t!="object")return null;if(typeof t.added=="number"&&typeof t.removed=="number")return{added:t.added,removed:t.removed};let i=Array.isArray(t.hunks)?t.hunks:Array.isArray(t.diff?.hunks)?t.diff.hunks:null;if(!i)return null;let n=0,r=0;for(let s of i)for(let a of s.lines??[])a?.t==="+"?n++:a?.t==="-"&&r++;return{added:n,removed:r}}function yp(e){return{done:e.filter(t=>t.status==="done"||t.status==="completed").length,total:e.length}}function iM(e){for(let t=e.length-1;t>=0;t--){let i=e[t];if(i.kind==="todo")return i.items.some(n=>n.status!=="done")?i:null;if(i.kind==="user")return null}return null}var bp,A6,Er,Ju=te(()=>{bp=6;A6=["edit","run","read","search","other"];Er=e=>typeof e=="string"&&e.trim()?e.trim():""});function M6(e){let t=e.replace(/\r\n?/g,` `).replace(/\u00a0/g," ");return t=t.split(` `).map(i=>i.replace(/\s+$/u,"")).join(` `),t=t.replace(/\n{3,}/g,` -`).replace(/^\n+|\n+$/g,""),t.length>4e3&&(t=t.slice(0,4e3).replace(/\s+$/u,"")+"\u2026"),t}function hp(e,t,i){let n=d6(t);return!n.trim()||e.some(r=>r.text===n&&r.src===i)||e.length>=10?e:[...e,{id:`q${Date.now().toString(36)}${(h6++).toString(36)}`,text:n,src:i}]}function HA(e,t){return e.length?[...e.map(n=>{let r=n.text.split(` +`).replace(/^\n+|\n+$/g,""),t.length>4e3&&(t=t.slice(0,4e3).replace(/\s+$/u,"")+"\u2026"),t}function Sp(e,t,i){let n=M6(t);return!n.trim()||e.some(r=>r.text===n&&r.src===i)||e.length>=10?e:[...e,{id:`q${Date.now().toString(36)}${(O6++).toString(36)}`,text:n,src:i}]}function nM(e,t){return e.length?[...e.map(n=>{let r=n.text.split(` `).map(s=>s?`> ${s}`:">");return(n.src?[`> [${n.src}]`,...r]:r).join(` `)}),t].filter(n=>n.trim()).join(` -`):t}function UA(e,t=28){let n=(e.text.split(` -`).find(r=>r.trim())??"").trim().replace(/\s+/g," ");return n.length>t?n.slice(0,t-1)+"\u2026":n}function qA(e,t,i,n,r=6){let s=e.filter(d=>d.bottom>t.top&&d.topd.left);if(!s.length)return null;let a=Math.min(...s.map(d=>d.top)),o=Math.max(...s.map(d=>d.bottom)),l=s.reduce((d,h)=>h.toph.bottom>d.bottom||h.bottom===d.bottom&&h.right>d.right?h:d),u=d=>Math.max(8,Math.min(d,n-i.w-8));return a-r-i.h>=t.top?{left:u(l.left),top:a-r-i.h,side:"above"}:o+r+i.h<=t.bottom?{left:u(c.right-i.w),top:o+r,side:"below"}:{left:u(c.right-i.w),top:Math.max(t.top,t.bottom-i.h-r),side:"inside"}}function Rb(e){let t=e.split(/\n{2,}/),i=[],n=0;for(;nr.trim())??"").trim().replace(/\s+/g," ");return n.length>t?n.slice(0,t-1)+"\u2026":n}function sM(e,t,i,n,r=6){let s=e.filter(d=>d.bottom>t.top&&d.topd.left);if(!s.length)return null;let a=Math.min(...s.map(d=>d.top)),o=Math.max(...s.map(d=>d.bottom)),l=s.reduce((d,h)=>h.toph.bottom>d.bottom||h.bottom===d.bottom&&h.right>d.right?h:d),u=d=>Math.max(8,Math.min(d,n-i.w-8));return a-r-i.h>=t.top?{left:u(l.left),top:a-r-i.h,side:"above"}:o+r+i.h<=t.bottom?{left:u(c.right-i.w),top:o+r,side:"below"}:{left:u(c.right-i.w),top:Math.max(t.top,t.bottom-i.h-r),side:"inside"}}function $b(e){let t=e.split(/\n{2,}/),i=[],n=0;for(;ns===">"||s.startsWith("> ")))break;i.push(r.map(s=>s===">"?"":s.slice(2)).join(` `))}return n===t.length?{quotes:[],rest:e}:{quotes:i,rest:t.slice(n).join(` -`)}}function FA(e){let t=Rb(e),i=[];for(let n of t.quotes){let r=/^\[([^\]\n]+)\]\n([\s\S]*)$/.exec(n);i=r?hp(i,r[2],r[1]):hp(i,n)}return{quotes:i,rest:t.rest}}var h6,fp=ae(()=>{h6=0});function WA(e){return e.kind==="permission"&&!!e.auto&&e.status!=="cancelled"}function f6(e){return e.kind==="toolgroup"||e.kind==="gone"||Ab(e)}function $A(e){if(!e.some(WA))return e;let t=[],i=null,n=()=>{i&&t.push(i),i=null};for(let r of e){if(WA(r)){i||(i={kind:"autoperm",key:`autoperm:${r.requestId}`,items:[]}),i.items.push(r);continue}i&&!f6(r)&&n(),t.push(r)}return n(),t}function KA(e){let t=e.detail??{};return(typeof t.command=="string"&&t.command.trim()?t.command:typeof t.path=="string"&&t.path.trim()?t.path:typeof t.diff?.path=="string"&&t.diff.path.trim()?t.diff.path:e.title).replace(/\s+/g," ").trim()}function GA(e){return e.choice?e.options.find(t=>t.id===e.choice)?.label??e.choice:null}var Db=ae(()=>{$u()});function jA({it:e}){let[t,i]=(0,Lb.useState)(!1),n=e.items.map(KA).filter(Boolean).join(" \xB7 ");return(0,vt.jsxs)("div",{className:`apv${t?" open":""}`,"data-testid":"auto-approved",children:[(0,vt.jsxs)("button",{className:"apv-head","aria-expanded":t,onClick:()=>i(!t),title:g("timeline.autoApproved.title"),children:[(0,vt.jsx)("span",{className:"apv-ic","aria-hidden":!0,children:(0,vt.jsx)(re,{name:"shieldCheck",size:13})}),(0,vt.jsx)("span",{className:"apv-n",children:_e("timeline.autoApproved.count",{n:e.items.length})}),!t&&n&&(0,vt.jsx)("span",{className:"apv-peek",children:n}),(0,vt.jsx)("span",{className:`caret${t?" open":""}`,"aria-hidden":!0,children:"\u203A"})]}),t&&(0,vt.jsx)("div",{className:"apv-list",children:e.items.map(r=>{let s=r.detail??{},a=GA(r),o=typeof s.command=="string"&&s.command.trim()?s.command.trim():"",l=!o&&typeof s.path=="string"&&s.path.trim()?s.path.trim():"",c=r.status==="pending"?g("timeline.autoApproved.pending"):_e("timeline.autoApproved.answer",{opt:a??g("timeline.permAllowed")});return(0,vt.jsxs)("div",{className:"apv-row",title:[r.title,o||l,c].filter(Boolean).join(` -`),children:[(0,vt.jsx)("span",{className:"ts-ic","aria-hidden":!0,children:(0,vt.jsx)(re,{name:r.status==="pending"?"hourglass":"check",size:13})}),o?(0,vt.jsx)("span",{className:"apv-cmd",children:o}):l?(0,vt.jsx)("span",{className:"apv-path",children:l}):(0,vt.jsx)("span",{className:"apv-title",children:r.title}),(0,vt.jsx)("span",{className:"apv-meta",children:c})]},r.requestId)})})]})}function VA({it:e,threadId:t}){let[i,n]=(0,Lb.useState)(!1),r=e.code==="auto_approve_migrated",s=()=>{n(!0),Q.call("thread.setMode",{id:t,mode:"bypassPermissions"}).catch(()=>{}).finally(()=>n(!1))};return(0,vt.jsxs)("div",{className:"nt nt-auto","data-testid":"auto-upgrade-notice",role:"note",children:[(0,vt.jsxs)("div",{className:"nt-auto-h",children:[(0,vt.jsx)("span",{className:"apv-ic",children:(0,vt.jsx)(re,{name:"shieldCheck",size:14})}),(0,vt.jsx)("b",{children:g("timeline.autoUpgrade.title")})]}),(0,vt.jsx)("div",{children:g(r?"timeline.autoUpgrade.migrated":"timeline.autoUpgrade.body")}),(0,vt.jsxs)("div",{className:"nt-actions",children:[(0,vt.jsx)("button",{type:"button",className:"btn",disabled:i,onClick:s,children:g("timeline.autoUpgrade.turnOn")}),(0,vt.jsx)("button",{type:"button",className:"btn",onClick:()=>window.dispatchEvent(new Event("open-settings")),children:g("timeline.autoUpgrade.settings")})]})]})}var Lb,vt,YA,XA=ae(()=>{Lb=ne(pt(),1);Db();Mn();Ct();Hi();vt=ne(be(),1);YA=new Set(["auto_approve_upgrade","auto_approve_migrated"])});function tM(e){return`/attachments/${e}?t=${eM()}`}function p6({text:e}){let t=(0,Rt.useMemo)(()=>GN(e),[e]);return t.length===1&&typeof t[0]=="string"?(0,O.jsx)(O.Fragment,{children:e}):(0,O.jsx)(O.Fragment,{children:t.map((i,n)=>typeof i=="string"?i:(0,O.jsx)("a",{href:i.url,"data-ac-local":i.url,className:"ac-local",title:g("links.openPreviewTitle"),children:i.text},n))})}function Bb({path:e,isDir:t,onRemove:i}){return(0,O.jsxs)("span",{className:"mention",title:e,children:[(0,O.jsx)(re,{name:t?"files":"file",size:12}),(0,O.jsxs)("span",{className:"mention-name",children:[m6(e),t?"/":""]}),i&&(0,O.jsx)("button",{type:"button",className:"att-x","aria-label":g("mention.remove"),onClick:i,children:"\xD7"})]})}function iM(){let[e,t]=(0,Rt.useState)(!1);return(0,Rt.useEffect)(()=>{if(!e)return;let i=setTimeout(()=>t(!1),1500);return()=>clearTimeout(i)},[e]),[e,i=>{gr(i).then(()=>t(!0))}]}function g6({it:e,onRetry:t}){let[i,n]=iM(),r=(0,Rt.useMemo)(()=>Rb(e.text),[e.text]),s=()=>window.dispatchEvent(new CustomEvent("ac-composer-fill",{detail:{text:e.text,mentions:e.mentions??[]}})),a=!!e.clientId&&op.has(e.clientId),o=e.sendState==="failed";return(0,O.jsxs)("div",{className:`um-row${a?" fresh":""}${e.sendState?` ${e.sendState}`:""}`,"data-client-id":e.clientId,children:[(0,O.jsxs)("div",{className:"um",children:[e.attachments?.filter(l=>Ib(l.mime)).map(l=>(0,O.jsx)("img",{className:"um-img",src:`/attachments/${l.id}?t=${eM()}`,alt:l.name},l.id)),e.attachments?.some(l=>!Ib(l.mime))&&(0,O.jsx)("span",{className:"um-mentions",children:e.attachments.filter(l=>!Ib(l.mime)).map(l=>(0,O.jsxs)("span",{className:"mention",title:l.name,children:[(0,O.jsx)(re,{name:"file",size:12}),(0,O.jsx)("span",{className:"mention-name",children:l.name})]},l.id))}),e.mentions&&e.mentions.length>0&&(0,O.jsx)("span",{className:"um-mentions",children:e.mentions.map(l=>(0,O.jsx)(Bb,{path:l.path,isDir:l.isDir},l.path))}),r.quotes.map((l,c)=>(0,O.jsx)("span",{className:"um-quote",children:l},c)),(0,O.jsx)("span",{className:"um-text",children:r.rest})]}),e.steered&&(0,O.jsx)("div",{className:"um-tag",children:g("timeline.steer")}),o&&e.clientId&&(0,O.jsxs)("div",{className:"um-fail",role:"alert",children:[(0,O.jsxs)("span",{className:"um-fail-t",title:e.sendError?Tr(e.sendError):void 0,children:[(0,O.jsx)(re,{name:"x",size:12}),g("timeline.sendFailed")]}),(0,O.jsxs)("button",{type:"button",className:"um-fail-b",title:g("timeline.sendRetry"),onClick:()=>Di.getState().retry(e.clientId),children:[(0,O.jsx)(re,{name:"refresh",size:12}),(0,O.jsx)("span",{children:g("common.retry")})]}),(0,O.jsx)("button",{type:"button",className:"um-fail-b",title:g("timeline.sendDismiss"),"aria-label":g("timeline.sendDismiss"),onClick:()=>Di.getState().dismiss(e.clientId),children:(0,O.jsx)("span",{children:g("common.remove")})})]}),(0,O.jsxs)("div",{className:"um-act",role:"toolbar","aria-label":g("timeline.msgActions"),children:[(0,O.jsx)("button",{type:"button",className:`ibtn${i?" done":""}`,title:i?g("common.copied"):g("common.copy"),"aria-label":i?g("common.copied"):g("common.copy"),onClick:()=>n(e.text),children:(0,O.jsx)(re,{name:i?"check":"copy",size:13})}),(0,O.jsx)("button",{type:"button",className:"ibtn",title:g("timeline.editMsg"),"aria-label":g("timeline.editMsg"),onClick:s,children:(0,O.jsx)(re,{name:"pencil",size:13})}),t&&!e.sendState&&(0,O.jsx)("button",{type:"button",className:"ibtn",title:g("timeline.resend"),"aria-label":g("timeline.resend"),onClick:()=>t(e.text,e.mentions),children:(0,O.jsx)(re,{name:"refresh",size:13})})]})]})}function _6({it:e}){let[t,i]=(0,Rt.useState)(e.streaming?"":e.text),n=(0,Rt.useRef)(null);return(0,Rt.useEffect)(()=>{n.current||(n.current=new lp(i)),n.current.push(e.text),e.streaming||n.current.flush()},[e.text,e.streaming]),(0,Rt.useEffect)(()=>()=>n.current?.stop(),[]),(0,O.jsx)(vb,{text:t,streaming:e.streaming})}function v6({it:e}){let[t,i]=(0,Rt.useState)(!1),n=Math.max(1,Math.round(e.text.length/40));return(0,O.jsxs)("div",{className:"rs-item",children:[(0,O.jsxs)("button",{className:"rs-head",onClick:()=>i(!t),children:[(0,O.jsx)("span",{className:`caret${t?" open":""}`,children:"\u203A"})," ",e.streaming?g("timeline.nowThinking"):_e("timeline.thinking",{s:n})]}),t&&(0,O.jsx)("div",{className:"rs-body",children:e.text})]})}function b6({it:e}){return(0,O.jsxs)("div",{className:`nt ${e.level} nt-bash`,children:[(0,O.jsx)("div",{children:g("timeline.bashMissing")}),(0,O.jsxs)("div",{className:"nt-actions",children:[(0,O.jsx)("button",{type:"button",className:"btn",onClick:()=>{ks(zb)},children:g("timeline.bashDownload")}),(0,O.jsx)("button",{type:"button",className:"btn",onClick:()=>window.dispatchEvent(new Event("open-settings")),children:g("timeline.bashSetting")})]})]})}function ZA(e){let t=`timeline.tool.${e}`,i=g(t);return i.startsWith("timeline.tool.")?g("timeline.tool.other"):i}function w6(){let e=he(i=>i.currentProjectId);return Ke(i=>i.projects).find(i=>i.id===e)?.path??null}function x6(e,t){if(!t)return e;let n=(s=>s.replace(/\\/g,"/").replace(/\/+$/,"").toLowerCase())(t),r=e.replace(/\\/g,"/").toLowerCase();return n&&r.startsWith(n+"/")?e.slice(n.length+1):e}function E6({it:e}){let[t,i]=(0,Rt.useState)(!1);if(!(zA(e.steps)>up))return(0,O.jsx)("div",{className:"tg flat",children:(0,O.jsx)("div",{className:"tg-list",children:e.steps.map(o=>o.kind==="think"?(0,O.jsx)(QA,{s:o},o.itemId):(0,O.jsx)(JA,{s:o},o.itemId))})});let r=LA(e.steps),s=r.counts.map(([o,l])=>_e(`timeline.cat.${o}`,{n:l}));!s.length&&r.thinkSecs&&s.push(_e("timeline.thinking",{s:r.thinkSecs}));let a=IA(e.steps);return(0,O.jsxs)("div",{className:`tg${t?" open":""}`,children:[(0,O.jsxs)("button",{className:"tg-head","aria-expanded":t,onClick:()=>i(!t),children:[(0,O.jsx)("span",{className:"tg-ic","aria-hidden":!0,children:(0,O.jsx)(re,{name:"layers",size:13})}),(0,O.jsx)("span",{className:"tg-sum",children:s.join(" \xB7 ")}),r.failed>0&&(0,O.jsx)("span",{className:"tg-fail",children:_e("timeline.failedCount",{n:r.failed})}),(0,O.jsx)("span",{className:`caret${t?" open":""}`,"aria-hidden":!0,children:"\u203A"})]}),!t&&a&&(0,O.jsx)(k6,{s:a}),t&&(0,O.jsx)("div",{className:"tg-list",children:e.steps.map(o=>o.kind==="think"?(0,O.jsx)(QA,{s:o},o.itemId):(0,O.jsx)(JA,{s:o},o.itemId))})]})}function k6({s:e}){let t=Mb(e.kind),i=t==="think"?g("timeline.nowThinking"):_e(`timeline.now.${t}`,{x:Ob(e)});return(0,O.jsxs)("div",{className:"tg-run",title:i,children:[(0,O.jsx)("span",{className:"spin","aria-hidden":!0}),(0,O.jsx)("span",{className:"tg-run-text",children:i})]})}function QA({s:e}){let[t,i]=(0,Rt.useState)(!1),n=e.think?.text??"",r=Math.max(1,Math.round(n.length/40)),s=!!e.think?.streaming;return(0,O.jsxs)("div",{className:"ts ts-think",children:[(0,O.jsxs)("button",{className:"ts-head","aria-expanded":t,onClick:()=>n.trim()&&i(!t),children:[(0,O.jsx)("span",{className:"ts-ic","aria-hidden":!0,children:(0,O.jsx)(re,{name:"spark",size:13})}),(0,O.jsx)("span",{className:"ts-title",children:s?g("timeline.nowThinking"):_e("timeline.thinking",{s:r})}),s&&(0,O.jsx)("span",{className:"ts-st","aria-hidden":!0,children:(0,O.jsx)("span",{className:"spin"})})]}),t&&(0,O.jsx)("div",{className:"rs-body",children:n})]})}function C6({status:e}){return e==="running"?(0,O.jsx)("span",{className:"ts-st run","aria-label":"running",children:(0,O.jsx)("span",{className:"spin"})}):e==="failed"?(0,O.jsx)("span",{className:"ts-st fail","aria-label":"failed",children:(0,O.jsx)(re,{name:"x",size:12})}):(0,O.jsx)("span",{className:"ts-st ok","aria-label":"ok",children:(0,O.jsx)(re,{name:"check",size:12})})}function JA({s:e}){let[t,i]=(0,Rt.useState)(e.status==="failed"),n=e.status==="failed",r=(0,Rt.useRef)(n);(0,Rt.useEffect)(()=>{n&&!r.current&&i(!0),r.current=n},[n]);let s=w6(),a=!!(e.output||e.detail||e.input!=null||n),o=x6(Ob(e),s)||ZA(e.kind),l=e.kind==="edit"||e.kind==="write"?BA(e):null,c=S6.has(e.kind)&&o!==e.title,u=`${ZA(e.kind)} \xB7 ${e.title||o}${e.durationMs!=null?` \xB7 ${Rv(e.durationMs)}`:""}`;return(0,O.jsxs)("div",{className:`ts${n?" failed":""}${t?" open":""}`,"data-kind":e.kind,children:[(0,O.jsxs)("button",{className:"ts-head",title:u,"aria-expanded":a?t:void 0,onClick:()=>a&&i(!t),children:[(0,O.jsx)("span",{className:"ts-ic","aria-hidden":!0,children:(0,O.jsx)(re,{name:y6[e.kind]??"wrench",size:13})}),(0,O.jsx)("span",{className:`ts-title${c?" mono":""}`,children:o}),l&&(l.added>0||l.removed>0)&&(0,O.jsxs)("span",{className:"ts-diff",children:[(0,O.jsxs)("span",{className:"add",children:["+",l.added]}),(0,O.jsxs)("span",{className:"del",children:["-",l.removed]})]}),e.exitCode!=null&&e.exitCode!==0&&(0,O.jsxs)("span",{className:"ts-meta err",children:["exit ",e.exitCode]}),(0,O.jsx)(C6,{status:e.status})]}),t&&(0,O.jsx)(T6,{s:e})]})}function T6({s:e}){let[t,i]=(0,Rt.useState)(!1),n=e.detail,r=n?.hunks??n?.diff?.hunks;if(r)return(0,O.jsx)(pp,{hunks:MA(r),path:n?.diff?.path??n?.path});if(e.status==="failed"&&!e.output?.trim())return(0,O.jsxs)("div",{className:"ts-out",children:[(0,O.jsx)("div",{className:"ts-noerr",children:g("timeline.noErrorOutput")}),e.input!=null&&(0,O.jsx)("pre",{children:JSON.stringify(e.input,null,2).slice(0,4e3)})]});if(e.output!=null){let s=e.output.split(` +`)}}function aM(e){let t=$b(e),i=[];for(let n of t.quotes){let r=/^\[([^\]\n]+)\]\n([\s\S]*)$/.exec(n);i=r?Sp(i,r[2],r[1]):Sp(i,n)}return{quotes:i,rest:t.rest}}var O6,wp=te(()=>{O6=0});function oM(e){return e.kind==="permission"&&!!e.auto&&e.status!=="cancelled"}function R6(e){return e.kind==="toolgroup"||e.kind==="gone"||Ub(e)}function lM(e){if(!e.some(oM))return e;let t=[],i=null,n=()=>{i&&t.push(i),i=null};for(let r of e){if(oM(r)){i||(i={kind:"autoperm",key:`autoperm:${r.requestId}`,items:[]}),i.items.push(r);continue}i&&!R6(r)&&n(),t.push(r)}return n(),t}function cM(e){let t=e.detail??{};return(typeof t.command=="string"&&t.command.trim()?t.command:typeof t.path=="string"&&t.path.trim()?t.path:typeof t.diff?.path=="string"&&t.diff.path.trim()?t.diff.path:e.title).replace(/\s+/g," ").trim()}function uM(e){return e.choice?e.options.find(t=>t.id===e.choice)?.label??e.choice:null}var Wb=te(()=>{Ju()});function dM({it:e}){let[t,i]=(0,Kb.useState)(!1),n=e.items.map(cM).filter(Boolean).join(" \xB7 ");return(0,xt.jsxs)("div",{className:`apv${t?" open":""}`,"data-testid":"auto-approved",children:[(0,xt.jsxs)("button",{className:"apv-head","aria-expanded":t,onClick:()=>i(!t),title:g("timeline.autoApproved.title"),children:[(0,xt.jsx)("span",{className:"apv-ic","aria-hidden":!0,children:(0,xt.jsx)(ne,{name:"shieldCheck",size:13})}),(0,xt.jsx)("span",{className:"apv-n",children:_e("timeline.autoApproved.count",{n:e.items.length})}),!t&&n&&(0,xt.jsx)("span",{className:"apv-peek",children:n}),(0,xt.jsx)("span",{className:`caret${t?" open":""}`,"aria-hidden":!0,children:"\u203A"})]}),t&&(0,xt.jsx)("div",{className:"apv-list",children:e.items.map(r=>{let s=r.detail??{},a=uM(r),o=typeof s.command=="string"&&s.command.trim()?s.command.trim():"",l=!o&&typeof s.path=="string"&&s.path.trim()?s.path.trim():"",c=r.status==="pending"?g("timeline.autoApproved.pending"):_e("timeline.autoApproved.answer",{opt:a??g("timeline.permAllowed")});return(0,xt.jsxs)("div",{className:"apv-row",title:[r.title,o||l,c].filter(Boolean).join(` +`),children:[(0,xt.jsx)("span",{className:"ts-ic","aria-hidden":!0,children:(0,xt.jsx)(ne,{name:r.status==="pending"?"hourglass":"check",size:13})}),o?(0,xt.jsx)("span",{className:"apv-cmd",children:o}):l?(0,xt.jsx)("span",{className:"apv-path",children:l}):(0,xt.jsx)("span",{className:"apv-title",children:r.title}),(0,xt.jsx)("span",{className:"apv-meta",children:c})]},r.requestId)})})]})}function fM({it:e,threadId:t}){let[i,n]=(0,Kb.useState)(!1),r=e.code==="auto_approve_migrated",s=()=>{n(!0),Z.call("thread.setMode",{id:t,mode:"bypassPermissions"}).catch(()=>{}).finally(()=>n(!1))};return(0,xt.jsxs)("div",{className:"nt nt-auto","data-testid":"auto-upgrade-notice",role:"note",children:[(0,xt.jsxs)("div",{className:"nt-auto-h",children:[(0,xt.jsx)("span",{className:"apv-ic",children:(0,xt.jsx)(ne,{name:"shieldCheck",size:14})}),(0,xt.jsx)("b",{children:g("timeline.autoUpgrade.title")})]}),(0,xt.jsx)("div",{children:g(r?"timeline.autoUpgrade.migrated":"timeline.autoUpgrade.body")}),(0,xt.jsxs)("div",{className:"nt-actions",children:[(0,xt.jsx)("button",{type:"button",className:"btn",disabled:i,onClick:s,children:g("timeline.autoUpgrade.turnOn")}),(0,xt.jsx)("button",{type:"button",className:"btn",onClick:()=>window.dispatchEvent(new Event("open-settings")),children:g("timeline.autoUpgrade.settings")})]})]})}var Kb,xt,hM,pM=te(()=>{Kb=ie(bt(),1);Wb();Rn();kt();qi();xt=ie(ye(),1);hM=new Set(["auto_approve_upgrade","auto_approve_migrated"])});function bM(e){return`/attachments/${e}?t=${vM()}`}function D6({text:e}){let t=(0,zt.useMemo)(()=>nC(e),[e]);return t.length===1&&typeof t[0]=="string"?(0,O.jsx)(O.Fragment,{children:e}):(0,O.jsx)(O.Fragment,{children:t.map((i,n)=>typeof i=="string"?i:(0,O.jsx)("a",{href:i.url,"data-ac-local":i.url,className:"ac-local",title:g("links.openPreviewTitle"),children:i.text},n))})}function Yb({path:e,isDir:t,onRemove:i}){return(0,O.jsxs)("span",{className:"mention",title:e,children:[(0,O.jsx)(ne,{name:t?"files":"file",size:12}),(0,O.jsxs)("span",{className:"mention-name",children:[L6(e),t?"/":""]}),i&&(0,O.jsx)("button",{type:"button",className:"att-x","aria-label":g("mention.remove"),onClick:i,children:"\xD7"})]})}function yM(){let[e,t]=(0,zt.useState)(!1);return(0,zt.useEffect)(()=>{if(!e)return;let i=setTimeout(()=>t(!1),1500);return()=>clearTimeout(i)},[e]),[e,i=>{vr(i).then(()=>t(!0))}]}function I6({it:e,onRetry:t}){let[i,n]=yM(),r=(0,zt.useMemo)(()=>$b(e.text),[e.text]),s=()=>window.dispatchEvent(new CustomEvent("ac-composer-fill",{detail:{text:e.text,mentions:e.mentions??[]}})),a=!!e.clientId&&gp.has(e.clientId),o=e.sendState==="failed";return(0,O.jsxs)("div",{className:`um-row${a?" fresh":""}${e.sendState?` ${e.sendState}`:""}`,"data-client-id":e.clientId,children:[(0,O.jsxs)("div",{className:"um",children:[e.attachments?.filter(l=>Gb(l.mime)).map(l=>(0,O.jsx)("img",{className:"um-img",src:`/attachments/${l.id}?t=${vM()}`,alt:l.name},l.id)),e.attachments?.some(l=>!Gb(l.mime))&&(0,O.jsx)("span",{className:"um-mentions",children:e.attachments.filter(l=>!Gb(l.mime)).map(l=>(0,O.jsxs)("span",{className:"mention",title:l.name,children:[(0,O.jsx)(ne,{name:"file",size:12}),(0,O.jsx)("span",{className:"mention-name",children:l.name})]},l.id))}),e.mentions&&e.mentions.length>0&&(0,O.jsx)("span",{className:"um-mentions",children:e.mentions.map(l=>(0,O.jsx)(Yb,{path:l.path,isDir:l.isDir},l.path))}),r.quotes.map((l,c)=>(0,O.jsx)("span",{className:"um-quote",children:l},c)),(0,O.jsx)("span",{className:"um-text",children:r.rest})]}),e.steered&&(0,O.jsx)("div",{className:"um-tag",children:g("timeline.steer")}),o&&e.clientId&&(0,O.jsxs)("div",{className:"um-fail",role:"alert",children:[(0,O.jsxs)("span",{className:"um-fail-t",title:e.sendError?Ar(e.sendError):void 0,children:[(0,O.jsx)(ne,{name:"x",size:12}),g("timeline.sendFailed")]}),(0,O.jsxs)("button",{type:"button",className:"um-fail-b",title:g("timeline.sendRetry"),onClick:()=>Rt.getState().retry(e.clientId),children:[(0,O.jsx)(ne,{name:"refresh",size:12}),(0,O.jsx)("span",{children:g("common.retry")})]}),(0,O.jsx)("button",{type:"button",className:"um-fail-b",title:g("timeline.sendDismiss"),"aria-label":g("timeline.sendDismiss"),onClick:()=>Rt.getState().dismiss(e.clientId),children:(0,O.jsx)("span",{children:g("common.remove")})})]}),(0,O.jsxs)("div",{className:"um-act",role:"toolbar","aria-label":g("timeline.msgActions"),children:[(0,O.jsx)("button",{type:"button",className:`ibtn${i?" done":""}`,title:i?g("common.copied"):g("common.copy"),"aria-label":i?g("common.copied"):g("common.copy"),onClick:()=>n(e.text),children:(0,O.jsx)(ne,{name:i?"check":"copy",size:13})}),(0,O.jsx)("button",{type:"button",className:"ibtn",title:g("timeline.editMsg"),"aria-label":g("timeline.editMsg"),onClick:s,children:(0,O.jsx)(ne,{name:"pencil",size:13})}),t&&!e.sendState&&(0,O.jsx)("button",{type:"button",className:"ibtn",title:g("timeline.resend"),"aria-label":g("timeline.resend"),onClick:()=>t(e.text,e.mentions),children:(0,O.jsx)(ne,{name:"refresh",size:13})})]})]})}function z6({it:e}){let[t,i]=(0,zt.useState)(e.streaming?"":e.text),n=(0,zt.useRef)(null);return(0,zt.useEffect)(()=>{n.current||(n.current=new _p(i)),n.current.push(e.text),e.streaming||n.current.flush()},[e.text,e.streaming]),(0,zt.useEffect)(()=>()=>n.current?.stop(),[]),(0,O.jsx)(Ab,{text:t,streaming:e.streaming})}function B6({it:e}){let[t,i]=(0,zt.useState)(!1),n=Math.max(1,Math.round(e.text.length/40));return(0,O.jsxs)("div",{className:"rs-item",children:[(0,O.jsxs)("button",{className:"rs-head",onClick:()=>i(!t),children:[(0,O.jsx)("span",{className:`caret${t?" open":""}`,children:"\u203A"})," ",e.streaming?g("timeline.nowThinking"):_e("timeline.thinking",{s:n})]}),t&&(0,O.jsx)("div",{className:"rs-body",children:e.text})]})}function P6({it:e}){return(0,O.jsxs)("div",{className:`nt ${e.level} nt-bash`,children:[(0,O.jsx)("div",{children:g("timeline.bashMissing")}),(0,O.jsxs)("div",{className:"nt-actions",children:[(0,O.jsx)("button",{type:"button",className:"btn",onClick:()=>{ks(jb)},children:g("timeline.bashDownload")}),(0,O.jsx)("button",{type:"button",className:"btn",onClick:()=>window.dispatchEvent(new Event("open-settings")),children:g("timeline.bashSetting")})]})]})}function mM(e){let t=`timeline.tool.${e}`,i=g(t);return i.startsWith("timeline.tool.")?g("timeline.tool.other"):i}function q6(){let e=he(i=>i.currentProjectId);return Ge(i=>i.projects).find(i=>i.id===e)?.path??null}function F6(e,t){if(!t)return e;let n=(s=>s.replace(/\\/g,"/").replace(/\/+$/,"").toLowerCase())(t),r=e.replace(/\\/g,"/").toLowerCase();return n&&r.startsWith(n+"/")?e.slice(n.length+1):e}function $6({it:e}){let[t,i]=(0,zt.useState)(!1);if(!(eM(e.steps)>bp))return(0,O.jsx)("div",{className:"tg flat",children:(0,O.jsx)("div",{className:"tg-list",children:e.steps.map(o=>o.kind==="think"?(0,O.jsx)(gM,{s:o},o.itemId):(0,O.jsx)(_M,{s:o},o.itemId))})});let r=QA(e.steps),s=r.counts.map(([o,l])=>_e(`timeline.cat.${o}`,{n:l}));!s.length&&r.thinkSecs&&s.push(_e("timeline.thinking",{s:r.thinkSecs}));let a=JA(e.steps);return(0,O.jsxs)("div",{className:`tg${t?" open":""}`,children:[(0,O.jsxs)("button",{className:"tg-head","aria-expanded":t,onClick:()=>i(!t),children:[(0,O.jsx)("span",{className:"tg-ic","aria-hidden":!0,children:(0,O.jsx)(ne,{name:"layers",size:13})}),(0,O.jsx)("span",{className:"tg-sum",children:s.join(" \xB7 ")}),r.failed>0&&(0,O.jsx)("span",{className:"tg-fail",children:_e("timeline.failedCount",{n:r.failed})}),(0,O.jsx)("span",{className:`caret${t?" open":""}`,"aria-hidden":!0,children:"\u203A"})]}),!t&&a&&(0,O.jsx)(W6,{s:a}),t&&(0,O.jsx)("div",{className:"tg-list",children:e.steps.map(o=>o.kind==="think"?(0,O.jsx)(gM,{s:o},o.itemId):(0,O.jsx)(_M,{s:o},o.itemId))})]})}function W6({s:e}){let t=qb(e.kind),i=t==="think"?g("timeline.nowThinking"):_e(`timeline.now.${t}`,{x:Fb(e)});return(0,O.jsxs)("div",{className:"tg-run",title:i,children:[(0,O.jsx)("span",{className:"spin","aria-hidden":!0}),(0,O.jsx)("span",{className:"tg-run-text",children:i})]})}function gM({s:e}){let[t,i]=(0,zt.useState)(!1),n=e.think?.text??"",r=Math.max(1,Math.round(n.length/40)),s=!!e.think?.streaming;return(0,O.jsxs)("div",{className:"ts ts-think",children:[(0,O.jsxs)("button",{className:"ts-head","aria-expanded":t,onClick:()=>n.trim()&&i(!t),children:[(0,O.jsx)("span",{className:"ts-ic","aria-hidden":!0,children:(0,O.jsx)(ne,{name:"spark",size:13})}),(0,O.jsx)("span",{className:"ts-title",children:s?g("timeline.nowThinking"):_e("timeline.thinking",{s:r})}),s&&(0,O.jsx)("span",{className:"ts-st","aria-hidden":!0,children:(0,O.jsx)("span",{className:"spin"})})]}),t&&(0,O.jsx)("div",{className:"rs-body",children:n})]})}function K6({status:e}){return e==="running"?(0,O.jsx)("span",{className:"ts-st run","aria-label":"running",children:(0,O.jsx)("span",{className:"spin"})}):e==="failed"?(0,O.jsx)("span",{className:"ts-st fail","aria-label":"failed",children:(0,O.jsx)(ne,{name:"x",size:12})}):(0,O.jsx)("span",{className:"ts-st ok","aria-label":"ok",children:(0,O.jsx)(ne,{name:"check",size:12})})}function _M({s:e}){let[t,i]=(0,zt.useState)(e.status==="failed"),n=e.status==="failed",r=(0,zt.useRef)(n);(0,zt.useEffect)(()=>{n&&!r.current&&i(!0),r.current=n},[n]);let s=q6(),a=!!(e.output||e.detail||e.input!=null||n),o=F6(Fb(e),s)||mM(e.kind),l=e.kind==="edit"||e.kind==="write"?tM(e):null,c=U6.has(e.kind)&&o!==e.title,u=`${mM(e.kind)} \xB7 ${e.title||o}${e.durationMs!=null?` \xB7 ${Pv(e.durationMs)}`:""}`;return(0,O.jsxs)("div",{className:`ts${n?" failed":""}${t?" open":""}`,"data-kind":e.kind,children:[(0,O.jsxs)("button",{className:"ts-head",title:u,"aria-expanded":a?t:void 0,onClick:()=>a&&i(!t),children:[(0,O.jsx)("span",{className:"ts-ic","aria-hidden":!0,children:(0,O.jsx)(ne,{name:H6[e.kind]??"wrench",size:13})}),(0,O.jsx)("span",{className:`ts-title${c?" mono":""}`,children:o}),l&&(l.added>0||l.removed>0)&&(0,O.jsxs)("span",{className:"ts-diff",children:[(0,O.jsxs)("span",{className:"add",children:["+",l.added]}),(0,O.jsxs)("span",{className:"del",children:["-",l.removed]})]}),e.exitCode!=null&&e.exitCode!==0&&(0,O.jsxs)("span",{className:"ts-meta err",children:["exit ",e.exitCode]}),(0,O.jsx)(K6,{status:e.status})]}),t&&(0,O.jsx)(G6,{s:e})]})}function G6({s:e}){let[t,i]=(0,zt.useState)(!1),n=e.detail,r=n?.hunks??n?.diff?.hunks;if(r)return(0,O.jsx)(xp,{hunks:YA(r),path:n?.diff?.path??n?.path});if(e.status==="failed"&&!e.output?.trim())return(0,O.jsxs)("div",{className:"ts-out",children:[(0,O.jsx)("div",{className:"ts-noerr",children:g("timeline.noErrorOutput")}),e.input!=null&&(0,O.jsx)("pre",{children:JSON.stringify(e.input,null,2).slice(0,4e3)})]});if(e.output!=null){let s=e.output.split(` `),a=s.length>50&&!t,o=a?s.slice(-50).join(` -`):e.output;return(0,O.jsxs)("div",{className:"ts-out",children:[a&&(0,O.jsx)("button",{className:"ts-more",onClick:()=>i(!0),children:_e("timeline.showAllLines",{n:s.length})}),(0,O.jsx)("pre",{onClick:tp,children:(0,O.jsx)(p6,{text:o})})]})}return e.input!=null?(0,O.jsx)("pre",{className:"ts-out",children:JSON.stringify(e.input,null,2).slice(0,4e3)}):null}function pp({hunks:e,path:t,max:i=3e3}){let n=0,r=!1;return(0,O.jsxs)("div",{className:"diff",children:[t&&(0,O.jsx)("div",{className:"diff-path",children:t}),(0,O.jsx)("pre",{className:"diff-pre",children:e.map((s,a)=>(0,O.jsxs)("span",{className:"dh",children:[(0,O.jsx)("span",{className:"dh-head",children:s.head??"@@"}),s.lines.map((o,l)=>(n++,n>i?(r=!0,null):(0,O.jsxs)("span",{className:`dl ${o.t==="+"?"add":o.t==="-"?"del":""}`,children:[o.t," ",o.text,` -`]},l)))]},a))}),r&&(0,O.jsx)("div",{className:"dlg-hint",children:_e("timeline.diffClip",{n:i})})]})}function N6({it:e}){return(0,O.jsx)("div",{className:"card plan",children:(0,O.jsx)(vb,{text:e.markdown})})}function A6({it:e}){let{done:t,total:i}=dp(e.items);return(0,O.jsxs)("div",{className:"ck","data-todo-key":e.key,children:[(0,O.jsxs)("div",{className:"ck-head",children:[(0,O.jsx)(re,{name:"listChecks",size:13}),(0,O.jsxs)("span",{className:"ck-n",children:[t,"/",i]}),(0,O.jsx)("span",{className:"ck-l",children:g("timeline.tasks")})]}),(0,O.jsx)("ul",{className:"ck-list",children:e.items.map((n,r)=>{let s=n.status==="done"||n.status==="completed"?"done":n.status==="in_progress"?"doing":"todo";return(0,O.jsxs)("li",{className:`ck-i ${s}`,children:[(0,O.jsx)("span",{className:"ck-box","aria-hidden":!0,children:s==="done"?(0,O.jsx)(re,{name:"check",size:12}):s==="doing"?(0,O.jsx)("span",{className:"spin"}):(0,O.jsx)(re,{name:"circle",size:12})}),(0,O.jsx)("span",{className:"ck-t",children:n.text})]},r)})})]})}function M6({it:e,threadId:t}){let[i,n]=(0,Rt.useState)(!1),r=l=>{n(!0),Q.call("thread.respond",{id:t,requestId:e.requestId,optionId:l}).catch(()=>n(!1))},s=e.detail,a=s?.hunks??s?.diff?.hunks,o=e.status==="resolved"?e.auto?g("timeline.permAutoAllowed"):e.choice==="allow_always"||e.choice==="acceptForSession"?g("timeline.permAllowSession"):e.choice==="deny"||e.choice==="reject"||e.choice==="decline"?g("timeline.permDenied"):e.choice==="implement"?g("timeline.permAllowed"):g("timeline.permAllowed"):g("timeline.permCancelled");return(0,O.jsxs)("div",{className:`card perm${e.status!=="pending"?" done":""}`,children:[(0,O.jsx)("div",{className:"perm-title",children:e.title}),s?.command&&(0,O.jsx)("pre",{className:"perm-cmd",children:s.command}),s?.path&&(0,O.jsx)("div",{className:"perm-path",children:s.path}),a&&(0,O.jsx)(pp,{hunks:a,path:s?.diff?.path??s?.path,max:200}),e.status==="pending"?(0,O.jsx)("div",{className:"perm-btns",children:e.options.map(l=>(0,O.jsx)("button",{className:`btn ${l.kind==="allow_once"?"primary":l.kind==="reject_once"?"danger":""}`,disabled:i,onClick:()=>r(l.id),children:l.label},l.id))}):(0,O.jsx)("div",{className:"perm-done",children:o})]})}function O6({it:e,threadId:t}){let[i,n]=(0,Rt.useState)({}),[r,s]=(0,Rt.useState)({}),a=e.questions,o=(c,u)=>c.id??c.question??c.header??`q${u}`,l=()=>{let c={};a.forEach((u,d)=>{c[o(u,d)]=i[d]?.trim()||r[d]||""}),Q.call("thread.respond",{id:t,requestId:e.requestId,answers:c})};return(0,O.jsxs)("div",{className:`card ask${e.status!=="pending"?" done":""}`,children:[a.map((c,u)=>(0,O.jsxs)("div",{className:"ask-q",children:[(0,O.jsx)("div",{className:"ask-t",children:c.header??c.question}),e.status==="pending"?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("div",{className:"ask-opts",children:c.options?.map(d=>(0,O.jsx)("button",{className:`btn${r[u]===d.label?" primary":""}`,onClick:()=>s(h=>({...h,[u]:d.label})),children:d.label},d.label))}),(0,O.jsx)("input",{className:"tinput ask-free",placeholder:g("common.other"),value:i[u]??"",onChange:d=>n(h=>({...h,[u]:d.target.value}))})]}):(0,O.jsx)("div",{className:"perm-done",children:e.answers?_e("timeline.submitted",{ans:Object.values(e.answers).join("\u3001")}):g("timeline.permCancelled")})]},u)),e.status==="pending"&&(0,O.jsx)("button",{className:"btn primary",onClick:l,children:g("common.submit")})]})}function R6({it:e,onRetry:t,replyText:i}){let n=he(),[r,s]=(0,Rt.useState)(!1),[a,o]=iM(),l=L6(e.model,e.model!==void 0);if(e.status==="failed")return(0,O.jsxs)("div",{className:"card err-card",children:[(0,O.jsx)("div",{className:"err-line",children:_e("timeline.turnError",{err:Tr(e.error??g("timeline.unknownError"))})}),(0,O.jsxs)("div",{className:"perm-btns",children:[t&&(0,O.jsx)("button",{className:"btn",onClick:t,children:g("common.retry")}),e.error&&e.error.length>60&&(0,O.jsx)("button",{className:"btn ghost",onClick:()=>s(!r),children:g("common.details")})]}),r&&(0,O.jsx)("pre",{className:"perm-cmd",children:Tr(e.error??"")})]});let c=[];if(e.usage){let u=e.usage.inputTokens+e.usage.outputTokens;u&&c.push(`${Wl(u)} tokens`),e.usage.costUsd&&c.push(Mf(e.usage.costUsd))}return(0,O.jsxs)("div",{className:"te",children:[i&&(0,O.jsxs)("button",{type:"button",className:`te-act te-copy${a?" done":""}`,title:a?g("common.copied"):g("common.copy"),"aria-label":a?g("common.copied"):g("common.copy"),onClick:()=>o(i),children:[(0,O.jsx)(re,{name:a?"check":"copy",size:13}),(0,O.jsx)("span",{children:a?g("common.copied"):g("common.copy")})]}),l&&(0,O.jsxs)("span",{className:"te-m",title:l,children:[(0,O.jsx)(re,{name:"cpu",size:12}),(0,O.jsx)("span",{children:l})]}),e.ts!=null&&(0,O.jsxs)("span",{className:"te-m",title:new Date(e.ts).toLocaleString(),children:[(0,O.jsx)(re,{name:"clock",size:12}),(0,O.jsx)("span",{children:D6(e.ts)})]}),e.durationMs!=null&&(0,O.jsxs)("span",{className:"te-m",children:[(0,O.jsx)(re,{name:"hourglass",size:12}),(0,O.jsx)("span",{children:Rv(e.durationMs)})]}),c.length>0&&(0,O.jsx)("span",{className:"te-m te-u",children:c.join(" \xB7 ")}),e.status==="interrupted"&&(0,O.jsx)("span",{className:"te-m",children:g("timeline.interrupted")}),t&&(0,O.jsx)("button",{type:"button",className:"te-act",title:g("timeline.retryHint"),"aria-label":g("timeline.retryHint"),onClick:t,children:(0,O.jsx)(re,{name:"refresh",size:13})}),e.filesChanged!=null&&e.filesChanged>0&&(0,O.jsx)("button",{className:"te-files",onClick:()=>n.openPanel("changes"),children:_e("timeline.filesChanged",{n:e.filesChanged})})]})}function D6(e){let t=new Date(e),i=r=>String(r).padStart(2,"0"),n=`${i(t.getHours())}:${i(t.getMinutes())}`;return t.toDateString()===new Date().toDateString()?n:`${t.getMonth()+1}/${t.getDate()} ${n}`}function L6(e,t){let i=he(o=>o.currentThreadId),n=Ke(o=>o.threads),r=Ke(o=>o.providers);if(!t)return null;let s=n.find(o=>o.id===i),a=r.find(o=>o.id===s?.provider)?.models??[];return e?a.find(o=>o.id===e)?.name??e:a.find(o=>o.isDefault)?.name??null}function nM({it:e,threadId:t,onEditResend:i,onRetryLast:n,replyText:r}){switch(e.kind){case"user":return(0,O.jsx)(g6,{it:e,onRetry:i});case"assistant":return(0,O.jsx)("div",{className:"as",children:(0,O.jsx)(_6,{it:e})});case"reasoning":return(0,O.jsx)(v6,{it:e});case"toolgroup":return(0,O.jsx)(E6,{it:e});case"plan":return(0,O.jsx)(N6,{it:e});case"todo":return(0,O.jsx)(A6,{it:e});case"permission":return(0,O.jsx)(M6,{it:e,threadId:t});case"autoperm":return(0,O.jsx)(jA,{it:e});case"question":return(0,O.jsx)(O6,{it:e,threadId:t});case"notice":return e.code==="bash_missing"?(0,O.jsx)(b6,{it:e}):e.code&&YA.has(e.code)?(0,O.jsx)(VA,{it:e,threadId:t}):(0,O.jsx)("div",{className:`nt ${e.level}`,children:Tr(e.message)});case"turnend":return(0,O.jsx)(R6,{it:e,onRetry:n,replyText:r});case"gone":return null;default:return null}}var Rt,O,zb,eM,m6,Ib,y6,S6,Ku=ae(()=>{Rt=ne(pt(),1);Hu();AA();Mn();Hi();cp();OA();$u();An();Of();Qi();Ct();ep();Pu();fp();yo();XA();O=ne(be(),1),zb="https://git-scm.com/download/win",eM=()=>rc();m6=e=>e.replace(/[\\/]+$/,"").split(/[\\/]/).pop()||e,Ib=e=>!e||e.startsWith("image/");y6={edit:"pencil",write:"pencil",bash:"prompt",read:"fileText",search:"search",glob:"search",web:"globe",task:"layers",mcp:"wrench",todo:"listChecks"},S6=new Set(["edit","write","bash","read","search","glob"])});function sM(e,t,i){let n=t.scrollTop{rM=()=>({stick:!0,lastTop:0,intentAt:-1/0,pointerDown:!1}),I6=e=>e.scrollHeight-e.scrollTop-e.clientHeight;aM=new Set(["ArrowUp","PageUp","Home"])});function ac(e,t){let i=/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith("\\\\"),n=i?"\\":"/",r=t==="."?"":i?t.replace(/\//g,"\\"):t;return r?e.replace(/[\\/]+$/,"")+n+r:e}function lM(e){if(!e||e.length>1e4)return null;try{let t=JSON.parse(e);return typeof t.projectId!="string"||typeof t.rel!="string"||!t.rel||t.rel.length>4096?null:{projectId:t.projectId,rel:t.rel,isDir:t.isDir===!0}}catch{return null}}function Pb(e,t){return e.some(i=>i.projectId===t.projectId&&i.rel===t.rel)||e.length>=50?e:[...e,t]}function cM(e){return e.map(t=>({rel:t.rel,isDir:t.isDir}))}function mp(e,t){let i=o=>o.replace(/\\/g,"/").replace(/\/+$/,""),n=i(e),r=i(t),s=/^[a-zA-Z]:\//.test(n),a=(o,l)=>s?o.toLowerCase()===l.toLowerCase():o===l;return a(r,n)?".":r.length>n.length&&a(r.slice(0,n.length),n)&&r[n.length]==="/"?r.slice(n.length+1):null}var sc,gp=ae(()=>{sc="application/x-agent-console-path"});function pn({value:e,options:t,onChange:i,ariaLabel:n,title:r,className:s,children:a,prefer:o="down",matchWidth:l=!1,menuClassName:c,upAnchor:u}){let[d,h]=(0,Li.useState)(!1),[f,p]=(0,Li.useState)(-1),[_,y]=(0,Li.useState)(null),m=(0,Li.useRef)(null),v=(0,Li.useRef)(null),b=(0,Li.useId)(),w=t.find(H=>H.value===e),k=H=>H>=0&&H{for(let x=1;x<=t.length;x++){let U=(H+P*x+t.length*2)%t.length;if(!t[U].disabled)return U}return H},[t]),T=H=>{let P=t.findIndex(U=>U.value===e),x=H==="first"?M(-1,1):H==="last"?M(0,-1):P;k(x)||(x=M(-1,1)),p(x),y(null),h(!0)},A=H=>{h(!1),H&&m.current?.focus()},I=H=>{k(H)&&(A(!0),t[H].value!==e&&i(t[H].value))};(0,Li.useLayoutEffect)(()=>{if(!d)return;let H=m.current?.getBoundingClientRect(),P=v.current;if(!H||!P)return;let x=window.innerWidth,U=window.innerHeight,C=l?H.width:0;P.style.minWidth=`${C}px`;let D=P.offsetWidth,R=P.scrollHeight,V=U-H.bottom-_p-Gu,z=u&&m.current?.closest(u)?.getBoundingClientRect().top||H.top,L=z-_p-Gu,K=o==="up"?!(LL):VV,X=K?L:V,oe=Math.min(R,X),ge=K?z-_p-oe:H.bottom+_p,te=Math.max(Gu,Math.min(H.left,x-D-Gu));y({left:te,top:Math.max(Gu,ge),minWidth:C,maxHeight:Math.max(80,X)})},[d,o,l,t.length,u]),(0,Li.useEffect)(()=>{d&&_&&v.current?.focus({preventScroll:!0})},[d,_]),(0,Li.useEffect)(()=>{!d||f<0||v.current?.querySelector(`[data-i="${f}"]`)?.scrollIntoView({block:"nearest"})},[d,f]),(0,Li.useEffect)(()=>{if(!d)return;let H=x=>{let U=x.target;v.current?.contains(U)||m.current?.contains(U)||A(!1)},P=()=>A(!1);return window.addEventListener("pointerdown",H,!0),window.addEventListener("resize",P),window.addEventListener("blur",P),()=>{window.removeEventListener("pointerdown",H,!0),window.removeEventListener("resize",P),window.removeEventListener("blur",P)}},[d]);let B=H=>{(H.key==="ArrowDown"||H.key==="ArrowUp"||H.key==="Enter"||H.key===" ")&&(H.preventDefault(),d?A(!1):T(H.key==="ArrowUp"?"last":void 0))},q=H=>{let P=H.key;if(P==="ArrowDown")p(x=>M(x<0?-1:x,1));else if(P==="ArrowUp")p(x=>M(x<0?0:x,-1));else if(P==="Home")p(M(-1,1));else if(P==="End")p(M(0,-1));else if(P==="Enter"||P===" ")I(f);else if(P==="Escape")A(!0);else if(P==="Tab"){A(!0);return}else if(P.length===1&&/\S/.test(P)){let x=P.toLowerCase();for(let U=1;U<=t.length;U++){let C=(Math.max(f,0)+U)%t.length;if(!t[C].disabled&&t[C].label.toLowerCase().startsWith(x)){p(C);break}}}else return;H.preventDefault(),H.stopPropagation()};return(0,qi.jsxs)(qi.Fragment,{children:[(0,qi.jsx)("button",{ref:m,type:"button",className:s,title:r,"aria-label":n,"aria-haspopup":"listbox","aria-expanded":d,"aria-controls":d?`${b}-lb`:void 0,onClick:()=>d?A(!1):T(),onKeyDown:B,children:a??(0,qi.jsx)("span",{className:"sm-val",children:w?.label??""})}),d&&(0,uM.createPortal)((0,qi.jsx)("div",{ref:v,id:`${b}-lb`,className:`menu select-menu${c?` ${c}`:""}`,role:"listbox","aria-label":n,"aria-activedescendant":f>=0?`${b}-o${f}`:void 0,tabIndex:-1,"data-select-menu":"",style:_?{left:_.left,top:_.top,minWidth:_.minWidth,maxHeight:_.maxHeight}:{left:-9999,top:0,visibility:"hidden"},onKeyDown:q,children:t.map((H,P)=>(0,qi.jsxs)("div",{id:`${b}-o${P}`,"data-i":P,role:"option","aria-selected":H.value===e,"aria-disabled":H.disabled||void 0,className:`mi sm-opt${P===f?" on":""}${H.disabled?" off":""}${H.danger?" danger":""}${H.warn?" warn":""}${H.hint?" has-hint":""}`,onPointerMove:()=>{!H.disabled&&f!==P&&p(P)},onClick:()=>I(P),children:[(0,qi.jsxs)("span",{className:"sm-text",children:[(0,qi.jsxs)("span",{className:"sm-label",children:[H.icon&&(0,qi.jsx)(re,{name:H.icon,size:13}),H.label]}),H.hint&&(0,qi.jsx)("span",{className:"sm-hint",children:H.hint})]}),(0,qi.jsx)("span",{className:"sm-check","aria-hidden":"true",children:H.value===e?(0,qi.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",children:(0,qi.jsx)("path",{d:"M2.5 6.2 5 8.6l4.5-5",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}):null})]},H.value))}),document.body)]})}var Li,uM,qi,_p,Gu,vp=ae(()=>{Mn();Li=ne(pt(),1),uM=ne(qs(),1),qi=ne(be(),1),_p=4,Gu=8});function hM(e){return g(`composer.autoDesc.${e&&dM.has(e)?e:"generic"}`)}function fM(e){let t=hM(e);return!e||!dM.has(e)||z6.has(e)?`${t} -${g("composer.autoOn.keeps")}`:t}function Hb(){return[{id:"plan",label:g("composer.mode.plan.label"),desc:g("composer.mode.plan.desc")},{id:"default",label:g("composer.mode.default.label"),desc:g("composer.mode.default.desc")},{id:"acceptEdits",label:g("composer.mode.acceptEdits.label"),desc:g("composer.mode.acceptEdits.desc")},{id:"bypassPermissions",label:g("composer.mode.bypass.label"),desc:g("composer.mode.bypass.desc"),auto:!0}]}function P6(){return[{id:"default",label:g("composer.mode.cursorAgent.label"),desc:g("composer.mode.cursorAgent.desc")},{id:"bypassPermissions",label:g("composer.mode.cursorBypass.label"),desc:g("composer.mode.cursorBypass.desc"),auto:!0},{id:"plan",label:g("composer.mode.cursorPlan.label"),desc:g("composer.mode.cursorPlan.desc")},{id:"ask",label:g("composer.mode.cursorAsk.label"),desc:g("composer.mode.cursorAsk.desc")}]}function pM(e,t,i){return(e==="cursor"?P6():Hb()).filter(r=>t.includes(r.id)).map(r=>e==="pi"&&r.id==="default"?{...r,label:g("composer.mode.pi.label"),desc:g("composer.mode.pi.desc"),auto:!0}:r.id===B6?{...r,desc:hM(e)}:i?.[r.id]?{...r,label:H6(i[r.id])}:r)}function H6(e){let t=g(`composer.agentMode.${e}`);return t.startsWith("composer.agentMode.")?e:t}function bp(e,t){let i=g(`composer.effort.${e}`);return i.startsWith("composer.effort.")?t??e:i}var dM,z6,B6,yp=ae(()=>{Ct();dM=new Set(["claude","codex","copilot","devin","cursor","opencode","pi"]),z6=new Set(["cursor","opencode","dsh"]);B6="bypassPermissions"});function mM({value:e,save:t}){let[i,n]=(0,So.useState)(null),[r,s]=(0,So.useState)(null),[a,o]=(0,So.useState)(null),[l,c]=(0,So.useState)(!1),u=()=>Q.call("shell.status").then(y=>n(y)).catch(()=>{});if((0,So.useEffect)(()=>{u()},[]),!i)return null;if(i.platform!=="win32")return(0,Ji.jsx)("div",{className:"dlg-hint",children:g("settings.bashNotWindows")});let d=r??e,h=async()=>{try{return await Q.call("shell.check",{path:d.trim()})}catch(y){return o({ok:!1,text:Ze(y)}),null}},f=async()=>{if(!d.trim()){o(null);return}c(!0);let y=await h();c(!1),y&&o(y.ok?{ok:!0,text:_e("settings.bashOk",{path:y.path})}:{ok:!1,text:Ub(y.reason)})},p=async()=>{if(r===null||r.trim()===e){s(null);return}let y="";if(r.trim()){let v=await h();if(!v)return;if(!v.ok){o({ok:!1,text:Ub(v.reason)});return}y=v.path}c(!0);let m=await t(y);c(!1),m&&(s(null),o(null),await u())},_=i.found?g(`settings.bashSrc.${i.found.source}`):"";return(0,Ji.jsxs)("div",{className:"bash-set",children:[(0,Ji.jsxs)("div",{className:"bash-row",children:[(0,Ji.jsx)("input",{className:`tinput${a&&!a.ok?" err":""}`,spellCheck:!1,"aria-label":g("settings.bashPath"),placeholder:"E:\\Git\\bin\\bash.exe",value:d,onChange:y=>{s(y.target.value),o(null)},onBlur:()=>{p()},onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),p())}}),(0,Ji.jsx)("button",{type:"button",className:"btn",disabled:l||!d.trim(),onMouseDown:y=>y.preventDefault(),onClick:()=>{f()},children:g("settings.bashCheck")})]}),a&&(0,Ji.jsx)("div",{className:`dlg-hint${a.ok?"":" err"}`,children:a.text}),!a&&i.manualError&&(0,Ji.jsx)("div",{className:"dlg-hint err",children:_e("settings.bashManualBad",{why:Ub(i.manualError)})}),(0,Ji.jsx)("div",{className:"dlg-hint",children:i.found?_e("settings.bashUsing",{path:i.found.path,src:_}):(0,Ji.jsxs)(Ji.Fragment,{children:[g("settings.bashNone")," ",(0,Ji.jsx)("button",{type:"button",className:"te-files",onClick:()=>{ks(zb)},children:g("timeline.bashDownload")})]})}),(0,Ji.jsx)("div",{className:"dlg-hint",children:g("settings.bashHint")})]})}var So,Ji,Ub,gM=ae(()=>{So=ne(pt(),1);Hi();Ct();Pu();Ku();Ji=ne(be(),1),Ub=e=>{let t=`settings.bashBad.${e}`,i=g(t);return i===t?e:i}});function qb(e){let t=e.trim();if(t){try{let i=JSON.parse(t);if(Array.isArray(i)&&i.every(n=>typeof n=="string"))return i}catch{}return null}}function Fb(e){let t=e.trim();if(!/^\d+$/.test(t))return null;let i=Number(t);return i>=5&&i<=240?i:null}var _M=ae(()=>{});function vM(e){return!(e.enabled===!1||!e.available||e.status==="planned")}function F6(e){return e.status==="verified"?g("settings.providerVerified"):e.status==="experimental"?g("settings.providerExperimental"):e.status==="planned"?g("settings.providerPlanned"):g("settings.providerPending")}function bM(){Q.call("providers.list").then(e=>{Ke.setState({providers:e})}).catch(()=>{})}function SM({onClose:e,providers:t}){let[i,n]=(0,Ln.useState)(null),[r,s]=(0,Ln.useState)({}),[a,o]=(0,Ln.useState)(null),[l,c]=(0,Ln.useState)({}),[u,d]=(0,Ln.useState)({}),[h,f]=(0,Ln.useState)({}),[p,_]=(0,Ln.useState)({}),[y,m]=(0,Ln.useState)(null),v=Hb();(0,Ln.useEffect)(()=>{Q.call("settings.get").then(x=>n(x)),Q.call("app.info").then(x=>s(x)).catch(()=>{})},[]);let b=async x=>{let U=i,C={...i,...x};n(C),x.theme&&Wr(x.theme);let D=x.contentWidth!==void 0||x.chatFontSize!==void 0;D&&Su(C);try{return await Q.call("settings.set",{patch:x}),window.dispatchEvent(new CustomEvent("settings-changed",{detail:C})),!0}catch(R){return n(U),x.theme&&Wr(U?.theme),D&&Su(U??{}),Ee(g("settings.failSave")+Ze(R),!0),!1}},w=async(x,U)=>{c(V=>({...V,[x]:U}));let C=i?.providerEnabled??{},D=i,R={...i,providerEnabled:{...C,[x]:U}};n(R);try{await Q.call("settings.set",{patch:{providerEnabled:R.providerEnabled}}),window.dispatchEvent(new CustomEvent("settings-changed",{detail:R})),U||Ke.setState(V=>({providers:V.providers.map(z=>z.id===x?{...z,enabled:!1}:z)})),bM()}catch(V){n(D),Ee(g("settings.providerToggleFailed")+Ze(V),!0)}finally{c(V=>{let z={...V};return delete z[x],z})}},k=()=>{Q.call("providers.list",{refresh:!0}).then(x=>{Ke.setState({providers:x}),Ee(g("settings.providerRedetect")+" \u2713")}).catch(x=>Ee(Ze(x),!0))},M=async(x,U)=>{let C={...i?.providerCommand??{}},D={...C[x],...U};D.executable||delete D.executable,(!D.args||D.args.length===0)&&delete D.args,JSON.stringify(C[x]??{})!==JSON.stringify(D)&&(C[x]=D,await b({providerCommand:C})&&bM())},T=x=>{let U=u[x];U!==void 0&&(M(x,{executable:U.trim()||void 0}),d(C=>{let D={...C};return delete D[x],D}))},A=x=>{let U=h[x];if(U===void 0)return;let C=qb(U);if(C===null){_(D=>({...D,[x]:!0}));return}_(D=>({...D,[x]:!1})),M(x,{args:C}),f(D=>{let R={...D};return delete R[x],R})},I=()=>{if(y===null)return;let x=Fb(y);x!==null&&(m(null),x!==i?.idleCloseMinutes&&b({idleCloseMinutes:x}))},B=(x,U)=>{if(!U)return{dot:"off",text:g("settings.providerOff")};if(x.enabled===!1)return{dot:"pending",text:g("settings.providerPending")};if(!x.available)return{dot:"off",text:x.reason??g("common.notDetected")};let C=x.models?.length??0,D=F6(x),R=C>0?` \xB7 ${_e("settings.providerModels",{n:String(C)})}`:"";return{dot:x.status==="verified"?"on":"pending",text:D+R}};if(!i)return(0,ye.jsx)(Kr,{title:g("settings.title"),onClose:e,children:(0,ye.jsx)("div",{className:"dlg-hint",children:g("common.loading")})});let q=(x,U,C)=>(0,ye.jsxs)("div",{className:"dlg-row",children:[(0,ye.jsx)("label",{children:x}),U,C&&(0,ye.jsx)("div",{className:"dlg-hint",style:{marginTop:4},children:C})]}),H=y!==null&&Fb(y)===null,P=x=>U=>{U.key==="Enter"&&(U.preventDefault(),x())};return(0,ye.jsxs)(Kr,{title:g("settings.title"),onClose:e,wide:!0,footer:(0,ye.jsx)("button",{className:"btn primary",onClick:e,children:g("common.done")}),children:[q(g("settings.defaultAgent"),(0,ye.jsx)(pn,{className:"tinput sm-field",matchWidth:!0,ariaLabel:g("settings.defaultAgent"),value:i.defaultProvider??"claude",onChange:x=>{b({defaultProvider:x})},options:t.map(x=>({value:x.id,label:x.name+(vM(x)?"":g("common.notInstalled")),disabled:!vM(x)}))})),(0,ye.jsxs)("div",{className:"dlg-row dlg-row-top",children:[(0,ye.jsx)("label",{children:g("settings.providers")}),(0,ye.jsxs)("div",{className:"provider-list",children:[(0,ye.jsx)("button",{type:"button",className:"btn sm provider-redetect",onClick:k,children:g("settings.providerRedetect")}),t.map(x=>{let U=l[x.id]??i.providerEnabled?.[x.id]??x.enabled!==!1,C=B(x,U),D=a===x.id,R=i.providerCommand?.[x.id],V=h[x.id]??(R?.args?.length?JSON.stringify(R.args):"");return(0,ye.jsxs)("div",{className:`provider-row${D?" open":""}`,children:[(0,ye.jsxs)("button",{type:"button",className:"provider-head",onClick:()=>o(D?null:x.id),children:[(0,ye.jsx)("span",{className:`provider-dot provider-dot-${C.dot}`,"aria-hidden":!0}),(0,ye.jsxs)("div",{className:"provider-meta",children:[(0,ye.jsx)("span",{className:"provider-name",children:x.name}),(0,ye.jsx)("span",{className:"dlg-hint",children:C.text})]}),(0,ye.jsx)("span",{className:"mi-caret",children:D?"\u25BE":"\u25B8"})]}),(0,ye.jsx)("label",{className:"provider-switch",title:x.name,children:(0,ye.jsx)("input",{type:"checkbox",checked:U,disabled:l[x.id]!==void 0,onChange:z=>{w(x.id,z.target.checked)}})}),D&&(0,ye.jsxs)("div",{className:"provider-detail",children:[x.bin&&(0,ye.jsxs)("div",{className:"dlg-hint",children:[x.bin,x.version?` \xB7 ${x.version}`:""]}),x.installHint&&(0,ye.jsxs)("div",{className:"provider-hint-row",children:[(0,ye.jsx)("code",{className:"dlg-hint",children:x.installHint}),(0,ye.jsx)("button",{type:"button",className:"te-files",onClick:()=>{navigator.clipboard?.writeText(x.installHint??"").then(()=>Ee(g("common.copied")))},children:g("settings.providerCopyHint")})]}),(0,ye.jsx)("div",{className:"dlg-hint",children:g("settings.providerLaunchCmd")}),(0,ye.jsx)("input",{className:"tinput",placeholder:g("settings.providerLaunchExe"),"aria-label":g("settings.providerLaunchExe"),value:u[x.id]??R?.executable??"",onChange:z=>{let L=z.target.value;d(K=>({...K,[x.id]:L}))},onBlur:()=>T(x.id),onKeyDown:P(()=>T(x.id))}),(0,ye.jsx)("input",{className:`tinput${p[x.id]?" err":""}`,placeholder:'["--foo"]',"aria-label":g("settings.providerLaunchArgs"),value:V,onChange:z=>{let L=z.target.value;f(K=>({...K,[x.id]:L})),p[x.id]&&_(K=>({...K,[x.id]:qb(L)===null}))},onBlur:()=>A(x.id),onKeyDown:P(()=>A(x.id))}),(0,ye.jsx)("div",{className:`dlg-hint${p[x.id]?" err":""}`,children:p[x.id]?g("settings.providerArgsInvalid"):g("settings.providerLaunchArgsHint")})]})]},x.id)})]})]}),q(g("settings.defaultMode"),(0,ye.jsx)(pn,{className:"tinput sm-field",matchWidth:!0,ariaLabel:g("settings.defaultMode"),value:i.defaultMode??"default",onChange:x=>{b({defaultMode:x})},options:v.map(x=>({value:x.id,label:x.label,hint:x.desc,icon:x.auto?"shieldCheck":void 0})),children:(0,ye.jsx)("span",{className:"sm-val",children:(()=>{let x=v.find(U=>U.id===(i.defaultMode??"default"));return x?`${x.label} \u2014 ${x.desc}`:""})()})}),i.defaultMode==="bypassPermissions"?`${g("settings.defaultModeHint")} ${g("composer.autoWarn")}`:g("settings.defaultModeHint")),q(g("settings.theme"),(0,ye.jsx)(pn,{className:"tinput sm-field",matchWidth:!0,ariaLabel:g("settings.theme"),value:xv(i.theme),onChange:x=>{b({theme:x})},options:[{value:"auto",label:hk()?g("settings.themeMagpie"):g("settings.themeAuto")},{value:"light",label:g("settings.themeLight")},{value:"dark",label:g("settings.themeDark")}]})),q(g("settings.contentWidth"),(0,ye.jsx)(pn,{className:"tinput sm-field",matchWidth:!0,ariaLabel:g("settings.contentWidth"),value:wf(i.contentWidth),onChange:x=>{b({contentWidth:x})},options:[{value:"narrow",label:g("settings.widthNarrow")},{value:"default",label:g("settings.widthDefault")},{value:"wide",label:g("settings.widthWide")},{value:"full",label:g("settings.widthFull")}]})),q(g("settings.chatFont"),(0,ye.jsx)(pn,{className:"tinput sm-field",matchWidth:!0,ariaLabel:g("settings.chatFont"),value:String(Cv(i.chatFontSize)),onChange:x=>{b({chatFontSize:Number(x)})},options:Array.from({length:Ev-Sf+1},(x,U)=>Sf+U).map(x=>({value:String(x),label:`${x} px${x===kv?g("settings.chatFontDefault"):""}`}))}),g("settings.chatFontHint")),q(g("settings.sendKey"),(0,ye.jsx)(pn,{className:"tinput sm-field",matchWidth:!0,ariaLabel:g("settings.sendKey"),value:i.sendKey??"enter",onChange:x=>{b({sendKey:x})},options:[{value:"enter",label:g("settings.sendEnter")},{value:"ctrlEnter",label:g("settings.sendCtrl")}]})),q(g("settings.runningSend"),(0,ye.jsx)(pn,{className:"tinput sm-field",matchWidth:!0,ariaLabel:g("settings.runningSend"),value:i.runningSend??"queue",onChange:x=>{b({runningSend:x})},options:[{value:"queue",label:g("settings.queue")},{value:"steer",label:g("settings.steer")}]}),g("settings.steerHint")),q(g("settings.thinking"),(0,ye.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"center",fontSize:"var(--fs-m)",color:"var(--fg)"},children:[(0,ye.jsx)("input",{type:"checkbox",checked:i.showThinking!==!1,onChange:x=>{b({showThinking:x.target.checked})}}),g("settings.showThinking")]})),q(g("settings.idleClose"),(0,ye.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,ye.jsx)("input",{className:`tinput${H?" err":""}`,type:"number",min:5,max:240,step:1,style:{width:90,flex:"none"},"aria-label":g("settings.idleClose"),value:y??String(i.idleCloseMinutes??30),onChange:x=>m(x.target.value),onBlur:I,onKeyDown:P(I)}),(0,ye.jsx)("span",{className:"dlg-hint",children:g("settings.idleMinutes")})]}),H?g("settings.idleInvalid"):void 0),q(g("settings.bashPath"),(0,ye.jsx)(mM,{value:i.bashPath??"",save:x=>b({bashPath:x})})),(0,ye.jsx)("div",{className:"msep"}),(0,ye.jsxs)("div",{className:"dlg-hint",children:[_e("settings.versionLine",{ver:r.version??"?",pid:r.pid??"?"}),(0,ye.jsx)("br",{}),g("settings.dataDir"),r.dataDir??"?"," ",(0,ye.jsx)("button",{className:"te-files",onClick:()=>{navigator.clipboard?.writeText(r.dataDir??"").catch(()=>{})},children:g("common.copy")})]})]})}function yM(e){return{sendKey:e?.sendKey==="ctrlEnter"?"ctrlEnter":"enter",runningSend:e?.runningSend==="steer"?"steer":"queue",showThinking:e?.showThinking!==!1}}function ju(){let[e,t]=(0,Ln.useState)(W6);return(0,Ln.useEffect)(()=>{Q.call("settings.get").then(n=>t(yM(n))).catch(()=>{});let i=n=>t(yM(n.detail));return window.addEventListener("settings-changed",i),()=>window.removeEventListener("settings-changed",i)},[]),e}var Ln,ye,W6,Sp=ae(()=>{Ln=ne(pt(),1);Kl();vp();Hi();fr();yp();Ct();gM();An();_M();yu();Tv();ye=ne(be(),1);W6={sendKey:"enter",runningSend:"queue",showThinking:!0}});function wM({size:e=18,className:t}){return(0,xa.jsxs)("svg",{className:t,width:e,height:e,viewBox:"0 0 64 64","aria-hidden":"true",children:[(0,xa.jsx)("rect",{width:"64",height:"64",rx:"15",fill:"#26292b"}),(0,xa.jsxs)("g",{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"5.2",children:[(0,xa.jsx)("path",{d:"M14 20.5 25 31 14 41.5",stroke:"#fff"}),(0,xa.jsx)("path",{d:"M29.14 23.61A12 12 0 1 1 46.63 39.92L48.6 47.6 39.85 42.93A12 12 0 0 1 29.14 38.39",stroke:"#fff"}),(0,xa.jsx)("path",{d:"M35.6 35.4h6",stroke:"#2dd4bf"})]})]})}var xa,xM=ae(()=>{xa=ne(be(),1)});function kM({providerId:e,onBack:t}){let i=fM(e),n=(0,EM.useId)();return(0,Ns.jsxs)("div",{className:"cp-auto-on",role:"status","aria-live":"polite","data-testid":"auto-on",children:[(0,Ns.jsxs)("span",{className:"cp-auto-t",title:i,"aria-describedby":n,tabIndex:0,children:[(0,Ns.jsx)("span",{className:"cp-auto-ic","aria-hidden":!0,children:(0,Ns.jsx)(re,{name:"shieldCheck",size:13})}),(0,Ns.jsx)("b",{children:g("composer.autoOn.title")})]}),(0,Ns.jsx)("span",{id:n,className:"sr-only",children:i}),t&&(0,Ns.jsx)("button",{type:"button",className:"cp-auto-back",onClick:t,children:g("composer.autoOn.back")})]})}var EM,Ns,CM=ae(()=>{EM=ne(pt(),1);Mn();yp();Ct();Ns=ne(be(),1)});function TM(e,t=!1){if(t||!e.startsWith("/"))return{open:!1,query:""};let i=e.slice(1);return i.includes(` -`)||i.includes(" ")?{open:!1,query:""}:{open:!0,query:i}}function NM(e,t){let i=t.trim().toLowerCase();return i?e.filter(n=>n.name.toLowerCase().includes(i)||n.description.toLowerCase().includes(i)||(n.argumentHint??"").toLowerCase().includes(i)):e}function AM(e){let t=e.filter(r=>r.kind==="command"),i=e.filter(r=>r.kind==="skill"),n=[];if(t.length){n.push({type:"heading",id:"h-cmd",labelKey:"slashGroupCommand"});for(let r of t)n.push({type:"item",id:`c:${r.name}`,command:r})}if(i.length){n.push({type:"heading",id:"h-skill",labelKey:"slashGroupSkill"});for(let r of i)n.push({type:"item",id:`s:${r.name}`,command:r})}return n}function MM(e){return e.filter(t=>t.type==="item").map(t=>t.command)}function Wb(e){return`/${e} `}function OM(e,t){return!!t&&e.trim()===`/${t}`}function $b(e,t){return t<=0?0:e<0?t-1:e>=t?0:e}var RM=ae(()=>{});function LM(){let e=he(),{threads:t,providers:i,projects:n}=Ke(),r=Di(),[s,a]=(0,De.useState)(""),[o,l]=(0,De.useState)([]),[c,u]=(0,De.useState)([]),[d,h]=(0,De.useState)([]),[f,p]=(0,De.useState)(!1),[_,y]=(0,De.useState)(!1),[m,v]=(0,De.useState)(null),[b,w]=(0,De.useState)(""),[k,M]=(0,De.useState)(!1),T=(0,De.useRef)(0),A=(0,De.useRef)(0),I=(0,De.useRef)(null),B=(0,De.useRef)(null),q=(0,De.useRef)(null),[H,P]=(0,De.useState)([]),[x,U]=(0,De.useState)(0),[C,D]=(0,De.useState)(0),R=(0,De.useRef)(!1),V=(0,De.useRef)(new Set),[z,L]=(0,De.useState)(!1),K=ju(),X=t.find(E=>E.id===e.currentThreadId),oe=i.find(E=>E.id===X?.provider),ge=r.status==="running"||r.status==="initializing",te=r.pending.length>0,We=oe?.capabilities.steer??!1,Ki=!!oe&&!oe.capabilities.images&&oe.capabilities.imagesKnown!==!1,oi=X?.mode??"default",yt=pM(X?.provider,oe?.capabilities.modes??[],oe?.capabilities.modeLabels),Hn=yt.find(E=>E.id===oi),Ht=r.items.some(E=>E.kind==="user")&&(ge||!!X?.providerSessionId||r.items.some(E=>E.kind==="assistant"||E.kind==="reasoning"||E.kind==="toolgroup"||E.kind==="permission")),Ne=(0,De.useMemo)(()=>TM(s,R.current),[s]),gn=(0,De.useMemo)(()=>NM(r.slashCommands,Ne.query),[r.slashCommands,Ne.query]),$t=(0,De.useMemo)(()=>AM(gn),[gn]),fe=(0,De.useMemo)(()=>MM($t),[$t]),li=Ne.open&&!te;(0,De.useEffect)(()=>{D(0)},[Ne.query,li]),(0,De.useEffect)(()=>{let E=X?.id;!li||!E||V.current.has(E)||(V.current.add(E),L(!0),Q.call("thread.commands",{id:E,load:!0},3e4).then(Z=>{let ue=Z.commands??[];(ue.length||!Di.getState().slashCommands.length)&&Di.setState({slashCommands:ue})}).catch(()=>{}).finally(()=>L(!1)))},[li,X?.id]);let se=(0,De.useMemo)(()=>i.filter(E=>E.enabled!==!1||E.id===X?.provider),[i,X?.provider]),Kt=se.find(E=>E.id===(m??X?.provider)),Ye=E=>E.enabled!==!1&&E.available&&E.status!=="planned",Fe=E=>{let Z=!!E?.force,ue=++T.current,Ce=0;Z&&(Ce=++A.current,M(!0));let $e={};return Z&&($e.refresh=!0),E?.provider&&($e.provider=E.provider),Q.call("providers.list",Object.keys($e).length?$e:void 0).then(St=>{ue===T.current&&Ke.setState({providers:St})}).catch(()=>{}).finally(()=>{Z&&Ce===A.current&&M(!1)})},Un=E=>{y(E),E&&(v(null),w(""),Fe({provider:Ht?X?.provider??null:null}))};(0,De.useEffect)(()=>{if(!_)return;let E=ue=>{I.current&&!I.current.contains(ue.target)&&Un(!1)},Z=ue=>{ue.key==="Escape"&&(ue.stopPropagation(),Un(!1))};return document.addEventListener("pointerdown",E,!0),window.addEventListener("keydown",Z,!0),()=>{document.removeEventListener("pointerdown",E,!0),window.removeEventListener("keydown",Z,!0)}},[_]);let Gt=async(E,Z)=>{if(X){Un(!1);try{!Ht&&E!==X.provider&&await Q.call("thread.setProvider",{id:X.id,provider:E}),await Q.call("thread.setModel",{id:X.id,model:Z})}catch(ue){Ee(g("composer.failSwitchAgent")+Ze(ue),!0)}}},ts=(0,De.useMemo)(()=>{let E=b.trim().toLowerCase();if(!E)return[];let Z=[];for(let ue of se)if(Ye(ue))for(let Ce of ue.models??[])(Ce.name.toLowerCase().includes(E)||Ce.id.toLowerCase().includes(E))&&Z.push({providerId:ue.id,providerName:ue.name,model:Ce});return Z.slice(0,100)},[b,se]),xr=!!(m&&!b.trim());(0,De.useEffect)(()=>{if(!ge)return;let E=Date.now(),Z=setInterval(()=>U(Math.floor((Date.now()-E)/1e3)),1e3);return()=>clearInterval(Z)},[ge]),(0,De.useEffect)(()=>{let E=B.current;if(!E)return;E.style.height="auto";let Z=parseFloat(getComputedStyle(E).lineHeight)||22;E.style.height=Math.min(E.scrollHeight,Math.round(12*Z))+"px"},[s]);let ie=(0,De.useCallback)(async(E="queue")=>{let Z=e.currentThreadId,ue=s.trim();if(!Z||!ue&&o.length===0&&c.length===0&&d.length===0)return;let Ce=HA(d,ue),$e=ge&&E==="steer"&&We,St=!ge||$e,Qt={attachments:o,mentions:c,quotes:d};ge&&E==="queue"&&P(_n=>[..._n,Ce]),a(""),l([]),u([]),h([]);let Er=n.find(_n=>_n.id===X?.projectId)?.path;try{let _n=await Di.getState().send(Z,{text:Ce,attachments:Qt.attachments.map(kt=>({path:kt.path,mime:kt.mime,name:kt.name})),...Qt.mentions.length?{mentions:cM(Qt.mentions)}:{},behavior:$e?"steer":"queue"},{attachments:Qt.attachments.map(kt=>({id:kt.path,name:kt.name.trim()||kt.path,mime:kt.mime})),...Er&&Qt.mentions.length?{mentions:Qt.mentions.map(kt=>({path:ac(Er,kt.rel),isDir:kt.isDir}))}:{}},{optimistic:St});_n?.delivered==="queued"&&ge?Ee(g("composer.queuedToast")):_n?.delivered==="steered"&&Ee(g("composer.steeredToast")),ge||P(kt=>[...kt.slice(-9),Ce])}catch(_n){St||(a(ue),l(Qt.attachments),u(Qt.mentions),h(Qt.quotes)),Ee(g("composer.failSend")+Ze(_n),!0)}},[s,o,c,d,e.currentThreadId,ge,We,n,X?.projectId]),de=E=>{if(Qn(E.nativeEvent))return;if(li&&fe.length>0){if(E.key==="ArrowDown"){E.preventDefault(),D(St=>$b(St+1,fe.length));return}if(E.key==="ArrowUp"){E.preventDefault(),D(St=>$b(St-1,fe.length));return}if(E.key==="Escape"){E.preventDefault(),R.current=!0,D(0);return}let Ce=fe[C]??fe[0],$e=E.key==="Enter"&&OM(s,Ce?.name);if((E.key==="Enter"&&!E.shiftKey||E.key==="Tab")&&!$e){E.preventDefault(),Ce&&(R.current=!1,a(Wb(Ce.name)));return}}let Z=E.ctrlKey||E.metaKey;if(K.sendKey==="ctrlEnter"?E.key==="Enter"&&Z:E.key==="Enter"&&!E.shiftKey&&!Z){E.preventDefault(),ge&&K.runningSend==="steer"&&We?ie("steer"):ie("queue");return}if(K.sendKey==="enter"&&E.key==="Enter"&&Z&&ge){E.preventDefault(),ie(We?"steer":"queue");return}E.key==="ArrowUp"&&s===""&&H.length>0&&(E.preventDefault(),a(H[H.length-1]))},ve=async E=>{let Z=E.clipboardData?.items;if(!Z)return;for(let Ce of Z)if(Ce.type.startsWith("image/")){E.preventDefault();let $e=Ce.getAsFile();$e&&await Me($e);return}let ue=E.clipboardData.getData("text/plain");if(ue&&ue.length>32*1024){E.preventDefault();let Ce=new File([ue],"paste.txt",{type:"text/plain"});await Me(Ce)}},Me=async E=>{let Z=rc(),ue={path:"",name:E.name,mime:E.type||"application/octet-stream",uploading:!0};l(Ce=>[...Ce,ue]);try{let $e=await(await fetch(`/api/upload?name=${encodeURIComponent(E.name)}`,{method:"POST",headers:{"x-agent-console":Z},body:E})).json();if(!$e.ok)throw new Error($e.e?.message??g("composer.uploadFailed"));l(St=>St.map(Qt=>Qt===ue?{...Qt,path:$e.id,name:$e.name??E.name,uploading:!1}:Qt))}catch(Ce){l($e=>$e.filter(St=>St!==ue)),Ee(g("composer.failUpload")+Ze(Ce),!0)}},rt=n.find(E=>E.id===X?.projectId)??null,Ii=E=>{if(E){if(!X||E.projectId!==X.projectId){Ee(g("mention.otherProject"),!0);return}u(Z=>Pb(Z,E)),B.current?.focus()}};(0,De.useEffect)(()=>{let E=Z=>Ii(Z.detail);return window.addEventListener("ac-insert-mention",E),()=>window.removeEventListener("ac-insert-mention",E)}),(0,De.useEffect)(()=>{let E=Z=>{let ue=Z.detail;if(!ue||typeof ue.text!="string")return;if(s.trim()||d.length>0||c.length>0||o.length>0){Ee(g("timeline.editBusy"),!0);return}let Ce=FA(ue.text);h(Ce.quotes),a(Ce.rest);let $e=rt?.path;if(X&&$e&&ue.mentions?.length){let St=[];for(let Qt of ue.mentions){let Er=mp($e,Qt.path);Er&&(St=Pb(St,{projectId:X.projectId,rel:Er,isDir:Qt.isDir}))}u(St)}requestAnimationFrame(()=>{let St=B.current;St&&(St.focus(),St.setSelectionRange(St.value.length,St.value.length))})};return window.addEventListener("ac-composer-fill",E),()=>window.removeEventListener("ac-composer-fill",E)}),(0,De.useEffect)(()=>{let E=Z=>{let ue=Z.detail;if(ue?.text){if(d.length>=10){Ee(_e("quote.full",{n:10}),!0);return}h(Ce=>hp(Ce,ue.text,ue.src)),B.current?.focus()}};return window.addEventListener("ac-add-quote",E),()=>window.removeEventListener("ac-add-quote",E)}),(0,De.useEffect)(()=>{u([]),h([])},[e.currentThreadId]);let Is=async E=>{if(E.preventDefault(),p(!1),E.dataTransfer.types.includes(sc)){Ii(lM(E.dataTransfer.getData(sc)));return}for(let Z of E.dataTransfer.files)(Z.type.startsWith("image/")||Z.type.startsWith("text/"))&&await Me(Z)},is=E=>{X&&Q.call("thread.setMode",{id:X.id,mode:E}).catch(Z=>Ee(Ze(Z),!0))},Mo=!!(yt.find(E=>E.id===oi)??yt[0])?.auto,zs=yt.some(E=>E.id==="default"&&!E.auto),Oo=E=>{X&&Q.call("thread.setEffort",{id:X.id,effort:E})},Ro=E=>{X&&Q.call("thread.setCursorOpts",{id:X.id,...E}).catch(Z=>Ee(Ze(Z),!0))},Do=X?.model?oe?.models?.find(E=>E.id===X.model):oe?.models?.find(E=>E.isDefault)??oe?.models?.[0],Lo=(Do?.thinkingOptions??[]).map(E=>{let Z=E,ue=typeof Z.id=="string"?Z.id:typeof Z.reasoningEffort=="string"?Z.reasoningEffort:null,Ce=Z.id,$e=ue??(Ce&&typeof Ce.reasoningEffort=="string"?Ce.reasoningEffort:null);return $e?{id:$e,label:typeof Z.label=="string"?Z.label:$e}:null}).filter(E=>E!==null),Io=typeof Do?.defaultThinking=="string"?Do.defaultThinking:null,hc=Lo.length>0,fc=(()=>{if(!X?.model){let ue=oe?.models?.find(Ce=>Ce.isDefault);return ue?ue.name:g("composer.defaultModel")}let Z=oe?.models?.find(ue=>ue.id===X.model)?.name??X.model;return X.cursorFast&&(Z+=" \xB7 Fast"),Z})();if(!e.currentThreadId)return null;let sr=PA(r.items);return(0,W.jsxs)("div",{className:`composer${te?" waiting":""}`,onDrop:Is,onDragOver:E=>{E.preventDefault();let Z=E.dataTransfer.types.includes(sc);Z&&(E.dataTransfer.dropEffect="copy"),Z!==f&&p(Z)},onDragLeave:E=>{E.currentTarget.contains(E.relatedTarget)||p(!1)},children:[sr&&(0,W.jsx)("div",{className:"cp-tasks",children:(0,W.jsxs)("button",{type:"button",className:"tasks-pill",title:g("timeline.tasksPillTitle"),onClick:()=>window.dispatchEvent(new CustomEvent("ac-show-item",{detail:{key:sr.key}})),children:[(0,W.jsx)(re,{name:"listChecks",size:12}),(0,W.jsx)("span",{children:_e("timeline.tasksPill",dp(sr.items))})]})}),r.queue.length>0&&(0,W.jsx)("div",{className:"q-list",children:r.queue.map(E=>(0,W.jsxs)("div",{className:"q-item",children:[(0,W.jsx)("span",{className:"q-text",children:E.text}),(0,W.jsx)("button",{className:"ibtn",title:g("common.remove"),onClick:()=>{Q.call("thread.queueRemove",{id:X?.id,queueId:E.id}).catch(()=>{})},children:(0,W.jsx)(re,{name:"x",size:12})})]},E.id))}),Mo&&(0,W.jsx)(kM,{providerId:X?.provider,onBack:zs?()=>is("default"):void 0}),(0,W.jsxs)("div",{className:`cp-card${te?" waiting":""}${Mo?" auto-on":""}${f?" drop-on":""}`,children:[f&&(0,W.jsx)("div",{className:"cp-drop-hint",children:g("mention.drop")}),Ki&&o.some(E=>E.mime.startsWith("image/"))&&(0,W.jsx)("div",{className:"att-note",children:_e("composer.imagesByPath",{agent:oe?.name??""})}),d.length>0&&(0,W.jsx)("div",{className:"att-bar q-bar",children:d.map(E=>(0,W.jsxs)("span",{className:"qchip",title:`${g("quote.chipTitle")} +`):e.output;return(0,O.jsxs)("div",{className:"ts-out",children:[a&&(0,O.jsx)("button",{className:"ts-more",onClick:()=>i(!0),children:_e("timeline.showAllLines",{n:s.length})}),(0,O.jsx)("pre",{onClick:Kf,children:(0,O.jsx)(D6,{text:o})})]})}return e.input!=null?(0,O.jsx)("pre",{className:"ts-out",children:JSON.stringify(e.input,null,2).slice(0,4e3)}):null}function xp({hunks:e,path:t,max:i=3e3}){let n=0,r=!1;return(0,O.jsxs)("div",{className:"diff",children:[t&&(0,O.jsx)("div",{className:"diff-path",children:t}),(0,O.jsx)("pre",{className:"diff-pre",children:e.map((s,a)=>(0,O.jsxs)("span",{className:"dh",children:[(0,O.jsx)("span",{className:"dh-head",children:s.head??"@@"}),s.lines.map((o,l)=>(n++,n>i?(r=!0,null):(0,O.jsxs)("span",{className:`dl ${o.t==="+"?"add":o.t==="-"?"del":""}`,children:[o.t," ",o.text,` +`]},l)))]},a))}),r&&(0,O.jsx)("div",{className:"dlg-hint",children:_e("timeline.diffClip",{n:i})})]})}function j6({it:e}){return(0,O.jsx)("div",{className:"card plan",children:(0,O.jsx)(Ab,{text:e.markdown})})}function Y6({it:e}){let{done:t,total:i}=yp(e.items);return(0,O.jsxs)("div",{className:"ck","data-todo-key":e.key,children:[(0,O.jsxs)("div",{className:"ck-head",children:[(0,O.jsx)(ne,{name:"listChecks",size:13}),(0,O.jsxs)("span",{className:"ck-n",children:[t,"/",i]}),(0,O.jsx)("span",{className:"ck-l",children:g("timeline.tasks")})]}),(0,O.jsx)("ul",{className:"ck-list",children:e.items.map((n,r)=>{let s=n.status==="done"||n.status==="completed"?"done":n.status==="in_progress"?"doing":"todo";return(0,O.jsxs)("li",{className:`ck-i ${s}`,children:[(0,O.jsx)("span",{className:"ck-box","aria-hidden":!0,children:s==="done"?(0,O.jsx)(ne,{name:"check",size:12}):s==="doing"?(0,O.jsx)("span",{className:"spin"}):(0,O.jsx)(ne,{name:"circle",size:12})}),(0,O.jsx)("span",{className:"ck-t",children:n.text})]},r)})})]})}function V6({it:e,threadId:t}){let[i,n]=(0,zt.useState)(!1),r=l=>{n(!0),Z.call("thread.respond",{id:t,requestId:e.requestId,optionId:l}).catch(()=>n(!1))},s=e.detail,a=s?.hunks??s?.diff?.hunks,o=e.status==="resolved"?e.auto?g("timeline.permAutoAllowed"):e.choice==="allow_always"||e.choice==="acceptForSession"?g("timeline.permAllowSession"):e.choice==="deny"||e.choice==="reject"||e.choice==="decline"?g("timeline.permDenied"):e.choice==="implement"?g("timeline.permAllowed"):g("timeline.permAllowed"):g("timeline.permCancelled");return(0,O.jsxs)("div",{className:`card perm${e.status!=="pending"?" done":""}`,children:[(0,O.jsx)("div",{className:"perm-title",children:e.title}),s?.command&&(0,O.jsx)("pre",{className:"perm-cmd",children:s.command}),s?.path&&(0,O.jsx)("div",{className:"perm-path",children:s.path}),a&&(0,O.jsx)(xp,{hunks:a,path:s?.diff?.path??s?.path,max:200}),e.status==="pending"?(0,O.jsx)("div",{className:"perm-btns",children:e.options.map(l=>(0,O.jsx)("button",{className:`btn ${l.kind==="allow_once"?"primary":l.kind==="reject_once"?"danger":""}`,disabled:i,onClick:()=>r(l.id),children:l.label},l.id))}):(0,O.jsx)("div",{className:"perm-done",children:o})]})}function X6({it:e,threadId:t}){let[i,n]=(0,zt.useState)({}),[r,s]=(0,zt.useState)({}),a=e.questions,o=(c,u)=>c.id??c.question??c.header??`q${u}`,l=()=>{let c={};a.forEach((u,d)=>{c[o(u,d)]=i[d]?.trim()||r[d]||""}),Z.call("thread.respond",{id:t,requestId:e.requestId,answers:c})};return(0,O.jsxs)("div",{className:`card ask${e.status!=="pending"?" done":""}`,children:[a.map((c,u)=>(0,O.jsxs)("div",{className:"ask-q",children:[(0,O.jsx)("div",{className:"ask-t",children:c.header??c.question}),e.status==="pending"?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("div",{className:"ask-opts",children:c.options?.map(d=>(0,O.jsx)("button",{className:`btn${r[u]===d.label?" primary":""}`,onClick:()=>s(h=>({...h,[u]:d.label})),children:d.label},d.label))}),(0,O.jsx)("input",{className:"tinput ask-free",placeholder:g("common.other"),value:i[u]??"",onChange:d=>n(h=>({...h,[u]:d.target.value}))})]}):(0,O.jsx)("div",{className:"perm-done",children:e.answers?_e("timeline.submitted",{ans:Object.values(e.answers).join("\u3001")}):g("timeline.permCancelled")})]},u)),e.status==="pending"&&(0,O.jsx)("button",{className:"btn primary",onClick:l,children:g("common.submit")})]})}function Z6({it:e,onRetry:t,replyText:i}){let n=he(),[r,s]=(0,zt.useState)(!1),[a,o]=yM(),l=J6(e.model,e.model!==void 0);if(e.status==="failed")return(0,O.jsxs)("div",{className:"card err-card",children:[(0,O.jsx)("div",{className:"err-line",children:_e("timeline.turnError",{err:Ar(e.error??g("timeline.unknownError"))})}),(0,O.jsxs)("div",{className:"perm-btns",children:[t&&(0,O.jsx)("button",{className:"btn",onClick:t,children:g("common.retry")}),e.error&&e.error.length>60&&(0,O.jsx)("button",{className:"btn ghost",onClick:()=>s(!r),children:g("common.details")})]}),r&&(0,O.jsx)("pre",{className:"perm-cmd",children:Ar(e.error??"")})]});let c=[];if(e.usage){let u=e.usage.inputTokens+e.usage.outputTokens;u&&c.push(`${Gl(u)} tokens`),e.usage.costUsd&&c.push(qf(e.usage.costUsd))}return(0,O.jsxs)("div",{className:"te",children:[i&&(0,O.jsxs)("button",{type:"button",className:`te-act te-copy${a?" done":""}`,title:a?g("common.copied"):g("common.copy"),"aria-label":a?g("common.copied"):g("common.copy"),onClick:()=>o(i),children:[(0,O.jsx)(ne,{name:a?"check":"copy",size:13}),(0,O.jsx)("span",{children:a?g("common.copied"):g("common.copy")})]}),l&&(0,O.jsxs)("span",{className:"te-m",title:l,children:[(0,O.jsx)(ne,{name:"cpu",size:12}),(0,O.jsx)("span",{children:l})]}),e.ts!=null&&(0,O.jsxs)("span",{className:"te-m",title:new Date(e.ts).toLocaleString(),children:[(0,O.jsx)(ne,{name:"clock",size:12}),(0,O.jsx)("span",{children:Q6(e.ts)})]}),e.durationMs!=null&&(0,O.jsxs)("span",{className:"te-m",children:[(0,O.jsx)(ne,{name:"hourglass",size:12}),(0,O.jsx)("span",{children:Pv(e.durationMs)})]}),c.length>0&&(0,O.jsx)("span",{className:"te-m te-u",children:c.join(" \xB7 ")}),e.status==="interrupted"&&(0,O.jsx)("span",{className:"te-m",children:g("timeline.interrupted")}),t&&(0,O.jsx)("button",{type:"button",className:"te-act",title:g("timeline.retryHint"),"aria-label":g("timeline.retryHint"),onClick:t,children:(0,O.jsx)(ne,{name:"refresh",size:13})}),e.filesChanged!=null&&e.filesChanged>0&&(0,O.jsx)("button",{className:"te-files",onClick:()=>n.openPanel("changes"),children:_e("timeline.filesChanged",{n:e.filesChanged})})]})}function Q6(e){let t=new Date(e),i=r=>String(r).padStart(2,"0"),n=`${i(t.getHours())}:${i(t.getMinutes())}`;return t.toDateString()===new Date().toDateString()?n:`${t.getMonth()+1}/${t.getDate()} ${n}`}function J6(e,t){let i=he(o=>o.currentThreadId),n=Ge(o=>o.threads),r=Ge(o=>o.providers);if(!t)return null;let s=n.find(o=>o.id===i),a=r.find(o=>o.id===s?.provider)?.models??[];return e?a.find(o=>o.id===e)?.name??e:a.find(o=>o.isDefault)?.name??null}function SM({it:e,threadId:t,onEditResend:i,onRetryLast:n,replyText:r}){switch(e.kind){case"user":return(0,O.jsx)(I6,{it:e,onRetry:i});case"assistant":return(0,O.jsx)("div",{className:"as",children:(0,O.jsx)(z6,{it:e})});case"reasoning":return(0,O.jsx)(B6,{it:e});case"toolgroup":return(0,O.jsx)($6,{it:e});case"plan":return(0,O.jsx)(j6,{it:e});case"todo":return(0,O.jsx)(Y6,{it:e});case"permission":return(0,O.jsx)(V6,{it:e,threadId:t});case"autoperm":return(0,O.jsx)(dM,{it:e});case"question":return(0,O.jsx)(X6,{it:e,threadId:t});case"notice":return e.code==="bash_missing"?(0,O.jsx)(P6,{it:e}):e.code&&hM.has(e.code)?(0,O.jsx)(fM,{it:e,threadId:t}):(0,O.jsx)("div",{className:`nt ${e.level}`,children:Ar(e.message)});case"turnend":return(0,O.jsx)(Z6,{it:e,onRetry:n,replyText:r});case"gone":return null;default:return null}}var zt,O,jb,vM,L6,Gb,H6,U6,ed=te(()=>{zt=ie(bt(),1);Lu();jA();Rn();qi();vp();VA();Ju();On();Ff();en();kt();Wf();Du();wp();Co();pM();O=ie(ye(),1),jb="https://git-scm.com/download/win",vM=()=>cc();L6=e=>e.replace(/[\\/]+$/,"").split(/[\\/]/).pop()||e,Gb=e=>!e||e.startsWith("image/");H6={edit:"pencil",write:"pencil",bash:"prompt",read:"fileText",search:"search",glob:"search",web:"globe",task:"layers",mcp:"wrench",todo:"listChecks"},U6=new Set(["edit","write","bash","read","search","glob"])});function xM(e,t,i){let n=t.scrollTop{wM=()=>({stick:!0,lastTop:0,intentAt:-1/0,pointerDown:!1}),eP=e=>e.scrollHeight-e.scrollTop-e.clientHeight;EM=new Set(["ArrowUp","PageUp","Home"])});function dc(e,t){let i=/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith("\\\\"),n=i?"\\":"/",r=t==="."?"":i?t.replace(/\//g,"\\"):t;return r?e.replace(/[\\/]+$/,"")+n+r:e}function CM(e){if(!e||e.length>1e4)return null;try{let t=JSON.parse(e);return typeof t.projectId!="string"||typeof t.rel!="string"||!t.rel||t.rel.length>4096?null:{projectId:t.projectId,rel:t.rel,isDir:t.isDir===!0}}catch{return null}}function Vb(e,t){return e.some(i=>i.projectId===t.projectId&&i.rel===t.rel)||e.length>=50?e:[...e,t]}function TM(e){return e.map(t=>({rel:t.rel,isDir:t.isDir}))}function Ep(e,t){let i=o=>o.replace(/\\/g,"/").replace(/\/+$/,""),n=i(e),r=i(t),s=/^[a-zA-Z]:\//.test(n),a=(o,l)=>s?o.toLowerCase()===l.toLowerCase():o===l;return a(r,n)?".":r.length>n.length&&a(r.slice(0,n.length),n)&&r[n.length]==="/"?r.slice(n.length+1):null}var uc,kp=te(()=>{uc="application/x-agent-console-path"});function gn({value:e,options:t,onChange:i,ariaLabel:n,title:r,className:s,children:a,prefer:o="down",matchWidth:l=!1,menuClassName:c,upAnchor:u}){let[d,h]=(0,Ii.useState)(!1),[f,p]=(0,Ii.useState)(-1),[_,y]=(0,Ii.useState)(null),m=(0,Ii.useRef)(null),v=(0,Ii.useRef)(null),b=(0,Ii.useId)(),w=t.find(H=>H.value===e),k=H=>H>=0&&H{for(let x=1;x<=t.length;x++){let U=(H+P*x+t.length*2)%t.length;if(!t[U].disabled)return U}return H},[t]),T=H=>{let P=t.findIndex(U=>U.value===e),x=H==="first"?M(-1,1):H==="last"?M(0,-1):P;k(x)||(x=M(-1,1)),p(x),y(null),h(!0)},A=H=>{h(!1),H&&m.current?.focus()},L=H=>{k(H)&&(A(!0),t[H].value!==e&&i(t[H].value))};(0,Ii.useLayoutEffect)(()=>{if(!d)return;let H=m.current?.getBoundingClientRect(),P=v.current;if(!H||!P)return;let x=window.innerWidth,U=window.innerHeight,C=l?H.width:0;P.style.minWidth=`${C}px`;let D=P.offsetWidth,R=P.scrollHeight,Y=U-H.bottom-Cp-td,z=u&&m.current?.closest(u)?.getBoundingClientRect().top||H.top,I=z-Cp-td,j=o==="up"?!(II):YY,ve=j?I:Y,de=Math.min(R,ve),Ae=j?z-Cp-de:H.bottom+Cp,re=Math.max(td,Math.min(H.left,x-D-td));y({left:re,top:Math.max(td,Ae),minWidth:C,maxHeight:Math.max(80,ve)})},[d,o,l,t.length,u]),(0,Ii.useEffect)(()=>{d&&_&&v.current?.focus({preventScroll:!0})},[d,_]),(0,Ii.useEffect)(()=>{!d||f<0||v.current?.querySelector(`[data-i="${f}"]`)?.scrollIntoView({block:"nearest"})},[d,f]),(0,Ii.useEffect)(()=>{if(!d)return;let H=x=>{let U=x.target;v.current?.contains(U)||m.current?.contains(U)||A(!1)},P=()=>A(!1);return window.addEventListener("pointerdown",H,!0),window.addEventListener("resize",P),window.addEventListener("blur",P),()=>{window.removeEventListener("pointerdown",H,!0),window.removeEventListener("resize",P),window.removeEventListener("blur",P)}},[d]);let B=H=>{(H.key==="ArrowDown"||H.key==="ArrowUp"||H.key==="Enter"||H.key===" ")&&(H.preventDefault(),d?A(!1):T(H.key==="ArrowUp"?"last":void 0))},q=H=>{let P=H.key;if(P==="ArrowDown")p(x=>M(x<0?-1:x,1));else if(P==="ArrowUp")p(x=>M(x<0?0:x,-1));else if(P==="Home")p(M(-1,1));else if(P==="End")p(M(0,-1));else if(P==="Enter"||P===" ")L(f);else if(P==="Escape")A(!0);else if(P==="Tab"){A(!0);return}else if(P.length===1&&/\S/.test(P)){let x=P.toLowerCase();for(let U=1;U<=t.length;U++){let C=(Math.max(f,0)+U)%t.length;if(!t[C].disabled&&t[C].label.toLowerCase().startsWith(x)){p(C);break}}}else return;H.preventDefault(),H.stopPropagation()};return(0,$i.jsxs)($i.Fragment,{children:[(0,$i.jsx)("button",{ref:m,type:"button",className:s,title:r,"aria-label":n,"aria-haspopup":"listbox","aria-expanded":d,"aria-controls":d?`${b}-lb`:void 0,onClick:()=>d?A(!1):T(),onKeyDown:B,children:a??(0,$i.jsx)("span",{className:"sm-val",children:w?.label??""})}),d&&(0,NM.createPortal)((0,$i.jsx)("div",{ref:v,id:`${b}-lb`,className:`menu select-menu${c?` ${c}`:""}`,role:"listbox","aria-label":n,"aria-activedescendant":f>=0?`${b}-o${f}`:void 0,tabIndex:-1,"data-select-menu":"",style:_?{left:_.left,top:_.top,minWidth:_.minWidth,maxHeight:_.maxHeight}:{left:-9999,top:0,visibility:"hidden"},onKeyDown:q,children:t.map((H,P)=>(0,$i.jsxs)("div",{id:`${b}-o${P}`,"data-i":P,role:"option","aria-selected":H.value===e,"aria-disabled":H.disabled||void 0,className:`mi sm-opt${P===f?" on":""}${H.disabled?" off":""}${H.danger?" danger":""}${H.warn?" warn":""}${H.hint?" has-hint":""}`,onPointerMove:()=>{!H.disabled&&f!==P&&p(P)},onClick:()=>L(P),children:[(0,$i.jsxs)("span",{className:"sm-text",children:[(0,$i.jsxs)("span",{className:"sm-label",children:[H.icon&&(0,$i.jsx)(ne,{name:H.icon,size:13}),H.label]}),H.hint&&(0,$i.jsx)("span",{className:"sm-hint",children:H.hint})]}),(0,$i.jsx)("span",{className:"sm-check","aria-hidden":"true",children:H.value===e?(0,$i.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",children:(0,$i.jsx)("path",{d:"M2.5 6.2 5 8.6l4.5-5",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}):null})]},H.value))}),document.body)]})}var Ii,NM,$i,Cp,td,Tp=te(()=>{Rn();Ii=ie(bt(),1),NM=ie(Ks(),1),$i=ie(ye(),1),Cp=4,td=8});function MM(e){return g(`composer.autoDesc.${e&&AM.has(e)?e:"generic"}`)}function OM(e){let t=MM(e);return!e||!AM.has(e)||tP.has(e)?`${t} +${g("composer.autoOn.keeps")}`:t}function Xb(){return[{id:"plan",label:g("composer.mode.plan.label"),desc:g("composer.mode.plan.desc")},{id:"default",label:g("composer.mode.default.label"),desc:g("composer.mode.default.desc")},{id:"acceptEdits",label:g("composer.mode.acceptEdits.label"),desc:g("composer.mode.acceptEdits.desc")},{id:"bypassPermissions",label:g("composer.mode.bypass.label"),desc:g("composer.mode.bypass.desc"),auto:!0}]}function nP(){return[{id:"default",label:g("composer.mode.cursorAgent.label"),desc:g("composer.mode.cursorAgent.desc")},{id:"bypassPermissions",label:g("composer.mode.cursorBypass.label"),desc:g("composer.mode.cursorBypass.desc"),auto:!0},{id:"plan",label:g("composer.mode.cursorPlan.label"),desc:g("composer.mode.cursorPlan.desc")},{id:"ask",label:g("composer.mode.cursorAsk.label"),desc:g("composer.mode.cursorAsk.desc")}]}function RM(e,t,i){return(e==="cursor"?nP():Xb()).filter(r=>t.includes(r.id)).map(r=>e==="pi"&&r.id==="default"?{...r,label:g("composer.mode.pi.label"),desc:g("composer.mode.pi.desc"),auto:!0}:r.id===iP?{...r,desc:MM(e)}:i?.[r.id]?{...r,label:rP(i[r.id])}:r)}function rP(e){let t=g(`composer.agentMode.${e}`);return t.startsWith("composer.agentMode.")?e:t}function Np(e,t){let i=g(`composer.effort.${e}`);return i.startsWith("composer.effort.")?t??e:i}var AM,tP,iP,Ap=te(()=>{kt();AM=new Set(["claude","codex","copilot","devin","cursor","opencode","pi"]),tP=new Set(["cursor","opencode","dsh"]);iP="bypassPermissions"});function DM({value:e,save:t}){let[i,n]=(0,To.useState)(null),[r,s]=(0,To.useState)(null),[a,o]=(0,To.useState)(null),[l,c]=(0,To.useState)(!1),u=()=>Z.call("shell.status").then(y=>n(y)).catch(()=>{});if((0,To.useEffect)(()=>{u()},[]),!i)return null;if(i.platform!=="win32")return(0,tn.jsx)("div",{className:"dlg-hint",children:g("settings.bashNotWindows")});let d=r??e,h=async()=>{try{return await Z.call("shell.check",{path:d.trim()})}catch(y){return o({ok:!1,text:Ze(y)}),null}},f=async()=>{if(!d.trim()){o(null);return}c(!0);let y=await h();c(!1),y&&o(y.ok?{ok:!0,text:_e("settings.bashOk",{path:y.path})}:{ok:!1,text:Zb(y.reason)})},p=async()=>{if(r===null||r.trim()===e){s(null);return}let y="";if(r.trim()){let v=await h();if(!v)return;if(!v.ok){o({ok:!1,text:Zb(v.reason)});return}y=v.path}c(!0);let m=await t(y);c(!1),m&&(s(null),o(null),await u())},_=i.found?g(`settings.bashSrc.${i.found.source}`):"";return(0,tn.jsxs)("div",{className:"bash-set",children:[(0,tn.jsxs)("div",{className:"bash-row",children:[(0,tn.jsx)("input",{className:`tinput${a&&!a.ok?" err":""}`,spellCheck:!1,"aria-label":g("settings.bashPath"),placeholder:"E:\\Git\\bin\\bash.exe",value:d,onChange:y=>{s(y.target.value),o(null)},onBlur:()=>{p()},onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),p())}}),(0,tn.jsx)("button",{type:"button",className:"btn",disabled:l||!d.trim(),onMouseDown:y=>y.preventDefault(),onClick:()=>{f()},children:g("settings.bashCheck")})]}),a&&(0,tn.jsx)("div",{className:`dlg-hint${a.ok?"":" err"}`,children:a.text}),!a&&i.manualError&&(0,tn.jsx)("div",{className:"dlg-hint err",children:_e("settings.bashManualBad",{why:Zb(i.manualError)})}),(0,tn.jsx)("div",{className:"dlg-hint",children:i.found?_e("settings.bashUsing",{path:i.found.path,src:_}):(0,tn.jsxs)(tn.Fragment,{children:[g("settings.bashNone")," ",(0,tn.jsx)("button",{type:"button",className:"te-files",onClick:()=>{ks(jb)},children:g("timeline.bashDownload")})]})}),(0,tn.jsx)("div",{className:"dlg-hint",children:g("settings.bashHint")})]})}var To,tn,Zb,LM=te(()=>{To=ie(bt(),1);qi();kt();Du();ed();tn=ie(ye(),1),Zb=e=>{let t=`settings.bashBad.${e}`,i=g(t);return i===t?e:i}});function Qb(e){let t=e.trim();if(t){try{let i=JSON.parse(t);if(Array.isArray(i)&&i.every(n=>typeof n=="string"))return i}catch{}return null}}function Jb(e){let t=e.trim();if(!/^\d+$/.test(t))return null;let i=Number(t);return i>=5&&i<=240?i:null}var IM=te(()=>{});function zM(e){return!(e.enabled===!1||!e.available||e.status==="planned")}function oP(e){return e.status==="verified"?g("settings.providerVerified"):e.status==="experimental"?g("settings.providerExperimental"):e.status==="planned"?g("settings.providerPlanned"):g("settings.providerPending")}function BM(){Z.call("providers.list").then(e=>{Ge.setState({providers:e})}).catch(()=>{})}function HM({onClose:e,providers:t}){let[i,n]=(0,zn.useState)(null),[r,s]=(0,zn.useState)({}),[a,o]=(0,zn.useState)(null),[l,c]=(0,zn.useState)({}),[u,d]=(0,zn.useState)({}),[h,f]=(0,zn.useState)({}),[p,_]=(0,zn.useState)({}),[y,m]=(0,zn.useState)(null),v=Xb();(0,zn.useEffect)(()=>{Z.call("settings.get").then(x=>n(x)),Z.call("app.info").then(x=>s(x)).catch(()=>{})},[]);let b=async x=>{let U=i,C={...i,...x};n(C),x.theme&&Kr(x.theme);let D=x.contentWidth!==void 0||x.chatFontSize!==void 0;D&&Nu(C);try{return await Z.call("settings.set",{patch:x}),window.dispatchEvent(new CustomEvent("settings-changed",{detail:C})),!0}catch(R){return n(U),x.theme&&Kr(U?.theme),D&&Nu(U??{}),ke(g("settings.failSave")+Ze(R),!0),!1}},w=async(x,U)=>{c(Y=>({...Y,[x]:U}));let C=i?.providerEnabled??{},D=i,R={...i,providerEnabled:{...C,[x]:U}};n(R);try{await Z.call("settings.set",{patch:{providerEnabled:R.providerEnabled}}),window.dispatchEvent(new CustomEvent("settings-changed",{detail:R})),U||Ge.setState(Y=>({providers:Y.providers.map(z=>z.id===x?{...z,enabled:!1}:z)})),BM()}catch(Y){n(D),ke(g("settings.providerToggleFailed")+Ze(Y),!0)}finally{c(Y=>{let z={...Y};return delete z[x],z})}},k=()=>{Z.call("providers.list",{refresh:!0}).then(x=>{Ge.setState({providers:x}),ke(g("settings.providerRedetect")+" \u2713")}).catch(x=>ke(Ze(x),!0))},M=async(x,U)=>{let C={...i?.providerCommand??{}},D={...C[x],...U};D.executable||delete D.executable,(!D.args||D.args.length===0)&&delete D.args,JSON.stringify(C[x]??{})!==JSON.stringify(D)&&(C[x]=D,await b({providerCommand:C})&&BM())},T=x=>{let U=u[x];U!==void 0&&(M(x,{executable:U.trim()||void 0}),d(C=>{let D={...C};return delete D[x],D}))},A=x=>{let U=h[x];if(U===void 0)return;let C=Qb(U);if(C===null){_(D=>({...D,[x]:!0}));return}_(D=>({...D,[x]:!1})),M(x,{args:C}),f(D=>{let R={...D};return delete R[x],R})},L=()=>{if(y===null)return;let x=Jb(y);x!==null&&(m(null),x!==i?.idleCloseMinutes&&b({idleCloseMinutes:x}))},B=(x,U)=>{if(!U)return{dot:"off",text:g("settings.providerOff")};if(x.enabled===!1)return{dot:"pending",text:g("settings.providerPending")};if(!x.available)return{dot:"off",text:x.reason??g("common.notDetected")};let C=x.models?.length??0,D=oP(x),R=C>0?` \xB7 ${_e("settings.providerModels",{n:String(C)})}`:"";return{dot:x.status==="verified"?"on":"pending",text:D+R}};if(!i)return(0,Se.jsx)(jr,{title:g("settings.title"),onClose:e,children:(0,Se.jsx)("div",{className:"dlg-hint",children:g("common.loading")})});let q=(x,U,C)=>(0,Se.jsxs)("div",{className:"dlg-row",children:[(0,Se.jsx)("label",{children:x}),U,C&&(0,Se.jsx)("div",{className:"dlg-hint",style:{marginTop:4},children:C})]}),H=y!==null&&Jb(y)===null,P=x=>U=>{U.key==="Enter"&&(U.preventDefault(),x())};return(0,Se.jsxs)(jr,{title:g("settings.title"),onClose:e,wide:!0,footer:(0,Se.jsx)("button",{className:"btn primary",onClick:e,children:g("common.done")}),children:[q(g("settings.defaultAgent"),(0,Se.jsx)(gn,{className:"tinput sm-field",matchWidth:!0,ariaLabel:g("settings.defaultAgent"),value:i.defaultProvider??"claude",onChange:x=>{b({defaultProvider:x})},options:t.map(x=>({value:x.id,label:x.name+(zM(x)?"":g("common.notInstalled")),disabled:!zM(x)}))})),(0,Se.jsxs)("div",{className:"dlg-row dlg-row-top",children:[(0,Se.jsx)("label",{children:g("settings.providers")}),(0,Se.jsxs)("div",{className:"provider-list",children:[(0,Se.jsx)("button",{type:"button",className:"btn sm provider-redetect",onClick:k,children:g("settings.providerRedetect")}),t.map(x=>{let U=l[x.id]??i.providerEnabled?.[x.id]??x.enabled!==!1,C=B(x,U),D=a===x.id,R=i.providerCommand?.[x.id],Y=h[x.id]??(R?.args?.length?JSON.stringify(R.args):"");return(0,Se.jsxs)("div",{className:`provider-row${D?" open":""}`,children:[(0,Se.jsxs)("button",{type:"button",className:"provider-head",onClick:()=>o(D?null:x.id),children:[(0,Se.jsx)("span",{className:`provider-dot provider-dot-${C.dot}`,"aria-hidden":!0}),(0,Se.jsxs)("div",{className:"provider-meta",children:[(0,Se.jsx)("span",{className:"provider-name",children:x.name}),(0,Se.jsx)("span",{className:"dlg-hint",children:C.text})]}),(0,Se.jsx)("span",{className:"mi-caret",children:D?"\u25BE":"\u25B8"})]}),(0,Se.jsx)("label",{className:"provider-switch",title:x.name,children:(0,Se.jsx)("input",{type:"checkbox",checked:U,disabled:l[x.id]!==void 0,onChange:z=>{w(x.id,z.target.checked)}})}),D&&(0,Se.jsxs)("div",{className:"provider-detail",children:[x.bin&&(0,Se.jsxs)("div",{className:"dlg-hint",children:[x.bin,x.version?` \xB7 ${x.version}`:""]}),x.installHint&&(0,Se.jsxs)("div",{className:"provider-hint-row",children:[(0,Se.jsx)("code",{className:"dlg-hint",children:x.installHint}),(0,Se.jsx)("button",{type:"button",className:"te-files",onClick:()=>{navigator.clipboard?.writeText(x.installHint??"").then(()=>ke(g("common.copied")))},children:g("settings.providerCopyHint")})]}),(0,Se.jsx)("div",{className:"dlg-hint",children:g("settings.providerLaunchCmd")}),(0,Se.jsx)("input",{className:"tinput",placeholder:g("settings.providerLaunchExe"),"aria-label":g("settings.providerLaunchExe"),value:u[x.id]??R?.executable??"",onChange:z=>{let I=z.target.value;d(j=>({...j,[x.id]:I}))},onBlur:()=>T(x.id),onKeyDown:P(()=>T(x.id))}),(0,Se.jsx)("input",{className:`tinput${p[x.id]?" err":""}`,placeholder:'["--foo"]',"aria-label":g("settings.providerLaunchArgs"),value:Y,onChange:z=>{let I=z.target.value;f(j=>({...j,[x.id]:I})),p[x.id]&&_(j=>({...j,[x.id]:Qb(I)===null}))},onBlur:()=>A(x.id),onKeyDown:P(()=>A(x.id))}),(0,Se.jsx)("div",{className:`dlg-hint${p[x.id]?" err":""}`,children:p[x.id]?g("settings.providerArgsInvalid"):g("settings.providerLaunchArgsHint")})]})]},x.id)})]})]}),q(g("settings.defaultMode"),(0,Se.jsx)(gn,{className:"tinput sm-field",matchWidth:!0,ariaLabel:g("settings.defaultMode"),value:i.defaultMode??"default",onChange:x=>{b({defaultMode:x})},options:v.map(x=>({value:x.id,label:x.label,hint:x.desc,icon:x.auto?"shieldCheck":void 0})),children:(0,Se.jsx)("span",{className:"sm-val",children:(()=>{let x=v.find(U=>U.id===(i.defaultMode??"default"));return x?`${x.label} \u2014 ${x.desc}`:""})()})}),i.defaultMode==="bypassPermissions"?`${g("settings.defaultModeHint")} ${g("composer.autoWarn")}`:g("settings.defaultModeHint")),q(g("settings.theme"),(0,Se.jsx)(gn,{className:"tinput sm-field",matchWidth:!0,ariaLabel:g("settings.theme"),value:Av(i.theme),onChange:x=>{b({theme:x})},options:[{value:"auto",label:wk()?g("settings.themeMagpie"):g("settings.themeAuto")},{value:"light",label:g("settings.themeLight")},{value:"dark",label:g("settings.themeDark")}]})),q(g("settings.contentWidth"),(0,Se.jsx)(gn,{className:"tinput sm-field",matchWidth:!0,ariaLabel:g("settings.contentWidth"),value:Df(i.contentWidth),onChange:x=>{b({contentWidth:x})},options:[{value:"narrow",label:g("settings.widthNarrow")},{value:"default",label:g("settings.widthDefault")},{value:"wide",label:g("settings.widthWide")},{value:"full",label:g("settings.widthFull")}]})),q(g("settings.chatFont"),(0,Se.jsx)(gn,{className:"tinput sm-field",matchWidth:!0,ariaLabel:g("settings.chatFont"),value:String(Rv(i.chatFontSize)),onChange:x=>{b({chatFontSize:Number(x)})},options:Array.from({length:Mv-Rf+1},(x,U)=>Rf+U).map(x=>({value:String(x),label:`${x} px${x===Ov?g("settings.chatFontDefault"):""}`}))}),g("settings.chatFontHint")),q(g("settings.sendKey"),(0,Se.jsx)(gn,{className:"tinput sm-field",matchWidth:!0,ariaLabel:g("settings.sendKey"),value:i.sendKey??"enter",onChange:x=>{b({sendKey:x})},options:[{value:"enter",label:g("settings.sendEnter")},{value:"ctrlEnter",label:g("settings.sendCtrl")}]})),q(g("settings.runningSend"),(0,Se.jsx)(gn,{className:"tinput sm-field",matchWidth:!0,ariaLabel:g("settings.runningSend"),value:i.runningSend??"queue",onChange:x=>{b({runningSend:x})},options:[{value:"queue",label:g("settings.queue")},{value:"steer",label:g("settings.steer")}]}),g("settings.steerHint")),q(g("settings.thinking"),(0,Se.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"center",fontSize:"var(--fs-m)",color:"var(--fg)"},children:[(0,Se.jsx)("input",{type:"checkbox",checked:i.showThinking!==!1,onChange:x=>{b({showThinking:x.target.checked})}}),g("settings.showThinking")]})),q(g("settings.idleClose"),(0,Se.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,Se.jsx)("input",{className:`tinput${H?" err":""}`,type:"number",min:5,max:240,step:1,style:{width:90,flex:"none"},"aria-label":g("settings.idleClose"),value:y??String(i.idleCloseMinutes??30),onChange:x=>m(x.target.value),onBlur:L,onKeyDown:P(L)}),(0,Se.jsx)("span",{className:"dlg-hint",children:g("settings.idleMinutes")})]}),H?g("settings.idleInvalid"):void 0),q(g("settings.bashPath"),(0,Se.jsx)(DM,{value:i.bashPath??"",save:x=>b({bashPath:x})})),(0,Se.jsx)("div",{className:"msep"}),(0,Se.jsxs)("div",{className:"dlg-hint",children:[_e("settings.versionLine",{ver:r.version??"?",pid:r.pid??"?"}),(0,Se.jsx)("br",{}),g("settings.dataDir"),r.dataDir??"?"," ",(0,Se.jsx)("button",{className:"te-files",onClick:()=>{navigator.clipboard?.writeText(r.dataDir??"").catch(()=>{})},children:g("common.copy")})]})]})}function PM(e){return{sendKey:e?.sendKey==="ctrlEnter"?"ctrlEnter":"enter",runningSend:e?.runningSend==="steer"?"steer":"queue",showThinking:e?.showThinking!==!1}}function id(){let[e,t]=(0,zn.useState)(lP);return(0,zn.useEffect)(()=>{Z.call("settings.get").then(n=>t(PM(n))).catch(()=>{});let i=n=>t(PM(n.detail));return window.addEventListener("settings-changed",i),()=>window.removeEventListener("settings-changed",i)},[]),e}var zn,Se,lP,Mp=te(()=>{zn=ie(bt(),1);Yl();Tp();qi();_r();Ap();kt();LM();On();IM();Tu();Dv();Se=ie(ye(),1);lP={sendKey:"enter",runningSend:"queue",showThinking:!0}});function UM({size:e=18,className:t}){return(0,Na.jsxs)("svg",{className:t,width:e,height:e,viewBox:"0 0 64 64","aria-hidden":"true",children:[(0,Na.jsx)("rect",{width:"64",height:"64",rx:"15",fill:"#26292b"}),(0,Na.jsxs)("g",{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"5.2",children:[(0,Na.jsx)("path",{d:"M14 20.5 25 31 14 41.5",stroke:"#fff"}),(0,Na.jsx)("path",{d:"M29.14 23.61A12 12 0 1 1 46.63 39.92L48.6 47.6 39.85 42.93A12 12 0 0 1 29.14 38.39",stroke:"#fff"}),(0,Na.jsx)("path",{d:"M35.6 35.4h6",stroke:"#2dd4bf"})]})]})}var Na,qM=te(()=>{Na=ie(ye(),1)});function $M({providerId:e,onBack:t}){let i=OM(e),n=(0,FM.useId)();return(0,Ms.jsxs)("div",{className:"cp-auto-on",role:"status","aria-live":"polite","data-testid":"auto-on",children:[(0,Ms.jsxs)("span",{className:"cp-auto-t",title:i,"aria-describedby":n,tabIndex:0,children:[(0,Ms.jsx)("span",{className:"cp-auto-ic","aria-hidden":!0,children:(0,Ms.jsx)(ne,{name:"shieldCheck",size:13})}),(0,Ms.jsx)("b",{children:g("composer.autoOn.title")})]}),(0,Ms.jsx)("span",{id:n,className:"sr-only",children:i}),t&&(0,Ms.jsx)("button",{type:"button",className:"cp-auto-back",onClick:t,children:g("composer.autoOn.back")})]})}var FM,Ms,WM=te(()=>{FM=ie(bt(),1);Rn();Ap();kt();Ms=ie(ye(),1)});function KM(e,t=!1){if(t||!e.startsWith("/"))return{open:!1,query:""};let i=e.slice(1);return i.includes(` +`)||i.includes(" ")?{open:!1,query:""}:{open:!0,query:i}}function GM(e,t){let i=t.trim().toLowerCase();return i?e.filter(n=>n.name.toLowerCase().includes(i)||n.description.toLowerCase().includes(i)||(n.argumentHint??"").toLowerCase().includes(i)):e}function jM(e){let t=e.filter(r=>r.kind==="command"),i=e.filter(r=>r.kind==="skill"),n=[];if(t.length){n.push({type:"heading",id:"h-cmd",labelKey:"slashGroupCommand"});for(let r of t)n.push({type:"item",id:`c:${r.name}`,command:r})}if(i.length){n.push({type:"heading",id:"h-skill",labelKey:"slashGroupSkill"});for(let r of i)n.push({type:"item",id:`s:${r.name}`,command:r})}return n}function YM(e){return e.filter(t=>t.type==="item").map(t=>t.command)}function e0(e){return`/${e} `}function VM(e,t){return!!t&&e.trim()===`/${t}`}function t0(e,t){return t<=0?0:e<0?t-1:e>=t?0:e}var XM=te(()=>{});function Op(){return(0,$.jsx)("svg",{className:"chip-caret",width:"10",height:"10",viewBox:"0 0 10 10","aria-hidden":"true",children:(0,$.jsx)("path",{d:"M2.5 4l2.5 2.5L7.5 4",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}var Oe,$,i0,QM,JM=te(()=>{Oe=ie(bt(),1);Kl();en();On();Co();qi();vp();Rn();ed();wp();kp();_r();Mp();Ap();qM();Ju();Tp();WM();kt();XM();$=ie(ye(),1),i0=150,QM=(0,Oe.memo)(function(){let t=he(),{threads:i,providers:n,projects:r}=Ge(),s=Rt(E=>E.status),a=Rt(E=>E.pending),o=Rt(E=>E.slashCommands),l=Rt(E=>E.queue),c=Rt(E=>E.items.some(X=>X.kind==="user")),u=Rt(E=>E.items.some(X=>X.kind==="assistant"||X.kind==="reasoning"||X.kind==="toolgroup"||X.kind==="permission")),d=Rt(E=>iM(E.items)),[h,f]=(0,Oe.useState)(""),[p,_]=(0,Oe.useState)([]),[y,m]=(0,Oe.useState)([]),[v,b]=(0,Oe.useState)([]),[w,k]=(0,Oe.useState)(!1),[M,T]=(0,Oe.useState)(!1),[A,L]=(0,Oe.useState)(null),[B,q]=(0,Oe.useState)(""),[H,P]=(0,Oe.useState)(!1),x=(0,Oe.useRef)(0),U=(0,Oe.useRef)(0),C=(0,Oe.useRef)(null),D=(0,Oe.useRef)(null),R=(0,Oe.useRef)(null),[Y,z]=(0,Oe.useState)([]),[I,j]=(0,Oe.useState)(0),[ve,de]=(0,Oe.useState)(0),Ae=(0,Oe.useRef)(!1),re=(0,Oe.useRef)(new Set),[ut,zi]=(0,Oe.useState)(!1),$t=id(),ue=i.find(E=>E.id===t.currentThreadId),gt=n.find(E=>E.id===ue?.provider),tt=s==="running"||s==="initializing",Ce=a.length>0,ei=gt?.capabilities.steer??!1,xi=!!gt&&!gt.capabilities.images&>.capabilities.imagesKnown!==!1,fe=ue?.mode??"default",dt=RM(ue?.provider,gt?.capabilities.modes??[],gt?.capabilities.modeLabels),se=dt.find(E=>E.id===fe),ji=c&&(tt||!!ue?.providerSessionId||u),Ke=(0,Oe.useMemo)(()=>KM(h,Ae.current),[h]),We=(0,Oe.useMemo)(()=>GM(o,Ke.query),[o,Ke.query]),qn=(0,Oe.useMemo)(()=>jM(We),[We]),Lt=(0,Oe.useMemo)(()=>YM(qn),[qn]),Fn=Ke.open&&!Ce;(0,Oe.useEffect)(()=>{de(0)},[Ke.query,Fn]),(0,Oe.useEffect)(()=>{let E=ue?.id;!Fn||!E||re.current.has(E)||(re.current.add(E),zi(!0),Z.call("thread.commands",{id:E,load:!0},3e4).then(X=>{let le=X.commands??[];(le.length||!Rt.getState().slashCommands.length)&&Rt.setState({slashCommands:le})}).catch(()=>{}).finally(()=>zi(!1)))},[Fn,ue?.id]);let vn=(0,Oe.useMemo)(()=>n.filter(E=>E.enabled!==!1||E.id===ue?.provider),[n,ue?.provider]),J=vn.find(E=>E.id===(A??ue?.provider)),ce=E=>E.enabled!==!1&&E.available&&E.status!=="planned",be=E=>{let X=!!E?.force,le=++x.current,me=0;X&&(me=++U.current,P(!0));let He={};return X&&(He.refresh=!0),E?.provider&&(He.provider=E.provider),Z.call("providers.list",Object.keys(He).length?He:void 0).then(_t=>{le===x.current&&Ge.setState({providers:_t})}).catch(()=>{}).finally(()=>{X&&me===U.current&&P(!1)})},Re=E=>{T(E),E&&(L(null),q(""),be({provider:ji?ue?.provider??null:null}))};(0,Oe.useEffect)(()=>{if(!M)return;let E=le=>{C.current&&!C.current.contains(le.target)&&Re(!1)},X=le=>{le.key==="Escape"&&(le.stopPropagation(),Re(!1))};return document.addEventListener("pointerdown",E,!0),window.addEventListener("keydown",X,!0),()=>{document.removeEventListener("pointerdown",E,!0),window.removeEventListener("keydown",X,!0)}},[M]);let st=async(E,X)=>{if(ue){Re(!1);try{!ji&&E!==ue.provider&&await Z.call("thread.setProvider",{id:ue.id,provider:E}),await Z.call("thread.setModel",{id:ue.id,model:X})}catch(le){ke(g("composer.failSwitchAgent")+Ze(le),!0)}}},Bi=(0,Oe.useMemo)(()=>{let E=B.trim().toLowerCase();if(!E)return[];let X=[];for(let le of vn)if(ce(le))for(let me of le.models??[])(me.name.toLowerCase().includes(E)||me.id.toLowerCase().includes(E))&&X.push({providerId:le.id,providerName:le.name,model:me});return X.slice(0,100)},[B,vn]),is=!!(A&&!B.trim());(0,Oe.useEffect)(()=>{if(!tt)return;let E=Date.now(),X=setInterval(()=>j(Math.floor((Date.now()-E)/1e3)),1e3);return()=>clearInterval(X)},[tt]),(0,Oe.useEffect)(()=>{let E=D.current;if(!E)return;E.style.height="auto";let X=parseFloat(getComputedStyle(E).lineHeight)||22;E.style.height=Math.min(E.scrollHeight,Math.round(12*X))+"px"},[h]);let bn=(0,Oe.useCallback)(async(E="queue")=>{let X=t.currentThreadId,le=h.trim();if(!X||!le&&p.length===0&&y.length===0&&v.length===0)return;let me=nM(v,le),He=tt&&E==="steer"&&ei,_t=!tt||He,Yt={attachments:p,mentions:y,quotes:v};tt&&E==="queue"&&z(cr=>[...cr,me]),f(""),_([]),m([]),b([]);let Ba=r.find(cr=>cr.id===ue?.projectId)?.path;try{let cr=await Rt.getState().send(X,{text:me,attachments:Yt.attachments.map(Ei=>({path:Ei.path,mime:Ei.mime,name:Ei.name})),...Yt.mentions.length?{mentions:TM(Yt.mentions)}:{},behavior:He?"steer":"queue"},{attachments:Yt.attachments.map(Ei=>({id:Ei.path,name:Ei.name.trim()||Ei.path,mime:Ei.mime})),...Ba&&Yt.mentions.length?{mentions:Yt.mentions.map(Ei=>({path:dc(Ba,Ei.rel),isDir:Ei.isDir}))}:{}},{optimistic:_t});cr?.delivered==="queued"&&tt?ke(g("composer.queuedToast")):cr?.delivered==="steered"&&ke(g("composer.steeredToast")),tt||z(Ei=>[...Ei.slice(-9),me])}catch(cr){_t||(f(le),_(Yt.attachments),m(Yt.mentions),b(Yt.quotes)),ke(g("composer.failSend")+Ze(cr),!0)}},[h,p,y,v,t.currentThreadId,tt,ei,r,ue?.projectId]),_c=E=>{if(er(E.nativeEvent))return;if(Fn&&Lt.length>0){if(E.key==="ArrowDown"){E.preventDefault(),de(_t=>t0(_t+1,Lt.length));return}if(E.key==="ArrowUp"){E.preventDefault(),de(_t=>t0(_t-1,Lt.length));return}if(E.key==="Escape"){E.preventDefault(),Ae.current=!0,de(0);return}let me=Lt[ve]??Lt[0],He=E.key==="Enter"&&VM(h,me?.name);if((E.key==="Enter"&&!E.shiftKey||E.key==="Tab")&&!He){E.preventDefault(),me&&(Ae.current=!1,f(e0(me.name)));return}}let X=E.ctrlKey||E.metaKey;if($t.sendKey==="ctrlEnter"?E.key==="Enter"&&X:E.key==="Enter"&&!E.shiftKey&&!X){E.preventDefault(),tt&&$t.runningSend==="steer"&&ei?bn("steer"):bn("queue");return}if($t.sendKey==="enter"&&E.key==="Enter"&&X&&tt){E.preventDefault(),bn(ei?"steer":"queue");return}E.key==="ArrowUp"&&h===""&&Y.length>0&&(E.preventDefault(),f(Y[Y.length-1]))},Bs=async E=>{let X=E.clipboardData?.items;if(!X)return;for(let me of X)if(me.type.startsWith("image/")){E.preventDefault();let He=me.getAsFile();He&&await ns(He);return}let le=E.clipboardData.getData("text/plain");if(le&&le.length>32*1024){E.preventDefault();let me=new File([le],"paste.txt",{type:"text/plain"});await ns(me)}},ns=async E=>{let X=cc(),le={path:"",name:E.name,mime:E.type||"application/octet-stream",uploading:!0};_(me=>[...me,le]);try{let He=await(await fetch(`/api/upload?name=${encodeURIComponent(E.name)}`,{method:"POST",headers:{"x-agent-console":X},body:E})).json();if(!He.ok)throw new Error(He.e?.message??g("composer.uploadFailed"));_(_t=>_t.map(Yt=>Yt===le?{...Yt,path:He.id,name:He.name??E.name,uploading:!1}:Yt))}catch(me){_(He=>He.filter(_t=>_t!==le)),ke(g("composer.failUpload")+Ze(me),!0)}},Ps=r.find(E=>E.id===ue?.projectId)??null,vc=E=>{if(E){if(!ue||E.projectId!==ue.projectId){ke(g("mention.otherProject"),!0);return}m(X=>Vb(X,E)),D.current?.focus()}};(0,Oe.useEffect)(()=>{let E=X=>vc(X.detail);return window.addEventListener("ac-insert-mention",E),()=>window.removeEventListener("ac-insert-mention",E)}),(0,Oe.useEffect)(()=>{let E=X=>{let le=X.detail;if(!le||typeof le.text!="string")return;if(h.trim()||v.length>0||y.length>0||p.length>0){ke(g("timeline.editBusy"),!0);return}let me=aM(le.text);b(me.quotes),f(me.rest);let He=Ps?.path;if(ue&&He&&le.mentions?.length){let _t=[];for(let Yt of le.mentions){let Ba=Ep(He,Yt.path);Ba&&(_t=Vb(_t,{projectId:ue.projectId,rel:Ba,isDir:Yt.isDir}))}m(_t)}requestAnimationFrame(()=>{let _t=D.current;_t&&(_t.focus(),_t.setSelectionRange(_t.value.length,_t.value.length))})};return window.addEventListener("ac-composer-fill",E),()=>window.removeEventListener("ac-composer-fill",E)}),(0,Oe.useEffect)(()=>{let E=X=>{let le=X.detail;if(le?.text){if(v.length>=10){ke(_e("quote.full",{n:10}),!0);return}b(me=>Sp(me,le.text,le.src)),D.current?.focus()}};return window.addEventListener("ac-add-quote",E),()=>window.removeEventListener("ac-add-quote",E)}),(0,Oe.useEffect)(()=>{m([]),b([])},[t.currentThreadId]);let Md=async E=>{if(E.preventDefault(),k(!1),E.dataTransfer.types.includes(uc)){vc(CM(E.dataTransfer.getData(uc)));return}for(let X of E.dataTransfer.files)(X.type.startsWith("image/")||X.type.startsWith("text/"))&&await ns(X)},bc=E=>{ue&&Z.call("thread.setMode",{id:ue.id,mode:E}).catch(X=>ke(Ze(X),!0))},Bo=!!(dt.find(E=>E.id===fe)??dt[0])?.auto,yc=dt.some(E=>E.id==="default"&&!E.auto),rs=E=>{ue&&Z.call("thread.setEffort",{id:ue.id,effort:E})},Hs=E=>{ue&&Z.call("thread.setCursorOpts",{id:ue.id,...E}).catch(X=>ke(Ze(X),!0))},lr=ue?.model?gt?.models?.find(E=>E.id===ue.model):gt?.models?.find(E=>E.isDefault)??gt?.models?.[0],Po=(lr?.thinkingOptions??[]).map(E=>{let X=E,le=typeof X.id=="string"?X.id:typeof X.reasoningEffort=="string"?X.reasoningEffort:null,me=X.id,He=le??(me&&typeof me.reasoningEffort=="string"?me.reasoningEffort:null);return He?{id:He,label:typeof X.label=="string"?X.label:He}:null}).filter(E=>E!==null),Ho=typeof lr?.defaultThinking=="string"?lr.defaultThinking:null,Od=Po.length>0,Rd=(()=>{if(!ue?.model){let le=gt?.models?.find(me=>me.isDefault);return le?le.name:g("composer.defaultModel")}let X=gt?.models?.find(le=>le.id===ue.model)?.name??ue.model;return ue.cursorFast&&(X+=" \xB7 Fast"),X})();return t.currentThreadId?(0,$.jsxs)("div",{className:`composer${Ce?" waiting":""}`,onDrop:Md,onDragOver:E=>{E.preventDefault();let X=E.dataTransfer.types.includes(uc);X&&(E.dataTransfer.dropEffect="copy"),X!==w&&k(X)},onDragLeave:E=>{E.currentTarget.contains(E.relatedTarget)||k(!1)},children:[d&&(0,$.jsx)("div",{className:"cp-tasks",children:(0,$.jsxs)("button",{type:"button",className:"tasks-pill",title:g("timeline.tasksPillTitle"),onClick:()=>window.dispatchEvent(new CustomEvent("ac-show-item",{detail:{key:d.key}})),children:[(0,$.jsx)(ne,{name:"listChecks",size:12}),(0,$.jsx)("span",{children:_e("timeline.tasksPill",yp(d.items))})]})}),l.length>0&&(0,$.jsx)("div",{className:"q-list",children:l.map(E=>(0,$.jsxs)("div",{className:"q-item",children:[(0,$.jsx)("span",{className:"q-text",children:E.text}),(0,$.jsx)("button",{className:"ibtn",title:g("common.remove"),onClick:()=>{Z.call("thread.queueRemove",{id:ue?.id,queueId:E.id}).catch(()=>{})},children:(0,$.jsx)(ne,{name:"x",size:12})})]},E.id))}),Bo&&(0,$.jsx)($M,{providerId:ue?.provider,onBack:yc?()=>bc("default"):void 0}),(0,$.jsxs)("div",{className:`cp-card${Ce?" waiting":""}${Bo?" auto-on":""}${w?" drop-on":""}`,children:[w&&(0,$.jsx)("div",{className:"cp-drop-hint",children:g("mention.drop")}),xi&&p.some(E=>E.mime.startsWith("image/"))&&(0,$.jsx)("div",{className:"att-note",children:_e("composer.imagesByPath",{agent:gt?.name??""})}),v.length>0&&(0,$.jsx)("div",{className:"att-bar q-bar",children:v.map(E=>(0,$.jsxs)("span",{className:"qchip",title:`${g("quote.chipTitle")} ${E.src?`[${E.src}] -`:""}${E.text.slice(0,600)}`,children:[(0,W.jsx)(re,{name:"quote",size:12}),(0,W.jsx)("span",{className:"qchip-t",children:UA(E)}),E.text.includes(` -`)&&(0,W.jsx)("span",{className:"qchip-n",children:_e("quote.lines",{n:E.text.split(` -`).length})}),(0,W.jsx)("button",{type:"button",className:"att-x","aria-label":g("quote.remove"),title:g("quote.remove"),onClick:()=>h(Z=>Z.filter(ue=>ue.id!==E.id)),children:"\xD7"})]},E.id))}),(o.length>0||c.length>0)&&(0,W.jsxs)("div",{className:"att-bar",children:[c.map(E=>(0,W.jsx)(Bb,{path:rt?ac(rt.path,E.rel):E.rel,isDir:E.isDir,onRemove:()=>u(Z=>Z.filter(ue=>ue!==E))},E.rel)),o.map((E,Z)=>(0,W.jsxs)("span",{className:`att${E.uploading?" up":""}`,children:[E.mime.startsWith("image/")&&E.path?(0,W.jsx)("img",{src:tM(E.path),alt:E.name}):(0,W.jsx)(re,{name:"attach",size:12}),(0,W.jsx)("span",{className:"att-name",children:E.name}),E.uploading&&(0,W.jsx)("span",{className:"att-prog",children:"\u2026"}),(0,W.jsx)("button",{className:"att-x",onClick:()=>l(ue=>ue.filter((Ce,$e)=>$e!==Z)),children:"\xD7"})]},Z))]}),(0,W.jsxs)("div",{className:"cp-ta-wrap",children:[li&&(0,W.jsx)("div",{className:"pop agent-picker slash-pop",role:"listbox",children:(0,W.jsx)("div",{className:"ap-scroll",children:$t.length===0?(0,W.jsx)("div",{className:"ap-empty",children:g(z?"composer.slashLoading":"composer.slashNoCommands")}):$t.map(E=>{if(E.type==="heading")return(0,W.jsx)("div",{className:"slash-h",children:E.labelKey==="slashGroupCommand"?g("composer.slashGroupCommand"):g("composer.slashGroupSkill")},E.id);let ue=fe.indexOf(E.command)===C;return(0,W.jsxs)("button",{type:"button",role:"option","aria-selected":ue,className:`mi slash-item${ue?" sel":""}`,onMouseDown:Ce=>Ce.preventDefault(),onClick:()=>{R.current=!1,a(Wb(E.command.name))},children:[(0,W.jsxs)("span",{className:"slash-name",children:["/",E.command.name]}),(0,W.jsx)("span",{className:"slash-desc",children:E.command.description}),E.command.argumentHint?(0,W.jsx)("span",{className:"slash-hint",children:E.command.argumentHint}):null]},E.id)})})}),(0,W.jsx)("textarea",{ref:B,className:"cp-ta",rows:1,placeholder:te?g("composer.waitPerm"):ge?g(We?"composer.queuePlaceholder":"composer.queuePlaceholderNoSteer"):g("composer.inputPlaceholder"),value:s,disabled:te,onChange:E=>{R.current=!1,a(E.target.value)},onKeyDown:de,onPaste:ve})]}),(0,W.jsxs)("div",{className:"cp-bar",children:[(0,W.jsxs)("div",{className:"pill-wrap",ref:I,children:[(0,W.jsxs)("button",{className:"pill chip",onClick:()=>Un(!_),title:g("composer.agentModel"),children:[(0,W.jsx)(wM,{size:16,className:"chip-logo"}),(0,W.jsx)("span",{className:"p-a",children:oe?.name??X?.provider??g("composer.agent")}),(0,W.jsx)("span",{className:"p-t",children:fc}),(0,W.jsx)(wp,{})]}),_&&(0,W.jsxs)("div",{className:"pop agent-pop agent-picker",children:[(0,W.jsxs)("div",{className:"ap-search",children:[(0,W.jsx)(re,{name:"search",size:14}),(0,W.jsx)("input",{className:"ap-search-in",autoFocus:!0,placeholder:g("composer.searchAllModels"),value:b,onChange:E=>w(E.target.value)}),(0,W.jsx)("button",{type:"button",className:`ap-refresh${k?" spinning":""}`,title:k?g("composer.refreshingModels"):g("composer.refreshModels"),"aria-label":g("composer.refreshModels"),disabled:k,onMouseDown:E=>E.preventDefault(),onClick:()=>{Fe({force:!0,provider:xr?m??X?.provider??null:null})},children:(0,W.jsx)(re,{name:"refresh",size:14})})]}),b.trim()?(0,W.jsxs)("div",{className:"ap-scroll",children:[ts.length===0&&(0,W.jsx)("div",{className:"ap-empty",children:g("composer.noModelMatch")}),ts.map(({providerId:E,providerName:Z,model:ue})=>{let Ce=Ht&&E!==X?.provider;return(0,W.jsxs)("button",{className:"mi mi-row",disabled:Ce,onClick:()=>{Gt(E,ue.id)},children:[(0,W.jsx)("span",{className:"mi-sub",children:Z}),(0,W.jsx)("span",{className:"mi-name",children:ue.name}),X?.provider===E&&X?.model===ue.id&&(0,W.jsx)("span",{className:"mi-check",children:"\u2713"})]},`${E}:${ue.id}`)})]}):xr&&Kt?(0,W.jsxs)("div",{className:"ap-scroll",children:[(0,W.jsxs)("button",{type:"button",className:"ap-back mi",onClick:()=>v(null),children:[(0,W.jsx)("span",{className:"ap-back-icon",children:(0,W.jsx)(re,{name:"caret",size:14})}),Kt.name]}),(0,W.jsxs)("button",{className:"mi model-pick-row",title:Kt.models?.find(E=>E.isDefault)?.name??g("composer.defaultModel"),onClick:()=>{Gt(Kt.id,null)},children:[(0,W.jsx)("span",{className:"model-pick-name",children:g("composer.defaultModel")}),(()=>{let E=Kt.models?.find(Z=>Z.isDefault);return E?(0,W.jsxs)("span",{className:"mi-sub model-pick-default",children:[" (",E.name,")"]}):null})(),X?.provider===Kt.id&&!X?.model?(0,W.jsx)("span",{className:"mi-check",children:"\u2713"}):""]}),(Kt.models??[]).filter(E=>!E.isDefault).slice(0,Kb).map(E=>(0,W.jsxs)("button",{className:"mi model-pick-row",title:E.name,onClick:()=>{Gt(Kt.id,E.id)},children:[(0,W.jsx)("span",{className:"model-pick-name",children:E.name}),X?.provider===Kt.id&&X?.model===E.id?(0,W.jsx)("span",{className:"mi-check",children:"\u2713"}):""]},E.id)),(Kt.models?.length??0)>Kb&&(0,W.jsx)("div",{className:"ap-empty",children:_e("composer.moreModels",{n:String((Kt.models?.length??0)-Kb)})})]}):(0,W.jsxs)("div",{className:"ap-scroll",children:[(0,W.jsx)("div",{className:"mlabel",children:Ht?g("composer.agentLocked"):g("composer.providers")}),Ht&&(0,W.jsx)("div",{className:"ap-empty",children:g("composer.agentLockedHint")}),se.length===0&&(0,W.jsx)("div",{className:"ap-empty",children:g("composer.providersLoading")}),se.map(E=>{let ue=Ye(E)&&(!Ht||E.id===X?.provider),Ce=E.models?.length??0,$e=E.name?.trim()||E.id;return(0,W.jsxs)("button",{className:"mi mi-row provider-pick-row",disabled:!ue,onClick:()=>{ue&&v(E.id)},children:[(0,W.jsx)("span",{className:"provider-pick-name",children:$e}),(0,W.jsxs)("span",{className:"provider-pick-meta",children:[E.id===X?.provider&&(0,W.jsx)("span",{className:"mi-tag",children:"Current"}),(0,W.jsx)("span",{className:"mi-meta",children:Ce===1?"1 model":`${Ce} models`}),ue&&(0,W.jsx)("span",{className:"mi-caret",children:(0,W.jsx)(re,{name:"caret",size:14})}),E.enabled===!1&&(0,W.jsx)("span",{className:"dlg-hint",children:"Disabled"}),E.enabled!==!1&&E.status==="planned"&&(0,W.jsx)("span",{className:"dlg-hint",children:"Not available"}),E.enabled!==!1&&E.status!=="planned"&&!E.available&&(0,W.jsx)("span",{className:"dlg-hint",children:"Not detected"})]})]},E.id)})]})]})]}),hc&&(0,W.jsxs)(pn,{className:"pill ipill",title:g("composer.effortTitle"),ariaLabel:g("composer.effortTitle"),prefer:"up",upAnchor:".cp-card",value:X?.effort??"",onChange:E=>Oo(E||null),options:[{value:"",label:Io?_e("composer.defaultEffortNamed",{level:bp(Io)}):g("composer.defaultEffort")},...Lo.filter(E=>E.id!=="default").map(E=>({value:E.id,label:bp(E.id,E.label)}))],children:[(0,W.jsx)(re,{name:"gauge",size:14}),(0,W.jsx)("span",{className:"ip-l",children:(()=>{let E=X?.effort??Io;return E?bp(E,Lo.find(Z=>Z.id===E)?.label):g("composer.defaultEffort")})()}),(0,W.jsx)(wp,{})]}),yt.length===1&&(0,W.jsxs)("span",{className:`pill ipill mode-chip static${yt[0].auto?" auto":""}`,title:yt[0].desc,"data-mode":yt[0].id,children:[(0,W.jsx)(re,{name:yt[0].auto?"shieldCheck":"shield",size:14}),(0,W.jsx)("span",{className:"ip-l",children:yt[0].label})]}),yt.length>1&&(()=>{let E=yt.find(Z=>Z.id===oi)??yt[0];return(0,W.jsxs)(pn,{className:`pill ipill mode-chip${E.danger?" danger":""}${E.auto?" auto":""}`,title:E.desc,ariaLabel:g("composer.modeTitle"),prefer:"up",upAnchor:".cp-card",menuClassName:"mode-menu",value:E.id,onChange:Z=>is(Z),options:yt.map(Z=>({value:Z.id,label:Z.label,hint:Z.desc,danger:Z.danger,warn:Z.auto,icon:Z.auto?"shieldCheck":void 0})),children:[(0,W.jsx)(re,{name:E.auto?"shieldCheck":"shield",size:14}),(0,W.jsx)("span",{className:"ip-l",children:E.label}),(0,W.jsx)(wp,{})]})})(),X?.provider==="cursor"&&(0,W.jsxs)(pn,{className:"pill ipill cursor-fast",title:"Fast",ariaLabel:"Fast",prefer:"up",upAnchor:".cp-card",value:X.cursorFast?"fast":"off",onChange:E=>Ro({cursorFast:E==="fast"}),options:[{value:"off",label:"Fast: Off"},{value:"fast",label:"Fast: On"}],children:[(0,W.jsx)(re,{name:"zap",size:13}),(0,W.jsx)("span",{className:"ip-l",children:X.cursorFast?"Fast: On":"Fast: Off"}),(0,W.jsx)(wp,{})]}),(0,W.jsx)("span",{className:"cp-div","aria-hidden":"true"}),(0,W.jsx)("button",{className:"ibtn cp-attach",title:g("composer.attachTitle"),onClick:()=>q.current?.click(),children:(0,W.jsx)(re,{name:"attach"})}),(0,W.jsx)("input",{ref:q,type:"file",hidden:!0,multiple:!0,accept:"image/*,.txt,.md,.log,.json,.csv",onChange:E=>{for(let Z of E.target.files??[])Me(Z);E.target.value=""}}),(0,W.jsx)("div",{className:"cp-right",children:ge?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)("span",{className:"cp-clock",children:[x,"s"]}),(s.trim()||o.length>0||c.length>0||d.length>0)&&(0,W.jsx)("button",{className:"cp-send",title:g(We&&K.runningSend==="steer"?"settings.steer":"settings.queue"),disabled:te||o.some(E=>E.uploading),onClick:()=>{ie(K.runningSend==="steer"&&We?"steer":"queue")},children:(0,W.jsx)(re,{name:"arrowUp"})}),(0,W.jsx)("button",{className:"cp-stop",title:g("common.stop"),onClick:()=>{Q.call("thread.interrupt",{id:X?.id})},children:(0,W.jsx)(re,{name:"stopFill"})})]}):(0,W.jsx)("button",{className:"cp-send",title:g("common.send"),disabled:te||!s.trim()&&o.length===0&&c.length===0&&d.length===0||o.some(E=>E.uploading),onClick:()=>{ie("queue")},children:(0,W.jsx)(re,{name:"arrowUp"})})})]})]}),ge&&!We&&K.runningSend==="steer"&&(0,W.jsx)("div",{className:"cp-hint",children:_e("composer.steerUnsupported",{agent:oe?.name??X?.provider??""})})]})}function wp(){return(0,W.jsx)("svg",{className:"chip-caret",width:"10",height:"10",viewBox:"0 0 10 10","aria-hidden":"true",children:(0,W.jsx)("path",{d:"M2.5 4l2.5 2.5L7.5 4",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}var De,W,Kb,IM=ae(()=>{De=ne(pt(),1);Fl();Qi();An();yo();Hi();cp();Mn();Ku();fp();gp();fr();Sp();yp();xM();$u();vp();CM();Ct();RM();W=ne(be(),1),Kb=150});function Gb(e){return e?e.nodeType===1?e:e.parentElement:null}function G6(e){if(!e||e.isCollapsed||e.rangeCount===0)return null;let t=e.toString();if(!t.trim())return null;let i=Gb(e.anchorNode),n=Gb(e.focusNode);if(!i||!n)return null;let r=i.closest("[data-quote-root]");if(!r||r!==n.closest("[data-quote-root]")||i.closest(zM)||n.closest(zM))return null;let s=e.getRangeAt(0),o=Gb(s.commonAncestorContainer)?.closest("[data-quote-src]")?.getAttribute("data-quote-src")||void 0;return{range:s,text:t,root:r,src:o}}function j6(e){let t=e;for(;t&&t!==document.body;){let s=getComputedStyle(t).overflowY;if(s==="auto"||s==="scroll")break;t=t.parentElement}let i=(t&&t!==document.body?t:document.documentElement).getBoundingClientRect(),n=Math.min(i.bottom,window.innerHeight),r=document.querySelector(".composer");return e.getAttribute("data-quote-root")==="chat"&&r&&(n=Math.min(n,r.getBoundingClientRect().top)),{left:i.left,right:i.right,top:Math.max(i.top,0)+4,bottom:n-4}}function PM(){let[e,t]=(0,Yr.useState)(null),i=(0,Yr.useRef)(!1),n=(0,Yr.useRef)(null),r=(0,Yr.useRef)(0),s=(0,Yr.useCallback)(()=>{cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{if(i.current)return;let o=G6(window.getSelection());if(!o){t(null);return}let l=n.current?.offsetWidth||$6,c=[...o.range.getClientRects()].map(d=>({left:d.left,top:d.top,right:d.right,bottom:d.bottom})),u=qA(c,j6(o.root),{w:l,h:K6},window.innerWidth);if(!u){t(null);return}t({text:o.text,src:o.src,left:u.left,top:u.top})})},[]);if((0,Yr.useEffect)(()=>{let o=h=>{h.target?.closest?.(".qs-pop")||h.button===0&&(i.current=!0,t(null))},l=()=>{i.current&&(i.current=!1,s())},c=h=>{if(h.key==="Escape"){t(null);return}s()},u=()=>s(),d=()=>s();return document.addEventListener("pointerdown",o,!0),document.addEventListener("pointerup",l,!0),document.addEventListener("keyup",c,!0),document.addEventListener("selectionchange",u),window.addEventListener("scroll",d,!0),window.addEventListener("resize",d),()=>{document.removeEventListener("pointerdown",o,!0),document.removeEventListener("pointerup",l,!0),document.removeEventListener("keyup",c,!0),document.removeEventListener("selectionchange",u),window.removeEventListener("scroll",d,!0),window.removeEventListener("resize",d),cancelAnimationFrame(r.current)}},[s]),!e)return null;let a=()=>{window.dispatchEvent(new CustomEvent("ac-add-quote",{detail:{text:e.text,src:e.src}})),window.getSelection()?.removeAllRanges(),t(null)};return(0,BM.createPortal)((0,Yu.jsxs)("button",{ref:n,type:"button",className:"qs-pop",style:{left:e.left,top:e.top},title:g("quote.addHint"),onMouseDown:o=>o.preventDefault(),onPointerDown:o=>o.preventDefault(),onClick:a,children:[(0,Yu.jsx)(re,{name:"chat",size:13}),(0,Yu.jsx)("span",{children:g("quote.add")})]}),document.body)}var Yr,BM,Yu,$6,K6,zM,HM=ae(()=>{Yr=ne(pt(),1),BM=ne(qs(),1);Mn();Ct();fp();Yu=ne(be(),1),$6=118,K6=30,zM="input, textarea, select, [contenteditable=''], [contenteditable='true'], button, .cp-card, .qs-pop, [data-quote-off]"});function qM(){let e=he(),{projects:t,threads:i}=Ke(),n=Di(),r=ju(),s=(0,ht.useMemo)(()=>DA($A(n.items),{showThinking:r.showThinking}),[n.items,r.showThinking]),a=(0,ht.useRef)(null),[o,l]=(0,ht.useState)(!0),[c,u]=(0,ht.useState)(!1),d=(0,ht.useRef)(rM()),h=(0,ht.useCallback)(z=>{d.current.stick=z,l(z)},[]),f=(0,ht.useCallback)(()=>{let z=a.current;z&&(z.scrollTop=z.scrollHeight,d.current.lastTop=z.scrollTop)},[]),p=t.find(z=>z.id===e.currentProjectId)??null,_=e.currentThreadId,y=_?i.find(z=>z.id===_)??null:null,m=p&&y&&y.projectId===p.id?y.id:null,v=t.length>0;(0,ht.useEffect)(()=>{m?n.open(m):n.close(),h(!0),u(!1),d.current.pointerDown=!1,d.current.intentAt=-1/0},[m,h]);let b=(0,ht.useCallback)(z=>{let L=s[z];if(!L)return 80;switch(L.kind){case"user":return 60;case"assistant":case"reasoning":return 120;case"toolgroup":return L.steps.length>up?34:8+26*L.steps.length;case"plan":return 200;case"permission":case"question":return 120;case"todo":return 34+24*L.items.length;case"turnend":case"notice":return 30;default:return 60}},[s]),w=bA({count:s.length,getScrollElement:()=>a.current,estimateSize:b,getItemKey:z=>s[z]?.key??z,overscan:8,measureElement:z=>z.getBoundingClientRect().height});w.shouldAdjustScrollPositionOnItemSizeChange=(z,L,K)=>!d.current.stick&&z.end<=(K.scrollOffset??0)&&K.scrollDirection!=="backward",(0,ht.useEffect)(()=>{let z=L=>{let K=L.detail?.key,X=K?s.findIndex(oe=>oe.key===K):-1;X<0||(h(!1),w.scrollToIndex(X,{align:"center"}),requestAnimationFrame(()=>{let oe=a.current?.querySelector(`[data-todo-key="${CSS.escape(K)}"]`);oe?.classList.remove("flash"),oe?.offsetWidth,oe?.classList.add("flash")}))};return window.addEventListener("ac-show-item",z),()=>window.removeEventListener("ac-show-item",z)},[s,w,h]);let k=s.length,M=(0,ht.useRef)({thread:null,n:0});(0,ht.useEffect)(()=>{let z=M.current,L=z.thread===m&&z.n>0&&k>z.n;M.current={thread:m,n:k},d.current.stick?f():L&&u(!0)},[k,m,f]);let T=w.getTotalSize();(0,ht.useLayoutEffect)(()=>{d.current.stick&&f()});let A=(0,ht.useRef)(null);!A.current&&typeof ResizeObserver<"u"&&(A.current=new ResizeObserver(()=>{d.current.stick&&f()})),(0,ht.useEffect)(()=>()=>A.current?.disconnect(),[]),(0,ht.useEffect)(()=>{let z=a.current,L=A.current;if(!z||!L)return;L.observe(z);let K=z.querySelector(".tl-wrap");return K&&L.observe(K),()=>{L.unobserve(z),K&&L.unobserve(K)}},[m,v]);let I=(0,ht.useCallback)(z=>{w.measureElement(z),z&&A.current?.observe(z)},[w]);(0,ht.useEffect)(()=>{if(!n.sentAt)return;h(!0),u(!1),f();let z=requestAnimationFrame(f);return()=>cancelAnimationFrame(z)},[n.sentAt,h,f]);let B=()=>{d.current.intentAt=performance.now()},q=z=>{B();let L=a.current;z.deltaY<0&&L&&L.scrollHeight>L.clientHeight&&d.current.stick&&h(!1)},H=z=>{(aM.has(z.key)||z.key===" "&&z.shiftKey)&&B()},P=()=>{d.current.pointerDown=!0,B()};(0,ht.useEffect)(()=>{let z=()=>{d.current.pointerDown&&(d.current.pointerDown=!1,B())};return window.addEventListener("pointerup",z),window.addEventListener("pointercancel",z),()=>{window.removeEventListener("pointerup",z),window.removeEventListener("pointercancel",z)}},[]);let x=()=>{let z=a.current;if(!z)return;let L=d.current.stick,K=sM(d.current,z,performance.now());(K!==L||K!==o)&&h(K),K&&(u(!1),z.scrollHeight-z.scrollTop-z.clientHeight>1&&f())},U=()=>{h(!0),u(!1),s.length>0&&w.scrollToIndex(s.length-1,{align:"end"}),f();let z=0,L=()=>{d.current.stick&&(f(),++z<6&&requestAnimationFrame(L))};requestAnimationFrame(L)},C=(z,L)=>{if(!m)return;let K=p?.path,X=K&&L?.length?L.map(ge=>({rel:mp(K,ge.path),isDir:ge.isDir})).filter(ge=>!!ge.rel):[],oe=n.status==="running"||n.status==="initializing";n.send(m,{text:z,...X.length?{mentions:X}:{}},L?.length?{mentions:L}:{},{optimistic:!oe}).catch(ge=>Ee(g("composer.failSend")+Ze(ge),!0))},D=()=>{n.lastUserText&&C(n.lastUserText)};if(!v)return(0,qe.jsx)("div",{className:"scroll",ref:a,children:(0,qe.jsx)(UM,{kind:"no-projects"})});if(!m)return(0,qe.jsx)("div",{className:"scroll",ref:a,children:p?(0,qe.jsxs)("div",{className:"empty-wrap",children:[(0,qe.jsx)("div",{className:"cp-hero-t",children:_e("chat.newInProject",{name:p.name})}),(0,qe.jsx)(Y6,{projectId:p.id})]}):(0,qe.jsx)(UM,{kind:"pick-project"})});let R=-1;for(let z=s.length-1;z>=0;z--)if(s[z].kind==="turnend"){R=z;break}let V=z=>{let L=[];for(let K=z-1;K>=0;K--){let X=s[K];if(X.kind==="user"||X.kind==="turnend")break;X.kind==="assistant"&&L.unshift(X.text)}return L.join(` +`:""}${E.text.slice(0,600)}`,children:[(0,$.jsx)(ne,{name:"quote",size:12}),(0,$.jsx)("span",{className:"qchip-t",children:rM(E)}),E.text.includes(` +`)&&(0,$.jsx)("span",{className:"qchip-n",children:_e("quote.lines",{n:E.text.split(` +`).length})}),(0,$.jsx)("button",{type:"button",className:"att-x","aria-label":g("quote.remove"),title:g("quote.remove"),onClick:()=>b(X=>X.filter(le=>le.id!==E.id)),children:"\xD7"})]},E.id))}),(p.length>0||y.length>0)&&(0,$.jsxs)("div",{className:"att-bar",children:[y.map(E=>(0,$.jsx)(Yb,{path:Ps?dc(Ps.path,E.rel):E.rel,isDir:E.isDir,onRemove:()=>m(X=>X.filter(le=>le!==E))},E.rel)),p.map((E,X)=>(0,$.jsxs)("span",{className:`att${E.uploading?" up":""}`,children:[E.mime.startsWith("image/")&&E.path?(0,$.jsx)("img",{src:bM(E.path),alt:E.name}):(0,$.jsx)(ne,{name:"attach",size:12}),(0,$.jsx)("span",{className:"att-name",children:E.name}),E.uploading&&(0,$.jsx)("span",{className:"att-prog",children:"\u2026"}),(0,$.jsx)("button",{className:"att-x",onClick:()=>_(le=>le.filter((me,He)=>He!==X)),children:"\xD7"})]},X))]}),(0,$.jsxs)("div",{className:"cp-ta-wrap",children:[Fn&&(0,$.jsx)("div",{className:"pop agent-picker slash-pop",role:"listbox",children:(0,$.jsx)("div",{className:"ap-scroll",children:qn.length===0?(0,$.jsx)("div",{className:"ap-empty",children:g(ut?"composer.slashLoading":"composer.slashNoCommands")}):qn.map(E=>{if(E.type==="heading")return(0,$.jsx)("div",{className:"slash-h",children:E.labelKey==="slashGroupCommand"?g("composer.slashGroupCommand"):g("composer.slashGroupSkill")},E.id);let le=Lt.indexOf(E.command)===ve;return(0,$.jsxs)("button",{type:"button",role:"option","aria-selected":le,className:`mi slash-item${le?" sel":""}`,onMouseDown:me=>me.preventDefault(),onClick:()=>{Ae.current=!1,f(e0(E.command.name))},children:[(0,$.jsxs)("span",{className:"slash-name",children:["/",E.command.name]}),(0,$.jsx)("span",{className:"slash-desc",children:E.command.description}),E.command.argumentHint?(0,$.jsx)("span",{className:"slash-hint",children:E.command.argumentHint}):null]},E.id)})})}),(0,$.jsx)("textarea",{ref:D,className:"cp-ta",rows:1,placeholder:Ce?g("composer.waitPerm"):tt?g(ei?"composer.queuePlaceholder":"composer.queuePlaceholderNoSteer"):g("composer.inputPlaceholder"),value:h,disabled:Ce,onChange:E=>{Ae.current=!1,f(E.target.value)},onKeyDown:_c,onPaste:Bs})]}),(0,$.jsxs)("div",{className:"cp-bar",children:[(0,$.jsxs)("div",{className:"pill-wrap",ref:C,children:[(0,$.jsxs)("button",{className:"pill chip",onClick:()=>Re(!M),title:g("composer.agentModel"),children:[(0,$.jsx)(UM,{size:16,className:"chip-logo"}),(0,$.jsx)("span",{className:"p-a",children:gt?.name??ue?.provider??g("composer.agent")}),(0,$.jsx)("span",{className:"p-t",children:Rd}),(0,$.jsx)(Op,{})]}),M&&(0,$.jsxs)("div",{className:"pop agent-pop agent-picker",children:[(0,$.jsxs)("div",{className:"ap-search",children:[(0,$.jsx)(ne,{name:"search",size:14}),(0,$.jsx)("input",{className:"ap-search-in",autoFocus:!0,placeholder:g("composer.searchAllModels"),value:B,onChange:E=>q(E.target.value)}),(0,$.jsx)("button",{type:"button",className:`ap-refresh${H?" spinning":""}`,title:H?g("composer.refreshingModels"):g("composer.refreshModels"),"aria-label":g("composer.refreshModels"),disabled:H,onMouseDown:E=>E.preventDefault(),onClick:()=>{be({force:!0,provider:is?A??ue?.provider??null:null})},children:(0,$.jsx)(ne,{name:"refresh",size:14})})]}),B.trim()?(0,$.jsxs)("div",{className:"ap-scroll",children:[Bi.length===0&&(0,$.jsx)("div",{className:"ap-empty",children:g("composer.noModelMatch")}),Bi.map(({providerId:E,providerName:X,model:le})=>{let me=ji&&E!==ue?.provider;return(0,$.jsxs)("button",{className:"mi mi-row",disabled:me,onClick:()=>{st(E,le.id)},children:[(0,$.jsx)("span",{className:"mi-sub",children:X}),(0,$.jsx)("span",{className:"mi-name",children:le.name}),ue?.provider===E&&ue?.model===le.id&&(0,$.jsx)("span",{className:"mi-check",children:"\u2713"})]},`${E}:${le.id}`)})]}):is&&J?(0,$.jsxs)("div",{className:"ap-scroll",children:[(0,$.jsxs)("button",{type:"button",className:"ap-back mi",onClick:()=>L(null),children:[(0,$.jsx)("span",{className:"ap-back-icon",children:(0,$.jsx)(ne,{name:"caret",size:14})}),J.name]}),(0,$.jsxs)("button",{className:"mi model-pick-row",title:J.models?.find(E=>E.isDefault)?.name??g("composer.defaultModel"),onClick:()=>{st(J.id,null)},children:[(0,$.jsx)("span",{className:"model-pick-name",children:g("composer.defaultModel")}),(()=>{let E=J.models?.find(X=>X.isDefault);return E?(0,$.jsxs)("span",{className:"mi-sub model-pick-default",children:[" (",E.name,")"]}):null})(),ue?.provider===J.id&&!ue?.model?(0,$.jsx)("span",{className:"mi-check",children:"\u2713"}):""]}),(J.models??[]).filter(E=>!E.isDefault).slice(0,i0).map(E=>(0,$.jsxs)("button",{className:"mi model-pick-row",title:E.name,onClick:()=>{st(J.id,E.id)},children:[(0,$.jsx)("span",{className:"model-pick-name",children:E.name}),ue?.provider===J.id&&ue?.model===E.id?(0,$.jsx)("span",{className:"mi-check",children:"\u2713"}):""]},E.id)),(J.models?.length??0)>i0&&(0,$.jsx)("div",{className:"ap-empty",children:_e("composer.moreModels",{n:String((J.models?.length??0)-i0)})})]}):(0,$.jsxs)("div",{className:"ap-scroll",children:[(0,$.jsx)("div",{className:"mlabel",children:ji?g("composer.agentLocked"):g("composer.providers")}),ji&&(0,$.jsx)("div",{className:"ap-empty",children:g("composer.agentLockedHint")}),vn.length===0&&(0,$.jsx)("div",{className:"ap-empty",children:g("composer.providersLoading")}),vn.map(E=>{let le=ce(E)&&(!ji||E.id===ue?.provider),me=E.models?.length??0,He=E.name?.trim()||E.id;return(0,$.jsxs)("button",{className:"mi mi-row provider-pick-row",disabled:!le,onClick:()=>{le&&L(E.id)},children:[(0,$.jsx)("span",{className:"provider-pick-name",children:He}),(0,$.jsxs)("span",{className:"provider-pick-meta",children:[E.id===ue?.provider&&(0,$.jsx)("span",{className:"mi-tag",children:"Current"}),(0,$.jsx)("span",{className:"mi-meta",children:me===1?"1 model":`${me} models`}),le&&(0,$.jsx)("span",{className:"mi-caret",children:(0,$.jsx)(ne,{name:"caret",size:14})}),E.enabled===!1&&(0,$.jsx)("span",{className:"dlg-hint",children:"Disabled"}),E.enabled!==!1&&E.status==="planned"&&(0,$.jsx)("span",{className:"dlg-hint",children:"Not available"}),E.enabled!==!1&&E.status!=="planned"&&!E.available&&(0,$.jsx)("span",{className:"dlg-hint",children:"Not detected"})]})]},E.id)})]})]})]}),Od&&(0,$.jsxs)(gn,{className:"pill ipill",title:g("composer.effortTitle"),ariaLabel:g("composer.effortTitle"),prefer:"up",upAnchor:".cp-card",value:ue?.effort??"",onChange:E=>rs(E||null),options:[{value:"",label:Ho?_e("composer.defaultEffortNamed",{level:Np(Ho)}):g("composer.defaultEffort")},...Po.filter(E=>E.id!=="default").map(E=>({value:E.id,label:Np(E.id,E.label)}))],children:[(0,$.jsx)(ne,{name:"gauge",size:14}),(0,$.jsx)("span",{className:"ip-l",children:(()=>{let E=ue?.effort??Ho;return E?Np(E,Po.find(X=>X.id===E)?.label):g("composer.defaultEffort")})()}),(0,$.jsx)(Op,{})]}),dt.length===1&&(0,$.jsxs)("span",{className:`pill ipill mode-chip static${dt[0].auto?" auto":""}`,title:dt[0].desc,"data-mode":dt[0].id,children:[(0,$.jsx)(ne,{name:dt[0].auto?"shieldCheck":"shield",size:14}),(0,$.jsx)("span",{className:"ip-l",children:dt[0].label})]}),dt.length>1&&(()=>{let E=dt.find(X=>X.id===fe)??dt[0];return(0,$.jsxs)(gn,{className:`pill ipill mode-chip${E.danger?" danger":""}${E.auto?" auto":""}`,title:E.desc,ariaLabel:g("composer.modeTitle"),prefer:"up",upAnchor:".cp-card",menuClassName:"mode-menu",value:E.id,onChange:X=>bc(X),options:dt.map(X=>({value:X.id,label:X.label,hint:X.desc,danger:X.danger,warn:X.auto,icon:X.auto?"shieldCheck":void 0})),children:[(0,$.jsx)(ne,{name:E.auto?"shieldCheck":"shield",size:14}),(0,$.jsx)("span",{className:"ip-l",children:E.label}),(0,$.jsx)(Op,{})]})})(),ue?.provider==="cursor"&&(0,$.jsxs)(gn,{className:"pill ipill cursor-fast",title:"Fast",ariaLabel:"Fast",prefer:"up",upAnchor:".cp-card",value:ue.cursorFast?"fast":"off",onChange:E=>Hs({cursorFast:E==="fast"}),options:[{value:"off",label:"Fast: Off"},{value:"fast",label:"Fast: On"}],children:[(0,$.jsx)(ne,{name:"zap",size:13}),(0,$.jsx)("span",{className:"ip-l",children:ue.cursorFast?"Fast: On":"Fast: Off"}),(0,$.jsx)(Op,{})]}),(0,$.jsx)("span",{className:"cp-div","aria-hidden":"true"}),(0,$.jsx)("button",{className:"ibtn cp-attach",title:g("composer.attachTitle"),onClick:()=>R.current?.click(),children:(0,$.jsx)(ne,{name:"attach"})}),(0,$.jsx)("input",{ref:R,type:"file",hidden:!0,multiple:!0,accept:"image/*,.txt,.md,.log,.json,.csv",onChange:E=>{for(let X of E.target.files??[])ns(X);E.target.value=""}}),(0,$.jsx)("div",{className:"cp-right",children:tt?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)("span",{className:"cp-clock",children:[I,"s"]}),(h.trim()||p.length>0||y.length>0||v.length>0)&&(0,$.jsx)("button",{className:"cp-send",title:g(ei&&$t.runningSend==="steer"?"settings.steer":"settings.queue"),disabled:Ce||p.some(E=>E.uploading),onClick:()=>{bn($t.runningSend==="steer"&&ei?"steer":"queue")},children:(0,$.jsx)(ne,{name:"arrowUp"})}),(0,$.jsx)("button",{className:"cp-stop",title:g("common.stop"),onClick:()=>{Z.call("thread.interrupt",{id:ue?.id})},children:(0,$.jsx)(ne,{name:"stopFill"})})]}):(0,$.jsx)("button",{className:"cp-send",title:g("common.send"),disabled:Ce||!h.trim()&&p.length===0&&y.length===0&&v.length===0||p.some(E=>E.uploading),onClick:()=>{bn("queue")},children:(0,$.jsx)(ne,{name:"arrowUp"})})})]})]}),tt&&!ei&&$t.runningSend==="steer"&&(0,$.jsx)("div",{className:"cp-hint",children:_e("composer.steerUnsupported",{agent:gt?.name??ue?.provider??""})})]}):null})});function n0(e){return e?e.nodeType===1?e:e.parentElement:null}function dP(e){if(!e||e.isCollapsed||e.rangeCount===0)return null;let t=e.toString();if(!t.trim())return null;let i=n0(e.anchorNode),n=n0(e.focusNode);if(!i||!n)return null;let r=i.closest("[data-quote-root]");if(!r||r!==n.closest("[data-quote-root]")||i.closest(eO)||n.closest(eO))return null;let s=e.getRangeAt(0),o=n0(s.commonAncestorContainer)?.closest("[data-quote-src]")?.getAttribute("data-quote-src")||void 0;return{range:s,text:t,root:r,src:o}}function hP(e){let t=e;for(;t&&t!==document.body;){let s=getComputedStyle(t).overflowY;if(s==="auto"||s==="scroll")break;t=t.parentElement}let i=(t&&t!==document.body?t:document.documentElement).getBoundingClientRect(),n=Math.min(i.bottom,window.innerHeight),r=document.querySelector(".composer");return e.getAttribute("data-quote-root")==="chat"&&r&&(n=Math.min(n,r.getBoundingClientRect().top)),{left:i.left,right:i.right,top:Math.max(i.top,0)+4,bottom:n-4}}var ir,tO,nd,cP,uP,eO,iO,nO=te(()=>{ir=ie(bt(),1),tO=ie(Ks(),1);Rn();kt();wp();nd=ie(ye(),1),cP=118,uP=30,eO="input, textarea, select, [contenteditable=''], [contenteditable='true'], button, .cp-card, .qs-pop, [data-quote-off]";iO=(0,ir.memo)(function(){let[t,i]=(0,ir.useState)(null),n=(0,ir.useRef)(!1),r=(0,ir.useRef)(null),s=(0,ir.useRef)(0),a=(0,ir.useCallback)(()=>{cancelAnimationFrame(s.current),s.current=requestAnimationFrame(()=>{if(n.current)return;let l=dP(window.getSelection());if(!l){i(null);return}let c=r.current?.offsetWidth||cP,u=[...l.range.getClientRects()].map(h=>({left:h.left,top:h.top,right:h.right,bottom:h.bottom})),d=sM(u,hP(l.root),{w:c,h:uP},window.innerWidth);if(!d){i(null);return}i({text:l.text,src:l.src,left:d.left,top:d.top})})},[]);if((0,ir.useEffect)(()=>{let l=f=>{f.target?.closest?.(".qs-pop")||f.button===0&&(n.current=!0,i(null))},c=()=>{n.current&&(n.current=!1,a())},u=f=>{if(f.key==="Escape"){i(null);return}a()},d=()=>a(),h=()=>a();return document.addEventListener("pointerdown",l,!0),document.addEventListener("pointerup",c,!0),document.addEventListener("keyup",u,!0),document.addEventListener("selectionchange",d),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),()=>{document.removeEventListener("pointerdown",l,!0),document.removeEventListener("pointerup",c,!0),document.removeEventListener("keyup",u,!0),document.removeEventListener("selectionchange",d),window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h),cancelAnimationFrame(s.current)}},[a]),!t)return null;let o=()=>{window.dispatchEvent(new CustomEvent("ac-add-quote",{detail:{text:t.text,src:t.src}})),window.getSelection()?.removeAllRanges(),i(null)};return(0,tO.createPortal)((0,nd.jsxs)("button",{ref:r,type:"button",className:"qs-pop",style:{left:t.left,top:t.top},title:g("quote.addHint"),onMouseDown:l=>l.preventDefault(),onPointerDown:l=>l.preventDefault(),onClick:o,children:[(0,nd.jsx)(ne,{name:"chat",size:13}),(0,nd.jsx)("span",{children:g("quote.add")})]}),document.body)})});function sO(){let e=he(),{projects:t,threads:i}=Ge(),n=Rt(),r=id(),s=(0,mt.useMemo)(()=>ZA(lM(n.items),{showThinking:r.showThinking}),[n.items,r.showThinking]),a=(0,mt.useRef)(null),[o,l]=(0,mt.useState)(!0),[c,u]=(0,mt.useState)(!1),d=(0,mt.useRef)(wM()),h=(0,mt.useCallback)(z=>{d.current.stick=z,l(z)},[]),f=(0,mt.useCallback)(()=>{let z=a.current;z&&(z.scrollTop=z.scrollHeight,d.current.lastTop=z.scrollTop)},[]),p=t.find(z=>z.id===e.currentProjectId)??null,_=e.currentThreadId,y=_?i.find(z=>z.id===_)??null:null,m=p&&y&&y.projectId===p.id?y.id:null,v=t.length>0;(0,mt.useEffect)(()=>{m?n.open(m):n.close(),h(!0),u(!1),d.current.pointerDown=!1,d.current.intentAt=-1/0},[m,h]);let b=(0,mt.useCallback)(z=>{let I=s[z];if(!I)return 80;switch(I.kind){case"user":return 60;case"assistant":case"reasoning":return 120;case"toolgroup":return I.steps.length>bp?34:8+26*I.steps.length;case"plan":return 200;case"permission":case"question":return 120;case"todo":return 34+24*I.items.length;case"turnend":case"notice":return 30;default:return 60}},[s]),w=zA({count:s.length,getScrollElement:()=>a.current,estimateSize:b,getItemKey:z=>s[z]?.key??z,overscan:8,measureElement:z=>z.getBoundingClientRect().height});w.shouldAdjustScrollPositionOnItemSizeChange=(z,I,j)=>!d.current.stick&&z.end<=(j.scrollOffset??0)&&j.scrollDirection!=="backward",(0,mt.useEffect)(()=>{let z=I=>{let j=I.detail?.key,ve=j?s.findIndex(de=>de.key===j):-1;ve<0||(h(!1),w.scrollToIndex(ve,{align:"center"}),requestAnimationFrame(()=>{let de=a.current?.querySelector(`[data-todo-key="${CSS.escape(j)}"]`);de?.classList.remove("flash"),de?.offsetWidth,de?.classList.add("flash")}))};return window.addEventListener("ac-show-item",z),()=>window.removeEventListener("ac-show-item",z)},[s,w,h]);let k=s.length,M=(0,mt.useRef)({thread:null,n:0});(0,mt.useEffect)(()=>{let z=M.current,I=z.thread===m&&z.n>0&&k>z.n;M.current={thread:m,n:k},d.current.stick?f():I&&u(!0)},[k,m,f]);let T=w.getTotalSize();(0,mt.useLayoutEffect)(()=>{d.current.stick&&f()});let A=(0,mt.useRef)(null);!A.current&&typeof ResizeObserver<"u"&&(A.current=new ResizeObserver(()=>{d.current.stick&&f()})),(0,mt.useEffect)(()=>()=>A.current?.disconnect(),[]),(0,mt.useEffect)(()=>{let z=a.current,I=A.current;if(!z||!I)return;I.observe(z);let j=z.querySelector(".tl-wrap");return j&&I.observe(j),()=>{I.unobserve(z),j&&I.unobserve(j)}},[m,v]);let L=(0,mt.useCallback)(z=>{w.measureElement(z),z&&A.current?.observe(z)},[w]);(0,mt.useEffect)(()=>{if(!n.sentAt)return;h(!0),u(!1),f();let z=requestAnimationFrame(f);return()=>cancelAnimationFrame(z)},[n.sentAt,h,f]);let B=()=>{d.current.intentAt=performance.now()},q=z=>{B();let I=a.current;z.deltaY<0&&I&&I.scrollHeight>I.clientHeight&&d.current.stick&&h(!1)},H=z=>{(EM.has(z.key)||z.key===" "&&z.shiftKey)&&B()},P=()=>{d.current.pointerDown=!0,B()};(0,mt.useEffect)(()=>{let z=()=>{d.current.pointerDown&&(d.current.pointerDown=!1,B())};return window.addEventListener("pointerup",z),window.addEventListener("pointercancel",z),()=>{window.removeEventListener("pointerup",z),window.removeEventListener("pointercancel",z)}},[]);let x=()=>{let z=a.current;if(!z)return;let I=d.current.stick,j=xM(d.current,z,performance.now());(j!==I||j!==o)&&h(j),j&&(u(!1),z.scrollHeight-z.scrollTop-z.clientHeight>1&&f())},U=()=>{h(!0),u(!1),s.length>0&&w.scrollToIndex(s.length-1,{align:"end"}),f();let z=0,I=()=>{d.current.stick&&(f(),++z<6&&requestAnimationFrame(I))};requestAnimationFrame(I)},C=(z,I)=>{if(!m)return;let j=p?.path,ve=j&&I?.length?I.map(Ae=>({rel:Ep(j,Ae.path),isDir:Ae.isDir})).filter(Ae=>!!Ae.rel):[],de=n.status==="running"||n.status==="initializing";n.send(m,{text:z,...ve.length?{mentions:ve}:{}},I?.length?{mentions:I}:{},{optimistic:!de}).catch(Ae=>ke(g("composer.failSend")+Ze(Ae),!0))},D=()=>{n.lastUserText&&C(n.lastUserText)};if(!v)return(0,$e.jsx)("div",{className:"scroll",ref:a,children:(0,$e.jsx)(rO,{kind:"no-projects"})});if(!m)return(0,$e.jsx)("div",{className:"scroll",ref:a,children:p?(0,$e.jsxs)("div",{className:"empty-wrap",children:[(0,$e.jsx)("div",{className:"cp-hero-t",children:_e("chat.newInProject",{name:p.name})}),(0,$e.jsx)(fP,{projectId:p.id})]}):(0,$e.jsx)(rO,{kind:"pick-project"})});let R=-1;for(let z=s.length-1;z>=0;z--)if(s[z].kind==="turnend"){R=z;break}let Y=z=>{let I=[];for(let j=z-1;j>=0;j--){let ve=s[j];if(ve.kind==="user"||ve.kind==="turnend")break;ve.kind==="assistant"&&I.unshift(ve.text)}return I.join(` -`)};return(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)("div",{className:"scroll",ref:a,onScroll:x,onWheel:q,onKeyDown:H,onPointerDown:P,onTouchStart:B,onTouchMove:B,children:(0,qe.jsxs)("div",{className:"tl-wrap","data-quote-root":"chat",children:[(0,qe.jsx)("div",{style:{height:T,position:"relative"},children:w.getVirtualItems().map(z=>{let L=s[z.index];return L?(0,qe.jsx)("div",{"data-index":z.index,ref:I,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${z.start}px)`},children:(0,qe.jsx)(nM,{it:L,threadId:m,onEditResend:C,onRetryLast:z.index===R?D:void 0,replyText:L.kind==="turnend"?V(z.index):void 0})},z.key):null})}),n.items.length===0&&!n.error&&(0,qe.jsx)("div",{className:"sb-empty",children:g("chat.emptyHint")}),n.error&&(0,qe.jsx)("div",{className:"nt error",children:Tr(n.error)})]})}),!o&&(0,qe.jsxs)("button",{className:"jump",onClick:U,title:g("chat.jumpBottom"),children:[(0,qe.jsx)(re,{name:"caret"}),c&&(0,qe.jsx)("span",{className:"jd"})]}),(0,qe.jsx)(LM,{}),(0,qe.jsx)(PM,{})]})}function UM({kind:e}){let t=e==="pick-project";return(0,qe.jsxs)("div",{className:"empty-wrap workspace-empty",children:[(0,qe.jsx)("div",{className:"cp-hero-t",children:g(t?"chat.pickProjectTitle":"sidebar.noProjectsTitle")}),(0,qe.jsx)("div",{className:"cp-hero-s",children:g(t?"chat.pickProjectSub":"sidebar.noProjectsSub")}),(0,qe.jsx)("div",{className:"empty-actions",children:(0,qe.jsx)("button",{type:"button",className:"btn primary",onClick:()=>window.dispatchEvent(new CustomEvent("open-new-project")),children:g("sidebar.newProject")})})]})}function Y6({projectId:e}){let t=he(),i=ju(),[n,r]=(0,ht.useState)(""),[s,a]=(0,ht.useState)(!1),o=async()=>{if(!(!n.trim()||s)){a(!0);try{let l=await ql(),c=await Q.call("settings.get"),u=await Q.call("threads.create",{projectId:e,provider:l,model:null,mode:c.defaultMode??"default"});t.select(e,u.id),await Di.getState().send(u.id,{text:n.trim()})}catch(l){Ee(g("chat.failSend")+Ze(l),!0),a(!1)}}};return(0,qe.jsxs)("div",{className:"cp-card",style:{marginTop:18},children:[(0,qe.jsx)("textarea",{className:"cp-ta",rows:3,placeholder:g("chat.emptyPlaceholder"),value:n,onChange:l=>r(l.target.value),onKeyDown:l=>{if(Qn(l.nativeEvent))return;let c=l.ctrlKey||l.metaKey;(i.sendKey==="ctrlEnter"?l.key==="Enter"&&c:l.key==="Enter"&&!l.shiftKey&&!c)&&(l.preventDefault(),o())}}),(0,qe.jsxs)("div",{className:"cp-bar",children:[(0,qe.jsx)("span",{className:"dlg-hint",children:g("chat.autoNewThread")}),(0,qe.jsx)("div",{className:"cp-right",children:(0,qe.jsx)("button",{className:"cp-send",disabled:!n.trim()||s,onClick:()=>{o()},title:g("common.send"),children:(0,qe.jsx)(re,{name:"send"})})})]})]})}var ht,qe,FM=ae(()=>{ht=ne(pt(),1);Fl();yA();Qi();An();yo();Ku();$u();Db();oM();IM();HM();Mn();Hi();fr();gp();Sp();Ct();qe=ne(be(),1)});function $M({onClose:e}){let{projects:t,threads:i,providers:n}=Ke(),r=he(),[s,a]=(0,Xr.useState)(""),[o,l]=(0,Xr.useState)(0),c=(0,Xr.useRef)(null);(0,Xr.useEffect)(()=>{c.current?.focus()},[]);let u=(0,Xr.useMemo)(()=>{let f=[],p=s.trim().toLowerCase(),_=m=>!p||m.toLowerCase().includes(p),y=[[g("palette.actNewThread"),()=>{let m=r.currentProjectId??t[0]?.id;m&&h(m)}],[g("palette.actSettings"),()=>window.dispatchEvent(new CustomEvent("open-settings"))],[g("palette.actTheme"),()=>{V6()}],[g("palette.actChanges"),()=>r.openPanel("changes")],[g("palette.actFiles"),()=>r.openPanel("files")],[g("palette.actTerminal"),()=>r.openPanel("terminal")],[g("palette.actImport"),()=>{let m=r.currentProjectId??t[0]?.id;m&&window.dispatchEvent(new CustomEvent("open-import",{detail:{projectId:m}}))}]];for(let[m,v]of y)_(m)&&f.push({id:`act:${m}`,label:m,hint:g("palette.hintAction"),run:v});for(let m of t)_(m.name)&&f.push({id:`p:${m.id}`,label:m.name,hint:g("palette.hintProject"),run:()=>r.select(m.id,null)});for(let m of i){let v=t.find(w=>w.id===m.projectId),b=`${m.title} ${v?.name??""}`;_(b)&&f.push({id:`t:${m.id}`,label:m.title,hint:v?.name??g("palette.hintThread"),run:()=>r.select(m.projectId,m.id)})}return f.slice(0,30)},[s,t,i]);(0,Xr.useEffect)(()=>{l(0)},[s]);let d=f=>{if(f.key==="ArrowDown")f.preventDefault(),l(p=>Math.min(u.length-1,p+1));else if(f.key==="ArrowUp")f.preventDefault(),l(p=>Math.max(0,p-1));else if(f.key==="Enter"&&!Qn(f.nativeEvent)){f.preventDefault();let p=u[o];p&&(e(),p.run())}else f.key==="Escape"&&(f.preventDefault(),e())};async function h(f){try{let p=await Q.call("settings.get"),_=await ql(),y=await Q.call("threads.create",{projectId:f,provider:_,mode:p.defaultMode??"default"});he.getState().select(f,y.id)}catch(p){Ee(g("palette.failNew")+Ze(p),!0)}}return(0,WM.createPortal)((0,Vr.jsx)("div",{className:"dlg-scrim",style:{alignItems:"flex-start",paddingTop:"14vh"},onPointerDown:f=>{f.target===f.currentTarget&&e()},children:(0,Vr.jsxs)("div",{className:"dlg cpal",role:"dialog","aria-label":g("palette.aria"),children:[(0,Vr.jsx)("input",{ref:c,className:"cpal-in",placeholder:g("palette.placeholder"),value:s,onChange:f=>a(f.target.value),onKeyDown:d}),(0,Vr.jsxs)("div",{className:"cpal-list",children:[u.map((f,p)=>(0,Vr.jsxs)("button",{className:`cpal-item${p===o?" on":""}`,onMouseEnter:()=>l(p),onClick:()=>{e(),f.run()},children:[(0,Vr.jsx)("span",{className:"cpal-label",children:f.label}),f.hint&&(0,Vr.jsx)("span",{className:"cpal-hint",children:f.hint})]},f.id)),u.length===0&&(0,Vr.jsx)("div",{className:"sb-empty",children:g("palette.noMatch")})]})]})}),document.body)}async function V6(){let e=pk()==="dark"?"light":"dark";Wr(e);try{await Q.call("settings.set",{patch:{theme:e}})}catch{}}var Xr,WM,Vr,KM=ae(()=>{yu();Xr=ne(pt(),1);Fl();WM=ne(qs(),1);An();Qi();Hi();fr();Ct();Vr=ne(be(),1)});function Q6(e){return e.replace(/\r?\n/g,"\r")}function J6(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function eP(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function tP(e,t,i,n){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");JO(r,t,i,n)}}function JO(e,t,i,n){e=Q6(e),e=J6(e,i.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function eR(e,t,i){let n=i.getBoundingClientRect(),r=e.clientX-n.left-10,s=e.clientY-n.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${s}px`,t.style.zIndex="1000",t.focus()}function YM(e,t,i,n,r){eR(e,t,i),r&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function Na(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Kp(e,t=0,i=e.length){let n="";for(let r=t;r65535?(s-=65536,n+=String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):n+=String.fromCharCode(s)}return n}function rP(e){return e[d0]||[]}function yi(e){if(jb.has(e))return jb.get(e);let t=function(i,n,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");sP(t,i,r)};return t._id=e,jb.set(e,t),t}function sP(e,t,i){t[VM]===t?t[d0].push({id:e,index:i}):(t[d0]=[{id:e,index:i}],t[VM]=t)}function lP(e,t){if(confirm(`Do you want to navigate to ${t}? +`)};return(0,$e.jsxs)($e.Fragment,{children:[(0,$e.jsx)("div",{className:"scroll",ref:a,onScroll:x,onWheel:q,onKeyDown:H,onPointerDown:P,onTouchStart:B,onTouchMove:B,children:(0,$e.jsxs)("div",{className:"tl-wrap","data-quote-root":"chat",children:[(0,$e.jsx)("div",{style:{height:T,position:"relative"},children:w.getVirtualItems().map(z=>{let I=s[z.index];return I?(0,$e.jsx)("div",{"data-index":z.index,ref:L,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${z.start}px)`,...!n.error&&z.index===s.length-1?{paddingBottom:"var(--tl-pad-b)"}:{}},children:(0,$e.jsx)(SM,{it:I,threadId:m,onEditResend:C,onRetryLast:z.index===R?D:void 0,replyText:I.kind==="turnend"?Y(z.index):void 0})},z.key):null})}),n.items.length===0&&!n.error&&(0,$e.jsx)("div",{className:"sb-empty",children:g("chat.emptyHint")}),n.error&&(0,$e.jsx)("div",{className:"nt error",children:Ar(n.error)})]})}),!o&&(0,$e.jsxs)("button",{className:"jump",onClick:U,title:g("chat.jumpBottom"),children:[(0,$e.jsx)(ne,{name:"caret"}),c&&(0,$e.jsx)("span",{className:"jd"})]}),(0,$e.jsx)(QM,{}),(0,$e.jsx)(iO,{})]})}function rO({kind:e}){let t=e==="pick-project";return(0,$e.jsxs)("div",{className:"empty-wrap workspace-empty",children:[(0,$e.jsx)("div",{className:"cp-hero-t",children:g(t?"chat.pickProjectTitle":"sidebar.noProjectsTitle")}),(0,$e.jsx)("div",{className:"cp-hero-s",children:g(t?"chat.pickProjectSub":"sidebar.noProjectsSub")}),(0,$e.jsx)("div",{className:"empty-actions",children:(0,$e.jsx)("button",{type:"button",className:"btn primary",onClick:()=>window.dispatchEvent(new CustomEvent("open-new-project")),children:g("sidebar.newProject")})})]})}function fP({projectId:e}){let t=he(),i=id(),[n,r]=(0,mt.useState)(""),[s,a]=(0,mt.useState)(!1),o=async()=>{if(!(!n.trim()||s)){a(!0);try{let l=await Wl(),c=await Z.call("settings.get"),u=await Z.call("threads.create",{projectId:e,provider:l,model:null,mode:c.defaultMode??"default"});t.select(e,u.id),await Rt.getState().send(u.id,{text:n.trim()})}catch(l){ke(g("chat.failSend")+Ze(l),!0),a(!1)}}};return(0,$e.jsxs)("div",{className:"cp-card",style:{marginTop:18},children:[(0,$e.jsx)("textarea",{className:"cp-ta",rows:3,placeholder:g("chat.emptyPlaceholder"),value:n,onChange:l=>r(l.target.value),onKeyDown:l=>{if(er(l.nativeEvent))return;let c=l.ctrlKey||l.metaKey;(i.sendKey==="ctrlEnter"?l.key==="Enter"&&c:l.key==="Enter"&&!l.shiftKey&&!c)&&(l.preventDefault(),o())}}),(0,$e.jsxs)("div",{className:"cp-bar",children:[(0,$e.jsx)("span",{className:"dlg-hint",children:g("chat.autoNewThread")}),(0,$e.jsx)("div",{className:"cp-right",children:(0,$e.jsx)("button",{className:"cp-send",disabled:!n.trim()||s,onClick:()=>{o()},title:g("common.send"),children:(0,$e.jsx)(ne,{name:"send"})})})]})]})}var mt,$e,aO=te(()=>{mt=ie(bt(),1);Kl();BA();en();On();Co();ed();Ju();Wb();kM();JM();nO();Rn();qi();_r();kp();Mp();kt();$e=ie(ye(),1)});function lO({onClose:e}){let{projects:t,threads:i,providers:n}=Ge(),r=he(),[s,a]=(0,Zr.useState)(""),[o,l]=(0,Zr.useState)(0),c=(0,Zr.useRef)(null);(0,Zr.useEffect)(()=>{c.current?.focus()},[]);let u=(0,Zr.useMemo)(()=>{let f=[],p=s.trim().toLowerCase(),_=m=>!p||m.toLowerCase().includes(p),y=[[g("palette.actNewThread"),()=>{let m=r.currentProjectId??t[0]?.id;m&&h(m)}],[g("palette.actSettings"),()=>window.dispatchEvent(new CustomEvent("open-settings"))],[g("palette.actTheme"),()=>{pP()}],[g("palette.actChanges"),()=>r.openPanel("changes")],[g("palette.actFiles"),()=>r.openPanel("files")],[g("palette.actTerminal"),()=>r.openPanel("terminal")],[g("palette.actImport"),()=>{let m=r.currentProjectId??t[0]?.id;m&&window.dispatchEvent(new CustomEvent("open-import",{detail:{projectId:m}}))}]];for(let[m,v]of y)_(m)&&f.push({id:`act:${m}`,label:m,hint:g("palette.hintAction"),run:v});for(let m of t)_(m.name)&&f.push({id:`p:${m.id}`,label:m.name,hint:g("palette.hintProject"),run:()=>r.select(m.id,null)});for(let m of i){let v=t.find(w=>w.id===m.projectId),b=`${m.title} ${v?.name??""}`;_(b)&&f.push({id:`t:${m.id}`,label:m.title,hint:v?.name??g("palette.hintThread"),run:()=>r.select(m.projectId,m.id)})}return f.slice(0,30)},[s,t,i]);(0,Zr.useEffect)(()=>{l(0)},[s]);let d=f=>{if(f.key==="ArrowDown")f.preventDefault(),l(p=>Math.min(u.length-1,p+1));else if(f.key==="ArrowUp")f.preventDefault(),l(p=>Math.max(0,p-1));else if(f.key==="Enter"&&!er(f.nativeEvent)){f.preventDefault();let p=u[o];p&&(e(),p.run())}else f.key==="Escape"&&(f.preventDefault(),e())};async function h(f){try{let p=await Z.call("settings.get"),_=await Wl(),y=await Z.call("threads.create",{projectId:f,provider:_,mode:p.defaultMode??"default"});he.getState().select(f,y.id)}catch(p){ke(g("palette.failNew")+Ze(p),!0)}}return(0,oO.createPortal)((0,Xr.jsx)("div",{className:"dlg-scrim",style:{alignItems:"flex-start",paddingTop:"14vh"},onPointerDown:f=>{f.target===f.currentTarget&&e()},children:(0,Xr.jsxs)("div",{className:"dlg cpal",role:"dialog","aria-label":g("palette.aria"),children:[(0,Xr.jsx)("input",{ref:c,className:"cpal-in",placeholder:g("palette.placeholder"),value:s,onChange:f=>a(f.target.value),onKeyDown:d}),(0,Xr.jsxs)("div",{className:"cpal-list",children:[u.map((f,p)=>(0,Xr.jsxs)("button",{className:`cpal-item${p===o?" on":""}`,onMouseEnter:()=>l(p),onClick:()=>{e(),f.run()},children:[(0,Xr.jsx)("span",{className:"cpal-label",children:f.label}),f.hint&&(0,Xr.jsx)("span",{className:"cpal-hint",children:f.hint})]},f.id)),u.length===0&&(0,Xr.jsx)("div",{className:"sb-empty",children:g("palette.noMatch")})]})]})}),document.body)}async function pP(){let e=Ek()==="dark"?"light":"dark";Kr(e);try{await Z.call("settings.set",{patch:{theme:e}})}catch{}}var Zr,oO,Xr,cO=te(()=>{Tu();Zr=ie(bt(),1);Kl();oO=ie(Ks(),1);On();en();qi();_r();kt();Xr=ie(ye(),1)});function _P(e){return e.replace(/\r?\n/g,"\r")}function vP(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function bP(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function yP(e,t,i,n){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");_R(r,t,i,n)}}function _R(e,t,i,n){e=_P(e),e=vP(e,i.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function vR(e,t,i){let n=i.getBoundingClientRect(),r=e.clientX-n.left-10,s=e.clientY-n.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${s}px`,t.style.zIndex="1000",t.focus()}function hO(e,t,i,n,r){vR(e,t,i),r&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function Da(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function em(e,t=0,i=e.length){let n="";for(let r=t;r65535?(s-=65536,n+=String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):n+=String.fromCharCode(s)}return n}function xP(e){return e[w0]||[]}function yi(e){if(r0.has(e))return r0.get(e);let t=function(i,n,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");EP(t,i,r)};return t._id=e,r0.set(e,t),t}function EP(e,t,i){t[fO]===t?t[w0].push({id:e,index:i}):(t[w0]=[{id:e,index:i}],t[fO]=t)}function TP(e,t){if(confirm(`Do you want to navigate to ${t}? -WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}function Np(e){hP(e)||dP.onUnexpectedError(e)}function hP(e){return e instanceof fP?!0:e instanceof Error&&e.name===f0&&e.message===f0}function pP(e){return e?new Error(`Illegal argument: ${e}`):new Error("Illegal argument")}function mP(e,t,i=0,n=e.length){let r=i,s=n;for(;rt(e(i),e(n))}function bP(e,t){let i=Object.create(null);for(let n of e){let r=t(n),s=i[r];s||(s=i[r]=[]),s.push(n)}return i}function SP(e,t){let i=this,n=!1,r;return function(){if(n)return r;if(n=!0,t)try{r=e.apply(i,arguments)}finally{t()}else r=e.apply(i,arguments);return r}}function EP(e){Co=e}function jp(e){return Co?.trackDisposable(e),e}function Yp(e){Co?.markAsDisposed(e)}function hd(e,t){Co?.setParent(e,t)}function kP(e,t){if(Co)for(let i of e)Co.setParent(i,t)}function eO(e){return Co?.markAsSingleton(e),e}function To(e){if(v0.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(n){t.push(n)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function CP(...e){let t=wt(()=>To(e));return kP(e,t),t}function wt(e){let t=jp({dispose:SP(()=>{Yp(t),e()})});return t}function HP(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}function UP(e){return J0.INSTANCE.getZoomFactor(e)}function qP(){return Rp}function nH(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return C0.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(k0)switch(t){case 59:return 85;case 60:if(VP)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Jr)return 57;break}else if(Op&&(Jr&&t===93||!Jr&&t===92))return 57;return eH[t]||0}function lH(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if(t.origin!=="null"&&i.origin!=="null"&&t.origin!==i.origin)return null}catch{return null}return e.parent}function fH(e){return 55296<=e&&e<=56319}function fO(e){return 56320<=e&&e<=57343}function pH(e,t){return(e-55296<<10)+(t-56320)+65536}function mH(e){return ny(e,0)}function ny(e,t){switch(typeof e){case"object":return e===null?Os(349,t):Array.isArray(e)?_H(e,t):vH(e,t);case"string":return CR(e,t);case"boolean":return gH(e,t);case"number":return Os(e,t);case"undefined":return Os(937,t);default:return Os(617,t)}}function Os(e,t){return(t<<5)-t+e|0}function gH(e,t){return Os(e?433:863,t)}function CR(e,t){t=Os(149417,t);for(let i=0,n=e.length;iny(n,i),t)}function vH(e,t){return t=Os(181387,t),Object.keys(e).sort().reduce((i,n)=>(i=CR(n,i),ny(e[n],i)),t)}function Qb(e,t,i=32){let n=i-t,r=~((1<>>n)>>>0}function pO(e,t=0,i=e.byteLength,n=0){for(let r=0;ri.toString(16).padStart(2,"0")).join(""):bH((e>>>0).toString(16),t/4)}function ke(e,t,i,n){return new wH(e,t,i,n)}function xH(e,t){return function(i){return t(new id(e,i))}}function EH(e){return function(t){return e(new T0(t))}}function TH(e){let t=e.getBoundingClientRect(),i=wr(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}function NR(e,t,i,...n){let r=NH.exec(t);if(!r)throw new Error("Bad use of emmet");let s=r[1]||"div",a;return e!=="http://www.w3.org/1999/xhtml"?a=document.createElementNS(e,s):a=document.createElement(s),r[3]&&(a.id=r[3]),r[4]&&(a.className=r[4].replace(/\./g," ").trim()),i&&Object.entries(i).forEach(([o,l])=>{typeof l>"u"||(/^on\w+$/.test(o)?a[o]=l:o==="selected"?l&&a.setAttribute(o,"true"):a.setAttribute(o,l))}),a.append(...n),a}function AH(e,t,...i){return NR("http://www.w3.org/1999/xhtml",e,t,...i)}function mn(e){return typeof e=="number"?`${e}px`:e}function cd(e){return new MH(e)}function OH(e,t,i){let n=null,r=null;if(typeof i.value=="function"?(n="value",r=i.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(n="get",r=i.get),!r)throw new Error("not supported");let s=`$memoize$${t}`;i[n]=function(...a){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,a)}),this[s]}}function e0(e,t){let i=t-e;return function(n){return e+i*PH(n)}}function zH(e,t,i){return function(n){return ne?"D":"C",pd(Math.abs(r-e),fd(a,n));a=s>t?"D":"C";let o=Math.abs(s-t),l=wU(s>t?e:r,i)+(o-1)*i.cols+1+SU(s>t?r:e,i);return pd(l,fd(a,n))}function SU(e,t){return e-1}function wU(e,t){return t.cols-e}function xU(e,t,i,n,r,s){return Xp(t,n,r,s).length===0?"":pd(UR(e,t,e,t-No(t,r),!1,r).length,fd("D",s))}function Xp(e,t,i,n){let r=e-No(e,i),s=t-No(t,i),a=Math.abs(r-s)-kU(e,t,i);return pd(a,fd(HR(e,t),n))}function EU(e,t,i,n,r,s){let a;Xp(t,n,r,s).length>0?a=n-No(n,r):a=t;let o=n,l=CU(e,t,i,n,r,s);return pd(UR(e,a,i,o,l==="C",r).length,fd(l,s))}function kU(e,t,i){let n=0,r=e-No(e,i),s=t-No(t,i);for(let a=0;a=0&&e0?a=n-No(n,r):a=t,e=i&&at?"A":"B"}function UR(e,t,i,n,r,s){let a=e,o=t,l="";for(;(a!==i||o!==n)&&o>=0&&os.cols-1?(l+=s.buffer.translateBufferLineToString(o,!1,e,a),a=0,e=0,o++):!r&&a<0&&(l+=s.buffer.translateBufferLineToString(o,!1,0,e+1),a=s.cols-1,e=a,o--);return l+s.buffer.translateBufferLineToString(o,!1,e,a)}function fd(e,t){let i=t?"O":"[";return $.ESC+i+e}function pd(e,t){e=Math.floor(e);let i="";for(let n=0;ne.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}function ot(e,t){if(e!==void 0)try{return Mt.toColor(e)}catch{}return t}function HU(e,t,i,n,r,s){let a=[];for(let o=0;o=o&&n0&&(y>d||u[y].getTrimmedLength()===0);y--)_++;_>0&&(a.push(o+u.length-_),a.push(_)),o+=u.length-1}return a}function UU(e,t){let i=[],n=0,r=t[n],s=0;for(let a=0;amd(e,c,t)).reduce((l,c)=>l+c),s=0,a=0,o=0;for(;ol&&(s-=l,a++);let c=e[a].getWidth(s-1)===2;c&&s--;let u=c?i-1:i;n.push(u),o+=u}return n}function md(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let n=!e[t].hasContent(i-1)&&e[t].getWidth(i-1)===1,r=e[t+1].getWidth(0)===2;return n&&r?i-1:i}function jU(e){return e==="block"||e==="underline"||e==="bar"}function ad(e,t=5){if(typeof e!="object")return e;let i=Array.isArray(e)?[]:{};for(let n in e)i[n]=t<=1?e[n]:e[n]&&ad(e[n],t-1);return i}function r0(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(i|=64,i|=e.action):(i|=e.button&3,e.button&4&&(i|=64),e.button&8&&(i|=128),e.action===32?i|=32:e.action===0&&!t&&(i|=3)),i}function VU(e,t){let i=0,n=t.length-1,r;if(et[n][1])return!1;for(;n>=i;)if(r=i+n>>1,e>t[r][1])i=r+1;else if(e>4:s>>8}return n}}function o0(e,t){let i=e.toString(16),n=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}function a8(e,t=16){let[i,n,r]=e;return`rgb:${o0(i,t)}/${o0(n,t)}/${o0(r,t)}`}function FO(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}function KO(e){return 0<=e&&e<256}function p8(e,t,i,n){let r={type:0,cancel:!1,key:void 0},s=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?r.key=$.ESC+"OA":r.key=$.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=$.ESC+"OD":r.key=$.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=$.ESC+"OC":r.key=$.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=$.ESC+"OB":r.key=$.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":$.DEL,e.altKey&&(r.key=$.ESC+r.key);break;case 9:if(e.shiftKey){r.key=$.ESC+"[Z";break}r.key=$.HT,r.cancel=!0;break;case 13:r.key=e.altKey?$.ESC+$.CR:$.CR,r.cancel=!0;break;case 27:r.key=$.ESC,e.altKey&&(r.key=$.ESC+$.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;s?r.key=$.ESC+"[1;"+(s+1)+"D":t?r.key=$.ESC+"OD":r.key=$.ESC+"[D";break;case 39:if(e.metaKey)break;s?r.key=$.ESC+"[1;"+(s+1)+"C":t?r.key=$.ESC+"OC":r.key=$.ESC+"[C";break;case 38:if(e.metaKey)break;s?r.key=$.ESC+"[1;"+(s+1)+"A":t?r.key=$.ESC+"OA":r.key=$.ESC+"[A";break;case 40:if(e.metaKey)break;s?r.key=$.ESC+"[1;"+(s+1)+"B":t?r.key=$.ESC+"OB":r.key=$.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=$.ESC+"[2~");break;case 46:s?r.key=$.ESC+"[3;"+(s+1)+"~":r.key=$.ESC+"[3~";break;case 36:s?r.key=$.ESC+"[1;"+(s+1)+"H":t?r.key=$.ESC+"OH":r.key=$.ESC+"[H";break;case 35:s?r.key=$.ESC+"[1;"+(s+1)+"F":t?r.key=$.ESC+"OF":r.key=$.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=$.ESC+"[5;"+(s+1)+"~":r.key=$.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=$.ESC+"[6;"+(s+1)+"~":r.key=$.ESC+"[6~";break;case 112:s?r.key=$.ESC+"[1;"+(s+1)+"P":r.key=$.ESC+"OP";break;case 113:s?r.key=$.ESC+"[1;"+(s+1)+"Q":r.key=$.ESC+"OQ";break;case 114:s?r.key=$.ESC+"[1;"+(s+1)+"R":r.key=$.ESC+"OR";break;case 115:s?r.key=$.ESC+"[1;"+(s+1)+"S":r.key=$.ESC+"OS";break;case 116:s?r.key=$.ESC+"[15;"+(s+1)+"~":r.key=$.ESC+"[15~";break;case 117:s?r.key=$.ESC+"[17;"+(s+1)+"~":r.key=$.ESC+"[17~";break;case 118:s?r.key=$.ESC+"[18;"+(s+1)+"~":r.key=$.ESC+"[18~";break;case 119:s?r.key=$.ESC+"[19;"+(s+1)+"~":r.key=$.ESC+"[19~";break;case 120:s?r.key=$.ESC+"[20;"+(s+1)+"~":r.key=$.ESC+"[20~";break;case 121:s?r.key=$.ESC+"[21;"+(s+1)+"~":r.key=$.ESC+"[21~";break;case 122:s?r.key=$.ESC+"[23;"+(s+1)+"~":r.key=$.ESC+"[23~";break;case 123:s?r.key=$.ESC+"[24;"+(s+1)+"~":r.key=$.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?r.key=$.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=$.DEL:e.keyCode===219?r.key=$.ESC:e.keyCode===220?r.key=$.FS:e.keyCode===221&&(r.key=$.GS);else if((!i||n)&&e.altKey&&!e.metaKey){let a=f8[e.keyCode]?.[e.shiftKey?1:0];if(a)r.key=$.ESC+a;else if(e.keyCode>=65&&e.keyCode<=90){let o=e.ctrlKey?e.keyCode-64:e.keyCode+32,l=String.fromCharCode(o);e.shiftKey&&(l=l.toUpperCase()),r.key=$.ESC+l}else if(e.keyCode===32)r.key=$.ESC+(e.ctrlKey?$.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let o=e.code.slice(3,4);e.shiftKey||(o=o.toLowerCase()),r.key=$.ESC+o,r.cancel=!0}}else i&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(r.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?r.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(r.key=$.US),e.key==="@"&&(r.key=$.NUL));break}return r}function y8(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}function w8(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var QO,X6,Z6,Pt,ce,GM,c0,jM,u0,iP,nP,tR,Aa,gd,zp,nr,VM,d0,jb,en,sR,Ao,aP,Z0,aR,tn,oR,oP,_d,h0,Gp,Ds,Q0,Ls,cP,lR,uc,cR,uP,dP,f0,fP,XM,m0,gP,g0,vP,ZM,QM,JM,g$,yP,v0,wP,Co,xP,fR,Ma,Le,cc,Pn,b0,Dt,tO,TP,NP,AP,iO,MP,bi,S0,OP,nO,gR,RP,x0,DP,LP,IP,Ap,zP,BP,Mp,ee,PP,E0,J0,v$,b$,dc,k0,Op,ey,bR,y$,S$,Rp,lc,Bp,Pp,ld,FP,yR,SR,WP,$P,KP,GP,xp,Dp,rO,jP,Ms,Rs,Bn,wR,YP,Yb,xR,Jr,VP,Vb,XP,w$,es,Ea,sO,ZP,QP,JP,x$,E$,k$,C$,ka,T$,ty,Xb,aO,oO,eH,C0,tH,iH,rH,sH,aH,oH,T0,lO,cH,id,cO,kR,uO,uH,iy,dH,hH,Zb,dO,hO,yH,N$,wr,A$,M$,O$,mO,R$,D$,SH,L$,I$,wH,gO,kH,Hp,CH,Jb,_O,z$,mi,NH,MH,AR,Sr,nd,RH,ry,vO,DH,LH,IH,bO,yO,HH,UH,MR,OR,qH,FH,WH,SO,wO,$H,O0,KH,GH,jH,R0,D0,VH,Zr,Ca,Xu,Up,$,ud,L0,I0,gi,_i,vi,Bt,xO,Wt,bt,Mt,Wi,dd,XH,qp,z0,tU,iU,t0,er,kp,kO,Zu,Cp,rU,B0,P0,RR,sU,aU,oU,lU,cU,H0,dU,DR,Vp,vd,bd,LR,hU,IR,Fp,pU,mU,zR,ay,BR,PR,gU,_U,Wp,vU,U0,bU,TU,i0,NU,AU,MU,OU,RU,q0,TO,NO,ni,xo,rd,AO,MO,Qu,DU,F0,LU,IU,zU,BU,W0,PU,OO,ze,Zt,Tp,n0,sd,FR,WU,si,Eo,RO,DO,$U,$R,KR,$0,oc,KU,GU,LO,IO,K0,zO,s0,BO,G0,a0,YU,ri,XU,ko,ZU,Ju,QU,GR,ed,JU,zn,td,e8,od,HO,t8,ir,i8,n8,r8,s8,o8,Ta,qO,WO,$O,l8,Y0,c8,GO,u8,d8,V0,jO,h8,f8,Ft,m8,l0,YO,g8,_8,v8,b8,VO,XO,$p,X0,S8,x8,E8,ZO,k8,C8,T8,N8,Qr,jR,YR=ae(()=>{QO=Object.defineProperty,X6=Object.getOwnPropertyDescriptor,Z6=(e,t)=>{for(var i in t)QO(e,i,{get:t[i],enumerable:!0})},Pt=(e,t,i,n)=>{for(var r=n>1?void 0:n?X6(t,i):t,s=e.length-1,a;s>=0;s--)(a=e[s])&&(r=(n?a(t,i,r):a(r))||r);return n&&r&&QO(t,i,r),r},ce=(e,t)=>(i,n)=>t(i,n,e),GM="Terminal input",c0={get:()=>GM,set:e=>GM=e},jM="Too much output to announce, navigate to rows manually to read",u0={get:()=>jM,set:e=>jM=e};iP=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let n=0,r=0;if(this._interim){let s=e.charCodeAt(r++);56320<=s&&s<=57343?t[n++]=(this._interim-55296)*1024+s-56320+65536:(t[n++]=this._interim,t[n++]=s),this._interim=0}for(let s=r;s=i)return this._interim=a,n;let o=e.charCodeAt(s);56320<=o&&o<=57343?t[n++]=(a-55296)*1024+o-56320+65536:(t[n++]=a,t[n++]=o);continue}a!==65279&&(t[n++]=a)}return n}},nP=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let n=0,r,s,a,o,l=0,c=0;if(this.interim[0]){let h=!1,f=this.interim[0];f&=(f&224)===192?31:(f&240)===224?15:7;let p=0,_;for(;(_=this.interim[++p]&63)&&p<4;)f<<=6,f|=_;let y=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,m=y-p;for(;c=i)return 0;if(_=e[c++],(_&192)!==128){c--,h=!0;break}else this.interim[p++]=_,f<<=6,f|=_&63}h||(y===2?f<128?c--:t[n++]=f:y===3?f<2048||f>=55296&&f<=57343||f===65279||(t[n++]=f):f<65536||f>1114111||(t[n++]=f)),this.interim.fill(0)}let u=i-4,d=c;for(;d=i)return this.interim[0]=r,n;if(s=e[d++],(s&192)!==128){d--;continue}if(l=(r&31)<<6|s&63,l<128){d--;continue}t[n++]=l}else if((r&240)===224){if(d>=i)return this.interim[0]=r,n;if(s=e[d++],(s&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=s,n;if(a=e[d++],(a&192)!==128){d--;continue}if(l=(r&15)<<12|(s&63)<<6|a&63,l<2048||l>=55296&&l<=57343||l===65279)continue;t[n++]=l}else if((r&248)===240){if(d>=i)return this.interim[0]=r,n;if(s=e[d++],(s&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=s,n;if(a=e[d++],(a&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=s,this.interim[2]=a,n;if(o=e[d++],(o&192)!==128){d--;continue}if(l=(r&7)<<18|(s&63)<<12|(a&63)<<6|o&63,l<65536||l>1114111)continue;t[n++]=l}}return n}},tR="",Aa=" ",gd=class iR{constructor(){this.fg=0,this.bg=0,this.extended=new zp}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new iR;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},zp=class nR{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new nR(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},nr=class rR extends gd{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new zp,this.combinedData=""}static fromCharData(t){let i=new rR;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Na(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},VM="di$target",d0="di$dependencies",jb=new Map;en=yi("BufferService"),sR=yi("CoreMouseService"),Ao=yi("CoreService"),aP=yi("CharsetService"),Z0=yi("InstantiationService"),aR=yi("LogService"),tn=yi("OptionsService"),oR=yi("OscLinkService"),oP=yi("UnicodeService"),_d=yi("DecorationService"),h0=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let n=[],r=this._optionsService.rawOptions.linkHandler,s=new nr,a=i.getTrimmedLength(),o=-1,l=-1,c=!1;for(let u=0;ur?r.activate(p,_,h):lP(p,_),hover:(p,_)=>r?.hover?.(p,_,h),leave:(p,_)=>r?.leave?.(p,_,h)})}c=!1,s.hasExtendedAttrs()&&s.extended.urlId?(l=u,o=s.extended.urlId):(l=-1,o=-1)}}t(n)}};h0=Pt([ce(0,en),ce(1,tn),ce(2,oR)],h0);Gp=yi("CharSizeService"),Ds=yi("CoreBrowserService"),Q0=yi("MouseService"),Ls=yi("RenderService"),cP=yi("SelectionService"),lR=yi("CharacterJoinerService"),uc=yi("ThemeService"),cR=yi("LinkProviderService"),uP=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?XM.isErrorNoTelemetry(e)?new XM(e.message+` +WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}function Bp(e){OP(e)||MP.onUnexpectedError(e)}function OP(e){return e instanceof RP?!0:e instanceof Error&&e.name===E0&&e.message===E0}function DP(e){return e?new Error(`Illegal argument: ${e}`):new Error("Illegal argument")}function LP(e,t,i=0,n=e.length){let r=i,s=n;for(;rt(e(i),e(n))}function PP(e,t){let i=Object.create(null);for(let n of e){let r=t(n),s=i[r];s||(s=i[r]=[]),s.push(n)}return i}function UP(e,t){let i=this,n=!1,r;return function(){if(n)return r;if(n=!0,t)try{r=e.apply(i,arguments)}finally{t()}else r=e.apply(i,arguments);return r}}function $P(e){Ro=e}function im(e){return Ro?.trackDisposable(e),e}function nm(e){Ro?.markAsDisposed(e)}function Sd(e,t){Ro?.setParent(e,t)}function WP(e,t){if(Ro)for(let i of e)Ro.setParent(i,t)}function vO(e){return Ro?.markAsSingleton(e),e}function Do(e){if(A0.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(n){t.push(n)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function KP(...e){let t=Ct(()=>Do(e));return WP(e,t),t}function Ct(e){let t=im({dispose:UP(()=>{nm(t),e()})});return t}function rH(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}function sH(e){return uy.INSTANCE.getZoomFactor(e)}function aH(){return qp}function wH(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return B0.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(z0)switch(t){case 59:return 85;case 60:if(pH)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(es)return 57;break}else if(Up&&(es&&t===93||!es&&t===92))return 57;return bH[t]||0}function TH(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if(t.origin!=="null"&&i.origin!=="null"&&t.origin!==i.origin)return null}catch{return null}return e.parent}function RH(e){return 55296<=e&&e<=56319}function OO(e){return 56320<=e&&e<=57343}function DH(e,t){return(e-55296<<10)+(t-56320)+65536}function LH(e){return py(e,0)}function py(e,t){switch(typeof e){case"object":return e===null?Ds(349,t):Array.isArray(e)?zH(e,t):BH(e,t);case"string":return WR(e,t);case"boolean":return IH(e,t);case"number":return Ds(e,t);case"undefined":return Ds(937,t);default:return Ds(617,t)}}function Ds(e,t){return(t<<5)-t+e|0}function IH(e,t){return Ds(e?433:863,t)}function WR(e,t){t=Ds(149417,t);for(let i=0,n=e.length;ipy(n,i),t)}function BH(e,t){return t=Ds(181387,t),Object.keys(e).sort().reduce((i,n)=>(i=WR(n,i),py(e[n],i)),t)}function c0(e,t,i=32){let n=i-t,r=~((1<>>n)>>>0}function RO(e,t=0,i=e.byteLength,n=0){for(let r=0;ri.toString(16).padStart(2,"0")).join(""):PH((e>>>0).toString(16),t/4)}function Te(e,t,i,n){return new qH(e,t,i,n)}function FH(e,t){return function(i){return t(new dd(e,i))}}function $H(e){return function(t){return e(new P0(t))}}function GH(e){let t=e.getBoundingClientRect(),i=Cr(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}function GR(e,t,i,...n){let r=jH.exec(t);if(!r)throw new Error("Bad use of emmet");let s=r[1]||"div",a;return e!=="http://www.w3.org/1999/xhtml"?a=document.createElementNS(e,s):a=document.createElement(s),r[3]&&(a.id=r[3]),r[4]&&(a.className=r[4].replace(/\./g," ").trim()),i&&Object.entries(i).forEach(([o,l])=>{typeof l>"u"||(/^on\w+$/.test(o)?a[o]=l:o==="selected"?l&&a.setAttribute(o,"true"):a.setAttribute(o,l))}),a.append(...n),a}function YH(e,t,...i){return GR("http://www.w3.org/1999/xhtml",e,t,...i)}function _n(e){return typeof e=="number"?`${e}px`:e}function vd(e){return new VH(e)}function XH(e,t,i){let n=null,r=null;if(typeof i.value=="function"?(n="value",r=i.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(n="get",r=i.get),!r)throw new Error("not supported");let s=`$memoize$${t}`;i[n]=function(...a){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,a)}),this[s]}}function d0(e,t){let i=t-e;return function(n){return e+i*nU(n)}}function tU(e,t,i){return function(n){return ne?"D":"C",xd(Math.abs(r-e),wd(a,n));a=s>t?"D":"C";let o=Math.abs(s-t),l=qU(s>t?e:r,i)+(o-1)*i.cols+1+UU(s>t?r:e,i);return xd(l,wd(a,n))}function UU(e,t){return e-1}function qU(e,t){return t.cols-e}function FU(e,t,i,n,r,s){return sm(t,n,r,s).length===0?"":xd(r2(e,t,e,t-Lo(t,r),!1,r).length,wd("D",s))}function sm(e,t,i,n){let r=e-Lo(e,i),s=t-Lo(t,i),a=Math.abs(r-s)-WU(e,t,i);return xd(a,wd(n2(e,t),n))}function $U(e,t,i,n,r,s){let a;sm(t,n,r,s).length>0?a=n-Lo(n,r):a=t;let o=n,l=KU(e,t,i,n,r,s);return xd(r2(e,a,i,o,l==="C",r).length,wd(l,s))}function WU(e,t,i){let n=0,r=e-Lo(e,i),s=t-Lo(t,i);for(let a=0;a=0&&e0?a=n-Lo(n,r):a=t,e=i&&at?"A":"B"}function r2(e,t,i,n,r,s){let a=e,o=t,l="";for(;(a!==i||o!==n)&&o>=0&&os.cols-1?(l+=s.buffer.translateBufferLineToString(o,!1,e,a),a=0,e=0,o++):!r&&a<0&&(l+=s.buffer.translateBufferLineToString(o,!1,0,e+1),a=s.cols-1,e=a,o--);return l+s.buffer.translateBufferLineToString(o,!1,e,a)}function wd(e,t){let i=t?"O":"[";return W.ESC+i+e}function xd(e,t){e=Math.floor(e);let i="";for(let n=0;ne.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}function lt(e,t){if(e!==void 0)try{return Dt.toColor(e)}catch{}return t}function r8(e,t,i,n,r,s){let a=[];for(let o=0;o=o&&n0&&(y>d||u[y].getTrimmedLength()===0);y--)_++;_>0&&(a.push(o+u.length-_),a.push(_)),o+=u.length-1}return a}function s8(e,t){let i=[],n=0,r=t[n],s=0;for(let a=0;aEd(e,c,t)).reduce((l,c)=>l+c),s=0,a=0,o=0;for(;ol&&(s-=l,a++);let c=e[a].getWidth(s-1)===2;c&&s--;let u=c?i-1:i;n.push(u),o+=u}return n}function Ed(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let n=!e[t].hasContent(i-1)&&e[t].getWidth(i-1)===1,r=e[t+1].getWidth(0)===2;return n&&r?i-1:i}function h8(e){return e==="block"||e==="underline"||e==="bar"}function md(e,t=5){if(typeof e!="object")return e;let i=Array.isArray(e)?[]:{};for(let n in e)i[n]=t<=1?e[n]:e[n]&&md(e[n],t-1);return i}function m0(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(i|=64,i|=e.action):(i|=e.button&3,e.button&4&&(i|=64),e.button&8&&(i|=128),e.action===32?i|=32:e.action===0&&!t&&(i|=3)),i}function p8(e,t){let i=0,n=t.length-1,r;if(et[n][1])return!1;for(;n>=i;)if(r=i+n>>1,e>t[r][1])i=r+1;else if(e>4:s>>8}return n}}function v0(e,t){let i=e.toString(16),n=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}function k8(e,t=16){let[i,n,r]=e;return`rgb:${v0(i,t)}/${v0(n,t)}/${v0(r,t)}`}function aR(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}function cR(e){return 0<=e&&e<256}function D8(e,t,i,n){let r={type:0,cancel:!1,key:void 0},s=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?r.key=W.ESC+"OA":r.key=W.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=W.ESC+"OD":r.key=W.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=W.ESC+"OC":r.key=W.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=W.ESC+"OB":r.key=W.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":W.DEL,e.altKey&&(r.key=W.ESC+r.key);break;case 9:if(e.shiftKey){r.key=W.ESC+"[Z";break}r.key=W.HT,r.cancel=!0;break;case 13:r.key=e.altKey?W.ESC+W.CR:W.CR,r.cancel=!0;break;case 27:r.key=W.ESC,e.altKey&&(r.key=W.ESC+W.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;s?r.key=W.ESC+"[1;"+(s+1)+"D":t?r.key=W.ESC+"OD":r.key=W.ESC+"[D";break;case 39:if(e.metaKey)break;s?r.key=W.ESC+"[1;"+(s+1)+"C":t?r.key=W.ESC+"OC":r.key=W.ESC+"[C";break;case 38:if(e.metaKey)break;s?r.key=W.ESC+"[1;"+(s+1)+"A":t?r.key=W.ESC+"OA":r.key=W.ESC+"[A";break;case 40:if(e.metaKey)break;s?r.key=W.ESC+"[1;"+(s+1)+"B":t?r.key=W.ESC+"OB":r.key=W.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=W.ESC+"[2~");break;case 46:s?r.key=W.ESC+"[3;"+(s+1)+"~":r.key=W.ESC+"[3~";break;case 36:s?r.key=W.ESC+"[1;"+(s+1)+"H":t?r.key=W.ESC+"OH":r.key=W.ESC+"[H";break;case 35:s?r.key=W.ESC+"[1;"+(s+1)+"F":t?r.key=W.ESC+"OF":r.key=W.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=W.ESC+"[5;"+(s+1)+"~":r.key=W.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=W.ESC+"[6;"+(s+1)+"~":r.key=W.ESC+"[6~";break;case 112:s?r.key=W.ESC+"[1;"+(s+1)+"P":r.key=W.ESC+"OP";break;case 113:s?r.key=W.ESC+"[1;"+(s+1)+"Q":r.key=W.ESC+"OQ";break;case 114:s?r.key=W.ESC+"[1;"+(s+1)+"R":r.key=W.ESC+"OR";break;case 115:s?r.key=W.ESC+"[1;"+(s+1)+"S":r.key=W.ESC+"OS";break;case 116:s?r.key=W.ESC+"[15;"+(s+1)+"~":r.key=W.ESC+"[15~";break;case 117:s?r.key=W.ESC+"[17;"+(s+1)+"~":r.key=W.ESC+"[17~";break;case 118:s?r.key=W.ESC+"[18;"+(s+1)+"~":r.key=W.ESC+"[18~";break;case 119:s?r.key=W.ESC+"[19;"+(s+1)+"~":r.key=W.ESC+"[19~";break;case 120:s?r.key=W.ESC+"[20;"+(s+1)+"~":r.key=W.ESC+"[20~";break;case 121:s?r.key=W.ESC+"[21;"+(s+1)+"~":r.key=W.ESC+"[21~";break;case 122:s?r.key=W.ESC+"[23;"+(s+1)+"~":r.key=W.ESC+"[23~";break;case 123:s?r.key=W.ESC+"[24;"+(s+1)+"~":r.key=W.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?r.key=W.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=W.DEL:e.keyCode===219?r.key=W.ESC:e.keyCode===220?r.key=W.FS:e.keyCode===221&&(r.key=W.GS);else if((!i||n)&&e.altKey&&!e.metaKey){let a=R8[e.keyCode]?.[e.shiftKey?1:0];if(a)r.key=W.ESC+a;else if(e.keyCode>=65&&e.keyCode<=90){let o=e.ctrlKey?e.keyCode-64:e.keyCode+32,l=String.fromCharCode(o);e.shiftKey&&(l=l.toUpperCase()),r.key=W.ESC+l}else if(e.keyCode===32)r.key=W.ESC+(e.ctrlKey?W.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let o=e.code.slice(3,4);e.shiftKey||(o=o.toLowerCase()),r.key=W.ESC+o,r.cancel=!0}}else i&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(r.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?r.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(r.key=W.US),e.key==="@"&&(r.key=W.NUL));break}return r}function H8(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}function q8(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var gR,mP,gP,Ft,oe,uO,y0,dO,S0,SP,wP,bR,La,kd,Kp,ar,fO,w0,r0,nn,xR,Io,kP,ly,ER,rn,kR,CP,Cd,x0,tm,Is,cy,zs,NP,CR,mc,TR,AP,MP,E0,RP,pO,C0,IP,T0,BP,mO,gO,_O,$W,HP,A0,qP,Ro,FP,OR,Ia,Ie,pc,Un,M0,Bt,bO,GP,jP,YP,yO,VP,bi,R0,XP,SO,LR,ZP,L0,QP,JP,eH,Pp,tH,iH,Hp,ee,nH,I0,uy,KW,GW,gc,z0,Up,dy,BR,jW,YW,qp,fc,Gp,jp,_d,oH,PR,HR,lH,cH,uH,dH,Rp,Fp,wO,hH,Rs,Ls,Hn,UR,fH,s0,qR,es,pH,a0,mH,VW,ts,Aa,xO,gH,_H,vH,XW,ZW,QW,JW,Ma,eK,hy,o0,EO,kO,bH,B0,yH,SH,xH,EH,kH,CH,P0,CO,NH,dd,TO,$R,NO,AH,fy,MH,OH,l0,AO,MO,HH,tK,Cr,iK,nK,rK,DO,sK,aK,UH,oK,lK,qH,LO,WH,Yp,KH,u0,IO,cK,mi,jH,VH,jR,kr,hd,ZH,my,zO,QH,JH,eU,BO,PO,rU,sU,YR,VR,aU,oU,lU,HO,UO,cU,F0,uU,dU,hU,$0,W0,pU,Qr,Oa,sd,Vp,W,bd,K0,G0,gi,_i,vi,qt,qO,jt,Et,Dt,Ki,yd,mU,Xp,j0,yU,SU,h0,nr,Lp,$O,ad,Ip,xU,Y0,V0,XR,EU,kU,CU,TU,NU,X0,MU,ZR,rm,Td,Nd,QR,OU,JR,Zp,DU,LU,e2,_y,t2,i2,IU,zU,Qp,BU,Z0,PU,GU,f0,jU,YU,VU,XU,ZU,Q0,KO,GO,si,Ao,fd,jO,YO,od,QU,J0,JU,e8,t8,i8,ey,n8,VO,Be,Jt,zp,p0,pd,a2,l8,oi,Mo,XO,ZO,c8,l2,c2,ty,hc,u8,d8,QO,JO,iy,eR,g0,tR,ny,_0,f8,ai,m8,Oo,g8,ld,_8,u2,cd,v8,Pn,ud,b8,gd,nR,y8,sr,S8,w8,x8,E8,C8,Ra,sR,oR,lR,T8,sy,N8,uR,A8,M8,ay,dR,O8,R8,Gt,L8,b0,hR,I8,z8,B8,P8,fR,pR,Jp,oy,U8,F8,$8,mR,W8,K8,G8,j8,Jr,d2,h2=te(()=>{gR=Object.defineProperty,mP=Object.getOwnPropertyDescriptor,gP=(e,t)=>{for(var i in t)gR(e,i,{get:t[i],enumerable:!0})},Ft=(e,t,i,n)=>{for(var r=n>1?void 0:n?mP(t,i):t,s=e.length-1,a;s>=0;s--)(a=e[s])&&(r=(n?a(t,i,r):a(r))||r);return n&&r&&gR(t,i,r),r},oe=(e,t)=>(i,n)=>t(i,n,e),uO="Terminal input",y0={get:()=>uO,set:e=>uO=e},dO="Too much output to announce, navigate to rows manually to read",S0={get:()=>dO,set:e=>dO=e};SP=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let n=0,r=0;if(this._interim){let s=e.charCodeAt(r++);56320<=s&&s<=57343?t[n++]=(this._interim-55296)*1024+s-56320+65536:(t[n++]=this._interim,t[n++]=s),this._interim=0}for(let s=r;s=i)return this._interim=a,n;let o=e.charCodeAt(s);56320<=o&&o<=57343?t[n++]=(a-55296)*1024+o-56320+65536:(t[n++]=a,t[n++]=o);continue}a!==65279&&(t[n++]=a)}return n}},wP=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let n=0,r,s,a,o,l=0,c=0;if(this.interim[0]){let h=!1,f=this.interim[0];f&=(f&224)===192?31:(f&240)===224?15:7;let p=0,_;for(;(_=this.interim[++p]&63)&&p<4;)f<<=6,f|=_;let y=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,m=y-p;for(;c=i)return 0;if(_=e[c++],(_&192)!==128){c--,h=!0;break}else this.interim[p++]=_,f<<=6,f|=_&63}h||(y===2?f<128?c--:t[n++]=f:y===3?f<2048||f>=55296&&f<=57343||f===65279||(t[n++]=f):f<65536||f>1114111||(t[n++]=f)),this.interim.fill(0)}let u=i-4,d=c;for(;d=i)return this.interim[0]=r,n;if(s=e[d++],(s&192)!==128){d--;continue}if(l=(r&31)<<6|s&63,l<128){d--;continue}t[n++]=l}else if((r&240)===224){if(d>=i)return this.interim[0]=r,n;if(s=e[d++],(s&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=s,n;if(a=e[d++],(a&192)!==128){d--;continue}if(l=(r&15)<<12|(s&63)<<6|a&63,l<2048||l>=55296&&l<=57343||l===65279)continue;t[n++]=l}else if((r&248)===240){if(d>=i)return this.interim[0]=r,n;if(s=e[d++],(s&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=s,n;if(a=e[d++],(a&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=s,this.interim[2]=a,n;if(o=e[d++],(o&192)!==128){d--;continue}if(l=(r&7)<<18|(s&63)<<12|(a&63)<<6|o&63,l<65536||l>1114111)continue;t[n++]=l}}return n}},bR="",La=" ",kd=class yR{constructor(){this.fg=0,this.bg=0,this.extended=new Kp}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new yR;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Kp=class SR{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new SR(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ar=class wR extends kd{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Kp,this.combinedData=""}static fromCharData(t){let i=new wR;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Da(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},fO="di$target",w0="di$dependencies",r0=new Map;nn=yi("BufferService"),xR=yi("CoreMouseService"),Io=yi("CoreService"),kP=yi("CharsetService"),ly=yi("InstantiationService"),ER=yi("LogService"),rn=yi("OptionsService"),kR=yi("OscLinkService"),CP=yi("UnicodeService"),Cd=yi("DecorationService"),x0=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let n=[],r=this._optionsService.rawOptions.linkHandler,s=new ar,a=i.getTrimmedLength(),o=-1,l=-1,c=!1;for(let u=0;ur?r.activate(p,_,h):TP(p,_),hover:(p,_)=>r?.hover?.(p,_,h),leave:(p,_)=>r?.leave?.(p,_,h)})}c=!1,s.hasExtendedAttrs()&&s.extended.urlId?(l=u,o=s.extended.urlId):(l=-1,o=-1)}}t(n)}};x0=Ft([oe(0,nn),oe(1,rn),oe(2,kR)],x0);tm=yi("CharSizeService"),Is=yi("CoreBrowserService"),cy=yi("MouseService"),zs=yi("RenderService"),NP=yi("SelectionService"),CR=yi("CharacterJoinerService"),mc=yi("ThemeService"),TR=yi("LinkProviderService"),AP=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?pO.isErrorNoTelemetry(e)?new pO(e.message+` `+e.stack):new Error(e.message+` -`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},dP=new uP;f0="Canceled";fP=class extends Error{constructor(){super(f0),this.name=this.message}};XM=class p0 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof p0)return t;let i=new p0;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},m0=class uR extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,uR.prototype)}};gP=class dR{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(dR.assertInvariants){if(this._prevFindLastPredicate){for(let n of this._array)if(this._prevFindLastPredicate(n)&&!t(n))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let i=mP(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=i+1,i===-1?void 0:this._array[i]}};gP.assertInvariants=!1;(e=>{function t(s){return s<0}e.isLessThan=t;function i(s){return s<=0}e.isLessThanOrEqual=i;function n(s){return s>0}e.isGreaterThan=n;function r(s){return s===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(g0||(g0={}));vP=(e,t)=>e-t,ZM=class _0{constructor(t){this.iterate=t}forEach(t){this.iterate(i=>(t(i),!0))}toArray(){let t=[];return this.iterate(i=>(t.push(i),!0)),t}filter(t){return new _0(i=>this.iterate(n=>t(n)?i(n):!0))}map(t){return new _0(i=>this.iterate(n=>i(t(n))))}some(t){let i=!1;return this.iterate(n=>(i=t(n),!i)),i}findFirst(t){let i;return this.iterate(n=>t(n)?(i=n,!1):!0),i}findLast(t){let i;return this.iterate(n=>(t(n)&&(i=n),!0)),i}findLastMaxBy(t){let i,n=!0;return this.iterate(r=>((n||g0.isGreaterThan(t(r,i)))&&(n=!1,i=r),!0)),i}};ZM.empty=new ZM(e=>{});g$=class{constructor(e,t){this.toKey=t,this._map=new Map,this[QM]="SetWithKey";for(let i of e)this.add(i)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(i=>e.call(t,i,i,this))}[(JM=Symbol.iterator,QM=Symbol.toStringTag,JM)](){return this.values()}},yP=class{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){let i=this.map.get(e);i&&(i.delete(t),i.size===0&&this.map.delete(e))}forEach(e,t){let i=this.map.get(e);i&&i.forEach(t)}get(e){return this.map.get(e)||new Set}};(e=>{function t(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function n(){return i}e.empty=n;function*r(w){yield w}e.single=r;function s(w){return t(w)?w:r(w)}e.wrap=s;function a(w){return w||i}e.from=a;function*o(w){for(let k=w.length-1;k>=0;k--)yield w[k]}e.reverse=o;function l(w){return!w||w[Symbol.iterator]().next().done===!0}e.isEmpty=l;function c(w){return w[Symbol.iterator]().next().value}e.first=c;function u(w,k){let M=0;for(let T of w)if(k(T,M++))return!0;return!1}e.some=u;function d(w,k){for(let M of w)if(k(M))return M}e.find=d;function*h(w,k){for(let M of w)k(M)&&(yield M)}e.filter=h;function*f(w,k){let M=0;for(let T of w)yield k(T,M++)}e.map=f;function*p(w,k){let M=0;for(let T of w)yield*k(T,M++)}e.flatMap=p;function*_(...w){for(let k of w)yield*k}e.concat=_;function y(w,k,M){let T=M;for(let A of w)T=k(T,A);return T}e.reduce=y;function*m(w,k,M=w.length){for(k<0&&(k+=w.length),M<0?M+=w.length:M>w.length&&(M=w.length);ki.source!==null&&!this.getRootParent(i,t).isSingleton).flatMap(([i])=>i)}computeLeakingDisposables(t=10,i){let n;if(i)n=i;else{let l=new Map,c=[...this.livingDisposables.values()].filter(d=>d.source!==null&&!this.getRootParent(d,l).isSingleton);if(c.length===0)return;let u=new Set(c.map(d=>d.value));if(n=c.filter(d=>!(d.parent&&u.has(d.parent))),n.length===0)throw new Error("There are cyclic diposable chains!")}if(!n)return;function r(l){function c(d,h){for(;d.length>0&&h.some(f=>typeof f=="string"?f===d[0]:d[0].match(f));)d.shift()}let u=l.source.split(` -`).map(d=>d.trim().replace("at ","")).filter(d=>d!=="");return c(u,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),u.reverse()}let s=new yP;for(let l of n){let c=r(l);for(let u=0;u<=c.length;u++)s.add(c.slice(0,u).join(` -`),l)}n.sort(_P(l=>l.idx,vP));let a="",o=0;for(let l of n.slice(0,t)){o++;let c=r(l),u=[];for(let d=0;d{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},MP=new AP;E0="Canceled";RP=class extends Error{constructor(){super(E0),this.name=this.message}};pO=class k0 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof k0)return t;let i=new k0;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},C0=class NR extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,NR.prototype)}};IP=class AR{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(AR.assertInvariants){if(this._prevFindLastPredicate){for(let n of this._array)if(this._prevFindLastPredicate(n)&&!t(n))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let i=LP(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=i+1,i===-1?void 0:this._array[i]}};IP.assertInvariants=!1;(e=>{function t(s){return s<0}e.isLessThan=t;function i(s){return s<=0}e.isLessThanOrEqual=i;function n(s){return s>0}e.isGreaterThan=n;function r(s){return s===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(T0||(T0={}));BP=(e,t)=>e-t,mO=class N0{constructor(t){this.iterate=t}forEach(t){this.iterate(i=>(t(i),!0))}toArray(){let t=[];return this.iterate(i=>(t.push(i),!0)),t}filter(t){return new N0(i=>this.iterate(n=>t(n)?i(n):!0))}map(t){return new N0(i=>this.iterate(n=>i(t(n))))}some(t){let i=!1;return this.iterate(n=>(i=t(n),!i)),i}findFirst(t){let i;return this.iterate(n=>t(n)?(i=n,!1):!0),i}findLast(t){let i;return this.iterate(n=>(t(n)&&(i=n),!0)),i}findLastMaxBy(t){let i,n=!0;return this.iterate(r=>((n||T0.isGreaterThan(t(r,i)))&&(n=!1,i=r),!0)),i}};mO.empty=new mO(e=>{});$W=class{constructor(e,t){this.toKey=t,this._map=new Map,this[gO]="SetWithKey";for(let i of e)this.add(i)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(i=>e.call(t,i,i,this))}[(_O=Symbol.iterator,gO=Symbol.toStringTag,_O)](){return this.values()}},HP=class{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){let i=this.map.get(e);i&&(i.delete(t),i.size===0&&this.map.delete(e))}forEach(e,t){let i=this.map.get(e);i&&i.forEach(t)}get(e){return this.map.get(e)||new Set}};(e=>{function t(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function n(){return i}e.empty=n;function*r(w){yield w}e.single=r;function s(w){return t(w)?w:r(w)}e.wrap=s;function a(w){return w||i}e.from=a;function*o(w){for(let k=w.length-1;k>=0;k--)yield w[k]}e.reverse=o;function l(w){return!w||w[Symbol.iterator]().next().done===!0}e.isEmpty=l;function c(w){return w[Symbol.iterator]().next().value}e.first=c;function u(w,k){let M=0;for(let T of w)if(k(T,M++))return!0;return!1}e.some=u;function d(w,k){for(let M of w)if(k(M))return M}e.find=d;function*h(w,k){for(let M of w)k(M)&&(yield M)}e.filter=h;function*f(w,k){let M=0;for(let T of w)yield k(T,M++)}e.map=f;function*p(w,k){let M=0;for(let T of w)yield*k(T,M++)}e.flatMap=p;function*_(...w){for(let k of w)yield*k}e.concat=_;function y(w,k,M){let T=M;for(let A of w)T=k(T,A);return T}e.reduce=y;function*m(w,k,M=w.length){for(k<0&&(k+=w.length),M<0?M+=w.length:M>w.length&&(M=w.length);ki.source!==null&&!this.getRootParent(i,t).isSingleton).flatMap(([i])=>i)}computeLeakingDisposables(t=10,i){let n;if(i)n=i;else{let l=new Map,c=[...this.livingDisposables.values()].filter(d=>d.source!==null&&!this.getRootParent(d,l).isSingleton);if(c.length===0)return;let u=new Set(c.map(d=>d.value));if(n=c.filter(d=>!(d.parent&&u.has(d.parent))),n.length===0)throw new Error("There are cyclic diposable chains!")}if(!n)return;function r(l){function c(d,h){for(;d.length>0&&h.some(f=>typeof f=="string"?f===d[0]:d[0].match(f));)d.shift()}let u=l.source.split(` +`).map(d=>d.trim().replace("at ","")).filter(d=>d!=="");return c(u,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),u.reverse()}let s=new HP;for(let l of n){let c=r(l);for(let u=0;u<=c.length;u++)s.add(c.slice(0,u).join(` +`),l)}n.sort(zP(l=>l.idx,BP));let a="",o=0;for(let l of n.slice(0,t)){o++;let c=r(l),u=[];for(let d=0;dr(_)[d]),_=>_);delete p[c[d]];for(let[_,y]of Object.entries(p))u.unshift(` - stacktraces of ${y.length} other leaks continue with ${_}`);u.unshift(h)}a+=` +`)),p=PP([...f].map(_=>r(_)[d]),_=>_);delete p[c[d]];for(let[_,y]of Object.entries(p))u.unshift(` - stacktraces of ${y.length} other leaks continue with ${_}`);u.unshift(h)}a+=` ==================== Leaking disposable ${o}/${n.length}: ${l.value.constructor.name} ==================== @@ -134,21 +134,21 @@ ${u.join(` ... and ${n.length-t} more leaking disposables -`),{leaks:n,details:a}}};xP.idx=0;if(wP){let e="__is_disposable_tracked__";EP(new class{trackDisposable(t){let i=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(i)},3e3)}setParent(t,i){if(t&&t!==Le.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Le.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}fR=class pR{constructor(){this._toDispose=new Set,this._isDisposed=!1,jp(this)}dispose(){this._isDisposed||(Yp(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{To(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return hd(t,this),this._isDisposed?pR.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),hd(t,null))}};fR.DISABLE_DISPOSED_WARNING=!1;Ma=fR,Le=class{constructor(){this._store=new Ma,jp(this),hd(this._store,this)}dispose(){Yp(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Le.None=Object.freeze({dispose(){}});cc=class{constructor(){this._isDisposed=!1,jp(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&hd(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Yp(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&hd(e,null),e}},Pn=typeof window=="object"?window:globalThis,b0=class y0{constructor(t){this.element=t,this.next=y0.Undefined,this.prev=y0.Undefined}};b0.Undefined=new b0(void 0);Dt=b0,tO=class{constructor(){this._first=Dt.Undefined,this._last=Dt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Dt.Undefined}clear(){let e=this._first;for(;e!==Dt.Undefined;){let t=e.next;e.prev=Dt.Undefined,e.next=Dt.Undefined,e=t}this._first=Dt.Undefined,this._last=Dt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new Dt(e);if(this._first===Dt.Undefined)this._first=i,this._last=i;else if(t){let r=this._last;this._last=i,i.prev=r,r.next=i}else{let r=this._first;this._first=i,i.next=r,r.prev=i}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(i))}}shift(){if(this._first!==Dt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Dt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Dt.Undefined&&e.next!==Dt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Dt.Undefined&&e.next===Dt.Undefined?(this._first=Dt.Undefined,this._last=Dt.Undefined):e.next===Dt.Undefined?(this._last=this._last.prev,this._last.next=Dt.Undefined):e.prev===Dt.Undefined&&(this._first=this._first.next,this._first.prev=Dt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Dt.Undefined;)yield e.element,e=e.next}},TP=globalThis.performance&&typeof globalThis.performance.now=="function",NP=class mR{static create(t){return new mR(t)}constructor(t){this._now=TP&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},AP=!1,iO=!1,MP=!1;(e=>{e.None=()=>Le.None;function t(P){if(MP){let{onDidAddListener:x}=P,U=x0.create(),C=0;P.onDidAddListener=()=>{++C===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),U.print()),x?.()}}}function i(P,x){return h(P,()=>{},0,void 0,!0,void 0,x)}e.defer=i;function n(P){return(x,U=null,C)=>{let D=!1,R;return R=P(V=>{if(!D)return R?R.dispose():D=!0,x.call(U,V)},null,C),D&&R.dispose(),R}}e.once=n;function r(P,x,U){return u((C,D=null,R)=>P(V=>C.call(D,x(V)),null,R),U)}e.map=r;function s(P,x,U){return u((C,D=null,R)=>P(V=>{x(V),C.call(D,V)},null,R),U)}e.forEach=s;function a(P,x,U){return u((C,D=null,R)=>P(V=>x(V)&&C.call(D,V),null,R),U)}e.filter=a;function o(P){return P}e.signal=o;function l(...P){return(x,U=null,C)=>{let D=CP(...P.map(R=>R(V=>x.call(U,V))));return d(D,C)}}e.any=l;function c(P,x,U,C){let D=U;return r(P,R=>(D=x(D,R),D),C)}e.reduce=c;function u(P,x){let U,C={onWillAddFirstListener(){U=P(D.fire,D)},onDidRemoveLastListener(){U?.dispose()}};x||t(C);let D=new ee(C);return x?.add(D),D.event}function d(P,x){return x instanceof Array?x.push(P):x&&x.add(P),P}function h(P,x,U=100,C=!1,D=!1,R,V){let z,L,K,X=0,oe,ge={leakWarningThreshold:R,onWillAddFirstListener(){z=P(We=>{X++,L=x(L,We),C&&!K&&(te.fire(L),L=void 0),oe=()=>{let Ki=L;L=void 0,K=void 0,(!C||X>1)&&te.fire(Ki),X=0},typeof U=="number"?(clearTimeout(K),K=setTimeout(oe,U)):K===void 0&&(K=0,queueMicrotask(oe))})},onWillRemoveListener(){D&&X>0&&oe?.()},onDidRemoveLastListener(){oe=void 0,z.dispose()}};V||t(ge);let te=new ee(ge);return V?.add(te),te.event}e.debounce=h;function f(P,x=0,U){return e.debounce(P,(C,D)=>C?(C.push(D),C):[D],x,void 0,!0,void 0,U)}e.accumulate=f;function p(P,x=(C,D)=>C===D,U){let C=!0,D;return a(P,R=>{let V=C||!x(R,D);return C=!1,D=R,V},U)}e.latch=p;function _(P,x,U){return[e.filter(P,x,U),e.filter(P,C=>!x(C),U)]}e.split=_;function y(P,x=!1,U=[],C){let D=U.slice(),R=P(L=>{D?D.push(L):z.fire(L)});C&&C.add(R);let V=()=>{D?.forEach(L=>z.fire(L)),D=null},z=new ee({onWillAddFirstListener(){R||(R=P(L=>z.fire(L)),C&&C.add(R))},onDidAddFirstListener(){D&&(x?setTimeout(V):V())},onDidRemoveLastListener(){R&&R.dispose(),R=null}});return C&&C.add(z),z.event}e.buffer=y;function m(P,x){return(U,C,D)=>{let R=x(new b);return P(function(V){let z=R.evaluate(V);z!==v&&U.call(C,z)},void 0,D)}}e.chain=m;let v=Symbol("HaltChainable");class b{constructor(){this.steps=[]}map(x){return this.steps.push(x),this}forEach(x){return this.steps.push(U=>(x(U),U)),this}filter(x){return this.steps.push(U=>x(U)?U:v),this}reduce(x,U){let C=U;return this.steps.push(D=>(C=x(C,D),C)),this}latch(x=(U,C)=>U===C){let U=!0,C;return this.steps.push(D=>{let R=U||!x(D,C);return U=!1,C=D,R?D:v}),this}evaluate(x){for(let U of this.steps)if(x=U(x),x===v)break;return x}}function w(P,x,U=C=>C){let C=(...z)=>V.fire(U(...z)),D=()=>P.on(x,C),R=()=>P.removeListener(x,C),V=new ee({onWillAddFirstListener:D,onDidRemoveLastListener:R});return V.event}e.fromNodeEventEmitter=w;function k(P,x,U=C=>C){let C=(...z)=>V.fire(U(...z)),D=()=>P.addEventListener(x,C),R=()=>P.removeEventListener(x,C),V=new ee({onWillAddFirstListener:D,onDidRemoveLastListener:R});return V.event}e.fromDOMEventEmitter=k;function M(P){return new Promise(x=>n(P)(x))}e.toPromise=M;function T(P){let x=new ee;return P.then(U=>{x.fire(U)},()=>{x.fire(void 0)}).finally(()=>{x.dispose()}),x.event}e.fromPromise=T;function A(P,x){return P(U=>x.fire(U))}e.forward=A;function I(P,x,U){return x(U),P(C=>x(C))}e.runAndSubscribe=I;class B{constructor(x,U){this._observable=x,this._counter=0,this._hasChanged=!1;let C={onWillAddFirstListener:()=>{x.addObserver(this)},onDidRemoveLastListener:()=>{x.removeObserver(this)}};U||t(C),this.emitter=new ee(C),U&&U.add(this.emitter)}beginUpdate(x){this._counter++}handlePossibleChange(x){}handleChange(x,U){this._hasChanged=!0}endUpdate(x){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function q(P,x){return new B(P,x).emitter.event}e.fromObservable=q;function H(P){return(x,U,C)=>{let D=0,R=!1,V={beginUpdate(){D++},endUpdate(){D--,D===0&&(P.reportChanges(),R&&(R=!1,x.call(U)))},handlePossibleChange(){},handleChange(){R=!0}};P.addObserver(V),P.reportChanges();let z={dispose(){P.removeObserver(V)}};return C instanceof Ma?C.add(z):Array.isArray(C)&&C.push(z),z}}e.fromObservableLight=H})(bi||(bi={}));S0=class w0{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${w0._idPool++}`,w0.all.add(this)}start(t){this._stopWatch=new NP,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};S0.all=new Set,S0._idPool=0;OP=S0,nO=-1,gR=class _R{constructor(t,i,n=(_R._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=n,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let n=this.threshold;if(n<=0||i{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[n,r]of this._stacks)(!t||i{t[e]||console.log(i)},3e3)}setParent(t,i){if(t&&t!==Ie.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Ie.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}OR=class RR{constructor(){this._toDispose=new Set,this._isDisposed=!1,im(this)}dispose(){this._isDisposed||(nm(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Do(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return Sd(t,this),this._isDisposed?RR.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),Sd(t,null))}};OR.DISABLE_DISPOSED_WARNING=!1;Ia=OR,Ie=class{constructor(){this._store=new Ia,im(this),Sd(this._store,this)}dispose(){nm(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Ie.None=Object.freeze({dispose(){}});pc=class{constructor(){this._isDisposed=!1,im(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Sd(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,nm(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Sd(e,null),e}},Un=typeof window=="object"?window:globalThis,M0=class O0{constructor(t){this.element=t,this.next=O0.Undefined,this.prev=O0.Undefined}};M0.Undefined=new M0(void 0);Bt=M0,bO=class{constructor(){this._first=Bt.Undefined,this._last=Bt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Bt.Undefined}clear(){let e=this._first;for(;e!==Bt.Undefined;){let t=e.next;e.prev=Bt.Undefined,e.next=Bt.Undefined,e=t}this._first=Bt.Undefined,this._last=Bt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new Bt(e);if(this._first===Bt.Undefined)this._first=i,this._last=i;else if(t){let r=this._last;this._last=i,i.prev=r,r.next=i}else{let r=this._first;this._first=i,i.next=r,r.prev=i}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(i))}}shift(){if(this._first!==Bt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Bt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Bt.Undefined&&e.next!==Bt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Bt.Undefined&&e.next===Bt.Undefined?(this._first=Bt.Undefined,this._last=Bt.Undefined):e.next===Bt.Undefined?(this._last=this._last.prev,this._last.next=Bt.Undefined):e.prev===Bt.Undefined&&(this._first=this._first.next,this._first.prev=Bt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Bt.Undefined;)yield e.element,e=e.next}},GP=globalThis.performance&&typeof globalThis.performance.now=="function",jP=class DR{static create(t){return new DR(t)}constructor(t){this._now=GP&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},YP=!1,yO=!1,VP=!1;(e=>{e.None=()=>Ie.None;function t(P){if(VP){let{onDidAddListener:x}=P,U=L0.create(),C=0;P.onDidAddListener=()=>{++C===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),U.print()),x?.()}}}function i(P,x){return h(P,()=>{},0,void 0,!0,void 0,x)}e.defer=i;function n(P){return(x,U=null,C)=>{let D=!1,R;return R=P(Y=>{if(!D)return R?R.dispose():D=!0,x.call(U,Y)},null,C),D&&R.dispose(),R}}e.once=n;function r(P,x,U){return u((C,D=null,R)=>P(Y=>C.call(D,x(Y)),null,R),U)}e.map=r;function s(P,x,U){return u((C,D=null,R)=>P(Y=>{x(Y),C.call(D,Y)},null,R),U)}e.forEach=s;function a(P,x,U){return u((C,D=null,R)=>P(Y=>x(Y)&&C.call(D,Y),null,R),U)}e.filter=a;function o(P){return P}e.signal=o;function l(...P){return(x,U=null,C)=>{let D=KP(...P.map(R=>R(Y=>x.call(U,Y))));return d(D,C)}}e.any=l;function c(P,x,U,C){let D=U;return r(P,R=>(D=x(D,R),D),C)}e.reduce=c;function u(P,x){let U,C={onWillAddFirstListener(){U=P(D.fire,D)},onDidRemoveLastListener(){U?.dispose()}};x||t(C);let D=new ee(C);return x?.add(D),D.event}function d(P,x){return x instanceof Array?x.push(P):x&&x.add(P),P}function h(P,x,U=100,C=!1,D=!1,R,Y){let z,I,j,ve=0,de,Ae={leakWarningThreshold:R,onWillAddFirstListener(){z=P(ut=>{ve++,I=x(I,ut),C&&!j&&(re.fire(I),I=void 0),de=()=>{let zi=I;I=void 0,j=void 0,(!C||ve>1)&&re.fire(zi),ve=0},typeof U=="number"?(clearTimeout(j),j=setTimeout(de,U)):j===void 0&&(j=0,queueMicrotask(de))})},onWillRemoveListener(){D&&ve>0&&de?.()},onDidRemoveLastListener(){de=void 0,z.dispose()}};Y||t(Ae);let re=new ee(Ae);return Y?.add(re),re.event}e.debounce=h;function f(P,x=0,U){return e.debounce(P,(C,D)=>C?(C.push(D),C):[D],x,void 0,!0,void 0,U)}e.accumulate=f;function p(P,x=(C,D)=>C===D,U){let C=!0,D;return a(P,R=>{let Y=C||!x(R,D);return C=!1,D=R,Y},U)}e.latch=p;function _(P,x,U){return[e.filter(P,x,U),e.filter(P,C=>!x(C),U)]}e.split=_;function y(P,x=!1,U=[],C){let D=U.slice(),R=P(I=>{D?D.push(I):z.fire(I)});C&&C.add(R);let Y=()=>{D?.forEach(I=>z.fire(I)),D=null},z=new ee({onWillAddFirstListener(){R||(R=P(I=>z.fire(I)),C&&C.add(R))},onDidAddFirstListener(){D&&(x?setTimeout(Y):Y())},onDidRemoveLastListener(){R&&R.dispose(),R=null}});return C&&C.add(z),z.event}e.buffer=y;function m(P,x){return(U,C,D)=>{let R=x(new b);return P(function(Y){let z=R.evaluate(Y);z!==v&&U.call(C,z)},void 0,D)}}e.chain=m;let v=Symbol("HaltChainable");class b{constructor(){this.steps=[]}map(x){return this.steps.push(x),this}forEach(x){return this.steps.push(U=>(x(U),U)),this}filter(x){return this.steps.push(U=>x(U)?U:v),this}reduce(x,U){let C=U;return this.steps.push(D=>(C=x(C,D),C)),this}latch(x=(U,C)=>U===C){let U=!0,C;return this.steps.push(D=>{let R=U||!x(D,C);return U=!1,C=D,R?D:v}),this}evaluate(x){for(let U of this.steps)if(x=U(x),x===v)break;return x}}function w(P,x,U=C=>C){let C=(...z)=>Y.fire(U(...z)),D=()=>P.on(x,C),R=()=>P.removeListener(x,C),Y=new ee({onWillAddFirstListener:D,onDidRemoveLastListener:R});return Y.event}e.fromNodeEventEmitter=w;function k(P,x,U=C=>C){let C=(...z)=>Y.fire(U(...z)),D=()=>P.addEventListener(x,C),R=()=>P.removeEventListener(x,C),Y=new ee({onWillAddFirstListener:D,onDidRemoveLastListener:R});return Y.event}e.fromDOMEventEmitter=k;function M(P){return new Promise(x=>n(P)(x))}e.toPromise=M;function T(P){let x=new ee;return P.then(U=>{x.fire(U)},()=>{x.fire(void 0)}).finally(()=>{x.dispose()}),x.event}e.fromPromise=T;function A(P,x){return P(U=>x.fire(U))}e.forward=A;function L(P,x,U){return x(U),P(C=>x(C))}e.runAndSubscribe=L;class B{constructor(x,U){this._observable=x,this._counter=0,this._hasChanged=!1;let C={onWillAddFirstListener:()=>{x.addObserver(this)},onDidRemoveLastListener:()=>{x.removeObserver(this)}};U||t(C),this.emitter=new ee(C),U&&U.add(this.emitter)}beginUpdate(x){this._counter++}handlePossibleChange(x){}handleChange(x,U){this._hasChanged=!0}endUpdate(x){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function q(P,x){return new B(P,x).emitter.event}e.fromObservable=q;function H(P){return(x,U,C)=>{let D=0,R=!1,Y={beginUpdate(){D++},endUpdate(){D--,D===0&&(P.reportChanges(),R&&(R=!1,x.call(U)))},handlePossibleChange(){},handleChange(){R=!0}};P.addObserver(Y),P.reportChanges();let z={dispose(){P.removeObserver(Y)}};return C instanceof Ia?C.add(z):Array.isArray(C)&&C.push(z),z}}e.fromObservableLight=H})(bi||(bi={}));R0=class D0{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${D0._idPool++}`,D0.all.add(this)}start(t){this._stopWatch=new jP,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};R0.all=new Set,R0._idPool=0;XP=R0,SO=-1,LR=class IR{constructor(t,i,n=(IR._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=n,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let n=this.threshold;if(n<=0||i{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[n,r]of this._stacks)(!t||i{if(e instanceof Ap)t(e);else for(let i=0;i{e.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(e.join(` -`)),e.length=0)},3e3),Mp=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}ee=class{constructor(e){this._size=0,this._options=e,this._leakageMon=nO>0||this._options?.leakWarningThreshold?new RP(e?.onListenerError??Np,this._options?.leakWarningThreshold??nO):void 0,this._perfMon=this._options?._profName?new OP(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(iO){let e=this._listeners;queueMicrotask(()=>{BP(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??(this._event=(e,t,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let o=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(o);let l=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],c=new LP(`${o}. HINT: Stack shows most frequent listener (${l[1]}-times)`,l[0]);return(this._options?.onListenerError||Np)(c),Le.None}if(this._disposed)return Le.None;t&&(e=e.bind(t));let n=new Ap(e),r,s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=x0.create(),r=this._leakageMon.check(n.stack,this._size+1)),iO&&(n.stack=s??x0.create()),this._listeners?this._listeners instanceof Ap?(this._deliveryQueue??(this._deliveryQueue=new PP),this._listeners=[this._listeners,n]):this._listeners.push(n):(this._options?.onWillAddFirstListener?.(this),this._listeners=n,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=wt(()=>{Mp?.unregister(a),r?.(),this._removeListener(n)});if(i instanceof Ma?i.add(a):Array.isArray(i)&&i.push(a),Mp){let o=new Error().stack.split(` +`))}},QP=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},JP=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},eH=0,Pp=class{constructor(e){this.value=e,this.id=eH++}},tH=2,iH=(e,t)=>{if(e instanceof Pp)t(e);else for(let i=0;i{e.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(e.join(` +`)),e.length=0)},3e3),Hp=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}ee=class{constructor(e){this._size=0,this._options=e,this._leakageMon=SO>0||this._options?.leakWarningThreshold?new ZP(e?.onListenerError??Bp,this._options?.leakWarningThreshold??SO):void 0,this._perfMon=this._options?._profName?new XP(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(yO){let e=this._listeners;queueMicrotask(()=>{iH(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??(this._event=(e,t,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let o=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(o);let l=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],c=new JP(`${o}. HINT: Stack shows most frequent listener (${l[1]}-times)`,l[0]);return(this._options?.onListenerError||Bp)(c),Ie.None}if(this._disposed)return Ie.None;t&&(e=e.bind(t));let n=new Pp(e),r,s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=L0.create(),r=this._leakageMon.check(n.stack,this._size+1)),yO&&(n.stack=s??L0.create()),this._listeners?this._listeners instanceof Pp?(this._deliveryQueue??(this._deliveryQueue=new nH),this._listeners=[this._listeners,n]):this._listeners.push(n):(this._options?.onWillAddFirstListener?.(this),this._listeners=n,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=Ct(()=>{Hp?.unregister(a),r?.(),this._removeListener(n)});if(i instanceof Ia?i.add(a):Array.isArray(i)&&i.push(a),Hp){let o=new Error().stack.split(` `).slice(2,3).join(` -`).trim(),l=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(o);Mp.register(a,l?.[2]??o,a)}return a}),this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let n=this._deliveryQueue.current===this;if(this._size*zP<=t.length){let r=0;for(let s=0;s0}},PP=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},E0=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ee,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ee,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let n=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(n,t),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let n=this.getWindowId(i);this.mapWindowIdToFullScreen.set(n,t),this._onDidChangeFullscreen.fire(n)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};E0.INSTANCE=new E0;J0=E0;v$=J0.INSTANCE.onDidChangeZoomLevel;b$=J0.INSTANCE.onDidChangeFullscreen,dc=typeof navigator=="object"?navigator.userAgent:"",k0=dc.indexOf("Firefox")>=0,Op=dc.indexOf("AppleWebKit")>=0,ey=dc.indexOf("Chrome")>=0,bR=!ey&&dc.indexOf("Safari")>=0,y$=dc.indexOf("Electron/")>=0,S$=dc.indexOf("Android")>=0,Rp=!1;if(typeof Pn.matchMedia=="function"){let e=Pn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Pn.matchMedia("(display-mode: fullscreen)");Rp=e.matches,HP(Pn,e,({matches:i})=>{Rp&&t.matches||(Rp=i)})}lc="en",Bp=!1,Pp=!1,ld=!1,FP=!1,yR=!1,SR=!1,WP=!1,$P=!1,KP=!1,GP=!1,Dp=lc,rO=lc,Rs=globalThis;typeof Rs.vscode<"u"&&typeof Rs.vscode.process<"u"?Bn=Rs.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Bn=process);wR=typeof Bn?.versions?.electron=="string",YP=wR&&Bn?.type==="renderer";if(typeof Bn=="object"){Bp=Bn.platform==="win32",Pp=Bn.platform==="darwin",ld=Bn.platform==="linux",FP=ld&&!!Bn.env.SNAP&&!!Bn.env.SNAP_REVISION,WP=wR,KP=!!Bn.env.CI||!!Bn.env.BUILD_ARTIFACTSTAGINGDIRECTORY,xp=lc,Dp=lc;let e=Bn.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);xp=t.userLocale,rO=t.osLocale,Dp=t.resolvedLanguage||lc,jP=t.languagePack?.translationsConfigFile}catch{}yR=!0}else typeof navigator=="object"&&!YP?(Ms=navigator.userAgent,Bp=Ms.indexOf("Windows")>=0,Pp=Ms.indexOf("Macintosh")>=0,$P=(Ms.indexOf("Macintosh")>=0||Ms.indexOf("iPad")>=0||Ms.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ld=Ms.indexOf("Linux")>=0,GP=Ms?.indexOf("Mobi")>=0,SR=!0,Dp=globalThis._VSCODE_NLS_LANGUAGE||lc,xp=navigator.language.toLowerCase(),rO=xp):console.error("Unable to resolve platform.");Yb=0;Pp?Yb=1:Bp?Yb=3:ld&&(Yb=2);xR=Bp,Jr=Pp,VP=ld,Vb=yR,XP=SR&&typeof Rs.importScripts=="function",w$=XP?Rs.origin:void 0,es=Ms,Ea=Dp;(e=>{function t(){return Ea}e.value=t;function i(){return Ea.length===2?Ea==="en":Ea.length>=3?Ea[0]==="e"&&Ea[1]==="n"&&Ea[2]==="-":!1}e.isDefaultVariant=i;function n(){return Ea==="en"}e.isDefault=n})(sO||(sO={}));ZP=typeof Rs.postMessage=="function"&&!Rs.importScripts,QP=(()=>{if(ZP){let e=[];Rs.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n{let n=++t;e.push({id:n,callback:i}),Rs.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})(),JP=!!(es&&es.indexOf("Chrome")>=0),x$=!!(es&&es.indexOf("Firefox")>=0),E$=!!(!JP&&es&&es.indexOf("Safari")>=0),k$=!!(es&&es.indexOf("Edg/")>=0),C$=!!(es&&es.indexOf("Android")>=0),ka=typeof navigator=="object"?navigator:{},T$={clipboard:{writeText:Vb||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(ka&&ka.clipboard&&ka.clipboard.writeText),readText:Vb||!!(ka&&ka.clipboard&&ka.clipboard.readText)},keyboard:Vb||qP()?0:ka.keyboard||bR?1:2,touch:"ontouchstart"in Pn||ka.maxTouchPoints>0,pointerEvents:Pn.PointerEvent&&("ontouchstart"in Pn||navigator.maxTouchPoints>0)},ty=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Xb=new ty,aO=new ty,oO=new ty,eH=new Array(230);(e=>{function t(o){return Xb.keyCodeToStr(o)}e.toString=t;function i(o){return Xb.strToKeyCode(o)}e.fromString=i;function n(o){return aO.keyCodeToStr(o)}e.toUserSettingsUS=n;function r(o){return oO.keyCodeToStr(o)}e.toUserSettingsGeneral=r;function s(o){return aO.strToKeyCode(o)||oO.strToKeyCode(o)}e.fromUserSettings=s;function a(o){if(o>=98&&o<=113)return null;switch(o){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Xb.keyCodeToStr(o)}e.toElectronAccelerator=a})(C0||(C0={}));tH=class ER{constructor(t,i,n,r,s){this.ctrlKey=t,this.shiftKey=i,this.altKey=n,this.metaKey=r,this.keyCode=s}equals(t){return t instanceof ER&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",n=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${i}${n}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new iH([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},iH=class{constructor(e){if(e.length===0)throw pP("chords");this.chords=e}getHashCode(){let e="";for(let t=0,i=this.chords.length;t{function t(i){return i===e.None||i===e.Cancelled||i instanceof uH?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:bi.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:kR})})(uO||(uO={}));uH=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?kR:(this._emitter||(this._emitter=new ee),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},iy=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new m0("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new m0("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},dH=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new m0("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=i.setInterval(()=>{e()},t);this.disposable=wt(()=>{i.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Zb=(e,t)=>{QP(()=>{if(i)return;let n=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,n-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:Zb=(e,t,i)=>{let n=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),r=!1;return{dispose(){r||(r=!0,e.cancelIdleCallback(n))}}},hH=e=>Zb(globalThis,e)})();(e=>{async function t(n){let r,s=await Promise.all(n.map(a=>a.then(o=>o,o=>{r||(r=o)})));if(typeof r<"u")throw r;return s}e.settled=t;function i(n){return new Promise(async(r,s)=>{try{await n(r,s)}catch(a){s(a)}})}e.withAsyncBody=i})(dO||(dO={}));hO=class tr{static fromArray(t){return new tr(i=>{i.emitMany(t)})}static fromPromise(t){return new tr(async i=>{i.emitMany(await t)})}static fromPromises(t){return new tr(async i=>{await Promise.all(t.map(async n=>i.emitOne(await n)))})}static merge(t){return new tr(async i=>{await Promise.all(t.map(async n=>{for await(let r of n)i.emitOne(r)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ee,queueMicrotask(async()=>{let n={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(n)),this.resolve()}catch(r){this.reject(r)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new tr(async n=>{for await(let r of t)n.emitOne(i(r))})}map(t){return tr.map(this,t)}static filter(t,i){return new tr(async n=>{for await(let r of t)i(r)&&n.emitOne(r)})}filter(t){return tr.filter(this,t)}static coalesce(t){return tr.filter(t,i=>!!i)}coalesce(){return tr.coalesce(this)}static async toPromise(t){let i=[];for await(let n of t)i.push(n);return i}toPromise(){return tr.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};hO.EMPTY=hO.fromArray([]);yH=class TR{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let i=t.length;if(i===0)return;let n=this._buff,r=this._buffLen,s=this._leftoverHighSurrogate,a,o;for(s!==0?(a=s,o=-1,s=0):(a=t.charCodeAt(0),o=0);;){let l=a;if(fH(a))if(o+1>>6,t[i++]=128|(n&63)>>>0):n<65536?(t[i++]=224|(n&61440)>>>12,t[i++]=128|(n&4032)>>>6,t[i++]=128|(n&63)>>>0):(t[i++]=240|(n&1835008)>>>18,t[i++]=128|(n&258048)>>>12,t[i++]=128|(n&4032)>>>6,t[i++]=128|(n&63)>>>0),i>=64&&(this._step(),i-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),i}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),Vu(this._h0)+Vu(this._h1)+Vu(this._h2)+Vu(this._h3)+Vu(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,pO(this._buff,this._buffLen),this._buffLen>56&&(this._step(),pO(this._buff));let t=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(t/4294967296),!1),this._buffDV.setUint32(60,t%4294967296,!1),this._step()}_step(){let t=TR._bigBlock32,i=this._buffDV;for(let d=0;d<64;d+=4)t.setUint32(d,i.getUint32(d,!1),!1);for(let d=64;d<320;d+=4)t.setUint32(d,Qb(t.getUint32(d-12,!1)^t.getUint32(d-32,!1)^t.getUint32(d-56,!1)^t.getUint32(d-64,!1),1),!1);let n=this._h0,r=this._h1,s=this._h2,a=this._h3,o=this._h4,l,c,u;for(let d=0;d<80;d++)d<20?(l=r&s|~r&a,c=1518500249):d<40?(l=r^s^a,c=1859775393):d<60?(l=r&s|r&a|s&a,c=2400959708):(l=r^s^a,c=3395469782),u=Qb(n,5)+l+o+c+t.getUint32(d*4,!1)&4294967295,o=a,a=s,s=Qb(r,30),r=n,n=u;this._h0=this._h0+n&4294967295,this._h1=this._h1+r&4294967295,this._h2=this._h2+s&4294967295,this._h3=this._h3+a&4294967295,this._h4=this._h4+o&4294967295}};yH._bigBlock32=new DataView(new ArrayBuffer(320));({registerWindow:N$,getWindow:wr,getDocument:A$,getWindows:M$,getWindowsCount:O$,getWindowId:mO,getWindowById:R$,hasWindow:D$,onDidRegisterWindow:SH,onWillUnregisterWindow:L$,onDidUnregisterWindow:I$}=(function(){let e=new Map,t={window:Pn,disposables:new Ma};e.set(Pn.vscodeWindowId,t);let i=new ee,n=new ee,r=new ee;function s(a,o){return(typeof a=="number"?e.get(a):void 0)??(o?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:n.event,registerWindow(a){if(e.has(a.vscodeWindowId))return Le.None;let o=new Ma,l={window:a,disposables:o.add(new Ma)};return e.set(a.vscodeWindowId,l),o.add(wt(()=>{e.delete(a.vscodeWindowId),n.fire(a)})),o.add(ke(a,mi.BEFORE_UNLOAD,()=>{r.fire(a)})),i.fire(l),o},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(a){return a.vscodeWindowId},hasWindow(a){return e.has(a)},getWindowById:s,getWindow(a){let o=a;if(o?.ownerDocument?.defaultView)return o.ownerDocument.defaultView.window;let l=a;return l?.view?l.view.window:Pn},getDocument(a){return wr(a).document}}})()),wH=class{constructor(e,t,i,n){this._node=e,this._type=t,this._handler=i,this._options=n||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};gO=function(e,t,i,n){let r=i;return t==="click"||t==="mousedown"||t==="contextmenu"?r=xH(wr(e),i):(t==="keydown"||t==="keypress"||t==="keyup")&&(r=EH(i)),ke(e,t,r,n)},CH=class extends dH{constructor(e){super(),this.defaultTarget=e&&wr(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},Jb=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Np(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,n=new Map,r=s=>{i.set(s,!1);let a=e.get(s)??[];for(t.set(s,a),e.set(s,[]),n.set(s,!0);a.length>0;)a.sort(Jb.sort),a.shift().execute();n.set(s,!1)};Hp=(s,a,o=0)=>{let l=mO(s),c=new Jb(a,o),u=e.get(l);return u||(u=[],e.set(l,u)),u.push(c),i.get(l)||(i.set(l,!0),s.requestAnimationFrame(()=>r(l))),c},kH=(s,a,o)=>{let l=mO(s);if(n.get(l)){let c=new Jb(a,o),u=t.get(l);return u||(u=[],t.set(l,u)),u.push(c),c}else return Hp(s,a,o)}})();_O=class Lp{constructor(t,i){this.width=t,this.height=i}with(t=this.width,i=this.height){return t!==this.width||i!==this.height?new Lp(t,i):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof Lp?t:new Lp(t.width,t.height)}static equals(t,i){return t===i?!0:!t||!i?!1:t.width===i.width&&t.height===i.height}};_O.None=new _O(0,0);z$=new class{constructor(){this.mutationObservers=new Map}observe(e,t,i){let n=this.mutationObservers.get(e);n||(n=new Map,this.mutationObservers.set(e,n));let r=mH(i),s=n.get(r);if(s)s.users+=1;else{let a=new ee,o=new MutationObserver(c=>a.fire(c));o.observe(e,i);let l=s={users:1,observer:o,onDidMutate:a.event};t.add(wt(()=>{l.users-=1,l.users===0&&(a.dispose(),o.disconnect(),n?.delete(r),n?.size===0&&this.mutationObservers.delete(e))})),n.set(r,s)}return s.onDidMutate}},mi={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:Op?"webkitAnimationStart":"animationstart",ANIMATION_END:Op?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Op?"webkitAnimationIteration":"animationiteration"},NH=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;AH.SVG=function(e,t,...i){return NR("http://www.w3.org/2000/svg",e,t,...i)};MH=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=mn(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=mn(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=mn(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=mn(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=mn(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=mn(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=mn(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=mn(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=mn(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=mn(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=mn(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=mn(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=mn(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=mn(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};AR=class{constructor(){this._hooks=new Ma,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,n,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=r;let s=e;try{e.setPointerCapture(t),this._hooks.add(wt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=wr(e)}this._hooks.add(ke(s,mi.POINTER_MOVE,a=>{if(a.buttons!==i){this.stopMonitoring(!0);return}a.preventDefault(),this._pointerMoveCallback(a)})),this._hooks.add(ke(s,mi.POINTER_UP,a=>this.stopMonitoring(!0)))}};(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Sr||(Sr={}));nd=class Fi extends Le{constructor(){super(),this.dispatched=!1,this.targets=new tO,this.ignoreTargets=new tO,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(bi.runAndSubscribe(SH,({window:t,disposables:i})=>{i.add(ke(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),i.add(ke(t.document,"touchend",n=>this.onTouchEnd(t,n))),i.add(ke(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:Pn,disposables:this._store}))}static addTarget(t){if(!Fi.isTouchDevice())return Le.None;Fi.INSTANCE||(Fi.INSTANCE=eO(new Fi));let i=Fi.INSTANCE.targets.push(t);return wt(i)}static ignoreTarget(t){if(!Fi.isTouchDevice())return Le.None;Fi.INSTANCE||(Fi.INSTANCE=eO(new Fi));let i=Fi.INSTANCE.ignoreTargets.push(t);return wt(i)}static isTouchDevice(){return"ontouchstart"in Pn||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let n=0,r=t.targetTouches.length;n=Fi.HOLD_DELAY&&Math.abs(l.initialPageX-In(l.rollingPageX))<30&&Math.abs(l.initialPageY-In(l.rollingPageY))<30){let u=this.newGestureEvent(Sr.Contextmenu,l.initialTarget);u.pageX=In(l.rollingPageX),u.pageY=In(l.rollingPageY),this.dispatchEvent(u)}else if(r===1){let u=In(l.rollingPageX),d=In(l.rollingPageY),h=In(l.rollingTimestamps)-l.rollingTimestamps[0],f=u-l.rollingPageX[0],p=d-l.rollingPageY[0],_=[...this.targets].filter(y=>l.initialTarget instanceof Node&&y.contains(l.initialTarget));this.inertia(t,_,n,Math.abs(f)/h,f>0?1:-1,u,Math.abs(p)/h,p>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(Sr.End,l.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,i){let n=document.createEvent("CustomEvent");return n.initEvent(t,!1,!0),n.initialTarget=i,n.tapCount=0,n}dispatchEvent(t){if(t.type===Sr.Tap){let i=new Date().getTime(),n=0;i-this._lastSetTapCountTime>Fi.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=i,t.tapCount=n}else(t.type===Sr.Change||t.type===Sr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let n of this.ignoreTargets)if(n.contains(t.initialTarget))return;let i=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,s=t.initialTarget;for(;s&&s!==n;)r++,s=s.parentElement;i.push([r,n])}i.sort((n,r)=>n[0]-r[0]);for(let[n,r]of i)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,i,n,r,s,a,o,l,c){this.handle=Hp(t,()=>{let u=Date.now(),d=u-n,h=0,f=0,p=!0;r+=Fi.SCROLL_FRICTION*d,o+=Fi.SCROLL_FRICTION*d,r>0&&(p=!1,h=s*r*d),o>0&&(p=!1,f=l*o*d);let _=this.newGestureEvent(Sr.Change);_.translationX=h,_.translationY=f,i.forEach(y=>y.dispatchEvent(_)),p||this.inertia(t,i,u,r,s,a+h,o,l,c+f)})}onTouchMove(t){let i=Date.now();for(let n=0,r=t.changedTouches.length;n3&&(a.rollingPageX.shift(),a.rollingPageY.shift(),a.rollingTimestamps.shift()),a.rollingPageX.push(s.pageX),a.rollingPageY.push(s.pageY),a.rollingTimestamps.push(i)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};nd.SCROLL_FRICTION=-.005,nd.HOLD_DELAY=700,nd.CLEAR_TAP_COUNT_TIME=400,Pt([OH],nd,"isTouchDevice",1);RH=nd,ry=class extends Le{onclick(e,t){this._register(ke(e,mi.CLICK,i=>t(new id(wr(e),i))))}onmousedown(e,t){this._register(ke(e,mi.MOUSE_DOWN,i=>t(new id(wr(e),i))))}onmouseover(e,t){this._register(ke(e,mi.MOUSE_OVER,i=>t(new id(wr(e),i))))}onmouseleave(e,t){this._register(ke(e,mi.MOUSE_LEAVE,i=>t(new id(wr(e),i))))}onkeydown(e,t){this._register(ke(e,mi.KEY_DOWN,i=>t(new T0(i))))}onkeyup(e,t){this._register(ke(e,mi.KEY_UP,i=>t(new T0(i))))}oninput(e,t){this._register(ke(e,mi.INPUT,t))}onblur(e,t){this._register(ke(e,mi.BLUR,t))}onfocus(e,t){this._register(ke(e,mi.FOCUS,t))}onchange(e,t){this._register(ke(e,mi.CHANGE,t))}ignoreGesture(e){return RH.ignoreTarget(e)}},vO=11,DH=class extends ry{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=vO+"px",this.domNode.style.height=vO+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new AR),this._register(gO(this.bgDomNode,mi.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(gO(this.domNode,mi.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new CH),this._pointerdownScheduleRepeatTimer=this._register(new iy)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,wr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},LH=class N0{constructor(t,i,n,r,s,a,o){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,n=n|0,r=r|0,s=s|0,a=a|0,o=o|0),this.rawScrollLeft=r,this.rawScrollTop=o,i<0&&(i=0),r+i>n&&(r=n-i),r<0&&(r=0),s<0&&(s=0),o+s>a&&(o=a-s),o<0&&(o=0),this.width=i,this.scrollWidth=n,this.scrollLeft=r,this.height=s,this.scrollHeight=a,this.scrollTop=o}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,i){return new N0(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new N0(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,i){let n=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,s=this.scrollLeft!==t.scrollLeft,a=this.height!==t.height,o=this.scrollHeight!==t.scrollHeight,l=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:i,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:s,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:l}}},IH=class extends Le{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ee),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new LH(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let n;t?n=new yO(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=yO.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},bO=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};yO=class A0{constructor(t,i,n,r){this.from=t,this.to=i,this.duration=r,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,i,n){if(Math.abs(t-i)>2.5*n){let r,s;return t{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},UH=140,MR=class extends ry{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new HH(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new AR),this._shouldRender=!0,this.domNode=cd(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(ke(this.domNode.domNode,mi.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new DH(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,n){this.slider=cd(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof n=="number"&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(ke(this.slider.domNode,mi.POINTER_DOWN,r=>{r.button===0&&(r.preventDefault(),this._sliderPointerDown(r))})),this.onclick(this.slider.domNode,r=>{r.leftButton&&r.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),n=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);i<=r&&r<=n?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{let r=TH(this.domNode.domNode);t=e.pageX-r.left,i=e.pageY-r.top}let n=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),n=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{let s=this._sliderOrthogonalPointerPosition(r),a=Math.abs(s-i);if(xR&&a>UH){this._setDesiredScrollPositionNow(n.getScrollPosition());return}let o=this._sliderPointerPosition(r)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},OR=class M0{constructor(t,i,n,r,s,a){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(t),this._visibleSize=r,this._scrollSize=s,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new M0(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let i=Math.round(t);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(t){let i=Math.round(t);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let i=Math.round(t);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,i,n,r,s){let a=Math.max(0,n-t),o=Math.max(0,a-2*i),l=r>0&&r>n;if(!l)return{computedAvailableSize:Math.round(a),computedIsNeeded:l,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),u=(o-c)/(r-n),d=s*u;return{computedAvailableSize:Math.round(a),computedIsNeeded:l,computedSliderSize:Math.round(c),computedSliderRatio:u,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){let t=M0._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize,n=this._scrollPosition;return i0&&Math.abs(t.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(n+=.25),i){let r=Math.abs(t.deltaX),s=Math.abs(t.deltaY),a=Math.abs(i.deltaX),o=Math.abs(i.deltaY),l=Math.max(Math.min(r,a),1),c=Math.max(Math.min(s,o),1),u=Math.max(r,a),d=Math.max(s,o);u%l===0&&d%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};O0.INSTANCE=new O0;KH=O0,GH=class extends ry{constructor(e,t,i){super(),this._onScroll=this._register(new ee),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ee),this.onWillScroll=this._onWillScroll.event,this._options=YH(t),this._scrollable=i,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let n={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new FH(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new qH(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=cd(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=cd(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=cd(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new iy),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=To(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Jr&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new cO(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=To(this._mouseWheelToDispose),e)){let t=i=>{this._onMouseWheel(new cO(i))};this._mouseWheelToDispose.push(ke(this._listenOnDomNode,mi.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=KH.INSTANCE;wO&&t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,s=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&s+r===0?s=r=0:Math.abs(r)>=Math.abs(s)?s=0:r=0),this._options.flipAxes&&([r,s]=[s,r]);let a=!Jr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!s&&(s=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(s=s*this._options.fastScrollSensitivity,r=r*this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),l={};if(r){let c=SO*r,u=o.scrollTop-(c<0?Math.floor(c):Math.ceil(c));this._verticalScrollbar.writeScrollPosition(l,u)}if(s){let c=SO*s,u=o.scrollLeft-(c<0?Math.floor(c):Math.ceil(c));this._horizontalScrollbar.writeScrollPosition(l,u)}l=this._scrollable.validateScrollPosition(l),(o.scrollLeft!==l.scrollLeft||o.scrollTop!==l.scrollTop)&&(wO&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(l):this._scrollable.setScrollPositionNow(l),i=!0)}let n=i;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,n=i?" left":"",r=t?" top":"",s=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${r}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),WH)}},jH=class extends GH{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};R0=class extends Le{constructor(e,t,i,n,r,s,a,o){super(),this._bufferService=i,this._optionsService=a,this._renderService=o,this._onRequestScrollLines=this._register(new ee),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let l=this._register(new IH({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>Hp(n.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{l.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new jH(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},l)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(bi.runAndSubscribe(s.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=s.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(wt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(wt(()=>this._styleElement.remove())),this._register(bi.runAndSubscribe(s.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${s.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${s.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${s.colors.scrollbarSliderActiveBackground.css};`,"}"].join(` -`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(c=>this._handleScroll(c)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),i=t-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};R0=Pt([ce(2,en),ce(3,Ds),ce(4,sR),ce(5,uc),ce(6,tn),ce(7,Ls)],R0);D0=class extends Le{constructor(e,t,i,n,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=n,this._renderService=r,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(s=>this._removeDecoration(s))),this._register(wt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let i=e.options.x??0;return i&&i>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=i?`${i*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};D0=Pt([ce(1,en),ce(2,Ds),ce(3,_d),ce(4,Ls)],D0);VH=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Zr={full:0,left:0,center:0,right:0},Ca={full:0,left:0,center:0,right:0},Xu={full:0,left:0,center:0,right:0},Up=class extends Le{constructor(e,t,i,n,r,s,a,o){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=n,this._renderService=r,this._optionsService=s,this._themeService=a,this._coreBrowserService=o,this._colorZoneStore=new VH,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(wt(()=>this._canvas?.remove()));let l=this._canvas.getContext("2d");if(l)this._ctx=l;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Ca.full=this._canvas.width,Ca.left=e,Ca.center=t,Ca.right=e,this._refreshDrawHeightConstants(),Xu.full=1,Xu.left=1,Xu.center=1+Ca.left,Xu.right=1+Ca.left+Ca.center}_refreshDrawHeightConstants(){Zr.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Zr.left=t,Zr.center=t,Zr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Zr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Zr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Zr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Zr.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Xu[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Zr[e.position||"full"]/2),Ca[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Zr[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Up=Pt([ce(2,en),ce(3,_d),ce(4,Ls),ce(5,tn),ce(6,uc),ce(7,Ds)],Up);(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=` -`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL="\x7F"))($||($={}));(e=>(e.PAD="\x80",e.HOP="\x81",e.BPH="\x82",e.NBH="\x83",e.IND="\x84",e.NEL="\x85",e.SSA="\x86",e.ESA="\x87",e.HTS="\x88",e.HTJ="\x89",e.VTS="\x8A",e.PLD="\x8B",e.PLU="\x8C",e.RI="\x8D",e.SS2="\x8E",e.SS3="\x8F",e.DCS="\x90",e.PU1="\x91",e.PU2="\x92",e.STS="\x93",e.CCH="\x94",e.MW="\x95",e.SPA="\x96",e.EPA="\x97",e.SOS="\x98",e.SGCI="\x99",e.SCI="\x9A",e.CSI="\x9B",e.ST="\x9C",e.OSC="\x9D",e.PM="\x9E",e.APC="\x9F"))(ud||(ud={}));(e=>e.ST=`${$.ESC}\\`)(L0||(L0={}));I0=class{constructor(e,t,i,n,r,s){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=n,this._coreService=r,this._renderService=s,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let i;t.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(t.start,this._compositionPosition.start):i=this._textarea.value.substring(t.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.lengththis.updateCompositionElements(!0),0)}}};I0=Pt([ce(2,en),ce(3,tn),ce(4,Ao),ce(5,Ls)],I0);gi=0,_i=0,vi=0,Bt=0,xO={css:"#00000000",rgba:0};(e=>{function t(r,s,a,o){return o!==void 0?`#${wo(r)}${wo(s)}${wo(a)}${wo(o)}`:`#${wo(r)}${wo(s)}${wo(a)}`}e.toCss=t;function i(r,s,a,o=255){return(r<<24|s<<16|a<<8|o)>>>0}e.toRgba=i;function n(r,s,a,o){return{css:e.toCss(r,s,a,o),rgba:e.toRgba(r,s,a,o)}}e.toColor=n})(Wt||(Wt={}));(e=>{function t(l,c){if(Bt=(c.rgba&255)/255,Bt===1)return{css:c.css,rgba:c.rgba};let u=c.rgba>>24&255,d=c.rgba>>16&255,h=c.rgba>>8&255,f=l.rgba>>24&255,p=l.rgba>>16&255,_=l.rgba>>8&255;gi=f+Math.round((u-f)*Bt),_i=p+Math.round((d-p)*Bt),vi=_+Math.round((h-_)*Bt);let y=Wt.toCss(gi,_i,vi),m=Wt.toRgba(gi,_i,vi);return{css:y,rgba:m}}e.blend=t;function i(l){return(l.rgba&255)===255}e.isOpaque=i;function n(l,c,u){let d=dd.ensureContrastRatio(l.rgba,c.rgba,u);if(d)return Wt.toColor(d>>24&255,d>>16&255,d>>8&255)}e.ensureContrastRatio=n;function r(l){let c=(l.rgba|255)>>>0;return[gi,_i,vi]=dd.toChannels(c),{css:Wt.toCss(gi,_i,vi),rgba:c}}e.opaque=r;function s(l,c){return Bt=Math.round(c*255),[gi,_i,vi]=dd.toChannels(l.rgba),{css:Wt.toCss(gi,_i,vi,Bt),rgba:Wt.toRgba(gi,_i,vi,Bt)}}e.opacity=s;function a(l,c){return Bt=l.rgba&255,s(l,Bt*c/255)}e.multiplyOpacity=a;function o(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}e.toColorRGB=o})(bt||(bt={}));(e=>{let t,i;try{let r=document.createElement("canvas");r.width=1,r.height=1;let s=r.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function n(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return gi=parseInt(r.slice(1,2).repeat(2),16),_i=parseInt(r.slice(2,3).repeat(2),16),vi=parseInt(r.slice(3,4).repeat(2),16),Wt.toColor(gi,_i,vi);case 5:return gi=parseInt(r.slice(1,2).repeat(2),16),_i=parseInt(r.slice(2,3).repeat(2),16),vi=parseInt(r.slice(3,4).repeat(2),16),Bt=parseInt(r.slice(4,5).repeat(2),16),Wt.toColor(gi,_i,vi,Bt);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let s=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return gi=parseInt(s[1]),_i=parseInt(s[2]),vi=parseInt(s[3]),Bt=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),Wt.toColor(gi,_i,vi,Bt);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[gi,_i,vi,Bt]=t.getImageData(0,0,1,1).data,Bt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Wt.toRgba(gi,_i,vi,Bt),css:r}}e.toColor=n})(Mt||(Mt={}));(e=>{function t(n){return i(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function i(n,r,s){let a=n/255,o=r/255,l=s/255,c=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),u=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return c*.2126+u*.7152+d*.0722}e.relativeLuminance2=i})(Wi||(Wi={}));(e=>{function t(a,o){if(Bt=(o&255)/255,Bt===1)return o;let l=o>>24&255,c=o>>16&255,u=o>>8&255,d=a>>24&255,h=a>>16&255,f=a>>8&255;return gi=d+Math.round((l-d)*Bt),_i=h+Math.round((c-h)*Bt),vi=f+Math.round((u-f)*Bt),Wt.toRgba(gi,_i,vi)}e.blend=t;function i(a,o,l){let c=Wi.relativeLuminance(a>>8),u=Wi.relativeLuminance(o>>8);if(As(c,u)>8));if(p>8));return p>y?f:_}return f}let d=r(a,o,l),h=As(c,Wi.relativeLuminance(d>>8));if(h>8));return h>p?d:f}return d}}e.ensureContrastRatio=i;function n(a,o,l){let c=a>>24&255,u=a>>16&255,d=a>>8&255,h=o>>24&255,f=o>>16&255,p=o>>8&255,_=As(Wi.relativeLuminance2(h,f,p),Wi.relativeLuminance2(c,u,d));for(;_0||f>0||p>0);)h-=Math.max(0,Math.ceil(h*.1)),f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),_=As(Wi.relativeLuminance2(h,f,p),Wi.relativeLuminance2(c,u,d));return(h<<24|f<<16|p<<8|255)>>>0}e.reduceLuminance=n;function r(a,o,l){let c=a>>24&255,u=a>>16&255,d=a>>8&255,h=o>>24&255,f=o>>16&255,p=o>>8&255,_=As(Wi.relativeLuminance2(h,f,p),Wi.relativeLuminance2(c,u,d));for(;_>>0}e.increaseLuminance=r;function s(a){return[a>>24&255,a>>16&255,a>>8&255,a&255]}e.toChannels=s})(dd||(dd={}));XH=class extends gd{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},qp=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new nr}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t1){let u=this._getJoinedRanges(n,a,s,t,r);for(let d=0;d1){let c=this._getJoinedRanges(n,a,s,t,r);for(let u=0;u=B,D=P,R=this._workCell;if(h.length>0&&P===h[0][0]&&C){let Ne=h.shift(),gn=this._isCellInSelection(Ne[0],t);for(v=Ne[0]+1;v=Ne[1]),C?(U=!0,R=new XH(this._workCell,e.translateToString(!0,Ne[0],Ne[1]),Ne[1]-Ne[0]),D=Ne[1]-1,x=R.getWidth()):B=Ne[1]}let V=this._isCellInSelection(P,t),z=i&&P===s,L=H&&P>=c&&P<=u,K=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,Ne=>{K=!0});let X=R.getChars()||Aa;if(X===" "&&(R.isUnderline()||R.isOverline())&&(X="\xA0"),I=x*o-l.get(X,R.isBold(),R.isItalic()),!_)_=this._document.createElement("span");else if(y&&(V&&A||!V&&!A&&R.bg===b)&&(V&&A&&f.selectionForeground||R.fg===w)&&R.extended.ext===k&&L===M&&I===T&&!z&&!U&&!K&&C){R.isInvisible()?m+=Aa:m+=X,y++;continue}else y&&(_.textContent=m),_=this._document.createElement("span"),y=0,m="";if(b=R.bg,w=R.fg,k=R.extended.ext,M=L,T=I,A=V,U&&s>=P&&s<=D&&(s=P),!this._coreService.isCursorHidden&&z&&this._coreService.isCursorInitialized){if(q.push("xterm-cursor"),this._coreBrowserService.isFocused)a&&q.push("xterm-cursor-blink"),q.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":q.push("xterm-cursor-outline");break;case"block":q.push("xterm-cursor-block");break;case"bar":q.push("xterm-cursor-bar");break;case"underline":q.push("xterm-cursor-underline");break;default:break}}if(R.isBold()&&q.push("xterm-bold"),R.isItalic()&&q.push("xterm-italic"),R.isDim()&&q.push("xterm-dim"),R.isInvisible()?m=Aa:m=R.getChars()||Aa,R.isUnderline()&&(q.push(`xterm-underline-${R.extended.underlineStyle}`),m===" "&&(m="\xA0"),!R.isUnderlineColorDefault()))if(R.isUnderlineColorRGB())_.style.textDecorationColor=`rgb(${gd.toColorRGB(R.getUnderlineColor()).join(",")})`;else{let Ne=R.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&R.isBold()&&Ne<8&&(Ne+=8),_.style.textDecorationColor=f.ansi[Ne].css}R.isOverline()&&(q.push("xterm-overline"),m===" "&&(m="\xA0")),R.isStrikethrough()&&q.push("xterm-strikethrough"),L&&(_.style.textDecoration="underline");let oe=R.getFgColor(),ge=R.getFgColorMode(),te=R.getBgColor(),We=R.getBgColorMode(),Ki=!!R.isInverse();if(Ki){let Ne=oe;oe=te,te=Ne;let gn=ge;ge=We,We=gn}let oi,yt,Hn=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,Ne=>{Ne.options.layer!=="top"&&Hn||(Ne.backgroundColorRGB&&(We=50331648,te=Ne.backgroundColorRGB.rgba>>8&16777215,oi=Ne.backgroundColorRGB),Ne.foregroundColorRGB&&(ge=50331648,oe=Ne.foregroundColorRGB.rgba>>8&16777215,yt=Ne.foregroundColorRGB),Hn=Ne.options.layer==="top")}),!Hn&&V&&(oi=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque,te=oi.rgba>>8&16777215,We=50331648,Hn=!0,f.selectionForeground&&(ge=50331648,oe=f.selectionForeground.rgba>>8&16777215,yt=f.selectionForeground)),Hn&&q.push("xterm-decoration-top");let Ht;switch(We){case 16777216:case 33554432:Ht=f.ansi[te],q.push(`xterm-bg-${te}`);break;case 50331648:Ht=Wt.toColor(te>>16,te>>8&255,te&255),this._addStyle(_,`background-color:#${EO((te>>>0).toString(16),"0",6)}`);break;default:Ki?(Ht=f.foreground,q.push("xterm-bg-257")):Ht=f.background}switch(oi||R.isDim()&&(oi=bt.multiplyOpacity(Ht,.5)),ge){case 16777216:case 33554432:R.isBold()&&oe<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(oe+=8),this._applyMinimumContrast(_,Ht,f.ansi[oe],R,oi,void 0)||q.push(`xterm-fg-${oe}`);break;case 50331648:let Ne=Wt.toColor(oe>>16&255,oe>>8&255,oe&255);this._applyMinimumContrast(_,Ht,Ne,R,oi,yt)||this._addStyle(_,`color:#${EO(oe.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(_,Ht,f.foreground,R,oi,yt)||Ki&&q.push("xterm-fg-257")}q.length&&(_.className=q.join(" "),q.length=0),!z&&!U&&!K&&C?y++:_.textContent=m,I!==this.defaultSpacing&&(_.style.letterSpacing=`${I}px`),d.push(_),P=D}return _&&y&&(_.textContent=m),d}_applyMinimumContrast(e,t,i,n,r,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||JH(n.getCode()))return!1;let a=this._getContrastCache(n),o;if(!r&&!s&&(o=a.getColor(t.rgba,i.rgba)),o===void 0){let l=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);o=bt.ensureContrastRatio(r||t,s||i,l),a.setColor((r||t).rgba,(s||i).rgba,o??null)}return o?(this._addStyle(e,`color:${o.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let i=this._selectionStart,n=this._selectionEnd;return!i||!n?!1:this._columnSelectMode?i[0]<=n[0]?e>=i[0]&&t>=i[1]&&e=i[1]&&e>=n[0]&&t<=n[1]:t>i[1]&&t=i[0]&&e=i[0]}};z0=Pt([ce(1,lR),ce(2,tn),ce(3,Ds),ce(4,Ao),ce(5,_d),ce(6,uc)],z0);tU=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let i=e.createElement("span");i.classList.add("xterm-char-measure-element");let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold",s.style.fontStyle="italic",this._measureElements=[i,n,r,s],this._container.appendChild(i),this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(s),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,i,n){e===this._font&&t===this._fontSize&&i===this._weight&&n===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(e,t,i){let n=0;if(!t&&!i&&e.length===1&&(n=e.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let a=this._measure(e,0);return a>0&&(this._flat[n]=a),a}let r=e;t&&(r+="B"),i&&(r+="I");let s=this._holey.get(r);if(s===void 0){let a=0;t&&(a|=1),i&&(a|=2),s=this._measure(e,a),s>0&&this._holey.set(r,s)}return s}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},iU=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,n=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let r=e.buffers.active.ydisp,s=t[1]-r,a=i[1]-r,o=Math.max(s,0),l=Math.min(a,e.rows-1);if(o>=e.rows||l<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=s,this.viewportEndRow=a,this.viewportCappedStartRow=o,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i=this.startCol&&t=this.startCol):!1}};t0="xterm-dom-renderer-owner-",er="xterm-rows",kp="xterm-fg-",kO="xterm-bg-",Zu="xterm-focus",Cp="xterm-selection",rU=1,B0=class extends Le{constructor(e,t,i,n,r,s,a,o,l,c,u,d,h,f){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=n,this._viewportElement=r,this._helperContainer=s,this._linkifier2=a,this._charSizeService=l,this._optionsService=c,this._bufferService=u,this._coreService=d,this._coreBrowserService=h,this._themeService=f,this._terminalClass=rU++,this._rowElements=[],this._selectionRenderModel=nU(),this.onRequestRedraw=this._register(new ee).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(er),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(Cp),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=eU(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(p=>this._injectCss(p))),this._injectCss(this._themeService.colors),this._rowFactory=o.createInstance(z0,document),this._element.classList.add(t0+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(p=>this._handleLinkHover(p))),this._register(this._linkifier2.onHideLinkUnderline(p=>this._handleLinkLeave(p))),this._register(wt(()=>{this._element.classList.remove(t0+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new tU(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${er} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${er} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${er} .xterm-dim { color: ${bt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let i=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${n} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${er}.${Zu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${er}.${Zu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${er}.${Zu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${er} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${er} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${er} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${er} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${er} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Cp} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Cp} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Cp} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,a]of e.ansi.entries())t+=`${this._terminalSelector} .${kp}${s} { color: ${a.css}; }${this._terminalSelector} .${kp}${s}.xterm-dim { color: ${bt.multiplyOpacity(a,.5).css}; }${this._terminalSelector} .${kO}${s} { background-color: ${a.css}; }`;t+=`${this._terminalSelector} .${kp}257 { color: ${bt.opaque(e.background).css}; }${this._terminalSelector} .${kp}257.xterm-dim { color: ${bt.multiplyOpacity(bt.opaque(e.background),.5).css}; }${this._terminalSelector} .${kO}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let i=this._rowElements.length;i<=t;i++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Zu),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Zu),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,s=this._selectionRenderModel.viewportCappedStartRow,a=this._selectionRenderModel.viewportCappedEndRow,o=this._document.createDocumentFragment();if(i){let l=e[0]>t[0];o.appendChild(this._createSelectionElement(s,l?t[0]:e[0],l?e[0]:t[0],a-s+1))}else{let l=n===s?e[0]:0,c=s===r?t[0]:this._bufferService.cols;o.appendChild(this._createSelectionElement(s,l,c));let u=a-s-1;if(o.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,u)),s!==a){let d=r===a?t[0]:this._bufferService.cols;o.appendChild(this._createSelectionElement(a,0,d))}}this._selectionContainer.appendChild(o)}_createSelectionElement(e,t,i,n=1){let r=this._document.createElement("div"),s=t*this.dimensions.css.cell.width,a=this.dimensions.css.cell.width*(i-t);return s+a>this.dimensions.css.canvas.width&&(a=this.dimensions.css.canvas.width-s),r.style.height=`${n*this.dimensions.css.cell.height}px`,r.style.top=`${e*this.dimensions.css.cell.height}px`,r.style.left=`${s}px`,r.style.width=`${a}px`,r}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let i=this._bufferService.buffer,n=i.ybase+i.y,r=Math.min(i.x,this._bufferService.cols-1),s=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,a=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,o=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=e;l<=t;l++){let c=l+i.ydisp,u=this._rowElements[l],d=i.lines.get(c);if(!u||!d)break;u.replaceChildren(...this._rowFactory.createRow(d,c,c===n,a,o,r,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${t0}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,i,n,r,s){i<0&&(e=0),n<0&&(t=0);let a=this._bufferService.rows-1;i=Math.max(Math.min(i,a),0),n=Math.max(Math.min(n,a),0),r=Math.min(r,this._bufferService.cols);let o=this._bufferService.buffer,l=o.ybase+o.y,c=Math.min(o.x,r-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=i;f<=n;++f){let p=f+o.ydisp,_=this._rowElements[f],y=o.lines.get(p);if(!_||!y)break;_.replaceChildren(...this._rowFactory.createRow(y,p,p===l,d,h,c,u,this.dimensions.css.cell.width,this._widthCache,s?f===i?e:0:-1,s?(f===n?t:r)-1:-1))}}};B0=Pt([ce(7,Z0),ce(8,Gp),ce(9,tn),ce(10,en),ce(11,Ao),ce(12,Ds),ce(13,uc)],B0);P0=class extends Le{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ee),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new aU(this._optionsService))}catch{this._measureStrategy=this._register(new sU(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};P0=Pt([ce(2,tn)],P0);RR=class extends Le{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},sU=class extends RR{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},aU=class extends RR{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},oU=class extends Le{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new lU(this._window)),this._onDprChange=this._register(new ee),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ee),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(bi.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(ke(this._textarea,"focus",()=>this._isFocused=!0)),this._register(ke(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},lU=class extends Le{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new cc),this._onDprChange=this._register(new ee),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(wt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=ke(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},cU=class extends Le{constructor(){super(),this.linkProviders=[],this._register(wt(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};H0=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,n,r){return uU(window,e,t,i,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let i=sy(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};H0=Pt([ce(0,Ls),ce(1,Gp)],H0);dU=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},DR={};Z6(DR,{getSafariVersion:()=>fU,isChromeOS:()=>BR,isFirefox:()=>LR,isIpad:()=>pU,isIphone:()=>mU,isLegacyEdge:()=>hU,isLinux:()=>ay,isMac:()=>Fp,isNode:()=>Vp,isSafari:()=>IR,isWindows:()=>zR});Vp=typeof process<"u"&&"title"in process,vd=Vp?"node":navigator.userAgent,bd=Vp?"node":navigator.platform,LR=vd.includes("Firefox"),hU=vd.includes("Edge"),IR=/^((?!chrome|android).)*safari/i.test(vd);Fp=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(bd),pU=bd==="iPad",mU=bd==="iPhone",zR=["Windows","Win16","Win32","WinCE"].includes(bd),ay=bd.indexOf("Linux")>=0,BR=/\bCrOS\b/.test(vd),PR=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._ir){n-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=r}this.clear()}},gU=class extends PR{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},_U=class extends PR{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Wp=!Vp&&"requestIdleCallback"in window?_U:gU,vU=class{constructor(){this._queue=new Wp}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},U0=class extends Le{constructor(e,t,i,n,r,s,a,o,l){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=n,this._coreService=r,this._coreBrowserService=o,this._renderer=this._register(new cc),this._pausedResizeTask=new vU,this._observerDisposable=this._register(new cc),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new ee),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ee),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ee),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ee),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new dU((c,u)=>this._renderRows(c,u),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new bU(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(wt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(a.onResize(()=>this._fullRefresh())),this._register(a.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(s.onDecorationRegistered(()=>this._fullRefresh())),this._register(s.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(a.cols,a.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(a.buffer.y,a.buffer.y,!0))),this._register(l.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=wt(()=>i.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,i=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let n=this._syncOutputHandler.flush();n&&(e=Math.min(e,n.start),t=Math.max(t,n.end)),i||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,i){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,this._renderer.value?.handleSelectionChanged(e,t,i)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};U0=Pt([ce(2,tn),ce(3,Gp),ce(4,Ao),ce(5,_d),ce(6,en),ce(7,Ds),ce(8,uc)],U0);bU=class{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};TU=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};i0=50,NU=15,AU=50,MU=500,OU="\xA0",RU=new RegExp(OU,"g"),q0=class extends Le{constructor(e,t,i,n,r,s,a,o,l){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=n,this._coreService=r,this._mouseService=s,this._optionsService=a,this._renderService=o,this._coreBrowserService=l,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new nr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ee),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ee),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ee),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ee),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new TU(this._bufferService),this._activeSelectionMode=0,this._register(wt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let i=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let r=e[0]r.replace(RU," ")).join(zR?`\r +`).trim(),l=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(o);Hp.register(a,l?.[2]??o,a)}return a}),this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let n=this._deliveryQueue.current===this;if(this._size*tH<=t.length){let r=0;for(let s=0;s0}},nH=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},I0=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ee,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ee,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let n=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(n,t),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let n=this.getWindowId(i);this.mapWindowIdToFullScreen.set(n,t),this._onDidChangeFullscreen.fire(n)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};I0.INSTANCE=new I0;uy=I0;KW=uy.INSTANCE.onDidChangeZoomLevel;GW=uy.INSTANCE.onDidChangeFullscreen,gc=typeof navigator=="object"?navigator.userAgent:"",z0=gc.indexOf("Firefox")>=0,Up=gc.indexOf("AppleWebKit")>=0,dy=gc.indexOf("Chrome")>=0,BR=!dy&&gc.indexOf("Safari")>=0,jW=gc.indexOf("Electron/")>=0,YW=gc.indexOf("Android")>=0,qp=!1;if(typeof Un.matchMedia=="function"){let e=Un.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Un.matchMedia("(display-mode: fullscreen)");qp=e.matches,rH(Un,e,({matches:i})=>{qp&&t.matches||(qp=i)})}fc="en",Gp=!1,jp=!1,_d=!1,oH=!1,PR=!1,HR=!1,lH=!1,cH=!1,uH=!1,dH=!1,Fp=fc,wO=fc,Ls=globalThis;typeof Ls.vscode<"u"&&typeof Ls.vscode.process<"u"?Hn=Ls.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Hn=process);UR=typeof Hn?.versions?.electron=="string",fH=UR&&Hn?.type==="renderer";if(typeof Hn=="object"){Gp=Hn.platform==="win32",jp=Hn.platform==="darwin",_d=Hn.platform==="linux",oH=_d&&!!Hn.env.SNAP&&!!Hn.env.SNAP_REVISION,lH=UR,uH=!!Hn.env.CI||!!Hn.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Rp=fc,Fp=fc;let e=Hn.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Rp=t.userLocale,wO=t.osLocale,Fp=t.resolvedLanguage||fc,hH=t.languagePack?.translationsConfigFile}catch{}PR=!0}else typeof navigator=="object"&&!fH?(Rs=navigator.userAgent,Gp=Rs.indexOf("Windows")>=0,jp=Rs.indexOf("Macintosh")>=0,cH=(Rs.indexOf("Macintosh")>=0||Rs.indexOf("iPad")>=0||Rs.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,_d=Rs.indexOf("Linux")>=0,dH=Rs?.indexOf("Mobi")>=0,HR=!0,Fp=globalThis._VSCODE_NLS_LANGUAGE||fc,Rp=navigator.language.toLowerCase(),wO=Rp):console.error("Unable to resolve platform.");s0=0;jp?s0=1:Gp?s0=3:_d&&(s0=2);qR=Gp,es=jp,pH=_d,a0=PR,mH=HR&&typeof Ls.importScripts=="function",VW=mH?Ls.origin:void 0,ts=Rs,Aa=Fp;(e=>{function t(){return Aa}e.value=t;function i(){return Aa.length===2?Aa==="en":Aa.length>=3?Aa[0]==="e"&&Aa[1]==="n"&&Aa[2]==="-":!1}e.isDefaultVariant=i;function n(){return Aa==="en"}e.isDefault=n})(xO||(xO={}));gH=typeof Ls.postMessage=="function"&&!Ls.importScripts,_H=(()=>{if(gH){let e=[];Ls.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n{let n=++t;e.push({id:n,callback:i}),Ls.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})(),vH=!!(ts&&ts.indexOf("Chrome")>=0),XW=!!(ts&&ts.indexOf("Firefox")>=0),ZW=!!(!vH&&ts&&ts.indexOf("Safari")>=0),QW=!!(ts&&ts.indexOf("Edg/")>=0),JW=!!(ts&&ts.indexOf("Android")>=0),Ma=typeof navigator=="object"?navigator:{},eK={clipboard:{writeText:a0||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(Ma&&Ma.clipboard&&Ma.clipboard.writeText),readText:a0||!!(Ma&&Ma.clipboard&&Ma.clipboard.readText)},keyboard:a0||aH()?0:Ma.keyboard||BR?1:2,touch:"ontouchstart"in Un||Ma.maxTouchPoints>0,pointerEvents:Un.PointerEvent&&("ontouchstart"in Un||navigator.maxTouchPoints>0)},hy=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},o0=new hy,EO=new hy,kO=new hy,bH=new Array(230);(e=>{function t(o){return o0.keyCodeToStr(o)}e.toString=t;function i(o){return o0.strToKeyCode(o)}e.fromString=i;function n(o){return EO.keyCodeToStr(o)}e.toUserSettingsUS=n;function r(o){return kO.keyCodeToStr(o)}e.toUserSettingsGeneral=r;function s(o){return EO.strToKeyCode(o)||kO.strToKeyCode(o)}e.fromUserSettings=s;function a(o){if(o>=98&&o<=113)return null;switch(o){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return o0.keyCodeToStr(o)}e.toElectronAccelerator=a})(B0||(B0={}));yH=class FR{constructor(t,i,n,r,s){this.ctrlKey=t,this.shiftKey=i,this.altKey=n,this.metaKey=r,this.keyCode=s}equals(t){return t instanceof FR&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",n=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${i}${n}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new SH([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},SH=class{constructor(e){if(e.length===0)throw DP("chords");this.chords=e}getHashCode(){let e="";for(let t=0,i=this.chords.length;t{function t(i){return i===e.None||i===e.Cancelled||i instanceof AH?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:bi.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:$R})})(NO||(NO={}));AH=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?$R:(this._emitter||(this._emitter=new ee),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},fy=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new C0("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new C0("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},MH=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new C0("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=i.setInterval(()=>{e()},t);this.disposable=Ct(()=>{i.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?l0=(e,t)=>{_H(()=>{if(i)return;let n=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,n-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:l0=(e,t,i)=>{let n=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),r=!1;return{dispose(){r||(r=!0,e.cancelIdleCallback(n))}}},OH=e=>l0(globalThis,e)})();(e=>{async function t(n){let r,s=await Promise.all(n.map(a=>a.then(o=>o,o=>{r||(r=o)})));if(typeof r<"u")throw r;return s}e.settled=t;function i(n){return new Promise(async(r,s)=>{try{await n(r,s)}catch(a){s(a)}})}e.withAsyncBody=i})(AO||(AO={}));MO=class rr{static fromArray(t){return new rr(i=>{i.emitMany(t)})}static fromPromise(t){return new rr(async i=>{i.emitMany(await t)})}static fromPromises(t){return new rr(async i=>{await Promise.all(t.map(async n=>i.emitOne(await n)))})}static merge(t){return new rr(async i=>{await Promise.all(t.map(async n=>{for await(let r of n)i.emitOne(r)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ee,queueMicrotask(async()=>{let n={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(n)),this.resolve()}catch(r){this.reject(r)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new rr(async n=>{for await(let r of t)n.emitOne(i(r))})}map(t){return rr.map(this,t)}static filter(t,i){return new rr(async n=>{for await(let r of t)i(r)&&n.emitOne(r)})}filter(t){return rr.filter(this,t)}static coalesce(t){return rr.filter(t,i=>!!i)}coalesce(){return rr.coalesce(this)}static async toPromise(t){let i=[];for await(let n of t)i.push(n);return i}toPromise(){return rr.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};MO.EMPTY=MO.fromArray([]);HH=class KR{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let i=t.length;if(i===0)return;let n=this._buff,r=this._buffLen,s=this._leftoverHighSurrogate,a,o;for(s!==0?(a=s,o=-1,s=0):(a=t.charCodeAt(0),o=0);;){let l=a;if(RH(a))if(o+1>>6,t[i++]=128|(n&63)>>>0):n<65536?(t[i++]=224|(n&61440)>>>12,t[i++]=128|(n&4032)>>>6,t[i++]=128|(n&63)>>>0):(t[i++]=240|(n&1835008)>>>18,t[i++]=128|(n&258048)>>>12,t[i++]=128|(n&4032)>>>6,t[i++]=128|(n&63)>>>0),i>=64&&(this._step(),i-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),i}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),rd(this._h0)+rd(this._h1)+rd(this._h2)+rd(this._h3)+rd(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,RO(this._buff,this._buffLen),this._buffLen>56&&(this._step(),RO(this._buff));let t=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(t/4294967296),!1),this._buffDV.setUint32(60,t%4294967296,!1),this._step()}_step(){let t=KR._bigBlock32,i=this._buffDV;for(let d=0;d<64;d+=4)t.setUint32(d,i.getUint32(d,!1),!1);for(let d=64;d<320;d+=4)t.setUint32(d,c0(t.getUint32(d-12,!1)^t.getUint32(d-32,!1)^t.getUint32(d-56,!1)^t.getUint32(d-64,!1),1),!1);let n=this._h0,r=this._h1,s=this._h2,a=this._h3,o=this._h4,l,c,u;for(let d=0;d<80;d++)d<20?(l=r&s|~r&a,c=1518500249):d<40?(l=r^s^a,c=1859775393):d<60?(l=r&s|r&a|s&a,c=2400959708):(l=r^s^a,c=3395469782),u=c0(n,5)+l+o+c+t.getUint32(d*4,!1)&4294967295,o=a,a=s,s=c0(r,30),r=n,n=u;this._h0=this._h0+n&4294967295,this._h1=this._h1+r&4294967295,this._h2=this._h2+s&4294967295,this._h3=this._h3+a&4294967295,this._h4=this._h4+o&4294967295}};HH._bigBlock32=new DataView(new ArrayBuffer(320));({registerWindow:tK,getWindow:Cr,getDocument:iK,getWindows:nK,getWindowsCount:rK,getWindowId:DO,getWindowById:sK,hasWindow:aK,onDidRegisterWindow:UH,onWillUnregisterWindow:oK,onDidUnregisterWindow:lK}=(function(){let e=new Map,t={window:Un,disposables:new Ia};e.set(Un.vscodeWindowId,t);let i=new ee,n=new ee,r=new ee;function s(a,o){return(typeof a=="number"?e.get(a):void 0)??(o?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:n.event,registerWindow(a){if(e.has(a.vscodeWindowId))return Ie.None;let o=new Ia,l={window:a,disposables:o.add(new Ia)};return e.set(a.vscodeWindowId,l),o.add(Ct(()=>{e.delete(a.vscodeWindowId),n.fire(a)})),o.add(Te(a,mi.BEFORE_UNLOAD,()=>{r.fire(a)})),i.fire(l),o},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(a){return a.vscodeWindowId},hasWindow(a){return e.has(a)},getWindowById:s,getWindow(a){let o=a;if(o?.ownerDocument?.defaultView)return o.ownerDocument.defaultView.window;let l=a;return l?.view?l.view.window:Un},getDocument(a){return Cr(a).document}}})()),qH=class{constructor(e,t,i,n){this._node=e,this._type=t,this._handler=i,this._options=n||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};LO=function(e,t,i,n){let r=i;return t==="click"||t==="mousedown"||t==="contextmenu"?r=FH(Cr(e),i):(t==="keydown"||t==="keypress"||t==="keyup")&&(r=$H(i)),Te(e,t,r,n)},KH=class extends MH{constructor(e){super(),this.defaultTarget=e&&Cr(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},u0=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Bp(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,n=new Map,r=s=>{i.set(s,!1);let a=e.get(s)??[];for(t.set(s,a),e.set(s,[]),n.set(s,!0);a.length>0;)a.sort(u0.sort),a.shift().execute();n.set(s,!1)};Yp=(s,a,o=0)=>{let l=DO(s),c=new u0(a,o),u=e.get(l);return u||(u=[],e.set(l,u)),u.push(c),i.get(l)||(i.set(l,!0),s.requestAnimationFrame(()=>r(l))),c},WH=(s,a,o)=>{let l=DO(s);if(n.get(l)){let c=new u0(a,o),u=t.get(l);return u||(u=[],t.set(l,u)),u.push(c),c}else return Yp(s,a,o)}})();IO=class $p{constructor(t,i){this.width=t,this.height=i}with(t=this.width,i=this.height){return t!==this.width||i!==this.height?new $p(t,i):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof $p?t:new $p(t.width,t.height)}static equals(t,i){return t===i?!0:!t||!i?!1:t.width===i.width&&t.height===i.height}};IO.None=new IO(0,0);cK=new class{constructor(){this.mutationObservers=new Map}observe(e,t,i){let n=this.mutationObservers.get(e);n||(n=new Map,this.mutationObservers.set(e,n));let r=LH(i),s=n.get(r);if(s)s.users+=1;else{let a=new ee,o=new MutationObserver(c=>a.fire(c));o.observe(e,i);let l=s={users:1,observer:o,onDidMutate:a.event};t.add(Ct(()=>{l.users-=1,l.users===0&&(a.dispose(),o.disconnect(),n?.delete(r),n?.size===0&&this.mutationObservers.delete(e))})),n.set(r,s)}return s.onDidMutate}},mi={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:Up?"webkitAnimationStart":"animationstart",ANIMATION_END:Up?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Up?"webkitAnimationIteration":"animationiteration"},jH=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;YH.SVG=function(e,t,...i){return GR("http://www.w3.org/2000/svg",e,t,...i)};VH=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=_n(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=_n(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=_n(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=_n(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=_n(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=_n(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=_n(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=_n(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=_n(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=_n(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=_n(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=_n(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=_n(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=_n(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};jR=class{constructor(){this._hooks=new Ia,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,n,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=r;let s=e;try{e.setPointerCapture(t),this._hooks.add(Ct(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=Cr(e)}this._hooks.add(Te(s,mi.POINTER_MOVE,a=>{if(a.buttons!==i){this.stopMonitoring(!0);return}a.preventDefault(),this._pointerMoveCallback(a)})),this._hooks.add(Te(s,mi.POINTER_UP,a=>this.stopMonitoring(!0)))}};(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(kr||(kr={}));hd=class Wi extends Ie{constructor(){super(),this.dispatched=!1,this.targets=new bO,this.ignoreTargets=new bO,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(bi.runAndSubscribe(UH,({window:t,disposables:i})=>{i.add(Te(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),i.add(Te(t.document,"touchend",n=>this.onTouchEnd(t,n))),i.add(Te(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:Un,disposables:this._store}))}static addTarget(t){if(!Wi.isTouchDevice())return Ie.None;Wi.INSTANCE||(Wi.INSTANCE=vO(new Wi));let i=Wi.INSTANCE.targets.push(t);return Ct(i)}static ignoreTarget(t){if(!Wi.isTouchDevice())return Ie.None;Wi.INSTANCE||(Wi.INSTANCE=vO(new Wi));let i=Wi.INSTANCE.ignoreTargets.push(t);return Ct(i)}static isTouchDevice(){return"ontouchstart"in Un||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let n=0,r=t.targetTouches.length;n=Wi.HOLD_DELAY&&Math.abs(l.initialPageX-Bn(l.rollingPageX))<30&&Math.abs(l.initialPageY-Bn(l.rollingPageY))<30){let u=this.newGestureEvent(kr.Contextmenu,l.initialTarget);u.pageX=Bn(l.rollingPageX),u.pageY=Bn(l.rollingPageY),this.dispatchEvent(u)}else if(r===1){let u=Bn(l.rollingPageX),d=Bn(l.rollingPageY),h=Bn(l.rollingTimestamps)-l.rollingTimestamps[0],f=u-l.rollingPageX[0],p=d-l.rollingPageY[0],_=[...this.targets].filter(y=>l.initialTarget instanceof Node&&y.contains(l.initialTarget));this.inertia(t,_,n,Math.abs(f)/h,f>0?1:-1,u,Math.abs(p)/h,p>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(kr.End,l.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,i){let n=document.createEvent("CustomEvent");return n.initEvent(t,!1,!0),n.initialTarget=i,n.tapCount=0,n}dispatchEvent(t){if(t.type===kr.Tap){let i=new Date().getTime(),n=0;i-this._lastSetTapCountTime>Wi.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=i,t.tapCount=n}else(t.type===kr.Change||t.type===kr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let n of this.ignoreTargets)if(n.contains(t.initialTarget))return;let i=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,s=t.initialTarget;for(;s&&s!==n;)r++,s=s.parentElement;i.push([r,n])}i.sort((n,r)=>n[0]-r[0]);for(let[n,r]of i)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,i,n,r,s,a,o,l,c){this.handle=Yp(t,()=>{let u=Date.now(),d=u-n,h=0,f=0,p=!0;r+=Wi.SCROLL_FRICTION*d,o+=Wi.SCROLL_FRICTION*d,r>0&&(p=!1,h=s*r*d),o>0&&(p=!1,f=l*o*d);let _=this.newGestureEvent(kr.Change);_.translationX=h,_.translationY=f,i.forEach(y=>y.dispatchEvent(_)),p||this.inertia(t,i,u,r,s,a+h,o,l,c+f)})}onTouchMove(t){let i=Date.now();for(let n=0,r=t.changedTouches.length;n3&&(a.rollingPageX.shift(),a.rollingPageY.shift(),a.rollingTimestamps.shift()),a.rollingPageX.push(s.pageX),a.rollingPageY.push(s.pageY),a.rollingTimestamps.push(i)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};hd.SCROLL_FRICTION=-.005,hd.HOLD_DELAY=700,hd.CLEAR_TAP_COUNT_TIME=400,Ft([XH],hd,"isTouchDevice",1);ZH=hd,my=class extends Ie{onclick(e,t){this._register(Te(e,mi.CLICK,i=>t(new dd(Cr(e),i))))}onmousedown(e,t){this._register(Te(e,mi.MOUSE_DOWN,i=>t(new dd(Cr(e),i))))}onmouseover(e,t){this._register(Te(e,mi.MOUSE_OVER,i=>t(new dd(Cr(e),i))))}onmouseleave(e,t){this._register(Te(e,mi.MOUSE_LEAVE,i=>t(new dd(Cr(e),i))))}onkeydown(e,t){this._register(Te(e,mi.KEY_DOWN,i=>t(new P0(i))))}onkeyup(e,t){this._register(Te(e,mi.KEY_UP,i=>t(new P0(i))))}oninput(e,t){this._register(Te(e,mi.INPUT,t))}onblur(e,t){this._register(Te(e,mi.BLUR,t))}onfocus(e,t){this._register(Te(e,mi.FOCUS,t))}onchange(e,t){this._register(Te(e,mi.CHANGE,t))}ignoreGesture(e){return ZH.ignoreTarget(e)}},zO=11,QH=class extends my{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=zO+"px",this.domNode.style.height=zO+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new jR),this._register(LO(this.bgDomNode,mi.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(LO(this.domNode,mi.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new KH),this._pointerdownScheduleRepeatTimer=this._register(new fy)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Cr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},JH=class H0{constructor(t,i,n,r,s,a,o){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,n=n|0,r=r|0,s=s|0,a=a|0,o=o|0),this.rawScrollLeft=r,this.rawScrollTop=o,i<0&&(i=0),r+i>n&&(r=n-i),r<0&&(r=0),s<0&&(s=0),o+s>a&&(o=a-s),o<0&&(o=0),this.width=i,this.scrollWidth=n,this.scrollLeft=r,this.height=s,this.scrollHeight=a,this.scrollTop=o}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,i){return new H0(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new H0(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,i){let n=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,s=this.scrollLeft!==t.scrollLeft,a=this.height!==t.height,o=this.scrollHeight!==t.scrollHeight,l=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:i,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:s,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:l}}},eU=class extends Ie{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ee),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new JH(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let n;t?n=new PO(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=PO.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},BO=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};PO=class U0{constructor(t,i,n,r){this.from=t,this.to=i,this.duration=r,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,i,n){if(Math.abs(t-i)>2.5*n){let r,s;return t{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},sU=140,YR=class extends my{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new rU(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new jR),this._shouldRender=!0,this.domNode=vd(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Te(this.domNode.domNode,mi.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new QH(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,n){this.slider=vd(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof n=="number"&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Te(this.slider.domNode,mi.POINTER_DOWN,r=>{r.button===0&&(r.preventDefault(),this._sliderPointerDown(r))})),this.onclick(this.slider.domNode,r=>{r.leftButton&&r.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),n=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);i<=r&&r<=n?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{let r=GH(this.domNode.domNode);t=e.pageX-r.left,i=e.pageY-r.top}let n=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),n=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{let s=this._sliderOrthogonalPointerPosition(r),a=Math.abs(s-i);if(qR&&a>sU){this._setDesiredScrollPositionNow(n.getScrollPosition());return}let o=this._sliderPointerPosition(r)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},VR=class q0{constructor(t,i,n,r,s,a){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(t),this._visibleSize=r,this._scrollSize=s,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new q0(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let i=Math.round(t);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(t){let i=Math.round(t);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let i=Math.round(t);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,i,n,r,s){let a=Math.max(0,n-t),o=Math.max(0,a-2*i),l=r>0&&r>n;if(!l)return{computedAvailableSize:Math.round(a),computedIsNeeded:l,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),u=(o-c)/(r-n),d=s*u;return{computedAvailableSize:Math.round(a),computedIsNeeded:l,computedSliderSize:Math.round(c),computedSliderRatio:u,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){let t=q0._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize,n=this._scrollPosition;return i0&&Math.abs(t.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(n+=.25),i){let r=Math.abs(t.deltaX),s=Math.abs(t.deltaY),a=Math.abs(i.deltaX),o=Math.abs(i.deltaY),l=Math.max(Math.min(r,a),1),c=Math.max(Math.min(s,o),1),u=Math.max(r,a),d=Math.max(s,o);u%l===0&&d%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};F0.INSTANCE=new F0;uU=F0,dU=class extends my{constructor(e,t,i){super(),this._onScroll=this._register(new ee),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ee),this.onWillScroll=this._onWillScroll.event,this._options=fU(t),this._scrollable=i,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let n={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new oU(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new aU(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=vd(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=vd(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=vd(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new fy),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Do(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,es&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new TO(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Do(this._mouseWheelToDispose),e)){let t=i=>{this._onMouseWheel(new TO(i))};this._mouseWheelToDispose.push(Te(this._listenOnDomNode,mi.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=uU.INSTANCE;UO&&t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,s=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&s+r===0?s=r=0:Math.abs(r)>=Math.abs(s)?s=0:r=0),this._options.flipAxes&&([r,s]=[s,r]);let a=!es&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!s&&(s=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(s=s*this._options.fastScrollSensitivity,r=r*this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),l={};if(r){let c=HO*r,u=o.scrollTop-(c<0?Math.floor(c):Math.ceil(c));this._verticalScrollbar.writeScrollPosition(l,u)}if(s){let c=HO*s,u=o.scrollLeft-(c<0?Math.floor(c):Math.ceil(c));this._horizontalScrollbar.writeScrollPosition(l,u)}l=this._scrollable.validateScrollPosition(l),(o.scrollLeft!==l.scrollLeft||o.scrollTop!==l.scrollTop)&&(UO&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(l):this._scrollable.setScrollPositionNow(l),i=!0)}let n=i;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,n=i?" left":"",r=t?" top":"",s=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${r}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),lU)}},hU=class extends dU{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};$0=class extends Ie{constructor(e,t,i,n,r,s,a,o){super(),this._bufferService=i,this._optionsService=a,this._renderService=o,this._onRequestScrollLines=this._register(new ee),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let l=this._register(new eU({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>Yp(n.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{l.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new hU(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},l)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(bi.runAndSubscribe(s.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=s.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ct(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Ct(()=>this._styleElement.remove())),this._register(bi.runAndSubscribe(s.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${s.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${s.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${s.colors.scrollbarSliderActiveBackground.css};`,"}"].join(` +`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(c=>this._handleScroll(c)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),i=t-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};$0=Ft([oe(2,nn),oe(3,Is),oe(4,xR),oe(5,mc),oe(6,rn),oe(7,zs)],$0);W0=class extends Ie{constructor(e,t,i,n,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=n,this._renderService=r,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(s=>this._removeDecoration(s))),this._register(Ct(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let i=e.options.x??0;return i&&i>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=i?`${i*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};W0=Ft([oe(1,nn),oe(2,Is),oe(3,Cd),oe(4,zs)],W0);pU=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Qr={full:0,left:0,center:0,right:0},Oa={full:0,left:0,center:0,right:0},sd={full:0,left:0,center:0,right:0},Vp=class extends Ie{constructor(e,t,i,n,r,s,a,o){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=n,this._renderService=r,this._optionsService=s,this._themeService=a,this._coreBrowserService=o,this._colorZoneStore=new pU,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(Ct(()=>this._canvas?.remove()));let l=this._canvas.getContext("2d");if(l)this._ctx=l;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Oa.full=this._canvas.width,Oa.left=e,Oa.center=t,Oa.right=e,this._refreshDrawHeightConstants(),sd.full=1,sd.left=1,sd.center=1+Oa.left,sd.right=1+Oa.left+Oa.center}_refreshDrawHeightConstants(){Qr.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Qr.left=t,Qr.center=t,Qr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Qr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Qr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Qr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Qr.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(sd[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Qr[e.position||"full"]/2),Oa[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Qr[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Vp=Ft([oe(2,nn),oe(3,Cd),oe(4,zs),oe(5,rn),oe(6,mc),oe(7,Is)],Vp);(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=` +`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL="\x7F"))(W||(W={}));(e=>(e.PAD="\x80",e.HOP="\x81",e.BPH="\x82",e.NBH="\x83",e.IND="\x84",e.NEL="\x85",e.SSA="\x86",e.ESA="\x87",e.HTS="\x88",e.HTJ="\x89",e.VTS="\x8A",e.PLD="\x8B",e.PLU="\x8C",e.RI="\x8D",e.SS2="\x8E",e.SS3="\x8F",e.DCS="\x90",e.PU1="\x91",e.PU2="\x92",e.STS="\x93",e.CCH="\x94",e.MW="\x95",e.SPA="\x96",e.EPA="\x97",e.SOS="\x98",e.SGCI="\x99",e.SCI="\x9A",e.CSI="\x9B",e.ST="\x9C",e.OSC="\x9D",e.PM="\x9E",e.APC="\x9F"))(bd||(bd={}));(e=>e.ST=`${W.ESC}\\`)(K0||(K0={}));G0=class{constructor(e,t,i,n,r,s){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=n,this._coreService=r,this._renderService=s,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let i;t.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(t.start,this._compositionPosition.start):i=this._textarea.value.substring(t.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.lengththis.updateCompositionElements(!0),0)}}};G0=Ft([oe(2,nn),oe(3,rn),oe(4,Io),oe(5,zs)],G0);gi=0,_i=0,vi=0,qt=0,qO={css:"#00000000",rgba:0};(e=>{function t(r,s,a,o){return o!==void 0?`#${No(r)}${No(s)}${No(a)}${No(o)}`:`#${No(r)}${No(s)}${No(a)}`}e.toCss=t;function i(r,s,a,o=255){return(r<<24|s<<16|a<<8|o)>>>0}e.toRgba=i;function n(r,s,a,o){return{css:e.toCss(r,s,a,o),rgba:e.toRgba(r,s,a,o)}}e.toColor=n})(jt||(jt={}));(e=>{function t(l,c){if(qt=(c.rgba&255)/255,qt===1)return{css:c.css,rgba:c.rgba};let u=c.rgba>>24&255,d=c.rgba>>16&255,h=c.rgba>>8&255,f=l.rgba>>24&255,p=l.rgba>>16&255,_=l.rgba>>8&255;gi=f+Math.round((u-f)*qt),_i=p+Math.round((d-p)*qt),vi=_+Math.round((h-_)*qt);let y=jt.toCss(gi,_i,vi),m=jt.toRgba(gi,_i,vi);return{css:y,rgba:m}}e.blend=t;function i(l){return(l.rgba&255)===255}e.isOpaque=i;function n(l,c,u){let d=yd.ensureContrastRatio(l.rgba,c.rgba,u);if(d)return jt.toColor(d>>24&255,d>>16&255,d>>8&255)}e.ensureContrastRatio=n;function r(l){let c=(l.rgba|255)>>>0;return[gi,_i,vi]=yd.toChannels(c),{css:jt.toCss(gi,_i,vi),rgba:c}}e.opaque=r;function s(l,c){return qt=Math.round(c*255),[gi,_i,vi]=yd.toChannels(l.rgba),{css:jt.toCss(gi,_i,vi,qt),rgba:jt.toRgba(gi,_i,vi,qt)}}e.opacity=s;function a(l,c){return qt=l.rgba&255,s(l,qt*c/255)}e.multiplyOpacity=a;function o(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}e.toColorRGB=o})(Et||(Et={}));(e=>{let t,i;try{let r=document.createElement("canvas");r.width=1,r.height=1;let s=r.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function n(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return gi=parseInt(r.slice(1,2).repeat(2),16),_i=parseInt(r.slice(2,3).repeat(2),16),vi=parseInt(r.slice(3,4).repeat(2),16),jt.toColor(gi,_i,vi);case 5:return gi=parseInt(r.slice(1,2).repeat(2),16),_i=parseInt(r.slice(2,3).repeat(2),16),vi=parseInt(r.slice(3,4).repeat(2),16),qt=parseInt(r.slice(4,5).repeat(2),16),jt.toColor(gi,_i,vi,qt);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let s=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return gi=parseInt(s[1]),_i=parseInt(s[2]),vi=parseInt(s[3]),qt=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),jt.toColor(gi,_i,vi,qt);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[gi,_i,vi,qt]=t.getImageData(0,0,1,1).data,qt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:jt.toRgba(gi,_i,vi,qt),css:r}}e.toColor=n})(Dt||(Dt={}));(e=>{function t(n){return i(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function i(n,r,s){let a=n/255,o=r/255,l=s/255,c=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),u=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return c*.2126+u*.7152+d*.0722}e.relativeLuminance2=i})(Ki||(Ki={}));(e=>{function t(a,o){if(qt=(o&255)/255,qt===1)return o;let l=o>>24&255,c=o>>16&255,u=o>>8&255,d=a>>24&255,h=a>>16&255,f=a>>8&255;return gi=d+Math.round((l-d)*qt),_i=h+Math.round((c-h)*qt),vi=f+Math.round((u-f)*qt),jt.toRgba(gi,_i,vi)}e.blend=t;function i(a,o,l){let c=Ki.relativeLuminance(a>>8),u=Ki.relativeLuminance(o>>8);if(Os(c,u)>8));if(p>8));return p>y?f:_}return f}let d=r(a,o,l),h=Os(c,Ki.relativeLuminance(d>>8));if(h>8));return h>p?d:f}return d}}e.ensureContrastRatio=i;function n(a,o,l){let c=a>>24&255,u=a>>16&255,d=a>>8&255,h=o>>24&255,f=o>>16&255,p=o>>8&255,_=Os(Ki.relativeLuminance2(h,f,p),Ki.relativeLuminance2(c,u,d));for(;_0||f>0||p>0);)h-=Math.max(0,Math.ceil(h*.1)),f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),_=Os(Ki.relativeLuminance2(h,f,p),Ki.relativeLuminance2(c,u,d));return(h<<24|f<<16|p<<8|255)>>>0}e.reduceLuminance=n;function r(a,o,l){let c=a>>24&255,u=a>>16&255,d=a>>8&255,h=o>>24&255,f=o>>16&255,p=o>>8&255,_=Os(Ki.relativeLuminance2(h,f,p),Ki.relativeLuminance2(c,u,d));for(;_>>0}e.increaseLuminance=r;function s(a){return[a>>24&255,a>>16&255,a>>8&255,a&255]}e.toChannels=s})(yd||(yd={}));mU=class extends kd{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Xp=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new ar}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t1){let u=this._getJoinedRanges(n,a,s,t,r);for(let d=0;d1){let c=this._getJoinedRanges(n,a,s,t,r);for(let u=0;u=B,D=P,R=this._workCell;if(h.length>0&&P===h[0][0]&&C){let Ce=h.shift(),ei=this._isCellInSelection(Ce[0],t);for(v=Ce[0]+1;v=Ce[1]),C?(U=!0,R=new mU(this._workCell,e.translateToString(!0,Ce[0],Ce[1]),Ce[1]-Ce[0]),D=Ce[1]-1,x=R.getWidth()):B=Ce[1]}let Y=this._isCellInSelection(P,t),z=i&&P===s,I=H&&P>=c&&P<=u,j=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,Ce=>{j=!0});let ve=R.getChars()||La;if(ve===" "&&(R.isUnderline()||R.isOverline())&&(ve="\xA0"),L=x*o-l.get(ve,R.isBold(),R.isItalic()),!_)_=this._document.createElement("span");else if(y&&(Y&&A||!Y&&!A&&R.bg===b)&&(Y&&A&&f.selectionForeground||R.fg===w)&&R.extended.ext===k&&I===M&&L===T&&!z&&!U&&!j&&C){R.isInvisible()?m+=La:m+=ve,y++;continue}else y&&(_.textContent=m),_=this._document.createElement("span"),y=0,m="";if(b=R.bg,w=R.fg,k=R.extended.ext,M=I,T=L,A=Y,U&&s>=P&&s<=D&&(s=P),!this._coreService.isCursorHidden&&z&&this._coreService.isCursorInitialized){if(q.push("xterm-cursor"),this._coreBrowserService.isFocused)a&&q.push("xterm-cursor-blink"),q.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":q.push("xterm-cursor-outline");break;case"block":q.push("xterm-cursor-block");break;case"bar":q.push("xterm-cursor-bar");break;case"underline":q.push("xterm-cursor-underline");break;default:break}}if(R.isBold()&&q.push("xterm-bold"),R.isItalic()&&q.push("xterm-italic"),R.isDim()&&q.push("xterm-dim"),R.isInvisible()?m=La:m=R.getChars()||La,R.isUnderline()&&(q.push(`xterm-underline-${R.extended.underlineStyle}`),m===" "&&(m="\xA0"),!R.isUnderlineColorDefault()))if(R.isUnderlineColorRGB())_.style.textDecorationColor=`rgb(${kd.toColorRGB(R.getUnderlineColor()).join(",")})`;else{let Ce=R.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&R.isBold()&&Ce<8&&(Ce+=8),_.style.textDecorationColor=f.ansi[Ce].css}R.isOverline()&&(q.push("xterm-overline"),m===" "&&(m="\xA0")),R.isStrikethrough()&&q.push("xterm-strikethrough"),I&&(_.style.textDecoration="underline");let de=R.getFgColor(),Ae=R.getFgColorMode(),re=R.getBgColor(),ut=R.getBgColorMode(),zi=!!R.isInverse();if(zi){let Ce=de;de=re,re=Ce;let ei=Ae;Ae=ut,ut=ei}let $t,ue,gt=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,Ce=>{Ce.options.layer!=="top"&>||(Ce.backgroundColorRGB&&(ut=50331648,re=Ce.backgroundColorRGB.rgba>>8&16777215,$t=Ce.backgroundColorRGB),Ce.foregroundColorRGB&&(Ae=50331648,de=Ce.foregroundColorRGB.rgba>>8&16777215,ue=Ce.foregroundColorRGB),gt=Ce.options.layer==="top")}),!gt&&Y&&($t=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque,re=$t.rgba>>8&16777215,ut=50331648,gt=!0,f.selectionForeground&&(Ae=50331648,de=f.selectionForeground.rgba>>8&16777215,ue=f.selectionForeground)),gt&&q.push("xterm-decoration-top");let tt;switch(ut){case 16777216:case 33554432:tt=f.ansi[re],q.push(`xterm-bg-${re}`);break;case 50331648:tt=jt.toColor(re>>16,re>>8&255,re&255),this._addStyle(_,`background-color:#${FO((re>>>0).toString(16),"0",6)}`);break;default:zi?(tt=f.foreground,q.push("xterm-bg-257")):tt=f.background}switch($t||R.isDim()&&($t=Et.multiplyOpacity(tt,.5)),Ae){case 16777216:case 33554432:R.isBold()&&de<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(de+=8),this._applyMinimumContrast(_,tt,f.ansi[de],R,$t,void 0)||q.push(`xterm-fg-${de}`);break;case 50331648:let Ce=jt.toColor(de>>16&255,de>>8&255,de&255);this._applyMinimumContrast(_,tt,Ce,R,$t,ue)||this._addStyle(_,`color:#${FO(de.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(_,tt,f.foreground,R,$t,ue)||zi&&q.push("xterm-fg-257")}q.length&&(_.className=q.join(" "),q.length=0),!z&&!U&&!j&&C?y++:_.textContent=m,L!==this.defaultSpacing&&(_.style.letterSpacing=`${L}px`),d.push(_),P=D}return _&&y&&(_.textContent=m),d}_applyMinimumContrast(e,t,i,n,r,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||vU(n.getCode()))return!1;let a=this._getContrastCache(n),o;if(!r&&!s&&(o=a.getColor(t.rgba,i.rgba)),o===void 0){let l=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);o=Et.ensureContrastRatio(r||t,s||i,l),a.setColor((r||t).rgba,(s||i).rgba,o??null)}return o?(this._addStyle(e,`color:${o.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let i=this._selectionStart,n=this._selectionEnd;return!i||!n?!1:this._columnSelectMode?i[0]<=n[0]?e>=i[0]&&t>=i[1]&&e=i[1]&&e>=n[0]&&t<=n[1]:t>i[1]&&t=i[0]&&e=i[0]}};j0=Ft([oe(1,CR),oe(2,rn),oe(3,Is),oe(4,Io),oe(5,Cd),oe(6,mc)],j0);yU=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let i=e.createElement("span");i.classList.add("xterm-char-measure-element");let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold",s.style.fontStyle="italic",this._measureElements=[i,n,r,s],this._container.appendChild(i),this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(s),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,i,n){e===this._font&&t===this._fontSize&&i===this._weight&&n===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(e,t,i){let n=0;if(!t&&!i&&e.length===1&&(n=e.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let a=this._measure(e,0);return a>0&&(this._flat[n]=a),a}let r=e;t&&(r+="B"),i&&(r+="I");let s=this._holey.get(r);if(s===void 0){let a=0;t&&(a|=1),i&&(a|=2),s=this._measure(e,a),s>0&&this._holey.set(r,s)}return s}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},SU=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,n=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let r=e.buffers.active.ydisp,s=t[1]-r,a=i[1]-r,o=Math.max(s,0),l=Math.min(a,e.rows-1);if(o>=e.rows||l<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=s,this.viewportEndRow=a,this.viewportCappedStartRow=o,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i=this.startCol&&t=this.startCol):!1}};h0="xterm-dom-renderer-owner-",nr="xterm-rows",Lp="xterm-fg-",$O="xterm-bg-",ad="xterm-focus",Ip="xterm-selection",xU=1,Y0=class extends Ie{constructor(e,t,i,n,r,s,a,o,l,c,u,d,h,f){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=n,this._viewportElement=r,this._helperContainer=s,this._linkifier2=a,this._charSizeService=l,this._optionsService=c,this._bufferService=u,this._coreService=d,this._coreBrowserService=h,this._themeService=f,this._terminalClass=xU++,this._rowElements=[],this._selectionRenderModel=wU(),this.onRequestRedraw=this._register(new ee).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(nr),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(Ip),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=bU(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(p=>this._injectCss(p))),this._injectCss(this._themeService.colors),this._rowFactory=o.createInstance(j0,document),this._element.classList.add(h0+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(p=>this._handleLinkHover(p))),this._register(this._linkifier2.onHideLinkUnderline(p=>this._handleLinkLeave(p))),this._register(Ct(()=>{this._element.classList.remove(h0+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new yU(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${nr} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${nr} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${nr} .xterm-dim { color: ${Et.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let i=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${n} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${nr}.${ad} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${nr}.${ad} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${nr}.${ad} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${nr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${nr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${nr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${nr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${nr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Ip} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Ip} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Ip} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,a]of e.ansi.entries())t+=`${this._terminalSelector} .${Lp}${s} { color: ${a.css}; }${this._terminalSelector} .${Lp}${s}.xterm-dim { color: ${Et.multiplyOpacity(a,.5).css}; }${this._terminalSelector} .${$O}${s} { background-color: ${a.css}; }`;t+=`${this._terminalSelector} .${Lp}257 { color: ${Et.opaque(e.background).css}; }${this._terminalSelector} .${Lp}257.xterm-dim { color: ${Et.multiplyOpacity(Et.opaque(e.background),.5).css}; }${this._terminalSelector} .${$O}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let i=this._rowElements.length;i<=t;i++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(ad),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(ad),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,s=this._selectionRenderModel.viewportCappedStartRow,a=this._selectionRenderModel.viewportCappedEndRow,o=this._document.createDocumentFragment();if(i){let l=e[0]>t[0];o.appendChild(this._createSelectionElement(s,l?t[0]:e[0],l?e[0]:t[0],a-s+1))}else{let l=n===s?e[0]:0,c=s===r?t[0]:this._bufferService.cols;o.appendChild(this._createSelectionElement(s,l,c));let u=a-s-1;if(o.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,u)),s!==a){let d=r===a?t[0]:this._bufferService.cols;o.appendChild(this._createSelectionElement(a,0,d))}}this._selectionContainer.appendChild(o)}_createSelectionElement(e,t,i,n=1){let r=this._document.createElement("div"),s=t*this.dimensions.css.cell.width,a=this.dimensions.css.cell.width*(i-t);return s+a>this.dimensions.css.canvas.width&&(a=this.dimensions.css.canvas.width-s),r.style.height=`${n*this.dimensions.css.cell.height}px`,r.style.top=`${e*this.dimensions.css.cell.height}px`,r.style.left=`${s}px`,r.style.width=`${a}px`,r}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let i=this._bufferService.buffer,n=i.ybase+i.y,r=Math.min(i.x,this._bufferService.cols-1),s=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,a=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,o=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=e;l<=t;l++){let c=l+i.ydisp,u=this._rowElements[l],d=i.lines.get(c);if(!u||!d)break;u.replaceChildren(...this._rowFactory.createRow(d,c,c===n,a,o,r,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${h0}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,i,n,r,s){i<0&&(e=0),n<0&&(t=0);let a=this._bufferService.rows-1;i=Math.max(Math.min(i,a),0),n=Math.max(Math.min(n,a),0),r=Math.min(r,this._bufferService.cols);let o=this._bufferService.buffer,l=o.ybase+o.y,c=Math.min(o.x,r-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=i;f<=n;++f){let p=f+o.ydisp,_=this._rowElements[f],y=o.lines.get(p);if(!_||!y)break;_.replaceChildren(...this._rowFactory.createRow(y,p,p===l,d,h,c,u,this.dimensions.css.cell.width,this._widthCache,s?f===i?e:0:-1,s?(f===n?t:r)-1:-1))}}};Y0=Ft([oe(7,ly),oe(8,tm),oe(9,rn),oe(10,nn),oe(11,Io),oe(12,Is),oe(13,mc)],Y0);V0=class extends Ie{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ee),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new kU(this._optionsService))}catch{this._measureStrategy=this._register(new EU(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};V0=Ft([oe(2,rn)],V0);XR=class extends Ie{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},EU=class extends XR{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},kU=class extends XR{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},CU=class extends Ie{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new TU(this._window)),this._onDprChange=this._register(new ee),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ee),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(bi.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Te(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Te(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},TU=class extends Ie{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new pc),this._onDprChange=this._register(new ee),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ct(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Te(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},NU=class extends Ie{constructor(){super(),this.linkProviders=[],this._register(Ct(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};X0=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,n,r){return AU(window,e,t,i,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let i=gy(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};X0=Ft([oe(0,zs),oe(1,tm)],X0);MU=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},ZR={};gP(ZR,{getSafariVersion:()=>RU,isChromeOS:()=>t2,isFirefox:()=>QR,isIpad:()=>DU,isIphone:()=>LU,isLegacyEdge:()=>OU,isLinux:()=>_y,isMac:()=>Zp,isNode:()=>rm,isSafari:()=>JR,isWindows:()=>e2});rm=typeof process<"u"&&"title"in process,Td=rm?"node":navigator.userAgent,Nd=rm?"node":navigator.platform,QR=Td.includes("Firefox"),OU=Td.includes("Edge"),JR=/^((?!chrome|android).)*safari/i.test(Td);Zp=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Nd),DU=Nd==="iPad",LU=Nd==="iPhone",e2=["Windows","Win16","Win32","WinCE"].includes(Nd),_y=Nd.indexOf("Linux")>=0,t2=/\bCrOS\b/.test(Td),i2=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._ir){n-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=r}this.clear()}},IU=class extends i2{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},zU=class extends i2{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Qp=!rm&&"requestIdleCallback"in window?zU:IU,BU=class{constructor(){this._queue=new Qp}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Z0=class extends Ie{constructor(e,t,i,n,r,s,a,o,l){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=n,this._coreService=r,this._coreBrowserService=o,this._renderer=this._register(new pc),this._pausedResizeTask=new BU,this._observerDisposable=this._register(new pc),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new ee),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ee),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ee),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ee),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new MU((c,u)=>this._renderRows(c,u),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new PU(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ct(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(a.onResize(()=>this._fullRefresh())),this._register(a.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(s.onDecorationRegistered(()=>this._fullRefresh())),this._register(s.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(a.cols,a.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(a.buffer.y,a.buffer.y,!0))),this._register(l.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=Ct(()=>i.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,i=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let n=this._syncOutputHandler.flush();n&&(e=Math.min(e,n.start),t=Math.max(t,n.end)),i||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,i){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,this._renderer.value?.handleSelectionChanged(e,t,i)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Z0=Ft([oe(2,rn),oe(3,tm),oe(4,Io),oe(5,Cd),oe(6,nn),oe(7,Is),oe(8,mc)],Z0);PU=class{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};GU=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};f0=50,jU=15,YU=50,VU=500,XU="\xA0",ZU=new RegExp(XU,"g"),Q0=class extends Ie{constructor(e,t,i,n,r,s,a,o,l){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=n,this._coreService=r,this._mouseService=s,this._optionsService=a,this._renderService=o,this._coreBrowserService=l,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new ar,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ee),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ee),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ee),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ee),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new GU(this._bufferService),this._activeSelectionMode=0,this._register(Ct(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let i=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let r=e[0]r.replace(ZU," ")).join(e2?`\r `:` -`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),ay&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!i||!n||!t?!1:this._areCoordsInSelection(t,i,n)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!i||!n?!1:this._areCoordsInSelection([e,t],i,n)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]}_selectWordAtCursor(e,t){let i=this._linkifier.currentLink?.link?.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=CO(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return n?(this._selectWordAt(n,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=sy(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-i0),i0),t/=i0,t/Math.abs(t)+Math.round(t*(NU-1)))}shouldForceSelection(e){return Fp?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),AU)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Fp&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let i=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&tthis._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let n=0;t>=n;n++){let r=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:r>1&&t!==n&&(i+=r-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,s=r.lines.get(e[1]);if(!s)return;let a=r.translateBufferLineToString(e[1],!1),o=this._convertViewportColToCharacterIndex(s,e[0]),l=o,c=e[0]-o,u=0,d=0,h=0,f=0;if(a.charAt(o)===" "){for(;o>0&&a.charAt(o-1)===" ";)o--;for(;l1&&(f+=v-1,l+=v-1);y>0&&o>0&&!this._isCharWordSeparator(s.loadCell(y-1,this._workCell));){s.loadCell(y-1,this._workCell);let b=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,y--):b>1&&(h+=b-1,o-=b-1),o--,y--}for(;m1&&(f+=b-1,l+=b-1),l++,m++}}l++;let p=o+c-u+h,_=Math.min(this._bufferService.cols,l-o+u+d-h-f);if(!(!t&&a.slice(o,l).trim()==="")){if(i&&p===0&&s.getCodePoint(0)!==32){let y=r.lines.get(e[1]-1);if(y&&s.isWrapped&&y.getCodePoint(this._bufferService.cols-1)!==32){let m=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(m){let v=this._bufferService.cols-m.start;p-=v,_+=v}}}if(n&&p+_===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let y=r.lines.get(e[1]+1);if(y?.isWrapped&&y.getCodePoint(0)!==32){let m=this._getWordAt([0,e[1]+1],!1,!1,!0);m&&(_+=m.length)}}return{start:p,length:_}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=CO(i,this._bufferService.cols)}};q0=Pt([ce(3,en),ce(4,Ao),ce(5,Q0),ce(6,tn),ce(7,Ls),ce(8,Ds)],q0);TO=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},NO=class{constructor(){this._color=new TO,this._css=new TO}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},ni=Object.freeze((()=>{let e=[Mt.toColor("#2e3436"),Mt.toColor("#cc0000"),Mt.toColor("#4e9a06"),Mt.toColor("#c4a000"),Mt.toColor("#3465a4"),Mt.toColor("#75507b"),Mt.toColor("#06989a"),Mt.toColor("#d3d7cf"),Mt.toColor("#555753"),Mt.toColor("#ef2929"),Mt.toColor("#8ae234"),Mt.toColor("#fce94f"),Mt.toColor("#729fcf"),Mt.toColor("#ad7fa8"),Mt.toColor("#34e2e2"),Mt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let n=t[i/36%6|0],r=t[i/6%6|0],s=t[i%6];e.push({css:Wt.toCss(n,r,s),rgba:Wt.toRgba(n,r,s)})}for(let i=0;i<24;i++){let n=8+i*10;e.push({css:Wt.toCss(n,n,n),rgba:Wt.toRgba(n,n,n)})}return e})()),xo=Mt.toColor("#ffffff"),rd=Mt.toColor("#000000"),AO=Mt.toColor("#ffffff"),MO=rd,Qu={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},DU=xo,F0=class extends Le{constructor(e){super(),this._optionsService=e,this._contrastCache=new NO,this._halfContrastCache=new NO,this._onChangeColors=this._register(new ee),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:xo,background:rd,cursor:AO,cursorAccent:MO,selectionForeground:void 0,selectionBackgroundTransparent:Qu,selectionBackgroundOpaque:bt.blend(rd,Qu),selectionInactiveBackgroundTransparent:Qu,selectionInactiveBackgroundOpaque:bt.blend(rd,Qu),scrollbarSliderBackground:bt.opacity(xo,.2),scrollbarSliderHoverBackground:bt.opacity(xo,.4),scrollbarSliderActiveBackground:bt.opacity(xo,.5),overviewRulerBorder:xo,ansi:ni.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=ot(e.foreground,xo),t.background=ot(e.background,rd),t.cursor=bt.blend(t.background,ot(e.cursor,AO)),t.cursorAccent=bt.blend(t.background,ot(e.cursorAccent,MO)),t.selectionBackgroundTransparent=ot(e.selectionBackground,Qu),t.selectionBackgroundOpaque=bt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ot(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=bt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ot(e.selectionForeground,xO):void 0,t.selectionForeground===xO&&(t.selectionForeground=void 0),bt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=bt.opacity(t.selectionBackgroundTransparent,.3)),bt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=bt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ot(e.scrollbarSliderBackground,bt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ot(e.scrollbarSliderHoverBackground,bt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ot(e.scrollbarSliderActiveBackground,bt.opacity(t.foreground,.5)),t.overviewRulerBorder=ot(e.overviewRulerBorder,DU),t.ansi=ni.slice(),t.ansi[0]=ot(e.black,ni[0]),t.ansi[1]=ot(e.red,ni[1]),t.ansi[2]=ot(e.green,ni[2]),t.ansi[3]=ot(e.yellow,ni[3]),t.ansi[4]=ot(e.blue,ni[4]),t.ansi[5]=ot(e.magenta,ni[5]),t.ansi[6]=ot(e.cyan,ni[6]),t.ansi[7]=ot(e.white,ni[7]),t.ansi[8]=ot(e.brightBlack,ni[8]),t.ansi[9]=ot(e.brightRed,ni[9]),t.ansi[10]=ot(e.brightGreen,ni[10]),t.ansi[11]=ot(e.brightYellow,ni[11]),t.ansi[12]=ot(e.brightBlue,ni[12]),t.ansi[13]=ot(e.brightMagenta,ni[13]),t.ansi[14]=ot(e.brightCyan,ni[14]),t.ansi[15]=ot(e.brightWhite,ni[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let n=0;ns.index-a.index),n=[];for(let s of i){let a=this._services.get(s.id);if(!a)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${s.id._id}.`);n.push(a)}let r=i.length>0?i[0].index:t.length;if(t.length!==r)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...n)}},zU={trace:0,debug:1,info:2,warn:3,error:4,off:5},BU="xterm.js: ",W0=class extends Le{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),PU=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=zU[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tthis._length)for(let t=this._length;t=e;n--)this._array[this._getCyclicIndex(n+i.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;nthis._maxLength){let n=this._length+i.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let r=t-1;r>=0;r--)this.set(e+r+i,this.get(e+r));let n=e+t+i-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n>22,i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,i){this._data[t*ze+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*ze+0]=t|2097152|i[2]<<22):this._data[t*ze+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*ze+0]>>22}hasWidth(t){return this._data[t*ze+0]&12582912}getFg(t){return this._data[t*ze+1]}getBg(t){return this._data[t*ze+2]}hasContent(t){return this._data[t*ze+0]&4194303}getCodePoint(t){let i=this._data[t*ze+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*ze+0]&2097152}getString(t){let i=this._data[t*ze+0];return i&2097152?this._combined[t]:i&2097151?Na(i&2097151):""}isProtected(t){return this._data[t*ze+2]&536870912}loadCell(t,i){return Tp=t*ze,i.content=this._data[Tp+0],i.fg=this._data[Tp+1],i.bg=this._data[Tp+2],i.content&2097152&&(i.combinedData=this._combined[t]),i.bg&268435456&&(i.extended=this._extendedAttrs[t]),i}setCell(t,i){i.content&2097152&&(this._combined[t]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*ze+0]=i.content,this._data[t*ze+1]=i.fg,this._data[t*ze+2]=i.bg}setCellFromCodepoint(t,i,n,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*ze+0]=i|n<<22,this._data[t*ze+1]=r.fg,this._data[t*ze+2]=r.bg}addCodepointToCell(t,i,n){let r=this._data[t*ze+0];r&2097152?this._combined[t]+=Na(i):r&2097151?(this._combined[t]=Na(r&2097151)+Na(i),r&=-2097152,r|=2097152):r=i|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[t*ze+0]=r}insertCells(t,i,n){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),i=0;--s)this.setCell(t+i+s,this.loadCell(t+s,r));for(let s=0;sthis.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let r=new Uint32Array(n);r.set(this._data),this._data=r}for(let r=this.length;r=t&&delete this._combined[o]}let s=Object.keys(this._extendedAttrs);for(let a=0;a=t&&delete this._extendedAttrs[o]}}return this.length=t,n*4*n0=0;--t)if(this._data[t*ze+0]&4194303)return t+(this._data[t*ze+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ze+0]&4194303||this._data[t*ze+2]&50331648)return t+(this._data[t*ze+0]>>22);return 0}copyCellsFrom(t,i,n,r,s){let a=t._data;if(s)for(let l=r-1;l>=0;l--){for(let c=0;c=i&&(this._combined[c-i+n]=t._combined[c])}}translateToString(t,i,n,r){i=i??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let s="";for(;i>22||1}return r&&r.push(i),s}};FR=class WR{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=WR._nextId++,this._onDispose=this.register(new ee),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),To(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};FR._nextId=1;WU=FR,si={},Eo=si.B;si[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"};si.A={"#":"\xA3"};si.B=void 0;si[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"};si.C=si[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"};si.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"};si.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"};si.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"};si.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"};si.E=si[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"};si.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"};si.H=si[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"};si["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"};RO=4294967295,DO=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Zt.clone(),this.savedCharset=Eo,this.markers=[],this._nullCell=nr.fromCharData([0,tR,1,0]),this._whitespaceCell=nr.fromCharData([0,Aa,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Wp,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new OO(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new zp),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new zp),this._whitespaceCell}getBlankLine(e,t){return new sd(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&eRO?RO:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Zt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new OO(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(Zt),n=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new sd(e,i)));else for(let a=this._rows;a>t;a--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r0&&(this.lines.trimStart(a),this.ybase=Math.max(this.ybase-a,0),this.ydisp=Math.max(this.ydisp-a,0),this.savedY=Math.max(this.savedY-a,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let s=0;s.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,n=HU(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Zt),i);if(n.length>0){let r=UU(this.lines,n);qU(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let n=this.getNullCell(Zt),r=i;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;a--){let o=this.lines.get(a);if(!o||!o.isWrapped&&o.getTrimmedLength()<=e)continue;let l=[o];for(;o.isWrapped&&a>0;)o=this.lines.get(--a),l.unshift(o);if(!i){let b=this.ybase+this.y;if(b>=a&&b0&&(r.push({start:a+l.length+s,newLines:f}),s+=f.length),l.push(...f);let p=u.length-1,_=u[p];_===0&&(p--,_=u[p]);let y=l.length-d-1,m=c;for(;y>=0;){let b=Math.min(m,_);if(l[p]===void 0)break;if(l[p].copyCellsFrom(l[y],m-b,_-b,b,!0),_-=b,_===0&&(p--,_=u[p]),m-=b,m===0){y--;let w=Math.max(y,0);m=md(l,w,this._cols)}}for(let b=0;b0;)this.ybase===0?this.y0){let a=[],o=[];for(let _=0;_=0;_--)if(d&&d.start>c+h){for(let y=d.newLines.length-1;y>=0;y--)this.lines.set(_--,d.newLines[y]);_++,a.push({index:c+1,amount:d.newLines.length}),h+=d.newLines.length,d=r[++u]}else this.lines.set(_,o[c--]);let f=0;for(let _=a.length-1;_>=0;_--)a[_].index+=f,this.lines.onInsertEmitter.fire(a[_]),f+=a[_].amount;let p=Math.max(0,l+s-this.lines.maxLength);p>0&&this.lines.onTrimEmitter.fire(p)}}translateBufferLineToString(e,t,i=0,n){let r=this.lines.get(e);return r?r.translateToString(t,i,n):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+10;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t{t.line-=i,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(i=>{t.line>=i.index&&(t.line+=i.amount)})),t.register(this.lines.onDelete(i=>{t.line>=i.index&&t.linei.index&&(t.line-=i.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},$U=class extends Le{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ee),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new DO(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new DO(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},$R=2,KR=1,$0=class extends Le{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ee),this.onResize=this._onResize.event,this._onScroll=this._register(new ee),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,$R),this.rows=Math.max(e.rawOptions.rows||0,KR),this.buffers=this._register(new $U(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=this.cols!==e,n=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==e.fg||n.getBg(0)!==e.bg)&&(n=i.getBlankLine(e,t),this._cachedBlankLine=n),n.isWrapped=t;let r=i.ybase+i.scrollTop,s=i.ybase+i.scrollBottom;if(i.scrollTop===0){let a=i.lines.isFull;s===i.lines.length-1?a?i.lines.recycle().copyFrom(n):i.lines.push(n.clone()):i.lines.splice(s+1,0,n.clone()),a?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let a=s-r+1;i.lines.shiftElements(r+1,a-1,-1),i.lines.set(s,n.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let n=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),n!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};$0=Pt([ce(0,tn)],$0);oc={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Fp,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},KU=["normal","bold","100","200","300","400","500","600","700","800","900"],GU=class extends Le{constructor(e){super(),this._onOptionChange=this._register(new ee),this.onOptionChange=this._onOptionChange.event;let t={...oc};for(let i in e)if(i in t)try{let n=e[i];t[i]=this._sanitizeAndValidateOption(i,n)}catch(n){console.error(n)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(wt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{e.indexOf(i)!==-1&&t()})}_setupOptions(){let e=i=>{if(!(i in oc))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,n)=>{if(!(i in oc))throw new Error(`No option with key "${i}"`);n=this._sanitizeAndValidateOption(i,n),this.rawOptions[i]!==n&&(this.rawOptions[i]=n,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let n={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,n)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=oc[e]),!jU(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=oc[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=KU.includes(t)?t:oc[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};LO=Object.freeze({insertMode:!1}),IO=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),K0=class extends Le{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ee),this.onData=this._onData.event,this._onUserInput=this._register(new ee),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ee),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ee),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=ad(LO),this.decPrivateModes=ad(IO)}reset(){this.modes=ad(LO),this.decPrivateModes=ad(IO)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(n=>n.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};K0=Pt([ce(0,en),ce(1,aR),ce(2,tn)],K0);zO={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};s0=String.fromCharCode,BO={DEFAULT:e=>{let t=[r0(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${s0(t[0])}${s0(t[1])}${s0(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${r0(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${r0(e,!0)};${e.x};${e.y}${t}`}},G0=class extends Le{constructor(e,t,i){super(),this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ee),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(zO))this.addProtocol(n,zO[n]);for(let n of Object.keys(BO))this.addEncoding(n,BO[n]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,i){if(e.deltaY===0||e.shiftKey||t===void 0||i===void 0)return 0;let n=t/i,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=n+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,i){if(i){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};G0=Pt([ce(0,en),ce(1,Ao),ce(2,tn)],G0);a0=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],YU=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];XU=class{constructor(){if(this.version="6",!ri){ri=new Uint8Array(65536),ri.fill(1),ri[0]=0,ri.fill(0,1,32),ri.fill(0,127,160),ri.fill(2,4352,4448),ri[9001]=2,ri[9002]=2,ri.fill(2,11904,42192),ri[12351]=1,ri.fill(2,44032,55204),ri.fill(2,63744,64256),ri.fill(2,65040,65050),ri.fill(2,65072,65136),ri.fill(2,65280,65377),ri.fill(2,65504,65511);for(let e=0;e=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),n=i===0&&t!==0;if(n){let r=ko.extractWidth(t);r===0?n=!1:r>i&&(i=r)}return ko.createPropertyValue(0,i,n)}},ko=class Ip{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ee,this.onChange=this._onChange.event;let t=new XU;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,i,n=!1){return(t&16777215)<<3|(i&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let i=0,n=0,r=t.length;for(let s=0;s=r)return i+this.wcwidth(a);let c=t.charCodeAt(s);56320<=c&&c<=57343?a=(a-55296)*1024+c-56320+65536:i+=this.wcwidth(c)}let o=this.charProperties(a,n),l=Ip.extractWidth(o);Ip.extractShouldJoin(o)&&(l-=Ip.extractWidth(n)),i+=l,n=o}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},ZU=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};Ju=2147483647,QU=256,GR=class j0{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>QU)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new j0;if(!t.length)return i;for(let n=Array.isArray(t[0])?1:0;n>8,r=this._subParamsIdx[i]&255;r-n>0&&t.push(Array.prototype.slice.call(this._subParams,n,r))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Ju?Ju:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Ju?Ju:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let i=this._subParamsIdx[t]>>8,n=this._subParamsIdx[t]&255;return n-i>0?this._subParams.subarray(i,n):null}getSubParamsAll(){let t={};for(let i=0;i>8,r=this._subParamsIdx[i]&255;r-n>0&&(t[i]=this._subParams.slice(n,r))}return t}addDigit(t){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[i-1];n[i-1]=~r?Math.min(r*10+t,Ju):t}},ed=[],JU=class{constructor(){this._state=0,this._active=ed,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let n=i.indexOf(t);n!==-1&&i.splice(n,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=ed}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=ed,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||ed,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,i){if(!this._active.length)this._handlerFb(this._id,"PUT",Kp(e,t,i));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,i)}start(){this.reset(),this._state=1}put(e,t,i){if(this._state!==3){if(this._state===1)for(;t0&&this._put(e,t,i)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let i=!1,n=this._active.length-1,r=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;n>=0&&(i=this._active[n].end(e),i!==!0);n--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,i;n--}for(;n>=0;n--)if(i=this._active[n].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,i}this._active=ed,this._id=-1,this._state=0}}},zn=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=Kp(e,t,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,t}},td=[],e8=class{constructor(){this._handlers=Object.create(null),this._active=td,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=td}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let n=i.indexOf(t);n!==-1&&i.splice(n,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=td,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||td,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t)}put(e,t,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",Kp(e,t,i));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,i)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let i=!1,n=this._active.length-1,r=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;n>=0&&(i=this._active[n].unhook(e),i!==!0);n--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,i;n--}for(;n>=0;n--)if(i=this._active[n].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,i}this._active=td,this._ident=0}},od=new GR;od.addParam(0);HO=class{constructor(e){this._handler=e,this._data="",this._params=od,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():od,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=Kp(e,t,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(i=>(this._params=od,this._data="",this._hitLimit=!1,i));return this._params=od,this._data="",this._hitLimit=!1,t}},t8=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,n){this.table[t<<8|e]=i<<4|n}addMany(e,t,i,n){for(let r=0;rl),i=(o,l)=>t.slice(o,l),n=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));let s=i(0,14),a;e.setDefault(1,0),e.addMany(n,0,2,0);for(a in s)e.addMany([24,26,153,154],a,3,0),e.addMany(i(128,144),a,3,0),e.addMany(i(144,152),a,3,0),e.add(156,a,0,0),e.add(27,a,11,1),e.add(157,a,4,8),e.addMany([152,158,159],a,0,7),e.add(155,a,11,3),e.add(144,a,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(ir,0,2,0),e.add(ir,8,5,8),e.add(ir,6,0,6),e.add(ir,11,0,11),e.add(ir,13,13,13),e})(),n8=class extends Le{constructor(e=i8){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new GR,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,n)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,i)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(wt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new JU),this._dcsParser=this._register(new e8),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let r=0;rs||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=s}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=n,i}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let i=this._identifier(e,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let n=this._escHandlers[i];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let i=this._identifier(e);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let n=this._csiHandlers[i];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,i,n,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=n,this._parseStack.chunkPos=r}parse(e,t,i){let n=0,r=0,s=0,a;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,s=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let o=this._parseStack.handlers,l=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&l>-1){for(;l>=0&&(a=o[l](this._params),a!==!0);l--)if(a instanceof Promise)return this._parseStack.handlerPos=l,a}this._parseStack.handlers=[];break;case 4:if(i===!1&&l>-1){for(;l>=0&&(a=o[l](),a!==!0);l--)if(a instanceof Promise)return this._parseStack.handlerPos=l,a}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],a=this._dcsParser.unhook(n!==24&&n!==26,i),a)return a;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],a=this._oscParser.end(n!==24&&n!==26,i),a)return a;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let o=s;o>4){case 2:for(let h=o+1;;++h){if(h>=t||(n=e[h])<32||n>126&&n=t||(n=e[h])<32||n>126&&n=t||(n=e[h])<32||n>126&&n=t||(n=e[h])<32||n>126&&n=0&&(a=l[c](this._params),a!==!0);c--)if(a instanceof Promise)return this._preserveStack(3,l,c,r,o),a;c<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++o47&&n<60);o--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let u=this._escHandlers[this._collect<<8|n],d=u?u.length-1:-1;for(;d>=0&&(a=u[d](),a!==!0);d--)if(a instanceof Promise)return this._preserveStack(4,u,d,r,o),a;d<0&&this._escHandlerFb(this._collect<<8|n),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|n,this._params);break;case 13:for(let h=o+1;;++h)if(h>=t||(n=e[h])===24||n===26||n===27||n>127&&n=t||(n=e[h])<32||n>127&&nthis._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,u)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:u.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,u,d)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:u,data:d})}),this._parser.setDcsHandlerFallback((c,u,d)=>{u==="HOOK"&&(d=d.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:u,payload:d})}),this._parser.setPrintHandler((c,u,d)=>this.print(c,u,d)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler($.BEL,()=>this.bell()),this._parser.setExecuteHandler($.LF,()=>this.lineFeed()),this._parser.setExecuteHandler($.VT,()=>this.lineFeed()),this._parser.setExecuteHandler($.FF,()=>this.lineFeed()),this._parser.setExecuteHandler($.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler($.BS,()=>this.backspace()),this._parser.setExecuteHandler($.HT,()=>this.tab()),this._parser.setExecuteHandler($.SO,()=>this.shiftOut()),this._parser.setExecuteHandler($.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(ud.IND,()=>this.index()),this._parser.setExecuteHandler(ud.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(ud.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new zn(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new zn(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new zn(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new zn(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new zn(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new zn(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new zn(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new zn(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new zn(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new zn(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new zn(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new zn(c=>this.restoreCursorColor(c))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let c in si)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new HO((c,u)=>this.requestStatusString(c,u)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),WO))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${WO} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,n=this._activeBuffer.x,r=this._activeBuffer.y,s=0,a=this._parseStack.paused;if(a){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;n=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Ta&&(s=this._parseStack.position+Ta)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.lengthTa)for(let c=s;c0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let h=this._parser.precedingJoinState;for(let f=t;fo){if(l){let m=d,v=this._activeBuffer.x-y;for(this._activeBuffer.x=y,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),y>0&&d instanceof sd&&d.copyCellsFrom(m,v,0,y,!1);v=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(c&&(d.insertCells(this._activeBuffer.x,r-y,this._activeBuffer.getNullCell(u)),d.getWidth(o-1)===2&&d.setCellFromCodepoint(o-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,n,r,u),r>0)for(;--r;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=h,this._activeBuffer.x0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,i=>FO(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new HO(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new zn(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,i,n=!1,r=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),n&&(s.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let i;switch(e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);i=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+i)?.getTrimmedLength(););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let n=this._activeBuffer.lines.length-this._bufferService.rows;n>0&&(this._activeBuffer.lines.trimStart(n),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-n,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-n,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let l=o;for(let c=1;c0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent($.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent($.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent($.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent($.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent($.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t(_[_.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",_[_.SET=1]="SET",_[_.RESET=2]="RESET",_[_.PERMANENTLY_SET=3]="PERMANENTLY_SET",_[_.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(i||(i={}));let n=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:s}=this._coreMouseService,a=this._coreService,{buffers:o,cols:l}=this._bufferService,{active:c,alt:u}=o,d=this._optionsService.rawOptions,h=(_,y)=>(a.triggerDataEvent(`${$.ESC}[${t?"":"?"}${_};${y}$y`),!0),f=_=>_?1:2,p=e.params[0];return t?p===2?h(p,4):p===4?h(p,f(a.modes.insertMode)):p===12?h(p,3):p===20?h(p,f(d.convertEol)):h(p,0):p===1?h(p,f(n.applicationCursorKeys)):p===3?h(p,d.windowOptions.setWinLines?l===80?2:l===132?1:0:0):p===6?h(p,f(n.origin)):p===7?h(p,f(n.wraparound)):p===8?h(p,3):p===9?h(p,f(r==="X10")):p===12?h(p,f(d.cursorBlink)):p===25?h(p,f(!a.isCursorHidden)):p===45?h(p,f(n.reverseWraparound)):p===66?h(p,f(n.applicationKeypad)):p===67?h(p,4):p===1e3?h(p,f(r==="VT200")):p===1002?h(p,f(r==="DRAG")):p===1003?h(p,f(r==="ANY")):p===1004?h(p,f(n.sendFocus)):p===1005?h(p,4):p===1006?h(p,f(s==="SGR")):p===1015?h(p,4):p===1016?h(p,f(s==="SGR_PIXELS")):p===1048?h(p,1):p===47||p===1047||p===1049?h(p,f(c===u)):p===2004?h(p,f(n.bracketedPasteMode)):p===2026?h(p,f(n.synchronizedOutput)):h(p,0)}_updateAttrColor(e,t,i,n,r){return t===2?(e|=50331648,e&=-16777216,e|=gd.fromColorRGB([i,n,r])):t===5&&(e&=-50331904,e|=33554432|i&255),e}_extractColor(e,t,i){let n=[0,0,-1,0,0,0],r=0,s=0;do{if(n[s+r]=e.params[t+s],e.hasSubParams(t+s)){let a=e.getSubParams(t+s),o=0;do n[1]===5&&(r=1),n[s+o+1+r]=a[o];while(++o=2||n[1]===2&&s+r>=5)break;n[1]&&(r=1)}while(++s+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Zt.fg,e.bg=Zt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,i,n=this._curAttrData;for(let r=0;r=30&&i<=37?(n.fg&=-50331904,n.fg|=16777216|i-30):i>=40&&i<=47?(n.bg&=-50331904,n.bg|=16777216|i-40):i>=90&&i<=97?(n.fg&=-50331904,n.fg|=16777216|i-90|8):i>=100&&i<=107?(n.bg&=-50331904,n.bg|=16777216|i-100|8):i===0?this._processSGR0(n):i===1?n.fg|=134217728:i===3?n.bg|=67108864:i===4?(n.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,n)):i===5?n.fg|=536870912:i===7?n.fg|=67108864:i===8?n.fg|=1073741824:i===9?n.fg|=2147483648:i===2?n.bg|=134217728:i===21?this._processUnderline(2,n):i===22?(n.fg&=-134217729,n.bg&=-134217729):i===23?n.bg&=-67108865:i===24?(n.fg&=-268435457,this._processUnderline(0,n)):i===25?n.fg&=-536870913:i===27?n.fg&=-67108865:i===28?n.fg&=-1073741825:i===29?n.fg&=2147483647:i===39?(n.fg&=-67108864,n.fg|=Zt.fg&16777215):i===49?(n.bg&=-67108864,n.bg|=Zt.bg&16777215):i===38||i===48||i===58?r+=this._extractColor(e,r,n):i===53?n.bg|=1073741824:i===55?n.bg&=-1073741825:i===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):i===100?(n.fg&=-67108864,n.fg|=Zt.fg&16777215,n.bg&=-67108864,n.bg|=Zt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${$.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[${t};${i}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[?${t};${i}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Zt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let i=t%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(e){let t=e.params[0]||1,i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!FO(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${$.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>qO&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>qO&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],i=e.split(";");for(;i.length>1;){let n=i.shift(),r=i.shift();if(/^\d+$/.exec(n)){let s=parseInt(n);if(KO(s))if(r==="?")t.push({type:0,index:s});else{let a=UO(r);a&&t.push({type:1,index:s,color:a})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let i=e.slice(0,t).trim(),n=e.slice(t+1);return n?this._createHyperlink(i,n):i.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i=e.split(":"),n,r=i.findIndex(s=>s.startsWith("id="));return r!==-1&&(n=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let i=e.split(";");for(let n=0;n=this._specialColors.length);++n,++t)if(i[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=UO(i[n]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],i=e.split(";");for(let n=0;n=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Zt.clone(),this._eraseAttrDataInternal=Zt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new nr;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t(this._coreService.triggerDataEvent(`${$.ESC}${a}${$.ESC}\\`),!0),n=this._bufferService.buffer,r=this._optionsService.rawOptions;return i(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Y0=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){ethis.end&&(this.end=e)}markRangeDirty(e,t){e>t&&($O=e,e=t,t=$O),ethis.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Y0=Pt([ce(0,en)],Y0);c8=5e7,GO=12,u8=50,d8=class extends Le{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new ee),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let i;for(;i=this._writeBuffer.shift();){this._action(i);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>c8)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],r=this._action(n,t);if(r){let a=o=>performance.now()-i>=GO?setTimeout(()=>this._innerWrite(0,o)):this._innerWrite(i,o);r.catch(o=>(queueMicrotask(()=>{throw o}),Promise.resolve(!1))).then(a);return}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-i>=GO)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>u8&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},V0=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let o=t.addMarker(t.ybase+t.y),l={data:e,id:this._nextId++,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(l,o)),this._dataByLinkId.set(l.id,l),l.id}let i=e,n=this._getEntryIdKey(i),r=this._entriesWithId.get(n);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;let s=t.addMarker(t.ybase+t.y),a={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(a,s)),this._entriesWithId.set(a.key,a),this._dataByLinkId.set(a.id,a),a.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every(n=>n.line!==t)){let n=this._bufferService.buffer.addMarker(t);i.lines.push(n),n.onDispose(()=>this._removeMarkerFromLink(i,n))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);i!==-1&&(e.lines.splice(i,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};V0=Pt([ce(0,en)],V0);jO=!1,h8=class extends Le{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new cc),this._onBinary=this._register(new ee),this.onBinary=this._onBinary.event,this._onData=this._register(new ee),this.onData=this._onData.event,this._onLineFeed=this._register(new ee),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ee),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ee),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ee),this._instantiationService=new IU,this.optionsService=this._register(new GU(e)),this._instantiationService.setService(tn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance($0)),this._instantiationService.setService(en,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(W0)),this._instantiationService.setService(aR,this._logService),this.coreService=this._register(this._instantiationService.createInstance(K0)),this._instantiationService.setService(Ao,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(G0)),this._instantiationService.setService(sR,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(ko)),this._instantiationService.setService(oP,this.unicodeService),this._charsetService=this._instantiationService.createInstance(ZU),this._instantiationService.setService(aP,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(V0),this._instantiationService.setService(oR,this._oscLinkService),this._inputHandler=this._register(new l8(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(bi.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(bi.forward(this._bufferService.onResize,this._onResize)),this._register(bi.forward(this.coreService.onData,this._onData)),this._register(bi.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new d8((t,i)=>this._inputHandler.parse(t,i))),this._register(bi.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ee),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!jO&&(this._logService.warn("writeSync is unreliable and will be removed soon."),jO=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,$R),t=Math.max(t,KR),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(PO.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(PO(this._bufferService),!1))),this._windowsWrappingHeuristics.value=wt(()=>{for(let t of e)t.dispose()})}}},f8={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};Ft=0,m8=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Wp,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Wp,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((r,s)=>this._getKey(r)-this._getKey(s)),t=0,i=0,n=new Array(this._array.length+this._insertedValues.length);for(let r=0;r=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(n[r]=e[t],t++):n[r]=this._array[i++];this._array=n,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Ft=this._search(t),Ft===-1)||this._getKey(this._array[Ft])!==t)return!1;do if(this._array[Ft]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Ft),!0;while(++Ftr-s),t=0,i=new Array(this._array.length-e.length),n=0;for(let r=0;r0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ft=this._search(e),!(Ft<0||Ft>=this._array.length)&&this._getKey(this._array[Ft])===e))do yield this._array[Ft];while(++Ft=this._array.length)&&this._getKey(this._array[Ft])===e))do t(this._array[Ft]);while(++Ft=t;){let n=t+i>>1,r=this._getKey(this._array[n]);if(r>e)i=n-1;else if(r0&&this._getKey(this._array[n-1])===e;)n--;return n}}return t}},l0=0,YO=0,g8=class extends Le{constructor(){super(),this._decorations=new m8(e=>e?.marker.line),this._onDecorationRegistered=this._register(new ee),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ee),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(wt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new _8(e);if(t){let i=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),i.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,i){let n=0,r=0;for(let s of this._decorations.getKeyIterator(t))n=s.options.x??0,r=n+(s.options.width??1),e>=n&&e{l0=r.options.x??0,YO=l0+(r.options.width??1),e>=l0&&e=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=n-this._lastRefreshMs,s=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},s)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},VO=20,XO=!1,$p=class extends Le{constructor(e,t,i,n){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=n,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let s=0;sthis._handleBoundaryFocus(s,0),this._bottomBoundaryFocusListener=s=>this._handleBoundaryFocus(s,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new b8(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");XO?(this._accessibilityContainer.classList.add("debug"),this._rowContainer.classList.add("debug"),this._debugRootContainer=r.createElement("div"),this._debugRootContainer.classList.add("xterm"),this._debugRootContainer.appendChild(r.createTextNode("------start a11y------")),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(r.createTextNode("------end a11y------")),this._terminal.element.insertAdjacentElement("afterend",this._debugRootContainer)):this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(s=>this._handleResize(s.rows))),this._register(this._terminal.onRender(s=>this._refreshRows(s.start,s.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(s=>this._handleChar(s))),this._register(this._terminal.onLineFeed(()=>this._handleChar(` -`))),this._register(this._terminal.onA11yTab(s=>this._handleTab(s))),this._register(this._terminal.onKey(s=>this._handleKey(s.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(ke(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(wt(()=>{XO?this._debugRootContainer.remove():this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===` -`&&(this._liveRegionLineCount++,this._liveRegionLineCount===VO+1&&(this._liveRegion.textContent+=u0.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let i=this._terminal.buffer,n=i.lines.length.toString();for(let r=e;r<=t;r++){let s=i.lines.get(i.ydisp+r),a=[],o=s?.translateToString(!0,void 0,void 0,a)||"",l=(i.ydisp+r+1).toString(),c=this._rowElements[r];c&&(o.length===0?(c.textContent="\xA0",this._rowColumns.set(c,[0,1])):(c.textContent=o,this._rowColumns.set(c,a)),c.setAttribute("aria-posinset",l),c.setAttribute("aria-setsize",n),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,n=this._rowElements[t===0?1:this._rowElements.length-2],r=i.getAttribute("aria-posinset"),s=t===0?"1":`${this._terminal.buffer.lines.length}`;if(r===s||e.relatedTarget!==n)return;let a,o;if(t===0?(a=i,o=this._rowElements.pop(),this._rowContainer.removeChild(o)):(a=this._rowElements.shift(),o=i,this._rowContainer.removeChild(a)),a.removeEventListener("focus",this._topBoundaryFocusListener),o.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let l=this._createAccessibilityTreeNode();this._rowElements.unshift(l),this._rowContainer.insertAdjacentElement("afterbegin",l)}else{let l=this._createAccessibilityTreeNode();this._rowElements.push(l),this._rowContainer.appendChild(l)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let n=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:n,offset:n.textContent?.length??0}),!this._rowContainer.contains(i.node))return;let r=({node:o,offset:l})=>{let c=o instanceof Text?o.parentNode:o,u=parseInt(c?.getAttribute("aria-posinset"),10)-1;if(isNaN(u))return console.warn("row is invalid. Race condition?"),null;let d=this._rowColumns.get(c);if(!d)return console.warn("columns is null. Race condition?"),null;let h=l=this._terminal.cols&&(++u,h=0),{row:u,column:h}},s=r(t),a=r(i);if(!(!s||!a)){if(s.row>a.row||s.row===a.row&&s.column>=a.column)throw new Error("invalid range");this._terminal.select(s.column,s.row,(a.row-s.row)*this._terminal.cols-s.column+a.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;te;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e{To(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(ke(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(ke(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(ke(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(ke(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let i=e.composedPath();for(let n=0;n{n?.forEach(r=>{r.link.dispose&&r.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[n,r]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(n)&&(i=this._checkLinkProviderResult(n,e,i)):r.provideLinks(e.y,s=>{if(this._isMouseOut)return;let a=s?.map(o=>({link:o}));this._activeProviderReplies?.set(n,a),i=this._checkLinkProviderResult(n,e,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let n=0;ne?this._bufferService.cols:a.link.range.end.x;for(let c=o;c<=l;c++){if(i.has(c)){r.splice(s--,1);break}i.add(c)}}}}_checkLinkProviderResult(e,t,i){if(!this._activeProviderReplies)return i;let n=this._activeProviderReplies.get(e),r=!1;for(let s=0;sthis._linkAtPosition(a.link,t));s&&(i=!0,this._handleNewLink(s))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let s=0;sthis._linkAtPosition(o.link,t));if(a){i=!0,this._handleNewLink(a);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&y8(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,To(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:i=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:i=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let n=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(n,r),this._lastMouseEvent)){let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._askForLink(s,!1)}})))}_linkHover(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,n=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-n-1,i.end.x,i.end.y-n-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return i<=r&&r<=n}_positionFromMouseEvent(e,t,i){let n=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,n,r){return{x1:e,y1:t,x2:i,y2:n,cols:this._bufferService.cols,fg:r}}};X0=Pt([ce(1,Q0),ce(2,Ls),ce(3,en),ce(4,cR)],X0);S8=class extends h8{constructor(e={}){super(e),this._linkifier=this._register(new cc),this.browser=DR,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new cc),this._onCursorMove=this._register(new ee),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ee),this.onKey=this._onKey.event,this._onRender=this._register(new ee),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ee),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ee),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ee),this.onBell=this._onBell.event,this._onFocus=this._register(new ee),this._onBlur=this._register(new ee),this._onA11yCharEmitter=this._register(new ee),this._onA11yTabEmitter=this._register(new ee),this._onWillOpen=this._register(new ee),this._setup(),this._decorationService=this._instantiationService.createInstance(g8),this._instantiationService.setService(_d,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(cU),this._instantiationService.setService(cR,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(h0)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(bi.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(bi.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(bi.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(bi.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(wt(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let i,n="";switch(t.index){case 256:i="foreground",n="10";break;case 257:i="background",n="11";break;case 258:i="cursor",n="12";break;default:i="ansi",n="4;"+t.index}switch(t.type){case 0:let r=bt.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${$.ESC}]${n};${a8(r)}${L0.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=Wt.toColor(...t.color));else{let s=i;this._themeService.modifyColors(a=>a[s]=Wt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance($p,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let i=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,r=t.getWidth(i),s=this._renderService.dimensions.css.cell.width*r,a=this.buffer.y*this._renderService.dimensions.css.cell.height,o=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=o+"px",this.textarea.style.top=a+"px",this.textarea.style.width=s+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(ke(this.element,"copy",t=>{this.hasSelection()&&eP(t,this._selectionService)}));let e=t=>tP(t,this.textarea,this.coreService,this.optionsService);this._register(ke(this.textarea,"paste",e)),this._register(ke(this.element,"paste",e)),LR?this._register(ke(this.element,"mousedown",t=>{t.button===2&&YM(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(ke(this.element,"contextmenu",t=>{YM(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),ay&&this._register(ke(this.element,"auxclick",t=>{t.button===1&&eR(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(ke(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(ke(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(ke(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(ke(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(ke(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(ke(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(ke(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(ke(this.screenElement,"mousemove",r=>this.updateCursorStyle(r))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",c0.get()),BR||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(oU,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Ds,this._coreBrowserService),this._register(ke(this.textarea,"focus",r=>this._handleTextAreaFocus(r))),this._register(ke(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(P0,this._document,this._helperContainer),this._instantiationService.setService(Gp,this._charSizeService),this._themeService=this._instantiationService.createInstance(F0),this._instantiationService.setService(uc,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(qp),this._instantiationService.setService(lR,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(U0,this.rows,this.screenElement)),this._instantiationService.setService(Ls,this._renderService),this._register(this._renderService.onRenderedViewportChange(r=>this._onRender.fire(r))),this.onResize(r=>this._renderService.resize(r.cols,r.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(I0,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(H0),this._instantiationService.setService(Q0,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(X0,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(R0,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(r=>{super.scrollLines(r,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(q0,this.element,this.screenElement,n)),this._instantiationService.setService(cP,this._selectionService),this._register(this._selectionService.onRequestScrollLines(r=>this.scrollLines(r.amount,r.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(r=>this._renderService.handleSelectionChanged(r.start,r.end,r.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(r=>{this.textarea.value=r,this.textarea.focus(),this.textarea.select()})),this._register(bi.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(D0,this.screenElement)),this._register(ke(this.element,"mousedown",r=>this._selectionService.handleMouseDown(r))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance($p,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",r=>this._handleScreenReaderModeOptionChange(r))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Up,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",r=>{!this._overviewRulerRenderer&&r&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Up,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(B0,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(s){let a=e._mouseService.getMouseReportCoords(s,e.screenElement);if(!a)return!1;let o,l;switch(s.overrideType||s.type){case"mousemove":l=32,s.buttons===void 0?(o=3,s.button!==void 0&&(o=s.button<3?s.button:3)):o=s.buttons&1?0:s.buttons&4?1:s.buttons&2?2:3;break;case"mouseup":l=0,o=s.button<3?s.button:3;break;case"mousedown":l=1,o=s.button<3?s.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(s)===!1)return!1;let c=s.deltaY;if(c===0||e.coreMouseService.consumeWheelEvent(s,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;l=c<0?0:1,o=4;break;default:return!1}return l===void 0||o===void 0||o>4?!1:e.coreMouseService.triggerMouseEvent({col:a.col,row:a.row,x:a.x,y:a.y,button:o,action:l,ctrl:s.ctrlKey,alt:s.altKey,shift:s.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:s=>(i(s),s.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(s)),wheel:s=>(i(s),this.cancel(s,!0)),mousedrag:s=>{s.buttons&&i(s)},mousemove:s=>{s.buttons||i(s)}};this._register(this.coreMouseService.onProtocolChange(s=>{s?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(s)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),s&8?n.mousemove||(t.addEventListener("mousemove",r.mousemove),n.mousemove=r.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),s&16?n.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),n.wheel=r.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),s&2?n.mouseup||(n.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),s&4?n.mousedrag||(n.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(ke(t,"mousedown",s=>{if(s.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(s)))return i(s),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(s)})),this._register(ke(t,"wheel",s=>{if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(s)===!1)return!1;if(!this.buffer.hasScrollback){if(s.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(s,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(s,!0);let a=$.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(a,!0),this.cancel(s,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){JO(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,i){this._selectionService.setSelection(e,t,i)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let i=p8(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),i.type===3||i.type===2){let n=this.rows-1;return this.scrollLines(i.type===2?-n:n),this.cancel(e,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((i.key===$.ETX||i.key===$.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let i=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(w8(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new nr)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},ZO=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new E8(t)}getNullCell(){return new nr}},k8=class extends Le{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ee),this.onBufferChange=this._onBufferChange.event,this._normal=new ZO(this._core.buffers.normal,"normal"),this._alternate=new ZO(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},C8=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,i=>t(i.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(i,n)=>t(i,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},T8=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},N8=["cols","rows"],Qr=0,jR=class extends Le{constructor(e){super(),this._core=this._register(new S8(e)),this._addonManager=this._register(new x8),this._publicOptions={...this._core.options};let t=n=>this._core.options[n],i=(n,r)=>{this._checkReadonlyOptions(n),this._core.options[n]=r};for(let n in this._core.options){let r={get:t.bind(this,n),set:i.bind(this,n)};Object.defineProperty(this._publicOptions,n,r)}}_checkReadonlyOptions(e){if(N8.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new C8(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new T8(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new k8(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r -`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return c0.get()},set promptLabel(e){c0.set(e)},get tooMuchOutput(){return u0.get()},set tooMuchOutput(e){u0.set(e)}}}_verifyIntegers(...e){for(Qr of e)if(Qr===1/0||isNaN(Qr)||Qr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Qr of e)if(Qr&&(Qr===1/0||isNaN(Qr)||Qr%1!==0||Qr<0))throw new Error("This API only accepts positive integers")}}});var A8,M8,VR,XR=ae(()=>{A8=2,M8=1,VR=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,i=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(i.getPropertyValue("height")),r=Math.max(0,parseInt(i.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),a={top:parseInt(s.getPropertyValue("padding-top")),bottom:parseInt(s.getPropertyValue("padding-bottom")),right:parseInt(s.getPropertyValue("padding-right")),left:parseInt(s.getPropertyValue("padding-left"))},o=a.top+a.bottom,l=a.right+a.left,c=n-o,u=r-l-t;return{cols:Math.max(A8,Math.floor(u/e.css.cell.width)),rows:Math.max(M8,Math.floor(c/e.css.cell.height))}}}});var ZR=ae(()=>{});function O8(){let e=document.documentElement.dataset.theme;return e==="dark"?!0:e==="light"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}function oy(){return O8()?{background:"#0c0c0c",foreground:"#cccccc",cursor:"#cccccc",cursorAccent:"#0c0c0c",selectionBackground:"#264f78",selectionForeground:"#ffffff",black:"#0c0c0c",red:"#f14c4c",green:"#23d18b",yellow:"#f5f543",blue:"#3b8eea",magenta:"#d670d6",cyan:"#29b8db",white:"#cccccc",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#ffffff"}:{background:"#ffffff",foreground:"#1e1e1e",cursor:"#1e1e1e",cursorAccent:"#ffffff",selectionBackground:"#add6ff",selectionForeground:"#1e1e1e",black:"#000000",red:"#cd3131",green:"#00bc00",yellow:"#949800",blue:"#0451a5",magenta:"#bc05bc",cyan:"#0598bc",white:"#555555",brightBlack:"#666666",brightRed:"#cd3131",brightGreen:"#14ce14",brightYellow:"#b5ba00",brightBlue:"#0451a5",brightMagenta:"#bc05bc",brightCyan:"#0598bc",brightWhite:"#a5a5a5"}}var QR=ae(()=>{});function JR(){let{projects:e,threads:t}=Ke(),i=he(),n=t.find(y=>y.id===i.currentThreadId)??null,r=n?e.find(y=>y.id===n.projectId):e.find(y=>y.id===i.currentProjectId),s=r?.id??null,[a,o]=(0,Si.useState)([]),[l,c]=(0,Si.useState)(null),[u,d]=(0,Si.useState)(null),h=(0,Si.useCallback)(async()=>{if(!s){o([]);return}try{let y=await Q.call("terminal.list",{projectId:s});o(y),c(m=>m&&y.some(v=>v.id===m)?m:y[0]?.id??null)}catch{}},[s]);(0,Si.useEffect)(()=>{h()},[h]),(0,Si.useEffect)(()=>Q.subscribe("terminals",(m,v)=>{let b=v;b?.type==="terminal.exit"&&(o(w=>w.filter(k=>k.id!==b.id)),c(w=>w===b.id?null:w))}),[]);let f=async()=>{if(s)try{let y=await Q.call("terminal.create",{projectId:s,cols:100,rows:28});await h(),c(y.id)}catch(y){Ee(g("terminal.failNew")+Ze(y),!0)}},p=async y=>{try{await Q.call("terminal.kill",{id:y.id}),o(m=>m.filter(v=>v.id!==y.id)),c(m=>m===y.id?null:m)}catch(m){Ee(g("terminal.failKill")+Ze(m),!0)}};if(!r)return(0,ai.jsx)("div",{className:"pn-empty",children:g("panel.pickProject")});let _=a.find(y=>y.id===l)??null;return(0,ai.jsxs)(ai.Fragment,{children:[(0,ai.jsxs)("div",{className:"tm-tabs",children:[a.map(y=>(0,ai.jsxs)("button",{className:`tm-tab${y.id===l?" on":""}`,onClick:()=>c(y.id),title:y.title,children:[y.title,(0,ai.jsx)("span",{className:"tm-x",onClick:m=>{m.stopPropagation(),d(y)},children:"\xD7"})]},y.id)),(0,ai.jsx)("button",{className:"ibtn",title:g("terminal.new"),onClick:()=>{f()},children:(0,ai.jsx)(re,{name:"plus",size:14})})]}),_?.simple&&(0,ai.jsx)("div",{className:"tm-note",children:g("terminal.simpleNote")}),(0,ai.jsxs)("div",{className:"tm-body",children:[a.length===0&&(0,ai.jsxs)("div",{className:"pn-empty",children:[g("terminal.noTerm"),(0,ai.jsx)("div",{style:{marginTop:8},children:(0,ai.jsx)("button",{className:"btn primary",onClick:()=>{f()},children:g("terminal.new")})})]}),a.map(y=>(0,ai.jsx)(R8,{term:y,visible:y.id===l},y.id))]}),u&&(0,ai.jsx)($l,{title:g("terminal.closeTitle"),body:_e("terminal.closeBody",{title:u.title}),okLabel:g("terminal.closeOk"),danger:!0,onOk:()=>{p(u)},onClose:()=>d(null)})]})}function R8({term:e,visible:t}){let i=(0,Si.useRef)(null),n=(0,Si.useRef)(null),r=(0,Si.useRef)(null),[s,a]=(0,Si.useState)(!1);return(0,Si.useEffect)(()=>{let o=i.current;if(!o)return;let l=new jR({fontFamily:'"Cascadia Mono", "Cascadia Code", Consolas, "SF Mono", Menlo, Monaco, "DejaVu Sans Mono", "Ubuntu Mono", "Microsoft YaHei UI", "PingFang SC", "Noto Sans Mono CJK SC", monospace',fontSize:13,lineHeight:1.25,cursorBlink:!0,scrollback:5e3,allowTransparency:!1,theme:oy()}),c=new VR;l.loadAddon(c),l.open(o),n.current=l,r.current=c;try{c.fit()}catch{}let u=new TextDecoder,d=new TextEncoder,h=Q.onBinaryFrame((f,p,_)=>{p!==e.index||f!==1||l.write(u.decode(_))});return l.onData(f=>Q.sendBinary(2,e.index,d.encode(f))),(async()=>{try{let f=await Q.call("terminal.attach",{id:e.id});f.windowsPty&&(l.options.windowsPty=f.windowsPty),f.snapshot&&l.write(f.snapshot),a(!0)}catch{l.writeln(g("terminal.ended"))}})(),()=>{h(),l.dispose(),n.current=null,r.current=null}},[e.id,e.index]),(0,Si.useEffect)(()=>{let o=document.documentElement,l=()=>{let d=n.current;d&&(d.options.theme=oy())},c=new MutationObserver(l);c.observe(o,{attributes:!0,attributeFilter:["data-theme"]});let u=window.matchMedia("(prefers-color-scheme: dark)");return u.addEventListener("change",l),()=>{c.disconnect(),u.removeEventListener("change",l)}},[]),(0,Si.useEffect)(()=>{if(!t)return;let o=r.current,l=n.current;if(!o||!l||!s)return;let c=setTimeout(()=>{try{o.fit();let u=new TextEncoder;Q.sendBinary(3,e.index,u.encode(JSON.stringify({cols:l.cols,rows:l.rows})))}catch{}},50);return()=>clearTimeout(c)},[t,s,e.index]),(0,Si.useEffect)(()=>{let o=i.current;if(!o)return;let l=new ResizeObserver(()=>{let c=r.current,u=n.current;if(!(!c||!u||!t))try{c.fit();let d=new TextEncoder;Q.sendBinary(3,e.index,d.encode(JSON.stringify({cols:u.cols,rows:u.rows})))}catch{}});return l.observe(o),()=>l.disconnect()},[t,e.index]),(0,ai.jsx)("div",{className:"tm-view",ref:i,style:{display:t?"block":"none"}})}var Si,ai,e2=ae(()=>{Si=ne(pt(),1);YR();XR();Qi();An();Hi();Mn();Kl();fr();Ct();ZR();QR();ai=ne(be(),1)});function t2(){let e=he(),t=Ke(B=>B.threads),i=e.currentThreadId,n=_c(i),r=xi(B=>B.byThread[n]),s=t.find(B=>B.id===i)??null,a=(0,rr.useRef)(null),[o,l]=(0,rr.useState)(""),[c,u]=(0,rr.useState)(!1),[d,h]=(0,rr.useState)(null),f=(0,rr.useRef)(null);(0,rr.useEffect)(()=>{let B=xi.getState(),q=B.byThread[n];if(q&&q.proxyHref)return;let H=q?.url??s?.previewUrl??null;H&&B.navigate(yd,n,i,H,{push:!1})},[n,i,s?.previewUrl]);let p=r?.origin,_=!!r?.proxyOrigin;(0,rr.useEffect)(()=>{if(!(!p||!_))return()=>{let B=xi.getState(),q=_c(he.getState().currentThreadId),H=he.getState().panelOpen&&he.getState().panelTab==="preview"&&B.byThread[q]?.origin===p&&q!==n;B.detach(n),H||Q.call("preview.release",{url:p}).catch(()=>{})}},[p,_,n]),(0,rr.useEffect)(()=>{c||l(r?Od(r.url):"")},[r?.url,c]),(0,rr.useEffect)(()=>{let B=q=>{let H=a.current?.contentWindow;if(!H||q.source!==H)return;let P=q.data;if(!P||typeof P!="object"||P.ac_preview!==1||typeof P.href!="string")return;let x=xi.getState().byThread[n];if(!x?.proxyOrigin)return;let U=Ky(P.href.slice(0,2048),x.proxyOrigin,x.origin),C=ns(U);if(!C.ok||C.target.origin!==x.origin)return;let D=typeof P.title=="string"?P.title.slice(0,200):"";xi.getState().reported(n,C.target.href,D),i&&C.target.href!==x.url&&(f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{Q.call("threads.update",{id:i,previewUrl:C.target.href}).catch(()=>{})},800))};return window.addEventListener("message",B),()=>window.removeEventListener("message",B)},[n,i]);let y=B=>{let q=B.trim();if(!q)return;let H=ns(q);if(!H.ok){h(q);return}h(null),u(!1),xi.getState().navigate(yd,n,i,H.target.href,{push:!0})},m=B=>{try{a.current?.contentWindow?.postMessage({ac_preview_cmd:B},"*")}catch{}},v=()=>{if(r?.bridged)return m("back");let B=xi.getState().step(n,-1);B&&xi.getState().navigate(yd,n,i,B,{push:!1})},b=()=>{if(r?.bridged)return m("forward");let B=xi.getState().step(n,1);B&&xi.getState().navigate(yd,n,i,B,{push:!1})},w=()=>{if(r){if(r.error||!r.proxyHref){xi.getState().navigate(yd,n,i,r.url,{push:!1});return}r.bridged?m("reload"):xi.getState().reload(n)}},k=!!r&&(r.bridged||r.idx>0),M=!!r&&(r.bridged||r.idxe.setPanelWidth(Math.min(Eu,ys({...he.getState(),panelOpen:!0})));return(0,lt.jsxs)("div",{className:"pv",children:[(0,lt.jsxs)("div",{className:"pv-bar",children:[(0,lt.jsx)("button",{type:"button",className:"ibtn",title:g("preview.back"),"aria-label":g("preview.back"),disabled:!k,onClick:v,children:(0,lt.jsx)(re,{name:"arrowLeft",size:15})}),(0,lt.jsx)("button",{type:"button",className:"ibtn",title:g("preview.forward"),"aria-label":g("preview.forward"),disabled:!M,onClick:b,children:(0,lt.jsx)(re,{name:"arrowRight",size:15})}),(0,lt.jsx)("button",{type:"button",className:"ibtn",title:g("preview.reload"),"aria-label":g("preview.reload"),disabled:!r,onClick:w,children:(0,lt.jsx)(re,{name:"refresh",size:14})}),(0,lt.jsx)("input",{className:`pv-addr${d?" err":""}`,value:o,spellCheck:!1,placeholder:g("preview.placeholder"),"aria-label":g("preview.address"),onFocus:B=>{u(!0),B.currentTarget.select()},onBlur:()=>{u(!1)},onChange:B=>{l(B.target.value),d&&h(null)},onKeyDown:B=>{B.nativeEvent.isComposing||(B.key==="Enter"?(B.preventDefault(),y(o)):B.key==="Escape"&&(u(!1),h(null),l(r?Od(r.url):""),B.target.blur()))}}),(0,lt.jsx)("button",{type:"button",className:"ibtn",title:g("preview.openExternal"),"aria-label":g("preview.openExternal"),disabled:!T,onClick:()=>T&&void ks(T),children:(0,lt.jsx)(re,{name:"external",size:14})}),(0,lt.jsx)("button",{type:"button",className:"ibtn",title:g("preview.widen"),"aria-label":g("preview.widen"),onClick:I,children:(0,lt.jsx)(re,{name:"widen",size:15})})]}),d&&(0,lt.jsxs)("div",{className:"pv-note err",children:[(0,lt.jsx)("span",{children:g("preview.onlyLocal")}),A&&(0,lt.jsx)("button",{type:"button",className:"btn",onClick:()=>{ks(A),h(null)},children:g("preview.openExternal")})]}),r?.error&&(0,lt.jsxs)("div",{className:"pv-note err",children:[(0,lt.jsxs)("span",{children:[g("preview.failed"),Tr(r.error)]}),T&&(0,lt.jsx)("button",{type:"button",className:"btn",onClick:()=>{ks(T)},children:g("preview.openExternal")}),(0,lt.jsx)("button",{type:"button",className:"btn",onClick:w,children:g("common.retry")})]}),r?(0,lt.jsxs)("div",{className:"pv-frame-wrap",children:[r.loading&&(0,lt.jsx)("div",{className:"pv-loading"}),r.proxyHref&&(0,lt.jsx)("iframe",{ref:a,className:"pv-frame",title:r.title||Od(r.url),src:r.proxyHref,referrerPolicy:"no-referrer"},`${r.proxyOrigin}|${r.nonce}`)]}):(0,lt.jsxs)("div",{className:"pv-empty",children:[(0,lt.jsx)("div",{children:g("preview.empty")}),(0,lt.jsx)("div",{className:"pv-hint",children:g("preview.limits")})]})]})}var rr,lt,yd,i2=ae(()=>{rr=ne(pt(),1);Hi();Qi();An();Rd();Nd();Pu();Ct();Mn();Nf();lt=ne(be(),1),yd=(e,t)=>Q.call(e,t)});function n2(){let e=he(),t=[{tab:"changes",label:g("panel.changes")},{tab:"files",label:g("panel.files")},{tab:"terminal",label:g("panel.terminal")},{tab:"preview",label:g("preview.tab")}];return(0,le.jsxs)(le.Fragment,{children:[(0,le.jsxs)("div",{className:"pn-head",children:[(0,le.jsx)("div",{className:"pn-tabs",children:t.map(i=>(0,le.jsx)("button",{className:`pn-tab${e.panelTab===i.tab?" on":""}`,onClick:()=>e.setPanelTab(i.tab),children:i.label},i.tab))}),(0,le.jsx)("button",{className:"ibtn pn-close",title:g("panel.closeTitle"),onClick:()=>e.closePanel(),children:(0,le.jsx)(re,{name:"x"})})]}),(0,le.jsxs)("div",{className:"pn-body",children:[e.panelTab==="changes"&&(0,le.jsx)(z8,{}),e.panelTab==="files"&&(0,le.jsx)(P8,{}),e.panelTab==="terminal"&&(0,le.jsx)(JR,{}),e.panelTab==="preview"&&e.panelOpen&&(0,le.jsx)(t2,{})]})]})}function L8(e){let t=[],i=null;for(let n of e.split(` -`))if(!(n.startsWith("diff ")||n.startsWith("index ")||n.startsWith("--- ")||n.startsWith("+++ "))){if(n.startsWith("@@")){i={head:n,lines:[]},t.push(i);continue}i&&(n.startsWith("+")?i.lines.push({t:"+",text:n.slice(1)}):n.startsWith("-")?i.lines.push({t:"-",text:n.slice(1)}):n.startsWith("\\")?i.lines.push({t:" ",text:n}):i.lines.push({t:" ",text:n.startsWith(" ")?n.slice(1):n}))}return t}function I8(e){let t=0,i=0;for(let n of e.split(` -`))n.startsWith("+")&&!n.startsWith("+++")?t++:n.startsWith("-")&&!n.startsWith("---")&&i++;return{add:t,del:i}}function z8(){let{projects:e,threads:t}=Ke(),i=he(),n=Di(A=>A.status),[r,s]=(0,xt.useState)(null),[a,o]=(0,xt.useState)(!1),[l,c]=(0,xt.useState)(null),[u,d]=(0,xt.useState)(null),[h,f]=(0,xt.useState)(null),[p,_]=(0,xt.useState)({}),y=(0,xt.useRef)(n),m=(0,xt.useRef)(null);m.current=l;let v=t.find(A=>A.id===i.currentThreadId)??null,b=v?e.find(A=>A.id===v.projectId):e.find(A=>A.id===i.currentProjectId),w=b?.id??null,k=(0,xt.useCallback)(async()=>{if(!w){s(null);return}try{let A=await Q.call("git.status",{projectId:w});s(A);let I=m.current;I&&!A.files?.some(B=>B.path===I)&&(c(null),d(null))}catch(A){s({isRepo:!1,error:String(A?.message??A)})}},[w]);(0,xt.useEffect)(()=>{k();let A=setInterval(()=>{k()},3e3);return()=>clearInterval(A)},[k]),(0,xt.useEffect)(()=>{let A=y.current;y.current=n,(A==="running"||A==="initializing")&&n!=="running"&&n!=="initializing"&&k()},[n,k]);let M=(0,xt.useCallback)(async A=>{if(w){c(A.path),d({loading:!0});try{let I=await Q.call("git.diff",{projectId:w,path:A.path});if(I.tooLarge)d({tooLarge:!0});else if(I.error)d({error:I.error});else{let B=L8(I.diff??"");d({hunks:B}),_(q=>({...q,[A.path]:I8(I.diff??"")}))}}catch(I){d({error:String(I?.message??I)})}}},[w]),T=(0,xt.useCallback)(async A=>{if(w){o(!0);try{await Q.call("git.discard",{projectId:w,path:A.path}),l===A.path&&(c(null),d(null)),await k()}catch(I){Ee(g("panel.failDiscard")+Ze(I),!0)}finally{o(!1)}}},[w,l,k]);return b?r&&!r.isRepo?(0,le.jsxs)("div",{className:"pn-empty",children:[g("panel.notGit"),r.error&&(0,le.jsx)("div",{className:"pn-empty-sub",children:r.error})]}):(0,le.jsxs)(le.Fragment,{children:[(0,le.jsxs)("div",{className:"chg-head",children:[(0,le.jsxs)("span",{className:"chg-branch",title:g("panel.branch"),children:[(0,le.jsx)(re,{name:"changes",size:13})," ",r?.branch??"\u2026"]}),(0,le.jsx)("button",{className:"ibtn",title:g("common.refresh"),onClick:()=>{k()},children:(0,le.jsx)(re,{name:"refresh",size:14})})]}),(0,le.jsxs)("div",{className:"chg-list",children:[(r?.files??[]).length===0&&(0,le.jsx)("div",{className:"pn-empty",children:g("panel.clean")}),r?.files?.map(A=>{let I=p[A.path];return(0,le.jsxs)("div",{className:`chg-row${l===A.path?" on":""}`,onClick:()=>{M(A)},children:[(0,le.jsx)("span",{className:`chg-kind k-${A.kind}`,title:A.kind,children:D8(A.kind)}),(0,le.jsx)("span",{className:"chg-path",title:A.path,children:A.path}),I&&(0,le.jsxs)("span",{className:"chg-stat",children:[(0,le.jsxs)("em",{className:"add",children:["+",I.add]})," ",(0,le.jsxs)("em",{className:"del",children:["\u2212",I.del]})]}),(0,le.jsx)("button",{className:"ibtn chg-discard",title:g("panel.discardBtn"),disabled:a,onClick:B=>{B.stopPropagation(),f(A)},children:(0,le.jsx)(re,{name:"x",size:13})})]},A.path)})]}),(0,le.jsxs)("div",{className:"chg-diff","data-quote-root":"panel","data-quote-src":l??void 0,children:[u?.loading&&(0,le.jsx)("div",{className:"pn-empty",children:g("panel.loadingDiff")}),u?.tooLarge&&(0,le.jsx)("div",{className:"pn-empty",children:g("panel.diffTooLarge")}),u?.error&&(0,le.jsx)("div",{className:"pn-empty",children:u.error}),u?.hunks&&(0,le.jsx)(pp,{hunks:u.hunks,path:l??void 0})]}),h&&(0,le.jsx)($l,{title:g("panel.discardTitle"),body:h.kind==="untracked"?_e("panel.discardUntracked",{path:h.path}):_e("panel.discardTracked",{path:h.path}),okLabel:g("common.discard"),danger:!0,onOk:()=>{T(h)},onClose:()=>f(null)})]}):(0,le.jsx)("div",{className:"pn-empty",children:g("panel.pickProject")})}function B8(e){window.dispatchEvent(new CustomEvent("ac-insert-mention",{detail:e}))}function P8(){let{projects:e,threads:t}=Ke(),i=he(),n=t.find(k=>k.id===i.currentThreadId)??null,r=n?e.find(k=>k.id===n.projectId):e.find(k=>k.id===i.currentProjectId),s=r?.id??null,[a,o]=(0,xt.useState)({}),[l,c]=(0,xt.useState)(null),[u,d]=(0,xt.useState)(null),[h,f]=(0,xt.useState)(null),p=(0,xt.useCallback)(async k=>{if(s){o(M=>({...M,[k]:"loading"}));try{let M=await Q.call("files.tree",{projectId:s,dir:k});o(T=>({...T,[k]:M.error?`err:${M.error}`:M.entries??[]}))}catch(M){o(T=>({...T,[k]:`err:${String(M?.message??M)}`}))}}},[s]);(0,xt.useEffect)(()=>{o({}),c(null),d(null),s&&p(".")},[s,p]);let _=k=>{if(!k.isDir){y(k.path);return}let M=a[k.path];M&&M!=="loading"?o(T=>{let A={...T};return delete A[k.path],A}):M||p(k.path)},y=async k=>{if(s){c(k),d({loading:!0});try{let M=await Q.call("files.read",{projectId:s,path:k});d(M)}catch(M){d({error:String(M?.message??M)})}}},m=(0,xt.useRef)(null);if((0,xt.useEffect)(()=>{let k=m.current;if(!(!k||!u?.text))try{Jf.highlightElement(k)}catch{}},[u?.text,u?.language]),!r)return(0,le.jsx)("div",{className:"pn-empty",children:g("panel.pickProject")});let v=l?l.split("/"):[],b=(k,M)=>{let T=a[k];return!T||T==="loading"?null:typeof T=="string"?(0,le.jsx)("div",{className:"ft-err",style:{paddingLeft:8+M*14},children:T.slice(4)}):T.map(A=>(0,le.jsxs)("div",{children:[(0,le.jsxs)("div",{className:`ft-row${l===A.path?" on":""}`,style:{paddingLeft:8+M*14},onClick:()=>_(A),title:A.path,draggable:!0,onDragStart:I=>{I.dataTransfer.effectAllowed="copy",I.dataTransfer.setData(sc,JSON.stringify({projectId:r.id,rel:A.path,isDir:A.isDir})),I.dataTransfer.setData("text/plain",ac(r.path,A.path))},onContextMenu:I=>{I.preventDefault(),f({x:I.clientX,y:I.clientY,entry:A})},children:[A.isDir?(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)("span",{className:`caret${a[A.path]&&a[A.path]!=="loading"?" open":""}`,children:"\u203A"}),(0,le.jsx)(re,{name:"files",size:13})]}):(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)("span",{className:"caret",style:{visibility:"hidden"},children:"\u203A"}),(0,le.jsx)("span",{className:"ft-dot"})]}),(0,le.jsx)("span",{className:"ft-name",children:A.name})]}),A.isDir&&b(A.path,M+1)]},A.path))},w=h?[{kind:"item",label:g("mention.add"),onClick:()=>B8({projectId:r.id,rel:h.entry.path,isDir:h.entry.isDir})},{kind:"sep"},{kind:"item",label:g("common.copyPath"),onClick:()=>{gr(ac(r.path,h.entry.path)),Ee(g("common.copiedPath"))}},{kind:"item",label:g("mention.copyRel"),onClick:()=>{gr(h.entry.path),Ee(g("common.copiedPath"))}}]:[];return(0,le.jsxs)(le.Fragment,{children:[h&&(0,le.jsx)(ao,{x:h.x,y:h.y,items:w,onClose:()=>f(null)}),(0,le.jsx)("div",{className:"ft-crumbs",children:l?(0,le.jsxs)(le.Fragment,{children:[(0,le.jsx)("button",{className:"ft-crumb",onClick:()=>c(null),title:g("panel.closePreview"),children:"\xD7"}),v.map((k,M)=>(0,le.jsxs)("span",{className:"ft-crumb-t",children:[M>0?"/":"",k]},M)),(0,le.jsx)("button",{className:"ibtn",title:g("common.copyPath"),onClick:()=>{gr(l),Ee(g("common.copiedPath"))},children:(0,le.jsx)(re,{name:"copy",size:13})})]}):(0,le.jsx)("span",{className:"ft-crumb-t muted",children:r.name})}),(0,le.jsx)("div",{className:"ft-tree",children:b(".",0)}),l&&(0,le.jsxs)("div",{className:"ft-view","data-quote-root":"panel","data-quote-src":l,children:[u?.loading&&(0,le.jsx)("div",{className:"pn-empty",children:g("panel.reading")}),u?.binary&&(0,le.jsx)("div",{className:"pn-empty",children:g("panel.binary")}),u?.tooLarge&&(0,le.jsx)("div",{className:"pn-empty",children:g("panel.tooLarge")}),u?.error&&(0,le.jsx)("div",{className:"pn-empty",children:u.error}),u?.text!=null&&(0,le.jsx)("pre",{className:"ft-pre",children:(0,le.jsx)("code",{ref:m,className:`language-${u.language??"plaintext"}`,children:u.text})})]})]})}var xt,le,D8,r2=ae(()=>{xt=ne(pt(),1);Qi();An();yo();Hi();Mn();Ku();Kl();fr();Ct();e2();i2();Rf();gp();Hu();pb();le=ne(be(),1);D8=e=>g(`panel.gitKind.${e}`)});function s2(){let{state:e,version:t}=$r(),i=Di(l=>l.pending),n=Ke(l=>l.providers),[r,s]=(0,Sd.useState)(!1),[a,o]=(0,Sd.useState)(!1);return(0,Sd.useEffect)(()=>{let l=u=>{(u.ctrlKey||u.metaKey)&&u.key.toLowerCase()==="k"&&(u.preventDefault(),s(d=>!d))},c=()=>o(!0);return window.addEventListener("keydown",l),window.addEventListener("open-settings",c),()=>{window.removeEventListener("keydown",l),window.removeEventListener("open-settings",c)}},[]),e==="down"?(0,wi.jsx)("div",{className:"boot-screen",children:(0,wi.jsxs)("div",{className:"boot-wrap",children:[(0,wi.jsx)("span",{children:g("boot.serviceDown")}),(0,wi.jsx)("button",{className:"btn primary",onClick:()=>{Ef()?kf():xf()||location.reload()},children:g("boot.retry")})]})}):e==="connecting"&&!t?(0,wi.jsxs)("div",{className:"boot-screen",children:[(0,wi.jsx)("div",{className:"boot-dot","data-state":e}),(0,wi.jsx)("span",{className:"boot-label",children:g("boot.connecting")})]}):(0,wi.jsxs)(Ok,{sidebar:(0,wi.jsx)(qk,{pendingByThread:new Set(i.map(l=>Di.getState().threadId).filter(Boolean))}),topbar:(0,wi.jsx)(ZN,{pendingCount:i.length,pendingKey:i[0]?.key}),panel:(0,wi.jsx)(n2,{}),children:[e==="reconnecting"&&(0,wi.jsx)("div",{className:"connbar",children:g("boot.reconnecting")}),(0,wi.jsx)(qM,{}),r&&(0,wi.jsx)($M,{onClose:()=>s(!1)}),a&&(0,wi.jsx)(SM,{onClose:()=>o(!1),providers:n}),(0,wi.jsx)(Hk,{})]})}var Sd,wi,a2=ae(()=>{xu();Rk();zv();QN();FM();yo();An();Sd=ne(pt(),1);KM();r2();Sp();fr();Ct();Nv();wi=ne(be(),1)});function o2(){let{state:e,version:t}=$r(),[i,n]=(0,$i.useState)([]),[r,s]=(0,$i.useState)([]),[a,o]=(0,$i.useState)(""),[l,c]=(0,$i.useState)(""),[u,d]=(0,$i.useState)([]),[h,f]=(0,$i.useState)([]),[p,_]=(0,$i.useState)([]),[y,m]=(0,$i.useState)(""),[v,b]=(0,$i.useState)(""),w=(0,$i.useRef)(null);(0,$i.useEffect)(()=>{e==="open"&&(Oa("projects.list").then(I=>n(I??[])),Oa("threads.list").then(I=>s(I??[])))},[e]),(0,$i.useEffect)(()=>{if(w.current?.(),w.current=null,d([]),f([]),_([]),!(!l||e!=="open"))return Oa("threads.get",{id:l}).then(I=>{let B=I;d(B.events??[]),f(B.pending??[]),_(B.queue??[])}),w.current=Q.subscribe(`thread:${l}`,(I,B)=>{let q=B;if(q.type==="event"&&q.event&&(d(H=>[...H,q.event]),q.event.type==="permission_resolved"||q.event.type==="question_answered")){let H=q.event.requestId;f(P=>P.filter(x=>x.requestId!==H))}q.type==="queue"&&q.queue&&_(q.queue)}),()=>w.current?.()},[l,e]),(0,$i.useEffect)(()=>{let I=u.filter(H=>H.type==="permission_request"||H.type==="question"),B=new Set(u.filter(H=>H.type==="permission_resolved"||H.type==="question_answered").map(H=>H.requestId)),q=I.filter(H=>!B.has(H.requestId)).map(H=>({requestId:H.requestId??"",kind:H.type==="question"?"question":"permission",options:H.options}));f(H=>{let P=new Map(H.map(x=>[x.requestId,x]));for(let x of q)P.set(x.requestId,x);return[...P.values()]})},[u]);let k=async()=>{if(!l)return;let I=await Oa("threads.get",{id:l}).catch(()=>null);I&&(d(I.events??[]),f(B=>{let q=new Map(B.map(H=>[H.requestId,H]));for(let H of I.pending??[])q.set(H.requestId,H);return[...q.values()]}),_(I.queue??[]))},M=async I=>{if(b(""),!l||!y.trim())return;let B=y;m("");try{await Oa("thread.send",{id:l,text:B,behavior:I})}catch(q){b(String(q?.message??q))}await k()},T=async(I,B,q)=>{await Oa("thread.respond",{id:l,requestId:I,optionId:B,answers:q}).catch(H=>b(String(H?.message??H))),setTimeout(()=>{k()},1500)},A=async()=>{if(!a)return;let I=await Oa("threads.create",{projectId:a,provider:"mock"}).catch(B=>(b(String(B?.message??B)),null));I&&(s(B=>[I,...B]),c(I.id))};return(0,Et.jsxs)("div",{style:{display:"flex",height:"100vh",font:"13px/1.5 system-ui",color:"var(--fg)"},children:[(0,Et.jsxs)("div",{style:{width:260,borderRight:"1px solid var(--border)",padding:12,overflowY:"auto"},children:[(0,Et.jsx)("div",{style:{marginBottom:8},children:e==="open"?`\u5DF2\u8FDE\u63A5 \xB7 ${t??""}`:"\u8FDE\u63A5\u4E2D\u2026"}),(0,Et.jsx)(pn,{className:"tinput sm-field",matchWidth:!0,ariaLabel:"\u9009\u62E9\u9879\u76EE",value:a,onChange:o,options:[{value:"",label:"\u9009\u62E9\u9879\u76EE"},...i.map(I=>({value:I.id,label:I.name}))]}),(0,Et.jsx)("button",{onClick:()=>{A()},disabled:!a,style:{width:"100%",marginTop:8},children:"\u65B0\u5EFA\u5BF9\u8BDD\uFF08mock\uFF09"}),(0,Et.jsx)("div",{style:{marginTop:12},children:r.filter(I=>!a||I.projectId===a).map(I=>(0,Et.jsxs)("div",{onClick:()=>c(I.id),style:{padding:"6px 8px",cursor:"pointer",borderRadius:4,background:I.id===l?"var(--bg-active, #333)":"transparent"},children:[I.title," ",(0,Et.jsxs)("span",{style:{opacity:.6},children:["(",I.status,")"]})]},I.id))})]}),(0,Et.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:[(0,Et.jsxs)("div",{style:{flex:1,overflowY:"auto",padding:12},children:[u.map((I,B)=>(0,Et.jsx)("pre",{style:{margin:"4px 0",fontSize:11,whiteSpace:"pre-wrap",borderBottom:"1px solid var(--border)",paddingBottom:4},children:(I.seq??"")+" "+(I.type??"?")+" "+JSON.stringify(I).slice(0,400)},B)),h.map(I=>(0,Et.jsxs)("div",{style:{border:"1px solid var(--warn, orange)",borderRadius:6,padding:8,margin:"8px 0"},children:[(0,Et.jsxs)("div",{children:["\u6388\u6743/\u63D0\u95EE ",I.requestId]}),I.options?.map(B=>(0,Et.jsx)("button",{onClick:()=>{T(I.requestId,B.id)},style:{marginRight:8},children:B.label},B.id)),I.kind==="question"&&(0,Et.jsx)("button",{onClick:()=>{T(I.requestId,void 0,{q1:"staging",q2:""})},children:"\u586B\u8868\u63D0\u4EA4"}),(0,Et.jsx)("button",{onClick:()=>{T(I.requestId,void 0,void 0)},children:"\u53D6\u6D88"})]},I.requestId))]}),p.length>0&&(0,Et.jsxs)("div",{style:{padding:"4px 12px",opacity:.7},children:["\u6392\u961F\u4E2D\uFF1A",p.length," \u6761"]}),v&&(0,Et.jsx)("div",{style:{padding:"4px 12px",color:"var(--danger, red)"},children:v}),(0,Et.jsxs)("div",{style:{display:"flex",gap:8,padding:12,borderTop:"1px solid var(--border)"},children:[(0,Et.jsx)("input",{value:y,onChange:I=>m(I.target.value),onKeyDown:I=>{I.key==="Enter"&&M()},placeholder:"/perm /plan /slow /exit \u2026",style:{flex:1}}),(0,Et.jsx)("button",{onClick:()=>{M()},children:"\u53D1\u9001"}),(0,Et.jsx)("button",{onClick:()=>{M("steer")},children:"\u63D2\u8BDD"}),(0,Et.jsx)("button",{onClick:()=>{Oa("thread.interrupt",{id:l})},children:"\u6253\u65AD"})]})]})]})}var $i,Et,Oa,l2=ae(()=>{$i=ne(pt(),1);xu();Hi();vp();Et=ne(be(),1),Oa=(e,t)=>Q.call(e,t)});function f2(){c2++,q8.render(U8?(0,ly.jsx)(o2,{}):(0,ly.jsx)(s2,{},`${Da()}-${c2}`))}var u2,ly,H8,d2,Q,h2,U8,q8,c2,Hi=ae(()=>{Rd();Qy();Jy();eS();tS();iS();u2=ne(lk(),1);wv();yu();vk();Tv();Nv();Ct();Sk();xu();Qi();An();a2();l2();cp();ly=ne(be(),1),H8=rc(),d2=new URLSearchParams(location.search);Yy(location.search);ck(location.search);dk(location.search);Q=new Cf(H8,Da());_k(e=>{!e.lang||!Vy(e.lang)||(Q.setLang(Da()),Q.call("app.setLocale",{lang:Da()}).catch(()=>{}),f2())});window.__ws=Q;window.__stores={useData:Ke,useUi:he,useConnection:$r,usePreview:xi};Promise.resolve().then(()=>(yo(),NA)).then(e=>{window.__tl=e.useTimeline});Q.onState(e=>$r.getState().set({state:e}));h2=Ef();bk(Q,()=>{h2?kf():xf()});h2&&(yk(Q),Q.onState(e=>{if(e==="open")try{window.parent.postMessage({ac_console:"alive"},"*")}catch{}}));Q.connect();Q.waitHello().then(async e=>{$r.getState().set({version:e.version??null}),he.getState().bind(Q);try{let t=await Q.call("settings.get");he.getState().hydrate(t),Wr(t.theme),Su(t)}catch{}await Ke.getState().bind(Q)});setInterval(()=>Q.ping(),1e4);U8=d2.get("debug")==="1",q8=(0,u2.createRoot)(document.getElementById("root")),c2=0;f2();d2.get("audit")==="1"&&setTimeout(()=>{try{let e=window.innerWidth,t=document.documentElement.scrollWidth,i=new Set,n=[],r=0,s=getComputedStyle(document.documentElement).getPropertyValue("--accent").trim(),a=c=>c.top0&&c.width>0;document.querySelectorAll("*").forEach(c=>{let u=c,d=getComputedStyle(u),h=u.getBoundingClientRect();if(!a(h)||d.display==="none"||d.visibility==="hidden"||h.width<3||h.height<3)return;i.add(d.fontSize),d.borderTopWidth!=="0px"&&d.borderTopStyle!=="none"&&r++,d.borderBottomWidth!=="0px"&&d.borderBottomStyle!=="none"&&r++;let f=d.backgroundColor,p=d.color;if(s&&(f===s||p===s)){let _=(u.getAttribute("class")??"").split(" ")[0];n.includes(_)||n.push(_)}});let o={vw:e,docW:t,noHScroll:t<=e+1,fontSizes:[...i].sort(),bordersFirstScreen:r,accentEls:n},l=document.createElement("pre");l.id="audit",l.style.display="none",l.textContent=JSON.stringify(o),document.body.appendChild(l)}catch(e){let t=document.createElement("pre");t.id="audit",t.textContent=JSON.stringify({error:String(e)}),document.body.appendChild(t)}},1500)});Hi();})(); +`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),_y&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!i||!n||!t?!1:this._areCoordsInSelection(t,i,n)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!i||!n?!1:this._areCoordsInSelection([e,t],i,n)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]}_selectWordAtCursor(e,t){let i=this._linkifier.currentLink?.link?.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=WO(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return n?(this._selectWordAt(n,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=gy(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-f0),f0),t/=f0,t/Math.abs(t)+Math.round(t*(jU-1)))}shouldForceSelection(e){return Zp?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),YU)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Zp&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let i=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&tthis._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let n=0;t>=n;n++){let r=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:r>1&&t!==n&&(i+=r-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,s=r.lines.get(e[1]);if(!s)return;let a=r.translateBufferLineToString(e[1],!1),o=this._convertViewportColToCharacterIndex(s,e[0]),l=o,c=e[0]-o,u=0,d=0,h=0,f=0;if(a.charAt(o)===" "){for(;o>0&&a.charAt(o-1)===" ";)o--;for(;l1&&(f+=v-1,l+=v-1);y>0&&o>0&&!this._isCharWordSeparator(s.loadCell(y-1,this._workCell));){s.loadCell(y-1,this._workCell);let b=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,y--):b>1&&(h+=b-1,o-=b-1),o--,y--}for(;m1&&(f+=b-1,l+=b-1),l++,m++}}l++;let p=o+c-u+h,_=Math.min(this._bufferService.cols,l-o+u+d-h-f);if(!(!t&&a.slice(o,l).trim()==="")){if(i&&p===0&&s.getCodePoint(0)!==32){let y=r.lines.get(e[1]-1);if(y&&s.isWrapped&&y.getCodePoint(this._bufferService.cols-1)!==32){let m=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(m){let v=this._bufferService.cols-m.start;p-=v,_+=v}}}if(n&&p+_===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let y=r.lines.get(e[1]+1);if(y?.isWrapped&&y.getCodePoint(0)!==32){let m=this._getWordAt([0,e[1]+1],!1,!1,!0);m&&(_+=m.length)}}return{start:p,length:_}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=WO(i,this._bufferService.cols)}};Q0=Ft([oe(3,nn),oe(4,Io),oe(5,cy),oe(6,rn),oe(7,zs),oe(8,Is)],Q0);KO=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},GO=class{constructor(){this._color=new KO,this._css=new KO}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},si=Object.freeze((()=>{let e=[Dt.toColor("#2e3436"),Dt.toColor("#cc0000"),Dt.toColor("#4e9a06"),Dt.toColor("#c4a000"),Dt.toColor("#3465a4"),Dt.toColor("#75507b"),Dt.toColor("#06989a"),Dt.toColor("#d3d7cf"),Dt.toColor("#555753"),Dt.toColor("#ef2929"),Dt.toColor("#8ae234"),Dt.toColor("#fce94f"),Dt.toColor("#729fcf"),Dt.toColor("#ad7fa8"),Dt.toColor("#34e2e2"),Dt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let n=t[i/36%6|0],r=t[i/6%6|0],s=t[i%6];e.push({css:jt.toCss(n,r,s),rgba:jt.toRgba(n,r,s)})}for(let i=0;i<24;i++){let n=8+i*10;e.push({css:jt.toCss(n,n,n),rgba:jt.toRgba(n,n,n)})}return e})()),Ao=Dt.toColor("#ffffff"),fd=Dt.toColor("#000000"),jO=Dt.toColor("#ffffff"),YO=fd,od={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},QU=Ao,J0=class extends Ie{constructor(e){super(),this._optionsService=e,this._contrastCache=new GO,this._halfContrastCache=new GO,this._onChangeColors=this._register(new ee),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ao,background:fd,cursor:jO,cursorAccent:YO,selectionForeground:void 0,selectionBackgroundTransparent:od,selectionBackgroundOpaque:Et.blend(fd,od),selectionInactiveBackgroundTransparent:od,selectionInactiveBackgroundOpaque:Et.blend(fd,od),scrollbarSliderBackground:Et.opacity(Ao,.2),scrollbarSliderHoverBackground:Et.opacity(Ao,.4),scrollbarSliderActiveBackground:Et.opacity(Ao,.5),overviewRulerBorder:Ao,ansi:si.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=lt(e.foreground,Ao),t.background=lt(e.background,fd),t.cursor=Et.blend(t.background,lt(e.cursor,jO)),t.cursorAccent=Et.blend(t.background,lt(e.cursorAccent,YO)),t.selectionBackgroundTransparent=lt(e.selectionBackground,od),t.selectionBackgroundOpaque=Et.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=lt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Et.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?lt(e.selectionForeground,qO):void 0,t.selectionForeground===qO&&(t.selectionForeground=void 0),Et.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Et.opacity(t.selectionBackgroundTransparent,.3)),Et.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Et.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=lt(e.scrollbarSliderBackground,Et.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=lt(e.scrollbarSliderHoverBackground,Et.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=lt(e.scrollbarSliderActiveBackground,Et.opacity(t.foreground,.5)),t.overviewRulerBorder=lt(e.overviewRulerBorder,QU),t.ansi=si.slice(),t.ansi[0]=lt(e.black,si[0]),t.ansi[1]=lt(e.red,si[1]),t.ansi[2]=lt(e.green,si[2]),t.ansi[3]=lt(e.yellow,si[3]),t.ansi[4]=lt(e.blue,si[4]),t.ansi[5]=lt(e.magenta,si[5]),t.ansi[6]=lt(e.cyan,si[6]),t.ansi[7]=lt(e.white,si[7]),t.ansi[8]=lt(e.brightBlack,si[8]),t.ansi[9]=lt(e.brightRed,si[9]),t.ansi[10]=lt(e.brightGreen,si[10]),t.ansi[11]=lt(e.brightYellow,si[11]),t.ansi[12]=lt(e.brightBlue,si[12]),t.ansi[13]=lt(e.brightMagenta,si[13]),t.ansi[14]=lt(e.brightCyan,si[14]),t.ansi[15]=lt(e.brightWhite,si[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let n=0;ns.index-a.index),n=[];for(let s of i){let a=this._services.get(s.id);if(!a)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${s.id._id}.`);n.push(a)}let r=i.length>0?i[0].index:t.length;if(t.length!==r)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...n)}},t8={trace:0,debug:1,info:2,warn:3,error:4,off:5},i8="xterm.js: ",ey=class extends Ie{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),n8=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=t8[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tthis._length)for(let t=this._length;t=e;n--)this._array[this._getCyclicIndex(n+i.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;nthis._maxLength){let n=this._length+i.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let r=t-1;r>=0;r--)this.set(e+r+i,this.get(e+r));let n=e+t+i-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n>22,i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,i){this._data[t*Be+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*Be+0]=t|2097152|i[2]<<22):this._data[t*Be+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*Be+0]>>22}hasWidth(t){return this._data[t*Be+0]&12582912}getFg(t){return this._data[t*Be+1]}getBg(t){return this._data[t*Be+2]}hasContent(t){return this._data[t*Be+0]&4194303}getCodePoint(t){let i=this._data[t*Be+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*Be+0]&2097152}getString(t){let i=this._data[t*Be+0];return i&2097152?this._combined[t]:i&2097151?Da(i&2097151):""}isProtected(t){return this._data[t*Be+2]&536870912}loadCell(t,i){return zp=t*Be,i.content=this._data[zp+0],i.fg=this._data[zp+1],i.bg=this._data[zp+2],i.content&2097152&&(i.combinedData=this._combined[t]),i.bg&268435456&&(i.extended=this._extendedAttrs[t]),i}setCell(t,i){i.content&2097152&&(this._combined[t]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*Be+0]=i.content,this._data[t*Be+1]=i.fg,this._data[t*Be+2]=i.bg}setCellFromCodepoint(t,i,n,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*Be+0]=i|n<<22,this._data[t*Be+1]=r.fg,this._data[t*Be+2]=r.bg}addCodepointToCell(t,i,n){let r=this._data[t*Be+0];r&2097152?this._combined[t]+=Da(i):r&2097151?(this._combined[t]=Da(r&2097151)+Da(i),r&=-2097152,r|=2097152):r=i|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[t*Be+0]=r}insertCells(t,i,n){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),i=0;--s)this.setCell(t+i+s,this.loadCell(t+s,r));for(let s=0;sthis.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let r=new Uint32Array(n);r.set(this._data),this._data=r}for(let r=this.length;r=t&&delete this._combined[o]}let s=Object.keys(this._extendedAttrs);for(let a=0;a=t&&delete this._extendedAttrs[o]}}return this.length=t,n*4*p0=0;--t)if(this._data[t*Be+0]&4194303)return t+(this._data[t*Be+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Be+0]&4194303||this._data[t*Be+2]&50331648)return t+(this._data[t*Be+0]>>22);return 0}copyCellsFrom(t,i,n,r,s){let a=t._data;if(s)for(let l=r-1;l>=0;l--){for(let c=0;c=i&&(this._combined[c-i+n]=t._combined[c])}}translateToString(t,i,n,r){i=i??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let s="";for(;i>22||1}return r&&r.push(i),s}};a2=class o2{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=o2._nextId++,this._onDispose=this.register(new ee),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Do(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};a2._nextId=1;l8=a2,oi={},Mo=oi.B;oi[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"};oi.A={"#":"\xA3"};oi.B=void 0;oi[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"};oi.C=oi[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"};oi.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"};oi.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"};oi.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"};oi.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"};oi.E=oi[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"};oi.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"};oi.H=oi[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"};oi["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"};XO=4294967295,ZO=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Jt.clone(),this.savedCharset=Mo,this.markers=[],this._nullCell=ar.fromCharData([0,bR,1,0]),this._whitespaceCell=ar.fromCharData([0,La,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Qp,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new VO(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Kp),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Kp),this._whitespaceCell}getBlankLine(e,t){return new pd(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&eXO?XO:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Jt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new VO(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(Jt),n=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new pd(e,i)));else for(let a=this._rows;a>t;a--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r0&&(this.lines.trimStart(a),this.ybase=Math.max(this.ybase-a,0),this.ydisp=Math.max(this.ydisp-a,0),this.savedY=Math.max(this.savedY-a,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let s=0;s.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,n=r8(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Jt),i);if(n.length>0){let r=s8(this.lines,n);a8(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let n=this.getNullCell(Jt),r=i;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;a--){let o=this.lines.get(a);if(!o||!o.isWrapped&&o.getTrimmedLength()<=e)continue;let l=[o];for(;o.isWrapped&&a>0;)o=this.lines.get(--a),l.unshift(o);if(!i){let b=this.ybase+this.y;if(b>=a&&b0&&(r.push({start:a+l.length+s,newLines:f}),s+=f.length),l.push(...f);let p=u.length-1,_=u[p];_===0&&(p--,_=u[p]);let y=l.length-d-1,m=c;for(;y>=0;){let b=Math.min(m,_);if(l[p]===void 0)break;if(l[p].copyCellsFrom(l[y],m-b,_-b,b,!0),_-=b,_===0&&(p--,_=u[p]),m-=b,m===0){y--;let w=Math.max(y,0);m=Ed(l,w,this._cols)}}for(let b=0;b0;)this.ybase===0?this.y0){let a=[],o=[];for(let _=0;_=0;_--)if(d&&d.start>c+h){for(let y=d.newLines.length-1;y>=0;y--)this.lines.set(_--,d.newLines[y]);_++,a.push({index:c+1,amount:d.newLines.length}),h+=d.newLines.length,d=r[++u]}else this.lines.set(_,o[c--]);let f=0;for(let _=a.length-1;_>=0;_--)a[_].index+=f,this.lines.onInsertEmitter.fire(a[_]),f+=a[_].amount;let p=Math.max(0,l+s-this.lines.maxLength);p>0&&this.lines.onTrimEmitter.fire(p)}}translateBufferLineToString(e,t,i=0,n){let r=this.lines.get(e);return r?r.translateToString(t,i,n):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+10;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t{t.line-=i,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(i=>{t.line>=i.index&&(t.line+=i.amount)})),t.register(this.lines.onDelete(i=>{t.line>=i.index&&t.linei.index&&(t.line-=i.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},c8=class extends Ie{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ee),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new ZO(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new ZO(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},l2=2,c2=1,ty=class extends Ie{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ee),this.onResize=this._onResize.event,this._onScroll=this._register(new ee),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,l2),this.rows=Math.max(e.rawOptions.rows||0,c2),this.buffers=this._register(new c8(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=this.cols!==e,n=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==e.fg||n.getBg(0)!==e.bg)&&(n=i.getBlankLine(e,t),this._cachedBlankLine=n),n.isWrapped=t;let r=i.ybase+i.scrollTop,s=i.ybase+i.scrollBottom;if(i.scrollTop===0){let a=i.lines.isFull;s===i.lines.length-1?a?i.lines.recycle().copyFrom(n):i.lines.push(n.clone()):i.lines.splice(s+1,0,n.clone()),a?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let a=s-r+1;i.lines.shiftElements(r+1,a-1,-1),i.lines.set(s,n.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let n=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),n!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};ty=Ft([oe(0,rn)],ty);hc={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Zp,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},u8=["normal","bold","100","200","300","400","500","600","700","800","900"],d8=class extends Ie{constructor(e){super(),this._onOptionChange=this._register(new ee),this.onOptionChange=this._onOptionChange.event;let t={...hc};for(let i in e)if(i in t)try{let n=e[i];t[i]=this._sanitizeAndValidateOption(i,n)}catch(n){console.error(n)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Ct(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{e.indexOf(i)!==-1&&t()})}_setupOptions(){let e=i=>{if(!(i in hc))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,n)=>{if(!(i in hc))throw new Error(`No option with key "${i}"`);n=this._sanitizeAndValidateOption(i,n),this.rawOptions[i]!==n&&(this.rawOptions[i]=n,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let n={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,n)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=hc[e]),!h8(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=hc[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=u8.includes(t)?t:hc[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};QO=Object.freeze({insertMode:!1}),JO=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),iy=class extends Ie{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ee),this.onData=this._onData.event,this._onUserInput=this._register(new ee),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ee),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ee),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=md(QO),this.decPrivateModes=md(JO)}reset(){this.modes=md(QO),this.decPrivateModes=md(JO)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(n=>n.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};iy=Ft([oe(0,nn),oe(1,ER),oe(2,rn)],iy);eR={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};g0=String.fromCharCode,tR={DEFAULT:e=>{let t=[m0(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${g0(t[0])}${g0(t[1])}${g0(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${m0(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${m0(e,!0)};${e.x};${e.y}${t}`}},ny=class extends Ie{constructor(e,t,i){super(),this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ee),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(eR))this.addProtocol(n,eR[n]);for(let n of Object.keys(tR))this.addEncoding(n,tR[n]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,i){if(e.deltaY===0||e.shiftKey||t===void 0||i===void 0)return 0;let n=t/i,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=n+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,i){if(i){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};ny=Ft([oe(0,nn),oe(1,Io),oe(2,rn)],ny);_0=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],f8=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];m8=class{constructor(){if(this.version="6",!ai){ai=new Uint8Array(65536),ai.fill(1),ai[0]=0,ai.fill(0,1,32),ai.fill(0,127,160),ai.fill(2,4352,4448),ai[9001]=2,ai[9002]=2,ai.fill(2,11904,42192),ai[12351]=1,ai.fill(2,44032,55204),ai.fill(2,63744,64256),ai.fill(2,65040,65050),ai.fill(2,65072,65136),ai.fill(2,65280,65377),ai.fill(2,65504,65511);for(let e=0;e<_0.length;++e)ai.fill(0,_0[e][0],_0[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ai[e]:p8(e,f8)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),n=i===0&&t!==0;if(n){let r=Oo.extractWidth(t);r===0?n=!1:r>i&&(i=r)}return Oo.createPropertyValue(0,i,n)}},Oo=class Wp{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ee,this.onChange=this._onChange.event;let t=new m8;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,i,n=!1){return(t&16777215)<<3|(i&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let i=0,n=0,r=t.length;for(let s=0;s=r)return i+this.wcwidth(a);let c=t.charCodeAt(s);56320<=c&&c<=57343?a=(a-55296)*1024+c-56320+65536:i+=this.wcwidth(c)}let o=this.charProperties(a,n),l=Wp.extractWidth(o);Wp.extractShouldJoin(o)&&(l-=Wp.extractWidth(n)),i+=l,n=o}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},g8=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};ld=2147483647,_8=256,u2=class ry{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>_8)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new ry;if(!t.length)return i;for(let n=Array.isArray(t[0])?1:0;n>8,r=this._subParamsIdx[i]&255;r-n>0&&t.push(Array.prototype.slice.call(this._subParams,n,r))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>ld?ld:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>ld?ld:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let i=this._subParamsIdx[t]>>8,n=this._subParamsIdx[t]&255;return n-i>0?this._subParams.subarray(i,n):null}getSubParamsAll(){let t={};for(let i=0;i>8,r=this._subParamsIdx[i]&255;r-n>0&&(t[i]=this._subParams.slice(n,r))}return t}addDigit(t){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[i-1];n[i-1]=~r?Math.min(r*10+t,ld):t}},cd=[],v8=class{constructor(){this._state=0,this._active=cd,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let n=i.indexOf(t);n!==-1&&i.splice(n,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=cd}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=cd,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||cd,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,i){if(!this._active.length)this._handlerFb(this._id,"PUT",em(e,t,i));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,i)}start(){this.reset(),this._state=1}put(e,t,i){if(this._state!==3){if(this._state===1)for(;t0&&this._put(e,t,i)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let i=!1,n=this._active.length-1,r=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;n>=0&&(i=this._active[n].end(e),i!==!0);n--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,i;n--}for(;n>=0;n--)if(i=this._active[n].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,i}this._active=cd,this._id=-1,this._state=0}}},Pn=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=em(e,t,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,t}},ud=[],b8=class{constructor(){this._handlers=Object.create(null),this._active=ud,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=ud}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let n=i.indexOf(t);n!==-1&&i.splice(n,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=ud,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||ud,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t)}put(e,t,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",em(e,t,i));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,i)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let i=!1,n=this._active.length-1,r=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;n>=0&&(i=this._active[n].unhook(e),i!==!0);n--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,i;n--}for(;n>=0;n--)if(i=this._active[n].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,i}this._active=ud,this._ident=0}},gd=new u2;gd.addParam(0);nR=class{constructor(e){this._handler=e,this._data="",this._params=gd,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():gd,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=em(e,t,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(i=>(this._params=gd,this._data="",this._hitLimit=!1,i));return this._params=gd,this._data="",this._hitLimit=!1,t}},y8=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,n){this.table[t<<8|e]=i<<4|n}addMany(e,t,i,n){for(let r=0;rl),i=(o,l)=>t.slice(o,l),n=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));let s=i(0,14),a;e.setDefault(1,0),e.addMany(n,0,2,0);for(a in s)e.addMany([24,26,153,154],a,3,0),e.addMany(i(128,144),a,3,0),e.addMany(i(144,152),a,3,0),e.add(156,a,0,0),e.add(27,a,11,1),e.add(157,a,4,8),e.addMany([152,158,159],a,0,7),e.add(155,a,11,3),e.add(144,a,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(sr,0,2,0),e.add(sr,8,5,8),e.add(sr,6,0,6),e.add(sr,11,0,11),e.add(sr,13,13,13),e})(),w8=class extends Ie{constructor(e=S8){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new u2,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,n)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,i)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Ct(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new v8),this._dcsParser=this._register(new b8),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let r=0;rs||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=s}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=n,i}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let i=this._identifier(e,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let n=this._escHandlers[i];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let i=this._identifier(e);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let n=this._csiHandlers[i];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,i,n,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=n,this._parseStack.chunkPos=r}parse(e,t,i){let n=0,r=0,s=0,a;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,s=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let o=this._parseStack.handlers,l=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&l>-1){for(;l>=0&&(a=o[l](this._params),a!==!0);l--)if(a instanceof Promise)return this._parseStack.handlerPos=l,a}this._parseStack.handlers=[];break;case 4:if(i===!1&&l>-1){for(;l>=0&&(a=o[l](),a!==!0);l--)if(a instanceof Promise)return this._parseStack.handlerPos=l,a}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],a=this._dcsParser.unhook(n!==24&&n!==26,i),a)return a;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],a=this._oscParser.end(n!==24&&n!==26,i),a)return a;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let o=s;o>4){case 2:for(let h=o+1;;++h){if(h>=t||(n=e[h])<32||n>126&&n=t||(n=e[h])<32||n>126&&n=t||(n=e[h])<32||n>126&&n=t||(n=e[h])<32||n>126&&n=0&&(a=l[c](this._params),a!==!0);c--)if(a instanceof Promise)return this._preserveStack(3,l,c,r,o),a;c<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++o47&&n<60);o--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let u=this._escHandlers[this._collect<<8|n],d=u?u.length-1:-1;for(;d>=0&&(a=u[d](),a!==!0);d--)if(a instanceof Promise)return this._preserveStack(4,u,d,r,o),a;d<0&&this._escHandlerFb(this._collect<<8|n),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|n,this._params);break;case 13:for(let h=o+1;;++h)if(h>=t||(n=e[h])===24||n===26||n===27||n>127&&n=t||(n=e[h])<32||n>127&&nthis._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,u)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:u.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,u,d)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:u,data:d})}),this._parser.setDcsHandlerFallback((c,u,d)=>{u==="HOOK"&&(d=d.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:u,payload:d})}),this._parser.setPrintHandler((c,u,d)=>this.print(c,u,d)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(W.BEL,()=>this.bell()),this._parser.setExecuteHandler(W.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(W.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(W.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(W.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(W.BS,()=>this.backspace()),this._parser.setExecuteHandler(W.HT,()=>this.tab()),this._parser.setExecuteHandler(W.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(W.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(bd.IND,()=>this.index()),this._parser.setExecuteHandler(bd.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(bd.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Pn(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new Pn(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new Pn(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new Pn(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new Pn(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new Pn(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new Pn(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new Pn(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new Pn(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new Pn(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new Pn(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new Pn(c=>this.restoreCursorColor(c))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let c in oi)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new nR((c,u)=>this.requestStatusString(c,u)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),oR))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${oR} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,n=this._activeBuffer.x,r=this._activeBuffer.y,s=0,a=this._parseStack.paused;if(a){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;n=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Ra&&(s=this._parseStack.position+Ra)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.lengthRa)for(let c=s;c0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let h=this._parser.precedingJoinState;for(let f=t;fo){if(l){let m=d,v=this._activeBuffer.x-y;for(this._activeBuffer.x=y,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),y>0&&d instanceof pd&&d.copyCellsFrom(m,v,0,y,!1);v=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(c&&(d.insertCells(this._activeBuffer.x,r-y,this._activeBuffer.getNullCell(u)),d.getWidth(o-1)===2&&d.setCellFromCodepoint(o-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,n,r,u),r>0)for(;--r;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=h,this._activeBuffer.x0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,i=>aR(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new nR(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Pn(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,i,n=!1,r=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),n&&(s.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let i;switch(e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);i=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+i)?.getTrimmedLength(););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let n=this._activeBuffer.lines.length-this._bufferService.rows;n>0&&(this._activeBuffer.lines.trimStart(n),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-n,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-n,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let l=o;for(let c=1;c0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(W.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(W.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(W.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(W.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(W.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t(_[_.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",_[_.SET=1]="SET",_[_.RESET=2]="RESET",_[_.PERMANENTLY_SET=3]="PERMANENTLY_SET",_[_.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(i||(i={}));let n=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:s}=this._coreMouseService,a=this._coreService,{buffers:o,cols:l}=this._bufferService,{active:c,alt:u}=o,d=this._optionsService.rawOptions,h=(_,y)=>(a.triggerDataEvent(`${W.ESC}[${t?"":"?"}${_};${y}$y`),!0),f=_=>_?1:2,p=e.params[0];return t?p===2?h(p,4):p===4?h(p,f(a.modes.insertMode)):p===12?h(p,3):p===20?h(p,f(d.convertEol)):h(p,0):p===1?h(p,f(n.applicationCursorKeys)):p===3?h(p,d.windowOptions.setWinLines?l===80?2:l===132?1:0:0):p===6?h(p,f(n.origin)):p===7?h(p,f(n.wraparound)):p===8?h(p,3):p===9?h(p,f(r==="X10")):p===12?h(p,f(d.cursorBlink)):p===25?h(p,f(!a.isCursorHidden)):p===45?h(p,f(n.reverseWraparound)):p===66?h(p,f(n.applicationKeypad)):p===67?h(p,4):p===1e3?h(p,f(r==="VT200")):p===1002?h(p,f(r==="DRAG")):p===1003?h(p,f(r==="ANY")):p===1004?h(p,f(n.sendFocus)):p===1005?h(p,4):p===1006?h(p,f(s==="SGR")):p===1015?h(p,4):p===1016?h(p,f(s==="SGR_PIXELS")):p===1048?h(p,1):p===47||p===1047||p===1049?h(p,f(c===u)):p===2004?h(p,f(n.bracketedPasteMode)):p===2026?h(p,f(n.synchronizedOutput)):h(p,0)}_updateAttrColor(e,t,i,n,r){return t===2?(e|=50331648,e&=-16777216,e|=kd.fromColorRGB([i,n,r])):t===5&&(e&=-50331904,e|=33554432|i&255),e}_extractColor(e,t,i){let n=[0,0,-1,0,0,0],r=0,s=0;do{if(n[s+r]=e.params[t+s],e.hasSubParams(t+s)){let a=e.getSubParams(t+s),o=0;do n[1]===5&&(r=1),n[s+o+1+r]=a[o];while(++o=2||n[1]===2&&s+r>=5)break;n[1]&&(r=1)}while(++s+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Jt.fg,e.bg=Jt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,i,n=this._curAttrData;for(let r=0;r=30&&i<=37?(n.fg&=-50331904,n.fg|=16777216|i-30):i>=40&&i<=47?(n.bg&=-50331904,n.bg|=16777216|i-40):i>=90&&i<=97?(n.fg&=-50331904,n.fg|=16777216|i-90|8):i>=100&&i<=107?(n.bg&=-50331904,n.bg|=16777216|i-100|8):i===0?this._processSGR0(n):i===1?n.fg|=134217728:i===3?n.bg|=67108864:i===4?(n.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,n)):i===5?n.fg|=536870912:i===7?n.fg|=67108864:i===8?n.fg|=1073741824:i===9?n.fg|=2147483648:i===2?n.bg|=134217728:i===21?this._processUnderline(2,n):i===22?(n.fg&=-134217729,n.bg&=-134217729):i===23?n.bg&=-67108865:i===24?(n.fg&=-268435457,this._processUnderline(0,n)):i===25?n.fg&=-536870913:i===27?n.fg&=-67108865:i===28?n.fg&=-1073741825:i===29?n.fg&=2147483647:i===39?(n.fg&=-67108864,n.fg|=Jt.fg&16777215):i===49?(n.bg&=-67108864,n.bg|=Jt.bg&16777215):i===38||i===48||i===58?r+=this._extractColor(e,r,n):i===53?n.bg|=1073741824:i===55?n.bg&=-1073741825:i===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):i===100?(n.fg&=-67108864,n.fg|=Jt.fg&16777215,n.bg&=-67108864,n.bg|=Jt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${W.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${W.ESC}[${t};${i}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${W.ESC}[?${t};${i}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Jt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let i=t%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(e){let t=e.params[0]||1,i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!aR(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${W.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>sR&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>sR&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],i=e.split(";");for(;i.length>1;){let n=i.shift(),r=i.shift();if(/^\d+$/.exec(n)){let s=parseInt(n);if(cR(s))if(r==="?")t.push({type:0,index:s});else{let a=rR(r);a&&t.push({type:1,index:s,color:a})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let i=e.slice(0,t).trim(),n=e.slice(t+1);return n?this._createHyperlink(i,n):i.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i=e.split(":"),n,r=i.findIndex(s=>s.startsWith("id="));return r!==-1&&(n=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let i=e.split(";");for(let n=0;n=this._specialColors.length);++n,++t)if(i[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=rR(i[n]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],i=e.split(";");for(let n=0;n=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Jt.clone(),this._eraseAttrDataInternal=Jt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new ar;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t(this._coreService.triggerDataEvent(`${W.ESC}${a}${W.ESC}\\`),!0),n=this._bufferService.buffer,r=this._optionsService.rawOptions;return i(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},sy=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){ethis.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(lR=e,e=t,t=lR),ethis.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};sy=Ft([oe(0,nn)],sy);N8=5e7,uR=12,A8=50,M8=class extends Ie{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new ee),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let i;for(;i=this._writeBuffer.shift();){this._action(i);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>N8)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],r=this._action(n,t);if(r){let a=o=>performance.now()-i>=uR?setTimeout(()=>this._innerWrite(0,o)):this._innerWrite(i,o);r.catch(o=>(queueMicrotask(()=>{throw o}),Promise.resolve(!1))).then(a);return}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-i>=uR)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>A8&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},ay=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let o=t.addMarker(t.ybase+t.y),l={data:e,id:this._nextId++,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(l,o)),this._dataByLinkId.set(l.id,l),l.id}let i=e,n=this._getEntryIdKey(i),r=this._entriesWithId.get(n);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;let s=t.addMarker(t.ybase+t.y),a={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(a,s)),this._entriesWithId.set(a.key,a),this._dataByLinkId.set(a.id,a),a.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every(n=>n.line!==t)){let n=this._bufferService.buffer.addMarker(t);i.lines.push(n),n.onDispose(()=>this._removeMarkerFromLink(i,n))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);i!==-1&&(e.lines.splice(i,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};ay=Ft([oe(0,nn)],ay);dR=!1,O8=class extends Ie{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new pc),this._onBinary=this._register(new ee),this.onBinary=this._onBinary.event,this._onData=this._register(new ee),this.onData=this._onData.event,this._onLineFeed=this._register(new ee),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ee),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ee),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ee),this._instantiationService=new e8,this.optionsService=this._register(new d8(e)),this._instantiationService.setService(rn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(ty)),this._instantiationService.setService(nn,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(ey)),this._instantiationService.setService(ER,this._logService),this.coreService=this._register(this._instantiationService.createInstance(iy)),this._instantiationService.setService(Io,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(ny)),this._instantiationService.setService(xR,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Oo)),this._instantiationService.setService(CP,this.unicodeService),this._charsetService=this._instantiationService.createInstance(g8),this._instantiationService.setService(kP,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(ay),this._instantiationService.setService(kR,this._oscLinkService),this._inputHandler=this._register(new T8(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(bi.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(bi.forward(this._bufferService.onResize,this._onResize)),this._register(bi.forward(this.coreService.onData,this._onData)),this._register(bi.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new M8((t,i)=>this._inputHandler.parse(t,i))),this._register(bi.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ee),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!dR&&(this._logService.warn("writeSync is unreliable and will be removed soon."),dR=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,l2),t=Math.max(t,c2),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(iR.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(iR(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ct(()=>{for(let t of e)t.dispose()})}}},R8={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};Gt=0,L8=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Qp,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Qp,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((r,s)=>this._getKey(r)-this._getKey(s)),t=0,i=0,n=new Array(this._array.length+this._insertedValues.length);for(let r=0;r=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(n[r]=e[t],t++):n[r]=this._array[i++];this._array=n,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Gt=this._search(t),Gt===-1)||this._getKey(this._array[Gt])!==t)return!1;do if(this._array[Gt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Gt),!0;while(++Gtr-s),t=0,i=new Array(this._array.length-e.length),n=0;for(let r=0;r0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Gt=this._search(e),!(Gt<0||Gt>=this._array.length)&&this._getKey(this._array[Gt])===e))do yield this._array[Gt];while(++Gt=this._array.length)&&this._getKey(this._array[Gt])===e))do t(this._array[Gt]);while(++Gt=t;){let n=t+i>>1,r=this._getKey(this._array[n]);if(r>e)i=n-1;else if(r0&&this._getKey(this._array[n-1])===e;)n--;return n}}return t}},b0=0,hR=0,I8=class extends Ie{constructor(){super(),this._decorations=new L8(e=>e?.marker.line),this._onDecorationRegistered=this._register(new ee),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ee),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Ct(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new z8(e);if(t){let i=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),i.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,i){let n=0,r=0;for(let s of this._decorations.getKeyIterator(t))n=s.options.x??0,r=n+(s.options.width??1),e>=n&&e{b0=r.options.x??0,hR=b0+(r.options.width??1),e>=b0&&e=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=n-this._lastRefreshMs,s=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},s)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},fR=20,pR=!1,Jp=class extends Ie{constructor(e,t,i,n){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=n,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let s=0;sthis._handleBoundaryFocus(s,0),this._bottomBoundaryFocusListener=s=>this._handleBoundaryFocus(s,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new P8(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");pR?(this._accessibilityContainer.classList.add("debug"),this._rowContainer.classList.add("debug"),this._debugRootContainer=r.createElement("div"),this._debugRootContainer.classList.add("xterm"),this._debugRootContainer.appendChild(r.createTextNode("------start a11y------")),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(r.createTextNode("------end a11y------")),this._terminal.element.insertAdjacentElement("afterend",this._debugRootContainer)):this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(s=>this._handleResize(s.rows))),this._register(this._terminal.onRender(s=>this._refreshRows(s.start,s.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(s=>this._handleChar(s))),this._register(this._terminal.onLineFeed(()=>this._handleChar(` +`))),this._register(this._terminal.onA11yTab(s=>this._handleTab(s))),this._register(this._terminal.onKey(s=>this._handleKey(s.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Te(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Ct(()=>{pR?this._debugRootContainer.remove():this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===` +`&&(this._liveRegionLineCount++,this._liveRegionLineCount===fR+1&&(this._liveRegion.textContent+=S0.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let i=this._terminal.buffer,n=i.lines.length.toString();for(let r=e;r<=t;r++){let s=i.lines.get(i.ydisp+r),a=[],o=s?.translateToString(!0,void 0,void 0,a)||"",l=(i.ydisp+r+1).toString(),c=this._rowElements[r];c&&(o.length===0?(c.textContent="\xA0",this._rowColumns.set(c,[0,1])):(c.textContent=o,this._rowColumns.set(c,a)),c.setAttribute("aria-posinset",l),c.setAttribute("aria-setsize",n),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,n=this._rowElements[t===0?1:this._rowElements.length-2],r=i.getAttribute("aria-posinset"),s=t===0?"1":`${this._terminal.buffer.lines.length}`;if(r===s||e.relatedTarget!==n)return;let a,o;if(t===0?(a=i,o=this._rowElements.pop(),this._rowContainer.removeChild(o)):(a=this._rowElements.shift(),o=i,this._rowContainer.removeChild(a)),a.removeEventListener("focus",this._topBoundaryFocusListener),o.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let l=this._createAccessibilityTreeNode();this._rowElements.unshift(l),this._rowContainer.insertAdjacentElement("afterbegin",l)}else{let l=this._createAccessibilityTreeNode();this._rowElements.push(l),this._rowContainer.appendChild(l)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let n=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:n,offset:n.textContent?.length??0}),!this._rowContainer.contains(i.node))return;let r=({node:o,offset:l})=>{let c=o instanceof Text?o.parentNode:o,u=parseInt(c?.getAttribute("aria-posinset"),10)-1;if(isNaN(u))return console.warn("row is invalid. Race condition?"),null;let d=this._rowColumns.get(c);if(!d)return console.warn("columns is null. Race condition?"),null;let h=l=this._terminal.cols&&(++u,h=0),{row:u,column:h}},s=r(t),a=r(i);if(!(!s||!a)){if(s.row>a.row||s.row===a.row&&s.column>=a.column)throw new Error("invalid range");this._terminal.select(s.column,s.row,(a.row-s.row)*this._terminal.cols-s.column+a.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;te;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e{Do(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Te(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Te(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Te(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Te(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let i=e.composedPath();for(let n=0;n{n?.forEach(r=>{r.link.dispose&&r.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[n,r]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(n)&&(i=this._checkLinkProviderResult(n,e,i)):r.provideLinks(e.y,s=>{if(this._isMouseOut)return;let a=s?.map(o=>({link:o}));this._activeProviderReplies?.set(n,a),i=this._checkLinkProviderResult(n,e,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let n=0;ne?this._bufferService.cols:a.link.range.end.x;for(let c=o;c<=l;c++){if(i.has(c)){r.splice(s--,1);break}i.add(c)}}}}_checkLinkProviderResult(e,t,i){if(!this._activeProviderReplies)return i;let n=this._activeProviderReplies.get(e),r=!1;for(let s=0;sthis._linkAtPosition(a.link,t));s&&(i=!0,this._handleNewLink(s))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let s=0;sthis._linkAtPosition(o.link,t));if(a){i=!0,this._handleNewLink(a);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&H8(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Do(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:i=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:i=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let n=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(n,r),this._lastMouseEvent)){let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._askForLink(s,!1)}})))}_linkHover(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,n=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-n-1,i.end.x,i.end.y-n-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return i<=r&&r<=n}_positionFromMouseEvent(e,t,i){let n=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,n,r){return{x1:e,y1:t,x2:i,y2:n,cols:this._bufferService.cols,fg:r}}};oy=Ft([oe(1,cy),oe(2,zs),oe(3,nn),oe(4,TR)],oy);U8=class extends O8{constructor(e={}){super(e),this._linkifier=this._register(new pc),this.browser=ZR,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new pc),this._onCursorMove=this._register(new ee),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ee),this.onKey=this._onKey.event,this._onRender=this._register(new ee),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ee),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ee),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ee),this.onBell=this._onBell.event,this._onFocus=this._register(new ee),this._onBlur=this._register(new ee),this._onA11yCharEmitter=this._register(new ee),this._onA11yTabEmitter=this._register(new ee),this._onWillOpen=this._register(new ee),this._setup(),this._decorationService=this._instantiationService.createInstance(I8),this._instantiationService.setService(Cd,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(NU),this._instantiationService.setService(TR,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(x0)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(bi.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(bi.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(bi.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(bi.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Ct(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let i,n="";switch(t.index){case 256:i="foreground",n="10";break;case 257:i="background",n="11";break;case 258:i="cursor",n="12";break;default:i="ansi",n="4;"+t.index}switch(t.type){case 0:let r=Et.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${W.ESC}]${n};${k8(r)}${K0.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=jt.toColor(...t.color));else{let s=i;this._themeService.modifyColors(a=>a[s]=jt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Jp,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let i=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,r=t.getWidth(i),s=this._renderService.dimensions.css.cell.width*r,a=this.buffer.y*this._renderService.dimensions.css.cell.height,o=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=o+"px",this.textarea.style.top=a+"px",this.textarea.style.width=s+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Te(this.element,"copy",t=>{this.hasSelection()&&bP(t,this._selectionService)}));let e=t=>yP(t,this.textarea,this.coreService,this.optionsService);this._register(Te(this.textarea,"paste",e)),this._register(Te(this.element,"paste",e)),QR?this._register(Te(this.element,"mousedown",t=>{t.button===2&&hO(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Te(this.element,"contextmenu",t=>{hO(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),_y&&this._register(Te(this.element,"auxclick",t=>{t.button===1&&vR(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Te(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Te(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Te(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Te(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Te(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Te(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Te(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Te(this.screenElement,"mousemove",r=>this.updateCursorStyle(r))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",y0.get()),t2||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(CU,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Is,this._coreBrowserService),this._register(Te(this.textarea,"focus",r=>this._handleTextAreaFocus(r))),this._register(Te(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(V0,this._document,this._helperContainer),this._instantiationService.setService(tm,this._charSizeService),this._themeService=this._instantiationService.createInstance(J0),this._instantiationService.setService(mc,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Xp),this._instantiationService.setService(CR,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Z0,this.rows,this.screenElement)),this._instantiationService.setService(zs,this._renderService),this._register(this._renderService.onRenderedViewportChange(r=>this._onRender.fire(r))),this.onResize(r=>this._renderService.resize(r.cols,r.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(G0,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(X0),this._instantiationService.setService(cy,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(oy,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance($0,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(r=>{super.scrollLines(r,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Q0,this.element,this.screenElement,n)),this._instantiationService.setService(NP,this._selectionService),this._register(this._selectionService.onRequestScrollLines(r=>this.scrollLines(r.amount,r.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(r=>this._renderService.handleSelectionChanged(r.start,r.end,r.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(r=>{this.textarea.value=r,this.textarea.focus(),this.textarea.select()})),this._register(bi.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(W0,this.screenElement)),this._register(Te(this.element,"mousedown",r=>this._selectionService.handleMouseDown(r))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Jp,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",r=>this._handleScreenReaderModeOptionChange(r))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Vp,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",r=>{!this._overviewRulerRenderer&&r&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Vp,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Y0,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(s){let a=e._mouseService.getMouseReportCoords(s,e.screenElement);if(!a)return!1;let o,l;switch(s.overrideType||s.type){case"mousemove":l=32,s.buttons===void 0?(o=3,s.button!==void 0&&(o=s.button<3?s.button:3)):o=s.buttons&1?0:s.buttons&4?1:s.buttons&2?2:3;break;case"mouseup":l=0,o=s.button<3?s.button:3;break;case"mousedown":l=1,o=s.button<3?s.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(s)===!1)return!1;let c=s.deltaY;if(c===0||e.coreMouseService.consumeWheelEvent(s,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;l=c<0?0:1,o=4;break;default:return!1}return l===void 0||o===void 0||o>4?!1:e.coreMouseService.triggerMouseEvent({col:a.col,row:a.row,x:a.x,y:a.y,button:o,action:l,ctrl:s.ctrlKey,alt:s.altKey,shift:s.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:s=>(i(s),s.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(s)),wheel:s=>(i(s),this.cancel(s,!0)),mousedrag:s=>{s.buttons&&i(s)},mousemove:s=>{s.buttons||i(s)}};this._register(this.coreMouseService.onProtocolChange(s=>{s?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(s)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),s&8?n.mousemove||(t.addEventListener("mousemove",r.mousemove),n.mousemove=r.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),s&16?n.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),n.wheel=r.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),s&2?n.mouseup||(n.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),s&4?n.mousedrag||(n.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Te(t,"mousedown",s=>{if(s.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(s)))return i(s),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(s)})),this._register(Te(t,"wheel",s=>{if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(s)===!1)return!1;if(!this.buffer.hasScrollback){if(s.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(s,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(s,!0);let a=W.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(a,!0),this.cancel(s,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){_R(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,i){this._selectionService.setSelection(e,t,i)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let i=D8(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),i.type===3||i.type===2){let n=this.rows-1;return this.scrollLines(i.type===2?-n:n),this.cancel(e,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((i.key===W.ETX||i.key===W.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let i=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(q8(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new ar)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},mR=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new $8(t)}getNullCell(){return new ar}},W8=class extends Ie{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ee),this.onBufferChange=this._onBufferChange.event,this._normal=new mR(this._core.buffers.normal,"normal"),this._alternate=new mR(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},K8=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,i=>t(i.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(i,n)=>t(i,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},G8=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},j8=["cols","rows"],Jr=0,d2=class extends Ie{constructor(e){super(),this._core=this._register(new U8(e)),this._addonManager=this._register(new F8),this._publicOptions={...this._core.options};let t=n=>this._core.options[n],i=(n,r)=>{this._checkReadonlyOptions(n),this._core.options[n]=r};for(let n in this._core.options){let r={get:t.bind(this,n),set:i.bind(this,n)};Object.defineProperty(this._publicOptions,n,r)}}_checkReadonlyOptions(e){if(j8.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new K8(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new G8(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new W8(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r +`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return y0.get()},set promptLabel(e){y0.set(e)},get tooMuchOutput(){return S0.get()},set tooMuchOutput(e){S0.set(e)}}}_verifyIntegers(...e){for(Jr of e)if(Jr===1/0||isNaN(Jr)||Jr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Jr of e)if(Jr&&(Jr===1/0||isNaN(Jr)||Jr%1!==0||Jr<0))throw new Error("This API only accepts positive integers")}}});var Y8,V8,f2,p2=te(()=>{Y8=2,V8=1,f2=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,i=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(i.getPropertyValue("height")),r=Math.max(0,parseInt(i.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),a={top:parseInt(s.getPropertyValue("padding-top")),bottom:parseInt(s.getPropertyValue("padding-bottom")),right:parseInt(s.getPropertyValue("padding-right")),left:parseInt(s.getPropertyValue("padding-left"))},o=a.top+a.bottom,l=a.right+a.left,c=n-o,u=r-l-t;return{cols:Math.max(Y8,Math.floor(u/e.css.cell.width)),rows:Math.max(V8,Math.floor(c/e.css.cell.height))}}}});var m2=te(()=>{});function X8(){let e=document.documentElement.dataset.theme;return e==="dark"?!0:e==="light"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}function vy(){return X8()?{background:"#0c0c0c",foreground:"#cccccc",cursor:"#cccccc",cursorAccent:"#0c0c0c",selectionBackground:"#264f78",selectionForeground:"#ffffff",black:"#0c0c0c",red:"#f14c4c",green:"#23d18b",yellow:"#f5f543",blue:"#3b8eea",magenta:"#d670d6",cyan:"#29b8db",white:"#cccccc",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#ffffff"}:{background:"#ffffff",foreground:"#1e1e1e",cursor:"#1e1e1e",cursorAccent:"#ffffff",selectionBackground:"#add6ff",selectionForeground:"#1e1e1e",black:"#000000",red:"#cd3131",green:"#00bc00",yellow:"#949800",blue:"#0451a5",magenta:"#bc05bc",cyan:"#0598bc",white:"#555555",brightBlack:"#666666",brightRed:"#cd3131",brightGreen:"#14ce14",brightYellow:"#b5ba00",brightBlue:"#0451a5",brightMagenta:"#bc05bc",brightCyan:"#0598bc",brightWhite:"#a5a5a5"}}var g2=te(()=>{});function _2(){let{projects:e,threads:t}=Ge(),i=he(),n=t.find(y=>y.id===i.currentThreadId)??null,r=n?e.find(y=>y.id===n.projectId):e.find(y=>y.id===i.currentProjectId),s=r?.id??null,[a,o]=(0,Si.useState)([]),[l,c]=(0,Si.useState)(null),[u,d]=(0,Si.useState)(null),h=(0,Si.useCallback)(async()=>{if(!s){o([]);return}try{let y=await Z.call("terminal.list",{projectId:s});o(y),c(m=>m&&y.some(v=>v.id===m)?m:y[0]?.id??null)}catch{}},[s]);(0,Si.useEffect)(()=>{h()},[h]),(0,Si.useEffect)(()=>Z.subscribe("terminals",(m,v)=>{let b=v;b?.type==="terminal.exit"&&(o(w=>w.filter(k=>k.id!==b.id)),c(w=>w===b.id?null:w))}),[]);let f=async()=>{if(s)try{let y=await Z.call("terminal.create",{projectId:s,cols:100,rows:28});await h(),c(y.id)}catch(y){ke(g("terminal.failNew")+Ze(y),!0)}},p=async y=>{try{await Z.call("terminal.kill",{id:y.id}),o(m=>m.filter(v=>v.id!==y.id)),c(m=>m===y.id?null:m)}catch(m){ke(g("terminal.failKill")+Ze(m),!0)}};if(!r)return(0,li.jsx)("div",{className:"pn-empty",children:g("panel.pickProject")});let _=a.find(y=>y.id===l)??null;return(0,li.jsxs)(li.Fragment,{children:[(0,li.jsxs)("div",{className:"tm-tabs",children:[a.map(y=>(0,li.jsxs)("button",{className:`tm-tab${y.id===l?" on":""}`,onClick:()=>c(y.id),title:y.title,children:[y.title,(0,li.jsx)("span",{className:"tm-x",onClick:m=>{m.stopPropagation(),d(y)},children:"\xD7"})]},y.id)),(0,li.jsx)("button",{className:"ibtn",title:g("terminal.new"),onClick:()=>{f()},children:(0,li.jsx)(ne,{name:"plus",size:14})})]}),_?.simple&&(0,li.jsx)("div",{className:"tm-note",children:g("terminal.simpleNote")}),(0,li.jsxs)("div",{className:"tm-body",children:[a.length===0&&(0,li.jsxs)("div",{className:"pn-empty",children:[g("terminal.noTerm"),(0,li.jsx)("div",{style:{marginTop:8},children:(0,li.jsx)("button",{className:"btn primary",onClick:()=>{f()},children:g("terminal.new")})})]}),a.map(y=>(0,li.jsx)(Z8,{term:y,visible:y.id===l},y.id))]}),u&&(0,li.jsx)(jl,{title:g("terminal.closeTitle"),body:_e("terminal.closeBody",{title:u.title}),okLabel:g("terminal.closeOk"),danger:!0,onOk:()=>{p(u)},onClose:()=>d(null)})]})}function Z8({term:e,visible:t}){let i=(0,Si.useRef)(null),n=(0,Si.useRef)(null),r=(0,Si.useRef)(null),[s,a]=(0,Si.useState)(!1);return(0,Si.useEffect)(()=>{let o=i.current;if(!o)return;let l=new d2({fontFamily:'"Cascadia Mono", "Cascadia Code", Consolas, "SF Mono", Menlo, Monaco, "DejaVu Sans Mono", "Ubuntu Mono", "Microsoft YaHei UI", "PingFang SC", "Noto Sans Mono CJK SC", monospace',fontSize:13,lineHeight:1.25,cursorBlink:!0,scrollback:5e3,allowTransparency:!1,theme:vy()}),c=new f2;l.loadAddon(c),l.open(o),n.current=l,r.current=c;try{c.fit()}catch{}let u=new TextDecoder,d=new TextEncoder,h=Z.onBinaryFrame((f,p,_)=>{p!==e.index||f!==1||l.write(u.decode(_))});return l.onData(f=>Z.sendBinary(2,e.index,d.encode(f))),(async()=>{try{let f=await Z.call("terminal.attach",{id:e.id});f.windowsPty&&(l.options.windowsPty=f.windowsPty),f.snapshot&&l.write(f.snapshot),a(!0)}catch{l.writeln(g("terminal.ended"))}})(),()=>{h(),l.dispose(),n.current=null,r.current=null}},[e.id,e.index]),(0,Si.useEffect)(()=>{let o=document.documentElement,l=()=>{let d=n.current;d&&(d.options.theme=vy())},c=new MutationObserver(l);c.observe(o,{attributes:!0,attributeFilter:["data-theme"]});let u=window.matchMedia("(prefers-color-scheme: dark)");return u.addEventListener("change",l),()=>{c.disconnect(),u.removeEventListener("change",l)}},[]),(0,Si.useEffect)(()=>{if(!t)return;let o=r.current,l=n.current;if(!o||!l||!s)return;let c=setTimeout(()=>{try{o.fit();let u=new TextEncoder;Z.sendBinary(3,e.index,u.encode(JSON.stringify({cols:l.cols,rows:l.rows})))}catch{}},50);return()=>clearTimeout(c)},[t,s,e.index]),(0,Si.useEffect)(()=>{let o=i.current;if(!o)return;let l=new ResizeObserver(()=>{let c=r.current,u=n.current;if(!(!c||!u||!t))try{c.fit();let d=new TextEncoder;Z.sendBinary(3,e.index,d.encode(JSON.stringify({cols:u.cols,rows:u.rows})))}catch{}});return l.observe(o),()=>l.disconnect()},[t,e.index]),(0,li.jsx)("div",{className:"tm-view",ref:i,style:{display:t?"block":"none"}})}var Si,li,v2=te(()=>{Si=ie(bt(),1);h2();p2();en();On();qi();Rn();Yl();_r();kt();m2();g2();li=ie(ye(),1)});function b2(){let e=he(),t=Ge(B=>B.threads),i=e.currentThreadId,n=Ec(i),r=ki(B=>B.byThread[n]),s=t.find(B=>B.id===i)??null,a=(0,or.useRef)(null),[o,l]=(0,or.useState)(""),[c,u]=(0,or.useState)(!1),[d,h]=(0,or.useState)(null),f=(0,or.useRef)(null);(0,or.useEffect)(()=>{let B=ki.getState(),q=B.byThread[n];if(q&&q.proxyHref)return;let H=q?.url??s?.previewUrl??null;H&&B.navigate(Ad,n,i,H,{push:!1})},[n,i,s?.previewUrl]);let p=r?.origin,_=!!r?.proxyOrigin;(0,or.useEffect)(()=>{if(!(!p||!_))return()=>{let B=ki.getState(),q=Ec(he.getState().currentThreadId),H=he.getState().panelOpen&&he.getState().panelTab==="preview"&&B.byThread[q]?.origin===p&&q!==n;B.detach(n),H||Z.call("preview.release",{url:p}).catch(()=>{})}},[p,_,n]),(0,or.useEffect)(()=>{c||l(r?Fd(r.url):"")},[r?.url,c]),(0,or.useEffect)(()=>{let B=q=>{let H=a.current?.contentWindow;if(!H||q.source!==H)return;let P=q.data;if(!P||typeof P!="object"||P.ac_preview!==1||typeof P.href!="string")return;let x=ki.getState().byThread[n];if(!x?.proxyOrigin)return;let U=tS(P.href.slice(0,2048),x.proxyOrigin,x.origin),C=ss(U);if(!C.ok||C.target.origin!==x.origin)return;let D=typeof P.title=="string"?P.title.slice(0,200):"";ki.getState().reported(n,C.target.href,D),i&&C.target.href!==x.url&&(f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{Z.call("threads.update",{id:i,previewUrl:C.target.href}).catch(()=>{})},800))};return window.addEventListener("message",B),()=>window.removeEventListener("message",B)},[n,i]);let y=B=>{let q=B.trim();if(!q)return;let H=ss(q);if(!H.ok){h(q);return}h(null),u(!1),ki.getState().navigate(Ad,n,i,H.target.href,{push:!0})},m=B=>{try{a.current?.contentWindow?.postMessage({ac_preview_cmd:B},"*")}catch{}},v=()=>{if(r?.bridged)return m("back");let B=ki.getState().step(n,-1);B&&ki.getState().navigate(Ad,n,i,B,{push:!1})},b=()=>{if(r?.bridged)return m("forward");let B=ki.getState().step(n,1);B&&ki.getState().navigate(Ad,n,i,B,{push:!1})},w=()=>{if(r){if(r.error||!r.proxyHref){ki.getState().navigate(Ad,n,i,r.url,{push:!1});return}r.bridged?m("reload"):ki.getState().reload(n)}},k=!!r&&(r.bridged||r.idx>0),M=!!r&&(r.bridged||r.idxe.setPanelWidth(Math.min(Ou,ws({...he.getState(),panelOpen:!0})));return(0,ct.jsxs)("div",{className:"pv",children:[(0,ct.jsxs)("div",{className:"pv-bar",children:[(0,ct.jsx)("button",{type:"button",className:"ibtn",title:g("preview.back"),"aria-label":g("preview.back"),disabled:!k,onClick:v,children:(0,ct.jsx)(ne,{name:"arrowLeft",size:15})}),(0,ct.jsx)("button",{type:"button",className:"ibtn",title:g("preview.forward"),"aria-label":g("preview.forward"),disabled:!M,onClick:b,children:(0,ct.jsx)(ne,{name:"arrowRight",size:15})}),(0,ct.jsx)("button",{type:"button",className:"ibtn",title:g("preview.reload"),"aria-label":g("preview.reload"),disabled:!r,onClick:w,children:(0,ct.jsx)(ne,{name:"refresh",size:14})}),(0,ct.jsx)("input",{className:`pv-addr${d?" err":""}`,value:o,spellCheck:!1,placeholder:g("preview.placeholder"),"aria-label":g("preview.address"),onFocus:B=>{u(!0),B.currentTarget.select()},onBlur:()=>{u(!1)},onChange:B=>{l(B.target.value),d&&h(null)},onKeyDown:B=>{B.nativeEvent.isComposing||(B.key==="Enter"?(B.preventDefault(),y(o)):B.key==="Escape"&&(u(!1),h(null),l(r?Fd(r.url):""),B.target.blur()))}}),(0,ct.jsx)("button",{type:"button",className:"ibtn",title:g("preview.openExternal"),"aria-label":g("preview.openExternal"),disabled:!T,onClick:()=>T&&void ks(T),children:(0,ct.jsx)(ne,{name:"external",size:14})}),(0,ct.jsx)("button",{type:"button",className:"ibtn",title:g("preview.widen"),"aria-label":g("preview.widen"),onClick:L,children:(0,ct.jsx)(ne,{name:"widen",size:15})})]}),d&&(0,ct.jsxs)("div",{className:"pv-note err",children:[(0,ct.jsx)("span",{children:g("preview.onlyLocal")}),A&&(0,ct.jsx)("button",{type:"button",className:"btn",onClick:()=>{ks(A),h(null)},children:g("preview.openExternal")})]}),r?.error&&(0,ct.jsxs)("div",{className:"pv-note err",children:[(0,ct.jsxs)("span",{children:[g("preview.failed"),Ar(r.error)]}),T&&(0,ct.jsx)("button",{type:"button",className:"btn",onClick:()=>{ks(T)},children:g("preview.openExternal")}),(0,ct.jsx)("button",{type:"button",className:"btn",onClick:w,children:g("common.retry")})]}),r?(0,ct.jsxs)("div",{className:"pv-frame-wrap",children:[r.loading&&(0,ct.jsx)("div",{className:"pv-loading"}),r.proxyHref&&(0,ct.jsx)("iframe",{ref:a,className:"pv-frame",title:r.title||Fd(r.url),src:r.proxyHref,referrerPolicy:"no-referrer"},`${r.proxyOrigin}|${r.nonce}`)]}):(0,ct.jsxs)("div",{className:"pv-empty",children:[(0,ct.jsx)("div",{children:g("preview.empty")}),(0,ct.jsx)("div",{className:"pv-hint",children:g("preview.limits")})]})]})}var or,ct,Ad,y2=te(()=>{or=ie(bt(),1);qi();en();On();$d();Hd();Du();kt();Rn();Hf();ct=ie(ye(),1),Ad=(e,t)=>Z.call(e,t)});function S2(){let e=he(),t=[{tab:"changes",label:g("panel.changes")},{tab:"files",label:g("panel.files")},{tab:"terminal",label:g("panel.terminal")},{tab:"preview",label:g("preview.tab")}];return(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsxs)("div",{className:"pn-head",children:[(0,ae.jsx)("div",{className:"pn-tabs",children:t.map(i=>(0,ae.jsx)("button",{className:`pn-tab${e.panelTab===i.tab?" on":""}`,onClick:()=>e.setPanelTab(i.tab),children:i.label},i.tab))}),(0,ae.jsx)("button",{className:"ibtn pn-close",title:g("panel.closeTitle"),onClick:()=>e.closePanel(),children:(0,ae.jsx)(ne,{name:"x"})})]}),(0,ae.jsxs)("div",{className:"pn-body",children:[e.panelTab==="changes"&&(0,ae.jsx)(t9,{}),e.panelTab==="files"&&(0,ae.jsx)(n9,{}),e.panelTab==="terminal"&&(0,ae.jsx)(_2,{}),e.panelTab==="preview"&&e.panelOpen&&(0,ae.jsx)(b2,{})]})]})}function J8(e){let t=[],i=null;for(let n of e.split(` +`))if(!(n.startsWith("diff ")||n.startsWith("index ")||n.startsWith("--- ")||n.startsWith("+++ "))){if(n.startsWith("@@")){i={head:n,lines:[]},t.push(i);continue}i&&(n.startsWith("+")?i.lines.push({t:"+",text:n.slice(1)}):n.startsWith("-")?i.lines.push({t:"-",text:n.slice(1)}):n.startsWith("\\")?i.lines.push({t:" ",text:n}):i.lines.push({t:" ",text:n.startsWith(" ")?n.slice(1):n}))}return t}function e9(e){let t=0,i=0;for(let n of e.split(` +`))n.startsWith("+")&&!n.startsWith("+++")?t++:n.startsWith("-")&&!n.startsWith("---")&&i++;return{add:t,del:i}}function t9(){let{projects:e,threads:t}=Ge(),i=he(),n=Rt(A=>A.status),[r,s]=(0,Tt.useState)(null),[a,o]=(0,Tt.useState)(!1),[l,c]=(0,Tt.useState)(null),[u,d]=(0,Tt.useState)(null),[h,f]=(0,Tt.useState)(null),[p,_]=(0,Tt.useState)({}),y=(0,Tt.useRef)(n),m=(0,Tt.useRef)(null);m.current=l;let v=t.find(A=>A.id===i.currentThreadId)??null,b=v?e.find(A=>A.id===v.projectId):e.find(A=>A.id===i.currentProjectId),w=b?.id??null,k=(0,Tt.useCallback)(async()=>{if(!w){s(null);return}try{let A=await Z.call("git.status",{projectId:w});s(A);let L=m.current;L&&!A.files?.some(B=>B.path===L)&&(c(null),d(null))}catch(A){s({isRepo:!1,error:String(A?.message??A)})}},[w]);(0,Tt.useEffect)(()=>{k();let A=setInterval(()=>{k()},3e3);return()=>clearInterval(A)},[k]),(0,Tt.useEffect)(()=>{let A=y.current;y.current=n,(A==="running"||A==="initializing")&&n!=="running"&&n!=="initializing"&&k()},[n,k]);let M=(0,Tt.useCallback)(async A=>{if(w){c(A.path),d({loading:!0});try{let L=await Z.call("git.diff",{projectId:w,path:A.path});if(L.tooLarge)d({tooLarge:!0});else if(L.error)d({error:L.error});else{let B=J8(L.diff??"");d({hunks:B}),_(q=>({...q,[A.path]:e9(L.diff??"")}))}}catch(L){d({error:String(L?.message??L)})}}},[w]),T=(0,Tt.useCallback)(async A=>{if(w){o(!0);try{await Z.call("git.discard",{projectId:w,path:A.path}),l===A.path&&(c(null),d(null)),await k()}catch(L){ke(g("panel.failDiscard")+Ze(L),!0)}finally{o(!1)}}},[w,l,k]);return b?r&&!r.isRepo?(0,ae.jsxs)("div",{className:"pn-empty",children:[g("panel.notGit"),r.error&&(0,ae.jsx)("div",{className:"pn-empty-sub",children:r.error})]}):(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsxs)("div",{className:"chg-head",children:[(0,ae.jsxs)("span",{className:"chg-branch",title:g("panel.branch"),children:[(0,ae.jsx)(ne,{name:"changes",size:13})," ",r?.branch??"\u2026"]}),(0,ae.jsx)("button",{className:"ibtn",title:g("common.refresh"),onClick:()=>{k()},children:(0,ae.jsx)(ne,{name:"refresh",size:14})})]}),(0,ae.jsxs)("div",{className:"chg-list",children:[(r?.files??[]).length===0&&(0,ae.jsx)("div",{className:"pn-empty",children:g("panel.clean")}),r?.files?.map(A=>{let L=p[A.path];return(0,ae.jsxs)("div",{className:`chg-row${l===A.path?" on":""}`,onClick:()=>{M(A)},children:[(0,ae.jsx)("span",{className:`chg-kind k-${A.kind}`,title:A.kind,children:Q8(A.kind)}),(0,ae.jsx)("span",{className:"chg-path",title:A.path,children:A.path}),L&&(0,ae.jsxs)("span",{className:"chg-stat",children:[(0,ae.jsxs)("em",{className:"add",children:["+",L.add]})," ",(0,ae.jsxs)("em",{className:"del",children:["\u2212",L.del]})]}),(0,ae.jsx)("button",{className:"ibtn chg-discard",title:g("panel.discardBtn"),disabled:a,onClick:B=>{B.stopPropagation(),f(A)},children:(0,ae.jsx)(ne,{name:"x",size:13})})]},A.path)})]}),(0,ae.jsxs)("div",{className:"chg-diff","data-quote-root":"panel","data-quote-src":l??void 0,children:[u?.loading&&(0,ae.jsx)("div",{className:"pn-empty",children:g("panel.loadingDiff")}),u?.tooLarge&&(0,ae.jsx)("div",{className:"pn-empty",children:g("panel.diffTooLarge")}),u?.error&&(0,ae.jsx)("div",{className:"pn-empty",children:u.error}),u?.hunks&&(0,ae.jsx)(xp,{hunks:u.hunks,path:l??void 0})]}),h&&(0,ae.jsx)(jl,{title:g("panel.discardTitle"),body:h.kind==="untracked"?_e("panel.discardUntracked",{path:h.path}):_e("panel.discardTracked",{path:h.path}),okLabel:g("common.discard"),danger:!0,onOk:()=>{T(h)},onClose:()=>f(null)})]}):(0,ae.jsx)("div",{className:"pn-empty",children:g("panel.pickProject")})}function i9(e){window.dispatchEvent(new CustomEvent("ac-insert-mention",{detail:e}))}function n9(){let{projects:e,threads:t}=Ge(),i=he(),n=t.find(k=>k.id===i.currentThreadId)??null,r=n?e.find(k=>k.id===n.projectId):e.find(k=>k.id===i.currentProjectId),s=r?.id??null,[a,o]=(0,Tt.useState)({}),[l,c]=(0,Tt.useState)(null),[u,d]=(0,Tt.useState)(null),[h,f]=(0,Tt.useState)(null),p=(0,Tt.useCallback)(async k=>{if(s){o(M=>({...M,[k]:"loading"}));try{let M=await Z.call("files.tree",{projectId:s,dir:k});o(T=>({...T,[k]:M.error?`err:${M.error}`:M.entries??[]}))}catch(M){o(T=>({...T,[k]:`err:${String(M?.message??M)}`}))}}},[s]);(0,Tt.useEffect)(()=>{o({}),c(null),d(null),s&&p(".")},[s,p]);let _=k=>{if(!k.isDir){y(k.path);return}let M=a[k.path];M&&M!=="loading"?o(T=>{let A={...T};return delete A[k.path],A}):M||p(k.path)},y=async k=>{if(s){c(k),d({loading:!0});try{let M=await Z.call("files.read",{projectId:s,path:k});d(M)}catch(M){d({error:String(M?.message??M)})}}},m=(0,Tt.useRef)(null);if((0,Tt.useEffect)(()=>{let k=m.current;if(!(!k||!u?.text))try{Jl.highlightElement(k)}catch{}},[u?.text,u?.language]),!r)return(0,ae.jsx)("div",{className:"pn-empty",children:g("panel.pickProject")});let v=l?l.split("/"):[],b=(k,M)=>{let T=a[k];return!T||T==="loading"?null:typeof T=="string"?(0,ae.jsx)("div",{className:"ft-err",style:{paddingLeft:8+M*14},children:T.slice(4)}):T.map(A=>(0,ae.jsxs)("div",{children:[(0,ae.jsxs)("div",{className:`ft-row${l===A.path?" on":""}`,style:{paddingLeft:8+M*14},onClick:()=>_(A),title:A.path,draggable:!0,onDragStart:L=>{L.dataTransfer.effectAllowed="copy",L.dataTransfer.setData(uc,JSON.stringify({projectId:r.id,rel:A.path,isDir:A.isDir})),L.dataTransfer.setData("text/plain",dc(r.path,A.path))},onContextMenu:L=>{L.preventDefault(),f({x:L.clientX,y:L.clientY,entry:A})},children:[A.isDir?(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)("span",{className:`caret${a[A.path]&&a[A.path]!=="loading"?" open":""}`,children:"\u203A"}),(0,ae.jsx)(ne,{name:"files",size:13})]}):(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)("span",{className:"caret",style:{visibility:"hidden"},children:"\u203A"}),(0,ae.jsx)("span",{className:"ft-dot"})]}),(0,ae.jsx)("span",{className:"ft-name",children:A.name})]}),A.isDir&&b(A.path,M+1)]},A.path))},w=h?[{kind:"item",label:g("mention.add"),onClick:()=>i9({projectId:r.id,rel:h.entry.path,isDir:h.entry.isDir})},{kind:"sep"},{kind:"item",label:g("common.copyPath"),onClick:()=>{vr(dc(r.path,h.entry.path)),ke(g("common.copiedPath"))}},{kind:"item",label:g("mention.copyRel"),onClick:()=>{vr(h.entry.path),ke(g("common.copiedPath"))}}]:[];return(0,ae.jsxs)(ae.Fragment,{children:[h&&(0,ae.jsx)(ho,{x:h.x,y:h.y,items:w,onClose:()=>f(null)}),(0,ae.jsx)("div",{className:"ft-crumbs",children:l?(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)("button",{className:"ft-crumb",onClick:()=>c(null),title:g("panel.closePreview"),children:"\xD7"}),v.map((k,M)=>(0,ae.jsxs)("span",{className:"ft-crumb-t",children:[M>0?"/":"",k]},M)),(0,ae.jsx)("button",{className:"ibtn",title:g("common.copyPath"),onClick:()=>{vr(l),ke(g("common.copiedPath"))},children:(0,ae.jsx)(ne,{name:"copy",size:13})})]}):(0,ae.jsx)("span",{className:"ft-crumb-t muted",children:r.name})}),(0,ae.jsx)("div",{className:"ft-tree",children:b(".",0)}),l&&(0,ae.jsxs)("div",{className:"ft-view","data-quote-root":"panel","data-quote-src":l,children:[u?.loading&&(0,ae.jsx)("div",{className:"pn-empty",children:g("panel.reading")}),u?.binary&&(0,ae.jsx)("div",{className:"pn-empty",children:g("panel.binary")}),u?.tooLarge&&(0,ae.jsx)("div",{className:"pn-empty",children:g("panel.tooLarge")}),u?.error&&(0,ae.jsx)("div",{className:"pn-empty",children:u.error}),u?.text!=null&&(0,ae.jsx)("pre",{className:"ft-pre",children:(0,ae.jsx)("code",{ref:m,className:`language-${u.language??"plaintext"}`,children:u.text})})]})]})}var Tt,ae,Q8,w2=te(()=>{Tt=ie(bt(),1);en();On();Co();qi();Rn();ed();Yl();_r();kt();v2();y2();$f();kp();Lu();tb();ae=ie(ye(),1);Q8=e=>g(`panel.gitKind.${e}`)});function x2(){let{state:e,version:t}=Gr(),i=Rt(d=>d.pending.length),n=Rt(d=>d.pending[0]?.key),r=Rt(d=>d.pending.length>0?d.threadId:null),s=(0,zo.useMemo)(()=>r?new Set([r]):r9,[r]),a=Ge(d=>d.providers),[o,l]=(0,zo.useState)(!1),[c,u]=(0,zo.useState)(!1);return(0,zo.useEffect)(()=>{let d=f=>{(f.ctrlKey||f.metaKey)&&f.key.toLowerCase()==="k"&&(f.preventDefault(),l(p=>!p))},h=()=>u(!0);return window.addEventListener("keydown",d),window.addEventListener("open-settings",h),()=>{window.removeEventListener("keydown",d),window.removeEventListener("open-settings",h)}},[]),e==="down"?(0,wi.jsx)("div",{className:"boot-screen",children:(0,wi.jsxs)("div",{className:"boot-wrap",children:[(0,wi.jsx)("span",{children:g("boot.serviceDown")}),(0,wi.jsx)("button",{className:"btn primary",onClick:()=>{If()?zf():Lf()||location.reload()},children:g("boot.retry")})]})}):e==="connecting"&&!t?(0,wi.jsxs)("div",{className:"boot-screen",children:[(0,wi.jsx)("div",{className:"boot-dot","data-state":e}),(0,wi.jsx)("span",{className:"boot-label",children:g("boot.connecting")})]}):(0,wi.jsxs)(Fk,{sidebar:(0,wi.jsx)(Qk,{pendingByThread:s}),topbar:(0,wi.jsx)(pA,{pendingCount:i,pendingKey:n}),panel:(0,wi.jsx)(S2,{}),children:[e==="reconnecting"&&(0,wi.jsx)("div",{className:"connbar",children:g("boot.reconnecting")}),(0,wi.jsx)(sO,{}),o&&(0,wi.jsx)(lO,{onClose:()=>l(!1)}),c&&(0,wi.jsx)(HM,{onClose:()=>u(!1),providers:a}),(0,wi.jsx)(Xk,{})]})}var zo,wi,r9,E2=te(()=>{Mu();$k();Fv();mA();aO();Co();On();zo=ie(bt(),1);cO();w2();Mp();_r();kt();Lv();wi=ie(ye(),1),r9=new Set});function k2(){let{state:e,version:t}=Gr(),[i,n]=(0,Gi.useState)([]),[r,s]=(0,Gi.useState)([]),[a,o]=(0,Gi.useState)(""),[l,c]=(0,Gi.useState)(""),[u,d]=(0,Gi.useState)([]),[h,f]=(0,Gi.useState)([]),[p,_]=(0,Gi.useState)([]),[y,m]=(0,Gi.useState)(""),[v,b]=(0,Gi.useState)(""),w=(0,Gi.useRef)(null);(0,Gi.useEffect)(()=>{e==="open"&&(za("projects.list").then(L=>n(L??[])),za("threads.list").then(L=>s(L??[])))},[e]),(0,Gi.useEffect)(()=>{if(w.current?.(),w.current=null,d([]),f([]),_([]),!(!l||e!=="open"))return za("threads.get",{id:l}).then(L=>{let B=L;d(B.events??[]),f(B.pending??[]),_(B.queue??[])}),w.current=Z.subscribe(`thread:${l}`,(L,B)=>{let q=B;if(q.type==="event"&&q.event&&(d(H=>[...H,q.event]),q.event.type==="permission_resolved"||q.event.type==="question_answered")){let H=q.event.requestId;f(P=>P.filter(x=>x.requestId!==H))}q.type==="queue"&&q.queue&&_(q.queue)}),()=>w.current?.()},[l,e]),(0,Gi.useEffect)(()=>{let L=u.filter(H=>H.type==="permission_request"||H.type==="question"),B=new Set(u.filter(H=>H.type==="permission_resolved"||H.type==="question_answered").map(H=>H.requestId)),q=L.filter(H=>!B.has(H.requestId)).map(H=>({requestId:H.requestId??"",kind:H.type==="question"?"question":"permission",options:H.options}));f(H=>{let P=new Map(H.map(x=>[x.requestId,x]));for(let x of q)P.set(x.requestId,x);return[...P.values()]})},[u]);let k=async()=>{if(!l)return;let L=await za("threads.get",{id:l}).catch(()=>null);L&&(d(L.events??[]),f(B=>{let q=new Map(B.map(H=>[H.requestId,H]));for(let H of L.pending??[])q.set(H.requestId,H);return[...q.values()]}),_(L.queue??[]))},M=async L=>{if(b(""),!l||!y.trim())return;let B=y;m("");try{await za("thread.send",{id:l,text:B,behavior:L})}catch(q){b(String(q?.message??q))}await k()},T=async(L,B,q)=>{await za("thread.respond",{id:l,requestId:L,optionId:B,answers:q}).catch(H=>b(String(H?.message??H))),setTimeout(()=>{k()},1500)},A=async()=>{if(!a)return;let L=await za("threads.create",{projectId:a,provider:"mock"}).catch(B=>(b(String(B?.message??B)),null));L&&(s(B=>[L,...B]),c(L.id))};return(0,Nt.jsxs)("div",{style:{display:"flex",height:"100vh",font:"13px/1.5 system-ui",color:"var(--fg)"},children:[(0,Nt.jsxs)("div",{style:{width:260,borderRight:"1px solid var(--border)",padding:12,overflowY:"auto"},children:[(0,Nt.jsx)("div",{style:{marginBottom:8},children:e==="open"?`\u5DF2\u8FDE\u63A5 \xB7 ${t??""}`:"\u8FDE\u63A5\u4E2D\u2026"}),(0,Nt.jsx)(gn,{className:"tinput sm-field",matchWidth:!0,ariaLabel:"\u9009\u62E9\u9879\u76EE",value:a,onChange:o,options:[{value:"",label:"\u9009\u62E9\u9879\u76EE"},...i.map(L=>({value:L.id,label:L.name}))]}),(0,Nt.jsx)("button",{onClick:()=>{A()},disabled:!a,style:{width:"100%",marginTop:8},children:"\u65B0\u5EFA\u5BF9\u8BDD\uFF08mock\uFF09"}),(0,Nt.jsx)("div",{style:{marginTop:12},children:r.filter(L=>!a||L.projectId===a).map(L=>(0,Nt.jsxs)("div",{onClick:()=>c(L.id),style:{padding:"6px 8px",cursor:"pointer",borderRadius:4,background:L.id===l?"var(--bg-active, #333)":"transparent"},children:[L.title," ",(0,Nt.jsxs)("span",{style:{opacity:.6},children:["(",L.status,")"]})]},L.id))})]}),(0,Nt.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:[(0,Nt.jsxs)("div",{style:{flex:1,overflowY:"auto",padding:12},children:[u.map((L,B)=>(0,Nt.jsx)("pre",{style:{margin:"4px 0",fontSize:11,whiteSpace:"pre-wrap",borderBottom:"1px solid var(--border)",paddingBottom:4},children:(L.seq??"")+" "+(L.type??"?")+" "+JSON.stringify(L).slice(0,400)},B)),h.map(L=>(0,Nt.jsxs)("div",{style:{border:"1px solid var(--warn, orange)",borderRadius:6,padding:8,margin:"8px 0"},children:[(0,Nt.jsxs)("div",{children:["\u6388\u6743/\u63D0\u95EE ",L.requestId]}),L.options?.map(B=>(0,Nt.jsx)("button",{onClick:()=>{T(L.requestId,B.id)},style:{marginRight:8},children:B.label},B.id)),L.kind==="question"&&(0,Nt.jsx)("button",{onClick:()=>{T(L.requestId,void 0,{q1:"staging",q2:""})},children:"\u586B\u8868\u63D0\u4EA4"}),(0,Nt.jsx)("button",{onClick:()=>{T(L.requestId,void 0,void 0)},children:"\u53D6\u6D88"})]},L.requestId))]}),p.length>0&&(0,Nt.jsxs)("div",{style:{padding:"4px 12px",opacity:.7},children:["\u6392\u961F\u4E2D\uFF1A",p.length," \u6761"]}),v&&(0,Nt.jsx)("div",{style:{padding:"4px 12px",color:"var(--danger, red)"},children:v}),(0,Nt.jsxs)("div",{style:{display:"flex",gap:8,padding:12,borderTop:"1px solid var(--border)"},children:[(0,Nt.jsx)("input",{value:y,onChange:L=>m(L.target.value),onKeyDown:L=>{L.key==="Enter"&&M()},placeholder:"/perm /plan /slow /exit \u2026",style:{flex:1}}),(0,Nt.jsx)("button",{onClick:()=>{M()},children:"\u53D1\u9001"}),(0,Nt.jsx)("button",{onClick:()=>{M("steer")},children:"\u63D2\u8BDD"}),(0,Nt.jsx)("button",{onClick:()=>{za("thread.interrupt",{id:l})},children:"\u6253\u65AD"})]})]})]})}var Gi,Nt,za,C2=te(()=>{Gi=ie(bt(),1);Mu();qi();Tp();Nt=ie(ye(),1),za=(e,t)=>Z.call(e,t)});function O2(){T2++,o9.render(a9?(0,by.jsx)(k2,{}):(0,by.jsx)(x2,{},`${Fs()}-${T2}`))}var N2,by,s9,A2,Z,M2,a9,o9,T2,qi=te(()=>{$d();lS();cS();uS();dS();hS();N2=ie(vk(),1);Nv();Tu();Nk();Dv();Lv();kt();Rk();Mu();en();On();E2();C2();vp();by=ie(ye(),1),s9=cc(),A2=new URLSearchParams(location.search);rS(location.search);bk(location.search);Sk(location.search);Z=new Bf(s9,Fs());Tk(e=>{!e.lang||!sS(e.lang)||(Z.setLang(Fs()),Z.call("app.setLocale",{lang:Fs()}).catch(()=>{}),O2())});window.__ws=Z;window.__stores={useData:Ge,useUi:he,useConnection:Gr,usePreview:ki};Promise.resolve().then(()=>(Co(),GA)).then(e=>{window.__tl=e.useTimeline});Z.onState(e=>Gr.getState().set({state:e}));M2=If();Mk(Z,()=>{M2?zf():Lf()||Ak(Fs().startsWith("zh")?"\u672C\u5730\u670D\u52A1\u5DF2\u65AD\u5F00":"Local service disconnected")});M2&&(Ok(Z),Z.onState(e=>{if(e==="open")try{window.parent.postMessage({ac_console:"alive"},"*")}catch{}}));Z.connect();Z.waitHello().then(async e=>{Gr.getState().set({version:e.version??null}),he.getState().bind(Z);try{let t=await Z.call("settings.get");he.getState().hydrate(t),Kr(t.theme),Nu(t)}catch{}await Ge.getState().bind(Z)});setInterval(()=>Z.ping(),1e4);a9=A2.get("debug")==="1",o9=(0,N2.createRoot)(document.getElementById("root")),T2=0;O2();A2.get("audit")==="1"&&setTimeout(()=>{try{let e=window.innerWidth,t=document.documentElement.scrollWidth,i=new Set,n=[],r=0,s=getComputedStyle(document.documentElement).getPropertyValue("--accent").trim(),a=c=>c.top0&&c.width>0;document.querySelectorAll("*").forEach(c=>{let u=c,d=getComputedStyle(u),h=u.getBoundingClientRect();if(!a(h)||d.display==="none"||d.visibility==="hidden"||h.width<3||h.height<3)return;i.add(d.fontSize),d.borderTopWidth!=="0px"&&d.borderTopStyle!=="none"&&r++,d.borderBottomWidth!=="0px"&&d.borderBottomStyle!=="none"&&r++;let f=d.backgroundColor,p=d.color;if(s&&(f===s||p===s)){let _=(u.getAttribute("class")??"").split(" ")[0];n.includes(_)||n.push(_)}});let o={vw:e,docW:t,noHScroll:t<=e+1,fontSizes:[...i].sort(),bordersFirstScreen:r,accentEls:n},l=document.createElement("pre");l.id="audit",l.style.display="none",l.textContent=JSON.stringify(o),document.body.appendChild(l)}catch(e){let t=document.createElement("pre");t.id="audit",t.textContent=JSON.stringify({error:String(e)}),document.body.appendChild(t)}},1500)});qi();})(); /*! Bundled license information: react/cjs/react.production.js: diff --git a/packages/agent-console/daemon/dist/main.js b/packages/agent-console/daemon/dist/main.js index 86dfa00..e1a001b 100644 --- a/packages/agent-console/daemon/dist/main.js +++ b/packages/agent-console/daemon/dist/main.js @@ -834,6 +834,26 @@ async function scriptBigReply(ctx) { } emit({ type: "assistant_message", itemId: "B1", text: acc }); } +async function scriptCodeStream(ctx) { + const { emit } = ctx; + let acc = ""; + const put = (p) => { + acc += p; + emit({ type: "assistant_delta", itemId: "C1", text: p }); + }; + put("\u5148\u770B\u7B2C\u4E00\u6BB5\u4EE3\u7801\uFF1A\n\n```ts\n"); + for (let b = 1; b <= 2; b++) { + if (b === 2) put("```\n\n\u7136\u540E\u662F\u7B2C\u4E8C\u6BB5\uFF1A\n\n```ts\n"); + for (let k = 0; k < 22; k++) { + if (ctx.interrupted()) return; + put(`const block${b}_line${k} = computeSomethingRatherLong(${b}, ${k}, "a fairly long string literal so wrapping matters ${"x".repeat(60)}"); +`); + await sleep(120); + } + } + put("```\n\n\u5B8C\u6BD5\u3002"); + emit({ type: "assistant_message", itemId: "C1", text: acc }); +} async function scriptExit(_ctx) { await sleep(300); throw new MockCrash(); @@ -849,6 +869,7 @@ function pickScript(text) { if (t.startsWith("/long")) return scriptLong; if (t.startsWith("/exit")) return scriptExit; if (t.startsWith("/bigreply")) return scriptBigReply; + if (t.startsWith("/codestream")) return scriptCodeStream; if (t.startsWith("/serve")) return scriptServe; if (t.startsWith("/tools")) return scriptTools; if (t.startsWith("/bashhint")) return scriptBashHint; diff --git a/packages/agent-console/daemon/dist/main.js.map b/packages/agent-console/daemon/dist/main.js.map index c23e32d..5a5ce17 100644 --- a/packages/agent-console/daemon/dist/main.js.map +++ b/packages/agent-console/daemon/dist/main.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/log.ts","../src/security.ts","../src/util/i18n.ts","../src/util/paths.ts","../src/util/queue.ts","../src/agents/diff.ts","../src/providers/slash.ts","../src/providers/mock.ts","../../lib/pathscan.mjs","../src/util/gitBash.ts","../src/util/agentShell.ts","../src/util/bin.ts","../src/agents/kinds.ts","../src/providers/claude/map.ts","../src/util/attachmentRefs.ts","../src/util/attachmentKinds.ts","../src/providers/claude/content.ts","../src/providers/launch.ts","../src/util/decode.ts","../src/providers/claude/cli.ts","../src/providers/claude/session.ts","../src/providers/claude/models.ts","../src/history/import.ts","../src/providers/claude/provider.ts","../src/history/codex.ts","../src/providers/codex/rpc.ts","../src/providers/codex/input.ts","../src/providers/codex/map.ts","../src/providers/codex/commands.ts","../src/providers/codex/session.ts","../src/providers/types.ts","../src/providers/codex/provider.ts","../src/providers/catalog.ts","../src/providers/acp/spawn.ts","../src/providers/acp/clientHandlers.ts","../src/providers/acp/mapUpdate.ts","../src/providers/acp/promptCaps.ts","../src/providers/acp/sessionCaps.ts","../src/providers/acp/prompt.ts","../src/providers/acp/session.ts","../src/providers/acp/provider.ts","../src/providers/acp/dsh.ts","../src/providers/acp/probe.ts","../src/providers/acp/specs.ts","../src/providers/magpieGateway.ts","../src/providers/infoCache.ts","../src/providers/registry.ts","../src/providers/enabled.ts","../src/util/pickFolderWin.ts","../src/util/pickFolder.ts","../src/providers/modes.ts","../src/providers/autoApprove.ts","../src/migrate/autoApprove13.ts","../src/util/mentions.ts","../src/preview/url.ts","../src/util/openExternal.ts","../src/preview/inject.ts","../src/preview/proxy.ts","../src/preview/host.ts","../src/ws/methods.ts","../src/util/atomic.ts","../src/store/settings.ts","../src/util/jsonl.ts","../src/migrate/legacy.ts","../src/providers/warm.ts","../src/main.ts","../src/config.ts","../src/util/buildStamp.ts","../src/http.ts","../src/store/attachments.ts","../src/store/projects.ts","../src/store/threads.ts","../src/ws/gateway.ts","../src/agents/manager.ts","../src/timeline/coalescer.ts","../src/git/service.ts","../src/files/service.ts","../src/terminal/service.ts","../src/util/proc.ts","../src/preview/ports.ts"],"sourcesContent":["// Simple logging: writes dataDir/logs/daemon-YYYY-MM-DD.log (kept 7 days) and to the console.\nimport { appendFileSync, mkdirSync, readdirSync, rmSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nlet logDir = \"\";\nlet today = \"\";\nlet logFile = \"\";\n\nfunction fileName(d: Date): string {\n const p = (n: number) => String(n).padStart(2, \"0\");\n return `daemon-${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())}.log`;\n}\n\nexport function initLog(dataDir: string): void {\n logDir = join(dataDir, \"logs\");\n mkdirSync(logDir, { recursive: true });\n // Keep 7 days\n try {\n const keep = new Set();\n const now = new Date();\n for (let i = 0; i < 7; i++) {\n keep.add(fileName(new Date(now.getTime() - i * 86400000)));\n }\n for (const f of readdirSync(logDir)) {\n if (/^daemon-\\d{4}-\\d{2}-\\d{2}\\.log$/.test(f) && !keep.has(f)) {\n rmSync(join(logDir, f), { force: true });\n }\n }\n } catch {}\n}\n\n// The console is a pipe to the plugin host. When the host is killed hard, the reader is gone and a write fails with EPIPE\n// (asynchronously, as an 'error' event on the stream): without a listener that becomes an uncaughtException. Once that happens\n// the console is dropped and only the log file is written.\nlet consoleGone = false;\nlet guarded = false;\nfunction guardConsole(): void {\n if (guarded) return;\n guarded = true;\n for (const stream of [process.stdout, process.stderr]) {\n // EPIPE, EIO, ERR_STREAM_DESTROYED…: any write error means the reader is gone; logging must never take the daemon down\n stream?.on?.(\"error\", () => { consoleGone = true; });\n }\n}\nexport function consoleClosed(): boolean {\n return consoleGone;\n}\n\nexport function log(level: \"info\" | \"warn\" | \"error\", msg: string, extra?: unknown): void {\n const line = `[${new Date().toISOString()}] [${level}] ${msg}${extra !== undefined ? \" \" + safeJson(extra) : \"\"}`;\n try {\n const d = new Date();\n const name = fileName(d);\n if (name !== today && logDir) {\n today = name;\n logFile = join(logDir, name);\n }\n if (logFile) appendFileSync(logFile, line + \"\\n\", \"utf8\");\n } catch {}\n guardConsole();\n if (consoleGone) return;\n const stream = level === \"info\" ? process.stdout : process.stderr;\n if (stream?.destroyed || stream?.writableEnded) { consoleGone = true; return; }\n const fn = level === \"error\" ? console.error : level === \"warn\" ? console.warn : console.log;\n try {\n fn(`[agent-console] ${msg}`, extra !== undefined ? extra : \"\");\n } catch {\n consoleGone = true;\n }\n}\n\nfunction safeJson(v: unknown): string {\n try {\n return JSON.stringify(v);\n } catch {\n return String(v);\n }\n}\n","// Host / Origin / token checks (timingSafeEqual).\n//\n// Security model (after the PR #535 review):\n// - Host is checked on every HTTP request and WS upgrade and must be 127.0.0.1: or localhost:,\n// to block DNS rebinding (requests from a rebound page carry no Origin, so only Host identifies them).\n// - Origin: null (opaque origin) is not trusted. Any website can send Origin: null from a sandboxed iframe, a data: or a file: page,\n// so null by itself means nothing. The token is the only authorization:\n// * token routes (/api/*, /attachments/*, WS hello) let a null origin \"present\" the token,\n// because Magpie's plugin page is a sandbox=\"allow-scripts\" iframe and can only request as null;\n// * static routes (/, app.js etc.) always 403 for null and send no CORS headers.\n// - Any other website's Origin is refused, even with the correct token.\nimport { timingSafeEqual, createHash } from \"node:crypto\";\n\nexport type CheckResult = { ok: true } | { ok: false; code: number; message: string };\n\n// none: no Origin (ordinary navigation, `;\n const head = /]*)?>/i.exec(html);\n if (head) return html.slice(0, head.index + head[0].length) + tag + html.slice(head.index + head[0].length);\n const root = /]*)?>/i.exec(html);\n if (root) return html.slice(0, root.index + root[0].length) + tag + html.slice(root.index + root[0].length);\n const doctype = /^\\s*]*>/i.exec(html);\n if (doctype) return html.slice(0, doctype[0].length) + tag + html.slice(doctype[0].length);\n return tag + html;\n}\n","// Preview proxy (1.2): a local-only reverse proxy, one 127.0.0.1: listener per loopback target origin.\n//\n// Why: Magpie's page frame is sandbox=\"allow-scripts\" and the sandbox is inherited by every child frame, so a plain\n//