From e2ebfd9806371aae9d3d3db682f02c722b9d1cc8 Mon Sep 17 00:00:00 2001 From: lawrencecchen <54008264+lawrencecchen@users.noreply.github.com> Date: Tue, 9 Jun 2026 15:41:06 -0700 Subject: [PATCH 01/28] Agent conversation protocol: canonical contract (TS source of truth, Go mirror, design doc) Co-Authored-By: Claude Fable 5 --- daemon/remote/agentconv/protocol.go | 103 ++++++++++++++++++++ docs/agent-conversation-protocol.md | 43 +++++++++ webviews/src/agent-chat/protocol.ts | 140 ++++++++++++++++++++++++++++ 3 files changed, 286 insertions(+) create mode 100644 daemon/remote/agentconv/protocol.go create mode 100644 docs/agent-conversation-protocol.md create mode 100644 webviews/src/agent-chat/protocol.ts diff --git a/daemon/remote/agentconv/protocol.go b/daemon/remote/agentconv/protocol.go new file mode 100644 index 000000000000..e49b23a9b329 --- /dev/null +++ b/daemon/remote/agentconv/protocol.go @@ -0,0 +1,103 @@ +// Package agentconv normalizes coding-agent session transcripts read from the +// filesystem into a canonical conversation event stream. +// +// The wire shapes mirror webviews/src/agent-chat/protocol.ts (the source of +// truth); keep both in sync with the golden fixtures under testdata/. +package agentconv + +// ProviderID identifies a coding agent. Open vocabulary: parse unknown +// providers without failing. +type ProviderID string + +const ( + ProviderClaude ProviderID = "claude" + ProviderCodex ProviderID = "codex" +) + +// SessionRef identifies one agent session backed by a transcript file. +type SessionRef struct { + Provider ProviderID `json:"provider"` + SessionID string `json:"session_id"` + TranscriptPath string `json:"transcript_path"` + Cwd string `json:"cwd,omitempty"` + Title string `json:"title,omitempty"` + UpdatedAt string `json:"updated_at,omitempty"` +} + +// ItemType classifies a conversation item. +type ItemType string + +const ( + ItemUserMessage ItemType = "user_message" + ItemAssistantMessage ItemType = "assistant_message" + ItemReasoning ItemType = "reasoning" + ItemPlan ItemType = "plan" + ItemCommandExecution ItemType = "command_execution" + ItemFileChange ItemType = "file_change" + ItemMCPToolCall ItemType = "mcp_tool_call" + ItemDynamicToolCall ItemType = "dynamic_tool_call" + ItemWebSearch ItemType = "web_search" + ItemContextCompaction ItemType = "context_compaction" + ItemError ItemType = "error" + ItemUnknown ItemType = "unknown" +) + +// ItemStatus is the lifecycle state of an item. +type ItemStatus string + +const ( + StatusInProgress ItemStatus = "in_progress" + StatusCompleted ItemStatus = "completed" + StatusFailed ItemStatus = "failed" + StatusDeclined ItemStatus = "declined" +) + +// ToolOutput is the folded result of a tool-shaped item. Image payloads are +// referenced by id, never inlined. +type ToolOutput struct { + Text string `json:"text,omitempty"` + IsError bool `json:"is_error,omitempty"` + ImageIDs []string `json:"image_ids,omitempty"` +} + +// Item is one unit of conversation timeline content. Messages, reasoning, and +// tool calls are all items; tool results fold into their tool item. +type Item struct { + ID string `json:"id"` + Type ItemType `json:"type"` + Status ItemStatus `json:"status"` + Text string `json:"text,omitempty"` + ToolName string `json:"tool_name,omitempty"` + ToolUseID string `json:"tool_use_id,omitempty"` + Input any `json:"input,omitempty"` + Output *ToolOutput `json:"output,omitempty"` + Title string `json:"title,omitempty"` + CreatedAt string `json:"created_at,omitempty"` +} + +// EventType discriminates Event. The names content.delta, request.opened, +// request.resolved, turn.started, and turn.completed are reserved for later +// live phases. +type EventType string + +const ( + EventSnapshot EventType = "snapshot" + EventItemStarted EventType = "item.started" + EventItemUpdated EventType = "item.updated" + EventItemCompleted EventType = "item.completed" + EventSessionMeta EventType = "session.meta" + EventError EventType = "error" +) + +// Event is one canonical conversation event. Exactly the fields relevant to +// its Type are set; Seq is monotonically increasing per subscription. +type Event struct { + Type EventType `json:"type"` + Seq uint64 `json:"seq"` + Session *SessionRef `json:"session,omitempty"` + Items []Item `json:"items,omitempty"` + Item *Item `json:"item,omitempty"` + Message string `json:"message,omitempty"` + // Recoverable is meaningful only for EventError. + Recoverable bool `json:"recoverable,omitempty"` +} diff --git a/docs/agent-conversation-protocol.md b/docs/agent-conversation-protocol.md new file mode 100644 index 000000000000..49d43a660cba --- /dev/null +++ b/docs/agent-conversation-protocol.md @@ -0,0 +1,43 @@ +# Agent conversation protocol + +A normalized layer over coding-agent session output. One canonical event vocabulary, produced by reading each agent's own session transcripts off the filesystem, consumed by GUIs on every surface. This lets cmux open a structured chat view for any session, including ones already running in a terminal pane that cmux did not spawn. + +The interface is adapted from t3code's canonical runtime events (items with a started/updated/completed lifecycle, streaming discriminated by kind, requests as first-class events). The implementation is deliberately different: t3code spawns agents through their SDKs and can only see sessions it created. We read the transcripts the agents already write (`~/.claude/projects//.jsonl`, `~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl`), so any session is observable. + +## Where each piece lives + +- **Contract:** `webviews/src/agent-chat/protocol.ts` (source of truth), mirrored by `daemon/remote/agentconv/protocol.go`. Golden fixtures in `daemon/remote/agentconv/testdata/` keep the two honest. +- **Producer:** Go package `daemon/remote/agentconv` inside cmuxd-remote: session discovery, per-provider parsers, file tailing, exposed as `agent.*` RPC verbs next to the existing `pty.*`/`session.*` verbs. One implementation runs everywhere transcripts live: headless Linux cmux servers, and macOS where the app spawns the same binary as a local stdio child. +- **Consumers:** the `/agent-chat` TanStack surface in `webviews/` (macOS via WKWebView bridge), iOS later over the mobile transport, terminals untouched. + +## Event model + +Everything in a conversation is an item: `user_message`, `assistant_message`, `reasoning`, `plan`, `command_execution`, `file_change`, `mcp_tool_call`, `dynamic_tool_call`, `web_search`, `context_compaction`, `error`, `unknown`. Items have a lifecycle (`in_progress` → `completed`/`failed`/`declined`). Tool results fold into their tool item by `tool_use_id`; the GUI never pairs calls with results itself. + +Events per subscription, `seq` strictly increasing: `snapshot` (full item list at open), `item.started`, `item.updated`, `item.completed`, `session.meta`, `error`. Items that arrive complete in the transcript (whole assistant messages) are emitted as a single `item.completed`. Reconnect means re-open and take a fresh snapshot. + +Reserved names for later phases, do not repurpose: `content.delta` (token streaming), `request.opened`/`request.resolved` (permission prompts), `turn.started`/`turn.completed`. Turn grouping in P1 is derived client-side from `user_message` boundaries. + +## RPC verbs (cmuxd-remote) + +Same newline-delimited JSON envelope as the existing verbs. + +- `agent.sessions.list` `{provider?, cwd?, limit?}` → `{sessions: SessionRef[]}` +- `agent.session.open` `{provider, session_id?, cwd?, transcript_path?}` → `{subscription_id, session}`, then async frames `{event: "agent.session.event", subscription_id, payload: Event}` starting with a `snapshot` +- `agent.session.close` `{subscription_id}` + +## Provider mapping notes + +Claude Code (`~/.claude/projects//.jsonl`): `user`/`assistant` lines carry `message.content` as a string or block array. `text` → message items, `thinking` → reasoning, `tool_use` → tool item (classified by tool name: Bash → command_execution; Edit/Write/MultiEdit/NotebookEdit → file_change; WebSearch/WebFetch → web_search; `mcp__*` → mcp_tool_call; otherwise dynamic_tool_call). `tool_result` blocks live in `user` lines and fold into their item by `tool_use_id`. Sidechain lines (`isSidechain`), meta lines, and unknown top-level types (`summary`, `queue-operation`, `attachment`, `mode`, ...) are skipped. Malformed lines are skipped, never fatal. + +Codex (`~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl`): `response_item` of type `message`/`reasoning`/`function_call`/`function_call_output` (paired by `call_id`; `shell` → command_execution, `apply_patch` → file_change). `event_msg` duplicates response_item text and is dropped, as is `token_count`. Envelope wrappers (``, ``, `# AGENTS.md` preamble) are stripped from message text. Discovery globs the sessions tree in P1; the sqlite index (`~/.codex/state_5.sqlite`) is a later optimization. + +## Write path (P2, design constraint now) + +Sending a message to a session must respect who owns the live process. If the session has a live TUI in a terminal pane, inject the text into that pane's existing PTY; never run a second `claude --resume` of the same session concurrently. Only sessions with no live process get a daemon-spawned background `claude --resume ` PTY (real CLI, no `-p`), with the GUI continuing to render from the transcript tail. Pane-to-session mapping stays in the macOS app (`SharedLiveAgentIndex`/`RestorableAgentSessionIndex`). + +## Phases + +- **P1 (this):** contract + Go parsers (Claude, Codex) + tailing + `agent.*` verbs + macOS local stdio spawn + read-only `/agent-chat` surface opened from a terminal pane. +- **P2:** composer (pane PTY inject + background `--resume` for detached sessions). +- **P3:** permission requests, Codex write path, image fetch (`agent.image.get`), iOS consumer, remote hosts over the existing `cmux ssh` daemon channel. diff --git a/webviews/src/agent-chat/protocol.ts b/webviews/src/agent-chat/protocol.ts new file mode 100644 index 000000000000..d7288a4c692f --- /dev/null +++ b/webviews/src/agent-chat/protocol.ts @@ -0,0 +1,140 @@ +// Canonical agent conversation protocol (P1). +// +// Source of truth for the normalized agent-output layer. The Go producer in +// daemon/remote/agentconv mirrors these shapes (protocol.go); keep both in +// sync with the golden fixtures under daemon/remote/agentconv/testdata. +// Wire format is JSON; all fields use snake_case on the wire. +// +// Design notes (see docs/agent-conversation-protocol.md): +// - Everything in a conversation is an "item" with a lifecycle +// (started -> updated -> completed). Messages, reasoning, and tool calls +// are all items; tool results fold into their tool item by tool_use_id. +// - Transcript replay cannot observe token-level streaming, so P1 has no +// content.delta event. The names `content.delta`, `request.opened`, +// `request.resolved`, `turn.started`, and `turn.completed` are reserved +// for the live phases and must not be reused for anything else. + +export type AgentProviderId = "claude" | "codex" | (string & {}); + +export interface AgentSessionRef { + provider: AgentProviderId; + /** Claude: session uuid. Codex: rollout id (filename stem after `rollout-`). */ + session_id: string; + /** Absolute path of the transcript on the host that parsed it. */ + transcript_path: string; + cwd?: string; + title?: string; + /** ISO 8601. */ + updated_at?: string; +} + +export type ItemType = + | "user_message" + | "assistant_message" + | "reasoning" + | "plan" + | "command_execution" + | "file_change" + | "mcp_tool_call" + | "dynamic_tool_call" + | "web_search" + | "context_compaction" + | "error" + | "unknown"; + +export type ItemStatus = "in_progress" | "completed" | "failed" | "declined"; + +export interface ToolOutput { + text?: string; + is_error?: boolean; + /** Image payloads are referenced by id, never inlined. Fetch is a later phase. */ + image_ids?: string[]; +} + +export interface ConversationItem { + /** Stable within a session: provider line uuid, tool_use_id, or synthesized. */ + id: string; + type: ItemType; + status: ItemStatus; + /** Message/reasoning/plan body (markdown). */ + text?: string; + /** Tool-shaped items only. */ + tool_name?: string; + tool_use_id?: string; + /** Raw provider-shaped tool input. */ + input?: unknown; + output?: ToolOutput; + /** Short one-line label (command line, file path, search query). */ + title?: string; + /** ISO 8601. */ + created_at?: string; +} + +export type AgentEvent = + | { + type: "snapshot"; + seq: number; + session: AgentSessionRef; + items: ConversationItem[]; + } + | { type: "item.started"; seq: number; item: ConversationItem } + | { type: "item.updated"; seq: number; item: ConversationItem } + | { type: "item.completed"; seq: number; item: ConversationItem } + | { type: "session.meta"; seq: number; session: AgentSessionRef } + | { type: "error"; seq: number; message: string; recoverable: boolean }; + +// --------------------------------------------------------------------------- +// RPC surface exposed by cmuxd-remote (newline-delimited JSON, same envelope +// as the existing pty.*/session.* verbs: request {id, method, params}, +// response {id, ok, result|error}, async frames {event, ...}). +// --------------------------------------------------------------------------- + +export interface AgentSessionsListParams { + provider?: AgentProviderId; + cwd?: string; + limit?: number; +} +export interface AgentSessionsListResult { + sessions: AgentSessionRef[]; +} + +export interface AgentSessionOpenParams { + provider: AgentProviderId; + /** Either session_id (+ cwd to disambiguate Claude project dirs) or transcript_path. */ + session_id?: string; + cwd?: string; + transcript_path?: string; +} +export interface AgentSessionOpenResult { + subscription_id: string; + session: AgentSessionRef; +} + +export interface AgentSessionCloseParams { + subscription_id: string; +} + +/** Async frame: { event: "agent.session.event", subscription_id, payload: AgentEvent } */ +export interface AgentSessionEventFrame { + event: "agent.session.event"; + subscription_id: string; + payload: AgentEvent; +} + +// --------------------------------------------------------------------------- +// WebKit bridge contract for the /agent-chat surface (macOS app <-> webview). +// JS -> Swift: window.webkit.messageHandlers.agentChat.postMessage(...) via +// callNative(method, params). Swift -> JS: window.cmuxAgentChatBridge.receive(msg). +// --------------------------------------------------------------------------- + +export interface AgentChatInitResult { + /** Session the panel was opened for, if the host resolved one. */ + session?: AgentSessionRef; + daemon_status: "ready" | "unavailable"; + /** Human-readable detail when unavailable. */ + daemon_detail?: string; +} + +export type AgentChatBridgeInbound = + | { type: "agent.event"; event: AgentEvent } + | { type: "daemon.status"; status: "ready" | "unavailable"; detail?: string }; From a8b0f0743b5231182796974d99ec3eb21c284d8e Mon Sep 17 00:00:00 2001 From: lawrencecchen <54008264+lawrencecchen@users.noreply.github.com> Date: Tue, 9 Jun 2026 16:50:46 -0700 Subject: [PATCH 02/28] Agent chat surface: /agent-chat TanStack route, event reducer, timeline UI, mock bridge Read-only chat timeline over the canonical agent conversation protocol. Native transport is the agentChat WebKit handler; without a host the surface falls back to a fixture-replaying mock bridge so it runs in plain vite/bun. Auto-follow is derived state (no effects): a bottom anchor keyed by lastSeq re-pins the viewport while following. Co-Authored-By: Claude Fable 5 --- .../webviews-app/chunks/agentChatSurface.mjs | 7 + .../chunks/agentSessionSurface.mjs | 46 +-- .../webviews-app/chunks/diffSurface.mjs | 2 +- .../chunks/installWebviewStyles.mjs | 2 +- .../webviews-app/chunks/markdown.mjs | 1 + .../markdown-viewer/webviews-app/main.mjs | 2 +- webviews/src/agent-chat/bridge.ts | 139 +++++++ .../src/agent-chat/conversationStore.test.ts | 138 +++++++ webviews/src/agent-chat/conversationStore.ts | 129 ++++++ webviews/src/agent-chat/mockBridge.ts | 289 +++++++++++++ .../src/agent-chat/react/AgentChatApp.tsx | 241 +++++++++++ webviews/src/agent-chat/react/display.ts | 86 ++++ webviews/src/agent-chat/react/rows.tsx | 196 +++++++++ webviews/src/agent-chat/styles.css | 380 ++++++++++++++++++ webviews/src/main.tsx | 19 +- webviews/src/router.tsx | 6 + webviews/src/surfaces/agentChatSurface.tsx | 19 + 17 files changed, 1674 insertions(+), 28 deletions(-) create mode 100644 Resources/markdown-viewer/webviews-app/chunks/agentChatSurface.mjs create mode 100644 Resources/markdown-viewer/webviews-app/chunks/markdown.mjs create mode 100644 webviews/src/agent-chat/bridge.ts create mode 100644 webviews/src/agent-chat/conversationStore.test.ts create mode 100644 webviews/src/agent-chat/conversationStore.ts create mode 100644 webviews/src/agent-chat/mockBridge.ts create mode 100644 webviews/src/agent-chat/react/AgentChatApp.tsx create mode 100644 webviews/src/agent-chat/react/display.ts create mode 100644 webviews/src/agent-chat/react/rows.tsx create mode 100644 webviews/src/agent-chat/styles.css create mode 100644 webviews/src/surfaces/agentChatSurface.tsx diff --git a/Resources/markdown-viewer/webviews-app/chunks/agentChatSurface.mjs b/Resources/markdown-viewer/webviews-app/chunks/agentChatSurface.mjs new file mode 100644 index 000000000000..3a3deaaee004 --- /dev/null +++ b/Resources/markdown-viewer/webviews-app/chunks/agentChatSurface.mjs @@ -0,0 +1,7 @@ +import{b,j as r,i as N,c as B,a as D}from"./vendor.mjs";import{a as H,m as L,r as $}from"./markdown.mjs";import{i as F,c as P}from"./installWebviewStyles.mjs";const W=1200,R={provider:"claude",session_id:"6f1f5e7e-mock-4d27-9c40-agentchatdev1",transcript_path:"~/.claude/projects/-Users-dev-fun-cmux/6f1f5e7e-mock-4d27-9c40-agentchatdev1.jsonl",cwd:"~/fun/cmux",title:"Wire the /agent-chat surface",updated_at:"2026-06-09T17:03:21Z"};function U(){return[{id:"msg-1",type:"user_message",status:"completed",text:"Add a structured chat view for agent sessions. Start by listing the failing webview tests.",created_at:"2026-06-09T16:58:01Z"},{id:"reasoning-1",type:"reasoning",status:"completed",text:"The webviews app keeps tests under `test/`. I should run `bun test` first to get a baseline, then look at the failures one by one.",created_at:"2026-06-09T16:58:04Z"},{id:"tool-1",type:"command_execution",status:"completed",title:"bun test",tool_name:"Bash",tool_use_id:"toolu_mock_01",input:{command:"bun test",description:"Run webview tests"},output:{text:`12 pass + 0 fail +Ran 12 tests across 11 files. [412ms]`},created_at:"2026-06-09T16:58:06Z"},{id:"msg-2",type:"assistant_message",status:"completed",text:"All **12 tests pass**, so there is no baseline failure. Next I will:\n\n1. Add the `/agent-chat` route\n2. Build the bridge client\n3. Render the timeline\n\n```bash\nbun run typecheck && bun test\n```",created_at:"2026-06-09T16:58:09Z"},{id:"msg-3",type:"user_message",status:"completed",text:"Sounds good. Check how the diff surface registers its route before you add a new one.",created_at:"2026-06-09T16:59:30Z"},{id:"plan-1",type:"plan",status:"completed",text:"1. Read `src/router.tsx` route registrations\n2. Mirror the `/diff` pattern for `/agent-chat`\n3. Split the surface into its own chunk",created_at:"2026-06-09T16:59:33Z"},{id:"tool-2",type:"dynamic_tool_call",status:"completed",title:"src/router.tsx",tool_name:"Read",tool_use_id:"toolu_mock_02",input:{file_path:"webviews/src/router.tsx"},output:{text:`createRoute({ path: "/diff", component: WebviewComponent }) +…`},created_at:"2026-06-09T16:59:35Z"},{id:"tool-3",type:"file_change",status:"completed",title:"webviews/src/router.tsx",tool_name:"Edit",tool_use_id:"toolu_mock_03",input:{file_path:"webviews/src/router.tsx",old_string:'path: "/agent-session"',new_string:'path: "/agent-chat"'},output:{text:"Edited webviews/src/router.tsx"},created_at:"2026-06-09T16:59:42Z"},{id:"tool-4",type:"web_search",status:"completed",title:"tanstack router hash history nested routes",tool_name:"WebSearch",tool_use_id:"toolu_mock_04",input:{query:"tanstack router hash history nested routes"},output:{text:"TanStack Router docs: createHashHistory() keeps route state in the URL fragment…"},created_at:"2026-06-09T17:00:01Z"},{id:"tool-5",type:"mcp_tool_call",status:"failed",title:"browser_screenshot",tool_name:"mcp__browser__screenshot",tool_use_id:"toolu_mock_05",input:{url:"http://localhost:5173/#/agent-chat"},output:{text:"Error: no browser session connected",is_error:!0},created_at:"2026-06-09T17:00:18Z"},{id:"compaction-1",type:"context_compaction",status:"completed",text:"Context compacted (142k → 38k tokens)",created_at:"2026-06-09T17:00:40Z"},{id:"error-1",type:"error",status:"completed",text:"Provider stream interrupted; retrying transcript tail.",created_at:"2026-06-09T17:00:41Z"},{id:"unknown-1",type:"unknown",status:"completed",text:"queue-operation",created_at:"2026-06-09T17:00:42Z"},{id:"msg-4",type:"user_message",status:"completed",text:"Now run the verify gates and show me the summary.",created_at:"2026-06-09T17:02:10Z"},{id:"tool-6",type:"command_execution",status:"in_progress",title:"bun run typecheck && bun run lint:ci",tool_name:"Bash",tool_use_id:"toolu_mock_06",input:{command:"bun run typecheck && bun run lint:ci"},created_at:"2026-06-09T17:02:12Z"}]}function O(a){return[{type:"item.updated",seq:a,item:{id:"tool-6",type:"command_execution",status:"in_progress",title:"bun run typecheck && bun run lint:ci",tool_name:"Bash",tool_use_id:"toolu_mock_06",input:{command:"bun run typecheck && bun run lint:ci"},output:{text:"$ tsc --noEmit"},created_at:"2026-06-09T17:02:12Z"}},{type:"item.completed",seq:a+1,item:{id:"tool-6",type:"command_execution",status:"completed",title:"bun run typecheck && bun run lint:ci",tool_name:"Bash",tool_use_id:"toolu_mock_06",input:{command:"bun run typecheck && bun run lint:ci"},output:{text:`$ tsc --noEmit +$ oxlint . --react-plugin --jsx-a11y-plugin --import-plugin --deny-warnings +Found 0 warnings and 0 errors. +Finished in 64ms on 41 files with 102 rules using 10 threads.`},created_at:"2026-06-09T17:02:12Z"}},{type:"item.started",seq:a+2,item:{id:"reasoning-2",type:"reasoning",status:"in_progress",text:"Both gates are green. Summarize the run and hand back to the user.",created_at:"2026-06-09T17:03:02Z"}},{type:"item.completed",seq:a+3,item:{id:"reasoning-2",type:"reasoning",status:"completed",text:"Both gates are green. Summarize the run and hand back to the user.",created_at:"2026-06-09T17:03:02Z"}},{type:"item.completed",seq:a+4,item:{id:"msg-5",type:"assistant_message",status:"completed",text:"Verify gates are green:\n\n- `bun run typecheck` — no errors\n- `bun run lint:ci` — 0 warnings\n\nThe `/agent-chat` surface is registered and renders this mock stream in dev.",created_at:"2026-06-09T17:03:20Z"}}]}function q(a){typeof window>"u"||window.cmuxAgentChatBridge?.receive(a)}function K(){let a=null,e=!1;const t=()=>{a!==null&&(clearInterval(a),a=null)};return{kind:"mock",init(){return Promise.resolve({session:R,daemon_status:"ready"})},subscribe(){if(e||a!==null)return Promise.resolve();q({type:"agent.event",event:{type:"snapshot",seq:1,session:R,items:U()}});const n=O(2);return a=setInterval(()=>{const s=n.shift();if(!s){t();return}q({type:"agent.event",event:s})},W),Promise.resolve()},dispose(){e=!0,t()}}}class G extends Error{code;constructor(e,t){super(e),this.name="AgentChatBridgeError",this.code=t}}const A=new Set;function I(){typeof window>"u"||window.cmuxAgentChatBridge||(window.cmuxAgentChatBridge={applyTheme(a){H(a)},receive(a){for(const e of A)e(a)}})}I();function J(a){return A.add(a),()=>{A.delete(a)}}function V(){if(typeof window>"u")return null;const a=window.webkit?.messageHandlers?.agentChat;return a&&typeof a.postMessage=="function"?a:null}async function M(a,e,t={}){const n=await a.postMessage({id:L(),method:e,params:t});if(!n.ok)throw new G(n.error?.userMessage||"Native bridge request failed.",n.error?.code);return n.value}function X(){I();const a=V();return a?{kind:"native",init:()=>M(a,"chat.init"),subscribe:()=>M(a,"chat.subscribe"),dispose(){}}:K()}function Q(){return{phase:"connecting",session:null,items:[],daemonStatus:"ready",daemonDetail:null,lastSeq:0,hasSnapshot:!1,streamError:null}}function Y(a,e){switch(e.type){case"init":return{...a,phase:"ready",session:e.result.session??a.session,daemonStatus:e.result.daemon_status,daemonDetail:e.result.daemon_detail??null};case"init-failed":return{...a,phase:"failed",daemonStatus:"unavailable",daemonDetail:e.detail};case"inbound":return e.message.type==="daemon.status"?{...a,daemonStatus:e.message.status,daemonDetail:e.message.detail??null}:ee(a,e.message.event)}}function ee(a,e){if(e.type==="snapshot")return{...a,hasSnapshot:!0,lastSeq:e.seq,session:e.session,items:[...e.items],streamError:null};if(e.seq<=a.lastSeq)return a;switch(e.type){case"item.started":case"item.updated":case"item.completed":return{...a,lastSeq:e.seq,items:te(a.items,e.item)};case"session.meta":return{...a,lastSeq:e.seq,session:e.session};case"error":return{...a,lastSeq:e.seq,streamError:{message:e.message,recoverable:e.recoverable}}}}function te(a,e){const t=a.findIndex(s=>s.id===e.id);if(t<0)return[...a,e];const n=a.slice();return n[t]=e,n}function ae(a){return a?a==="claude"?"Claude":a==="codex"?"Codex":a.charAt(0).toUpperCase()+a.slice(1):"Agent"}function ne(a){return a?a.title&&a.title.trim()!==""?a.title:a.transcript_path.split("/").pop()||a.session_id:"Agent session"}const Z={command_execution:"Run",file_change:"Edit",mcp_tool_call:"MCP",dynamic_tool_call:"Tool",web_search:"Search"};function se(a){return a in Z}function z(a){return Z[a]??"Tool"}function oe(a){return a.title||a.tool_name||z(a.type)}const re={command_execution:"$",file_change:"±",mcp_tool_call:"⚙",dynamic_tool_call:"⚙",web_search:"⌕"};function ie(a){return re[a]??"⚙"}function le(a){if(a==null)return"";if(typeof a=="string")return a;try{return JSON.stringify(a,null,2)??String(a)}catch{return String(a)}}function ce(a){switch(a){case"completed":return"✓";case"failed":return"✕";case"declined":return"⊘";case"in_progress":return""}}function de(a){const e=b.c(12),{item:t}=a;if(t.type==="user_message"){let s;return e[0]!==t?(s=r.jsx(ue,{item:t}),e[0]=t,e[1]=s):s=e[1],s}if(t.type==="assistant_message"){let s;return e[2]!==t?(s=r.jsx(pe,{item:t}),e[2]=t,e[3]=s):s=e[3],s}if(t.type==="reasoning"){let s;return e[4]!==t?(s=r.jsx(me,{item:t}),e[4]=t,e[5]=s):s=e[5],s}if(t.type==="plan"){let s;return e[6]!==t?(s=r.jsx(ge,{item:t}),e[6]=t,e[7]=s):s=e[7],s}if(se(t.type)){let s;return e[8]!==t?(s=r.jsx(fe,{item:t}),e[8]=t,e[9]=s):s=e[9],s}let n;return e[10]!==t?(n=r.jsx(be,{item:t}),e[10]=t,e[11]=n):n=e[11],n}function T(a){return{"data-item-id":a.id,"data-item-type":a.type,"data-item-status":a.status}}function ue(a){const e=b.c(7),{item:t}=a;let n;e[0]!==t?(n=T(t),e[0]=t,e[1]=n):n=e[1];const s=t.text??"";let o;e[2]!==s?(o=r.jsx("div",{className:"agent-chat-user-bubble",children:s}),e[2]=s,e[3]=o):o=e[3];let i;return e[4]!==n||e[5]!==o?(i=r.jsx("div",{className:"agent-chat-row agent-chat-user-row",...n,children:o}),e[4]=n,e[5]=o,e[6]=i):i=e[6],i}function pe(a){const e=b.c(12),{item:t}=a;let n;e[0]!==t?(n=T(t),e[0]=t,e[1]=n):n=e[1];const s=t.text??"";let o;e[2]!==s?(o=$(s),e[2]=s,e[3]=o):o=e[3];let i;e[4]!==o?(i=r.jsx("div",{className:"agent-chat-markdown",dangerouslySetInnerHTML:{__html:o}}),e[4]=o,e[5]=i):i=e[5];let l;e[6]!==t.status?(l=t.status!=="completed"?r.jsx(E,{status:t.status}):null,e[6]=t.status,e[7]=l):l=e[7];let c;return e[8]!==n||e[9]!==i||e[10]!==l?(c=r.jsxs("div",{className:"agent-chat-row agent-chat-assistant-row",...n,children:[i,l]}),e[8]=n,e[9]=i,e[10]=l,e[11]=c):c=e[11],c}function me(a){const e=b.c(19),{item:t}=a,[n,s]=N.useState(!1);let o;e[0]!==t?(o=T(t),e[0]=t,e[1]=o):o=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=()=>s(he),e[2]=i):i=e[2];const l=n?"▾":"▸";let c;e[3]!==l?(c=r.jsx("span",{className:"agent-chat-disclosure-chevron","aria-hidden":"true",children:l}),e[3]=l,e[4]=c):c=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx("span",{className:"agent-chat-reasoning-label",children:"Reasoning"}),e[5]=d):d=e[5];let u;e[6]!==t.status?(u=t.status!=="completed"?r.jsx(E,{status:t.status}):null,e[6]=t.status,e[7]=u):u=e[7];let p;e[8]!==n||e[9]!==c||e[10]!==u?(p=r.jsxs("button",{type:"button",className:"agent-chat-disclosure","aria-expanded":n,onClick:i,children:[c,d,u]}),e[8]=n,e[9]=c,e[10]=u,e[11]=p):p=e[11];let m;e[12]!==n||e[13]!==t.text?(m=n?r.jsx("div",{className:"agent-chat-markdown agent-chat-reasoning-body",dangerouslySetInnerHTML:{__html:$(t.text??"")}}):null,e[12]=n,e[13]=t.text,e[14]=m):m=e[14];let f;return e[15]!==o||e[16]!==p||e[17]!==m?(f=r.jsxs("div",{className:"agent-chat-row agent-chat-reasoning-row",...o,children:[p,m]}),e[15]=o,e[16]=p,e[17]=m,e[18]=f):f=e[18],f}function he(a){return!a}function ge(a){const e=b.c(15),{item:t}=a;let n;e[0]!==t?(n=T(t),e[0]=t,e[1]=n):n=e[1];let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx("span",{className:"agent-chat-badge",children:"Plan"}),e[2]=s):s=e[2];let o;e[3]!==t.status?(o=t.status!=="completed"?r.jsx(E,{status:t.status}):null,e[3]=t.status,e[4]=o):o=e[4];let i;e[5]!==o?(i=r.jsxs("div",{className:"agent-chat-plan-header",children:[s,o]}),e[5]=o,e[6]=i):i=e[6];const l=t.text??"";let c;e[7]!==l?(c=$(l),e[7]=l,e[8]=c):c=e[8];let d;e[9]!==c?(d=r.jsx("div",{className:"agent-chat-markdown",dangerouslySetInnerHTML:{__html:c}}),e[9]=c,e[10]=d):d=e[10];let u;return e[11]!==n||e[12]!==i||e[13]!==d?(u=r.jsxs("div",{className:"agent-chat-row agent-chat-plan-row",...n,children:[i,d]}),e[11]=n,e[12]=i,e[13]=d,e[14]=u):u=e[14],u}function fe(a){const e=b.c(38),{item:t}=a,[n,s]=N.useState(!1);let o;e[0]!==t.input?(o=le(t.input),e[0]=t.input,e[1]=o):o=e[1];const i=o,l=t.output?.text??"",c=t.output?.image_ids?.length??0,d=t.status==="failed"||t.output?.is_error===!0;let u;e[2]!==t?(u=T(t),e[2]=t,e[3]=u):u=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=()=>s(xe),e[4]=p):p=e[4];let m;e[5]!==t.status?(m=r.jsx(E,{status:t.status}),e[5]=t.status,e[6]=m):m=e[6];let f;e[7]!==t.type?(f=ie(t.type),e[7]=t.type,e[8]=f):f=e[8];let h;e[9]!==f?(h=r.jsx("span",{"aria-hidden":"true",children:f}),e[9]=f,e[10]=h):h=e[10];let w;e[11]!==t.type?(w=z(t.type),e[11]=t.type,e[12]=w):w=e[12];let g;e[13]!==h||e[14]!==w?(g=r.jsxs("span",{className:"agent-chat-badge agent-chat-tool-badge",children:[h," ",w]}),e[13]=h,e[14]=w,e[15]=g):g=e[15];let y;e[16]!==t?(y=oe(t),e[16]=t,e[17]=y):y=e[17];let _;e[18]!==y?(_=r.jsx("span",{className:"agent-chat-tool-title",children:y}),e[18]=y,e[19]=_):_=e[19];const S=n?"▾":"▸";let v;e[20]!==S?(v=r.jsx("span",{className:"agent-chat-disclosure-chevron","aria-hidden":"true",children:S}),e[20]=S,e[21]=v):v=e[21];let j;e[22]!==n||e[23]!==_||e[24]!==v||e[25]!==m||e[26]!==g?(j=r.jsxs("button",{type:"button",className:"agent-chat-disclosure agent-chat-tool-summary","aria-expanded":n,onClick:p,children:[m,g,_,v]}),e[22]=n,e[23]=_,e[24]=v,e[25]=m,e[26]=g,e[27]=j):j=e[27];let x;e[28]!==n||e[29]!==d||e[30]!==c||e[31]!==i||e[32]!==l?(x=n?r.jsxs("div",{className:"agent-chat-tool-detail",children:[i!==""?r.jsx("pre",{className:"agent-chat-mono agent-chat-tool-input",children:i}):null,l!==""?r.jsx("pre",{className:`agent-chat-mono agent-chat-tool-output${d?" is-error":""}`,children:l}):null,c>0?r.jsx("div",{className:"agent-chat-tool-images",children:c===1?"1 image attachment":`${c} image attachments`}):null,i===""&&l===""&&c===0?r.jsx("div",{className:"agent-chat-tool-images",children:"No input or output recorded."}):null]}):null,e[28]=n,e[29]=d,e[30]=c,e[31]=i,e[32]=l,e[33]=x):x=e[33];let k;return e[34]!==j||e[35]!==x||e[36]!==u?(k=r.jsxs("div",{className:"agent-chat-row agent-chat-tool-row",...u,children:[j,x]}),e[34]=j,e[35]=x,e[36]=u,e[37]=k):k=e[37],k}function xe(a){return!a}function be(a){const e=b.c(11),{item:t}=a,n=t.type==="context_compaction"?"Context compacted":t.type==="error"?"Error":"Event",s=`agent-chat-row agent-chat-system-row${t.type==="error"?" is-error":""}`;let o;e[0]!==t?(o=T(t),e[0]=t,e[1]=o):o=e[1];let i;e[2]!==n?(i=r.jsx("span",{className:"agent-chat-system-label",children:n}),e[2]=n,e[3]=i):i=e[3];let l;e[4]!==t.text?(l=t.text?r.jsx("span",{className:"agent-chat-system-text",children:t.text}):null,e[4]=t.text,e[5]=l):l=e[5];let c;return e[6]!==s||e[7]!==o||e[8]!==i||e[9]!==l?(c=r.jsxs("div",{className:s,...o,children:[i,l]}),e[6]=s,e[7]=o,e[8]=i,e[9]=l,e[10]=c):c=e[10],c}function E(a){const e=b.c(11),{status:t}=a;if(t==="in_progress"){let l,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx("span",{className:"agent-chat-spinner","aria-hidden":"true"}),c=r.jsx("span",{className:"agent-chat-visually-hidden",children:"In progress"}),e[0]=l,e[1]=c):(l=e[0],c=e[1]);let d;return e[2]!==t?(d=r.jsxs("output",{className:"agent-chat-status is-in-progress","data-status":t,children:[l,c]}),e[2]=t,e[3]=d):d=e[3],d}const n=`agent-chat-status is-${t}`,s=t==="failed"?"Failed":t==="declined"?"Declined":"Completed";let o;e[4]!==t?(o=ce(t),e[4]=t,e[5]=o):o=e[5];let i;return e[6]!==t||e[7]!==n||e[8]!==s||e[9]!==o?(i=r.jsx("span",{className:n,"data-status":t,"aria-label":s,children:o}),e[6]=t,e[7]=n,e[8]=s,e[9]=o,e[10]=i):i=e[10],i}function ye(){const a=b.c(1);let e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"agent-chat-turn-separator","aria-hidden":"true"}),a[0]=e):e=a[0],e}const we=24;function _e(a,e){const t=b.c(4);let n,s;t[0]!==e||t[1]!==a?(n=()=>{const o=e?e():X(),i=J(c=>{a({type:"inbound",message:c})});let l=!1;return(async()=>{try{const c=await o.init();if(l)return;a({type:"init",result:c}),await o.subscribe()}catch(c){const d=c;l||a({type:"init-failed",detail:d instanceof Error?d.message:"Agent bridge request failed."})}})(),()=>{l=!0,i(),o.dispose()}},s=[a,e],t[0]=e,t[1]=a,t[2]=n,t[3]=s):(n=t[2],s=t[3]),N.useEffect(n,s)}function ve(a){const e=b.c(12),{createBridge:t}=a,[n,s]=N.useReducer(Y,void 0,Q);_e(s,t);let o;e[0]!==n?(o=r.jsx(je,{state:n}),e[0]=n,e[1]=o):o=e[1];let i;e[2]!==n.daemonDetail||e[3]!==n.daemonStatus||e[4]!==n.items?(i=n.daemonStatus==="unavailable"&&n.items.length>0?r.jsx(Se,{detail:n.daemonDetail}):null,e[2]=n.daemonDetail,e[3]=n.daemonStatus,e[4]=n.items,e[5]=i):i=e[5];let l;e[6]!==n?(l=r.jsx(ke,{state:n}),e[6]=n,e[7]=l):l=e[7];let c;return e[8]!==o||e[9]!==i||e[10]!==l?(c=r.jsxs("div",{className:"agent-chat-shell",children:[o,i,l]}),e[8]=o,e[9]=i,e[10]=l,e[11]=c):c=e[11],c}function je(a){const e=b.c(23),{state:t}=a,n=t.session,s=n?.provider??"",o=n?.provider;let i;e[0]!==o?(i=ae(o),e[0]=o,e[1]=i):i=e[1];let l;e[2]!==s||e[3]!==i?(l=r.jsx("span",{className:"agent-chat-provider-badge","data-provider":s,children:i}),e[2]=s,e[3]=i,e[4]=l):l=e[4];let c;e[5]!==n?(c=ne(n),e[5]=n,e[6]=c):c=e[6];let d;e[7]!==c?(d=r.jsx("span",{className:"agent-chat-header-title",children:c}),e[7]=c,e[8]=d):d=e[8];let u;e[9]!==n?(u=n?.cwd?r.jsx("span",{className:"agent-chat-header-cwd",children:n.cwd}):null,e[9]=n,e[10]=u):u=e[10];let p;e[11]!==d||e[12]!==u?(p=r.jsxs("span",{className:"agent-chat-header-titles",children:[d,u]}),e[11]=d,e[12]=u,e[13]=p):p=e[13];const m=`agent-chat-daemon-status is-${t.daemonStatus}`,f=t.daemonStatus==="unavailable"?t.daemonDetail??void 0:void 0;let h;e[14]===Symbol.for("react.memo_cache_sentinel")?(h=r.jsx("span",{className:"agent-chat-daemon-dot","aria-hidden":"true"}),e[14]=h):h=e[14];const w=t.daemonStatus==="unavailable"?"Daemon unavailable":"Live";let g;e[15]!==f||e[16]!==w||e[17]!==m?(g=r.jsxs("span",{className:m,title:f,children:[h,w]}),e[15]=f,e[16]=w,e[17]=m,e[18]=g):g=e[18];let y;return e[19]!==g||e[20]!==l||e[21]!==p?(y=r.jsxs("header",{className:"agent-chat-header",children:[l,p,g]}),e[19]=g,e[20]=l,e[21]=p,e[22]=y):y=e[22],y}function Se(a){const e=b.c(2),{detail:t}=a,n=t?`: ${t}`:".";let s;return e[0]!==n?(s=r.jsxs("output",{className:"agent-chat-daemon-banner",children:["Agent daemon unavailable",n," Showing the last known transcript."]}),e[0]=n,e[1]=s):s=e[1],s}function ke(a){const e=b.c(8),{state:t}=a;if(t.phase==="connecting"){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(C,{title:"Connecting",detail:"Reaching the agent daemon…"}),e[0]=s):s=e[0],s}if(t.daemonStatus==="unavailable"&&t.items.length===0){const s=t.daemonDetail??"The conversation daemon could not be reached.";let o;return e[1]!==s?(o=r.jsx(C,{title:"Agent daemon unavailable",detail:s}),e[1]=s,e[2]=o):o=e[2],o}if(!t.hasSnapshot&&t.session===null){let s;return e[3]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(C,{title:"No session",detail:"No agent session was resolved for this pane."}),e[3]=s):s=e[3],s}if(!t.hasSnapshot){let s;return e[4]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(C,{title:"Loading transcript",detail:"Waiting for the first snapshot…"}),e[4]=s):s=e[4],s}if(t.items.length===0){let s;return e[5]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(C,{title:"No conversation yet",detail:"This session's transcript has no items so far."}),e[5]=s):s=e[5],s}let n;return e[6]!==t?(n=r.jsx(Ne,{state:t}),e[6]=t,e[7]=n):n=e[7],n}function C(a){const e=b.c(8),{title:t,detail:n}=a;let s;e[0]!==t?(s=r.jsx("span",{className:"agent-chat-empty-title",children:t}),e[0]=t,e[1]=s):s=e[1];let o;e[2]!==n?(o=r.jsx("span",{className:"agent-chat-empty-detail",children:n}),e[2]=n,e[3]=o):o=e[3];let i;return e[4]!==s||e[5]!==o||e[6]!==t?(i=r.jsxs("div",{className:"agent-chat-empty","data-empty-title":t,children:[s,o]}),e[4]=s,e[5]=o,e[6]=t,e[7]=i):i=e[7],i}function Ne(a){const e=b.c(25),{state:t}=a,[n,s]=N.useState(null),[o,i]=N.useState(null),l=o===null,c=o!==null&&t.lastSeq>o,d=Te;let u;e[0]!==t.lastSeq||e[1]!==o?(u=x=>{const k=x.currentTarget;k.scrollTop+k.clientHeight>=k.scrollHeight-we?o!==null&&i(null):o===null&&i(t.lastSeq)},e[0]=t.lastSeq,e[1]=o,e[2]=u):u=e[2];const p=u;let m;e[3]!==l?(m=x=>{x&&l&&d(x.parentElement)},e[3]=l,e[4]=m):m=e[4];const f=m;let h;e[5]!==t.items?(h=[],t.items.forEach((x,k)=>{x.type==="user_message"&&k>0&&h.push(r.jsx(ye,{},`turn-${x.id}`)),h.push(r.jsx(de,{item:x},x.id))}),e[5]=t.items,e[6]=h):h=e[6];const w=l?"true":"false";let g;e[7]!==t.streamError?(g=t.streamError?r.jsxs("div",{className:"agent-chat-row agent-chat-system-row is-error","data-stream-error":"true",children:[r.jsx("span",{className:"agent-chat-system-label",children:"Stream error"}),r.jsxs("span",{className:"agent-chat-system-text",children:[t.streamError.message,t.streamError.recoverable?" (retrying)":""]})]}):null,e[7]=t.streamError,e[8]=g):g=e[8];const y=`anchor-${t.lastSeq}`;let _;e[9]!==f||e[10]!==y?(_=r.jsx("div",{ref:f,className:"agent-chat-anchor"},y),e[9]=f,e[10]=y,e[11]=_):_=e[11];let S;e[12]!==p||e[13]!==h||e[14]!==w||e[15]!==g||e[16]!==_?(S=r.jsxs("div",{className:"agent-chat-scroll",ref:s,onScroll:p,"data-following":w,children:[h,g,_]}),e[12]=p,e[13]=h,e[14]=w,e[15]=g,e[16]=_,e[17]=S):S=e[17];let v;e[18]!==l||e[19]!==c||e[20]!==n?(v=!l&&c?r.jsx("button",{type:"button",className:"agent-chat-jump-latest",onClick:()=>{d(n),i(null)},children:"↓ Jump to latest"}):null,e[18]=l,e[19]=c,e[20]=n,e[21]=v):v=e[21];let j;return e[22]!==S||e[23]!==v?(j=r.jsxs("div",{className:"agent-chat-timeline",children:[S,v]}),e[22]=S,e[23]=v,e[24]=j):j=e[24],j}function Te(a){a&&(a.scrollTop=a.scrollHeight)}const Ce=':root{color-scheme:light dark}[data-cmux-webview-kind=agent-chat]{margin:0;background:var(--agent-page-bg, #1e1e1e);color:var(--agent-text, #d6d6d6);font-family:var(--vscode-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);font-size:13px;-webkit-font-smoothing:antialiased}.agent-chat-shell{display:flex;flex-direction:column;height:100vh;overflow:hidden}.agent-chat-header{display:flex;align-items:center;gap:8px;padding:8px 12px;border-bottom:1px solid var(--agent-border, rgba(127, 127, 127, .25));flex:none;min-width:0}.agent-chat-provider-badge{flex:none;padding:2px 8px;border-radius:999px;font-size:11px;font-weight:600;background:var(--agent-control, rgba(127, 127, 127, .16));color:var(--agent-soft, #b8b8b8)}.agent-chat-header-titles{display:flex;flex-direction:column;min-width:0;flex:1}.agent-chat-header-title{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.agent-chat-header-cwd{font-size:11px;color:var(--agent-muted, #8a8a8a);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;direction:rtl;text-align:left}.agent-chat-daemon-status{flex:none;display:inline-flex;align-items:center;gap:5px;font-size:11px;color:var(--agent-muted, #8a8a8a)}.agent-chat-daemon-dot{width:7px;height:7px;border-radius:999px;background:#00a240}.agent-chat-daemon-status.is-unavailable .agent-chat-daemon-dot{background:var(--agent-danger, #e5484d)}.agent-chat-daemon-banner{display:block;flex:none;padding:6px 12px;font-size:11px;color:var(--agent-danger, #e5484d);background:color-mix(in srgb,var(--agent-danger, #e5484d) 10%,transparent);border-bottom:1px solid var(--agent-border, rgba(127, 127, 127, .25))}.agent-chat-timeline{position:relative;flex:1;min-height:0;display:flex}.agent-chat-scroll{flex:1;overflow-y:auto;padding:12px 14px 18px;scrollbar-width:thin}.agent-chat-anchor{height:1px}.agent-chat-row{margin:0 auto;max-width:760px;padding:4px 0}.agent-chat-turn-separator{margin:10px auto;max-width:760px;border-top:1px solid var(--agent-border, rgba(127, 127, 127, .2))}.agent-chat-user-row{display:flex;justify-content:flex-end}.agent-chat-user-bubble{max-width:85%;padding:7px 11px;border-radius:12px;background:var(--agent-control, rgba(127, 127, 127, .16));white-space:pre-wrap;overflow-wrap:anywhere}.agent-chat-assistant-row{display:flex;flex-direction:column;gap:4px}.agent-chat-markdown{line-height:1.5;overflow-wrap:anywhere}.agent-chat-markdown pre{padding:8px 10px;border-radius:8px;background:var(--agent-input-bg, rgba(127, 127, 127, .12));overflow-x:auto;font-family:var(--vscode-editor-font-family, ui-monospace, "SF Mono", Menlo, monospace);font-size:12px}.agent-chat-markdown code{font-family:var(--vscode-editor-font-family, ui-monospace, "SF Mono", Menlo, monospace);font-size:12px}.agent-chat-markdown a{color:var(--agent-accent, #4f8ff7)}.agent-chat-reasoning-row{color:var(--agent-muted, #8a8a8a)}.agent-chat-reasoning-body{padding:4px 0 2px 18px;font-size:12px}.agent-chat-plan-row{border-left:2px solid var(--agent-accent, #4f8ff7);padding-left:10px}.agent-chat-plan-header{display:flex;align-items:center;gap:6px;margin-bottom:2px}.agent-chat-disclosure{display:flex;align-items:center;gap:6px;width:100%;min-width:0;padding:2px 0;border:none;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer}.agent-chat-disclosure-chevron{flex:none;color:var(--agent-muted, #8a8a8a);font-size:10px}.agent-chat-badge{flex:none;padding:1px 6px;border-radius:5px;font-size:10.5px;font-weight:600;background:var(--agent-control, rgba(127, 127, 127, .16));color:var(--agent-soft, #b8b8b8)}.agent-chat-tool-row{font-size:12px}.agent-chat-tool-title{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--agent-soft, #b8b8b8);font-family:var(--vscode-editor-font-family, ui-monospace, "SF Mono", Menlo, monospace);font-size:11.5px}.agent-chat-tool-detail{display:flex;flex-direction:column;gap:6px;padding:4px 0 4px 18px}.agent-chat-mono{margin:0;padding:8px 10px;border-radius:8px;background:var(--agent-input-bg, rgba(127, 127, 127, .12));font-family:var(--vscode-editor-font-family, ui-monospace, "SF Mono", Menlo, monospace);font-size:11.5px;line-height:1.45;white-space:pre-wrap;overflow-wrap:anywhere;overflow-y:auto;max-height:320px}.agent-chat-tool-output.is-error{color:var(--agent-danger, #e5484d)}.agent-chat-tool-images{font-size:11px;color:var(--agent-muted, #8a8a8a)}.agent-chat-system-row{display:flex;gap:8px;align-items:baseline;font-size:11.5px;color:var(--agent-muted, #8a8a8a)}.agent-chat-system-row.is-error{color:var(--agent-danger, #e5484d)}.agent-chat-system-label{flex:none;font-weight:600}.agent-chat-system-text{overflow-wrap:anywhere}.agent-chat-status{flex:none;display:inline-flex;align-items:center;font-size:11px;color:var(--agent-muted, #8a8a8a)}.agent-chat-status.is-failed,.agent-chat-status.is-declined{color:var(--agent-danger, #e5484d)}.agent-chat-spinner{width:10px;height:10px;border-radius:999px;border:1.5px solid var(--agent-muted, #8a8a8a);border-top-color:transparent;animation:agent-chat-spin .8s linear infinite}@keyframes agent-chat-spin{to{transform:rotate(360deg)}}.agent-chat-visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.agent-chat-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;color:var(--agent-muted, #8a8a8a)}.agent-chat-empty-title{font-weight:600;color:var(--agent-soft, #b8b8b8)}.agent-chat-empty-detail{font-size:12px}.agent-chat-jump-latest{position:absolute;bottom:14px;left:50%;transform:translate(-50%);padding:5px 12px;border:1px solid var(--agent-border, rgba(127, 127, 127, .25));border-radius:999px;background:var(--agent-surface-elevated, #2a2a2a);color:var(--agent-text, #d6d6d6);font:inherit;font-size:12px;cursor:pointer;box-shadow:0 2px 8px #00000040}';function qe(a){F("agent-chat",Ce),document.documentElement.dataset.cmuxWebviewKind="agent-chat",document.body.dataset.cmuxWebviewKind="agent-chat";const e=P(()=>r.jsx(ve,{}));B.createRoot(a).render(r.jsx(D,{router:e}))}export{qe as mountAgentChatSurface}; diff --git a/Resources/markdown-viewer/webviews-app/chunks/agentSessionSurface.mjs b/Resources/markdown-viewer/webviews-app/chunks/agentSessionSurface.mjs index 7d23dbf0631e..a40566a8dcc7 100644 --- a/Resources/markdown-viewer/webviews-app/chunks/agentSessionSurface.mjs +++ b/Resources/markdown-viewer/webviews-app/chunks/agentSessionSurface.mjs @@ -1,42 +1,42 @@ -import{R as rt,i as b,b as Et,c as Ys,j as Pr,a as Gs}from"./vendor.mjs";import{i as Xs,c as Qs}from"./installWebviewStyles.mjs";function ea(n){if(n.activityStatus==="stopped"||n.activityStatus==="failed")return"!";switch(n.activityKind){case"command":return"$";case"fileChange":return"+";default:return"*"}}function lt(){const n=globalThis.crypto;if(typeof n?.randomUUID=="function")return n.randomUUID();const e=n?.getRandomValues?.bind(n);if(typeof e=="function"){const t=new Uint8Array(16);return e(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128,[...t].map((r,o)=>{const i=r.toString(16).padStart(2,"0");return[4,6,8,10].includes(o)?`-${i}`:i}).join("")}return`cmux-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}const ta={isDark:null,pageBackground:"--agent-page-bg",surfaceBackground:"--agent-surface",surfaceElevatedBackground:"--agent-surface-elevated",inputBackground:"--agent-input-bg",border:"--agent-border",borderStrong:"--agent-border-strong",text:"--agent-text",mutedText:"--agent-muted",softText:"--agent-soft",accent:"--agent-accent",accentSoft:"--agent-accent-soft",danger:"--agent-danger",shadow:"--agent-shadow"};function Wn(n){if(typeof document>"u")return;const e=document.documentElement;e.dataset.theme=n.isDark?"dark":"light",jo(),e.classList.toggle("dark",n.isDark),e.classList.toggle("electron-dark",n.isDark),e.classList.toggle("light",!n.isDark),e.style.colorScheme=n.isDark?"dark":"light";for(const[t,r]of Object.entries(ta))r&&e.style.setProperty(r,String(n[t]))}function jo(){if(typeof document>"u")return;const n=document.documentElement;n.dataset.codexWindowType="electron",n.dataset.windowType="electron",n.dataset.codexOs=na(),document.body&&(document.body.dataset.codexWindowType="electron")}function na(){if(typeof navigator>"u")return"unknown";const n=navigator,e=(n.userAgentData?.platform??n.platform??n.userAgent).toLowerCase();return e.includes("win")?"win32":e.includes("mac")||e.includes("darwin")?"darwin":e.includes("linux")?"linux":"unknown"}const Hn=new Set;class Ko extends Error{code;constructor(e,t){super(e),this.name="NativeBridgeError",this.code=t}}typeof window<"u"&&(window.cmuxAgentBridge={applyTheme(n){Wn(n)},receive(n){n.type==="app.theme"&&Wn(n.theme);for(const e of Hn)e(n)}});function ra(n){return Hn.add(n),()=>{Hn.delete(n)}}async function qe(n,e={}){if(typeof window>"u")throw new Error("Native bridge is unavailable.");const t=window.webkit?.messageHandlers?.agentSession;if(!t||typeof t.postMessage!="function")throw new Error("Native bridge is unavailable.");const r=await t.postMessage({id:lt(),method:n,params:e});if(!r.ok)throw new Ko(r.error?.userMessage||"Native bridge request failed.",r.error?.code);return r.value}const ee="border-token-border user-select-none no-drag cursor-interaction flex items-center gap-1 border whitespace-nowrap focus:outline-none disabled:cursor-not-allowed disabled:opacity-40",te="text-token-text-tertiary enabled:hover:bg-token-list-hover-background data-[state=open]:bg-token-list-hover-background border-transparent",Oe="h-token-button-composer px-2 py-0 text-sm leading-[18px]",oa="h-token-button-composer-sm px-1.5 py-0 text-sm leading-[18px]",ln="electron:p-1 electron:[&>svg]:icon-sm flex items-center justify-center p-0.5",Kt="aspect-square items-center justify-center !px-0",ia="focus-visible:outline-token-button-background cursor-interaction size-token-button-composer flex items-center justify-center rounded-full p-0.5 transition-opacity focus-visible:outline-2 bg-token-foreground",sa="agent-composer-stack",aa="codex-composer-frame relative",la="codex-composer-inner relative z-10 flex min-h-0 flex-1 flex-col",ca="codex-composer-surface relative flex flex-col bg-token-input-background/90 backdrop-blur-lg extension:border extension:border-token-border/50 electron:ring electron:ring-black/10 electron:shadow-[0_4px_16px_0_rgba(0,0,0,0.05)] electron:dark:bg-token-dropdown-background",da="composer-footer grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 px-2 py-1",ua="composer-footer grid grid-cols-[minmax(0,auto)_auto_minmax(0,1fr)] items-center gap-[5px] mb-2 px-2",Zo="M16.6182 9.33203H3.38184V12.7002C3.38184 13.3753 3.38238 13.8438 3.41211 14.208C3.44124 14.5646 3.49494 14.766 3.57129 14.916L3.63867 15.0361C3.80618 15.3094 4.04683 15.5324 4.33399 15.6787L4.45703 15.7314C4.59362 15.7803 4.77411 15.816 5.04199 15.8379C5.40624 15.8676 5.87469 15.8682 6.54981 15.8682H13.4502C14.1253 15.8682 14.5938 15.8676 14.958 15.8379C15.3146 15.8088 15.516 15.7551 15.666 15.6787L15.7861 15.6113C16.0594 15.4438 16.2824 15.2032 16.4287 14.916L16.4814 14.793C16.5303 14.6564 16.566 14.4759 16.5879 14.208C16.6176 13.8438 16.6182 13.3753 16.6182 12.7002V9.33203ZM17.8818 12.7002C17.8818 13.3547 17.8826 13.8838 17.8477 14.3115C17.8165 14.6922 17.7543 15.0349 17.6172 15.3545L17.5537 15.4902C17.3015 15.9852 16.9182 16.3996 16.4473 16.6885L16.2402 16.8037C15.8824 16.9861 15.4966 17.0621 15.0615 17.0977C14.6338 17.1326 14.1047 17.1318 13.4502 17.1318H6.54981C5.89526 17.1318 5.36616 17.1326 4.93848 17.0977C4.55777 17.0665 4.21506 17.0043 3.89551 16.8672L3.75977 16.8037C3.26483 16.5515 2.85036 16.1682 2.56152 15.6973L2.44629 15.4902C2.26394 15.1324 2.1879 14.7466 2.15235 14.3115C2.1174 13.8838 2.11817 13.3547 2.11817 12.7002V7.29981C2.11817 6.64526 2.1174 6.11616 2.15235 5.68848C2.1879 5.25344 2.26394 4.86765 2.44629 4.50977L2.56152 4.30274C2.85036 3.83179 3.26483 3.44854 3.75977 3.19629L3.89551 3.13281C4.21506 2.99571 4.55777 2.93346 4.93848 2.90235C5.36616 2.8674 5.89526 2.86817 6.54981 2.86817H7.24512C7.38876 2.86816 7.48717 2.86807 7.58399 2.87402L7.83496 2.90039C8.41501 2.98537 8.96006 3.23832 9.40039 3.63086L9.64356 3.86817C9.75546 3.98103 9.79343 4.0181 9.83008 4.05078L9.94238 4.14356C10.2142 4.34787 10.5413 4.46917 10.8828 4.49024L11.1445 4.49317H13.4502C14.1047 4.49317 14.6338 4.4924 15.0615 4.52735C15.4966 4.5629 15.8824 4.63894 16.2402 4.82129L16.4473 4.93652C16.9182 5.22536 17.3015 5.63983 17.5537 6.13477L17.6172 6.27051C17.7543 6.59006 17.8165 6.93277 17.8477 7.31348C17.8826 7.74116 17.8818 8.27026 17.8818 8.92481V12.7002ZM3.38184 8.06836H16.6143C16.6105 7.81516 16.603 7.60256 16.5879 7.41699C16.566 7.14911 16.5303 6.96862 16.4814 6.83203L16.4287 6.70899C16.2824 6.42183 16.0594 6.18118 15.7861 6.01367L15.666 5.94629C15.516 5.86994 15.3146 5.81624 14.958 5.78711C14.5938 5.75738 14.1253 5.75684 13.4502 5.75684H11.1445L10.8047 5.75098C10.2158 5.71466 9.65236 5.50645 9.1836 5.1543L8.98926 4.99414C8.91673 4.92948 8.84746 4.85908 8.7461 4.75684L8.55957 4.57422C8.30416 4.34653 7.98784 4.19959 7.65137 4.15039L7.50684 4.13477C7.45779 4.13174 7.4043 4.13184 7.24512 4.13184H6.54981C5.87469 4.13184 5.40624 4.13238 5.04199 4.16211C4.77411 4.184 4.59362 4.21966 4.45703 4.26856L4.33399 4.32129C4.04683 4.4676 3.80618 4.69061 3.63867 4.96387L3.57129 5.08399C3.49494 5.23405 3.44124 5.43543 3.41211 5.79199C3.38238 6.15624 3.38184 6.62469 3.38184 7.29981V8.06836Z",pa=32;function fa(n){return n.hasVisibleAttachments||n.isEditorMultiline||n.isVoiceLayoutActive?!1:n.singleLineInputWidth==null?!0:n.singleLineTextWidth+pa<=n.singleLineInputWidth}function Yo(n){const e={};for(const t of n)e[t.id]={hideControl:!1,hideLabel:!1};return e}function ha(n){const e=n.items.filter(s=>s.enabled),t=Yo(n.items);if(e.length===0||n.availableWidth<=0)return t;const r=e.reduce((s,a)=>s+a.expandedWidth,0)+n.gap*Math.max(0,e.length-1);if(r<=0)return t;let o=r;for(const s of e)!s.canHideLabel||n.availableWidth>=o||(t[s.id].hideLabel=!0,o-=s.expandedWidth-s.compactWidth);if(ga(t,n.previousState,"hideLabel"))return t;let i=e.length;for(const s of e){const a=t[s.id],l=a.hideLabel?s.compactWidth:s.expandedWidth;(a.hideLabel&&!s.hasMeasuredCompactWidth||n.availableWidth1?n.gap:0),i-=1)}return t}function ma(n,e){const t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;for(const o of t)if(n[o]?.hideControl!==e[o]?.hideControl||n[o]?.hideLabel!==e[o]?.hideLabel)return!1;return!0}function ga(n,e,t){const r=Object.keys(n);return r.length!==Object.keys(e).length?!0:r.some(o=>n[o]?.[t]!==e[o]?.[t])}const xa=new Set(["base","embed","form","iframe","link","meta","object","script","style"]),ba=new Set(["poster","src","srcset","xlink:href"]);function ya(n){const e=typeof window>"u"?void 0:window.marked;if(e?.parse)try{const t=e.parse(ka(n),{async:!1,breaks:!0,gfm:!0});if(typeof t=="string")return Ma(t)}catch{return Be(n)}return Be(n)}function ka(n){let e="",t=null;const r=n.match(/[^\r\n]*(?:\r\n|\n|\r|$)/g)??[];for(const o of r){if(o==="")continue;const i=o.match(/(\r\n|\n|\r)$/)?.[0]??"",s=i?o.slice(0,-i.length):o;if(t){e+=s+i,Ca(s,t)&&(t=null);continue}const a=va(s);if(a){t=a,e+=s+i;continue}e+=Sa(s)+i}return e}function Be(n){return wa(n).replace(/\n/g,"
")}function wa(n){return n.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function va(n){const e=/^( {0,3})(`{3,}|~{3,})/.exec(n);if(!e)return null;const t=e[2];return{character:t[0],length:t.length}}function Ca(n,e){const t=/^( {0,3})(`{3,}|~{3,})\s*$/.exec(n);if(!t)return!1;const r=t[2];return r[0]===e.character&&r.length>=e.length}function Sa(n){let e="",t=0,r=0;for(;r"u")return n;const e=document.createElement("template");e.innerHTML=n;for(const t of Array.from(e.content.querySelectorAll("*"))){if(xa.has(t.localName)){t.remove();continue}for(const r of Array.from(t.attributes)){const o=r.name.toLowerCase();if(o.startsWith("on")||o==="srcdoc"||o==="style"){t.removeAttribute(r.name);continue}const i=Na(t.localName,o,r.value);i===null?t.removeAttribute(r.name):typeof i=="string"&&i!==r.value&&t.setAttribute(r.name,i)}t.localName==="a"&&t.setAttribute("rel","noreferrer")}return e.innerHTML}function Na(n,e,t){const r=e.toLowerCase();if(ba.has(r))return null;if(r==="href")return n.toLowerCase()!=="a"?null:Oa(t)?t:null}function Oa(n){const e=n.trim();if(e.startsWith("#"))return!0;if(e.startsWith("/")||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(e))return!1;try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"||t.protocol==="mailto:"}catch{return!1}}function Go(n){return n.replace(/([\\[\]])/g,"\\$1")}function Xo(n){return encodeURI(n).replace(/([\\()])/g,"\\$1")}function Ta(n,e){const t=e.map(r=>`[${Go(r.label)}](${Xo(r.path)})`).join(" ");return t?n.trim().length>0?`${t} +import{R as nt,i as b,b as Et,c as Ks,j as Pr,a as Zs}from"./vendor.mjs";import{a as Wn,m as at,c as xt,r as Ys,b as Gs}from"./markdown.mjs";import{i as Xs,c as Qs}from"./installWebviewStyles.mjs";function ea(n){if(n.activityStatus==="stopped"||n.activityStatus==="failed")return"!";switch(n.activityKind){case"command":return"$";case"fileChange":return"+";default:return"*"}}const Hn=new Set;class Uo extends Error{code;constructor(e,t){super(e),this.name="NativeBridgeError",this.code=t}}typeof window<"u"&&(window.cmuxAgentBridge={applyTheme(n){Wn(n)},receive(n){n.type==="app.theme"&&Wn(n.theme);for(const e of Hn)e(n)}});function ta(n){return Hn.add(n),()=>{Hn.delete(n)}}async function He(n,e={}){if(typeof window>"u")throw new Error("Native bridge is unavailable.");const t=window.webkit?.messageHandlers?.agentSession;if(!t||typeof t.postMessage!="function")throw new Error("Native bridge is unavailable.");const r=await t.postMessage({id:at(),method:n,params:e});if(!r.ok)throw new Uo(r.error?.userMessage||"Native bridge request failed.",r.error?.code);return r.value}const ee="border-token-border user-select-none no-drag cursor-interaction flex items-center gap-1 border whitespace-nowrap focus:outline-none disabled:cursor-not-allowed disabled:opacity-40",te="text-token-text-tertiary enabled:hover:bg-token-list-hover-background data-[state=open]:bg-token-list-hover-background border-transparent",Oe="h-token-button-composer px-2 py-0 text-sm leading-[18px]",na="h-token-button-composer-sm px-1.5 py-0 text-sm leading-[18px]",ln="electron:p-1 electron:[&>svg]:icon-sm flex items-center justify-center p-0.5",Kt="aspect-square items-center justify-center !px-0",ra="focus-visible:outline-token-button-background cursor-interaction size-token-button-composer flex items-center justify-center rounded-full p-0.5 transition-opacity focus-visible:outline-2 bg-token-foreground",oa="agent-composer-stack",ia="codex-composer-frame relative",sa="codex-composer-inner relative z-10 flex min-h-0 flex-1 flex-col",aa="codex-composer-surface relative flex flex-col bg-token-input-background/90 backdrop-blur-lg extension:border extension:border-token-border/50 electron:ring electron:ring-black/10 electron:shadow-[0_4px_16px_0_rgba(0,0,0,0.05)] electron:dark:bg-token-dropdown-background",la="composer-footer grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 px-2 py-1",ca="composer-footer grid grid-cols-[minmax(0,auto)_auto_minmax(0,1fr)] items-center gap-[5px] mb-2 px-2",jo="M16.6182 9.33203H3.38184V12.7002C3.38184 13.3753 3.38238 13.8438 3.41211 14.208C3.44124 14.5646 3.49494 14.766 3.57129 14.916L3.63867 15.0361C3.80618 15.3094 4.04683 15.5324 4.33399 15.6787L4.45703 15.7314C4.59362 15.7803 4.77411 15.816 5.04199 15.8379C5.40624 15.8676 5.87469 15.8682 6.54981 15.8682H13.4502C14.1253 15.8682 14.5938 15.8676 14.958 15.8379C15.3146 15.8088 15.516 15.7551 15.666 15.6787L15.7861 15.6113C16.0594 15.4438 16.2824 15.2032 16.4287 14.916L16.4814 14.793C16.5303 14.6564 16.566 14.4759 16.5879 14.208C16.6176 13.8438 16.6182 13.3753 16.6182 12.7002V9.33203ZM17.8818 12.7002C17.8818 13.3547 17.8826 13.8838 17.8477 14.3115C17.8165 14.6922 17.7543 15.0349 17.6172 15.3545L17.5537 15.4902C17.3015 15.9852 16.9182 16.3996 16.4473 16.6885L16.2402 16.8037C15.8824 16.9861 15.4966 17.0621 15.0615 17.0977C14.6338 17.1326 14.1047 17.1318 13.4502 17.1318H6.54981C5.89526 17.1318 5.36616 17.1326 4.93848 17.0977C4.55777 17.0665 4.21506 17.0043 3.89551 16.8672L3.75977 16.8037C3.26483 16.5515 2.85036 16.1682 2.56152 15.6973L2.44629 15.4902C2.26394 15.1324 2.1879 14.7466 2.15235 14.3115C2.1174 13.8838 2.11817 13.3547 2.11817 12.7002V7.29981C2.11817 6.64526 2.1174 6.11616 2.15235 5.68848C2.1879 5.25344 2.26394 4.86765 2.44629 4.50977L2.56152 4.30274C2.85036 3.83179 3.26483 3.44854 3.75977 3.19629L3.89551 3.13281C4.21506 2.99571 4.55777 2.93346 4.93848 2.90235C5.36616 2.8674 5.89526 2.86817 6.54981 2.86817H7.24512C7.38876 2.86816 7.48717 2.86807 7.58399 2.87402L7.83496 2.90039C8.41501 2.98537 8.96006 3.23832 9.40039 3.63086L9.64356 3.86817C9.75546 3.98103 9.79343 4.0181 9.83008 4.05078L9.94238 4.14356C10.2142 4.34787 10.5413 4.46917 10.8828 4.49024L11.1445 4.49317H13.4502C14.1047 4.49317 14.6338 4.4924 15.0615 4.52735C15.4966 4.5629 15.8824 4.63894 16.2402 4.82129L16.4473 4.93652C16.9182 5.22536 17.3015 5.63983 17.5537 6.13477L17.6172 6.27051C17.7543 6.59006 17.8165 6.93277 17.8477 7.31348C17.8826 7.74116 17.8818 8.27026 17.8818 8.92481V12.7002ZM3.38184 8.06836H16.6143C16.6105 7.81516 16.603 7.60256 16.5879 7.41699C16.566 7.14911 16.5303 6.96862 16.4814 6.83203L16.4287 6.70899C16.2824 6.42183 16.0594 6.18118 15.7861 6.01367L15.666 5.94629C15.516 5.86994 15.3146 5.81624 14.958 5.78711C14.5938 5.75738 14.1253 5.75684 13.4502 5.75684H11.1445L10.8047 5.75098C10.2158 5.71466 9.65236 5.50645 9.1836 5.1543L8.98926 4.99414C8.91673 4.92948 8.84746 4.85908 8.7461 4.75684L8.55957 4.57422C8.30416 4.34653 7.98784 4.19959 7.65137 4.15039L7.50684 4.13477C7.45779 4.13174 7.4043 4.13184 7.24512 4.13184H6.54981C5.87469 4.13184 5.40624 4.13238 5.04199 4.16211C4.77411 4.184 4.59362 4.21966 4.45703 4.26856L4.33399 4.32129C4.04683 4.4676 3.80618 4.69061 3.63867 4.96387L3.57129 5.08399C3.49494 5.23405 3.44124 5.43543 3.41211 5.79199C3.38238 6.15624 3.38184 6.62469 3.38184 7.29981V8.06836Z",da=32;function ua(n){return n.hasVisibleAttachments||n.isEditorMultiline||n.isVoiceLayoutActive?!1:n.singleLineInputWidth==null?!0:n.singleLineTextWidth+da<=n.singleLineInputWidth}function Ko(n){const e={};for(const t of n)e[t.id]={hideControl:!1,hideLabel:!1};return e}function pa(n){const e=n.items.filter(s=>s.enabled),t=Ko(n.items);if(e.length===0||n.availableWidth<=0)return t;const r=e.reduce((s,a)=>s+a.expandedWidth,0)+n.gap*Math.max(0,e.length-1);if(r<=0)return t;let o=r;for(const s of e)!s.canHideLabel||n.availableWidth>=o||(t[s.id].hideLabel=!0,o-=s.expandedWidth-s.compactWidth);if(fa(t,n.previousState,"hideLabel"))return t;let i=e.length;for(const s of e){const a=t[s.id],l=a.hideLabel?s.compactWidth:s.expandedWidth;(a.hideLabel&&!s.hasMeasuredCompactWidth||n.availableWidth1?n.gap:0),i-=1)}return t}function ha(n,e){const t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;for(const o of t)if(n[o]?.hideControl!==e[o]?.hideControl||n[o]?.hideLabel!==e[o]?.hideLabel)return!1;return!0}function fa(n,e,t){const r=Object.keys(n);return r.length!==Object.keys(e).length?!0:r.some(o=>n[o]?.[t]!==e[o]?.[t])}function Zo(n){return n.replace(/([\\[\]])/g,"\\$1")}function Yo(n){return encodeURI(n).replace(/([\\()])/g,"\\$1")}function ma(n,e){const t=e.map(r=>`[${Zo(r.label)}](${Yo(r.path)})`).join(" ");return t?n.trim().length>0?`${t} -${n}`:t:n}function $t(n){switch(n.kind){case"at":return Sn(n.label??n.name,n.path);case"agent":return Sn(`@${n.displayName||n.name}`,n.path);case"skill":return Sn(`$${n.name}`,n.path)}}function Da(n,e,t){if(!t||e==null)return n;const r=$t(e);return n.includes(r)||n.includes(e.path)?n:n.trim().length>0?`${r} +${n}`:t:n}function $t(n){switch(n.kind){case"at":return Sn(n.label??n.name,n.path);case"agent":return Sn(`@${n.displayName||n.name}`,n.path);case"skill":return Sn(`$${n.name}`,n.path)}}function ga(n,e,t){if(!t||e==null)return n;const r=$t(e);return n.includes(r)||n.includes(e.path)?n:n.trim().length>0?`${r} -${n}`:r}function Sn(n,e){return`[${Go(n)}](${Xo(e)})`}const Fr="[$plan](skill://plan)";function Ea(n,e){return!e||Aa(n)?n:n.trim().length>0?`${n} +${n}`:r}function Sn(n,e){return`[${Zo(n)}](${Yo(e)})`}const zr="[$plan](skill://plan)";function xa(n,e){return!e||ba(n)?n:n.trim().length>0?`${n} -${Fr}`:Fr}function Aa(n){return n.includes("skill://plan")||/(?:^|\s)\$plan(?:\s|$)/.test(n)}function Ia(n){return n?.id==="codex"?"GPT-5.5":n?.displayName??"GPT-5.5"}function Ra(n){const e=n.displayName,t=e.toLowerCase();return n.id==="claude"||t.includes("claude")?"Cl":n.id==="opencode"||t.includes("open")?"O":t==="pi"||t.includes(" pi")?"Pi":e.trim().slice(0,1).toUpperCase()||"C"}function La(n){const e=n.usedPercent,t=n.remainingPercent,r=e!=null&&Number.isFinite(e)?ht(e):ht(100-(t??0)),o=t!=null&&Number.isFinite(t)?ht(t):ht(100-r);return{...n,remainingPercent:o,usedPercent:r,windowDurationMins:Number.isFinite(n.windowDurationMins)?n.windowDurationMins:void 0}}function Qo(n){return Number.isFinite(n)?`${Math.round(ht(n))}%`:"100%"}function ei(n,e=new Date){if(n==null||!Number.isFinite(n))return null;const t=new Date(n*1e3);if(!Number.isFinite(t.getTime()))return null;const r=Math.floor((t.getTime()-e.getTime())/1e3);return r>0&&r<3600?new Intl.DateTimeFormat(void 0,{timeStyle:"short"}).format(t):Pa(t,e)?new Intl.DateTimeFormat(void 0,{timeStyle:"short"}).format(t):new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(t)}function ti(n,e,t){if(n==null||!Number.isFinite(n)||n<=0)return e;const r=Math.round(n);return Br(n,720*60)?t?.monthly??e:Br(n,10080)?t?.weekly??e:r>=1440?Mn(t?.daysFormat,Math.ceil(r/1440),e):r>=60?Mn(t?.hoursFormat,Math.ceil(r/60),e):Mn(t?.minutesFormat,Math.max(1,Math.ceil(r)),e)}function ht(n){return Number.isFinite(n)?Math.min(Math.max(n,0),100):100}function Br(n,e){return n>=e*.95&&n<=e*1.05}function Pa(n,e){return n.getFullYear()===e.getFullYear()&&n.getMonth()===e.getMonth()&&n.getDate()===e.getDate()}function Mn(n,e,t){const r=new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e);return n==null||n.length===0?t:n.replaceAll("%@",r).replaceAll("%d",r).replaceAll("{value}",r)}const Vr=256*1024,_r=64*1024,za=8*1024,$r=`[earlier assistant output truncated] -`,Wr=`[earlier command output truncated] -`,Fa=`[earlier log output truncated] -`;function Ba(n){return{selectedProviderId:"codex",status:"loading",input:"",providers:[],log:[],transcript:[],autoStartAttemptedProviderIds:[],seenSessionIds:[]}}function Va(n,e){switch(e.type){case"context":return Ga({...n,context:e.context,selectedProviderId:e.context.initialProviderId,status:"idle"});case"providers":return{...n,providers:e.providers};case"selectProvider":return ar(n)?{...n,selectedProviderId:e.providerId}:n;case"setInput":return{...n,input:e.input};case"autoStartAttempted":return n.autoStartAttemptedProviderIds.includes(e.providerId)?n:{...n,autoStartAttemptedProviderIds:[...n.autoStartAttemptedProviderIds,e.providerId]};case"starting":return{...n,status:"starting",log:de(n,"info",ue(n,"startingStatus","Starting"))};case"startAccepted":return n.status!=="starting"||n.runningSessionId?n:{...n,runningSessionId:e.sessionId,requestedStopSessionId:void 0,seenSessionIds:Wt(n,e.sessionId)};case"stopping":return{...n,status:"stopping",requestedStopSessionId:e.sessionId,log:de(n,"info",ue(n,"stoppingStatus","Stopping"))};case"failed":return{...n,status:"failed",log:de(n,"error",e.message),transcript:bt(n,e.message,"error")};case"failedForSession":case"sendFailed":return n.runningSessionId!==e.sessionId||n.requestedStopSessionId===e.sessionId?n:{...n,status:"failed",log:de(n,"error",e.message),transcript:bt(n,e.message,"error")};case"stopFailed":return n.runningSessionId!==e.sessionId&&n.requestedStopSessionId!==e.sessionId?n:{...n,requestedStopSessionId:void 0,status:"failed",log:de(n,"error",e.message),transcript:bt(n,e.message,"error")};case"sent":return n.runningSessionId!==e.sessionId||n.requestedStopSessionId===e.sessionId?n:{...n,input:n.input===e.submittedInput?"":n.input,log:de(n,"info",Zt(n,"sentCharsFormat","Sent %d chars",e.text.length)),transcript:Xa(n,e.displayText??e.text,e.attachments,e.sentAtMs)};case"event":return Za(n,e.event);default:return n}}async function _a(n){try{const[e,t]=await Promise.all([qe("app.context"),qe("provider.list")]);Wn(e.theme),n({type:"context",context:e}),n({type:"providers",providers:t})}catch(e){n({type:"failed",message:At(e)})}}async function $a(n,e){sr(n)&&await ri(ni(n),e)}function ni(n){return{providerId:n.selectedProviderId,workingDirectory:n.context?.workingDirectory,copy:n.context?.copy}}async function ri(n,e){e({type:"starting"});try{const t=await qe("provider.start",{providerId:n.providerId,workingDirectory:n.workingDirectory});e({type:"startAccepted",sessionId:t.sessionId})}catch(t){e({type:"failed",message:At(t,n.copy)})}}function Wa(n){return!sr(n)||n.autoStartAttemptedProviderIds.includes(n.selectedProviderId)?!1:n.providers.find(t=>t.id===n.selectedProviderId)?.autoStart===!0}async function Ha(n,e){if(!Wa(n))return;const t=n.selectedProviderId,r=ni(n);e({type:"autoStartAttempted",providerId:t}),await ri(r,e)}function qa(n,e,t){ar(e)&&(t({type:"selectProvider",providerId:n}),qe("provider.select",{providerId:n}).catch(()=>{}))}async function Ja(n,e,t={}){const r=t.text??n.input,o=t.clearInput??r;if(r.length===0||!n.runningSessionId||n.status!=="running")return!1;const i=n.runningSessionId;try{return await qe("provider.writeLine",{permissionMode:t.permissionMode??"default",sessionId:i,text:r}),e({type:"sent",attachments:t.attachments,displayText:t.displayText,sentAtMs:Date.now(),sessionId:i,text:r,submittedInput:o}),!0}catch(s){return nl(s)||e({type:"sendFailed",sessionId:i,message:At(s,n)}),!1}}async function Ua(n,e){if(!n.runningSessionId||n.status==="stopping")return;const t=n.runningSessionId;e({type:"stopping",sessionId:t});try{await qe("provider.stop",{sessionId:t})}catch(r){e({type:"stopFailed",sessionId:t,message:At(r,n)})}}function ja(n){switch(n.status){case"loading":return ue(n,"loadingStatus","Loading");case"idle":return ue(n,"idleStatus","Idle");case"starting":return ue(n,"startingStatus","Starting");case"running":return ue(n,"runningStatus","Running");case"stopping":return ue(n,"stoppingStatus","Stopping");case"failed":return ue(n,"failedStatus","Failed")}}function sr(n){return(n.status==="idle"||n.status==="failed")&&!n.runningSessionId&&!!n.context}function ar(n){return!n.runningSessionId&&n.status!=="starting"&&n.status!=="stopping"}function Ka(n){return!!n.runningSessionId&&n.status!=="stopping"}function Za(n,e){switch(e.type){case"app.theme":return n.context?{...n,context:{...n.context,theme:e.theme}}:n;case"app.rateLimitRows":return n.context?{...n,context:{...n.context,rateLimitRows:e.rateLimitRows}}:n;case"provider.started":return e.sessionId===n.requestedStopSessionId||n.runningSessionId&&e.sessionId!==n.runningSessionId||!n.runningSessionId&&n.status!=="starting"||!n.runningSessionId&&e.providerId!==n.selectedProviderId?n:{...n,runningSessionId:e.sessionId,requestedStopSessionId:void 0,seenSessionIds:Wt(n,e.sessionId),status:"running",log:de(n,"info",ue(n,"providerStarted","Provider started"))};case"provider.output":return e.sessionId!==n.runningSessionId?n:{...n,log:de(n,e.stream,e.text),transcript:Qa(n,e)};case"provider.activity":return e.sessionId!==n.runningSessionId?n:{...n,transcript:el(n,e)};case"provider.turnComplete":return e.sessionId!==n.runningSessionId?n:{...n,transcript:zt(n.transcript,e.sessionId)};case"provider.exit":return Ya(n,e)?e.sessionId===n.requestedStopSessionId?{...n,runningSessionId:void 0,requestedStopSessionId:void 0,seenSessionIds:Wt(n,e.sessionId),status:"idle",log:de(n,"info",ue(n,"stopped","Stopped")),transcript:zt(n.transcript,e.sessionId)}:{...n,runningSessionId:void 0,requestedStopSessionId:void 0,seenSessionIds:Wt(n,e.sessionId),status:e.status===0?"idle":"failed",log:de(n,e.status===0?"info":"error",Zt(n,"providerExitedFormat","Provider exited %d",e.status)),transcript:e.status===0?zt(n.transcript,e.sessionId):bt({...n,transcript:zt(n.transcript,e.sessionId)},Zt(n,"providerExitedFormat","Provider exited %d",e.status),"error")}:n;default:return n}}function Ya(n,e){return e.sessionId===n.runningSessionId?!0:!n.seenSessionIds.includes(e.sessionId)&&n.status==="starting"&&!n.runningSessionId&&e.providerId===n.selectedProviderId}function Wt(n,e){return n.seenSessionIds.includes(e)?n.seenSessionIds:[...n.seenSessionIds,e].slice(-50)}function Ga(n){const e=n.context?.renderer==="solid"?"Solid":"React";return{...n,log:de(n,"info",Zt(n,"rendererReadyFormat","%@ ready",e))}}function de(n,e,t){return[...n.log,{id:lt(),level:e,text:dn(t,za,Fa)}].slice(-300)}function Xa(n,e,t,r){return cn(n.transcript,{attachments:t,id:lt(),role:"user",sentAtMs:r,text:e})}function Qa(n,e){if(e.stream!=="stdout")return bt(n,e.text,"warning");const t=n.transcript.at(-1);return t?.role==="assistant"&&t.sessionId===e.sessionId?[...n.transcript.slice(0,-1),{...t,isComplete:!1,text:oi(t.text,e.text,Vr,$r)}]:cn(n.transcript,{id:lt(),role:"assistant",isComplete:!1,sessionId:e.sessionId,sentAtMs:Date.now(),text:dn(e.text,Vr,$r)})}function zt(n,e){let t=!1;const r=n.map(o=>o.role!=="assistant"||o.sessionId!==e||o.isComplete===!0?o:(t=!0,{...o,isComplete:!0}));return t?r:n}function el(n,e){const t=tl(n.transcript,e.sessionId,e.activityId);if(t>=0){const r=n.transcript[t];return[...n.transcript.slice(0,t),{...r,text:e.action,detail:e.detail??r.detail,activityKind:e.kind,activityStatus:e.status,output:e.outputDelta===void 0?r.output:oi(r.output??"",e.outputDelta,_r,Wr)},...n.transcript.slice(t+1)]}return cn(n.transcript,{id:lt(),role:"activity",text:e.action,detail:e.detail,sessionId:e.sessionId,activityId:e.activityId,activityKind:e.kind,activityStatus:e.status,output:e.outputDelta===void 0?void 0:dn(e.outputDelta,_r,Wr)})}function tl(n,e,t){for(let r=n.length-1;r>=0;r-=1){const o=n[r];if(o.role==="activity"&&o.sessionId===e&&o.activityId===t)return r}return-1}function bt(n,e,t){return cn(n.transcript,{id:lt(),role:"notice",tone:t,text:e})}function cn(n,e){return[...n,e].slice(-200)}function oi(n,e,t,r){const o=n.startsWith(r),i=n.startsWith(r)?n.slice(r.length):n;return o?r+(i+e).slice(-(t-r.length)):dn(i+e,t,r)}function dn(n,e,t){return n.length<=e?n:t+n.slice(-(e-t.length))}function ue(n,e,t){return n.context?.copy[e]??t}function nl(n){return n instanceof Ko&&n.code==="providerNotReady"}function Zt(n,e,t,...r){return rl(ue(n,e,t),r)}function rl(n,e){let t=0;return n.replace(/%(\d+\$)?[@d]/g,(r,o)=>{const i=o?Number(o.slice(0,-1))-1:t++;return String(e[i]??"")})}function At(n,e){const t=ol(e);return n instanceof Error&&n.message?t&&n.message==="Native bridge request failed."?t.requestFailed:n.message:t?.requestFailed??"Native bridge request failed."}function ol(n){if(n)return"providers"in n?n.context?.copy:n}function H(n){this.content=n}H.prototype={constructor:H,find:function(n){for(var e=0;e>1}};H.from=function(n){if(n instanceof H)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new H(e)};function ii(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),i=e.child(r);if(o==i){t+=o.nodeSize;continue}if(!o.sameMarkup(i))return t;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)t++;return t}if(o.content.size||i.content.size){let s=ii(o.content,i.content,t+1);if(s!=null)return s}t+=o.nodeSize}}function si(n,e,t,r){for(let o=n.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:t,b:r};let s=n.child(--o),a=e.child(--i),l=s.nodeSize;if(s==a){t-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:t,b:r};if(s.isText&&s.text!=a.text){let c=0,d=Math.min(s.text.length,a.text.length);for(;ce&&r(l,o+a,i||null,s)!==!1&&l.content.size){let d=a+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,t-d),r,o+d)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let i="",s=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),i=1);ie)for(let i=0,s=0;se&&((st)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,t-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,t-s-1))),r.push(a),o+=a.nodeSize),s=l}return new y(r,o)}cutByIndex(e,t){return e==t?y.empty:e==0&&t==this.content.length?this:new y(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let o=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new y(o,i)}addToStart(e){return new y([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new y(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let o=this.child(t),i=r+o.nodeSize;if(i>=e)return i==e?Ft(t+1,i):Ft(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return y.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return y.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return y.empty;let t,r=0;for(let o=0;othis.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;tr.type.rank-o.type.rank),t}}E.none=[];class Gt extends Error{}class w{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=li(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new w(r,this.openStart,this.openEnd)}removeBetween(e,t){return new w(ai(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return w.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new w(y.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)o++;return new w(e,r,o)}}w.empty=new w(y.empty,0,0);function ai(n,e,t){let{index:r,offset:o}=n.findIndex(e),i=n.maybeChild(r),{index:s,offset:a}=n.findIndex(t);if(o==e||i.isText){if(a!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(ai(i.content,e-o-1,t-o-1)))}function li(n,e,t,r,o,i){let{index:s,offset:a}=n.findIndex(e),l=n.maybeChild(s);if(a==e||l.isText)return i&&r<=0&&o<=0&&!i.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let c=li(l.content,e-a-1,t,s==0?r-1:0,s==n.childCount-1?o-1:0,l);return c&&n.replaceChild(s,l.copy(c))}function il(n,e,t){if(t.openStart>n.depth)throw new Gt("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Gt("Inconsistent open depths");return ci(n,e,t,0)}function ci(n,e,t,r){let o=n.index(r),i=n.node(r);if(o==e.index(r)&&r=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function yt(n,e,t,r){let o=(e||n).node(t),i=0,s=e?e.index(t):o.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Ve(n.nodeAfter,r),i++));for(let a=i;ao&&qn(n,e,o+1),s=r.depth>o&&qn(t,r,o+1),a=[];return yt(null,n,o,a),i&&s&&e.index(o)==t.index(o)?(di(i,s),Ve(_e(i,ui(n,e,t,r,o+1)),a)):(i&&Ve(_e(i,Xt(n,e,o+1)),a),yt(e,t,o,a),s&&Ve(_e(s,Xt(t,r,o+1)),a)),yt(r,null,o,a),new y(a)}function Xt(n,e,t){let r=[];if(yt(null,n,t,r),n.depth>t){let o=qn(n,e,t+1);Ve(_e(o,Xt(n,e,t+1)),r)}return yt(e,null,t,r),new y(r)}function sl(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)o=e.node(i).copy(y.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}class Ct{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let i=0;i0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new cl(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],o=0,i=t;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(i),c=i-l;if(r.push(s,a,o+l),!c||(s=s.child(a),s.isText))break;i=c-1,o+=l+1}return new Ct(t,r,i)}static resolveCached(e,t){let r=Hr.get(e);if(r)for(let i=0;ie&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),pi(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=y.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=o;lt.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=y.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};$e.prototype.text=void 0;class Qt extends $e{constructor(e,t,r,o){if(super(e,t,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):pi(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Qt(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Qt(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function pi(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Je{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new ul(e,t);if(r.next==null)return Je.empty;let o=fi(r);r.next&&r.err("Unexpected trailing text");let i=bl(xl(o));return yl(i,r),i}matchType(e){for(let t=0;tc.createAndFill()));for(let c=0;c=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s"+e.indexOf(r.next[s].next);return i}).join(` -`)}}Je.empty=new Je(!0);class ul{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function fi(n){let e=[];do e.push(pl(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function pl(n){let e=[];do e.push(fl(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function fl(n){let e=gl(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=hl(n,e);else break;return e}function qr(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function hl(n,e){let t=qr(n),r=t;return n.eat(",")&&(n.next!="}"?r=qr(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function ml(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let o=[];for(let i in t){let s=t[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&n.err("No node type or group '"+e+"' found"),o}function gl(n){if(n.eat("(")){let e=fi(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=ml(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function xl(n){let e=[[]];return o(i(n,0),t()),e;function t(){return e.push([])-1}function r(s,a,l){let c={term:l,to:a};return e[s].push(c),c}function o(s,a){s.forEach(l=>l.to=a)}function i(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=i(s.exprs[l],a);if(l==s.exprs.length-1)return c;o(c,a=t())}else if(s.type=="star"){let l=t();return r(a,l),o(i(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=t();return o(i(s.expr,a),l),o(i(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c{n[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let d=0;d{c||o.push([a,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let i=e[r.join(",")]=new Je(r.indexOf(n.length-1)>-1);for(let s=0;s-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:gi(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new $e(this,this.computeAttrs(e),y.from(t),E.setFrom(r))}createChecked(e=null,t,r){return t=y.from(t),this.checkContent(t),new $e(this,this.computeAttrs(e),t,E.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=y.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let o=this.contentMatch.matchFragment(t),i=o&&o.fillBefore(y.empty,!0);return i?new $e(this,e,t.append(i),E.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;tr[i]=new yi(i,t,s));let o=t.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function kl(n,e,t){let r=t.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}class wl{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?kl(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class un{constructor(e,t,r,o){this.name=e,this.rank=t,this.schema=r,this.spec=o,this.attrs=bi(e,o.attrs),this.excluded=null;let i=mi(this.attrs);this.instance=i?new E(this,i):null}create(e=null){return!e&&this.instance?this.instance:new E(this,gi(this.attrs,e))}static compile(e,t){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new un(i,o++,t,s)),r}removeFromSet(e){for(var t=0;t-1}}class vl{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let o in e)t[o]=e[o];t.nodes=H.from(e.nodes),t.marks=H.from(e.marks||{}),this.nodes=Ur.compile(this.spec.nodes,this),this.marks=un.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=Je.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?jr(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:jr(this,s.split(" "))}this.nodeFromJSON=o=>$e.fromJSON(this,o),this.markFromJSON=o=>E.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Ur){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,o)}text(e,t){let r=this.nodes.text;return new Qt(r,r.defaultAttrs,e,E.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function jr(n,e){let t=[];for(let r=0;r-1)&&t.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Cl(n){return n.tag!=null}function Sl(n){return n.style!=null}class St{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(o=>{if(Cl(o))this.tags.push(o);else if(Sl(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new Zr(this,t,!1);return r.addAll(e,E.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Zr(this,t,!0);return r.addAll(e,E.none,t.from,t.to),w.maxOpen(r.finish())}matchTag(e,t,r){for(let o=r?this.tags.indexOf(r)+1:0;oe.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(s.getAttrs){let l=s.getAttrs(t);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let t=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s{r(s=Yr(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Yr(s)),s.node||s.ignore||s.mark||(s.node=o)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new St(e,St.schemaRules(e)))}}const ki={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Ml={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},wi={ol:!0,ul:!0},Mt=1,Un=2,kt=4;function Kr(n,e,t){return e!=null?(e?Mt:0)|(e==="full"?Un:0):n&&n.whitespace=="pre"?Mt|Un:t&~kt}class Bt{constructor(e,t,r,o,i,s){this.type=e,this.attrs=t,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=E.none,this.match=i||(s&kt?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(y.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Mt)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let t=y.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(y.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ki.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Zr{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=t.topNode,i,s=Kr(null,t.preserveWhitespace,0)|(r?kt:0);o?i=new Bt(o.type,o.attrs,E.none,!0,t.topMatch||o.type.contentMatch,s):r?i=new Bt(null,null,E.none,!0,null,s):i=new Bt(e.schema.topNodeType,null,E.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,o=this.top,i=o.options&Un?"full":this.localPreserveWS||(o.options&Mt)>0,{schema:s}=this.parser;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,` -`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,r,o){let i,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,t.attrs||null,r,t.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[t.mark];r=r.concat(l.create(t.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}i&&this.sync(a)&&this.open--}addAll(e,t,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=o==null?null:e.childNodes[o];s!=a;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t,r){let o,i;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!o||o.length>c.length+a)&&(o=c,i=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!o)return null;this.sync(i);for(let s=0;s(s.type?s.type.allowsMarkType(c.type):Gr(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Bt(e,t,l,o,null,a)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Mt)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=i;l--)if(s(a-1,l))return!0;return!1}else{let d=l>0||l==0&&o?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;l--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function Nl(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&wi.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Ol(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Yr(n){let e={};for(let t in n)e[t]=n[t];return e}function Gr(n,e){let t=e.schema.nodes;for(let r in t){let o=t[r];if(!o.allowsMarkType(n))continue;let i=[],s=a=>{i.push(a);for(let l=0;l{if(i.length||s.marks.length){let a=0,l=0;for(;a=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let o=this.marks[e.type.name];return o&&Ht(Vt(r),o(e,t),null,e.attrs)}static renderSpec(e,t,r=null,o){return typeof t=="string"?{dom:e.createTextNode(t)}:Ht(e,t,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ct(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Xr(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Xr(e.marks)}}function Xr(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Vt(n){return n.document||window.document}const Qr=new WeakMap;function Tl(n){let e=Qr.get(n);return e===void 0&&Qr.set(n,e=Dl(n)),e}function Dl(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(t=o.slice(0,s),o=o.slice(s+1));let a,l=t?n.createElementNS(t,o):n.createElement(o),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let p=u.indexOf(" ");p>0?l.setAttributeNS(u.slice(0,p),u.slice(p+1),c[u]):u=="style"&&l.style?l.style.cssText=c[u]:l.setAttribute(u,c[u])}}for(let u=d;ud)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof p=="string")l.appendChild(n.createTextNode(p));else{let{dom:h,contentDOM:m}=Ht(n,p,t,r);if(l.appendChild(h),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const vi=65535,Ci=Math.pow(2,16);function El(n,e){return n+e*Ci}function eo(n){return n&vi}function Al(n){return(n-(n&vi))/Ci}const Si=1,Mi=2,qt=4,Ni=8;class jn{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Ni)>0}get deletedBefore(){return(this.delInfo&(Si|qt))>0}get deletedAfter(){return(this.delInfo&(Mi|qt))>0}get deletedAcross(){return(this.delInfo&qt)>0}}class Q{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Q.empty)return Q.empty}recover(e){let t=0,r=eo(e);if(!this.inverted)for(let o=0;oe)break;let c=this.ranges[a+i],d=this.ranges[a+s],u=l+c;if(e<=u){let p=c?e==l?-1:e==u?1:t:t,h=l+o+(p<0?0:d);if(r)return h;let m=e==(t<0?l:u)?null:El(a/3,e-l),g=e==l?Mi:e==u?Si:qt;return(t<0?e!=l:e!=u)&&(g|=Ni),new jn(h,g,m)}o+=d-c}return r?e+o:new jn(e+o,0,null)}touches(e,t){let r=0,o=eo(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;ae)break;let c=this.ranges[a+i],d=l+c;if(e<=d&&a==o*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o=0;t--){let o=e.getMirror(t);this.appendMap(e._maps[t].invert(),o!=null&&o>t?r-o-1:void 0)}}invert(){let e=new en;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;ri&&l!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),t.openStart,t.openEnd);return P.fromReplace(e,this.from,this.to,i)}invert(){return new he(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Te(t.pos,r.pos,this.mark)}merge(e){return e instanceof Te&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Te(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Te(t.from,t.to,e.markFromJSON(t.mark))}}K.jsonID("addMark",Te);class he extends K{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new w(lr(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return P.fromReplace(e,this.from,this.to,r)}invert(){return new Te(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new he(t.pos,r.pos,this.mark)}merge(e){return e instanceof he&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new he(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new he(t.from,t.to,e.markFromJSON(t.mark))}}K.jsonID("removeMark",he);class De extends K{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return P.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return P.fromReplace(e,this.pos,this.pos+1,new w(y.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let o=0;or.pos?null:new ne(t.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ne(t.from,t.to,t.gapFrom,t.gapTo,w.fromJSON(e,t.slice),t.insert,!!t.structure)}}K.jsonID("replaceAround",ne);function Kn(n,e,t){let r=n.resolve(e),o=t-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function Il(n,e,t,r){let o=[],i=[],s,a;n.doc.nodesBetween(e,t,(l,c,d)=>{if(!l.isInline)return;let u=l.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let p=Math.max(c,e),h=Math.min(c+l.nodeSize,t),m=r.addToSet(u);for(let g=0;gn.step(l)),i.forEach(l=>n.step(l))}function Rl(n,e,t,r){let o=[],i=0;n.doc.nodesBetween(e,t,(s,a)=>{if(!s.isInline)return;i++;let l=null;if(r instanceof un){let c=s.marks,d;for(;d=r.isInSet(c);)(l||(l=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,t);for(let d=0;dn.step(new he(s.from,s.to,s.style)))}function cr(n,e,t,r=t.contentMatch,o=!0){let i=n.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l=0;l--)n.step(s[l])}function Ll(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function dr(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,o=0,i=0;;--r){let s=n.$from.node(r),a=n.$from.index(r)+o,l=n.$to.indexAfter(r)-i;if(rt;m--)g||r.index(m)>0?(g=!0,d=y.from(r.node(m).copy(d)),u++):l--;let p=y.empty,h=0;for(let m=i,g=!1;m>t;m--)g||o.after(m+1)=0;s--){if(r.size){let a=t[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=y.from(t[s].type.create(t[s].attrs,r))}let o=e.start,i=e.end;n.step(new ne(o,i,o,i,new w(r,0,0),t.length,!0))}function Fl(n,e,t,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,a)=>{let l=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,l)&&Bl(n.doc,n.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?c=!1:!h&&m&&(c=!0)}c===!1&&Ti(n,s,a,i),cr(n,n.mapping.slice(i).map(a,1),r,void 0,c===null);let d=n.mapping.slice(i),u=d.map(a,1),p=d.map(a+s.nodeSize,1);return n.step(new ne(u,p,u+1,p-1,new w(y.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&Oi(n,s,a,i),!1}})}function Oi(n,e,t,r){e.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let l=n.mapping.slice(r).map(t+1+i+s.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Ti(n,e,t,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+i);n.replaceWith(s,s+1,e.type.schema.text(` -`))}})}function Bl(n,e,t){let r=n.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,t)}function Vl(n,e,t,r,o){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(r,null,o||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new ne(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new w(y.from(s),0,0),1,!0))}function Jt(n,e,t=1,r){let o=n.resolve(e),i=o.depth-t,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,d=t-2;c>i;c--,d--){let u=o.node(c),p=o.index(c);if(u.type.spec.isolating)return!1;let h=u.content.cutByIndex(p,u.childCount),m=r&&r[d+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[d]||u;if(!u.canReplace(p+1,u.childCount)||!g.type.validContent(h))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function _l(n,e,t=1,r){let o=n.doc.resolve(e),i=y.empty,s=y.empty;for(let a=o.depth,l=o.depth-t,c=t-1;a>l;a--,c--){i=y.from(o.node(a).copy(i));let d=r&&r[c];s=y.from(d?d.type.create(d.attrs,s):o.node(a).copy(s))}n.step(new _(e,e,new w(i.append(s),t,t),!0))}function Di(n,e){let t=n.resolve(e),r=t.index();return Wl(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function $l(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let o=0;o=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,t))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,t))return r.after(o+1);if(i=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),d=!1;if(i==1)d=c.canReplace(l,l,o);else{let u=c.contentMatchAt(l).findWrapping(o.firstChild.type);d=u&&c.canReplaceWith(l,l,u[0])}if(d)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function ur(n,e,t=e,r=w.empty){if(e==t&&!r.size)return null;let o=n.resolve(e),i=n.resolve(t);return Ei(o,i,r)?new _(e,t,r):new Ul(o,i,r).fit()}function Ei(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Ul{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=y.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=y.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,a=o.depth;for(;s&&a&&i.childCount==1;)i=i.firstChild.content,s--,a--;let l=new w(i,s,a);return e>-1?new ne(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new _(r.pos,o.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,o=this.unplaced.openEnd;r1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Tn(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],d,u=null;if(t==1&&(s?c.matchType(s.type)||(u=c.fillBefore(y.from(s),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:u};if(t==2&&s&&(d=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:d};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Tn(e,t);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new w(e,t+1,Math.max(r,o.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Tn(e,t);if(o.childCount<=1&&t>0){let i=e.size-t<=t+o.size;this.unplaced=new w(mt(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new w(mt(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:o,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let g=0;g1||l==0||g.content.size)&&(u=x,d.push(Ai(g.mark(p.allowedMarks(g.marks)),c==1?l:0,c==a.childCount?h:-1)))}let m=c==a.childCount;m||(h=-1),this.placed=gt(this.placed,t,y.from(d)),this.frontier[t].match=u,m&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,x=a;g1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:o}=this.frontier[t],i=t=0;a--){let{match:l,type:c}=this.frontier[a],d=Dn(e,a,c,l,!0);if(!d||d.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=gt(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,t=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=gt(this.placed,this.depth,y.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(y.empty,!0);t.childCount&&(this.placed=gt(this.placed,this.frontier.length,t))}}function mt(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(mt(n.firstChild.content,e-1,t)))}function gt(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(gt(n.lastChild.content,e-1,t)))}function Tn(n,e){for(let t=0;t1&&(r=r.replaceChild(0,Ai(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(y.empty,!0)))),n.copy(r)}function Dn(n,e,t,r,o){let i=n.node(e),s=o?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!jl(t,i.content,s)?a:null}function jl(n,e,t){for(let r=t;r0;p--,h--){let m=o.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?a=p:o.before(p)==h&&s.splice(1,0,-p)}let l=s.indexOf(a),c=[],d=r.openStart;for(let p=r.content,h=0;;h++){let m=p.firstChild;if(c.push(m),h==r.openStart)break;p=m.content}for(let p=d-1;p>=0;p--){let h=c[p],m=Kl(h.type);if(m&&!h.sameMarkup(o.node(Math.abs(a)-1)))d=p;else if(m||!h.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let h=(p+d+1)%(r.openStart+1),m=c[h];if(m)for(let g=0;g=0&&(n.replace(e,t,r),!(n.steps.length>u));p--){let h=s[p];h<0||(e=o.before(h),t=i.after(h))}}function Ii(n,e,t,r,o){if(er){let i=o.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(y.empty,!0))}return n}function Yl(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=ql(n.doc,e,r.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new w(y.from(r),0,0))}function Gl(n,e,t){let r=n.doc.resolve(e),o=n.doc.resolve(t);if(r.parent.isTextblock&&o.parent.isTextblock&&r.start()!=o.start()&&r.parentOffset==0&&o.parentOffset==0){let s=r.sharedDepth(t),a=!1;for(let l=r.depth;l>s;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=o.depth;l>s;l--)o.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=o.depth;l>0&&t==o.start(l);l--)t=o.before(l);r=n.doc.resolve(e),o=n.doc.resolve(t)}}let i=Ri(r,o);for(let s=0;s0&&(l||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return n.delete(r.before(a),o.after(a))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&o.end(s)-t!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return n.delete(r.before(s),t);n.delete(e,t)}function Ri(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let o=r;o>=0;o--){let i=n.start(o);if(ie.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&t.push(o)}return t}class tt extends K{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return P.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let o=t.type.create(r,null,t.marks);return P.fromReplace(e,this.pos,this.pos+1,new w(y.from(o),0,t.isLeaf?0:1))}getMap(){return Q.empty}invert(e){return new tt(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new tt(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new tt(t.pos,t.attr,t.value)}}K.jsonID("attr",tt);class Nt extends K{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return P.ok(r)}getMap(){return Q.empty}invert(e){return new Nt(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Nt(t.attr,t.value)}}K.jsonID("docAttr",Nt);let ot=class extends Error{};ot=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};ot.prototype=Object.create(Error.prototype);ot.prototype.constructor=ot;ot.prototype.name="TransformError";class Xl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new en}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new ot(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let r=0;r{e=Math.min(e,a),t=Math.max(t,l)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=w.empty){let o=ur(this.doc,e,t,r);return o&&this.step(o),this}replaceWith(e,t,r){return this.replace(e,t,new w(y.from(r),0,0))}delete(e,t){return this.replace(e,t,w.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Zl(this,e,t,r),this}replaceRangeWith(e,t,r){return Yl(this,e,t,r),this}deleteRange(e,t){return Gl(this,e,t),this}lift(e,t){return Pl(this,e,t),this}join(e,t=1){return Hl(this,e,t),this}wrap(e,t){return zl(this,e,t),this}setBlockType(e,t=e,r,o=null){return Fl(this,e,t,r,o),this}setNodeMarkup(e,t,r=null,o){return Vl(this,e,t,r,o),this}setNodeAttribute(e,t,r){return this.step(new tt(e,t,r)),this}setDocAttribute(e,t){return this.step(new Nt(e,t)),this}addNodeMark(e,t){return this.step(new De(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof E)t.isInSet(r.marks)&&this.step(new Ue(e,t));else{let o=r.marks,i,s=[];for(;i=t.isInSet(o);)s.push(new Ue(e,i)),o=i.removeFromSet(o);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(e,t=1,r){return _l(this,e,t,r),this}addMark(e,t,r){return Il(this,e,t,r),this}removeMark(e,t,r){return Rl(this,e,t,r),this}clearIncompatible(e,t,r){return cr(this,e,t,r),this}}const En=Object.create(null);class I{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Ql(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t=0;i--){let s=t<0?Xe(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):Xe(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new se(e.node(0))}static atStart(e){return Xe(e,e,0,0,1)||new se(e)}static atEnd(e){return Xe(e,e,e.content.size,e.childCount,-1)||new se(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=En[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in En)throw new RangeError("Duplicate use of selection JSON ID "+e);return En[e]=t,t.prototype.jsonID=e,t}getBookmark(){return D.between(this.$anchor,this.$head).getBookmark()}}I.prototype.visible=!0;class Ql{constructor(e,t){this.$from=e,this.$to=t}}let to=!1;function no(n){!to&&!n.parent.inlineContent&&(to=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class D extends I{constructor(e,t=e){no(e),no(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return I.near(r);let o=e.resolve(t.map(this.anchor));return new D(o.parent.inlineContent?o:r,r)}replace(e,t=w.empty){if(super.replace(e,t),t==w.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof D&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new pn(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new D(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let o=e.resolve(t);return new this(o,r==t?o:e.resolve(r))}static between(e,t,r){let o=e.pos-t.pos;if((!r||o)&&(r=o>=0?1:-1),!t.parent.inlineContent){let i=I.findFrom(t,r,!0)||I.findFrom(t,-r,!0);if(i)t=i.$head;else return I.near(t,r)}return e.parent.inlineContent||(o==0?e=t:(e=(I.findFrom(e,-r,!0)||I.findFrom(e,r,!0)).$anchor,e.pos0?0:1);o>0?s=0;s+=o){let a=e.child(s);if(a.isAtom){if(!i&&M.isSelectable(a))return M.create(n,t-(o<0?a.nodeSize:0))}else{let l=Xe(n,a,t+o,o<0?a.childCount:0,o,i);if(l)return l}t+=a.nodeSize*o}return null}function ro(n,e,t){let r=n.steps.length-1;if(r{s==null&&(s=d)}),n.setSelection(I.near(n.doc.resolve(s),t))}const oo=1,_t=2,io=4;class tc extends Xl{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=_t,this}ensureMarks(e){return E.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&_t)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~_t,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||E.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let o=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(t);i=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,o.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(I.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=io,this}get scrolledIntoView(){return(this.updated&io)>0}}function so(n,e){return!e||!n?n:n.bind(e)}class xt{constructor(e,t,r){this.name=e,this.init=so(t.init,r),this.apply=so(t.apply,r)}}const nc=[new xt("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new xt("selection",{init(n,e){return n.selection||I.atStart(e.doc)},apply(n){return n.selection}}),new xt("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new xt("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class An{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=nc.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new xt(r.key,r.spec.state,r))})}}class et{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(t[r]=i.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new An(e.schema,e.plugins),i=new et(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=$e.fromJSON(e.schema,t.doc);else if(s.name=="selection")i.selection=I.fromJSON(i.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){i[s.name]=c.fromJSON.call(l,e,t[a],i);return}}i[s.name]=s.init(e,i)}}),i}}function Li(n,e,t){for(let r in n){let o=n[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=Li(o,e,{})),t[r]=o}return t}class rc{constructor(e){this.spec=e,this.props={},e.props&&Li(e.props,this,this.props),this.key=e.key?e.key.key:Pi("plugin")}getState(e){return e[this.key]}}const In=Object.create(null);function Pi(n){return n in In?n+"$"+ ++In[n]:(In[n]=0,n+"$")}class oc{constructor(e="key"){this.key=Pi(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const zi=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function ic(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const sc=(n,e,t)=>{let r=ic(n,t);if(!r)return!1;let o=Fi(r);if(!o){let s=r.blockRange(),a=s&&dr(s);return a==null?!1:(e&&e(n.tr.lift(s,a).scrollIntoView()),!0)}let i=o.nodeBefore;if($i(n,o,e,-1))return!0;if(r.parent.content.size==0&&(it(i,"end")||M.isSelectable(i)))for(let s=r.depth;;s--){let a=ur(n.doc,r.before(s),r.after(s),w.empty);if(a&&a.slice.size1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1};function it(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const ac=(n,e,t)=>{let{$head:r,empty:o}=n.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;i=Fi(r)}let s=i&&i.nodeBefore;return!s||!M.isSelectable(s)?!1:(e&&e(n.tr.setSelection(M.create(n.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Fi(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function lc(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset{let r=lc(n,t);if(!r)return!1;let o=Bi(r);if(!o)return!1;let i=o.nodeAfter;if($i(n,o,e,1))return!0;if(r.parent.content.size==0&&(it(i,"start")||M.isSelectable(i))){let s=ur(n.doc,r.before(),r.after(),w.empty);if(s&&s.slice.size{let{$head:r,empty:o}=n.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset=0;e--){let t=n.node(e);if(n.index(e)+1{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(` -`).scrollIntoView()),!0)};function Vi(n){for(let e=0;e{let t=n.selection,{$from:r,$to:o}=t;if(t instanceof se||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Vi(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index(){let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(Jt(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let r=t.blockRange(),o=r&&dr(r);return o==null?!1:(e&&e(n.tr.lift(r,o).scrollIntoView()),!0)};function hc(n){return(e,t)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof M&&e.selection.node.isBlock)return!r.parentOffset||!Jt(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,a,l=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){l=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),a=Vi(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),i.unshift(l&&a?{type:a}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let d=e.tr;(e.selection instanceof D||e.selection instanceof se)&&d.deleteSelection();let u=d.mapping.map(r.pos),p=Jt(d.doc,u,i.length,i);if(p||(i[0]=a?{type:a}:null,p=Jt(d.doc,u,i.length,i)),!p)return!1;if(d.split(u,i.length,i),!l&&c&&r.node(s).type!=a){let h=d.mapping.map(r.before(s)),m=d.doc.resolve(h);a&&r.node(s-1).canReplaceWith(m.index(),m.index()+1,a)&&d.setNodeMarkup(d.mapping.map(r.before(s)),a)}return t&&t(d.scrollIntoView()),!0}}const _i=hc();function mc(n,e,t){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||Di(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function $i(n,e,t,r){let o=e.nodeBefore,i=e.nodeAfter,s,a,l=o.type.spec.isolating||i.type.spec.isolating;if(!l&&mc(n,e,t))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(a=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&a.matchType(s[0]||i.type).validEnd){if(t){let h=e.pos+i.nodeSize,m=y.empty;for(let k=s.length-1;k>=0;k--)m=y.from(s[k].create(null,m));m=y.from(o.copy(m));let g=n.tr.step(new ne(e.pos-1,h,e.pos,h,new w(m,1,0),s.length,!0)),x=g.doc.resolve(h+2*s.length);x.nodeAfter&&x.nodeAfter.type==o.type&&Di(g.doc,x.pos)&&g.join(x.pos),t(g.scrollIntoView())}return!0}let d=i.type.spec.isolating||r>0&&l?null:I.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),p=u&&dr(u);if(p!=null&&p>=e.depth)return t&&t(n.tr.lift(u,p).scrollIntoView()),!0;if(c&&it(i,"start",!0)&&it(o,"end")){let h=o,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let g=i,x=1;for(;!g.isTextblock;g=g.firstChild)x++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(t){let k=y.empty;for(let N=m.length-1;N>=0;N--)k=y.from(m[N].copy(k));let T=n.tr.step(new ne(e.pos-m.length,e.pos+i.nodeSize,e.pos+x,e.pos+i.nodeSize-x,new w(k,m.length,0),0,!0));t(T.scrollIntoView())}return!0}}return!1}function fr(...n){return function(e,t,r){for(let o=0;o0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=oe(n)}else if(n.parentNode&&!It(n))e=q(n),n=n.parentNode;else return null}}function yc(n,e){for(;;){if(n.nodeType==3&&e2),re=at||(me?/Mac/.test(me.platform):!1),qi=me?/Win/.test(me.platform):!1,we=/Android \d/.test(Le),Rt=!!lo&&"webkitFontSmoothing"in lo.documentElement.style,Cc=Rt?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Sc(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function ye(n,e){return typeof n=="number"?n:n[e]}function Mc(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function co(n,e,t){let r=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let s=t||n.dom;s;){if(s.nodeType!=1){s=st(s);continue}let a=s,l=a==i.body,c=l?Sc(i):Mc(a),d=0,u=0;if(e.topc.bottom-ye(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+ye(o,"top")-c.top:e.bottom-c.bottom+ye(o,"bottom")),e.leftc.right-ye(r,"right")&&(d=e.right-c.right+ye(o,"right")),d||u)if(l)i.defaultView.scrollBy(d,u);else{let h=a.scrollLeft,m=a.scrollTop;u&&(a.scrollTop+=u),d&&(a.scrollLeft+=d);let g=a.scrollLeft-h,x=a.scrollTop-m;e={left:e.left-g,top:e.top-x,right:e.right-g,bottom:e.bottom-x}}let p=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:st(s)}}function Nc(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=t+1;s=t-20){r=a,o=l.top;break}}return{refDOM:r,refTop:o,stack:Ji(n.dom)}}function Ji(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=st(r));return e}function Oc({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Ui(t,r==0?0:r-e)}function Ui(n,e){for(let t=0;t=a){s=Math.max(m.bottom,s),a=Math.min(m.top,a);let g=m.left>e.left?m.left-e.left:m.right=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=d,c={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=u+1)}}return!t&&l&&(t=l,o=c,r=0),t&&t.nodeType==3?Dc(t,o):!t||r&&t.nodeType==1?{node:n,offset:i}:ji(t,o)}function Dc(n,e){let t=n.nodeValue.length,r=document.createRange(),o;for(let i=0;i=(s.left+s.right)/2?1:0)};break}}return r.detach(),o||{node:n,offset:0}}function hr(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Ec(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,o,i)}function Ic(n,e,t,r){let o=-1;for(let i=e,s=!1;i!=n.dom;){let a=n.docView.nearestDesc(i,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!s&&l.left>r.left||l.top>r.top?o=a.posBefore:(!s&&l.right-1?o:n.docView.posFromDOM(e,t,-1)}function Ki(n,e,t){let r=n.childNodes.length;if(r&&t.tope.top&&o++}let c;Rt&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==n.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(a=Ic(n,r,o,e))}a==null&&(a=Ac(n,s,e));let l=n.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function uo(n){return n.top=0&&o==r.nodeValue.length?(l--,d=1):t<0?l--:c++,ft(Se(ke(r,l,c),d),d<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(t<0||o==oe(r))){let l=r.childNodes[o-1];if(l.nodeType==1)return Rn(l.getBoundingClientRect(),!1)}if(i==null&&o=0)}if(i==null&&o&&(t<0||o==oe(r))){let l=r.childNodes[o-1],c=l.nodeType==3?ke(l,oe(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return ft(Se(c,1),!1)}if(i==null&&o=0)}function ft(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function Rn(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Yi(n,e,t){let r=n.state,o=n.root.activeElement;r!=e&&n.updateState(e),o!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),o!=n.dom&&o&&o.focus()}}function Pc(n,e,t){let r=e.selection,o=t=="up"?r.$from:r.$to;return Yi(n,e,()=>{let{node:i}=n.docView.domFromPos(o.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let s=Zi(n,o.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=ke(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;cd.top+1&&(t=="up"?s.top-d.top>(d.bottom-s.top)*2:d.bottom-s.bottom>(s.bottom-d.top)*2))return!1}}return!0})}const zc=/[\u0590-\u08ac]/;function Fc(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=n.domSelection();return a?!zc.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?i:s:Yi(n,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:d,anchorOffset:u}=n.domSelectionRange(),p=a.caretBidiLevel;a.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),x=m&&!h.contains(m.nodeType==1?m:m.parentNode)||l==m&&c==g;try{a.collapse(d,u),l&&(l!=d||c!=u)&&a.extend&&a.extend(l,c)}catch{}return p!=null&&(a.caretBidiLevel=p),x}):r.pos==r.start()||r.pos==r.end()}let po=null,fo=null,ho=!1;function Bc(n,e,t){return po==e&&fo==t?ho:(po=e,fo=t,ho=t=="up"||t=="down"?Pc(n,e,t):Fc(n,e,t))}const le=0,mo=1,ze=2,ge=3;class Lt{constructor(e,t,r,o){this.parent=e,this.children=t,this.dom=r,this.contentDOM=o,this.dirty=le,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;tq(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!t||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;te||s instanceof Xi){o=e-i;break}i=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof Gi&&i.side>=0;r--);if(t<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&t&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?q(i.dom)+1:0}}else{let i,s=!0;for(;i=r=d&&t<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,d);e=s;for(let u=a;u>0;u--){let p=this.children[u-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){o=q(p.dom)+1;break}e-=p.size}o==-1&&(o=0)}if(o>-1&&(c>t||a==this.children.length-1)){t=c;for(let d=a+1;dm&&st){let m=a;a=l,l=m}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,o=0;o=r:er){let a=r+i.border,l=s-i.border;if(e>=a&&t<=l){this.dirty=e==r||t==s?ze:mo,e==a&&t==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=ge:i.markDirty(e-a,t-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?ze:ge}r=s}this.dirty=ze}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?ze:mo;t.dirty{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==le&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Vc extends Lt{constructor(e,t,r,o){super(e,[],t,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Ke extends Lt{constructor(e,t,r,o,i){super(e,[],r,o),this.mark=t,this.spec=i}static create(e,t,r,o){let i=o.nodeViews[t.type.name],s=i&&i(t,o,r);return(!s||!s.dom)&&(s=ct.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new Ke(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&ge||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ge&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=le){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=er(i,0,e,r));for(let a=0;a{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,o),d=c&&c.dom,u=c&&c.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=ct.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!u&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let p=d;return d=ts(d,r,t),c?l=new _c(e,t,r,o,d,u||null,p,c,i,s+1):t.isText?new hn(e,t,r,o,d,p,i):new Ie(e,t,r,o,d,u||null,p,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>y.empty)}return e}matchesNode(e,t,r){return this.dirty==le&&e.eq(this.node)&&tn(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,o=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new Wc(this,s&&s.node,e);Jc(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e,d):c.type.side>=0&&!u&&l.syncToMarks(d==this.node.childCount?E.none:this.node.child(d).marks,r,e,d),l.placeWidget(c,e,o)},(c,d,u,p)=>{l.syncToMarks(c.marks,r,e,p);let h;l.findNodeMatch(c,d,u,p)||a&&e.state.selection.from>o&&e.state.selection.to-1&&l.updateNodeAt(c,d,u,h,e)||l.updateNextNode(c,d,u,e,p,o)||l.addNode(c,d,u,e,o),o+=c.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==ze)&&(s&&this.protectLocalComposition(e,s),Qi(this.contentDOM,this.children,e),at&&Uc(this.dom))}localCompositionInfo(e,t){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof D)||rt+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,a=jc(this.node.content,s,r-t,o-t);return a<0?null:{node:i,pos:a,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:o}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new Vc(this,i,t,o);e.input.compositionNodes.push(s),this.children=er(this.children,r,r+o.length,e,s)}update(e,t,r,o){return this.dirty==ge||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,o),!0)}updateInner(e,t,r,o){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=le}updateOuterDeco(e){if(tn(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=es(this.dom,this.nodeDOM,Qn(this.outerDeco,this.node,t),Qn(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function go(n,e,t,r,o){ts(r,e,n);let i=new Ie(void 0,n,e,t,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class hn extends Ie{constructor(e,t,r,o,i,s,a){super(e,t,r,o,i,null,s,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,o){return this.dirty==ge||this.dirty!=le&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=le||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=le,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let o=this.node.cut(e,t),i=document.createTextNode(o.text);return new hn(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=ge)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Xi extends Lt{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==le&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class _c extends Ie{constructor(e,t,r,o,i,s,a,l,c,d){super(e,t,r,o,i,s,a,c,d),this.spec=l}update(e,t,r,o){if(this.dirty==ge)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,r);return i&&this.updateInner(e,t,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,o){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Qi(n,e,t){let r=n.firstChild,o=!1;for(let i=0;i>1,a=Math.min(s,e.length);for(;i-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let d=Ke.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))i=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a0;){let a;for(;;)if(r){let c=t.children[r-1];if(c instanceof Ke)t=c,r=c.children.length;else{a=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=n.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}function qc(n,e){return n.type.side-e.type.side}function Jc(n,e,t,r){let o=e.locals(n),i=0;if(o.length==0){for(let c=0;ci;)a.push(o[s++]);let m=i+p.nodeSize;if(p.isText){let x=m;s!x.inline):a.slice();r(p,g,e.forChild(i,p),h),i=m}}function Uc(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function jc(n,e,t,r){for(let o=0,i=0;o=t){if(i>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a=0&&c+e.length+a>=t)return a+c;if(t==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function er(n,e,t,r,o){let i=[];for(let s=0,a=0;s=t||d<=e?i.push(l):(ct&&i.push(l.slice(t-c,l.size,r)))}return i}function mr(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let o=n.docView.nearestDesc(t.focusNode),i=o&&o.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(fn(t)){for(l=s;o&&!o.node;)o=o.parent;let u=o.node;if(o&&u.isAtom&&M.isSelectable(u)&&o.parent&&!(u.isInline&&kc(t.focusNode,t.focusOffset,o.dom))){let p=o.posBefore;c=new M(s==p?a:r.resolve(p))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let u=s,p=s;for(let h=0;h{(t.anchorNode!=r||t.anchorOffset!=o)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!ns(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Zc(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,q(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&G&&Ae<=11&&(t.disabled=!0,t.disabled=!1)}function rs(n,e){if(e instanceof M){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(wo(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else wo(n)}function wo(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function gr(n,e,t,r){return n.someProp("createSelectionBetween",o=>o(n,e,t))||D.between(e,t,r)}function vo(n){return n.editable&&!n.hasFocus()?!1:is(n)}function is(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Yc(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return je(e.node,e.offset,t.anchorNode,t.anchorOffset)}function tr(n,e){let{$anchor:t,$head:r}=n.selection,o=e>0?t.max(r):t.min(r),i=o.parent.inlineContent?o.depth?n.doc.resolve(e>0?o.after():o.before()):null:o;return i&&I.findFrom(i,e)}function Me(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Co(n,e,t){let r=n.state.selection;if(r instanceof D)if(t.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=n.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return Me(n,new D(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let o=tr(n.state,e);return o&&o instanceof M?Me(n,o):!1}else if(!(re&&t.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let a=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=n.docView.descAt(a))&&!s.contentDOM?M.isSelectable(i)?Me(n,new M(e<0?n.state.doc.resolve(o.pos-i.nodeSize):o)):Rt?Me(n,new D(n.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof M&&r.node.isInline)return Me(n,new D(e>0?r.$to:r.$from));{let o=tr(n.state,e);return o?Me(n,o):!1}}}function nn(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function vt(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Ge(n,e){return e<0?Gc(n):Xc(n)}function Gc(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o,i,s=!1;for(ae&&t.nodeType==1&&r0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(vt(a,-1))o=t,i=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if(ss(t))break;{let a=t.previousSibling;for(;a&&vt(a,-1);)o=t.parentNode,i=q(a),a=a.previousSibling;if(a)t=a,r=nn(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?nr(n,t,r):o&&nr(n,o,i)}function Xc(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o=nn(t),i,s;for(;;)if(r{n.state==o&&ve(n)},50)}function So(n,e){let t=n.state.doc.resolve(e);if(!(J||qi)&&t.parent.inlineContent){let o=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>o.top&&s1)return i.lefto.top&&s1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Mo(n,e,t){let r=n.state.selection;if(r instanceof D&&!r.empty||t.indexOf("s")>-1||re&&t.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=tr(n.state,e);if(s&&s instanceof M)return Me(n,s)}if(!o.parent.inlineContent){let s=e<0?o:i,a=r instanceof se?I.near(s,e):I.findFrom(s,e);return a?Me(n,a):!1}return!1}function No(n,e){if(!(n.state.selection instanceof D))return!0;let{$head:t,$anchor:r,empty:o}=n.state.selection;if(!t.sameParent(r))return!0;if(!o)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let s=n.state.tr;return e<0?s.delete(t.pos-i.nodeSize,t.pos):s.delete(t.pos,t.pos+i.nodeSize),n.dispatch(s),!0}return!1}function Oo(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function td(n){if(!j||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Oo(n,r,"true"),setTimeout(()=>Oo(n,r,"false"),20)}return!1}function nd(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function rd(n,e){let t=e.keyCode,r=nd(e);if(t==8||re&&t==72&&r=="c")return No(n,-1)||Ge(n,-1);if(t==46&&!e.shiftKey||re&&t==68&&r=="c")return No(n,1)||Ge(n,1);if(t==13||t==27)return!0;if(t==37||re&&t==66&&r=="c"){let o=t==37?So(n,n.state.selection.from)=="ltr"?-1:1:-1;return Co(n,o,r)||Ge(n,o)}else if(t==39||re&&t==70&&r=="c"){let o=t==39?So(n,n.state.selection.from)=="ltr"?1:-1:1;return Co(n,o,r)||Ge(n,o)}else{if(t==38||re&&t==80&&r=="c")return Mo(n,-1,r)||Ge(n,-1);if(t==40||re&&t==78&&r=="c")return td(n)||Mo(n,1,r)||Ge(n,1);if(r==(re?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function xr(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=n.someProp("clipboardSerializer")||ct.fromSchema(n.state.schema),a=ps(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=us[c.nodeName.toLowerCase()]);){for(let h=d.length-1;h>=0;h--){let m=a.createElement(d[h]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),u++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${i}${u?` -${u}`:""} ${JSON.stringify(t)}`);let p=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,` +${zr}`:zr}function ba(n){return n.includes("skill://plan")||/(?:^|\s)\$plan(?:\s|$)/.test(n)}function ya(n){return n?.id==="codex"?"GPT-5.5":n?.displayName??"GPT-5.5"}function ka(n){const e=n.displayName,t=e.toLowerCase();return n.id==="claude"||t.includes("claude")?"Cl":n.id==="opencode"||t.includes("open")?"O":t==="pi"||t.includes(" pi")?"Pi":e.trim().slice(0,1).toUpperCase()||"C"}function wa(n){const e=n.usedPercent,t=n.remainingPercent,r=e!=null&&Number.isFinite(e)?ht(e):ht(100-(t??0)),o=t!=null&&Number.isFinite(t)?ht(t):ht(100-r);return{...n,remainingPercent:o,usedPercent:r,windowDurationMins:Number.isFinite(n.windowDurationMins)?n.windowDurationMins:void 0}}function Go(n){return Number.isFinite(n)?`${Math.round(ht(n))}%`:"100%"}function Xo(n,e=new Date){if(n==null||!Number.isFinite(n))return null;const t=new Date(n*1e3);if(!Number.isFinite(t.getTime()))return null;const r=Math.floor((t.getTime()-e.getTime())/1e3);return r>0&&r<3600?new Intl.DateTimeFormat(void 0,{timeStyle:"short"}).format(t):va(t,e)?new Intl.DateTimeFormat(void 0,{timeStyle:"short"}).format(t):new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(t)}function Qo(n,e,t){if(n==null||!Number.isFinite(n)||n<=0)return e;const r=Math.round(n);return Fr(n,720*60)?t?.monthly??e:Fr(n,10080)?t?.weekly??e:r>=1440?Mn(t?.daysFormat,Math.ceil(r/1440),e):r>=60?Mn(t?.hoursFormat,Math.ceil(r/60),e):Mn(t?.minutesFormat,Math.max(1,Math.ceil(r)),e)}function ht(n){return Number.isFinite(n)?Math.min(Math.max(n,0),100):100}function Fr(n,e){return n>=e*.95&&n<=e*1.05}function va(n,e){return n.getFullYear()===e.getFullYear()&&n.getMonth()===e.getMonth()&&n.getDate()===e.getDate()}function Mn(n,e,t){const r=new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e);return n==null||n.length===0?t:n.replaceAll("%@",r).replaceAll("%d",r).replaceAll("{value}",r)}const Br=256*1024,Vr=64*1024,Ca=8*1024,_r=`[earlier assistant output truncated] +`,$r=`[earlier command output truncated] +`,Sa=`[earlier log output truncated] +`;function Ma(n){return{selectedProviderId:"codex",status:"loading",input:"",providers:[],log:[],transcript:[],autoStartAttemptedProviderIds:[],seenSessionIds:[]}}function Na(n,e){switch(e.type){case"context":return Ba({...n,context:e.context,selectedProviderId:e.context.initialProviderId,status:"idle"});case"providers":return{...n,providers:e.providers};case"selectProvider":return ar(n)?{...n,selectedProviderId:e.providerId}:n;case"setInput":return{...n,input:e.input};case"autoStartAttempted":return n.autoStartAttemptedProviderIds.includes(e.providerId)?n:{...n,autoStartAttemptedProviderIds:[...n.autoStartAttemptedProviderIds,e.providerId]};case"starting":return{...n,status:"starting",log:de(n,"info",ue(n,"startingStatus","Starting"))};case"startAccepted":return n.status!=="starting"||n.runningSessionId?n:{...n,runningSessionId:e.sessionId,requestedStopSessionId:void 0,seenSessionIds:Wt(n,e.sessionId)};case"stopping":return{...n,status:"stopping",requestedStopSessionId:e.sessionId,log:de(n,"info",ue(n,"stoppingStatus","Stopping"))};case"failed":return{...n,status:"failed",log:de(n,"error",e.message),transcript:bt(n,e.message,"error")};case"failedForSession":case"sendFailed":return n.runningSessionId!==e.sessionId||n.requestedStopSessionId===e.sessionId?n:{...n,status:"failed",log:de(n,"error",e.message),transcript:bt(n,e.message,"error")};case"stopFailed":return n.runningSessionId!==e.sessionId&&n.requestedStopSessionId!==e.sessionId?n:{...n,requestedStopSessionId:void 0,status:"failed",log:de(n,"error",e.message),transcript:bt(n,e.message,"error")};case"sent":return n.runningSessionId!==e.sessionId||n.requestedStopSessionId===e.sessionId?n:{...n,input:n.input===e.submittedInput?"":n.input,log:de(n,"info",Zt(n,"sentCharsFormat","Sent %d chars",e.text.length)),transcript:Va(n,e.displayText??e.text,e.attachments,e.sentAtMs)};case"event":return za(n,e.event);default:return n}}async function Oa(n){try{const[e,t]=await Promise.all([He("app.context"),He("provider.list")]);Wn(e.theme),n({type:"context",context:e}),n({type:"providers",providers:t})}catch(e){n({type:"failed",message:It(e)})}}async function Ta(n,e){sr(n)&&await ti(ei(n),e)}function ei(n){return{providerId:n.selectedProviderId,workingDirectory:n.context?.workingDirectory,copy:n.context?.copy}}async function ti(n,e){e({type:"starting"});try{const t=await He("provider.start",{providerId:n.providerId,workingDirectory:n.workingDirectory});e({type:"startAccepted",sessionId:t.sessionId})}catch(t){e({type:"failed",message:It(t,n.copy)})}}function Da(n){return!sr(n)||n.autoStartAttemptedProviderIds.includes(n.selectedProviderId)?!1:n.providers.find(t=>t.id===n.selectedProviderId)?.autoStart===!0}async function Ea(n,e){if(!Da(n))return;const t=n.selectedProviderId,r=ei(n);e({type:"autoStartAttempted",providerId:t}),await ti(r,e)}function Ia(n,e,t){ar(e)&&(t({type:"selectProvider",providerId:n}),He("provider.select",{providerId:n}).catch(()=>{}))}async function Ra(n,e,t={}){const r=t.text??n.input,o=t.clearInput??r;if(r.length===0||!n.runningSessionId||n.status!=="running")return!1;const i=n.runningSessionId;try{return await He("provider.writeLine",{permissionMode:t.permissionMode??"default",sessionId:i,text:r}),e({type:"sent",attachments:t.attachments,displayText:t.displayText,sentAtMs:Date.now(),sessionId:i,text:r,submittedInput:o}),!0}catch(s){return Ha(s)||e({type:"sendFailed",sessionId:i,message:It(s,n)}),!1}}async function Aa(n,e){if(!n.runningSessionId||n.status==="stopping")return;const t=n.runningSessionId;e({type:"stopping",sessionId:t});try{await He("provider.stop",{sessionId:t})}catch(r){e({type:"stopFailed",sessionId:t,message:It(r,n)})}}function La(n){switch(n.status){case"loading":return ue(n,"loadingStatus","Loading");case"idle":return ue(n,"idleStatus","Idle");case"starting":return ue(n,"startingStatus","Starting");case"running":return ue(n,"runningStatus","Running");case"stopping":return ue(n,"stoppingStatus","Stopping");case"failed":return ue(n,"failedStatus","Failed")}}function sr(n){return(n.status==="idle"||n.status==="failed")&&!n.runningSessionId&&!!n.context}function ar(n){return!n.runningSessionId&&n.status!=="starting"&&n.status!=="stopping"}function Pa(n){return!!n.runningSessionId&&n.status!=="stopping"}function za(n,e){switch(e.type){case"app.theme":return n.context?{...n,context:{...n.context,theme:e.theme}}:n;case"app.rateLimitRows":return n.context?{...n,context:{...n.context,rateLimitRows:e.rateLimitRows}}:n;case"provider.started":return e.sessionId===n.requestedStopSessionId||n.runningSessionId&&e.sessionId!==n.runningSessionId||!n.runningSessionId&&n.status!=="starting"||!n.runningSessionId&&e.providerId!==n.selectedProviderId?n:{...n,runningSessionId:e.sessionId,requestedStopSessionId:void 0,seenSessionIds:Wt(n,e.sessionId),status:"running",log:de(n,"info",ue(n,"providerStarted","Provider started"))};case"provider.output":return e.sessionId!==n.runningSessionId?n:{...n,log:de(n,e.stream,e.text),transcript:_a(n,e)};case"provider.activity":return e.sessionId!==n.runningSessionId?n:{...n,transcript:$a(n,e)};case"provider.turnComplete":return e.sessionId!==n.runningSessionId?n:{...n,transcript:zt(n.transcript,e.sessionId)};case"provider.exit":return Fa(n,e)?e.sessionId===n.requestedStopSessionId?{...n,runningSessionId:void 0,requestedStopSessionId:void 0,seenSessionIds:Wt(n,e.sessionId),status:"idle",log:de(n,"info",ue(n,"stopped","Stopped")),transcript:zt(n.transcript,e.sessionId)}:{...n,runningSessionId:void 0,requestedStopSessionId:void 0,seenSessionIds:Wt(n,e.sessionId),status:e.status===0?"idle":"failed",log:de(n,e.status===0?"info":"error",Zt(n,"providerExitedFormat","Provider exited %d",e.status)),transcript:e.status===0?zt(n.transcript,e.sessionId):bt({...n,transcript:zt(n.transcript,e.sessionId)},Zt(n,"providerExitedFormat","Provider exited %d",e.status),"error")}:n;default:return n}}function Fa(n,e){return e.sessionId===n.runningSessionId?!0:!n.seenSessionIds.includes(e.sessionId)&&n.status==="starting"&&!n.runningSessionId&&e.providerId===n.selectedProviderId}function Wt(n,e){return n.seenSessionIds.includes(e)?n.seenSessionIds:[...n.seenSessionIds,e].slice(-50)}function Ba(n){const e=n.context?.renderer==="solid"?"Solid":"React";return{...n,log:de(n,"info",Zt(n,"rendererReadyFormat","%@ ready",e))}}function de(n,e,t){return[...n.log,{id:at(),level:e,text:dn(t,Ca,Sa)}].slice(-300)}function Va(n,e,t,r){return cn(n.transcript,{attachments:t,id:at(),role:"user",sentAtMs:r,text:e})}function _a(n,e){if(e.stream!=="stdout")return bt(n,e.text,"warning");const t=n.transcript.at(-1);return t?.role==="assistant"&&t.sessionId===e.sessionId?[...n.transcript.slice(0,-1),{...t,isComplete:!1,text:ni(t.text,e.text,Br,_r)}]:cn(n.transcript,{id:at(),role:"assistant",isComplete:!1,sessionId:e.sessionId,sentAtMs:Date.now(),text:dn(e.text,Br,_r)})}function zt(n,e){let t=!1;const r=n.map(o=>o.role!=="assistant"||o.sessionId!==e||o.isComplete===!0?o:(t=!0,{...o,isComplete:!0}));return t?r:n}function $a(n,e){const t=Wa(n.transcript,e.sessionId,e.activityId);if(t>=0){const r=n.transcript[t];return[...n.transcript.slice(0,t),{...r,text:e.action,detail:e.detail??r.detail,activityKind:e.kind,activityStatus:e.status,output:e.outputDelta===void 0?r.output:ni(r.output??"",e.outputDelta,Vr,$r)},...n.transcript.slice(t+1)]}return cn(n.transcript,{id:at(),role:"activity",text:e.action,detail:e.detail,sessionId:e.sessionId,activityId:e.activityId,activityKind:e.kind,activityStatus:e.status,output:e.outputDelta===void 0?void 0:dn(e.outputDelta,Vr,$r)})}function Wa(n,e,t){for(let r=n.length-1;r>=0;r-=1){const o=n[r];if(o.role==="activity"&&o.sessionId===e&&o.activityId===t)return r}return-1}function bt(n,e,t){return cn(n.transcript,{id:at(),role:"notice",tone:t,text:e})}function cn(n,e){return[...n,e].slice(-200)}function ni(n,e,t,r){const o=n.startsWith(r),i=n.startsWith(r)?n.slice(r.length):n;return o?r+(i+e).slice(-(t-r.length)):dn(i+e,t,r)}function dn(n,e,t){return n.length<=e?n:t+n.slice(-(e-t.length))}function ue(n,e,t){return n.context?.copy[e]??t}function Ha(n){return n instanceof Uo&&n.code==="providerNotReady"}function Zt(n,e,t,...r){return Ja(ue(n,e,t),r)}function Ja(n,e){let t=0;return n.replace(/%(\d+\$)?[@d]/g,(r,o)=>{const i=o?Number(o.slice(0,-1))-1:t++;return String(e[i]??"")})}function It(n,e){const t=qa(e);return n instanceof Error&&n.message?t&&n.message==="Native bridge request failed."?t.requestFailed:n.message:t?.requestFailed??"Native bridge request failed."}function qa(n){if(n)return"providers"in n?n.context?.copy:n}function H(n){this.content=n}H.prototype={constructor:H,find:function(n){for(var e=0;e>1}};H.from=function(n){if(n instanceof H)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new H(e)};function ri(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),i=e.child(r);if(o==i){t+=o.nodeSize;continue}if(!o.sameMarkup(i))return t;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)t++;return t}if(o.content.size||i.content.size){let s=ri(o.content,i.content,t+1);if(s!=null)return s}t+=o.nodeSize}}function oi(n,e,t,r){for(let o=n.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:t,b:r};let s=n.child(--o),a=e.child(--i),l=s.nodeSize;if(s==a){t-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:t,b:r};if(s.isText&&s.text!=a.text){let c=0,d=Math.min(s.text.length,a.text.length);for(;ce&&r(l,o+a,i||null,s)!==!1&&l.content.size){let d=a+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,t-d),r,o+d)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let i="",s=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),i=1);ie)for(let i=0,s=0;se&&((st)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,t-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,t-s-1))),r.push(a),o+=a.nodeSize),s=l}return new y(r,o)}cutByIndex(e,t){return e==t?y.empty:e==0&&t==this.content.length?this:new y(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let o=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new y(o,i)}addToStart(e){return new y([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new y(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let o=this.child(t),i=r+o.nodeSize;if(i>=e)return i==e?Ft(t+1,i):Ft(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return y.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return y.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return y.empty;let t,r=0;for(let o=0;othis.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;tr.type.rank-o.type.rank),t}}E.none=[];class Gt extends Error{}class w{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=si(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new w(r,this.openStart,this.openEnd)}removeBetween(e,t){return new w(ii(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return w.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new w(y.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)o++;return new w(e,r,o)}}w.empty=new w(y.empty,0,0);function ii(n,e,t){let{index:r,offset:o}=n.findIndex(e),i=n.maybeChild(r),{index:s,offset:a}=n.findIndex(t);if(o==e||i.isText){if(a!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(ii(i.content,e-o-1,t-o-1)))}function si(n,e,t,r,o,i){let{index:s,offset:a}=n.findIndex(e),l=n.maybeChild(s);if(a==e||l.isText)return i&&r<=0&&o<=0&&!i.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let c=si(l.content,e-a-1,t,s==0?r-1:0,s==n.childCount-1?o-1:0,l);return c&&n.replaceChild(s,l.copy(c))}function Ua(n,e,t){if(t.openStart>n.depth)throw new Gt("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Gt("Inconsistent open depths");return ai(n,e,t,0)}function ai(n,e,t,r){let o=n.index(r),i=n.node(r);if(o==e.index(r)&&r=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function yt(n,e,t,r){let o=(e||n).node(t),i=0,s=e?e.index(t):o.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Be(n.nodeAfter,r),i++));for(let a=i;ao&&Jn(n,e,o+1),s=r.depth>o&&Jn(t,r,o+1),a=[];return yt(null,n,o,a),i&&s&&e.index(o)==t.index(o)?(li(i,s),Be(Ve(i,ci(n,e,t,r,o+1)),a)):(i&&Be(Ve(i,Xt(n,e,o+1)),a),yt(e,t,o,a),s&&Be(Ve(s,Xt(t,r,o+1)),a)),yt(r,null,o,a),new y(a)}function Xt(n,e,t){let r=[];if(yt(null,n,t,r),n.depth>t){let o=Jn(n,e,t+1);Be(Ve(o,Xt(n,e,t+1)),r)}return yt(e,null,t,r),new y(r)}function ja(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)o=e.node(i).copy(y.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}class Ct{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let i=0;i0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Ya(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],o=0,i=t;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(i),c=i-l;if(r.push(s,a,o+l),!c||(s=s.child(a),s.isText))break;i=c-1,o+=l+1}return new Ct(t,r,i)}static resolveCached(e,t){let r=Wr.get(e);if(r)for(let i=0;ie&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),di(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=y.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=o;lt.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=y.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};_e.prototype.text=void 0;class Qt extends _e{constructor(e,t,r,o){if(super(e,t,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):di(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Qt(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Qt(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function di(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Je{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Xa(e,t);if(r.next==null)return Je.empty;let o=ui(r);r.next&&r.err("Unexpected trailing text");let i=il(ol(o));return sl(i,r),i}matchType(e){for(let t=0;tc.createAndFill()));for(let c=0;c=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s"+e.indexOf(r.next[s].next);return i}).join(` +`)}}Je.empty=new Je(!0);class Xa{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function ui(n){let e=[];do e.push(Qa(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Qa(n){let e=[];do e.push(el(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function el(n){let e=rl(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=tl(n,e);else break;return e}function Hr(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function tl(n,e){let t=Hr(n),r=t;return n.eat(",")&&(n.next!="}"?r=Hr(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function nl(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let o=[];for(let i in t){let s=t[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&n.err("No node type or group '"+e+"' found"),o}function rl(n){if(n.eat("(")){let e=ui(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=nl(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function ol(n){let e=[[]];return o(i(n,0),t()),e;function t(){return e.push([])-1}function r(s,a,l){let c={term:l,to:a};return e[s].push(c),c}function o(s,a){s.forEach(l=>l.to=a)}function i(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=i(s.exprs[l],a);if(l==s.exprs.length-1)return c;o(c,a=t())}else if(s.type=="star"){let l=t();return r(a,l),o(i(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=t();return o(i(s.expr,a),l),o(i(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c{n[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let d=0;d{c||o.push([a,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let i=e[r.join(",")]=new Je(r.indexOf(n.length-1)>-1);for(let s=0;s-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:fi(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new _e(this,this.computeAttrs(e),y.from(t),E.setFrom(r))}createChecked(e=null,t,r){return t=y.from(t),this.checkContent(t),new _e(this,this.computeAttrs(e),t,E.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=y.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let o=this.contentMatch.matchFragment(t),i=o&&o.fillBefore(y.empty,!0);return i?new _e(this,e,t.append(i),E.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;tr[i]=new xi(i,t,s));let o=t.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function al(n,e,t){let r=t.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}class ll{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?al(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class un{constructor(e,t,r,o){this.name=e,this.rank=t,this.schema=r,this.spec=o,this.attrs=gi(e,o.attrs),this.excluded=null;let i=hi(this.attrs);this.instance=i?new E(this,i):null}create(e=null){return!e&&this.instance?this.instance:new E(this,fi(this.attrs,e))}static compile(e,t){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new un(i,o++,t,s)),r}removeFromSet(e){for(var t=0;t-1}}class cl{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let o in e)t[o]=e[o];t.nodes=H.from(e.nodes),t.marks=H.from(e.marks||{}),this.nodes=qr.compile(this.spec.nodes,this),this.marks=un.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=Je.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?Ur(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:Ur(this,s.split(" "))}this.nodeFromJSON=o=>_e.fromJSON(this,o),this.markFromJSON=o=>E.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof qr){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,o)}text(e,t){let r=this.nodes.text;return new Qt(r,r.defaultAttrs,e,E.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Ur(n,e){let t=[];for(let r=0;r-1)&&t.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function dl(n){return n.tag!=null}function ul(n){return n.style!=null}class St{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(o=>{if(dl(o))this.tags.push(o);else if(ul(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new Kr(this,t,!1);return r.addAll(e,E.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Kr(this,t,!0);return r.addAll(e,E.none,t.from,t.to),w.maxOpen(r.finish())}matchTag(e,t,r){for(let o=r?this.tags.indexOf(r)+1:0;oe.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(s.getAttrs){let l=s.getAttrs(t);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let t=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s{r(s=Zr(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Zr(s)),s.node||s.ignore||s.mark||(s.node=o)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new St(e,St.schemaRules(e)))}}const bi={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},pl={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},yi={ol:!0,ul:!0},Mt=1,Un=2,kt=4;function jr(n,e,t){return e!=null?(e?Mt:0)|(e==="full"?Un:0):n&&n.whitespace=="pre"?Mt|Un:t&~kt}class Bt{constructor(e,t,r,o,i,s){this.type=e,this.attrs=t,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=E.none,this.match=i||(s&kt?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(y.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Mt)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let t=y.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(y.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!bi.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Kr{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=t.topNode,i,s=jr(null,t.preserveWhitespace,0)|(r?kt:0);o?i=new Bt(o.type,o.attrs,E.none,!0,t.topMatch||o.type.contentMatch,s):r?i=new Bt(null,null,E.none,!0,null,s):i=new Bt(e.schema.topNodeType,null,E.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,o=this.top,i=o.options&Un?"full":this.localPreserveWS||(o.options&Mt)>0,{schema:s}=this.parser;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,` +`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,r,o){let i,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,t.attrs||null,r,t.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[t.mark];r=r.concat(l.create(t.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}i&&this.sync(a)&&this.open--}addAll(e,t,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=o==null?null:e.childNodes[o];s!=a;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t,r){let o,i;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!o||o.length>c.length+a)&&(o=c,i=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!o)return null;this.sync(i);for(let s=0;s(s.type?s.type.allowsMarkType(c.type):Yr(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Bt(e,t,l,o,null,a)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Mt)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=i;l--)if(s(a-1,l))return!0;return!1}else{let d=l>0||l==0&&o?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;l--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function hl(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&yi.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function fl(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Zr(n){let e={};for(let t in n)e[t]=n[t];return e}function Yr(n,e){let t=e.schema.nodes;for(let r in t){let o=t[r];if(!o.allowsMarkType(n))continue;let i=[],s=a=>{i.push(a);for(let l=0;l{if(i.length||s.marks.length){let a=0,l=0;for(;a=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let o=this.marks[e.type.name];return o&&Ht(Vt(r),o(e,t),null,e.attrs)}static renderSpec(e,t,r=null,o){return typeof t=="string"?{dom:e.createTextNode(t)}:Ht(e,t,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new lt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Gr(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Gr(e.marks)}}function Gr(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Vt(n){return n.document||window.document}const Xr=new WeakMap;function ml(n){let e=Xr.get(n);return e===void 0&&Xr.set(n,e=gl(n)),e}function gl(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(t=o.slice(0,s),o=o.slice(s+1));let a,l=t?n.createElementNS(t,o):n.createElement(o),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let p=u.indexOf(" ");p>0?l.setAttributeNS(u.slice(0,p),u.slice(p+1),c[u]):u=="style"&&l.style?l.style.cssText=c[u]:l.setAttribute(u,c[u])}}for(let u=d;ud)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof p=="string")l.appendChild(n.createTextNode(p));else{let{dom:f,contentDOM:m}=Ht(n,p,t,r);if(l.appendChild(f),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const ki=65535,wi=Math.pow(2,16);function xl(n,e){return n+e*wi}function Qr(n){return n&ki}function bl(n){return(n-(n&ki))/wi}const vi=1,Ci=2,Jt=4,Si=8;class jn{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Si)>0}get deletedBefore(){return(this.delInfo&(vi|Jt))>0}get deletedAfter(){return(this.delInfo&(Ci|Jt))>0}get deletedAcross(){return(this.delInfo&Jt)>0}}class Q{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Q.empty)return Q.empty}recover(e){let t=0,r=Qr(e);if(!this.inverted)for(let o=0;oe)break;let c=this.ranges[a+i],d=this.ranges[a+s],u=l+c;if(e<=u){let p=c?e==l?-1:e==u?1:t:t,f=l+o+(p<0?0:d);if(r)return f;let m=e==(t<0?l:u)?null:xl(a/3,e-l),g=e==l?Ci:e==u?vi:Jt;return(t<0?e!=l:e!=u)&&(g|=Si),new jn(f,g,m)}o+=d-c}return r?e+o:new jn(e+o,0,null)}touches(e,t){let r=0,o=Qr(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;ae)break;let c=this.ranges[a+i],d=l+c;if(e<=d&&a==o*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o=0;t--){let o=e.getMirror(t);this.appendMap(e._maps[t].invert(),o!=null&&o>t?r-o-1:void 0)}}invert(){let e=new en;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;ri&&l!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),t.openStart,t.openEnd);return P.fromReplace(e,this.from,this.to,i)}invert(){return new fe(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Te(t.pos,r.pos,this.mark)}merge(e){return e instanceof Te&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Te(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Te(t.from,t.to,e.markFromJSON(t.mark))}}K.jsonID("addMark",Te);class fe extends K{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new w(lr(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return P.fromReplace(e,this.from,this.to,r)}invert(){return new Te(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new fe(t.pos,r.pos,this.mark)}merge(e){return e instanceof fe&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new fe(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new fe(t.from,t.to,e.markFromJSON(t.mark))}}K.jsonID("removeMark",fe);class De extends K{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return P.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return P.fromReplace(e,this.pos,this.pos+1,new w(y.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let o=0;or.pos?null:new ne(t.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ne(t.from,t.to,t.gapFrom,t.gapTo,w.fromJSON(e,t.slice),t.insert,!!t.structure)}}K.jsonID("replaceAround",ne);function Kn(n,e,t){let r=n.resolve(e),o=t-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function yl(n,e,t,r){let o=[],i=[],s,a;n.doc.nodesBetween(e,t,(l,c,d)=>{if(!l.isInline)return;let u=l.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let p=Math.max(c,e),f=Math.min(c+l.nodeSize,t),m=r.addToSet(u);for(let g=0;gn.step(l)),i.forEach(l=>n.step(l))}function kl(n,e,t,r){let o=[],i=0;n.doc.nodesBetween(e,t,(s,a)=>{if(!s.isInline)return;i++;let l=null;if(r instanceof un){let c=s.marks,d;for(;d=r.isInSet(c);)(l||(l=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,t);for(let d=0;dn.step(new fe(s.from,s.to,s.style)))}function cr(n,e,t,r=t.contentMatch,o=!0){let i=n.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l=0;l--)n.step(s[l])}function wl(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function dr(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,o=0,i=0;;--r){let s=n.$from.node(r),a=n.$from.index(r)+o,l=n.$to.indexAfter(r)-i;if(rt;m--)g||r.index(m)>0?(g=!0,d=y.from(r.node(m).copy(d)),u++):l--;let p=y.empty,f=0;for(let m=i,g=!1;m>t;m--)g||o.after(m+1)=0;s--){if(r.size){let a=t[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=y.from(t[s].type.create(t[s].attrs,r))}let o=e.start,i=e.end;n.step(new ne(o,i,o,i,new w(r,0,0),t.length,!0))}function Sl(n,e,t,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,a)=>{let l=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,l)&&Ml(n.doc,n.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!m?c=!1:!f&&m&&(c=!0)}c===!1&&Ni(n,s,a,i),cr(n,n.mapping.slice(i).map(a,1),r,void 0,c===null);let d=n.mapping.slice(i),u=d.map(a,1),p=d.map(a+s.nodeSize,1);return n.step(new ne(u,p,u+1,p-1,new w(y.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&Mi(n,s,a,i),!1}})}function Mi(n,e,t,r){e.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let l=n.mapping.slice(r).map(t+1+i+s.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Ni(n,e,t,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+i);n.replaceWith(s,s+1,e.type.schema.text(` +`))}})}function Ml(n,e,t){let r=n.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,t)}function Nl(n,e,t,r,o){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(r,null,o||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new ne(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new w(y.from(s),0,0),1,!0))}function qt(n,e,t=1,r){let o=n.resolve(e),i=o.depth-t,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,d=t-2;c>i;c--,d--){let u=o.node(c),p=o.index(c);if(u.type.spec.isolating)return!1;let f=u.content.cutByIndex(p,u.childCount),m=r&&r[d+1];m&&(f=f.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[d]||u;if(!u.canReplace(p+1,u.childCount)||!g.type.validContent(f))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function Ol(n,e,t=1,r){let o=n.doc.resolve(e),i=y.empty,s=y.empty;for(let a=o.depth,l=o.depth-t,c=t-1;a>l;a--,c--){i=y.from(o.node(a).copy(i));let d=r&&r[c];s=y.from(d?d.type.create(d.attrs,s):o.node(a).copy(s))}n.step(new _(e,e,new w(i.append(s),t,t),!0))}function Oi(n,e){let t=n.resolve(e),r=t.index();return Dl(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Tl(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let o=0;o=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,t))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,t))return r.after(o+1);if(i=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),d=!1;if(i==1)d=c.canReplace(l,l,o);else{let u=c.contentMatchAt(l).findWrapping(o.firstChild.type);d=u&&c.canReplaceWith(l,l,u[0])}if(d)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function ur(n,e,t=e,r=w.empty){if(e==t&&!r.size)return null;let o=n.resolve(e),i=n.resolve(t);return Ti(o,i,r)?new _(e,t,r):new Al(o,i,r).fit()}function Ti(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Al{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=y.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=y.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,a=o.depth;for(;s&&a&&i.childCount==1;)i=i.firstChild.content,s--,a--;let l=new w(i,s,a);return e>-1?new ne(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new _(r.pos,o.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,o=this.unplaced.openEnd;r1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Tn(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],d,u=null;if(t==1&&(s?c.matchType(s.type)||(u=c.fillBefore(y.from(s),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:u};if(t==2&&s&&(d=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:d};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Tn(e,t);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new w(e,t+1,Math.max(r,o.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Tn(e,t);if(o.childCount<=1&&t>0){let i=e.size-t<=t+o.size;this.unplaced=new w(ft(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new w(ft(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:o,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let g=0;g1||l==0||g.content.size)&&(u=x,d.push(Di(g.mark(p.allowedMarks(g.marks)),c==1?l:0,c==a.childCount?f:-1)))}let m=c==a.childCount;m||(f=-1),this.placed=mt(this.placed,t,y.from(d)),this.frontier[t].match=u,m&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,x=a;g1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:o}=this.frontier[t],i=t=0;a--){let{match:l,type:c}=this.frontier[a],d=Dn(e,a,c,l,!0);if(!d||d.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=mt(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,t=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=mt(this.placed,this.depth,y.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(y.empty,!0);t.childCount&&(this.placed=mt(this.placed,this.frontier.length,t))}}function ft(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(ft(n.firstChild.content,e-1,t)))}function mt(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(mt(n.lastChild.content,e-1,t)))}function Tn(n,e){for(let t=0;t1&&(r=r.replaceChild(0,Di(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(y.empty,!0)))),n.copy(r)}function Dn(n,e,t,r,o){let i=n.node(e),s=o?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!Ll(t,i.content,s)?a:null}function Ll(n,e,t){for(let r=t;r0;p--,f--){let m=o.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?a=p:o.before(p)==f&&s.splice(1,0,-p)}let l=s.indexOf(a),c=[],d=r.openStart;for(let p=r.content,f=0;;f++){let m=p.firstChild;if(c.push(m),f==r.openStart)break;p=m.content}for(let p=d-1;p>=0;p--){let f=c[p],m=Pl(f.type);if(m&&!f.sameMarkup(o.node(Math.abs(a)-1)))d=p;else if(m||!f.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let f=(p+d+1)%(r.openStart+1),m=c[f];if(m)for(let g=0;g=0&&(n.replace(e,t,r),!(n.steps.length>u));p--){let f=s[p];f<0||(e=o.before(f),t=i.after(f))}}function Ei(n,e,t,r,o){if(er){let i=o.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(y.empty,!0))}return n}function Fl(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=Il(n.doc,e,r.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new w(y.from(r),0,0))}function Bl(n,e,t){let r=n.doc.resolve(e),o=n.doc.resolve(t);if(r.parent.isTextblock&&o.parent.isTextblock&&r.start()!=o.start()&&r.parentOffset==0&&o.parentOffset==0){let s=r.sharedDepth(t),a=!1;for(let l=r.depth;l>s;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=o.depth;l>s;l--)o.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=o.depth;l>0&&t==o.start(l);l--)t=o.before(l);r=n.doc.resolve(e),o=n.doc.resolve(t)}}let i=Ii(r,o);for(let s=0;s0&&(l||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return n.delete(r.before(a),o.after(a))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&o.end(s)-t!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return n.delete(r.before(s),t);n.delete(e,t)}function Ii(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let o=r;o>=0;o--){let i=n.start(o);if(ie.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&t.push(o)}return t}class et extends K{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return P.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let o=t.type.create(r,null,t.marks);return P.fromReplace(e,this.pos,this.pos+1,new w(y.from(o),0,t.isLeaf?0:1))}getMap(){return Q.empty}invert(e){return new et(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new et(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new et(t.pos,t.attr,t.value)}}K.jsonID("attr",et);class Nt extends K{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return P.ok(r)}getMap(){return Q.empty}invert(e){return new Nt(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Nt(t.attr,t.value)}}K.jsonID("docAttr",Nt);let rt=class extends Error{};rt=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};rt.prototype=Object.create(Error.prototype);rt.prototype.constructor=rt;rt.prototype.name="TransformError";class Vl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new en}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new rt(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let r=0;r{e=Math.min(e,a),t=Math.max(t,l)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=w.empty){let o=ur(this.doc,e,t,r);return o&&this.step(o),this}replaceWith(e,t,r){return this.replace(e,t,new w(y.from(r),0,0))}delete(e,t){return this.replace(e,t,w.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return zl(this,e,t,r),this}replaceRangeWith(e,t,r){return Fl(this,e,t,r),this}deleteRange(e,t){return Bl(this,e,t),this}lift(e,t){return vl(this,e,t),this}join(e,t=1){return El(this,e,t),this}wrap(e,t){return Cl(this,e,t),this}setBlockType(e,t=e,r,o=null){return Sl(this,e,t,r,o),this}setNodeMarkup(e,t,r=null,o){return Nl(this,e,t,r,o),this}setNodeAttribute(e,t,r){return this.step(new et(e,t,r)),this}setDocAttribute(e,t){return this.step(new Nt(e,t)),this}addNodeMark(e,t){return this.step(new De(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof E)t.isInSet(r.marks)&&this.step(new qe(e,t));else{let o=r.marks,i,s=[];for(;i=t.isInSet(o);)s.push(new qe(e,i)),o=i.removeFromSet(o);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(e,t=1,r){return Ol(this,e,t,r),this}addMark(e,t,r){return yl(this,e,t,r),this}removeMark(e,t,r){return kl(this,e,t,r),this}clearIncompatible(e,t,r){return cr(this,e,t,r),this}}const En=Object.create(null);class R{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new _l(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t=0;i--){let s=t<0?Ge(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):Ge(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new se(e.node(0))}static atStart(e){return Ge(e,e,0,0,1)||new se(e)}static atEnd(e){return Ge(e,e,e.content.size,e.childCount,-1)||new se(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=En[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in En)throw new RangeError("Duplicate use of selection JSON ID "+e);return En[e]=t,t.prototype.jsonID=e,t}getBookmark(){return D.between(this.$anchor,this.$head).getBookmark()}}R.prototype.visible=!0;class _l{constructor(e,t){this.$from=e,this.$to=t}}let eo=!1;function to(n){!eo&&!n.parent.inlineContent&&(eo=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class D extends R{constructor(e,t=e){to(e),to(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return R.near(r);let o=e.resolve(t.map(this.anchor));return new D(o.parent.inlineContent?o:r,r)}replace(e,t=w.empty){if(super.replace(e,t),t==w.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof D&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new pn(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new D(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let o=e.resolve(t);return new this(o,r==t?o:e.resolve(r))}static between(e,t,r){let o=e.pos-t.pos;if((!r||o)&&(r=o>=0?1:-1),!t.parent.inlineContent){let i=R.findFrom(t,r,!0)||R.findFrom(t,-r,!0);if(i)t=i.$head;else return R.near(t,r)}return e.parent.inlineContent||(o==0?e=t:(e=(R.findFrom(e,-r,!0)||R.findFrom(e,r,!0)).$anchor,e.pos0?0:1);o>0?s=0;s+=o){let a=e.child(s);if(a.isAtom){if(!i&&M.isSelectable(a))return M.create(n,t-(o<0?a.nodeSize:0))}else{let l=Ge(n,a,t+o,o<0?a.childCount:0,o,i);if(l)return l}t+=a.nodeSize*o}return null}function no(n,e,t){let r=n.steps.length-1;if(r{s==null&&(s=d)}),n.setSelection(R.near(n.doc.resolve(s),t))}const ro=1,_t=2,oo=4;class Wl extends Vl{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=_t,this}ensureMarks(e){return E.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&_t)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~_t,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||E.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let o=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(t);i=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,o.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(R.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=oo,this}get scrolledIntoView(){return(this.updated&oo)>0}}function io(n,e){return!e||!n?n:n.bind(e)}class gt{constructor(e,t,r){this.name=e,this.init=io(t.init,r),this.apply=io(t.apply,r)}}const Hl=[new gt("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new gt("selection",{init(n,e){return n.selection||R.atStart(e.doc)},apply(n){return n.selection}}),new gt("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new gt("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class In{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Hl.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new gt(r.key,r.spec.state,r))})}}class Qe{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(t[r]=i.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new In(e.schema,e.plugins),i=new Qe(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=_e.fromJSON(e.schema,t.doc);else if(s.name=="selection")i.selection=R.fromJSON(i.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){i[s.name]=c.fromJSON.call(l,e,t[a],i);return}}i[s.name]=s.init(e,i)}}),i}}function Ri(n,e,t){for(let r in n){let o=n[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=Ri(o,e,{})),t[r]=o}return t}class Jl{constructor(e){this.spec=e,this.props={},e.props&&Ri(e.props,this,this.props),this.key=e.key?e.key.key:Ai("plugin")}getState(e){return e[this.key]}}const Rn=Object.create(null);function Ai(n){return n in Rn?n+"$"+ ++Rn[n]:(Rn[n]=0,n+"$")}class ql{constructor(e="key"){this.key=Ai(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Li=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Ul(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const jl=(n,e,t)=>{let r=Ul(n,t);if(!r)return!1;let o=Pi(r);if(!o){let s=r.blockRange(),a=s&&dr(s);return a==null?!1:(e&&e(n.tr.lift(s,a).scrollIntoView()),!0)}let i=o.nodeBefore;if(Vi(n,o,e,-1))return!0;if(r.parent.content.size==0&&(ot(i,"end")||M.isSelectable(i)))for(let s=r.depth;;s--){let a=ur(n.doc,r.before(s),r.after(s),w.empty);if(a&&a.slice.size1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1};function ot(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const Kl=(n,e,t)=>{let{$head:r,empty:o}=n.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;i=Pi(r)}let s=i&&i.nodeBefore;return!s||!M.isSelectable(s)?!1:(e&&e(n.tr.setSelection(M.create(n.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Pi(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Zl(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset{let r=Zl(n,t);if(!r)return!1;let o=zi(r);if(!o)return!1;let i=o.nodeAfter;if(Vi(n,o,e,1))return!0;if(r.parent.content.size==0&&(ot(i,"start")||M.isSelectable(i))){let s=ur(n.doc,r.before(),r.after(),w.empty);if(s&&s.slice.size{let{$head:r,empty:o}=n.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset=0;e--){let t=n.node(e);if(n.index(e)+1{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(` +`).scrollIntoView()),!0)};function Fi(n){for(let e=0;e{let t=n.selection,{$from:r,$to:o}=t;if(t instanceof se||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Fi(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index(){let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(qt(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let r=t.blockRange(),o=r&&dr(r);return o==null?!1:(e&&e(n.tr.lift(r,o).scrollIntoView()),!0)};function tc(n){return(e,t)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof M&&e.selection.node.isBlock)return!r.parentOffset||!qt(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,a,l=!1,c=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){l=r.end(f)==r.pos+(r.depth-f),c=r.start(f)==r.pos-(r.depth-f),a=Fi(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),i.unshift(l&&a?{type:a}:null),s=f;break}else{if(f==1)return!1;i.unshift(null)}let d=e.tr;(e.selection instanceof D||e.selection instanceof se)&&d.deleteSelection();let u=d.mapping.map(r.pos),p=qt(d.doc,u,i.length,i);if(p||(i[0]=a?{type:a}:null,p=qt(d.doc,u,i.length,i)),!p)return!1;if(d.split(u,i.length,i),!l&&c&&r.node(s).type!=a){let f=d.mapping.map(r.before(s)),m=d.doc.resolve(f);a&&r.node(s-1).canReplaceWith(m.index(),m.index()+1,a)&&d.setNodeMarkup(d.mapping.map(r.before(s)),a)}return t&&t(d.scrollIntoView()),!0}}const Bi=tc();function nc(n,e,t){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||Oi(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Vi(n,e,t,r){let o=e.nodeBefore,i=e.nodeAfter,s,a,l=o.type.spec.isolating||i.type.spec.isolating;if(!l&&nc(n,e,t))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(a=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&a.matchType(s[0]||i.type).validEnd){if(t){let f=e.pos+i.nodeSize,m=y.empty;for(let k=s.length-1;k>=0;k--)m=y.from(s[k].create(null,m));m=y.from(o.copy(m));let g=n.tr.step(new ne(e.pos-1,f,e.pos,f,new w(m,1,0),s.length,!0)),x=g.doc.resolve(f+2*s.length);x.nodeAfter&&x.nodeAfter.type==o.type&&Oi(g.doc,x.pos)&&g.join(x.pos),t(g.scrollIntoView())}return!0}let d=i.type.spec.isolating||r>0&&l?null:R.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),p=u&&dr(u);if(p!=null&&p>=e.depth)return t&&t(n.tr.lift(u,p).scrollIntoView()),!0;if(c&&ot(i,"start",!0)&&ot(o,"end")){let f=o,m=[];for(;m.push(f),!f.isTextblock;)f=f.lastChild;let g=i,x=1;for(;!g.isTextblock;g=g.firstChild)x++;if(f.canReplace(f.childCount,f.childCount,g.content)){if(t){let k=y.empty;for(let N=m.length-1;N>=0;N--)k=y.from(m[N].copy(k));let T=n.tr.step(new ne(e.pos-m.length,e.pos+i.nodeSize,e.pos+x,e.pos+i.nodeSize-x,new w(k,m.length,0),0,!0));t(T.scrollIntoView())}return!0}}return!1}function hr(...n){return function(e,t,r){for(let o=0;o0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=oe(n)}else if(n.parentNode&&!Rt(n))e=J(n),n=n.parentNode;else return null}}function sc(n,e){for(;;){if(n.nodeType==3&&e2),re=st||(me?/Mac/.test(me.platform):!1),Wi=me?/Win/.test(me.platform):!1,we=/Android \d/.test(Le),At=!!ao&&"webkitFontSmoothing"in ao.documentElement.style,dc=At?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function uc(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function ye(n,e){return typeof n=="number"?n:n[e]}function pc(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function lo(n,e,t){let r=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let s=t||n.dom;s;){if(s.nodeType!=1){s=it(s);continue}let a=s,l=a==i.body,c=l?uc(i):pc(a),d=0,u=0;if(e.topc.bottom-ye(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+ye(o,"top")-c.top:e.bottom-c.bottom+ye(o,"bottom")),e.leftc.right-ye(r,"right")&&(d=e.right-c.right+ye(o,"right")),d||u)if(l)i.defaultView.scrollBy(d,u);else{let f=a.scrollLeft,m=a.scrollTop;u&&(a.scrollTop+=u),d&&(a.scrollLeft+=d);let g=a.scrollLeft-f,x=a.scrollTop-m;e={left:e.left-g,top:e.top-x,right:e.right-g,bottom:e.bottom-x}}let p=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:it(s)}}function hc(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=t+1;s=t-20){r=a,o=l.top;break}}return{refDOM:r,refTop:o,stack:Hi(n.dom)}}function Hi(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=it(r));return e}function fc({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Ji(t,r==0?0:r-e)}function Ji(n,e){for(let t=0;t=a){s=Math.max(m.bottom,s),a=Math.min(m.top,a);let g=m.left>e.left?m.left-e.left:m.right=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=d,c={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=u+1)}}return!t&&l&&(t=l,o=c,r=0),t&&t.nodeType==3?gc(t,o):!t||r&&t.nodeType==1?{node:n,offset:i}:qi(t,o)}function gc(n,e){let t=n.nodeValue.length,r=document.createRange(),o;for(let i=0;i=(s.left+s.right)/2?1:0)};break}}return r.detach(),o||{node:n,offset:0}}function fr(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function xc(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,o,i)}function yc(n,e,t,r){let o=-1;for(let i=e,s=!1;i!=n.dom;){let a=n.docView.nearestDesc(i,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!s&&l.left>r.left||l.top>r.top?o=a.posBefore:(!s&&l.right-1?o:n.docView.posFromDOM(e,t,-1)}function Ui(n,e,t){let r=n.childNodes.length;if(r&&t.tope.top&&o++}let c;At&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==n.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(a=yc(n,r,o,e))}a==null&&(a=bc(n,s,e));let l=n.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function co(n){return n.top=0&&o==r.nodeValue.length?(l--,d=1):t<0?l--:c++,pt(Se(ke(r,l,c),d),d<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(t<0||o==oe(r))){let l=r.childNodes[o-1];if(l.nodeType==1)return An(l.getBoundingClientRect(),!1)}if(i==null&&o=0)}if(i==null&&o&&(t<0||o==oe(r))){let l=r.childNodes[o-1],c=l.nodeType==3?ke(l,oe(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return pt(Se(c,1),!1)}if(i==null&&o=0)}function pt(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function An(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Ki(n,e,t){let r=n.state,o=n.root.activeElement;r!=e&&n.updateState(e),o!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),o!=n.dom&&o&&o.focus()}}function vc(n,e,t){let r=e.selection,o=t=="up"?r.$from:r.$to;return Ki(n,e,()=>{let{node:i}=n.docView.domFromPos(o.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let s=ji(n,o.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=ke(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;cd.top+1&&(t=="up"?s.top-d.top>(d.bottom-s.top)*2:d.bottom-s.bottom>(s.bottom-d.top)*2))return!1}}return!0})}const Cc=/[\u0590-\u08ac]/;function Sc(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=n.domSelection();return a?!Cc.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?i:s:Ki(n,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:d,anchorOffset:u}=n.domSelectionRange(),p=a.caretBidiLevel;a.modify("move",t,"character");let f=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),x=m&&!f.contains(m.nodeType==1?m:m.parentNode)||l==m&&c==g;try{a.collapse(d,u),l&&(l!=d||c!=u)&&a.extend&&a.extend(l,c)}catch{}return p!=null&&(a.caretBidiLevel=p),x}):r.pos==r.start()||r.pos==r.end()}let uo=null,po=null,ho=!1;function Mc(n,e,t){return uo==e&&po==t?ho:(uo=e,po=t,ho=t=="up"||t=="down"?vc(n,e,t):Sc(n,e,t))}const le=0,fo=1,ze=2,ge=3;class Lt{constructor(e,t,r,o){this.parent=e,this.children=t,this.dom=r,this.contentDOM=o,this.dirty=le,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;tJ(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!t||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;te||s instanceof Yi){o=e-i;break}i=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof Zi&&i.side>=0;r--);if(t<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&t&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?J(i.dom)+1:0}}else{let i,s=!0;for(;i=r=d&&t<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,d);e=s;for(let u=a;u>0;u--){let p=this.children[u-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){o=J(p.dom)+1;break}e-=p.size}o==-1&&(o=0)}if(o>-1&&(c>t||a==this.children.length-1)){t=c;for(let d=a+1;dm&&st){let m=a;a=l,l=m}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,o=0;o=r:er){let a=r+i.border,l=s-i.border;if(e>=a&&t<=l){this.dirty=e==r||t==s?ze:fo,e==a&&t==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=ge:i.markDirty(e-a,t-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?ze:ge}r=s}this.dirty=ze}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?ze:fo;t.dirty{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==le&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Nc extends Lt{constructor(e,t,r,o){super(e,[],t,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class je extends Lt{constructor(e,t,r,o,i){super(e,[],r,o),this.mark=t,this.spec=i}static create(e,t,r,o){let i=o.nodeViews[t.type.name],s=i&&i(t,o,r);return(!s||!s.dom)&&(s=lt.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new je(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&ge||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ge&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=le){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=er(i,0,e,r));for(let a=0;a{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,o),d=c&&c.dom,u=c&&c.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=lt.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!u&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let p=d;return d=Qi(d,r,t),c?l=new Oc(e,t,r,o,d,u||null,p,c,i,s+1):t.isText?new fn(e,t,r,o,d,p,i):new Re(e,t,r,o,d,u||null,p,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>y.empty)}return e}matchesNode(e,t,r){return this.dirty==le&&e.eq(this.node)&&tn(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,o=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new Dc(this,s&&s.node,e);Rc(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e,d):c.type.side>=0&&!u&&l.syncToMarks(d==this.node.childCount?E.none:this.node.child(d).marks,r,e,d),l.placeWidget(c,e,o)},(c,d,u,p)=>{l.syncToMarks(c.marks,r,e,p);let f;l.findNodeMatch(c,d,u,p)||a&&e.state.selection.from>o&&e.state.selection.to-1&&l.updateNodeAt(c,d,u,f,e)||l.updateNextNode(c,d,u,e,p,o)||l.addNode(c,d,u,e,o),o+=c.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==ze)&&(s&&this.protectLocalComposition(e,s),Gi(this.contentDOM,this.children,e),st&&Ac(this.dom))}localCompositionInfo(e,t){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof D)||rt+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,a=Lc(this.node.content,s,r-t,o-t);return a<0?null:{node:i,pos:a,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:o}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new Nc(this,i,t,o);e.input.compositionNodes.push(s),this.children=er(this.children,r,r+o.length,e,s)}update(e,t,r,o){return this.dirty==ge||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,o),!0)}updateInner(e,t,r,o){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=le}updateOuterDeco(e){if(tn(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Xi(this.dom,this.nodeDOM,Qn(this.outerDeco,this.node,t),Qn(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function mo(n,e,t,r,o){Qi(r,e,n);let i=new Re(void 0,n,e,t,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class fn extends Re{constructor(e,t,r,o,i,s,a){super(e,t,r,o,i,null,s,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,o){return this.dirty==ge||this.dirty!=le&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=le||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=le,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let o=this.node.cut(e,t),i=document.createTextNode(o.text);return new fn(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=ge)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Yi extends Lt{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==le&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Oc extends Re{constructor(e,t,r,o,i,s,a,l,c,d){super(e,t,r,o,i,s,a,c,d),this.spec=l}update(e,t,r,o){if(this.dirty==ge)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,r);return i&&this.updateInner(e,t,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,o){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Gi(n,e,t){let r=n.firstChild,o=!1;for(let i=0;i>1,a=Math.min(s,e.length);for(;i-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let d=je.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))i=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a0;){let a;for(;;)if(r){let c=t.children[r-1];if(c instanceof je)t=c,r=c.children.length;else{a=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=n.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}function Ic(n,e){return n.type.side-e.type.side}function Rc(n,e,t,r){let o=e.locals(n),i=0;if(o.length==0){for(let c=0;ci;)a.push(o[s++]);let m=i+p.nodeSize;if(p.isText){let x=m;s!x.inline):a.slice();r(p,g,e.forChild(i,p),f),i=m}}function Ac(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Lc(n,e,t,r){for(let o=0,i=0;o=t){if(i>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a=0&&c+e.length+a>=t)return a+c;if(t==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function er(n,e,t,r,o){let i=[];for(let s=0,a=0;s=t||d<=e?i.push(l):(ct&&i.push(l.slice(t-c,l.size,r)))}return i}function mr(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let o=n.docView.nearestDesc(t.focusNode),i=o&&o.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(hn(t)){for(l=s;o&&!o.node;)o=o.parent;let u=o.node;if(o&&u.isAtom&&M.isSelectable(u)&&o.parent&&!(u.isInline&&ac(t.focusNode,t.focusOffset,o.dom))){let p=o.posBefore;c=new M(s==p?a:r.resolve(p))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let u=s,p=s;for(let f=0;f{(t.anchorNode!=r||t.anchorOffset!=o)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!es(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function zc(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,J(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&G&&Ie<=11&&(t.disabled=!0,t.disabled=!1)}function ts(n,e){if(e instanceof M){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(ko(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else ko(n)}function ko(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function gr(n,e,t,r){return n.someProp("createSelectionBetween",o=>o(n,e,t))||D.between(e,t,r)}function wo(n){return n.editable&&!n.hasFocus()?!1:ns(n)}function ns(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Fc(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Ue(e.node,e.offset,t.anchorNode,t.anchorOffset)}function tr(n,e){let{$anchor:t,$head:r}=n.selection,o=e>0?t.max(r):t.min(r),i=o.parent.inlineContent?o.depth?n.doc.resolve(e>0?o.after():o.before()):null:o;return i&&R.findFrom(i,e)}function Me(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function vo(n,e,t){let r=n.state.selection;if(r instanceof D)if(t.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=n.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return Me(n,new D(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let o=tr(n.state,e);return o&&o instanceof M?Me(n,o):!1}else if(!(re&&t.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let a=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=n.docView.descAt(a))&&!s.contentDOM?M.isSelectable(i)?Me(n,new M(e<0?n.state.doc.resolve(o.pos-i.nodeSize):o)):At?Me(n,new D(n.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof M&&r.node.isInline)return Me(n,new D(e>0?r.$to:r.$from));{let o=tr(n.state,e);return o?Me(n,o):!1}}}function nn(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function vt(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Ye(n,e){return e<0?Bc(n):Vc(n)}function Bc(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o,i,s=!1;for(ae&&t.nodeType==1&&r0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(vt(a,-1))o=t,i=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if(rs(t))break;{let a=t.previousSibling;for(;a&&vt(a,-1);)o=t.parentNode,i=J(a),a=a.previousSibling;if(a)t=a,r=nn(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?nr(n,t,r):o&&nr(n,o,i)}function Vc(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o=nn(t),i,s;for(;;)if(r{n.state==o&&ve(n)},50)}function Co(n,e){let t=n.state.doc.resolve(e);if(!(q||Wi)&&t.parent.inlineContent){let o=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>o.top&&s1)return i.lefto.top&&s1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function So(n,e,t){let r=n.state.selection;if(r instanceof D&&!r.empty||t.indexOf("s")>-1||re&&t.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=tr(n.state,e);if(s&&s instanceof M)return Me(n,s)}if(!o.parent.inlineContent){let s=e<0?o:i,a=r instanceof se?R.near(s,e):R.findFrom(s,e);return a?Me(n,a):!1}return!1}function Mo(n,e){if(!(n.state.selection instanceof D))return!0;let{$head:t,$anchor:r,empty:o}=n.state.selection;if(!t.sameParent(r))return!0;if(!o)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let s=n.state.tr;return e<0?s.delete(t.pos-i.nodeSize,t.pos):s.delete(t.pos,t.pos+i.nodeSize),n.dispatch(s),!0}return!1}function No(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Wc(n){if(!j||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;No(n,r,"true"),setTimeout(()=>No(n,r,"false"),20)}return!1}function Hc(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Jc(n,e){let t=e.keyCode,r=Hc(e);if(t==8||re&&t==72&&r=="c")return Mo(n,-1)||Ye(n,-1);if(t==46&&!e.shiftKey||re&&t==68&&r=="c")return Mo(n,1)||Ye(n,1);if(t==13||t==27)return!0;if(t==37||re&&t==66&&r=="c"){let o=t==37?Co(n,n.state.selection.from)=="ltr"?-1:1:-1;return vo(n,o,r)||Ye(n,o)}else if(t==39||re&&t==70&&r=="c"){let o=t==39?Co(n,n.state.selection.from)=="ltr"?1:-1:1;return vo(n,o,r)||Ye(n,o)}else{if(t==38||re&&t==80&&r=="c")return So(n,-1,r)||Ye(n,-1);if(t==40||re&&t==78&&r=="c")return Wc(n)||So(n,1,r)||Ye(n,1);if(r==(re?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function xr(n,e){n.someProp("transformCopied",f=>{e=f(e,n)});let t=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let f=r.firstChild;t.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let s=n.someProp("clipboardSerializer")||lt.fromSchema(n.state.schema),a=ds(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=cs[c.nodeName.toLowerCase()]);){for(let f=d.length-1;f>=0;f--){let m=a.createElement(d[f]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),u++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${i}${u?` -${u}`:""} ${JSON.stringify(t)}`);let p=n.someProp("clipboardTextSerializer",f=>f(e,n))||e.content.textBetween(0,e.content.size,` -`);return{dom:l,text:p,slice:e}}function as(n,e,t,r,o){let i=o.parent.type.spec.code,s,a;if(!t&&!e)return null;let l=!!e&&(r||i||!t);if(l){if(n.someProp("transformPastedText",p=>{e=p(e,i||r,n)}),i)return a=new w(y.from(n.state.schema.text(e.replace(/\r\n?/g,` -`))),0,0),n.someProp("transformPasted",p=>{a=p(a,n,!0)}),a;let u=n.someProp("clipboardTextParser",p=>p(e,o,r,n));if(u)a=u;else{let p=o.marks(),{schema:h}=n.state,m=ct.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let x=s.appendChild(document.createElement("p"));g&&x.appendChild(m.serializeNode(h.text(g,p)))})}}else n.someProp("transformPastedHTML",u=>{t=u(t,n)}),s=ad(t),Rt&&ld(s);let c=s&&s.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||St.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||d),context:o,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!od.test(p.parentNode.nodeName)?{ignore:!0}:null}})),d)a=cd(To(a,+d[1],+d[2]),d[4]);else if(a=w.maxOpen(id(a.content,o),!0),a.openStart||a.openEnd){let u=0,p=0;for(let h=a.content.firstChild;u{a=u(a,n,l)}),a}const od=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function id(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.index(t)),i,s=[];if(n.forEach(a=>{if(!s)return;let l=o.findWrapping(a.type),c;if(!l)return s=null;if(c=s.length&&i.length&&cs(l,i,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=ds(s[s.length-1],i.length));let d=ls(a,l);s.push(d),o=o.matchType(d.type),i=l}}),s)return y.from(s)}return n}function ls(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,y.from(n));return n}function cs(n,e,t,r,o){if(o1&&(i=0),o=t&&(a=e<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(y.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(a))}function To(n,e,t){return et})),Pn.createHTML(n)):n}function ad(n){let e=/^(\s*]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=ps().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),o;if((o=r&&us[r[1].toLowerCase()])&&(n=o.map(i=>"<"+i+">").join("")+n+o.map(i=>"").reverse().join("")),t.innerHTML=sd(n),o)for(let i=0;i=0;a-=2){let l=t.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;o=y.from(l.create(r[a+1],o)),i++,s++}return new w(o,i,s)}const Z={},Y={},dd={touchstart:!0,touchmove:!0};class ud{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function pd(n){for(let e in Z){let t=Z[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{hd(n,r)&&!br(n,r)&&(n.editable||!(r.type in Y))&&t(n,r)},dd[e]?{passive:!0}:void 0)}j&&n.dom.addEventListener("input",()=>null),or(n)}function Ee(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function fd(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function or(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>br(n,r))})}function br(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function hd(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function md(n,e){!br(n,e)&&Z[e.type]&&(n.editable||!(e.type in Y))&&Z[e.type](n,e)}Y.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!hs(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(we&&J&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),at&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",o=>o(n,Pe(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||rd(n,t)?t.preventDefault():Ee(n,"key")};Y.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Y.keypress=(n,e)=>{let t=e;if(hs(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||re&&t.metaKey)return;if(n.someProp("handleKeyPress",o=>o(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof D)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,o,i))&&n.dispatch(i()),t.preventDefault()}};function mn(n){return{left:n.clientX,top:n.clientY}}function gd(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function yr(n,e,t,r,o){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(n.someProp(e,a=>s>i.depth?a(n,t,i.nodeAfter,i.before(s),o,!0):a(n,t,i.node(s),i.before(s),o,!1)))return!0;return!1}function nt(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function xd(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&M.isSelectable(r)?(nt(n,new M(t)),!0):!1}function bd(n,e){if(e==-1)return!1;let t=n.state.selection,r,o;t instanceof M&&(r=t.node);let i=n.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(M.isSelectable(a)){r&&t.$from.depth>0&&s>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?o=i.before(t.$from.depth):o=i.before(s);break}}return o!=null?(nt(n,M.create(n.state.doc,o)),!0):!1}function yd(n,e,t,r,o){return yr(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(o?bd(n,t):xd(n,t))}function kd(n,e,t,r){return yr(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",o=>o(n,e,r))}function wd(n,e,t,r){return yr(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",o=>o(n,e,r))||vd(n,t,r)}function vd(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(nt(n,D.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)nt(n,D.create(r,a+1,a+1+s.content.size));else if(M.isSelectable(s))nt(n,M.create(r,a));else continue;return!0}}function kr(n){return rn(n)}const fs=re?"metaKey":"ctrlKey";Z.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=kr(n),o=Date.now(),i="singleClick";o-n.input.lastClick.time<500&&gd(t,n.input.lastClick)&&!t[fs]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:o,x:t.clientX,y:t.clientY,type:i,button:t.button};let s=n.posAtCoords(mn(t));s&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Cd(n,s,t,!!r)):(i=="doubleClick"?kd:wd)(n,s.pos,s.inside,t)?t.preventDefault():Ee(n,"pointer"))};class Cd{constructor(e,t,r,o){this.view=e,this.pos=t,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[fs],this.allowDefault=r.shiftKey;let i,s;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let d=e.state.doc.resolve(t.pos);i=d.parent,s=d.depth?d.before():0}const a=o?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof M&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ae&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ee(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>ve(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(mn(e))),this.updateAllowDefault(e),this.allowDefault||!t?Ee(this.view,"pointer"):yd(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||j&&this.mightDrag&&!this.mightDrag.node.isAtom||J&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(nt(this.view,I.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Ee(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ee(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Z.touchstart=n=>{n.input.lastTouch=Date.now(),kr(n),Ee(n,"pointer")};Z.touchmove=n=>{n.input.lastTouch=Date.now(),Ee(n,"pointer")};Z.contextmenu=n=>kr(n);function hs(n,e){return n.composing?!0:j&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Sd=we?5e3:-1;Y.compositionstart=Y.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof D&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||J&&qi&&Md(n)))n.markCursor=n.state.storedMarks||t.marks(),rn(n,!0),n.markCursor=null;else if(rn(n,!e.selection.empty),ae&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let a=n.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}n.input.composing=!0}ms(n,Sd)};function Md(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return r.nodeType==1&&r.contentEditable=="false"}Y.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,ms(n,20))};function ms(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>rn(n),e))}function gs(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Od());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Nd(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=bc(e.focusNode,e.focusOffset),r=yc(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let o=r.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t||r}function Od(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function rn(n,e=!1){if(!(we&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),gs(n),e||n.docView&&n.docView.dirty){let t=mr(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function Td(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Ot=G&&Ae<15||at&&Cc<604;Z.copy=Y.cut=(n,e)=>{let t=e,r=n.state.selection,o=t.type=="cut";if(r.empty)return;let i=Ot?null:t.clipboardData,s=r.content(),{dom:a,text:l}=xr(n,s);i?(t.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):Td(n,a),o&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Dd(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Ed(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Tt(n,r.value,null,o,e):Tt(n,r.textContent,r.innerHTML,o,e)},50)}function Tt(n,e,t,r,o){let i=as(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,o,i||w.empty)))return!0;if(!i)return!1;let s=Dd(i),a=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(i);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function xs(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Y.paste=(n,e)=>{let t=e;if(n.composing&&!we)return;let r=Ot?null:t.clipboardData,o=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Tt(n,xs(r),r.getData("text/html"),o,t)?t.preventDefault():Ed(n,t)};class bs{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Ad=re?"altKey":"ctrlKey";function ys(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[Ad]}Z.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let o=n.state.selection,i=o.empty?null:n.posAtCoords(mn(t)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof M?o.to-1:o.to))){if(r&&r.mightDrag)s=M.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=n.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=n.docView&&(s=M.create(n.state.doc,u.posBefore))}}let a=(s||n.state.selection).content(),{dom:l,text:c,slice:d}=xr(n,a);(!t.dataTransfer.files.length||!J||Hi>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Ot?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Ot||t.dataTransfer.setData("text/plain",c),n.dragging=new bs(d,ys(n,t),s)};Z.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Y.dragover=Y.dragenter=(n,e)=>e.preventDefault();Y.drop=(n,e)=>{try{Id(n,e,n.dragging)}finally{n.dragging=null}};function Id(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(mn(e));if(!r)return;let o=n.state.doc.resolve(r.pos),i=t&&t.slice;i?n.someProp("transformPasted",h=>{i=h(i,n,!1)}):i=as(n,xs(e.dataTransfer),Ot?null:e.dataTransfer.getData("text/html"),!1,o);let s=!!(t&&ys(n,e));if(n.someProp("handleDrop",h=>h(n,e,i||w.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?Jl(n.state.doc,o.pos,i):o.pos;a==null&&(a=o.pos);let l=n.state.tr;if(s){let{node:h}=t;h?h.replace(l):l.deleteSelection()}let c=l.mapping.map(a),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,u=l.doc;if(d?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i),l.doc.eq(u))return;let p=l.doc.resolve(c);if(d&&M.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new M(p));else{let h=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((m,g,x,k)=>h=k),l.setSelection(gr(n,p,l.doc.resolve(h)))}n.focus(),n.dispatch(l.setMeta("uiEvent","drop"))}Z.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&ve(n)},20))};Z.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};Z.beforeinput=(n,e)=>{if(J&&we&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,Pe(8,"Backspace")))))return;let{$cursor:o}=n.state.selection;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let n in Y)Z[n]=Y[n];function Dt(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class on{constructor(e,t){this.toDOM=e,this.spec=t||We,this.side=this.spec.side||0}map(e,t,r,o){let{pos:i,deleted:s}=e.mapResult(t.from+o,this.side<0?-1:1);return s?null:new ie(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof on&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Dt(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Re{constructor(e,t){this.attrs=e,this.spec=t||We}map(e,t,r,o){let i=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new ie(i,s,this)}valid(e,t){return t.from=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let s=0;se){let a=this.children[s]+1;this.children[s+2].findInner(e-a,t-a,r,o+a,i)}}map(e,t,r){return this==U||e.maps.length==0?this:this.mapInner(e,t,0,0,r||We)}mapInner(e,t,r,o,i){let s;for(let a=0;a{let c=l+r,d;if(d=ws(t,a,c)){for(o||(o=this.children.slice());ia&&u.to=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,s=i+t.content.size;for(let a=0;ai&&l.type instanceof Re){let c=Math.max(i,l.from)-i,d=Math.min(s,l.to)-i;co.map(e,t,We));return Ne.from(r)}forChild(e,t){if(t.isLeaf)return z.empty;let r=[];for(let o=0;ot instanceof z)?e:e.reduce((t,r)=>t.concat(r instanceof z?r:r.members),[]))}}forEachSet(e){for(let t=0;t{let x=g-m-(h-p);for(let k=0;kT+d-u)continue;let N=a[k]+d-u;h>=N?a[k+1]=p<=N?-2:-1:p>=d&&x&&(a[k]+=x,a[k+1]+=x)}u+=x}),d=t.maps[c].map(d,-1)}let l=!1;for(let c=0;c=r.content.size){l=!0;continue}let p=t.map(n[c+1]+i,-1),h=p-o,{index:m,offset:g}=r.content.findIndex(u),x=r.maybeChild(m);if(x&&g==u&&g+x.nodeSize==h){let k=a[c+2].mapInner(t,x,d+1,n[c]+i+1,s);k!=U?(a[c]=u,a[c+1]=h,a[c+2]=k):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=Ld(a,n,e,t,o,i,s),d=sn(c,r,0,s);e=d.local;for(let u=0;ut&&s.to{let c=ws(n,a,l+t);if(c){i=!0;let d=sn(c,a,t+l+1,r);d!=U&&o.push(l,l+a.nodeSize,d)}});let s=ks(i?vs(n):n,-t).sort(He);for(let a=0;a0;)e++;n.splice(e,0,t)}function zn(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=U&&e.push(r)}),n.cursorWrapper&&e.push(z.create(n.state.doc,[n.cursorWrapper.deco])),Ne.from(e)}const Pd={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},zd=G&&Ae<=11;class Fd{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Bd{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Fd,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;oo.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():j&&e.composing&&r.some(o=>o.type=="childList"&&o.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),zd&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Pd)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;tthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(vo(this.view)){if(this.suppressingSelectionUpdates)return ve(this.view);if(G&&Ae<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&je(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let i=e.focusNode;i;i=st(i))t.add(i);for(let i=e.anchorNode;i;i=st(i))if(t.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&vo(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,a=!1,l=[];if(e.editable)for(let d=0;dd.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of l)if(d.nodeName=="BR"&&d.parentNode){let u=d.nextSibling;for(;u&&u.nodeType==1;){if(u.contentEditable=="false"){d.parentNode.removeChild(d);break}u=u.firstChild}}}else if(ae&&l.length){let d=l.filter(u=>u.nodeName=="BR");if(d.length==2){let[u,p]=d;u.parentNode&&u.parentNode.parentNode==p.parentNode?p.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let p of d){let h=p.parentNode;h&&h.nodeName=="LI"&&(!u||$d(e,u)!=h)&&p.remove()}}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||o)&&(i>-1&&(e.docView.markDirty(i,s),Vd(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Wd(e,l)),this.handleDOMChange(i,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||ve(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;do;x--){let k=r.childNodes[x-1],T=k.pmViewDesc;if(k.nodeName=="BR"&&!T){i=x;break}if(!T||T.size)break}let u=n.state.doc,p=n.someProp("domParser")||St.fromSchema(n.state.schema),h=u.resolve(s),m=null,g=p.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:qd,context:h});if(c&&c[0].pos!=null){let x=c[0].pos,k=c[1]&&c[1].pos;k==null&&(k=x),m={anchor:x+s,head:k+s}}return{doc:g,sel:m,from:s,to:a}}function qd(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(j&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||j&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Jd=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Ud(n,e,t,r,o){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let S=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,A=mr(n,S);if(A&&!n.state.selection.eq(A)){if(J&&we&&n.input.lastKeyCode===13&&Date.now()-100O(n,Pe(13,"Enter"))))return;let C=n.state.tr.setSelection(A);S=="pointer"?C.setMeta("pointer",!0):S=="key"&&C.scrollIntoView(),i&&C.setMeta("composition",i),n.dispatch(C)}return}let s=n.state.doc.resolve(e),a=s.sharedDepth(t);e=s.before(a+1),t=n.state.doc.resolve(t).after(a+1);let l=n.state.selection,c=Hd(n,e,t),d=n.state.doc,u=d.slice(c.from,c.to),p,h;n.input.lastKeyCode===8&&Date.now()-100Date.now()-225||we)&&o.some(S=>S.nodeType==1&&!Jd.test(S.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",S=>S(n,Pe(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof D&&!l.empty&&l.$head.sameParent(l.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let S=Lo(n,n.state.doc,c.sel);if(S&&!S.eq(n.state.selection)){let A=n.state.tr.setSelection(S);i&&A.setMeta("composition",i),n.dispatch(A)}}return}n.state.selection.fromn.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?m.start=n.state.selection.from:m.endA=n.state.selection.to-2&&n.state.selection.to<=c.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),G&&Ae<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=c.doc.resolveNoCache(m.start-c.from),x=c.doc.resolveNoCache(m.endB-c.from),k=d.resolve(m.start),T=g.sameParent(x)&&g.parent.inlineContent&&k.end()>=m.endA;if((at&&n.input.lastIOSEnter>Date.now()-225&&(!T||o.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!T&&g.posS(n,Pe(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&Kd(d,m.start,m.endA,g,x)&&n.someProp("handleKeyDown",S=>S(n,Pe(8,"Backspace")))){we&&J&&n.domObserver.suppressSelectionUpdates();return}J&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),we&&!T&&g.start()!=x.start()&&x.parentOffset==0&&g.depth==x.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,x=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(S){return S(n,Pe(13,"Enter"))})},20));let N=m.start,F=m.endA,X=S=>{let A=S||n.state.tr.replace(N,F,c.doc.slice(m.start-c.from,m.endB-c.from));if(c.sel){let C=Lo(n,A.doc,c.sel);C&&!(J&&n.composing&&C.empty&&(m.start!=m.endB||n.input.lastChromeDeleteve(n),20));let S=X(n.state.tr.delete(N,F)),A=d.resolve(m.start).marksAcross(d.resolve(m.endA));A&&S.ensureMarks(A),n.dispatch(S)}else if(m.endA==m.endB&&($=jd(g.parent.content.cut(g.parentOffset,x.parentOffset),k.parent.content.cut(k.parentOffset,m.endA-k.start())))){let S=X(n.state.tr);$.type=="add"?S.addMark(N,F,$.mark):S.removeMark(N,F,$.mark),n.dispatch(S)}else if(g.parent.child(g.index()).isText&&g.index()==x.index()-(x.textOffset?0:1)){let S=g.parent.textBetween(g.parentOffset,x.parentOffset),A=()=>X(n.state.tr.insertText(S,N,F));n.someProp("handleTextInput",C=>C(n,N,F,S,A))||n.dispatch(A())}else n.dispatch(X());else n.dispatch(X())}function Lo(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:gr(n,e.resolve(t.anchor),e.resolve(t.head))}function jd(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,o=t,i=r,s,a,l;for(let d=0;dd.mark(a.addToSet(d.marks));else if(o.length==0&&i.length==1)a=i[0],s="remove",l=d=>d.mark(a.removeFromSet(d.marks));else return null;let c=[];for(let d=0;dt||Fn(s,!0,!1)0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,o++,e=!1;if(t){let i=n.node(r).maybeChild(n.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function Zd(n,e,t,r,o){let i=n.findDiffStart(e,t);if(i==null)return null;let{a:s,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(o=="end"){let l=Math.max(0,i-Math.min(s,a));r-=s+l-i}if(s=s?i-r:0;i-=l,i&&i=a?i-r:0;i-=l,i&&i=56320&&e<=57343&&t>=55296&&t<=56319}class Cs{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new ud,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(_o),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Bo(this),Fo(this),this.nodeViews=Vo(this),this.docView=go(this.state.doc,zo(this),zn(this),this.dom,this),this.domObserver=new Bd(this,(r,o,i,s)=>Ud(this,r,o,i,s)),this.domObserver.start(),pd(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&or(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(_o),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(gs(this),s=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=Vo(this);Gd(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&or(this),this.editable=Bo(this),Fo(this);let l=zn(this),c=zo(this),d=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",u=i||!this.docView.matchesNode(e.doc,c,l);(u||!e.selection.eq(o.selection))&&(s=!0);let p=d=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Nc(this);if(s){this.domObserver.stop();let h=u&&(G||J)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&Yd(o.selection,e.selection);if(u){let m=J?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Nd(this)),(i||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=go(e.doc,c,l,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Yc(this))?ve(this,h):(rs(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():p&&Oc(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof M){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&co(this,t.getBoundingClientRect(),e)}else co(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t0&&it.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Rc(this,e)}coordsAtPos(e,t=1){return Zi(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let o=this.docView.posFromDOM(e,t,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,t){return Bc(this,t||this.state,e)}pasteHTML(e,t){return Tt(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Tt(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return xr(this,e)}destroy(){this.docView&&(fd(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],zn(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,gc())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return md(this,e)}domSelectionRange(){let e=this.domSelection();return e?j&&this.root.nodeType===11&&wc(this.dom.ownerDocument)==this.dom&&_d(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Cs.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function zo(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[ie.node(0,n.state.doc.content.size,e)]}function Fo(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:ie.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Bo(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Yd(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Vo(n){let e=Object.create(null);function t(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Gd(n,e){let t=0,r=0;for(let o in n){if(n[o]!=e[o])return!0;t++}for(let o in e)r++;return t!=r}function _o(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}function Xd(n,e=!1){return n.key==="Enter"&&(n.isComposing===!0||e||n.keyCode===229)}function Qd(n){return n.key==="Tab"&&n.shiftKey===!0&&!n.altKey&&!n.ctrlKey&&!n.metaKey}const Bn=new vl({nodes:{doc:{content:"paragraph+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:()=>["p",0]},text:{group:"inline"},atMention:{attrs:{label:{validate:"string"},path:{validate:"string"},fsPath:{validate:"string",default:""}},inline:!0,group:"inline",draggable:!1,selectable:!1,toDOM:n=>Vn({text:n.attrs.label,iconNode:du(),dataAttributes:{"at-mention-label":n.attrs.label,"at-mention-path":n.attrs.path,"at-mention-fs-path":n.attrs.fsPath}}),parseDOM:[{tag:"span[at-mention-label][at-mention-path]",getAttrs:n=>{const e=n;return{label:e.getAttribute("at-mention-label"),path:e.getAttribute("at-mention-path"),fsPath:e.getAttribute("at-mention-fs-path")??""}}}]},agentMention:{attrs:{name:{validate:"string"},displayName:{validate:"string",default:""},path:{validate:"string"}},inline:!0,group:"inline",draggable:!1,selectable:!1,toDOM:n=>{const e=n.attrs.displayName||n.attrs.name;return Vn({text:`@${e}`,dataAttributes:{"agent-mention-name":n.attrs.name,"agent-mention-display-name":e,"agent-mention-path":n.attrs.path}})},parseDOM:[{tag:"span[agent-mention-name][agent-mention-path]",getAttrs:n=>{const e=n,t=e.getAttribute("agent-mention-name")??"";return{name:t,displayName:e.getAttribute("agent-mention-display-name")??t,path:e.getAttribute("agent-mention-path")??""}}}]},skillMention:{attrs:{name:{validate:"string"},displayName:{validate:"string",default:""},path:{validate:"string"},description:{validate:"string",default:""}},inline:!0,group:"inline",draggable:!1,selectable:!1,toDOM:n=>{const e=n.attrs.displayName||n.attrs.name;return Vn({text:e,icon:"$",dataAttributes:{"skill-mention-name":n.attrs.name,"skill-mention-display-name":e,"skill-mention-path":n.attrs.path},title:n.attrs.description})},parseDOM:[{tag:"span[skill-mention-name][skill-mention-path]",getAttrs:n=>{const e=n,t=e.getAttribute("skill-mention-name")??"";return{name:t,displayName:e.getAttribute("skill-mention-display-name")??t,path:e.getAttribute("skill-mention-path")??"",description:e.getAttribute("title")??""}}}]}},marks:{}}),Ut=new oc("agentPromptPlaceholder"),eu=rt.forwardRef(function({ariaLabel:e,className:t,minHeight:r="2.75rem",onAutocompleteChange:o,onAutocompleteKeyDown:i,onPlanModeShortcut:s,onSubmit:a,onTextChange:l,onTriggerToken:c,placeholder:d,singleLine:u=!1,value:p},h){const m=b.useRef(null),g=b.useRef(null),x=b.useRef(a),k=b.useRef(o),T=b.useRef(i),N=b.useRef(s),F=b.useRef(l),X=b.useRef(c),$=b.useRef(p),S=b.useRef(u);x.current=a,k.current=o,T.current=i,N.current=s,F.current=l,X.current=c,S.current=u,b.useImperativeHandle(h,()=>({focus(){g.current?.focus()},getText(){return $.current},insertMention(C){const O=g.current;O&&au(O,C)},insertMentions(C){const O=g.current;!O||C.length===0||lu(O,C)},insertText(C){const O=g.current;O&&su(O,C)}}),[]),b.useLayoutEffect(()=>{const C=m.current;if(!C)return;const O=new Cs(C,{state:et.create({doc:Ss($.current),plugins:[nu("")]}),attributes:{"aria-label":"","data-codex-composer":"true","data-virtualkeyboard":"true",role:"textbox",class:"ProseMirror prompt-editor-view",style:"min-height: 2.75rem; font-size: var(--codex-chat-font-size); height: auto; resize: none;"},dispatchTransaction(L){const R=O.state.apply(L);O.updateState(R);const B=ru(R.doc),dt=$.current;if(B!==dt){$.current=B;const pe=tu(dt,B);pe&&X.current?.(pe),F.current(B)}k.current?.(Ns(O))},handleKeyDown(L,R){return Xd(R,L.composing)?!1:Qd(R)&&N.current?(R.preventDefault(),N.current(),!0):cu(R.key)&&T.current?.(R.key)?(R.preventDefault(),!0):(R.metaKey||R.ctrlKey)&&R.key==="Enter"?(R.preventDefault(),x.current(),!0):R.key!=="Enter"?!1:R.shiftKey||R.altKey?(R.preventDefault(),S.current?!0:_i(L.state,L.dispatch,L)):(R.preventDefault(),x.current(),!0)}});return g.current=O,()=>{O.destroy(),g.current=null}},[]),b.useLayoutEffect(()=>{const C=g.current;C&&C.dispatch(C.state.tr.setMeta(Ut,d))},[d]),b.useLayoutEffect(()=>{const C=g.current;if(!C)return;const O=e??d;O?C.dom.setAttribute("aria-label",O):C.dom.removeAttribute("aria-label")},[e,d]),b.useLayoutEffect(()=>{const C=g.current;C&&(C.dom.style.minHeight=r)},[r]),b.useLayoutEffect(()=>{const C=g.current;!C||p===$.current||($.current=p,iu(C,p))},[p]);const A=["text-size-chat","[&_.ProseMirror]:focus-visible:outline-none","text-token-foreground",u?"flex h-9 max-h-none items-center overflow-hidden [&_.ProseMirror]:!h-5 [&_.ProseMirror]:!min-h-5 [&_.ProseMirror]:min-w-0 [&_.ProseMirror]:flex-1 [&_.ProseMirror]:overflow-hidden [&_.ProseMirror]:whitespace-nowrap [&_.ProseMirror_p]:overflow-hidden [&_.ProseMirror_p]:text-ellipsis [&_.ProseMirror_p]:whitespace-nowrap":"h-auto max-h-[25dvh] overflow-y-auto [&_.ProseMirror]:h-auto [&_.ProseMirror]:min-h-[2rem]","[&_.ProseMirror]:resize-none","[&_.ProseMirror_p]:m-0",t].filter(Boolean).join(" ");return rt.createElement("div",{className:A,onMouseDown:C=>{const O=g.current;O&&C.target instanceof Node&&!O.dom.contains(C.target)&&(C.preventDefault(),O.focus())},ref:m})});function tu(n,e){if(e.length!==n.length+1)return null;let t=0;for(;tn,apply(e,t){return e.getMeta(Ut)??t}},props:{decorations(e){const t=Ut.getState(e)??"";if(!t||e.doc.childCount!==1)return null;const r=e.doc.firstChild;return!r?.isTextblock||r.content.size!==0?null:z.create(e.doc,[ie.node(0,r.nodeSize,{class:"placeholder","data-placeholder":t})])}}})}function Ss(n){const e=n.split(` -`);return Bn.nodes.doc.create(null,e.map(t=>Bn.nodes.paragraph.create(null,t.length>0?Bn.text(t):null)))}function ru(n){const e=[];return n.forEach(t=>{const r=[];t.forEach(o=>{r.push(ou(o))}),e.push(r.join(""))}),e.join(` -`)}function ou(n){switch(n.type.name){case"atMention":return $t({kind:"at",label:n.attrs.label,name:n.attrs.label,path:n.attrs.path});case"agentMention":return $t({kind:"agent",displayName:n.attrs.displayName||n.attrs.name,name:n.attrs.name,path:n.attrs.path});case"skillMention":return $t({kind:"skill",displayName:n.attrs.displayName||n.attrs.name,name:n.attrs.name,path:n.attrs.path});default:return n.textContent}}function iu(n,e){const t=Ss(e),r=n.state.tr.replaceWith(0,n.state.doc.content.size,t.content);r.setSelection(D.atEnd(r.doc)),n.dispatch(r)}function su(n,e){const{state:t}=n,{from:r,to:o}=t.selection,i=e.startsWith("@")?"@":e.startsWith("$")?"$":null,s=t.doc.textBetween(Math.max(0,r-1),r,` +`);return{dom:l,text:p,slice:e}}function is(n,e,t,r,o){let i=o.parent.type.spec.code,s,a;if(!t&&!e)return null;let l=!!e&&(r||i||!t);if(l){if(n.someProp("transformPastedText",p=>{e=p(e,i||r,n)}),i)return a=new w(y.from(n.state.schema.text(e.replace(/\r\n?/g,` +`))),0,0),n.someProp("transformPasted",p=>{a=p(a,n,!0)}),a;let u=n.someProp("clipboardTextParser",p=>p(e,o,r,n));if(u)a=u;else{let p=o.marks(),{schema:f}=n.state,m=lt.fromSchema(f);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let x=s.appendChild(document.createElement("p"));g&&x.appendChild(m.serializeNode(f.text(g,p)))})}}else n.someProp("transformPastedHTML",u=>{t=u(t,n)}),s=Kc(t),At&&Zc(s);let c=s&&s.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||St.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||d),context:o,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!qc.test(p.parentNode.nodeName)?{ignore:!0}:null}})),d)a=Yc(Oo(a,+d[1],+d[2]),d[4]);else if(a=w.maxOpen(Uc(a.content,o),!0),a.openStart||a.openEnd){let u=0,p=0;for(let f=a.content.firstChild;u{a=u(a,n,l)}),a}const qc=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Uc(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.index(t)),i,s=[];if(n.forEach(a=>{if(!s)return;let l=o.findWrapping(a.type),c;if(!l)return s=null;if(c=s.length&&i.length&&as(l,i,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=ls(s[s.length-1],i.length));let d=ss(a,l);s.push(d),o=o.matchType(d.type),i=l}}),s)return y.from(s)}return n}function ss(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,y.from(n));return n}function as(n,e,t,r,o){if(o1&&(i=0),o=t&&(a=e<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(y.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(a))}function Oo(n,e,t){return et})),Pn.createHTML(n)):n}function Kc(n){let e=/^(\s*]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=ds().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),o;if((o=r&&cs[r[1].toLowerCase()])&&(n=o.map(i=>"<"+i+">").join("")+n+o.map(i=>"").reverse().join("")),t.innerHTML=jc(n),o)for(let i=0;i=0;a-=2){let l=t.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;o=y.from(l.create(r[a+1],o)),i++,s++}return new w(o,i,s)}const Z={},Y={},Gc={touchstart:!0,touchmove:!0};class Xc{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Qc(n){for(let e in Z){let t=Z[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{td(n,r)&&!br(n,r)&&(n.editable||!(r.type in Y))&&t(n,r)},Gc[e]?{passive:!0}:void 0)}j&&n.dom.addEventListener("input",()=>null),or(n)}function Ee(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function ed(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function or(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>br(n,r))})}function br(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function td(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function nd(n,e){!br(n,e)&&Z[e.type]&&(n.editable||!(e.type in Y))&&Z[e.type](n,e)}Y.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!ps(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(we&&q&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),st&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",o=>o(n,Pe(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Jc(n,t)?t.preventDefault():Ee(n,"key")};Y.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Y.keypress=(n,e)=>{let t=e;if(ps(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||re&&t.metaKey)return;if(n.someProp("handleKeyPress",o=>o(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof D)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,o,i))&&n.dispatch(i()),t.preventDefault()}};function mn(n){return{left:n.clientX,top:n.clientY}}function rd(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function yr(n,e,t,r,o){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(n.someProp(e,a=>s>i.depth?a(n,t,i.nodeAfter,i.before(s),o,!0):a(n,t,i.node(s),i.before(s),o,!1)))return!0;return!1}function tt(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function od(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&M.isSelectable(r)?(tt(n,new M(t)),!0):!1}function id(n,e){if(e==-1)return!1;let t=n.state.selection,r,o;t instanceof M&&(r=t.node);let i=n.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(M.isSelectable(a)){r&&t.$from.depth>0&&s>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?o=i.before(t.$from.depth):o=i.before(s);break}}return o!=null?(tt(n,M.create(n.state.doc,o)),!0):!1}function sd(n,e,t,r,o){return yr(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(o?id(n,t):od(n,t))}function ad(n,e,t,r){return yr(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",o=>o(n,e,r))}function ld(n,e,t,r){return yr(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",o=>o(n,e,r))||cd(n,t,r)}function cd(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(tt(n,D.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)tt(n,D.create(r,a+1,a+1+s.content.size));else if(M.isSelectable(s))tt(n,M.create(r,a));else continue;return!0}}function kr(n){return rn(n)}const us=re?"metaKey":"ctrlKey";Z.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=kr(n),o=Date.now(),i="singleClick";o-n.input.lastClick.time<500&&rd(t,n.input.lastClick)&&!t[us]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:o,x:t.clientX,y:t.clientY,type:i,button:t.button};let s=n.posAtCoords(mn(t));s&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new dd(n,s,t,!!r)):(i=="doubleClick"?ad:ld)(n,s.pos,s.inside,t)?t.preventDefault():Ee(n,"pointer"))};class dd{constructor(e,t,r,o){this.view=e,this.pos=t,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[us],this.allowDefault=r.shiftKey;let i,s;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let d=e.state.doc.resolve(t.pos);i=d.parent,s=d.depth?d.before():0}const a=o?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof M&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ae&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ee(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>ve(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(mn(e))),this.updateAllowDefault(e),this.allowDefault||!t?Ee(this.view,"pointer"):sd(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||j&&this.mightDrag&&!this.mightDrag.node.isAtom||q&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(tt(this.view,R.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Ee(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ee(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Z.touchstart=n=>{n.input.lastTouch=Date.now(),kr(n),Ee(n,"pointer")};Z.touchmove=n=>{n.input.lastTouch=Date.now(),Ee(n,"pointer")};Z.contextmenu=n=>kr(n);function ps(n,e){return n.composing?!0:j&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const ud=we?5e3:-1;Y.compositionstart=Y.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof D&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||q&&Wi&&pd(n)))n.markCursor=n.state.storedMarks||t.marks(),rn(n,!0),n.markCursor=null;else if(rn(n,!e.selection.empty),ae&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let a=n.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}n.input.composing=!0}hs(n,ud)};function pd(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return r.nodeType==1&&r.contentEditable=="false"}Y.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,hs(n,20))};function hs(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>rn(n),e))}function fs(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=fd());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function hd(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=ic(e.focusNode,e.focusOffset),r=sc(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let o=r.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t||r}function fd(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function rn(n,e=!1){if(!(we&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),fs(n),e||n.docView&&n.docView.dirty){let t=mr(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function md(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Ot=G&&Ie<15||st&&dc<604;Z.copy=Y.cut=(n,e)=>{let t=e,r=n.state.selection,o=t.type=="cut";if(r.empty)return;let i=Ot?null:t.clipboardData,s=r.content(),{dom:a,text:l}=xr(n,s);i?(t.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):md(n,a),o&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function gd(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function xd(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Tt(n,r.value,null,o,e):Tt(n,r.textContent,r.innerHTML,o,e)},50)}function Tt(n,e,t,r,o){let i=is(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,o,i||w.empty)))return!0;if(!i)return!1;let s=gd(i),a=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(i);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ms(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Y.paste=(n,e)=>{let t=e;if(n.composing&&!we)return;let r=Ot?null:t.clipboardData,o=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Tt(n,ms(r),r.getData("text/html"),o,t)?t.preventDefault():xd(n,t)};class gs{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const bd=re?"altKey":"ctrlKey";function xs(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[bd]}Z.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let o=n.state.selection,i=o.empty?null:n.posAtCoords(mn(t)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof M?o.to-1:o.to))){if(r&&r.mightDrag)s=M.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=n.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=n.docView&&(s=M.create(n.state.doc,u.posBefore))}}let a=(s||n.state.selection).content(),{dom:l,text:c,slice:d}=xr(n,a);(!t.dataTransfer.files.length||!q||$i>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Ot?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Ot||t.dataTransfer.setData("text/plain",c),n.dragging=new gs(d,xs(n,t),s)};Z.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Y.dragover=Y.dragenter=(n,e)=>e.preventDefault();Y.drop=(n,e)=>{try{yd(n,e,n.dragging)}finally{n.dragging=null}};function yd(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(mn(e));if(!r)return;let o=n.state.doc.resolve(r.pos),i=t&&t.slice;i?n.someProp("transformPasted",f=>{i=f(i,n,!1)}):i=is(n,ms(e.dataTransfer),Ot?null:e.dataTransfer.getData("text/html"),!1,o);let s=!!(t&&xs(n,e));if(n.someProp("handleDrop",f=>f(n,e,i||w.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?Rl(n.state.doc,o.pos,i):o.pos;a==null&&(a=o.pos);let l=n.state.tr;if(s){let{node:f}=t;f?f.replace(l):l.deleteSelection()}let c=l.mapping.map(a),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,u=l.doc;if(d?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i),l.doc.eq(u))return;let p=l.doc.resolve(c);if(d&&M.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new M(p));else{let f=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((m,g,x,k)=>f=k),l.setSelection(gr(n,p,l.doc.resolve(f)))}n.focus(),n.dispatch(l.setMeta("uiEvent","drop"))}Z.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&ve(n)},20))};Z.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};Z.beforeinput=(n,e)=>{if(q&&we&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,Pe(8,"Backspace")))))return;let{$cursor:o}=n.state.selection;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let n in Y)Z[n]=Y[n];function Dt(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class on{constructor(e,t){this.toDOM=e,this.spec=t||$e,this.side=this.spec.side||0}map(e,t,r,o){let{pos:i,deleted:s}=e.mapResult(t.from+o,this.side<0?-1:1);return s?null:new ie(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof on&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Dt(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ae{constructor(e,t){this.attrs=e,this.spec=t||$e}map(e,t,r,o){let i=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new ie(i,s,this)}valid(e,t){return t.from=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let s=0;se){let a=this.children[s]+1;this.children[s+2].findInner(e-a,t-a,r,o+a,i)}}map(e,t,r){return this==U||e.maps.length==0?this:this.mapInner(e,t,0,0,r||$e)}mapInner(e,t,r,o,i){let s;for(let a=0;a{let c=l+r,d;if(d=ys(t,a,c)){for(o||(o=this.children.slice());ia&&u.to=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,s=i+t.content.size;for(let a=0;ai&&l.type instanceof Ae){let c=Math.max(i,l.from)-i,d=Math.min(s,l.to)-i;co.map(e,t,$e));return Ne.from(r)}forChild(e,t){if(t.isLeaf)return z.empty;let r=[];for(let o=0;ot instanceof z)?e:e.reduce((t,r)=>t.concat(r instanceof z?r:r.members),[]))}}forEachSet(e){for(let t=0;t{let x=g-m-(f-p);for(let k=0;kT+d-u)continue;let N=a[k]+d-u;f>=N?a[k+1]=p<=N?-2:-1:p>=d&&x&&(a[k]+=x,a[k+1]+=x)}u+=x}),d=t.maps[c].map(d,-1)}let l=!1;for(let c=0;c=r.content.size){l=!0;continue}let p=t.map(n[c+1]+i,-1),f=p-o,{index:m,offset:g}=r.content.findIndex(u),x=r.maybeChild(m);if(x&&g==u&&g+x.nodeSize==f){let k=a[c+2].mapInner(t,x,d+1,n[c]+i+1,s);k!=U?(a[c]=u,a[c+1]=f,a[c+2]=k):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=wd(a,n,e,t,o,i,s),d=sn(c,r,0,s);e=d.local;for(let u=0;ut&&s.to{let c=ys(n,a,l+t);if(c){i=!0;let d=sn(c,a,t+l+1,r);d!=U&&o.push(l,l+a.nodeSize,d)}});let s=bs(i?ks(n):n,-t).sort(We);for(let a=0;a0;)e++;n.splice(e,0,t)}function zn(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=U&&e.push(r)}),n.cursorWrapper&&e.push(z.create(n.state.doc,[n.cursorWrapper.deco])),Ne.from(e)}const vd={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Cd=G&&Ie<=11;class Sd{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Md{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Sd,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;oo.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():j&&e.composing&&r.some(o=>o.type=="childList"&&o.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Cd&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,vd)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;tthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(wo(this.view)){if(this.suppressingSelectionUpdates)return ve(this.view);if(G&&Ie<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ue(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let i=e.focusNode;i;i=it(i))t.add(i);for(let i=e.anchorNode;i;i=it(i))if(t.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&wo(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,a=!1,l=[];if(e.editable)for(let d=0;dd.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of l)if(d.nodeName=="BR"&&d.parentNode){let u=d.nextSibling;for(;u&&u.nodeType==1;){if(u.contentEditable=="false"){d.parentNode.removeChild(d);break}u=u.firstChild}}}else if(ae&&l.length){let d=l.filter(u=>u.nodeName=="BR");if(d.length==2){let[u,p]=d;u.parentNode&&u.parentNode.parentNode==p.parentNode?p.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let p of d){let f=p.parentNode;f&&f.nodeName=="LI"&&(!u||Td(e,u)!=f)&&p.remove()}}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||o)&&(i>-1&&(e.docView.markDirty(i,s),Nd(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Dd(e,l)),this.handleDOMChange(i,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||ve(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;do;x--){let k=r.childNodes[x-1],T=k.pmViewDesc;if(k.nodeName=="BR"&&!T){i=x;break}if(!T||T.size)break}let u=n.state.doc,p=n.someProp("domParser")||St.fromSchema(n.state.schema),f=u.resolve(s),m=null,g=p.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:o,to:i,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Id,context:f});if(c&&c[0].pos!=null){let x=c[0].pos,k=c[1]&&c[1].pos;k==null&&(k=x),m={anchor:x+s,head:k+s}}return{doc:g,sel:m,from:s,to:a}}function Id(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(j&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||j&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Rd=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Ad(n,e,t,r,o){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let S=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,I=mr(n,S);if(I&&!n.state.selection.eq(I)){if(q&&we&&n.input.lastKeyCode===13&&Date.now()-100O(n,Pe(13,"Enter"))))return;let C=n.state.tr.setSelection(I);S=="pointer"?C.setMeta("pointer",!0):S=="key"&&C.scrollIntoView(),i&&C.setMeta("composition",i),n.dispatch(C)}return}let s=n.state.doc.resolve(e),a=s.sharedDepth(t);e=s.before(a+1),t=n.state.doc.resolve(t).after(a+1);let l=n.state.selection,c=Ed(n,e,t),d=n.state.doc,u=d.slice(c.from,c.to),p,f;n.input.lastKeyCode===8&&Date.now()-100Date.now()-225||we)&&o.some(S=>S.nodeType==1&&!Rd.test(S.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",S=>S(n,Pe(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof D&&!l.empty&&l.$head.sameParent(l.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let S=Ao(n,n.state.doc,c.sel);if(S&&!S.eq(n.state.selection)){let I=n.state.tr.setSelection(S);i&&I.setMeta("composition",i),n.dispatch(I)}}return}n.state.selection.fromn.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?m.start=n.state.selection.from:m.endA=n.state.selection.to-2&&n.state.selection.to<=c.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),G&&Ie<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=c.doc.resolveNoCache(m.start-c.from),x=c.doc.resolveNoCache(m.endB-c.from),k=d.resolve(m.start),T=g.sameParent(x)&&g.parent.inlineContent&&k.end()>=m.endA;if((st&&n.input.lastIOSEnter>Date.now()-225&&(!T||o.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!T&&g.posS(n,Pe(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&Pd(d,m.start,m.endA,g,x)&&n.someProp("handleKeyDown",S=>S(n,Pe(8,"Backspace")))){we&&q&&n.domObserver.suppressSelectionUpdates();return}q&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),we&&!T&&g.start()!=x.start()&&x.parentOffset==0&&g.depth==x.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,x=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(S){return S(n,Pe(13,"Enter"))})},20));let N=m.start,F=m.endA,X=S=>{let I=S||n.state.tr.replace(N,F,c.doc.slice(m.start-c.from,m.endB-c.from));if(c.sel){let C=Ao(n,I.doc,c.sel);C&&!(q&&n.composing&&C.empty&&(m.start!=m.endB||n.input.lastChromeDeleteve(n),20));let S=X(n.state.tr.delete(N,F)),I=d.resolve(m.start).marksAcross(d.resolve(m.endA));I&&S.ensureMarks(I),n.dispatch(S)}else if(m.endA==m.endB&&($=Ld(g.parent.content.cut(g.parentOffset,x.parentOffset),k.parent.content.cut(k.parentOffset,m.endA-k.start())))){let S=X(n.state.tr);$.type=="add"?S.addMark(N,F,$.mark):S.removeMark(N,F,$.mark),n.dispatch(S)}else if(g.parent.child(g.index()).isText&&g.index()==x.index()-(x.textOffset?0:1)){let S=g.parent.textBetween(g.parentOffset,x.parentOffset),I=()=>X(n.state.tr.insertText(S,N,F));n.someProp("handleTextInput",C=>C(n,N,F,S,I))||n.dispatch(I())}else n.dispatch(X());else n.dispatch(X())}function Ao(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:gr(n,e.resolve(t.anchor),e.resolve(t.head))}function Ld(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,o=t,i=r,s,a,l;for(let d=0;dd.mark(a.addToSet(d.marks));else if(o.length==0&&i.length==1)a=i[0],s="remove",l=d=>d.mark(a.removeFromSet(d.marks));else return null;let c=[];for(let d=0;dt||Fn(s,!0,!1)0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,o++,e=!1;if(t){let i=n.node(r).maybeChild(n.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function zd(n,e,t,r,o){let i=n.findDiffStart(e,t);if(i==null)return null;let{a:s,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(o=="end"){let l=Math.max(0,i-Math.min(s,a));r-=s+l-i}if(s=s?i-r:0;i-=l,i&&i=a?i-r:0;i-=l,i&&i=56320&&e<=57343&&t>=55296&&t<=56319}class ws{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Xc,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Vo),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Fo(this),zo(this),this.nodeViews=Bo(this),this.docView=mo(this.state.doc,Po(this),zn(this),this.dom,this),this.domObserver=new Md(this,(r,o,i,s)=>Ad(this,r,o,i,s)),this.domObserver.start(),Qc(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&or(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Vo),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(fs(this),s=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let f=Bo(this);Bd(f,this.nodeViews)&&(this.nodeViews=f,i=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&or(this),this.editable=Fo(this),zo(this);let l=zn(this),c=Po(this),d=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",u=i||!this.docView.matchesNode(e.doc,c,l);(u||!e.selection.eq(o.selection))&&(s=!0);let p=d=="preserve"&&s&&this.dom.style.overflowAnchor==null&&hc(this);if(s){this.domObserver.stop();let f=u&&(G||q)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&Fd(o.selection,e.selection);if(u){let m=q?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=hd(this)),(i||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=mo(e.doc,c,l,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Fc(this))?ve(this,f):(ts(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():p&&fc(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof M){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&lo(this,t.getBoundingClientRect(),e)}else lo(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t0&&it.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return kc(this,e)}coordsAtPos(e,t=1){return ji(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let o=this.docView.posFromDOM(e,t,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,t){return Mc(this,t||this.state,e)}pasteHTML(e,t){return Tt(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Tt(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return xr(this,e)}destroy(){this.docView&&(ed(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],zn(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,rc())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return nd(this,e)}domSelectionRange(){let e=this.domSelection();return e?j&&this.root.nodeType===11&&lc(this.dom.ownerDocument)==this.dom&&Od(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}ws.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Po(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[ie.node(0,n.state.doc.content.size,e)]}function zo(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:ie.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Fo(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Fd(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Bo(n){let e=Object.create(null);function t(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Bd(n,e){let t=0,r=0;for(let o in n){if(n[o]!=e[o])return!0;t++}for(let o in e)r++;return t!=r}function Vo(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}function Vd(n,e=!1){return n.key==="Enter"&&(n.isComposing===!0||e||n.keyCode===229)}function _d(n){return n.key==="Tab"&&n.shiftKey===!0&&!n.altKey&&!n.ctrlKey&&!n.metaKey}const Bn=new cl({nodes:{doc:{content:"paragraph+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:()=>["p",0]},text:{group:"inline"},atMention:{attrs:{label:{validate:"string"},path:{validate:"string"},fsPath:{validate:"string",default:""}},inline:!0,group:"inline",draggable:!1,selectable:!1,toDOM:n=>Vn({text:n.attrs.label,iconNode:Gd(),dataAttributes:{"at-mention-label":n.attrs.label,"at-mention-path":n.attrs.path,"at-mention-fs-path":n.attrs.fsPath}}),parseDOM:[{tag:"span[at-mention-label][at-mention-path]",getAttrs:n=>{const e=n;return{label:e.getAttribute("at-mention-label"),path:e.getAttribute("at-mention-path"),fsPath:e.getAttribute("at-mention-fs-path")??""}}}]},agentMention:{attrs:{name:{validate:"string"},displayName:{validate:"string",default:""},path:{validate:"string"}},inline:!0,group:"inline",draggable:!1,selectable:!1,toDOM:n=>{const e=n.attrs.displayName||n.attrs.name;return Vn({text:`@${e}`,dataAttributes:{"agent-mention-name":n.attrs.name,"agent-mention-display-name":e,"agent-mention-path":n.attrs.path}})},parseDOM:[{tag:"span[agent-mention-name][agent-mention-path]",getAttrs:n=>{const e=n,t=e.getAttribute("agent-mention-name")??"";return{name:t,displayName:e.getAttribute("agent-mention-display-name")??t,path:e.getAttribute("agent-mention-path")??""}}}]},skillMention:{attrs:{name:{validate:"string"},displayName:{validate:"string",default:""},path:{validate:"string"},description:{validate:"string",default:""}},inline:!0,group:"inline",draggable:!1,selectable:!1,toDOM:n=>{const e=n.attrs.displayName||n.attrs.name;return Vn({text:e,icon:"$",dataAttributes:{"skill-mention-name":n.attrs.name,"skill-mention-display-name":e,"skill-mention-path":n.attrs.path},title:n.attrs.description})},parseDOM:[{tag:"span[skill-mention-name][skill-mention-path]",getAttrs:n=>{const e=n,t=e.getAttribute("skill-mention-name")??"";return{name:t,displayName:e.getAttribute("skill-mention-display-name")??t,path:e.getAttribute("skill-mention-path")??"",description:e.getAttribute("title")??""}}}]}},marks:{}}),Ut=new ql("agentPromptPlaceholder"),$d=nt.forwardRef(function({ariaLabel:e,className:t,minHeight:r="2.75rem",onAutocompleteChange:o,onAutocompleteKeyDown:i,onPlanModeShortcut:s,onSubmit:a,onTextChange:l,onTriggerToken:c,placeholder:d,singleLine:u=!1,value:p},f){const m=b.useRef(null),g=b.useRef(null),x=b.useRef(a),k=b.useRef(o),T=b.useRef(i),N=b.useRef(s),F=b.useRef(l),X=b.useRef(c),$=b.useRef(p),S=b.useRef(u);x.current=a,k.current=o,T.current=i,N.current=s,F.current=l,X.current=c,S.current=u,b.useImperativeHandle(f,()=>({focus(){g.current?.focus()},getText(){return $.current},insertMention(C){const O=g.current;O&&Kd(O,C)},insertMentions(C){const O=g.current;!O||C.length===0||Zd(O,C)},insertText(C){const O=g.current;O&&jd(O,C)}}),[]),b.useLayoutEffect(()=>{const C=m.current;if(!C)return;const O=new ws(C,{state:Qe.create({doc:vs($.current),plugins:[Hd("")]}),attributes:{"aria-label":"","data-codex-composer":"true","data-virtualkeyboard":"true",role:"textbox",class:"ProseMirror prompt-editor-view",style:"min-height: 2.75rem; font-size: var(--codex-chat-font-size); height: auto; resize: none;"},dispatchTransaction(L){const A=O.state.apply(L);O.updateState(A);const B=Jd(A.doc),ct=$.current;if(B!==ct){$.current=B;const pe=Wd(ct,B);pe&&X.current?.(pe),F.current(B)}k.current?.(Ss(O))},handleKeyDown(L,A){return Vd(A,L.composing)?!1:_d(A)&&N.current?(A.preventDefault(),N.current(),!0):Yd(A.key)&&T.current?.(A.key)?(A.preventDefault(),!0):(A.metaKey||A.ctrlKey)&&A.key==="Enter"?(A.preventDefault(),x.current(),!0):A.key!=="Enter"?!1:A.shiftKey||A.altKey?(A.preventDefault(),S.current?!0:Bi(L.state,L.dispatch,L)):(A.preventDefault(),x.current(),!0)}});return g.current=O,()=>{O.destroy(),g.current=null}},[]),b.useLayoutEffect(()=>{const C=g.current;C&&C.dispatch(C.state.tr.setMeta(Ut,d))},[d]),b.useLayoutEffect(()=>{const C=g.current;if(!C)return;const O=e??d;O?C.dom.setAttribute("aria-label",O):C.dom.removeAttribute("aria-label")},[e,d]),b.useLayoutEffect(()=>{const C=g.current;C&&(C.dom.style.minHeight=r)},[r]),b.useLayoutEffect(()=>{const C=g.current;!C||p===$.current||($.current=p,Ud(C,p))},[p]);const I=["text-size-chat","[&_.ProseMirror]:focus-visible:outline-none","text-token-foreground",u?"flex h-9 max-h-none items-center overflow-hidden [&_.ProseMirror]:!h-5 [&_.ProseMirror]:!min-h-5 [&_.ProseMirror]:min-w-0 [&_.ProseMirror]:flex-1 [&_.ProseMirror]:overflow-hidden [&_.ProseMirror]:whitespace-nowrap [&_.ProseMirror_p]:overflow-hidden [&_.ProseMirror_p]:text-ellipsis [&_.ProseMirror_p]:whitespace-nowrap":"h-auto max-h-[25dvh] overflow-y-auto [&_.ProseMirror]:h-auto [&_.ProseMirror]:min-h-[2rem]","[&_.ProseMirror]:resize-none","[&_.ProseMirror_p]:m-0",t].filter(Boolean).join(" ");return nt.createElement("div",{className:I,onMouseDown:C=>{const O=g.current;O&&C.target instanceof Node&&!O.dom.contains(C.target)&&(C.preventDefault(),O.focus())},ref:m})});function Wd(n,e){if(e.length!==n.length+1)return null;let t=0;for(;tn,apply(e,t){return e.getMeta(Ut)??t}},props:{decorations(e){const t=Ut.getState(e)??"";if(!t||e.doc.childCount!==1)return null;const r=e.doc.firstChild;return!r?.isTextblock||r.content.size!==0?null:z.create(e.doc,[ie.node(0,r.nodeSize,{class:"placeholder","data-placeholder":t})])}}})}function vs(n){const e=n.split(` +`);return Bn.nodes.doc.create(null,e.map(t=>Bn.nodes.paragraph.create(null,t.length>0?Bn.text(t):null)))}function Jd(n){const e=[];return n.forEach(t=>{const r=[];t.forEach(o=>{r.push(qd(o))}),e.push(r.join(""))}),e.join(` +`)}function qd(n){switch(n.type.name){case"atMention":return $t({kind:"at",label:n.attrs.label,name:n.attrs.label,path:n.attrs.path});case"agentMention":return $t({kind:"agent",displayName:n.attrs.displayName||n.attrs.name,name:n.attrs.name,path:n.attrs.path});case"skillMention":return $t({kind:"skill",displayName:n.attrs.displayName||n.attrs.name,name:n.attrs.name,path:n.attrs.path});default:return n.textContent}}function Ud(n,e){const t=vs(e),r=n.state.tr.replaceWith(0,n.state.doc.content.size,t.content);r.setSelection(D.atEnd(r.doc)),n.dispatch(r)}function jd(n,e){const{state:t}=n,{from:r,to:o}=t.selection,i=e.startsWith("@")?"@":e.startsWith("$")?"$":null,s=t.doc.textBetween(Math.max(0,r-1),r,` `,` `),a=i&&s===i?r-1:r,l=t.doc.textBetween(Math.max(0,a-2),a,` `,` `),c=t.doc.textBetween(o,Math.min(t.doc.content.size,o+2),` `,` -`),d=l.length>0&&!/\s$/.test(l)?" ":"",u=c.length>0&&!/^\s/.test(c)?" ":"",p=`${d}${e}${u}`,h=t.tr.insertText(p,a,o),m=a+p.length;h.setSelection(D.create(h.doc,m)),n.dispatch(h),n.focus()}function au(n,e){const{state:t}=n,{from:r,to:o}=t.selection,i=e.kind==="skill"?"$":"@",s=Ns(n)?.anchorPos??(t.doc.textBetween(Math.max(0,r-1),r,` +`),d=l.length>0&&!/\s$/.test(l)?" ":"",u=c.length>0&&!/^\s/.test(c)?" ":"",p=`${d}${e}${u}`,f=t.tr.insertText(p,a,o),m=a+p.length;f.setSelection(D.create(f.doc,m)),n.dispatch(f),n.focus()}function Kd(n,e){const{state:t}=n,{from:r,to:o}=t.selection,i=e.kind==="skill"?"$":"@",s=Ss(n)?.anchorPos??(t.doc.textBetween(Math.max(0,r-1),r,` `,` `)===i?r-1:r),a=t.doc.textBetween(Math.max(0,s-2),s,` `,` `),l=t.doc.textBetween(o,Math.min(t.doc.content.size,o+2),` `,` -`),c=a.length>0&&!/\s$/.test(a)?" ":"",d=l.length>0&&!/^\s/.test(l)?" ":"",u=[];c&&u.push(t.schema.text(c)),u.push(Ms(t.schema,e)),d&&u.push(t.schema.text(d));const p=t.tr.replaceWith(s,o,u),h=s+u.reduce((m,g)=>m+g.nodeSize,0);p.setSelection(D.create(p.doc,h)),n.dispatch(p),n.focus()}function lu(n,e){const{state:t}=n,{from:r,to:o}=t.selection,i=t.doc.textBetween(Math.max(0,r-2),r,` +`),c=a.length>0&&!/\s$/.test(a)?" ":"",d=l.length>0&&!/^\s/.test(l)?" ":"",u=[];c&&u.push(t.schema.text(c)),u.push(Cs(t.schema,e)),d&&u.push(t.schema.text(d));const p=t.tr.replaceWith(s,o,u),f=s+u.reduce((m,g)=>m+g.nodeSize,0);p.setSelection(D.create(p.doc,f)),n.dispatch(p),n.focus()}function Zd(n,e){const{state:t}=n,{from:r,to:o}=t.selection,i=t.doc.textBetween(Math.max(0,r-2),r,` `,` `),s=t.doc.textBetween(o,Math.min(t.doc.content.size,o+2),` `,` -`),a=[];i.length>0&&!/\s$/.test(i)&&a.push(t.schema.text(" ")),e.forEach((d,u)=>{u>0&&a.push(t.schema.text(" ")),a.push(Ms(t.schema,d))}),s.length>0&&!/^\s/.test(s)&&a.push(t.schema.text(" "));const l=t.tr.replaceWith(r,o,a),c=r+a.reduce((d,u)=>d+u.nodeSize,0);l.setSelection(D.create(l.doc,c)),n.dispatch(l),n.focus()}function Ms(n,e){switch(e.kind){case"skill":return n.nodes.skillMention.create({name:e.name,displayName:e.displayName??e.label,path:e.path,description:e.description??""});case"agent":return n.nodes.agentMention.create({name:e.name,displayName:e.displayName??e.label,path:e.path});case"at":return n.nodes.atMention.create({label:e.label,path:e.path,fsPath:e.fsPath??e.path})}}function Ns(n){const{state:e}=n,{from:t,empty:r}=e.selection;if(!r)return null;const o=e.doc.textBetween(0,t,` +`),a=[];i.length>0&&!/\s$/.test(i)&&a.push(t.schema.text(" ")),e.forEach((d,u)=>{u>0&&a.push(t.schema.text(" ")),a.push(Cs(t.schema,d))}),s.length>0&&!/^\s/.test(s)&&a.push(t.schema.text(" "));const l=t.tr.replaceWith(r,o,a),c=r+a.reduce((d,u)=>d+u.nodeSize,0);l.setSelection(D.create(l.doc,c)),n.dispatch(l),n.focus()}function Cs(n,e){switch(e.kind){case"skill":return n.nodes.skillMention.create({name:e.name,displayName:e.displayName??e.label,path:e.path,description:e.description??""});case"agent":return n.nodes.agentMention.create({name:e.name,displayName:e.displayName??e.label,path:e.path});case"at":return n.nodes.atMention.create({label:e.label,path:e.path,fsPath:e.fsPath??e.path})}}function Ss(n){const{state:e}=n,{from:t,empty:r}=e.selection;if(!r)return null;const o=e.doc.textBetween(0,t,` `,` -`),i=/(^|\s)([@$][^\s@$]*)$/.exec(o);if(!i)return null;const s=i[2]??"",a=s.charAt(0),l=s.slice(1);return{anchorPos:t-s.length,kind:a==="$"?"skill":"mention",query:l}}function cu(n){return n==="ArrowDown"||n==="ArrowUp"||n==="Enter"||n==="Tab"||n==="Escape"}function Vn({dataAttributes:n,icon:e,iconNode:t,text:r,title:o}){const i=document.createElement("span");i.className="prompt-editor-mention group/inline-mention cursor-pointer inline-mention-brand-aware font-medium px-0.5 cursor-interaction",o&&(i.title=o);for(const[a,l]of Object.entries(n))i.setAttribute(a,l);if(e||t){const a=document.createElement("span");if(a.className="prompt-editor-mention-icon relative mr-[3px] inline-block h-[1lh] w-4 align-bottom",t)a.append(t);else if(e){const l=document.createElement("span");l.className="icon-xs absolute top-1/2 -translate-y-1/2",l.textContent=e,a.append(l)}i.append(a)}const s=document.createElement("span");return s.className="min-w-0 break-words",s.textContent=r,i.append(s),i}function du(){const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("class","icon-xs absolute top-1/2 -translate-y-1/2"),n.setAttribute("width","20"),n.setAttribute("height","20"),n.setAttribute("viewBox","0 0 20 20"),n.setAttribute("fill","none"),n.setAttribute("aria-hidden","true");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d",Zo),e.setAttribute("fill","currentColor"),n.append(e),n}const f=rt.createElement,uu=20,pu={background:"linear-gradient(to bottom, var(--color-token-editor-background), transparent)"},fu={background:"linear-gradient(to top, var(--color-token-editor-background), transparent)"};function hu(n,e){"use no memo";const[t,r]=b.useState(null),[o,i]=b.useState(0),[s,a]=b.useState(null),l=b.useRef(null),c=b.useCallback(d=>{a(d)},[]);return b.useLayoutEffect(()=>{const d=s;if(!d)return;const u=()=>r(d.getBoundingClientRect().width);if(u(),typeof ResizeObserver>"u")return;const p=new ResizeObserver(u);return p.observe(d),()=>p.disconnect()},[s]),b.useLayoutEffect(()=>{const d=l.current;d&&i(d.getBoundingClientRect().width)},[n]),{inputMeasureRef:c,isSingleLine:fa({hasVisibleAttachments:e,isEditorMultiline:n.includes(` -`),isVoiceLayoutActive:!1,singleLineInputWidth:t,singleLineTextWidth:o}),textMeasureRef:l}}function mu(n){"use no memo";const[e,t]=b.useState(()=>Yo(n)),r=b.useRef(null),o=b.useRef(new Map),i=b.useRef(new Map),s=b.useRef(new Map),a=b.useRef(n),l=b.useRef(e);a.current=n,l.current=e;const c=b.useCallback(()=>{const p=r.current;if(!p)return;const h=a.current.map(g=>{const k=(o.current.get(g.id)??null)?.offsetWidth??0;k>0&&(l.current[g.id]?.hideLabel===!0?s.current.set(g.id,k):i.current.set(g.id,k));const T=i.current.get(g.id)??s.current.get(g.id)??k,N=s.current.get(g.id),F=g.canHideLabel?Math.min(T,N??T):T;return{...g,compactWidth:F,expandedWidth:T,hasMeasuredCompactWidth:N!=null}}),m=ha({availableWidth:p.getBoundingClientRect().width,gap:$o(window.getComputedStyle(p).columnGap)??$o(window.getComputedStyle(p).gap)??0,items:h,previousState:l.current});ma(m,l.current)||t(m)},[]),d=b.useCallback(p=>{r.current=p,p&&c()},[c]),u=b.useCallback((p,h)=>{h?(o.current.set(p,h),c()):o.current.delete(p)},[c]);return b.useLayoutEffect(()=>{c()},[c,n,e]),b.useLayoutEffect(()=>{if(typeof ResizeObserver>"u")return;const p=new ResizeObserver(c);r.current&&p.observe(r.current);for(const h of o.current.values())p.observe(h);return()=>p.disconnect()},[c,n,e]),{state:e,setContainerRef:d,setItemRef:u}}function $o(n){const e=Number.parseFloat(n);return Number.isFinite(e)?e:null}function gu(n){const e=Et.c(3);let t,r;e[0]!==n?(t=()=>{_a(n)},r=[n],e[0]=n,e[1]=t,e[2]=r):(t=e[1],r=e[2]),b.useEffect(t,r)}function xu(n){const e=Et.c(3);let t,r;e[0]!==n?(t=()=>ra(o=>n({type:"event",event:o})),r=[n],e[0]=n,e[1]=t,e[2]=r):(t=e[1],r=e[2]),b.useEffect(t,r)}function bu(n,e){const t=Et.c(4);let r,o;t[0]!==e||t[1]!==n?(r=()=>{Ha(n,e)},o=[n,e],t[0]=e,t[1]=n,t[2]=r,t[3]=o):(r=t[2],o=t[3]),b.useEffect(r,o)}function yu(){const n=Et.c(3);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=Ba(),n[0]=e):e=n[0];const[t,r]=b.useReducer(Va,e);gu(r),xu(r),bu(t,r);let o;return n[1]!==t?(o=f(ku,{state:t,dispatch:r,renderer:"React"}),n[1]=t,n[2]=o):o=n[2],o}function ku({state:n,dispatch:e,renderer:t}){"use no memo";const r=n.providers.find(v=>v.id===n.selectedProviderId),o=ar(n),i=sr(n),s=Ka(n),[a,l]=b.useState([]),c=n.status==="running"&&(n.input.length>0||a.length>0),d=r?n.autoStartAttemptedProviderIds.includes(r.id):!1,u=i&&(r?.autoStart!==!0||d),p=r?.id==="codex",h=Ia(r),m=r?.id==="codex"?n.context?.copy.reasoningEffortHigh??"High":null,[g,x]=b.useState("default"),[k,T]=b.useState(null),N=Zu(n),F=k??N!=null,X=N!=null&&F,$=hu(n.input,a.length>0),S=$.isSingleLine,A=mu([{canHideLabel:m!=null,enabled:r!=null,id:"intelligence"},{canHideLabel:!0,enabled:X,id:"ide-context"}]),C=S?{hideControl:!1,hideLabel:!1}:A.state.intelligence??{hideControl:!1,hideLabel:!1},O=S?{hideControl:!1,hideLabel:!1}:A.state["ide-context"]??{hideControl:!1,hideLabel:!1},L=b.useRef(null),[R,B]=b.useState(null),[dt,pe]=b.useState(""),[As,xe]=b.useState(0),[yn,ce]=b.useState(!1),[Is,fe]=b.useState(!1),[Mr,Nr]=b.useState(!1),[ut,Pt]=b.useState(!1),[Rs,Or]=b.useState(!1),[Ls,be]=b.useState(!1),Ce=R?Cr(R,n,dt):[],kn=Ce.length===0?-1:Math.min(As,Ce.length-1),wn=()=>{const v=L.current?.getText()??n.input;if(!(n.status==="running"&&(v.length>0||a.length>0)))return;v!==n.input&&e({type:"setInput",input:v}),B(null),pe(""),ce(!1),fe(!1),be(!1);const pt=Da(Ea(v,ut),N?.mention??null,F),V=Ta(pt,a),vn=new Set(a.map(Cn=>Cn.id));Ja(n,e,{attachments:a,clearInput:v,displayText:v,permissionMode:p?g:"default",text:V}).then(Cn=>{Cn&&l(Ks=>Ks.filter(Zs=>!vn.has(Zs.id)))})},Tr=v=>{L.current?.insertMention(v.mention),B(null),pe(""),xe(0),fe(!1)},Dr=()=>{Pt(v=>!v),fe(!1),be(!1),ce(!1),B(null),L.current?.focus()},Ps=()=>{T(v=>!(v??N!=null)),fe(!1),be(!1),ce(!1),B(null),L.current?.focus()},zs=()=>{T(!1),fe(!1),be(!1),ce(!1),B(null),L.current?.focus()},Fs=()=>{Pt(!0),Or(!0),fe(!1),be(!1),ce(!1),B(null),L.current?.focus()},Bs=async()=>{if(Mr)return;const v=n.runningSessionId;Nr(!0),B(null),pe(""),xe(0),fe(!1),be(!1);try{const pt=((await qe("app.pickFiles")).files??[]).filter(V=>V.path.trim().length>0).map(V=>{const vn=V.label&&V.label.trim().length>0?V.label:jt(V.path);return{dataUrl:V.dataUrl,fsPath:V.fsPath??V.path,id:`${V.path}-${Date.now()}-${Math.random().toString(36).slice(2)}`,kind:V.isImage||V.dataUrl?.startsWith("data:image/")?"image":"file",label:vn,mimeType:V.mimeType,path:V.path}});l(V=>ap([...V,...pt])),L.current?.focus()}catch(W){v||e({type:"failed",message:At(W,n)})}finally{Nr(!1)}},Vs=v=>{if(!v){B(null),pe(""),xe(0);return}B(v.kind),pe(v.query),xe(0)},_s=v=>{if(!R)return!1;if(v==="Escape")return B(null),pe(""),xe(0),!0;if(Ce.length===0)return v==="Enter"||v==="Tab";if(v==="ArrowDown")return xe(W=>(W+1)%Ce.length),!0;if(v==="ArrowUp")return xe(W=>(W-1+Ce.length)%Ce.length),!0;if(v==="Enter"||v==="Tab"){const W=Ce[kn>=0?kn:0];return W&&Tr(W),!0}return!1},$s=v=>{qa(v,n,e),ce(!1)},Ws=C.hideControl?null:f("div",{className:"model-picker-root relative min-w-0",ref:v=>A.setItemRef("intelligence",v),onBlur:v=>{v.currentTarget.contains(v.relatedTarget)||ce(!1)}},f("button",{className:`model-picker ${ee} ${te} ${Oe} min-w-0 rounded-full`,type:"button",disabled:!o,"aria-haspopup":"menu","aria-expanded":yn,"data-state":yn?"open":"closed","data-codex-intelligence-trigger":!0,"data-selected-reasoning-effort":"high",onClick:()=>{o&&(fe(!1),be(!1),ce(v=>!v))},onKeyDown:v=>{v.key==="ArrowDown"&&(v.preventDefault(),ce(o))}},C.hideLabel?up("icon-2xs"):f("span",{className:"model-picker-content flex max-w-40 min-w-0 items-center gap-1.5"},f("span",{className:"model-display flex min-w-0 items-center gap-1 tabular-nums"},f("span",{className:"model-label truncate whitespace-nowrap text-token-foreground"},h)),m?f("span",{className:"composer-footer__label--sm shrink-0 text-token-description-foreground"},m):null),f("span",{className:"model-chevron composer-footer__secondary-chevron icon-2xs text-token-input-placeholder-foreground","aria-hidden":!0},gn())),yn?f("div",{className:"provider-dropdown _content_1hiti_1 no-drag bg-token-dropdown-background/90 text-token-foreground ring-token-border z-50 m-px flex select-none flex-col overflow-y-auto rounded-xl ring-[0.5px] px-1 py-1 shadow-xl-spread backdrop-blur-sm w-52",role:"menu","aria-label":n.context?.copy.provider??"","data-state":"open","data-side":"top",style:{"--radix-dropdown-menu-content-transform-origin":"left bottom"}},f("div",{className:"provider-dropdown-title"},n.context?.copy.provider??"Provider"),n.providers.map(v=>f("button",{key:v.id,className:"provider-dropdown-item no-drag group hover:bg-token-list-hover-background focus:bg-token-list-hover-background cursor-interaction text-token-foreground outline-hidden rounded-lg px-[var(--padding-row-x)] py-[var(--padding-row-y)] text-sm",type:"button",role:"menuitem","data-selected":v.id===n.selectedProviderId?"true":void 0,onMouseDown:W=>W.preventDefault(),onClick:()=>$s(v.id)},f("span",{className:"provider-dropdown-item-content flex w-full items-center gap-1.5"},f("span",{className:"min-w-0 flex-1 truncate"},v.displayName),v.id===n.selectedProviderId?f("span",{className:"provider-dropdown-check icon-xs shrink-0","aria-hidden":!0},Ze()):null)))):null),Hs=f(eu,{ref:L,className:S?"text-base":"text-base [&_.ProseMirror]:leading-5",minHeight:S?"1.25rem":"2.75rem",singleLine:S,value:n.input,ariaLabel:n.context?.copy.promptPlaceholder??"",placeholder:n.context?.copy.promptPlaceholder??"",onAutocompleteChange:Vs,onAutocompleteKeyDown:_s,onPlanModeShortcut:Dr,onTextChange:v=>e({type:"setInput",input:v}),onSubmit:wn,onTriggerToken:v=>{B(v==="@"?"mention":"skill"),pe(""),xe(0)}}),Er=(v=!1)=>p?f(qu,{copy:n.context?.copy,hideLabel:v,isEnabled:!0,isOpen:Ls,mode:g,onModeChange:x,onOpenChange:W=>{be(W),W&&(fe(!1),ce(!1),B(null))}}):null,Ar=f("div",{className:"codex-left-rail flex min-w-0 items-center gap-[5px]"},f(Uu,{hasIdeContext:N!=null,isAutoContextOn:F,isOpen:Is,isPickingFiles:Mr,onOpenChange:v=>{fe(v),v&&(be(!1),ce(!1),B(null))},onPickFiles:()=>{Bs()},onToggleAutoContext:Ps,onTogglePlanMode:Dr,isPlanMode:ut,state:n}),S?null:Er(!1),!S&&ut?f(Wo,{icon:an("icon-xs"),label:n.context?.copy.skillPlan??"Plan",onClear:()=>Pt(!1)}):null),Ir=f("div",{className:"codex-secondary-controls flex min-w-0 items-center gap-1",ref:A.setContainerRef},Ws,X&&!O.hideControl?f("span",{className:"composer-context-indicator flex min-w-0 items-center gap-1",ref:v=>A.setItemRef("ide-context",v)},f("div",{className:"composer-context-divider h-4 w-px bg-token-border/70","aria-hidden":!0}),f(Hu,{hideLabel:O.hideLabel,label:n.context?.copy.ideContext??"IDE context",onClear:zs})):null),Rr=f("div",{className:"codex-action-cluster flex shrink-0 items-center gap-2"},u?f("button",{className:`codex-action codex-start ${ee} ${te} ${Oe} rounded-full`,type:"button",disabled:!i,onClick:()=>{$a(n,e)}},n.context?.copy.start??"Start"):null,s?f("button",{className:`codex-action codex-stop ${ee} ${te} ${Oe} ${Kt} rounded-full`,type:"button","aria-label":n.context?.copy.stop??"Stop",onClick:()=>{Ua(n,e)}},cp()):null,f("button",{className:`codex-action codex-mic ${ee} ${te} ${Oe} ${Kt} rounded-full`,type:"button",disabled:!0,"aria-label":n.context?.copy.voiceInput??""},dp()),f("button",{className:`codex-action send-button ${ia}${c?"":" cursor-default opacity-50"}`,type:"button",disabled:!c,"aria-label":n.context?.copy.send??"Send",onClick:wn},lp("icon-sm text-token-dropdown-background"))),qs=f("div",{className:"flex min-w-0 shrink-0 items-center justify-end gap-2"},Ir,Er(!0),S&&ut?f(Wo,{icon:an("icon-xs"),label:n.context?.copy.skillPlan??"Plan",onClear:()=>Pt(!1)}):null,Rr),Lr=f("div",{key:"composer-input",ref:$.inputMeasureRef,className:S?"min-w-0":"mb-1 flex-grow overflow-y-auto px-3"},Hs),Js=S?f("div",{className:da},Ar,Lr,qs):f("div",{className:"contents"},a.length>0?f("div",{className:"px-2 py-1.5"},f(zu,{attachments:a,copy:n.context?.copy,onRemove:v=>{l(W=>W.filter(pt=>pt.id!==v))}})):null,Lr,f("div",{className:ua},Ar,f("div",{className:"flex items-center"}),f("div",{className:"flex w-full min-w-0 items-center justify-end gap-2"},f("div",{className:"flex min-w-0 flex-1 justify-end"},Ir),f("div",{className:"flex shrink-0 items-center gap-2"},Rr)))),Us=f("div",{className:la},Js),js=!ut&&!Rs&&/\bplan\b/i.test(n.input);return f("section",{className:"agent-shell","data-codex-window-type":"electron"},f(vu,{entries:n.transcript,copy:n.context?.copy}),f("div",{className:sa},f("div",{className:"relative flex w-full flex-col gap-2"},f("form",{className:"w-full min-w-0",onSubmit:v=>{v.preventDefault(),wn()}},f("div",{className:aa},f("span",{ref:$.textMeasureRef,className:"composer-single-line-measure text-size-chat pointer-events-none invisible absolute h-0 w-max max-w-none overflow-hidden whitespace-pre","aria-hidden":!0},n.input),js?f(wu,{copy:n.context?.copy,onAction:Fs,onDismiss:()=>Or(!0)}):null,R?f(Wu,{emptyLabel:n.context?.copy?.composerNoResults??"No results",highlightedIndex:kn,items:Ce,onChoose:Tr,onHighlight:xe,query:dt}):null,f("div",{className:ca+" "+(S?"overflow-visible rounded-full":"overflow-y-auto rounded-3xl")},Us)))),f(Bu,{state:n,providerDisplayName:r?.displayName??t})))}function wu({copy:n,onAction:e,onDismiss:t}){return f("div",{className:"above-composer-suggestion-shell pointer-events-none absolute inset-x-0 bottom-full z-20 mb-2 flex justify-center"},f("div",{className:"pointer-events-auto flex w-full max-w-full justify-center"},f("div",{className:"relative inline-flex max-w-full min-w-0 items-center justify-between gap-4 overflow-hidden rounded-3xl border border-token-border/80 bg-token-dropdown-background/90 py-1.5 pr-2 pl-3 text-token-foreground shadow-md backdrop-blur-sm","data-codex-above-composer-suggestion":"keyword-plan-mode"},f("div",{className:"flex min-w-0 flex-1 items-center gap-2"},f("span",{className:"flex items-center justify-center text-token-foreground","aria-hidden":!0},an("icon-xs shrink-0")),f("div",{className:"min-w-0 flex-1 flex items-center gap-2"},f("span",{className:"truncate text-sm font-medium leading-[18px] text-token-foreground"},n?.planSuggestionTitle??"Create a plan"),f("span",{className:"hidden leading-none text-sm text-token-description-foreground @[500px]:inline","aria-hidden":!0},f("span",{className:"pointer-events-none !h-auto rounded-md border border-token-border/80 px-1 py-0.5 text-xs !leading-none text-token-description-foreground"},n?.planSuggestionShortcut??"Shift + Tab")))),f("div",{className:"flex shrink-0 items-center gap-1"},f("button",{className:"user-select-none no-drag cursor-interaction flex h-8 items-center justify-center rounded-full border border-transparent bg-token-button-secondary-background px-2.5 text-sm text-token-button-secondary-foreground hover:bg-token-button-secondary-hover-background focus:outline-none",type:"button",onClick:r=>{r.stopPropagation(),e()}},n?.planSuggestionAction??"Use plan mode"),f("button",{className:"user-select-none no-drag flex size-[22px] shrink-0 cursor-interaction items-center justify-center rounded-full border border-transparent text-token-description-foreground hover:bg-token-list-hover-background focus:outline-none",type:"button","aria-label":n?.planSuggestionDismiss??"Dismiss suggestion",onClick:r=>{r.stopPropagation(),t()}},bn("icon-xs"))))))}const vu=rt.memo(function({entries:e,copy:t}){return f("div",{className:"agent-thread","data-empty":e.length===0?"true":void 0},e.map(r=>f(Cu,{copy:t,entry:r,key:r.id})))}),Cu=rt.memo(function({copy:e,entry:t}){switch(t.role){case"user":{const r=t.attachments??[],o=t.text.trim().length>0;return f("div",{className:"codex-user-turn group flex w-full flex-col items-end justify-end gap-1"},r.length>0?f(Lu,{attachments:r}):null,o?f("div",{className:"codex-user-bubble bg-token-foreground/5 max-w-[77%] min-w-0 overflow-hidden break-words rounded-2xl px-3 py-2 [&_.contain-inline-size]:[contain:initial]"},f(Iu,{copy:e,text:t.text})):null,o?f(Du,{copy:e,sentAtMs:t.sentAtMs,text:t.text}):null)}case"assistant":return t.isComplete===!1?f("div",{className:"codex-assistant-turn group flex min-w-0 flex-col"},f("div",{className:"codex-assistant-message codex-assistant-message-streaming text-size-chat leading-[calc(var(--codex-chat-font-size)+8px)]"},t.text)):f("div",{className:"codex-assistant-turn group flex min-w-0 flex-col"},f("div",{className:"codex-assistant-message text-size-chat leading-[calc(var(--codex-chat-font-size)+8px)] [&>*:last-child]:mb-0 [&>ol:first-child]:mt-0 [&>ul:first-child]:mt-0",dangerouslySetInnerHTML:{__html:ya(t.text)}}),t.text.trim().length>0?f(Eu,{copy:e,sentAtMs:t.sentAtMs,text:t.text}):null);case"notice":return f("div",{className:`codex-notice-turn ${t.tone??"warning"}`},f("div",{className:"codex-notice-content text-size-chat-sm",dangerouslySetInnerHTML:{__html:Be(t.text)}}));case"activity":return f(Su,{copy:e,entry:t})}});function Su({copy:n,entry:e}){"use no memo";const[t,r]=b.useState(!1),[o,i]=b.useState({bottom:!1,top:!1}),s=b.useRef(null),a=n?.copyOutput??"Copy output",l=n?.shellLabel??"",c=n?.copyShellContents??a,d=n?.copiedShellContents??c,u=n?.collapseShell??"",p=n?.shellSuccess??"",h=n?.stopped??"",m=n?.failedStatus??"",g=!!e.output,x=b.useCallback(()=>{r(C=>!C)},[]),k=b.useCallback(()=>{r(!1)},[]),T=b.useCallback(C=>{const O=C===null?{bottom:!1,top:!1}:{bottom:C.scrollTop+C.clientHeight1};i(L=>L.bottom===O.bottom&&L.top===O.top?L:O)},[]),N=b.useCallback(()=>{s.current?.mutation?.disconnect(),s.current?.resize?.disconnect(),s.current=null},[]),F=b.useCallback(C=>{if(N(),C===null){T(null);return}const O=()=>T(C);O();const L=typeof ResizeObserver>"u"?void 0:new ResizeObserver(O);L?.observe(C);const R=typeof MutationObserver>"u"?void 0:new MutationObserver(O);R?.observe(C,{characterData:!0,childList:!0,subtree:!0}),s.current={mutation:R,resize:L}},[N,T]),X=b.useCallback(C=>{T(C.currentTarget)},[T]),$=Nu(e),S=f(rt.Fragment,null,f("span",{className:"codex-tool-activity-icon icon-xs shrink-0","aria-hidden":!0},ea(e)),f("span",{className:"codex-tool-activity-text shrink overflow-hidden [mask-image:linear-gradient(to_right,black_calc(100%_-_0.25rem),transparent)] [mask-repeat:no-repeat] pr-1 group-hover/collapsed-tool-activity:text-token-foreground"},f("span",{className:"codex-tool-activity-action",dangerouslySetInnerHTML:{__html:Be(e.text)}}),e.detail?f("span",{className:"codex-tool-activity-detail",dangerouslySetInnerHTML:{__html:` ${Be(e.detail)}`}}):null)),A=g?f("button",{type:"button",className:"codex-tool-activity-summary group/collapsed-tool-activity group/summary inline-flex w-fit max-w-full cursor-interaction items-center gap-1 self-start text-left","aria-expanded":t,onClick:x},S,f("span",{className:`codex-tool-activity-chevron inline-chevron flex-shrink-0 text-token-input-placeholder-foreground opacity-0 group-hover/summary:opacity-100${t?" opacity-100":""}`},pp(`icon-2xs text-current transition-transform duration-300${t?" rotate-90":""}`))):f("div",{className:"codex-tool-activity-summary group/collapsed-tool-activity group/summary inline-flex w-fit max-w-full items-center gap-1 self-start text-left"},S);return f("div",{className:`codex-tool-activity-turn ${e.activityKind??"other"} ${e.activityStatus??"completed"}`},A,e.output?f("div",{"aria-hidden":!t,className:"codex-tool-activity-output-shell relative overflow-hidden","data-expanded":t?"true":"false"},f("div",{className:"codex-tool-activity-output-shell-inner"},f("div",{className:"codex-tool-activity-output-frame group/output relative pr-0 min-h-[1.25rem] flex flex-col overflow-clip rounded-lg border border-token-border"},f("div",{className:"codex-shell-header flex items-center justify-between bg-token-side-bar-background pl-2 text-sm font-medium text-ellipsis hover:bg-token-editor-background/40"},f("div",{className:"flex min-w-0 items-center"},f("span",{className:"truncate"},l)),f("div",{className:"flex items-center"},f(Ou,{copiedLabel:d,copyLabel:c,text:$}),f("button",{type:"button",className:`codex-shell-collapse ${ee} ${te} ${ln} rounded-full electron:rounded-md hover:bg-transparent hover:text-token-button-foreground`,"aria-label":u,title:u,onClick:k},gn("icon-2xs rotate-180")))),f("div",{className:"relative overflow-hidden"},f("div",{className:"codex-tool-activity-output vertical-scroll-fade-mask [--edge-fade-distance:2rem] box-border flex flex-col gap-1.5 overflow-x-auto overflow-y-auto whitespace-pre p-2 font-vscode-editor font-medium text-size-code-sm text-token-description-foreground max-h-[140px]",onScroll:X,ref:F,dangerouslySetInnerHTML:{__html:Be(e.output)}}),o.top?f("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 top-0 h-6",style:pu}):null,o.bottom?f("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 bottom-0 h-6",style:fu}):null),f(Mu,{failedLabel:m,status:e.activityStatus??"completed",stoppedLabel:h,successLabel:p}),f(Tu,{label:a,output:e.output})))):null)}function Mu({failedLabel:n,status:e,stoppedLabel:t,successLabel:r}){return e==="inProgress"?f("div",{className:"codex-shell-footer text-size-chat px-2.5 pt-0.5 pb-1"}):e==="stopped"?f("div",{className:"codex-shell-footer text-size-chat flex items-center gap-2 px-2.5 pt-0.5 pb-1 text-token-input-placeholder-foreground"},f("span",{className:"ml-auto"},t)):e==="failed"?f("div",{className:"codex-shell-footer text-size-chat flex items-center gap-2 px-2.5 pt-0.5 pb-1 text-token-input-placeholder-foreground"},f("span",{className:"ml-auto"},n)):f("div",{className:"codex-shell-footer text-size-chat flex items-center gap-2 px-2.5 pt-0.5 pb-1 text-token-input-placeholder-foreground"},f("span",{className:"ml-auto flex items-center gap-1"},Ze("icon-xxs"),r))}function Nu(n){const e=(n.detail??n.text).trim(),t=n.output?.trimEnd()??"";return[e,t].filter(r=>r.length>0).join(` +`),i=/(^|\s)([@$][^\s@$]*)$/.exec(o);if(!i)return null;const s=i[2]??"",a=s.charAt(0),l=s.slice(1);return{anchorPos:t-s.length,kind:a==="$"?"skill":"mention",query:l}}function Yd(n){return n==="ArrowDown"||n==="ArrowUp"||n==="Enter"||n==="Tab"||n==="Escape"}function Vn({dataAttributes:n,icon:e,iconNode:t,text:r,title:o}){const i=document.createElement("span");i.className="prompt-editor-mention group/inline-mention cursor-pointer inline-mention-brand-aware font-medium px-0.5 cursor-interaction",o&&(i.title=o);for(const[a,l]of Object.entries(n))i.setAttribute(a,l);if(e||t){const a=document.createElement("span");if(a.className="prompt-editor-mention-icon relative mr-[3px] inline-block h-[1lh] w-4 align-bottom",t)a.append(t);else if(e){const l=document.createElement("span");l.className="icon-xs absolute top-1/2 -translate-y-1/2",l.textContent=e,a.append(l)}i.append(a)}const s=document.createElement("span");return s.className="min-w-0 break-words",s.textContent=r,i.append(s),i}function Gd(){const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("class","icon-xs absolute top-1/2 -translate-y-1/2"),n.setAttribute("width","20"),n.setAttribute("height","20"),n.setAttribute("viewBox","0 0 20 20"),n.setAttribute("fill","none"),n.setAttribute("aria-hidden","true");const e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("d",jo),e.setAttribute("fill","currentColor"),n.append(e),n}const h=nt.createElement,Xd=20,Qd={background:"linear-gradient(to bottom, var(--color-token-editor-background), transparent)"},eu={background:"linear-gradient(to top, var(--color-token-editor-background), transparent)"};function tu(n,e){"use no memo";const[t,r]=b.useState(null),[o,i]=b.useState(0),[s,a]=b.useState(null),l=b.useRef(null),c=b.useCallback(d=>{a(d)},[]);return b.useLayoutEffect(()=>{const d=s;if(!d)return;const u=()=>r(d.getBoundingClientRect().width);if(u(),typeof ResizeObserver>"u")return;const p=new ResizeObserver(u);return p.observe(d),()=>p.disconnect()},[s]),b.useLayoutEffect(()=>{const d=l.current;d&&i(d.getBoundingClientRect().width)},[n]),{inputMeasureRef:c,isSingleLine:ua({hasVisibleAttachments:e,isEditorMultiline:n.includes(` +`),isVoiceLayoutActive:!1,singleLineInputWidth:t,singleLineTextWidth:o}),textMeasureRef:l}}function nu(n){"use no memo";const[e,t]=b.useState(()=>Ko(n)),r=b.useRef(null),o=b.useRef(new Map),i=b.useRef(new Map),s=b.useRef(new Map),a=b.useRef(n),l=b.useRef(e);a.current=n,l.current=e;const c=b.useCallback(()=>{const p=r.current;if(!p)return;const f=a.current.map(g=>{const k=(o.current.get(g.id)??null)?.offsetWidth??0;k>0&&(l.current[g.id]?.hideLabel===!0?s.current.set(g.id,k):i.current.set(g.id,k));const T=i.current.get(g.id)??s.current.get(g.id)??k,N=s.current.get(g.id),F=g.canHideLabel?Math.min(T,N??T):T;return{...g,compactWidth:F,expandedWidth:T,hasMeasuredCompactWidth:N!=null}}),m=pa({availableWidth:p.getBoundingClientRect().width,gap:_o(window.getComputedStyle(p).columnGap)??_o(window.getComputedStyle(p).gap)??0,items:f,previousState:l.current});ha(m,l.current)||t(m)},[]),d=b.useCallback(p=>{r.current=p,p&&c()},[c]),u=b.useCallback((p,f)=>{f?(o.current.set(p,f),c()):o.current.delete(p)},[c]);return b.useLayoutEffect(()=>{c()},[c,n,e]),b.useLayoutEffect(()=>{if(typeof ResizeObserver>"u")return;const p=new ResizeObserver(c);r.current&&p.observe(r.current);for(const f of o.current.values())p.observe(f);return()=>p.disconnect()},[c,n,e]),{state:e,setContainerRef:d,setItemRef:u}}function _o(n){const e=Number.parseFloat(n);return Number.isFinite(e)?e:null}function ru(n){const e=Et.c(3);let t,r;e[0]!==n?(t=()=>{Oa(n)},r=[n],e[0]=n,e[1]=t,e[2]=r):(t=e[1],r=e[2]),b.useEffect(t,r)}function ou(n){const e=Et.c(3);let t,r;e[0]!==n?(t=()=>ta(o=>n({type:"event",event:o})),r=[n],e[0]=n,e[1]=t,e[2]=r):(t=e[1],r=e[2]),b.useEffect(t,r)}function iu(n,e){const t=Et.c(4);let r,o;t[0]!==e||t[1]!==n?(r=()=>{Ea(n,e)},o=[n,e],t[0]=e,t[1]=n,t[2]=r,t[3]=o):(r=t[2],o=t[3]),b.useEffect(r,o)}function su(){const n=Et.c(3);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=Ma(),n[0]=e):e=n[0];const[t,r]=b.useReducer(Na,e);ru(r),ou(r),iu(t,r);let o;return n[1]!==t?(o=h(au,{state:t,dispatch:r,renderer:"React"}),n[1]=t,n[2]=o):o=n[2],o}function au({state:n,dispatch:e,renderer:t}){"use no memo";const r=n.providers.find(v=>v.id===n.selectedProviderId),o=ar(n),i=sr(n),s=Pa(n),[a,l]=b.useState([]),c=n.status==="running"&&(n.input.length>0||a.length>0),d=r?n.autoStartAttemptedProviderIds.includes(r.id):!1,u=i&&(r?.autoStart!==!0||d),p=r?.id==="codex",f=ya(r),m=r?.id==="codex"?n.context?.copy.reasoningEffortHigh??"High":null,[g,x]=b.useState("default"),[k,T]=b.useState(null),N=zu(n),F=k??N!=null,X=N!=null&&F,$=tu(n.input,a.length>0),S=$.isSingleLine,I=nu([{canHideLabel:m!=null,enabled:r!=null,id:"intelligence"},{canHideLabel:!0,enabled:X,id:"ide-context"}]),C=S?{hideControl:!1,hideLabel:!1}:I.state.intelligence??{hideControl:!1,hideLabel:!1},O=S?{hideControl:!1,hideLabel:!1}:I.state["ide-context"]??{hideControl:!1,hideLabel:!1},L=b.useRef(null),[A,B]=b.useState(null),[ct,pe]=b.useState(""),[Ds,xe]=b.useState(0),[yn,ce]=b.useState(!1),[Es,he]=b.useState(!1),[Mr,Nr]=b.useState(!1),[dt,Pt]=b.useState(!1),[Is,Or]=b.useState(!1),[Rs,be]=b.useState(!1),Ce=A?Cr(A,n,ct):[],kn=Ce.length===0?-1:Math.min(Ds,Ce.length-1),wn=()=>{const v=L.current?.getText()??n.input;if(!(n.status==="running"&&(v.length>0||a.length>0)))return;v!==n.input&&e({type:"setInput",input:v}),B(null),pe(""),ce(!1),he(!1),be(!1);const ut=ga(xa(v,dt),N?.mention??null,F),V=ma(ut,a),vn=new Set(a.map(Cn=>Cn.id));Ra(n,e,{attachments:a,clearInput:v,displayText:v,permissionMode:p?g:"default",text:V}).then(Cn=>{Cn&&l(Us=>Us.filter(js=>!vn.has(js.id)))})},Tr=v=>{L.current?.insertMention(v.mention),B(null),pe(""),xe(0),he(!1)},Dr=()=>{Pt(v=>!v),he(!1),be(!1),ce(!1),B(null),L.current?.focus()},As=()=>{T(v=>!(v??N!=null)),he(!1),be(!1),ce(!1),B(null),L.current?.focus()},Ls=()=>{T(!1),he(!1),be(!1),ce(!1),B(null),L.current?.focus()},Ps=()=>{Pt(!0),Or(!0),he(!1),be(!1),ce(!1),B(null),L.current?.focus()},zs=async()=>{if(Mr)return;const v=n.runningSessionId;Nr(!0),B(null),pe(""),xe(0),he(!1),be(!1);try{const ut=((await He("app.pickFiles")).files??[]).filter(V=>V.path.trim().length>0).map(V=>{const vn=V.label&&V.label.trim().length>0?V.label:jt(V.path);return{dataUrl:V.dataUrl,fsPath:V.fsPath??V.path,id:`${V.path}-${Date.now()}-${Math.random().toString(36).slice(2)}`,kind:V.isImage||V.dataUrl?.startsWith("data:image/")?"image":"file",label:vn,mimeType:V.mimeType,path:V.path}});l(V=>Ku([...V,...ut])),L.current?.focus()}catch(W){v||e({type:"failed",message:It(W,n)})}finally{Nr(!1)}},Fs=v=>{if(!v){B(null),pe(""),xe(0);return}B(v.kind),pe(v.query),xe(0)},Bs=v=>{if(!A)return!1;if(v==="Escape")return B(null),pe(""),xe(0),!0;if(Ce.length===0)return v==="Enter"||v==="Tab";if(v==="ArrowDown")return xe(W=>(W+1)%Ce.length),!0;if(v==="ArrowUp")return xe(W=>(W-1+Ce.length)%Ce.length),!0;if(v==="Enter"||v==="Tab"){const W=Ce[kn>=0?kn:0];return W&&Tr(W),!0}return!1},Vs=v=>{Ia(v,n,e),ce(!1)},_s=C.hideControl?null:h("div",{className:"model-picker-root relative min-w-0",ref:v=>I.setItemRef("intelligence",v),onBlur:v=>{v.currentTarget.contains(v.relatedTarget)||ce(!1)}},h("button",{className:`model-picker ${ee} ${te} ${Oe} min-w-0 rounded-full`,type:"button",disabled:!o,"aria-haspopup":"menu","aria-expanded":yn,"data-state":yn?"open":"closed","data-codex-intelligence-trigger":!0,"data-selected-reasoning-effort":"high",onClick:()=>{o&&(he(!1),be(!1),ce(v=>!v))},onKeyDown:v=>{v.key==="ArrowDown"&&(v.preventDefault(),ce(o))}},C.hideLabel?Xu("icon-2xs"):h("span",{className:"model-picker-content flex max-w-40 min-w-0 items-center gap-1.5"},h("span",{className:"model-display flex min-w-0 items-center gap-1 tabular-nums"},h("span",{className:"model-label truncate whitespace-nowrap text-token-foreground"},f)),m?h("span",{className:"composer-footer__label--sm shrink-0 text-token-description-foreground"},m):null),h("span",{className:"model-chevron composer-footer__secondary-chevron icon-2xs text-token-input-placeholder-foreground","aria-hidden":!0},gn())),yn?h("div",{className:"provider-dropdown _content_1hiti_1 no-drag bg-token-dropdown-background/90 text-token-foreground ring-token-border z-50 m-px flex select-none flex-col overflow-y-auto rounded-xl ring-[0.5px] px-1 py-1 shadow-xl-spread backdrop-blur-sm w-52",role:"menu","aria-label":n.context?.copy.provider??"","data-state":"open","data-side":"top",style:{"--radix-dropdown-menu-content-transform-origin":"left bottom"}},h("div",{className:"provider-dropdown-title"},n.context?.copy.provider??"Provider"),n.providers.map(v=>h("button",{key:v.id,className:"provider-dropdown-item no-drag group hover:bg-token-list-hover-background focus:bg-token-list-hover-background cursor-interaction text-token-foreground outline-hidden rounded-lg px-[var(--padding-row-x)] py-[var(--padding-row-y)] text-sm",type:"button",role:"menuitem","data-selected":v.id===n.selectedProviderId?"true":void 0,onMouseDown:W=>W.preventDefault(),onClick:()=>Vs(v.id)},h("span",{className:"provider-dropdown-item-content flex w-full items-center gap-1.5"},h("span",{className:"min-w-0 flex-1 truncate"},v.displayName),v.id===n.selectedProviderId?h("span",{className:"provider-dropdown-check icon-xs shrink-0","aria-hidden":!0},Ke()):null)))):null),$s=h($d,{ref:L,className:S?"text-base":"text-base [&_.ProseMirror]:leading-5",minHeight:S?"1.25rem":"2.75rem",singleLine:S,value:n.input,ariaLabel:n.context?.copy.promptPlaceholder??"",placeholder:n.context?.copy.promptPlaceholder??"",onAutocompleteChange:Fs,onAutocompleteKeyDown:Bs,onPlanModeShortcut:Dr,onTextChange:v=>e({type:"setInput",input:v}),onSubmit:wn,onTriggerToken:v=>{B(v==="@"?"mention":"skill"),pe(""),xe(0)}}),Er=(v=!1)=>p?h(Iu,{copy:n.context?.copy,hideLabel:v,isEnabled:!0,isOpen:Rs,mode:g,onModeChange:x,onOpenChange:W=>{be(W),W&&(he(!1),ce(!1),B(null))}}):null,Ir=h("div",{className:"codex-left-rail flex min-w-0 items-center gap-[5px]"},h(Au,{hasIdeContext:N!=null,isAutoContextOn:F,isOpen:Es,isPickingFiles:Mr,onOpenChange:v=>{he(v),v&&(be(!1),ce(!1),B(null))},onPickFiles:()=>{zs()},onToggleAutoContext:As,onTogglePlanMode:Dr,isPlanMode:dt,state:n}),S?null:Er(!1),!S&&dt?h($o,{icon:an("icon-xs"),label:n.context?.copy.skillPlan??"Plan",onClear:()=>Pt(!1)}):null),Rr=h("div",{className:"codex-secondary-controls flex min-w-0 items-center gap-1",ref:I.setContainerRef},_s,X&&!O.hideControl?h("span",{className:"composer-context-indicator flex min-w-0 items-center gap-1",ref:v=>I.setItemRef("ide-context",v)},h("div",{className:"composer-context-divider h-4 w-px bg-token-border/70","aria-hidden":!0}),h(Eu,{hideLabel:O.hideLabel,label:n.context?.copy.ideContext??"IDE context",onClear:Ls})):null),Ar=h("div",{className:"codex-action-cluster flex shrink-0 items-center gap-2"},u?h("button",{className:`codex-action codex-start ${ee} ${te} ${Oe} rounded-full`,type:"button",disabled:!i,onClick:()=>{Ta(n,e)}},n.context?.copy.start??"Start"):null,s?h("button",{className:`codex-action codex-stop ${ee} ${te} ${Oe} ${Kt} rounded-full`,type:"button","aria-label":n.context?.copy.stop??"Stop",onClick:()=>{Aa(n,e)}},Yu()):null,h("button",{className:`codex-action codex-mic ${ee} ${te} ${Oe} ${Kt} rounded-full`,type:"button",disabled:!0,"aria-label":n.context?.copy.voiceInput??""},Gu()),h("button",{className:`codex-action send-button ${ra}${c?"":" cursor-default opacity-50"}`,type:"button",disabled:!c,"aria-label":n.context?.copy.send??"Send",onClick:wn},Zu("icon-sm text-token-dropdown-background"))),Ws=h("div",{className:"flex min-w-0 shrink-0 items-center justify-end gap-2"},Rr,Er(!0),S&&dt?h($o,{icon:an("icon-xs"),label:n.context?.copy.skillPlan??"Plan",onClear:()=>Pt(!1)}):null,Ar),Lr=h("div",{key:"composer-input",ref:$.inputMeasureRef,className:S?"min-w-0":"mb-1 flex-grow overflow-y-auto px-3"},$s),Hs=S?h("div",{className:la},Ir,Lr,Ws):h("div",{className:"contents"},a.length>0?h("div",{className:"px-2 py-1.5"},h(Cu,{attachments:a,copy:n.context?.copy,onRemove:v=>{l(W=>W.filter(ut=>ut.id!==v))}})):null,Lr,h("div",{className:ca},Ir,h("div",{className:"flex items-center"}),h("div",{className:"flex w-full min-w-0 items-center justify-end gap-2"},h("div",{className:"flex min-w-0 flex-1 justify-end"},Rr),h("div",{className:"flex shrink-0 items-center gap-2"},Ar)))),Js=h("div",{className:sa},Hs),qs=!dt&&!Is&&/\bplan\b/i.test(n.input);return h("section",{className:"agent-shell","data-codex-window-type":"electron"},h(cu,{entries:n.transcript,copy:n.context?.copy}),h("div",{className:oa},h("div",{className:"relative flex w-full flex-col gap-2"},h("form",{className:"w-full min-w-0",onSubmit:v=>{v.preventDefault(),wn()}},h("div",{className:ia},h("span",{ref:$.textMeasureRef,className:"composer-single-line-measure text-size-chat pointer-events-none invisible absolute h-0 w-max max-w-none overflow-hidden whitespace-pre","aria-hidden":!0},n.input),qs?h(lu,{copy:n.context?.copy,onAction:Ps,onDismiss:()=>Or(!0)}):null,A?h(Du,{emptyLabel:n.context?.copy?.composerNoResults??"No results",highlightedIndex:kn,items:Ce,onChoose:Tr,onHighlight:xe,query:ct}):null,h("div",{className:aa+" "+(S?"overflow-visible rounded-full":"overflow-y-auto rounded-3xl")},Js)))),h(Mu,{state:n,providerDisplayName:r?.displayName??t})))}function lu({copy:n,onAction:e,onDismiss:t}){return h("div",{className:"above-composer-suggestion-shell pointer-events-none absolute inset-x-0 bottom-full z-20 mb-2 flex justify-center"},h("div",{className:"pointer-events-auto flex w-full max-w-full justify-center"},h("div",{className:"relative inline-flex max-w-full min-w-0 items-center justify-between gap-4 overflow-hidden rounded-3xl border border-token-border/80 bg-token-dropdown-background/90 py-1.5 pr-2 pl-3 text-token-foreground shadow-md backdrop-blur-sm","data-codex-above-composer-suggestion":"keyword-plan-mode"},h("div",{className:"flex min-w-0 flex-1 items-center gap-2"},h("span",{className:"flex items-center justify-center text-token-foreground","aria-hidden":!0},an("icon-xs shrink-0")),h("div",{className:"min-w-0 flex-1 flex items-center gap-2"},h("span",{className:"truncate text-sm font-medium leading-[18px] text-token-foreground"},n?.planSuggestionTitle??"Create a plan"),h("span",{className:"hidden leading-none text-sm text-token-description-foreground @[500px]:inline","aria-hidden":!0},h("span",{className:"pointer-events-none !h-auto rounded-md border border-token-border/80 px-1 py-0.5 text-xs !leading-none text-token-description-foreground"},n?.planSuggestionShortcut??"Shift + Tab")))),h("div",{className:"flex shrink-0 items-center gap-1"},h("button",{className:"user-select-none no-drag cursor-interaction flex h-8 items-center justify-center rounded-full border border-transparent bg-token-button-secondary-background px-2.5 text-sm text-token-button-secondary-foreground hover:bg-token-button-secondary-hover-background focus:outline-none",type:"button",onClick:r=>{r.stopPropagation(),e()}},n?.planSuggestionAction??"Use plan mode"),h("button",{className:"user-select-none no-drag flex size-[22px] shrink-0 cursor-interaction items-center justify-center rounded-full border border-transparent text-token-description-foreground hover:bg-token-list-hover-background focus:outline-none",type:"button","aria-label":n?.planSuggestionDismiss??"Dismiss suggestion",onClick:r=>{r.stopPropagation(),t()}},bn("icon-xs"))))))}const cu=nt.memo(function({entries:e,copy:t}){return h("div",{className:"agent-thread","data-empty":e.length===0?"true":void 0},e.map(r=>h(du,{copy:t,entry:r,key:r.id})))}),du=nt.memo(function({copy:e,entry:t}){switch(t.role){case"user":{const r=t.attachments??[],o=t.text.trim().length>0;return h("div",{className:"codex-user-turn group flex w-full flex-col items-end justify-end gap-1"},r.length>0?h(wu,{attachments:r}):null,o?h("div",{className:"codex-user-bubble bg-token-foreground/5 max-w-[77%] min-w-0 overflow-hidden break-words rounded-2xl px-3 py-2 [&_.contain-inline-size]:[contain:initial]"},h(yu,{copy:e,text:t.text})):null,o?h(gu,{copy:e,sentAtMs:t.sentAtMs,text:t.text}):null)}case"assistant":return t.isComplete===!1?h("div",{className:"codex-assistant-turn group flex min-w-0 flex-col"},h("div",{className:"codex-assistant-message codex-assistant-message-streaming text-size-chat leading-[calc(var(--codex-chat-font-size)+8px)]"},t.text)):h("div",{className:"codex-assistant-turn group flex min-w-0 flex-col"},h("div",{className:"codex-assistant-message text-size-chat leading-[calc(var(--codex-chat-font-size)+8px)] [&>*:last-child]:mb-0 [&>ol:first-child]:mt-0 [&>ul:first-child]:mt-0",dangerouslySetInnerHTML:{__html:Ys(t.text)}}),t.text.trim().length>0?h(xu,{copy:e,sentAtMs:t.sentAtMs,text:t.text}):null);case"notice":return h("div",{className:`codex-notice-turn ${t.tone??"warning"}`},h("div",{className:"codex-notice-content text-size-chat-sm",dangerouslySetInnerHTML:{__html:xt(t.text)}}));case"activity":return h(uu,{copy:e,entry:t})}});function uu({copy:n,entry:e}){"use no memo";const[t,r]=b.useState(!1),[o,i]=b.useState({bottom:!1,top:!1}),s=b.useRef(null),a=n?.copyOutput??"Copy output",l=n?.shellLabel??"",c=n?.copyShellContents??a,d=n?.copiedShellContents??c,u=n?.collapseShell??"",p=n?.shellSuccess??"",f=n?.stopped??"",m=n?.failedStatus??"",g=!!e.output,x=b.useCallback(()=>{r(C=>!C)},[]),k=b.useCallback(()=>{r(!1)},[]),T=b.useCallback(C=>{const O=C===null?{bottom:!1,top:!1}:{bottom:C.scrollTop+C.clientHeight1};i(L=>L.bottom===O.bottom&&L.top===O.top?L:O)},[]),N=b.useCallback(()=>{s.current?.mutation?.disconnect(),s.current?.resize?.disconnect(),s.current=null},[]),F=b.useCallback(C=>{if(N(),C===null){T(null);return}const O=()=>T(C);O();const L=typeof ResizeObserver>"u"?void 0:new ResizeObserver(O);L?.observe(C);const A=typeof MutationObserver>"u"?void 0:new MutationObserver(O);A?.observe(C,{characterData:!0,childList:!0,subtree:!0}),s.current={mutation:A,resize:L}},[N,T]),X=b.useCallback(C=>{T(C.currentTarget)},[T]),$=hu(e),S=h(nt.Fragment,null,h("span",{className:"codex-tool-activity-icon icon-xs shrink-0","aria-hidden":!0},ea(e)),h("span",{className:"codex-tool-activity-text shrink overflow-hidden [mask-image:linear-gradient(to_right,black_calc(100%_-_0.25rem),transparent)] [mask-repeat:no-repeat] pr-1 group-hover/collapsed-tool-activity:text-token-foreground"},h("span",{className:"codex-tool-activity-action",dangerouslySetInnerHTML:{__html:xt(e.text)}}),e.detail?h("span",{className:"codex-tool-activity-detail",dangerouslySetInnerHTML:{__html:` ${xt(e.detail)}`}}):null)),I=g?h("button",{type:"button",className:"codex-tool-activity-summary group/collapsed-tool-activity group/summary inline-flex w-fit max-w-full cursor-interaction items-center gap-1 self-start text-left","aria-expanded":t,onClick:x},S,h("span",{className:`codex-tool-activity-chevron inline-chevron flex-shrink-0 text-token-input-placeholder-foreground opacity-0 group-hover/summary:opacity-100${t?" opacity-100":""}`},Qu(`icon-2xs text-current transition-transform duration-300${t?" rotate-90":""}`))):h("div",{className:"codex-tool-activity-summary group/collapsed-tool-activity group/summary inline-flex w-fit max-w-full items-center gap-1 self-start text-left"},S);return h("div",{className:`codex-tool-activity-turn ${e.activityKind??"other"} ${e.activityStatus??"completed"}`},I,e.output?h("div",{"aria-hidden":!t,className:"codex-tool-activity-output-shell relative overflow-hidden","data-expanded":t?"true":"false"},h("div",{className:"codex-tool-activity-output-shell-inner"},h("div",{className:"codex-tool-activity-output-frame group/output relative pr-0 min-h-[1.25rem] flex flex-col overflow-clip rounded-lg border border-token-border"},h("div",{className:"codex-shell-header flex items-center justify-between bg-token-side-bar-background pl-2 text-sm font-medium text-ellipsis hover:bg-token-editor-background/40"},h("div",{className:"flex min-w-0 items-center"},h("span",{className:"truncate"},l)),h("div",{className:"flex items-center"},h(fu,{copiedLabel:d,copyLabel:c,text:$}),h("button",{type:"button",className:`codex-shell-collapse ${ee} ${te} ${ln} rounded-full electron:rounded-md hover:bg-transparent hover:text-token-button-foreground`,"aria-label":u,title:u,onClick:k},gn("icon-2xs rotate-180")))),h("div",{className:"relative overflow-hidden"},h("div",{className:"codex-tool-activity-output vertical-scroll-fade-mask [--edge-fade-distance:2rem] box-border flex flex-col gap-1.5 overflow-x-auto overflow-y-auto whitespace-pre p-2 font-vscode-editor font-medium text-size-code-sm text-token-description-foreground max-h-[140px]",onScroll:X,ref:F,dangerouslySetInnerHTML:{__html:xt(e.output)}}),o.top?h("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 top-0 h-6",style:Qd}):null,o.bottom?h("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 bottom-0 h-6",style:eu}):null),h(pu,{failedLabel:m,status:e.activityStatus??"completed",stoppedLabel:f,successLabel:p}),h(mu,{label:a,output:e.output})))):null)}function pu({failedLabel:n,status:e,stoppedLabel:t,successLabel:r}){return e==="inProgress"?h("div",{className:"codex-shell-footer text-size-chat px-2.5 pt-0.5 pb-1"}):e==="stopped"?h("div",{className:"codex-shell-footer text-size-chat flex items-center gap-2 px-2.5 pt-0.5 pb-1 text-token-input-placeholder-foreground"},h("span",{className:"ml-auto"},t)):e==="failed"?h("div",{className:"codex-shell-footer text-size-chat flex items-center gap-2 px-2.5 pt-0.5 pb-1 text-token-input-placeholder-foreground"},h("span",{className:"ml-auto"},n)):h("div",{className:"codex-shell-footer text-size-chat flex items-center gap-2 px-2.5 pt-0.5 pb-1 text-token-input-placeholder-foreground"},h("span",{className:"ml-auto flex items-center gap-1"},Ke("icon-xxs"),r))}function hu(n){const e=(n.detail??n.text).trim(),t=n.output?.trimEnd()??"";return[e,t].filter(r=>r.length>0).join(` -`)}function Ou({copiedLabel:n,copyLabel:e,text:t}){"use no memo";const[r,o]=b.useState(!1),i=b.useRef(null),s=r?n:e,a=b.useCallback(c=>{c!==null||i.current===null||(window.clearTimeout(i.current),i.current=null)},[]),l=b.useCallback(c=>{c.stopPropagation(),navigator.clipboard?.writeText(t)?.catch(()=>{}),o(!0),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{o(!1),i.current=null},2e3)},[t]);return f("button",{ref:a,type:"button",className:`codex-shell-copy ${ee} ${te} ${ln} rounded-full electron:rounded-md hover:bg-transparent hover:text-token-button-foreground`,"aria-label":s,title:s,onClick:l},r?Ze("icon-xxs"):xn("icon-xxs"))}function Tu({label:n,output:e}){"use no memo";const[t,r]=b.useState(!1),o=b.useRef(null),i=b.useCallback(a=>{a!==null||o.current===null||(window.clearTimeout(o.current),o.current=null)},[]),s=b.useCallback(a=>{a.stopPropagation(),navigator.clipboard?.writeText(e)?.catch(()=>{}),r(!0),o.current!==null&&window.clearTimeout(o.current),o.current=window.setTimeout(()=>{r(!1),o.current=null},2e3)},[e]);return f("button",{ref:i,type:"button",className:`codex-tool-output-copy ${ee} ${te} rounded-full electron:rounded-md electron:p-1 electron:[&>svg]:icon-sm flex items-center justify-center p-0.5 absolute top-0 right-2.5 opacity-0 transition-opacity duration-200 group-hover/output:opacity-100${t?" text-token-foreground opacity-100":""}`,"aria-label":n,title:n,onClick:s},t?Ze("icon-2xs"):xn("icon-2xs"))}function Du({copy:n,sentAtMs:e,text:t}){"use no memo";const[r,o]=b.useState(!1),i=b.useRef(null),s=n?.copyUserMessage??"",a=n?.copiedUserMessage??"",l=r?a:s,c=e==null?null:Os(e),d=b.useCallback(p=>{p!==null||i.current===null||(window.clearTimeout(i.current),i.current=null)},[]),u=b.useCallback(()=>{const p=t.trim();if(!p)return;navigator.clipboard?.writeText(p)?.catch(()=>{}),o(!0),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{o(!1),i.current=null},1500)},[t]);return f("div",{className:"codex-user-message-actions flex flex-row-reverse items-center gap-1"},f("div",{className:"mr-1 ms-1 flex items-center gap-2 opacity-0 group-focus-within:opacity-100 group-hover:opacity-100"},c==null?null:f("span",{className:"text-xs text-token-text-tertiary"},c),f("button",{ref:d,type:"button",className:`codex-user-message-action-button ${ee} ${te} ${ln} rounded-full electron:rounded-md`,"aria-label":l,title:l,onClick:u},r?Ze("icon-xs"):xn("icon-xs"))))}function Eu({copy:n,sentAtMs:e,text:t}){"use no memo";const[r,o]=b.useState(!1),i=b.useRef(null),s=n?.copyAssistantMessage??"",a=n?.copiedAssistantMessage??s,l=r?a:s,c=e==null?null:Os(e),d=b.useCallback(p=>{p!==null||i.current===null||(window.clearTimeout(i.current),i.current=null)},[]),u=b.useCallback(()=>{const p=t.trim();if(!p)return;navigator.clipboard?.writeText(p)?.catch(()=>{}),o(!0),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{o(!1),i.current=null},2e3)},[t]);return f("div",{className:"codex-assistant-message-actions mt-1.5 flex h-5 items-center justify-start gap-0.5 opacity-0 group-focus-within:opacity-100 group-hover:opacity-100"},f("button",{ref:d,type:"button",className:`codex-assistant-message-action-button ${ee} ${te} ${ln} rounded-full electron:rounded-md`,"aria-label":l,title:l,onClick:u},r?Ze("icon-xs"):xn("icon-xs")),c==null?null:f("span",{className:"ml-1.5 flex h-full items-center text-size-chat leading-5 text-token-input-placeholder-foreground"},c))}function Os(n,e=new Date){const t=new Date(n),r=Au(t,e);return r===0?new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(t):r<0&&r>-7?new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit",weekday:"long"}).format(t):new Intl.DateTimeFormat(void 0,{day:"numeric",hour:"numeric",minute:"2-digit",month:"short"}).format(t)}function Au(n,e){const t=new Date(n.getFullYear(),n.getMonth(),n.getDate()),r=new Date(e.getFullYear(),e.getMonth(),e.getDate());return Math.round((t.getTime()-r.getTime())/864e5)}function Iu({copy:n,text:e}){"use no memo";const[t,r]=b.useState(!1),o=Ru(e),i=o&&!t,s=n?.showMore??"",a=n?.showLess??"",l=b.useCallback(()=>{r(c=>!c)},[]);return f("div",{className:"flex flex-col items-end gap-1"},f("div",{className:"codex-user-message-content text-size-chat relative w-full min-w-0 mb-px","data-collapsed":i?"true":void 0,dangerouslySetInnerHTML:{__html:Be(e)}}),o?f("button",{type:"button","aria-expanded":t,className:"codex-user-message-toggle text-size-chat mt-1.5 inline-flex cursor-interaction items-center gap-1 self-start text-token-description-foreground hover:text-token-foreground",onClick:l},f("span",null,t?a:s),gn(`icon-2xs${t?" rotate-180":""}`)):null)}function Ru(n){return n.split(/\r\n|\r|\n/).length>uu||n.length>1600}function Lu({attachments:n}){return f("div",{className:"codex-user-message-attachments flex max-w-[77%] flex-row-reverse flex-wrap items-center gap-1"},n.map(e=>f(Pu,{attachment:e,key:e.id})))}function Pu({attachment:n}){return n.kind==="image"&&n.dataUrl?f("div",{className:"user-message-image-attachment flex size-16 items-center justify-center rounded-lg border border-token-border",title:n.label},f("img",{alt:n.label,className:"h-full w-full rounded-md object-cover",referrerPolicy:"no-referrer",src:n.dataUrl})):f("div",{className:"user-message-file-attachment bg-token-dropdown-background border-token-border inline-flex max-w-[320px] items-center gap-1 rounded-full border px-2 py-1.5 text-sm",title:n.path},f("span",{className:"text-token-input-placeholder-foreground flex-shrink-0","aria-hidden":!0},Sr("icon-2xs")),f("span",{className:"flex max-w-full min-w-0 items-center gap-1"},f("span",{className:"truncate"},n.label)))}function zu({attachments:n,className:e,copy:t,onRemove:r}){return f("div",{className:`codex-attachment-tray w-full overflow-x-auto${e?` ${e}`:""}`,"data-composer-attachments-row":!0},f("div",{className:"codex-attachment-row flex min-w-max items-end gap-2"},n.map(o=>f(Fu,{attachment:o,copy:t,key:o.id,onRemove:r}))))}function Fu({attachment:n,copy:e,onRemove:t}){const r=`${e?.removeAttachment??"Remove attachment"} ${n.label}`,o=t?f("button",{className:"composer-attachment-remove",type:"button","aria-label":r,onClick:()=>t(n.id),onMouseDown:i=>i.preventDefault()},bn("icon-2xs")):null;return n.kind==="image"&&n.dataUrl?f("div",{className:"composer-attachment-image",title:n.label},f("img",{alt:"","aria-hidden":!0,src:n.dataUrl}),o):f("div",{className:"composer-attachment-file",title:n.path},f("span",{className:"composer-attachment-file-icon","aria-hidden":!0},Sr("icon-xs")),f("span",{className:"composer-attachment-file-label"},n.label),o)}function Bu(n){const e=Et.c(6),{state:t,providerDisplayName:r}=n,i=(t.context?.rateLimitRows??[]).map(La),s=t.context?.copy,[a,l]=b.useState(!1);if(i.length===0)return null;const c=s?.rateLimits??"Rate limits";let d;e[0]!==t?(d=ja(t),e[0]=t,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=m=>{m.currentTarget.contains(m.relatedTarget)||l(!1)},e[2]=u):u=e[2];let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=()=>l(Vu),e[3]=p):p=e[3];let h;return e[4]!==t?(h=(m,g)=>[g>0?f("span",{key:`${m.role}-separator`,className:"rate-limit-inline-separator","aria-hidden":!0},"•"):null,f(_u,{key:m.role,row:m,state:t})],e[4]=t,e[5]=h):h=e[5],f("div",{className:"rate-line codex-rate-limit-summary relative",role:"status","aria-label":`${r} ${d}`.trim(),onBlur:u},f("button",{className:"rate-limit-trigger rate-limit-trigger-inline flex min-w-0 items-center gap-1",type:"button","aria-expanded":a,onClick:p},f("span",{className:"rate-line-heading"},c),i.flatMap(h)),a?f("div",{className:"rate-limit-popover absolute bottom-[calc(100%+6px)] left-0 z-50 flex min-w-56 flex-col gap-1 rounded-xl border border-token-border bg-token-dropdown-background/95 px-3 py-2 text-sm shadow-xl-spread backdrop-blur-sm"},f("div",{className:"rate-limit-popover-title"},c),i.map(m=>f($u,{key:m.role,row:m,state:t}))):null)}function Vu(n){return!n}function _u({row:n,state:e}){const t=n,r=e.context?.copy,o=t.role==="primary"?r?.rateLimitPrimary??"Primary":r?.rateLimitSecondary??"Secondary",i=ti(t.windowDurationMins,o,{weekly:r?.rateLimitWeekly??"Weekly",monthly:r?.rateLimitMonthly??"Monthly",daysFormat:r?.rateLimitDaysFormat??"",hoursFormat:r?.rateLimitHoursFormat??"",minutesFormat:r?.rateLimitMinutesFormat??""}),s=ei(t.resetsAt);return f("span",{className:"rate-limit-inline-segment"},f("span",{className:"rate-limit-window"},i),f("span",{className:"rate-limit-percent"},Qo(t.remainingPercent)),s?f("span",{className:"rate-limit-reset"},`${r?.rateLimitResets??"resets"} ${s}`):null)}function $u({row:n,state:e}){const t=n,r=e.context?.copy,o=t.role==="primary"?r?.rateLimitPrimary??"Primary":r?.rateLimitSecondary??"Secondary",i=ti(t.windowDurationMins,o,{weekly:r?.rateLimitWeekly??"Weekly",monthly:r?.rateLimitMonthly??"Monthly",daysFormat:r?.rateLimitDaysFormat??"",hoursFormat:r?.rateLimitHoursFormat??"",minutesFormat:r?.rateLimitMinutesFormat??""}),s=ei(t.resetsAt);return f("div",{className:"rate-limit-popover-row"},f("span",{className:"rate-limit-window"},i),f("span",{className:"rate-limit-row-value"},f("span",{className:"rate-limit-percent"},Qo(t.remainingPercent)),s?f("span",{className:"rate-limit-reset"},`${r?.rateLimitResets??"resets"} ${s}`):null))}function Wu({emptyLabel:n,highlightedIndex:e,items:t,onChoose:r,onHighlight:o,query:i}){return f("div",{className:"codex-top-tray-shell absolute z-20"},f("div",{className:"codex-top-tray-panel","cmdk-root":"","data-cmdk-root":!0},f("div",{className:"codex-top-tray-list","cmdk-list":"","data-cmdk-list":!0},t.length===0?f("div",{className:"codex-top-tray-empty","cmdk-empty":"","data-cmdk-empty":!0,"data-command-menu-empty-state":"true"},n):t.map((s,a)=>{const l=s.detail?"codex-top-tray-label max-w-[60%] flex-none truncate":"codex-top-tray-label min-w-0 flex-1 truncate",c=sp(s.label,i),d=c.some(u=>!u.isMatch);return f("button",{key:s.id,className:"codex-top-tray-item",type:"button","aria-selected":a===e?"true":void 0,"cmdk-item":"","data-selected":a===e?"true":void 0,"data-list-navigation-item":!0,onMouseEnter:()=>o(a),onMouseDown:u=>u.preventDefault(),onClick:()=>r(s)},f("div",{className:"codex-top-tray-copy flex w-full items-center gap-2"},f("span",{className:"codex-top-tray-icon icon-xs shrink-0","aria-hidden":!0},s.icon),f("div",{className:l},c.map((u,p)=>f("span",{key:`${u.text}-${p}`,className:!u.isMatch&&d?"text-token-description-foreground":void 0},u.text))),s.detail?f("span",{className:"codex-top-tray-detail min-w-0 flex-1 truncate text-sm text-token-description-foreground"},s.detail):null))}))))}function Wo({icon:n,label:e,onClear:t}){return f("div",{className:"composer-mode-indicator flex min-w-0 items-center gap-1"},f("div",{className:"composer-mode-divider","aria-hidden":!0}),f("button",{className:`composer-mode-button group ${ee} ${te} ${Oe} rounded-full`,type:"button","aria-label":e,onClick:t},f("span",{className:"composer-mode-icon composer-mode-icon-default icon-xs shrink-0","aria-hidden":!0},n),f("span",{className:"composer-mode-icon composer-mode-icon-hover icon-xs shrink-0","aria-hidden":!0},bn("icon-xs")),f("span",{className:"composer-footer__label--sm composer-mode-label max-w-16 truncate"},e)))}function Hu({hideLabel:n,label:e,onClear:t}){return f("button",{className:`composer-context-button group ${ee} ${te} ${Oe} min-w-0 rounded-full`,type:"button","aria-label":e,title:e,onClick:t},f("span",{className:"composer-context-icon composer-context-icon-default icon-xs shrink-0","aria-hidden":!0},Es("icon-xs")),f("span",{className:"composer-context-icon composer-context-icon-hover icon-xs shrink-0","aria-hidden":!0},bn("icon-xs")),n?null:f("span",{className:"composer-footer__label--sm composer-context-label max-w-20 truncate"},e))}function qu({copy:n,hideLabel:e=!1,isEnabled:t,isOpen:r,mode:o,onModeChange:i,onOpenChange:s}){const a=n?.changePermissions??"Change permissions",l=Uo(n,o),c=t?["default","auto-review","full-access","custom"]:[],d=e?oa:Oe,u=h=>{i(h),s(!1)},p=t&&r;return f("div",{className:"permissions-root relative inline-flex",onBlur:h=>{t&&!h.currentTarget.contains(h.relatedTarget)&&s(!1)}},f("button",{className:`permissions-trigger ${ee} ${te} ${d} ${e?Kt:"min-w-0"} rounded-full`,type:"button","aria-label":a,"aria-haspopup":t?"menu":void 0,"aria-expanded":t?p:void 0,"aria-disabled":t?void 0:!0,"data-permission-mode":o,"data-state":p?"open":"closed",disabled:!t,onClick:()=>{t&&s(!p)},onKeyDown:h=>{t&&(h.key==="ArrowDown"&&(h.preventDefault(),s(!0)),h.key==="Escape"&&(h.preventDefault(),s(!1)))}},Ds(o,"icon-xs shrink-0"),e?null:f("span",{className:"permissions-trigger-label composer-footer__label--xs max-w-40 truncate whitespace-nowrap text-left"},l),t?f("span",{className:"permissions-trigger-chevron icon-2xs shrink-0","aria-hidden":!0},gn()):null),p?f("div",{className:"permissions-dropdown _content_1hiti_1 no-drag bg-token-dropdown-background/90 text-token-foreground ring-token-border z-50 m-px flex select-none flex-col overflow-y-auto rounded-xl ring-[0.5px] px-1 py-1 shadow-xl-spread backdrop-blur-sm",role:"menu","aria-label":a,"data-state":"open","data-side":"top",style:{"--radix-dropdown-menu-content-transform-origin":"left bottom"}},c.map(h=>f(Ju,{isSelected:h===o,key:h,label:Uo(n,h),mode:h,onSelect:()=>u(h)}))):null)}function Ju({isSelected:n,label:e,mode:t,onSelect:r}){return f("button",{className:"permissions-item no-drag group hover:bg-token-list-hover-background focus:bg-token-list-hover-background cursor-interaction text-token-foreground outline-hidden rounded-lg px-[var(--padding-row-x)] py-[var(--padding-row-y)] text-sm",type:"button",role:"menuitemradio","aria-checked":n,"data-permission-mode":t,"data-selected":n?"true":void 0,onMouseDown:o=>o.preventDefault(),onClick:r},f("span",{className:"permissions-item-icon icon-xs shrink-0","aria-hidden":!0},Ds(t,"icon-xs shrink-0")),f("span",{className:"permissions-item-label min-w-0 flex-1 truncate"},e),n?f("span",{className:"permissions-item-check icon-xs shrink-0","aria-hidden":!0},Ze()):null)}function Uu({hasIdeContext:n,isAutoContextOn:e,isOpen:t,isPickingFiles:r,isPlanMode:o,onOpenChange:i,onPickFiles:s,onToggleAutoContext:a,onTogglePlanMode:l,state:c}){const d=c.context?.copy,u=d?.addFilesAndMore??"Add files and more",p=d?.addPhotosAndFiles??"Add photos & files",m=Cr("skill",c,"").find(g=>g.id==="plan")??null;return f("div",{className:"add-context-root relative inline-flex",onBlur:g=>{g.currentTarget.contains(g.relatedTarget)||i(!1)}},f("button",{className:`codex-tool codex-tool-plus ${ee} ${te} ${Oe} ${Kt} rounded-full`,type:"button","aria-label":u,"aria-haspopup":"menu","aria-expanded":t,"data-state":t?"open":"closed",onClick:()=>i(!t),onKeyDown:g=>{g.key==="ArrowDown"&&(g.preventDefault(),i(!0)),g.key==="Escape"&&(g.preventDefault(),i(!1))}},fp()),t?f("div",{className:"add-context-dropdown _content_1hiti_1 no-drag bg-token-dropdown-background/90 text-token-foreground ring-token-border z-50 m-px flex select-none flex-col overflow-y-auto rounded-xl ring-[0.5px] px-1 py-1 shadow-xl-spread backdrop-blur-sm",role:"menu","aria-label":u,"data-state":"open","data-side":"top",style:{"--radix-dropdown-menu-content-transform-origin":"left bottom"}},f(ju,{disabled:r,icon:Sr("icon-xs"),label:p,onSelect:s}),n||m?f(Ku):null,n?f(Ho,{checked:e,icon:Es("icon-sm"),label:d?.includeIdeContext??"Include IDE context",onSelect:a}):null,m?f(Ho,{checked:o,icon:an(),label:d?.planMode??"Plan mode",onSelect:l}):null):null)}function ju({detail:n,disabled:e=!1,icon:t,label:r,onSelect:o}){return f("button",{className:"add-context-item group no-drag hover:bg-token-list-hover-background focus:bg-token-list-hover-background cursor-interaction text-token-foreground outline-hidden rounded-lg px-[var(--padding-row-x)] py-[var(--padding-row-y)] text-sm",disabled:e,type:"button",role:"menuitem",onMouseDown:i=>i.preventDefault(),onClick:e?void 0:o},f("span",{className:"add-context-item-icon icon-xs shrink-0","aria-hidden":!0},t),f("span",{className:"add-context-item-copy flex min-w-0 flex-1 items-center gap-2"},f("span",{className:"add-context-item-label min-w-0 truncate"},r),n?f("span",{className:"add-context-item-detail min-w-0 flex-1 truncate text-token-description-foreground"},n):null))}function Ho({checked:n,icon:e,label:t,onSelect:r}){const o=n?"checked":"unchecked",i=n?"relative inline-flex h-4 w-7 shrink-0 items-center rounded-full bg-token-charts-blue transition-colors duration-200 ease-out":"relative inline-flex h-4 w-7 shrink-0 items-center rounded-full bg-token-foreground/10 transition-colors duration-200 ease-out";return f("button",{className:"add-context-item group no-drag hover:bg-token-list-hover-background focus:bg-token-list-hover-background cursor-interaction text-token-foreground outline-hidden rounded-lg px-[var(--padding-row-x)] py-[var(--padding-row-y)] text-sm",type:"button",role:"menuitemcheckbox","aria-checked":n,onMouseDown:s=>s.preventDefault(),onClick:r},f("span",{className:"add-context-item-icon icon-xs shrink-0","aria-hidden":!0},e),f("span",{className:"add-context-switch-row flex w-full min-w-0 items-center justify-between gap-2"},f("span",{className:"flex min-w-0 items-center gap-2"},f("span",{className:"add-context-item-label min-w-0 truncate"},t)),f("span",{className:i,"data-state":o,"aria-hidden":!0},f("span",{className:"h-3 w-3 rounded-full border border-[color:var(--gray-0)] bg-[color:var(--gray-0)] shadow-sm transition-transform duration-200 ease-out data-[state=unchecked]:translate-x-[2px] data-[state=checked]:translate-x-[14px]","data-state":o}))))}function Ku(){return f("div",{className:"add-context-separator w-full px-[var(--padding-row-x)] py-1",role:"separator"},f("div",{className:"add-context-separator-line h-[1px] w-full bg-token-menu-border"}))}function Zu(n){return Cr("mention",n,"").find(e=>e.id==="workspace")??null}function Cr(n,e,t){const r=e.context?.copy,o=n==="mention"?[...e.context?.workingDirectory?[{id:"workspace",icon:hp("icon-xs"),label:r?.mentionCurrentWorkspace??"Current workspace",detail:jt(e.context.workingDirectory),mention:{kind:"at",label:jt(e.context.workingDirectory),name:jt(e.context.workingDirectory),path:e.context.workingDirectory,fsPath:e.context.workingDirectory}}]:[],...e.providers.map(i=>({id:i.id,icon:Ra(i),label:i.displayName,detail:i.executableName,mention:{kind:"agent",label:i.displayName,name:i.id,displayName:i.displayName,path:`provider://${i.id}`,description:i.executableName}}))]:[{id:"plan",icon:"$",label:r?.skillPlan??"Plan",detail:"$plan",mention:{kind:"skill",label:"Plan",name:"plan",displayName:"Plan",path:"skill://plan"}},{id:"review",icon:"$",label:r?.skillCodeReview??"Code review",detail:"$codex-review",mention:{kind:"skill",label:"Code review",name:"codex-review",displayName:"Code review",path:"skill://codex-review"}},{id:"research",icon:"$",label:r?.skillResearch??"Research",detail:"$research",mention:{kind:"skill",label:"Research",name:"research",displayName:"Research",path:"skill://research"}}];return Yu(o,t)}function Yu(n,e){const t=e.trim();return t?n.map(r=>({item:r,score:ip(r.label,t,[r.detail,r.mention.name])})).filter(({score:r})=>r>0).sort((r,o)=>o.score-r.score).map(({item:r})=>r):n}const qo=1,Gu=.9,Xu=.8,Qu=.17,_n=.1,$n=.999,ep=.9999,tp=.99,np=/[\\/_+.#"@[({&]/,rp=/[\\/_+.#"@[({&]/g,op=/[\s-]/,Ts=/[\s-]/g;function ip(n,e,t){const r=t.length>0?`${n} ${t.join(" ")}`:n;return ir(r,e,Jo(r),Jo(e),0,0,{})}function Jo(n){return n.toLowerCase().replace(Ts," ")}function ir(n,e,t,r,o,i,s){if(i===e.length)return o===n.length?qo:tp;const a=`${o},${i}`;if(s[a]!==void 0)return s[a];const l=r.charAt(i);let c=t.indexOf(l,o),d=0;for(;c>=0;){let u=ir(n,e,t,r,c+1,i+1,s);if(u>d){if(c===o)u*=qo;else if(np.test(n.charAt(c-1))){u*=Xu;const p=n.slice(o,c-1).match(rp);p&&o>0&&(u*=$n**p.length)}else if(op.test(n.charAt(c-1))){u*=Gu;const p=n.slice(o,c-1).match(Ts);p&&o>0&&(u*=$n**p.length)}else u*=Qu,o>0&&(u*=$n**(c-o));n.charAt(c)!==e.charAt(i)&&(u*=ep)}if(u<_n&&t.charAt(c-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&t.charAt(c-1)!==r.charAt(i)){const p=ir(n,e,t,r,c+1,i+2,s);p*_n>u&&(u=p*_n)}u>d&&(d=u),c=t.indexOf(l,c+1)}return s[a]=d,d}function sp(n,e){const t=Array.from(n),r=e.trim();if(!r)return t.map(l=>({isMatch:!0,text:l}));const o=t.map(l=>l.toLowerCase()),i=Array.from(r.toLowerCase());let s=-1;for(let l=0;l<=o.length-i.length;l+=1)if(i.every((c,d)=>o[l+d]===c)){s=l;break}if(s>=0){const l=s+i.length;return t.map((c,d)=>({isMatch:d>=s&&d{const c=a{const r=`${t.kind}:${t.path}`;return e.has(r)?!1:(e.add(r),!0)})}function lp(n="icon-sm"){return f("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},f("path",{d:"M9.33467 16.6663V4.93978L4.6374 9.63704L4.1667 9.16634L3.69599 8.69661L9.52998 2.86263L9.63447 2.77767C9.8925 2.60753 10.2433 2.63564 10.4704 2.86263L16.3034 8.69661L16.3884 8.80111C16.5588 9.05922 16.5306 9.40982 16.3034 9.63704C16.0762 9.86414 15.7255 9.89242 15.4675 9.722L15.363 9.63704L10.6647 4.9388V16.6663C10.6647 17.0336 10.367 17.3314 9.99971 17.3314C9.63259 17.3312 9.33467 17.0335 9.33467 16.6663ZM4.6374 9.63704C4.3777 9.89674 3.95569 9.89674 3.69599 9.63704C3.43657 9.37744 3.43668 8.95628 3.69599 8.69661L4.6374 9.63704Z",fill:"currentColor"}))}function cp(){return f("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0},f("rect",{x:"4.75",y:"4.75",width:"6.5",height:"6.5",rx:"1",fill:"currentColor"}))}function dp(){return f("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0},f("path",{d:"M8 2.25a2 2 0 0 0-2 2v3.25a2 2 0 1 0 4 0V4.25a2 2 0 0 0-2-2ZM4 7.5a4 4 0 0 0 8 0M8 11.5v2.25",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}))}function up(n="icon-sm"){return f("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},f("path",{d:"M10 5.14295V14.8441M10 5.14295C10 1.98209 14.8475 1.94468 14.8475 5.07797L14.8473 5.1067C17.1367 5.43539 18.0436 7.54498 16.4225 9.14006C17.8633 10.5577 17.3503 13.9054 15.4449 14.6301C14.8475 17.6527 10.8056 18.4821 10 14.8441M10 5.14295C10 1.98209 5.15249 1.94468 5.15249 5.07797L5.15265 5.1067C2.86325 5.43539 1.95642 7.54498 3.57746 9.14006C2.13674 10.5577 2.64974 13.9054 4.5551 14.6301C5.15249 17.6527 9.19444 18.4821 10 14.8441",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"1.33"}))}function gn(n="icon-2xs"){return f("svg",{className:n,width:"20",height:"21",viewBox:"0 0 20 21",fill:"none","aria-hidden":!0},f("path",{d:"M15.2793 7.71101C15.539 7.45131 15.961 7.45131 16.2207 7.71101C16.4804 7.97071 16.4804 8.39272 16.2207 8.65242L10.4707 14.4024C10.211 14.6621 9.78902 14.6621 9.52932 14.4024L3.77932 8.65242L3.69436 8.54792C3.52385 8.28979 3.55205 7.93828 3.77932 7.71101C4.00659 7.48374 4.3581 7.45554 4.61623 7.62605L4.72073 7.71101L10 12.9903L15.2793 7.71101Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"0.6"}))}function pp(n="icon-2xs"){return f("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},f("path",{d:"M7.52925 3.7793C7.75652 3.55203 8.10803 3.52383 8.36616 3.69434L8.47065 3.7793L14.2207 9.5293C14.4804 9.789 14.4804 10.211 14.2207 10.4707L8.47065 16.2207C8.21095 16.4804 7.78895 16.4804 7.52925 16.2207C7.26955 15.961 7.26955 15.539 7.52925 15.2793L12.8085 10L7.52925 4.7207L7.44429 4.61621C7.27378 4.35808 7.30198 4.00657 7.52925 3.7793Z",fill:"currentColor"}))}function xn(n="icon-sm"){return f("svg",{className:n,width:"21",height:"21",viewBox:"0 0 21 21",fill:"none","aria-hidden":!0},f("path",{d:"M13.468 11.1216C13.468 10.4107 13.468 9.91717 13.4367 9.53369C13.4137 9.25191 13.3758 9.0622 13.3244 8.91846L13.2687 8.78858C13.1148 8.48652 12.8803 8.23344 12.593 8.05713L12.466 7.98584C12.308 7.90546 12.0963 7.84854 11.7209 7.81787C11.3374 7.78656 10.8439 7.78662 10.133 7.78662H7.29999C6.58895 7.78662 6.09562 7.78654 5.7121 7.81787C5.43015 7.84091 5.24064 7.87872 5.09686 7.93018L4.96698 7.98584C4.66487 8.13977 4.41184 8.37419 4.23554 8.66162L4.16522 8.78858C4.08477 8.94657 4.02794 9.15811 3.99725 9.53369C3.96594 9.91718 3.96503 10.4107 3.96503 11.1216V13.9546C3.96503 14.6656 3.96592 15.159 3.99725 15.5425C4.02796 15.9182 4.08471 16.1296 4.16522 16.2876L4.23554 16.4136C4.41185 16.7012 4.66472 16.9353 4.96698 17.0894L5.09686 17.146C5.24061 17.1974 5.43024 17.2343 5.7121 17.2573C6.09562 17.2887 6.58895 17.2896 7.29999 17.2896H10.133C10.8439 17.2896 11.3374 17.2886 11.7209 17.2573C12.0965 17.2266 12.308 17.1698 12.466 17.0894L12.593 17.019C12.8804 16.8427 13.1148 16.5897 13.2687 16.2876L13.3244 16.1577C13.3759 16.0139 13.4137 15.8244 13.4367 15.5425C13.468 15.159 13.468 14.6656 13.468 13.9546V11.1216ZM14.798 13.1196C15.2528 13.118 15.6011 13.1147 15.8879 13.0913C16.2634 13.0606 16.475 13.0038 16.633 12.9233L16.759 12.8521C17.0466 12.6757 17.2808 12.4228 17.4348 12.1206L17.4914 11.9907C17.5428 11.847 17.5797 11.6572 17.6027 11.3755C17.634 10.992 17.6349 10.4985 17.6349 9.7876V6.95459C17.6349 6.24355 17.6341 5.75022 17.6027 5.3667C17.5797 5.08484 17.5428 4.89522 17.4914 4.75147L17.4348 4.62158C17.2807 4.31933 17.0466 4.06645 16.759 3.89014L16.633 3.81982C16.475 3.73932 16.2636 3.68256 15.8879 3.65186C15.5044 3.62052 15.011 3.61963 14.3 3.61963H11.467C10.7561 3.61963 10.2626 3.62054 9.87909 3.65186C9.59738 3.67487 9.40759 3.71179 9.26386 3.76318L9.13397 3.81982C8.83175 3.97382 8.57885 4.20802 8.40253 4.49561L8.33124 4.62158C8.25079 4.77957 8.19396 4.99114 8.16327 5.3667C8.13984 5.65352 8.13561 6.00178 8.13397 6.45654H10.133C10.822 6.45654 11.3791 6.4559 11.8293 6.49268C12.2873 6.5301 12.6937 6.6093 13.0705 6.80127L13.2883 6.92334C13.7839 7.22739 14.1878 7.66313 14.4533 8.18408L14.5197 8.32666C14.6642 8.66318 14.7291 9.02433 14.7619 9.42529C14.7987 9.8755 14.798 10.4326 14.798 11.1216V13.1196ZM18.965 9.7876C18.965 10.4766 18.9657 11.0337 18.9289 11.4839C18.8961 11.8848 18.8311 12.246 18.6867 12.5825L18.6203 12.7251C18.3548 13.246 17.9509 13.6818 17.4553 13.9858L17.2365 14.1079C16.8599 14.2998 16.4541 14.3791 15.9963 14.4165C15.6592 14.444 15.2624 14.4481 14.7951 14.4497C14.7935 14.917 14.7894 15.3138 14.7619 15.6509C14.7292 16.0516 14.664 16.4122 14.5197 16.7485L14.4533 16.8911C14.1878 17.4122 13.7841 17.8487 13.2883 18.1528L13.0705 18.2749C12.6937 18.4669 12.2873 18.5461 11.8293 18.5835C11.3791 18.6203 10.822 18.6196 10.133 18.6196H7.29999C6.6109 18.6196 6.05394 18.6203 5.6037 18.5835C5.20305 18.5508 4.84233 18.4855 4.50604 18.3413L4.36347 18.2749C3.84243 18.0094 3.40584 17.6056 3.10175 17.1099L2.97968 16.8911C2.78787 16.5145 2.70849 16.1087 2.67108 15.6509C2.6343 15.2006 2.63495 14.6437 2.63495 13.9546V11.1216C2.63495 10.4326 2.63431 9.8755 2.67108 9.42529C2.7085 8.96729 2.78771 8.56084 2.97968 8.18408L3.10175 7.96631C3.40585 7.47049 3.84235 7.06679 4.36347 6.80127L4.50604 6.73486C4.84236 6.59059 5.20302 6.52542 5.6037 6.49268C5.9405 6.46516 6.33707 6.4601 6.80389 6.4585C6.8055 5.99167 6.81056 5.5951 6.83807 5.2583C6.87549 4.80047 6.95482 4.39471 7.14667 4.01807L7.26874 3.79932C7.5728 3.30371 8.00855 2.89973 8.52948 2.63428L8.67206 2.56787C9.00854 2.42345 9.36978 2.35844 9.77069 2.32568C10.2209 2.28891 10.778 2.28955 11.467 2.28955H14.3C14.9891 2.28955 15.546 2.2889 15.9963 2.32568C16.4541 2.3631 16.8599 2.44247 17.2365 2.63428L17.4553 2.75635C17.951 3.06044 18.3548 3.49703 18.6203 4.01807L18.6867 4.16065C18.8309 4.49694 18.8962 4.85765 18.9289 5.2583C18.9657 5.70854 18.965 6.2655 18.965 6.95459V9.7876Z",fill:"currentColor"}))}function Ze(n){return f("svg",{className:n,width:"17",height:"17",viewBox:"0 0 17 17",fill:"none","aria-hidden":!0},f("path",{d:"M12.8961 3.64101C13.1297 3.41418 13.4984 3.37523 13.7779 3.56581C14.0571 3.75635 14.1554 4.11331 14.0299 4.41347L13.9615 4.53847L7.71151 13.7045C7.59411 13.8767 7.4063 13.9877 7.19881 14.0072C6.99136 14.0267 6.78564 13.9533 6.63826 13.806L2.88826 10.056L2.79842 9.9457C2.6192 9.67407 2.64927 9.30496 2.88826 9.06581C3.12738 8.82669 3.49647 8.79676 3.76815 8.97597L3.8785 9.06581L7.03084 12.2182L12.8053 3.74941L12.8961 3.64101Z",fill:"currentColor"}))}function bn(n="icon-sm"){return f("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},f("path",{d:"M5.96967 5.96967C6.26256 5.67678 6.73744 5.67678 7.03033 5.96967L10 8.93934L12.9697 5.96967C13.2626 5.67678 13.7374 5.67678 14.0303 5.96967C14.3232 6.26256 14.3232 6.73744 14.0303 7.03033L11.0607 10L14.0303 12.9697C14.3232 13.2626 14.3232 13.7374 14.0303 14.0303C13.7374 14.3232 13.2626 14.3232 12.9697 14.0303L10 11.0607L7.03033 14.0303C6.73744 14.3232 6.26256 14.3232 5.96967 14.0303C5.67678 13.7374 5.67678 13.2626 5.96967 12.9697L8.93934 10L5.96967 7.03033C5.67678 6.73744 5.67678 6.26256 5.96967 5.96967Z",fill:"currentColor"}))}function fp(){return f("svg",{className:"icon-sm",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},f("path",{d:"M9.33496 16.5V10.665H3.5C3.13273 10.665 2.83496 10.3673 2.83496 10C2.83496 9.63273 3.13273 9.33496 3.5 9.33496H9.33496V3.5C9.33496 3.13273 9.63273 2.83496 10 2.83496C10.3673 2.83496 10.665 3.13273 10.665 3.5V9.33496H16.5L16.6338 9.34863C16.9369 9.41057 17.165 9.67857 17.165 10C17.165 10.3214 16.9369 10.5894 16.6338 10.6514L16.5 10.665H10.665V16.5C10.665 16.8673 10.3673 17.165 10 17.165C9.63273 17.165 9.33496 16.8673 9.33496 16.5Z",fill:"currentColor"}))}function Sr(n="icon-sm"){return f("svg",{className:n,width:"21",height:"21",viewBox:"0 0 21 21",fill:"none","aria-hidden":!0},f("path",{d:"M4.43945 12.8041V7.68261C4.43945 7.30642 4.74446 7.00141 5.12066 7.00141C5.49685 7.00141 5.80186 7.30642 5.80186 7.68261V12.8041C5.80186 15.2565 7.78984 17.2445 10.2422 17.2445C12.6945 17.2445 14.6825 15.2565 14.6825 12.8041V5.9751C14.6823 4.46587 13.4589 3.24247 11.9497 3.24229C10.4403 3.24229 9.21606 4.46576 9.21588 5.9751V12.8041C9.21588 13.3708 9.67553 13.8304 10.2422 13.8304C10.8088 13.8304 11.2685 13.3708 11.2685 12.8041V7.68261C11.2685 7.30642 11.5735 7.00141 11.9497 7.00141C12.3257 7.00159 12.6309 7.30653 12.6309 7.68261V12.8041C12.6309 14.1232 11.5612 15.1929 10.2422 15.1929C8.92314 15.1929 7.85347 14.1232 7.85347 12.8041V5.9751C7.85365 3.71337 9.68791 1.87988 11.9497 1.87988C14.2113 1.88006 16.0447 3.71348 16.0449 5.9751V12.8041C16.0449 16.0089 13.4469 18.6069 10.2422 18.6069C7.03745 18.6069 4.43945 16.0089 4.43945 12.8041Z",fill:"currentColor"}))}function hp(n="icon-sm"){return f("svg",{className:n,width:20,height:20,viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},f("path",{d:Zo,fill:"currentColor"}))}function an(n="icon-sm"){return f("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},f("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.69336 11.0557C7.05891 11.1944 8.12484 12.3479 8.125 13.75L8.11035 14.0273C7.97144 15.3928 6.81814 16.459 5.41602 16.459L5.13965 16.4443C3.86514 16.3149 2.85128 15.3018 2.72168 14.0273L2.70801 13.75C2.70818 12.2546 3.92061 11.0423 5.41602 11.042L5.69336 11.0557ZM5.41602 12.3721C4.65515 12.3724 4.03826 12.9891 4.03809 13.75C4.03826 14.5109 4.65515 15.1286 5.41602 15.1289C6.17714 15.1289 6.79475 14.5111 6.79492 13.75C6.79475 12.9889 6.17714 12.3721 5.41602 12.3721Z",fill:"currentColor"}),f("path",{d:"M16.8008 13.0986C17.1036 13.1608 17.3311 13.4288 17.3311 13.75C17.3311 14.0712 17.1036 14.3392 16.8008 14.4014L16.666 14.415H10.833C10.4659 14.4149 10.168 14.1172 10.168 13.75C10.168 13.3828 10.4659 13.0851 10.833 13.085H16.666L16.8008 13.0986Z",fill:"currentColor"}),f("path",{d:"M16.8008 5.59863C17.1036 5.66081 17.3311 5.92879 17.3311 6.25C17.3311 6.57121 17.1036 6.83919 16.8008 6.90137L16.666 6.91504H10.833C10.4659 6.91491 10.168 6.61719 10.168 6.25C10.168 5.88281 10.4659 5.58509 10.833 5.58496H16.666L16.8008 5.59863Z",fill:"currentColor"}),f("path",{d:"M7.13311 3.76578C7.35346 3.47216 7.771 3.4128 8.06475 3.63297C8.35843 3.85336 8.41789 4.27084 8.19757 4.56461L5.19757 8.56461C5.0819 8.71866 4.90439 8.81462 4.71221 8.82828C4.5201 8.84178 4.33083 8.77209 4.19464 8.6359L2.69464 7.1359C2.43512 6.87623 2.43512 6.45415 2.69464 6.19449C2.95429 5.93484 3.37633 5.93493 3.63604 6.19449L4.59307 7.15152L7.13311 3.76578Z",fill:"currentColor"}))}function mp(n="icon-sm"){return f("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},f("path",{d:"M12.6683 4.16699C12.6683 3.84391 12.4065 3.58203 12.0834 3.58203C11.7603 3.58203 11.4984 3.84391 11.4984 4.16699V7.91699L11.4847 8.05078C11.4227 8.35375 11.1547 8.58203 10.8334 8.58203C10.4662 8.58203 10.1685 8.28411 10.1683 7.91699V3.75C10.1683 3.42691 9.90646 3.16504 9.58337 3.16504C9.26029 3.16504 8.99841 3.42691 8.99841 3.75V7.91699C8.99824 8.28411 8.70053 8.58203 8.33337 8.58203C7.96621 8.58203 7.66851 8.28411 7.66833 7.91699V5C7.66833 4.67691 7.40646 4.41504 7.08337 4.41504C6.76029 4.41504 6.49841 4.67691 6.49841 5V9.30371C6.53326 9.3429 6.56715 9.38359 6.59998 9.42578L8.02478 11.2588C8.25005 11.5486 8.19821 11.9659 7.90857 12.1914C7.6187 12.4169 7.20048 12.365 6.97498 12.0752L5.55017 10.2432C5.15812 9.7391 4.41813 9.73637 4.01501 10.1924C4.04396 10.426 4.11486 10.8323 4.25525 11.3486C4.44664 12.0525 4.75404 12.9113 5.21619 13.7383C6.14103 15.3931 7.62465 16.835 10.0004 16.835C12.8545 16.8348 15.1682 14.5211 15.1683 11.667V6.25C15.1683 5.92691 14.9065 5.66504 14.5834 5.66504C14.2603 5.66504 13.9984 5.92691 13.9984 6.25V9.16699C13.9982 9.53411 13.7005 9.83203 13.3334 9.83203C12.9662 9.83203 12.6685 9.53411 12.6683 9.16699V4.16699ZM13.9984 4.42578C14.1828 4.36671 14.3794 4.33496 14.5834 4.33496C15.641 4.33496 16.4984 5.19237 16.4984 6.25V11.667C16.4982 15.2557 13.589 18.1649 10.0004 18.165C6.95953 18.165 5.10939 16.2734 4.05505 14.3867C3.52774 13.4431 3.1843 12.4787 2.97205 11.6982C2.76447 10.9349 2.66834 10.2954 2.66833 10C2.66833 9.87959 2.70117 9.76148 2.76306 9.6582C3.28988 8.78018 4.26555 8.40372 5.16833 8.56152V5C5.16833 3.94237 6.02575 3.08496 7.08337 3.08496C7.31706 3.08496 7.54039 3.12845 7.74744 3.20508C7.98218 2.41297 8.7151 1.83496 9.58337 1.83496C10.1836 1.83496 10.7186 2.11176 11.0697 2.54395C11.3639 2.35978 11.7107 2.25195 12.0834 2.25195C13.141 2.25195 13.9984 3.10937 13.9984 4.16699V4.42578Z",fill:"currentColor"}))}function gp(n="icon-sm"){return f("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},f("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.06543 1.95123C9.66107 1.69076 10.3389 1.69071 10.9346 1.95123L15.9346 4.13873C16.7832 4.51008 17.3311 5.34917 17.3311 6.27545V10.5528C17.3309 14.6017 14.0489 17.8847 10 17.8848C5.95108 17.8846 2.66813 14.6017 2.66797 10.5528V6.27545C2.66797 5.34924 3.21695 4.51012 4.06543 4.13873L9.06543 1.95123ZM10.4014 3.16998C10.1456 3.05814 9.85444 3.05819 9.59863 3.16998L4.59863 5.35748C4.23427 5.51708 3.99805 5.87764 3.99805 6.27545V10.5528C3.99821 13.8671 6.68563 16.5546 10 16.5547C13.3144 16.5546 16.0008 13.8671 16.001 10.5528V6.27545C16.001 5.87756 15.7658 5.51703 15.4014 5.35748L10.4014 3.16998Z",fill:"currentColor"}),f("path",{d:"M13.4678 11.4318L13.333 11.4182H10.833C10.466 11.4183 10.1682 11.7162 10.168 12.0832C10.168 12.4504 10.4659 12.7481 10.833 12.7482H13.333L13.4678 12.7346C13.7706 12.6724 13.9981 12.4044 13.9981 12.0832C13.9979 11.7621 13.7706 11.494 13.4678 11.4318Z",fill:"currentColor"}),f("path",{d:"M7.65336 12.426C7.46431 12.7406 7.05607 12.8424 6.74125 12.6535C6.42646 12.4646 6.32395 12.0563 6.51274 11.7414L7.55668 10.0002L6.51274 8.25899C6.32395 7.94412 6.42646 7.53583 6.74125 7.34688C7.05607 7.15799 7.46431 7.25975 7.65336 7.57442L8.90336 9.6584C9.0296 9.86893 9.0296 10.1315 8.90336 10.342L7.65336 12.426Z",fill:"currentColor"}))}function xp(n="icon-sm"){return f("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},f("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.06543 1.95123C9.66107 1.69076 10.3389 1.69071 10.9346 1.95123L15.9346 4.13873C16.7832 4.51008 17.3311 5.34917 17.3311 6.27545V10.5528C17.3309 14.6017 14.0489 17.8847 10 17.8848C5.95108 17.8846 2.66813 14.6017 2.66797 10.5528V6.27545C2.66797 5.34924 3.21695 4.51012 4.06543 4.13873L9.06543 1.95123ZM10.4014 3.16998C10.1456 3.05814 9.85444 3.05819 9.59863 3.16998L4.59863 5.35748C4.23427 5.51708 3.99805 5.87764 3.99805 6.27545V10.5528C3.99821 13.8671 6.68563 16.5546 10 16.5547C13.3144 16.5546 16.0008 13.8671 16.001 10.5528V6.27545C16.001 5.87756 15.7658 5.51703 15.4014 5.35748L10.4014 3.16998Z",fill:"currentColor"}),f("path",{d:"M10.8883 13.1116C10.8883 13.6025 10.4903 14.0005 9.99936 14.0005C9.50844 14.0005 9.11047 13.6025 9.11047 13.1116C9.11047 12.6207 9.50844 12.2227 9.99936 12.2227C10.4903 12.2227 10.8883 12.6207 10.8883 13.1116Z",fill:"currentColor"}),f("path",{d:"M10.5169 10.8949L11.1135 7.31519C11.2283 6.62672 10.6974 6 9.99941 6C9.30145 6 8.77053 6.62672 8.88528 7.31519L9.4819 10.8949C9.52406 11.1479 9.74294 11.3333 9.99941 11.3333C10.2559 11.3333 10.4748 11.1479 10.5169 10.8949Z",fill:"currentColor"}))}function bp(n="icon-sm"){return f("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},f("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.99944 7.24939C11.5169 7.2495 12.7473 8.47995 12.7475 9.99744C12.7475 11.5151 11.517 12.7454 9.99944 12.7455C8.48176 12.7455 7.2514 11.5151 7.2514 9.99744C7.25155 8.47988 8.48186 7.24939 9.99944 7.24939ZM9.99944 8.57947C9.2164 8.57947 8.58163 9.21442 8.58148 9.99744C8.58148 10.7806 9.2163 11.4154 9.99944 11.4154C10.7825 11.4153 11.4174 10.7805 11.4174 9.99744C11.4173 9.21449 10.7824 8.57958 9.99944 8.57947Z",fill:"currentColor"}),f("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.6391 1.67517C11.2939 1.67532 11.8991 2.02577 12.226 2.59314L13.2485 4.36755H15.2963C15.9505 4.36758 16.555 4.71709 16.8823 5.28357L17.5219 6.39001C17.8489 6.95668 17.8481 7.65542 17.5209 8.22205L16.4975 9.99451L17.5239 11.7689C17.8519 12.3357 17.8521 13.0347 17.5248 13.6019L16.8862 14.7084C16.559 15.2747 15.9543 15.6243 15.3002 15.6244H13.2514L12.2299 17.3988C11.9029 17.9663 11.297 18.3168 10.642 18.3168L9.3637 18.3158C8.71064 18.3155 8.10718 17.9678 7.77972 17.4027L6.74847 15.6234L4.69964 15.6244C4.04558 15.6242 3.44087 15.2747 3.1137 14.7084L2.47503 13.6019C2.14791 13.0349 2.14836 12.3366 2.47601 11.7699L3.50237 9.99548L2.47894 8.22205C2.15175 7.65533 2.15174 6.95673 2.47894 6.39001L3.11761 5.28259C3.44458 4.71663 4.04894 4.36813 4.70257 4.36755L6.75042 4.36658L7.77581 2.59119C8.10301 2.02476 8.7076 1.67527 9.36175 1.67517H10.6391ZM9.36273 3.00623C9.1835 3.00623 9.01679 3.10199 8.92718 3.2572L7.82659 5.16345C7.63652 5.49253 7.28473 5.69529 6.90472 5.69568L4.70355 5.69763C4.52451 5.69782 4.3585 5.79355 4.26898 5.94861L3.6303 7.05505C3.54091 7.2102 3.54077 7.40192 3.6303 7.55701L4.73089 9.46326C4.92108 9.7929 4.92135 10.1992 4.73089 10.5287L3.62737 12.4359C3.5378 12.591 3.53792 12.7817 3.62737 12.9369L4.26605 14.0433C4.35567 14.1982 4.52067 14.2932 4.69964 14.2933L6.90276 14.2943C7.28242 14.2946 7.63335 14.497 7.82366 14.8256L8.93011 16.7357C9.01984 16.8905 9.18578 16.9857 9.36468 16.9857H10.642C10.8213 16.9857 10.987 16.89 11.0766 16.7347L12.1752 14.8275C12.3653 14.4975 12.7182 14.2943 13.0991 14.2943H15.3002C15.4794 14.2942 15.6452 14.1985 15.7348 14.0433L16.3725 12.9379C16.4621 12.7826 16.4621 12.5911 16.3725 12.4359L15.27 10.5287C15.1032 10.2404 15.0808 9.89331 15.2055 9.59021L15.269 9.46326L16.3696 7.55701C16.4591 7.40189 16.459 7.21022 16.3696 7.05505L15.7309 5.94861C15.6412 5.79363 15.4754 5.69863 15.2963 5.69861L13.0951 5.69763L12.9535 5.68884C12.6751 5.65158 12.4217 5.50519 12.2504 5.28259L12.1723 5.16443L11.0737 3.2572C10.9841 3.10175 10.8175 3.00525 10.6381 3.00525L9.36273 3.00623Z",fill:"currentColor"}))}function Es(n="icon-sm"){return f("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},f("path",{d:"M10.6878 9.46029L10.8421 9.49545L17.2913 11.43L17.4642 11.4974C18.2215 11.8649 18.2705 12.9544 17.5492 13.388L17.3822 13.4701L14.5872 14.5872L13.4701 17.3822C13.1135 18.2734 11.8913 18.2756 11.4974 17.4642L11.43 17.2913L9.49544 10.8421C9.26342 10.0687 9.92452 9.34418 10.6878 9.46029ZM12.4984 16.2288L13.3929 13.9954L13.4388 13.8949C13.5579 13.6675 13.7549 13.4891 13.9954 13.3929L16.2288 12.4984L10.9007 10.9007L12.4984 16.2288ZM5.90365 12.9749C6.16329 12.7153 6.58436 12.7154 6.84408 12.9749C7.10378 13.2346 7.10378 13.6557 6.84408 13.9154L5.0765 15.6829C4.8168 15.9426 4.39577 15.9426 4.13607 15.6829C3.87654 15.4232 3.87643 15.0022 4.13607 14.7425L5.90365 12.9749ZM2.83724 7.3265L5.25228 7.97299L5.37826 8.02084C5.65484 8.1591 5.80597 8.47712 5.72298 8.78744C5.63984 9.09774 5.34997 9.298 5.04134 9.27963L4.90853 9.25814L2.49349 8.61068L2.36752 8.56283C2.09082 8.42452 1.93961 8.10666 2.02279 7.79623C2.10599 7.4859 2.39574 7.28652 2.70443 7.30502L2.83724 7.3265ZM14.847 4.05111C15.1051 3.88059 15.4556 3.90894 15.6829 4.13607C15.9426 4.39577 15.9426 4.8168 15.6829 5.0765L13.9154 6.84408C13.6557 7.10378 13.2346 7.10378 12.9749 6.84408C12.7154 6.58437 12.7153 6.16329 12.9749 5.90365L14.7425 4.13607L14.847 4.05111ZM7.79623 2.02279C8.15098 1.92773 8.51562 2.13874 8.61068 2.49349L9.25814 4.90853L9.27962 5.04135C9.298 5.34998 9.09774 5.63984 8.78744 5.72299C8.47713 5.80592 8.15908 5.65484 8.02084 5.37826L7.97298 5.25228L7.3265 2.83724L7.30502 2.70443C7.28652 2.39577 7.48595 2.10603 7.79623 2.02279Z",fill:"currentColor"}))}const yp='@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-outline-style:solid;--top-fade:0;--bottom-fade:0;--edge-fade-distance:1rem}}}@layer theme{:root,:host{--font-sans:var(--vscode-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);--font-mono:var(--vscode-editor-font-family,ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace);--color-black:#000;--spacing:.25rem;--text-xs:11px;--text-xs--line-height:calc(1 / .75);--text-sm:12px;--text-sm--line-height:calc(1.25 / .875);--text-base:14px;--text-base--line-height: 1.5 ;--font-weight-medium:500;--radius-md:calc(var(--radius-md-base) * var(--corner-radius-scale));--radius-lg:calc(var(--radius-lg-base) * var(--corner-radius-scale));--radius-xl:calc(var(--radius-xl-base) * var(--corner-radius-scale));--radius-2xl:calc(var(--radius-2xl-base) * var(--corner-radius-scale));--radius-3xl:calc(var(--radius-3xl-base) * var(--corner-radius-scale));--shadow-xl:0px 8px 16px -4px #0000001f;--ease-out:cubic-bezier(0, 0, .2, 1);--blur-sm:8px;--blur-lg:16px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-token-foreground:var(--agent-text);--color-token-description-foreground:var(--agent-muted);--color-token-input-background:var(--agent-input-bg);--color-token-dropdown-background:var(--agent-surface-elevated);--color-token-border:var(--agent-border);--color-token-border-heavy:var(--agent-border-strong);--color-token-button-foreground:var(--agent-text);--color-token-button-background:var(--agent-accent);--color-token-button-secondary-foreground:var(--agent-text);--color-token-button-secondary-background:var(--agent-control);--color-token-button-secondary-hover-background:var(--agent-control-hover);--color-token-input-placeholder-foreground:var(--agent-muted);--color-token-charts-blue:var(--agent-accent);--color-token-text-tertiary:var(--agent-muted);--color-token-menu-border:var(--agent-border);--color-token-list-hover-background:var(--agent-control-hover);--color-token-side-bar-background:var(--agent-surface-elevated);--color-token-text-link-foreground:var(--agent-accent);--color-token-editor-background:var(--agent-page-bg);--corner-radius-scale:1;--radius-md-base:.5rem;--radius-lg-base:.625rem;--radius-xl-base:.75rem;--radius-2xl-base:1rem;--radius-3xl-base:1.25rem;--spacing-token-button-composer:calc(var(--spacing) * 7);--spacing-token-button-composer-sm:calc(var(--spacing) * 5);--spacing-token-button-composer-gap:var(--spacing);--h-token-button-composer-gap:var(--spacing-token-button-composer-gap)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.top-0{top:calc(var(--spacing) * 0)}.top-1\\/2{top:50%}.right-2\\.5{right:calc(var(--spacing) * 2.5)}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-\\[calc\\(100\\%\\+6px\\)\\]{bottom:calc(100% + 6px)}.bottom-full{bottom:100%}.left-0{left:calc(var(--spacing) * 0)}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.m-px{margin:1px}.ms-1{margin-inline-start:calc(var(--spacing) * 1)}.mt-1\\.5{margin-top:calc(var(--spacing) * 1.5)}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-\\[3px\\]{margin-right:3px}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-px{margin-bottom:1px}.ml-1\\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-auto{margin-left:auto}.box-border{box-sizing:border-box}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.aspect-square{aspect-ratio:1}.size-16{width:calc(var(--spacing) * 16);height:calc(var(--spacing) * 16)}.size-\\[22px\\]{width:22px;height:22px}.size-token-button-composer{width:var(--spacing-token-button-composer);height:var(--spacing-token-button-composer)}.\\!h-auto{height:auto!important}.h-0{height:calc(var(--spacing) * 0)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-\\[1lh\\]{height:1lh}.h-\\[1px\\]{height:1px}.h-auto{height:auto}.h-full{height:100%}.h-token-button-composer{height:var(--spacing-token-button-composer)}.h-token-button-composer-sm{height:var(--spacing-token-button-composer-sm)}.max-h-\\[25dvh\\]{max-height:25dvh}.max-h-\\[140px\\]{max-height:140px}.max-h-none{max-height:none}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-\\[1\\.25rem\\]{min-height:1.25rem}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-7{width:calc(var(--spacing) * 7)}.w-52{width:calc(var(--spacing) * 52)}.w-fit{width:fit-content}.w-full{width:100%}.w-max{width:max-content}.w-px{width:1px}.max-w-16{max-width:calc(var(--spacing) * 16)}.max-w-20{max-width:calc(var(--spacing) * 20)}.max-w-40{max-width:calc(var(--spacing) * 40)}.max-w-\\[60\\%\\]{max-width:60%}.max-w-\\[77\\%\\]{max-width:77%}.max-w-\\[320px\\]{max-width:320px}.max-w-full{max-width:100%}.max-w-none{max-width:none}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-56{min-width:calc(var(--spacing) * 56)}.min-w-max{min-width:max-content}.flex-1{flex:1}.flex-none{flex:none}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.resize{resize:both}.grid-cols-\\[auto_minmax\\(0\\,1fr\\)_auto\\]{grid-template-columns:auto minmax(0,1fr) auto}.grid-cols-\\[minmax\\(0\\,auto\\)_auto_minmax\\(0\\,1fr\\)\\]{grid-template-columns:minmax(0,auto) auto minmax(0,1fr)}.flex-col{flex-direction:column}.flex-row-reverse{flex-direction:row-reverse}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-\\[5px\\]{gap:5px}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-clip{overflow:clip}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-\\[color\\:var\\(--gray-0\\)\\]{border-color:var(--gray-0)}.border-token-border,.border-token-border\\/80{border-color:var(--color-token-border)}@supports (color:color-mix(in lab,red,red)){.border-token-border\\/80{border-color:color-mix(in oklab,var(--color-token-border) 80%,transparent)}}.border-transparent{border-color:#0000}.bg-\\[color\\:var\\(--gray-0\\)\\]{background-color:var(--gray-0)}.bg-token-border\\/70{background-color:var(--color-token-border)}@supports (color:color-mix(in lab,red,red)){.bg-token-border\\/70{background-color:color-mix(in oklab,var(--color-token-border) 70%,transparent)}}.bg-token-button-secondary-background{background-color:var(--color-token-button-secondary-background)}.bg-token-charts-blue{background-color:var(--color-token-charts-blue)}.bg-token-dropdown-background,.bg-token-dropdown-background\\/90{background-color:var(--color-token-dropdown-background)}@supports (color:color-mix(in lab,red,red)){.bg-token-dropdown-background\\/90{background-color:color-mix(in oklab,var(--color-token-dropdown-background) 90%,transparent)}}.bg-token-dropdown-background\\/95{background-color:var(--color-token-dropdown-background)}@supports (color:color-mix(in lab,red,red)){.bg-token-dropdown-background\\/95{background-color:color-mix(in oklab,var(--color-token-dropdown-background) 95%,transparent)}}.bg-token-foreground,.bg-token-foreground\\/5{background-color:var(--color-token-foreground)}@supports (color:color-mix(in lab,red,red)){.bg-token-foreground\\/5{background-color:color-mix(in oklab,var(--color-token-foreground) 5%,transparent)}}.bg-token-foreground\\/10{background-color:var(--color-token-foreground)}@supports (color:color-mix(in lab,red,red)){.bg-token-foreground\\/10{background-color:color-mix(in oklab,var(--color-token-foreground) 10%,transparent)}}.bg-token-input-background\\/90{background-color:var(--color-token-input-background)}@supports (color:color-mix(in lab,red,red)){.bg-token-input-background\\/90{background-color:color-mix(in oklab,var(--color-token-input-background) 90%,transparent)}}.bg-token-menu-border{background-color:var(--color-token-menu-border)}.bg-token-side-bar-background{background-color:var(--color-token-side-bar-background)}.\\[mask-image\\:linear-gradient\\(to_right\\,black_calc\\(100\\%_-_0\\.25rem\\)\\,transparent\\)\\]{-webkit-mask-image:linear-gradient(90deg,#000 calc(100% - .25rem),#0000);mask-image:linear-gradient(90deg,#000 calc(100% - .25rem),#0000)}.\\[mask-repeat\\:no-repeat\\]{-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.object-cover{object-fit:cover}.p-0\\.5{padding:calc(var(--spacing) * .5)}.p-2{padding:calc(var(--spacing) * 2)}.\\!px-0{padding-inline:calc(var(--spacing) * 0)!important}.px-0\\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-\\[var\\(--padding-row-x\\)\\]{padding-inline:var(--padding-row-x)}.py-0{padding-block:calc(var(--spacing) * 0)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-\\[var\\(--padding-row-y\\)\\]{padding-block:var(--padding-row-y)}.pt-0\\.5{padding-top:calc(var(--spacing) * .5)}.pr-0{padding-right:calc(var(--spacing) * 0)}.pr-1{padding-right:calc(var(--spacing) * 1)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.text-left{text-align:left}.align-bottom{vertical-align:bottom}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.\\!leading-none{--tw-leading:1!important;line-height:1!important}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-\\[18px\\]{--tw-leading:18px;line-height:18px}.leading-\\[calc\\(var\\(--codex-chat-font-size\\)\\+8px\\)\\]{--tw-leading:calc(var(--codex-chat-font-size) + 8px);line-height:calc(var(--codex-chat-font-size) + 8px)}.leading-none{--tw-leading:1;line-height:1}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.break-words{overflow-wrap:break-word}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.text-current{color:currentColor}.text-token-button-secondary-foreground{color:var(--color-token-button-secondary-foreground)}.text-token-description-foreground{color:var(--color-token-description-foreground)}.text-token-dropdown-background{color:var(--color-token-dropdown-background)}.text-token-foreground{color:var(--color-token-foreground)}.text-token-input-placeholder-foreground{color:var(--color-token-input-placeholder-foreground)}.text-token-text-tertiary{color:var(--color-token-text-tertiary)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0px 2px 4px -1px var(--tw-shadow-color,#00000014);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-\\[0\\.5px\\]{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(.5px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-token-border{--tw-ring-color:var(--color-token-border)}.outline-hidden{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.outline-hidden{outline-offset:2px;outline:2px solid #0000}}.backdrop-blur-lg{--tw-backdrop-blur:blur(var(--blur-lg));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.select-none{-webkit-user-select:none;user-select:none}.\\[--edge-fade-distance\\:2rem\\]{--edge-fade-distance:2rem}.group-focus-within\\:opacity-100:is(:where(.group):focus-within *){opacity:1}@media(hover:hover){.group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}.group-hover\\/collapsed-tool-activity\\:text-token-foreground:is(:where(.group\\/collapsed-tool-activity):hover *){color:var(--color-token-foreground)}.hover\\:bg-token-button-secondary-hover-background:hover{background-color:var(--color-token-button-secondary-hover-background)}.hover\\:bg-token-editor-background\\/40:hover{background-color:var(--color-token-editor-background)}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-token-editor-background\\/40:hover{background-color:color-mix(in oklab,var(--color-token-editor-background) 40%,transparent)}}.hover\\:bg-token-list-hover-background:hover{background-color:var(--color-token-list-hover-background)}.hover\\:bg-transparent:hover{background-color:#0000}.hover\\:text-token-button-foreground:hover{color:var(--color-token-button-foreground)}.hover\\:text-token-foreground:hover{color:var(--color-token-foreground)}}.focus\\:bg-token-list-hover-background:focus{background-color:var(--color-token-list-hover-background)}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\\:outline-token-button-background:focus-visible{outline-color:var(--color-token-button-background)}@media(hover:hover){.enabled\\:hover\\:bg-token-foreground\\/80:enabled:hover{background-color:var(--color-token-foreground)}@supports (color:color-mix(in lab,red,red)){.enabled\\:hover\\:bg-token-foreground\\/80:enabled:hover{background-color:color-mix(in oklab,var(--color-token-foreground) 80%,transparent)}}.enabled\\:hover\\:bg-token-list-hover-background:enabled:hover{background-color:var(--color-token-list-hover-background)}}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-40:disabled{opacity:.4}.data-\\[state\\=checked\\]\\:translate-x-\\[14px\\][data-state=checked]{--tw-translate-x:14px;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\\[state\\=open\\]\\:bg-token-foreground\\/80[data-state=open]{background-color:var(--color-token-foreground)}@supports (color:color-mix(in lab,red,red)){.data-\\[state\\=open\\]\\:bg-token-foreground\\/80[data-state=open]{background-color:color-mix(in oklab,var(--color-token-foreground) 80%,transparent)}}.data-\\[state\\=open\\]\\:bg-token-list-hover-background[data-state=open]{background-color:var(--color-token-list-hover-background)}.data-\\[state\\=unchecked\\]\\:translate-x-\\[2px\\][data-state=unchecked]{--tw-translate-x:2px;translate:var(--tw-translate-x) var(--tw-translate-y)}@container (min-width:500px){.\\@\\[500px\\]\\:inline{display:inline}}.electron\\:rounded-md:where([data-codex-window-type=electron],[data-codex-window-type=electron] *){border-radius:var(--radius-md)}.electron\\:p-1:where([data-codex-window-type=electron],[data-codex-window-type=electron] *){padding:calc(var(--spacing) * 1)}.electron\\:shadow-\\[0_4px_16px_0_rgba\\(0\\,0\\,0\\,0\\.05\\)\\]:where([data-codex-window-type=electron],[data-codex-window-type=electron] *){--tw-shadow:0 4px 16px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.electron\\:ring:where([data-codex-window-type=electron],[data-codex-window-type=electron] *){--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.electron\\:ring-black\\/10:where([data-codex-window-type=electron],[data-codex-window-type=electron] *){--tw-ring-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.electron\\:ring-black\\/10:where([data-codex-window-type=electron],[data-codex-window-type=electron] *){--tw-ring-color:color-mix(in oklab, var(--color-black) 10%, transparent)}}@media(prefers-color-scheme:dark){.electron\\:dark\\:bg-token-dropdown-background:where([data-codex-window-type=electron],[data-codex-window-type=electron] *){background-color:var(--color-token-dropdown-background)}}.extension\\:border:where([data-codex-window-type=extension],[data-codex-window-type=extension] *){border-style:var(--tw-border-style);border-width:1px}.extension\\:border-token-border\\/50:where([data-codex-window-type=extension],[data-codex-window-type=extension] *){border-color:var(--color-token-border)}@supports (color:color-mix(in lab,red,red)){.extension\\:border-token-border\\/50:where([data-codex-window-type=extension],[data-codex-window-type=extension] *){border-color:color-mix(in oklab,var(--color-token-border) 50%,transparent)}}.\\[\\&_\\.ProseMirror\\]\\:\\!h-5 .ProseMirror{height:calc(var(--spacing) * 5)!important}.\\[\\&_\\.ProseMirror\\]\\:h-auto .ProseMirror{height:auto}.\\[\\&_\\.ProseMirror\\]\\:\\!min-h-5 .ProseMirror{min-height:calc(var(--spacing) * 5)!important}.\\[\\&_\\.ProseMirror\\]\\:min-h-\\[2rem\\] .ProseMirror{min-height:2rem}.\\[\\&_\\.ProseMirror\\]\\:min-w-0 .ProseMirror{min-width:calc(var(--spacing) * 0)}.\\[\\&_\\.ProseMirror\\]\\:flex-1 .ProseMirror{flex:1}.\\[\\&_\\.ProseMirror\\]\\:resize-none .ProseMirror{resize:none}.\\[\\&_\\.ProseMirror\\]\\:overflow-hidden .ProseMirror{overflow:hidden}.\\[\\&_\\.ProseMirror\\]\\:leading-5 .ProseMirror{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.\\[\\&_\\.ProseMirror\\]\\:whitespace-nowrap .ProseMirror{white-space:nowrap}.\\[\\&_\\.ProseMirror\\]\\:focus-visible\\:outline-none .ProseMirror:focus-visible{--tw-outline-style:none;outline-style:none}.\\[\\&_\\.ProseMirror_p\\]\\:m-0 .ProseMirror p{margin:calc(var(--spacing) * 0)}.\\[\\&_\\.ProseMirror_p\\]\\:overflow-hidden .ProseMirror p{overflow:hidden}.\\[\\&_\\.ProseMirror_p\\]\\:text-ellipsis .ProseMirror p{text-overflow:ellipsis}.\\[\\&_\\.ProseMirror_p\\]\\:whitespace-nowrap .ProseMirror p{white-space:nowrap}.\\[\\&_\\.contain-inline-size\\]\\:\\[contain\\:initial\\] .contain-inline-size{contain:initial}.\\[\\&\\>\\*\\:last-child\\]\\:mb-0>:last-child{margin-bottom:calc(var(--spacing) * 0)}.\\[\\&\\>ol\\:first-child\\]\\:mt-0>ol:first-child,.\\[\\&\\>ul\\:first-child\\]\\:mt-0>ul:first-child{margin-top:calc(var(--spacing) * 0)}}@property --top-fade{syntax:"";inherits:false;initial-value:0}@property --bottom-fade{syntax:"";inherits:false;initial-value:0}@property --edge-fade-distance{syntax:"";inherits:false;initial-value:1rem}@keyframes edge-fade{0%,1%{--top-fade:0;--bottom-fade:var(--edge-fade-distance,1rem)}99%,to{--top-fade:var(--edge-fade-distance,1rem);--bottom-fade:0}}@supports (animation-timeline:--scroll-fade){.vertical-scroll-fade-mask{-webkit-mask:linear-gradient(to bottom in oklch,oklch(60% 0 0/0),oklch(85% 0 0) var(--top-fade) calc(100% - var(--bottom-fade)),oklch(60% 0 0/0));mask:linear-gradient(to bottom in oklch,oklch(60% 0 0/0),oklch(85% 0 0) var(--top-fade) calc(100% - var(--bottom-fade)),oklch(60% 0 0/0));animation-name:edge-fade;animation-timing-function:linear;animation-fill-mode:both;animation-timeline:scroll(self y)}}:root{color-scheme:dark;font-family:var(--font-sans);color:var(--agent-text,#f1f0e8);--agent-page-bg:transparent;--agent-surface:#1c1f1b57;--agent-surface-elevated:#1c1f1b7a;--agent-input-bg:#080a085c;--agent-border:#e9e7d81f;--agent-border-strong:#e9e7d838;--agent-text:#f1f0e8;--agent-muted:#f1f0e894;--agent-soft:#f1f0e8c7;--agent-accent:#8ab4f8;--agent-accent-soft:#8ab4f833;--agent-danger:#ff8d7e;--agent-shadow:#0003;--agent-card:var(--agent-input-bg);background:0 0}@supports (color:color-mix(in lab,red,red)){:root{--agent-card:color-mix(in srgb, var(--agent-input-bg) 90%, transparent)}}:root{--agent-card-hover:var(--agent-input-bg)}@supports (color:color-mix(in lab,red,red)){:root{--agent-card-hover:color-mix(in srgb, var(--agent-input-bg) 96%, transparent)}}:root{--agent-control:var(--agent-input-bg)}@supports (color:color-mix(in lab,red,red)){:root{--agent-control:color-mix(in srgb, var(--agent-input-bg) 44%, transparent)}}:root{--agent-control-hover:var(--agent-soft)}@supports (color:color-mix(in lab,red,red)){:root{--agent-control-hover:color-mix(in srgb, var(--agent-soft) 8%, transparent)}}:root{--agent-primary:var(--agent-accent)}@supports (color:color-mix(in lab,red,red)){:root{--agent-primary:color-mix(in srgb, var(--agent-accent) 90%, var(--agent-text))}}:root{--agent-primary-text:#fff;--cubic-enter:cubic-bezier(.19, 1, .22, 1);--cubic-exit-snappy:cubic-bezier(.65, 0, .4, 1);--transition-duration-basic:.15s;--gray-0:#fff;--color-background-surface:transparent;--color-background-surface-under:transparent;--color-background-elevated-primary:var(--agent-surface-elevated);--color-background-elevated-primary-opaque:var(--agent-surface-elevated)}@supports (color:color-mix(in lab,red,red)){:root{--color-background-elevated-primary-opaque:color-mix(in srgb, var(--agent-surface-elevated) 100%, #111)}}:root{--color-background-elevated-secondary:var(--agent-card);--color-background-elevated-secondary-opaque:var(--agent-card)}@supports (color:color-mix(in lab,red,red)){:root{--color-background-elevated-secondary-opaque:color-mix(in srgb, var(--agent-card) 100%, #111)}}:root{--thread-content-max-width:none;--markdown-wide-block-max-width:56rem;--padding-toolbar:calc(var(--spacing) * 4);--vscode-foreground:var(--agent-text);--vscode-descriptionForeground:var(--agent-muted);--vscode-input-background:var(--agent-input-bg);--vscode-dropdown-background:var(--agent-surface-elevated);--vscode-input-placeholderForeground:var(--agent-muted);--vscode-textLink-foreground:var(--agent-accent);--vscode-textLink-activeForeground:var(--agent-accent);--vscode-list-hoverBackground:var(--agent-control-hover);--color-token-editor-foreground:var(--agent-text);--color-token-editor-background:var(--agent-page-bg);--color-token-side-bar-background:var(--agent-surface-elevated);--color-token-main-surface-primary:transparent;--color-token-text-code-block-background:var(--agent-input-bg);--color-token-bg-primary:var(--agent-surface-elevated);--color-token-bg-secondary:var(--agent-card);--color-token-bg-fog:var(--color-background-elevated-secondary);--color-token-bg-tertiary:var(--agent-control);--color-token-list-hover-background:var(--agent-control-hover);--markdown-wide-block-max-height:80vh;--conversation-block-gap:12px;--conversation-tool-assistant-gap:16px;--color-token-terminal-ansi-black:var(--vscode-terminal-ansiBlack,#000);--color-token-terminal-ansi-red:var(--vscode-terminal-ansiRed,#f66);--color-token-terminal-ansi-green:var(--vscode-terminal-ansiGreen,#94f494);--color-token-terminal-ansi-yellow:var(--vscode-terminal-ansiYellow,#f4f47b);--color-token-terminal-ansi-blue:var(--vscode-terminal-ansiBlue,#9e9eff);--color-token-terminal-ansi-magenta:var(--vscode-terminal-ansiMagenta,#db6bdb);--color-token-terminal-ansi-cyan:var(--vscode-terminal-ansiCyan,#81eeee);--color-token-terminal-ansi-white:var(--vscode-terminal-ansiWhite,#d6d6d6);--color-token-terminal-ansi-bright-black:var(--vscode-terminal-ansiBrightBlack,#6e6e6e);--color-token-terminal-ansi-bright-red:var(--vscode-terminal-ansiBrightRed,#ffa8a8);--color-token-terminal-ansi-bright-green:var(--vscode-terminal-ansiBrightGreen,#0f0);--color-token-terminal-ansi-bright-yellow:var(--vscode-terminal-ansiBrightYellow,#ffffa8);--color-token-terminal-ansi-bright-blue:var(--vscode-terminal-ansiBrightBlue,#9494ff);--color-token-terminal-ansi-bright-magenta:var(--vscode-terminal-ansiBrightMagenta,#ffb3ff);--color-token-terminal-ansi-bright-cyan:var(--vscode-terminal-ansiBrightCyan,#adffff);--color-token-terminal-ansi-bright-white:var(--vscode-terminal-ansiBrightWhite,#fff);--padding-row-x:calc(var(--spacing) * 2);--padding-row-y:calc(var(--spacing) * 1.25);--height-token-nav-row:32px;--codex-chat-font-size:var(--vscode-chat-font-size,var(--vscode-font-size,13px));--codex-chat-code-font-size:var(--vscode-chat-editor-font-size,var(--vscode-editor-font-size,12px))}:root[data-codex-window-type=electron]{background:0 0;overflow:hidden}:root[data-codex-window-type=electron] body{--padding-row-y:calc(var(--spacing) * 1.25);--height-token-nav-row:calc(var(--text-base) * 1.5 + var(--padding-row-y) * 2);--padding-panel-base:calc(var(--spacing) * 5);--padding-panel:var(--padding-panel-base);--thread-content-max-width:48rem;--markdown-wide-block-max-width:56rem;--markdown-wide-block-max-height:80vh;--conversation-block-gap:12px;--conversation-tool-assistant-gap:16px;--spacing-token-button-composer-sm:calc(var(--spacing) * 7);--text-heading-md:18px;--cursor-interaction:default;--vscode-editor-font-family:ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;--vscode-font-size:var(--text-base);--vscode-editor-font-size:var(--text-sm);--vscode-chat-font-size:var(--vscode-font-size);--vscode-chat-editor-font-size:var(--vscode-editor-font-size);overscroll-behavior:none;overflow:hidden}:root[data-codex-window-type=electron]:not([data-codex-os=win32]) body{background:0 0}*{box-sizing:border-box}html,body,#root{background:0 0;height:100%}body{min-width:0;color:var(--agent-text);font-family:var(--font-sans);font-size:var(--text-base);font-weight:var(--vscode-font-weight,400);margin:0;overflow:hidden}button,select,textarea{font:inherit}button,select{cursor:default}.agent-shell{height:100%;min-height:100%;padding:var(--padding-toolbar);color:var(--agent-text);background:var(--agent-page-bg);flex-direction:column;display:flex}.agent-log,.log,.agent-thread{width:100%;min-height:0;max-width:var(--thread-content-max-width);scrollbar-width:thin;scrollbar-color:var(--agent-muted) transparent;background:0 0;flex:auto;margin:0 auto;padding:6px 2px 18px;overflow:auto}@supports (color:color-mix(in lab,red,red)){.agent-log,.log,.agent-thread{scrollbar-color:color-mix(in srgb,var(--agent-muted) 28%,transparent) transparent}}.agent-thread{gap:var(--conversation-block-gap,12px);flex-direction:column;padding-top:10px;padding-bottom:24px;display:flex;position:relative;overflow-x:hidden}:root[data-codex-window-type=electron] .agent-thread{--color-token-description-foreground:var(--color-token-foreground)}@supports (color:color-mix(in lab,red,red)){:root[data-codex-window-type=electron] .agent-thread{--color-token-description-foreground:color-mix(in srgb, var(--color-token-foreground) 70%, transparent)}}.agent-thread[data-empty]{justify-content:flex-end}.text-size-chat{font-size:var(--codex-chat-font-size)}.text-size-chat-sm{font-size:calc(var(--codex-chat-font-size) - 1px)}.text-size-code{font-size:var(--codex-chat-code-font-size)}.text-size-code-sm{font-size:calc(var(--codex-chat-code-font-size) - 1px)}.font-vscode-editor{font-family:var(--vscode-editor-font-family,var(--font-mono))}.codex-user-turn,.codex-assistant-turn,.codex-notice-turn{width:100%;min-width:0}.codex-user-bubble{color:var(--color-token-foreground);background:var(--color-token-foreground)}@supports (color:color-mix(in lab,red,red)){.codex-user-bubble{background:color-mix(in srgb,var(--color-token-foreground) 5%,transparent)}}.codex-user-message-content[data-collapsed=true]{-webkit-line-clamp:20;-webkit-box-orient:vertical;max-height:20lh;display:-webkit-box;overflow:hidden}.codex-user-message-toggle{background:0 0;border:0;padding:0}.codex-assistant-turn{justify-content:flex-start;display:flex}.codex-assistant-message{max-width:100%;color:var(--color-token-foreground);white-space:normal;overflow-wrap:anywhere}.codex-assistant-message-streaming{white-space:break-spaces}.codex-assistant-message :where(p){margin:0 0 .85em}.codex-assistant-message :where(p:last-child){margin-bottom:0}.codex-assistant-message :where(ul,ol){margin:.45em 0 .85em;padding-left:1.35rem}.codex-assistant-message :where(ul){list-style:outside}.codex-assistant-message :where(ol){list-style:decimal}.codex-assistant-message :where(li){margin:.25em 0}.codex-assistant-message :where(blockquote){border-left:2px solid var(--color-token-border);color:var(--agent-soft);margin:.75em 0;padding-left:.85rem}.codex-assistant-message :where(code){background:var(--agent-soft);border-radius:4px;padding:.12em .3em}@supports (color:color-mix(in lab,red,red)){.codex-assistant-message :where(code){background:color-mix(in srgb,var(--agent-soft) 10%,transparent)}}.codex-assistant-message :where(code){font-family:var(--font-mono);font-size:var(--codex-chat-code-font-size)}.codex-assistant-message :where(pre){border:1px solid var(--agent-border);margin:.75em 0;padding:.65rem .75rem;overflow-x:auto}@supports (color:color-mix(in lab,red,red)){.codex-assistant-message :where(pre){border:1px solid color-mix(in srgb,var(--agent-border) 72%,transparent)}}.codex-assistant-message :where(pre){border-radius:var(--radius-lg);background:var(--agent-input-bg)}@supports (color:color-mix(in lab,red,red)){.codex-assistant-message :where(pre){background:color-mix(in srgb,var(--agent-input-bg) 82%,transparent)}}.codex-assistant-message :where(pre code){white-space:pre;background:0 0;border-radius:0;padding:0;display:block}.codex-assistant-message :where(a){color:var(--agent-accent);text-underline-offset:2px;text-decoration:underline}.codex-assistant-message :where(hr){border-top:1px solid var(--color-token-border);margin:1rem 0}.codex-notice-turn{justify-content:flex-start;display:flex}.codex-notice-content{border:1px solid var(--agent-border);max-width:min(100%,44rem);padding:10px 12px}@supports (color:color-mix(in lab,red,red)){.codex-notice-content{border:1px solid color-mix(in srgb,var(--agent-border) 74%,transparent)}}.codex-notice-content{border-radius:var(--radius-lg);color:var(--agent-soft);background:var(--agent-surface-elevated)}@supports (color:color-mix(in lab,red,red)){.codex-notice-content{background:color-mix(in srgb,var(--agent-surface-elevated) 86%,transparent)}}.codex-notice-content{overflow-wrap:anywhere}.codex-notice-turn.error .codex-notice-content{border-color:var(--agent-danger)}@supports (color:color-mix(in lab,red,red)){.codex-notice-turn.error .codex-notice-content{border-color:color-mix(in srgb,var(--agent-danger) 46%,transparent)}}.codex-notice-turn.error .codex-notice-content{color:var(--agent-danger)}@supports (color:color-mix(in lab,red,red)){.codex-notice-turn.error .codex-notice-content{color:color-mix(in srgb,var(--agent-danger) 88%,var(--agent-text))}}.codex-notice-turn.error .codex-notice-content{background:var(--agent-danger)}@supports (color:color-mix(in lab,red,red)){.codex-notice-turn.error .codex-notice-content{background:color-mix(in srgb,var(--agent-danger) 11%,transparent)}}.codex-notice-turn.warning .codex-notice-content{border-color:var(--agent-accent)}@supports (color:color-mix(in lab,red,red)){.codex-notice-turn.warning .codex-notice-content{border-color:color-mix(in srgb,var(--agent-accent) 30%,transparent)}}.codex-tool-activity-turn{flex-direction:column;align-items:flex-start;gap:0;width:100%;min-width:0;display:flex}.codex-tool-activity-summary{max-width:100%;color:var(--color-token-foreground);border:0;padding:0}@supports (color:color-mix(in lab,red,red)){.codex-tool-activity-summary{color:color-mix(in srgb,var(--color-token-foreground) 40%,transparent)}}.codex-tool-activity-summary{font:inherit;font-size:var(--codex-chat-font-size);line-height:calc(var(--codex-chat-font-size) + 8px);background:0 0}.codex-tool-activity-summary:focus-visible{outline:none}.codex-tool-activity-turn.inProgress .codex-tool-activity-summary{color:var(--color-token-description-foreground)}@supports (color:color-mix(in lab,red,red)){.codex-tool-activity-turn.inProgress .codex-tool-activity-summary{color:color-mix(in srgb,var(--color-token-description-foreground) 90%,transparent)}}.codex-tool-activity-icon{color:var(--color-token-foreground);justify-content:center;align-items:center;display:inline-flex}@supports (color:color-mix(in lab,red,red)){.codex-tool-activity-icon{color:color-mix(in srgb,var(--color-token-foreground) 35%,transparent)}}.codex-tool-activity-icon{font-family:var(--font-mono);font-size:11px;line-height:1}.codex-tool-activity-turn.inProgress .codex-tool-activity-icon{animation:1.2s ease-in-out infinite codex-tool-activity-pulse}.codex-tool-activity-text{align-items:baseline;gap:4px;min-width:0;max-width:100%;display:inline-flex}.codex-tool-activity-action{color:var(--color-token-foreground);flex:none}@supports (color:color-mix(in lab,red,red)){.codex-tool-activity-action{color:color-mix(in srgb,var(--color-token-foreground) 58%,transparent)}}.codex-tool-activity-detail{min-width:0;color:var(--color-token-foreground);overflow:hidden}@supports (color:color-mix(in lab,red,red)){.codex-tool-activity-detail{color:color-mix(in srgb,var(--color-token-foreground) 40%,transparent)}}.codex-tool-activity-detail{font-family:var(--font-mono);text-overflow:ellipsis;white-space:nowrap}.codex-tool-activity-summary:hover .codex-tool-activity-action,.codex-tool-activity-summary:hover .codex-tool-activity-detail,.codex-tool-activity-summary:hover .codex-tool-activity-icon{color:var(--color-token-foreground)}.codex-tool-activity-output-shell{opacity:0;pointer-events:none;grid-template-rows:0fr;width:100%;min-width:0;transition:grid-template-rows .18s ease-out,opacity .18s ease-out;display:grid;overflow:hidden}.codex-tool-activity-output-shell[data-expanded=true]{opacity:1;pointer-events:auto;grid-template-rows:1fr}.codex-tool-activity-output-shell-inner{min-height:0;overflow:hidden}.codex-tool-activity-output-frame{min-height:1.25rem;padding-right:0;position:relative}.codex-tool-activity-output{box-sizing:border-box;max-width:min(100%,var(--markdown-wide-block-max-width));max-height:140px;color:var(--color-token-description-foreground);white-space:pre;--edge-fade-distance:2rem;background:0 0;border:0;border-radius:0;flex-direction:column;gap:6px;margin:0;padding:8px;font-weight:500;display:flex;overflow:auto}.codex-tool-output-copy:focus-visible{opacity:1}@keyframes codex-tool-activity-pulse{0%,to{opacity:.45}50%{opacity:1}}.agent-log-line,.log-line{border-bottom:1px solid var(--agent-border);grid-template-columns:4.5rem minmax(0,1fr);gap:12px;padding:9px 0;display:grid}@supports (color:color-mix(in lab,red,red)){.agent-log-line,.log-line{border-bottom:1px solid color-mix(in srgb,var(--agent-border) 55%,transparent)}}.agent-log-line,.log-line{color:var(--agent-soft);font-family:var(--font-mono);font-size:12px;line-height:1.5}.agent-log-line:last-child,.log-line:last-child{border-bottom-color:#0000}.agent-log-label,.log-label{color:var(--agent-muted);text-overflow:ellipsis;text-transform:uppercase;overflow:hidden}.agent-log-line.stdout .agent-log-label,.log-line.stdout .log-label{color:var(--agent-accent)}.agent-log-line.stderr .agent-log-label,.agent-log-line.error .agent-log-label,.log-line.stderr .log-label,.log-line.error .log-label{color:var(--agent-danger)}.agent-log-text,.log-text{overflow-wrap:anywhere;white-space:pre-wrap;word-break:normal;min-width:0}.agent-composer-stack{width:100%;max-width:var(--thread-content-max-width);gap:6px;margin:0 auto;display:grid}.above-composer-suggestion-shell{container-type:inline-size}.codex-composer-frame{--composer-top-tray-inline-padding:12px;--composer-top-tray-top-padding:14px;--composer-top-tray-max-height:177px}.codex-composer-surface{color:var(--color-token-foreground)}.codex-composer-inner{isolation:isolate}@supports (corner-shape:superellipse(1.5)){:root{--corner-radius-scale:1.25}.codex-composer-surface,.codex-user-bubble,.codex-notice-content,.provider-dropdown,.provider-dropdown-item,.add-context-dropdown,.add-context-item,.composer-attachment-file,.composer-attachment-image,.rate-limit-popover,.codex-top-tray-panel,.codex-top-tray-item{corner-shape:superellipse(1.5)}}.codex-composer-single-line{min-height:0}.composer-single-line-measure{pointer-events:none;visibility:hidden;white-space:pre;width:max-content;max-width:none;height:0;font-family:var(--font-sans);font-size:var(--text-base);line-height:20px;position:absolute;overflow:hidden}.h-token-button-composer{height:var(--spacing-token-button-composer);gap:var(--h-token-button-composer-gap)}.h-token-button-composer-sm{height:var(--spacing-token-button-composer-sm);gap:var(--h-token-button-composer-gap)}.size-token-button-composer{width:var(--spacing-token-button-composer);height:var(--spacing-token-button-composer)}.size-token-button-composer-sm{width:var(--spacing-token-button-composer-sm);height:var(--spacing-token-button-composer-sm)}.icon-3xs{width:10px;height:10px}.icon-xxs{width:12px;height:12px}.icon-2xs{width:14px;height:14px}.icon-xs{width:16px;height:16px}.icon-sm{width:18px;height:18px}.icon-base{width:20px;height:20px}.icon-md{width:24px;height:24px}.icon-lg{width:28px;height:28px}.cursor-interaction{cursor:var(--cursor-interaction)}.no-drag{-webkit-app-region:no-drag}.outline-hidden{outline-offset:2px;outline:2px solid #0000}.user-select-none{-webkit-user-select:none;user-select:none}.shadow-xl-spread{--tw-shadow:0px 0px 0px .5px var(--tw-shadow-color,var(--color-token-border)), var(--shadow-xl);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}._content_1hiti_1{--dropdown-content-inset:2px;--dropdown-content-start-transform:translateY(calc(var(--dropdown-content-inset) * -1)) scale(.98);transform-origin:var(--radix-dropdown-menu-content-transform-origin);will-change:opacity,transform}._content_1hiti_1[data-side=top]{--dropdown-content-start-transform:translateY(var(--dropdown-content-inset)) scale(.98)}._content_1hiti_1[data-side=right]{--dropdown-content-start-transform:translateX(calc(var(--dropdown-content-inset) * -1)) scale(.98)}._content_1hiti_1[data-side=left]{--dropdown-content-start-transform:translateX(var(--dropdown-content-inset)) scale(.98)}@media(prefers-reduced-motion:no-preference){._content_1hiti_1[data-state=open]{animation:_dropdown-content-enter_1hiti_1 var(--transition-duration-basic) var(--cubic-enter)}}@keyframes _dropdown-content-enter_1hiti_1{0%{opacity:0;transform:var(--dropdown-content-start-transform)}to{opacity:1;transform:translate(0)translateY(0)scale(1)}}.hide-scrollbar{scrollbar-width:none}.hide-scrollbar::-webkit-scrollbar{display:none}.prompt-input{resize:none;width:100%;min-height:2.75rem;max-height:200px;color:var(--color-token-foreground);font-size:var(--text-base);background:0 0;border:0;outline:none;padding:0;line-height:20px;display:block}.prompt-input::placeholder{color:var(--color-token-input-placeholder-foreground)}@supports (color:color-mix(in lab,red,red)){.prompt-input::placeholder{color:color-mix(in srgb,var(--color-token-input-placeholder-foreground) 50%,transparent)}}.ProseMirror{min-width:0;color:var(--agent-text);caret-color:var(--agent-text);font-variant-ligatures:none;font-feature-settings:"liga" 0;white-space:pre-wrap;white-space:break-spaces;word-wrap:break-word;word-break:normal;background:0 0;outline:none;position:relative;overflow-y:auto}.ProseMirror pre{white-space:pre-wrap}.ProseMirror li{position:relative}.ProseMirror-hideselection{caret-color:#0000;background:0 0}.ProseMirror-hideselection ::selection{caret-color:#0000;background:0 0}.ProseMirror [draggable][contenteditable=false]{-webkit-user-select:text;user-select:text}.ProseMirror-selectednode{outline:2px solid #8cf}li.ProseMirror-selectednode{outline:none}li.ProseMirror-selectednode:after{content:"";pointer-events:none;border:2px solid #8cf;position:absolute;inset:-2px -2px -2px -32px}img.ProseMirror-separator{border:none!important;margin:0!important;display:inline!important}.ProseMirror p{margin:0}.ProseMirror .placeholder{pointer-events:none;-webkit-user-select:none;user-select:none;position:relative}.ProseMirror .placeholder:after{color:var(--color-token-input-placeholder-foreground);content:attr(data-placeholder);opacity:.5;pointer-events:none;-webkit-user-select:none;user-select:none;white-space:nowrap;text-overflow:ellipsis;max-width:100%;position:absolute;inset:0 0 auto;overflow:hidden}.ProseMirror .placeholder::selection{color:inherit;background:0 0}.ProseMirror .placeholder ::selection{color:inherit;background:0 0}.ProseMirror .ProseMirror-selectednode:has([skill-mention-name]){outline:none}.prompt-editor-mention{--inline-mention-base-color:var(--color-token-text-link-foreground)}@supports (color:color-mix(in lab,red,red)){.prompt-editor-mention{--inline-mention-base-color:color-mix(in srgb, var(--color-token-text-link-foreground) 80%, var(--color-token-foreground) 20%)}}.prompt-editor-mention{--inline-mention-color:var(--inline-mention-resolved-base-color,var(--inline-mention-base-color));max-width:100%;color:var(--inline-mention-color);vertical-align:baseline;white-space:nowrap;align-items:baseline;display:inline-flex}.prompt-editor-mention:hover{text-underline-offset:2px;text-decoration-line:underline;text-decoration-style:dashed;text-decoration-thickness:.5px}.prompt-editor-mention-icon{color:currentColor}[cmdk-dialog],[cmdk-dialog]:focus-visible{outline:none}[cmdk-root],[data-cmdk-root]{z-index:1000;gap:var(--spacing);min-width:100%;padding:var(--spacing);border:1px solid var(--color-token-border);border-radius:var(--radius-3xl);color:var(--color-token-foreground);background-color:var(--color-token-dropdown-background);flex-direction:column;display:flex}@supports (color:color-mix(in lab,red,red)){[cmdk-root],[data-cmdk-root]{background-color:color-mix(in oklab,var(--color-token-dropdown-background) 95%,transparent)}}[cmdk-root],[data-cmdk-root]{font-size:var(--text-sm);opacity:1;-webkit-user-select:none;user-select:none;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);--cmdk-bottom-item-radius:calc(var(--radius-3xl) - var(--spacing));transform:translateZ(0)}[cmdk-item]{content-visibility:auto;width:100%;min-height:calc(var(--spacing) * 6);padding:var(--padding-row-y) var(--padding-row-x);border-radius:var(--radius-lg);color:var(--color-token-foreground);cursor:var(--cursor-interaction);opacity:.75;-webkit-user-select:none;user-select:none;outline:none;flex-direction:row;align-items:center;display:flex}[cmdk-item][aria-disabled=true],[cmdk-item][data-disabled=true]{cursor:default;opacity:.25}[cmdk-item]:hover:not([aria-disabled=true]),[cmdk-item][data-selected=true],[cmdk-item][aria-selected=true],[cmdk-item]:focus-visible,[cmdk-item]:active:not([aria-disabled=true]){background-color:var(--color-token-list-hover-background);opacity:1}[cmdk-item][data-command-menu-loading=true],[cmdk-item][data-command-menu-loading=true]:hover,[cmdk-item][data-command-menu-loading=true][data-selected=true],[cmdk-item][data-command-menu-loading=true][aria-selected=true],[cmdk-item][data-command-menu-loading=true]:focus-visible,[cmdk-item][data-command-menu-loading=true]:active{cursor:default;opacity:.6;background-color:#0000}[cmdk-item][data-command-menu-empty-state=true],[cmdk-item][data-command-menu-empty-state=true]:hover,[cmdk-item][data-command-menu-empty-state=true][data-selected=true],[cmdk-item][data-command-menu-empty-state=true][aria-selected=true],[cmdk-item][data-command-menu-empty-state=true]:focus-visible,[cmdk-item][data-command-menu-empty-state=true]:active{cursor:default;opacity:1;background-color:#0000}[cmdk-list]{min-height:0;max-height:min(300px,var(--cmdk-list-height,300px));gap:var(--spacing);overscroll-behavior:contain;scrollbar-width:none;flex-direction:column;transition:max-height .1s;display:flex;overflow-y:auto}[cmdk-list]:focus-visible{outline:none}.command-menu-dialog [cmdk-list]{max-height:var(--command-menu-list-max-height);scroll-padding-block-start:calc(var(--spacing) * 8)}.composer-home-top-menu [cmdk-list]{max-height:none}.composer-home-top-menu{max-height:min(320px,var(--composer-top-menu-max-height,320px));overflow:hidden}:where([cmdk-list])>[cmdk-item]:not(:has(~[cmdk-item],~[cmdk-group]:not([hidden]))),:where([cmdk-list])>[cmdk-group]:not([hidden]):not(:has(~[cmdk-item],~[cmdk-group]:not([hidden]))) [cmdk-item]:last-of-type,:where([cmdk-list])>[cmdk-list-sizer]>[cmdk-item]:not(:has(~[cmdk-item],~[cmdk-group]:not([hidden]))),:where([cmdk-list])>[cmdk-list-sizer]>[cmdk-group]:not([hidden]):not(:has(~[cmdk-item],~[cmdk-group]:not([hidden]))) [cmdk-item]:last-of-type{border-bottom-right-radius:var(--cmdk-bottom-item-radius);border-bottom-left-radius:var(--cmdk-bottom-item-radius)}[cmdk-input]{padding:calc(var(--spacing) * 1.5) calc(var(--spacing) * 2.5)}[cmdk-input]:focus-visible{outline:none}[cmdk-empty],[data-cmdk-empty]{min-height:calc(var(--spacing) * 8);padding:calc(var(--spacing) * 1.5) calc(var(--spacing) * 2.5);color:var(--color-token-description-foreground);text-align:center;white-space:pre-wrap;align-items:center;line-height:1.4;display:flex}[data-codex-window-type=electron] [cmdk-root],[data-codex-window-type=electron] [data-cmdk-root]{font-size:var(--text-base)}.codex-attachment-tray{scrollbar-width:none}.codex-attachment-tray::-webkit-scrollbar{display:none}.codex-user-attachment-tray{max-width:77%}.codex-user-attachment-tray .codex-attachment-row{justify-content:flex-end;min-width:0}.composer-attachment-image{border:1px solid var(--color-token-border-heavy);border-radius:var(--radius-lg);background:var(--color-token-input-background);flex:none;width:80px;height:80px;display:inline-flex;position:relative;overflow:visible}.composer-attachment-image img{border-radius:calc(var(--radius-lg) - 1px);object-fit:cover;width:100%;height:100%}.composer-attachment-file{border:.5px solid var(--color-token-border-heavy);flex:none;align-items:center;gap:7px;max-width:min(220px,70vw);height:32px;padding:0 30px 0 10px;display:inline-flex;position:relative}@supports (color:color-mix(in lab,red,red)){.composer-attachment-file{border:.5px solid color-mix(in srgb,var(--color-token-border-heavy) 80%,transparent)}}.composer-attachment-file{border-radius:var(--radius-lg);color:var(--color-token-foreground);background:var(--color-token-dropdown-background)}@supports (color:color-mix(in lab,red,red)){.composer-attachment-file{background:color-mix(in srgb,var(--color-token-dropdown-background) 90%,transparent)}}.composer-attachment-file-icon{color:var(--color-token-description-foreground);flex:none;display:inline-flex}.composer-attachment-file-label{min-width:0;font-size:var(--text-sm);text-overflow:ellipsis;white-space:nowrap;font-weight:500;line-height:1rem;overflow:hidden}.composer-attachment-remove{border:.5px solid var(--color-token-border-heavy);justify-content:center;align-items:center;width:18px;height:18px;display:inline-flex;position:absolute;top:-7px;right:-7px}@supports (color:color-mix(in lab,red,red)){.composer-attachment-remove{border:.5px solid color-mix(in srgb,var(--color-token-border-heavy) 70%,transparent)}}.composer-attachment-remove{color:var(--color-token-foreground);background:var(--color-token-dropdown-background);border-radius:999px;box-shadow:0 1px 3px #0000002e}.composer-attachment-remove:hover,.composer-attachment-remove:focus-visible{background:var(--color-token-list-hover-background)}.codex-left-rail,.codex-secondary-controls,.codex-action-cluster,.model-picker,.rate-line{align-items:center;display:flex}.codex-left-rail{scrollbar-width:none;flex:0 auto;min-width:0;margin:0;padding:0;overflow-x:auto}.codex-left-rail::-webkit-scrollbar{display:none}.composer-mode-indicator{color:var(--color-token-text-link-foreground);flex:0 auto}.composer-mode-divider{background:var(--color-token-border);width:1px;height:1rem;margin:0 1px}@supports (color:color-mix(in lab,red,red)){.composer-mode-divider{background:color-mix(in srgb,var(--color-token-border) 70%,transparent)}}.composer-mode-button{min-width:0;color:var(--color-token-text-link-foreground)}.composer-mode-icon{flex:none;justify-content:center;align-items:center;display:inline-flex}.composer-mode-icon-hover,.composer-mode-button:hover .composer-mode-icon-default,.composer-mode-button:focus-visible .composer-mode-icon-default{display:none}.composer-mode-button:hover .composer-mode-icon-hover,.composer-mode-button:focus-visible .composer-mode-icon-hover{display:inline-flex}.composer-mode-label{color:currentColor;font-weight:500}.composer-context-indicator{color:var(--color-token-text-link-foreground);flex:0 auto}.composer-context-divider{background:var(--color-token-border);margin:0 1px}@supports (color:color-mix(in lab,red,red)){.composer-context-divider{background:color-mix(in srgb,var(--color-token-border) 70%,transparent)}}.composer-context-button{color:var(--color-token-text-link-foreground)}.composer-context-icon{justify-content:center;align-items:center;display:inline-flex}.composer-context-icon-hover,.composer-context-button:hover .composer-context-icon-default,.composer-context-button:focus-visible .composer-context-icon-default{display:none}.composer-context-button:hover .composer-context-icon-hover,.composer-context-button:focus-visible .composer-context-icon-hover{display:inline-flex}.composer-context-label{color:currentColor;font-weight:500}.codex-secondary-controls{flex:0 auto;justify-content:flex-end}.codex-action-cluster{flex:none;justify-content:flex-end}.model-picker-root{flex:none;align-items:center;display:inline-flex}.model-picker,.codex-tool,.codex-action{outline:none;flex:none;justify-content:center;align-items:center;display:inline-flex;position:relative}.codex-tool,.codex-action{line-height:18px}.model-picker{letter-spacing:0;white-space:nowrap;min-width:0;max-width:10rem}.model-icon{border:1px solid var(--agent-border-strong);flex:none;justify-content:center;align-items:center;width:18px;height:18px;display:inline-flex}@supports (color:color-mix(in lab,red,red)){.model-icon{border:1px solid color-mix(in srgb,var(--agent-border-strong) 70%,transparent)}}.model-icon{color:var(--agent-text);background:var(--agent-control);border-radius:999px;font-size:10px;font-weight:750;line-height:1}.model-label{min-width:0;color:var(--color-token-foreground);text-overflow:ellipsis;overflow:hidden}.model-chevron{color:var(--color-token-input-placeholder-foreground);flex:none;line-height:1}.provider-dropdown{z-index:50;border:.5px solid var(--color-token-menu-border);width:13rem;max-height:min(250px,100vh - 16px);position:absolute;bottom:calc(100% + 6px);left:0}@supports (color:color-mix(in lab,red,red)){.provider-dropdown{border:.5px solid color-mix(in srgb,var(--color-token-menu-border) 78%,transparent)}}.provider-dropdown{border-radius:var(--radius-xl);color:var(--color-token-foreground);background:var(--color-token-dropdown-background)}@supports (color:color-mix(in lab,red,red)){.provider-dropdown{background:color-mix(in srgb,var(--color-token-dropdown-background) 90%,transparent)}}.provider-dropdown{-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.provider-dropdown-title{min-height:24px;padding:var(--padding-row-y) var(--padding-row-x);color:var(--color-token-description-foreground);font-size:var(--text-sm);text-overflow:ellipsis;white-space:nowrap;align-items:center;line-height:1rem;display:flex;overflow:hidden}.provider-dropdown-item{width:100%;color:var(--color-token-foreground);text-align:left;background:0 0;border:0}.provider-dropdown-item:hover,.provider-dropdown-item:focus,.provider-dropdown-item[data-selected=true]{background:var(--color-token-list-hover-background)}.provider-dropdown-check{color:var(--color-token-foreground)}.permissions-root{flex:0 auto;min-width:0;display:inline-flex;position:relative}.permissions-trigger{color:var(--color-token-input-placeholder-foreground)}.permissions-trigger[data-permission-mode=auto-review],.permissions-item[data-permission-mode=auto-review] .permissions-item-icon{color:var(--color-token-text-link-foreground)}.permissions-trigger[data-permission-mode=full-access],.permissions-item[data-permission-mode=full-access] .permissions-item-icon{color:var(--agent-danger)}.permissions-trigger-label{color:currentColor;font-weight:500}.permissions-trigger-chevron{color:currentColor;opacity:.72}.permissions-dropdown{z-index:50;border:.5px solid var(--color-token-menu-border);width:13.5rem;max-height:min(250px,100vh - 16px);position:absolute;bottom:calc(100% + 6px);left:0;overflow-y:auto}@supports (color:color-mix(in lab,red,red)){.permissions-dropdown{border:.5px solid color-mix(in srgb,var(--color-token-menu-border) 78%,transparent)}}.permissions-dropdown{border-radius:var(--radius-xl);color:var(--color-token-foreground);background:var(--color-token-dropdown-background)}@supports (color:color-mix(in lab,red,red)){.permissions-dropdown{background:color-mix(in srgb,var(--color-token-dropdown-background) 90%,transparent)}}.permissions-dropdown{-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.permissions-item{width:100%;min-height:calc(var(--spacing) * 8);align-items:center;gap:calc(var(--spacing) * 2);color:var(--color-token-foreground);text-align:left;background:0 0;border:0;display:flex}.permissions-item:hover,.permissions-item:focus-visible,.permissions-item[data-selected=true]{background:var(--color-token-list-hover-background)}.permissions-item-icon,.permissions-item-check{color:var(--color-token-description-foreground);justify-content:center;align-items:center;display:inline-flex}.permissions-item-label{color:var(--color-token-foreground);font-weight:500}.add-context-root{flex:none;display:inline-flex;position:relative}.add-context-dropdown{z-index:50;border:.5px solid var(--color-token-menu-border);width:max-content;min-width:120px;max-width:min(320px,100vw - 16px);max-height:min(270px,100vh - 16px);position:absolute;bottom:calc(100% + 6px);left:-8px;overflow-y:auto}@supports (color:color-mix(in lab,red,red)){.add-context-dropdown{border:.5px solid color-mix(in srgb,var(--color-token-menu-border) 78%,transparent)}}.add-context-dropdown{border-radius:var(--radius-xl);color:var(--color-token-foreground);background:var(--color-token-dropdown-background)}@supports (color:color-mix(in lab,red,red)){.add-context-dropdown{background:color-mix(in srgb,var(--color-token-dropdown-background) 90%,transparent)}}.add-context-dropdown{-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.add-context-item{width:100%;min-height:calc(var(--spacing) * 8);align-items:center;gap:calc(var(--spacing) * 1.5);color:var(--color-token-foreground);cursor:var(--cursor-interaction);text-align:left;background:0 0;border:0;display:flex}.add-context-item:hover,.add-context-item:focus-visible{background:var(--color-token-list-hover-background)}.add-context-item:disabled{cursor:default;opacity:.5}.add-context-item:disabled:hover{background:0 0}.add-context-item-icon{color:var(--color-token-description-foreground);opacity:.75;justify-content:center;align-items:center;display:inline-flex}.add-context-item:hover .add-context-item-icon,.add-context-item:focus-visible .add-context-item-icon{opacity:1}.add-context-glyph{width:14px;height:14px;color:var(--color-token-description-foreground);font-size:var(--text-sm);justify-content:center;align-items:center;font-weight:700;line-height:1;display:inline-flex}.add-context-item-label{color:var(--color-token-foreground);font-weight:500}.add-context-item-detail{color:var(--color-token-description-foreground);font-size:var(--text-sm)}.add-context-separator{flex:none}.add-context-separator-line{background:var(--color-token-menu-border)}.provider-select{appearance:none;color:#0000;opacity:0;background:0 0;outline:none;width:100%;height:100%;position:absolute;inset:0}.composer-separator{background:var(--agent-border-strong);flex:none;width:1px;height:18px;margin:0 3px}@supports (color:color-mix(in lab,red,red)){.composer-separator{background:color-mix(in srgb,var(--agent-border-strong) 72%,transparent)}}.codex-start{width:auto;min-width:56px}.codex-circle-action:before{content:"";border:2px solid;border-radius:999px;width:13px;height:13px}.send-button{border-radius:999px}.provider-select:disabled{opacity:0}.rate-line{min-width:0;color:var(--agent-muted);gap:6px;padding:0 2px}@supports (color:color-mix(in lab,red,red)){.rate-line{color:color-mix(in srgb,var(--agent-muted) 88%,transparent)}}.rate-line{white-space:nowrap;font-size:12px;font-weight:500;line-height:1.35}.rate-line[hidden]{display:none}.rate-line :where(span){text-overflow:ellipsis;min-width:0;overflow:hidden}.codex-rate-limit-summary{flex-wrap:nowrap;justify-content:flex-start;overflow:hidden}.rate-limit-trigger{border-radius:var(--radius-md);max-width:100%;height:22px;color:var(--color-token-input-placeholder-foreground);border:0;padding:0 4px;display:inline-flex;position:relative}@supports (color:color-mix(in lab,red,red)){.rate-limit-trigger{color:color-mix(in srgb,var(--color-token-input-placeholder-foreground) 94%,transparent)}}.rate-limit-trigger{font-size:var(--text-sm);background:0 0;font-weight:500;line-height:1}.rate-limit-trigger-inline{gap:6px;overflow:hidden}.rate-limit-trigger:hover,.rate-limit-trigger:focus-visible,.rate-limit-trigger[aria-expanded=true]{background:var(--color-token-list-hover-background);outline:none}.rate-limit-speedometer,.rate-limit-chevron{color:var(--color-token-input-placeholder-foreground);flex:none}@supports (color:color-mix(in lab,red,red)){.rate-limit-speedometer,.rate-limit-chevron{color:color-mix(in srgb,var(--color-token-input-placeholder-foreground) 86%,transparent)}}.rate-line-heading{color:var(--color-token-input-placeholder-foreground);flex:none}@supports (color:color-mix(in lab,red,red)){.rate-line-heading{color:color-mix(in srgb,var(--color-token-input-placeholder-foreground) 92%,transparent)}}.rate-limit-inline-separator{color:var(--agent-accent);flex:none}@supports (color:color-mix(in lab,red,red)){.rate-limit-inline-separator{color:color-mix(in srgb,var(--agent-accent) 82%,transparent)}}.rate-limit-inline-segment{align-items:baseline;gap:5px;min-width:0;display:inline-flex}.rate-limit-popover{color:var(--color-token-foreground)}.rate-limit-popover-title{color:var(--color-token-description-foreground);font-size:var(--text-xs);padding:2px 0 5px;font-weight:600}.rate-limit-popover-row{min-width:0;min-height:24px;color:var(--color-token-foreground);grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:24px;display:grid}.rate-limit-window{min-width:0;color:var(--color-token-foreground);text-overflow:ellipsis;font-weight:500;overflow:hidden}.rate-limit-row-value{min-width:0;color:var(--color-token-description-foreground);text-align:right;justify-content:flex-end;align-items:center;gap:5px;display:inline-flex}.rate-limit-percent{color:var(--color-token-input-placeholder-foreground);flex:none}@supports (color:color-mix(in lab,red,red)){.rate-limit-percent{color:color-mix(in srgb,var(--color-token-input-placeholder-foreground) 92%,transparent)}}.rate-limit-percent{font-weight:600}.rate-limit-reset{min-width:0;color:var(--color-token-description-foreground)}.status-dot{background:var(--agent-muted);border-radius:999px;flex:none;width:6px;height:6px}.status-dot.running{background:var(--agent-accent)}.status-dot.failed{background:var(--agent-danger)}.codex-top-tray-shell{width:calc(var(--composer-top-tray-inline-padding,12px) * 2 + 100% + 8px);min-width:0;left:50%;bottom:var(--composer-top-tray-top-padding,14px);transform:translate(-50%)}.codex-top-tray-panel,.codex-top-tray-panel[cmdk-root],.codex-top-tray-panel[data-cmdk-root]{width:100%;min-width:0;max-height:var(--composer-top-tray-max-height,177px);padding:var(--spacing);padding-top:calc(var(--spacing) * 3);padding-left:calc(var(--spacing) * 2);border:1px solid var(--composer-top-tray-border,var(--color-token-border));flex-direction:column;display:flex;position:relative}@supports (color:color-mix(in lab,red,red)){.codex-top-tray-panel,.codex-top-tray-panel[cmdk-root],.codex-top-tray-panel[data-cmdk-root]{border:1px solid var(--composer-top-tray-border,color-mix(in srgb, var(--color-token-border) 72%, transparent))}}.codex-top-tray-panel,.codex-top-tray-panel[cmdk-root],.codex-top-tray-panel[data-cmdk-root]{border-top-left-radius:var(--radius-3xl);border-top-right-radius:var(--radius-3xl);color:var(--color-token-foreground);background:var(--composer-top-tray-background,var(--color-token-side-bar-background));border-top-color:#0000;border-bottom:none;border-bottom-right-radius:0;border-bottom-left-radius:0}@supports (color:color-mix(in lab,red,red)){.codex-top-tray-panel,.codex-top-tray-panel[cmdk-root],.codex-top-tray-panel[data-cmdk-root]{background:var(--composer-top-tray-background,color-mix(in oklab, var(--color-token-side-bar-background) 94%, transparent))}}.codex-top-tray-panel,.codex-top-tray-panel[cmdk-root],.codex-top-tray-panel[data-cmdk-root]{box-shadow:none;font-size:var(--text-sm);-webkit-backdrop-filter:none;backdrop-filter:none;isolation:isolate;-webkit-user-select:none;user-select:none;--cmdk-bottom-item-radius:0;overflow:hidden}.codex-top-tray-title{padding:0 var(--padding-row-x) calc(var(--spacing) * 1.25);color:var(--color-token-description-foreground);font-size:var(--text-xs);font-weight:600;line-height:1.2}.codex-top-tray-list,.codex-top-tray-panel [cmdk-list],.codex-top-tray-panel [data-cmdk-list]{gap:var(--spacing);scrollbar-width:none;flex-direction:column;flex:1;width:100%;min-height:0;max-height:none;transition:none;display:flex;overflow-y:auto}.codex-top-tray-list::-webkit-scrollbar{display:none}.codex-top-tray-empty,.codex-top-tray-panel [data-cmdk-empty]{padding:var(--padding-row-y) var(--padding-row-x);color:var(--color-token-input-placeholder-foreground);font-size:var(--text-sm);align-items:center;display:flex}.codex-top-tray-item,.codex-top-tray-item[cmdk-item],.codex-top-tray-item[data-list-navigation-item]{width:calc(100% - var(--spacing) * 2);min-height:calc(var(--spacing) * 6);padding:var(--padding-row-y) var(--padding-row-x);border-radius:var(--radius-lg);color:var(--color-token-foreground);cursor:var(--cursor-interaction,default);font-size:var(--text-sm);opacity:.75;text-align:left;background:0 0;border:0;outline:none;flex-shrink:0;align-items:center;gap:0;display:flex;overflow:hidden}.codex-top-tray-item:hover,.codex-top-tray-item[data-selected=true],.codex-top-tray-item:focus-visible{background:var(--color-token-list-hover-background);opacity:1}.codex-top-tray-icon{width:14px;height:14px;color:var(--color-token-description-foreground);font-size:var(--text-sm);flex:none;justify-content:center;align-items:center;font-weight:700;line-height:1;display:inline-flex}.codex-top-tray-copy{align-items:center;gap:calc(var(--spacing) * 2);min-width:0;display:flex}.codex-top-tray-label,.codex-top-tray-detail{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.codex-top-tray-label{color:var(--color-token-foreground);font-size:var(--text-sm)}.codex-top-tray-detail{color:var(--color-token-description-foreground);font-size:var(--text-sm);flex:1 1 0}@media(max-width:720px){.agent-shell{padding:10px}.prompt-input{min-height:2.75rem;font-size:16px}.model-picker,.codex-tool,.codex-action{height:var(--spacing-token-button-composer)}.codex-tool,.codex-action{width:var(--spacing-token-button-composer)}.codex-tool{width:var(--spacing-token-button-composer-sm);height:var(--spacing-token-button-composer-sm)}.codex-left-rail{min-width:0}.codex-action-cluster{margin-left:auto}}@media(max-width:520px){.agent-log-line,.log-line{grid-template-columns:1fr;gap:2px}.model-picker{min-width:104px;max-width:168px}.codex-tool-skill,.codex-mic,.rate-dot,.rate-limit-reset{display:none}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}';function vp(n){Xs("agent-session",yp),jo(),document.documentElement.dataset.cmuxWebviewKind="agent-session",document.body.dataset.cmuxWebviewKind="agent-session";const e=Qs(()=>Pr.jsx(yu,{}));Ys.createRoot(n).render(Pr.jsx(Gs,{router:e}))}export{vp as mountAgentSessionSurface}; +`)}function fu({copiedLabel:n,copyLabel:e,text:t}){"use no memo";const[r,o]=b.useState(!1),i=b.useRef(null),s=r?n:e,a=b.useCallback(c=>{c!==null||i.current===null||(window.clearTimeout(i.current),i.current=null)},[]),l=b.useCallback(c=>{c.stopPropagation(),navigator.clipboard?.writeText(t)?.catch(()=>{}),o(!0),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{o(!1),i.current=null},2e3)},[t]);return h("button",{ref:a,type:"button",className:`codex-shell-copy ${ee} ${te} ${ln} rounded-full electron:rounded-md hover:bg-transparent hover:text-token-button-foreground`,"aria-label":s,title:s,onClick:l},r?Ke("icon-xxs"):xn("icon-xxs"))}function mu({label:n,output:e}){"use no memo";const[t,r]=b.useState(!1),o=b.useRef(null),i=b.useCallback(a=>{a!==null||o.current===null||(window.clearTimeout(o.current),o.current=null)},[]),s=b.useCallback(a=>{a.stopPropagation(),navigator.clipboard?.writeText(e)?.catch(()=>{}),r(!0),o.current!==null&&window.clearTimeout(o.current),o.current=window.setTimeout(()=>{r(!1),o.current=null},2e3)},[e]);return h("button",{ref:i,type:"button",className:`codex-tool-output-copy ${ee} ${te} rounded-full electron:rounded-md electron:p-1 electron:[&>svg]:icon-sm flex items-center justify-center p-0.5 absolute top-0 right-2.5 opacity-0 transition-opacity duration-200 group-hover/output:opacity-100${t?" text-token-foreground opacity-100":""}`,"aria-label":n,title:n,onClick:s},t?Ke("icon-2xs"):xn("icon-2xs"))}function gu({copy:n,sentAtMs:e,text:t}){"use no memo";const[r,o]=b.useState(!1),i=b.useRef(null),s=n?.copyUserMessage??"",a=n?.copiedUserMessage??"",l=r?a:s,c=e==null?null:Ms(e),d=b.useCallback(p=>{p!==null||i.current===null||(window.clearTimeout(i.current),i.current=null)},[]),u=b.useCallback(()=>{const p=t.trim();if(!p)return;navigator.clipboard?.writeText(p)?.catch(()=>{}),o(!0),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{o(!1),i.current=null},1500)},[t]);return h("div",{className:"codex-user-message-actions flex flex-row-reverse items-center gap-1"},h("div",{className:"mr-1 ms-1 flex items-center gap-2 opacity-0 group-focus-within:opacity-100 group-hover:opacity-100"},c==null?null:h("span",{className:"text-xs text-token-text-tertiary"},c),h("button",{ref:d,type:"button",className:`codex-user-message-action-button ${ee} ${te} ${ln} rounded-full electron:rounded-md`,"aria-label":l,title:l,onClick:u},r?Ke("icon-xs"):xn("icon-xs"))))}function xu({copy:n,sentAtMs:e,text:t}){"use no memo";const[r,o]=b.useState(!1),i=b.useRef(null),s=n?.copyAssistantMessage??"",a=n?.copiedAssistantMessage??s,l=r?a:s,c=e==null?null:Ms(e),d=b.useCallback(p=>{p!==null||i.current===null||(window.clearTimeout(i.current),i.current=null)},[]),u=b.useCallback(()=>{const p=t.trim();if(!p)return;navigator.clipboard?.writeText(p)?.catch(()=>{}),o(!0),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{o(!1),i.current=null},2e3)},[t]);return h("div",{className:"codex-assistant-message-actions mt-1.5 flex h-5 items-center justify-start gap-0.5 opacity-0 group-focus-within:opacity-100 group-hover:opacity-100"},h("button",{ref:d,type:"button",className:`codex-assistant-message-action-button ${ee} ${te} ${ln} rounded-full electron:rounded-md`,"aria-label":l,title:l,onClick:u},r?Ke("icon-xs"):xn("icon-xs")),c==null?null:h("span",{className:"ml-1.5 flex h-full items-center text-size-chat leading-5 text-token-input-placeholder-foreground"},c))}function Ms(n,e=new Date){const t=new Date(n),r=bu(t,e);return r===0?new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(t):r<0&&r>-7?new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit",weekday:"long"}).format(t):new Intl.DateTimeFormat(void 0,{day:"numeric",hour:"numeric",minute:"2-digit",month:"short"}).format(t)}function bu(n,e){const t=new Date(n.getFullYear(),n.getMonth(),n.getDate()),r=new Date(e.getFullYear(),e.getMonth(),e.getDate());return Math.round((t.getTime()-r.getTime())/864e5)}function yu({copy:n,text:e}){"use no memo";const[t,r]=b.useState(!1),o=ku(e),i=o&&!t,s=n?.showMore??"",a=n?.showLess??"",l=b.useCallback(()=>{r(c=>!c)},[]);return h("div",{className:"flex flex-col items-end gap-1"},h("div",{className:"codex-user-message-content text-size-chat relative w-full min-w-0 mb-px","data-collapsed":i?"true":void 0,dangerouslySetInnerHTML:{__html:xt(e)}}),o?h("button",{type:"button","aria-expanded":t,className:"codex-user-message-toggle text-size-chat mt-1.5 inline-flex cursor-interaction items-center gap-1 self-start text-token-description-foreground hover:text-token-foreground",onClick:l},h("span",null,t?a:s),gn(`icon-2xs${t?" rotate-180":""}`)):null)}function ku(n){return n.split(/\r\n|\r|\n/).length>Xd||n.length>1600}function wu({attachments:n}){return h("div",{className:"codex-user-message-attachments flex max-w-[77%] flex-row-reverse flex-wrap items-center gap-1"},n.map(e=>h(vu,{attachment:e,key:e.id})))}function vu({attachment:n}){return n.kind==="image"&&n.dataUrl?h("div",{className:"user-message-image-attachment flex size-16 items-center justify-center rounded-lg border border-token-border",title:n.label},h("img",{alt:n.label,className:"h-full w-full rounded-md object-cover",referrerPolicy:"no-referrer",src:n.dataUrl})):h("div",{className:"user-message-file-attachment bg-token-dropdown-background border-token-border inline-flex max-w-[320px] items-center gap-1 rounded-full border px-2 py-1.5 text-sm",title:n.path},h("span",{className:"text-token-input-placeholder-foreground flex-shrink-0","aria-hidden":!0},Sr("icon-2xs")),h("span",{className:"flex max-w-full min-w-0 items-center gap-1"},h("span",{className:"truncate"},n.label)))}function Cu({attachments:n,className:e,copy:t,onRemove:r}){return h("div",{className:`codex-attachment-tray w-full overflow-x-auto${e?` ${e}`:""}`,"data-composer-attachments-row":!0},h("div",{className:"codex-attachment-row flex min-w-max items-end gap-2"},n.map(o=>h(Su,{attachment:o,copy:t,key:o.id,onRemove:r}))))}function Su({attachment:n,copy:e,onRemove:t}){const r=`${e?.removeAttachment??"Remove attachment"} ${n.label}`,o=t?h("button",{className:"composer-attachment-remove",type:"button","aria-label":r,onClick:()=>t(n.id),onMouseDown:i=>i.preventDefault()},bn("icon-2xs")):null;return n.kind==="image"&&n.dataUrl?h("div",{className:"composer-attachment-image",title:n.label},h("img",{alt:"","aria-hidden":!0,src:n.dataUrl}),o):h("div",{className:"composer-attachment-file",title:n.path},h("span",{className:"composer-attachment-file-icon","aria-hidden":!0},Sr("icon-xs")),h("span",{className:"composer-attachment-file-label"},n.label),o)}function Mu(n){const e=Et.c(6),{state:t,providerDisplayName:r}=n,i=(t.context?.rateLimitRows??[]).map(wa),s=t.context?.copy,[a,l]=b.useState(!1);if(i.length===0)return null;const c=s?.rateLimits??"Rate limits";let d;e[0]!==t?(d=La(t),e[0]=t,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=m=>{m.currentTarget.contains(m.relatedTarget)||l(!1)},e[2]=u):u=e[2];let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=()=>l(Nu),e[3]=p):p=e[3];let f;return e[4]!==t?(f=(m,g)=>[g>0?h("span",{key:`${m.role}-separator`,className:"rate-limit-inline-separator","aria-hidden":!0},"•"):null,h(Ou,{key:m.role,row:m,state:t})],e[4]=t,e[5]=f):f=e[5],h("div",{className:"rate-line codex-rate-limit-summary relative",role:"status","aria-label":`${r} ${d}`.trim(),onBlur:u},h("button",{className:"rate-limit-trigger rate-limit-trigger-inline flex min-w-0 items-center gap-1",type:"button","aria-expanded":a,onClick:p},h("span",{className:"rate-line-heading"},c),i.flatMap(f)),a?h("div",{className:"rate-limit-popover absolute bottom-[calc(100%+6px)] left-0 z-50 flex min-w-56 flex-col gap-1 rounded-xl border border-token-border bg-token-dropdown-background/95 px-3 py-2 text-sm shadow-xl-spread backdrop-blur-sm"},h("div",{className:"rate-limit-popover-title"},c),i.map(m=>h(Tu,{key:m.role,row:m,state:t}))):null)}function Nu(n){return!n}function Ou({row:n,state:e}){const t=n,r=e.context?.copy,o=t.role==="primary"?r?.rateLimitPrimary??"Primary":r?.rateLimitSecondary??"Secondary",i=Qo(t.windowDurationMins,o,{weekly:r?.rateLimitWeekly??"Weekly",monthly:r?.rateLimitMonthly??"Monthly",daysFormat:r?.rateLimitDaysFormat??"",hoursFormat:r?.rateLimitHoursFormat??"",minutesFormat:r?.rateLimitMinutesFormat??""}),s=Xo(t.resetsAt);return h("span",{className:"rate-limit-inline-segment"},h("span",{className:"rate-limit-window"},i),h("span",{className:"rate-limit-percent"},Go(t.remainingPercent)),s?h("span",{className:"rate-limit-reset"},`${r?.rateLimitResets??"resets"} ${s}`):null)}function Tu({row:n,state:e}){const t=n,r=e.context?.copy,o=t.role==="primary"?r?.rateLimitPrimary??"Primary":r?.rateLimitSecondary??"Secondary",i=Qo(t.windowDurationMins,o,{weekly:r?.rateLimitWeekly??"Weekly",monthly:r?.rateLimitMonthly??"Monthly",daysFormat:r?.rateLimitDaysFormat??"",hoursFormat:r?.rateLimitHoursFormat??"",minutesFormat:r?.rateLimitMinutesFormat??""}),s=Xo(t.resetsAt);return h("div",{className:"rate-limit-popover-row"},h("span",{className:"rate-limit-window"},i),h("span",{className:"rate-limit-row-value"},h("span",{className:"rate-limit-percent"},Go(t.remainingPercent)),s?h("span",{className:"rate-limit-reset"},`${r?.rateLimitResets??"resets"} ${s}`):null))}function Du({emptyLabel:n,highlightedIndex:e,items:t,onChoose:r,onHighlight:o,query:i}){return h("div",{className:"codex-top-tray-shell absolute z-20"},h("div",{className:"codex-top-tray-panel","cmdk-root":"","data-cmdk-root":!0},h("div",{className:"codex-top-tray-list","cmdk-list":"","data-cmdk-list":!0},t.length===0?h("div",{className:"codex-top-tray-empty","cmdk-empty":"","data-cmdk-empty":!0,"data-command-menu-empty-state":"true"},n):t.map((s,a)=>{const l=s.detail?"codex-top-tray-label max-w-[60%] flex-none truncate":"codex-top-tray-label min-w-0 flex-1 truncate",c=ju(s.label,i),d=c.some(u=>!u.isMatch);return h("button",{key:s.id,className:"codex-top-tray-item",type:"button","aria-selected":a===e?"true":void 0,"cmdk-item":"","data-selected":a===e?"true":void 0,"data-list-navigation-item":!0,onMouseEnter:()=>o(a),onMouseDown:u=>u.preventDefault(),onClick:()=>r(s)},h("div",{className:"codex-top-tray-copy flex w-full items-center gap-2"},h("span",{className:"codex-top-tray-icon icon-xs shrink-0","aria-hidden":!0},s.icon),h("div",{className:l},c.map((u,p)=>h("span",{key:`${u.text}-${p}`,className:!u.isMatch&&d?"text-token-description-foreground":void 0},u.text))),s.detail?h("span",{className:"codex-top-tray-detail min-w-0 flex-1 truncate text-sm text-token-description-foreground"},s.detail):null))}))))}function $o({icon:n,label:e,onClear:t}){return h("div",{className:"composer-mode-indicator flex min-w-0 items-center gap-1"},h("div",{className:"composer-mode-divider","aria-hidden":!0}),h("button",{className:`composer-mode-button group ${ee} ${te} ${Oe} rounded-full`,type:"button","aria-label":e,onClick:t},h("span",{className:"composer-mode-icon composer-mode-icon-default icon-xs shrink-0","aria-hidden":!0},n),h("span",{className:"composer-mode-icon composer-mode-icon-hover icon-xs shrink-0","aria-hidden":!0},bn("icon-xs")),h("span",{className:"composer-footer__label--sm composer-mode-label max-w-16 truncate"},e)))}function Eu({hideLabel:n,label:e,onClear:t}){return h("button",{className:`composer-context-button group ${ee} ${te} ${Oe} min-w-0 rounded-full`,type:"button","aria-label":e,title:e,onClick:t},h("span",{className:"composer-context-icon composer-context-icon-default icon-xs shrink-0","aria-hidden":!0},Ts("icon-xs")),h("span",{className:"composer-context-icon composer-context-icon-hover icon-xs shrink-0","aria-hidden":!0},bn("icon-xs")),n?null:h("span",{className:"composer-footer__label--sm composer-context-label max-w-20 truncate"},e))}function Iu({copy:n,hideLabel:e=!1,isEnabled:t,isOpen:r,mode:o,onModeChange:i,onOpenChange:s}){const a=n?.changePermissions??"Change permissions",l=qo(n,o),c=t?["default","auto-review","full-access","custom"]:[],d=e?na:Oe,u=f=>{i(f),s(!1)},p=t&&r;return h("div",{className:"permissions-root relative inline-flex",onBlur:f=>{t&&!f.currentTarget.contains(f.relatedTarget)&&s(!1)}},h("button",{className:`permissions-trigger ${ee} ${te} ${d} ${e?Kt:"min-w-0"} rounded-full`,type:"button","aria-label":a,"aria-haspopup":t?"menu":void 0,"aria-expanded":t?p:void 0,"aria-disabled":t?void 0:!0,"data-permission-mode":o,"data-state":p?"open":"closed",disabled:!t,onClick:()=>{t&&s(!p)},onKeyDown:f=>{t&&(f.key==="ArrowDown"&&(f.preventDefault(),s(!0)),f.key==="Escape"&&(f.preventDefault(),s(!1)))}},Os(o,"icon-xs shrink-0"),e?null:h("span",{className:"permissions-trigger-label composer-footer__label--xs max-w-40 truncate whitespace-nowrap text-left"},l),t?h("span",{className:"permissions-trigger-chevron icon-2xs shrink-0","aria-hidden":!0},gn()):null),p?h("div",{className:"permissions-dropdown _content_1hiti_1 no-drag bg-token-dropdown-background/90 text-token-foreground ring-token-border z-50 m-px flex select-none flex-col overflow-y-auto rounded-xl ring-[0.5px] px-1 py-1 shadow-xl-spread backdrop-blur-sm",role:"menu","aria-label":a,"data-state":"open","data-side":"top",style:{"--radix-dropdown-menu-content-transform-origin":"left bottom"}},c.map(f=>h(Ru,{isSelected:f===o,key:f,label:qo(n,f),mode:f,onSelect:()=>u(f)}))):null)}function Ru({isSelected:n,label:e,mode:t,onSelect:r}){return h("button",{className:"permissions-item no-drag group hover:bg-token-list-hover-background focus:bg-token-list-hover-background cursor-interaction text-token-foreground outline-hidden rounded-lg px-[var(--padding-row-x)] py-[var(--padding-row-y)] text-sm",type:"button",role:"menuitemradio","aria-checked":n,"data-permission-mode":t,"data-selected":n?"true":void 0,onMouseDown:o=>o.preventDefault(),onClick:r},h("span",{className:"permissions-item-icon icon-xs shrink-0","aria-hidden":!0},Os(t,"icon-xs shrink-0")),h("span",{className:"permissions-item-label min-w-0 flex-1 truncate"},e),n?h("span",{className:"permissions-item-check icon-xs shrink-0","aria-hidden":!0},Ke()):null)}function Au({hasIdeContext:n,isAutoContextOn:e,isOpen:t,isPickingFiles:r,isPlanMode:o,onOpenChange:i,onPickFiles:s,onToggleAutoContext:a,onTogglePlanMode:l,state:c}){const d=c.context?.copy,u=d?.addFilesAndMore??"Add files and more",p=d?.addPhotosAndFiles??"Add photos & files",m=Cr("skill",c,"").find(g=>g.id==="plan")??null;return h("div",{className:"add-context-root relative inline-flex",onBlur:g=>{g.currentTarget.contains(g.relatedTarget)||i(!1)}},h("button",{className:`codex-tool codex-tool-plus ${ee} ${te} ${Oe} ${Kt} rounded-full`,type:"button","aria-label":u,"aria-haspopup":"menu","aria-expanded":t,"data-state":t?"open":"closed",onClick:()=>i(!t),onKeyDown:g=>{g.key==="ArrowDown"&&(g.preventDefault(),i(!0)),g.key==="Escape"&&(g.preventDefault(),i(!1))}},ep()),t?h("div",{className:"add-context-dropdown _content_1hiti_1 no-drag bg-token-dropdown-background/90 text-token-foreground ring-token-border z-50 m-px flex select-none flex-col overflow-y-auto rounded-xl ring-[0.5px] px-1 py-1 shadow-xl-spread backdrop-blur-sm",role:"menu","aria-label":u,"data-state":"open","data-side":"top",style:{"--radix-dropdown-menu-content-transform-origin":"left bottom"}},h(Lu,{disabled:r,icon:Sr("icon-xs"),label:p,onSelect:s}),n||m?h(Pu):null,n?h(Wo,{checked:e,icon:Ts("icon-sm"),label:d?.includeIdeContext??"Include IDE context",onSelect:a}):null,m?h(Wo,{checked:o,icon:an(),label:d?.planMode??"Plan mode",onSelect:l}):null):null)}function Lu({detail:n,disabled:e=!1,icon:t,label:r,onSelect:o}){return h("button",{className:"add-context-item group no-drag hover:bg-token-list-hover-background focus:bg-token-list-hover-background cursor-interaction text-token-foreground outline-hidden rounded-lg px-[var(--padding-row-x)] py-[var(--padding-row-y)] text-sm",disabled:e,type:"button",role:"menuitem",onMouseDown:i=>i.preventDefault(),onClick:e?void 0:o},h("span",{className:"add-context-item-icon icon-xs shrink-0","aria-hidden":!0},t),h("span",{className:"add-context-item-copy flex min-w-0 flex-1 items-center gap-2"},h("span",{className:"add-context-item-label min-w-0 truncate"},r),n?h("span",{className:"add-context-item-detail min-w-0 flex-1 truncate text-token-description-foreground"},n):null))}function Wo({checked:n,icon:e,label:t,onSelect:r}){const o=n?"checked":"unchecked",i=n?"relative inline-flex h-4 w-7 shrink-0 items-center rounded-full bg-token-charts-blue transition-colors duration-200 ease-out":"relative inline-flex h-4 w-7 shrink-0 items-center rounded-full bg-token-foreground/10 transition-colors duration-200 ease-out";return h("button",{className:"add-context-item group no-drag hover:bg-token-list-hover-background focus:bg-token-list-hover-background cursor-interaction text-token-foreground outline-hidden rounded-lg px-[var(--padding-row-x)] py-[var(--padding-row-y)] text-sm",type:"button",role:"menuitemcheckbox","aria-checked":n,onMouseDown:s=>s.preventDefault(),onClick:r},h("span",{className:"add-context-item-icon icon-xs shrink-0","aria-hidden":!0},e),h("span",{className:"add-context-switch-row flex w-full min-w-0 items-center justify-between gap-2"},h("span",{className:"flex min-w-0 items-center gap-2"},h("span",{className:"add-context-item-label min-w-0 truncate"},t)),h("span",{className:i,"data-state":o,"aria-hidden":!0},h("span",{className:"h-3 w-3 rounded-full border border-[color:var(--gray-0)] bg-[color:var(--gray-0)] shadow-sm transition-transform duration-200 ease-out data-[state=unchecked]:translate-x-[2px] data-[state=checked]:translate-x-[14px]","data-state":o}))))}function Pu(){return h("div",{className:"add-context-separator w-full px-[var(--padding-row-x)] py-1",role:"separator"},h("div",{className:"add-context-separator-line h-[1px] w-full bg-token-menu-border"}))}function zu(n){return Cr("mention",n,"").find(e=>e.id==="workspace")??null}function Cr(n,e,t){const r=e.context?.copy,o=n==="mention"?[...e.context?.workingDirectory?[{id:"workspace",icon:tp("icon-xs"),label:r?.mentionCurrentWorkspace??"Current workspace",detail:jt(e.context.workingDirectory),mention:{kind:"at",label:jt(e.context.workingDirectory),name:jt(e.context.workingDirectory),path:e.context.workingDirectory,fsPath:e.context.workingDirectory}}]:[],...e.providers.map(i=>({id:i.id,icon:ka(i),label:i.displayName,detail:i.executableName,mention:{kind:"agent",label:i.displayName,name:i.id,displayName:i.displayName,path:`provider://${i.id}`,description:i.executableName}}))]:[{id:"plan",icon:"$",label:r?.skillPlan??"Plan",detail:"$plan",mention:{kind:"skill",label:"Plan",name:"plan",displayName:"Plan",path:"skill://plan"}},{id:"review",icon:"$",label:r?.skillCodeReview??"Code review",detail:"$codex-review",mention:{kind:"skill",label:"Code review",name:"codex-review",displayName:"Code review",path:"skill://codex-review"}},{id:"research",icon:"$",label:r?.skillResearch??"Research",detail:"$research",mention:{kind:"skill",label:"Research",name:"research",displayName:"Research",path:"skill://research"}}];return Fu(o,t)}function Fu(n,e){const t=e.trim();return t?n.map(r=>({item:r,score:Uu(r.label,t,[r.detail,r.mention.name])})).filter(({score:r})=>r>0).sort((r,o)=>o.score-r.score).map(({item:r})=>r):n}const Ho=1,Bu=.9,Vu=.8,_u=.17,_n=.1,$n=.999,$u=.9999,Wu=.99,Hu=/[\\/_+.#"@[({&]/,Ju=/[\\/_+.#"@[({&]/g,qu=/[\s-]/,Ns=/[\s-]/g;function Uu(n,e,t){const r=t.length>0?`${n} ${t.join(" ")}`:n;return ir(r,e,Jo(r),Jo(e),0,0,{})}function Jo(n){return n.toLowerCase().replace(Ns," ")}function ir(n,e,t,r,o,i,s){if(i===e.length)return o===n.length?Ho:Wu;const a=`${o},${i}`;if(s[a]!==void 0)return s[a];const l=r.charAt(i);let c=t.indexOf(l,o),d=0;for(;c>=0;){let u=ir(n,e,t,r,c+1,i+1,s);if(u>d){if(c===o)u*=Ho;else if(Hu.test(n.charAt(c-1))){u*=Vu;const p=n.slice(o,c-1).match(Ju);p&&o>0&&(u*=$n**p.length)}else if(qu.test(n.charAt(c-1))){u*=Bu;const p=n.slice(o,c-1).match(Ns);p&&o>0&&(u*=$n**p.length)}else u*=_u,o>0&&(u*=$n**(c-o));n.charAt(c)!==e.charAt(i)&&(u*=$u)}if(u<_n&&t.charAt(c-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&t.charAt(c-1)!==r.charAt(i)){const p=ir(n,e,t,r,c+1,i+2,s);p*_n>u&&(u=p*_n)}u>d&&(d=u),c=t.indexOf(l,c+1)}return s[a]=d,d}function ju(n,e){const t=Array.from(n),r=e.trim();if(!r)return t.map(l=>({isMatch:!0,text:l}));const o=t.map(l=>l.toLowerCase()),i=Array.from(r.toLowerCase());let s=-1;for(let l=0;l<=o.length-i.length;l+=1)if(i.every((c,d)=>o[l+d]===c)){s=l;break}if(s>=0){const l=s+i.length;return t.map((c,d)=>({isMatch:d>=s&&d{const c=a{const r=`${t.kind}:${t.path}`;return e.has(r)?!1:(e.add(r),!0)})}function Zu(n="icon-sm"){return h("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},h("path",{d:"M9.33467 16.6663V4.93978L4.6374 9.63704L4.1667 9.16634L3.69599 8.69661L9.52998 2.86263L9.63447 2.77767C9.8925 2.60753 10.2433 2.63564 10.4704 2.86263L16.3034 8.69661L16.3884 8.80111C16.5588 9.05922 16.5306 9.40982 16.3034 9.63704C16.0762 9.86414 15.7255 9.89242 15.4675 9.722L15.363 9.63704L10.6647 4.9388V16.6663C10.6647 17.0336 10.367 17.3314 9.99971 17.3314C9.63259 17.3312 9.33467 17.0335 9.33467 16.6663ZM4.6374 9.63704C4.3777 9.89674 3.95569 9.89674 3.69599 9.63704C3.43657 9.37744 3.43668 8.95628 3.69599 8.69661L4.6374 9.63704Z",fill:"currentColor"}))}function Yu(){return h("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0},h("rect",{x:"4.75",y:"4.75",width:"6.5",height:"6.5",rx:"1",fill:"currentColor"}))}function Gu(){return h("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0},h("path",{d:"M8 2.25a2 2 0 0 0-2 2v3.25a2 2 0 1 0 4 0V4.25a2 2 0 0 0-2-2ZM4 7.5a4 4 0 0 0 8 0M8 11.5v2.25",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}))}function Xu(n="icon-sm"){return h("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},h("path",{d:"M10 5.14295V14.8441M10 5.14295C10 1.98209 14.8475 1.94468 14.8475 5.07797L14.8473 5.1067C17.1367 5.43539 18.0436 7.54498 16.4225 9.14006C17.8633 10.5577 17.3503 13.9054 15.4449 14.6301C14.8475 17.6527 10.8056 18.4821 10 14.8441M10 5.14295C10 1.98209 5.15249 1.94468 5.15249 5.07797L5.15265 5.1067C2.86325 5.43539 1.95642 7.54498 3.57746 9.14006C2.13674 10.5577 2.64974 13.9054 4.5551 14.6301C5.15249 17.6527 9.19444 18.4821 10 14.8441",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"1.33"}))}function gn(n="icon-2xs"){return h("svg",{className:n,width:"20",height:"21",viewBox:"0 0 20 21",fill:"none","aria-hidden":!0},h("path",{d:"M15.2793 7.71101C15.539 7.45131 15.961 7.45131 16.2207 7.71101C16.4804 7.97071 16.4804 8.39272 16.2207 8.65242L10.4707 14.4024C10.211 14.6621 9.78902 14.6621 9.52932 14.4024L3.77932 8.65242L3.69436 8.54792C3.52385 8.28979 3.55205 7.93828 3.77932 7.71101C4.00659 7.48374 4.3581 7.45554 4.61623 7.62605L4.72073 7.71101L10 12.9903L15.2793 7.71101Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"0.6"}))}function Qu(n="icon-2xs"){return h("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},h("path",{d:"M7.52925 3.7793C7.75652 3.55203 8.10803 3.52383 8.36616 3.69434L8.47065 3.7793L14.2207 9.5293C14.4804 9.789 14.4804 10.211 14.2207 10.4707L8.47065 16.2207C8.21095 16.4804 7.78895 16.4804 7.52925 16.2207C7.26955 15.961 7.26955 15.539 7.52925 15.2793L12.8085 10L7.52925 4.7207L7.44429 4.61621C7.27378 4.35808 7.30198 4.00657 7.52925 3.7793Z",fill:"currentColor"}))}function xn(n="icon-sm"){return h("svg",{className:n,width:"21",height:"21",viewBox:"0 0 21 21",fill:"none","aria-hidden":!0},h("path",{d:"M13.468 11.1216C13.468 10.4107 13.468 9.91717 13.4367 9.53369C13.4137 9.25191 13.3758 9.0622 13.3244 8.91846L13.2687 8.78858C13.1148 8.48652 12.8803 8.23344 12.593 8.05713L12.466 7.98584C12.308 7.90546 12.0963 7.84854 11.7209 7.81787C11.3374 7.78656 10.8439 7.78662 10.133 7.78662H7.29999C6.58895 7.78662 6.09562 7.78654 5.7121 7.81787C5.43015 7.84091 5.24064 7.87872 5.09686 7.93018L4.96698 7.98584C4.66487 8.13977 4.41184 8.37419 4.23554 8.66162L4.16522 8.78858C4.08477 8.94657 4.02794 9.15811 3.99725 9.53369C3.96594 9.91718 3.96503 10.4107 3.96503 11.1216V13.9546C3.96503 14.6656 3.96592 15.159 3.99725 15.5425C4.02796 15.9182 4.08471 16.1296 4.16522 16.2876L4.23554 16.4136C4.41185 16.7012 4.66472 16.9353 4.96698 17.0894L5.09686 17.146C5.24061 17.1974 5.43024 17.2343 5.7121 17.2573C6.09562 17.2887 6.58895 17.2896 7.29999 17.2896H10.133C10.8439 17.2896 11.3374 17.2886 11.7209 17.2573C12.0965 17.2266 12.308 17.1698 12.466 17.0894L12.593 17.019C12.8804 16.8427 13.1148 16.5897 13.2687 16.2876L13.3244 16.1577C13.3759 16.0139 13.4137 15.8244 13.4367 15.5425C13.468 15.159 13.468 14.6656 13.468 13.9546V11.1216ZM14.798 13.1196C15.2528 13.118 15.6011 13.1147 15.8879 13.0913C16.2634 13.0606 16.475 13.0038 16.633 12.9233L16.759 12.8521C17.0466 12.6757 17.2808 12.4228 17.4348 12.1206L17.4914 11.9907C17.5428 11.847 17.5797 11.6572 17.6027 11.3755C17.634 10.992 17.6349 10.4985 17.6349 9.7876V6.95459C17.6349 6.24355 17.6341 5.75022 17.6027 5.3667C17.5797 5.08484 17.5428 4.89522 17.4914 4.75147L17.4348 4.62158C17.2807 4.31933 17.0466 4.06645 16.759 3.89014L16.633 3.81982C16.475 3.73932 16.2636 3.68256 15.8879 3.65186C15.5044 3.62052 15.011 3.61963 14.3 3.61963H11.467C10.7561 3.61963 10.2626 3.62054 9.87909 3.65186C9.59738 3.67487 9.40759 3.71179 9.26386 3.76318L9.13397 3.81982C8.83175 3.97382 8.57885 4.20802 8.40253 4.49561L8.33124 4.62158C8.25079 4.77957 8.19396 4.99114 8.16327 5.3667C8.13984 5.65352 8.13561 6.00178 8.13397 6.45654H10.133C10.822 6.45654 11.3791 6.4559 11.8293 6.49268C12.2873 6.5301 12.6937 6.6093 13.0705 6.80127L13.2883 6.92334C13.7839 7.22739 14.1878 7.66313 14.4533 8.18408L14.5197 8.32666C14.6642 8.66318 14.7291 9.02433 14.7619 9.42529C14.7987 9.8755 14.798 10.4326 14.798 11.1216V13.1196ZM18.965 9.7876C18.965 10.4766 18.9657 11.0337 18.9289 11.4839C18.8961 11.8848 18.8311 12.246 18.6867 12.5825L18.6203 12.7251C18.3548 13.246 17.9509 13.6818 17.4553 13.9858L17.2365 14.1079C16.8599 14.2998 16.4541 14.3791 15.9963 14.4165C15.6592 14.444 15.2624 14.4481 14.7951 14.4497C14.7935 14.917 14.7894 15.3138 14.7619 15.6509C14.7292 16.0516 14.664 16.4122 14.5197 16.7485L14.4533 16.8911C14.1878 17.4122 13.7841 17.8487 13.2883 18.1528L13.0705 18.2749C12.6937 18.4669 12.2873 18.5461 11.8293 18.5835C11.3791 18.6203 10.822 18.6196 10.133 18.6196H7.29999C6.6109 18.6196 6.05394 18.6203 5.6037 18.5835C5.20305 18.5508 4.84233 18.4855 4.50604 18.3413L4.36347 18.2749C3.84243 18.0094 3.40584 17.6056 3.10175 17.1099L2.97968 16.8911C2.78787 16.5145 2.70849 16.1087 2.67108 15.6509C2.6343 15.2006 2.63495 14.6437 2.63495 13.9546V11.1216C2.63495 10.4326 2.63431 9.8755 2.67108 9.42529C2.7085 8.96729 2.78771 8.56084 2.97968 8.18408L3.10175 7.96631C3.40585 7.47049 3.84235 7.06679 4.36347 6.80127L4.50604 6.73486C4.84236 6.59059 5.20302 6.52542 5.6037 6.49268C5.9405 6.46516 6.33707 6.4601 6.80389 6.4585C6.8055 5.99167 6.81056 5.5951 6.83807 5.2583C6.87549 4.80047 6.95482 4.39471 7.14667 4.01807L7.26874 3.79932C7.5728 3.30371 8.00855 2.89973 8.52948 2.63428L8.67206 2.56787C9.00854 2.42345 9.36978 2.35844 9.77069 2.32568C10.2209 2.28891 10.778 2.28955 11.467 2.28955H14.3C14.9891 2.28955 15.546 2.2889 15.9963 2.32568C16.4541 2.3631 16.8599 2.44247 17.2365 2.63428L17.4553 2.75635C17.951 3.06044 18.3548 3.49703 18.6203 4.01807L18.6867 4.16065C18.8309 4.49694 18.8962 4.85765 18.9289 5.2583C18.9657 5.70854 18.965 6.2655 18.965 6.95459V9.7876Z",fill:"currentColor"}))}function Ke(n){return h("svg",{className:n,width:"17",height:"17",viewBox:"0 0 17 17",fill:"none","aria-hidden":!0},h("path",{d:"M12.8961 3.64101C13.1297 3.41418 13.4984 3.37523 13.7779 3.56581C14.0571 3.75635 14.1554 4.11331 14.0299 4.41347L13.9615 4.53847L7.71151 13.7045C7.59411 13.8767 7.4063 13.9877 7.19881 14.0072C6.99136 14.0267 6.78564 13.9533 6.63826 13.806L2.88826 10.056L2.79842 9.9457C2.6192 9.67407 2.64927 9.30496 2.88826 9.06581C3.12738 8.82669 3.49647 8.79676 3.76815 8.97597L3.8785 9.06581L7.03084 12.2182L12.8053 3.74941L12.8961 3.64101Z",fill:"currentColor"}))}function bn(n="icon-sm"){return h("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},h("path",{d:"M5.96967 5.96967C6.26256 5.67678 6.73744 5.67678 7.03033 5.96967L10 8.93934L12.9697 5.96967C13.2626 5.67678 13.7374 5.67678 14.0303 5.96967C14.3232 6.26256 14.3232 6.73744 14.0303 7.03033L11.0607 10L14.0303 12.9697C14.3232 13.2626 14.3232 13.7374 14.0303 14.0303C13.7374 14.3232 13.2626 14.3232 12.9697 14.0303L10 11.0607L7.03033 14.0303C6.73744 14.3232 6.26256 14.3232 5.96967 14.0303C5.67678 13.7374 5.67678 13.2626 5.96967 12.9697L8.93934 10L5.96967 7.03033C5.67678 6.73744 5.67678 6.26256 5.96967 5.96967Z",fill:"currentColor"}))}function ep(){return h("svg",{className:"icon-sm",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},h("path",{d:"M9.33496 16.5V10.665H3.5C3.13273 10.665 2.83496 10.3673 2.83496 10C2.83496 9.63273 3.13273 9.33496 3.5 9.33496H9.33496V3.5C9.33496 3.13273 9.63273 2.83496 10 2.83496C10.3673 2.83496 10.665 3.13273 10.665 3.5V9.33496H16.5L16.6338 9.34863C16.9369 9.41057 17.165 9.67857 17.165 10C17.165 10.3214 16.9369 10.5894 16.6338 10.6514L16.5 10.665H10.665V16.5C10.665 16.8673 10.3673 17.165 10 17.165C9.63273 17.165 9.33496 16.8673 9.33496 16.5Z",fill:"currentColor"}))}function Sr(n="icon-sm"){return h("svg",{className:n,width:"21",height:"21",viewBox:"0 0 21 21",fill:"none","aria-hidden":!0},h("path",{d:"M4.43945 12.8041V7.68261C4.43945 7.30642 4.74446 7.00141 5.12066 7.00141C5.49685 7.00141 5.80186 7.30642 5.80186 7.68261V12.8041C5.80186 15.2565 7.78984 17.2445 10.2422 17.2445C12.6945 17.2445 14.6825 15.2565 14.6825 12.8041V5.9751C14.6823 4.46587 13.4589 3.24247 11.9497 3.24229C10.4403 3.24229 9.21606 4.46576 9.21588 5.9751V12.8041C9.21588 13.3708 9.67553 13.8304 10.2422 13.8304C10.8088 13.8304 11.2685 13.3708 11.2685 12.8041V7.68261C11.2685 7.30642 11.5735 7.00141 11.9497 7.00141C12.3257 7.00159 12.6309 7.30653 12.6309 7.68261V12.8041C12.6309 14.1232 11.5612 15.1929 10.2422 15.1929C8.92314 15.1929 7.85347 14.1232 7.85347 12.8041V5.9751C7.85365 3.71337 9.68791 1.87988 11.9497 1.87988C14.2113 1.88006 16.0447 3.71348 16.0449 5.9751V12.8041C16.0449 16.0089 13.4469 18.6069 10.2422 18.6069C7.03745 18.6069 4.43945 16.0089 4.43945 12.8041Z",fill:"currentColor"}))}function tp(n="icon-sm"){return h("svg",{className:n,width:20,height:20,viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},h("path",{d:jo,fill:"currentColor"}))}function an(n="icon-sm"){return h("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},h("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.69336 11.0557C7.05891 11.1944 8.12484 12.3479 8.125 13.75L8.11035 14.0273C7.97144 15.3928 6.81814 16.459 5.41602 16.459L5.13965 16.4443C3.86514 16.3149 2.85128 15.3018 2.72168 14.0273L2.70801 13.75C2.70818 12.2546 3.92061 11.0423 5.41602 11.042L5.69336 11.0557ZM5.41602 12.3721C4.65515 12.3724 4.03826 12.9891 4.03809 13.75C4.03826 14.5109 4.65515 15.1286 5.41602 15.1289C6.17714 15.1289 6.79475 14.5111 6.79492 13.75C6.79475 12.9889 6.17714 12.3721 5.41602 12.3721Z",fill:"currentColor"}),h("path",{d:"M16.8008 13.0986C17.1036 13.1608 17.3311 13.4288 17.3311 13.75C17.3311 14.0712 17.1036 14.3392 16.8008 14.4014L16.666 14.415H10.833C10.4659 14.4149 10.168 14.1172 10.168 13.75C10.168 13.3828 10.4659 13.0851 10.833 13.085H16.666L16.8008 13.0986Z",fill:"currentColor"}),h("path",{d:"M16.8008 5.59863C17.1036 5.66081 17.3311 5.92879 17.3311 6.25C17.3311 6.57121 17.1036 6.83919 16.8008 6.90137L16.666 6.91504H10.833C10.4659 6.91491 10.168 6.61719 10.168 6.25C10.168 5.88281 10.4659 5.58509 10.833 5.58496H16.666L16.8008 5.59863Z",fill:"currentColor"}),h("path",{d:"M7.13311 3.76578C7.35346 3.47216 7.771 3.4128 8.06475 3.63297C8.35843 3.85336 8.41789 4.27084 8.19757 4.56461L5.19757 8.56461C5.0819 8.71866 4.90439 8.81462 4.71221 8.82828C4.5201 8.84178 4.33083 8.77209 4.19464 8.6359L2.69464 7.1359C2.43512 6.87623 2.43512 6.45415 2.69464 6.19449C2.95429 5.93484 3.37633 5.93493 3.63604 6.19449L4.59307 7.15152L7.13311 3.76578Z",fill:"currentColor"}))}function np(n="icon-sm"){return h("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},h("path",{d:"M12.6683 4.16699C12.6683 3.84391 12.4065 3.58203 12.0834 3.58203C11.7603 3.58203 11.4984 3.84391 11.4984 4.16699V7.91699L11.4847 8.05078C11.4227 8.35375 11.1547 8.58203 10.8334 8.58203C10.4662 8.58203 10.1685 8.28411 10.1683 7.91699V3.75C10.1683 3.42691 9.90646 3.16504 9.58337 3.16504C9.26029 3.16504 8.99841 3.42691 8.99841 3.75V7.91699C8.99824 8.28411 8.70053 8.58203 8.33337 8.58203C7.96621 8.58203 7.66851 8.28411 7.66833 7.91699V5C7.66833 4.67691 7.40646 4.41504 7.08337 4.41504C6.76029 4.41504 6.49841 4.67691 6.49841 5V9.30371C6.53326 9.3429 6.56715 9.38359 6.59998 9.42578L8.02478 11.2588C8.25005 11.5486 8.19821 11.9659 7.90857 12.1914C7.6187 12.4169 7.20048 12.365 6.97498 12.0752L5.55017 10.2432C5.15812 9.7391 4.41813 9.73637 4.01501 10.1924C4.04396 10.426 4.11486 10.8323 4.25525 11.3486C4.44664 12.0525 4.75404 12.9113 5.21619 13.7383C6.14103 15.3931 7.62465 16.835 10.0004 16.835C12.8545 16.8348 15.1682 14.5211 15.1683 11.667V6.25C15.1683 5.92691 14.9065 5.66504 14.5834 5.66504C14.2603 5.66504 13.9984 5.92691 13.9984 6.25V9.16699C13.9982 9.53411 13.7005 9.83203 13.3334 9.83203C12.9662 9.83203 12.6685 9.53411 12.6683 9.16699V4.16699ZM13.9984 4.42578C14.1828 4.36671 14.3794 4.33496 14.5834 4.33496C15.641 4.33496 16.4984 5.19237 16.4984 6.25V11.667C16.4982 15.2557 13.589 18.1649 10.0004 18.165C6.95953 18.165 5.10939 16.2734 4.05505 14.3867C3.52774 13.4431 3.1843 12.4787 2.97205 11.6982C2.76447 10.9349 2.66834 10.2954 2.66833 10C2.66833 9.87959 2.70117 9.76148 2.76306 9.6582C3.28988 8.78018 4.26555 8.40372 5.16833 8.56152V5C5.16833 3.94237 6.02575 3.08496 7.08337 3.08496C7.31706 3.08496 7.54039 3.12845 7.74744 3.20508C7.98218 2.41297 8.7151 1.83496 9.58337 1.83496C10.1836 1.83496 10.7186 2.11176 11.0697 2.54395C11.3639 2.35978 11.7107 2.25195 12.0834 2.25195C13.141 2.25195 13.9984 3.10937 13.9984 4.16699V4.42578Z",fill:"currentColor"}))}function rp(n="icon-sm"){return h("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},h("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.06543 1.95123C9.66107 1.69076 10.3389 1.69071 10.9346 1.95123L15.9346 4.13873C16.7832 4.51008 17.3311 5.34917 17.3311 6.27545V10.5528C17.3309 14.6017 14.0489 17.8847 10 17.8848C5.95108 17.8846 2.66813 14.6017 2.66797 10.5528V6.27545C2.66797 5.34924 3.21695 4.51012 4.06543 4.13873L9.06543 1.95123ZM10.4014 3.16998C10.1456 3.05814 9.85444 3.05819 9.59863 3.16998L4.59863 5.35748C4.23427 5.51708 3.99805 5.87764 3.99805 6.27545V10.5528C3.99821 13.8671 6.68563 16.5546 10 16.5547C13.3144 16.5546 16.0008 13.8671 16.001 10.5528V6.27545C16.001 5.87756 15.7658 5.51703 15.4014 5.35748L10.4014 3.16998Z",fill:"currentColor"}),h("path",{d:"M13.4678 11.4318L13.333 11.4182H10.833C10.466 11.4183 10.1682 11.7162 10.168 12.0832C10.168 12.4504 10.4659 12.7481 10.833 12.7482H13.333L13.4678 12.7346C13.7706 12.6724 13.9981 12.4044 13.9981 12.0832C13.9979 11.7621 13.7706 11.494 13.4678 11.4318Z",fill:"currentColor"}),h("path",{d:"M7.65336 12.426C7.46431 12.7406 7.05607 12.8424 6.74125 12.6535C6.42646 12.4646 6.32395 12.0563 6.51274 11.7414L7.55668 10.0002L6.51274 8.25899C6.32395 7.94412 6.42646 7.53583 6.74125 7.34688C7.05607 7.15799 7.46431 7.25975 7.65336 7.57442L8.90336 9.6584C9.0296 9.86893 9.0296 10.1315 8.90336 10.342L7.65336 12.426Z",fill:"currentColor"}))}function op(n="icon-sm"){return h("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},h("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.06543 1.95123C9.66107 1.69076 10.3389 1.69071 10.9346 1.95123L15.9346 4.13873C16.7832 4.51008 17.3311 5.34917 17.3311 6.27545V10.5528C17.3309 14.6017 14.0489 17.8847 10 17.8848C5.95108 17.8846 2.66813 14.6017 2.66797 10.5528V6.27545C2.66797 5.34924 3.21695 4.51012 4.06543 4.13873L9.06543 1.95123ZM10.4014 3.16998C10.1456 3.05814 9.85444 3.05819 9.59863 3.16998L4.59863 5.35748C4.23427 5.51708 3.99805 5.87764 3.99805 6.27545V10.5528C3.99821 13.8671 6.68563 16.5546 10 16.5547C13.3144 16.5546 16.0008 13.8671 16.001 10.5528V6.27545C16.001 5.87756 15.7658 5.51703 15.4014 5.35748L10.4014 3.16998Z",fill:"currentColor"}),h("path",{d:"M10.8883 13.1116C10.8883 13.6025 10.4903 14.0005 9.99936 14.0005C9.50844 14.0005 9.11047 13.6025 9.11047 13.1116C9.11047 12.6207 9.50844 12.2227 9.99936 12.2227C10.4903 12.2227 10.8883 12.6207 10.8883 13.1116Z",fill:"currentColor"}),h("path",{d:"M10.5169 10.8949L11.1135 7.31519C11.2283 6.62672 10.6974 6 9.99941 6C9.30145 6 8.77053 6.62672 8.88528 7.31519L9.4819 10.8949C9.52406 11.1479 9.74294 11.3333 9.99941 11.3333C10.2559 11.3333 10.4748 11.1479 10.5169 10.8949Z",fill:"currentColor"}))}function ip(n="icon-sm"){return h("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},h("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.99944 7.24939C11.5169 7.2495 12.7473 8.47995 12.7475 9.99744C12.7475 11.5151 11.517 12.7454 9.99944 12.7455C8.48176 12.7455 7.2514 11.5151 7.2514 9.99744C7.25155 8.47988 8.48186 7.24939 9.99944 7.24939ZM9.99944 8.57947C9.2164 8.57947 8.58163 9.21442 8.58148 9.99744C8.58148 10.7806 9.2163 11.4154 9.99944 11.4154C10.7825 11.4153 11.4174 10.7805 11.4174 9.99744C11.4173 9.21449 10.7824 8.57958 9.99944 8.57947Z",fill:"currentColor"}),h("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.6391 1.67517C11.2939 1.67532 11.8991 2.02577 12.226 2.59314L13.2485 4.36755H15.2963C15.9505 4.36758 16.555 4.71709 16.8823 5.28357L17.5219 6.39001C17.8489 6.95668 17.8481 7.65542 17.5209 8.22205L16.4975 9.99451L17.5239 11.7689C17.8519 12.3357 17.8521 13.0347 17.5248 13.6019L16.8862 14.7084C16.559 15.2747 15.9543 15.6243 15.3002 15.6244H13.2514L12.2299 17.3988C11.9029 17.9663 11.297 18.3168 10.642 18.3168L9.3637 18.3158C8.71064 18.3155 8.10718 17.9678 7.77972 17.4027L6.74847 15.6234L4.69964 15.6244C4.04558 15.6242 3.44087 15.2747 3.1137 14.7084L2.47503 13.6019C2.14791 13.0349 2.14836 12.3366 2.47601 11.7699L3.50237 9.99548L2.47894 8.22205C2.15175 7.65533 2.15174 6.95673 2.47894 6.39001L3.11761 5.28259C3.44458 4.71663 4.04894 4.36813 4.70257 4.36755L6.75042 4.36658L7.77581 2.59119C8.10301 2.02476 8.7076 1.67527 9.36175 1.67517H10.6391ZM9.36273 3.00623C9.1835 3.00623 9.01679 3.10199 8.92718 3.2572L7.82659 5.16345C7.63652 5.49253 7.28473 5.69529 6.90472 5.69568L4.70355 5.69763C4.52451 5.69782 4.3585 5.79355 4.26898 5.94861L3.6303 7.05505C3.54091 7.2102 3.54077 7.40192 3.6303 7.55701L4.73089 9.46326C4.92108 9.7929 4.92135 10.1992 4.73089 10.5287L3.62737 12.4359C3.5378 12.591 3.53792 12.7817 3.62737 12.9369L4.26605 14.0433C4.35567 14.1982 4.52067 14.2932 4.69964 14.2933L6.90276 14.2943C7.28242 14.2946 7.63335 14.497 7.82366 14.8256L8.93011 16.7357C9.01984 16.8905 9.18578 16.9857 9.36468 16.9857H10.642C10.8213 16.9857 10.987 16.89 11.0766 16.7347L12.1752 14.8275C12.3653 14.4975 12.7182 14.2943 13.0991 14.2943H15.3002C15.4794 14.2942 15.6452 14.1985 15.7348 14.0433L16.3725 12.9379C16.4621 12.7826 16.4621 12.5911 16.3725 12.4359L15.27 10.5287C15.1032 10.2404 15.0808 9.89331 15.2055 9.59021L15.269 9.46326L16.3696 7.55701C16.4591 7.40189 16.459 7.21022 16.3696 7.05505L15.7309 5.94861C15.6412 5.79363 15.4754 5.69863 15.2963 5.69861L13.0951 5.69763L12.9535 5.68884C12.6751 5.65158 12.4217 5.50519 12.2504 5.28259L12.1723 5.16443L11.0737 3.2572C10.9841 3.10175 10.8175 3.00525 10.6381 3.00525L9.36273 3.00623Z",fill:"currentColor"}))}function Ts(n="icon-sm"){return h("svg",{className:n,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0},h("path",{d:"M10.6878 9.46029L10.8421 9.49545L17.2913 11.43L17.4642 11.4974C18.2215 11.8649 18.2705 12.9544 17.5492 13.388L17.3822 13.4701L14.5872 14.5872L13.4701 17.3822C13.1135 18.2734 11.8913 18.2756 11.4974 17.4642L11.43 17.2913L9.49544 10.8421C9.26342 10.0687 9.92452 9.34418 10.6878 9.46029ZM12.4984 16.2288L13.3929 13.9954L13.4388 13.8949C13.5579 13.6675 13.7549 13.4891 13.9954 13.3929L16.2288 12.4984L10.9007 10.9007L12.4984 16.2288ZM5.90365 12.9749C6.16329 12.7153 6.58436 12.7154 6.84408 12.9749C7.10378 13.2346 7.10378 13.6557 6.84408 13.9154L5.0765 15.6829C4.8168 15.9426 4.39577 15.9426 4.13607 15.6829C3.87654 15.4232 3.87643 15.0022 4.13607 14.7425L5.90365 12.9749ZM2.83724 7.3265L5.25228 7.97299L5.37826 8.02084C5.65484 8.1591 5.80597 8.47712 5.72298 8.78744C5.63984 9.09774 5.34997 9.298 5.04134 9.27963L4.90853 9.25814L2.49349 8.61068L2.36752 8.56283C2.09082 8.42452 1.93961 8.10666 2.02279 7.79623C2.10599 7.4859 2.39574 7.28652 2.70443 7.30502L2.83724 7.3265ZM14.847 4.05111C15.1051 3.88059 15.4556 3.90894 15.6829 4.13607C15.9426 4.39577 15.9426 4.8168 15.6829 5.0765L13.9154 6.84408C13.6557 7.10378 13.2346 7.10378 12.9749 6.84408C12.7154 6.58437 12.7153 6.16329 12.9749 5.90365L14.7425 4.13607L14.847 4.05111ZM7.79623 2.02279C8.15098 1.92773 8.51562 2.13874 8.61068 2.49349L9.25814 4.90853L9.27962 5.04135C9.298 5.34998 9.09774 5.63984 8.78744 5.72299C8.47713 5.80592 8.15908 5.65484 8.02084 5.37826L7.97298 5.25228L7.3265 2.83724L7.30502 2.70443C7.28652 2.39577 7.48595 2.10603 7.79623 2.02279Z",fill:"currentColor"}))}const sp='@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-outline-style:solid;--top-fade:0;--bottom-fade:0;--edge-fade-distance:1rem}}}@layer theme{:root,:host{--font-sans:var(--vscode-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);--font-mono:var(--vscode-editor-font-family,ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace);--color-black:#000;--spacing:.25rem;--text-xs:11px;--text-xs--line-height:calc(1 / .75);--text-sm:12px;--text-sm--line-height:calc(1.25 / .875);--text-base:14px;--text-base--line-height: 1.5 ;--font-weight-medium:500;--radius-md:calc(var(--radius-md-base) * var(--corner-radius-scale));--radius-lg:calc(var(--radius-lg-base) * var(--corner-radius-scale));--radius-xl:calc(var(--radius-xl-base) * var(--corner-radius-scale));--radius-2xl:calc(var(--radius-2xl-base) * var(--corner-radius-scale));--radius-3xl:calc(var(--radius-3xl-base) * var(--corner-radius-scale));--shadow-xl:0px 8px 16px -4px #0000001f;--ease-out:cubic-bezier(0, 0, .2, 1);--blur-sm:8px;--blur-lg:16px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-token-foreground:var(--agent-text);--color-token-description-foreground:var(--agent-muted);--color-token-input-background:var(--agent-input-bg);--color-token-dropdown-background:var(--agent-surface-elevated);--color-token-border:var(--agent-border);--color-token-border-heavy:var(--agent-border-strong);--color-token-button-foreground:var(--agent-text);--color-token-button-background:var(--agent-accent);--color-token-button-secondary-foreground:var(--agent-text);--color-token-button-secondary-background:var(--agent-control);--color-token-button-secondary-hover-background:var(--agent-control-hover);--color-token-input-placeholder-foreground:var(--agent-muted);--color-token-charts-blue:var(--agent-accent);--color-token-text-tertiary:var(--agent-muted);--color-token-menu-border:var(--agent-border);--color-token-list-hover-background:var(--agent-control-hover);--color-token-side-bar-background:var(--agent-surface-elevated);--color-token-text-link-foreground:var(--agent-accent);--color-token-editor-background:var(--agent-page-bg);--corner-radius-scale:1;--radius-md-base:.5rem;--radius-lg-base:.625rem;--radius-xl-base:.75rem;--radius-2xl-base:1rem;--radius-3xl-base:1.25rem;--spacing-token-button-composer:calc(var(--spacing) * 7);--spacing-token-button-composer-sm:calc(var(--spacing) * 5);--spacing-token-button-composer-gap:var(--spacing);--h-token-button-composer-gap:var(--spacing-token-button-composer-gap)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.top-0{top:calc(var(--spacing) * 0)}.top-1\\/2{top:50%}.right-2\\.5{right:calc(var(--spacing) * 2.5)}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-\\[calc\\(100\\%\\+6px\\)\\]{bottom:calc(100% + 6px)}.bottom-full{bottom:100%}.left-0{left:calc(var(--spacing) * 0)}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.m-px{margin:1px}.ms-1{margin-inline-start:calc(var(--spacing) * 1)}.mt-1\\.5{margin-top:calc(var(--spacing) * 1.5)}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-\\[3px\\]{margin-right:3px}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-px{margin-bottom:1px}.ml-1\\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-auto{margin-left:auto}.box-border{box-sizing:border-box}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.aspect-square{aspect-ratio:1}.size-16{width:calc(var(--spacing) * 16);height:calc(var(--spacing) * 16)}.size-\\[22px\\]{width:22px;height:22px}.size-token-button-composer{width:var(--spacing-token-button-composer);height:var(--spacing-token-button-composer)}.\\!h-auto{height:auto!important}.h-0{height:calc(var(--spacing) * 0)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-\\[1lh\\]{height:1lh}.h-\\[1px\\]{height:1px}.h-auto{height:auto}.h-full{height:100%}.h-token-button-composer{height:var(--spacing-token-button-composer)}.h-token-button-composer-sm{height:var(--spacing-token-button-composer-sm)}.max-h-\\[25dvh\\]{max-height:25dvh}.max-h-\\[140px\\]{max-height:140px}.max-h-none{max-height:none}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-\\[1\\.25rem\\]{min-height:1.25rem}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-7{width:calc(var(--spacing) * 7)}.w-52{width:calc(var(--spacing) * 52)}.w-fit{width:fit-content}.w-full{width:100%}.w-max{width:max-content}.w-px{width:1px}.max-w-16{max-width:calc(var(--spacing) * 16)}.max-w-20{max-width:calc(var(--spacing) * 20)}.max-w-40{max-width:calc(var(--spacing) * 40)}.max-w-\\[60\\%\\]{max-width:60%}.max-w-\\[77\\%\\]{max-width:77%}.max-w-\\[320px\\]{max-width:320px}.max-w-full{max-width:100%}.max-w-none{max-width:none}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-56{min-width:calc(var(--spacing) * 56)}.min-w-max{min-width:max-content}.flex-1{flex:1}.flex-none{flex:none}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.resize{resize:both}.grid-cols-\\[auto_minmax\\(0\\,1fr\\)_auto\\]{grid-template-columns:auto minmax(0,1fr) auto}.grid-cols-\\[minmax\\(0\\,auto\\)_auto_minmax\\(0\\,1fr\\)\\]{grid-template-columns:minmax(0,auto) auto minmax(0,1fr)}.flex-col{flex-direction:column}.flex-row-reverse{flex-direction:row-reverse}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-\\[5px\\]{gap:5px}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-clip{overflow:clip}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-\\[color\\:var\\(--gray-0\\)\\]{border-color:var(--gray-0)}.border-token-border,.border-token-border\\/80{border-color:var(--color-token-border)}@supports (color:color-mix(in lab,red,red)){.border-token-border\\/80{border-color:color-mix(in oklab,var(--color-token-border) 80%,transparent)}}.border-transparent{border-color:#0000}.bg-\\[color\\:var\\(--gray-0\\)\\]{background-color:var(--gray-0)}.bg-token-border\\/70{background-color:var(--color-token-border)}@supports (color:color-mix(in lab,red,red)){.bg-token-border\\/70{background-color:color-mix(in oklab,var(--color-token-border) 70%,transparent)}}.bg-token-button-secondary-background{background-color:var(--color-token-button-secondary-background)}.bg-token-charts-blue{background-color:var(--color-token-charts-blue)}.bg-token-dropdown-background,.bg-token-dropdown-background\\/90{background-color:var(--color-token-dropdown-background)}@supports (color:color-mix(in lab,red,red)){.bg-token-dropdown-background\\/90{background-color:color-mix(in oklab,var(--color-token-dropdown-background) 90%,transparent)}}.bg-token-dropdown-background\\/95{background-color:var(--color-token-dropdown-background)}@supports (color:color-mix(in lab,red,red)){.bg-token-dropdown-background\\/95{background-color:color-mix(in oklab,var(--color-token-dropdown-background) 95%,transparent)}}.bg-token-foreground,.bg-token-foreground\\/5{background-color:var(--color-token-foreground)}@supports (color:color-mix(in lab,red,red)){.bg-token-foreground\\/5{background-color:color-mix(in oklab,var(--color-token-foreground) 5%,transparent)}}.bg-token-foreground\\/10{background-color:var(--color-token-foreground)}@supports (color:color-mix(in lab,red,red)){.bg-token-foreground\\/10{background-color:color-mix(in oklab,var(--color-token-foreground) 10%,transparent)}}.bg-token-input-background\\/90{background-color:var(--color-token-input-background)}@supports (color:color-mix(in lab,red,red)){.bg-token-input-background\\/90{background-color:color-mix(in oklab,var(--color-token-input-background) 90%,transparent)}}.bg-token-menu-border{background-color:var(--color-token-menu-border)}.bg-token-side-bar-background{background-color:var(--color-token-side-bar-background)}.\\[mask-image\\:linear-gradient\\(to_right\\,black_calc\\(100\\%_-_0\\.25rem\\)\\,transparent\\)\\]{-webkit-mask-image:linear-gradient(90deg,#000 calc(100% - .25rem),#0000);mask-image:linear-gradient(90deg,#000 calc(100% - .25rem),#0000)}.\\[mask-repeat\\:no-repeat\\]{-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.object-cover{object-fit:cover}.p-0\\.5{padding:calc(var(--spacing) * .5)}.p-2{padding:calc(var(--spacing) * 2)}.\\!px-0{padding-inline:calc(var(--spacing) * 0)!important}.px-0\\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-\\[var\\(--padding-row-x\\)\\]{padding-inline:var(--padding-row-x)}.py-0{padding-block:calc(var(--spacing) * 0)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-\\[var\\(--padding-row-y\\)\\]{padding-block:var(--padding-row-y)}.pt-0\\.5{padding-top:calc(var(--spacing) * .5)}.pr-0{padding-right:calc(var(--spacing) * 0)}.pr-1{padding-right:calc(var(--spacing) * 1)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.text-left{text-align:left}.align-bottom{vertical-align:bottom}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.\\!leading-none{--tw-leading:1!important;line-height:1!important}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-\\[18px\\]{--tw-leading:18px;line-height:18px}.leading-\\[calc\\(var\\(--codex-chat-font-size\\)\\+8px\\)\\]{--tw-leading:calc(var(--codex-chat-font-size) + 8px);line-height:calc(var(--codex-chat-font-size) + 8px)}.leading-none{--tw-leading:1;line-height:1}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.break-words{overflow-wrap:break-word}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.text-current{color:currentColor}.text-token-button-secondary-foreground{color:var(--color-token-button-secondary-foreground)}.text-token-description-foreground{color:var(--color-token-description-foreground)}.text-token-dropdown-background{color:var(--color-token-dropdown-background)}.text-token-foreground{color:var(--color-token-foreground)}.text-token-input-placeholder-foreground{color:var(--color-token-input-placeholder-foreground)}.text-token-text-tertiary{color:var(--color-token-text-tertiary)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0px 2px 4px -1px var(--tw-shadow-color,#00000014);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-\\[0\\.5px\\]{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(.5px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-token-border{--tw-ring-color:var(--color-token-border)}.outline-hidden{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.outline-hidden{outline-offset:2px;outline:2px solid #0000}}.backdrop-blur-lg{--tw-backdrop-blur:blur(var(--blur-lg));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.select-none{-webkit-user-select:none;user-select:none}.\\[--edge-fade-distance\\:2rem\\]{--edge-fade-distance:2rem}.group-focus-within\\:opacity-100:is(:where(.group):focus-within *){opacity:1}@media(hover:hover){.group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}.group-hover\\/collapsed-tool-activity\\:text-token-foreground:is(:where(.group\\/collapsed-tool-activity):hover *){color:var(--color-token-foreground)}.hover\\:bg-token-button-secondary-hover-background:hover{background-color:var(--color-token-button-secondary-hover-background)}.hover\\:bg-token-editor-background\\/40:hover{background-color:var(--color-token-editor-background)}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-token-editor-background\\/40:hover{background-color:color-mix(in oklab,var(--color-token-editor-background) 40%,transparent)}}.hover\\:bg-token-list-hover-background:hover{background-color:var(--color-token-list-hover-background)}.hover\\:bg-transparent:hover{background-color:#0000}.hover\\:text-token-button-foreground:hover{color:var(--color-token-button-foreground)}.hover\\:text-token-foreground:hover{color:var(--color-token-foreground)}}.focus\\:bg-token-list-hover-background:focus{background-color:var(--color-token-list-hover-background)}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\\:outline-token-button-background:focus-visible{outline-color:var(--color-token-button-background)}@media(hover:hover){.enabled\\:hover\\:bg-token-foreground\\/80:enabled:hover{background-color:var(--color-token-foreground)}@supports (color:color-mix(in lab,red,red)){.enabled\\:hover\\:bg-token-foreground\\/80:enabled:hover{background-color:color-mix(in oklab,var(--color-token-foreground) 80%,transparent)}}.enabled\\:hover\\:bg-token-list-hover-background:enabled:hover{background-color:var(--color-token-list-hover-background)}}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-40:disabled{opacity:.4}.data-\\[state\\=checked\\]\\:translate-x-\\[14px\\][data-state=checked]{--tw-translate-x:14px;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\\[state\\=open\\]\\:bg-token-foreground\\/80[data-state=open]{background-color:var(--color-token-foreground)}@supports (color:color-mix(in lab,red,red)){.data-\\[state\\=open\\]\\:bg-token-foreground\\/80[data-state=open]{background-color:color-mix(in oklab,var(--color-token-foreground) 80%,transparent)}}.data-\\[state\\=open\\]\\:bg-token-list-hover-background[data-state=open]{background-color:var(--color-token-list-hover-background)}.data-\\[state\\=unchecked\\]\\:translate-x-\\[2px\\][data-state=unchecked]{--tw-translate-x:2px;translate:var(--tw-translate-x) var(--tw-translate-y)}@container (min-width:500px){.\\@\\[500px\\]\\:inline{display:inline}}.electron\\:rounded-md:where([data-codex-window-type=electron],[data-codex-window-type=electron] *){border-radius:var(--radius-md)}.electron\\:p-1:where([data-codex-window-type=electron],[data-codex-window-type=electron] *){padding:calc(var(--spacing) * 1)}.electron\\:shadow-\\[0_4px_16px_0_rgba\\(0\\,0\\,0\\,0\\.05\\)\\]:where([data-codex-window-type=electron],[data-codex-window-type=electron] *){--tw-shadow:0 4px 16px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.electron\\:ring:where([data-codex-window-type=electron],[data-codex-window-type=electron] *){--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.electron\\:ring-black\\/10:where([data-codex-window-type=electron],[data-codex-window-type=electron] *){--tw-ring-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.electron\\:ring-black\\/10:where([data-codex-window-type=electron],[data-codex-window-type=electron] *){--tw-ring-color:color-mix(in oklab, var(--color-black) 10%, transparent)}}@media(prefers-color-scheme:dark){.electron\\:dark\\:bg-token-dropdown-background:where([data-codex-window-type=electron],[data-codex-window-type=electron] *){background-color:var(--color-token-dropdown-background)}}.extension\\:border:where([data-codex-window-type=extension],[data-codex-window-type=extension] *){border-style:var(--tw-border-style);border-width:1px}.extension\\:border-token-border\\/50:where([data-codex-window-type=extension],[data-codex-window-type=extension] *){border-color:var(--color-token-border)}@supports (color:color-mix(in lab,red,red)){.extension\\:border-token-border\\/50:where([data-codex-window-type=extension],[data-codex-window-type=extension] *){border-color:color-mix(in oklab,var(--color-token-border) 50%,transparent)}}.\\[\\&_\\.ProseMirror\\]\\:\\!h-5 .ProseMirror{height:calc(var(--spacing) * 5)!important}.\\[\\&_\\.ProseMirror\\]\\:h-auto .ProseMirror{height:auto}.\\[\\&_\\.ProseMirror\\]\\:\\!min-h-5 .ProseMirror{min-height:calc(var(--spacing) * 5)!important}.\\[\\&_\\.ProseMirror\\]\\:min-h-\\[2rem\\] .ProseMirror{min-height:2rem}.\\[\\&_\\.ProseMirror\\]\\:min-w-0 .ProseMirror{min-width:calc(var(--spacing) * 0)}.\\[\\&_\\.ProseMirror\\]\\:flex-1 .ProseMirror{flex:1}.\\[\\&_\\.ProseMirror\\]\\:resize-none .ProseMirror{resize:none}.\\[\\&_\\.ProseMirror\\]\\:overflow-hidden .ProseMirror{overflow:hidden}.\\[\\&_\\.ProseMirror\\]\\:leading-5 .ProseMirror{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.\\[\\&_\\.ProseMirror\\]\\:whitespace-nowrap .ProseMirror{white-space:nowrap}.\\[\\&_\\.ProseMirror\\]\\:focus-visible\\:outline-none .ProseMirror:focus-visible{--tw-outline-style:none;outline-style:none}.\\[\\&_\\.ProseMirror_p\\]\\:m-0 .ProseMirror p{margin:calc(var(--spacing) * 0)}.\\[\\&_\\.ProseMirror_p\\]\\:overflow-hidden .ProseMirror p{overflow:hidden}.\\[\\&_\\.ProseMirror_p\\]\\:text-ellipsis .ProseMirror p{text-overflow:ellipsis}.\\[\\&_\\.ProseMirror_p\\]\\:whitespace-nowrap .ProseMirror p{white-space:nowrap}.\\[\\&_\\.contain-inline-size\\]\\:\\[contain\\:initial\\] .contain-inline-size{contain:initial}.\\[\\&\\>\\*\\:last-child\\]\\:mb-0>:last-child{margin-bottom:calc(var(--spacing) * 0)}.\\[\\&\\>ol\\:first-child\\]\\:mt-0>ol:first-child,.\\[\\&\\>ul\\:first-child\\]\\:mt-0>ul:first-child{margin-top:calc(var(--spacing) * 0)}}@property --top-fade{syntax:"";inherits:false;initial-value:0}@property --bottom-fade{syntax:"";inherits:false;initial-value:0}@property --edge-fade-distance{syntax:"";inherits:false;initial-value:1rem}@keyframes edge-fade{0%,1%{--top-fade:0;--bottom-fade:var(--edge-fade-distance,1rem)}99%,to{--top-fade:var(--edge-fade-distance,1rem);--bottom-fade:0}}@supports (animation-timeline:--scroll-fade){.vertical-scroll-fade-mask{-webkit-mask:linear-gradient(to bottom in oklch,oklch(60% 0 0/0),oklch(85% 0 0) var(--top-fade) calc(100% - var(--bottom-fade)),oklch(60% 0 0/0));mask:linear-gradient(to bottom in oklch,oklch(60% 0 0/0),oklch(85% 0 0) var(--top-fade) calc(100% - var(--bottom-fade)),oklch(60% 0 0/0));animation-name:edge-fade;animation-timing-function:linear;animation-fill-mode:both;animation-timeline:scroll(self y)}}:root{color-scheme:dark;font-family:var(--font-sans);color:var(--agent-text,#f1f0e8);--agent-page-bg:transparent;--agent-surface:#1c1f1b57;--agent-surface-elevated:#1c1f1b7a;--agent-input-bg:#080a085c;--agent-border:#e9e7d81f;--agent-border-strong:#e9e7d838;--agent-text:#f1f0e8;--agent-muted:#f1f0e894;--agent-soft:#f1f0e8c7;--agent-accent:#8ab4f8;--agent-accent-soft:#8ab4f833;--agent-danger:#ff8d7e;--agent-shadow:#0003;--agent-card:var(--agent-input-bg);background:0 0}@supports (color:color-mix(in lab,red,red)){:root{--agent-card:color-mix(in srgb, var(--agent-input-bg) 90%, transparent)}}:root{--agent-card-hover:var(--agent-input-bg)}@supports (color:color-mix(in lab,red,red)){:root{--agent-card-hover:color-mix(in srgb, var(--agent-input-bg) 96%, transparent)}}:root{--agent-control:var(--agent-input-bg)}@supports (color:color-mix(in lab,red,red)){:root{--agent-control:color-mix(in srgb, var(--agent-input-bg) 44%, transparent)}}:root{--agent-control-hover:var(--agent-soft)}@supports (color:color-mix(in lab,red,red)){:root{--agent-control-hover:color-mix(in srgb, var(--agent-soft) 8%, transparent)}}:root{--agent-primary:var(--agent-accent)}@supports (color:color-mix(in lab,red,red)){:root{--agent-primary:color-mix(in srgb, var(--agent-accent) 90%, var(--agent-text))}}:root{--agent-primary-text:#fff;--cubic-enter:cubic-bezier(.19, 1, .22, 1);--cubic-exit-snappy:cubic-bezier(.65, 0, .4, 1);--transition-duration-basic:.15s;--gray-0:#fff;--color-background-surface:transparent;--color-background-surface-under:transparent;--color-background-elevated-primary:var(--agent-surface-elevated);--color-background-elevated-primary-opaque:var(--agent-surface-elevated)}@supports (color:color-mix(in lab,red,red)){:root{--color-background-elevated-primary-opaque:color-mix(in srgb, var(--agent-surface-elevated) 100%, #111)}}:root{--color-background-elevated-secondary:var(--agent-card);--color-background-elevated-secondary-opaque:var(--agent-card)}@supports (color:color-mix(in lab,red,red)){:root{--color-background-elevated-secondary-opaque:color-mix(in srgb, var(--agent-card) 100%, #111)}}:root{--thread-content-max-width:none;--markdown-wide-block-max-width:56rem;--padding-toolbar:calc(var(--spacing) * 4);--vscode-foreground:var(--agent-text);--vscode-descriptionForeground:var(--agent-muted);--vscode-input-background:var(--agent-input-bg);--vscode-dropdown-background:var(--agent-surface-elevated);--vscode-input-placeholderForeground:var(--agent-muted);--vscode-textLink-foreground:var(--agent-accent);--vscode-textLink-activeForeground:var(--agent-accent);--vscode-list-hoverBackground:var(--agent-control-hover);--color-token-editor-foreground:var(--agent-text);--color-token-editor-background:var(--agent-page-bg);--color-token-side-bar-background:var(--agent-surface-elevated);--color-token-main-surface-primary:transparent;--color-token-text-code-block-background:var(--agent-input-bg);--color-token-bg-primary:var(--agent-surface-elevated);--color-token-bg-secondary:var(--agent-card);--color-token-bg-fog:var(--color-background-elevated-secondary);--color-token-bg-tertiary:var(--agent-control);--color-token-list-hover-background:var(--agent-control-hover);--markdown-wide-block-max-height:80vh;--conversation-block-gap:12px;--conversation-tool-assistant-gap:16px;--color-token-terminal-ansi-black:var(--vscode-terminal-ansiBlack,#000);--color-token-terminal-ansi-red:var(--vscode-terminal-ansiRed,#f66);--color-token-terminal-ansi-green:var(--vscode-terminal-ansiGreen,#94f494);--color-token-terminal-ansi-yellow:var(--vscode-terminal-ansiYellow,#f4f47b);--color-token-terminal-ansi-blue:var(--vscode-terminal-ansiBlue,#9e9eff);--color-token-terminal-ansi-magenta:var(--vscode-terminal-ansiMagenta,#db6bdb);--color-token-terminal-ansi-cyan:var(--vscode-terminal-ansiCyan,#81eeee);--color-token-terminal-ansi-white:var(--vscode-terminal-ansiWhite,#d6d6d6);--color-token-terminal-ansi-bright-black:var(--vscode-terminal-ansiBrightBlack,#6e6e6e);--color-token-terminal-ansi-bright-red:var(--vscode-terminal-ansiBrightRed,#ffa8a8);--color-token-terminal-ansi-bright-green:var(--vscode-terminal-ansiBrightGreen,#0f0);--color-token-terminal-ansi-bright-yellow:var(--vscode-terminal-ansiBrightYellow,#ffffa8);--color-token-terminal-ansi-bright-blue:var(--vscode-terminal-ansiBrightBlue,#9494ff);--color-token-terminal-ansi-bright-magenta:var(--vscode-terminal-ansiBrightMagenta,#ffb3ff);--color-token-terminal-ansi-bright-cyan:var(--vscode-terminal-ansiBrightCyan,#adffff);--color-token-terminal-ansi-bright-white:var(--vscode-terminal-ansiBrightWhite,#fff);--padding-row-x:calc(var(--spacing) * 2);--padding-row-y:calc(var(--spacing) * 1.25);--height-token-nav-row:32px;--codex-chat-font-size:var(--vscode-chat-font-size,var(--vscode-font-size,13px));--codex-chat-code-font-size:var(--vscode-chat-editor-font-size,var(--vscode-editor-font-size,12px))}:root[data-codex-window-type=electron]{background:0 0;overflow:hidden}:root[data-codex-window-type=electron] body{--padding-row-y:calc(var(--spacing) * 1.25);--height-token-nav-row:calc(var(--text-base) * 1.5 + var(--padding-row-y) * 2);--padding-panel-base:calc(var(--spacing) * 5);--padding-panel:var(--padding-panel-base);--thread-content-max-width:48rem;--markdown-wide-block-max-width:56rem;--markdown-wide-block-max-height:80vh;--conversation-block-gap:12px;--conversation-tool-assistant-gap:16px;--spacing-token-button-composer-sm:calc(var(--spacing) * 7);--text-heading-md:18px;--cursor-interaction:default;--vscode-editor-font-family:ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;--vscode-font-size:var(--text-base);--vscode-editor-font-size:var(--text-sm);--vscode-chat-font-size:var(--vscode-font-size);--vscode-chat-editor-font-size:var(--vscode-editor-font-size);overscroll-behavior:none;overflow:hidden}:root[data-codex-window-type=electron]:not([data-codex-os=win32]) body{background:0 0}*{box-sizing:border-box}html,body,#root{background:0 0;height:100%}body{min-width:0;color:var(--agent-text);font-family:var(--font-sans);font-size:var(--text-base);font-weight:var(--vscode-font-weight,400);margin:0;overflow:hidden}button,select,textarea{font:inherit}button,select{cursor:default}.agent-shell{height:100%;min-height:100%;padding:var(--padding-toolbar);color:var(--agent-text);background:var(--agent-page-bg);flex-direction:column;display:flex}.agent-log,.log,.agent-thread{width:100%;min-height:0;max-width:var(--thread-content-max-width);scrollbar-width:thin;scrollbar-color:var(--agent-muted) transparent;background:0 0;flex:auto;margin:0 auto;padding:6px 2px 18px;overflow:auto}@supports (color:color-mix(in lab,red,red)){.agent-log,.log,.agent-thread{scrollbar-color:color-mix(in srgb,var(--agent-muted) 28%,transparent) transparent}}.agent-thread{gap:var(--conversation-block-gap,12px);flex-direction:column;padding-top:10px;padding-bottom:24px;display:flex;position:relative;overflow-x:hidden}:root[data-codex-window-type=electron] .agent-thread{--color-token-description-foreground:var(--color-token-foreground)}@supports (color:color-mix(in lab,red,red)){:root[data-codex-window-type=electron] .agent-thread{--color-token-description-foreground:color-mix(in srgb, var(--color-token-foreground) 70%, transparent)}}.agent-thread[data-empty]{justify-content:flex-end}.text-size-chat{font-size:var(--codex-chat-font-size)}.text-size-chat-sm{font-size:calc(var(--codex-chat-font-size) - 1px)}.text-size-code{font-size:var(--codex-chat-code-font-size)}.text-size-code-sm{font-size:calc(var(--codex-chat-code-font-size) - 1px)}.font-vscode-editor{font-family:var(--vscode-editor-font-family,var(--font-mono))}.codex-user-turn,.codex-assistant-turn,.codex-notice-turn{width:100%;min-width:0}.codex-user-bubble{color:var(--color-token-foreground);background:var(--color-token-foreground)}@supports (color:color-mix(in lab,red,red)){.codex-user-bubble{background:color-mix(in srgb,var(--color-token-foreground) 5%,transparent)}}.codex-user-message-content[data-collapsed=true]{-webkit-line-clamp:20;-webkit-box-orient:vertical;max-height:20lh;display:-webkit-box;overflow:hidden}.codex-user-message-toggle{background:0 0;border:0;padding:0}.codex-assistant-turn{justify-content:flex-start;display:flex}.codex-assistant-message{max-width:100%;color:var(--color-token-foreground);white-space:normal;overflow-wrap:anywhere}.codex-assistant-message-streaming{white-space:break-spaces}.codex-assistant-message :where(p){margin:0 0 .85em}.codex-assistant-message :where(p:last-child){margin-bottom:0}.codex-assistant-message :where(ul,ol){margin:.45em 0 .85em;padding-left:1.35rem}.codex-assistant-message :where(ul){list-style:outside}.codex-assistant-message :where(ol){list-style:decimal}.codex-assistant-message :where(li){margin:.25em 0}.codex-assistant-message :where(blockquote){border-left:2px solid var(--color-token-border);color:var(--agent-soft);margin:.75em 0;padding-left:.85rem}.codex-assistant-message :where(code){background:var(--agent-soft);border-radius:4px;padding:.12em .3em}@supports (color:color-mix(in lab,red,red)){.codex-assistant-message :where(code){background:color-mix(in srgb,var(--agent-soft) 10%,transparent)}}.codex-assistant-message :where(code){font-family:var(--font-mono);font-size:var(--codex-chat-code-font-size)}.codex-assistant-message :where(pre){border:1px solid var(--agent-border);margin:.75em 0;padding:.65rem .75rem;overflow-x:auto}@supports (color:color-mix(in lab,red,red)){.codex-assistant-message :where(pre){border:1px solid color-mix(in srgb,var(--agent-border) 72%,transparent)}}.codex-assistant-message :where(pre){border-radius:var(--radius-lg);background:var(--agent-input-bg)}@supports (color:color-mix(in lab,red,red)){.codex-assistant-message :where(pre){background:color-mix(in srgb,var(--agent-input-bg) 82%,transparent)}}.codex-assistant-message :where(pre code){white-space:pre;background:0 0;border-radius:0;padding:0;display:block}.codex-assistant-message :where(a){color:var(--agent-accent);text-underline-offset:2px;text-decoration:underline}.codex-assistant-message :where(hr){border-top:1px solid var(--color-token-border);margin:1rem 0}.codex-notice-turn{justify-content:flex-start;display:flex}.codex-notice-content{border:1px solid var(--agent-border);max-width:min(100%,44rem);padding:10px 12px}@supports (color:color-mix(in lab,red,red)){.codex-notice-content{border:1px solid color-mix(in srgb,var(--agent-border) 74%,transparent)}}.codex-notice-content{border-radius:var(--radius-lg);color:var(--agent-soft);background:var(--agent-surface-elevated)}@supports (color:color-mix(in lab,red,red)){.codex-notice-content{background:color-mix(in srgb,var(--agent-surface-elevated) 86%,transparent)}}.codex-notice-content{overflow-wrap:anywhere}.codex-notice-turn.error .codex-notice-content{border-color:var(--agent-danger)}@supports (color:color-mix(in lab,red,red)){.codex-notice-turn.error .codex-notice-content{border-color:color-mix(in srgb,var(--agent-danger) 46%,transparent)}}.codex-notice-turn.error .codex-notice-content{color:var(--agent-danger)}@supports (color:color-mix(in lab,red,red)){.codex-notice-turn.error .codex-notice-content{color:color-mix(in srgb,var(--agent-danger) 88%,var(--agent-text))}}.codex-notice-turn.error .codex-notice-content{background:var(--agent-danger)}@supports (color:color-mix(in lab,red,red)){.codex-notice-turn.error .codex-notice-content{background:color-mix(in srgb,var(--agent-danger) 11%,transparent)}}.codex-notice-turn.warning .codex-notice-content{border-color:var(--agent-accent)}@supports (color:color-mix(in lab,red,red)){.codex-notice-turn.warning .codex-notice-content{border-color:color-mix(in srgb,var(--agent-accent) 30%,transparent)}}.codex-tool-activity-turn{flex-direction:column;align-items:flex-start;gap:0;width:100%;min-width:0;display:flex}.codex-tool-activity-summary{max-width:100%;color:var(--color-token-foreground);border:0;padding:0}@supports (color:color-mix(in lab,red,red)){.codex-tool-activity-summary{color:color-mix(in srgb,var(--color-token-foreground) 40%,transparent)}}.codex-tool-activity-summary{font:inherit;font-size:var(--codex-chat-font-size);line-height:calc(var(--codex-chat-font-size) + 8px);background:0 0}.codex-tool-activity-summary:focus-visible{outline:none}.codex-tool-activity-turn.inProgress .codex-tool-activity-summary{color:var(--color-token-description-foreground)}@supports (color:color-mix(in lab,red,red)){.codex-tool-activity-turn.inProgress .codex-tool-activity-summary{color:color-mix(in srgb,var(--color-token-description-foreground) 90%,transparent)}}.codex-tool-activity-icon{color:var(--color-token-foreground);justify-content:center;align-items:center;display:inline-flex}@supports (color:color-mix(in lab,red,red)){.codex-tool-activity-icon{color:color-mix(in srgb,var(--color-token-foreground) 35%,transparent)}}.codex-tool-activity-icon{font-family:var(--font-mono);font-size:11px;line-height:1}.codex-tool-activity-turn.inProgress .codex-tool-activity-icon{animation:1.2s ease-in-out infinite codex-tool-activity-pulse}.codex-tool-activity-text{align-items:baseline;gap:4px;min-width:0;max-width:100%;display:inline-flex}.codex-tool-activity-action{color:var(--color-token-foreground);flex:none}@supports (color:color-mix(in lab,red,red)){.codex-tool-activity-action{color:color-mix(in srgb,var(--color-token-foreground) 58%,transparent)}}.codex-tool-activity-detail{min-width:0;color:var(--color-token-foreground);overflow:hidden}@supports (color:color-mix(in lab,red,red)){.codex-tool-activity-detail{color:color-mix(in srgb,var(--color-token-foreground) 40%,transparent)}}.codex-tool-activity-detail{font-family:var(--font-mono);text-overflow:ellipsis;white-space:nowrap}.codex-tool-activity-summary:hover .codex-tool-activity-action,.codex-tool-activity-summary:hover .codex-tool-activity-detail,.codex-tool-activity-summary:hover .codex-tool-activity-icon{color:var(--color-token-foreground)}.codex-tool-activity-output-shell{opacity:0;pointer-events:none;grid-template-rows:0fr;width:100%;min-width:0;transition:grid-template-rows .18s ease-out,opacity .18s ease-out;display:grid;overflow:hidden}.codex-tool-activity-output-shell[data-expanded=true]{opacity:1;pointer-events:auto;grid-template-rows:1fr}.codex-tool-activity-output-shell-inner{min-height:0;overflow:hidden}.codex-tool-activity-output-frame{min-height:1.25rem;padding-right:0;position:relative}.codex-tool-activity-output{box-sizing:border-box;max-width:min(100%,var(--markdown-wide-block-max-width));max-height:140px;color:var(--color-token-description-foreground);white-space:pre;--edge-fade-distance:2rem;background:0 0;border:0;border-radius:0;flex-direction:column;gap:6px;margin:0;padding:8px;font-weight:500;display:flex;overflow:auto}.codex-tool-output-copy:focus-visible{opacity:1}@keyframes codex-tool-activity-pulse{0%,to{opacity:.45}50%{opacity:1}}.agent-log-line,.log-line{border-bottom:1px solid var(--agent-border);grid-template-columns:4.5rem minmax(0,1fr);gap:12px;padding:9px 0;display:grid}@supports (color:color-mix(in lab,red,red)){.agent-log-line,.log-line{border-bottom:1px solid color-mix(in srgb,var(--agent-border) 55%,transparent)}}.agent-log-line,.log-line{color:var(--agent-soft);font-family:var(--font-mono);font-size:12px;line-height:1.5}.agent-log-line:last-child,.log-line:last-child{border-bottom-color:#0000}.agent-log-label,.log-label{color:var(--agent-muted);text-overflow:ellipsis;text-transform:uppercase;overflow:hidden}.agent-log-line.stdout .agent-log-label,.log-line.stdout .log-label{color:var(--agent-accent)}.agent-log-line.stderr .agent-log-label,.agent-log-line.error .agent-log-label,.log-line.stderr .log-label,.log-line.error .log-label{color:var(--agent-danger)}.agent-log-text,.log-text{overflow-wrap:anywhere;white-space:pre-wrap;word-break:normal;min-width:0}.agent-composer-stack{width:100%;max-width:var(--thread-content-max-width);gap:6px;margin:0 auto;display:grid}.above-composer-suggestion-shell{container-type:inline-size}.codex-composer-frame{--composer-top-tray-inline-padding:12px;--composer-top-tray-top-padding:14px;--composer-top-tray-max-height:177px}.codex-composer-surface{color:var(--color-token-foreground)}.codex-composer-inner{isolation:isolate}@supports (corner-shape:superellipse(1.5)){:root{--corner-radius-scale:1.25}.codex-composer-surface,.codex-user-bubble,.codex-notice-content,.provider-dropdown,.provider-dropdown-item,.add-context-dropdown,.add-context-item,.composer-attachment-file,.composer-attachment-image,.rate-limit-popover,.codex-top-tray-panel,.codex-top-tray-item{corner-shape:superellipse(1.5)}}.codex-composer-single-line{min-height:0}.composer-single-line-measure{pointer-events:none;visibility:hidden;white-space:pre;width:max-content;max-width:none;height:0;font-family:var(--font-sans);font-size:var(--text-base);line-height:20px;position:absolute;overflow:hidden}.h-token-button-composer{height:var(--spacing-token-button-composer);gap:var(--h-token-button-composer-gap)}.h-token-button-composer-sm{height:var(--spacing-token-button-composer-sm);gap:var(--h-token-button-composer-gap)}.size-token-button-composer{width:var(--spacing-token-button-composer);height:var(--spacing-token-button-composer)}.size-token-button-composer-sm{width:var(--spacing-token-button-composer-sm);height:var(--spacing-token-button-composer-sm)}.icon-3xs{width:10px;height:10px}.icon-xxs{width:12px;height:12px}.icon-2xs{width:14px;height:14px}.icon-xs{width:16px;height:16px}.icon-sm{width:18px;height:18px}.icon-base{width:20px;height:20px}.icon-md{width:24px;height:24px}.icon-lg{width:28px;height:28px}.cursor-interaction{cursor:var(--cursor-interaction)}.no-drag{-webkit-app-region:no-drag}.outline-hidden{outline-offset:2px;outline:2px solid #0000}.user-select-none{-webkit-user-select:none;user-select:none}.shadow-xl-spread{--tw-shadow:0px 0px 0px .5px var(--tw-shadow-color,var(--color-token-border)), var(--shadow-xl);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}._content_1hiti_1{--dropdown-content-inset:2px;--dropdown-content-start-transform:translateY(calc(var(--dropdown-content-inset) * -1)) scale(.98);transform-origin:var(--radix-dropdown-menu-content-transform-origin);will-change:opacity,transform}._content_1hiti_1[data-side=top]{--dropdown-content-start-transform:translateY(var(--dropdown-content-inset)) scale(.98)}._content_1hiti_1[data-side=right]{--dropdown-content-start-transform:translateX(calc(var(--dropdown-content-inset) * -1)) scale(.98)}._content_1hiti_1[data-side=left]{--dropdown-content-start-transform:translateX(var(--dropdown-content-inset)) scale(.98)}@media(prefers-reduced-motion:no-preference){._content_1hiti_1[data-state=open]{animation:_dropdown-content-enter_1hiti_1 var(--transition-duration-basic) var(--cubic-enter)}}@keyframes _dropdown-content-enter_1hiti_1{0%{opacity:0;transform:var(--dropdown-content-start-transform)}to{opacity:1;transform:translate(0)translateY(0)scale(1)}}.hide-scrollbar{scrollbar-width:none}.hide-scrollbar::-webkit-scrollbar{display:none}.prompt-input{resize:none;width:100%;min-height:2.75rem;max-height:200px;color:var(--color-token-foreground);font-size:var(--text-base);background:0 0;border:0;outline:none;padding:0;line-height:20px;display:block}.prompt-input::placeholder{color:var(--color-token-input-placeholder-foreground)}@supports (color:color-mix(in lab,red,red)){.prompt-input::placeholder{color:color-mix(in srgb,var(--color-token-input-placeholder-foreground) 50%,transparent)}}.ProseMirror{min-width:0;color:var(--agent-text);caret-color:var(--agent-text);font-variant-ligatures:none;font-feature-settings:"liga" 0;white-space:pre-wrap;white-space:break-spaces;word-wrap:break-word;word-break:normal;background:0 0;outline:none;position:relative;overflow-y:auto}.ProseMirror pre{white-space:pre-wrap}.ProseMirror li{position:relative}.ProseMirror-hideselection{caret-color:#0000;background:0 0}.ProseMirror-hideselection ::selection{caret-color:#0000;background:0 0}.ProseMirror [draggable][contenteditable=false]{-webkit-user-select:text;user-select:text}.ProseMirror-selectednode{outline:2px solid #8cf}li.ProseMirror-selectednode{outline:none}li.ProseMirror-selectednode:after{content:"";pointer-events:none;border:2px solid #8cf;position:absolute;inset:-2px -2px -2px -32px}img.ProseMirror-separator{border:none!important;margin:0!important;display:inline!important}.ProseMirror p{margin:0}.ProseMirror .placeholder{pointer-events:none;-webkit-user-select:none;user-select:none;position:relative}.ProseMirror .placeholder:after{color:var(--color-token-input-placeholder-foreground);content:attr(data-placeholder);opacity:.5;pointer-events:none;-webkit-user-select:none;user-select:none;white-space:nowrap;text-overflow:ellipsis;max-width:100%;position:absolute;inset:0 0 auto;overflow:hidden}.ProseMirror .placeholder::selection{color:inherit;background:0 0}.ProseMirror .placeholder ::selection{color:inherit;background:0 0}.ProseMirror .ProseMirror-selectednode:has([skill-mention-name]){outline:none}.prompt-editor-mention{--inline-mention-base-color:var(--color-token-text-link-foreground)}@supports (color:color-mix(in lab,red,red)){.prompt-editor-mention{--inline-mention-base-color:color-mix(in srgb, var(--color-token-text-link-foreground) 80%, var(--color-token-foreground) 20%)}}.prompt-editor-mention{--inline-mention-color:var(--inline-mention-resolved-base-color,var(--inline-mention-base-color));max-width:100%;color:var(--inline-mention-color);vertical-align:baseline;white-space:nowrap;align-items:baseline;display:inline-flex}.prompt-editor-mention:hover{text-underline-offset:2px;text-decoration-line:underline;text-decoration-style:dashed;text-decoration-thickness:.5px}.prompt-editor-mention-icon{color:currentColor}[cmdk-dialog],[cmdk-dialog]:focus-visible{outline:none}[cmdk-root],[data-cmdk-root]{z-index:1000;gap:var(--spacing);min-width:100%;padding:var(--spacing);border:1px solid var(--color-token-border);border-radius:var(--radius-3xl);color:var(--color-token-foreground);background-color:var(--color-token-dropdown-background);flex-direction:column;display:flex}@supports (color:color-mix(in lab,red,red)){[cmdk-root],[data-cmdk-root]{background-color:color-mix(in oklab,var(--color-token-dropdown-background) 95%,transparent)}}[cmdk-root],[data-cmdk-root]{font-size:var(--text-sm);opacity:1;-webkit-user-select:none;user-select:none;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);--cmdk-bottom-item-radius:calc(var(--radius-3xl) - var(--spacing));transform:translateZ(0)}[cmdk-item]{content-visibility:auto;width:100%;min-height:calc(var(--spacing) * 6);padding:var(--padding-row-y) var(--padding-row-x);border-radius:var(--radius-lg);color:var(--color-token-foreground);cursor:var(--cursor-interaction);opacity:.75;-webkit-user-select:none;user-select:none;outline:none;flex-direction:row;align-items:center;display:flex}[cmdk-item][aria-disabled=true],[cmdk-item][data-disabled=true]{cursor:default;opacity:.25}[cmdk-item]:hover:not([aria-disabled=true]),[cmdk-item][data-selected=true],[cmdk-item][aria-selected=true],[cmdk-item]:focus-visible,[cmdk-item]:active:not([aria-disabled=true]){background-color:var(--color-token-list-hover-background);opacity:1}[cmdk-item][data-command-menu-loading=true],[cmdk-item][data-command-menu-loading=true]:hover,[cmdk-item][data-command-menu-loading=true][data-selected=true],[cmdk-item][data-command-menu-loading=true][aria-selected=true],[cmdk-item][data-command-menu-loading=true]:focus-visible,[cmdk-item][data-command-menu-loading=true]:active{cursor:default;opacity:.6;background-color:#0000}[cmdk-item][data-command-menu-empty-state=true],[cmdk-item][data-command-menu-empty-state=true]:hover,[cmdk-item][data-command-menu-empty-state=true][data-selected=true],[cmdk-item][data-command-menu-empty-state=true][aria-selected=true],[cmdk-item][data-command-menu-empty-state=true]:focus-visible,[cmdk-item][data-command-menu-empty-state=true]:active{cursor:default;opacity:1;background-color:#0000}[cmdk-list]{min-height:0;max-height:min(300px,var(--cmdk-list-height,300px));gap:var(--spacing);overscroll-behavior:contain;scrollbar-width:none;flex-direction:column;transition:max-height .1s;display:flex;overflow-y:auto}[cmdk-list]:focus-visible{outline:none}.command-menu-dialog [cmdk-list]{max-height:var(--command-menu-list-max-height);scroll-padding-block-start:calc(var(--spacing) * 8)}.composer-home-top-menu [cmdk-list]{max-height:none}.composer-home-top-menu{max-height:min(320px,var(--composer-top-menu-max-height,320px));overflow:hidden}:where([cmdk-list])>[cmdk-item]:not(:has(~[cmdk-item],~[cmdk-group]:not([hidden]))),:where([cmdk-list])>[cmdk-group]:not([hidden]):not(:has(~[cmdk-item],~[cmdk-group]:not([hidden]))) [cmdk-item]:last-of-type,:where([cmdk-list])>[cmdk-list-sizer]>[cmdk-item]:not(:has(~[cmdk-item],~[cmdk-group]:not([hidden]))),:where([cmdk-list])>[cmdk-list-sizer]>[cmdk-group]:not([hidden]):not(:has(~[cmdk-item],~[cmdk-group]:not([hidden]))) [cmdk-item]:last-of-type{border-bottom-right-radius:var(--cmdk-bottom-item-radius);border-bottom-left-radius:var(--cmdk-bottom-item-radius)}[cmdk-input]{padding:calc(var(--spacing) * 1.5) calc(var(--spacing) * 2.5)}[cmdk-input]:focus-visible{outline:none}[cmdk-empty],[data-cmdk-empty]{min-height:calc(var(--spacing) * 8);padding:calc(var(--spacing) * 1.5) calc(var(--spacing) * 2.5);color:var(--color-token-description-foreground);text-align:center;white-space:pre-wrap;align-items:center;line-height:1.4;display:flex}[data-codex-window-type=electron] [cmdk-root],[data-codex-window-type=electron] [data-cmdk-root]{font-size:var(--text-base)}.codex-attachment-tray{scrollbar-width:none}.codex-attachment-tray::-webkit-scrollbar{display:none}.codex-user-attachment-tray{max-width:77%}.codex-user-attachment-tray .codex-attachment-row{justify-content:flex-end;min-width:0}.composer-attachment-image{border:1px solid var(--color-token-border-heavy);border-radius:var(--radius-lg);background:var(--color-token-input-background);flex:none;width:80px;height:80px;display:inline-flex;position:relative;overflow:visible}.composer-attachment-image img{border-radius:calc(var(--radius-lg) - 1px);object-fit:cover;width:100%;height:100%}.composer-attachment-file{border:.5px solid var(--color-token-border-heavy);flex:none;align-items:center;gap:7px;max-width:min(220px,70vw);height:32px;padding:0 30px 0 10px;display:inline-flex;position:relative}@supports (color:color-mix(in lab,red,red)){.composer-attachment-file{border:.5px solid color-mix(in srgb,var(--color-token-border-heavy) 80%,transparent)}}.composer-attachment-file{border-radius:var(--radius-lg);color:var(--color-token-foreground);background:var(--color-token-dropdown-background)}@supports (color:color-mix(in lab,red,red)){.composer-attachment-file{background:color-mix(in srgb,var(--color-token-dropdown-background) 90%,transparent)}}.composer-attachment-file-icon{color:var(--color-token-description-foreground);flex:none;display:inline-flex}.composer-attachment-file-label{min-width:0;font-size:var(--text-sm);text-overflow:ellipsis;white-space:nowrap;font-weight:500;line-height:1rem;overflow:hidden}.composer-attachment-remove{border:.5px solid var(--color-token-border-heavy);justify-content:center;align-items:center;width:18px;height:18px;display:inline-flex;position:absolute;top:-7px;right:-7px}@supports (color:color-mix(in lab,red,red)){.composer-attachment-remove{border:.5px solid color-mix(in srgb,var(--color-token-border-heavy) 70%,transparent)}}.composer-attachment-remove{color:var(--color-token-foreground);background:var(--color-token-dropdown-background);border-radius:999px;box-shadow:0 1px 3px #0000002e}.composer-attachment-remove:hover,.composer-attachment-remove:focus-visible{background:var(--color-token-list-hover-background)}.codex-left-rail,.codex-secondary-controls,.codex-action-cluster,.model-picker,.rate-line{align-items:center;display:flex}.codex-left-rail{scrollbar-width:none;flex:0 auto;min-width:0;margin:0;padding:0;overflow-x:auto}.codex-left-rail::-webkit-scrollbar{display:none}.composer-mode-indicator{color:var(--color-token-text-link-foreground);flex:0 auto}.composer-mode-divider{background:var(--color-token-border);width:1px;height:1rem;margin:0 1px}@supports (color:color-mix(in lab,red,red)){.composer-mode-divider{background:color-mix(in srgb,var(--color-token-border) 70%,transparent)}}.composer-mode-button{min-width:0;color:var(--color-token-text-link-foreground)}.composer-mode-icon{flex:none;justify-content:center;align-items:center;display:inline-flex}.composer-mode-icon-hover,.composer-mode-button:hover .composer-mode-icon-default,.composer-mode-button:focus-visible .composer-mode-icon-default{display:none}.composer-mode-button:hover .composer-mode-icon-hover,.composer-mode-button:focus-visible .composer-mode-icon-hover{display:inline-flex}.composer-mode-label{color:currentColor;font-weight:500}.composer-context-indicator{color:var(--color-token-text-link-foreground);flex:0 auto}.composer-context-divider{background:var(--color-token-border);margin:0 1px}@supports (color:color-mix(in lab,red,red)){.composer-context-divider{background:color-mix(in srgb,var(--color-token-border) 70%,transparent)}}.composer-context-button{color:var(--color-token-text-link-foreground)}.composer-context-icon{justify-content:center;align-items:center;display:inline-flex}.composer-context-icon-hover,.composer-context-button:hover .composer-context-icon-default,.composer-context-button:focus-visible .composer-context-icon-default{display:none}.composer-context-button:hover .composer-context-icon-hover,.composer-context-button:focus-visible .composer-context-icon-hover{display:inline-flex}.composer-context-label{color:currentColor;font-weight:500}.codex-secondary-controls{flex:0 auto;justify-content:flex-end}.codex-action-cluster{flex:none;justify-content:flex-end}.model-picker-root{flex:none;align-items:center;display:inline-flex}.model-picker,.codex-tool,.codex-action{outline:none;flex:none;justify-content:center;align-items:center;display:inline-flex;position:relative}.codex-tool,.codex-action{line-height:18px}.model-picker{letter-spacing:0;white-space:nowrap;min-width:0;max-width:10rem}.model-icon{border:1px solid var(--agent-border-strong);flex:none;justify-content:center;align-items:center;width:18px;height:18px;display:inline-flex}@supports (color:color-mix(in lab,red,red)){.model-icon{border:1px solid color-mix(in srgb,var(--agent-border-strong) 70%,transparent)}}.model-icon{color:var(--agent-text);background:var(--agent-control);border-radius:999px;font-size:10px;font-weight:750;line-height:1}.model-label{min-width:0;color:var(--color-token-foreground);text-overflow:ellipsis;overflow:hidden}.model-chevron{color:var(--color-token-input-placeholder-foreground);flex:none;line-height:1}.provider-dropdown{z-index:50;border:.5px solid var(--color-token-menu-border);width:13rem;max-height:min(250px,100vh - 16px);position:absolute;bottom:calc(100% + 6px);left:0}@supports (color:color-mix(in lab,red,red)){.provider-dropdown{border:.5px solid color-mix(in srgb,var(--color-token-menu-border) 78%,transparent)}}.provider-dropdown{border-radius:var(--radius-xl);color:var(--color-token-foreground);background:var(--color-token-dropdown-background)}@supports (color:color-mix(in lab,red,red)){.provider-dropdown{background:color-mix(in srgb,var(--color-token-dropdown-background) 90%,transparent)}}.provider-dropdown{-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.provider-dropdown-title{min-height:24px;padding:var(--padding-row-y) var(--padding-row-x);color:var(--color-token-description-foreground);font-size:var(--text-sm);text-overflow:ellipsis;white-space:nowrap;align-items:center;line-height:1rem;display:flex;overflow:hidden}.provider-dropdown-item{width:100%;color:var(--color-token-foreground);text-align:left;background:0 0;border:0}.provider-dropdown-item:hover,.provider-dropdown-item:focus,.provider-dropdown-item[data-selected=true]{background:var(--color-token-list-hover-background)}.provider-dropdown-check{color:var(--color-token-foreground)}.permissions-root{flex:0 auto;min-width:0;display:inline-flex;position:relative}.permissions-trigger{color:var(--color-token-input-placeholder-foreground)}.permissions-trigger[data-permission-mode=auto-review],.permissions-item[data-permission-mode=auto-review] .permissions-item-icon{color:var(--color-token-text-link-foreground)}.permissions-trigger[data-permission-mode=full-access],.permissions-item[data-permission-mode=full-access] .permissions-item-icon{color:var(--agent-danger)}.permissions-trigger-label{color:currentColor;font-weight:500}.permissions-trigger-chevron{color:currentColor;opacity:.72}.permissions-dropdown{z-index:50;border:.5px solid var(--color-token-menu-border);width:13.5rem;max-height:min(250px,100vh - 16px);position:absolute;bottom:calc(100% + 6px);left:0;overflow-y:auto}@supports (color:color-mix(in lab,red,red)){.permissions-dropdown{border:.5px solid color-mix(in srgb,var(--color-token-menu-border) 78%,transparent)}}.permissions-dropdown{border-radius:var(--radius-xl);color:var(--color-token-foreground);background:var(--color-token-dropdown-background)}@supports (color:color-mix(in lab,red,red)){.permissions-dropdown{background:color-mix(in srgb,var(--color-token-dropdown-background) 90%,transparent)}}.permissions-dropdown{-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.permissions-item{width:100%;min-height:calc(var(--spacing) * 8);align-items:center;gap:calc(var(--spacing) * 2);color:var(--color-token-foreground);text-align:left;background:0 0;border:0;display:flex}.permissions-item:hover,.permissions-item:focus-visible,.permissions-item[data-selected=true]{background:var(--color-token-list-hover-background)}.permissions-item-icon,.permissions-item-check{color:var(--color-token-description-foreground);justify-content:center;align-items:center;display:inline-flex}.permissions-item-label{color:var(--color-token-foreground);font-weight:500}.add-context-root{flex:none;display:inline-flex;position:relative}.add-context-dropdown{z-index:50;border:.5px solid var(--color-token-menu-border);width:max-content;min-width:120px;max-width:min(320px,100vw - 16px);max-height:min(270px,100vh - 16px);position:absolute;bottom:calc(100% + 6px);left:-8px;overflow-y:auto}@supports (color:color-mix(in lab,red,red)){.add-context-dropdown{border:.5px solid color-mix(in srgb,var(--color-token-menu-border) 78%,transparent)}}.add-context-dropdown{border-radius:var(--radius-xl);color:var(--color-token-foreground);background:var(--color-token-dropdown-background)}@supports (color:color-mix(in lab,red,red)){.add-context-dropdown{background:color-mix(in srgb,var(--color-token-dropdown-background) 90%,transparent)}}.add-context-dropdown{-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.add-context-item{width:100%;min-height:calc(var(--spacing) * 8);align-items:center;gap:calc(var(--spacing) * 1.5);color:var(--color-token-foreground);cursor:var(--cursor-interaction);text-align:left;background:0 0;border:0;display:flex}.add-context-item:hover,.add-context-item:focus-visible{background:var(--color-token-list-hover-background)}.add-context-item:disabled{cursor:default;opacity:.5}.add-context-item:disabled:hover{background:0 0}.add-context-item-icon{color:var(--color-token-description-foreground);opacity:.75;justify-content:center;align-items:center;display:inline-flex}.add-context-item:hover .add-context-item-icon,.add-context-item:focus-visible .add-context-item-icon{opacity:1}.add-context-glyph{width:14px;height:14px;color:var(--color-token-description-foreground);font-size:var(--text-sm);justify-content:center;align-items:center;font-weight:700;line-height:1;display:inline-flex}.add-context-item-label{color:var(--color-token-foreground);font-weight:500}.add-context-item-detail{color:var(--color-token-description-foreground);font-size:var(--text-sm)}.add-context-separator{flex:none}.add-context-separator-line{background:var(--color-token-menu-border)}.provider-select{appearance:none;color:#0000;opacity:0;background:0 0;outline:none;width:100%;height:100%;position:absolute;inset:0}.composer-separator{background:var(--agent-border-strong);flex:none;width:1px;height:18px;margin:0 3px}@supports (color:color-mix(in lab,red,red)){.composer-separator{background:color-mix(in srgb,var(--agent-border-strong) 72%,transparent)}}.codex-start{width:auto;min-width:56px}.codex-circle-action:before{content:"";border:2px solid;border-radius:999px;width:13px;height:13px}.send-button{border-radius:999px}.provider-select:disabled{opacity:0}.rate-line{min-width:0;color:var(--agent-muted);gap:6px;padding:0 2px}@supports (color:color-mix(in lab,red,red)){.rate-line{color:color-mix(in srgb,var(--agent-muted) 88%,transparent)}}.rate-line{white-space:nowrap;font-size:12px;font-weight:500;line-height:1.35}.rate-line[hidden]{display:none}.rate-line :where(span){text-overflow:ellipsis;min-width:0;overflow:hidden}.codex-rate-limit-summary{flex-wrap:nowrap;justify-content:flex-start;overflow:hidden}.rate-limit-trigger{border-radius:var(--radius-md);max-width:100%;height:22px;color:var(--color-token-input-placeholder-foreground);border:0;padding:0 4px;display:inline-flex;position:relative}@supports (color:color-mix(in lab,red,red)){.rate-limit-trigger{color:color-mix(in srgb,var(--color-token-input-placeholder-foreground) 94%,transparent)}}.rate-limit-trigger{font-size:var(--text-sm);background:0 0;font-weight:500;line-height:1}.rate-limit-trigger-inline{gap:6px;overflow:hidden}.rate-limit-trigger:hover,.rate-limit-trigger:focus-visible,.rate-limit-trigger[aria-expanded=true]{background:var(--color-token-list-hover-background);outline:none}.rate-limit-speedometer,.rate-limit-chevron{color:var(--color-token-input-placeholder-foreground);flex:none}@supports (color:color-mix(in lab,red,red)){.rate-limit-speedometer,.rate-limit-chevron{color:color-mix(in srgb,var(--color-token-input-placeholder-foreground) 86%,transparent)}}.rate-line-heading{color:var(--color-token-input-placeholder-foreground);flex:none}@supports (color:color-mix(in lab,red,red)){.rate-line-heading{color:color-mix(in srgb,var(--color-token-input-placeholder-foreground) 92%,transparent)}}.rate-limit-inline-separator{color:var(--agent-accent);flex:none}@supports (color:color-mix(in lab,red,red)){.rate-limit-inline-separator{color:color-mix(in srgb,var(--agent-accent) 82%,transparent)}}.rate-limit-inline-segment{align-items:baseline;gap:5px;min-width:0;display:inline-flex}.rate-limit-popover{color:var(--color-token-foreground)}.rate-limit-popover-title{color:var(--color-token-description-foreground);font-size:var(--text-xs);padding:2px 0 5px;font-weight:600}.rate-limit-popover-row{min-width:0;min-height:24px;color:var(--color-token-foreground);grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:24px;display:grid}.rate-limit-window{min-width:0;color:var(--color-token-foreground);text-overflow:ellipsis;font-weight:500;overflow:hidden}.rate-limit-row-value{min-width:0;color:var(--color-token-description-foreground);text-align:right;justify-content:flex-end;align-items:center;gap:5px;display:inline-flex}.rate-limit-percent{color:var(--color-token-input-placeholder-foreground);flex:none}@supports (color:color-mix(in lab,red,red)){.rate-limit-percent{color:color-mix(in srgb,var(--color-token-input-placeholder-foreground) 92%,transparent)}}.rate-limit-percent{font-weight:600}.rate-limit-reset{min-width:0;color:var(--color-token-description-foreground)}.status-dot{background:var(--agent-muted);border-radius:999px;flex:none;width:6px;height:6px}.status-dot.running{background:var(--agent-accent)}.status-dot.failed{background:var(--agent-danger)}.codex-top-tray-shell{width:calc(var(--composer-top-tray-inline-padding,12px) * 2 + 100% + 8px);min-width:0;left:50%;bottom:var(--composer-top-tray-top-padding,14px);transform:translate(-50%)}.codex-top-tray-panel,.codex-top-tray-panel[cmdk-root],.codex-top-tray-panel[data-cmdk-root]{width:100%;min-width:0;max-height:var(--composer-top-tray-max-height,177px);padding:var(--spacing);padding-top:calc(var(--spacing) * 3);padding-left:calc(var(--spacing) * 2);border:1px solid var(--composer-top-tray-border,var(--color-token-border));flex-direction:column;display:flex;position:relative}@supports (color:color-mix(in lab,red,red)){.codex-top-tray-panel,.codex-top-tray-panel[cmdk-root],.codex-top-tray-panel[data-cmdk-root]{border:1px solid var(--composer-top-tray-border,color-mix(in srgb, var(--color-token-border) 72%, transparent))}}.codex-top-tray-panel,.codex-top-tray-panel[cmdk-root],.codex-top-tray-panel[data-cmdk-root]{border-top-left-radius:var(--radius-3xl);border-top-right-radius:var(--radius-3xl);color:var(--color-token-foreground);background:var(--composer-top-tray-background,var(--color-token-side-bar-background));border-top-color:#0000;border-bottom:none;border-bottom-right-radius:0;border-bottom-left-radius:0}@supports (color:color-mix(in lab,red,red)){.codex-top-tray-panel,.codex-top-tray-panel[cmdk-root],.codex-top-tray-panel[data-cmdk-root]{background:var(--composer-top-tray-background,color-mix(in oklab, var(--color-token-side-bar-background) 94%, transparent))}}.codex-top-tray-panel,.codex-top-tray-panel[cmdk-root],.codex-top-tray-panel[data-cmdk-root]{box-shadow:none;font-size:var(--text-sm);-webkit-backdrop-filter:none;backdrop-filter:none;isolation:isolate;-webkit-user-select:none;user-select:none;--cmdk-bottom-item-radius:0;overflow:hidden}.codex-top-tray-title{padding:0 var(--padding-row-x) calc(var(--spacing) * 1.25);color:var(--color-token-description-foreground);font-size:var(--text-xs);font-weight:600;line-height:1.2}.codex-top-tray-list,.codex-top-tray-panel [cmdk-list],.codex-top-tray-panel [data-cmdk-list]{gap:var(--spacing);scrollbar-width:none;flex-direction:column;flex:1;width:100%;min-height:0;max-height:none;transition:none;display:flex;overflow-y:auto}.codex-top-tray-list::-webkit-scrollbar{display:none}.codex-top-tray-empty,.codex-top-tray-panel [data-cmdk-empty]{padding:var(--padding-row-y) var(--padding-row-x);color:var(--color-token-input-placeholder-foreground);font-size:var(--text-sm);align-items:center;display:flex}.codex-top-tray-item,.codex-top-tray-item[cmdk-item],.codex-top-tray-item[data-list-navigation-item]{width:calc(100% - var(--spacing) * 2);min-height:calc(var(--spacing) * 6);padding:var(--padding-row-y) var(--padding-row-x);border-radius:var(--radius-lg);color:var(--color-token-foreground);cursor:var(--cursor-interaction,default);font-size:var(--text-sm);opacity:.75;text-align:left;background:0 0;border:0;outline:none;flex-shrink:0;align-items:center;gap:0;display:flex;overflow:hidden}.codex-top-tray-item:hover,.codex-top-tray-item[data-selected=true],.codex-top-tray-item:focus-visible{background:var(--color-token-list-hover-background);opacity:1}.codex-top-tray-icon{width:14px;height:14px;color:var(--color-token-description-foreground);font-size:var(--text-sm);flex:none;justify-content:center;align-items:center;font-weight:700;line-height:1;display:inline-flex}.codex-top-tray-copy{align-items:center;gap:calc(var(--spacing) * 2);min-width:0;display:flex}.codex-top-tray-label,.codex-top-tray-detail{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.codex-top-tray-label{color:var(--color-token-foreground);font-size:var(--text-sm)}.codex-top-tray-detail{color:var(--color-token-description-foreground);font-size:var(--text-sm);flex:1 1 0}@media(max-width:720px){.agent-shell{padding:10px}.prompt-input{min-height:2.75rem;font-size:16px}.model-picker,.codex-tool,.codex-action{height:var(--spacing-token-button-composer)}.codex-tool,.codex-action{width:var(--spacing-token-button-composer)}.codex-tool{width:var(--spacing-token-button-composer-sm);height:var(--spacing-token-button-composer-sm)}.codex-left-rail{min-width:0}.codex-action-cluster{margin-left:auto}}@media(max-width:520px){.agent-log-line,.log-line{grid-template-columns:1fr;gap:2px}.model-picker{min-width:104px;max-width:168px}.codex-tool-skill,.codex-mic,.rate-dot,.rate-limit-reset{display:none}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}';function dp(n){Xs("agent-session",sp),Gs(),document.documentElement.dataset.cmuxWebviewKind="agent-session",document.body.dataset.cmuxWebviewKind="agent-session";const e=Qs(()=>Pr.jsx(su,{}));Ks.createRoot(n).render(Pr.jsx(Zs,{router:e}))}export{dp as mountAgentSessionSurface}; diff --git a/Resources/markdown-viewer/webviews-app/chunks/diffSurface.mjs b/Resources/markdown-viewer/webviews-app/chunks/diffSurface.mjs index 4fd4bb18eda4..4f074e5e78fa 100644 --- a/Resources/markdown-viewer/webviews-app/chunks/diffSurface.mjs +++ b/Resources/markdown-viewer/webviews-app/chunks/diffSurface.mjs @@ -112,4 +112,4 @@ From `,o-1)}}function ht(t){const e=xt(t,0);if(e==null||e<=0)return;const r=t.sl background-color: var(--cmux-diff-tree-sticky-bg, var(--cmux-diff-sidebar-bg)) !important; box-shadow: 0 1px 0 var(--trees-border-color); } - `}function Be(t,e){const r=t.palette??{},i=nt(t.background,e),n=Y(t.foreground,i,t.type==="light"?"#000000":"#ffffff"),o=(a,c=n)=>Y(a,i,c);return{name:t.name,displayName:t.ghosttyName,type:t.type,colors:{"editor.background":i,"editor.foreground":n,"terminal.background":i,"terminal.foreground":n,"terminal.ansiBlack":o(r[0]),"terminal.ansiRed":o(r[1]),"terminal.ansiGreen":o(r[2]),"terminal.ansiYellow":o(r[3]),"terminal.ansiBlue":o(r[4]),"terminal.ansiMagenta":o(r[5]),"terminal.ansiCyan":o(r[6]),"terminal.ansiWhite":o(r[7]),"terminal.ansiBrightBlack":o(r[8]),"terminal.ansiBrightRed":o(r[9],o(r[1])),"terminal.ansiBrightGreen":o(r[10],o(r[2])),"terminal.ansiBrightYellow":o(r[11],o(r[3])),"terminal.ansiBrightBlue":o(r[12],o(r[4])),"terminal.ansiBrightMagenta":o(r[13],o(r[5])),"terminal.ansiBrightCyan":o(r[14],o(r[6])),"terminal.ansiBrightWhite":o(r[15]),"gitDecoration.addedResourceForeground":o(r[10],o(r[2],"#32d74b")),"gitDecoration.deletedResourceForeground":o(r[9],o(r[1],"#ff453a")),"gitDecoration.modifiedResourceForeground":o(r[12],o(r[4],"#0a84ff")),"editor.selectionBackground":t.selectionBackground,"editor.selectionForeground":t.selectionForeground},tokenColors:[{settings:{foreground:n,background:i}},{scope:["comment","punctuation.definition.comment"],settings:{foreground:o(r[8]),fontStyle:"italic"}},{scope:["string","constant.other.symbol"],settings:{foreground:o(r[2])}},{scope:["constant.numeric","constant.language","support.constant"],settings:{foreground:o(r[3])}},{scope:["keyword","storage","storage.type"],settings:{foreground:o(r[5])}},{scope:["entity.name.function","support.function"],settings:{foreground:o(r[4])}},{scope:["entity.name.type","entity.name.class","support.type"],settings:{foreground:o(r[6])}},{scope:["variable","meta.definition.variable"],settings:{foreground:n}},{scope:["invalid","message.error"],settings:{foreground:o(r[9],o(r[1]))}}]}}function K(t,e={}){const r=e.pending===!0;return{error:e.error===!0,loading:e.loading===!0||r,message:t,pending:r,statusOnly:e.statusOnly===!0}}function Bt(t,e){const r=t.payload;return r?.pendingReplacement===!0?K(r.statusMessage??e("loadingDiff"),{loading:!0,pending:!0}):typeof r?.statusMessage=="string"&&r.statusMessage.length>0?K(r.statusMessage,{error:r.statusIsError===!0,loading:!1,statusOnly:!0}):K(e("loadingDiff"),{loading:!0})}function je(t){document.body.dataset.loading=t.loading?"true":"false",document.body.dataset.statusOnly=t.statusOnly?"true":"false"}const Tt=/\b(Android|iPhone|iPad|iPod|Mobile)\b/i;function zt(t){return Tt.test(t??"")?1:3}function Lt(){return zt(typeof navigator>"u"?void 0:navigator.userAgent)}function Dt(t){return{poolSize:Lt(),workerFactory:()=>new Worker(t,{type:"module"})}}const Nt=["82%","64%","76%","58%","70%","46%"],Rt=["58%","88%","72%","94%","64%","82%","52%","78%"],Ot="./assets/pierre-diffs-1.2.7-trees-1.0.0-beta.4/worker-pool/worker-portable.js",Oe="cmux.diffViewer.layout";function Et(t,e){const r=t.payload??{};return{activeItemId:"",activeTreePath:"",copyFeedback:"",fileSearchOpen:!1,filesWidth:252,filesVisible:!0,items:[],metrics:null,options:{collapsed:!1,diffIndicators:"bars",expandUnchanged:!1,layout:Ut(r),lineNumbers:!0,showBackgrounds:!0,wordDiffs:!1,wordWrap:!1},optionsOpen:!1,status:e,treeSource:null}}function Vt(t,e){switch(e.type){case"append-items":{const r=t.options.collapsed?e.items.map(i=>({...i,collapsed:!0})):e.items;return{...t,activeItemId:t.activeItemId||r[0]?.id||"",items:[...t.items,...r],status:t.status.loading?K("",{loading:!1}):t.status}}case"rename-item":return{...t,activeItemId:t.activeItemId===e.oldId?e.newId:t.activeItemId,items:t.items.map(r=>r.id===e.oldId||r.id===e.newId?{...r,id:e.newId,version:(r.version??0)+1}:r)};case"set-active-item":return{...t,activeItemId:e.itemId,activeTreePath:e.treePath??t.activeTreePath};case"set-copy-feedback":return{...t,copyFeedback:e.message};case"set-file-search-open":return{...t,fileSearchOpen:e.open,filesVisible:e.open?!0:t.filesVisible};case"set-files-width":return{...t,filesWidth:e.width};case"set-files-visible":return{...t,filesVisible:e.visible};case"set-metrics":return{...t,metrics:e.metrics};case"set-option":return e.key==="collapsed"?{...t,options:{...t.options,collapsed:!!e.value},items:t.items.map(r=>({...r,collapsed:!!e.value,version:(r.version??0)+1}))}:{...t,options:{...t.options,[e.key]:e.value}};case"set-options-open":return{...t,optionsOpen:e.open};case"set-status":return{...t,status:e.status};case"set-tree-source":{const r=e.source,i=t.activeItemId?r.treePathByItemId.get(t.activeItemId)??t.activeTreePath:t.activeTreePath;return{...t,activeTreePath:i,treeSource:r}}}}function Wt(t){const e=L.c(65),{config:r,initialStatus:i}=t,n=r.payload??{},o=Re(n.labels,{assertMissing:Ne()}),a=we(n.appearance);let c;e[0]!==r||e[1]!==i?(c=Et(r,i),e[0]=r,e[1]=i,e[2]=c):c=e[2];const[l,f]=R.useReducer(Vt,c),d=Ve(l),u=R.useRef(null),p=R.useRef(null),m=R.useRef(null);let g;if(e[3]!==r.assets?.workerModuleURL){const O=$t(r.assets?.workerModuleURL);g=Dt(O),e[3]=r.assets?.workerModuleURL,e[4]=g}else g=e[4];const h=g,y=Ct(l.options,a),j=Pt(l.options,a);Si(l),yi(n,o,f),xi(r,o,f,d);let v;e[5]!==n.shortcuts?(v=n.shortcuts??{},e[5]=n.shortcuts,e[6]=v):v=e[6],ji(v,m,f),Ii(l.optionsOpen,f);let S;e[7]!==l.activeItemId||e[8]!==l.activeTreePath||e[9]!==l.treeSource?.treePathByItemId?(S=l.treeSource?.treePathByItemId.get(l.activeItemId)??l.activeTreePath,e[7]=l.activeItemId,e[8]=l.activeTreePath,e[9]=l.treeSource?.treePathByItemId,e[10]=S):S=e[10];const x=S;let b;e[11]!==f||e[12]!==l.items||e[13]!==l.treeSource?.treePathByItemId?(b=O=>{const H=Fi(O,l.items);H&&(u.current?.scrollTo({type:"item",id:H,align:"start",behavior:"smooth-auto"}),f({type:"set-active-item",itemId:H,treePath:l.treeSource?.treePathByItemId.get(H)}))},e[11]=f,e[12]=l.items,e[13]=l.treeSource?.treePathByItemId,e[14]=b):b=e[14];const w=b;let I;e[15]!==f?(I=O=>{je(O),f({type:"set-status",status:O})},e[15]=f,e[16]=I):I=e[16];const N=I;let P;e[17]!==f?(P=O=>{Ht(O),f({type:"set-option",key:"layout",value:O})},e[17]=f,e[18]=P):P=e[18];const _=P;let B;e[19]!==f||e[20]!==o||e[21]!==n.patchURL?(B=async()=>{try{const O=await it(n.patchURL,o,p.current);f({type:"set-copy-feedback",message:O})}catch{f({type:"set-copy-feedback",message:o("copyFailedGitApplyCommand")})}},e[19]=f,e[20]=o,e[21]=n.patchURL,e[22]=B):B=e[22];let M;e[23]!==o||e[24]!==N?(M=O=>{N(K(o("loadingDiff"),{pending:!0})),window.location.href=tt(O)},e[23]=o,e[24]=N,e[25]=M):M=e[25];let D;e[26]!==r||e[27]!==f||e[28]!==o||e[29]!==w||e[30]!==_||e[31]!==l||e[32]!==B||e[33]!==M?(D=s.jsx(qt,{config:r,label:o,onCopyGitApply:B,onJump:w,onNavigate:M,onReload:At,onSetLayout:_,dispatch:f,state:l}),e[26]=r,e[27]=f,e[28]=o,e[29]=w,e[30]=_,e[31]=l,e[32]=B,e[33]=M,e[34]=D):D=e[34];const T=`${l.filesWidth}px`;let C;e[35]!==T?(C={"--cmux-diff-files-width":T},e[35]=T,e[36]=C):C=e[36];const z=C;let F;e[37]!==f||e[38]!==o||e[39]!==w||e[40]!==x||e[41]!==l?(F=s.jsx(ti,{label:o,onSelectItem:w,selectedPath:x,dispatch:f,state:l}),e[37]=f,e[38]=o,e[39]=w,e[40]=x,e[41]=l,e[42]=F):F=e[42];let k;e[43]!==o?(k=o("diffViewer"),e[43]=o,e[44]=k):k=e[44];let E;e[45]!==y||e[46]!==j||e[47]!==l.items||e[48]!==h?(E=l.items.length>0?s.jsxs(Ue,{poolOptions:h,highlighterOptions:y,children:[s.jsx(Kt,{codeViewRef:u,highlighterOptions:y}),s.jsx(Ge,{ref:u,className:"code-view-root",containerRef:m,items:l.items,options:j})]}):null,e[45]=y,e[46]=j,e[47]=l.items,e[48]=h,e[49]=E):E=e[49];let V;e[50]!==k||e[51]!==E?(V=s.jsx("main",{id:"viewer","aria-label":k,children:E}),e[50]=k,e[51]=E,e[52]=V):V=e[52];let W;e[53]!==o||e[54]!==l.status?(W=s.jsx(li,{label:o,status:l.status}),e[53]=o,e[54]=l.status,e[55]=W):W=e[55];let A;e[56]!==z||e[57]!==F||e[58]!==V||e[59]!==W?(A=s.jsxs("section",{id:"content",style:z,children:[F,V,W]}),e[56]=z,e[57]=F,e[58]=V,e[59]=W,e[60]=A):A=e[60];let U;e[61]===Symbol.for("react.memo_cache_sentinel")?(U=s.jsx("textarea",{ref:p,"aria-hidden":"true",readOnly:!0,tabIndex:-1,className:"copy-fallback-textarea"}),e[61]=U):U=e[61];let G;return e[62]!==D||e[63]!==A?(G=s.jsxs("div",{id:"app",children:[D,A,U]}),e[62]=D,e[63]=A,e[64]=G):G=e[64],G}function At(){return window.location.reload()}function $t(t){return new URL(t||Ot,window.location.href)}function Ut(t){const e=Ee(t.layout);return t.layoutSource==="explicit"&&e?e:Gt()??e??"unified"}function Gt(){try{return Ee(window.localStorage.getItem(Oe))}catch{return null}}function Ht(t){try{window.localStorage.setItem(Oe,t)}catch{}}function Ee(t){return t==="split"||t==="unified"?t:null}function Kt(t){const{codeViewRef:e,highlighterOptions:r}=t;return di(r,e),null}function qt(t){const e=L.c(77),{config:r,dispatch:i,label:n,onCopyGitApply:o,onJump:a,onNavigate:c,onReload:l,onSetLayout:f,state:d}=t;let u;e[0]!==r.payload?(u=r.payload??{},e[0]=r.payload,e[1]=u):u=e[1];const p=u;let m;e[2]!==n||e[3]!==c||e[4]!==p?(m=s.jsx(Jt,{label:n,onNavigate:c,payload:p}),e[2]=n,e[3]=c,e[4]=p,e[5]=m):m=e[5];let g;e[6]!==n||e[7]!==a||e[8]!==d.activeItemId||e[9]!==d.items?(g=s.jsx("div",{className:"toolbar-middle flex min-w-0 flex-1 items-center justify-center gap-1.5",children:s.jsx(Zt,{items:d.items,label:n,onJump:a,selectedItemId:d.activeItemId})}),e[6]=n,e[7]=a,e[8]=d.activeItemId,e[9]=d.items,e[10]=g):g=e[10];let h;e[11]!==n||e[12]!==p.externalURL?(h=typeof p.externalURL=="string"&&p.externalURL.length>0?s.jsx("a",{id:"external-link",className:"toolbar-icon",href:p.externalURL,target:"_blank",rel:"noreferrer",title:n("openSourceURL"),"aria-label":n("openSourceURL"),children:s.jsx(X,{name:"external"})}):null,e[11]=n,e[12]=p.externalURL,e[13]=h):h=e[13];let y;e[14]!==n||e[15]!==d.options.layout?(y=d.options.layout==="split"?n("switchToUnifiedDiff"):n("switchToSplitDiff"),e[14]=n,e[15]=d.options.layout,e[16]=y):y=e[16];let j;e[17]!==n||e[18]!==d.options.layout?(j=d.options.layout==="split"?n("switchToUnifiedDiff"):n("switchToSplitDiff"),e[17]=n,e[18]=d.options.layout,e[19]=j):j=e[19];let v;e[20]!==f||e[21]!==d.options.layout?(v=()=>f(d.options.layout==="split"?"unified":"split"),e[20]=f,e[21]=d.options.layout,e[22]=v):v=e[22];let S;e[23]!==d.options.layout?(S=s.jsx(X,{name:d.options.layout}),e[23]=d.options.layout,e[24]=S):S=e[24];let x;e[25]!==y||e[26]!==j||e[27]!==v||e[28]!==S?(x=s.jsx("button",{id:"layout-toggle",className:"toolbar-icon",type:"button",title:y,"aria-label":j,onClick:v,children:S}),e[25]=y,e[26]=j,e[27]=v,e[28]=S,e[29]=x):x=e[29];let b;e[30]!==n?(b=n("options"),e[30]=n,e[31]=b):b=e[31];let w;e[32]!==n?(w=n("options"),e[32]=n,e[33]=w):w=e[33];let I;e[34]!==i||e[35]!==d.optionsOpen?(I=()=>i({type:"set-options-open",open:!d.optionsOpen}),e[34]=i,e[35]=d.optionsOpen,e[36]=I):I=e[36];let N;e[37]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(X,{name:"dots"}),e[37]=N):N=e[37];let P;e[38]!==d.optionsOpen||e[39]!==b||e[40]!==w||e[41]!==I?(P=s.jsx("button",{id:"options-button",className:"toolbar-icon",type:"button",title:b,"aria-label":w,"aria-expanded":d.optionsOpen,"aria-controls":"options-menu",onClick:I,children:N}),e[38]=d.optionsOpen,e[39]=b,e[40]=w,e[41]=I,e[42]=P):P=e[42];let _;e[43]!==n||e[44]!==d.filesVisible?(_=d.filesVisible?n("hideFiles"):n("showFiles"),e[43]=n,e[44]=d.filesVisible,e[45]=_):_=e[45];let B;e[46]!==n||e[47]!==d.filesVisible?(B=d.filesVisible?n("hideFiles"):n("showFiles"),e[46]=n,e[47]=d.filesVisible,e[48]=B):B=e[48];let M;e[49]!==i||e[50]!==d.filesVisible?(M=()=>i({type:"set-files-visible",visible:!d.filesVisible}),e[49]=i,e[50]=d.filesVisible,e[51]=M):M=e[51];let D;e[52]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(X,{name:"files"}),e[52]=D):D=e[52];let T;e[53]!==d.filesVisible||e[54]!==_||e[55]!==B||e[56]!==M?(T=s.jsx("button",{id:"files-toggle",className:"toolbar-icon",type:"button",title:_,"aria-label":B,"aria-pressed":d.filesVisible,onClick:M,children:D}),e[53]=d.filesVisible,e[54]=_,e[55]=B,e[56]=M,e[57]=T):T=e[57];let C;e[58]!==d.copyFeedback?(C=s.jsx("span",{id:"copy-feedback",className:"visually-hidden","aria-live":"polite",children:d.copyFeedback}),e[58]=d.copyFeedback,e[59]=C):C=e[59];let z;e[60]!==P||e[61]!==T||e[62]!==C||e[63]!==h||e[64]!==x?(z=s.jsxs("div",{className:"toolbar-actions flex shrink-0 items-center gap-1.5",children:[h,x,P,T,C]}),e[60]=P,e[61]=T,e[62]=C,e[63]=h,e[64]=x,e[65]=z):z=e[65];let F;e[66]!==i||e[67]!==n||e[68]!==o||e[69]!==l||e[70]!==d?(F=d.optionsOpen?s.jsx(ei,{dispatch:i,label:n,onCopyGitApply:o,onReload:l,state:d}):null,e[66]=i,e[67]=n,e[68]=o,e[69]=l,e[70]=d,e[71]=F):F=e[71];let k;return e[72]!==m||e[73]!==z||e[74]!==F||e[75]!==g?(k=s.jsxs("header",{id:"toolbar",children:[m,g,z,F]}),e[72]=m,e[73]=z,e[74]=F,e[75]=g,e[76]=k):k=e[76],k}function Jt(t){const e=L.c(24),{label:r,onNavigate:i,payload:n}=t;let o;e[0]!==r?(o=r("diffTarget"),e[0]=r,e[1]=o):o=e[1];let a;e[2]!==i||e[3]!==n.sourceOptions||e[4]!==o?(a=s.jsx(be,{ariaLabel:o,fallbackValue:"",id:"source-select",options:n.sourceOptions,onNavigate:i}),e[2]=i,e[3]=n.sourceOptions,e[4]=o,e[5]=a):a=e[5];let c;e[6]!==r?(c=r("repoPath"),e[6]=r,e[7]=c):c=e[7];const l=n.repoRoot??"";let f;e[8]!==i||e[9]!==n.repoOptions||e[10]!==c||e[11]!==l?(f=s.jsx(be,{ariaLabel:c,fallbackValue:l,id:"repo-select",options:n.repoOptions,onNavigate:i}),e[8]=i,e[9]=n.repoOptions,e[10]=c,e[11]=l,e[12]=f):f=e[12];let d;e[13]!==r?(d=r("branchBase"),e[13]=r,e[14]=d):d=e[14];const u=n.branchBaseRef??"";let p;e[15]!==i||e[16]!==n.baseOptions||e[17]!==d||e[18]!==u?(p=s.jsx(be,{ariaLabel:d,fallbackValue:u,id:"base-select",options:n.baseOptions,onNavigate:i}),e[15]=i,e[16]=n.baseOptions,e[17]=d,e[18]=u,e[19]=p):p=e[19];let m;return e[20]!==a||e[21]!==f||e[22]!==p?(m=s.jsxs("div",{className:"toolbar-left flex min-w-0 items-center gap-1.5",children:[a,f,p]}),e[20]=a,e[21]=f,e[22]=p,e[23]=m):m=e[23],m}function be(t){const e=L.c(15),{ariaLabel:r,fallbackValue:i,id:n,onNavigate:o,options:a}=t;if(!Array.isArray(a)||a.length<2)return null;let c;e[0]!==a?(c=a.find(Qt)??a.find(Yt),e[0]=a,e[1]=c):c=e[1];const l=c,f=l?.value??i;let d;e[2]!==i||e[3]!==o||e[4]!==a||e[5]!==l?.value?(d=m=>{const g=a.find(h=>h.value===m.currentTarget.value);if(!g?.url){m.currentTarget.value=l?.value??i;return}o(g.url)},e[2]=i,e[3]=o,e[4]=a,e[5]=l?.value,e[6]=d):d=e[6];let u;e[7]!==a?(u=a.map(Xt),e[7]=a,e[8]=u):u=e[8];let p;return e[9]!==r||e[10]!==n||e[11]!==f||e[12]!==d||e[13]!==u?(p=s.jsx("select",{id:n,"aria-label":r,defaultValue:f,title:r,onChange:d,children:u}),e[9]=r,e[10]=n,e[11]=f,e[12]=d,e[13]=u,e[14]=p):p=e[14],p}function Xt(t){return s.jsx("option",{value:t.value,disabled:t.disabled||!t.url,title:t.message,children:t.label},t.value)}function Yt(t){return!t.disabled}function Qt(t){return t.selected}function Zt(t){const e=L.c(19),{items:r,label:i,onJump:n,selectedItemId:o}=t;if(r.length===0)return null;let a;e[0]!==i?(a=i("jumpToFile"),e[0]=i,e[1]=a):a=e[1];let c;e[2]!==n?(c=p=>n(p.currentTarget.value),e[2]=n,e[3]=c):c=e[3];let l;e[4]!==i?(l=i("jumpToFile"),e[4]=i,e[5]=l):l=e[5];let f;e[6]!==l?(f=s.jsx("option",{value:"",children:l}),e[6]=l,e[7]=f):f=e[7];let d;if(e[8]!==r||e[9]!==i){let p;e[11]!==i?(p=m=>s.jsx("option",{value:m.id,children:Se(m.fileDiff,i("untitled"))},m.id),e[11]=i,e[12]=p):p=e[12],d=r.map(p),e[8]=r,e[9]=i,e[10]=d}else d=e[10];let u;return e[13]!==o||e[14]!==a||e[15]!==c||e[16]!==f||e[17]!==d?(u=s.jsxs("select",{id:"jump-select","aria-label":a,value:o,onChange:c,children:[f,d]}),e[13]=o,e[14]=a,e[15]=c,e[16]=f,e[17]=d,e[18]=u):u=e[18],u}function ei(t){const e=L.c(122),{dispatch:r,label:i,onCopyGitApply:n,onReload:o,state:a}=t;let c;e[0]!==r||e[1]!==a.options?(c=q=>r({type:"set-option",key:q,value:!a.options[q]}),e[0]=r,e[1]=a.options,e[2]=c):c=e[2];const l=c;let f;e[3]!==i?(f=i("options"),e[3]=i,e[4]=f):f=e[4];let d;e[5]!==i?(d=i("refresh"),e[5]=i,e[6]=d):d=e[6];let u;e[7]!==o||e[8]!==d?(u=s.jsx(J,{icon:"refresh",label:d,onClick:o}),e[7]=o,e[8]=d,e[9]=u):u=e[9];let p;e[10]!==i||e[11]!==a.options.wordWrap?(p=a.options.wordWrap?i("disableWordWrap"):i("enableWordWrap"),e[10]=i,e[11]=a.options.wordWrap,e[12]=p):p=e[12];let m;e[13]!==l?(m=()=>l("wordWrap"),e[13]=l,e[14]=m):m=e[14];let g;e[15]!==a.options.wordWrap||e[16]!==p||e[17]!==m?(g=s.jsx(J,{checked:a.options.wordWrap,icon:"wrap",label:p,onClick:m}),e[15]=a.options.wordWrap,e[16]=p,e[17]=m,e[18]=g):g=e[18];const h=a.options.collapsed?"expand":"collapse";let y;e[19]!==i||e[20]!==a.options.collapsed?(y=a.options.collapsed?i("expandAllDiffs"):i("collapseAllDiffs"),e[19]=i,e[20]=a.options.collapsed,e[21]=y):y=e[21];let j;e[22]!==l?(j=()=>l("collapsed"),e[22]=l,e[23]=j):j=e[23];let v;e[24]!==a.options.collapsed||e[25]!==j||e[26]!==h||e[27]!==y?(v=s.jsx(J,{checked:a.options.collapsed,icon:h,label:y,onClick:j}),e[24]=a.options.collapsed,e[25]=j,e[26]=h,e[27]=y,e[28]=v):v=e[28];let S;e[29]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("div",{className:"menu-separator"}),e[29]=S):S=e[29];let x;e[30]!==i||e[31]!==a.filesVisible?(x=a.filesVisible?i("hideFiles"):i("showFiles"),e[30]=i,e[31]=a.filesVisible,e[32]=x):x=e[32];let b;e[33]!==r||e[34]!==a.filesVisible?(b=()=>r({type:"set-files-visible",visible:!a.filesVisible}),e[33]=r,e[34]=a.filesVisible,e[35]=b):b=e[35];let w;e[36]!==a.filesVisible||e[37]!==x||e[38]!==b?(w=s.jsx(J,{checked:a.filesVisible,icon:"files",label:x,onClick:b}),e[36]=a.filesVisible,e[37]=x,e[38]=b,e[39]=w):w=e[39];let I;e[40]!==i||e[41]!==a.options.expandUnchanged?(I=a.options.expandUnchanged?i("collapseUnchangedContext"):i("expandUnchangedContext"),e[40]=i,e[41]=a.options.expandUnchanged,e[42]=I):I=e[42];let N;e[43]!==l?(N=()=>l("expandUnchanged"),e[43]=l,e[44]=N):N=e[44];let P;e[45]!==a.options.expandUnchanged||e[46]!==I||e[47]!==N?(P=s.jsx(J,{checked:a.options.expandUnchanged,icon:"document",label:I,onClick:N}),e[45]=a.options.expandUnchanged,e[46]=I,e[47]=N,e[48]=P):P=e[48];let _;e[49]!==i||e[50]!==a.options.showBackgrounds?(_=a.options.showBackgrounds?i("hideBackgrounds"):i("showBackgrounds"),e[49]=i,e[50]=a.options.showBackgrounds,e[51]=_):_=e[51];let B;e[52]!==l?(B=()=>l("showBackgrounds"),e[52]=l,e[53]=B):B=e[53];let M;e[54]!==a.options.showBackgrounds||e[55]!==_||e[56]!==B?(M=s.jsx(J,{checked:a.options.showBackgrounds,icon:"background",label:_,onClick:B}),e[54]=a.options.showBackgrounds,e[55]=_,e[56]=B,e[57]=M):M=e[57];let D;e[58]!==i||e[59]!==a.options.lineNumbers?(D=a.options.lineNumbers?i("hideLineNumbers"):i("showLineNumbers"),e[58]=i,e[59]=a.options.lineNumbers,e[60]=D):D=e[60];let T;e[61]!==l?(T=()=>l("lineNumbers"),e[61]=l,e[62]=T):T=e[62];let C;e[63]!==a.options.lineNumbers||e[64]!==D||e[65]!==T?(C=s.jsx(J,{checked:a.options.lineNumbers,icon:"numbers",label:D,onClick:T}),e[63]=a.options.lineNumbers,e[64]=D,e[65]=T,e[66]=C):C=e[66];let z;e[67]!==i||e[68]!==a.options.wordDiffs?(z=a.options.wordDiffs?i("disableWordDiffs"):i("enableWordDiffs"),e[67]=i,e[68]=a.options.wordDiffs,e[69]=z):z=e[69];let F;e[70]!==l?(F=()=>l("wordDiffs"),e[70]=l,e[71]=F):F=e[71];let k;e[72]!==a.options.wordDiffs||e[73]!==z||e[74]!==F?(k=s.jsx(J,{checked:a.options.wordDiffs,icon:"word",label:z,onClick:F}),e[72]=a.options.wordDiffs,e[73]=z,e[74]=F,e[75]=k):k=e[75];let E;e[76]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx(X,{name:"bars"}),e[76]=E):E=e[76];let V;e[77]!==i?(V=i("indicatorStyle"),e[77]=i,e[78]=V):V=e[78];let W;e[79]!==V?(W=s.jsx("span",{className:"menu-label",children:V}),e[79]=V,e[80]=W):W=e[80];let A;e[81]!==i?(A=i("bars"),e[81]=i,e[82]=A):A=e[82];let U;e[83]!==A?(U={value:"bars",icon:"bars",label:A},e[83]=A,e[84]=U):U=e[84];let G;e[85]!==i?(G=i("classic"),e[85]=i,e[86]=G):G=e[86];let O;e[87]!==G?(O={value:"classic",icon:"classic",label:G},e[87]=G,e[88]=O):O=e[88];let H;e[89]!==i?(H=i("none"),e[89]=i,e[90]=H):H=e[90];let Q;e[91]!==H?(Q={value:"none",icon:"eye",label:H},e[91]=H,e[92]=Q):Q=e[92];let Z;e[93]!==U||e[94]!==O||e[95]!==Q?(Z=[U,O,Q],e[93]=U,e[94]=O,e[95]=Q,e[96]=Z):Z=e[96];let ee;e[97]!==r||e[98]!==a.options.diffIndicators||e[99]!==Z?(ee=s.jsx("span",{className:"menu-segment-controls",children:Z.map(q=>s.jsx("button",{type:"button",className:"segment-button",title:q.label,"aria-label":q.label,"aria-pressed":a.options.diffIndicators===q.value,onClick:()=>r({type:"set-option",key:"diffIndicators",value:q.value}),children:s.jsx(X,{name:q.icon})},q.value))}),e[97]=r,e[98]=a.options.diffIndicators,e[99]=Z,e[100]=ee):ee=e[100];let te;e[101]!==W||e[102]!==ee?(te=s.jsxs("div",{className:"menu-item menu-segment",children:[E,W,ee]}),e[101]=W,e[102]=ee,e[103]=te):te=e[103];let ne;e[104]===Symbol.for("react.memo_cache_sentinel")?(ne=s.jsx("div",{className:"menu-separator"}),e[104]=ne):ne=e[104];let ie;e[105]!==i?(ie=i("copyGitApplyCommand"),e[105]=i,e[106]=ie):ie=e[106];let re;e[107]!==n||e[108]!==ie?(re=s.jsx(J,{icon:"clipboard",label:ie,onClick:n}),e[107]=n,e[108]=ie,e[109]=re):re=e[109];let oe;return e[110]!==v||e[111]!==w||e[112]!==P||e[113]!==f||e[114]!==M||e[115]!==C||e[116]!==k||e[117]!==te||e[118]!==u||e[119]!==re||e[120]!==g?(oe=s.jsxs("div",{id:"options-menu","aria-label":f,children:[u,g,v,S,w,P,M,C,k,te,ne,re]}),e[110]=v,e[111]=w,e[112]=P,e[113]=f,e[114]=M,e[115]=C,e[116]=k,e[117]=te,e[118]=u,e[119]=re,e[120]=g,e[121]=oe):oe=e[121],oe}function J(t){const e=L.c(14),{checked:r,icon:i,label:n,onClick:o}=t,a=r??void 0;let c;e[0]!==i?(c=s.jsx(X,{name:i}),e[0]=i,e[1]=c):c=e[1];let l;e[2]!==n?(l=s.jsx("span",{className:"menu-label",children:n}),e[2]=n,e[3]=l):l=e[3];let f;e[4]!==r?(f=r?s.jsx(X,{name:"check"}):null,e[4]=r,e[5]=f):f=e[5];let d;e[6]!==f?(d=s.jsx("span",{className:"menu-check",children:f}),e[6]=f,e[7]=d):d=e[7];let u;return e[8]!==o||e[9]!==a||e[10]!==c||e[11]!==l||e[12]!==d?(u=s.jsxs("button",{type:"button",className:"menu-item","aria-pressed":a,onClick:o,children:[c,l,d]}),e[8]=o,e[9]=a,e[10]=c,e[11]=l,e[12]=d,e[13]=u):u=e[13],u}function ti(t){const e=L.c(63),{dispatch:r,label:i,onSelectItem:n,selectedPath:o,state:a}=t,c=R.useRef(null);let l;e[0]!==r?(l=k=>{const E=c.current;if(!E)return;const V=document.documentElement.clientWidth||window.innerWidth,W=Math.max(220,Math.min(520,Math.floor(V*.55))),A=Math.max(180,Math.min(W,Math.round(E.startWidth-(k-E.startX))));r({type:"set-files-width",width:A})},e[0]=r,e[1]=l):l=e[1];const f=l;let d;e[2]!==i?(d=i("changedFiles"),e[2]=i,e[3]=d):d=e[3];const u=!a.filesVisible,p=!a.filesVisible;let m;e[4]!==i?(m=i("files"),e[4]=i,e[5]=m):m=e[5];let g;e[6]!==a.filesWidth?(g=k=>{c.current={startWidth:a.filesWidth,startX:k.clientX},k.currentTarget.setPointerCapture(k.pointerId)},e[6]=a.filesWidth,e[7]=g):g=e[7];let h,y;e[8]!==f?(h=k=>f(k.clientX),y=k=>{f(k.clientX),c.current=null,k.currentTarget.releasePointerCapture(k.pointerId)},e[8]=f,e[9]=h,e[10]=y):(h=e[9],y=e[10]);let j;e[11]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{c.current=null},e[11]=j):j=e[11];let v;e[12]!==r||e[13]!==a.filesWidth?(v=k=>{if(k.key!=="ArrowLeft"&&k.key!=="ArrowRight")return;k.preventDefault();const E=k.key==="ArrowLeft"?20:-20;r({type:"set-files-width",width:Math.max(180,Math.min(520,a.filesWidth+E))})},e[12]=r,e[13]=a.filesWidth,e[14]=v):v=e[14];let S;e[15]!==v||e[16]!==m||e[17]!==g||e[18]!==h||e[19]!==y?(S=s.jsx("button",{id:"files-resize-handle","aria-label":m,type:"button",tabIndex:0,onPointerDown:g,onPointerMove:h,onPointerUp:y,onPointerCancel:j,onKeyDown:v}),e[15]=v,e[16]=m,e[17]=g,e[18]=h,e[19]=y,e[20]=S):S=e[20];let x;e[21]!==i?(x=i("files"),e[21]=i,e[22]=x):x=e[22];let b;e[23]!==x?(b=s.jsx("span",{children:x}),e[23]=x,e[24]=b):b=e[24];const w=a.treeSource?.pathCount??0;let I;e[25]!==w?(I=s.jsx("span",{id:"files-count",children:w}),e[25]=w,e[26]=I):I=e[26];let N;e[27]!==b||e[28]!==I?(N=s.jsxs("span",{id:"files-title",children:[b,I]}),e[27]=b,e[28]=I,e[29]=N):N=e[29];let P;e[30]!==i||e[31]!==a.fileSearchOpen?(P=a.fileSearchOpen?i("hideFileSearch"):i("showFileSearch"),e[30]=i,e[31]=a.fileSearchOpen,e[32]=P):P=e[32];let _;e[33]!==i||e[34]!==a.fileSearchOpen?(_=a.fileSearchOpen?i("hideFileSearch"):i("showFileSearch"),e[33]=i,e[34]=a.fileSearchOpen,e[35]=_):_=e[35];const B=!a.treeSource;let M;e[36]!==r||e[37]!==a.fileSearchOpen?(M=()=>r({type:"set-file-search-open",open:!a.fileSearchOpen}),e[36]=r,e[37]=a.fileSearchOpen,e[38]=M):M=e[38];let D;e[39]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(X,{name:"search"}),e[39]=D):D=e[39];let T;e[40]!==a.fileSearchOpen||e[41]!==P||e[42]!==_||e[43]!==B||e[44]!==M?(T=s.jsx("span",{id:"files-header-actions",children:s.jsx("button",{id:"file-search-toggle",type:"button",title:P,"aria-label":_,"aria-pressed":a.fileSearchOpen,disabled:B,onClick:M,children:D})}),e[40]=a.fileSearchOpen,e[41]=P,e[42]=_,e[43]=B,e[44]=M,e[45]=T):T=e[45];let C;e[46]!==N||e[47]!==T?(C=s.jsxs("div",{id:"files-header",children:[N,T]}),e[46]=N,e[47]=T,e[48]=C):C=e[48];let z;e[49]!==i||e[50]!==n||e[51]!==o||e[52]!==a.fileSearchOpen||e[53]!==a.status||e[54]!==a.treeSource?(z=s.jsx("div",{id:"file-list",children:a.treeSource?s.jsx(ii,{fileSearchOpen:a.fileSearchOpen,label:i,onSelectItem:n,selectedPath:o,source:a.treeSource}):a.status.loading||a.status.pending?s.jsx(ai,{}):s.jsx("div",{className:"visually-hidden",children:a.status.message})}),e[49]=i,e[50]=n,e[51]=o,e[52]=a.fileSearchOpen,e[53]=a.status,e[54]=a.treeSource,e[55]=z):z=e[55];let F;return e[56]!==S||e[57]!==d||e[58]!==C||e[59]!==z||e[60]!==u||e[61]!==p?(F=s.jsxs("aside",{id:"files-sidebar","aria-label":d,"aria-hidden":u,inert:p,children:[S,C,z]}),e[56]=S,e[57]=d,e[58]=C,e[59]=z,e[60]=u,e[61]=p,e[62]=F):F=e[62],F}function ii(t){const e=L.c(18),{fileSearchOpen:r,label:i,onSelectItem:n,selectedPath:o,source:a}=t;let c;e[0]!==i||e[1]!==n||e[2]!==a?(c={label:i,onSelectItem:n,source:a},e[0]=i,e[1]=n,e[2]=a,e[3]=c):c=e[3];const l=Ve(c);let f;e[4]!==a.paths?(f=()=>ve(a.paths),e[4]=a.paths,e[5]=f):f=e[5];const[d]=R.useState(f);let u;e[6]!==o?(u=o?[o]:[],e[6]=o,e[7]=u):u=e[7];let p;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=We(),e[8]=p):p=e[8];const m=a.gitStatus;let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=_t(),e[9]=g):g=e[9];let h;e[10]!==d||e[11]!==l||e[12]!==u||e[13]!==m?(h={flattenEmptyDirectories:!1,id:"cmux-diff-file-tree",initialExpansion:"open",initialSelectedPaths:u,initialVisibleRowCount:p,itemHeight:24,overscan:12,preparedInput:d,search:!0,searchBlurBehavior:"retain",stickyFolders:!0,gitStatus:m,sort:ri,unsafeCSS:g,onSelectionChange(S){const x=S[S.length-1],b=l.current.source.pathToItemId.get(x);b&&l.current.onSelectItem(b)}},e[10]=d,e[11]=l,e[12]=u,e[13]=m,e[14]=h):h=e[14];const{model:y}=Ke(h);pi(y,a),gi(y,r),hi(y,o);let j;e[15]===Symbol.for("react.memo_cache_sentinel")?(j={height:"100%"},e[15]=j):j=e[15];let v;return e[16]!==y?(v=s.jsx(qe,{model:y,style:j}),e[16]=y,e[17]=v):v=e[17],v}function ri(){return 0}function ai(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"diff-loading-placeholder","aria-hidden":"true",children:Nt.map(ni)}),t[0]=e):e=t[0],e}function ni(t,e){return s.jsxs("div",{className:"grid h-6 grid-cols-[16px_minmax(0,1fr)_44px] items-center gap-2 rounded-[5px] px-[7px]",children:[s.jsx("span",{className:"size-4 rounded-[5px] border border-[color-mix(in_lab,var(--cmux-diff-fg)_18%,transparent)]"}),s.jsx("span",{className:"h-[11px] rounded bg-[var(--cmux-diff-muted-bg)]",style:{width:t}}),s.jsx("span",{className:"h-[11px] justify-self-end rounded bg-[var(--cmux-diff-muted-bg)] opacity-70",style:{width:e%2===0?"34px":"24px"}})]},`${t}-${e}`)}function oi(){const t=L.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"mb-3 grid h-9 grid-cols-[72px_minmax(0,1fr)_96px] items-center gap-3 rounded-md bg-[color-mix(in_lab,var(--cmux-diff-fg)_5%,transparent)] px-3",children:[s.jsx("span",{className:"h-3 rounded bg-[var(--cmux-diff-muted-bg)]"}),s.jsx("span",{className:"h-3 w-2/5 rounded bg-[var(--cmux-diff-muted-bg)]"}),s.jsx("span",{className:"h-3 rounded bg-[var(--cmux-diff-muted-bg)] opacity-70"})]}),t[0]=e):e=t[0];let r;return t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("div",{className:"diff-loading-placeholder mx-3.5 mt-3.5 border-t border-[var(--cmux-diff-border)] pt-3","aria-hidden":"true",children:[e,s.jsx("div",{className:"space-y-[13px] px-3 py-1",children:Rt.map(si)})]}),t[1]=r):r=t[1],r}function si(t,e){return s.jsxs("div",{className:"grid grid-cols-[42px_minmax(0,1fr)] items-center gap-4",children:[s.jsx("span",{className:"h-px bg-[color-mix(in_lab,var(--cmux-diff-fg)_10%,transparent)]"}),s.jsx("span",{className:"h-3 rounded bg-[var(--cmux-diff-muted-bg)]",style:{width:t}})]},`${t}-${e}`)}function li(t){const e=L.c(16),{label:r,status:i}=t;if(!i.loading&&!i.pending&&!i.statusOnly&&!i.error)return null;const n=i.error?"true":"false",o=i.pending?"true":"false";let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("span",{id:"status-icon","aria-hidden":"true"}),e[0]=a):a=e[0];let c;e[1]!==r||e[2]!==i.message?(c=i.message||r("loadingDiff"),e[1]=r,e[2]=i.message,e[3]=c):c=e[3];let l;e[4]!==c?(l=s.jsx("span",{id:"status-text",children:c}),e[4]=c,e[5]=l):l=e[5];let f;e[6]!==n||e[7]!==o||e[8]!==l?(f=s.jsxs("div",{id:"status","data-error":n,"data-pending":o,children:[a,l]}),e[6]=n,e[7]=o,e[8]=l,e[9]=f):f=e[9];let d;e[10]!==i.loading||e[11]!==i.pending?(d=i.loading||i.pending?s.jsx(oi,{}):null,e[10]=i.loading,e[11]=i.pending,e[12]=d):d=e[12];let u;return e[13]!==f||e[14]!==d?(u=s.jsxs("div",{id:"loading-layer","aria-live":"polite",children:[f,d]}),e[13]=f,e[14]=d,e[15]=u):u=e[15],u}function Ve(t){const e=L.c(3),r=R.useRef(t);let i,n;return e[0]!==t?(i=()=>{r.current=t},n=[t],e[0]=t,e[1]=i,e[2]=n):(i=e[1],n=e[2]),R.useEffect(i,n),r}function di(t,e){const r=L.c(5),i=He(),n=R.useRef(null);let o,a;r[0]!==e||r[1]!==t||r[2]!==i?(o=()=>{if(!i||fi(n.current,t))return;let c=!0;return n.current=t,i.setRenderOptions(t).then(()=>{c&&e.current?.getInstance()?.render(!0)}).catch(ci),()=>{c=!1}},a=[e,t,i],r[0]=e,r[1]=t,r[2]=i,r[3]=o,r[4]=a):(o=r[3],a=r[4]),R.useEffect(o,a)}function ci(t){return console.warn("cmux diff worker render options update failed",t)}function fi(t,e){return t?.lineDiffType===e.lineDiffType&&t?.maxLineDiffLength===e.maxLineDiffLength&&t?.preferredHighlighter===e.preferredHighlighter&&ui(t?.theme,e.theme)&&t?.tokenizeMaxLineLength===e.tokenizeMaxLineLength&&t?.useTokenTransformer===e.useTokenTransformer}function ui(t,e){return t===e?!0:typeof t!="object"||t==null||typeof e!="object"||e==null?!1:t.dark===e.dark&&t.light===e.light}function pi(t,e){const r=L.c(4),i=R.useRef(null);let n,o;r[0]!==t||r[1]!==e?(n=()=>{const a=i.current;i.current=e;const c=yt(a,e,e.paths);let l=c.kind==="append"?c.requiresFullGitStatus:!1;if(c.kind==="append"){if(c.addedPaths.length>0)try{t.batch(c.addedPaths.map(mi)),l=!c.sourceFollowsPrevious}catch{const f=ve(e.paths);t.resetPaths(e.paths,{preparedInput:f}),l=!0}}else{const f=ve(e.paths);t.resetPaths(e.paths,{preparedInput:f}),l=!0}kt(t,e,l)},o=[t,e],r[0]=t,r[1]=e,r[2]=n,r[3]=o):(n=r[2],o=r[3]),R.useEffect(n,o)}function mi(t){return{type:"add",path:t}}function gi(t,e){const r=L.c(4);let i,n;r[0]!==e||r[1]!==t?(i=()=>{e?t.openSearch(""):t.closeSearch()},n=[e,t],r[0]=e,r[1]=t,r[2]=i,r[3]=n):(i=r[2],n=r[3]),R.useEffect(i,n)}function hi(t,e){const r=L.c(4);let i,n;r[0]!==t||r[1]!==e?(i=()=>{St(t,e)},n=[t,e],r[0]=t,r[1]=e,r[2]=i,r[3]=n):(i=r[2],n=r[3]),R.useEffect(i,n)}function xi(t,e,r,i){const n=L.c(6),o=R.useRef(!1);let a,c;n[0]!==t||n[1]!==r||n[2]!==e||n[3]!==i?(a=()=>{if(o.current||wi(t.payload))return;o.current=!0;const l=t.payload??{},f=we(l.appearance);f.themes.light.name&&Ie(f.themes.light.name,()=>Promise.resolve(Be(f.themes.light,f))),f.themes.dark.name&&Ie(f.themes.dark.name,()=>Promise.resolve(Be(f.themes.dark,f)));const d=[];r({type:"set-status",status:K(e("parsingDiff"),{loading:!0})}),st({getCollapsed:()=>i.current.options.collapsed,initialFileTreeRowCount:We(),label:e,onBatch:u=>{d.push(...u),r({type:"append-items",items:u})},onComplete:u=>{r({type:"set-metrics",metrics:u});const p=d;if(p.length===0){r({type:"set-status",status:K(e("noFileDiffs"),{error:!0,loading:!1,statusOnly:!0})});return}const m=Array.from(new Set([f.theme?.light,f.theme?.dark].filter(Boolean))),g=Array.from(new Set(p.flatMap(vi)));Ye({themes:m,langs:g.length>0?g:["text"]}).catch(bi)},onMetrics:u=>r({type:"set-metrics",metrics:u}),onRename:u=>r({type:"rename-item",oldId:u.oldId,newId:u.newId}),onTreeSource:u=>r({type:"set-tree-source",source:u}),parsePatchFiles:Xe,patchURL:l.patchURL,processFile:Je}).catch(u=>{console.error("cmux diff viewer render failed",u),r({type:"set-status",status:K(e("renderFailed"),{error:!0,loading:!1,statusOnly:!0})})})},c=[t,r,e,i],n[0]=t,n[1]=r,n[2]=e,n[3]=i,n[4]=a,n[5]=c):(a=n[4],c=n[5]),R.useEffect(a,c)}function bi(t){return console.warn("cmux diff highlighter preload failed",t)}function vi(t){const e=t.fileDiff??{},r=e.lang??Qe(Se(e,""))??"text";return r?[r]:[]}function wi(t){return t?.pendingReplacement===!0||typeof t?.statusMessage=="string"&&t.statusMessage.length>0}function yi(t,e,r){const i=L.c(5),n=R.useRef(!1);let o,a;i[0]!==r||i[1]!==e||i[2]!==t?(o=()=>{if(!n.current){if(n.current=!0,t.pendingReplacement===!0){r({type:"set-status",status:K(t.statusMessage??e("loadingDiff"),{loading:!0,pending:!0})}),fetch("/__cmux_diff_viewer_wait"+location.pathname,{cache:"no-store"}).then(ki).catch(c=>{document.documentElement.dataset.cmuxDiffWait="failed",r({type:"set-status",status:K(e("renderFailed"),{error:!0,loading:!1,statusOnly:!0})}),console.warn("cmux diff viewer deferred load failed",c)});return}typeof t.statusMessage=="string"&&t.statusMessage.length>0&&r({type:"set-status",status:K(t.statusMessage,{error:t.statusIsError===!0,loading:!1,statusOnly:!0})})}},a=[r,e,t],i[0]=r,i[1]=e,i[2]=t,i[3]=o,i[4]=a):(o=i[3],a=i[4]),R.useEffect(o,a)}async function ki(t){if(!t.ok)throw new Error("replacement failed");(await t.text()).includes('data-cmux-diff-pending="true"')||window.location.reload()}function Si(t){const e=L.c(10);let r;e[0]!==t.filesVisible||e[1]!==t.items||e[2]!==t.metrics||e[3]!==t.options.diffIndicators||e[4]!==t.options.layout||e[5]!==t.options.wordWrap||e[6]!==t.status?(r=()=>{document.body.dataset.filesHidden=t.filesVisible?"false":"true",document.body.dataset.loading=t.status.loading?"true":"false",document.documentElement.dataset.layout=t.options.layout,document.documentElement.dataset.wordWrap=String(t.options.wordWrap),document.documentElement.dataset.diffIndicators=t.options.diffIndicators,t.metrics&&(document.body.dataset.streamFileCount=String(t.metrics.fileCount??t.items.length),document.body.dataset.streamRenderableFileCount=String(t.metrics.renderableFileCount??t.items.length),document.body.dataset.streamFlushCount=String(t.metrics.flushCount??0),document.body.dataset.streamMaxBatchSize=String(t.metrics.maxBatchSize??0),document.body.dataset.streamTreeRefreshCount=String(t.metrics.treeRefreshCount??0),Number.isFinite(t.metrics.completedAt)&&t.metrics.completedAt>0&&(document.body.dataset.streamElapsedMs=String(Math.round(t.metrics.completedAt-t.metrics.startedAt)))),je(t.status)},e[0]=t.filesVisible,e[1]=t.items,e[2]=t.metrics,e[3]=t.options.diffIndicators,e[4]=t.options.layout,e[5]=t.options.wordWrap,e[6]=t.status,e[7]=r):r=e[7];let i;e[8]!==t?(i=[t],e[8]=t,e[9]=i):i=e[9],R.useEffect(r,i)}function ji(t,e,r){const i=L.c(12);let n;i[0]!==r||i[1]!==t.diffViewerOpenFileSearch||i[2]!==t.diffViewerScrollDown||i[3]!==t.diffViewerScrollToBottom||i[4]!==t.diffViewerScrollToTop||i[5]!==t.diffViewerScrollUp||i[6]!==e?(n=()=>{const a=ae(t.diffViewerScrollDown),c=ae(t.diffViewerScrollUp),l=ae(t.diffViewerScrollToBottom),f=ae(t.diffViewerScrollToTop),d=ae(t.diffViewerOpenFileSearch);let u=null,p=0;const m=()=>{u=null,p!==0&&(window.clearTimeout(p),p=0)},g=h=>{if(!(h.defaultPrevented||Ci(h.target))){if(u&&!pe(u.shortcut.second,h)&&m(),u&&pe(u.shortcut.second,h)){h.preventDefault(),u.action(),m();return}if(de(a,h)){h.preventDefault(),ze(e.current,1);return}if(de(c,h)){h.preventDefault(),ze(e.current,-1);return}if(de(l,h)){h.preventDefault(),e.current?.scrollTo({top:e.current.scrollHeight,behavior:"auto"});return}if(de(d,h)){h.preventDefault(),r({type:"set-file-search-open",open:!0});return}f&&Mi(f,h)&&(h.preventDefault(),u={shortcut:f,action:()=>e.current?.scrollTo({top:0,behavior:"auto"})},p=window.setTimeout(m,700))}};return document.addEventListener("keydown",g),()=>{m(),document.removeEventListener("keydown",g)}},i[0]=r,i[1]=t.diffViewerOpenFileSearch,i[2]=t.diffViewerScrollDown,i[3]=t.diffViewerScrollToBottom,i[4]=t.diffViewerScrollToTop,i[5]=t.diffViewerScrollUp,i[6]=e,i[7]=n):n=i[7];let o;i[8]!==r||i[9]!==t||i[10]!==e?(o=[r,t,e],i[8]=r,i[9]=t,i[10]=e,i[11]=o):o=i[11],R.useEffect(n,o)}function Ii(t,e){const r=L.c(4);let i,n;r[0]!==e||r[1]!==t?(i=()=>{if(!t)return;const o=c=>{c.target instanceof Element&&c.target.closest("#toolbar")||e({type:"set-options-open",open:!1})},a=c=>{c.key==="Escape"&&e({type:"set-options-open",open:!1})};return document.addEventListener("click",o),document.addEventListener("keydown",a),()=>{document.removeEventListener("click",o),document.removeEventListener("keydown",a)}},n=[e,t],r[0]=e,r[1]=t,r[2]=i,r[3]=n):(i=r[2],n=r[3]),R.useEffect(i,n)}function ae(t){return!t||t.unbound===!0||!t.first?null:{first:Te(t.first),second:t.second?Te(t.second):null}}function Te(t){return{key:String(t?.key??"").toLowerCase(),command:t?.command===!0,shift:t?.shift===!0,option:t?.option===!0,control:t?.control===!0}}function de(t,e){return!!(t&&!t.second&&pe(t.first,e))}function Mi(t,e){return!!(t.second&&pe(t.first,e))}function pe(t,e){return!t||e.metaKey!==t.command||e.ctrlKey!==t.control||e.altKey!==t.option||e.shiftKey!==t.shift?!1:Pi(e)===t.key}function Pi(t){return t.code==="Space"?"space":typeof t.key!="string"||t.key.length===0?"":(t.key.length===1,t.key.toLowerCase())}function Ci(t){return!!(t instanceof Element?t:null)?.closest("input, textarea, select, [contenteditable='true']")}function ze(t,e){if(!t)return;const r=Math.max(80,Math.floor(t.clientHeight*.38));t.scrollBy({top:e*r,behavior:"auto"})}function Fi(t,e){return e.some(r=>r.id===t)?t:e[0]?.id??""}function We(){const t=window.visualViewport?.height??window.innerHeight;return!Number.isFinite(t)||t<=0?25:Math.min(96,Math.max(25,Math.ceil(t/24)))}const _i=`@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-outline-style:solid}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--font-weight-medium:500;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--shadow-xl:0 20px 25px -5px #0000001a, 0 8px 10px -6px #0000001a;--ease-out:cubic-bezier(0, 0, .2, 1);--blur-sm:8px;--blur-lg:16px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.\\@container{container-type:inline-size}.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.top-0{top:calc(var(--spacing) * 0)}.top-1\\/2{top:50%}.right-2\\.5{right:calc(var(--spacing) * 2.5)}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-\\[calc\\(100\\%\\+6px\\)\\]{bottom:calc(100% + 6px)}.bottom-full{bottom:100%}.left-0{left:calc(var(--spacing) * 0)}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.m-px{margin:1px}.mx-3\\.5{margin-inline:calc(var(--spacing) * 3.5)}.ms-1{margin-inline-start:calc(var(--spacing) * 1)}.mt-1\\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-3\\.5{margin-top:calc(var(--spacing) * 3.5)}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-\\[3px\\]{margin-right:3px}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-px{margin-bottom:1px}.ml-1\\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-auto{margin-left:auto}.box-border{box-sizing:border-box}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.aspect-square{aspect-ratio:1}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-16{width:calc(var(--spacing) * 16);height:calc(var(--spacing) * 16)}.size-\\[22px\\]{width:22px;height:22px}.\\!h-auto{height:auto!important}.h-0{height:calc(var(--spacing) * 0)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-\\[1lh\\]{height:1lh}.h-\\[1px\\]{height:1px}.h-\\[11px\\]{height:11px}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.max-h-\\[25dvh\\]{max-height:25dvh}.max-h-\\[140px\\]{max-height:140px}.max-h-none{max-height:none}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-\\[1\\.25rem\\]{min-height:1.25rem}.w-2\\/5{width:40%}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-7{width:calc(var(--spacing) * 7)}.w-52{width:calc(var(--spacing) * 52)}.w-fit{width:fit-content}.w-full{width:100%}.w-max{width:max-content}.w-px{width:1px}.max-w-16{max-width:calc(var(--spacing) * 16)}.max-w-20{max-width:calc(var(--spacing) * 20)}.max-w-40{max-width:calc(var(--spacing) * 40)}.max-w-\\[60\\%\\]{max-width:60%}.max-w-\\[77\\%\\]{max-width:77%}.max-w-\\[320px\\]{max-width:320px}.max-w-full{max-width:100%}.max-w-none{max-width:none}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-56{min-width:calc(var(--spacing) * 56)}.min-w-max{min-width:max-content}.flex-1{flex:1}.flex-none{flex:none}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.resize{resize:both}.grid-cols-\\[16px_minmax\\(0\\,1fr\\)_44px\\]{grid-template-columns:16px minmax(0,1fr) 44px}.grid-cols-\\[42px_minmax\\(0\\,1fr\\)\\]{grid-template-columns:42px minmax(0,1fr)}.grid-cols-\\[72px_minmax\\(0\\,1fr\\)_96px\\]{grid-template-columns:72px minmax(0,1fr) 96px}.grid-cols-\\[auto_minmax\\(0\\,1fr\\)_auto\\]{grid-template-columns:auto minmax(0,1fr) auto}.grid-cols-\\[minmax\\(0\\,auto\\)_auto_minmax\\(0\\,1fr\\)\\]{grid-template-columns:minmax(0,auto) auto minmax(0,1fr)}.flex-col{flex-direction:column}.flex-row-reverse{flex-direction:row-reverse}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-\\[5px\\]{gap:5px}:where(.space-y-\\[13px\\]>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(13px * var(--tw-space-y-reverse));margin-block-end:calc(13px * calc(1 - var(--tw-space-y-reverse)))}.self-start{align-self:flex-start}.justify-self-end{justify-self:flex-end}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-clip{overflow:clip}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-\\[5px\\]{border-radius:5px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-\\[color-mix\\(in_lab\\,var\\(--cmux-diff-fg\\)_18\\%\\,transparent\\)\\]{border-color:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.border-\\[color-mix\\(in_lab\\,var\\(--cmux-diff-fg\\)_18\\%\\,transparent\\)\\]{border-color:color-mix(in lab,var(--cmux-diff-fg) 18%,transparent)}}.border-\\[color\\:var\\(--gray-0\\)\\]{border-color:var(--gray-0)}.border-\\[var\\(--cmux-diff-border\\)\\]{border-color:var(--cmux-diff-border)}.border-transparent{border-color:#0000}.bg-\\[color-mix\\(in_lab\\,var\\(--cmux-diff-fg\\)_5\\%\\,transparent\\)\\]{background-color:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.bg-\\[color-mix\\(in_lab\\,var\\(--cmux-diff-fg\\)_5\\%\\,transparent\\)\\]{background-color:color-mix(in lab,var(--cmux-diff-fg) 5%,transparent)}}.bg-\\[color-mix\\(in_lab\\,var\\(--cmux-diff-fg\\)_10\\%\\,transparent\\)\\]{background-color:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.bg-\\[color-mix\\(in_lab\\,var\\(--cmux-diff-fg\\)_10\\%\\,transparent\\)\\]{background-color:color-mix(in lab,var(--cmux-diff-fg) 10%,transparent)}}.bg-\\[color\\:var\\(--gray-0\\)\\]{background-color:var(--gray-0)}.bg-\\[var\\(--cmux-diff-muted-bg\\)\\]{background-color:var(--cmux-diff-muted-bg)}.\\[mask-image\\:linear-gradient\\(to_right\\,black_calc\\(100\\%_-_0\\.25rem\\)\\,transparent\\)\\]{-webkit-mask-image:linear-gradient(90deg,#000 calc(100% - .25rem),#0000);mask-image:linear-gradient(90deg,#000 calc(100% - .25rem),#0000)}.\\[mask-repeat\\:no-repeat\\]{-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.object-cover{object-fit:cover}.p-0\\.5{padding:calc(var(--spacing) * .5)}.p-2{padding:calc(var(--spacing) * 2)}.\\!px-0{padding-inline:calc(var(--spacing) * 0)!important}.px-0\\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-\\[7px\\]{padding-inline:7px}.px-\\[var\\(--padding-row-x\\)\\]{padding-inline:var(--padding-row-x)}.py-0{padding-block:calc(var(--spacing) * 0)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-\\[var\\(--padding-row-y\\)\\]{padding-block:var(--padding-row-y)}.pt-0\\.5{padding-top:calc(var(--spacing) * .5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pr-0{padding-right:calc(var(--spacing) * 0)}.pr-1{padding-right:calc(var(--spacing) * 1)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.text-left{text-align:left}.align-bottom{vertical-align:bottom}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.\\!leading-none{--tw-leading:1!important;line-height:1!important}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-\\[18px\\]{--tw-leading:18px;line-height:18px}.leading-\\[calc\\(var\\(--codex-chat-font-size\\)\\+8px\\)\\]{--tw-leading:calc(var(--codex-chat-font-size) + 8px);line-height:calc(var(--codex-chat-font-size) + 8px)}.leading-none{--tw-leading:1;line-height:1}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.break-words{overflow-wrap:break-word}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.text-current{color:currentColor}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-\\[0\\.5px\\]{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(.5px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline-hidden{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.outline-hidden{outline-offset:2px;outline:2px solid #0000}}.backdrop-blur-lg{--tw-backdrop-blur:blur(var(--blur-lg));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.select-none{-webkit-user-select:none;user-select:none}.\\[--edge-fade-distance\\:2rem\\]{--edge-fade-distance:2rem}.group-focus-within\\:opacity-100:is(:where(.group):focus-within *){opacity:1}@media(hover:hover){.group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}.hover\\:bg-transparent:hover{background-color:#0000}}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-40:disabled{opacity:.4}.data-\\[state\\=checked\\]\\:translate-x-\\[14px\\][data-state=checked]{--tw-translate-x:14px;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\\[state\\=unchecked\\]\\:translate-x-\\[2px\\][data-state=unchecked]{--tw-translate-x:2px;translate:var(--tw-translate-x) var(--tw-translate-y)}@container (min-width:500px){.\\@\\[500px\\]\\:inline{display:inline}}.\\[\\&_\\.ProseMirror\\]\\:\\!h-5 .ProseMirror{height:calc(var(--spacing) * 5)!important}.\\[\\&_\\.ProseMirror\\]\\:h-auto .ProseMirror{height:auto}.\\[\\&_\\.ProseMirror\\]\\:\\!min-h-5 .ProseMirror{min-height:calc(var(--spacing) * 5)!important}.\\[\\&_\\.ProseMirror\\]\\:min-h-\\[2rem\\] .ProseMirror{min-height:2rem}.\\[\\&_\\.ProseMirror\\]\\:min-w-0 .ProseMirror{min-width:calc(var(--spacing) * 0)}.\\[\\&_\\.ProseMirror\\]\\:flex-1 .ProseMirror{flex:1}.\\[\\&_\\.ProseMirror\\]\\:resize-none .ProseMirror{resize:none}.\\[\\&_\\.ProseMirror\\]\\:overflow-hidden .ProseMirror{overflow:hidden}.\\[\\&_\\.ProseMirror\\]\\:leading-5 .ProseMirror{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.\\[\\&_\\.ProseMirror\\]\\:whitespace-nowrap .ProseMirror{white-space:nowrap}.\\[\\&_\\.ProseMirror\\]\\:focus-visible\\:outline-none .ProseMirror:focus-visible{--tw-outline-style:none;outline-style:none}.\\[\\&_\\.ProseMirror_p\\]\\:m-0 .ProseMirror p{margin:calc(var(--spacing) * 0)}.\\[\\&_\\.ProseMirror_p\\]\\:overflow-hidden .ProseMirror p{overflow:hidden}.\\[\\&_\\.ProseMirror_p\\]\\:text-ellipsis .ProseMirror p{text-overflow:ellipsis}.\\[\\&_\\.ProseMirror_p\\]\\:whitespace-nowrap .ProseMirror p{white-space:nowrap}.\\[\\&_\\.contain-inline-size\\]\\:\\[contain\\:initial\\] .contain-inline-size{contain:initial}.\\[\\&\\>\\*\\:last-child\\]\\:mb-0>:last-child{margin-bottom:calc(var(--spacing) * 0)}.\\[\\&\\>ol\\:first-child\\]\\:mt-0>ol:first-child,.\\[\\&\\>ul\\:first-child\\]\\:mt-0>ul:first-child{margin-top:calc(var(--spacing) * 0)}}:root{color-scheme:light dark;--cmux-diff-bg-light:#fff;--cmux-diff-bg-dark:#000;--cmux-diff-fg-light:#000;--cmux-diff-fg-dark:#fff;--cmux-diff-selection-bg-light:#abd8ff;--cmux-diff-selection-bg-dark:#3f638b;--cmux-diff-ui-font-family:system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;--cmux-diff-ui-font-size:12px;--cmux-diff-ui-line-height:16px;--cmux-diff-code-font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;--cmux-diff-font-size:10px;--cmux-diff-line-height:20px;--cmux-diff-bg:var(--cmux-diff-bg-light);--cmux-diff-fg:var(--cmux-diff-fg-light);--cmux-diff-border:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){:root{--cmux-diff-border:color-mix(in lab, var(--cmux-diff-fg) 12%, transparent)}}:root{--cmux-diff-toolbar-bg:var(--cmux-diff-bg);--cmux-diff-sidebar-bg:var(--cmux-diff-bg);--cmux-diff-muted-bg:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){:root{--cmux-diff-muted-bg:color-mix(in lab, var(--cmux-diff-fg) 8%, transparent)}}:root{--cmux-diff-hover-bg:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){:root{--cmux-diff-hover-bg:color-mix(in lab, var(--cmux-diff-fg) 10%, transparent)}}:root{--cmux-diff-accent:light-dark(#0a84ff,#7ab7ff);--cmux-diff-text-muted:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){:root{--cmux-diff-text-muted:color-mix(in lab, var(--cmux-diff-fg) 72%, var(--cmux-diff-bg))}}:root{--cmux-diff-text-subtle:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){:root{--cmux-diff-text-subtle:color-mix(in lab, var(--cmux-diff-fg) 84%, var(--cmux-diff-bg))}}:root{--cmux-diff-surface-fill-light:var(--cmux-diff-bg-light);--cmux-diff-surface-fill-dark:var(--cmux-diff-bg-dark);--cmux-diff-surface-fill:var(--cmux-diff-surface-fill-light);background:var(--cmux-diff-surface-fill);color:var(--cmux-diff-fg)}@media(prefers-color-scheme:dark){:root{--cmux-diff-bg:var(--cmux-diff-bg-dark);--cmux-diff-fg:var(--cmux-diff-fg-dark);--cmux-diff-surface-fill:var(--cmux-diff-surface-fill-dark)}}*{box-sizing:border-box}html,body{background:var(--cmux-diff-surface-fill);height:100%;overflow:hidden}body{background:var(--cmux-diff-surface-fill);height:100vh;min-height:0;color:var(--cmux-diff-fg);font-family:var(--cmux-diff-ui-font-family);font-size:var(--cmux-diff-ui-font-size);line-height:var(--cmux-diff-ui-line-height);flex-direction:column;margin:0;display:flex;overflow:hidden}#root{background:0 0;height:100%;min-height:0}#app{overscroll-behavior:contain;contain:strict;height:100vh;min-height:0;color:inherit;background:0 0;grid-template-rows:auto minmax(0,1fr);grid-template-columns:minmax(0,1fr);display:grid;overflow:hidden}.copy-fallback-textarea{opacity:0;pointer-events:none;width:1px;height:1px;position:fixed;top:0;left:-9999px}#toolbar{border-bottom:1px solid var(--cmux-diff-border);background:var(--cmux-diff-toolbar-bg);min-height:32px;color:var(--cmux-diff-fg);flex:none;grid-template-columns:minmax(0,1.1fr) minmax(124px,.9fr) auto;align-items:center;gap:7px;padding:3px 4px 3px 8px;display:grid;position:relative}@supports (color:color-mix(in lab,red,red)){#toolbar{color:color-mix(in lab,var(--cmux-diff-fg) 76%,var(--cmux-diff-bg))}}#toolbar{z-index:50}.toolbar-left,.toolbar-middle,.toolbar-actions{align-items:center;min-width:0;display:flex}.toolbar-left,.toolbar-middle{gap:6px}.toolbar-left{justify-self:stretch}.toolbar-middle{justify-content:center}.toolbar-actions{justify-self:end;gap:4px}#source-select,#repo-select,#base-select,#jump-select{appearance:none;background:linear-gradient(45deg,transparent 50%,currentColor 50%) right 11px center / 4px 4px no-repeat,linear-gradient(135deg,currentColor 50%,transparent 50%) right 7px center / 4px 4px no-repeat,var(--cmux-diff-fg);border:1px solid #0000;border-radius:6px;min-width:0;max-width:100%;height:24px;padding:0 24px 0 9px}@supports (color:color-mix(in lab,red,red)){#source-select,#repo-select,#base-select,#jump-select{background:linear-gradient(45deg,transparent 50%,currentColor 50%) right 11px center / 4px 4px no-repeat,linear-gradient(135deg,currentColor 50%,transparent 50%) right 7px center / 4px 4px no-repeat,color-mix(in lab,var(--cmux-diff-fg) 7%,transparent)}}#source-select,#repo-select,#base-select,#jump-select{color:inherit;font:inherit}#source-select{flex:0 118px}#source-select:hover,#repo-select:hover,#base-select:hover,#jump-select:hover{border-color:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){#source-select:hover,#repo-select:hover,#base-select:hover,#jump-select:hover{border-color:color-mix(in lab,var(--cmux-diff-fg) 24%,transparent)}}#source-select:hover,#repo-select:hover,#base-select:hover,#jump-select:hover{background-color:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){#source-select:hover,#repo-select:hover,#base-select:hover,#jump-select:hover{background-color:color-mix(in lab,var(--cmux-diff-fg) 10%,transparent)}}#source-select[hidden],#repo-select[hidden],#base-select[hidden],#jump-select[hidden]{display:none}#jump-select{width:100%}#repo-select{flex:0 132px}#base-select{flex:0 120px}#source-select:focus,#repo-select:focus,#base-select:focus,#jump-select:focus,.toolbar-icon:focus-visible,.menu-item:focus-visible,.file-entry:focus-visible{outline:2px solid var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){#source-select:focus,#repo-select:focus,#base-select:focus,#jump-select:focus,.toolbar-icon:focus-visible,.menu-item:focus-visible,.file-entry:focus-visible{outline:2px solid color-mix(in lab,var(--cmux-diff-fg) 36%,transparent)}}#source-select:focus,#repo-select:focus,#base-select:focus,#jump-select:focus,.toolbar-icon:focus-visible,.menu-item:focus-visible,.file-entry:focus-visible{outline-offset:1px}@media(max-width:760px){#toolbar{grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"source actions""jump actions"}.toolbar-left{grid-area:source}.toolbar-middle{grid-area:jump;justify-content:stretch}.toolbar-actions{grid-area:actions}}.toolbar-icon{width:20px;height:20px;color:var(--cmux-diff-fg);background:0 0;border:1px solid #0000;border-radius:6px;justify-content:center;align-items:center;display:inline-flex}@supports (color:color-mix(in lab,red,red)){.toolbar-icon{color:color-mix(in lab,var(--cmux-diff-fg) 60%,var(--cmux-diff-bg))}}.toolbar-icon{cursor:pointer;padding:0}.toolbar-icon:hover,.toolbar-icon[aria-expanded=true]{border-color:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.toolbar-icon:hover,.toolbar-icon[aria-expanded=true]{border-color:color-mix(in lab,var(--cmux-diff-fg) 14%,transparent)}}.toolbar-icon:hover,.toolbar-icon[aria-expanded=true]{background:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.toolbar-icon:hover,.toolbar-icon[aria-expanded=true]{background:color-mix(in lab,var(--cmux-diff-fg) 9%,transparent)}}.toolbar-icon:hover,.toolbar-icon[aria-expanded=true],.toolbar-icon[aria-pressed=true]{color:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.toolbar-icon[aria-pressed=true]{color:color-mix(in lab,var(--cmux-diff-fg) 78%,var(--cmux-diff-bg))}}.toolbar-icon[hidden]{display:none}.toolbar-icon svg,.menu-item svg{fill:none;stroke:currentColor;stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;width:14px;height:14px;display:block}#layout-toggle svg [data-diff-deletion],#layout-toggle svg [data-diff-addition]{stroke:none}#layout-toggle svg [data-diff-deletion]{fill:light-dark(var(--cmux-diff-deletion-fg-light),var(--cmux-diff-deletion-fg-dark))}#layout-toggle svg [data-diff-addition]{fill:light-dark(var(--cmux-diff-addition-fg-light),var(--cmux-diff-addition-fg-dark))}.toolbar-icon svg [data-precision-dot],.menu-item svg [data-precision-dot]{stroke-width:2px}#options-menu{border:1px solid var(--cmux-diff-fg);min-width:246px;padding:8px;position:absolute;top:calc(100% + 7px);right:10px}@supports (color:color-mix(in lab,red,red)){#options-menu{border:1px solid color-mix(in lab,var(--cmux-diff-fg) 13%,transparent)}}#options-menu{background:var(--cmux-diff-bg);z-index:100;border-radius:8px;box-shadow:0 16px 34px lab(0% none none/.28)}#options-menu[hidden]{display:none}.menu-separator{background:var(--cmux-diff-fg);height:1px;margin:7px 6px}@supports (color:color-mix(in lab,red,red)){.menu-separator{background:color-mix(in lab,var(--cmux-diff-fg) 12%,transparent)}}.menu-item{width:100%;min-height:31px;color:var(--cmux-diff-fg);background:0 0;border:0;border-radius:6px;grid-template-columns:22px minmax(0,1fr) 18px;align-items:center;gap:10px;display:grid}@supports (color:color-mix(in lab,red,red)){.menu-item{color:color-mix(in lab,var(--cmux-diff-fg) 86%,var(--cmux-diff-bg))}}.menu-item{font:inherit;text-align:left;padding:0 7px}.menu-item:hover:not(:disabled){background:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.menu-item:hover:not(:disabled){background:color-mix(in lab,var(--cmux-diff-fg) 10%,transparent)}}.menu-item:hover:not(:disabled){color:var(--cmux-diff-fg)}.menu-segment{cursor:default}.menu-segment:hover{background:0 0}.menu-segment-controls{background:0 0;border-radius:7px;justify-self:end;align-items:center;gap:2px;padding:2px;display:inline-flex}.segment-button{width:27px;height:24px;color:var(--cmux-diff-fg);background:0 0;border:0;border-radius:5px;justify-content:center;align-items:center;display:inline-flex}@supports (color:color-mix(in lab,red,red)){.segment-button{color:color-mix(in lab,var(--cmux-diff-fg) 62%,var(--cmux-diff-bg))}}.segment-button{padding:0}.segment-button:hover,.segment-button[aria-pressed=true]{background:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.segment-button:hover,.segment-button[aria-pressed=true]{background:color-mix(in lab,var(--cmux-diff-fg) 12%,transparent)}}.segment-button:hover,.segment-button[aria-pressed=true],.menu-item:disabled{color:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.menu-item:disabled{color:color-mix(in lab,var(--cmux-diff-fg) 36%,var(--cmux-diff-bg))}}.menu-label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.menu-check{justify-self:end}#content{--cmux-diff-files-width:252px;grid-template-columns:minmax(0,1fr) var(--cmux-diff-files-width);overscroll-behavior:contain;contain:strict;background:0 0;flex:auto;grid-template-rows:minmax(0,1fr);grid-template-areas:"viewer files";min-width:0;min-height:0;display:grid;position:relative;overflow:hidden}body[data-files-hidden=true] #content{grid-template-columns:minmax(0,1fr) 0}body[data-status-only=true] #content{grid-template-columns:minmax(0,1fr);grid-template-areas:"viewer"}#files-sidebar{border-left:1px solid var(--cmux-diff-border);background:var(--cmux-diff-sidebar-bg);contain:strict;opacity:1;flex-direction:column;grid-area:files;width:100%;min-width:0;height:100%;min-height:0;transition:opacity .1s,visibility linear;display:flex;position:relative;overflow:hidden}#files-resize-handle{z-index:3;appearance:none;cursor:col-resize;background:0 0;border:0;outline:none;width:8px;margin:0;padding:0;position:absolute;top:0;bottom:0;left:0}#files-resize-handle:after{content:"";background:0 0;width:1px;position:absolute;top:0;bottom:0;left:0}body[data-files-hidden=true] #files-sidebar{opacity:0;pointer-events:none;visibility:hidden;transition:opacity .1s,visibility 0s linear .1s}body[data-status-only=true] #files-sidebar{display:none}#files-header{z-index:1;border-bottom:1px solid var(--cmux-diff-border);background:var(--cmux-diff-sidebar-bg);min-height:30px;color:var(--cmux-diff-text-muted);justify-content:space-between;align-items:center;gap:8px;padding:0 7px 0 10px;display:flex;position:relative}#files-title{align-items:center;gap:6px;min-width:0;display:inline-flex}#files-header-actions{flex:none;align-items:center;gap:2px;display:inline-flex}#file-search-toggle{width:24px;height:24px;color:var(--cmux-diff-text-muted);background:0 0;border:0;border-radius:5px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}#file-search-toggle:hover,#file-search-toggle[aria-pressed=true]{background:var(--cmux-diff-hover-bg);color:var(--cmux-diff-fg)}#file-search-toggle svg{fill:none;stroke:currentColor;stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;width:15px;height:15px}#file-list{background:var(--cmux-diff-sidebar-bg);--trees-bg-override:var(--cmux-diff-sidebar-bg);--trees-fg-override:var(--cmux-diff-text-subtle);--trees-fg-muted-override:var(--cmux-diff-text-muted);--trees-bg-muted-override:var(--cmux-diff-hover-bg);--trees-selected-bg-override:var(--cmux-diff-fg);flex:auto;min-height:0;padding:6px 4px 6px 6px;overflow:hidden}@supports (color:color-mix(in lab,red,red)){#file-list{--trees-selected-bg-override:color-mix(in lab, var(--cmux-diff-fg) 11%, transparent)}}#file-list{--trees-selected-fg-override:var(--cmux-diff-fg);--trees-selected-focused-border-color-override:transparent;--trees-border-color-override:var(--cmux-diff-border);--trees-focus-ring-color-override:var(--cmux-diff-accent)}@supports (color:color-mix(in lab,red,red)){#file-list{--trees-focus-ring-color-override:color-mix(in lab, var(--cmux-diff-accent) 72%, transparent)}}#file-list{--trees-font-family-override:var(--cmux-diff-ui-font-family);--trees-font-size-override:var(--cmux-diff-ui-font-size);--trees-font-weight-semibold-override:500;--trees-density-override:.78;--trees-border-radius-override:5px;--trees-item-padding-x-override:7px;--trees-item-margin-x-override:0;--trees-padding-inline-override:8px;--trees-search-bg-override:var(--cmux-diff-bg)}@supports (color:color-mix(in lab,red,red)){#file-list{--trees-search-bg-override:color-mix(in lab, var(--cmux-diff-bg) 92%, var(--cmux-diff-fg))}}#file-list{--trees-status-added-override:light-dark(var(--cmux-diff-addition-fg-light),var(--cmux-diff-addition-fg-dark));--trees-status-modified-override:var(--cmux-diff-accent);--trees-status-renamed-override:light-dark(#a26300,#ffd166);--trees-status-deleted-override:light-dark(var(--cmux-diff-deletion-fg-light),var(--cmux-diff-deletion-fg-dark))}body[data-loading=false] .diff-loading-placeholder,body[data-loading=false]:not([data-status-only=true]) #loading-layer{display:none}#file-list file-tree-container{width:100%;height:100%;min-height:0;display:block}.file-entry{width:100%;min-height:30px;color:inherit;font:inherit;text-align:left;background:0 0;border:0;border-radius:6px;grid-template-columns:18px minmax(0,1fr) auto;align-items:center;gap:8px;padding:3px 7px;display:grid}.file-entry:hover,.file-entry[aria-current=true]{background:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.file-entry:hover,.file-entry[aria-current=true]{background:color-mix(in lab,var(--cmux-diff-fg) 9%,transparent)}}.file-status{width:17px;height:17px;color:var(--cmux-diff-text-muted);border:1px solid;border-radius:5px;justify-content:center;align-items:center;font-size:9px;line-height:1;display:inline-flex}.file-name{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.file-stats{color:var(--cmux-diff-text-muted);gap:5px;display:inline-flex}.stat-add{color:light-dark(var(--cmux-diff-addition-fg-light),var(--cmux-diff-addition-fg-dark))}.stat-del{color:light-dark(var(--cmux-diff-deletion-fg-light),var(--cmux-diff-deletion-fg-dark))}#viewer{--diffs-font-family:var(--cmux-diff-code-font-family);--diffs-header-font-family:var(--cmux-diff-ui-font-family);--diffs-font-size:var(--cmux-diff-font-size);--diffs-line-height:var(--cmux-diff-line-height);--diffs-bg-selection-override:light-dark(var(--cmux-diff-selection-bg-light),var(--cmux-diff-selection-bg-dark));overscroll-behavior:contain;overflow-anchor:none;contain:strict;border-bottom:1px solid var(--cmux-diff-border);background:0 0;grid-area:viewer;width:100%;min-width:0;height:100%;min-height:0;position:relative;overflow:clip auto}.code-view-root{overscroll-behavior:contain;overflow-anchor:none;contain:strict;width:100%;min-width:0;height:100%;min-height:0;position:relative;overflow:clip auto}@media(max-width:520px){#content,body[data-files-hidden=true] #content{grid-template-columns:minmax(0,1fr);grid-template-areas:"viewer"}#files-sidebar{display:none}}@media(prefers-reduced-motion:reduce){#files-sidebar{transition:none}}#viewer diffs-container{--diffs-font-family:var(--cmux-diff-code-font-family);--diffs-header-font-family:var(--cmux-diff-ui-font-family);--diffs-font-size:var(--cmux-diff-font-size);--diffs-line-height:var(--cmux-diff-line-height);--diffs-bg-selection-override:light-dark(var(--cmux-diff-selection-bg-light),var(--cmux-diff-selection-bg-dark));contain:layout paint style;display:block;overflow:clip}#loading-layer{z-index:4;pointer-events:none;contain:strict;background:0 0;grid-area:viewer;position:absolute;inset:0;overflow:hidden}body[data-status-only=true] #loading-layer{pointer-events:auto;justify-content:center;align-items:center;width:100%;height:100%;padding:32px;display:flex;position:static}#status{z-index:5;border:1px solid var(--cmux-diff-fg);align-items:center;gap:10px;max-width:calc(100% - 24px);min-height:32px;padding:8px 12px;display:flex;position:absolute;top:10px;left:12px}@supports (color:color-mix(in lab,red,red)){#status{border:1px solid color-mix(in lab,var(--cmux-diff-fg) 10%,transparent)}}#status{background:var(--cmux-diff-bg);font-family:var(--cmux-diff-ui-font-family);font-size:13px;line-height:var(--cmux-diff-ui-line-height);color:var(--cmux-diff-fg);border-radius:7px}@supports (color:color-mix(in lab,red,red)){#status{color:color-mix(in lab,var(--cmux-diff-fg) 70%,var(--cmux-diff-bg))}}body[data-status-only=true] #status{text-align:center;text-wrap:balance;width:auto;max-width:340px;min-height:0;color:var(--cmux-diff-fg);background:0 0;border:0;border-radius:0;flex-direction:column;justify-content:center;align-items:center;gap:14px;padding:0;font-size:14px;line-height:1.55;position:static}@supports (color:color-mix(in lab,red,red)){body[data-status-only=true] #status{color:color-mix(in lab,var(--cmux-diff-fg) 58%,var(--cmux-diff-bg))}}body[data-status-only=true] #status-text{letter-spacing:.005em;font-weight:500}.visually-hidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}#status-icon{display:none}body[data-status-only=true] #status:not([data-error=true]):not([data-pending=true]) #status-icon{background:var(--cmux-diff-fg);border-radius:16px;justify-content:center;align-items:center;width:56px;height:56px;display:flex}@supports (color:color-mix(in lab,red,red)){body[data-status-only=true] #status:not([data-error=true]):not([data-pending=true]) #status-icon{background:color-mix(in lab,var(--cmux-diff-fg) 5%,transparent)}}body[data-status-only=true] #status:not([data-error=true]):not([data-pending=true]) #status-icon{border:1px solid var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){body[data-status-only=true] #status:not([data-error=true]):not([data-pending=true]) #status-icon{border:1px solid color-mix(in lab,var(--cmux-diff-fg) 8%,transparent)}}body[data-status-only=true] #status:not([data-error=true]):not([data-pending=true]) #status-icon:before{content:"";opacity:.8;background-color:currentColor;width:26px;height:26px;display:block;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 2v6h6'/%3E%3Cpath d='M9 13h6'/%3E%3Cpath d='M9 17h4'/%3E%3C/svg%3E") 50%/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 2v6h6'/%3E%3Cpath d='M9 13h6'/%3E%3Cpath d='M9 17h4'/%3E%3C/svg%3E") 50%/contain no-repeat}#status[data-pending=true]:before,body[data-loading=true] #status:before{content:"";border:2px solid var(--cmux-diff-fg);flex:none;width:14px;height:14px}@supports (color:color-mix(in lab,red,red)){#status[data-pending=true]:before,body[data-loading=true] #status:before{border:2px solid color-mix(in lab,var(--cmux-diff-fg) 20%,transparent)}}#status[data-pending=true]:before,body[data-loading=true] #status:before{border-top-color:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){#status[data-pending=true]:before,body[data-loading=true] #status:before{border-top-color:color-mix(in lab,var(--cmux-diff-fg) 70%,var(--cmux-diff-bg))}}#status[data-pending=true]:before,body[data-loading=true] #status:before{border-radius:50%;animation:.8s linear infinite cmuxDiffPendingSpin}#status[data-error=true]{color:light-dark(#b42318,#ff8a80)}@keyframes cmuxDiffPendingSpin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){#status[data-pending=true]:before,body[data-loading=true] #status:before{animation:none}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}`;function Bi(){const t=document.getElementById("cmux-diff-viewer-config");if(!t?.textContent)throw new Error("Missing cmux diff viewer config");return JSON.parse(t.textContent)}function Di(t){const e=Bi();Ze("diff",_i),at(we(e.payload?.appearance)),typeof e.payload?.title=="string"&&e.payload.title.trim()!==""&&(document.title=e.payload.title);const r=Re(e.payload?.labels,{assertMissing:Ne()}),i=Bt(e,r);document.body.dataset.filesHidden="false",je(i);const n=et(()=>s.jsx(Wt,{config:e,initialStatus:i}));Ae.createRoot(t).render(s.jsx($e,{router:n}))}export{Di as mountDiffSurface}; + `}function Be(t,e){const r=t.palette??{},i=nt(t.background,e),n=Y(t.foreground,i,t.type==="light"?"#000000":"#ffffff"),o=(a,c=n)=>Y(a,i,c);return{name:t.name,displayName:t.ghosttyName,type:t.type,colors:{"editor.background":i,"editor.foreground":n,"terminal.background":i,"terminal.foreground":n,"terminal.ansiBlack":o(r[0]),"terminal.ansiRed":o(r[1]),"terminal.ansiGreen":o(r[2]),"terminal.ansiYellow":o(r[3]),"terminal.ansiBlue":o(r[4]),"terminal.ansiMagenta":o(r[5]),"terminal.ansiCyan":o(r[6]),"terminal.ansiWhite":o(r[7]),"terminal.ansiBrightBlack":o(r[8]),"terminal.ansiBrightRed":o(r[9],o(r[1])),"terminal.ansiBrightGreen":o(r[10],o(r[2])),"terminal.ansiBrightYellow":o(r[11],o(r[3])),"terminal.ansiBrightBlue":o(r[12],o(r[4])),"terminal.ansiBrightMagenta":o(r[13],o(r[5])),"terminal.ansiBrightCyan":o(r[14],o(r[6])),"terminal.ansiBrightWhite":o(r[15]),"gitDecoration.addedResourceForeground":o(r[10],o(r[2],"#32d74b")),"gitDecoration.deletedResourceForeground":o(r[9],o(r[1],"#ff453a")),"gitDecoration.modifiedResourceForeground":o(r[12],o(r[4],"#0a84ff")),"editor.selectionBackground":t.selectionBackground,"editor.selectionForeground":t.selectionForeground},tokenColors:[{settings:{foreground:n,background:i}},{scope:["comment","punctuation.definition.comment"],settings:{foreground:o(r[8]),fontStyle:"italic"}},{scope:["string","constant.other.symbol"],settings:{foreground:o(r[2])}},{scope:["constant.numeric","constant.language","support.constant"],settings:{foreground:o(r[3])}},{scope:["keyword","storage","storage.type"],settings:{foreground:o(r[5])}},{scope:["entity.name.function","support.function"],settings:{foreground:o(r[4])}},{scope:["entity.name.type","entity.name.class","support.type"],settings:{foreground:o(r[6])}},{scope:["variable","meta.definition.variable"],settings:{foreground:n}},{scope:["invalid","message.error"],settings:{foreground:o(r[9],o(r[1]))}}]}}function K(t,e={}){const r=e.pending===!0;return{error:e.error===!0,loading:e.loading===!0||r,message:t,pending:r,statusOnly:e.statusOnly===!0}}function Bt(t,e){const r=t.payload;return r?.pendingReplacement===!0?K(r.statusMessage??e("loadingDiff"),{loading:!0,pending:!0}):typeof r?.statusMessage=="string"&&r.statusMessage.length>0?K(r.statusMessage,{error:r.statusIsError===!0,loading:!1,statusOnly:!0}):K(e("loadingDiff"),{loading:!0})}function je(t){document.body.dataset.loading=t.loading?"true":"false",document.body.dataset.statusOnly=t.statusOnly?"true":"false"}const Tt=/\b(Android|iPhone|iPad|iPod|Mobile)\b/i;function zt(t){return Tt.test(t??"")?1:3}function Lt(){return zt(typeof navigator>"u"?void 0:navigator.userAgent)}function Dt(t){return{poolSize:Lt(),workerFactory:()=>new Worker(t,{type:"module"})}}const Nt=["82%","64%","76%","58%","70%","46%"],Rt=["58%","88%","72%","94%","64%","82%","52%","78%"],Ot="./assets/pierre-diffs-1.2.7-trees-1.0.0-beta.4/worker-pool/worker-portable.js",Oe="cmux.diffViewer.layout";function Et(t,e){const r=t.payload??{};return{activeItemId:"",activeTreePath:"",copyFeedback:"",fileSearchOpen:!1,filesWidth:252,filesVisible:!0,items:[],metrics:null,options:{collapsed:!1,diffIndicators:"bars",expandUnchanged:!1,layout:Ut(r),lineNumbers:!0,showBackgrounds:!0,wordDiffs:!1,wordWrap:!1},optionsOpen:!1,status:e,treeSource:null}}function Vt(t,e){switch(e.type){case"append-items":{const r=t.options.collapsed?e.items.map(i=>({...i,collapsed:!0})):e.items;return{...t,activeItemId:t.activeItemId||r[0]?.id||"",items:[...t.items,...r],status:t.status.loading?K("",{loading:!1}):t.status}}case"rename-item":return{...t,activeItemId:t.activeItemId===e.oldId?e.newId:t.activeItemId,items:t.items.map(r=>r.id===e.oldId||r.id===e.newId?{...r,id:e.newId,version:(r.version??0)+1}:r)};case"set-active-item":return{...t,activeItemId:e.itemId,activeTreePath:e.treePath??t.activeTreePath};case"set-copy-feedback":return{...t,copyFeedback:e.message};case"set-file-search-open":return{...t,fileSearchOpen:e.open,filesVisible:e.open?!0:t.filesVisible};case"set-files-width":return{...t,filesWidth:e.width};case"set-files-visible":return{...t,filesVisible:e.visible};case"set-metrics":return{...t,metrics:e.metrics};case"set-option":return e.key==="collapsed"?{...t,options:{...t.options,collapsed:!!e.value},items:t.items.map(r=>({...r,collapsed:!!e.value,version:(r.version??0)+1}))}:{...t,options:{...t.options,[e.key]:e.value}};case"set-options-open":return{...t,optionsOpen:e.open};case"set-status":return{...t,status:e.status};case"set-tree-source":{const r=e.source,i=t.activeItemId?r.treePathByItemId.get(t.activeItemId)??t.activeTreePath:t.activeTreePath;return{...t,activeTreePath:i,treeSource:r}}}}function Wt(t){const e=L.c(65),{config:r,initialStatus:i}=t,n=r.payload??{},o=Re(n.labels,{assertMissing:Ne()}),a=we(n.appearance);let c;e[0]!==r||e[1]!==i?(c=Et(r,i),e[0]=r,e[1]=i,e[2]=c):c=e[2];const[l,f]=R.useReducer(Vt,c),d=Ve(l),u=R.useRef(null),p=R.useRef(null),m=R.useRef(null);let g;if(e[3]!==r.assets?.workerModuleURL){const O=$t(r.assets?.workerModuleURL);g=Dt(O),e[3]=r.assets?.workerModuleURL,e[4]=g}else g=e[4];const h=g,y=Ct(l.options,a),j=Pt(l.options,a);Si(l),yi(n,o,f),xi(r,o,f,d);let v;e[5]!==n.shortcuts?(v=n.shortcuts??{},e[5]=n.shortcuts,e[6]=v):v=e[6],ji(v,m,f),Ii(l.optionsOpen,f);let S;e[7]!==l.activeItemId||e[8]!==l.activeTreePath||e[9]!==l.treeSource?.treePathByItemId?(S=l.treeSource?.treePathByItemId.get(l.activeItemId)??l.activeTreePath,e[7]=l.activeItemId,e[8]=l.activeTreePath,e[9]=l.treeSource?.treePathByItemId,e[10]=S):S=e[10];const x=S;let b;e[11]!==f||e[12]!==l.items||e[13]!==l.treeSource?.treePathByItemId?(b=O=>{const H=Fi(O,l.items);H&&(u.current?.scrollTo({type:"item",id:H,align:"start",behavior:"smooth-auto"}),f({type:"set-active-item",itemId:H,treePath:l.treeSource?.treePathByItemId.get(H)}))},e[11]=f,e[12]=l.items,e[13]=l.treeSource?.treePathByItemId,e[14]=b):b=e[14];const w=b;let I;e[15]!==f?(I=O=>{je(O),f({type:"set-status",status:O})},e[15]=f,e[16]=I):I=e[16];const N=I;let P;e[17]!==f?(P=O=>{Ht(O),f({type:"set-option",key:"layout",value:O})},e[17]=f,e[18]=P):P=e[18];const _=P;let B;e[19]!==f||e[20]!==o||e[21]!==n.patchURL?(B=async()=>{try{const O=await it(n.patchURL,o,p.current);f({type:"set-copy-feedback",message:O})}catch{f({type:"set-copy-feedback",message:o("copyFailedGitApplyCommand")})}},e[19]=f,e[20]=o,e[21]=n.patchURL,e[22]=B):B=e[22];let M;e[23]!==o||e[24]!==N?(M=O=>{N(K(o("loadingDiff"),{pending:!0})),window.location.href=tt(O)},e[23]=o,e[24]=N,e[25]=M):M=e[25];let D;e[26]!==r||e[27]!==f||e[28]!==o||e[29]!==w||e[30]!==_||e[31]!==l||e[32]!==B||e[33]!==M?(D=s.jsx(qt,{config:r,label:o,onCopyGitApply:B,onJump:w,onNavigate:M,onReload:At,onSetLayout:_,dispatch:f,state:l}),e[26]=r,e[27]=f,e[28]=o,e[29]=w,e[30]=_,e[31]=l,e[32]=B,e[33]=M,e[34]=D):D=e[34];const T=`${l.filesWidth}px`;let C;e[35]!==T?(C={"--cmux-diff-files-width":T},e[35]=T,e[36]=C):C=e[36];const z=C;let F;e[37]!==f||e[38]!==o||e[39]!==w||e[40]!==x||e[41]!==l?(F=s.jsx(ti,{label:o,onSelectItem:w,selectedPath:x,dispatch:f,state:l}),e[37]=f,e[38]=o,e[39]=w,e[40]=x,e[41]=l,e[42]=F):F=e[42];let k;e[43]!==o?(k=o("diffViewer"),e[43]=o,e[44]=k):k=e[44];let E;e[45]!==y||e[46]!==j||e[47]!==l.items||e[48]!==h?(E=l.items.length>0?s.jsxs(Ue,{poolOptions:h,highlighterOptions:y,children:[s.jsx(Kt,{codeViewRef:u,highlighterOptions:y}),s.jsx(Ge,{ref:u,className:"code-view-root",containerRef:m,items:l.items,options:j})]}):null,e[45]=y,e[46]=j,e[47]=l.items,e[48]=h,e[49]=E):E=e[49];let V;e[50]!==k||e[51]!==E?(V=s.jsx("main",{id:"viewer","aria-label":k,children:E}),e[50]=k,e[51]=E,e[52]=V):V=e[52];let W;e[53]!==o||e[54]!==l.status?(W=s.jsx(li,{label:o,status:l.status}),e[53]=o,e[54]=l.status,e[55]=W):W=e[55];let A;e[56]!==z||e[57]!==F||e[58]!==V||e[59]!==W?(A=s.jsxs("section",{id:"content",style:z,children:[F,V,W]}),e[56]=z,e[57]=F,e[58]=V,e[59]=W,e[60]=A):A=e[60];let U;e[61]===Symbol.for("react.memo_cache_sentinel")?(U=s.jsx("textarea",{ref:p,"aria-hidden":"true",readOnly:!0,tabIndex:-1,className:"copy-fallback-textarea"}),e[61]=U):U=e[61];let G;return e[62]!==D||e[63]!==A?(G=s.jsxs("div",{id:"app",children:[D,A,U]}),e[62]=D,e[63]=A,e[64]=G):G=e[64],G}function At(){return window.location.reload()}function $t(t){return new URL(t||Ot,window.location.href)}function Ut(t){const e=Ee(t.layout);return t.layoutSource==="explicit"&&e?e:Gt()??e??"unified"}function Gt(){try{return Ee(window.localStorage.getItem(Oe))}catch{return null}}function Ht(t){try{window.localStorage.setItem(Oe,t)}catch{}}function Ee(t){return t==="split"||t==="unified"?t:null}function Kt(t){const{codeViewRef:e,highlighterOptions:r}=t;return di(r,e),null}function qt(t){const e=L.c(77),{config:r,dispatch:i,label:n,onCopyGitApply:o,onJump:a,onNavigate:c,onReload:l,onSetLayout:f,state:d}=t;let u;e[0]!==r.payload?(u=r.payload??{},e[0]=r.payload,e[1]=u):u=e[1];const p=u;let m;e[2]!==n||e[3]!==c||e[4]!==p?(m=s.jsx(Jt,{label:n,onNavigate:c,payload:p}),e[2]=n,e[3]=c,e[4]=p,e[5]=m):m=e[5];let g;e[6]!==n||e[7]!==a||e[8]!==d.activeItemId||e[9]!==d.items?(g=s.jsx("div",{className:"toolbar-middle flex min-w-0 flex-1 items-center justify-center gap-1.5",children:s.jsx(Zt,{items:d.items,label:n,onJump:a,selectedItemId:d.activeItemId})}),e[6]=n,e[7]=a,e[8]=d.activeItemId,e[9]=d.items,e[10]=g):g=e[10];let h;e[11]!==n||e[12]!==p.externalURL?(h=typeof p.externalURL=="string"&&p.externalURL.length>0?s.jsx("a",{id:"external-link",className:"toolbar-icon",href:p.externalURL,target:"_blank",rel:"noreferrer",title:n("openSourceURL"),"aria-label":n("openSourceURL"),children:s.jsx(X,{name:"external"})}):null,e[11]=n,e[12]=p.externalURL,e[13]=h):h=e[13];let y;e[14]!==n||e[15]!==d.options.layout?(y=d.options.layout==="split"?n("switchToUnifiedDiff"):n("switchToSplitDiff"),e[14]=n,e[15]=d.options.layout,e[16]=y):y=e[16];let j;e[17]!==n||e[18]!==d.options.layout?(j=d.options.layout==="split"?n("switchToUnifiedDiff"):n("switchToSplitDiff"),e[17]=n,e[18]=d.options.layout,e[19]=j):j=e[19];let v;e[20]!==f||e[21]!==d.options.layout?(v=()=>f(d.options.layout==="split"?"unified":"split"),e[20]=f,e[21]=d.options.layout,e[22]=v):v=e[22];let S;e[23]!==d.options.layout?(S=s.jsx(X,{name:d.options.layout}),e[23]=d.options.layout,e[24]=S):S=e[24];let x;e[25]!==y||e[26]!==j||e[27]!==v||e[28]!==S?(x=s.jsx("button",{id:"layout-toggle",className:"toolbar-icon",type:"button",title:y,"aria-label":j,onClick:v,children:S}),e[25]=y,e[26]=j,e[27]=v,e[28]=S,e[29]=x):x=e[29];let b;e[30]!==n?(b=n("options"),e[30]=n,e[31]=b):b=e[31];let w;e[32]!==n?(w=n("options"),e[32]=n,e[33]=w):w=e[33];let I;e[34]!==i||e[35]!==d.optionsOpen?(I=()=>i({type:"set-options-open",open:!d.optionsOpen}),e[34]=i,e[35]=d.optionsOpen,e[36]=I):I=e[36];let N;e[37]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(X,{name:"dots"}),e[37]=N):N=e[37];let P;e[38]!==d.optionsOpen||e[39]!==b||e[40]!==w||e[41]!==I?(P=s.jsx("button",{id:"options-button",className:"toolbar-icon",type:"button",title:b,"aria-label":w,"aria-expanded":d.optionsOpen,"aria-controls":"options-menu",onClick:I,children:N}),e[38]=d.optionsOpen,e[39]=b,e[40]=w,e[41]=I,e[42]=P):P=e[42];let _;e[43]!==n||e[44]!==d.filesVisible?(_=d.filesVisible?n("hideFiles"):n("showFiles"),e[43]=n,e[44]=d.filesVisible,e[45]=_):_=e[45];let B;e[46]!==n||e[47]!==d.filesVisible?(B=d.filesVisible?n("hideFiles"):n("showFiles"),e[46]=n,e[47]=d.filesVisible,e[48]=B):B=e[48];let M;e[49]!==i||e[50]!==d.filesVisible?(M=()=>i({type:"set-files-visible",visible:!d.filesVisible}),e[49]=i,e[50]=d.filesVisible,e[51]=M):M=e[51];let D;e[52]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(X,{name:"files"}),e[52]=D):D=e[52];let T;e[53]!==d.filesVisible||e[54]!==_||e[55]!==B||e[56]!==M?(T=s.jsx("button",{id:"files-toggle",className:"toolbar-icon",type:"button",title:_,"aria-label":B,"aria-pressed":d.filesVisible,onClick:M,children:D}),e[53]=d.filesVisible,e[54]=_,e[55]=B,e[56]=M,e[57]=T):T=e[57];let C;e[58]!==d.copyFeedback?(C=s.jsx("span",{id:"copy-feedback",className:"visually-hidden","aria-live":"polite",children:d.copyFeedback}),e[58]=d.copyFeedback,e[59]=C):C=e[59];let z;e[60]!==P||e[61]!==T||e[62]!==C||e[63]!==h||e[64]!==x?(z=s.jsxs("div",{className:"toolbar-actions flex shrink-0 items-center gap-1.5",children:[h,x,P,T,C]}),e[60]=P,e[61]=T,e[62]=C,e[63]=h,e[64]=x,e[65]=z):z=e[65];let F;e[66]!==i||e[67]!==n||e[68]!==o||e[69]!==l||e[70]!==d?(F=d.optionsOpen?s.jsx(ei,{dispatch:i,label:n,onCopyGitApply:o,onReload:l,state:d}):null,e[66]=i,e[67]=n,e[68]=o,e[69]=l,e[70]=d,e[71]=F):F=e[71];let k;return e[72]!==m||e[73]!==z||e[74]!==F||e[75]!==g?(k=s.jsxs("header",{id:"toolbar",children:[m,g,z,F]}),e[72]=m,e[73]=z,e[74]=F,e[75]=g,e[76]=k):k=e[76],k}function Jt(t){const e=L.c(24),{label:r,onNavigate:i,payload:n}=t;let o;e[0]!==r?(o=r("diffTarget"),e[0]=r,e[1]=o):o=e[1];let a;e[2]!==i||e[3]!==n.sourceOptions||e[4]!==o?(a=s.jsx(be,{ariaLabel:o,fallbackValue:"",id:"source-select",options:n.sourceOptions,onNavigate:i}),e[2]=i,e[3]=n.sourceOptions,e[4]=o,e[5]=a):a=e[5];let c;e[6]!==r?(c=r("repoPath"),e[6]=r,e[7]=c):c=e[7];const l=n.repoRoot??"";let f;e[8]!==i||e[9]!==n.repoOptions||e[10]!==c||e[11]!==l?(f=s.jsx(be,{ariaLabel:c,fallbackValue:l,id:"repo-select",options:n.repoOptions,onNavigate:i}),e[8]=i,e[9]=n.repoOptions,e[10]=c,e[11]=l,e[12]=f):f=e[12];let d;e[13]!==r?(d=r("branchBase"),e[13]=r,e[14]=d):d=e[14];const u=n.branchBaseRef??"";let p;e[15]!==i||e[16]!==n.baseOptions||e[17]!==d||e[18]!==u?(p=s.jsx(be,{ariaLabel:d,fallbackValue:u,id:"base-select",options:n.baseOptions,onNavigate:i}),e[15]=i,e[16]=n.baseOptions,e[17]=d,e[18]=u,e[19]=p):p=e[19];let m;return e[20]!==a||e[21]!==f||e[22]!==p?(m=s.jsxs("div",{className:"toolbar-left flex min-w-0 items-center gap-1.5",children:[a,f,p]}),e[20]=a,e[21]=f,e[22]=p,e[23]=m):m=e[23],m}function be(t){const e=L.c(15),{ariaLabel:r,fallbackValue:i,id:n,onNavigate:o,options:a}=t;if(!Array.isArray(a)||a.length<2)return null;let c;e[0]!==a?(c=a.find(Qt)??a.find(Yt),e[0]=a,e[1]=c):c=e[1];const l=c,f=l?.value??i;let d;e[2]!==i||e[3]!==o||e[4]!==a||e[5]!==l?.value?(d=m=>{const g=a.find(h=>h.value===m.currentTarget.value);if(!g?.url){m.currentTarget.value=l?.value??i;return}o(g.url)},e[2]=i,e[3]=o,e[4]=a,e[5]=l?.value,e[6]=d):d=e[6];let u;e[7]!==a?(u=a.map(Xt),e[7]=a,e[8]=u):u=e[8];let p;return e[9]!==r||e[10]!==n||e[11]!==f||e[12]!==d||e[13]!==u?(p=s.jsx("select",{id:n,"aria-label":r,defaultValue:f,title:r,onChange:d,children:u}),e[9]=r,e[10]=n,e[11]=f,e[12]=d,e[13]=u,e[14]=p):p=e[14],p}function Xt(t){return s.jsx("option",{value:t.value,disabled:t.disabled||!t.url,title:t.message,children:t.label},t.value)}function Yt(t){return!t.disabled}function Qt(t){return t.selected}function Zt(t){const e=L.c(19),{items:r,label:i,onJump:n,selectedItemId:o}=t;if(r.length===0)return null;let a;e[0]!==i?(a=i("jumpToFile"),e[0]=i,e[1]=a):a=e[1];let c;e[2]!==n?(c=p=>n(p.currentTarget.value),e[2]=n,e[3]=c):c=e[3];let l;e[4]!==i?(l=i("jumpToFile"),e[4]=i,e[5]=l):l=e[5];let f;e[6]!==l?(f=s.jsx("option",{value:"",children:l}),e[6]=l,e[7]=f):f=e[7];let d;if(e[8]!==r||e[9]!==i){let p;e[11]!==i?(p=m=>s.jsx("option",{value:m.id,children:Se(m.fileDiff,i("untitled"))},m.id),e[11]=i,e[12]=p):p=e[12],d=r.map(p),e[8]=r,e[9]=i,e[10]=d}else d=e[10];let u;return e[13]!==o||e[14]!==a||e[15]!==c||e[16]!==f||e[17]!==d?(u=s.jsxs("select",{id:"jump-select","aria-label":a,value:o,onChange:c,children:[f,d]}),e[13]=o,e[14]=a,e[15]=c,e[16]=f,e[17]=d,e[18]=u):u=e[18],u}function ei(t){const e=L.c(122),{dispatch:r,label:i,onCopyGitApply:n,onReload:o,state:a}=t;let c;e[0]!==r||e[1]!==a.options?(c=q=>r({type:"set-option",key:q,value:!a.options[q]}),e[0]=r,e[1]=a.options,e[2]=c):c=e[2];const l=c;let f;e[3]!==i?(f=i("options"),e[3]=i,e[4]=f):f=e[4];let d;e[5]!==i?(d=i("refresh"),e[5]=i,e[6]=d):d=e[6];let u;e[7]!==o||e[8]!==d?(u=s.jsx(J,{icon:"refresh",label:d,onClick:o}),e[7]=o,e[8]=d,e[9]=u):u=e[9];let p;e[10]!==i||e[11]!==a.options.wordWrap?(p=a.options.wordWrap?i("disableWordWrap"):i("enableWordWrap"),e[10]=i,e[11]=a.options.wordWrap,e[12]=p):p=e[12];let m;e[13]!==l?(m=()=>l("wordWrap"),e[13]=l,e[14]=m):m=e[14];let g;e[15]!==a.options.wordWrap||e[16]!==p||e[17]!==m?(g=s.jsx(J,{checked:a.options.wordWrap,icon:"wrap",label:p,onClick:m}),e[15]=a.options.wordWrap,e[16]=p,e[17]=m,e[18]=g):g=e[18];const h=a.options.collapsed?"expand":"collapse";let y;e[19]!==i||e[20]!==a.options.collapsed?(y=a.options.collapsed?i("expandAllDiffs"):i("collapseAllDiffs"),e[19]=i,e[20]=a.options.collapsed,e[21]=y):y=e[21];let j;e[22]!==l?(j=()=>l("collapsed"),e[22]=l,e[23]=j):j=e[23];let v;e[24]!==a.options.collapsed||e[25]!==j||e[26]!==h||e[27]!==y?(v=s.jsx(J,{checked:a.options.collapsed,icon:h,label:y,onClick:j}),e[24]=a.options.collapsed,e[25]=j,e[26]=h,e[27]=y,e[28]=v):v=e[28];let S;e[29]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("div",{className:"menu-separator"}),e[29]=S):S=e[29];let x;e[30]!==i||e[31]!==a.filesVisible?(x=a.filesVisible?i("hideFiles"):i("showFiles"),e[30]=i,e[31]=a.filesVisible,e[32]=x):x=e[32];let b;e[33]!==r||e[34]!==a.filesVisible?(b=()=>r({type:"set-files-visible",visible:!a.filesVisible}),e[33]=r,e[34]=a.filesVisible,e[35]=b):b=e[35];let w;e[36]!==a.filesVisible||e[37]!==x||e[38]!==b?(w=s.jsx(J,{checked:a.filesVisible,icon:"files",label:x,onClick:b}),e[36]=a.filesVisible,e[37]=x,e[38]=b,e[39]=w):w=e[39];let I;e[40]!==i||e[41]!==a.options.expandUnchanged?(I=a.options.expandUnchanged?i("collapseUnchangedContext"):i("expandUnchangedContext"),e[40]=i,e[41]=a.options.expandUnchanged,e[42]=I):I=e[42];let N;e[43]!==l?(N=()=>l("expandUnchanged"),e[43]=l,e[44]=N):N=e[44];let P;e[45]!==a.options.expandUnchanged||e[46]!==I||e[47]!==N?(P=s.jsx(J,{checked:a.options.expandUnchanged,icon:"document",label:I,onClick:N}),e[45]=a.options.expandUnchanged,e[46]=I,e[47]=N,e[48]=P):P=e[48];let _;e[49]!==i||e[50]!==a.options.showBackgrounds?(_=a.options.showBackgrounds?i("hideBackgrounds"):i("showBackgrounds"),e[49]=i,e[50]=a.options.showBackgrounds,e[51]=_):_=e[51];let B;e[52]!==l?(B=()=>l("showBackgrounds"),e[52]=l,e[53]=B):B=e[53];let M;e[54]!==a.options.showBackgrounds||e[55]!==_||e[56]!==B?(M=s.jsx(J,{checked:a.options.showBackgrounds,icon:"background",label:_,onClick:B}),e[54]=a.options.showBackgrounds,e[55]=_,e[56]=B,e[57]=M):M=e[57];let D;e[58]!==i||e[59]!==a.options.lineNumbers?(D=a.options.lineNumbers?i("hideLineNumbers"):i("showLineNumbers"),e[58]=i,e[59]=a.options.lineNumbers,e[60]=D):D=e[60];let T;e[61]!==l?(T=()=>l("lineNumbers"),e[61]=l,e[62]=T):T=e[62];let C;e[63]!==a.options.lineNumbers||e[64]!==D||e[65]!==T?(C=s.jsx(J,{checked:a.options.lineNumbers,icon:"numbers",label:D,onClick:T}),e[63]=a.options.lineNumbers,e[64]=D,e[65]=T,e[66]=C):C=e[66];let z;e[67]!==i||e[68]!==a.options.wordDiffs?(z=a.options.wordDiffs?i("disableWordDiffs"):i("enableWordDiffs"),e[67]=i,e[68]=a.options.wordDiffs,e[69]=z):z=e[69];let F;e[70]!==l?(F=()=>l("wordDiffs"),e[70]=l,e[71]=F):F=e[71];let k;e[72]!==a.options.wordDiffs||e[73]!==z||e[74]!==F?(k=s.jsx(J,{checked:a.options.wordDiffs,icon:"word",label:z,onClick:F}),e[72]=a.options.wordDiffs,e[73]=z,e[74]=F,e[75]=k):k=e[75];let E;e[76]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx(X,{name:"bars"}),e[76]=E):E=e[76];let V;e[77]!==i?(V=i("indicatorStyle"),e[77]=i,e[78]=V):V=e[78];let W;e[79]!==V?(W=s.jsx("span",{className:"menu-label",children:V}),e[79]=V,e[80]=W):W=e[80];let A;e[81]!==i?(A=i("bars"),e[81]=i,e[82]=A):A=e[82];let U;e[83]!==A?(U={value:"bars",icon:"bars",label:A},e[83]=A,e[84]=U):U=e[84];let G;e[85]!==i?(G=i("classic"),e[85]=i,e[86]=G):G=e[86];let O;e[87]!==G?(O={value:"classic",icon:"classic",label:G},e[87]=G,e[88]=O):O=e[88];let H;e[89]!==i?(H=i("none"),e[89]=i,e[90]=H):H=e[90];let Q;e[91]!==H?(Q={value:"none",icon:"eye",label:H},e[91]=H,e[92]=Q):Q=e[92];let Z;e[93]!==U||e[94]!==O||e[95]!==Q?(Z=[U,O,Q],e[93]=U,e[94]=O,e[95]=Q,e[96]=Z):Z=e[96];let ee;e[97]!==r||e[98]!==a.options.diffIndicators||e[99]!==Z?(ee=s.jsx("span",{className:"menu-segment-controls",children:Z.map(q=>s.jsx("button",{type:"button",className:"segment-button",title:q.label,"aria-label":q.label,"aria-pressed":a.options.diffIndicators===q.value,onClick:()=>r({type:"set-option",key:"diffIndicators",value:q.value}),children:s.jsx(X,{name:q.icon})},q.value))}),e[97]=r,e[98]=a.options.diffIndicators,e[99]=Z,e[100]=ee):ee=e[100];let te;e[101]!==W||e[102]!==ee?(te=s.jsxs("div",{className:"menu-item menu-segment",children:[E,W,ee]}),e[101]=W,e[102]=ee,e[103]=te):te=e[103];let ne;e[104]===Symbol.for("react.memo_cache_sentinel")?(ne=s.jsx("div",{className:"menu-separator"}),e[104]=ne):ne=e[104];let ie;e[105]!==i?(ie=i("copyGitApplyCommand"),e[105]=i,e[106]=ie):ie=e[106];let re;e[107]!==n||e[108]!==ie?(re=s.jsx(J,{icon:"clipboard",label:ie,onClick:n}),e[107]=n,e[108]=ie,e[109]=re):re=e[109];let oe;return e[110]!==v||e[111]!==w||e[112]!==P||e[113]!==f||e[114]!==M||e[115]!==C||e[116]!==k||e[117]!==te||e[118]!==u||e[119]!==re||e[120]!==g?(oe=s.jsxs("div",{id:"options-menu","aria-label":f,children:[u,g,v,S,w,P,M,C,k,te,ne,re]}),e[110]=v,e[111]=w,e[112]=P,e[113]=f,e[114]=M,e[115]=C,e[116]=k,e[117]=te,e[118]=u,e[119]=re,e[120]=g,e[121]=oe):oe=e[121],oe}function J(t){const e=L.c(14),{checked:r,icon:i,label:n,onClick:o}=t,a=r??void 0;let c;e[0]!==i?(c=s.jsx(X,{name:i}),e[0]=i,e[1]=c):c=e[1];let l;e[2]!==n?(l=s.jsx("span",{className:"menu-label",children:n}),e[2]=n,e[3]=l):l=e[3];let f;e[4]!==r?(f=r?s.jsx(X,{name:"check"}):null,e[4]=r,e[5]=f):f=e[5];let d;e[6]!==f?(d=s.jsx("span",{className:"menu-check",children:f}),e[6]=f,e[7]=d):d=e[7];let u;return e[8]!==o||e[9]!==a||e[10]!==c||e[11]!==l||e[12]!==d?(u=s.jsxs("button",{type:"button",className:"menu-item","aria-pressed":a,onClick:o,children:[c,l,d]}),e[8]=o,e[9]=a,e[10]=c,e[11]=l,e[12]=d,e[13]=u):u=e[13],u}function ti(t){const e=L.c(63),{dispatch:r,label:i,onSelectItem:n,selectedPath:o,state:a}=t,c=R.useRef(null);let l;e[0]!==r?(l=k=>{const E=c.current;if(!E)return;const V=document.documentElement.clientWidth||window.innerWidth,W=Math.max(220,Math.min(520,Math.floor(V*.55))),A=Math.max(180,Math.min(W,Math.round(E.startWidth-(k-E.startX))));r({type:"set-files-width",width:A})},e[0]=r,e[1]=l):l=e[1];const f=l;let d;e[2]!==i?(d=i("changedFiles"),e[2]=i,e[3]=d):d=e[3];const u=!a.filesVisible,p=!a.filesVisible;let m;e[4]!==i?(m=i("files"),e[4]=i,e[5]=m):m=e[5];let g;e[6]!==a.filesWidth?(g=k=>{c.current={startWidth:a.filesWidth,startX:k.clientX},k.currentTarget.setPointerCapture(k.pointerId)},e[6]=a.filesWidth,e[7]=g):g=e[7];let h,y;e[8]!==f?(h=k=>f(k.clientX),y=k=>{f(k.clientX),c.current=null,k.currentTarget.releasePointerCapture(k.pointerId)},e[8]=f,e[9]=h,e[10]=y):(h=e[9],y=e[10]);let j;e[11]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{c.current=null},e[11]=j):j=e[11];let v;e[12]!==r||e[13]!==a.filesWidth?(v=k=>{if(k.key!=="ArrowLeft"&&k.key!=="ArrowRight")return;k.preventDefault();const E=k.key==="ArrowLeft"?20:-20;r({type:"set-files-width",width:Math.max(180,Math.min(520,a.filesWidth+E))})},e[12]=r,e[13]=a.filesWidth,e[14]=v):v=e[14];let S;e[15]!==v||e[16]!==m||e[17]!==g||e[18]!==h||e[19]!==y?(S=s.jsx("button",{id:"files-resize-handle","aria-label":m,type:"button",tabIndex:0,onPointerDown:g,onPointerMove:h,onPointerUp:y,onPointerCancel:j,onKeyDown:v}),e[15]=v,e[16]=m,e[17]=g,e[18]=h,e[19]=y,e[20]=S):S=e[20];let x;e[21]!==i?(x=i("files"),e[21]=i,e[22]=x):x=e[22];let b;e[23]!==x?(b=s.jsx("span",{children:x}),e[23]=x,e[24]=b):b=e[24];const w=a.treeSource?.pathCount??0;let I;e[25]!==w?(I=s.jsx("span",{id:"files-count",children:w}),e[25]=w,e[26]=I):I=e[26];let N;e[27]!==b||e[28]!==I?(N=s.jsxs("span",{id:"files-title",children:[b,I]}),e[27]=b,e[28]=I,e[29]=N):N=e[29];let P;e[30]!==i||e[31]!==a.fileSearchOpen?(P=a.fileSearchOpen?i("hideFileSearch"):i("showFileSearch"),e[30]=i,e[31]=a.fileSearchOpen,e[32]=P):P=e[32];let _;e[33]!==i||e[34]!==a.fileSearchOpen?(_=a.fileSearchOpen?i("hideFileSearch"):i("showFileSearch"),e[33]=i,e[34]=a.fileSearchOpen,e[35]=_):_=e[35];const B=!a.treeSource;let M;e[36]!==r||e[37]!==a.fileSearchOpen?(M=()=>r({type:"set-file-search-open",open:!a.fileSearchOpen}),e[36]=r,e[37]=a.fileSearchOpen,e[38]=M):M=e[38];let D;e[39]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(X,{name:"search"}),e[39]=D):D=e[39];let T;e[40]!==a.fileSearchOpen||e[41]!==P||e[42]!==_||e[43]!==B||e[44]!==M?(T=s.jsx("span",{id:"files-header-actions",children:s.jsx("button",{id:"file-search-toggle",type:"button",title:P,"aria-label":_,"aria-pressed":a.fileSearchOpen,disabled:B,onClick:M,children:D})}),e[40]=a.fileSearchOpen,e[41]=P,e[42]=_,e[43]=B,e[44]=M,e[45]=T):T=e[45];let C;e[46]!==N||e[47]!==T?(C=s.jsxs("div",{id:"files-header",children:[N,T]}),e[46]=N,e[47]=T,e[48]=C):C=e[48];let z;e[49]!==i||e[50]!==n||e[51]!==o||e[52]!==a.fileSearchOpen||e[53]!==a.status||e[54]!==a.treeSource?(z=s.jsx("div",{id:"file-list",children:a.treeSource?s.jsx(ii,{fileSearchOpen:a.fileSearchOpen,label:i,onSelectItem:n,selectedPath:o,source:a.treeSource}):a.status.loading||a.status.pending?s.jsx(ai,{}):s.jsx("div",{className:"visually-hidden",children:a.status.message})}),e[49]=i,e[50]=n,e[51]=o,e[52]=a.fileSearchOpen,e[53]=a.status,e[54]=a.treeSource,e[55]=z):z=e[55];let F;return e[56]!==S||e[57]!==d||e[58]!==C||e[59]!==z||e[60]!==u||e[61]!==p?(F=s.jsxs("aside",{id:"files-sidebar","aria-label":d,"aria-hidden":u,inert:p,children:[S,C,z]}),e[56]=S,e[57]=d,e[58]=C,e[59]=z,e[60]=u,e[61]=p,e[62]=F):F=e[62],F}function ii(t){const e=L.c(18),{fileSearchOpen:r,label:i,onSelectItem:n,selectedPath:o,source:a}=t;let c;e[0]!==i||e[1]!==n||e[2]!==a?(c={label:i,onSelectItem:n,source:a},e[0]=i,e[1]=n,e[2]=a,e[3]=c):c=e[3];const l=Ve(c);let f;e[4]!==a.paths?(f=()=>ve(a.paths),e[4]=a.paths,e[5]=f):f=e[5];const[d]=R.useState(f);let u;e[6]!==o?(u=o?[o]:[],e[6]=o,e[7]=u):u=e[7];let p;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=We(),e[8]=p):p=e[8];const m=a.gitStatus;let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=_t(),e[9]=g):g=e[9];let h;e[10]!==d||e[11]!==l||e[12]!==u||e[13]!==m?(h={flattenEmptyDirectories:!1,id:"cmux-diff-file-tree",initialExpansion:"open",initialSelectedPaths:u,initialVisibleRowCount:p,itemHeight:24,overscan:12,preparedInput:d,search:!0,searchBlurBehavior:"retain",stickyFolders:!0,gitStatus:m,sort:ri,unsafeCSS:g,onSelectionChange(S){const x=S[S.length-1],b=l.current.source.pathToItemId.get(x);b&&l.current.onSelectItem(b)}},e[10]=d,e[11]=l,e[12]=u,e[13]=m,e[14]=h):h=e[14];const{model:y}=Ke(h);pi(y,a),gi(y,r),hi(y,o);let j;e[15]===Symbol.for("react.memo_cache_sentinel")?(j={height:"100%"},e[15]=j):j=e[15];let v;return e[16]!==y?(v=s.jsx(qe,{model:y,style:j}),e[16]=y,e[17]=v):v=e[17],v}function ri(){return 0}function ai(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"diff-loading-placeholder","aria-hidden":"true",children:Nt.map(ni)}),t[0]=e):e=t[0],e}function ni(t,e){return s.jsxs("div",{className:"grid h-6 grid-cols-[16px_minmax(0,1fr)_44px] items-center gap-2 rounded-[5px] px-[7px]",children:[s.jsx("span",{className:"size-4 rounded-[5px] border border-[color-mix(in_lab,var(--cmux-diff-fg)_18%,transparent)]"}),s.jsx("span",{className:"h-[11px] rounded bg-[var(--cmux-diff-muted-bg)]",style:{width:t}}),s.jsx("span",{className:"h-[11px] justify-self-end rounded bg-[var(--cmux-diff-muted-bg)] opacity-70",style:{width:e%2===0?"34px":"24px"}})]},`${t}-${e}`)}function oi(){const t=L.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"mb-3 grid h-9 grid-cols-[72px_minmax(0,1fr)_96px] items-center gap-3 rounded-md bg-[color-mix(in_lab,var(--cmux-diff-fg)_5%,transparent)] px-3",children:[s.jsx("span",{className:"h-3 rounded bg-[var(--cmux-diff-muted-bg)]"}),s.jsx("span",{className:"h-3 w-2/5 rounded bg-[var(--cmux-diff-muted-bg)]"}),s.jsx("span",{className:"h-3 rounded bg-[var(--cmux-diff-muted-bg)] opacity-70"})]}),t[0]=e):e=t[0];let r;return t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("div",{className:"diff-loading-placeholder mx-3.5 mt-3.5 border-t border-[var(--cmux-diff-border)] pt-3","aria-hidden":"true",children:[e,s.jsx("div",{className:"space-y-[13px] px-3 py-1",children:Rt.map(si)})]}),t[1]=r):r=t[1],r}function si(t,e){return s.jsxs("div",{className:"grid grid-cols-[42px_minmax(0,1fr)] items-center gap-4",children:[s.jsx("span",{className:"h-px bg-[color-mix(in_lab,var(--cmux-diff-fg)_10%,transparent)]"}),s.jsx("span",{className:"h-3 rounded bg-[var(--cmux-diff-muted-bg)]",style:{width:t}})]},`${t}-${e}`)}function li(t){const e=L.c(16),{label:r,status:i}=t;if(!i.loading&&!i.pending&&!i.statusOnly&&!i.error)return null;const n=i.error?"true":"false",o=i.pending?"true":"false";let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("span",{id:"status-icon","aria-hidden":"true"}),e[0]=a):a=e[0];let c;e[1]!==r||e[2]!==i.message?(c=i.message||r("loadingDiff"),e[1]=r,e[2]=i.message,e[3]=c):c=e[3];let l;e[4]!==c?(l=s.jsx("span",{id:"status-text",children:c}),e[4]=c,e[5]=l):l=e[5];let f;e[6]!==n||e[7]!==o||e[8]!==l?(f=s.jsxs("div",{id:"status","data-error":n,"data-pending":o,children:[a,l]}),e[6]=n,e[7]=o,e[8]=l,e[9]=f):f=e[9];let d;e[10]!==i.loading||e[11]!==i.pending?(d=i.loading||i.pending?s.jsx(oi,{}):null,e[10]=i.loading,e[11]=i.pending,e[12]=d):d=e[12];let u;return e[13]!==f||e[14]!==d?(u=s.jsxs("div",{id:"loading-layer","aria-live":"polite",children:[f,d]}),e[13]=f,e[14]=d,e[15]=u):u=e[15],u}function Ve(t){const e=L.c(3),r=R.useRef(t);let i,n;return e[0]!==t?(i=()=>{r.current=t},n=[t],e[0]=t,e[1]=i,e[2]=n):(i=e[1],n=e[2]),R.useEffect(i,n),r}function di(t,e){const r=L.c(5),i=He(),n=R.useRef(null);let o,a;r[0]!==e||r[1]!==t||r[2]!==i?(o=()=>{if(!i||fi(n.current,t))return;let c=!0;return n.current=t,i.setRenderOptions(t).then(()=>{c&&e.current?.getInstance()?.render(!0)}).catch(ci),()=>{c=!1}},a=[e,t,i],r[0]=e,r[1]=t,r[2]=i,r[3]=o,r[4]=a):(o=r[3],a=r[4]),R.useEffect(o,a)}function ci(t){return console.warn("cmux diff worker render options update failed",t)}function fi(t,e){return t?.lineDiffType===e.lineDiffType&&t?.maxLineDiffLength===e.maxLineDiffLength&&t?.preferredHighlighter===e.preferredHighlighter&&ui(t?.theme,e.theme)&&t?.tokenizeMaxLineLength===e.tokenizeMaxLineLength&&t?.useTokenTransformer===e.useTokenTransformer}function ui(t,e){return t===e?!0:typeof t!="object"||t==null||typeof e!="object"||e==null?!1:t.dark===e.dark&&t.light===e.light}function pi(t,e){const r=L.c(4),i=R.useRef(null);let n,o;r[0]!==t||r[1]!==e?(n=()=>{const a=i.current;i.current=e;const c=yt(a,e,e.paths);let l=c.kind==="append"?c.requiresFullGitStatus:!1;if(c.kind==="append"){if(c.addedPaths.length>0)try{t.batch(c.addedPaths.map(mi)),l=!c.sourceFollowsPrevious}catch{const f=ve(e.paths);t.resetPaths(e.paths,{preparedInput:f}),l=!0}}else{const f=ve(e.paths);t.resetPaths(e.paths,{preparedInput:f}),l=!0}kt(t,e,l)},o=[t,e],r[0]=t,r[1]=e,r[2]=n,r[3]=o):(n=r[2],o=r[3]),R.useEffect(n,o)}function mi(t){return{type:"add",path:t}}function gi(t,e){const r=L.c(4);let i,n;r[0]!==e||r[1]!==t?(i=()=>{e?t.openSearch(""):t.closeSearch()},n=[e,t],r[0]=e,r[1]=t,r[2]=i,r[3]=n):(i=r[2],n=r[3]),R.useEffect(i,n)}function hi(t,e){const r=L.c(4);let i,n;r[0]!==t||r[1]!==e?(i=()=>{St(t,e)},n=[t,e],r[0]=t,r[1]=e,r[2]=i,r[3]=n):(i=r[2],n=r[3]),R.useEffect(i,n)}function xi(t,e,r,i){const n=L.c(6),o=R.useRef(!1);let a,c;n[0]!==t||n[1]!==r||n[2]!==e||n[3]!==i?(a=()=>{if(o.current||wi(t.payload))return;o.current=!0;const l=t.payload??{},f=we(l.appearance);f.themes.light.name&&Ie(f.themes.light.name,()=>Promise.resolve(Be(f.themes.light,f))),f.themes.dark.name&&Ie(f.themes.dark.name,()=>Promise.resolve(Be(f.themes.dark,f)));const d=[];r({type:"set-status",status:K(e("parsingDiff"),{loading:!0})}),st({getCollapsed:()=>i.current.options.collapsed,initialFileTreeRowCount:We(),label:e,onBatch:u=>{d.push(...u),r({type:"append-items",items:u})},onComplete:u=>{r({type:"set-metrics",metrics:u});const p=d;if(p.length===0){r({type:"set-status",status:K(e("noFileDiffs"),{error:!0,loading:!1,statusOnly:!0})});return}const m=Array.from(new Set([f.theme?.light,f.theme?.dark].filter(Boolean))),g=Array.from(new Set(p.flatMap(vi)));Ye({themes:m,langs:g.length>0?g:["text"]}).catch(bi)},onMetrics:u=>r({type:"set-metrics",metrics:u}),onRename:u=>r({type:"rename-item",oldId:u.oldId,newId:u.newId}),onTreeSource:u=>r({type:"set-tree-source",source:u}),parsePatchFiles:Xe,patchURL:l.patchURL,processFile:Je}).catch(u=>{console.error("cmux diff viewer render failed",u),r({type:"set-status",status:K(e("renderFailed"),{error:!0,loading:!1,statusOnly:!0})})})},c=[t,r,e,i],n[0]=t,n[1]=r,n[2]=e,n[3]=i,n[4]=a,n[5]=c):(a=n[4],c=n[5]),R.useEffect(a,c)}function bi(t){return console.warn("cmux diff highlighter preload failed",t)}function vi(t){const e=t.fileDiff??{},r=e.lang??Qe(Se(e,""))??"text";return r?[r]:[]}function wi(t){return t?.pendingReplacement===!0||typeof t?.statusMessage=="string"&&t.statusMessage.length>0}function yi(t,e,r){const i=L.c(5),n=R.useRef(!1);let o,a;i[0]!==r||i[1]!==e||i[2]!==t?(o=()=>{if(!n.current){if(n.current=!0,t.pendingReplacement===!0){r({type:"set-status",status:K(t.statusMessage??e("loadingDiff"),{loading:!0,pending:!0})}),fetch("/__cmux_diff_viewer_wait"+location.pathname,{cache:"no-store"}).then(ki).catch(c=>{document.documentElement.dataset.cmuxDiffWait="failed",r({type:"set-status",status:K(e("renderFailed"),{error:!0,loading:!1,statusOnly:!0})}),console.warn("cmux diff viewer deferred load failed",c)});return}typeof t.statusMessage=="string"&&t.statusMessage.length>0&&r({type:"set-status",status:K(t.statusMessage,{error:t.statusIsError===!0,loading:!1,statusOnly:!0})})}},a=[r,e,t],i[0]=r,i[1]=e,i[2]=t,i[3]=o,i[4]=a):(o=i[3],a=i[4]),R.useEffect(o,a)}async function ki(t){if(!t.ok)throw new Error("replacement failed");(await t.text()).includes('data-cmux-diff-pending="true"')||window.location.reload()}function Si(t){const e=L.c(10);let r;e[0]!==t.filesVisible||e[1]!==t.items||e[2]!==t.metrics||e[3]!==t.options.diffIndicators||e[4]!==t.options.layout||e[5]!==t.options.wordWrap||e[6]!==t.status?(r=()=>{document.body.dataset.filesHidden=t.filesVisible?"false":"true",document.body.dataset.loading=t.status.loading?"true":"false",document.documentElement.dataset.layout=t.options.layout,document.documentElement.dataset.wordWrap=String(t.options.wordWrap),document.documentElement.dataset.diffIndicators=t.options.diffIndicators,t.metrics&&(document.body.dataset.streamFileCount=String(t.metrics.fileCount??t.items.length),document.body.dataset.streamRenderableFileCount=String(t.metrics.renderableFileCount??t.items.length),document.body.dataset.streamFlushCount=String(t.metrics.flushCount??0),document.body.dataset.streamMaxBatchSize=String(t.metrics.maxBatchSize??0),document.body.dataset.streamTreeRefreshCount=String(t.metrics.treeRefreshCount??0),Number.isFinite(t.metrics.completedAt)&&t.metrics.completedAt>0&&(document.body.dataset.streamElapsedMs=String(Math.round(t.metrics.completedAt-t.metrics.startedAt)))),je(t.status)},e[0]=t.filesVisible,e[1]=t.items,e[2]=t.metrics,e[3]=t.options.diffIndicators,e[4]=t.options.layout,e[5]=t.options.wordWrap,e[6]=t.status,e[7]=r):r=e[7];let i;e[8]!==t?(i=[t],e[8]=t,e[9]=i):i=e[9],R.useEffect(r,i)}function ji(t,e,r){const i=L.c(12);let n;i[0]!==r||i[1]!==t.diffViewerOpenFileSearch||i[2]!==t.diffViewerScrollDown||i[3]!==t.diffViewerScrollToBottom||i[4]!==t.diffViewerScrollToTop||i[5]!==t.diffViewerScrollUp||i[6]!==e?(n=()=>{const a=ae(t.diffViewerScrollDown),c=ae(t.diffViewerScrollUp),l=ae(t.diffViewerScrollToBottom),f=ae(t.diffViewerScrollToTop),d=ae(t.diffViewerOpenFileSearch);let u=null,p=0;const m=()=>{u=null,p!==0&&(window.clearTimeout(p),p=0)},g=h=>{if(!(h.defaultPrevented||Ci(h.target))){if(u&&!pe(u.shortcut.second,h)&&m(),u&&pe(u.shortcut.second,h)){h.preventDefault(),u.action(),m();return}if(de(a,h)){h.preventDefault(),ze(e.current,1);return}if(de(c,h)){h.preventDefault(),ze(e.current,-1);return}if(de(l,h)){h.preventDefault(),e.current?.scrollTo({top:e.current.scrollHeight,behavior:"auto"});return}if(de(d,h)){h.preventDefault(),r({type:"set-file-search-open",open:!0});return}f&&Mi(f,h)&&(h.preventDefault(),u={shortcut:f,action:()=>e.current?.scrollTo({top:0,behavior:"auto"})},p=window.setTimeout(m,700))}};return document.addEventListener("keydown",g),()=>{m(),document.removeEventListener("keydown",g)}},i[0]=r,i[1]=t.diffViewerOpenFileSearch,i[2]=t.diffViewerScrollDown,i[3]=t.diffViewerScrollToBottom,i[4]=t.diffViewerScrollToTop,i[5]=t.diffViewerScrollUp,i[6]=e,i[7]=n):n=i[7];let o;i[8]!==r||i[9]!==t||i[10]!==e?(o=[r,t,e],i[8]=r,i[9]=t,i[10]=e,i[11]=o):o=i[11],R.useEffect(n,o)}function Ii(t,e){const r=L.c(4);let i,n;r[0]!==e||r[1]!==t?(i=()=>{if(!t)return;const o=c=>{c.target instanceof Element&&c.target.closest("#toolbar")||e({type:"set-options-open",open:!1})},a=c=>{c.key==="Escape"&&e({type:"set-options-open",open:!1})};return document.addEventListener("click",o),document.addEventListener("keydown",a),()=>{document.removeEventListener("click",o),document.removeEventListener("keydown",a)}},n=[e,t],r[0]=e,r[1]=t,r[2]=i,r[3]=n):(i=r[2],n=r[3]),R.useEffect(i,n)}function ae(t){return!t||t.unbound===!0||!t.first?null:{first:Te(t.first),second:t.second?Te(t.second):null}}function Te(t){return{key:String(t?.key??"").toLowerCase(),command:t?.command===!0,shift:t?.shift===!0,option:t?.option===!0,control:t?.control===!0}}function de(t,e){return!!(t&&!t.second&&pe(t.first,e))}function Mi(t,e){return!!(t.second&&pe(t.first,e))}function pe(t,e){return!t||e.metaKey!==t.command||e.ctrlKey!==t.control||e.altKey!==t.option||e.shiftKey!==t.shift?!1:Pi(e)===t.key}function Pi(t){return t.code==="Space"?"space":typeof t.key!="string"||t.key.length===0?"":(t.key.length===1,t.key.toLowerCase())}function Ci(t){return!!(t instanceof Element?t:null)?.closest("input, textarea, select, [contenteditable='true']")}function ze(t,e){if(!t)return;const r=Math.max(80,Math.floor(t.clientHeight*.38));t.scrollBy({top:e*r,behavior:"auto"})}function Fi(t,e){return e.some(r=>r.id===t)?t:e[0]?.id??""}function We(){const t=window.visualViewport?.height??window.innerHeight;return!Number.isFinite(t)||t<=0?25:Math.min(96,Math.max(25,Math.ceil(t/24)))}const _i=`@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-outline-style:solid}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--font-weight-medium:500;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--shadow-xl:0 20px 25px -5px #0000001a, 0 8px 10px -6px #0000001a;--ease-out:cubic-bezier(0, 0, .2, 1);--blur-sm:8px;--blur-lg:16px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.\\@container{container-type:inline-size}.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.top-0{top:calc(var(--spacing) * 0)}.top-1\\/2{top:50%}.right-2\\.5{right:calc(var(--spacing) * 2.5)}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-\\[calc\\(100\\%\\+6px\\)\\]{bottom:calc(100% + 6px)}.bottom-full{bottom:100%}.left-0{left:calc(var(--spacing) * 0)}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.m-px{margin:1px}.mx-3\\.5{margin-inline:calc(var(--spacing) * 3.5)}.ms-1{margin-inline-start:calc(var(--spacing) * 1)}.mt-1\\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-3\\.5{margin-top:calc(var(--spacing) * 3.5)}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-\\[3px\\]{margin-right:3px}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-px{margin-bottom:1px}.ml-1\\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-auto{margin-left:auto}.box-border{box-sizing:border-box}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.aspect-square{aspect-ratio:1}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-16{width:calc(var(--spacing) * 16);height:calc(var(--spacing) * 16)}.size-\\[22px\\]{width:22px;height:22px}.\\!h-auto{height:auto!important}.h-0{height:calc(var(--spacing) * 0)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-\\[1lh\\]{height:1lh}.h-\\[1px\\]{height:1px}.h-\\[11px\\]{height:11px}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.max-h-\\[25dvh\\]{max-height:25dvh}.max-h-\\[140px\\]{max-height:140px}.max-h-none{max-height:none}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-\\[1\\.25rem\\]{min-height:1.25rem}.w-2\\/5{width:40%}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-7{width:calc(var(--spacing) * 7)}.w-52{width:calc(var(--spacing) * 52)}.w-fit{width:fit-content}.w-full{width:100%}.w-max{width:max-content}.w-px{width:1px}.max-w-16{max-width:calc(var(--spacing) * 16)}.max-w-20{max-width:calc(var(--spacing) * 20)}.max-w-40{max-width:calc(var(--spacing) * 40)}.max-w-\\[60\\%\\]{max-width:60%}.max-w-\\[77\\%\\]{max-width:77%}.max-w-\\[320px\\]{max-width:320px}.max-w-full{max-width:100%}.max-w-none{max-width:none}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-56{min-width:calc(var(--spacing) * 56)}.min-w-max{min-width:max-content}.flex-1{flex:1}.flex-none{flex:none}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.resize{resize:both}.grid-cols-\\[16px_minmax\\(0\\,1fr\\)_44px\\]{grid-template-columns:16px minmax(0,1fr) 44px}.grid-cols-\\[42px_minmax\\(0\\,1fr\\)\\]{grid-template-columns:42px minmax(0,1fr)}.grid-cols-\\[72px_minmax\\(0\\,1fr\\)_96px\\]{grid-template-columns:72px minmax(0,1fr) 96px}.grid-cols-\\[auto_minmax\\(0\\,1fr\\)_auto\\]{grid-template-columns:auto minmax(0,1fr) auto}.grid-cols-\\[minmax\\(0\\,auto\\)_auto_minmax\\(0\\,1fr\\)\\]{grid-template-columns:minmax(0,auto) auto minmax(0,1fr)}.flex-col{flex-direction:column}.flex-row-reverse{flex-direction:row-reverse}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-\\[5px\\]{gap:5px}:where(.space-y-\\[13px\\]>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(13px * var(--tw-space-y-reverse));margin-block-end:calc(13px * calc(1 - var(--tw-space-y-reverse)))}.self-start{align-self:flex-start}.justify-self-end{justify-self:flex-end}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-clip{overflow:clip}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-\\[5px\\]{border-radius:5px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-\\[color-mix\\(in_lab\\,var\\(--cmux-diff-fg\\)_18\\%\\,transparent\\)\\]{border-color:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.border-\\[color-mix\\(in_lab\\,var\\(--cmux-diff-fg\\)_18\\%\\,transparent\\)\\]{border-color:color-mix(in lab,var(--cmux-diff-fg) 18%,transparent)}}.border-\\[color\\:var\\(--gray-0\\)\\]{border-color:var(--gray-0)}.border-\\[var\\(--cmux-diff-border\\)\\]{border-color:var(--cmux-diff-border)}.border-transparent{border-color:#0000}.bg-\\[color-mix\\(in_lab\\,var\\(--cmux-diff-fg\\)_5\\%\\,transparent\\)\\]{background-color:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.bg-\\[color-mix\\(in_lab\\,var\\(--cmux-diff-fg\\)_5\\%\\,transparent\\)\\]{background-color:color-mix(in lab,var(--cmux-diff-fg) 5%,transparent)}}.bg-\\[color-mix\\(in_lab\\,var\\(--cmux-diff-fg\\)_10\\%\\,transparent\\)\\]{background-color:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.bg-\\[color-mix\\(in_lab\\,var\\(--cmux-diff-fg\\)_10\\%\\,transparent\\)\\]{background-color:color-mix(in lab,var(--cmux-diff-fg) 10%,transparent)}}.bg-\\[color\\:var\\(--gray-0\\)\\]{background-color:var(--gray-0)}.bg-\\[var\\(--cmux-diff-muted-bg\\)\\]{background-color:var(--cmux-diff-muted-bg)}.\\[mask-image\\:linear-gradient\\(to_right\\,black_calc\\(100\\%_-_0\\.25rem\\)\\,transparent\\)\\]{-webkit-mask-image:linear-gradient(90deg,#000 calc(100% - .25rem),#0000);mask-image:linear-gradient(90deg,#000 calc(100% - .25rem),#0000)}.\\[mask-repeat\\:no-repeat\\]{-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.object-cover{object-fit:cover}.p-0\\.5{padding:calc(var(--spacing) * .5)}.p-2{padding:calc(var(--spacing) * 2)}.\\!px-0{padding-inline:calc(var(--spacing) * 0)!important}.px-0\\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-\\[7px\\]{padding-inline:7px}.px-\\[var\\(--padding-row-x\\)\\]{padding-inline:var(--padding-row-x)}.py-0{padding-block:calc(var(--spacing) * 0)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-\\[var\\(--padding-row-y\\)\\]{padding-block:var(--padding-row-y)}.pt-0\\.5{padding-top:calc(var(--spacing) * .5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pr-0{padding-right:calc(var(--spacing) * 0)}.pr-1{padding-right:calc(var(--spacing) * 1)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.text-left{text-align:left}.align-bottom{vertical-align:bottom}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.\\!leading-none{--tw-leading:1!important;line-height:1!important}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-\\[18px\\]{--tw-leading:18px;line-height:18px}.leading-\\[calc\\(var\\(--codex-chat-font-size\\)\\+8px\\)\\]{--tw-leading:calc(var(--codex-chat-font-size) + 8px);line-height:calc(var(--codex-chat-font-size) + 8px)}.leading-none{--tw-leading:1;line-height:1}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.break-words{overflow-wrap:break-word}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.text-current{color:currentColor}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-\\[0\\.5px\\]{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(.5px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline-hidden{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.outline-hidden{outline-offset:2px;outline:2px solid #0000}}.backdrop-blur-lg{--tw-backdrop-blur:blur(var(--blur-lg));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.select-none{-webkit-user-select:none;user-select:none}.\\[--edge-fade-distance\\:2rem\\]{--edge-fade-distance:2rem}.group-focus-within\\:opacity-100:is(:where(.group):focus-within *){opacity:1}@media(hover:hover){.group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}.hover\\:bg-transparent:hover{background-color:#0000}}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-40:disabled{opacity:.4}.data-\\[state\\=checked\\]\\:translate-x-\\[14px\\][data-state=checked]{--tw-translate-x:14px;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\\[state\\=unchecked\\]\\:translate-x-\\[2px\\][data-state=unchecked]{--tw-translate-x:2px;translate:var(--tw-translate-x) var(--tw-translate-y)}@container (min-width:500px){.\\@\\[500px\\]\\:inline{display:inline}}.\\[\\&_\\.ProseMirror\\]\\:\\!h-5 .ProseMirror{height:calc(var(--spacing) * 5)!important}.\\[\\&_\\.ProseMirror\\]\\:h-auto .ProseMirror{height:auto}.\\[\\&_\\.ProseMirror\\]\\:\\!min-h-5 .ProseMirror{min-height:calc(var(--spacing) * 5)!important}.\\[\\&_\\.ProseMirror\\]\\:min-h-\\[2rem\\] .ProseMirror{min-height:2rem}.\\[\\&_\\.ProseMirror\\]\\:min-w-0 .ProseMirror{min-width:calc(var(--spacing) * 0)}.\\[\\&_\\.ProseMirror\\]\\:flex-1 .ProseMirror{flex:1}.\\[\\&_\\.ProseMirror\\]\\:resize-none .ProseMirror{resize:none}.\\[\\&_\\.ProseMirror\\]\\:overflow-hidden .ProseMirror{overflow:hidden}.\\[\\&_\\.ProseMirror\\]\\:leading-5 .ProseMirror{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.\\[\\&_\\.ProseMirror\\]\\:whitespace-nowrap .ProseMirror{white-space:nowrap}.\\[\\&_\\.ProseMirror\\]\\:focus-visible\\:outline-none .ProseMirror:focus-visible{--tw-outline-style:none;outline-style:none}.\\[\\&_\\.ProseMirror_p\\]\\:m-0 .ProseMirror p{margin:calc(var(--spacing) * 0)}.\\[\\&_\\.ProseMirror_p\\]\\:overflow-hidden .ProseMirror p{overflow:hidden}.\\[\\&_\\.ProseMirror_p\\]\\:text-ellipsis .ProseMirror p{text-overflow:ellipsis}.\\[\\&_\\.ProseMirror_p\\]\\:whitespace-nowrap .ProseMirror p{white-space:nowrap}.\\[\\&_\\.contain-inline-size\\]\\:\\[contain\\:initial\\] .contain-inline-size{contain:initial}.\\[\\&\\>\\*\\:last-child\\]\\:mb-0>:last-child{margin-bottom:calc(var(--spacing) * 0)}.\\[\\&\\>ol\\:first-child\\]\\:mt-0>ol:first-child,.\\[\\&\\>ul\\:first-child\\]\\:mt-0>ul:first-child{margin-top:calc(var(--spacing) * 0)}}:root{color-scheme:light dark;--cmux-diff-bg-light:#fff;--cmux-diff-bg-dark:#000;--cmux-diff-fg-light:#000;--cmux-diff-fg-dark:#fff;--cmux-diff-selection-bg-light:#abd8ff;--cmux-diff-selection-bg-dark:#3f638b;--cmux-diff-ui-font-family:system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;--cmux-diff-ui-font-size:12px;--cmux-diff-ui-line-height:16px;--cmux-diff-code-font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;--cmux-diff-font-size:10px;--cmux-diff-line-height:20px;--cmux-diff-bg:var(--cmux-diff-bg-light);--cmux-diff-fg:var(--cmux-diff-fg-light);--cmux-diff-border:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){:root{--cmux-diff-border:color-mix(in lab, var(--cmux-diff-fg) 12%, transparent)}}:root{--cmux-diff-toolbar-bg:var(--cmux-diff-bg);--cmux-diff-sidebar-bg:var(--cmux-diff-bg);--cmux-diff-muted-bg:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){:root{--cmux-diff-muted-bg:color-mix(in lab, var(--cmux-diff-fg) 8%, transparent)}}:root{--cmux-diff-hover-bg:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){:root{--cmux-diff-hover-bg:color-mix(in lab, var(--cmux-diff-fg) 10%, transparent)}}:root{--cmux-diff-accent:light-dark(#0a84ff,#7ab7ff);--cmux-diff-text-muted:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){:root{--cmux-diff-text-muted:color-mix(in lab, var(--cmux-diff-fg) 72%, var(--cmux-diff-bg))}}:root{--cmux-diff-text-subtle:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){:root{--cmux-diff-text-subtle:color-mix(in lab, var(--cmux-diff-fg) 84%, var(--cmux-diff-bg))}}:root{--cmux-diff-surface-fill-light:var(--cmux-diff-bg-light);--cmux-diff-surface-fill-dark:var(--cmux-diff-bg-dark);--cmux-diff-surface-fill:var(--cmux-diff-surface-fill-light);background:var(--cmux-diff-surface-fill);color:var(--cmux-diff-fg)}@media(prefers-color-scheme:dark){:root{--cmux-diff-bg:var(--cmux-diff-bg-dark);--cmux-diff-fg:var(--cmux-diff-fg-dark);--cmux-diff-surface-fill:var(--cmux-diff-surface-fill-dark)}}*{box-sizing:border-box}html,body{background:var(--cmux-diff-surface-fill);height:100%;overflow:hidden}body{background:var(--cmux-diff-surface-fill);height:100vh;min-height:0;color:var(--cmux-diff-fg);font-family:var(--cmux-diff-ui-font-family);font-size:var(--cmux-diff-ui-font-size);line-height:var(--cmux-diff-ui-line-height);flex-direction:column;margin:0;display:flex;overflow:hidden}#root{background:0 0;height:100%;min-height:0}#app{overscroll-behavior:contain;contain:strict;height:100vh;min-height:0;color:inherit;background:0 0;grid-template-rows:auto minmax(0,1fr);grid-template-columns:minmax(0,1fr);display:grid;overflow:hidden}.copy-fallback-textarea{opacity:0;pointer-events:none;width:1px;height:1px;position:fixed;top:0;left:-9999px}#toolbar{border-bottom:1px solid var(--cmux-diff-border);background:var(--cmux-diff-toolbar-bg);min-height:32px;color:var(--cmux-diff-fg);flex:none;grid-template-columns:minmax(0,1.1fr) minmax(124px,.9fr) auto;align-items:center;gap:7px;padding:3px 4px 3px 8px;display:grid;position:relative}@supports (color:color-mix(in lab,red,red)){#toolbar{color:color-mix(in lab,var(--cmux-diff-fg) 76%,var(--cmux-diff-bg))}}#toolbar{z-index:50}.toolbar-left,.toolbar-middle,.toolbar-actions{align-items:center;min-width:0;display:flex}.toolbar-left,.toolbar-middle{gap:6px}.toolbar-left{justify-self:stretch}.toolbar-middle{justify-content:center}.toolbar-actions{justify-self:end;gap:4px}#source-select,#repo-select,#base-select,#jump-select{appearance:none;background:linear-gradient(45deg,transparent 50%,currentColor 50%) right 11px center / 4px 4px no-repeat,linear-gradient(135deg,currentColor 50%,transparent 50%) right 7px center / 4px 4px no-repeat,var(--cmux-diff-fg);border:1px solid #0000;border-radius:6px;min-width:0;max-width:100%;height:24px;padding:0 24px 0 9px}@supports (color:color-mix(in lab,red,red)){#source-select,#repo-select,#base-select,#jump-select{background:linear-gradient(45deg,transparent 50%,currentColor 50%) right 11px center / 4px 4px no-repeat,linear-gradient(135deg,currentColor 50%,transparent 50%) right 7px center / 4px 4px no-repeat,color-mix(in lab,var(--cmux-diff-fg) 7%,transparent)}}#source-select,#repo-select,#base-select,#jump-select{color:inherit;font:inherit}#source-select{flex:0 118px}#source-select:hover,#repo-select:hover,#base-select:hover,#jump-select:hover{border-color:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){#source-select:hover,#repo-select:hover,#base-select:hover,#jump-select:hover{border-color:color-mix(in lab,var(--cmux-diff-fg) 24%,transparent)}}#source-select:hover,#repo-select:hover,#base-select:hover,#jump-select:hover{background-color:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){#source-select:hover,#repo-select:hover,#base-select:hover,#jump-select:hover{background-color:color-mix(in lab,var(--cmux-diff-fg) 10%,transparent)}}#source-select[hidden],#repo-select[hidden],#base-select[hidden],#jump-select[hidden]{display:none}#jump-select{width:100%}#repo-select{flex:0 132px}#base-select{flex:0 120px}#source-select:focus,#repo-select:focus,#base-select:focus,#jump-select:focus,.toolbar-icon:focus-visible,.menu-item:focus-visible,.file-entry:focus-visible{outline:2px solid var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){#source-select:focus,#repo-select:focus,#base-select:focus,#jump-select:focus,.toolbar-icon:focus-visible,.menu-item:focus-visible,.file-entry:focus-visible{outline:2px solid color-mix(in lab,var(--cmux-diff-fg) 36%,transparent)}}#source-select:focus,#repo-select:focus,#base-select:focus,#jump-select:focus,.toolbar-icon:focus-visible,.menu-item:focus-visible,.file-entry:focus-visible{outline-offset:1px}@media(max-width:760px){#toolbar{grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"source actions""jump actions"}.toolbar-left{grid-area:source}.toolbar-middle{grid-area:jump;justify-content:stretch}.toolbar-actions{grid-area:actions}}.toolbar-icon{width:20px;height:20px;color:var(--cmux-diff-fg);background:0 0;border:1px solid #0000;border-radius:6px;justify-content:center;align-items:center;display:inline-flex}@supports (color:color-mix(in lab,red,red)){.toolbar-icon{color:color-mix(in lab,var(--cmux-diff-fg) 60%,var(--cmux-diff-bg))}}.toolbar-icon{cursor:pointer;padding:0}.toolbar-icon:hover,.toolbar-icon[aria-expanded=true]{border-color:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.toolbar-icon:hover,.toolbar-icon[aria-expanded=true]{border-color:color-mix(in lab,var(--cmux-diff-fg) 14%,transparent)}}.toolbar-icon:hover,.toolbar-icon[aria-expanded=true]{background:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.toolbar-icon:hover,.toolbar-icon[aria-expanded=true]{background:color-mix(in lab,var(--cmux-diff-fg) 9%,transparent)}}.toolbar-icon:hover,.toolbar-icon[aria-expanded=true],.toolbar-icon[aria-pressed=true]{color:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.toolbar-icon[aria-pressed=true]{color:color-mix(in lab,var(--cmux-diff-fg) 78%,var(--cmux-diff-bg))}}.toolbar-icon[hidden]{display:none}.toolbar-icon svg,.menu-item svg{fill:none;stroke:currentColor;stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;width:14px;height:14px;display:block}#layout-toggle svg [data-diff-deletion],#layout-toggle svg [data-diff-addition]{stroke:none}#layout-toggle svg [data-diff-deletion]{fill:light-dark(var(--cmux-diff-deletion-fg-light),var(--cmux-diff-deletion-fg-dark))}#layout-toggle svg [data-diff-addition]{fill:light-dark(var(--cmux-diff-addition-fg-light),var(--cmux-diff-addition-fg-dark))}.toolbar-icon svg [data-precision-dot],.menu-item svg [data-precision-dot]{stroke-width:2px}#options-menu{border:1px solid var(--cmux-diff-fg);min-width:246px;padding:8px;position:absolute;top:calc(100% + 7px);right:10px}@supports (color:color-mix(in lab,red,red)){#options-menu{border:1px solid color-mix(in lab,var(--cmux-diff-fg) 13%,transparent)}}#options-menu{background:var(--cmux-diff-bg);z-index:100;border-radius:8px;box-shadow:0 16px 34px lab(0% none none/.28)}#options-menu[hidden]{display:none}.menu-separator{background:var(--cmux-diff-fg);height:1px;margin:7px 6px}@supports (color:color-mix(in lab,red,red)){.menu-separator{background:color-mix(in lab,var(--cmux-diff-fg) 12%,transparent)}}.menu-item{width:100%;min-height:31px;color:var(--cmux-diff-fg);background:0 0;border:0;border-radius:6px;grid-template-columns:22px minmax(0,1fr) 18px;align-items:center;gap:10px;display:grid}@supports (color:color-mix(in lab,red,red)){.menu-item{color:color-mix(in lab,var(--cmux-diff-fg) 86%,var(--cmux-diff-bg))}}.menu-item{font:inherit;text-align:left;padding:0 7px}.menu-item:hover:not(:disabled){background:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.menu-item:hover:not(:disabled){background:color-mix(in lab,var(--cmux-diff-fg) 10%,transparent)}}.menu-item:hover:not(:disabled){color:var(--cmux-diff-fg)}.menu-segment{cursor:default}.menu-segment:hover{background:0 0}.menu-segment-controls{background:0 0;border-radius:7px;justify-self:end;align-items:center;gap:2px;padding:2px;display:inline-flex}.segment-button{width:27px;height:24px;color:var(--cmux-diff-fg);background:0 0;border:0;border-radius:5px;justify-content:center;align-items:center;display:inline-flex}@supports (color:color-mix(in lab,red,red)){.segment-button{color:color-mix(in lab,var(--cmux-diff-fg) 62%,var(--cmux-diff-bg))}}.segment-button{padding:0}.segment-button:hover,.segment-button[aria-pressed=true]{background:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.segment-button:hover,.segment-button[aria-pressed=true]{background:color-mix(in lab,var(--cmux-diff-fg) 12%,transparent)}}.segment-button:hover,.segment-button[aria-pressed=true],.menu-item:disabled{color:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.menu-item:disabled{color:color-mix(in lab,var(--cmux-diff-fg) 36%,var(--cmux-diff-bg))}}.menu-label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.menu-check{justify-self:end}#content{--cmux-diff-files-width:252px;grid-template-columns:minmax(0,1fr) var(--cmux-diff-files-width);overscroll-behavior:contain;contain:strict;background:0 0;flex:auto;grid-template-rows:minmax(0,1fr);grid-template-areas:"viewer files";min-width:0;min-height:0;display:grid;position:relative;overflow:hidden}body[data-files-hidden=true] #content{grid-template-columns:minmax(0,1fr) 0}body[data-status-only=true] #content{grid-template-columns:minmax(0,1fr);grid-template-areas:"viewer"}#files-sidebar{border-left:1px solid var(--cmux-diff-border);background:var(--cmux-diff-sidebar-bg);contain:strict;opacity:1;flex-direction:column;grid-area:files;width:100%;min-width:0;height:100%;min-height:0;transition:opacity .1s,visibility linear;display:flex;position:relative;overflow:hidden}#files-resize-handle{z-index:3;appearance:none;cursor:col-resize;background:0 0;border:0;outline:none;width:8px;margin:0;padding:0;position:absolute;top:0;bottom:0;left:0}#files-resize-handle:after{content:"";background:0 0;width:1px;position:absolute;top:0;bottom:0;left:0}body[data-files-hidden=true] #files-sidebar{opacity:0;pointer-events:none;visibility:hidden;transition:opacity .1s,visibility 0s linear .1s}body[data-status-only=true] #files-sidebar{display:none}#files-header{z-index:1;border-bottom:1px solid var(--cmux-diff-border);background:var(--cmux-diff-sidebar-bg);min-height:30px;color:var(--cmux-diff-text-muted);justify-content:space-between;align-items:center;gap:8px;padding:0 7px 0 10px;display:flex;position:relative}#files-title{align-items:center;gap:6px;min-width:0;display:inline-flex}#files-header-actions{flex:none;align-items:center;gap:2px;display:inline-flex}#file-search-toggle{width:24px;height:24px;color:var(--cmux-diff-text-muted);background:0 0;border:0;border-radius:5px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}#file-search-toggle:hover,#file-search-toggle[aria-pressed=true]{background:var(--cmux-diff-hover-bg);color:var(--cmux-diff-fg)}#file-search-toggle svg{fill:none;stroke:currentColor;stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;width:15px;height:15px}#file-list{background:var(--cmux-diff-sidebar-bg);--trees-bg-override:var(--cmux-diff-sidebar-bg);--trees-fg-override:var(--cmux-diff-text-subtle);--trees-fg-muted-override:var(--cmux-diff-text-muted);--trees-bg-muted-override:var(--cmux-diff-hover-bg);--trees-selected-bg-override:var(--cmux-diff-fg);flex:auto;min-height:0;padding:6px 4px 6px 6px;overflow:hidden}@supports (color:color-mix(in lab,red,red)){#file-list{--trees-selected-bg-override:color-mix(in lab, var(--cmux-diff-fg) 11%, transparent)}}#file-list{--trees-selected-fg-override:var(--cmux-diff-fg);--trees-selected-focused-border-color-override:transparent;--trees-border-color-override:var(--cmux-diff-border);--trees-focus-ring-color-override:var(--cmux-diff-accent)}@supports (color:color-mix(in lab,red,red)){#file-list{--trees-focus-ring-color-override:color-mix(in lab, var(--cmux-diff-accent) 72%, transparent)}}#file-list{--trees-font-family-override:var(--cmux-diff-ui-font-family);--trees-font-size-override:var(--cmux-diff-ui-font-size);--trees-font-weight-semibold-override:500;--trees-density-override:.78;--trees-border-radius-override:5px;--trees-item-padding-x-override:7px;--trees-item-margin-x-override:0;--trees-padding-inline-override:8px;--trees-search-bg-override:var(--cmux-diff-bg)}@supports (color:color-mix(in lab,red,red)){#file-list{--trees-search-bg-override:color-mix(in lab, var(--cmux-diff-bg) 92%, var(--cmux-diff-fg))}}#file-list{--trees-status-added-override:light-dark(var(--cmux-diff-addition-fg-light),var(--cmux-diff-addition-fg-dark));--trees-status-modified-override:var(--cmux-diff-accent);--trees-status-renamed-override:light-dark(#a26300,#ffd166);--trees-status-deleted-override:light-dark(var(--cmux-diff-deletion-fg-light),var(--cmux-diff-deletion-fg-dark))}body[data-loading=false] .diff-loading-placeholder,body[data-loading=false]:not([data-status-only=true]) #loading-layer{display:none}#file-list file-tree-container{width:100%;height:100%;min-height:0;display:block}.file-entry{width:100%;min-height:30px;color:inherit;font:inherit;text-align:left;background:0 0;border:0;border-radius:6px;grid-template-columns:18px minmax(0,1fr) auto;align-items:center;gap:8px;padding:3px 7px;display:grid}.file-entry:hover,.file-entry[aria-current=true]{background:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){.file-entry:hover,.file-entry[aria-current=true]{background:color-mix(in lab,var(--cmux-diff-fg) 9%,transparent)}}.file-status{width:17px;height:17px;color:var(--cmux-diff-text-muted);border:1px solid;border-radius:5px;justify-content:center;align-items:center;font-size:9px;line-height:1;display:inline-flex}.file-name{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.file-stats{color:var(--cmux-diff-text-muted);gap:5px;display:inline-flex}.stat-add{color:light-dark(var(--cmux-diff-addition-fg-light),var(--cmux-diff-addition-fg-dark))}.stat-del{color:light-dark(var(--cmux-diff-deletion-fg-light),var(--cmux-diff-deletion-fg-dark))}#viewer{--diffs-font-family:var(--cmux-diff-code-font-family);--diffs-header-font-family:var(--cmux-diff-ui-font-family);--diffs-font-size:var(--cmux-diff-font-size);--diffs-line-height:var(--cmux-diff-line-height);--diffs-bg-selection-override:light-dark(var(--cmux-diff-selection-bg-light),var(--cmux-diff-selection-bg-dark));overscroll-behavior:contain;overflow-anchor:none;contain:strict;border-bottom:1px solid var(--cmux-diff-border);background:0 0;grid-area:viewer;width:100%;min-width:0;height:100%;min-height:0;position:relative;overflow:clip auto}.code-view-root{overscroll-behavior:contain;overflow-anchor:none;contain:strict;width:100%;min-width:0;height:100%;min-height:0;position:relative;overflow:clip auto}@media(max-width:520px){#content,body[data-files-hidden=true] #content{grid-template-columns:minmax(0,1fr);grid-template-areas:"viewer"}#files-sidebar{display:none}}@media(prefers-reduced-motion:reduce){#files-sidebar{transition:none}}#viewer diffs-container{--diffs-font-family:var(--cmux-diff-code-font-family);--diffs-header-font-family:var(--cmux-diff-ui-font-family);--diffs-font-size:var(--cmux-diff-font-size);--diffs-line-height:var(--cmux-diff-line-height);--diffs-bg-selection-override:light-dark(var(--cmux-diff-selection-bg-light),var(--cmux-diff-selection-bg-dark));contain:layout paint style;display:block;overflow:clip}#loading-layer{z-index:4;pointer-events:none;contain:strict;background:0 0;grid-area:viewer;position:absolute;inset:0;overflow:hidden}body[data-status-only=true] #loading-layer{pointer-events:auto;justify-content:center;align-items:center;width:100%;height:100%;padding:32px;display:flex;position:static}#status{z-index:5;border:1px solid var(--cmux-diff-fg);align-items:center;gap:10px;max-width:calc(100% - 24px);min-height:32px;padding:8px 12px;display:flex;position:absolute;top:10px;left:12px}@supports (color:color-mix(in lab,red,red)){#status{border:1px solid color-mix(in lab,var(--cmux-diff-fg) 10%,transparent)}}#status{background:var(--cmux-diff-bg);font-family:var(--cmux-diff-ui-font-family);font-size:13px;line-height:var(--cmux-diff-ui-line-height);color:var(--cmux-diff-fg);border-radius:7px}@supports (color:color-mix(in lab,red,red)){#status{color:color-mix(in lab,var(--cmux-diff-fg) 70%,var(--cmux-diff-bg))}}body[data-status-only=true] #status{text-align:center;text-wrap:balance;width:auto;max-width:340px;min-height:0;color:var(--cmux-diff-fg);background:0 0;border:0;border-radius:0;flex-direction:column;justify-content:center;align-items:center;gap:14px;padding:0;font-size:14px;line-height:1.55;position:static}@supports (color:color-mix(in lab,red,red)){body[data-status-only=true] #status{color:color-mix(in lab,var(--cmux-diff-fg) 58%,var(--cmux-diff-bg))}}body[data-status-only=true] #status-text{letter-spacing:.005em;font-weight:500}.visually-hidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}#status-icon{display:none}body[data-status-only=true] #status:not([data-error=true]):not([data-pending=true]) #status-icon{background:var(--cmux-diff-fg);border-radius:16px;justify-content:center;align-items:center;width:56px;height:56px;display:flex}@supports (color:color-mix(in lab,red,red)){body[data-status-only=true] #status:not([data-error=true]):not([data-pending=true]) #status-icon{background:color-mix(in lab,var(--cmux-diff-fg) 5%,transparent)}}body[data-status-only=true] #status:not([data-error=true]):not([data-pending=true]) #status-icon{border:1px solid var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){body[data-status-only=true] #status:not([data-error=true]):not([data-pending=true]) #status-icon{border:1px solid color-mix(in lab,var(--cmux-diff-fg) 8%,transparent)}}body[data-status-only=true] #status:not([data-error=true]):not([data-pending=true]) #status-icon:before{content:"";opacity:.8;background-color:currentColor;width:26px;height:26px;display:block;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 2v6h6'/%3E%3Cpath d='M9 13h6'/%3E%3Cpath d='M9 17h4'/%3E%3C/svg%3E") 50%/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 2v6h6'/%3E%3Cpath d='M9 13h6'/%3E%3Cpath d='M9 17h4'/%3E%3C/svg%3E") 50%/contain no-repeat}#status[data-pending=true]:before,body[data-loading=true] #status:before{content:"";border:2px solid var(--cmux-diff-fg);flex:none;width:14px;height:14px}@supports (color:color-mix(in lab,red,red)){#status[data-pending=true]:before,body[data-loading=true] #status:before{border:2px solid color-mix(in lab,var(--cmux-diff-fg) 20%,transparent)}}#status[data-pending=true]:before,body[data-loading=true] #status:before{border-top-color:var(--cmux-diff-fg)}@supports (color:color-mix(in lab,red,red)){#status[data-pending=true]:before,body[data-loading=true] #status:before{border-top-color:color-mix(in lab,var(--cmux-diff-fg) 70%,var(--cmux-diff-bg))}}#status[data-pending=true]:before,body[data-loading=true] #status:before{border-radius:50%;animation:.8s linear infinite cmuxDiffPendingSpin}#status[data-error=true]{color:light-dark(#b42318,#ff8a80)}@keyframes cmuxDiffPendingSpin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){#status[data-pending=true]:before,body[data-loading=true] #status:before{animation:none}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}`;function Bi(){const t=document.getElementById("cmux-diff-viewer-config");if(!t?.textContent)throw new Error("Missing cmux diff viewer config");return JSON.parse(t.textContent)}function Di(t){const e=Bi();Ze("diff",_i),at(we(e.payload?.appearance)),typeof e.payload?.title=="string"&&e.payload.title.trim()!==""&&(document.title=e.payload.title);const r=Re(e.payload?.labels,{assertMissing:Ne()}),i=Bt(e,r);document.body.dataset.filesHidden="false",je(i);const n=et(()=>s.jsx(Wt,{config:e,initialStatus:i}));Ae.createRoot(t).render(s.jsx($e,{router:n}))}export{Di as mountDiffSurface}; diff --git a/Resources/markdown-viewer/webviews-app/chunks/installWebviewStyles.mjs b/Resources/markdown-viewer/webviews-app/chunks/installWebviewStyles.mjs index 09a4c7b6243a..43e1887c429d 100644 --- a/Resources/markdown-viewer/webviews-app/chunks/installWebviewStyles.mjs +++ b/Resources/markdown-viewer/webviews-app/chunks/installWebviewStyles.mjs @@ -1 +1 @@ -import{e as u,f as n,g as d,d as i,O as R}from"./vendor.mjs";function p(t){const e=u({component:R,notFoundComponent:t}),o=n({getParentRoute:()=>e,path:"/",component:t}),a=n({getParentRoute:()=>e,path:"/diff",component:t}),s=n({getParentRoute:()=>e,path:"/cmux-diff-viewer",component:t}),c=n({getParentRoute:()=>e,path:"/agent-session",component:t}),r=e.addChildren([o,a,s,c]);return d({history:i(),routeTree:r})}function l(t,e){const o=document.createElement("style");o.dataset.cmuxWebviewStyle=t,o.textContent=e,document.head.append(o)}export{p as c,l as i}; +import{e as R,f as n,g as d,d as i,O as f}from"./vendor.mjs";function h(t){const e=R({component:f,notFoundComponent:t}),o=n({getParentRoute:()=>e,path:"/",component:t}),a=n({getParentRoute:()=>e,path:"/diff",component:t}),s=n({getParentRoute:()=>e,path:"/cmux-diff-viewer",component:t}),c=n({getParentRoute:()=>e,path:"/agent-session",component:t}),r=n({getParentRoute:()=>e,path:"/agent-chat",component:t}),u=e.addChildren([o,a,s,c,r]);return d({history:i(),routeTree:u})}function p(t,e){const o=document.createElement("style");o.dataset.cmuxWebviewStyle=t,o.textContent=e,document.head.append(o)}export{h as c,p as i}; diff --git a/Resources/markdown-viewer/webviews-app/chunks/markdown.mjs b/Resources/markdown-viewer/webviews-app/chunks/markdown.mjs new file mode 100644 index 000000000000..1208b0a4530e --- /dev/null +++ b/Resources/markdown-viewer/webviews-app/chunks/markdown.mjs @@ -0,0 +1 @@ +const l={isDark:null,pageBackground:"--agent-page-bg",surfaceBackground:"--agent-surface",surfaceElevatedBackground:"--agent-surface-elevated",inputBackground:"--agent-input-bg",border:"--agent-border",borderStrong:"--agent-border-strong",text:"--agent-text",mutedText:"--agent-muted",softText:"--agent-soft",accent:"--agent-accent",accentSoft:"--agent-accent-soft",danger:"--agent-danger",shadow:"--agent-shadow"};function T(e){if(typeof document>"u")return;const t=document.documentElement;t.dataset.theme=e.isDark?"dark":"light",d(),t.classList.toggle("dark",e.isDark),t.classList.toggle("electron-dark",e.isDark),t.classList.toggle("light",!e.isDark),t.style.colorScheme=e.isDark?"dark":"light";for(const[n,r]of Object.entries(l))r&&t.style.setProperty(r,String(e[n]))}function d(){if(typeof document>"u")return;const e=document.documentElement;e.dataset.codexWindowType="electron",e.dataset.windowType="electron",e.dataset.codexOs=f(),document.body&&(document.body.dataset.codexWindowType="electron")}function f(){if(typeof navigator>"u")return"unknown";const e=navigator,t=(e.userAgentData?.platform??e.platform??e.userAgent).toLowerCase();return t.includes("win")?"win32":t.includes("mac")||t.includes("darwin")?"darwin":t.includes("linux")?"linux":"unknown"}function S(){const e=globalThis.crypto;if(typeof e?.randomUUID=="function")return e.randomUUID();const t=e?.getRandomValues?.bind(e);if(typeof t=="function"){const n=new Uint8Array(16);return t(n),n[6]=n[6]&15|64,n[8]=n[8]&63|128,[...n].map((r,o)=>{const a=r.toString(16).padStart(2,"0");return[4,6,8,10].includes(o)?`-${a}`:a}).join("")}return`cmux-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}const g=new Set(["base","embed","form","iframe","link","meta","object","script","style"]),m=new Set(["poster","src","srcset","xlink:href"]);function A(e){const t=typeof window>"u"?void 0:window.marked;if(t?.parse)try{const n=t.parse(p(e),{async:!1,breaks:!0,gfm:!0});if(typeof n=="string")return k(n)}catch{return s(e)}return s(e)}function p(e){let t="",n=null;const r=e.match(/[^\r\n]*(?:\r\n|\n|\r|$)/g)??[];for(const o of r){if(o==="")continue;const a=o.match(/(\r\n|\n|\r)$/)?.[0]??"",c=a?o.slice(0,-a.length):o;if(n){t+=c+a,y(c,n)&&(n=null);continue}const i=h(c);if(i){n=i,t+=c+a;continue}t+=b(c)+a}return t}function s(e){return w(e).replace(/\n/g,"
")}function w(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function h(e){const t=/^( {0,3})(`{3,}|~{3,})/.exec(e);if(!t)return null;const n=t[2];return{character:n[0],length:n.length}}function y(e,t){const n=/^( {0,3})(`{3,}|~{3,})\s*$/.exec(e);if(!n)return!1;const r=n[2];return r[0]===t.character&&r.length>=t.length}function b(e){let t="",n=0,r=0;for(;r"u")return e;const t=document.createElement("template");t.innerHTML=e;for(const n of Array.from(t.content.querySelectorAll("*"))){if(g.has(n.localName)){n.remove();continue}for(const r of Array.from(n.attributes)){const o=r.name.toLowerCase();if(o.startsWith("on")||o==="srcdoc"||o==="style"){n.removeAttribute(r.name);continue}const a=x(n.localName,o,r.value);a===null?n.removeAttribute(r.name):typeof a=="string"&&a!==r.value&&n.setAttribute(r.name,a)}n.localName==="a"&&n.setAttribute("rel","noreferrer")}return t.innerHTML}function x(e,t,n){const r=t.toLowerCase();if(m.has(r))return null;if(r==="href")return e.toLowerCase()!=="a"?null:L(n)?n:null}function L(e){const t=e.trim();if(t.startsWith("#"))return!0;if(t.startsWith("/")||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t))return!1;try{const n=new URL(t);return n.protocol==="http:"||n.protocol==="https:"||n.protocol==="mailto:"}catch{return!1}}export{T as a,d as b,s as c,S as m,A as r}; diff --git a/Resources/markdown-viewer/webviews-app/main.mjs b/Resources/markdown-viewer/webviews-app/main.mjs index fd26b46d3a98..0fde7b7aa7bd 100644 --- a/Resources/markdown-viewer/webviews-app/main.mjs +++ b/Resources/markdown-viewer/webviews-app/main.mjs @@ -1 +1 @@ -import{_ as n}from"./chunks/vendor.mjs";function o(){return document.documentElement.dataset.cmuxWebviewKind==="agent-session"||document.body.dataset.cmuxWebviewKind==="agent-session"||document.getElementById("cmux-agent-session-config")?"agent-session":"diff"}const t=document.getElementById("root");if(!t)throw new Error("Missing cmux webview root");o()==="agent-session"?n(()=>import("./chunks/agentSessionSurface.mjs"),[]).then(e=>{e.mountAgentSessionSurface(t)}):n(()=>import("./chunks/diffSurface.mjs"),[]).then(e=>{e.mountDiffSurface(t)}); +import{_ as n}from"./chunks/vendor.mjs";function i(){return document.documentElement.dataset.cmuxWebviewKind==="agent-chat"||document.body.dataset.cmuxWebviewKind==="agent-chat"||document.getElementById("cmux-agent-chat-config")||window.location.hash.startsWith("#/agent-chat")?"agent-chat":document.documentElement.dataset.cmuxWebviewKind==="agent-session"||document.body.dataset.cmuxWebviewKind==="agent-session"||document.getElementById("cmux-agent-session-config")?"agent-session":"diff"}const t=document.getElementById("root");if(!t)throw new Error("Missing cmux webview root");const o=i();o==="agent-chat"?n(()=>import("./chunks/agentChatSurface.mjs"),[]).then(e=>{e.mountAgentChatSurface(t)}):o==="agent-session"?n(()=>import("./chunks/agentSessionSurface.mjs"),[]).then(e=>{e.mountAgentSessionSurface(t)}):n(()=>import("./chunks/diffSurface.mjs"),[]).then(e=>{e.mountDiffSurface(t)}); diff --git a/webviews/src/agent-chat/bridge.ts b/webviews/src/agent-chat/bridge.ts new file mode 100644 index 000000000000..5baa2ecb42aa --- /dev/null +++ b/webviews/src/agent-chat/bridge.ts @@ -0,0 +1,139 @@ +// WebKit bridge client for the /agent-chat surface. +// +// Mirrors the agent-session bridge pattern (`agent-session/shared/bridge.ts`): +// JS -> Swift requests go through `window.webkit.messageHandlers.agentChat` +// with the `{id, method, params}` envelope, Swift -> JS frames arrive through +// `window.cmuxAgentChatBridge.receive(message)`. When the WebKit handler is +// absent (vite dev, bun tests) the resolver falls back to a mock bridge that +// replays a built-in fixture stream, so the surface is fully developable +// standalone. + +import { applyAgentTheme } from "../agent-session/shared/theme"; +import { makeClientId } from "../agent-session/shared/ids"; +import type { AgentSessionTheme } from "../agent-session/shared/types"; +import type { AgentChatBridgeInbound, AgentChatInitResult } from "./protocol"; +import { createMockAgentChatBridge } from "./mockBridge"; + +type NativeReply = + | { ok: true; value: T } + | { ok: false; error?: { code?: string; userMessage?: string } }; + +type AgentChatMessageHandler = { + postMessage(message: unknown): Promise>; +}; + +export type AgentChatInboundListener = (message: AgentChatBridgeInbound) => void; + +/** Transport-agnostic client used by the surface; native or mock. */ +export interface AgentChatBridgeClient { + readonly kind: "mock" | "native"; + /** `chat.init` -> session + daemon status the panel was opened with. */ + init(): Promise; + /** `chat.subscribe` -> start the inbound `agent.event` stream. */ + subscribe(): Promise; + /** Stop any client-owned resources (mock replay timer). */ + dispose(): void; +} + +declare global { + interface Window { + cmuxAgentChatBridge?: { + applyTheme(theme: AgentSessionTheme): void; + receive(message: AgentChatBridgeInbound): void; + }; + } +} + +export class AgentChatBridgeError extends Error { + readonly code?: string; + + constructor(message: string, code?: string) { + super(message); + this.name = "AgentChatBridgeError"; + this.code = code; + } +} + +const listeners = new Set(); + +/** + * Installs `window.cmuxAgentChatBridge` (the Swift -> JS entry point) on the + * current window. Idempotent; safe to call from non-window contexts. The host + * applies terminal theme tokens through `applyTheme` exactly like it does for + * the agent-session surface (`window.cmuxAgentBridge.applyTheme`). + */ +export function ensureAgentChatBridgeInstalled(): void { + if (typeof window === "undefined" || window.cmuxAgentChatBridge) { + return; + } + window.cmuxAgentChatBridge = { + applyTheme(theme: AgentSessionTheme) { + applyAgentTheme(theme); + }, + receive(message: AgentChatBridgeInbound) { + // Set iteration tolerates listeners unsubscribing themselves mid-dispatch. + for (const listener of listeners) { + listener(message); + } + }, + }; +} + +ensureAgentChatBridgeInstalled(); + +export function subscribeToAgentChatInbound(listener: AgentChatInboundListener): () => void { + listeners.add(listener); + return () => { + listeners.delete(listener); + }; +} + +function nativeAgentChatHandler(): AgentChatMessageHandler | null { + if (typeof window === "undefined") { + return null; + } + // The agent-session bridge already declares `Window.webkit` globally with + // only its own handler; read ours through a local cast instead of a second, + // conflicting global declaration. + const handler = (window as { + webkit?: { messageHandlers?: { agentChat?: AgentChatMessageHandler } }; + }).webkit?.messageHandlers?.agentChat; + return handler && typeof handler.postMessage === "function" ? handler : null; +} + +async function callNative( + handler: AgentChatMessageHandler, + method: string, + params: Record = {}, +): Promise { + const reply = (await handler.postMessage({ + id: makeClientId(), + method, + params, + })) as NativeReply; + if (!reply.ok) { + throw new AgentChatBridgeError( + reply.error?.userMessage || "Native bridge request failed.", + reply.error?.code, + ); + } + return reply.value; +} + +/** + * Picks the transport for this page: the WebKit message handler when the + * macOS host injected one, otherwise the fixture-replaying mock bridge. + */ +export function resolveAgentChatBridge(): AgentChatBridgeClient { + ensureAgentChatBridgeInstalled(); + const handler = nativeAgentChatHandler(); + if (handler) { + return { + kind: "native", + init: () => callNative(handler, "chat.init"), + subscribe: () => callNative(handler, "chat.subscribe"), + dispose() {}, + }; + } + return createMockAgentChatBridge(); +} diff --git a/webviews/src/agent-chat/conversationStore.test.ts b/webviews/src/agent-chat/conversationStore.test.ts new file mode 100644 index 000000000000..e3828aa50037 --- /dev/null +++ b/webviews/src/agent-chat/conversationStore.test.ts @@ -0,0 +1,138 @@ +import { describe, expect, test } from "bun:test"; +import { + applyAgentEvent, + initialConversationState, + reduceConversation, + type ConversationState, +} from "./conversationStore"; +import type { AgentSessionRef, ConversationItem } from "./protocol"; + +const session: AgentSessionRef = { + provider: "claude", + session_id: "abc-123", + transcript_path: "/tmp/abc-123.jsonl", + cwd: "/Users/dev/project", +}; + +function item(id: string, overrides: Partial = {}): ConversationItem { + return { id, type: "assistant_message", status: "completed", text: id, ...overrides }; +} + +function snapshotted(items: ConversationItem[], seq = 1): ConversationState { + return applyAgentEvent(initialConversationState(), { + type: "snapshot", + seq, + session, + items, + }); +} + +describe("applyAgentEvent", () => { + test("snapshot replaces items, sets session, and resets the cursor", () => { + const state = snapshotted([item("a"), item("b")], 5); + expect(state.items.map((entry) => entry.id)).toEqual(["a", "b"]); + expect(state.session).toEqual(session); + expect(state.lastSeq).toBe(5); + expect(state.hasSnapshot).toBe(true); + }); + + test("a fresh snapshot applies even when its seq is lower (reconnect)", () => { + const state = snapshotted([item("a")], 50); + const next = applyAgentEvent(state, { type: "snapshot", seq: 1, session, items: [item("z")] }); + expect(next.items.map((entry) => entry.id)).toEqual(["z"]); + expect(next.lastSeq).toBe(1); + }); + + test("item.started appends and item.completed updates in place", () => { + const started = applyAgentEvent(snapshotted([item("a")]), { + type: "item.started", + seq: 2, + item: item("tool-1", { type: "command_execution", status: "in_progress", title: "ls" }), + }); + expect(started.items.map((entry) => entry.id)).toEqual(["a", "tool-1"]); + + const completed = applyAgentEvent(started, { + type: "item.completed", + seq: 3, + item: item("tool-1", { + type: "command_execution", + status: "completed", + title: "ls", + output: { text: "README.md" }, + }), + }); + expect(completed.items.map((entry) => entry.id)).toEqual(["a", "tool-1"]); + expect(completed.items[1]?.status).toBe("completed"); + expect(completed.items[1]?.output?.text).toBe("README.md"); + }); + + test("stale and duplicate seqs are dropped", () => { + const state = snapshotted([item("a")], 4); + const dup = applyAgentEvent(state, { type: "item.completed", seq: 4, item: item("late") }); + expect(dup).toBe(state); + const stale = applyAgentEvent(state, { type: "item.completed", seq: 2, item: item("late") }); + expect(stale).toBe(state); + }); + + test("stream errors record and the next snapshot clears them", () => { + const errored = applyAgentEvent(snapshotted([item("a")]), { + type: "error", + seq: 2, + message: "transcript unreadable", + recoverable: true, + }); + expect(errored.streamError).toEqual({ message: "transcript unreadable", recoverable: true }); + const recovered = applyAgentEvent(errored, { type: "snapshot", seq: 3, session, items: [] }); + expect(recovered.streamError).toBeNull(); + }); + + test("session.meta updates the session ref", () => { + const renamed = { ...session, title: "Fix the parser" }; + const next = applyAgentEvent(snapshotted([item("a")]), { + type: "session.meta", + seq: 2, + session: renamed, + }); + expect(next.session?.title).toBe("Fix the parser"); + }); +}); + +describe("reduceConversation", () => { + test("init applies daemon status and optional session", () => { + const next = reduceConversation(initialConversationState(), { + type: "init", + result: { session, daemon_status: "ready" }, + }); + expect(next.phase).toBe("ready"); + expect(next.session).toEqual(session); + expect(next.daemonStatus).toBe("ready"); + }); + + test("init-failed marks the daemon unavailable with detail", () => { + const next = reduceConversation(initialConversationState(), { + type: "init-failed", + detail: "binary missing", + }); + expect(next.phase).toBe("failed"); + expect(next.daemonStatus).toBe("unavailable"); + expect(next.daemonDetail).toBe("binary missing"); + }); + + test("daemon.status frames update status without touching items", () => { + const ready = reduceConversation(initialConversationState(), { + type: "init", + result: { session, daemon_status: "ready" }, + }); + const withItems = { + ...ready, + ...snapshotted([item("a")]), + }; + const next = reduceConversation(withItems, { + type: "inbound", + message: { type: "daemon.status", status: "unavailable", detail: "daemon exited" }, + }); + expect(next.daemonStatus).toBe("unavailable"); + expect(next.daemonDetail).toBe("daemon exited"); + expect(next.items).toEqual(withItems.items); + }); +}); diff --git a/webviews/src/agent-chat/conversationStore.ts b/webviews/src/agent-chat/conversationStore.ts new file mode 100644 index 000000000000..ce916682d9a4 --- /dev/null +++ b/webviews/src/agent-chat/conversationStore.ts @@ -0,0 +1,129 @@ +// Pure conversation state for the /agent-chat surface. +// +// `reduceConversation` is the single state transition for the panel: the init +// reply, daemon status frames, and the `AgentEvent` stream all flow through +// it. `applyAgentEvent` implements the protocol's ordering rules: a snapshot +// replaces the item list and resets the sequence cursor, `item.*` events +// upsert by item id while preserving first-appearance order, and stale events +// (`seq` at or below the cursor) are ignored except for fresh snapshots. + +import type { + AgentChatBridgeInbound, + AgentChatInitResult, + AgentEvent, + AgentSessionRef, + ConversationItem, +} from "./protocol"; + +export type DaemonStatus = "ready" | "unavailable"; + +export type ConversationPhase = "connecting" | "failed" | "ready"; + +export type ConversationState = { + /** Bridge lifecycle: init pending, init replied, or init threw. */ + phase: ConversationPhase; + session: AgentSessionRef | null; + /** Ordered by first appearance; updates replace in place. */ + items: ConversationItem[]; + daemonStatus: DaemonStatus; + daemonDetail: string | null; + /** Highest applied event seq; 0 before the first snapshot. */ + lastSeq: number; + /** True once a snapshot has been applied (distinguishes empty transcripts). */ + hasSnapshot: boolean; + /** Last stream-level `error` event, cleared by the next snapshot. */ + streamError: { message: string; recoverable: boolean } | null; +}; + +export type ConversationAction = + | { type: "init"; result: AgentChatInitResult } + | { type: "init-failed"; detail: string } + | { type: "inbound"; message: AgentChatBridgeInbound }; + +export function initialConversationState(): ConversationState { + return { + phase: "connecting", + session: null, + items: [], + daemonStatus: "ready", + daemonDetail: null, + lastSeq: 0, + hasSnapshot: false, + streamError: null, + }; +} + +export function reduceConversation( + state: ConversationState, + action: ConversationAction, +): ConversationState { + switch (action.type) { + case "init": + return { + ...state, + phase: "ready", + session: action.result.session ?? state.session, + daemonStatus: action.result.daemon_status, + daemonDetail: action.result.daemon_detail ?? null, + }; + case "init-failed": + return { + ...state, + phase: "failed", + daemonStatus: "unavailable", + daemonDetail: action.detail, + }; + case "inbound": + if (action.message.type === "daemon.status") { + return { + ...state, + daemonStatus: action.message.status, + daemonDetail: action.message.detail ?? null, + }; + } + return applyAgentEvent(state, action.message.event); + } +} + +export function applyAgentEvent(state: ConversationState, event: AgentEvent): ConversationState { + // A fresh snapshot always applies: it is the reconnect/replace point and + // resets the sequence cursor (the daemon restarts seq per subscription). + if (event.type === "snapshot") { + return { + ...state, + hasSnapshot: true, + lastSeq: event.seq, + session: event.session, + items: [...event.items], + streamError: null, + }; + } + // Seq regression guard: drop stale or duplicate frames. + if (event.seq <= state.lastSeq) { + return state; + } + switch (event.type) { + case "item.started": + case "item.updated": + case "item.completed": + return { ...state, lastSeq: event.seq, items: upsertItem(state.items, event.item) }; + case "session.meta": + return { ...state, lastSeq: event.seq, session: event.session }; + case "error": + return { + ...state, + lastSeq: event.seq, + streamError: { message: event.message, recoverable: event.recoverable }, + }; + } +} + +function upsertItem(items: ConversationItem[], item: ConversationItem): ConversationItem[] { + const index = items.findIndex((existing) => existing.id === item.id); + if (index < 0) { + return [...items, item]; + } + const next = items.slice(); + next[index] = item; + return next; +} diff --git a/webviews/src/agent-chat/mockBridge.ts b/webviews/src/agent-chat/mockBridge.ts new file mode 100644 index 000000000000..47cec37dbf3b --- /dev/null +++ b/webviews/src/agent-chat/mockBridge.ts @@ -0,0 +1,289 @@ +// Mock agent-chat bridge for vite dev and headless tests. +// +// Used whenever `window.webkit.messageHandlers.agentChat` is absent. Replays a +// realistic fixture conversation: `chat.subscribe` delivers a snapshot with a +// mixed item list, then a short scripted sequence of item.started / +// item.updated / item.completed ticks on a timer, all through the real inbound +// path (`window.cmuxAgentChatBridge.receive`). + +import type { AgentChatBridgeClient } from "./bridge"; +import type { + AgentChatBridgeInbound, + AgentChatInitResult, + AgentEvent, + AgentSessionRef, + ConversationItem, +} from "./protocol"; + +const MOCK_TICK_INTERVAL_MS = 1200; + +const mockSession: AgentSessionRef = { + provider: "claude", + session_id: "6f1f5e7e-mock-4d27-9c40-agentchatdev1", + transcript_path: + "~/.claude/projects/-Users-dev-fun-cmux/6f1f5e7e-mock-4d27-9c40-agentchatdev1.jsonl", + cwd: "~/fun/cmux", + title: "Wire the /agent-chat surface", + updated_at: "2026-06-09T17:03:21Z", +}; + +export function mockSnapshotItems(): ConversationItem[] { + return [ + { + id: "msg-1", + type: "user_message", + status: "completed", + text: "Add a structured chat view for agent sessions. Start by listing the failing webview tests.", + created_at: "2026-06-09T16:58:01Z", + }, + { + id: "reasoning-1", + type: "reasoning", + status: "completed", + text: "The webviews app keeps tests under `test/`. I should run `bun test` first to get a baseline, then look at the failures one by one.", + created_at: "2026-06-09T16:58:04Z", + }, + { + id: "tool-1", + type: "command_execution", + status: "completed", + title: "bun test", + tool_name: "Bash", + tool_use_id: "toolu_mock_01", + input: { command: "bun test", description: "Run webview tests" }, + output: { + text: "12 pass\n 0 fail\nRan 12 tests across 11 files. [412ms]", + }, + created_at: "2026-06-09T16:58:06Z", + }, + { + id: "msg-2", + type: "assistant_message", + status: "completed", + text: "All **12 tests pass**, so there is no baseline failure. Next I will:\n\n1. Add the `/agent-chat` route\n2. Build the bridge client\n3. Render the timeline\n\n```bash\nbun run typecheck && bun test\n```", + created_at: "2026-06-09T16:58:09Z", + }, + { + id: "msg-3", + type: "user_message", + status: "completed", + text: "Sounds good. Check how the diff surface registers its route before you add a new one.", + created_at: "2026-06-09T16:59:30Z", + }, + { + id: "plan-1", + type: "plan", + status: "completed", + text: "1. Read `src/router.tsx` route registrations\n2. Mirror the `/diff` pattern for `/agent-chat`\n3. Split the surface into its own chunk", + created_at: "2026-06-09T16:59:33Z", + }, + { + id: "tool-2", + type: "dynamic_tool_call", + status: "completed", + title: "src/router.tsx", + tool_name: "Read", + tool_use_id: "toolu_mock_02", + input: { file_path: "webviews/src/router.tsx" }, + output: { text: "createRoute({ path: \"/diff\", component: WebviewComponent })\n…" }, + created_at: "2026-06-09T16:59:35Z", + }, + { + id: "tool-3", + type: "file_change", + status: "completed", + title: "webviews/src/router.tsx", + tool_name: "Edit", + tool_use_id: "toolu_mock_03", + input: { + file_path: "webviews/src/router.tsx", + old_string: "path: \"/agent-session\"", + new_string: "path: \"/agent-chat\"", + }, + output: { text: "Edited webviews/src/router.tsx" }, + created_at: "2026-06-09T16:59:42Z", + }, + { + id: "tool-4", + type: "web_search", + status: "completed", + title: "tanstack router hash history nested routes", + tool_name: "WebSearch", + tool_use_id: "toolu_mock_04", + input: { query: "tanstack router hash history nested routes" }, + output: { text: "TanStack Router docs: createHashHistory() keeps route state in the URL fragment…" }, + created_at: "2026-06-09T17:00:01Z", + }, + { + id: "tool-5", + type: "mcp_tool_call", + status: "failed", + title: "browser_screenshot", + tool_name: "mcp__browser__screenshot", + tool_use_id: "toolu_mock_05", + input: { url: "http://localhost:5173/#/agent-chat" }, + output: { text: "Error: no browser session connected", is_error: true }, + created_at: "2026-06-09T17:00:18Z", + }, + { + id: "compaction-1", + type: "context_compaction", + status: "completed", + text: "Context compacted (142k → 38k tokens)", + created_at: "2026-06-09T17:00:40Z", + }, + { + id: "error-1", + type: "error", + status: "completed", + text: "Provider stream interrupted; retrying transcript tail.", + created_at: "2026-06-09T17:00:41Z", + }, + { + id: "unknown-1", + type: "unknown", + status: "completed", + text: "queue-operation", + created_at: "2026-06-09T17:00:42Z", + }, + { + id: "msg-4", + type: "user_message", + status: "completed", + text: "Now run the verify gates and show me the summary.", + created_at: "2026-06-09T17:02:10Z", + }, + { + id: "tool-6", + type: "command_execution", + status: "in_progress", + title: "bun run typecheck && bun run lint:ci", + tool_name: "Bash", + tool_use_id: "toolu_mock_06", + input: { command: "bun run typecheck && bun run lint:ci" }, + created_at: "2026-06-09T17:02:12Z", + }, + ]; +} + +export function mockLiveEvents(startSeq: number): AgentEvent[] { + return [ + { + type: "item.updated", + seq: startSeq, + item: { + id: "tool-6", + type: "command_execution", + status: "in_progress", + title: "bun run typecheck && bun run lint:ci", + tool_name: "Bash", + tool_use_id: "toolu_mock_06", + input: { command: "bun run typecheck && bun run lint:ci" }, + output: { text: "$ tsc --noEmit" }, + created_at: "2026-06-09T17:02:12Z", + }, + }, + { + type: "item.completed", + seq: startSeq + 1, + item: { + id: "tool-6", + type: "command_execution", + status: "completed", + title: "bun run typecheck && bun run lint:ci", + tool_name: "Bash", + tool_use_id: "toolu_mock_06", + input: { command: "bun run typecheck && bun run lint:ci" }, + output: { + text: "$ tsc --noEmit\n$ oxlint . --react-plugin --jsx-a11y-plugin --import-plugin --deny-warnings\nFound 0 warnings and 0 errors.\nFinished in 64ms on 41 files with 102 rules using 10 threads.", + }, + created_at: "2026-06-09T17:02:12Z", + }, + }, + { + type: "item.started", + seq: startSeq + 2, + item: { + id: "reasoning-2", + type: "reasoning", + status: "in_progress", + text: "Both gates are green. Summarize the run and hand back to the user.", + created_at: "2026-06-09T17:03:02Z", + }, + }, + { + type: "item.completed", + seq: startSeq + 3, + item: { + id: "reasoning-2", + type: "reasoning", + status: "completed", + text: "Both gates are green. Summarize the run and hand back to the user.", + created_at: "2026-06-09T17:03:02Z", + }, + }, + { + type: "item.completed", + seq: startSeq + 4, + item: { + id: "msg-5", + type: "assistant_message", + status: "completed", + text: "Verify gates are green:\n\n- `bun run typecheck` — no errors\n- `bun run lint:ci` — 0 warnings\n\nThe `/agent-chat` surface is registered and renders this mock stream in dev.", + created_at: "2026-06-09T17:03:20Z", + }, + }, + ]; +} + +function deliver(message: AgentChatBridgeInbound): void { + if (typeof window === "undefined") { + return; + } + window.cmuxAgentChatBridge?.receive(message); +} + +export function createMockAgentChatBridge(): AgentChatBridgeClient { + let timer: ReturnType | null = null; + let disposed = false; + + const stopTimer = () => { + if (timer !== null) { + clearInterval(timer); + timer = null; + } + }; + + return { + kind: "mock", + init(): Promise { + return Promise.resolve({ + session: mockSession, + daemon_status: "ready", + }); + }, + subscribe(): Promise { + if (disposed || timer !== null) { + return Promise.resolve(); + } + deliver({ + type: "agent.event", + event: { type: "snapshot", seq: 1, session: mockSession, items: mockSnapshotItems() }, + }); + const pending = mockLiveEvents(2); + timer = setInterval(() => { + const event = pending.shift(); + if (!event) { + stopTimer(); + return; + } + deliver({ type: "agent.event", event }); + }, MOCK_TICK_INTERVAL_MS); + return Promise.resolve(); + }, + dispose(): void { + disposed = true; + stopTimer(); + }, + }; +} diff --git a/webviews/src/agent-chat/react/AgentChatApp.tsx b/webviews/src/agent-chat/react/AgentChatApp.tsx new file mode 100644 index 000000000000..21c25831bd6c --- /dev/null +++ b/webviews/src/agent-chat/react/AgentChatApp.tsx @@ -0,0 +1,241 @@ +// /agent-chat surface: read-only structured chat timeline over the normalized +// agent conversation protocol (see ../protocol.ts and +// docs/agent-conversation-protocol.md). + +import { useEffect, useReducer, useState } from "react"; +import type { UIEvent as ReactUIEvent, ReactNode } from "react"; +import { + resolveAgentChatBridge, + subscribeToAgentChatInbound, + type AgentChatBridgeClient, +} from "../bridge"; +import { + initialConversationState, + reduceConversation, + type ConversationAction, + type ConversationState, +} from "../conversationStore"; +import { providerDisplayName, sessionDisplayTitle } from "./display"; +import { ItemRow, TurnSeparator } from "./rows"; + +/** Distance from the bottom (px) still treated as "at the bottom". */ +const FOLLOW_THRESHOLD_PX = 24; + +type BridgeFactory = () => AgentChatBridgeClient; + +/** + * Connects the panel to the agent-chat bridge for the lifetime of the + * component: registers the inbound listener, performs `chat.init`, then + * `chat.subscribe`. Narrow contract: runs once per (stable) factory, forwards + * everything as reducer actions, and disposes the bridge client on unmount. + * This is the surface's one lifecycle effect, mirroring the agent-session + * surface's `useInitialData`/`useNativeEvents` hooks. + */ +function useAgentChatConnection( + dispatch: (action: ConversationAction) => void, + createBridge: BridgeFactory | undefined, +) { + useEffect(() => { + const bridge = createBridge ? createBridge() : resolveAgentChatBridge(); + const unsubscribe = subscribeToAgentChatInbound((message) => { + dispatch({ type: "inbound", message }); + }); + let cancelled = false; + void (async () => { + try { + const result = await bridge.init(); + if (cancelled) { + return; + } + dispatch({ type: "init", result }); + await bridge.subscribe(); + } catch (error) { + if (!cancelled) { + dispatch({ + type: "init-failed", + detail: error instanceof Error ? error.message : "Agent bridge request failed.", + }); + } + } + })(); + return () => { + cancelled = true; + unsubscribe(); + bridge.dispose(); + }; + }, [dispatch, createBridge]); +} + +export function AgentChatApp({ createBridge }: { createBridge?: BridgeFactory }) { + const [state, dispatch] = useReducer( + reduceConversation, + undefined, + initialConversationState, + ); + useAgentChatConnection(dispatch, createBridge); + return ( +
+ + {state.daemonStatus === "unavailable" && state.items.length > 0 ? ( + + ) : null} + +
+ ); +} + +function HeaderStrip({ state }: { state: ConversationState }) { + const session = state.session; + return ( +
+ + {providerDisplayName(session?.provider)} + + + {sessionDisplayTitle(session)} + {session?.cwd ? {session.cwd} : null} + + + +
+ ); +} + +function DaemonBanner({ detail }: { detail: string | null }) { + return ( + + Agent daemon unavailable{detail ? `: ${detail}` : "."} Showing the last known transcript. + + ); +} + +function TimelineBody({ state }: { state: ConversationState }) { + if (state.phase === "connecting") { + return ; + } + if (state.daemonStatus === "unavailable" && state.items.length === 0) { + return ( + + ); + } + if (!state.hasSnapshot && state.session === null) { + return ( + + ); + } + if (!state.hasSnapshot) { + return ; + } + if (state.items.length === 0) { + return ( + + ); + } + return ; +} + +function EmptyState({ title, detail }: { title: string; detail: string }) { + return ( +
+ {title} + {detail} +
+ ); +} + +function Timeline({ state }: { state: ConversationState }) { + // Auto-follow is fully derived: `unfollowedAtSeq === null` means "stick to + // the bottom". Scroll events flip it (leaving the bottom unfollows, reaching + // the bottom re-follows), and the seq recorded at unfollow time tells us + // whether new items arrived for the jump-to-latest pill. No effects: the + // bottom anchor below is keyed by lastSeq, so every applied event remounts + // it and its callback ref re-pins the viewport while following. + const [scrollContainer, setScrollContainer] = useState(null); + const [unfollowedAtSeq, setUnfollowedAtSeq] = useState(null); + const following = unfollowedAtSeq === null; + const hasNewWhileUnfollowed = unfollowedAtSeq !== null && state.lastSeq > unfollowedAtSeq; + + const scrollToBottom = (node: HTMLElement | null) => { + if (node) { + // Instant (non-smooth) jump: the resulting scroll event lands at the + // bottom in one step, so the handler below keeps `following` stable. + node.scrollTop = node.scrollHeight; + } + }; + + const handleScroll = (event: ReactUIEvent) => { + const node = event.currentTarget; + const atBottom = + node.scrollTop + node.clientHeight >= node.scrollHeight - FOLLOW_THRESHOLD_PX; + if (atBottom) { + if (unfollowedAtSeq !== null) { + setUnfollowedAtSeq(null); + } + } else if (unfollowedAtSeq === null) { + setUnfollowedAtSeq(state.lastSeq); + } + }; + + const anchorRef = (node: HTMLDivElement | null) => { + if (node && following) { + scrollToBottom(node.parentElement); + } + }; + + const rows: ReactNode[] = []; + state.items.forEach((item, index) => { + if (item.type === "user_message" && index > 0) { + rows.push(); + } + rows.push(); + }); + + return ( +
+
+ {rows} + {state.streamError ? ( +
+ Stream error + + {state.streamError.message} + {state.streamError.recoverable ? " (retrying)" : ""} + +
+ ) : null} +
+
+ {!following && hasNewWhileUnfollowed ? ( + + ) : null} +
+ ); +} diff --git a/webviews/src/agent-chat/react/display.ts b/webviews/src/agent-chat/react/display.ts new file mode 100644 index 000000000000..74ccbadb00b3 --- /dev/null +++ b/webviews/src/agent-chat/react/display.ts @@ -0,0 +1,86 @@ +// Pure display helpers for the agent-chat timeline. + +import type { AgentSessionRef, ConversationItem, ItemType } from "../protocol"; + +export function providerDisplayName(provider: string | undefined): string { + if (!provider) { + return "Agent"; + } + if (provider === "claude") { + return "Claude"; + } + if (provider === "codex") { + return "Codex"; + } + return provider.charAt(0).toUpperCase() + provider.slice(1); +} + +export function sessionDisplayTitle(session: AgentSessionRef | null): string { + if (!session) { + return "Agent session"; + } + if (session.title && session.title.trim() !== "") { + return session.title; + } + const transcriptFile = session.transcript_path.split("/").pop(); + return transcriptFile || session.session_id; +} + +const toolTypeLabels: Partial> = { + command_execution: "Run", + file_change: "Edit", + mcp_tool_call: "MCP", + dynamic_tool_call: "Tool", + web_search: "Search", +}; + +export function isToolItemType(type: ItemType): boolean { + return type in toolTypeLabels; +} + +export function toolTypeLabel(type: ItemType): string { + return toolTypeLabels[type] ?? "Tool"; +} + +export function toolItemTitle(item: ConversationItem): string { + return item.title || item.tool_name || toolTypeLabel(item.type); +} + +const toolTypeGlyphs: Partial> = { + command_execution: "$", + file_change: "±", + mcp_tool_call: "⚙", + dynamic_tool_call: "⚙", + web_search: "⌕", +}; + +export function toolTypeGlyph(type: ItemType): string { + return toolTypeGlyphs[type] ?? "⚙"; +} + +export function formatToolInput(input: unknown): string { + if (input === undefined || input === null) { + return ""; + } + if (typeof input === "string") { + return input; + } + try { + return JSON.stringify(input, null, 2) ?? String(input); + } catch { + return String(input); + } +} + +export function statusGlyph(status: ConversationItem["status"]): string { + switch (status) { + case "completed": + return "✓"; + case "failed": + return "✕"; + case "declined": + return "⊘"; + case "in_progress": + return ""; + } +} diff --git a/webviews/src/agent-chat/react/rows.tsx b/webviews/src/agent-chat/react/rows.tsx new file mode 100644 index 000000000000..9aff0ed41286 --- /dev/null +++ b/webviews/src/agent-chat/react/rows.tsx @@ -0,0 +1,196 @@ +// Timeline row components for the /agent-chat surface, one renderer per +// `ItemType` family. Expand/collapse is plain per-row component state; markdown +// goes through the shared sanitizing renderer from the agent-session surface. + +import { useState } from "react"; +import { renderMarkdownHTML } from "../../agent-session/shared/markdown"; +import type { ConversationItem } from "../protocol"; +import { + formatToolInput, + isToolItemType, + statusGlyph, + toolItemTitle, + toolTypeGlyph, + toolTypeLabel, +} from "./display"; + +export function ItemRow({ item }: { item: ConversationItem }) { + if (item.type === "user_message") { + return ; + } + if (item.type === "assistant_message") { + return ; + } + if (item.type === "reasoning") { + return ; + } + if (item.type === "plan") { + return ; + } + if (isToolItemType(item.type)) { + return ; + } + return ; +} + +function rowDataProps(item: ConversationItem) { + return { + "data-item-id": item.id, + "data-item-type": item.type, + "data-item-status": item.status, + }; +} + +function UserMessageRow({ item }: { item: ConversationItem }) { + return ( +
+
{item.text ?? ""}
+
+ ); +} + +function AssistantMessageRow({ item }: { item: ConversationItem }) { + return ( +
+
+ {item.status !== "completed" ? : null} +
+ ); +} + +function ReasoningRow({ item }: { item: ConversationItem }) { + const [expanded, setExpanded] = useState(false); + return ( +
+ + {expanded ? ( +
+ ) : null} +
+ ); +} + +function PlanRow({ item }: { item: ConversationItem }) { + return ( +
+
+ Plan + {item.status !== "completed" ? : null} +
+
+
+ ); +} + +function ToolRow({ item }: { item: ConversationItem }) { + const [expanded, setExpanded] = useState(false); + const input = formatToolInput(item.input); + const outputText = item.output?.text ?? ""; + const imageCount = item.output?.image_ids?.length ?? 0; + const failed = item.status === "failed" || item.output?.is_error === true; + return ( +
+ + {expanded ? ( +
+ {input !== "" ? ( +
{input}
+ ) : null} + {outputText !== "" ? ( +
+              {outputText}
+            
+ ) : null} + {imageCount > 0 ? ( +
+ {imageCount === 1 ? "1 image attachment" : `${imageCount} image attachments`} +
+ ) : null} + {input === "" && outputText === "" && imageCount === 0 ? ( +
No input or output recorded.
+ ) : null} +
+ ) : null} +
+ ); +} + +function SystemRow({ item }: { item: ConversationItem }) { + const label = + item.type === "context_compaction" + ? "Context compacted" + : item.type === "error" + ? "Error" + : "Event"; + return ( +
+ {label} + {item.text ? {item.text} : null} +
+ ); +} + +export function StatusIndicator({ status }: { status: ConversationItem["status"] }) { + if (status === "in_progress") { + return ( + + + ); + } + return ( + + {statusGlyph(status)} + + ); +} + +export function TurnSeparator() { + return ); @@ -196,9 +199,17 @@ function Timeline({ state }: { state: ConversationState }) { } }; + // Turn boundaries: real (hook-observed turn.started indexes) once hooks are + // live; items that predate the first real boundary (snapshot history) keep + // the user_message-derived fallback. + const realBoundaries = new Set(state.turnStarts); + const firstRealBoundary = + state.turnStarts.length > 0 ? Math.min(...state.turnStarts) : Number.POSITIVE_INFINITY; const rows: ReactNode[] = []; state.items.forEach((item, index) => { - if (item.type === "user_message" && index > 0) { + const isBoundary = + index >= firstRealBoundary ? realBoundaries.has(index) : item.type === "user_message"; + if (isBoundary && index > 0) { rows.push(); } rows.push(); diff --git a/webviews/src/agent-chat/react/rows.tsx b/webviews/src/agent-chat/react/rows.tsx index 9aff0ed41286..a3dbb7508aaf 100644 --- a/webviews/src/agent-chat/react/rows.tsx +++ b/webviews/src/agent-chat/react/rows.tsx @@ -4,6 +4,7 @@ import { useState } from "react"; import { renderMarkdownHTML } from "../../agent-session/shared/markdown"; +import type { PendingRequest } from "../conversationStore"; import type { ConversationItem } from "../protocol"; import { formatToolInput, @@ -194,3 +195,28 @@ export function StatusIndicator({ status }: { status: ConversationItem["status"] export function TurnSeparator() { return