From 4b3d85c54c3bcad37378f7e456a05bbd73d0fb17 Mon Sep 17 00:00:00 2001 From: Adam Cheng <63501289+627150795@users.noreply.github.com> Date: Tue, 8 Sep 2026 00:26:23 +0800 Subject: [PATCH 1/2] fix(web): keep composer drafts scoped to sessions --- tests/web/app-render.spec.ts | 196 ++++++++++++++++++++++ web/ui/src/app/App.tsx | 1 + web/ui/src/features/composer/Composer.tsx | 70 +++++++- 3 files changed, 261 insertions(+), 6 deletions(-) diff --git a/tests/web/app-render.spec.ts b/tests/web/app-render.spec.ts index 522432f5..14572074 100644 --- a/tests/web/app-render.spec.ts +++ b/tests/web/app-render.spec.ts @@ -100,6 +100,14 @@ function renderWithI18n(node: ReturnType) { return render(createElement(I18nextProvider, { i18n }, node)); } +function deferred() { + let resolve!: (value: T) => void; + const promise = new Promise((next) => { + resolve = next; + }); + return { promise, resolve }; +} + describe("OpenPI React transcript", () => { it("renders sanitized GFM and projects images as links", () => { const { container } = render( @@ -784,3 +792,191 @@ it("does not repeat a provider identity used as the fallback model label", () => screen.queryByText("provider-alpha/model-a (provider-alpha/model-a)"), ).toBeNull(); }); + +it("keeps a retyped draft when an earlier send settles", async () => { + const result = deferred(); + const store = createWebStore(); + const sendPrompt = vi.fn(() => result.promise); + const snapshot = activeSnapshot(); + snapshot.runtime.status = "idle"; + const props = { + snapshot, + selectedPath: "/tmp/session", + selectedWorkspace: "/tmp", + sessionSwitching: false, + promptAdmissionPending: false, + liveRunning: false, + landing: false, + activeTurn: null, + turnCancellationPending: false, + turnTerminalStatus: null, + pendingFollowUpsReceipt: null, + actions: { ...store.getState().actions, sendPrompt }, + }; + renderWithI18n(createElement(Composer, props)); + const input = screen.getByRole("textbox"); + + fireEvent.change(input, { target: { value: "first" } }); + fireEvent.click(screen.getByRole("button", { name: i18n.t("send") })); + fireEvent.change(input, { target: { value: "second" } }); + fireEvent.change(input, { target: { value: "first" } }); + + await act(async () => { + result.resolve(true); + await result.promise; + }); + + expect(input.value).toBe("first"); +}); + +it("keeps a draft after a failed send", async () => { + const result = deferred(); + const store = createWebStore(); + const sendPrompt = vi.fn(() => result.promise); + const snapshot = activeSnapshot(); + snapshot.runtime.status = "idle"; + renderWithI18n( + createElement(Composer, { + snapshot, + selectedPath: "/tmp/session", + selectedWorkspace: "/tmp", + sessionSwitching: false, + promptAdmissionPending: false, + liveRunning: false, + landing: false, + activeTurn: null, + turnCancellationPending: false, + turnTerminalStatus: null, + pendingFollowUpsReceipt: null, + actions: { ...store.getState().actions, sendPrompt }, + }), + ); + const input = screen.getByRole("textbox"); + + fireEvent.change(input, { target: { value: "keep me" } }); + fireEvent.click(screen.getByRole("button", { name: i18n.t("send") })); + await act(async () => { + result.resolve(false); + await result.promise; + }); + + expect(input.value).toBe("keep me"); +}); + +it("clears an old session draft without letting its late send clear the new one", async () => { + const result = deferred(); + const store = createWebStore(); + const sendPrompt = vi.fn(() => result.promise); + const snapshot = activeSnapshot(); + snapshot.runtime.status = "idle"; + const props = { + snapshot, + selectedPath: "/tmp/session", + selectedWorkspace: "/tmp", + sessionSwitching: false, + promptAdmissionPending: false, + liveRunning: false, + landing: false, + activeTurn: null, + turnCancellationPending: false, + turnTerminalStatus: null, + pendingFollowUpsReceipt: null, + actions: { ...store.getState().actions, sendPrompt }, + }; + const view = renderWithI18n(createElement(Composer, props)); + const input = screen.getByRole("textbox"); + fireEvent.change(input, { target: { value: "old session" } }); + fireEvent.click(screen.getByRole("button", { name: i18n.t("send") })); + + const nextSnapshot = { + ...snapshot, + currentSessionId: "next-session", + selectedSession: { + ...snapshot.selectedSession!, + id: "next-session", + path: "/tmp/next-session", + }, + }; + view.rerender( + createElement( + I18nextProvider, + { i18n }, + createElement(Composer, { + ...props, + snapshot: nextSnapshot, + selectedPath: "/tmp/next-session", + }), + ), + ); + expect(input.value).toBe(""); + + fireEvent.change(input, { target: { value: "new session" } }); + await act(async () => { + result.resolve(true); + await result.promise; + }); + + expect(input.value).toBe("new session"); +}); + +it("transfers a new-session draft until its first send is accepted", async () => { + const result = deferred(); + const store = createWebStore(); + const sendPrompt = vi.fn(() => result.promise); + const draftSnapshot = activeSnapshot(); + draftSnapshot.runtime.status = "idle"; + delete draftSnapshot.currentSessionId; + delete draftSnapshot.selectedSession; + draftSnapshot.sessions = []; + const props = { + snapshot: draftSnapshot, + selectedPath: null, + selectedWorkspace: "/tmp", + sessionSwitching: false, + promptAdmissionPending: false, + liveRunning: false, + landing: true, + activeTurn: null, + turnCancellationPending: false, + turnTerminalStatus: null, + pendingFollowUpsReceipt: null, + actions: { ...store.getState().actions, sendPrompt }, + }; + const view = renderWithI18n(createElement(Composer, props)); + const input = screen.getByRole("textbox"); + fireEvent.change(input, { target: { value: "first prompt" } }); + fireEvent.click(screen.getByRole("button", { name: i18n.t("send") })); + + const createdSnapshot = { + ...draftSnapshot, + currentSessionId: "created-session", + selectedSession: { + id: "created-session", + path: "/tmp/created-session", + cwd: "/tmp", + entries: [], + bytes: 0, + truncation, + }, + }; + view.rerender( + createElement( + I18nextProvider, + { i18n }, + createElement(Composer, { + ...props, + snapshot: createdSnapshot, + selectedPath: "/tmp/created-session", + sessionSwitching: true, + landing: false, + }), + ), + ); + expect(input.value).toBe("first prompt"); + + await act(async () => { + result.resolve(true); + await result.promise; + }); + expect(input.value).toBe(""); +}); diff --git a/web/ui/src/app/App.tsx b/web/ui/src/app/App.tsx index a2865d8b..22d4c246 100644 --- a/web/ui/src/app/App.tsx +++ b/web/ui/src/app/App.tsx @@ -177,6 +177,7 @@ export function App() { turnTerminalStatus={state.turnTerminalStatus} pendingFollowUpsReceipt={state.pendingFollowUpsReceipt} snapshot={state.snapshot} + selectedPath={state.selectedPath} selectedWorkspace={state.selectedWorkspace} sessionSwitching={state.sessionSwitching} promptAdmissionPending={state.promptAdmissionPending} diff --git a/web/ui/src/features/composer/Composer.tsx b/web/ui/src/features/composer/Composer.tsx index f02a8a65..11dc5d88 100644 --- a/web/ui/src/features/composer/Composer.tsx +++ b/web/ui/src/features/composer/Composer.tsx @@ -9,7 +9,7 @@ import { Square, SlidersHorizontal, } from "lucide-react"; -import { type FormEvent, useRef, useState } from "react"; +import { type FormEvent, useEffect, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import type { WebModelSummary, @@ -25,6 +25,7 @@ interface ComposerProps { modelSelectionPending?: boolean; onInspect?: (terminalId?: string) => void; snapshot: WebSnapshot | null; + selectedPath?: string | null; selectedWorkspace: string | null; sessionSwitching: boolean; promptAdmissionPending: boolean; @@ -47,6 +48,20 @@ export function Composer(props: ComposerProps) { const [prompt, setPrompt] = useState(""); const textarea = useRef(null); const selected = props.snapshot?.selectedSession; + const selectedPath = + props.selectedPath === undefined + ? (selected?.path ?? null) + : props.selectedPath; + const draftScope = + selectedPath ?? + (props.selectedWorkspace ? `new:${props.selectedWorkspace}` : "none"); + const draftScopeRef = useRef(draftScope); + const draftRevision = useRef(0); + const pendingSubmission = useRef<{ + revision: number; + scope: string; + canTransferToCreatedSession: boolean; + } | null>(null); const active = Boolean( !props.workspaceDraft && selected?.id && @@ -68,6 +83,29 @@ export function Composer(props: ComposerProps) { const disabled = props.sessionSwitching || (!canCompose && Boolean(props.selectedWorkspace)); + useEffect(() => { + const previousScope = draftScopeRef.current; + if (previousScope === draftScope) return; + draftScopeRef.current = draftScope; + + const submission = pendingSubmission.current; + const createdSession = + submission?.canTransferToCreatedSession && + submission.scope === previousScope && + Boolean(selectedPath) && + props.snapshot?.selectedSession?.path === selectedPath; + if (createdSession) { + submission.scope = draftScope; + return; + } + + draftRevision.current += 1; + setPrompt(""); + if (submission?.scope === previousScope) { + submission.canTransferToCreatedSession = false; + } + }, [draftScope, props.snapshot?.selectedSession?.path, selectedPath]); + const resize = (element: HTMLTextAreaElement) => { element.style.height = "auto"; element.style.height = `${Math.min(element.scrollHeight, 220)}px`; @@ -80,11 +118,30 @@ export function Composer(props: ComposerProps) { await props.actions.chooseWorkspace(); return; } - if (await props.actions.sendPrompt(prompt)) { - setPrompt(""); - if (textarea.current) { - textarea.current.style.height = "auto"; - textarea.current.style.overflowY = "hidden"; + const submission = { + revision: draftRevision.current, + scope: draftScopeRef.current, + canTransferToCreatedSession: draftSession, + }; + pendingSubmission.current = submission; + try { + if (await props.actions.sendPrompt(prompt)) { + if ( + pendingSubmission.current === submission && + draftScopeRef.current === submission.scope && + draftRevision.current === submission.revision + ) { + draftRevision.current += 1; + setPrompt(""); + if (textarea.current) { + textarea.current.style.height = "auto"; + textarea.current.style.overflowY = "hidden"; + } + } + } + } finally { + if (pendingSubmission.current === submission) { + pendingSubmission.current = null; } } }; @@ -204,6 +261,7 @@ export function Composer(props: ComposerProps) { aria-label={t("describeTask")} placeholder={placeholder} onChange={(event) => { + draftRevision.current += 1; setPrompt(event.target.value); resize(event.currentTarget); }} From 180892fdeb9bd200a8d1b7f45063cb1a99dfd8de Mon Sep 17 00:00:00 2001 From: Adam Cheng <63501289+627150795@users.noreply.github.com> Date: Tue, 8 Sep 2026 12:12:52 +0800 Subject: [PATCH 2/2] build(web): refresh Composer bundle --- web/dist/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/dist/app.js b/web/dist/app.js index 01ddf819..4fd6117c 100644 --- a/web/dist/app.js +++ b/web/dist/app.js @@ -47,7 +47,7 @@ Try polyfilling it using "@formatjs/intl-pluralrules" `)}\n}`);let o=``;t.length>0&&(o=`@scope (${r}) to (${i}) {\n${t.join(` `)}\n}`);let s=nc(e);return s&&(o=o?`${o}\n\n${s}`:s),{prose:a,component:o}}function ac(e,t=!1){let n=(0,w.useCallback)(t=>{let n=window.matchMedia(e);return n.addEventListener(`change`,t),()=>n.removeEventListener(`change`,t)},[e]),r=(0,w.useCallback)(()=>window.matchMedia(e).matches,[e]),i=(0,w.useCallback)(()=>t,[t]);return(0,w.useSyncExternalStore)(n,r,i)}var oc=(0,w.createContext)(null);oc.displayName=`ThemeContext`;function sc(){return typeof document>`u`?null:document.documentElement.getAttribute(Ir(`theme`))}function cc(){return null}function lc(){return null}var uc=new Set,dc=null;function fc(){for(let e of uc)e()}function pc(e){return uc.add(e),uc.size===1&&typeof MutationObserver<`u`&&(dc=new MutationObserver(fc),dc.observe(document.documentElement,{attributes:!0,attributeFilter:[Ir(`theme`)]})),()=>{uc.delete(e),uc.size===0&&dc&&(dc.disconnect(),dc=null)}}function mc(){return()=>{}}function hc(e){return(0,w.useSyncExternalStore)(e?mc:pc,e?lc:sc,cc)}function gc(){let e=(0,w.use)(oc),t=hc(e!=null);return e?.theme.name??t}var _c={xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,width:`1em`,height:`1em`,"aria-hidden":!0},vc={xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,width:`1em`,height:`1em`,"aria-hidden":!0},yc={close:(0,L.jsx)(`svg`,{..._c,children:(0,L.jsx)(`path`,{d:`M6 6l12 12M6 18L18 6`})}),chevronDown:(0,L.jsx)(`svg`,{..._c,children:(0,L.jsx)(`path`,{d:`M6 9l6 6 6-6`})}),"numberInput:stepperDown":(0,L.jsx)(`svg`,{..._c,children:(0,L.jsx)(`path`,{d:`M7.5 9.75l4.5 4.5 4.5-4.5`})}),chevronLeft:(0,L.jsx)(`svg`,{..._c,children:(0,L.jsx)(`path`,{d:`M15 6l-6 6 6 6`})}),chevronRight:(0,L.jsx)(`svg`,{..._c,children:(0,L.jsx)(`path`,{d:`M9 6l6 6-6 6`})}),chevronsLeft:(0,L.jsx)(`svg`,{..._c,children:(0,L.jsx)(`path`,{d:`M18 6l-6 6 6 6M11 6l-6 6 6 6`})}),chevronsRight:(0,L.jsx)(`svg`,{..._c,children:(0,L.jsx)(`path`,{d:`M6 6l6 6-6 6M13 6l6 6-6 6`})}),check:(0,L.jsx)(`svg`,{..._c,children:(0,L.jsx)(`path`,{d:`M5 13l4 4L19 7`})}),success:(0,L.jsx)(`svg`,{...vc,children:(0,L.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 3a9 9 0 100 18 9 9 0 000-18zm4.06 6.56a.75.75 0 00-1.12-1l-3.94 4.4-1.94-1.94a.75.75 0 00-1.06 1.06l2.5 2.5a.75.75 0 001.09-.03l4.47-5z`})}),error:(0,L.jsx)(`svg`,{...vc,children:(0,L.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 3a9 9 0 100 18 9 9 0 000-18zm-2.47 5.47a.75.75 0 00-1.06 1.06L10.94 12l-2.47 2.47a.75.75 0 101.06 1.06L12 13.06l2.47 2.47a.75.75 0 101.06-1.06L13.06 12l2.47-2.47a.75.75 0 00-1.06-1.06L12 10.94l-2.47-2.47z`})}),warning:(0,L.jsx)(`svg`,{...vc,children:(0,L.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10.29 3.86L2.07 19.05A2 2 0 003.78 22h16.44a2 2 0 001.71-2.95L13.71 3.86a2 2 0 00-3.42 0zM12 9a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0112 9zm0 9a1 1 0 100-2 1 1 0 000 2z`})}),info:(0,L.jsx)(`svg`,{...vc,children:(0,L.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 3a9 9 0 100 18 9 9 0 000-18zm0 4a1 1 0 100 2 1 1 0 000-2zm-.75 3.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5z`})}),calendar:(0,L.jsxs)(`svg`,{..._c,children:[(0,L.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`}),(0,L.jsx)(`path`,{d:`M16 2v4M8 2v4M3 10h18`})]}),clock:(0,L.jsxs)(`svg`,{..._c,children:[(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,L.jsx)(`path`,{d:`M12 7v5l3 3`})]}),externalLink:(0,L.jsxs)(`svg`,{..._c,children:[(0,L.jsx)(`path`,{d:`M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6`}),(0,L.jsx)(`path`,{d:`M15 3h6v6`}),(0,L.jsx)(`path`,{d:`M10 14L21 3`})]}),menu:(0,L.jsx)(`svg`,{..._c,strokeWidth:2,children:(0,L.jsx)(`path`,{d:`M4 6h16M4 12h16M4 18h16`})}),moreHorizontal:(0,L.jsxs)(`svg`,{...vc,children:[(0,L.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.5`}),(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.5`}),(0,L.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.5`})]}),search:(0,L.jsxs)(`svg`,{..._c,children:[(0,L.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,L.jsx)(`path`,{d:`M21 21l-4.35-4.35`})]}),arrowUp:(0,L.jsx)(`svg`,{..._c,children:(0,L.jsx)(`path`,{d:`M12 19V5m0 0l-7 7m7-7l7 7`})}),arrowDown:(0,L.jsx)(`svg`,{..._c,children:(0,L.jsx)(`path`,{d:`M12 5v14m0 0l7-7m-7 7l-7-7`})}),arrowsUpDown:(0,L.jsx)(`svg`,{..._c,children:(0,L.jsx)(`path`,{d:`M3 7.5L7.5 3m0 0L12 7.5M7.5 3v13.5m13.5 0L16.5 21m0 0L12 16.5m4.5 4.5V7.5`})}),funnel:(0,L.jsx)(`svg`,{..._c,children:(0,L.jsx)(`path`,{d:`M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z`})}),eyeSlash:(0,L.jsx)(`svg`,{..._c,children:(0,L.jsx)(`path`,{d:`M3.98 8.223A10.477 10.477 0 001.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88`})}),viewColumns:(0,L.jsx)(`svg`,{..._c,children:(0,L.jsx)(`path`,{d:`M9 4.5v15m6-15v15m-10.875 0h15.75c.621 0 1.125-.504 1.125-1.125V5.625c0-.621-.504-1.125-1.125-1.125H4.125C3.504 4.5 3 5.004 3 5.625v12.75c0 .621.504 1.125 1.125 1.125z`})}),copy:(0,L.jsxs)(`svg`,{..._c,children:[(0,L.jsx)(`path`,{d:`M8 4v12a2 2 0 002 2h8a2 2 0 002-2V7.242a2 2 0 00-.602-1.43L16.083 2.57A2 2 0 0014.685 2H10a2 2 0 00-2 2z`}),(0,L.jsx)(`path`,{d:`M16 18v2a2 2 0 01-2 2H6a2 2 0 01-2-2V9a2 2 0 012-2h2`})]}),checkDouble:(0,L.jsxs)(`svg`,{..._c,children:[(0,L.jsx)(`path`,{d:`M2 13l4 4L14 7`}),(0,L.jsx)(`path`,{d:`M9 13l4 4L21 7`})]}),wrench:(0,L.jsx)(`svg`,{..._c,children:(0,L.jsx)(`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`})}),stop:(0,L.jsx)(`svg`,{...vc,children:(0,L.jsx)(`rect`,{x:`6`,y:`6`,width:`12`,height:`12`,rx:`2`})}),microphone:(0,L.jsxs)(`svg`,{..._c,children:[(0,L.jsx)(`path`,{d:`M12 2a3 3 0 00-3 3v6a3 3 0 006 0V5a3 3 0 00-3-3z`}),(0,L.jsx)(`path`,{d:`M19 10v1a7 7 0 01-14 0v-1`}),(0,L.jsx)(`path`,{d:`M12 18v4m-4 0h8`})]})},bc={};function xc(e){return e==null?null:typeof e==`string`?Ms(e)?.icons??null:e.icons??null}function Sc(e,t){return xc(t)?.[e]??bc[e]??yc[e]}var Cc={root:{kmuXW:`x2lah0s`,$$css:!0},span:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmuXW:`x2lah0s`,$$css:!0}},wc={primary:{kMwMTN:`xtbr613`,$$css:!0},secondary:{kMwMTN:`xv9yike`,$$css:!0},tertiary:{kMwMTN:`xv9yike`,$$css:!0},disabled:{kMwMTN:`xqa6c3m`,$$css:!0},accent:{kMwMTN:`xqwr325`,$$css:!0},success:{kMwMTN:`xtjic6`,$$css:!0},error:{kMwMTN:`xjt36v0`,$$css:!0},warning:{kMwMTN:`xs3pv69`,$$css:!0},inherit:{kMwMTN:`x1heor9g`,$$css:!0},blue:{kMwMTN:`x1fns2mt`,$$css:!0},red:{kMwMTN:`xeffzf7`,$$css:!0},green:{kMwMTN:`xmxeech`,$$css:!0},gray:{kMwMTN:`x1eyinzz`,$$css:!0},cyan:{kMwMTN:`x157w0xa`,$$css:!0},teal:{kMwMTN:`x1f3zxcb`,$$css:!0},yellow:{kMwMTN:`x1g6zdft`,$$css:!0},orange:{kMwMTN:`xxu74a4`,$$css:!0},pink:{kMwMTN:`x1kxxfg5`,$$css:!0},purple:{kMwMTN:`xzdw94u`,$$css:!0}},Tc={xsm:{kzqmXN:`x1jw3ynk`,kZKoxP:`xvle69y`,$$css:!0},sm:{kzqmXN:`xcdlrvm`,kZKoxP:`x1l36t39`,$$css:!0},md:{kzqmXN:`xwqq7k2`,kZKoxP:`xmll18r`,$$css:!0},lg:{kzqmXN:`xp8d6y2`,kZKoxP:`xam5rvr`,$$css:!0}},Ec={xsm:{kzqmXN:`x1jw3ynk`,kZKoxP:`xvle69y`,kGuDYH:`xboafo0`,$$css:!0},sm:{kzqmXN:`xcdlrvm`,kZKoxP:`x1l36t39`,kGuDYH:`x1jchvi3`,$$css:!0},md:{kzqmXN:`xwqq7k2`,kZKoxP:`xmll18r`,kGuDYH:`x1603h9y`,$$css:!0},lg:{kzqmXN:`xp8d6y2`,kZKoxP:`xam5rvr`,kGuDYH:`xngnso2`,$$css:!0}};function Dc(e){return e!=null&&e!==``?{role:`img`,"aria-label":e}:{"aria-hidden":`true`}}function Oc({icon:e,color:t=`inherit`,size:n=`md`,label:r,ref:i,className:a,style:o,xstyle:s,...c}){let l=Dc(r);return typeof e==`string`?(0,L.jsx)(kc,{name:e,color:t,size:n,a11yProps:l,className:a,style:o,xstyle:s,spanProps:c}):(0,L.jsx)(e,{ref:i,...l,...kr(Hr(`icon`,{size:n,color:t}),xn(Cc.root,wc[t],Tc[n],s),a??void 0,o),...c})}Oc.displayName=`Icon`;function kc({name:e,color:t,size:n,a11yProps:r,className:i,style:a,xstyle:o,spanProps:s}){let c=Sc(e,gc());if(c==null)return null;let l=s??{};return(0,L.jsx)(`span`,{...r,...l,...kr(Hr(`icon`,{size:n,color:t}),xn(Cc.span,wc[t],Ec[n],o),i??void 0,a),children:c})}function Ac(e,t){return typeof e==`string`||typeof e==`function`||typeof e==`object`&&e&&`render`in e?(0,L.jsx)(Oc,{icon:e,...t}):e}var jc=`openpi.web.token`,Mc=class extends Error{status;code;constructor(e,t,n){super(e),this.status=t,this.code=n,this.name=`WebApiError`}};function Nc(){let e=document.querySelector(`meta[name="openpi-web-token"]`)?.content,t=new URLSearchParams(location.hash.slice(1)).get(`token`),n=e&&/^[a-f0-9]{64}$/i.test(e)?e:t;if(t&&history.replaceState(null,``,`${location.pathname}${location.search}`),n){try{window.sessionStorage.setItem(jc,n)}catch{}return n}try{return window.sessionStorage.getItem(jc)}catch{return null}}var Pc=class{token=Nc();headers(e=!1){return{Authorization:`Bearer ${this.token??``}`,...e?{"Content-Type":`application/json`}:{}}}async request(e,t={}){let{timeoutMs:n=15e3,timeoutMessage:r=`Request timed out. Please try again.`,...i}=t,a=new AbortController,o=!1,s=()=>a.abort();t.signal?.aborted&&s(),t.signal?.addEventListener(`abort`,s,{once:!0});let c=window.setTimeout(()=>{o=!0,a.abort()},n);try{let n=await fetch(e,{...i,signal:a.signal,headers:{...this.headers(!!t.body),...t.headers}}),r=await n.json();if(a.signal.aborted)throw Error(`Request aborted`);if(!n.ok)throw new Mc(r.error||`Request failed (${n.status})`,n.status,r.code);return r}catch(e){throw o?Error(r):e}finally{window.clearTimeout(c),t.signal?.removeEventListener(`abort`,s)}}snapshot(e){let t=e?`?path=${encodeURIComponent(e)}`:``;return this.request(`/api/snapshot${t}`)}chooseWorkspace(){return this.request(`/api/workspaces/select`,{method:`POST`})}renameWorkspace(e,t){return this.request(`/api/workspaces`,{method:`PATCH`,body:JSON.stringify({path:e,name:t})})}removeWorkspace(e){return this.request(`/api/workspaces?path=${encodeURIComponent(e)}`,{method:`DELETE`})}createSession(e,t){return this.request(`/api/sessions`,{method:`POST`,body:JSON.stringify({workspacePath:e,commandId:t})})}selectSession(e){return this.request(`/api/sessions/select`,{method:`POST`,body:JSON.stringify({path:e})})}renameSession(e,t){return this.request(`/api/sessions`,{method:`PATCH`,body:JSON.stringify({path:e,name:t})})}archiveSession(e){return this.request(`/api/sessions/archive?path=${encodeURIComponent(e)}`,{method:`POST`})}unarchiveSession(e){return this.request(`/api/sessions/unarchive?path=${encodeURIComponent(e)}`,{method:`POST`})}thinking(e,t){return this.request(`/api/thinking?sessionId=${encodeURIComponent(e)}`,{signal:t})}trust(e,t){return this.request(`/api/trust?sessionId=${encodeURIComponent(e)}`,{signal:t})}providerAuth(e,t){return this.request(`/api/providers/auth-status?sessionId=${encodeURIComponent(e)}`,{signal:t})}terminalDetail(e,t,n){return this.request(`/api/capabilities/detail?kind=background-terminals&id=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(e)}`,{signal:n})}selectModel(e,t,n){return this.request(`/api/model`,{method:`POST`,body:JSON.stringify({provider:e,modelId:t,sessionId:n})})}cancelActiveTurn(e){return this.request(`/api/turns/cancel`,{method:`POST`,body:JSON.stringify(e)})}async prompt(e,t,n,r=!1){let i=await this.request(`/api/prompt`,{method:`POST`,body:JSON.stringify({sessionId:e,content:t,commandId:n,retry:r}),timeoutMs:3e4,timeoutMessage:`Request timed out; admission may still be pending. Retry the same message to recover its receipt.`});if(typeof i.id!=`string`||!i.id||i.accepted!==!0)throw Error(`Invalid prompt receipt; retry the same message to recover its admission.`);return i}};function Fc({target:e,onClose:t}){let{t:n}=cn(),r=(0,w.useMemo)(()=>new Pc,[]),[i,a]=(0,w.useState)(0),[o,s]=(0,w.useState)(null),[c,l]=(0,w.useState)(null);(0,w.useEffect)(()=>{let t=new AbortController;return s(null),l(null),(async()=>{let i={errors:[]};if(e.terminalId)try{let a=await r.terminalDetail(e.sessionId,e.terminalId,t.signal);if(a.sessionId!==e.sessionId||a.detail.id!==e.terminalId)throw Error(n(`inspectionChanged`));i.terminal=a.detail}catch(e){i.errors.push(e instanceof Error?e.message:n(`inspectionUnavailable`))}else{let[a,o,s]=await Promise.allSettled([r.thinking(e.sessionId,t.signal),r.trust(e.sessionId,t.signal),r.providerAuth(e.sessionId,t.signal)]);a.status===`fulfilled`&&a.value.sessionId===e.sessionId?i.thinking=a.value:i.errors.push(n(`thinkingUnavailable`)),o.status===`fulfilled`&&(o.value.workspace===void 0||o.value.workspace===e.cwd)?i.trust=o.value:i.errors.push(n(`trustUnavailable`)),s.status===`fulfilled`?i.auth=s.value:i.errors.push(n(`authUnavailable`))}t.signal.aborted||(s(i),l(new Date().toLocaleTimeString()))})(),()=>t.abort()},[r,e,i,n]);let u=e.terminalId?n(`terminalDetails`):n(`runtimeStatus`),d=o?.terminal;return(0,L.jsx)(mi,{isOpen:!0,onOpenChange:e=>!e&&t(),width:640,"aria-label":u,children:(0,L.jsxs)(`section`,{className:`inspection-panel`,children:[(0,L.jsxs)(`header`,{className:`inspection-heading`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{children:u}),(0,L.jsx)(`p`,{className:`inspection-subtitle`,children:e.cwd})]}),(0,L.jsxs)(`div`,{className:`inspection-actions`,children:[(0,L.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":n(`refreshStatus`),disabled:!o,onClick:()=>a(e=>e+1),children:(0,L.jsx)(Oe,{})}),(0,L.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":n(`close`),onClick:t,children:(0,L.jsx)(ze,{})})]})]}),o?(0,L.jsxs)(L.Fragment,{children:[o.errors.map(e=>(0,L.jsx)(`p`,{className:`inspection-warning`,role:`alert`,children:e},e)),d?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`inspection-section`,children:[(0,L.jsx)(`h3`,{children:d.title||d.id}),(0,L.jsxs)(`dl`,{children:[(0,L.jsx)(`dt`,{children:n(`executionState`)}),(0,L.jsx)(`dd`,{children:n(`execution_${d.status}`,{defaultValue:d.status})}),(0,L.jsx)(`dt`,{children:n(`terminalCommand`)}),(0,L.jsx)(`dd`,{children:(0,L.jsx)(`code`,{children:d.command})}),(0,L.jsx)(`dt`,{children:n(`terminalDirectory`)}),(0,L.jsx)(`dd`,{children:d.cwd}),(0,L.jsx)(`dt`,{children:n(`startedAt`)}),(0,L.jsx)(`dd`,{children:new Date(d.createdAt).toLocaleString()}),d.exitCode!==void 0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{children:n(`exitCode`)}),(0,L.jsx)(`dd`,{children:d.exitCode})]})]}),d.errorText&&(0,L.jsx)(`p`,{className:`inspection-warning`,children:d.errorText}),d.truncated&&(0,L.jsx)(`p`,{className:`inspection-note`,children:n(`detailTruncated`)})]}),[`stdout`,`stderr`].map(e=>(0,L.jsxs)(`section`,{className:`inspection-section`,children:[(0,L.jsx)(`h3`,{children:n(e===`stdout`?`standardOutput`:`standardError`)}),(0,L.jsx)(`pre`,{className:`terminal-evidence`,children:d[e].text||n(`noOutput`)}),d[e].truncated&&(0,L.jsx)(`p`,{className:`inspection-note`,children:n(`outputTruncated`,{count:d[e].omittedBytes})}),d[e].recoveryAvailable&&(0,L.jsx)(`p`,{className:`inspection-note`,children:n(`outputRecovery`)})]},e))]}):!e.terminalId&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`section`,{className:`inspection-section`,children:[(0,L.jsx)(`h3`,{children:n(`modelAndThinking`)}),(0,L.jsxs)(`dl`,{children:[(0,L.jsx)(`dt`,{children:n(`selectedModel`)}),(0,L.jsx)(`dd`,{children:e.model||n(`noModels`)}),(0,L.jsx)(`dt`,{children:n(`thinkingLevel`)}),(0,L.jsx)(`dd`,{children:o.thinking?.level??n(`unknownState`)}),!!o.thinking?.available.length&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{children:n(`availableThinking`)}),(0,L.jsx)(`dd`,{children:o.thinking?.available.join(` · `)})]})]})]}),(0,L.jsxs)(`section`,{className:`inspection-section`,children:[(0,L.jsx)(`h3`,{children:n(`projectTrust`)}),(0,L.jsx)(`p`,{children:n(`trust_${o.trust?.state??`unknown`}`)}),o.trust?.refreshRequired===!0&&(0,L.jsx)(`p`,{className:`inspection-warning`,children:n(`trustRefreshNeeded`)})]}),(0,L.jsxs)(`section`,{className:`inspection-section`,children:[(0,L.jsx)(`h3`,{children:n(`providerAvailability`)}),o.auth?.providers.map(e=>(0,L.jsxs)(`div`,{className:`provider-status`,children:[(0,L.jsx)(`span`,{children:e.name||e.id}),(0,L.jsx)(`span`,{children:e.configured?n(`credentialConfigured`):n(`credentialMissing`)})]},e.id)),o.auth&&!o.auth.providers.length&&(0,L.jsx)(`p`,{children:n(`noProviders`)}),o.auth?.truncation.truncated&&(0,L.jsx)(`p`,{className:`inspection-note`,children:n(`providersBounded`)}),(0,L.jsx)(`p`,{className:`inspection-note`,children:n(`authNotVerified`)})]}),(0,L.jsx)(`p`,{className:`inspection-note`,children:n(`configurationViaPi`)})]}),(0,L.jsx)(`p`,{className:`inspection-updated`,children:n(`statusCaptured`,{time:c})})]}):(0,L.jsx)(`p`,{role:`status`,children:n(`inspectionLoading`)})]})})}var Ic=`button:not([disabled]), a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), [contenteditable]:not([contenteditable="false"]), audio[controls], video[controls], iframe, details > summary:first-child`,Lc=0;function Rc(e){if(e.hasAttribute(`inert`)||e.closest(`[inert]`)||e.hidden||e.closest(`[hidden]`)||e.closest(`[aria-hidden="true"]`))return!1;if(typeof window<`u`&&window.getComputedStyle){let t=window.getComputedStyle(e);if(t.visibility===`hidden`||t.display===`none`)return!1}return!0}function zc(e){return Array.from(e.querySelectorAll(Ic)).filter(Rc)}function Bc(e){try{e.focus()}catch{}return document.activeElement===e}function Vc(e){let t=zc(e);for(let e of t)if(Bc(e))return!0;return!1}function Hc(e){let t=zc(e);for(let e=t.length-1;e>=0;e--)if(Bc(t[e]))return!0;return!1}function Uc(e){let{isActive:t,onEscape:n}=e,r=(0,w.useRef)(null),i=(0,w.useRef)(null),a=(0,w.useRef)(!1),o=t&&n!=null;Xn({isActive:o,onDismiss:()=>{n?.()},getContainer:()=>r.current}),(0,w.useEffect)(()=>{if(o)return Lc+=1,()=>{--Lc}},[o]);let s=(0,w.useCallback)(()=>{r.current&&Vc(r.current)},[]);return(0,w.useEffect)(()=>{if(!t)return;let e=document.activeElement,n=r.current;return()=>{let t=document.activeElement;(t==null||t===document.body||t===document.documentElement||n!=null&&n.contains(t))&&e!=null&&e.isConnected&&typeof e.focus==`function`&&e.focus()}},[t]),(0,w.useEffect)(()=>{if(!t)return;let e=e=>{let t=r.current;if(!t)return;let n=e.target;if(t.contains(n))i.current=n;else if(a.current){let e=Vc(t);e&&i.current===document.activeElement?Hc(t):!e&&i.current instanceof HTMLElement&&t.contains(i.current)&&Bc(i.current),i.current=document.activeElement}a.current=!1};return document.addEventListener(`focus`,e,!0),()=>{document.removeEventListener(`focus`,e,!0)}},[t]),(0,w.useEffect)(()=>{if(!t)return;let e=e=>{let t=r.current;if(t&&e.key===`Tab`){a.current=!0;let n=zc(t);if(n.length===0){let n=document.activeElement;if(!(n instanceof HTMLElement)||!t.contains(n))return;e.preventDefault(),i.current=n,a.current=!1;return}let r=n[0],o=n[n.length-1];e.shiftKey?document.activeElement===r&&(e.preventDefault(),o.focus()):document.activeElement===o&&(e.preventDefault(),r.focus())}};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[t,n]),{containerRef:r,focusFirst:s}}function Wc(e,t,n=!0){let r=(0,w.useRef)(!1);(0,w.useEffect)(()=>{n&&!r.current&&(r.current=!0)},[e,t,n])}var Gc={surface:{kWkggS:`x1prclbq`,"--_popover-radius":`xiki222`,kaIpWk:`x11m9jtl`,kGVxlE:`x1i5ehqx`,$$css:!0},contentWrapper:{kVAEAm:`x1n2onr6`,$$css:!0},closeButtonWrapper:{kVAEAm:`x10l6tqk`,krVfgx:`x1ey2m1c`,kY2c9j:`x1vjfegm`,kzqmXN:`x1i1rx1s x10okhzq`,kZKoxP:`xjm9jq1 x132qfvm`,kVQacm:`xb3r6kr x1dordxg`,kz4h6p:`x1hyvwdk x10wafsz`,kfzvcC:`x47corl xbt4iw`,kLKAdn:`xexx8yu x1kw28su`,$$css:!0}};function Kc(e={}){let{onShow:t,onHide:n,xstyle:r,className:i,style:a,hasLightDismiss:o=!0,hasEscapeDismiss:s=!0,hasAutoFocus:c=!0,hasSurface:l=!0,surfaceTarget:u,hasCloseButton:d=!0,closeButtonLabel:f,dialogLabel:p,role:m=`dialog`,isModal:h=!0}=e,g=ys(),_=f??g(`@astryx.popover.close`),v=(0,w.useRef)(null),y=(0,w.useRef)(!1),b=Li({mode:`context`,lightDismiss:o,onShow:t,onHide:n}),{containerRef:x,focusFirst:S}=Uc({isActive:b.isOpen,onEscape:s||o?b.hide:void 0});(0,w.useEffect)(()=>{b.isOpen&&c&&!y.current&&requestAnimationFrame(()=>{S()}),b.isOpen||(y.current=!1)},[b.isOpen,c,S]);let C=(0,w.useCallback)(e=>{v.current=e,b.ref(e)},[b]),T=(0,w.useCallback)(e=>{y.current=e?.skipAutoFocus??!1,b.show()},[b]),E=(0,w.useCallback)(()=>{b.wasJustDismissed()||(b.isOpen?b.hide():T())},[b,T]),D={"aria-haspopup":m===`dialog`?`dialog`:`true`,"aria-expanded":b.isOpen,"aria-controls":b.id};Wc(`usePopover`,'role="dialog" without a `dialogLabel` renders an unnamed dialog. Pass `dialogLabel`, or use `role: "none"` for listbox/menu popups whose content already carries its own role.',m===`dialog`&&!p);let O=(0,w.useCallback)((e,t)=>{let n=Hr(`popover-surface`),o=u==null?n.className:`${n.className} ${Fr(u)}`;return b.render((0,L.jsx)(kn,{children:(0,L.jsxs)(`div`,{ref:x,role:m===`dialog`?`dialog`:void 0,"aria-modal":m===`dialog`&&h?!0:void 0,"aria-label":m===`dialog`?p:void 0,...kr({...n,className:o},xn(Gc.contentWrapper,l&&Gc.surface,r),i,a),children:[e,d&&(0,L.jsx)(`div`,{...xn(Gc.closeButtonWrapper,Yr.centerInline(`100%`)),children:(0,L.jsx)(Os,{variant:`secondary`,label:_,onClick:b.hide})})]})}),{...t,xstyle:t?.xstyle})},[b,d,l,u,i,a,_,x,p,m,h,r]);return{triggerRef:C,contentRef:x,anchorId:b.anchorId,show:T,hide:b.hide,toggle:E,wasJustDismissed:b.wasJustDismissed,isOpen:b.isOpen,id:b.id,render:O,triggerProps:D}}function qc(e={}){return Kc(e)}var Jc=[`noopener`,`noreferrer`];function Yc(e,t){if(e!==`_blank`)return{target:e,rel:t};let n=t?.split(/\s+/).filter(Boolean)??[];for(let e of Jc)n.includes(e)||n.push(e);return{target:e,rel:n.join(` `)}}var Xc=[`button`,`a`,`input`,`select`,`textarea`,`[role="button"]`,`[role="link"]`,`[role="checkbox"]`,`[role="radio"]`,`[role="switch"]`,`[role="tab"]`,`[role="menuitem"]`,`[role="option"]`,`[role="combobox"]`,`[role="listbox"]`,`[role="slider"]`,`[role="spinbutton"]`,`[data-pressable-container]`].join(`,`),Zc=`[aria-readonly="true"]`;function Qc(e,t){let n=e;for(;n!=null&&n!==t&&n!==document.body;){if(n.matches(Xc)&&!n.matches(Zc))return!0;n=n.parentElement}return!1}function $c(e){if(typeof document>`u`||!(`getSelection`in document))return!1;let t=document.getSelection();return t==null||t.isCollapsed?!1:e.contains(t.anchorNode)}function el({containerRef:e,interactiveRef:t,onClick:n,href:r,target:i,disabled:a=!1}){return(0,w.useEffect)(()=>{let t=e.current;t&&t.setAttribute(`data-pressable-container`,`true`)},[e]),{onClick:(0,w.useCallback)(o=>{if(a)return;let s=e.current;if(!s||$c(s))return;let c=o.target;if(c instanceof Element&&!(c!==o.currentTarget&&Qc(c,s))&&(n?.(o),!o.defaultPrevented&&(r!=null&&(i===`_blank`||o.ctrlKey||o.metaKey?window.open(r,`_blank`,`noopener`):t?.current?t.current.click():window.location.href=r),r==null&&n==null&&t?.current))){let e=new MouseEvent(`click`,{bubbles:o.bubbles,cancelable:o.cancelable,ctrlKey:o.ctrlKey,metaKey:o.metaKey,shiftKey:o.shiftKey,altKey:o.altKey,button:o.button});t.current.dispatchEvent(e),o.stopPropagation()}},[e,t,n,r,i,a]),onMouseUp:(0,w.useCallback)(t=>{if(a)return;let n=e.current;if(!n)return;let i=t.target;i instanceof Element&&t.button===1&&r!=null&&(i===t.currentTarget||!Qc(i,n))&&window.open(r,`_blank`,`noopener`)},[e,r,a])}}var tl=new Set([`option`,`tab`,`row`,`gridcell`,`columnheader`,`rowheader`,`treeitem`]),nl={root:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,kg3NbH:`xf314gf`,kVAEAm:`x1n2onr6`,kB7OPa:`x9f619`,k9WMMc:`x1yc453h`,kaIpWk:`xh6dtrn`,$$css:!0},alignStart:{kGNEyG:`x1cy8zhl`,$$css:!0},interactive:{kkrTdU:`x1ypdohk x16khyan`,k1ekBW:`x15406qy`,kIyJzY:`xkvfbh3`,kAMwcw:`xlr8y92`,$$css:!0},highlighted:{kWkggS:`x1lmrjuc`,$$css:!0},selected:{kWkggS:`xgcxg3y`,$$css:!0},disabled:{kkrTdU:`xt0e3qv`,kfzvcC:`x47corl`,$$css:!0},inlineLabel:{kmuXW:`x2lah0s`,$$css:!0},inlineDescription:{kmuXW:`xs83m0k`,k7Eaqz:`xeuugli`,$$css:!0},label:{kMwMTN:`x5tbw38`,kGuDYH:`xjm74w1`,kLWn49:`xw6l6zx`,$$css:!0},labelSingleTruncate:{kVQacm:`xb3r6kr`,kg5iWk:`xlyipyv`,khDVqt:`xuxw1ft`,$$css:!0},labelMultiTruncate:{kVQacm:`xb3r6kr`,k1xSpc:`x104kibb`,kgKLqz:`x1ua5tub`,$$css:!0},description:{kMwMTN:`x1gb3s7i`,kGuDYH:`x141an7d`,kLWn49:`x1ltkj2j`,$$css:!0},descriptionSingleTruncate:{kVQacm:`xb3r6kr`,kg5iWk:`xlyipyv`,khDVqt:`xuxw1ft`,$$css:!0},descriptionMultiTruncate:{kVQacm:`xb3r6kr`,k1xSpc:`x104kibb`,kgKLqz:`x1ua5tub`,$$css:!0}},rl={lineClamp:e=>[{kJFfOR:e==null?e:`x1yhjpo9`,$$css:!0},{"--x-WebkitLineClamp":e??void 0}]},il={compact:{k8WAf4:`xu0wf1k`,$$css:!0},balanced:{k8WAf4:`xce4md1`,$$css:!0},spacious:{k8WAf4:`x8o8v82`,kg3NbH:`xrrkdod`,$$css:!0}};function al({as:e=`div`,marker:t,startContent:n,label:r,description:i,endContent:a,align:o=`center`,density:s=`balanced`,labelLines:c,descriptionLines:l,layout:u=`stacked`,onClick:d,interactiveRef:f,href:p,target:m,rel:h,isHighlighted:g=!1,isSelected:_=!1,isDisabled:v=!1,xstyle:y,className:b,style:x,ref:S,role:C,...T}){let E=Ka(),D=f!=null,O=(0,w.useRef)(null),{onClick:ee}=el({containerRef:O,interactiveRef:f??void 0,disabled:v});Wc(`Item`,"`interactiveRef` is mutually exclusive with `onClick`/`href`. In delegation mode the row only forwards clicks to the referenced control, so `onClick`/`href` are ignored. Drop one of them.",D&&(d!=null||p!=null));let te=d!=null||p!=null||D,{target:k,rel:A}=Yc(m,h),j=C!=null,M=C!=null&&tl.has(C),ne=typeof r==`string`,N=typeof i==`string`,P=c==null?ne?nl.labelSingleTruncate:null:c===1?nl.labelSingleTruncate:nl.labelMultiTruncate,re=u===`inline`&&i!=null,ie=l==null?N||re?nl.descriptionSingleTruncate:null:l===1?nl.descriptionSingleTruncate:nl.descriptionMultiTruncate,ae=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{...xn(nl.label,re&&nl.inlineLabel,P,c!=null&&c>1&&rl.lineClamp(c)),children:r}),i!=null&&(0,L.jsx)(`span`,{...xn(nl.description,re&&nl.inlineDescription,ie,l!=null&&l>1&&rl.lineClamp(l)),children:i})]}),oe=e=>{v||e.target.closest(`button, a, input, select, textarea`)||d?.(e)},se=(0,L.jsxs)(L.Fragment,{children:[t,n!=null&&(0,L.jsx)(`span`,{className:`x3psx0u x78zum5`,children:n}),j||D?(0,L.jsx)(`span`,{...{0:{className:`x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h`},2:{className:`x78zum5 x98rzlu xeuugli x1yc453h x1q0g3np x6s0dn4 x1lfs0n9`},1:{className:`x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h xbyyjgo`},3:{className:`x78zum5 x98rzlu xeuugli x1yc453h x1q0g3np x6s0dn4 x1lfs0n9 xbyyjgo`}}[!!re<<1|!!v<<0],children:ae}):p==null?d==null?(0,L.jsx)(`span`,{...{0:{className:`x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h`},2:{className:`x78zum5 x98rzlu xeuugli x1yc453h x1q0g3np x6s0dn4 x1lfs0n9`},1:{className:`x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h xbyyjgo`},3:{className:`x78zum5 x98rzlu xeuugli x1yc453h x1q0g3np x6s0dn4 x1lfs0n9 xbyyjgo`}}[!!re<<1|!!v<<0],children:ae}):(0,L.jsx)(`button`,{type:`button`,onClick:d,disabled:v,...{0:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h x1a2a7pz`},2:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 x98rzlu xeuugli x1yc453h x1a2a7pz x1q0g3np x6s0dn4 x1lfs0n9`},1:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h x1a2a7pz xbyyjgo`},3:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 x98rzlu xeuugli x1yc453h x1a2a7pz x1q0g3np x6s0dn4 x1lfs0n9 xbyyjgo`}}[!!re<<1|!!v<<0],children:ae}):(0,L.jsx)(E,{href:p,target:k,rel:A,"aria-disabled":v||void 0,tabIndex:v?-1:void 0,...{0:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h x1hl2dhg x1a2a7pz`},2:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 x98rzlu xeuugli x1yc453h x1hl2dhg x1a2a7pz x1q0g3np x6s0dn4 x1lfs0n9`},1:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h x1hl2dhg x1a2a7pz xbyyjgo`},3:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 x98rzlu xeuugli x1yc453h x1hl2dhg x1a2a7pz x1q0g3np x6s0dn4 x1lfs0n9 xbyyjgo`}}[!!re<<1|!!v<<0],children:ae}),a!=null&&(0,L.jsx)(`span`,{...{0:{className:`x3psx0u x78zum5 xvc5jky`},1:{className:`x3psx0u x78zum5 xvc5jky xbyyjgo`}}[!!v<<0],children:a})]}),F=ri(S,O);return(0,L.jsx)(e,{ref:D?F:S,...T,"aria-selected":M&&_||void 0,"aria-current":T[`aria-current`]??(_&&!M?!0:void 0),"aria-disabled":v||void 0,...kr(Hr(`item`,{density:s,align:o}),ti.focusWithin(nl.root,il[s],o===`start`&&nl.alignStart,te&&nl.interactive,te&&qa.backgroundColor,g&&nl.highlighted,_&&nl.selected,v&&!j&&nl.disabled,y),b,x),role:C,onClick:D?ee:j?d:te?oe:void 0,children:se})}al.displayName=`Item`;var ol=(0,w.createContext)(null);ol.displayName=`DropdownMenuContext`;function sl(){return(0,w.use)(ol)}var cl=(0,w.createContext)(null);cl.displayName=`DropdownMenuRadioGroupContext`;function ll(e,t){if(t||e.pointerType!==`mouse`)return;let n=e.currentTarget;n!==n.ownerDocument.activeElement&&n.focus()}var ul={root:{kB7OPa:`x9f619`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xf314gf`,kaIpWk:`x1ws5lxm`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w x1c52tdz`,kkrTdU:`x1ypdohk x16khyan`,k9WMMc:`x1yc453h`,kI3sdo:`x1a2a7pz`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0},destructive:{kMwMTN:`xjt36v0`,"--_item-label-color":`xufyqxy`,"--_item-description-color":`xqlix59`,$$css:!0}},dl={sm:{k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,$$css:!0},md:{k8WAf4:`x1vofgu7`,$$css:!0},lg:{$$css:!0}};function fl({icon:e,label:t,description:n,onClick:r,isDisabled:i=!1,endContent:a,hasCloseOnSelect:o=!0,variant:s=`default`,xstyle:c,className:l,style:u}){let d=sl(),f=d?.menuSize??`md`,p=(0,w.useCallback)(()=>{i||(r?.(),o&&d?.closeMenu())},[i,r,o,d]),m=(0,w.useCallback)(e=>ll(e,i),[i]),h=s===`destructive`;return(0,L.jsx)(al,{role:`menuitem`,tabIndex:i?void 0:-1,onPointerMove:m,startContent:e?Ac(e,{size:`sm`,color:h?`error`:`secondary`}):void 0,label:t,description:n,endContent:a,onClick:p,isDisabled:i,xstyle:[ul.root,dl[f],h&&ul.destructive,i&&ul.disabled,c],...kr(Hr(`dropdown-menu-item`,{size:f,variant:h?`destructive`:null}),{className:l,style:u})})}fl.displayName=`DropdownMenuItem`;var pl={horizontal:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kzqmXN:`xh8yej3`,$$css:!0},vertical:{k1xSpc:`x3nfvp2`,kXwgrk:`xdt5ytf`,kGNEyG:`x6s0dn4`,kZKoxP:`x5yr21d`,$$css:!0}},ml={horizontalLine:{kZKoxP:`xsyqizj`,kzQI83:`x1iyjqo2`,kmuXW:`xs83m0k`,$$css:!0},verticalLine:{kzqmXN:`xjk4fl7`,kzQI83:`x1iyjqo2`,kmuXW:`xs83m0k`,$$css:!0},subtle:{kWkggS:`x1m4xfpy`,$$css:!0},strong:{kWkggS:`x7njt3n`,$$css:!0}},hl={horizontal:{keTefX:`xojxgvx`,k71WvV:`x1fcf3bl`,kzqmXN:`xx6qvi6`,$$css:!0},vertical:{keoZOQ:`x1sa9bsh`,k1K539:`x6h7pi7`,kZKoxP:`x12qplqi`,$$css:!0}};function gl({orientation:e=`horizontal`,label:t,variant:n=`subtle`,isFullBleed:r=!1,xstyle:i,className:a,style:o,ref:s,"aria-label":c,"aria-labelledby":l,...u}){let d=e===`horizontal`,f=(0,w.useId)(),p=l??(t&&c==null?f:void 0);return(0,L.jsxs)(`div`,{ref:s,...u,role:`separator`,"aria-orientation":e,"aria-label":c,"aria-labelledby":p,...kr(Hr(`divider`,{variant:n,orientation:e}),xn(d?pl.horizontal:pl.vertical,r&&(d?hl.horizontal:hl.vertical),i),a,o),children:[(0,L.jsx)(`div`,{...xn(d?ml.horizontalLine:ml.verticalLine,ml[n])}),t&&(0,L.jsx)(`div`,{id:f,...{0:{className:`x2lah0s xrrkdod x141an7d x1ltkj2j xv1l7n4`},1:{className:`x2lah0s x141an7d x1ltkj2j xv1l7n4 xnjsko4 x8o8v82`}}[!d<<0],children:t}),t&&(0,L.jsx)(`div`,{...xn(d?ml.horizontalLine:ml.verticalLine,ml[n])})]})}gl.displayName=`Divider`;var _l={divider:{kqGvvJ:`xsq74q5`,$$css:!0}},vl=Hr(`dropdown-menu-divider`).className;function yl({xstyle:e,className:t,style:n,ref:r}){return(0,L.jsx)(gl,{ref:r,xstyle:[_l.divider,e],className:t?`${vl} ${t}`:vl,style:n})}yl.displayName=`DropdownMenuDivider`;function bl(e){return!e||typeof window>`u`?!1:window.getComputedStyle(e).direction===`rtl`}var xl=typeof window<`u`?w.useLayoutEffect:w.useEffect,Sl=new Set([`text`,`search`,`url`,`tel`,`email`,`password`,`number`]);function Cl(e){if(e.isContentEditable)return e;let t=e.closest(`[contenteditable]`);return t&&t.getAttribute(`contenteditable`)!==`false`?t:null}function wl(e,t){if(!(e instanceof HTMLElement))return!1;let n=Cl(e);if(n){let e=typeof window<`u`?window.getSelection():null;return e&&e.rangeCount>0&&!e.isCollapsed?!0:(n.textContent??``).length>0}let r=e.tagName===`TEXTAREA`,i=e.tagName===`INPUT`&&Sl.has(e.type);if(!r&&!i)return!1;let{selectionStart:a,selectionEnd:o,value:s}=e;return a!==o||a==null?!0:t===`ArrowLeft`||t===`ArrowUp`||t===`Home`?a>0:t===`ArrowRight`||t===`ArrowDown`||t===`End`?ae.getAttribute(`aria-disabled`)===`true`||e.disabled===!0||e.hasAttribute(`disabled`),[]),f=(0,w.useCallback)(()=>{let e=u.current;if(!e)return[];let r=Array.from(e.querySelectorAll(t));return n?r.filter(t=>t.closest(n)===e):r},[t,n]),p=(0,w.useCallback)(e=>{let t=u.current;if(!t||!n)return!0;let r=e.target;return!r||r.closest(n)===t},[n]),m=(0,w.useCallback)((e,t,n,r)=>{let i=e.length;if(i===0)return-1;let a=t;for(let t=0;t=i){if(!r)return-1;a=(a+i)%i}let t=e[a];if(t&&!d(t))return a;a+=n}return-1},[d]),h=(0,w.useCallback)(()=>{let e=f(),t=document.activeElement;return e.findIndex(e=>e===t||e.contains(t))},[f]),g=(0,w.useCallback)((e,t)=>{e.getAttribute(`tabindex`)!==String(t)&&e.setAttribute(`tabindex`,String(t))},[]),_=(0,w.useCallback)(()=>{let e=f(),t=e.filter(e=>!d(e));if(t.length===0)return;let n=t.find(e=>e.getAttribute(`tabindex`)===`0`)??t[0];for(let t of e)g(t,t===n?0:-1)},[f,d,g]);xl(()=>{c&&_()});let v=(0,w.useCallback)((e,t)=>{let n=e[t];if(n){if(c)for(let t of e)g(t,t===n?0:-1);n.focus()}},[c,g]),y=(0,w.useCallback)(e=>{let t=f();if(t.length===0)return;let n=Math.max(0,Math.min(e,t.length-1));v(t,n)},[f,v]),b=(0,w.useCallback)(()=>{let e=f(),t=m(e,0,1,!1);return t!==-1&&(v(e,t),!0)},[f,m,v]),x=(0,w.useCallback)(()=>{let e=f(),t=m(e,e.length-1,-1,!1);return t!==-1&&(v(e,t),!0)},[f,m,v]),S=(0,w.useCallback)(()=>{c&&_()},[c,_]);return{listRef:u,handleKeyDown:(0,w.useCallback)(e=>{if(e.ctrlKey||e.metaKey||e.altKey||!p(e))return;if(e.key===`Escape`){i&&(e.preventDefault(),i());return}let t=a===`horizontal`||a===`both`,n=a===`vertical`||a===`both`,c=[],d=[];if(t){let t=e.key===`ArrowLeft`||e.key===`ArrowRight`?s??bl(u.current):!1;c.push(t?`ArrowLeft`:`ArrowRight`),d.push(t?`ArrowRight`:`ArrowLeft`)}n&&(c.push(`ArrowDown`),d.push(`ArrowUp`));let g=c.includes(e.key),_=d.includes(e.key),y=o&&e.key===`Home`,S=o&&e.key===`End`;if(!g&&!_&&!y&&!S||l&&(wl(e.target,e.key)||wl(document.activeElement,e.key)))return;let C=h(),w=f();if(g){let e=C===-1?0:C+1,t=m(w,e,1,r);t!==-1&&v(w,t)}else if(_){let e=C===-1?w.length-1:C-1,t=m(w,e,-1,r);t!==-1&&v(w,t)}else y?b():S&&x();e.preventDefault()},[h,f,r,a,s,o,l,m,v,b,x,i,p]),handleFocus:S,focusItem:y,focusFirst:b,focusLast:x,ownsEvent:p,getItems:f}}var El=500,Dl=300;function Ol(e){let{show:t,hide:n,isOpen:r,isEnabled:i,showDelay:a=150,hideDelay:o=200,clickGuardMs:s=El,itemSelector:c,popoverId:l,ownsFocus:u=!0}=e,d=ac(`(hover: hover)`),f=(0,w.useRef)(null),p=(0,w.useRef)(null),m=(0,w.useRef)(null),h=(0,w.useRef)(!1),g=(0,w.useRef)(0),_=(0,w.useRef)(0),v=(0,w.useRef)(r);xl(()=>{let e=v.current;v.current=r,e&&!r&&(h.current=!1,_.current=0,g.current=Date.now())},[r]);let y=(0,w.useCallback)(()=>{f.current&&=(clearTimeout(f.current),null),p.current&&=(clearTimeout(p.current),null)},[]),b=(0,w.useRef)(()=>{}),{listRef:x,handleKeyDown:S,focusFirst:C}=Tl({itemSelector:c,onEscape:()=>b.current()}),T=(0,w.useCallback)(()=>{let e=x.current?.contains(document.activeElement)??!1;n(),e&&m.current?.focus()},[n,x]);(0,w.useEffect)(()=>{b.current=()=>{y(),T()}},[y,T]),(0,w.useEffect)(()=>()=>y(),[y]);let E=(0,w.useCallback)(()=>{C()||x.current?.focus()},[C,x]),D=(0,w.useCallback)(()=>{if(!u){t();return}t({skipAutoFocus:!0}),E()},[u,t,E]),O=(0,w.useCallback)(()=>s>0&&_.current>0&&Date.now()-_.current{if(l&&e?.preventDefault(),y(),e!=null&&e.detail===0){g.current=0,h.current=!1,_.current=0,r?u&&E():D();return}if(!r){g.current=0,h.current=!1,_.current=0,D();return}if(O()){u&&E();return}T()},[l,y,r,u,O,D,E,T]),te=(0,w.useCallback)(()=>{if(!d||g.current>0&&Date.now()-g.current{_.current=Date.now(),t({skipAutoFocus:!0})};a>0?f.current=setTimeout(e,a):e()},[d,r,y,t,a]),k=(0,w.useCallback)(()=>{g.current=0,h.current&&(y(),p.current=setTimeout(()=>{n()},o))},[y,n,o]),A=(0,w.useCallback)(()=>{y()},[y]),j=(0,w.useCallback)(e=>{m.current=e},[]),M=(0,w.useCallback)(()=>{},[]),ne=(0,w.useCallback)(e=>{},[]),N=(0,w.useCallback)(e=>{},[]);return i?{triggerProps:{onClick:ee,onMouseEnter:te,onMouseLeave:k,...l?{popoverTarget:l}:null},contentProps:{onMouseEnter:A,onMouseLeave:k,onKeyDown:S},menuRef:x,focusFirst:C,focusMenu:E,confirmHoverOpen:O,close:T,setTriggerEl:j}:{triggerProps:{onClick:M,onMouseEnter:M,onMouseLeave:M},contentProps:{onMouseEnter:M,onMouseLeave:M,onKeyDown:N},menuRef:x,focusFirst:C,focusMenu:E,confirmHoverOpen:O,close:T,setTriggerEl:ne}}function kl(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey&&e.key!==` `}function Al(e){let{getItemLabels:t,onMatch:n,getCurrentIndex:r,resetMs:i=750,isDisabled:a}=e,o=(0,w.useRef)(``),s=(0,w.useRef)(void 0),c=(0,w.useCallback)(()=>{o.current=``,s.current&&=(clearTimeout(s.current),void 0)},[]),l=(0,w.useCallback)(()=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{o.current=``,s.current=void 0},i)},[i]);return{onKeyDown:(0,w.useCallback)(e=>{let i=e.key===` `&&!e.ctrlKey&&!e.metaKey&&o.current.length>0;if(!kl(e)&&!i)return!1;let s=t();if(s.length===0)return!1;let c=e.key.toLowerCase(),u=o.current.length>0&&o.current.split(``).every(e=>e===c)?c:o.current+c;o.current=u,l();let d=r?.()??-1,f=s.length,p=d>=0,m=p?d:0,h=p&&u.length===1?1:0;for(let e=0;e`[role="${e}"]:not([aria-disabled="true"])`).join(`,`),Nl=`[role="menu"]`,Pl={root:{kB7OPa:`x9f619`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xf314gf`,kaIpWk:`x1ws5lxm`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w x1c52tdz`,kkrTdU:`x1ypdohk x16khyan`,k9WMMc:`x1yc453h`,kI3sdo:`x1a2a7pz`,$$css:!0},open:{kWkggS:`x1lmrjuc`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0}},Fl={sm:{k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,$$css:!0},md:{k8WAf4:`x1vofgu7`,$$css:!0},lg:{$$css:!0}},Il={popover:{k7Eaqz:`x5w4yej`,$$css:!0},popoverCustomWidth:e=>[{k7Eaqz:(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`xkj4a21`,$$css:!0},{"--x-minWidth":(e=>typeof e==`number`?e+`px`:e??void 0)(typeof e==`number`?`${e}px`:e)}]};function Ll(e){let{icon:t,label:n,description:r,isDisabled:i=!1,hasSpinner:a=!1,menuWidth:o,onOpenChange:s,children:c,xstyle:l,className:u,style:d,"data-testid":f,menuDataTestId:p}=e,m=sl(),h=m?.menuSize??`md`,g=!i,_=(0,w.useId)(),v=(0,w.useId)(),y=(0,w.useRef)(null),[b,x]=(0,w.useState)(!1),S=Ii({mode:`context`,lightDismiss:!1,onShow:(0,w.useCallback)(()=>{x(!0),s?.(!0)},[s]),onHide:(0,w.useCallback)(()=>{x(!1),s?.(!1)},[s])}),C=(0,w.useCallback)(()=>{g&&S.show()},[g,S]),T=(0,w.useCallback)(()=>{S.hide()},[S]),{listRef:E,handleKeyDown:D,focusFirst:O,focusItem:ee,ownsEvent:te,getItems:k}=Tl({itemSelector:Ml,boundarySelector:Nl,wrap:!1,onEscape:()=>P({focusTrigger:!0})}),A=Al({getItemLabels:()=>k().map(e=>e.textContent),onMatch:ee,getCurrentIndex:()=>k().findIndex(e=>e===document.activeElement||e.contains(document.activeElement))}),{triggerProps:j,contentProps:M,confirmHoverOpen:ne}=Ol({show:C,hide:T,isOpen:b,isEnabled:g}),N=(0,w.useCallback)(e=>{g&&(S.show(),e?.focusFirst&&(O()||E.current?.focus()))},[g,S,O,E]),P=(0,w.useCallback)(e=>{S.hide(),e?.focusTrigger!==!1&&y.current?.focus()},[S]),re=(0,w.useCallback)(e=>{y.current=e,S.ref(e)},[S]),ie=(0,w.useCallback)(()=>{if(!i)if(b){if(ne()){O()||E.current?.focus();return}P({focusTrigger:!0})}else N({focusFirst:!0})},[i,b,N,P,ne,O,E]),ae=(0,w.useCallback)(e=>{if(i)return;let t=typeof window<`u`&&y.current&&window.getComputedStyle(y.current).direction===`rtl`?`ArrowLeft`:`ArrowRight`;(e.key===t||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),N({focusFirst:!0}))},[i,N]),oe=(0,w.useCallback)(e=>ll(e,i),[i]),se=(0,w.useCallback)(e=>{if(!te(e))return;if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),P({focusTrigger:!0});return}if(e.key===`Enter`||e.key===` `){e.preventDefault();let t=document.activeElement;t&&jl.has(t.getAttribute(`role`)??``)&&t.click();return}let t=typeof window<`u`&&E.current&&window.getComputedStyle(E.current).direction===`rtl`?`ArrowRight`:`ArrowLeft`;if(e.key===t){e.preventDefault(),P({focusTrigger:!0});return}if(A.onKeyDown(e)){e.preventDefault();return}D(e)},[te,P,D,A,E]),F=(0,w.useMemo)(()=>({menuSize:h,closeMenu:()=>{P({focusTrigger:!1}),m?.closeMenu()}}),[h,P,m]),ce=a?(0,L.jsx)(`span`,{className:`x78zum5 x6s0dn4`,children:(0,L.jsx)(La,{size:`sm`})}):(0,L.jsx)(`span`,{className:`x78zum5 x6s0dn4`,children:(0,L.jsx)(Oc,{icon:`chevronRight`,size:`sm`,color:`secondary`,...Hr(`dropdown-menu-indicator-icon`)})}),le=o?Il.popoverCustomWidth(o):Il.popover;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(al,{ref:e=>re(e),id:v,role:`menuitem`,tabIndex:i?void 0:-1,"aria-haspopup":`menu`,"aria-expanded":b,"aria-controls":b?_:void 0,"aria-disabled":i||void 0,"data-testid":f,onMouseEnter:j.onMouseEnter,onMouseLeave:j.onMouseLeave,onPointerMove:oe,startContent:t?Ac(t,{size:`sm`,color:`secondary`}):void 0,label:n,description:r,endContent:ce,onClick:ie,onKeyDown:ae,isDisabled:i,xstyle:[Pl.root,Fl[h],b&&Pl.open,i&&Pl.disabled,l],...kr(Hr(`dropdown-menu-item`,{size:h}),{className:u,style:d})}),S.render((0,L.jsx)(`div`,{ref:E,id:_,role:`menu`,tabIndex:-1,"aria-labelledby":v,onKeyDown:se,onMouseEnter:M.onMouseEnter,onMouseLeave:M.onMouseLeave,"data-testid":p,...kr(Hr(`dropdown-menu`),{className:`x9f619 x78zum5 xdt5ytf x1lsbc85 xuyqlj2 x1odjw0f x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92`}),children:(0,L.jsx)(ol,{value:F,children:c})}),{placement:`end`,alignment:`start`,offset:Qn[`--spacing-1`],xstyle:[le,Yi.end]})]})}Ll.displayName=`DropdownMenuSubMenu`;function Rl(e,t){return`item-${e.id??t}`}function zl(e,t){return`section-${e.id??t}`}function Bl(e,t){let{items:n,id:r,...i}=e;return(0,L.jsx)(fl,{...i},Rl(e,t))}function Vl(e){let t=[];for(let n=0;n0?t.push((0,L.jsx)(Ll,{icon:r.icon,label:r.label,isDisabled:r.isDisabled,children:Vl(r.items)},Rl(r,n))):t.push(Bl(r,n)))}return t}var Hl={dropdown:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kOIVth:`x1lsbc85`,kskxy:`xuyqlj2`,kORKVm:`x1odjw0f`,"--_dropdown-menu-radius":`x1fcsqxe`,"--_dropdown-menu-padding":`xgory14`,kmVPX3:`x9epnlk`,kaIpWk:`x1n97fys`,kSiTet:`x1hc1fzr`,k1ekBW:`x19991ni`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,$$css:!0},popover:{k7Eaqz:`xrzjruh`,$$css:!0},popoverCustomWidth:e=>[{k7Eaqz:(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`xkj4a21`,$$css:!0},{"--x-minWidth":(e=>typeof e==`number`?e+`px`:e??void 0)(typeof e==`number`?`${e}px`:e)}]},Ul=`@astryx.dropdownMenu.label`;function V({button:e,isMenuOpen:t,onOpenChange:n,menuWidth:r,onClick:i,hasChevron:a=!0,placement:o=`below`,alignment:s=`start`,className:c,style:l,xstyle:u,"data-testid":d,...f}){let p=ys(),m=e??{label:p(Ul)},h=(`items`in f?f.items:void 0)??[],g=f.children,{items:_,children:v,...y}=f,b=(0,w.useId)(),x=m.size??`md`,S=(0,w.useRef)(null),[C,T]=(0,w.useState)(!1),E=t!==void 0,D=E?t:C,O=(0,w.useCallback)(()=>{n?.(!1),E||T(!1),S.current?.focus()},[E,n]),ee=(0,w.useRef)(!1),te=(0,w.useRef)(`keyboard`),k=qc({onHide:O,onShow:(0,w.useCallback)(()=>{n?.(!0),E||T(!0)},[E,n]),hasLightDismiss:!0,hasCloseButton:!1,hasAutoFocus:!1,role:`none`}),A=(0,w.useCallback)(()=>{k.hide()},[k]),{listRef:j,handleKeyDown:M,focusFirst:ne,focusItem:N,ownsEvent:P,getItems:re}=Tl({itemSelector:Ml,boundarySelector:Nl,wrap:!1,onEscape:A}),ie=Al({getItemLabels:()=>re().map(e=>e.textContent),onMatch:N,getCurrentIndex:()=>re().findIndex(e=>e===document.activeElement||e.contains(document.activeElement))});(0,w.useEffect)(()=>{E&&(t&&!k.isOpen?(ee.current=!0,k.show()):!t&&k.isOpen&&k.hide())},[t,E,k]),(0,w.useEffect)(()=>{!k.isOpen||!ee.current||(ee.current=!1,requestAnimationFrame(()=>{(te.current===`pointer`||!ne())&&j.current?.focus(),te.current=`keyboard`}))},[k.isOpen,ne,j]);let ae=(0,w.useCallback)(e=>{if(P(e)){if(e.key===`Enter`||e.key===` `){e.preventDefault();let t=document.activeElement;t&&jl.has(t.getAttribute(`role`)??``)&&t.click();return}if(e.key===`Tab`){A();return}if(ie.onKeyDown(e)){e.preventDefault();return}M(e)}},[M,A,ie,P]),oe=(0,w.useCallback)((e=`keyboard`)=>{te.current=e,ee.current=!0,k.show()},[k]),se=(0,w.useCallback)(e=>{if(k.wasJustDismissed())return;i?.();let r=e.detail===0?`keyboard`:`pointer`;E?(t||(te.current=r),n?.(!t)):k.isOpen?k.hide():oe(r)},[i,E,n,t,k,oe]),F=(0,w.useCallback)(e=>{k.isOpen||(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),oe())},[k.isOpen,oe]),ce=m.isIconOnly===!0,le=m.endContent??(a&&!ce?(0,L.jsx)(Oc,{icon:`chevronDown`,size:`sm`,color:`inherit`}):void 0),ue=r?Hl.popoverCustomWidth(r):Hl.popover,de=(0,w.useMemo)(()=>({closeMenu:A,menuSize:x}),[A,x]),fe=f.items===void 0?g:Vl(h);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Os,{...m,ref:e=>{S.current=e,k.triggerRef(e);let t=m.ref;typeof t==`function`?t(e):t&&(t.current=e)},tooltip:D?void 0:m.tooltip,endContent:le,onClick:se,onKeyDown:F,"aria-haspopup":`menu`,"aria-expanded":D,"aria-controls":b,"data-testid":d}),k.render((0,L.jsx)(`div`,{...y,ref:j,id:b,role:`menu`,tabIndex:-1,"aria-label":m.label,onKeyDown:ae,...kr(Hr(`dropdown-menu`),xn(Hl.dropdown,u),c,l),children:(0,L.jsx)(ol,{value:de,children:fe})}),{placement:o,alignment:s,offset:Qn[`--spacing-1`],xstyle:[ue,Yi[o]]})]})}V.displayName=`DropdownMenu`;var Wl=s({Tooltip:()=>W});function H(e){return typeof e==`string`||typeof e==`number`}function U(...e){let t=e.filter(Boolean);return t.length>0?t.join(` `):void 0}function W({children:e,anchorRef:t,content:n,placement:r=`above`,alignment:i=`center`,delay:a=200,hideDelay:o=0,focusTrigger:s=`auto`,touchTrigger:c=`auto`,isEnabled:l=!0,onOpenChange:u,hasHoverIndication:d=`auto`,isOpen:f,isDefaultOpen:p}){let m=(0,w.useRef)(null),h=e!=null&&H(e),g=d===!0||d===`auto`&&h,_=$i({placement:r,alignment:i,delay:a,hideDelay:o,focusTrigger:s,touchTrigger:c,isEnabled:l,isOpen:f,isDefaultOpen:p,onShow:(0,w.useCallback)(()=>{u?.(!0)},[u]),onHide:(0,w.useCallback)(()=>{u?.(!1)},[u])});return xl(()=>{if(!t)return;let e=t.current;if(!e)return;_.ref(e);let n=e.getAttribute(`aria-describedby`);return e.setAttribute(`aria-describedby`,U(n,_.describedBy)??``),()=>{_.ref(null),n?e.setAttribute(`aria-describedby`,n):e.removeAttribute(`aria-describedby`)}},[t,_.ref,_.describedBy]),xl(()=>{if(t||h)return;let e=m.current;if(!e)return;let n=e.firstElementChild;if(!n)return;_.ref(n);let r=n.getAttribute(`aria-describedby`);return n.setAttribute(`aria-describedby`,U(r,_.describedBy)??``),()=>{_.ref(null),r?n.setAttribute(`aria-describedby`,r):n.removeAttribute(`aria-describedby`)}},[t,h,_.ref,_.describedBy]),t&&e==null?(0,L.jsx)(L.Fragment,{children:_.renderTooltip(n)}):h?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{ref:_.ref,tabIndex:0,"aria-describedby":_.describedBy,...{0:{className:`xt0psk2`},1:{className:`xt0psk2 xujl8zx xev0dqp xycaml9 xrys4gj`}}[!!g<<0],children:e}),_.renderTooltip(n)]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{ref:m,className:`xjp7ctv`,children:e}),_.renderTooltip(n)]})}W.displayName=`Tooltip`;function Gl(e,t){return e.name?.trim()||e.firstMessage?.trim()||t}function Kl(e){return e.split(/[\\/]/u).filter(Boolean).at(-1)||e}function ql(e,t=96){let n=String(e??``).replace(/\s+/gu,` `).trim();return n.length>t?`${n.slice(0,t-1)}…`:n}function Jl(e){let t=Date.now()-new Date(e).getTime();return Number.isFinite(t)?t<6e4?`now`:t<36e5?`${Math.floor(t/6e4)}m`:t<864e5?`${Math.floor(t/36e5)}h`:new Date(e).toLocaleDateString(void 0,{day:`numeric`,month:`short`}):``}function Yl(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function Xl(e,t=Date.now()){if(typeof e!=`number`)return``;let n=Math.max(0,Math.round((t-e)/1e3)),r=Math.floor(n/60),i=n%60;return r>0?`${r}m${String(i).padStart(2,`0`)}s`:`${i}s`}function Zl(e){let t=e.split(` -`).map(e=>e.trim()).find(Boolean)??``;return t.length>60?`${t.slice(0,60)}…`:t}function Ql(e){return e===`running`?`running`:e===`done`||e===`completed`?`done`:[`error`,`failed`,`aborted`,`killed`,`timed_out`].includes(e)?`error`:e===`uncertain`?`warn`:`unknown`}function $l({kind:e,label:t,status:n,onClick:r}){return(0,L.jsxs)(r?`button`:`span`,{className:`activity-chip ${e} ${n}`,type:r?`button`:void 0,onClick:r,children:[n===`running`?(0,L.jsx)(`i`,{className:`activity-chip-dot`}):n===`done`?(0,L.jsx)(P,{}):n===`error`?(0,L.jsx)(ze,{}):(0,L.jsx)(`span`,{className:`activity-chip-glyph`,children:`?`}),(0,L.jsx)(`span`,{className:`activity-chip-text`,children:t})]})}function eu({snapshot:e,onInspectTerminal:t}){let[,n]=(0,w.useState)(0),r=e?.runtime.capabilities,i=[...r?.subagents?.items??[],...r?.workflows?.items??[],...r?.[`background-terminals`]?.items??[]].some(e=>e.status===`running`);(0,w.useEffect)(()=>{if(!i)return;let e=window.setInterval(()=>n(e=>e+1),1e3);return()=>window.clearInterval(e)},[i]);let a=[];for(let e of r?.workflows?.items??[]){let t=e.agents.total-e.agents.running,n=e.agents.total?` · ${t}/${e.agents.total} agents`:``,r=e.status===`running`&&e.currentPhase?` · ${e.currentPhase}`:``,i=Xl(e.startedAt,e.finishedAt);a.push({key:`workflow-${e.runId}`,kind:`workflow`,label:`${e.name||e.runId}${r}${n}${i?` · ${i}`:``}`,status:Ql(e.status)})}for(let e of r?.subagents?.items??[]){let t=Xl(e.createdAt,e.settledAt);a.push({key:`subagent-${e.id}`,kind:`subagent`,label:`${e.title||e.id}${t?` · ${t}`:``}`,status:Ql(e.status)})}for(let e of r?.[`background-terminals`]?.items??[]){let n=Xl(e.createdAt,e.settledAt);a.push({key:`terminal-${e.id}`,onClick:t?()=>t(e.id):void 0,kind:`terminal`,label:`${e.title||e.id}${n?` · ${n}`:``}`,status:Ql(e.status)})}a.sort((e,t)=>Number(t.status===`running`)-Number(e.status===`running`));let o=a.slice(0,5),s=a.length-o.length+(r?.subagents?.omitted??0)+(r?.workflows?.omitted??0)+(r?.[`background-terminals`]?.omitted??0);return!o.length&&!s?null:(0,L.jsxs)(`div`,{className:`activity-bar`,role:`status`,"aria-label":`Runtime activity`,children:[o.map(({key:e,...t})=>(0,L.jsx)($l,{...t},e)),s>0&&(0,L.jsxs)(`span`,{className:`activity-chip more`,children:[`+`,s]})]})}function tu(e){let t=`${e.provider}/${e.id}`;return e.label===t?t:`${e.label} (${t})`}function nu(e){let{t}=cn(),[n,r]=(0,w.useState)(``),i=(0,w.useRef)(null),a=e.snapshot?.selectedSession,o=!!(!e.workspaceDraft&&a?.id&&a.id===e.snapshot?.currentSessionId),s=!!(e.selectedWorkspace&&(e.workspaceDraft||!a&&!e.snapshot?.currentSessionId)),c=o||s,l=!e.workspaceDraft&&(e.snapshot?.runtime.status===`running`||e.liveRunning),u=o&&l&&!!(e.activeTurn??e.snapshot?.runtime.activeTurn),d=e.sessionSwitching||!c&&!!e.selectedWorkspace,f=e=>{e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`,e.style.overflowY=e.scrollHeight>220?`auto`:`hidden`},p=async t=>{if(t?.preventDefault(),!e.selectedWorkspace){await e.actions.chooseWorkspace();return}await e.actions.sendPrompt(n)&&(r(``),i.current&&(i.current.style.height=`auto`,i.current.style.overflowY=`hidden`))},m=[...(e.snapshot?.workspaces??[]).map(t=>({id:t.path,label:t.name,icon:(0,L.jsx)(ve,{}),endContent:t.path===e.selectedWorkspace?(0,L.jsx)(P,{}):void 0,onClick:()=>e.actions.setWorkspace(t.path)})),{type:`divider`},{id:`add`,label:t(`addWorkspaceMenu`),icon:(0,L.jsx)(De,{}),onClick:()=>void e.actions.chooseWorkspace()}],h=e.draftModel??e.snapshot?.models.find(e=>e.current)??e.snapshot?.models[0],g=h?tu(h):t(`noModels`),_=(e.snapshot?.models??[]).map(t=>({id:`${t.provider}/${t.id}`,label:(0,L.jsx)(`span`,{className:`model-menu-item-label`,children:tu(t)}),endContent:(e.draftModel?e.draftModel.provider===t.provider&&e.draftModel.id===t.id:t.current)?(0,L.jsx)(P,{}):void 0,onClick:()=>void e.actions.selectModel(`${t.provider}/${t.id}`)})),v=e.selectedWorkspace?e.landing?t(`promptTask`):t(o?`promptMessage`:`promptReadonly`):t(`promptStart`),y=e.workspaceDraft?t(`enterHint`):e.turnCancellationPending?t(`stoppingTurn`):e.turnTerminalStatus===`cancelled`?t(`stoppedTurn`):e.pendingFollowUpsReceipt===null?t(c?l?`queuedHint`:`enterHint`:`activeOnlyHint`):e.pendingFollowUpsReceipt>0?t(`pendingFollowUpsHint`,{count:e.pendingFollowUpsReceipt}):t(`acceptedHint`);return(0,L.jsxs)(`div`,{className:`composer-dock`,children:[o&&(0,L.jsx)(eu,{snapshot:e.snapshot,onInspectTerminal:e.onInspect}),e.landing&&(0,L.jsx)(`div`,{className:`workspace-picker-row`,children:(0,L.jsx)(V,{className:`workspace-picker-menu`,button:{label:e.selectedWorkspace?Kl(e.selectedWorkspace):t(`selectWorkspace`),icon:(0,L.jsx)(ve,{}),size:`md`,variant:`ghost`,className:`workspace-picker`},items:m,menuWidth:240,placement:`above`,alignment:`start`,hasChevron:!0})}),(0,L.jsxs)(`form`,{className:`composer ${e.selectedWorkspace?``:`dormant`}`,onSubmit:e=>void p(e),children:[!e.selectedWorkspace&&(0,L.jsx)(`button`,{className:`dormant-overlay`,type:`button`,"aria-label":t(`selectWorkspace`),onClick:()=>void e.actions.chooseWorkspace()}),(0,L.jsx)(`textarea`,{ref:i,value:n,rows:1,disabled:d,readOnly:!e.selectedWorkspace,"aria-label":t(`describeTask`),placeholder:v,onChange:e=>{r(e.target.value),f(e.currentTarget)},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),p())}}),(0,L.jsxs)(`div`,{className:`composer-toolbar`,children:[e.onInspect&&(0,L.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":t(`runtimeStatus`),title:t(`runtimeStatus`),disabled:!o||e.sessionSwitching,onClick:()=>e.onInspect?.(),children:(0,L.jsx)(je,{})}),(0,L.jsx)(`div`,{className:`model-picker-wrap`,children:(0,L.jsx)(V,{className:`model-menu`,button:{label:g,children:h?(0,L.jsx)(`span`,{className:`model-picker-label`,children:g}):void 0,endContent:(0,L.jsx)(re,{}),size:`sm`,variant:`ghost`,className:`model-picker`,isDisabled:e.sessionSwitching||e.modelSelectionPending||e.promptAdmissionPending||!!(!e.workspaceDraft&&a&&!o)||l||!_.length},items:_,menuWidth:320,placement:`above`,alignment:`end`,hasChevron:!1})}),u?(0,L.jsx)(W,{content:t(`stopTurn`),placement:`above`,children:(0,L.jsx)(`button`,{className:`send-button`,type:`button`,"aria-label":t(`stopTurn`),disabled:e.turnCancellationPending||e.sessionSwitching,onClick:()=>void e.actions.cancelActiveTurn(),children:(0,L.jsx)(Ne,{})})}):(0,L.jsx)(W,{content:t(`send`),placement:`above`,children:(0,L.jsx)(`button`,{className:`send-button`,type:`submit`,"aria-label":t(`send`),disabled:e.sessionSwitching||e.modelSelectionPending||!c||!e.selectedWorkspace||e.promptAdmissionPending||!n.trim(),children:(0,L.jsx)(Ae,{})})})]}),(0,L.jsx)(`div`,{className:`composer-hint`,"aria-live":`polite`,children:y})]})]})}function ru({items:e,label:t}){return(0,L.jsx)(`span`,{className:`astryx-menu-trigger`,children:(0,L.jsx)(V,{button:{label:t,icon:(0,L.jsx)(pe,{}),isIconOnly:!0,size:`sm`,variant:`ghost`,className:`menu-action-button`},items:e,menuWidth:190,placement:`below`,alignment:`end`,hasChevron:!1})})}function iu(e){let{t}=cn(),[n,r]=(0,w.useState)(null),[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(``),c=(0,w.useRef)(null),l=(0,w.useRef)(null),u=e.snapshot,[d,f]=(0,w.useState)(!1),[p,m]=(0,w.useState)(new Set),[h,g]=(0,w.useState)(new Set),_=(0,w.useRef)(new Set),[v,y]=(0,w.useState)(!1),b=async t=>{if(!_.current.has(t)){_.current.add(t),g(new Set(_.current)),y(!1);try{await e.actions.unarchiveSession(t)||y(!0)}finally{_.current.delete(t),g(new Set(_.current))}}};(0,w.useEffect)(()=>{e.searchOpen&&c.current?.focus()},[e.searchOpen]),(0,w.useEffect)(()=>{n&&(l.current?.focus(),l.current?.select())},[n]);let x=(0,w.useMemo)(()=>{let n=e.query.trim().toLowerCase(),r=e=>(u?.sessions??[]).filter(r=>!!r.archived===d&&(e===`__ungrouped__`?r.ungrouped:r.cwd===e&&!r.ungrouped)&&(!n||`${Gl(r,t(`untitledSession`))} ${r.cwd}`.toLowerCase().includes(n))),i=[...u?.workspaces??[]];for(let e of u?.sessions??[])!e.ungrouped&&!i.some(t=>t.path===e.cwd)&&i.push({path:e.cwd,name:e.cwd,current:!1});return[...i.map(e=>({...e,sessions:r(e.path),ungrouped:!1})),{path:`__ungrouped__`,name:t(`ungrouped`),current:!1,sessions:r(`__ungrouped__`),ungrouped:!0}].filter(e=>e.sessions.length>0||!d&&!e.ungrouped&&!n)},[d,e.query,u,t]),S=e=>{s(e.name),r(e)},C=async()=>{let t=o.trim();!n||!t||(n.kind===`workspace`?await e.actions.renameWorkspace(n.path,t):await e.actions.renameSession(n.path,t),r(null))};return(0,L.jsxs)(`aside`,{className:`session-sidebar`,"aria-label":`Session navigation`,children:[(0,L.jsxs)(`div`,{className:`sidebar-brand`,children:[(0,L.jsx)(gn,{compact:!0}),(0,L.jsx)(W,{content:t(`collapseSidebar`),placement:`end`,children:(0,L.jsx)(`button`,{className:`collapse-button`,type:`button`,"aria-label":t(`collapseSidebar`),onClick:()=>e.mobileOpen?e.actions.closeMobileSidebar():e.actions.toggleSidebar(!1),children:(0,L.jsx)(oe,{})})})]}),(0,L.jsxs)(`button`,{className:`new-session-button`,type:`button`,onClick:()=>e.selectedWorkspace?void e.actions.createSession(e.selectedWorkspace):void e.actions.chooseWorkspace(),children:[(0,L.jsx)(Me,{}),(0,L.jsx)(`span`,{children:t(`newSession`)})]}),(0,L.jsxs)(`div`,{className:`workspace-heading ${e.searchOpen?`is-searching`:``}`,children:[(0,L.jsx)(`span`,{className:`workspace-heading-label`,children:t(`workspaces`)}),(0,L.jsxs)(`div`,{className:`session-search`,children:[(0,L.jsx)(ke,{}),(0,L.jsx)(`input`,{ref:c,type:`search`,value:e.query,placeholder:t(`searchPlaceholder`),"aria-label":t(`searchConversations`),onChange:t=>e.actions.setQuery(t.target.value)}),(0,L.jsx)(`button`,{type:`button`,"aria-label":t(`closeSearch`),onClick:()=>e.actions.setSearchOpen(!1),children:(0,L.jsx)(ze,{})})]}),(0,L.jsxs)(`div`,{className:`workspace-actions`,children:[(0,L.jsx)(W,{content:t(`searchConversations`),children:(0,L.jsx)(`button`,{className:`icon-button`,type:`button`,"aria-label":t(`searchConversations`),onClick:()=>e.actions.setSearchOpen(!0),children:(0,L.jsx)(ke,{})})}),(0,L.jsx)(W,{content:t(`addWorkspace`),children:(0,L.jsx)(`button`,{className:`icon-button`,type:`button`,"aria-label":t(`addWorkspace`),onClick:()=>void e.actions.chooseWorkspace(),children:(0,L.jsx)(De,{})})})]})]}),(0,L.jsxs)(`fieldset`,{className:`session-view-switch`,"aria-label":t(`conversationViews`),children:[(0,L.jsx)(`button`,{type:`button`,"aria-pressed":!d,onClick:()=>f(!1),children:t(`currentConversations`)}),(0,L.jsx)(`button`,{type:`button`,"aria-pressed":d,onClick:()=>f(!0),children:t(`archivedConversations`)})]}),d&&(0,L.jsx)(`p`,{className:`sidebar-scope-note`,children:t(`loadedArchives`)}),!!(u?.truncation.sessionsOmitted||u?.truncation.workspacesOmitted)&&(0,L.jsx)(`p`,{className:`sidebar-scope-note`,children:t(`loadedHistoryBounded`,{sessions:u?.truncation.sessionsOmitted,workspaces:u?.truncation.workspacesOmitted})}),v&&(0,L.jsx)(`p`,{className:`sidebar-scope-note`,role:`alert`,children:t(`restoreFailed`)}),(0,L.jsx)(`div`,{className:`workspace-tree`,children:x.length?x.map(n=>{let r=(d?p:e.collapsed).has(n.path);return(0,L.jsxs)(`section`,{className:`workspace-group ${r?`collapsed`:``}`,children:[(0,L.jsxs)(`div`,{className:`workspace-button`,children:[(0,L.jsxs)(`button`,{className:`workspace-label`,type:`button`,"aria-expanded":!r,title:n.path===`__ungrouped__`?void 0:n.path,onClick:()=>{d?m(e=>{let t=new Set(e);return t.has(n.path)?t.delete(n.path):t.add(n.path),t}):e.actions.toggleWorkspace(n.path)},children:[(0,L.jsx)(`span`,{className:`workspace-toggle`,"aria-hidden":`true`,children:(0,L.jsx)(`span`,{className:`workspace-chevron`,children:`⌄`})}),(0,L.jsx)(`strong`,{children:n.name})]}),!n.ungrouped&&(0,L.jsxs)(`span`,{className:`workspace-row-actions`,children:[(0,L.jsx)(ru,{label:`Workspace options`,items:[{id:`rename`,label:t(`renameWorkspace`),icon:(0,L.jsx)(Me,{}),onClick:()=>S({kind:`workspace`,path:n.path,name:n.name})},{id:`remove`,label:t(`removeWorkspace`),icon:(0,L.jsx)(Fe,{}),variant:`destructive`,onClick:()=>a({path:n.path,name:n.name})}]}),(0,L.jsx)(W,{content:t(`newSession`),children:(0,L.jsx)(`button`,{className:`workspace-action`,type:`button`,"aria-label":`${t(`newSession`)} ${n.name}`,onClick:t=>{t.stopPropagation(),e.actions.createSession(n.path)},children:(0,L.jsx)(De,{})})})]})]}),(0,L.jsx)(`div`,{className:`workspace-sessions`,children:n.sessions.length?n.sessions.map(n=>(0,L.jsxs)(`div`,{className:`session-row`,children:[(0,L.jsxs)(`button`,{className:`session ${n.path===e.selectedPath?`active`:``}`,type:`button`,"aria-current":n.path===e.selectedPath?`page`:void 0,title:Gl(n,t(`untitledSession`)),onClick:()=>void e.actions.selectSession(n.path),children:[(0,L.jsx)(`span`,{className:`session-title`,children:Gl(n,t(`untitledSession`))}),(0,L.jsx)(`span`,{className:`session-time`,children:Jl(n.modified)})]}),(0,L.jsx)(ru,{label:t(`conversationOptions`),items:[{id:`rename`,label:t(`renameConversation`),icon:(0,L.jsx)(Me,{}),onClick:()=>S({kind:`session`,path:n.path,name:Gl(n,t(`untitledSession`))})},{id:d?`restore`:`archive`,label:h.has(n.path)?t(`restoringConversation`):t(d?`restoreConversation`:`archiveConversation`),icon:d?(0,L.jsx)(ee,{}):(0,L.jsx)(te,{}),onClick:()=>d?void b(n.path):void e.actions.archiveSession(n.path)}]})]},n.path)):(0,L.jsx)(`div`,{className:`empty`,children:t(`noConversations`)})})]},n.path)}):(0,L.jsx)(`div`,{className:`empty`,children:e.query?t(`noMatching`):t(d?`noLoadedArchives`:`noSessions`)})}),(0,L.jsx)(mi,{isOpen:!!n,onOpenChange:e=>!e&&r(null),purpose:`form`,width:400,"aria-label":n?.kind===`workspace`?t(`renameWorkspace`):t(`renameConversation`),children:(0,L.jsxs)(`form`,{className:`openpi-dialog`,onSubmit:e=>{e.preventDefault(),C()},children:[(0,L.jsx)(`strong`,{children:n?.kind===`workspace`?t(`renameWorkspace`):t(`renameConversation`)}),(0,L.jsx)(`input`,{ref:l,value:o,maxLength:80,"aria-label":n?.kind===`workspace`?t(`workspaceName`):t(`conversationName`),onChange:e=>s(e.target.value)}),(0,L.jsxs)(`div`,{className:`dialog-actions`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:()=>r(null),children:t(`cancel`)}),(0,L.jsx)(`button`,{type:`submit`,className:`primary`,children:t(`save`)})]})]})}),(0,L.jsx)(mi,{isOpen:!!i,onOpenChange:e=>!e&&a(null),purpose:`form`,width:440,"aria-label":t(`deleteWorkspace`),children:(0,L.jsxs)(`div`,{className:`openpi-dialog`,children:[(0,L.jsx)(`strong`,{children:t(`deleteWorkspace`)}),(0,L.jsxs)(`p`,{children:[i?.name,`:`,t(`workspaceDeleteConfirm`)]}),(0,L.jsxs)(`div`,{className:`dialog-actions`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:()=>a(null),children:t(`cancel`)}),(0,L.jsx)(`button`,{type:`button`,className:`danger`,onClick:()=>{i&&(e.actions.removeWorkspace(i.path),a(null))},children:t(`deleteWorkspace`)})]})]})})]})}function au(e){let t=new Map(e.map((e,t)=>[e.id,t])),n=new Map,r=new Map,i=new Map;for(let a of e){let e=`message`in a?a.message:void 0;for(let t of e?.parts??[])t.type===`toolCall`&&t.id&&r.set(t.id,(r.get(t.id)??0)+1);if(e?.role===`toolResult`&&e.toolCallId){let r=i.get(e.toolCallId)??[];r.push(e),n.set(e,t.get(a.id)??-1),i.set(e.toolCallId,r)}}let a=new Set,o=[];for(let s of e){let e=`message`in s?s.message:void 0;if(!e){o.push({key:s.id,kind:`event`,title:s.type,timestamp:s.timestamp});continue}if(e.role!==`toolResult`){(e.role!==`assistant`||e.content||!e.parts?.length||e.parts?.some(e=>e.type!==`toolCall`))&&o.push({key:s.id,kind:e.role===`user`?`user`:e.role===`assistant`?`assistant`:`event`,title:e.customType||e.role||s.type,timestamp:s.timestamp,message:e});for(let[c,l]of(e.parts??[]).entries()){if(l.type!==`toolCall`)continue;let u=l.id?i.get(l.id):void 0,d=l.id&&r.get(l.id)===1&&u?.length===1&&u[0]?.toolName===l.name&&!l.id.includes(`[truncated]`)&&(n.get(u[0])??-1)>(t.get(s.id)??-1)?u[0]:void 0;d&&a.add(d),o.push({key:`${s.id}:call:${c}`,kind:`call`,title:l.name,timestamp:s.timestamp,callId:l.id,input:l.arguments,message:e,result:d,outcome:d?.isError===!0?`error`:d?.isError===!1?`returned`:`unknown`})}}}let s=new Map(o.map(e=>[e.key,t.get(e.key)??-1]));for(let n of e){let e=`message`in n?n.message:void 0;e?.role===`toolResult`&&!a.has(e)&&(o.push({key:n.id,kind:`result`,title:e.toolName||`toolResult`,timestamp:n.timestamp,callId:e.toolCallId,result:e,outcome:e.isError===!0?`error`:e.isError===!1?`returned`:`unknown`}),s.set(n.id,t.get(n.id)??0));for(let[r,i]of(e?.parts??[]).entries())i.type===`toolCall`&&s.set(`${n.id}:call:${r}`,t.get(n.id)??0)}return o.sort((e,t)=>(s.get(e.key)??0)-(s.get(t.key)??0)),o}var ou=[],su=(0,w.memo)(function({snapshot:e,running:t}){let{t:n}=cn(),r=e.selectedSession?.entries??ou,i=(0,w.useMemo)(()=>au(r),[r]),[a,o]=(0,w.useState)(null),[s,c]=(0,w.useState)(50),l=i.findIndex(e=>e.key===a),u=Math.min(Math.max(0,i.length-s),l<0?i.length:l),d=i.slice(u),f=d.find(e=>e.key===a)??d.at(-1),p=e.selectedSession?.truncation,m=f?.result,h=f?.message;return(0,L.jsxs)(`section`,{className:`conversation trajectory`,"aria-label":n(`trajectory`),children:[(0,L.jsxs)(`header`,{className:`trajectory-heading`,children:[(0,L.jsx)(`h2`,{children:n(`trajectory`)}),(0,L.jsx)(`p`,{children:n(`trajectoryScope`)}),t&&(0,L.jsx)(`p`,{role:`status`,children:n(`trajectoryRunning`)}),p?.truncated&&(0,L.jsx)(`p`,{className:`trajectory-warning`,children:n(`trajectoryTruncated`,{entries:p.entriesOmitted,parts:p.messagePartsOmitted,messages:p.messagesTruncated})})]}),i.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`nav`,{className:`trajectory-overview`,"aria-label":n(`trajectoryOverview`),children:d.map((e,t)=>(0,L.jsx)(`button`,{type:`button`,"aria-label":`${n(`trajectory_${e.kind}`)} ${i.length-d.length+t+1}: ${e.title}`,"aria-pressed":e.key===f?.key,onClick:()=>o(e.key),className:`trajectory-point ${e.kind} ${e.outcome??``}`,children:(0,L.jsx)(`span`,{children:i.length-d.length+t+1})},e.key))}),(0,L.jsxs)(`div`,{className:`trajectory-body`,children:[(0,L.jsxs)(`div`,{className:`trajectory-ledger`,children:[u>0&&(0,L.jsx)(`button`,{type:`button`,className:`trajectory-load`,onClick:()=>c(e=>e+50),children:n(`trajectoryEarlier`,{count:u})}),(0,L.jsx)(`ol`,{start:i.length-d.length+1,children:d.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,"aria-pressed":e.key===f?.key,onClick:()=>o(e.key),className:`trajectory-record ${e.kind}`,children:[(0,L.jsx)(`span`,{className:`trajectory-kind`,children:n(`trajectory_${e.kind}`)}),(0,L.jsx)(`strong`,{children:e.title}),(0,L.jsx)(`span`,{className:`trajectory-preview`,children:(e.input??e.message?.content??e.result?.content??``).slice(0,110)}),e.outcome&&(0,L.jsx)(`span`,{children:n(`trajectory_${e.outcome}`)})]})},e.key))})]}),f&&(0,L.jsxs)(`section`,{className:`trajectory-inspector`,"aria-label":n(`trajectoryDetails`),children:[(0,L.jsx)(`h3`,{children:f.title}),f.timestamp&&(0,L.jsxs)(`p`,{className:`trajectory-metadata`,children:[n(`trajectoryRecordedAt`),`:`,` `,(0,L.jsx)(`time`,{children:f.timestamp})]}),f.callId&&(0,L.jsxs)(`p`,{className:`trajectory-metadata`,children:[`Tool call ID: `,f.callId]}),(h?.truncation||m?.truncation)&&(0,L.jsx)(`p`,{className:`trajectory-warning`,children:n(`trajectoryEvidenceTruncated`)}),f.input!==void 0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h4`,{children:n(`trajectoryArguments`)}),(0,L.jsx)(`pre`,{children:f.input})]}),h&&f.kind!==`call`&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h4`,{children:n(`trajectoryRecordedContent`)}),(0,L.jsx)(`pre`,{children:h.content||n(`noOutput`)}),h.parts?.some(e=>e.type===`thinking`)&&(0,L.jsxs)(`details`,{children:[(0,L.jsx)(`summary`,{children:n(`trajectoryThinking`)}),(0,L.jsx)(`pre`,{children:h.parts.filter(e=>e.type===`thinking`).map(e=>e.text).join(` +`).map(e=>e.trim()).find(Boolean)??``;return t.length>60?`${t.slice(0,60)}…`:t}function Ql(e){return e===`running`?`running`:e===`done`||e===`completed`?`done`:[`error`,`failed`,`aborted`,`killed`,`timed_out`].includes(e)?`error`:e===`uncertain`?`warn`:`unknown`}function $l({kind:e,label:t,status:n,onClick:r}){return(0,L.jsxs)(r?`button`:`span`,{className:`activity-chip ${e} ${n}`,type:r?`button`:void 0,onClick:r,children:[n===`running`?(0,L.jsx)(`i`,{className:`activity-chip-dot`}):n===`done`?(0,L.jsx)(P,{}):n===`error`?(0,L.jsx)(ze,{}):(0,L.jsx)(`span`,{className:`activity-chip-glyph`,children:`?`}),(0,L.jsx)(`span`,{className:`activity-chip-text`,children:t})]})}function eu({snapshot:e,onInspectTerminal:t}){let[,n]=(0,w.useState)(0),r=e?.runtime.capabilities,i=[...r?.subagents?.items??[],...r?.workflows?.items??[],...r?.[`background-terminals`]?.items??[]].some(e=>e.status===`running`);(0,w.useEffect)(()=>{if(!i)return;let e=window.setInterval(()=>n(e=>e+1),1e3);return()=>window.clearInterval(e)},[i]);let a=[];for(let e of r?.workflows?.items??[]){let t=e.agents.total-e.agents.running,n=e.agents.total?` · ${t}/${e.agents.total} agents`:``,r=e.status===`running`&&e.currentPhase?` · ${e.currentPhase}`:``,i=Xl(e.startedAt,e.finishedAt);a.push({key:`workflow-${e.runId}`,kind:`workflow`,label:`${e.name||e.runId}${r}${n}${i?` · ${i}`:``}`,status:Ql(e.status)})}for(let e of r?.subagents?.items??[]){let t=Xl(e.createdAt,e.settledAt);a.push({key:`subagent-${e.id}`,kind:`subagent`,label:`${e.title||e.id}${t?` · ${t}`:``}`,status:Ql(e.status)})}for(let e of r?.[`background-terminals`]?.items??[]){let n=Xl(e.createdAt,e.settledAt);a.push({key:`terminal-${e.id}`,onClick:t?()=>t(e.id):void 0,kind:`terminal`,label:`${e.title||e.id}${n?` · ${n}`:``}`,status:Ql(e.status)})}a.sort((e,t)=>Number(t.status===`running`)-Number(e.status===`running`));let o=a.slice(0,5),s=a.length-o.length+(r?.subagents?.omitted??0)+(r?.workflows?.omitted??0)+(r?.[`background-terminals`]?.omitted??0);return!o.length&&!s?null:(0,L.jsxs)(`div`,{className:`activity-bar`,role:`status`,"aria-label":`Runtime activity`,children:[o.map(({key:e,...t})=>(0,L.jsx)($l,{...t},e)),s>0&&(0,L.jsxs)(`span`,{className:`activity-chip more`,children:[`+`,s]})]})}function tu(e){let t=`${e.provider}/${e.id}`;return e.label===t?t:`${e.label} (${t})`}function nu(e){let{t}=cn(),[n,r]=(0,w.useState)(``),i=(0,w.useRef)(null),a=e.snapshot?.selectedSession,o=e.selectedPath===void 0?a?.path??null:e.selectedPath,s=o??(e.selectedWorkspace?`new:${e.selectedWorkspace}`:`none`),c=(0,w.useRef)(s),l=(0,w.useRef)(0),u=(0,w.useRef)(null),d=!!(!e.workspaceDraft&&a?.id&&a.id===e.snapshot?.currentSessionId),f=!!(e.selectedWorkspace&&(e.workspaceDraft||!a&&!e.snapshot?.currentSessionId)),p=d||f,m=!e.workspaceDraft&&(e.snapshot?.runtime.status===`running`||e.liveRunning),h=d&&m&&!!(e.activeTurn??e.snapshot?.runtime.activeTurn),g=e.sessionSwitching||!p&&!!e.selectedWorkspace;(0,w.useEffect)(()=>{let t=c.current;if(t===s)return;c.current=s;let n=u.current;if(n?.canTransferToCreatedSession&&n.scope===t&&o&&e.snapshot?.selectedSession?.path===o){n.scope=s;return}l.current+=1,r(``),n?.scope===t&&(n.canTransferToCreatedSession=!1)},[s,e.snapshot?.selectedSession?.path,o]);let _=e=>{e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`,e.style.overflowY=e.scrollHeight>220?`auto`:`hidden`},v=async t=>{if(t?.preventDefault(),!e.selectedWorkspace){await e.actions.chooseWorkspace();return}let a={revision:l.current,scope:c.current,canTransferToCreatedSession:f};u.current=a;try{await e.actions.sendPrompt(n)&&u.current===a&&c.current===a.scope&&l.current===a.revision&&(l.current+=1,r(``),i.current&&(i.current.style.height=`auto`,i.current.style.overflowY=`hidden`))}finally{u.current===a&&(u.current=null)}},y=[...(e.snapshot?.workspaces??[]).map(t=>({id:t.path,label:t.name,icon:(0,L.jsx)(ve,{}),endContent:t.path===e.selectedWorkspace?(0,L.jsx)(P,{}):void 0,onClick:()=>e.actions.setWorkspace(t.path)})),{type:`divider`},{id:`add`,label:t(`addWorkspaceMenu`),icon:(0,L.jsx)(De,{}),onClick:()=>void e.actions.chooseWorkspace()}],b=e.draftModel??e.snapshot?.models.find(e=>e.current)??e.snapshot?.models[0],x=b?tu(b):t(`noModels`),S=(e.snapshot?.models??[]).map(t=>({id:`${t.provider}/${t.id}`,label:(0,L.jsx)(`span`,{className:`model-menu-item-label`,children:tu(t)}),endContent:(e.draftModel?e.draftModel.provider===t.provider&&e.draftModel.id===t.id:t.current)?(0,L.jsx)(P,{}):void 0,onClick:()=>void e.actions.selectModel(`${t.provider}/${t.id}`)})),C=e.selectedWorkspace?e.landing?t(`promptTask`):t(d?`promptMessage`:`promptReadonly`):t(`promptStart`),T=e.workspaceDraft?t(`enterHint`):e.turnCancellationPending?t(`stoppingTurn`):e.turnTerminalStatus===`cancelled`?t(`stoppedTurn`):e.pendingFollowUpsReceipt===null?t(p?m?`queuedHint`:`enterHint`:`activeOnlyHint`):e.pendingFollowUpsReceipt>0?t(`pendingFollowUpsHint`,{count:e.pendingFollowUpsReceipt}):t(`acceptedHint`);return(0,L.jsxs)(`div`,{className:`composer-dock`,children:[d&&(0,L.jsx)(eu,{snapshot:e.snapshot,onInspectTerminal:e.onInspect}),e.landing&&(0,L.jsx)(`div`,{className:`workspace-picker-row`,children:(0,L.jsx)(V,{className:`workspace-picker-menu`,button:{label:e.selectedWorkspace?Kl(e.selectedWorkspace):t(`selectWorkspace`),icon:(0,L.jsx)(ve,{}),size:`md`,variant:`ghost`,className:`workspace-picker`},items:y,menuWidth:240,placement:`above`,alignment:`start`,hasChevron:!0})}),(0,L.jsxs)(`form`,{className:`composer ${e.selectedWorkspace?``:`dormant`}`,onSubmit:e=>void v(e),children:[!e.selectedWorkspace&&(0,L.jsx)(`button`,{className:`dormant-overlay`,type:`button`,"aria-label":t(`selectWorkspace`),onClick:()=>void e.actions.chooseWorkspace()}),(0,L.jsx)(`textarea`,{ref:i,value:n,rows:1,disabled:g,readOnly:!e.selectedWorkspace,"aria-label":t(`describeTask`),placeholder:C,onChange:e=>{l.current+=1,r(e.target.value),_(e.currentTarget)},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),v())}}),(0,L.jsxs)(`div`,{className:`composer-toolbar`,children:[e.onInspect&&(0,L.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":t(`runtimeStatus`),title:t(`runtimeStatus`),disabled:!d||e.sessionSwitching,onClick:()=>e.onInspect?.(),children:(0,L.jsx)(je,{})}),(0,L.jsx)(`div`,{className:`model-picker-wrap`,children:(0,L.jsx)(V,{className:`model-menu`,button:{label:x,children:b?(0,L.jsx)(`span`,{className:`model-picker-label`,children:x}):void 0,endContent:(0,L.jsx)(re,{}),size:`sm`,variant:`ghost`,className:`model-picker`,isDisabled:e.sessionSwitching||e.modelSelectionPending||e.promptAdmissionPending||!!(!e.workspaceDraft&&a&&!d)||m||!S.length},items:S,menuWidth:320,placement:`above`,alignment:`end`,hasChevron:!1})}),h?(0,L.jsx)(W,{content:t(`stopTurn`),placement:`above`,children:(0,L.jsx)(`button`,{className:`send-button`,type:`button`,"aria-label":t(`stopTurn`),disabled:e.turnCancellationPending||e.sessionSwitching,onClick:()=>void e.actions.cancelActiveTurn(),children:(0,L.jsx)(Ne,{})})}):(0,L.jsx)(W,{content:t(`send`),placement:`above`,children:(0,L.jsx)(`button`,{className:`send-button`,type:`submit`,"aria-label":t(`send`),disabled:e.sessionSwitching||e.modelSelectionPending||!p||!e.selectedWorkspace||e.promptAdmissionPending||!n.trim(),children:(0,L.jsx)(Ae,{})})})]}),(0,L.jsx)(`div`,{className:`composer-hint`,"aria-live":`polite`,children:T})]})]})}function ru({items:e,label:t}){return(0,L.jsx)(`span`,{className:`astryx-menu-trigger`,children:(0,L.jsx)(V,{button:{label:t,icon:(0,L.jsx)(pe,{}),isIconOnly:!0,size:`sm`,variant:`ghost`,className:`menu-action-button`},items:e,menuWidth:190,placement:`below`,alignment:`end`,hasChevron:!1})})}function iu(e){let{t}=cn(),[n,r]=(0,w.useState)(null),[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(``),c=(0,w.useRef)(null),l=(0,w.useRef)(null),u=e.snapshot,[d,f]=(0,w.useState)(!1),[p,m]=(0,w.useState)(new Set),[h,g]=(0,w.useState)(new Set),_=(0,w.useRef)(new Set),[v,y]=(0,w.useState)(!1),b=async t=>{if(!_.current.has(t)){_.current.add(t),g(new Set(_.current)),y(!1);try{await e.actions.unarchiveSession(t)||y(!0)}finally{_.current.delete(t),g(new Set(_.current))}}};(0,w.useEffect)(()=>{e.searchOpen&&c.current?.focus()},[e.searchOpen]),(0,w.useEffect)(()=>{n&&(l.current?.focus(),l.current?.select())},[n]);let x=(0,w.useMemo)(()=>{let n=e.query.trim().toLowerCase(),r=e=>(u?.sessions??[]).filter(r=>!!r.archived===d&&(e===`__ungrouped__`?r.ungrouped:r.cwd===e&&!r.ungrouped)&&(!n||`${Gl(r,t(`untitledSession`))} ${r.cwd}`.toLowerCase().includes(n))),i=[...u?.workspaces??[]];for(let e of u?.sessions??[])!e.ungrouped&&!i.some(t=>t.path===e.cwd)&&i.push({path:e.cwd,name:e.cwd,current:!1});return[...i.map(e=>({...e,sessions:r(e.path),ungrouped:!1})),{path:`__ungrouped__`,name:t(`ungrouped`),current:!1,sessions:r(`__ungrouped__`),ungrouped:!0}].filter(e=>e.sessions.length>0||!d&&!e.ungrouped&&!n)},[d,e.query,u,t]),S=e=>{s(e.name),r(e)},C=async()=>{let t=o.trim();!n||!t||(n.kind===`workspace`?await e.actions.renameWorkspace(n.path,t):await e.actions.renameSession(n.path,t),r(null))};return(0,L.jsxs)(`aside`,{className:`session-sidebar`,"aria-label":`Session navigation`,children:[(0,L.jsxs)(`div`,{className:`sidebar-brand`,children:[(0,L.jsx)(gn,{compact:!0}),(0,L.jsx)(W,{content:t(`collapseSidebar`),placement:`end`,children:(0,L.jsx)(`button`,{className:`collapse-button`,type:`button`,"aria-label":t(`collapseSidebar`),onClick:()=>e.mobileOpen?e.actions.closeMobileSidebar():e.actions.toggleSidebar(!1),children:(0,L.jsx)(oe,{})})})]}),(0,L.jsxs)(`button`,{className:`new-session-button`,type:`button`,onClick:()=>e.selectedWorkspace?void e.actions.createSession(e.selectedWorkspace):void e.actions.chooseWorkspace(),children:[(0,L.jsx)(Me,{}),(0,L.jsx)(`span`,{children:t(`newSession`)})]}),(0,L.jsxs)(`div`,{className:`workspace-heading ${e.searchOpen?`is-searching`:``}`,children:[(0,L.jsx)(`span`,{className:`workspace-heading-label`,children:t(`workspaces`)}),(0,L.jsxs)(`div`,{className:`session-search`,children:[(0,L.jsx)(ke,{}),(0,L.jsx)(`input`,{ref:c,type:`search`,value:e.query,placeholder:t(`searchPlaceholder`),"aria-label":t(`searchConversations`),onChange:t=>e.actions.setQuery(t.target.value)}),(0,L.jsx)(`button`,{type:`button`,"aria-label":t(`closeSearch`),onClick:()=>e.actions.setSearchOpen(!1),children:(0,L.jsx)(ze,{})})]}),(0,L.jsxs)(`div`,{className:`workspace-actions`,children:[(0,L.jsx)(W,{content:t(`searchConversations`),children:(0,L.jsx)(`button`,{className:`icon-button`,type:`button`,"aria-label":t(`searchConversations`),onClick:()=>e.actions.setSearchOpen(!0),children:(0,L.jsx)(ke,{})})}),(0,L.jsx)(W,{content:t(`addWorkspace`),children:(0,L.jsx)(`button`,{className:`icon-button`,type:`button`,"aria-label":t(`addWorkspace`),onClick:()=>void e.actions.chooseWorkspace(),children:(0,L.jsx)(De,{})})})]})]}),(0,L.jsxs)(`fieldset`,{className:`session-view-switch`,"aria-label":t(`conversationViews`),children:[(0,L.jsx)(`button`,{type:`button`,"aria-pressed":!d,onClick:()=>f(!1),children:t(`currentConversations`)}),(0,L.jsx)(`button`,{type:`button`,"aria-pressed":d,onClick:()=>f(!0),children:t(`archivedConversations`)})]}),d&&(0,L.jsx)(`p`,{className:`sidebar-scope-note`,children:t(`loadedArchives`)}),!!(u?.truncation.sessionsOmitted||u?.truncation.workspacesOmitted)&&(0,L.jsx)(`p`,{className:`sidebar-scope-note`,children:t(`loadedHistoryBounded`,{sessions:u?.truncation.sessionsOmitted,workspaces:u?.truncation.workspacesOmitted})}),v&&(0,L.jsx)(`p`,{className:`sidebar-scope-note`,role:`alert`,children:t(`restoreFailed`)}),(0,L.jsx)(`div`,{className:`workspace-tree`,children:x.length?x.map(n=>{let r=(d?p:e.collapsed).has(n.path);return(0,L.jsxs)(`section`,{className:`workspace-group ${r?`collapsed`:``}`,children:[(0,L.jsxs)(`div`,{className:`workspace-button`,children:[(0,L.jsxs)(`button`,{className:`workspace-label`,type:`button`,"aria-expanded":!r,title:n.path===`__ungrouped__`?void 0:n.path,onClick:()=>{d?m(e=>{let t=new Set(e);return t.has(n.path)?t.delete(n.path):t.add(n.path),t}):e.actions.toggleWorkspace(n.path)},children:[(0,L.jsx)(`span`,{className:`workspace-toggle`,"aria-hidden":`true`,children:(0,L.jsx)(`span`,{className:`workspace-chevron`,children:`⌄`})}),(0,L.jsx)(`strong`,{children:n.name})]}),!n.ungrouped&&(0,L.jsxs)(`span`,{className:`workspace-row-actions`,children:[(0,L.jsx)(ru,{label:`Workspace options`,items:[{id:`rename`,label:t(`renameWorkspace`),icon:(0,L.jsx)(Me,{}),onClick:()=>S({kind:`workspace`,path:n.path,name:n.name})},{id:`remove`,label:t(`removeWorkspace`),icon:(0,L.jsx)(Fe,{}),variant:`destructive`,onClick:()=>a({path:n.path,name:n.name})}]}),(0,L.jsx)(W,{content:t(`newSession`),children:(0,L.jsx)(`button`,{className:`workspace-action`,type:`button`,"aria-label":`${t(`newSession`)} ${n.name}`,onClick:t=>{t.stopPropagation(),e.actions.createSession(n.path)},children:(0,L.jsx)(De,{})})})]})]}),(0,L.jsx)(`div`,{className:`workspace-sessions`,children:n.sessions.length?n.sessions.map(n=>(0,L.jsxs)(`div`,{className:`session-row`,children:[(0,L.jsxs)(`button`,{className:`session ${n.path===e.selectedPath?`active`:``}`,type:`button`,"aria-current":n.path===e.selectedPath?`page`:void 0,title:Gl(n,t(`untitledSession`)),onClick:()=>void e.actions.selectSession(n.path),children:[(0,L.jsx)(`span`,{className:`session-title`,children:Gl(n,t(`untitledSession`))}),(0,L.jsx)(`span`,{className:`session-time`,children:Jl(n.modified)})]}),(0,L.jsx)(ru,{label:t(`conversationOptions`),items:[{id:`rename`,label:t(`renameConversation`),icon:(0,L.jsx)(Me,{}),onClick:()=>S({kind:`session`,path:n.path,name:Gl(n,t(`untitledSession`))})},{id:d?`restore`:`archive`,label:h.has(n.path)?t(`restoringConversation`):t(d?`restoreConversation`:`archiveConversation`),icon:d?(0,L.jsx)(ee,{}):(0,L.jsx)(te,{}),onClick:()=>d?void b(n.path):void e.actions.archiveSession(n.path)}]})]},n.path)):(0,L.jsx)(`div`,{className:`empty`,children:t(`noConversations`)})})]},n.path)}):(0,L.jsx)(`div`,{className:`empty`,children:e.query?t(`noMatching`):t(d?`noLoadedArchives`:`noSessions`)})}),(0,L.jsx)(mi,{isOpen:!!n,onOpenChange:e=>!e&&r(null),purpose:`form`,width:400,"aria-label":n?.kind===`workspace`?t(`renameWorkspace`):t(`renameConversation`),children:(0,L.jsxs)(`form`,{className:`openpi-dialog`,onSubmit:e=>{e.preventDefault(),C()},children:[(0,L.jsx)(`strong`,{children:n?.kind===`workspace`?t(`renameWorkspace`):t(`renameConversation`)}),(0,L.jsx)(`input`,{ref:l,value:o,maxLength:80,"aria-label":n?.kind===`workspace`?t(`workspaceName`):t(`conversationName`),onChange:e=>s(e.target.value)}),(0,L.jsxs)(`div`,{className:`dialog-actions`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:()=>r(null),children:t(`cancel`)}),(0,L.jsx)(`button`,{type:`submit`,className:`primary`,children:t(`save`)})]})]})}),(0,L.jsx)(mi,{isOpen:!!i,onOpenChange:e=>!e&&a(null),purpose:`form`,width:440,"aria-label":t(`deleteWorkspace`),children:(0,L.jsxs)(`div`,{className:`openpi-dialog`,children:[(0,L.jsx)(`strong`,{children:t(`deleteWorkspace`)}),(0,L.jsxs)(`p`,{children:[i?.name,`:`,t(`workspaceDeleteConfirm`)]}),(0,L.jsxs)(`div`,{className:`dialog-actions`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:()=>a(null),children:t(`cancel`)}),(0,L.jsx)(`button`,{type:`button`,className:`danger`,onClick:()=>{i&&(e.actions.removeWorkspace(i.path),a(null))},children:t(`deleteWorkspace`)})]})]})})]})}function au(e){let t=new Map(e.map((e,t)=>[e.id,t])),n=new Map,r=new Map,i=new Map;for(let a of e){let e=`message`in a?a.message:void 0;for(let t of e?.parts??[])t.type===`toolCall`&&t.id&&r.set(t.id,(r.get(t.id)??0)+1);if(e?.role===`toolResult`&&e.toolCallId){let r=i.get(e.toolCallId)??[];r.push(e),n.set(e,t.get(a.id)??-1),i.set(e.toolCallId,r)}}let a=new Set,o=[];for(let s of e){let e=`message`in s?s.message:void 0;if(!e){o.push({key:s.id,kind:`event`,title:s.type,timestamp:s.timestamp});continue}if(e.role!==`toolResult`){(e.role!==`assistant`||e.content||!e.parts?.length||e.parts?.some(e=>e.type!==`toolCall`))&&o.push({key:s.id,kind:e.role===`user`?`user`:e.role===`assistant`?`assistant`:`event`,title:e.customType||e.role||s.type,timestamp:s.timestamp,message:e});for(let[c,l]of(e.parts??[]).entries()){if(l.type!==`toolCall`)continue;let u=l.id?i.get(l.id):void 0,d=l.id&&r.get(l.id)===1&&u?.length===1&&u[0]?.toolName===l.name&&!l.id.includes(`[truncated]`)&&(n.get(u[0])??-1)>(t.get(s.id)??-1)?u[0]:void 0;d&&a.add(d),o.push({key:`${s.id}:call:${c}`,kind:`call`,title:l.name,timestamp:s.timestamp,callId:l.id,input:l.arguments,message:e,result:d,outcome:d?.isError===!0?`error`:d?.isError===!1?`returned`:`unknown`})}}}let s=new Map(o.map(e=>[e.key,t.get(e.key)??-1]));for(let n of e){let e=`message`in n?n.message:void 0;e?.role===`toolResult`&&!a.has(e)&&(o.push({key:n.id,kind:`result`,title:e.toolName||`toolResult`,timestamp:n.timestamp,callId:e.toolCallId,result:e,outcome:e.isError===!0?`error`:e.isError===!1?`returned`:`unknown`}),s.set(n.id,t.get(n.id)??0));for(let[r,i]of(e?.parts??[]).entries())i.type===`toolCall`&&s.set(`${n.id}:call:${r}`,t.get(n.id)??0)}return o.sort((e,t)=>(s.get(e.key)??0)-(s.get(t.key)??0)),o}var ou=[],su=(0,w.memo)(function({snapshot:e,running:t}){let{t:n}=cn(),r=e.selectedSession?.entries??ou,i=(0,w.useMemo)(()=>au(r),[r]),[a,o]=(0,w.useState)(null),[s,c]=(0,w.useState)(50),l=i.findIndex(e=>e.key===a),u=Math.min(Math.max(0,i.length-s),l<0?i.length:l),d=i.slice(u),f=d.find(e=>e.key===a)??d.at(-1),p=e.selectedSession?.truncation,m=f?.result,h=f?.message;return(0,L.jsxs)(`section`,{className:`conversation trajectory`,"aria-label":n(`trajectory`),children:[(0,L.jsxs)(`header`,{className:`trajectory-heading`,children:[(0,L.jsx)(`h2`,{children:n(`trajectory`)}),(0,L.jsx)(`p`,{children:n(`trajectoryScope`)}),t&&(0,L.jsx)(`p`,{role:`status`,children:n(`trajectoryRunning`)}),p?.truncated&&(0,L.jsx)(`p`,{className:`trajectory-warning`,children:n(`trajectoryTruncated`,{entries:p.entriesOmitted,parts:p.messagePartsOmitted,messages:p.messagesTruncated})})]}),i.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`nav`,{className:`trajectory-overview`,"aria-label":n(`trajectoryOverview`),children:d.map((e,t)=>(0,L.jsx)(`button`,{type:`button`,"aria-label":`${n(`trajectory_${e.kind}`)} ${i.length-d.length+t+1}: ${e.title}`,"aria-pressed":e.key===f?.key,onClick:()=>o(e.key),className:`trajectory-point ${e.kind} ${e.outcome??``}`,children:(0,L.jsx)(`span`,{children:i.length-d.length+t+1})},e.key))}),(0,L.jsxs)(`div`,{className:`trajectory-body`,children:[(0,L.jsxs)(`div`,{className:`trajectory-ledger`,children:[u>0&&(0,L.jsx)(`button`,{type:`button`,className:`trajectory-load`,onClick:()=>c(e=>e+50),children:n(`trajectoryEarlier`,{count:u})}),(0,L.jsx)(`ol`,{start:i.length-d.length+1,children:d.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,"aria-pressed":e.key===f?.key,onClick:()=>o(e.key),className:`trajectory-record ${e.kind}`,children:[(0,L.jsx)(`span`,{className:`trajectory-kind`,children:n(`trajectory_${e.kind}`)}),(0,L.jsx)(`strong`,{children:e.title}),(0,L.jsx)(`span`,{className:`trajectory-preview`,children:(e.input??e.message?.content??e.result?.content??``).slice(0,110)}),e.outcome&&(0,L.jsx)(`span`,{children:n(`trajectory_${e.outcome}`)})]})},e.key))})]}),f&&(0,L.jsxs)(`section`,{className:`trajectory-inspector`,"aria-label":n(`trajectoryDetails`),children:[(0,L.jsx)(`h3`,{children:f.title}),f.timestamp&&(0,L.jsxs)(`p`,{className:`trajectory-metadata`,children:[n(`trajectoryRecordedAt`),`:`,` `,(0,L.jsx)(`time`,{children:f.timestamp})]}),f.callId&&(0,L.jsxs)(`p`,{className:`trajectory-metadata`,children:[`Tool call ID: `,f.callId]}),(h?.truncation||m?.truncation)&&(0,L.jsx)(`p`,{className:`trajectory-warning`,children:n(`trajectoryEvidenceTruncated`)}),f.input!==void 0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h4`,{children:n(`trajectoryArguments`)}),(0,L.jsx)(`pre`,{children:f.input})]}),h&&f.kind!==`call`&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h4`,{children:n(`trajectoryRecordedContent`)}),(0,L.jsx)(`pre`,{children:h.content||n(`noOutput`)}),h.parts?.some(e=>e.type===`thinking`)&&(0,L.jsxs)(`details`,{children:[(0,L.jsx)(`summary`,{children:n(`trajectoryThinking`)}),(0,L.jsx)(`pre`,{children:h.parts.filter(e=>e.type===`thinking`).map(e=>e.text).join(` `)})]},f.key)]}),(f.kind===`call`||f.kind===`result`)&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h4`,{children:n(`trajectoryOutput`)}),(0,L.jsx)(`p`,{children:n(`trajectory_${f.outcome??`unknown`}`)}),m?(0,L.jsx)(`pre`,{children:m.content||n(`noOutput`)}):(0,L.jsx)(`p`,{children:n(`trajectoryMissingResult`)}),m?.details!==void 0&&(0,L.jsxs)(`details`,{children:[(0,L.jsx)(`summary`,{children:n(`trajectoryStructured`)}),(0,L.jsx)(`pre`,{children:JSON.stringify(m.details,null,2)})]})]}),f.kind===`event`&&!h&&(0,L.jsx)(`p`,{children:n(`trajectoryEventOnly`)})]})]})]}):(0,L.jsx)(`p`,{children:n(`trajectoryEmpty`)})]})});function cu(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var lu=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,uu=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,du={};function fu(e,t){return((t||du).jsx?uu:lu).test(e)}var pu=/[ \t\n\f\r]/g;function mu(e){return typeof e==`object`?e.type===`text`&&hu(e.value):hu(e)}function hu(e){return e.replace(pu,``)===``}var gu=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};gu.prototype.normal={},gu.prototype.property={},gu.prototype.space=void 0;function _u(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new gu(n,r,t)}function vu(e){return e.toLowerCase()}var yu=class{constructor(e,t){this.attribute=t,this.property=e}};yu.prototype.attribute=``,yu.prototype.booleanish=!1,yu.prototype.boolean=!1,yu.prototype.commaOrSpaceSeparated=!1,yu.prototype.commaSeparated=!1,yu.prototype.defined=!1,yu.prototype.mustUseProperty=!1,yu.prototype.number=!1,yu.prototype.overloadedBoolean=!1,yu.prototype.property=``,yu.prototype.spaceSeparated=!1,yu.prototype.space=void 0;var bu=s({boolean:()=>G,booleanish:()=>Su,commaOrSpaceSeparated:()=>Tu,commaSeparated:()=>wu,number:()=>K,overloadedBoolean:()=>Cu,spaceSeparated:()=>q}),xu=0,G=Eu(),Su=Eu(),Cu=Eu(),K=Eu(),q=Eu(),wu=Eu(),Tu=Eu();function Eu(){return 2**++xu}var Du=Object.keys(bu),Ou=class extends yu{constructor(e,t,n,r){let i=-1;if(super(e,t),ku(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&Hu.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Vu,Gu);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Vu.test(e)){let n=e.replace(Bu,Wu);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Ou}return new i(r,t)}function Wu(e){return`-`+e.toLowerCase()}function Gu(e){return e.charAt(1).toUpperCase()}var Ku=_u([ju,Pu,Iu,Lu,Ru],`html`),qu=_u([ju,Fu,Iu,Lu,Ru],`svg`);function J(e){return e.join(` `).trim()}var Ju=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(` `);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),Yu=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(Ju());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Xu=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),Zu=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Yu()),r=Xu();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Qu=ed(`end`),$u=ed(`start`);function ed(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function td(e){let t=$u(e),n=Qu(e);if(t&&n)return{start:t,end:n}}function nd(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?id(e.position):`start`in e||`end`in e?id(e):`line`in e||`column`in e?rd(e):``}function rd(e){return ad(e&&e.line)+`:`+ad(e&&e.column)}function id(e){return rd(e&&e.start)+`-`+rd(e&&e.end)}function ad(e){return e&&typeof e==`number`?e:1}var od=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=nd(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};od.prototype.file=``,od.prototype.name=``,od.prototype.reason=``,od.prototype.message=``,od.prototype.stack=``,od.prototype.column=void 0,od.prototype.line=void 0,od.prototype.ancestors=void 0,od.prototype.cause=void 0,od.prototype.fatal=void 0,od.prototype.place=void 0,od.prototype.ruleId=void 0,od.prototype.source=void 0;var sd=l(Zu(),1),cd={}.hasOwnProperty,ld=new Map,ud=/[A-Z]/g,dd=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),fd=new Set([`td`,`th`]);function pd(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Cd(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Y(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?qu:Ku,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=md(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function md(e,t,n){if(t.type===`element`)return hd(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return gd(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return vd(e,t,n);if(t.type===`mdxjsEsm`)return _d(e,t);if(t.type===`root`)return yd(e,t,n);if(t.type===`text`)return bd(e,t)}function hd(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=qu,e.schema=i),e.ancestors.push(t);let a=kd(e,t.tagName,!1),o=wd(e,t),s=Ed(e,t);return dd.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!mu(e)})),xd(e,o,a,t),Sd(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function gd(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Ad(e,t.position)}function _d(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ad(e,t.position)}function vd(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=qu,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:kd(e,t.name,!0),o=Td(e,t),s=Ed(e,t);return xd(e,o,a,t),Sd(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function yd(e,t,n){let r={};return Sd(r,Ed(e,t)),e.create(t,e.Fragment,r,n)}function bd(e,t){return t.value}function xd(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Sd(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Y(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Cd(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=$u(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function wd(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&cd.call(t.properties,i)){let a=Dd(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&fd.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Td(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Ad(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Ad(e,t.position);else a=r.value===null||r.value;n[i]=a}return n}function Ed(e,t){let n=[],r=-1,i=e.passKeys?new Map:ld;for(;++ri?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a0?(Vd(e,e.length,0,t),e):t}var Ud={}.hasOwnProperty;function Wd(e){let t={},n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function Jd(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Yd=of(/[A-Za-z]/),Xd=of(/[\dA-Za-z]/),Zd=of(/[#-'*+\--9=?A-Z^-~]/);function Qd(e){return e!==null&&(e<32||e===127)}var $d=of(/\d/),ef=of(/[\dA-Fa-f]/),tf=of(/[!-/:-@[-`{-~]/);function Z(e){return e!==null&&e<-2}function nf(e){return e!==null&&(e<0||e===32)}function Q(e){return e===-2||e===-1||e===32}var rf=of(/\p{P}|\p{S}/u),af=of(/\s/);function of(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function sf(e){let t=[],n=-1,r=0,i=0;for(;++n55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function $(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Q(r)?(e.enter(n),s(r)):t(r)}function s(r){return Q(r)&&a++o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;er;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function pf(e,t,n){return $(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function mf(e){if(e===null||nf(e)||af(e))return 1;if(rf(e))return 2}function hf(e,t,n){let r=[],i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};yf(d,-c),yf(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Hd(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Hd(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Hd(l,hf(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Hd(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Hd(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Vd(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n0&&Q(t)?$(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Z(t)?e.check(Mf,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Z(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Q(t)?$(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Q(t)?$(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Z(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Ff(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var If={name:`codeIndented`,tokenize:Rf},Lf={partial:!0,tokenize:zf};function Rf(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),$(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Z(t)?e.attempt(Lf,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Z(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function zf(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Z(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):$(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Z(e)?i(e):n(e)}}var Bf={name:`codeText`,previous:Hf,resolve:Vf,tokenize:Uf};function Vf(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&Gf(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),Gf(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Gf(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function $f(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Qd(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Z(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||nf(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Z(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Z(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Q(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function tp(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Z(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),$(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Z(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function np(e,t){let n;return r;function r(i){return Z(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Q(i)?$(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var rp={name:`definition`,tokenize:ap},ip={partial:!0,tokenize:op};function ap(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return ep.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Jd(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return nf(t)?np(e,l)(t):l(t)}function l(t){return $f(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(ip,d,d)(t)}function d(t){return Q(t)?$(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Z(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function op(e,t,n){return r;function r(t){return nf(t)?np(e,i)(t):n(t)}function i(t){return tp(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Q(t)?$(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Z(e)?t(e):n(e)}}var sp={name:`hardBreakEscape`,tokenize:cp};function cp(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Z(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var lp={name:`headingAtx`,resolve:up,tokenize:dp};function up(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},Vd(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function dp(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||nf(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Z(n)?(e.exit(`atxHeading`),t(n)):Q(n)?$(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||nf(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var fp=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),pp=[`pre`,`script`,`style`,`textarea`],mp={concrete:!0,name:`htmlFlow`,resolveTo:_p,tokenize:vp},hp={partial:!0,tokenize:bp},gp={partial:!0,tokenize:yp};function _p(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function vp(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:N):Yd(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):Yd(a)?(e.consume(a),i=4,r.interrupt?t:N):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:N):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return Yd(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||nf(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&pp.includes(l)?(i=1,r.interrupt?t(s):O(s)):fp.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||Xd(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Q(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Yd(t)?(e.consume(t),b):Q(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Xd(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Q(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Q(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Z(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||nf(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Q(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Z(t)?O(t):Q(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),A):t===60&&i===1?(e.consume(t),j):t===62&&i===4?(e.consume(t),P):t===63&&i===3?(e.consume(t),N):t===93&&i===5?(e.consume(t),ne):Z(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(hp,re,ee)(t)):t===null||Z(t)?(e.exit(`htmlFlowData`),ee(t)):(e.consume(t),O)}function ee(t){return e.check(gp,te,re)(t)}function te(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),k}function k(t){return t===null||Z(t)?ee(t):(e.enter(`htmlFlowData`),O(t))}function A(t){return t===45?(e.consume(t),N):O(t)}function j(t){return t===47?(e.consume(t),o=``,M):O(t)}function M(t){if(t===62){let n=o.toLowerCase();return pp.includes(n)?(e.consume(t),P):O(t)}return Yd(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),M):O(t)}function ne(t){return t===93?(e.consume(t),N):O(t)}function N(t){return t===62?(e.consume(t),P):t===45&&i===2?(e.consume(t),N):O(t)}function P(t){return t===null||Z(t)?(e.exit(`htmlFlowData`),re(t)):(e.consume(t),P)}function re(n){return e.exit(`htmlFlow`),t(n)}}function yp(e,t,n){let r=this;return i;function i(t){return Z(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function bp(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Sf,t,n)}}var xp={name:`htmlText`,tokenize:Sp};function Sp(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):Yd(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):Yd(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Z(t)?(o=d,j(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?A(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Z(t)?(o=h,j(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?A(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?A(t):Z(t)?(o=v,j(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Z(t)?(o=y,j(t)):(e.consume(t),y)}function b(e){return e===62?A(e):y(e)}function x(t){return Yd(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Xd(t)?(e.consume(t),S):C(t)}function C(t){return Z(t)?(o=C,j(t)):Q(t)?(e.consume(t),C):A(t)}function w(t){return t===45||Xd(t)?(e.consume(t),w):t===47||t===62||nf(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),A):t===58||t===95||Yd(t)?(e.consume(t),E):Z(t)?(o=T,j(t)):Q(t)?(e.consume(t),T):A(t)}function E(t){return t===45||t===46||t===58||t===95||Xd(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Z(t)?(o=D,j(t)):Q(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,ee):Z(t)?(o=O,j(t)):Q(t)?(e.consume(t),O):(e.consume(t),te)}function ee(t){return t===i?(e.consume(t),i=void 0,k):t===null?n(t):Z(t)?(o=ee,j(t)):(e.consume(t),ee)}function te(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||nf(t)?T(t):(e.consume(t),te)}function k(e){return e===47||e===62||nf(e)?T(e):n(e)}function A(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function j(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),M}function M(t){return Q(t)?$(e,ne,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ne(t)}function ne(t){return e.enter(`htmlTextData`),o(t)}}var Cp={name:`labelEnd`,resolveAll:Dp,resolveTo:Op,tokenize:kp},wp={tokenize:Ap},Tp={tokenize:jp},Ep={tokenize:Mp};function Dp(e){let t=-1,n=[];for(;++t=3&&(a===null||Z(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Q(t)?$(e,s,`whitespace`)(t):s(t))}}var Vp={continuation:{tokenize:Gp},exit:qp,name:`list`,tokenize:Wp},Hp={partial:!0,tokenize:Jp},Up={partial:!0,tokenize:Kp};function Wp(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:$d(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(zp,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return $d(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Sf,r.interrupt?n:u,e.attempt(Hp,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Q(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Gp(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Sf,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,$(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Q(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Up,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,$(e,e.attempt(Vp,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Kp(e,t,n){let r=this;return $(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function qp(e){e.exit(this.containerState.type)}function Jp(e,t,n){let r=this;return $(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Q(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Yp={name:`setextUnderline`,resolveTo:Xp,tokenize:Zp};function Xp(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Zp(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Q(t)?$(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Z(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Qp={tokenize:$p};function $p(e){let t=this,n=e.attempt(Sf,r,e.attempt(this.parser.constructs.flowInitial,i,$(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Jf,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var em={resolveAll:im()},tm=rm(`string`),nm=rm(`text`);function rm(e){return{resolveAll:im(e===`text`?am:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++imm,contentInitial:()=>cm,disable:()=>hm,document:()=>sm,flow:()=>um,flowInitial:()=>lm,insideSpan:()=>pm,string:()=>dm,text:()=>fm}),sm={42:Vp,43:Vp,45:Vp,48:Vp,49:Vp,50:Vp,51:Vp,52:Vp,53:Vp,54:Vp,55:Vp,56:Vp,57:Vp,62:wf},cm={91:rp},lm={[-2]:If,[-1]:If,32:If},um={35:lp,42:zp,45:[Yp,zp],60:mp,61:Yp,95:zp,96:Nf,126:Nf},dm={38:Af,92:Of},fm={[-5]:Lp,[-4]:Lp,[-3]:Lp,33:Np,38:Af,42:gf,60:[bf,xp],91:Fp,92:[sp,Of],93:Cp,95:gf,96:Bf},pm={null:[gf,em]},mm={null:[42,95]},hm={null:[]};function gm(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Hd(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=hf(a,l.events,l),l.events):[]}function f(e,t){return vm(p(e),t)}function p(e){return _m(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function vm(e,t){let n=-1,r=[],i;for(;++n20?`${e.slice(0,20)}…`:e}"`,{type:`unknown-field`,field:e,value:t,line:n}))}}function T(){u!==void 0&&a?.(u),f>0&&i?.({id:u,event:p,data:d}),u=void 0,d=``,f=0,p=void 0}function E(e={}){if(e.consume&&s.length>0){let e=s.join(``);C(e,0,e.length)}l=!0,u=void 0,d=``,f=0,p=void 0,s.length=0,c=0,m=!1,h=!1,g=!1}return{feed:_,reset:E}}function Rb(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function zb(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}function Bb(e,t){let n=1;for(;nt.abort();e.signal.addEventListener(`abort`,n,{once:!0}),e.signal.aborted&&n();let r=window.setTimeout(n,45e3),i=await fetch(`/events?cursor=${e.cursor}`,{headers:e.client.headers(),signal:t.signal}).finally(()=>{window.clearTimeout(r),e.signal.removeEventListener(`abort`,n)});if(i.status===409)throw new Vb(`event replay expired`);if(!i.ok||!i.body)throw Error(`event connection failed`);e.onConnected();let a=e.cursor,o=0,s=Lb({onComment(t){t.trim()===`heartbeat`&&++o>=4&&(o=0,e.onHeartbeat?.())},onEvent(t){let n=JSON.parse(t.data);if(!Number.isSafeInteger(n.sequence))throw new Vb(`invalid event cursor`);if(!(n.sequence<=a)){if(n.sequence!==a+1)throw new Vb(`event cursor gap`);if(a=n.sequence,n.type===`state_invalidated`)throw new Vb(`state invalidated`);e.onEvent(n)}}}),c=i.body.getReader(),l=new TextDecoder;try{for(;!e.signal.aborted;){let t,n,r=c.read(),i=new Promise((r,i)=>{n=()=>i(Error(`event stream aborted`)),e.signal.addEventListener(`abort`,n,{once:!0}),e.signal.aborted&&n(),t=window.setTimeout(()=>i(Error(`event stream stalled`)),45e3)}),{done:a,value:o}=await Promise.race([r,i]).finally(()=>{window.clearTimeout(t),n&&e.signal.removeEventListener(`abort`,n)});if(a)throw Error(`event connection closed`);s.feed(l.decode(o,{stream:!0}))}}finally{await c.cancel().catch(()=>void 0)}}var Ub=`openpi.collapsed-workspaces`,Wb=`openpi.sidebar-collapsed`,Gb=new Set([`agent_start`,`turn_started`,`turn_settled`,`agent_settled`,`prompt_settled`,`message_end`,`tool_execution_end`,`session_start`,`session_switched`,`session_progress`,`prompt_failed`,`model_select`,`workspace_imported`,`workspace_removed`,`workspace_renamed`,`session_renamed`,`session_archived`,`session_unarchived`,`session_created`,`prompt_accepted`,`runtime_changed`]);function Kb(e){try{let t=JSON.parse(window.sessionStorage.getItem(e)||`[]`);return new Set(Array.isArray(t)?t.filter(e=>typeof e==`string`):[])}catch{return new Set}}function qb(e){try{return window.sessionStorage.getItem(e)===`true`}catch{return!1}}function Jb(e,t){try{window.sessionStorage.setItem(e,JSON.stringify(t))}catch{}}function Yb(e,t){return t.aborted?Promise.resolve():new Promise(n=>{let r=()=>{window.clearTimeout(i),t.removeEventListener(`abort`,r),n()},i=window.setTimeout(r,e);t.addEventListener(`abort`,r,{once:!0})})}function Xb(e=new Pc,t={}){let n=t.consumeEvents??Hb,r=0,i=0,a=0,o=null,s=null,c=null,l=Promise.resolve(),u=null,d=!1,f=!1,p=null,m=new Set,h=new Set,g=(e,t)=>{if(typeof t==`string`)for(e.add(t);e.size>32;){let t=e.values().next().value;t&&e.delete(t)}},_=()=>({activeTurn:null,turnCancellationPending:!1,turnTerminalStatus:null,pendingFollowUpsReceipt:null,liveMessages:[],liveRunning:!1,livePhase:`idle`,liveRetry:null,thinkingStarts:{},thinkingDurations:{}}),v=(e,t)=>({liveRunning:t===`running`||!e,livePhase:t===`running`?`running`:e?`idle`:`preparing`});return dn((t,y)=>{let b=e=>{t({notice:e instanceof Error?e.message:String(e)})},x=async(n,i,a)=>{if(y().modelSelectionPending)return!1;t({modelSelectionPending:!0});try{let o=await e.selectModel(n.provider,n.id,a);if(i!==r||a!==y().snapshot?.selectedSession?.id)return!1;if(o.provider!==n.provider||o.id!==n.id||!o.current)throw Error(`Model selection was not confirmed. Please select a model again.`);if(!await y().actions.refreshSnapshot({epoch:i})||i!==r||a!==y().snapshot?.selectedSession?.id)return!1;let s=y().snapshot?.models.find(e=>e.current);if(s?.provider!==n.provider||s.id!==n.id)throw Error(`The Session model changed. Please select a model again.`);return t({draftModel:null,notice:null}),!0}catch(e){return i===r&&a===y().snapshot?.selectedSession?.id&&b(e),!1}finally{i===r&&t({modelSelectionPending:!1})}},S=(e=160)=>{if(d){f=!0;return}u===null&&(u=window.setTimeout(async()=>{u=null,d=!0;try{await y().actions.refreshSnapshot()}finally{d=!1,f&&(f=!1,S())}},e))},C=e=>{let n=y(),i=e.detail??{},a=i.sessionId,l=[`session_start`,`session_switched`,`session_created`].includes(e.type);if(t({cursor:e.sequence}),n.sessionSwitching&&!l){S();return}if(typeof a==`string`&&a!==n.snapshot?.currentSessionId&&!l){S();return}if(l){let a=i.commandId;if(typeof a==`string`&&h.has(a)){S();return}let l=i.sessionPath,u=n.snapshot?.sessions.some(e=>e.path===l),d=!1;if(c?.kind===`select`?d=c.expectedPath===l:c?.kind===`create`&&c.commandId===a&&e.type===`session_switched`&&typeof l==`string`&&!u?(c.observedPath=l,d=!0):c?.kind===`create`&&c.commandId===a&&e.type===`session_created`&&typeof c.observedPath==`string`&&(d=!0),d&&c?.epoch!==r)return;if(d)t(_());else{let e=++r;o=null,s=null,t({..._(),promptAdmissionPending:!1,selectedPath:typeof l==`string`?l:null,draftModel:n.workspaceDraft?n.draftModel:null,modelSelectionPending:!1,sessionSwitching:!0}),y().actions.refreshSnapshot({epoch:e}).then(n=>{e===r&&t({selectedPath:n?y().selectedPath:null,sessionSwitching:!1})})}}else if(e.type===`prompt_accepted`){let e=m.has(String(i.commandId??``));t({...v(e,n.livePhase),liveRetry:null,pendingFollowUpsReceipt:Number.isInteger(i.pendingFollowUps)?Number(i.pendingFollowUps):n.pendingFollowUpsReceipt})}else if(e.type===`turn_started`)t({activeTurn:{sessionId:String(i.sessionId),commandId:String(i.commandId),epoch:Number(i.epoch)},liveRunning:!0,livePhase:`running`,liveRetry:null,turnTerminalStatus:null});else if(e.type===`agent_start`)t({...i.activeTurn?{activeTurn:i.activeTurn}:{},liveRunning:!0,livePhase:`running`,liveRetry:null});else if(e.type===`turn_settled`){g(m,i.commandId);let e=n.activeTurn;e?.sessionId===i.sessionId&&e?.commandId===i.commandId&&e?.epoch===i.epoch&&t({activeTurn:null,liveRunning:!1,livePhase:`idle`,liveRetry:null,turnTerminalStatus:typeof i.outcome==`string`?i.outcome:null})}else if(e.type===`agent_settled`)t({pendingFollowUpsReceipt:null,...n.activeTurn?{}:{liveRunning:!1,livePhase:`idle`,liveRetry:null}});else if(e.type===`prompt_settled`)g(m,i.commandId),n.livePhase!==`running`&&t({liveRunning:!1,livePhase:`idle`,liveRetry:null});else if(i.message&&typeof i.message==`object`){let r=i.message,a=n.liveMessages;r.role===`user`&&(a=a.filter(e=>!e.key.startsWith(`optimistic-`)||e.message.content!==r.content));let o=typeof i.messageKey==`string`?i.messageKey:`${r.role||`message`}-${e.sequence}`,s={key:o,message:r},c=a.findIndex(e=>e.key===o);a=c>=0?a.map((e,t)=>t===c?s:e):[...a,s].slice(-8);let l={...n.thinkingStarts},u={...n.thinkingDurations};r.parts?.some(e=>e.type===`thinking`)&&(l[o]??=Date.now(),e.type===`message_end`&&(u[o]=Date.now()-l[o])),t({liveMessages:a,thinkingDurations:u,thinkingStarts:l})}e.type===`prompt_failed`&&(g(m,i.commandId),t({liveMessages:y().liveMessages.filter(e=>!e.key.startsWith(`optimistic-`)),liveRunning:!1,livePhase:`idle`,liveRetry:null,notice:typeof i.error==`string`?i.error:`Prompt failed`})),e.type===`auto_retry_start`&&t({liveRunning:!0,livePhase:`running`,liveRetry:{attempt:Number(i.attempt)||0,maxAttempts:Number(i.maxAttempts)||0}}),Gb.has(e.type)&&S()},w=async r=>{let i=500;for(;!r.aborted;){let a=!1;try{if(y().cursor===null){if(a=!0,!await y().actions.refreshSnapshot({resetCursor:!0}))throw Error(`snapshot unavailable`);a=!1}if(r.aborted)return;await n({client:e,cursor:y().cursor??0,onConnected:()=>{i=500,t({connection:`connected`,notice:null})},onEvent:C,onHeartbeat:()=>S(0),signal:r})}catch(e){if(r.aborted)return;t({connection:`reconnecting`}),!a&&await y().actions.refreshSnapshot({resetCursor:!0})||t(_()),await Yb(i,r),i=Math.min(i*2,5e3),e instanceof SyntaxError&&t({notice:`Invalid event data`})}}},T={start(){p||(p=new AbortController,w(p.signal))},stop(){p?.abort(),p=null,u!==null&&window.clearTimeout(u),u=null},async refreshSnapshot(n={}){let a=n.epoch??r,o=++i,c=y().selectedPath;try{let l=await e.snapshot(c);if(a!==r||o!==i)return!1;let u=typeof l.currentSessionId==`string`,d=u?l.sessions.find(e=>e.id===l.currentSessionId):void 0,f=u?l.selectedSession?.id===l.currentSessionId:l.selectedSession===void 0,p=!c||l.sessions.some(e=>e.path===c),m=!c||l.selectedSession?.path===c;if(!p||!m||!f)return t({selectedPath:null}),!n.canonicalRetry&&T.refreshSnapshot({...n,canonicalRetry:!0,epoch:a});let h=l.selectedSession?.cwd,g=l.workspaces.find(e=>e.current)?.path,v=l.workspaces.some(e=>e.path===y().selectedWorkspace)?y().selectedWorkspace:void 0,b=y().workspaceDraft?y().selectedWorkspace:l.workspaces.some(e=>e.path===h)?h:g??v??null,x=n.resetCursor;return t({...x?_():{},connection:y().connection===`connecting`?`connecting`:y().connection,cursor:x||y().cursor===null?l.cursor:Math.max(y().cursor??0,l.cursor),activeTurn:l.runtime.activeTurn??null,livePhase:l.runtime.status!==`running`&&!y().promptAdmissionPending&&!s?`idle`:y().livePhase,liveRetry:l.runtime.status!==`running`&&!y().promptAdmissionPending&&!s?null:y().liveRetry,liveRunning:l.runtime.status===`running`?!0:!y().promptAdmissionPending&&!s?!1:y().liveRunning,selectedPath:d?.path??l.selectedSession?.path??null,selectedWorkspace:b,snapshot:l}),!0}catch(e){return a!==r||o!==i?!1:(t({connection:`unavailable`}),b(e),!1)}},async chooseWorkspace(){let t=r;try{let n=await e.chooseWorkspace();if(t!==r||n.cancelled||!n.path)return;T.setWorkspace(n.path),await T.refreshSnapshot()}catch(e){t===r&&b(e)}},setWorkspace(e){let n=y();e===n.selectedWorkspace&&!n.sessionSwitching||(++r,o=null,s=null,t({..._(),selectedWorkspace:e,workspaceDraft:!0,sessionSwitching:!1,modelSelectionPending:!1,promptAdmissionPending:!1,notice:null}))},async renameWorkspace(t,n){try{await e.renameWorkspace(t,n),await T.refreshSnapshot()}catch(e){throw b(e),e}},async removeWorkspace(n){try{await e.removeWorkspace(n),t({selectedPath:null,selectedWorkspace:y().selectedWorkspace===n?null:y().selectedWorkspace}),await T.refreshSnapshot()}catch(e){b(e)}},async createSession(n){if(!n||y().modelSelectionPending)return!1;let i=++r,a=globalThis.crypto?.randomUUID?.()??`web-create-${Date.now()}-${i}`;o=null,s=null,t({..._(),mobileSidebarOpen:!1,promptAdmissionPending:!1,selectedPath:null,selectedWorkspace:n,workspaceDraft:!0,sessionSwitching:!0});let u=!1,d=l.then(async()=>{if(i===r){c={commandId:a,epoch:i,expectedPath:null,kind:`create`,observedPath:null};try{let o=await e.createSession(n,a);if(i!==r)return;if(o.cancelled||!o.sessionPath)throw Error(`Session creation was not confirmed. Please try again.`);t({selectedPath:null});let s=await T.refreshSnapshot({epoch:i});if(!s&&i===r&&(s=await T.refreshSnapshot({epoch:i})),i!==r)return;if(!s)throw Error(`The created Session could not be confirmed. Please try again.`);let c=y().snapshot?.selectedSession;if(!c||c.path!==o.sessionPath||c.cwd!==n||c.id!==y().snapshot?.currentSessionId)throw Error(`The created Session is no longer active in the selected workspace. Please try again.`);t({workspaceDraft:!1,notice:null});let l=y().draftModel,d=c.id;u=!l||await x(l,i,d)}catch(e){if(i!==r)return;t({selectedPath:null}),b(e),await T.refreshSnapshot({epoch:i})}finally{g(h,a),c?.epoch===i&&(c=null),i===r&&t({sessionSwitching:!1})}}});return l=d.catch(()=>void 0),await d,u&&i===r},async selectSession(n){if(!n)return;t({workspaceDraft:!1,draftModel:null,modelSelectionPending:!1});let i=++r;o=null,s=null,t({..._(),mobileSidebarOpen:!1,promptAdmissionPending:!1,selectedPath:n,sessionSwitching:!0});let a=l.then(async()=>{if(i===r){c={epoch:i,expectedPath:n,kind:`select`};try{if(await e.selectSession(n),i!==r)return;await T.refreshSnapshot({epoch:i})||t({selectedPath:null})}catch(e){if(i!==r)return;t({selectedPath:null}),b(e),await T.refreshSnapshot({epoch:i})}finally{c?.epoch===i&&(c=null),i===r&&t({sessionSwitching:!1})}}});l=a.catch(()=>void 0),await a},async renameSession(t,n){try{await e.renameSession(t,n),await T.refreshSnapshot()}catch(e){throw b(e),e}},async archiveSession(t){try{await e.archiveSession(t),await T.refreshSnapshot()}catch(e){b(e)}},async unarchiveSession(t){let n=r;try{return await e.unarchiveSession(t),n!==r||await T.refreshSnapshot({epoch:n})}catch(e){return n===r&&b(e),!1}},async selectModel(e){let[n,...i]=e.split(`/`),a=i.join(`/`),o=y();if(!n||!a||o.sessionSwitching||o.modelSelectionPending||o.promptAdmissionPending||!o.workspaceDraft&&(o.liveRunning||o.snapshot?.runtime.status===`running`))return;let s=o.snapshot?.selectedSession?.id;if(o.workspaceDraft||!s&&!o.snapshot?.currentSessionId){let e=o.snapshot?.models.find(e=>e.provider===n&&e.id===a);e&&t({draftModel:e,notice:null});return}!s||s!==o.snapshot?.currentSessionId||await x({provider:n,id:a},r,s)},async cancelActiveTurn(){let n=y().activeTurn??y().snapshot?.runtime.activeTurn;if(!n||y().turnCancellationPending||y().sessionSwitching)return;let i=r;t({turnCancellationPending:!0});try{await e.cancelActiveTurn(n)}catch(e){if(i!==r)return;await T.refreshSnapshot({epoch:i}),i===r&&b(e)}finally{i===r&&t({turnCancellationPending:!1})}},async sendPrompt(n){let i=n.trim(),c=y().selectedWorkspace;if(!c||!i||y().sessionSwitching||y().promptAdmissionPending||y().modelSelectionPending)return!1;let l=y().workspaceDraft||!y().snapshot?.selectedSession?.id;if(l&&!await T.createSession(c)||l&&y().draftModel)return!1;let u=y().snapshot?.selectedSession?.id;if(!u||y().workspaceDraft||y().selectedWorkspace!==c||y().snapshot?.selectedSession?.cwd!==c||u!==y().snapshot?.currentSessionId||y().sessionSwitching||y().promptAdmissionPending)return!1;let d=r,f=y().draftModel;if(f&&!await x(f,d,u)||d!==r||u!==y().snapshot?.selectedSession?.id||u!==y().snapshot?.currentSessionId||y().workspaceDraft||y().selectedWorkspace!==c||y().snapshot?.selectedSession?.cwd!==c)return!1;let p=++a,h=s?.sessionId===u&&s.content===i,g=h?s.commandId:globalThis.crypto?.randomUUID?.()??`web-prompt-${Date.now()}-${p}`,_=h?s.optimisticKey:`optimistic-${g}`;s={sessionId:u,content:i,commandId:g,optimisticKey:_},o=p,t({liveMessages:h?y().liveMessages:[...y().liveMessages,{key:_,message:{role:`user`,content:i}}].slice(-8),notice:null,pendingFollowUpsReceipt:null,turnTerminalStatus:null,promptAdmissionPending:!0,scrollToBottom:y().scrollToBottom+1});try{let n=await e.prompt(u,i,g,h);if(d!==r||o!==p)return!1;let a=m.has(n.id);return s?.commandId===g&&(s=null),t({...v(a,y().livePhase),pendingFollowUpsReceipt:n.pendingFollowUps??null}),S(120),!0}catch(e){return d!==r||o!==p?!1:e instanceof Mc&&[`WORKSPACE_REQUIRED`,`SESSION_CONFLICT`,`PROMPT_REJECTED`,`COMMAND_CONFLICT`,`PROMPT_ADMISSION_CAPACITY`].includes(e.code??``)?(s?.commandId===g&&(s=null),t({liveMessages:y().liveMessages.filter(e=>e.key!==_),livePhase:`idle`,liveRetry:null,liveRunning:!1}),b(e),!1):(t({liveRunning:!0,livePhase:y().livePhase===`running`?`running`:`preparing`,liveRetry:null}),b(e),!1)}finally{d===r&&o===p&&(o=null,t({promptAdmissionPending:!1}))}},setQuery(e){t({query:e})},setSearchOpen(e){t({searchOpen:e,...e?{}:{query:``}})},toggleWorkspace(e){let n=new Set(y().collapsed);n.has(e)?n.delete(e):n.add(e),Jb(Ub,[...n]),t({collapsed:n})},toggleSidebar(e){if(e){t({mobileSidebarOpen:!y().mobileSidebarOpen});return}let n=!y().sidebarCollapsed;try{window.sessionStorage.setItem(Wb,String(n))}catch{}t({sidebarCollapsed:n})},closeMobileSidebar(){t({mobileSidebarOpen:!1})},clearNotice(){t({notice:null})}};return{activeTurn:null,turnCancellationPending:!1,turnTerminalStatus:null,pendingFollowUpsReceipt:null,snapshot:null,cursor:null,selectedPath:null,selectedWorkspace:null,workspaceDraft:!1,draftModel:null,modelSelectionPending:!1,collapsed:Kb(Ub),sidebarCollapsed:qb(Wb),mobileSidebarOpen:!1,query:``,searchOpen:!1,connection:`connecting`,notice:null,liveMessages:[],liveRunning:!1,livePhase:`idle`,liveRetry:null,thinkingStarts:{},thinkingDurations:{},promptAdmissionPending:!1,sessionSwitching:!1,scrollToBottom:0,actions:T}})}var Zb=Xb();function Qb(){let e=pn(Zb),{t}=cn(),{actions:n}=e,[r,i]=(0,w.useState)(`chat`),[a,o]=(0,w.useState)(null),s=e.snapshot?.models.find(e=>e.current),c=JSON.stringify([s?.provider,s?.id]),l=t=>{let n=e.snapshot,r=n?.selectedSession;e.workspaceDraft||!n||!r||e.sessionSwitching||r.id!==n.currentSessionId||o({sessionId:r.id,sessionPath:r.path,cwd:r.cwd,model:s?.label??``,modelKey:c,terminalId:t})},u=a&&!e.workspaceDraft&&!e.sessionSwitching&&a.sessionId===e.snapshot?.currentSessionId&&a.sessionPath===e.snapshot?.selectedSession?.path&&a.modelKey===c;(0,w.useEffect)(()=>{a&&!u&&o(null)},[a,u]),(0,w.useEffect)(()=>(n.start(),n.stop),[n]);let d=e.workspaceDraft?void 0:e.snapshot?.selectedSession,f=d?.entries.some(e=>e.type===`message`&&e.message)||e.liveMessages.length>0,p=!d||!f,m=(0,w.useCallback)(e=>n.sendPrompt(e),[n]);return(0,L.jsxs)(`div`,{className:`app-shell ${e.sidebarCollapsed?`sidebar-collapsed`:``} ${e.mobileSidebarOpen?`sidebar-open`:``}`,children:[(0,L.jsx)(iu,{snapshot:e.snapshot,selectedPath:e.workspaceDraft?null:e.selectedPath,selectedWorkspace:e.selectedWorkspace,collapsed:e.collapsed,query:e.query,searchOpen:e.searchOpen,mobileOpen:e.mobileSidebarOpen,actions:n}),e.sidebarCollapsed&&(0,L.jsx)(`button`,{className:`sidebar-expand`,type:`button`,"aria-label":t(`expandSidebar`),title:t(`expandSidebar`),onClick:()=>n.toggleSidebar(!1),children:(0,L.jsx)(Te,{})}),(0,L.jsxs)(`main`,{className:`conversation-shell ${d?`has-view`:``} ${p&&(e.workspaceDraft||r===`chat`)?`landing`:``}`,children:[(0,L.jsx)(`h1`,{className:`sr-only`,children:`OpenPI`}),(0,L.jsxs)(`header`,{className:`mobile-header`,children:[(0,L.jsx)(`button`,{type:`button`,"aria-label":t(`openSidebar`),onClick:()=>n.toggleSidebar(!0),children:(0,L.jsx)(Ce,{})}),(0,L.jsx)(`span`,{className:`connection-state ${e.connection}`,children:t(e.connection)})]}),d&&(0,L.jsxs)(`fieldset`,{className:`conversation-view-switch`,"aria-label":t(`conversationView`),children:[(0,L.jsx)(`button`,{type:`button`,"aria-pressed":r===`chat`,onClick:()=>i(`chat`),children:t(`chatView`)}),(0,L.jsx)(`button`,{type:`button`,"aria-pressed":r===`trajectory`,onClick:()=>i(`trajectory`),children:t(`trajectory`)})]}),e.sessionSwitching?(0,L.jsx)(`div`,{className:`conversation switching`,role:`status`,children:(0,L.jsxs)(`div`,{className:`conversation-running`,children:[(0,L.jsx)(`span`,{className:`conversation-running-dot`}),(0,L.jsx)(`span`,{children:t(`switchingSession`)})]})}):r===`trajectory`&&d&&e.snapshot?(0,L.jsx)(su,{snapshot:e.snapshot,running:e.liveRunning},d.path):p?(0,L.jsx)(`section`,{className:`conversation landing-conversation`,"aria-label":`Conversation`,children:(0,L.jsx)(`div`,{className:`landing-welcome`,children:(0,L.jsx)(gn,{animated:!0})})}):e.snapshot?(0,L.jsx)(jb,{snapshot:e.snapshot,liveMessages:e.liveMessages,liveRunning:e.liveRunning,livePhase:e.livePhase,liveRetry:e.liveRetry,thinkingStarts:e.thinkingStarts,thinkingDurations:e.thinkingDurations,scrollToBottom:e.scrollToBottom,onResend:m}):null,(0,L.jsx)(nu,{workspaceDraft:e.workspaceDraft,draftModel:e.draftModel,modelSelectionPending:e.modelSelectionPending,onInspect:l,activeTurn:e.activeTurn,turnCancellationPending:e.turnCancellationPending,turnTerminalStatus:e.turnTerminalStatus,pendingFollowUpsReceipt:e.pendingFollowUpsReceipt,snapshot:e.snapshot,selectedWorkspace:e.selectedWorkspace,sessionSwitching:e.sessionSwitching,promptAdmissionPending:e.promptAdmissionPending,liveRunning:e.liveRunning,landing:p,actions:n}),e.notice&&(0,L.jsxs)(`div`,{className:`notice`,role:`alert`,children:[(0,L.jsx)(`span`,{children:e.notice}),(0,L.jsx)(`button`,{type:`button`,"aria-label":t(`close`),onClick:n.clearNotice,children:(0,L.jsx)(ze,{})})]})]}),u&&(0,L.jsx)(Fc,{target:a,onClose:()=>o(null)},`${a.sessionId}:${a.sessionPath}:${a.terminalId??`status`}`),(0,L.jsx)(`button`,{className:`sidebar-scrim`,type:`button`,"aria-label":t(`close`),onClick:n.closeMobileSidebar})]})}var $b={base:{k1xSpc:`xjp7ctv`,kMwMTN:`x1tgivj0`,kMv6JI:`x9ynric`,$$css:!0},light:{kQNsl9:`x19aimcq`,$$css:!0},dark:{kQNsl9:`xntwwlm`,$$css:!0},system:{kQNsl9:`x108lcm5`,$$css:!0}},ex=w.createContext(!1);ex.displayName=`ThemeNestingContext`;var tx=new Set,nx=0;function rx(e){let t=(0,w.useId)();(0,w.useInsertionEffect)(()=>{if(e.__built)return;let n=`astryx-theme-${e.name}`;if(tx.has(n))return;`${e.name}`,`${e.name}${e.name}${e.name}${e.name}`;let{prose:r,component:i}=ic(e),a=rc();tx.add(n);let o=[()=>tx.delete(n)];if(a){if(nx++===0){let e=document.createElement(`style`);e.setAttribute(Ir(`theme-base`),``),e.textContent=`@layer astryx-base {\n${a}\n}`,document.head.appendChild(e)}o.push(()=>{--nx===0&&document.querySelector(`style[${Ir(`theme-base`)}]`)?.remove()})}if(r){let n=document.createElement(`style`);n.setAttribute(Ir(`theme-prose`),e.name),n.setAttribute(Ir(`id`),t),n.textContent=`@layer reset {\n${r}\n}`,document.head.appendChild(n)}if(i){let n=document.createElement(`style`);n.setAttribute(Ir(`theme`),e.name),n.setAttribute(Ir(`id`),t),n.textContent=`@layer astryx-theme {\n${i}\n}`,document.head.appendChild(n)}return(r||i)&&o.push(()=>{let n=document.querySelector(`style[${Ir(`theme-prose`)}="${e.name}"][${Ir(`id`)}="${t}"]`),r=document.querySelector(`style[${Ir(`theme`)}="${e.name}"][${Ir(`id`)}="${t}"]`);n?.remove(),r?.remove()}),()=>{for(let e of o)e()}},[e,t])}function ix(e,t,n){xl(()=>{if(!e&&!(typeof document>`u`))return t===`light`||t===`dark`?document.documentElement.setAttribute(`data-theme`,t):document.documentElement.removeAttribute(`data-theme`),document.documentElement.setAttribute(Ir(`theme`),n),()=>{document.documentElement.removeAttribute(`data-theme`),document.documentElement.removeAttribute(Ir(`theme`))}},[e,t,n])}function ax({theme:e,mode:t=`system`,children:n}){let r=(0,w.use)(ex);js(e),rx(e),ix(r,t,e.name);let i=t===`dark`?$b.dark:t===`light`?$b.light:$b.system,a=(0,w.useMemo)(()=>({theme:e,mode:t}),[e,t]);return(0,L.jsx)(oc,{value:a,children:(0,L.jsx)(ex,{value:!0,children:(0,L.jsx)(`div`,{...xn($b.base,i),"data-astryx-theme":e.name,"data-theme":t===`system`?void 0:t,children:n})})})}ax.displayName=`Theme`;var ox={size:`1em`,"aria-hidden":!0},sx={name:`neutral`,__built:!0,tokens:{"--font-size-4xs":`0.375rem`,"--font-size-3xs":`0.4375rem`,"--font-size-2xs":`0.5rem`,"--font-size-xs":`0.625rem`,"--font-size-sm":`0.75rem`,"--font-size-base":`0.875rem`,"--font-size-lg":`1.0625rem`,"--font-size-xl":`1.25rem`,"--font-size-2xl":`1.5rem`,"--font-size-3xl":`1.8125rem`,"--font-size-4xl":`2.1875rem`,"--font-size-5xl":`2.625rem`,"--text-heading-1-size":`var(--font-size-2xl)`,"--text-heading-1-weight":`var(--font-weight-semibold)`,"--text-heading-1-leading":`1.3333`,"--text-heading-2-size":`var(--font-size-xl)`,"--text-heading-2-weight":`var(--font-weight-semibold)`,"--text-heading-2-leading":`1.4`,"--text-heading-3-size":`var(--font-size-lg)`,"--text-heading-3-weight":`var(--font-weight-bold)`,"--text-heading-3-leading":`1.4118`,"--text-heading-4-size":`var(--font-size-base)`,"--text-heading-4-weight":`var(--font-weight-bold)`,"--text-heading-4-leading":`1.4286`,"--text-heading-5-size":`var(--font-size-sm)`,"--text-heading-5-weight":`var(--font-weight-semibold)`,"--text-heading-5-leading":`1.6667`,"--text-heading-6-size":`var(--font-size-xs)`,"--text-heading-6-weight":`var(--font-weight-semibold)`,"--text-heading-6-leading":`1.6`,"--text-body-size":`var(--font-size-base)`,"--text-body-weight":`var(--font-weight-normal)`,"--text-body-leading":`1.4286`,"--text-large-size":`var(--font-size-lg)`,"--text-large-weight":`var(--font-weight-semibold)`,"--text-large-leading":`1.4118`,"--text-label-size":`var(--font-size-base)`,"--text-label-weight":`var(--font-weight-medium)`,"--text-label-leading":`1.4286`,"--text-code-size":`var(--font-size-base)`,"--text-code-weight":`var(--font-weight-normal)`,"--text-code-leading":`1.4286`,"--text-supporting-size":`var(--font-size-sm)`,"--text-supporting-weight":`var(--font-weight-normal)`,"--text-supporting-leading":`1.6667`,"--text-display-1-size":`var(--font-size-5xl)`,"--text-display-1-weight":`var(--font-weight-normal)`,"--text-display-1-leading":`1.2381`,"--text-display-2-size":`var(--font-size-4xl)`,"--text-display-2-weight":`var(--font-weight-normal)`,"--text-display-2-leading":`1.2571`,"--text-display-3-size":`var(--font-size-3xl)`,"--text-display-3-weight":`var(--font-weight-normal)`,"--text-display-3-leading":`1.3793`,"--duration-fast-min":`95ms`,"--duration-fast":`125ms`,"--duration-fast-max":`165ms`,"--duration-medium-min":`225ms`,"--duration-medium":`300ms`,"--duration-medium-max":`400ms`,"--duration-slow-min":`525ms`,"--duration-slow":`700ms`,"--duration-slow-max":`935ms`,"--font-family-body":`Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`,"--font-family-heading":`Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`,"--font-family-code":`ui-monospace, "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace`,"--color-syntax-keyword":`light-dark(#700084, #efa8ff)`,"--color-syntax-string":`light-dark(#005600, #a6d2a2)`,"--color-syntax-comment":`light-dark(#737373, #a3a3a3)`,"--color-syntax-number":`light-dark(#6e3500, #ffb37f)`,"--color-syntax-function":`light-dark(#00458c, #a0caff)`,"--color-syntax-type":`light-dark(#700084, #efa8ff)`,"--color-syntax-variable":`light-dark(#171717, #e5e5e5)`,"--color-syntax-operator":`light-dark(#737373, #a3a3a3)`,"--color-syntax-constant":`light-dark(#6e3500, #ffb37f)`,"--color-syntax-tag":`light-dark(#89001a, #ffaeaa)`,"--color-syntax-attribute":`light-dark(#584400, #eec12f)`,"--color-syntax-property":`light-dark(#005348, #83dac9)`,"--color-syntax-punctuation":`light-dark(#6e6e6e, #a0a0a0)`,"--color-syntax-background":`light-dark(#fafafa, #0a0a0a)`,"--color-background-surface":`light-dark(#ffffff, #262626)`,"--color-background-body":`light-dark(#f1f1f1, #1b1b1b)`,"--color-background-card":`light-dark(#ffffff, #1b1b1b)`,"--color-background-popover":`light-dark(#ffffff, #1b1b1b)`,"--color-background-muted":`light-dark(#f1f1f1, #1b1b1b)`,"--color-accent":`light-dark(#262626, #ebebeb)`,"--color-accent-muted":`light-dark(#f1f1f1, #262626)`,"--color-neutral":`light-dark(#0000000F, #FFFFFF1A)`,"--color-overlay":`light-dark(#00000080, #000000CC)`,"--color-overlay-hover":`light-dark(#0000000D, #FFFFFF0D)`,"--color-overlay-pressed":`light-dark(#0000001A, #FFFFFF1A)`,"--color-text-primary":`light-dark(#171717, #fafafa)`,"--color-text-secondary":`light-dark(#525252, #a3a3a3)`,"--color-text-disabled":`light-dark(#a3a3a3, #525252)`,"--color-text-accent":`light-dark(#262626, #ebebeb)`,"--color-on-dark":`#ffffff`,"--color-on-light":`#171717`,"--color-on-accent":`light-dark(#ffffff, #171717)`,"--color-on-success":`light-dark(#ffffff, #171717)`,"--color-on-error":`light-dark(#ffffff, #171717)`,"--color-on-warning":`#171717`,"--color-icon-accent":`light-dark(#262626, #ebebeb)`,"--color-icon-primary":`light-dark(#171717, #fafafa)`,"--color-icon-secondary":`light-dark(#737373, #a3a3a3)`,"--color-icon-disabled":`light-dark(#a3a3a3, #525252)`,"--color-success":`light-dark(#007004, #9fe59b)`,"--color-error":`light-dark(#a50c25, #ffc6c1)`,"--color-warning":`light-dark(#745b00, #fdcf4f)`,"--color-success-muted":`light-dark(#c5e5c0, #84c9803D)`,"--color-error-muted":`light-dark(#facecb, #ff9e973D)`,"--color-warning-muted":`light-dark(#f8da9d, #deb4333D)`,"--color-border":`light-dark(#00000014, #FFFFFF1A)`,"--color-border-emphasized":`light-dark(#d4d4d4, #525252)`,"--color-skeleton":`light-dark(#ebebeb, #525252)`,"--color-shadow":`light-dark(#0000001A, #0000004D)`,"--color-tint-hover":`light-dark(black, white)`,"--color-background-red":`light-dark(#facecb, #ff9e973D)`,"--color-border-red":`light-dark(#e6bab8, #ff6f6c)`,"--color-icon-red":`light-dark(#89001a, #ff9e97)`,"--color-text-red":`light-dark(#89001a, #ffc6c1)`,"--color-background-orange":`light-dark(#fad0b5, #ffa2583D)`,"--color-border-orange":`light-dark(#e6bda2, #e2883e)`,"--color-icon-orange":`light-dark(#6e3500, #ffa258)`,"--color-text-orange":`light-dark(#6e3500, #ffc9a2)`,"--color-background-yellow":`light-dark(#f8da9d, #deb4333D)`,"--color-border-yellow":`light-dark(#e4c279, #c0990e)`,"--color-icon-yellow":`light-dark(#584400, #deb433)`,"--color-text-yellow":`light-dark(#584400, #fdcf4f)`,"--color-background-green":`light-dark(#c5e5c0, #84c9803D)`,"--color-border-green":`light-dark(#b2d1ac, #69ad67)`,"--color-icon-green":`light-dark(#0c5700, #84c980)`,"--color-text-green":`light-dark(#0c5700, #9fe59b)`,"--color-background-teal":`light-dark(#a5e3d6, #7ec6b83D)`,"--color-border-teal":`light-dark(#94d6c8, #63ab9d)`,"--color-icon-teal":`light-dark(#005348, #7ec6b8)`,"--color-text-teal":`light-dark(#005348, #99e2d3)`,"--color-background-cyan":`light-dark(#a3e0ef, #83c2d43D)`,"--color-border-cyan":`light-dark(#91d3e3, #67a7b8)`,"--color-icon-cyan":`light-dark(#00505f, #83c2d4)`,"--color-text-cyan":`light-dark(#00505f, #9edef0)`,"--color-background-blue":`light-dark(#c4ddfb, #9eb7ff3D)`,"--color-border-blue":`light-dark(#b1c9e7, #6d9cfe)`,"--color-icon-blue":`light-dark(#00458c, #9eb7ff)`,"--color-text-blue":`light-dark(#00458c, #c7d3ff)`,"--color-background-purple":`light-dark(#eccef3, #f297ff3D)`,"--color-border-purple":`light-dark(#d8bbdf, #dd74f0)`,"--color-icon-purple":`light-dark(#700084, #f297ff)`,"--color-text-purple":`light-dark(#700084, #fac1ff)`,"--color-background-pink":`light-dark(#fccadc, #ff99c33D)`,"--color-border-pink":`light-dark(#e7b7c8, #f273aa)`,"--color-icon-pink":`light-dark(#83004b, #ff99c3)`,"--color-text-pink":`light-dark(#83004b, #ffc3da)`,"--color-background-gray":`light-dark(#e5e5e5, var(--color-neutral))`,"--color-border-gray":`light-dark(#d4d4d4, #262626)`,"--color-icon-gray":`light-dark(#525252, #a3a3a3)`,"--color-text-gray":`light-dark(#262626, #e5e5e5)`,"--radius-none":`0px`,"--radius-inner":`0.375rem`,"--radius-element":`0.625rem`,"--radius-container":`0.75rem`,"--radius-page":`1.75rem`,"--radius-full":`9999px`,"--shadow-low":`0 2px 4px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 25%)), 0 4px 8px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 40%)), inset 0 0 0 1px light-dark(transparent, oklch(1 0 0 / 8%))`,"--shadow-med":`0 2px 4px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 35%)), 0 4px 12px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 50%)), inset 0 0 0 1px light-dark(transparent, oklch(1 0 0 / 12%))`,"--shadow-high":`0 4px 6px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 50%)), 0 12px 24px light-dark(oklch(0 0 0 / 15%), oklch(0 0 0 / 70%)), inset 0 0 0 1px light-dark(transparent, oklch(1 0 0 / 15%))`,"--shadow-inset-hover":`inset 0px 0px 0px 2px #0074e24D`,"--shadow-inset-selected":`inset 0px 0px 0px 2px #0074e280`,"--shadow-inset-success":`inset 0px 0px 0px 2px #1981004D`,"--shadow-inset-warning":`inset 0px 0px 0px 2px #ffce2f4D`,"--shadow-inset-error":`inset 0px 0px 0px 2px #e33f4a4D`},components:{heading:{"level:1":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-1-size)`,fontWeight:`var(--text-heading-1-weight)`,lineHeight:`var(--text-heading-1-leading)`},"level:2":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-2-size)`,fontWeight:`var(--text-heading-2-weight)`,lineHeight:`var(--text-heading-2-leading)`},"level:3":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-3-size)`,fontWeight:`var(--text-heading-3-weight)`,lineHeight:`var(--text-heading-3-leading)`},"level:4":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-4-size)`,fontWeight:`var(--text-heading-4-weight)`,lineHeight:`var(--text-heading-4-leading)`},"level:5":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-5-size)`,fontWeight:`var(--text-heading-5-weight)`,lineHeight:`var(--text-heading-5-leading)`},"level:6":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-6-size)`,fontWeight:`var(--text-heading-6-weight)`,lineHeight:`var(--text-heading-6-leading)`},"type:display-1":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-1-size)`,lineHeight:`var(--text-display-1-leading)`},"type:display-2":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-2-size)`,lineHeight:`var(--text-display-2-leading)`},"type:display-3":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-3-size)`,lineHeight:`var(--text-display-3-leading)`}},text:{"type:body":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-body-size)`,lineHeight:`var(--text-body-leading)`},"type:large":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-large-size)`,lineHeight:`var(--text-large-leading)`},"type:label":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-label-size)`,lineHeight:`var(--text-label-leading)`},"type:code":{fontFamily:`var(--font-family-code)`,fontSize:`var(--text-code-size)`,lineHeight:`var(--text-code-leading)`},"type:supporting":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-supporting-size)`,lineHeight:`var(--text-supporting-leading)`},"type:display-1":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-1-size)`,lineHeight:`var(--text-display-1-leading)`},"type:display-2":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-2-size)`,lineHeight:`var(--text-display-2-leading)`},"type:display-3":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-3-size)`,lineHeight:`var(--text-display-3-leading)`}},button:{"variant:destructive":{backgroundColor:`var(--color-error-muted)`,color:`var(--color-error)`}},badge:{"variant:info":{backgroundColor:`light-dark(#0074e2, #6d9cfe)`,color:`light-dark(#ffffff, #171717)`},"variant:neutral":{backgroundColor:`var(--color-background-gray)`,color:`var(--color-text-gray)`},"variant:success":{backgroundColor:`light-dark(#198100, #64af4c)`,color:`light-dark(#ffffff, #171717)`},"variant:warning":{backgroundColor:`#ffce2f`,color:`#171717`},"variant:error":{backgroundColor:`light-dark(#c9303a, #ff705d)`,color:`light-dark(#ffffff, #171717)`},"variant:red":{backgroundColor:`var(--color-background-red)`,color:`var(--color-text-red)`},"variant:orange":{backgroundColor:`var(--color-background-orange)`,color:`var(--color-text-orange)`},"variant:yellow":{backgroundColor:`var(--color-background-yellow)`,color:`var(--color-text-yellow)`},"variant:green":{backgroundColor:`var(--color-background-green)`,color:`var(--color-text-green)`},"variant:teal":{backgroundColor:`var(--color-background-teal)`,color:`var(--color-text-teal)`},"variant:cyan":{backgroundColor:`var(--color-background-cyan)`,color:`var(--color-text-cyan)`},"variant:blue":{backgroundColor:`var(--color-background-blue)`,color:`var(--color-text-blue)`},"variant:purple":{backgroundColor:`var(--color-background-purple)`,color:`var(--color-text-purple)`},"variant:pink":{backgroundColor:`var(--color-background-pink)`,color:`var(--color-text-pink)`},"variant:gray":{backgroundColor:`var(--color-background-gray)`,color:`var(--color-text-gray)`}},statusdot:{"variant:success":{backgroundColor:`light-dark(#198100, #64af4c)`},"variant:warning":{backgroundColor:`#ffce2f`},"variant:error":{backgroundColor:`light-dark(#c9303a, #ff705d)`},"variant:accent":{backgroundColor:`light-dark(#0074e2, #6d9cfe)`}},banner:{"status:info":{"--color-accent-muted":`var(--color-background-blue)`,"--color-text-primary":`var(--color-text-blue)`,"--color-text-secondary":`var(--color-text-blue)`,"--color-accent":`var(--color-text-blue)`},"status:success":{"--color-text-primary":`var(--color-text-green)`,"--color-text-secondary":`var(--color-text-green)`,"--color-success":`var(--color-text-green)`},"status:warning":{"--color-text-primary":`var(--color-text-yellow)`,"--color-text-secondary":`var(--color-text-yellow)`,"--color-warning":`var(--color-text-yellow)`},"status:error":{"--color-text-primary":`var(--color-text-red)`,"--color-text-secondary":`var(--color-text-red)`,"--color-error":`var(--color-text-red)`}},switch:{base:{"--color-background-gray":`var(--color-border-emphasized)`}},progressbar:{base:{"--color-background-muted":`var(--color-border-emphasized)`},"variant:accent":{"--color-accent":`#0074e2`},"variant:success":{"--color-success":`#198100`},"variant:warning":{"--color-warning":`#ffce2f`},"variant:error":{"--color-error":`#c9303a`}},card:{base:{padding:`var(--spacing-3)`}},section:{base:{padding:`var(--spacing-3)`}}},__onDark:{tokens:{"color-scheme":`dark`,"--color-text-primary":`var(--color-on-dark)`,"--color-icon-primary":`var(--color-on-dark)`,"--color-accent":`var(--color-on-dark)`}},__onLight:{tokens:{"color-scheme":`light`,"--color-text-primary":`var(--color-on-light)`,"--color-icon-primary":`var(--color-on-light)`,"--color-accent":`var(--color-on-light)`}},icons:{close:(0,L.jsx)(ze,{...ox}),chevronDown:(0,L.jsx)(re,{...ox}),chevronLeft:(0,L.jsx)(ie,{...ox}),chevronRight:(0,L.jsx)(ae,{...ox}),chevronsLeft:(0,L.jsx)(oe,{...ox}),chevronsRight:(0,L.jsx)(se,{...ox}),check:(0,L.jsx)(P,{...ox}),success:(0,L.jsx)(F,{...ox}),error:(0,L.jsx)(ce,{...ox}),warning:(0,L.jsx)(Ie,{...ox}),info:(0,L.jsx)(xe,{...ox}),calendar:(0,L.jsx)(ne,{...ox}),clock:(0,L.jsx)(ue,{...ox}),externalLink:(0,L.jsx)(me,{...ox}),menu:(0,L.jsx)(Ce,{...ox}),moreHorizontal:(0,L.jsx)(pe,{...ox}),search:(0,L.jsx)(ke,{...ox}),arrowUp:(0,L.jsx)(j,{...ox}),arrowDown:(0,L.jsx)(k,{...ox}),arrowsUpDown:(0,L.jsx)(A,{...ox}),funnel:(0,L.jsx)(ye,{...ox}),eyeSlash:(0,L.jsx)(he,{...ox}),viewColumns:(0,L.jsx)(de,{...ox}),copy:(0,L.jsx)(fe,{...ox}),checkDouble:(0,L.jsx)(N,{...ox}),wrench:(0,L.jsx)(Re,{...ox}),stop:(0,L.jsx)(Ne,{...ox}),microphone:(0,L.jsx)(we,{...ox})}},cx={en:{translation:{conversationView:`Conversation view`,chatView:`Chat`,trajectory:`Trajectory`,trajectoryScope:`Recorded Session messages in order, not execution durations or the complete model request.`,trajectoryRunning:`Work is active. This view updates as saved records arrive; in-flight text is available in Chat.`,trajectoryTruncated:`Loaded history is partial: {{entries}} entries omitted, {{parts}} parts omitted, {{messages}} messages truncated.`,trajectoryEmpty:`No saved records yet.`,trajectoryOverview:`Record sequence overview`,trajectoryEarlier:`Show earlier records ({{count}} remaining in loaded history)`,trajectoryDetails:`Record details`,trajectoryRecordedAt:`Record timestamp`,trajectoryEvidenceTruncated:`This evidence was truncated in the Session projection.`,trajectoryArguments:`Tool arguments`,trajectoryRecordedContent:`Recorded content`,trajectoryThinking:`Recorded model reasoning`,trajectoryOutput:`Tool result`,trajectoryMissingResult:`No unambiguous result is included in the loaded records. This does not imply the tool is still running.`,trajectoryStructured:`Structured result`,trajectoryEventOnly:`Only this event’s type and timestamp are available.`,trajectory_user:`User prompt`,trajectory_assistant:`Assistant`,trajectory_call:`Tool call`,trajectory_result:`Unpaired result`,trajectory_event:`Session event`,trajectory_returned:`Tool returned successfully; background work may still be active.`,trajectory_error:`Tool returned an error`,trajectory_unknown:`Outcome not established`,runtimeStatus:`Runtime status`,refreshStatus:`Refresh status`,terminalDetails:`Terminal details`,inspectionChanged:`The active session changed. Reopen this panel.`,inspectionUnavailable:`Details are unavailable.`,inspectionLoading:`Loading status…`,thinkingUnavailable:`Thinking state is unavailable.`,trustUnavailable:`Project trust status is unavailable.`,authUnavailable:`Provider status is unavailable.`,executionState:`State`,terminalCommand:`Command`,terminalDirectory:`Directory`,startedAt:`Started`,exitCode:`Exit code`,detailTruncated:`Some details are shortened to keep this view bounded.`,standardOutput:`Standard output`,standardError:`Standard error`,outputTruncated:`{{count}} bytes omitted from this output view.`,outputRecovery:`The runtime reports a retained log. This view shows only a bounded excerpt.`,modelAndThinking:`Model and reasoning`,selectedModel:`Current model`,thinkingLevel:`Thinking level`,availableThinking:`Available levels`,unknownState:`Unknown`,projectTrust:`Project trust`,trust_trusted:`This session trusts the workspace.`,trust_untrusted:`Trust for this workspace has been denied.`,trust_restricted:`Project resources are restricted pending a trust decision.`,trust_unknown:`Trust state is not available.`,trustRefreshNeeded:`The saved decision and active session differ. Refresh the session through Pi to apply it.`,providerAvailability:`Provider credentials`,credentialConfigured:`Configured`,credentialMissing:`Not configured`,noProviders:`No providers reported.`,providersBounded:`This provider list is truncated.`,authNotVerified:`Configured credentials do not guarantee a successful model request.`,configurationViaPi:`Read-only status. Manage model credentials and trust through Pi; manage OpenPI options with /openpi-setup.`,statusCaptured:`Snapshot at {{time}} · refresh for the latest state`,conversationViews:`Conversation views`,currentConversations:`Current`,archivedConversations:`Archived`,restoreConversation:`Restore conversation`,restoringConversation:`Restoring…`,loadedArchives:`Archived conversations in the loaded history`,loadedHistoryBounded:`{{sessions}} more sessions and {{workspaces}} workspace summaries are not loaded. Search covers the loaded list only.`,noLoadedArchives:`No archived conversations in this loaded list.`,restoreFailed:`Could not confirm restoration. Refresh and try again.`,execution_running:`Running`,execution_done:`Completed`,execution_killed:`Stopped`,execution_timed_out:`Timed out`,execution_failed:`Failed`,execution_uncertain:`Uncertain`,activeOnlyHint:`Only the active Web session accepts messages.`,acceptedHint:`Message accepted by OpenPI Web.`,stopTurn:`Stop current turn`,stoppingTurn:`Stopping current turn…`,stoppedTurn:`Current turn stopped.`,pendingFollowUpsHint:`{{count}} messages queued`,addWorkspace:`Add workspace`,addWorkspaceMenu:`Add workspace...`,archiveConversation:`Archive conversation`,cancel:`Cancel`,chooseWorkspaceHint:`Choose a workspace and describe the work`,close:`Close`,closeSearch:`Close search`,collapseSidebar:`Collapse sidebar`,confirmEdit:`OK`,connected:`Connected`,connecting:`Connecting`,conversationName:`Conversation name`,conversationOptions:`Conversation options`,conversationTurns:`Conversation turns`,copiedMessage:`Copied`,copyMessage:`Copy message`,copyFailed:`Copy failed. Please select and copy the message manually.`,deleteWorkspace:`Delete workspace`,describeTask:`Describe a task`,editMessage:`Edit message`,enterHint:`Enter to send, Shift+Enter for a new line.`,expandSidebar:`Expand sidebar`,importWorkspace:`Import workspace`,loadingModels:`Loading models...`,modelPreparing:`Preparing task...`,modelRetrying:`Retrying model request...`,modelRunning:`Working...`,newSession:`New session`,noConversations:`No conversations yet`,noMatching:`No matching conversations`,noModels:`No models available`,noOutput:`no output`,noSessions:`No sessions`,openSidebar:`Open sidebar`,promptMessage:`Send a message to the active Web session`,promptReadonly:`A non-active session cannot receive prompts`,promptStart:`Choose a workspace to begin.`,promptTask:`Describe what you want to build.`,queuedHint:`The message will be queued after the current turn.`,reconnecting:`Reconnecting`,removeWorkspace:`Remove from sidebar`,renameConversation:`Rename conversation`,renameWorkspace:`Rename workspace`,save:`Save`,searchConversations:`Search conversations`,searchPlaceholder:`Search conversations...`,selectModel:`Select model`,selectWorkspace:`Select workspace`,send:`Send`,stepsLabel:`steps`,switchingSession:`Switching session...`,thinkingActive:`Thinking...`,thinkingDone:`Thinking`,unavailable:`Unavailable`,ungrouped:`Ungrouped`,untitledSession:`New session`,workspaceDeleteConfirm:`The folder and conversation records will be kept. Its conversations will move to Ungrouped.`,workspaceName:`Workspace name`,workspaces:`Workspaces`}},zh:{translation:{conversationView:`会话视图`,chatView:`对话`,trajectory:`执行轨迹`,trajectoryScope:`按记录顺序展示会话消息,不表示执行耗时,也不是完整模型请求。`,trajectoryRunning:`任务仍在进行。已保存记录到达后自动更新;实时生成内容可在“对话”中查看。`,trajectoryTruncated:`当前历史不完整:省略 {{entries}} 条记录、{{parts}} 个内容片段,{{messages}} 条消息被截断。`,trajectoryEmpty:`尚无已保存记录。`,trajectoryOverview:`记录顺序总览`,trajectoryEarlier:`显示更早记录(已加载历史中还有 {{count}} 条)`,trajectoryDetails:`记录详情`,trajectoryRecordedAt:`记录时间`,trajectoryEvidenceTruncated:`此证据在会话投影中已被截断。`,trajectoryArguments:`工具参数`,trajectoryRecordedContent:`已记录内容`,trajectoryThinking:`模型返回的推理内容`,trajectoryOutput:`工具结果`,trajectoryMissingResult:`当前记录中没有可明确配对的结果。这不表示工具仍在运行。`,trajectoryStructured:`结构化结果`,trajectoryEventOnly:`当前仅提供此事件的类型和记录时间。`,trajectory_user:`用户 Prompt`,trajectory_assistant:`模型消息`,trajectory_call:`工具调用`,trajectory_result:`未配对结果`,trajectory_event:`会话事件`,trajectory_returned:`工具已成功返回;其启动的后台任务可能仍在进行。`,trajectory_error:`工具返回错误`,trajectory_unknown:`尚无法确定结果`,runtimeStatus:`运行状态`,refreshStatus:`刷新状态`,terminalDetails:`终端详情`,inspectionChanged:`当前会话已切换,请重新打开详情。`,inspectionUnavailable:`暂时无法读取详情。`,inspectionLoading:`正在读取状态…`,thinkingUnavailable:`暂时无法读取思考等级。`,trustUnavailable:`暂时无法读取项目信任状态。`,authUnavailable:`暂时无法读取服务商状态。`,executionState:`状态`,terminalCommand:`命令`,terminalDirectory:`目录`,startedAt:`启动时间`,exitCode:`退出码`,detailTruncated:`部分详情已截断,以限制页面加载量。`,standardOutput:`标准输出`,standardError:`错误输出`,outputTruncated:`此输出视图省略了 {{count}} 字节。`,outputRecovery:`运行时报告已保留日志;此处仅显示有大小限制的片段。`,modelAndThinking:`模型与思考`,selectedModel:`当前模型`,thinkingLevel:`思考等级`,availableThinking:`支持的等级`,unknownState:`未知`,projectTrust:`项目信任`,trust_trusted:`当前会话信任此工作区。`,trust_untrusted:`此工作区的信任已被拒绝。`,trust_restricted:`项目资源受到限制,等待信任决定。`,trust_unknown:`尚无法确定信任状态。`,trustRefreshNeeded:`保存的信任决定与当前会话不同,请通过 Pi 刷新会话后生效。`,providerAvailability:`服务商凭据`,credentialConfigured:`已配置`,credentialMissing:`未配置`,noProviders:`未发现服务商。`,providersBounded:`服务商列表已截断。`,authNotVerified:`凭据已配置不代表模型请求一定成功。`,configurationViaPi:`此处为只读状态。模型凭据与信任由 Pi 管理,OpenPI 选项通过 /openpi-setup 配置。`,statusCaptured:`采集于 {{time}} · 刷新查看最新状态`,conversationViews:`会话视图`,currentConversations:`当前`,archivedConversations:`已归档`,restoreConversation:`恢复会话`,restoringConversation:`正在恢复…`,loadedArchives:`已加载历史中的归档会话`,loadedHistoryBounded:`另有 {{sessions}} 个会话和 {{workspaces}} 个工作区摘要未加载。搜索仅覆盖已加载列表。`,noLoadedArchives:`已加载列表中没有归档会话。`,restoreFailed:`暂时无法确认恢复结果,请刷新后重试。`,execution_running:`运行中`,execution_done:`已完成`,execution_killed:`已停止`,execution_timed_out:`已超时`,execution_failed:`失败`,execution_uncertain:`状态不确定`,activeOnlyHint:`只有当前 Web 会话可以接收消息。`,stopTurn:`停止当前轮次`,stoppingTurn:`正在停止当前轮次…`,stoppedTurn:`当前轮次已停止。`,pendingFollowUpsHint:`{{count}} 条消息正在排队`,acceptedHint:`OpenPI Web 已接收消息。`,addWorkspace:`添加工作区`,addWorkspaceMenu:`添加工作区...`,archiveConversation:`归档会话`,cancel:`取消`,chooseWorkspaceHint:`选择工作区并描述任务`,close:`关闭`,closeSearch:`关闭搜索`,collapseSidebar:`收起侧边栏`,confirmEdit:`确定`,connected:`已连接`,connecting:`正在连接`,conversationName:`会话名称`,conversationOptions:`会话选项`,conversationTurns:`会话轮次`,copiedMessage:`已复制`,copyMessage:`复制消息`,copyFailed:`复制失败,请选中消息后手动复制。`,deleteWorkspace:`删除工作区`,describeTask:`描述任务`,editMessage:`编辑消息`,enterHint:`按 Enter 发送,Shift+Enter 换行。`,expandSidebar:`展开侧边栏`,importWorkspace:`导入工作区`,loadingModels:`正在加载模型...`,modelPreparing:`正在准备任务...`,modelRetrying:`模型请求重试中...`,modelRunning:`正在运行...`,newSession:`新建会话`,noConversations:`暂无对话`,noMatching:`没有匹配的会话`,noModels:`没有可用模型`,noOutput:`无输出`,noSessions:`暂无会话`,openSidebar:`打开侧边栏`,promptMessage:`向当前 Web 会话发送消息`,promptReadonly:`非当前会话不能接收消息`,promptStart:`选择一个工作区开始`,promptTask:`描述你想要构建的任务`,queuedHint:`当前回合结束后将发送消息。`,reconnecting:`正在重连`,removeWorkspace:`从侧边栏移除`,renameConversation:`重命名会话`,renameWorkspace:`重命名工作区`,save:`保存`,searchConversations:`搜索会话`,searchPlaceholder:`搜索会话...`,selectModel:`选择模型`,selectWorkspace:`选择工作区`,send:`发送`,stepsLabel:`个步骤`,switchingSession:`正在切换会话...`,thinkingActive:`思考中...`,thinkingDone:`思考过程`,unavailable:`不可用`,ungrouped:`未分组`,untitledSession:`新会话`,workspaceDeleteConfirm:`文件夹与会话记录会保留,其中的会话会被放到“未分组”;再次打开此目录时将是一个干净的工作区。`,workspaceName:`工作区名称`,workspaces:`工作区`}}},lx=navigator.language?.toLowerCase().startsWith(`zh`)?`zh`:`en`;Ft.use(en).init({fallbackLng:`en`,initAsync:!1,interpolation:{escapeValue:!1},lng:lx,resources:cx}),document.documentElement.lang=lx===`zh`?`zh-CN`:`en`;function ux({children:e}){let t=pn(Zb,e=>e.snapshot?.preferences?.theme)??`system`,[n,r]=(0,w.useState)(()=>window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1);(0,w.useEffect)(()=>{let e=window.matchMedia?.(`(prefers-color-scheme: dark)`);if(!e)return;let t=()=>r(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let i=t===`dark`||t===`system`&&n?`dark`:`light`;return(0,w.useEffect)(()=>{document.documentElement.dataset.theme=i},[i]),(0,L.jsx)(ln,{i18n:Ft,children:(0,L.jsx)(ax,{theme:sx,mode:i,children:e})})}var dx=document.getElementById(`root`);if(!dx)throw Error(`OpenPI Web root is missing`);(0,Be.createRoot)(dx).render((0,L.jsx)(w.StrictMode,{children:(0,L.jsx)(ux,{children:(0,L.jsx)(Qb,{})})})); \ No newline at end of file +`,t),i=-1;if(n!==-1&&r!==-1?i=n20?`${e.slice(0,20)}…`:e}"`,{type:`unknown-field`,field:e,value:t,line:n}))}}function T(){u!==void 0&&a?.(u),f>0&&i?.({id:u,event:p,data:d}),u=void 0,d=``,f=0,p=void 0}function E(e={}){if(e.consume&&s.length>0){let e=s.join(``);C(e,0,e.length)}l=!0,u=void 0,d=``,f=0,p=void 0,s.length=0,c=0,m=!1,h=!1,g=!1}return{feed:_,reset:E}}function Rb(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function zb(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}function Bb(e,t){let n=1;for(;nt.abort();e.signal.addEventListener(`abort`,n,{once:!0}),e.signal.aborted&&n();let r=window.setTimeout(n,45e3),i=await fetch(`/events?cursor=${e.cursor}`,{headers:e.client.headers(),signal:t.signal}).finally(()=>{window.clearTimeout(r),e.signal.removeEventListener(`abort`,n)});if(i.status===409)throw new Vb(`event replay expired`);if(!i.ok||!i.body)throw Error(`event connection failed`);e.onConnected();let a=e.cursor,o=0,s=Lb({onComment(t){t.trim()===`heartbeat`&&++o>=4&&(o=0,e.onHeartbeat?.())},onEvent(t){let n=JSON.parse(t.data);if(!Number.isSafeInteger(n.sequence))throw new Vb(`invalid event cursor`);if(!(n.sequence<=a)){if(n.sequence!==a+1)throw new Vb(`event cursor gap`);if(a=n.sequence,n.type===`state_invalidated`)throw new Vb(`state invalidated`);e.onEvent(n)}}}),c=i.body.getReader(),l=new TextDecoder;try{for(;!e.signal.aborted;){let t,n,r=c.read(),i=new Promise((r,i)=>{n=()=>i(Error(`event stream aborted`)),e.signal.addEventListener(`abort`,n,{once:!0}),e.signal.aborted&&n(),t=window.setTimeout(()=>i(Error(`event stream stalled`)),45e3)}),{done:a,value:o}=await Promise.race([r,i]).finally(()=>{window.clearTimeout(t),n&&e.signal.removeEventListener(`abort`,n)});if(a)throw Error(`event connection closed`);s.feed(l.decode(o,{stream:!0}))}}finally{await c.cancel().catch(()=>void 0)}}var Ub=`openpi.collapsed-workspaces`,Wb=`openpi.sidebar-collapsed`,Gb=new Set([`agent_start`,`turn_started`,`turn_settled`,`agent_settled`,`prompt_settled`,`message_end`,`tool_execution_end`,`session_start`,`session_switched`,`session_progress`,`prompt_failed`,`model_select`,`workspace_imported`,`workspace_removed`,`workspace_renamed`,`session_renamed`,`session_archived`,`session_unarchived`,`session_created`,`prompt_accepted`,`runtime_changed`]);function Kb(e){try{let t=JSON.parse(window.sessionStorage.getItem(e)||`[]`);return new Set(Array.isArray(t)?t.filter(e=>typeof e==`string`):[])}catch{return new Set}}function qb(e){try{return window.sessionStorage.getItem(e)===`true`}catch{return!1}}function Jb(e,t){try{window.sessionStorage.setItem(e,JSON.stringify(t))}catch{}}function Yb(e,t){return t.aborted?Promise.resolve():new Promise(n=>{let r=()=>{window.clearTimeout(i),t.removeEventListener(`abort`,r),n()},i=window.setTimeout(r,e);t.addEventListener(`abort`,r,{once:!0})})}function Xb(e=new Pc,t={}){let n=t.consumeEvents??Hb,r=0,i=0,a=0,o=null,s=null,c=null,l=Promise.resolve(),u=null,d=!1,f=!1,p=null,m=new Set,h=new Set,g=(e,t)=>{if(typeof t==`string`)for(e.add(t);e.size>32;){let t=e.values().next().value;t&&e.delete(t)}},_=()=>({activeTurn:null,turnCancellationPending:!1,turnTerminalStatus:null,pendingFollowUpsReceipt:null,liveMessages:[],liveRunning:!1,livePhase:`idle`,liveRetry:null,thinkingStarts:{},thinkingDurations:{}}),v=(e,t)=>({liveRunning:t===`running`||!e,livePhase:t===`running`?`running`:e?`idle`:`preparing`});return dn((t,y)=>{let b=e=>{t({notice:e instanceof Error?e.message:String(e)})},x=async(n,i,a)=>{if(y().modelSelectionPending)return!1;t({modelSelectionPending:!0});try{let o=await e.selectModel(n.provider,n.id,a);if(i!==r||a!==y().snapshot?.selectedSession?.id)return!1;if(o.provider!==n.provider||o.id!==n.id||!o.current)throw Error(`Model selection was not confirmed. Please select a model again.`);if(!await y().actions.refreshSnapshot({epoch:i})||i!==r||a!==y().snapshot?.selectedSession?.id)return!1;let s=y().snapshot?.models.find(e=>e.current);if(s?.provider!==n.provider||s.id!==n.id)throw Error(`The Session model changed. Please select a model again.`);return t({draftModel:null,notice:null}),!0}catch(e){return i===r&&a===y().snapshot?.selectedSession?.id&&b(e),!1}finally{i===r&&t({modelSelectionPending:!1})}},S=(e=160)=>{if(d){f=!0;return}u===null&&(u=window.setTimeout(async()=>{u=null,d=!0;try{await y().actions.refreshSnapshot()}finally{d=!1,f&&(f=!1,S())}},e))},C=e=>{let n=y(),i=e.detail??{},a=i.sessionId,l=[`session_start`,`session_switched`,`session_created`].includes(e.type);if(t({cursor:e.sequence}),n.sessionSwitching&&!l){S();return}if(typeof a==`string`&&a!==n.snapshot?.currentSessionId&&!l){S();return}if(l){let a=i.commandId;if(typeof a==`string`&&h.has(a)){S();return}let l=i.sessionPath,u=n.snapshot?.sessions.some(e=>e.path===l),d=!1;if(c?.kind===`select`?d=c.expectedPath===l:c?.kind===`create`&&c.commandId===a&&e.type===`session_switched`&&typeof l==`string`&&!u?(c.observedPath=l,d=!0):c?.kind===`create`&&c.commandId===a&&e.type===`session_created`&&typeof c.observedPath==`string`&&(d=!0),d&&c?.epoch!==r)return;if(d)t(_());else{let e=++r;o=null,s=null,t({..._(),promptAdmissionPending:!1,selectedPath:typeof l==`string`?l:null,draftModel:n.workspaceDraft?n.draftModel:null,modelSelectionPending:!1,sessionSwitching:!0}),y().actions.refreshSnapshot({epoch:e}).then(n=>{e===r&&t({selectedPath:n?y().selectedPath:null,sessionSwitching:!1})})}}else if(e.type===`prompt_accepted`){let e=m.has(String(i.commandId??``));t({...v(e,n.livePhase),liveRetry:null,pendingFollowUpsReceipt:Number.isInteger(i.pendingFollowUps)?Number(i.pendingFollowUps):n.pendingFollowUpsReceipt})}else if(e.type===`turn_started`)t({activeTurn:{sessionId:String(i.sessionId),commandId:String(i.commandId),epoch:Number(i.epoch)},liveRunning:!0,livePhase:`running`,liveRetry:null,turnTerminalStatus:null});else if(e.type===`agent_start`)t({...i.activeTurn?{activeTurn:i.activeTurn}:{},liveRunning:!0,livePhase:`running`,liveRetry:null});else if(e.type===`turn_settled`){g(m,i.commandId);let e=n.activeTurn;e?.sessionId===i.sessionId&&e?.commandId===i.commandId&&e?.epoch===i.epoch&&t({activeTurn:null,liveRunning:!1,livePhase:`idle`,liveRetry:null,turnTerminalStatus:typeof i.outcome==`string`?i.outcome:null})}else if(e.type===`agent_settled`)t({pendingFollowUpsReceipt:null,...n.activeTurn?{}:{liveRunning:!1,livePhase:`idle`,liveRetry:null}});else if(e.type===`prompt_settled`)g(m,i.commandId),n.livePhase!==`running`&&t({liveRunning:!1,livePhase:`idle`,liveRetry:null});else if(i.message&&typeof i.message==`object`){let r=i.message,a=n.liveMessages;r.role===`user`&&(a=a.filter(e=>!e.key.startsWith(`optimistic-`)||e.message.content!==r.content));let o=typeof i.messageKey==`string`?i.messageKey:`${r.role||`message`}-${e.sequence}`,s={key:o,message:r},c=a.findIndex(e=>e.key===o);a=c>=0?a.map((e,t)=>t===c?s:e):[...a,s].slice(-8);let l={...n.thinkingStarts},u={...n.thinkingDurations};r.parts?.some(e=>e.type===`thinking`)&&(l[o]??=Date.now(),e.type===`message_end`&&(u[o]=Date.now()-l[o])),t({liveMessages:a,thinkingDurations:u,thinkingStarts:l})}e.type===`prompt_failed`&&(g(m,i.commandId),t({liveMessages:y().liveMessages.filter(e=>!e.key.startsWith(`optimistic-`)),liveRunning:!1,livePhase:`idle`,liveRetry:null,notice:typeof i.error==`string`?i.error:`Prompt failed`})),e.type===`auto_retry_start`&&t({liveRunning:!0,livePhase:`running`,liveRetry:{attempt:Number(i.attempt)||0,maxAttempts:Number(i.maxAttempts)||0}}),Gb.has(e.type)&&S()},w=async r=>{let i=500;for(;!r.aborted;){let a=!1;try{if(y().cursor===null){if(a=!0,!await y().actions.refreshSnapshot({resetCursor:!0}))throw Error(`snapshot unavailable`);a=!1}if(r.aborted)return;await n({client:e,cursor:y().cursor??0,onConnected:()=>{i=500,t({connection:`connected`,notice:null})},onEvent:C,onHeartbeat:()=>S(0),signal:r})}catch(e){if(r.aborted)return;t({connection:`reconnecting`}),!a&&await y().actions.refreshSnapshot({resetCursor:!0})||t(_()),await Yb(i,r),i=Math.min(i*2,5e3),e instanceof SyntaxError&&t({notice:`Invalid event data`})}}},T={start(){p||(p=new AbortController,w(p.signal))},stop(){p?.abort(),p=null,u!==null&&window.clearTimeout(u),u=null},async refreshSnapshot(n={}){let a=n.epoch??r,o=++i,c=y().selectedPath;try{let l=await e.snapshot(c);if(a!==r||o!==i)return!1;let u=typeof l.currentSessionId==`string`,d=u?l.sessions.find(e=>e.id===l.currentSessionId):void 0,f=u?l.selectedSession?.id===l.currentSessionId:l.selectedSession===void 0,p=!c||l.sessions.some(e=>e.path===c),m=!c||l.selectedSession?.path===c;if(!p||!m||!f)return t({selectedPath:null}),!n.canonicalRetry&&T.refreshSnapshot({...n,canonicalRetry:!0,epoch:a});let h=l.selectedSession?.cwd,g=l.workspaces.find(e=>e.current)?.path,v=l.workspaces.some(e=>e.path===y().selectedWorkspace)?y().selectedWorkspace:void 0,b=y().workspaceDraft?y().selectedWorkspace:l.workspaces.some(e=>e.path===h)?h:g??v??null,x=n.resetCursor;return t({...x?_():{},connection:y().connection===`connecting`?`connecting`:y().connection,cursor:x||y().cursor===null?l.cursor:Math.max(y().cursor??0,l.cursor),activeTurn:l.runtime.activeTurn??null,livePhase:l.runtime.status!==`running`&&!y().promptAdmissionPending&&!s?`idle`:y().livePhase,liveRetry:l.runtime.status!==`running`&&!y().promptAdmissionPending&&!s?null:y().liveRetry,liveRunning:l.runtime.status===`running`?!0:!y().promptAdmissionPending&&!s?!1:y().liveRunning,selectedPath:d?.path??l.selectedSession?.path??null,selectedWorkspace:b,snapshot:l}),!0}catch(e){return a!==r||o!==i?!1:(t({connection:`unavailable`}),b(e),!1)}},async chooseWorkspace(){let t=r;try{let n=await e.chooseWorkspace();if(t!==r||n.cancelled||!n.path)return;T.setWorkspace(n.path),await T.refreshSnapshot()}catch(e){t===r&&b(e)}},setWorkspace(e){let n=y();e===n.selectedWorkspace&&!n.sessionSwitching||(++r,o=null,s=null,t({..._(),selectedWorkspace:e,workspaceDraft:!0,sessionSwitching:!1,modelSelectionPending:!1,promptAdmissionPending:!1,notice:null}))},async renameWorkspace(t,n){try{await e.renameWorkspace(t,n),await T.refreshSnapshot()}catch(e){throw b(e),e}},async removeWorkspace(n){try{await e.removeWorkspace(n),t({selectedPath:null,selectedWorkspace:y().selectedWorkspace===n?null:y().selectedWorkspace}),await T.refreshSnapshot()}catch(e){b(e)}},async createSession(n){if(!n||y().modelSelectionPending)return!1;let i=++r,a=globalThis.crypto?.randomUUID?.()??`web-create-${Date.now()}-${i}`;o=null,s=null,t({..._(),mobileSidebarOpen:!1,promptAdmissionPending:!1,selectedPath:null,selectedWorkspace:n,workspaceDraft:!0,sessionSwitching:!0});let u=!1,d=l.then(async()=>{if(i===r){c={commandId:a,epoch:i,expectedPath:null,kind:`create`,observedPath:null};try{let o=await e.createSession(n,a);if(i!==r)return;if(o.cancelled||!o.sessionPath)throw Error(`Session creation was not confirmed. Please try again.`);t({selectedPath:null});let s=await T.refreshSnapshot({epoch:i});if(!s&&i===r&&(s=await T.refreshSnapshot({epoch:i})),i!==r)return;if(!s)throw Error(`The created Session could not be confirmed. Please try again.`);let c=y().snapshot?.selectedSession;if(!c||c.path!==o.sessionPath||c.cwd!==n||c.id!==y().snapshot?.currentSessionId)throw Error(`The created Session is no longer active in the selected workspace. Please try again.`);t({workspaceDraft:!1,notice:null});let l=y().draftModel,d=c.id;u=!l||await x(l,i,d)}catch(e){if(i!==r)return;t({selectedPath:null}),b(e),await T.refreshSnapshot({epoch:i})}finally{g(h,a),c?.epoch===i&&(c=null),i===r&&t({sessionSwitching:!1})}}});return l=d.catch(()=>void 0),await d,u&&i===r},async selectSession(n){if(!n)return;t({workspaceDraft:!1,draftModel:null,modelSelectionPending:!1});let i=++r;o=null,s=null,t({..._(),mobileSidebarOpen:!1,promptAdmissionPending:!1,selectedPath:n,sessionSwitching:!0});let a=l.then(async()=>{if(i===r){c={epoch:i,expectedPath:n,kind:`select`};try{if(await e.selectSession(n),i!==r)return;await T.refreshSnapshot({epoch:i})||t({selectedPath:null})}catch(e){if(i!==r)return;t({selectedPath:null}),b(e),await T.refreshSnapshot({epoch:i})}finally{c?.epoch===i&&(c=null),i===r&&t({sessionSwitching:!1})}}});l=a.catch(()=>void 0),await a},async renameSession(t,n){try{await e.renameSession(t,n),await T.refreshSnapshot()}catch(e){throw b(e),e}},async archiveSession(t){try{await e.archiveSession(t),await T.refreshSnapshot()}catch(e){b(e)}},async unarchiveSession(t){let n=r;try{return await e.unarchiveSession(t),n!==r||await T.refreshSnapshot({epoch:n})}catch(e){return n===r&&b(e),!1}},async selectModel(e){let[n,...i]=e.split(`/`),a=i.join(`/`),o=y();if(!n||!a||o.sessionSwitching||o.modelSelectionPending||o.promptAdmissionPending||!o.workspaceDraft&&(o.liveRunning||o.snapshot?.runtime.status===`running`))return;let s=o.snapshot?.selectedSession?.id;if(o.workspaceDraft||!s&&!o.snapshot?.currentSessionId){let e=o.snapshot?.models.find(e=>e.provider===n&&e.id===a);e&&t({draftModel:e,notice:null});return}!s||s!==o.snapshot?.currentSessionId||await x({provider:n,id:a},r,s)},async cancelActiveTurn(){let n=y().activeTurn??y().snapshot?.runtime.activeTurn;if(!n||y().turnCancellationPending||y().sessionSwitching)return;let i=r;t({turnCancellationPending:!0});try{await e.cancelActiveTurn(n)}catch(e){if(i!==r)return;await T.refreshSnapshot({epoch:i}),i===r&&b(e)}finally{i===r&&t({turnCancellationPending:!1})}},async sendPrompt(n){let i=n.trim(),c=y().selectedWorkspace;if(!c||!i||y().sessionSwitching||y().promptAdmissionPending||y().modelSelectionPending)return!1;let l=y().workspaceDraft||!y().snapshot?.selectedSession?.id;if(l&&!await T.createSession(c)||l&&y().draftModel)return!1;let u=y().snapshot?.selectedSession?.id;if(!u||y().workspaceDraft||y().selectedWorkspace!==c||y().snapshot?.selectedSession?.cwd!==c||u!==y().snapshot?.currentSessionId||y().sessionSwitching||y().promptAdmissionPending)return!1;let d=r,f=y().draftModel;if(f&&!await x(f,d,u)||d!==r||u!==y().snapshot?.selectedSession?.id||u!==y().snapshot?.currentSessionId||y().workspaceDraft||y().selectedWorkspace!==c||y().snapshot?.selectedSession?.cwd!==c)return!1;let p=++a,h=s?.sessionId===u&&s.content===i,g=h?s.commandId:globalThis.crypto?.randomUUID?.()??`web-prompt-${Date.now()}-${p}`,_=h?s.optimisticKey:`optimistic-${g}`;s={sessionId:u,content:i,commandId:g,optimisticKey:_},o=p,t({liveMessages:h?y().liveMessages:[...y().liveMessages,{key:_,message:{role:`user`,content:i}}].slice(-8),notice:null,pendingFollowUpsReceipt:null,turnTerminalStatus:null,promptAdmissionPending:!0,scrollToBottom:y().scrollToBottom+1});try{let n=await e.prompt(u,i,g,h);if(d!==r||o!==p)return!1;let a=m.has(n.id);return s?.commandId===g&&(s=null),t({...v(a,y().livePhase),pendingFollowUpsReceipt:n.pendingFollowUps??null}),S(120),!0}catch(e){return d!==r||o!==p?!1:e instanceof Mc&&[`WORKSPACE_REQUIRED`,`SESSION_CONFLICT`,`PROMPT_REJECTED`,`COMMAND_CONFLICT`,`PROMPT_ADMISSION_CAPACITY`].includes(e.code??``)?(s?.commandId===g&&(s=null),t({liveMessages:y().liveMessages.filter(e=>e.key!==_),livePhase:`idle`,liveRetry:null,liveRunning:!1}),b(e),!1):(t({liveRunning:!0,livePhase:y().livePhase===`running`?`running`:`preparing`,liveRetry:null}),b(e),!1)}finally{d===r&&o===p&&(o=null,t({promptAdmissionPending:!1}))}},setQuery(e){t({query:e})},setSearchOpen(e){t({searchOpen:e,...e?{}:{query:``}})},toggleWorkspace(e){let n=new Set(y().collapsed);n.has(e)?n.delete(e):n.add(e),Jb(Ub,[...n]),t({collapsed:n})},toggleSidebar(e){if(e){t({mobileSidebarOpen:!y().mobileSidebarOpen});return}let n=!y().sidebarCollapsed;try{window.sessionStorage.setItem(Wb,String(n))}catch{}t({sidebarCollapsed:n})},closeMobileSidebar(){t({mobileSidebarOpen:!1})},clearNotice(){t({notice:null})}};return{activeTurn:null,turnCancellationPending:!1,turnTerminalStatus:null,pendingFollowUpsReceipt:null,snapshot:null,cursor:null,selectedPath:null,selectedWorkspace:null,workspaceDraft:!1,draftModel:null,modelSelectionPending:!1,collapsed:Kb(Ub),sidebarCollapsed:qb(Wb),mobileSidebarOpen:!1,query:``,searchOpen:!1,connection:`connecting`,notice:null,liveMessages:[],liveRunning:!1,livePhase:`idle`,liveRetry:null,thinkingStarts:{},thinkingDurations:{},promptAdmissionPending:!1,sessionSwitching:!1,scrollToBottom:0,actions:T}})}var Zb=Xb();function Qb(){let e=pn(Zb),{t}=cn(),{actions:n}=e,[r,i]=(0,w.useState)(`chat`),[a,o]=(0,w.useState)(null),s=e.snapshot?.models.find(e=>e.current),c=JSON.stringify([s?.provider,s?.id]),l=t=>{let n=e.snapshot,r=n?.selectedSession;e.workspaceDraft||!n||!r||e.sessionSwitching||r.id!==n.currentSessionId||o({sessionId:r.id,sessionPath:r.path,cwd:r.cwd,model:s?.label??``,modelKey:c,terminalId:t})},u=a&&!e.workspaceDraft&&!e.sessionSwitching&&a.sessionId===e.snapshot?.currentSessionId&&a.sessionPath===e.snapshot?.selectedSession?.path&&a.modelKey===c;(0,w.useEffect)(()=>{a&&!u&&o(null)},[a,u]),(0,w.useEffect)(()=>(n.start(),n.stop),[n]);let d=e.workspaceDraft?void 0:e.snapshot?.selectedSession,f=d?.entries.some(e=>e.type===`message`&&e.message)||e.liveMessages.length>0,p=!d||!f,m=(0,w.useCallback)(e=>n.sendPrompt(e),[n]);return(0,L.jsxs)(`div`,{className:`app-shell ${e.sidebarCollapsed?`sidebar-collapsed`:``} ${e.mobileSidebarOpen?`sidebar-open`:``}`,children:[(0,L.jsx)(iu,{snapshot:e.snapshot,selectedPath:e.workspaceDraft?null:e.selectedPath,selectedWorkspace:e.selectedWorkspace,collapsed:e.collapsed,query:e.query,searchOpen:e.searchOpen,mobileOpen:e.mobileSidebarOpen,actions:n}),e.sidebarCollapsed&&(0,L.jsx)(`button`,{className:`sidebar-expand`,type:`button`,"aria-label":t(`expandSidebar`),title:t(`expandSidebar`),onClick:()=>n.toggleSidebar(!1),children:(0,L.jsx)(Te,{})}),(0,L.jsxs)(`main`,{className:`conversation-shell ${d?`has-view`:``} ${p&&(e.workspaceDraft||r===`chat`)?`landing`:``}`,children:[(0,L.jsx)(`h1`,{className:`sr-only`,children:`OpenPI`}),(0,L.jsxs)(`header`,{className:`mobile-header`,children:[(0,L.jsx)(`button`,{type:`button`,"aria-label":t(`openSidebar`),onClick:()=>n.toggleSidebar(!0),children:(0,L.jsx)(Ce,{})}),(0,L.jsx)(`span`,{className:`connection-state ${e.connection}`,children:t(e.connection)})]}),d&&(0,L.jsxs)(`fieldset`,{className:`conversation-view-switch`,"aria-label":t(`conversationView`),children:[(0,L.jsx)(`button`,{type:`button`,"aria-pressed":r===`chat`,onClick:()=>i(`chat`),children:t(`chatView`)}),(0,L.jsx)(`button`,{type:`button`,"aria-pressed":r===`trajectory`,onClick:()=>i(`trajectory`),children:t(`trajectory`)})]}),e.sessionSwitching?(0,L.jsx)(`div`,{className:`conversation switching`,role:`status`,children:(0,L.jsxs)(`div`,{className:`conversation-running`,children:[(0,L.jsx)(`span`,{className:`conversation-running-dot`}),(0,L.jsx)(`span`,{children:t(`switchingSession`)})]})}):r===`trajectory`&&d&&e.snapshot?(0,L.jsx)(su,{snapshot:e.snapshot,running:e.liveRunning},d.path):p?(0,L.jsx)(`section`,{className:`conversation landing-conversation`,"aria-label":`Conversation`,children:(0,L.jsx)(`div`,{className:`landing-welcome`,children:(0,L.jsx)(gn,{animated:!0})})}):e.snapshot?(0,L.jsx)(jb,{snapshot:e.snapshot,liveMessages:e.liveMessages,liveRunning:e.liveRunning,livePhase:e.livePhase,liveRetry:e.liveRetry,thinkingStarts:e.thinkingStarts,thinkingDurations:e.thinkingDurations,scrollToBottom:e.scrollToBottom,onResend:m}):null,(0,L.jsx)(nu,{workspaceDraft:e.workspaceDraft,draftModel:e.draftModel,modelSelectionPending:e.modelSelectionPending,onInspect:l,activeTurn:e.activeTurn,turnCancellationPending:e.turnCancellationPending,turnTerminalStatus:e.turnTerminalStatus,pendingFollowUpsReceipt:e.pendingFollowUpsReceipt,snapshot:e.snapshot,selectedPath:e.selectedPath,selectedWorkspace:e.selectedWorkspace,sessionSwitching:e.sessionSwitching,promptAdmissionPending:e.promptAdmissionPending,liveRunning:e.liveRunning,landing:p,actions:n}),e.notice&&(0,L.jsxs)(`div`,{className:`notice`,role:`alert`,children:[(0,L.jsx)(`span`,{children:e.notice}),(0,L.jsx)(`button`,{type:`button`,"aria-label":t(`close`),onClick:n.clearNotice,children:(0,L.jsx)(ze,{})})]})]}),u&&(0,L.jsx)(Fc,{target:a,onClose:()=>o(null)},`${a.sessionId}:${a.sessionPath}:${a.terminalId??`status`}`),(0,L.jsx)(`button`,{className:`sidebar-scrim`,type:`button`,"aria-label":t(`close`),onClick:n.closeMobileSidebar})]})}var $b={base:{k1xSpc:`xjp7ctv`,kMwMTN:`x1tgivj0`,kMv6JI:`x9ynric`,$$css:!0},light:{kQNsl9:`x19aimcq`,$$css:!0},dark:{kQNsl9:`xntwwlm`,$$css:!0},system:{kQNsl9:`x108lcm5`,$$css:!0}},ex=w.createContext(!1);ex.displayName=`ThemeNestingContext`;var tx=new Set,nx=0;function rx(e){let t=(0,w.useId)();(0,w.useInsertionEffect)(()=>{if(e.__built)return;let n=`astryx-theme-${e.name}`;if(tx.has(n))return;`${e.name}`,`${e.name}${e.name}${e.name}${e.name}`;let{prose:r,component:i}=ic(e),a=rc();tx.add(n);let o=[()=>tx.delete(n)];if(a){if(nx++===0){let e=document.createElement(`style`);e.setAttribute(Ir(`theme-base`),``),e.textContent=`@layer astryx-base {\n${a}\n}`,document.head.appendChild(e)}o.push(()=>{--nx===0&&document.querySelector(`style[${Ir(`theme-base`)}]`)?.remove()})}if(r){let n=document.createElement(`style`);n.setAttribute(Ir(`theme-prose`),e.name),n.setAttribute(Ir(`id`),t),n.textContent=`@layer reset {\n${r}\n}`,document.head.appendChild(n)}if(i){let n=document.createElement(`style`);n.setAttribute(Ir(`theme`),e.name),n.setAttribute(Ir(`id`),t),n.textContent=`@layer astryx-theme {\n${i}\n}`,document.head.appendChild(n)}return(r||i)&&o.push(()=>{let n=document.querySelector(`style[${Ir(`theme-prose`)}="${e.name}"][${Ir(`id`)}="${t}"]`),r=document.querySelector(`style[${Ir(`theme`)}="${e.name}"][${Ir(`id`)}="${t}"]`);n?.remove(),r?.remove()}),()=>{for(let e of o)e()}},[e,t])}function ix(e,t,n){xl(()=>{if(!e&&!(typeof document>`u`))return t===`light`||t===`dark`?document.documentElement.setAttribute(`data-theme`,t):document.documentElement.removeAttribute(`data-theme`),document.documentElement.setAttribute(Ir(`theme`),n),()=>{document.documentElement.removeAttribute(`data-theme`),document.documentElement.removeAttribute(Ir(`theme`))}},[e,t,n])}function ax({theme:e,mode:t=`system`,children:n}){let r=(0,w.use)(ex);js(e),rx(e),ix(r,t,e.name);let i=t===`dark`?$b.dark:t===`light`?$b.light:$b.system,a=(0,w.useMemo)(()=>({theme:e,mode:t}),[e,t]);return(0,L.jsx)(oc,{value:a,children:(0,L.jsx)(ex,{value:!0,children:(0,L.jsx)(`div`,{...xn($b.base,i),"data-astryx-theme":e.name,"data-theme":t===`system`?void 0:t,children:n})})})}ax.displayName=`Theme`;var ox={size:`1em`,"aria-hidden":!0},sx={name:`neutral`,__built:!0,tokens:{"--font-size-4xs":`0.375rem`,"--font-size-3xs":`0.4375rem`,"--font-size-2xs":`0.5rem`,"--font-size-xs":`0.625rem`,"--font-size-sm":`0.75rem`,"--font-size-base":`0.875rem`,"--font-size-lg":`1.0625rem`,"--font-size-xl":`1.25rem`,"--font-size-2xl":`1.5rem`,"--font-size-3xl":`1.8125rem`,"--font-size-4xl":`2.1875rem`,"--font-size-5xl":`2.625rem`,"--text-heading-1-size":`var(--font-size-2xl)`,"--text-heading-1-weight":`var(--font-weight-semibold)`,"--text-heading-1-leading":`1.3333`,"--text-heading-2-size":`var(--font-size-xl)`,"--text-heading-2-weight":`var(--font-weight-semibold)`,"--text-heading-2-leading":`1.4`,"--text-heading-3-size":`var(--font-size-lg)`,"--text-heading-3-weight":`var(--font-weight-bold)`,"--text-heading-3-leading":`1.4118`,"--text-heading-4-size":`var(--font-size-base)`,"--text-heading-4-weight":`var(--font-weight-bold)`,"--text-heading-4-leading":`1.4286`,"--text-heading-5-size":`var(--font-size-sm)`,"--text-heading-5-weight":`var(--font-weight-semibold)`,"--text-heading-5-leading":`1.6667`,"--text-heading-6-size":`var(--font-size-xs)`,"--text-heading-6-weight":`var(--font-weight-semibold)`,"--text-heading-6-leading":`1.6`,"--text-body-size":`var(--font-size-base)`,"--text-body-weight":`var(--font-weight-normal)`,"--text-body-leading":`1.4286`,"--text-large-size":`var(--font-size-lg)`,"--text-large-weight":`var(--font-weight-semibold)`,"--text-large-leading":`1.4118`,"--text-label-size":`var(--font-size-base)`,"--text-label-weight":`var(--font-weight-medium)`,"--text-label-leading":`1.4286`,"--text-code-size":`var(--font-size-base)`,"--text-code-weight":`var(--font-weight-normal)`,"--text-code-leading":`1.4286`,"--text-supporting-size":`var(--font-size-sm)`,"--text-supporting-weight":`var(--font-weight-normal)`,"--text-supporting-leading":`1.6667`,"--text-display-1-size":`var(--font-size-5xl)`,"--text-display-1-weight":`var(--font-weight-normal)`,"--text-display-1-leading":`1.2381`,"--text-display-2-size":`var(--font-size-4xl)`,"--text-display-2-weight":`var(--font-weight-normal)`,"--text-display-2-leading":`1.2571`,"--text-display-3-size":`var(--font-size-3xl)`,"--text-display-3-weight":`var(--font-weight-normal)`,"--text-display-3-leading":`1.3793`,"--duration-fast-min":`95ms`,"--duration-fast":`125ms`,"--duration-fast-max":`165ms`,"--duration-medium-min":`225ms`,"--duration-medium":`300ms`,"--duration-medium-max":`400ms`,"--duration-slow-min":`525ms`,"--duration-slow":`700ms`,"--duration-slow-max":`935ms`,"--font-family-body":`Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`,"--font-family-heading":`Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`,"--font-family-code":`ui-monospace, "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace`,"--color-syntax-keyword":`light-dark(#700084, #efa8ff)`,"--color-syntax-string":`light-dark(#005600, #a6d2a2)`,"--color-syntax-comment":`light-dark(#737373, #a3a3a3)`,"--color-syntax-number":`light-dark(#6e3500, #ffb37f)`,"--color-syntax-function":`light-dark(#00458c, #a0caff)`,"--color-syntax-type":`light-dark(#700084, #efa8ff)`,"--color-syntax-variable":`light-dark(#171717, #e5e5e5)`,"--color-syntax-operator":`light-dark(#737373, #a3a3a3)`,"--color-syntax-constant":`light-dark(#6e3500, #ffb37f)`,"--color-syntax-tag":`light-dark(#89001a, #ffaeaa)`,"--color-syntax-attribute":`light-dark(#584400, #eec12f)`,"--color-syntax-property":`light-dark(#005348, #83dac9)`,"--color-syntax-punctuation":`light-dark(#6e6e6e, #a0a0a0)`,"--color-syntax-background":`light-dark(#fafafa, #0a0a0a)`,"--color-background-surface":`light-dark(#ffffff, #262626)`,"--color-background-body":`light-dark(#f1f1f1, #1b1b1b)`,"--color-background-card":`light-dark(#ffffff, #1b1b1b)`,"--color-background-popover":`light-dark(#ffffff, #1b1b1b)`,"--color-background-muted":`light-dark(#f1f1f1, #1b1b1b)`,"--color-accent":`light-dark(#262626, #ebebeb)`,"--color-accent-muted":`light-dark(#f1f1f1, #262626)`,"--color-neutral":`light-dark(#0000000F, #FFFFFF1A)`,"--color-overlay":`light-dark(#00000080, #000000CC)`,"--color-overlay-hover":`light-dark(#0000000D, #FFFFFF0D)`,"--color-overlay-pressed":`light-dark(#0000001A, #FFFFFF1A)`,"--color-text-primary":`light-dark(#171717, #fafafa)`,"--color-text-secondary":`light-dark(#525252, #a3a3a3)`,"--color-text-disabled":`light-dark(#a3a3a3, #525252)`,"--color-text-accent":`light-dark(#262626, #ebebeb)`,"--color-on-dark":`#ffffff`,"--color-on-light":`#171717`,"--color-on-accent":`light-dark(#ffffff, #171717)`,"--color-on-success":`light-dark(#ffffff, #171717)`,"--color-on-error":`light-dark(#ffffff, #171717)`,"--color-on-warning":`#171717`,"--color-icon-accent":`light-dark(#262626, #ebebeb)`,"--color-icon-primary":`light-dark(#171717, #fafafa)`,"--color-icon-secondary":`light-dark(#737373, #a3a3a3)`,"--color-icon-disabled":`light-dark(#a3a3a3, #525252)`,"--color-success":`light-dark(#007004, #9fe59b)`,"--color-error":`light-dark(#a50c25, #ffc6c1)`,"--color-warning":`light-dark(#745b00, #fdcf4f)`,"--color-success-muted":`light-dark(#c5e5c0, #84c9803D)`,"--color-error-muted":`light-dark(#facecb, #ff9e973D)`,"--color-warning-muted":`light-dark(#f8da9d, #deb4333D)`,"--color-border":`light-dark(#00000014, #FFFFFF1A)`,"--color-border-emphasized":`light-dark(#d4d4d4, #525252)`,"--color-skeleton":`light-dark(#ebebeb, #525252)`,"--color-shadow":`light-dark(#0000001A, #0000004D)`,"--color-tint-hover":`light-dark(black, white)`,"--color-background-red":`light-dark(#facecb, #ff9e973D)`,"--color-border-red":`light-dark(#e6bab8, #ff6f6c)`,"--color-icon-red":`light-dark(#89001a, #ff9e97)`,"--color-text-red":`light-dark(#89001a, #ffc6c1)`,"--color-background-orange":`light-dark(#fad0b5, #ffa2583D)`,"--color-border-orange":`light-dark(#e6bda2, #e2883e)`,"--color-icon-orange":`light-dark(#6e3500, #ffa258)`,"--color-text-orange":`light-dark(#6e3500, #ffc9a2)`,"--color-background-yellow":`light-dark(#f8da9d, #deb4333D)`,"--color-border-yellow":`light-dark(#e4c279, #c0990e)`,"--color-icon-yellow":`light-dark(#584400, #deb433)`,"--color-text-yellow":`light-dark(#584400, #fdcf4f)`,"--color-background-green":`light-dark(#c5e5c0, #84c9803D)`,"--color-border-green":`light-dark(#b2d1ac, #69ad67)`,"--color-icon-green":`light-dark(#0c5700, #84c980)`,"--color-text-green":`light-dark(#0c5700, #9fe59b)`,"--color-background-teal":`light-dark(#a5e3d6, #7ec6b83D)`,"--color-border-teal":`light-dark(#94d6c8, #63ab9d)`,"--color-icon-teal":`light-dark(#005348, #7ec6b8)`,"--color-text-teal":`light-dark(#005348, #99e2d3)`,"--color-background-cyan":`light-dark(#a3e0ef, #83c2d43D)`,"--color-border-cyan":`light-dark(#91d3e3, #67a7b8)`,"--color-icon-cyan":`light-dark(#00505f, #83c2d4)`,"--color-text-cyan":`light-dark(#00505f, #9edef0)`,"--color-background-blue":`light-dark(#c4ddfb, #9eb7ff3D)`,"--color-border-blue":`light-dark(#b1c9e7, #6d9cfe)`,"--color-icon-blue":`light-dark(#00458c, #9eb7ff)`,"--color-text-blue":`light-dark(#00458c, #c7d3ff)`,"--color-background-purple":`light-dark(#eccef3, #f297ff3D)`,"--color-border-purple":`light-dark(#d8bbdf, #dd74f0)`,"--color-icon-purple":`light-dark(#700084, #f297ff)`,"--color-text-purple":`light-dark(#700084, #fac1ff)`,"--color-background-pink":`light-dark(#fccadc, #ff99c33D)`,"--color-border-pink":`light-dark(#e7b7c8, #f273aa)`,"--color-icon-pink":`light-dark(#83004b, #ff99c3)`,"--color-text-pink":`light-dark(#83004b, #ffc3da)`,"--color-background-gray":`light-dark(#e5e5e5, var(--color-neutral))`,"--color-border-gray":`light-dark(#d4d4d4, #262626)`,"--color-icon-gray":`light-dark(#525252, #a3a3a3)`,"--color-text-gray":`light-dark(#262626, #e5e5e5)`,"--radius-none":`0px`,"--radius-inner":`0.375rem`,"--radius-element":`0.625rem`,"--radius-container":`0.75rem`,"--radius-page":`1.75rem`,"--radius-full":`9999px`,"--shadow-low":`0 2px 4px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 25%)), 0 4px 8px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 40%)), inset 0 0 0 1px light-dark(transparent, oklch(1 0 0 / 8%))`,"--shadow-med":`0 2px 4px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 35%)), 0 4px 12px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 50%)), inset 0 0 0 1px light-dark(transparent, oklch(1 0 0 / 12%))`,"--shadow-high":`0 4px 6px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 50%)), 0 12px 24px light-dark(oklch(0 0 0 / 15%), oklch(0 0 0 / 70%)), inset 0 0 0 1px light-dark(transparent, oklch(1 0 0 / 15%))`,"--shadow-inset-hover":`inset 0px 0px 0px 2px #0074e24D`,"--shadow-inset-selected":`inset 0px 0px 0px 2px #0074e280`,"--shadow-inset-success":`inset 0px 0px 0px 2px #1981004D`,"--shadow-inset-warning":`inset 0px 0px 0px 2px #ffce2f4D`,"--shadow-inset-error":`inset 0px 0px 0px 2px #e33f4a4D`},components:{heading:{"level:1":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-1-size)`,fontWeight:`var(--text-heading-1-weight)`,lineHeight:`var(--text-heading-1-leading)`},"level:2":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-2-size)`,fontWeight:`var(--text-heading-2-weight)`,lineHeight:`var(--text-heading-2-leading)`},"level:3":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-3-size)`,fontWeight:`var(--text-heading-3-weight)`,lineHeight:`var(--text-heading-3-leading)`},"level:4":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-4-size)`,fontWeight:`var(--text-heading-4-weight)`,lineHeight:`var(--text-heading-4-leading)`},"level:5":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-5-size)`,fontWeight:`var(--text-heading-5-weight)`,lineHeight:`var(--text-heading-5-leading)`},"level:6":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-6-size)`,fontWeight:`var(--text-heading-6-weight)`,lineHeight:`var(--text-heading-6-leading)`},"type:display-1":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-1-size)`,lineHeight:`var(--text-display-1-leading)`},"type:display-2":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-2-size)`,lineHeight:`var(--text-display-2-leading)`},"type:display-3":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-3-size)`,lineHeight:`var(--text-display-3-leading)`}},text:{"type:body":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-body-size)`,lineHeight:`var(--text-body-leading)`},"type:large":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-large-size)`,lineHeight:`var(--text-large-leading)`},"type:label":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-label-size)`,lineHeight:`var(--text-label-leading)`},"type:code":{fontFamily:`var(--font-family-code)`,fontSize:`var(--text-code-size)`,lineHeight:`var(--text-code-leading)`},"type:supporting":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-supporting-size)`,lineHeight:`var(--text-supporting-leading)`},"type:display-1":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-1-size)`,lineHeight:`var(--text-display-1-leading)`},"type:display-2":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-2-size)`,lineHeight:`var(--text-display-2-leading)`},"type:display-3":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-3-size)`,lineHeight:`var(--text-display-3-leading)`}},button:{"variant:destructive":{backgroundColor:`var(--color-error-muted)`,color:`var(--color-error)`}},badge:{"variant:info":{backgroundColor:`light-dark(#0074e2, #6d9cfe)`,color:`light-dark(#ffffff, #171717)`},"variant:neutral":{backgroundColor:`var(--color-background-gray)`,color:`var(--color-text-gray)`},"variant:success":{backgroundColor:`light-dark(#198100, #64af4c)`,color:`light-dark(#ffffff, #171717)`},"variant:warning":{backgroundColor:`#ffce2f`,color:`#171717`},"variant:error":{backgroundColor:`light-dark(#c9303a, #ff705d)`,color:`light-dark(#ffffff, #171717)`},"variant:red":{backgroundColor:`var(--color-background-red)`,color:`var(--color-text-red)`},"variant:orange":{backgroundColor:`var(--color-background-orange)`,color:`var(--color-text-orange)`},"variant:yellow":{backgroundColor:`var(--color-background-yellow)`,color:`var(--color-text-yellow)`},"variant:green":{backgroundColor:`var(--color-background-green)`,color:`var(--color-text-green)`},"variant:teal":{backgroundColor:`var(--color-background-teal)`,color:`var(--color-text-teal)`},"variant:cyan":{backgroundColor:`var(--color-background-cyan)`,color:`var(--color-text-cyan)`},"variant:blue":{backgroundColor:`var(--color-background-blue)`,color:`var(--color-text-blue)`},"variant:purple":{backgroundColor:`var(--color-background-purple)`,color:`var(--color-text-purple)`},"variant:pink":{backgroundColor:`var(--color-background-pink)`,color:`var(--color-text-pink)`},"variant:gray":{backgroundColor:`var(--color-background-gray)`,color:`var(--color-text-gray)`}},statusdot:{"variant:success":{backgroundColor:`light-dark(#198100, #64af4c)`},"variant:warning":{backgroundColor:`#ffce2f`},"variant:error":{backgroundColor:`light-dark(#c9303a, #ff705d)`},"variant:accent":{backgroundColor:`light-dark(#0074e2, #6d9cfe)`}},banner:{"status:info":{"--color-accent-muted":`var(--color-background-blue)`,"--color-text-primary":`var(--color-text-blue)`,"--color-text-secondary":`var(--color-text-blue)`,"--color-accent":`var(--color-text-blue)`},"status:success":{"--color-text-primary":`var(--color-text-green)`,"--color-text-secondary":`var(--color-text-green)`,"--color-success":`var(--color-text-green)`},"status:warning":{"--color-text-primary":`var(--color-text-yellow)`,"--color-text-secondary":`var(--color-text-yellow)`,"--color-warning":`var(--color-text-yellow)`},"status:error":{"--color-text-primary":`var(--color-text-red)`,"--color-text-secondary":`var(--color-text-red)`,"--color-error":`var(--color-text-red)`}},switch:{base:{"--color-background-gray":`var(--color-border-emphasized)`}},progressbar:{base:{"--color-background-muted":`var(--color-border-emphasized)`},"variant:accent":{"--color-accent":`#0074e2`},"variant:success":{"--color-success":`#198100`},"variant:warning":{"--color-warning":`#ffce2f`},"variant:error":{"--color-error":`#c9303a`}},card:{base:{padding:`var(--spacing-3)`}},section:{base:{padding:`var(--spacing-3)`}}},__onDark:{tokens:{"color-scheme":`dark`,"--color-text-primary":`var(--color-on-dark)`,"--color-icon-primary":`var(--color-on-dark)`,"--color-accent":`var(--color-on-dark)`}},__onLight:{tokens:{"color-scheme":`light`,"--color-text-primary":`var(--color-on-light)`,"--color-icon-primary":`var(--color-on-light)`,"--color-accent":`var(--color-on-light)`}},icons:{close:(0,L.jsx)(ze,{...ox}),chevronDown:(0,L.jsx)(re,{...ox}),chevronLeft:(0,L.jsx)(ie,{...ox}),chevronRight:(0,L.jsx)(ae,{...ox}),chevronsLeft:(0,L.jsx)(oe,{...ox}),chevronsRight:(0,L.jsx)(se,{...ox}),check:(0,L.jsx)(P,{...ox}),success:(0,L.jsx)(F,{...ox}),error:(0,L.jsx)(ce,{...ox}),warning:(0,L.jsx)(Ie,{...ox}),info:(0,L.jsx)(xe,{...ox}),calendar:(0,L.jsx)(ne,{...ox}),clock:(0,L.jsx)(ue,{...ox}),externalLink:(0,L.jsx)(me,{...ox}),menu:(0,L.jsx)(Ce,{...ox}),moreHorizontal:(0,L.jsx)(pe,{...ox}),search:(0,L.jsx)(ke,{...ox}),arrowUp:(0,L.jsx)(j,{...ox}),arrowDown:(0,L.jsx)(k,{...ox}),arrowsUpDown:(0,L.jsx)(A,{...ox}),funnel:(0,L.jsx)(ye,{...ox}),eyeSlash:(0,L.jsx)(he,{...ox}),viewColumns:(0,L.jsx)(de,{...ox}),copy:(0,L.jsx)(fe,{...ox}),checkDouble:(0,L.jsx)(N,{...ox}),wrench:(0,L.jsx)(Re,{...ox}),stop:(0,L.jsx)(Ne,{...ox}),microphone:(0,L.jsx)(we,{...ox})}},cx={en:{translation:{conversationView:`Conversation view`,chatView:`Chat`,trajectory:`Trajectory`,trajectoryScope:`Recorded Session messages in order, not execution durations or the complete model request.`,trajectoryRunning:`Work is active. This view updates as saved records arrive; in-flight text is available in Chat.`,trajectoryTruncated:`Loaded history is partial: {{entries}} entries omitted, {{parts}} parts omitted, {{messages}} messages truncated.`,trajectoryEmpty:`No saved records yet.`,trajectoryOverview:`Record sequence overview`,trajectoryEarlier:`Show earlier records ({{count}} remaining in loaded history)`,trajectoryDetails:`Record details`,trajectoryRecordedAt:`Record timestamp`,trajectoryEvidenceTruncated:`This evidence was truncated in the Session projection.`,trajectoryArguments:`Tool arguments`,trajectoryRecordedContent:`Recorded content`,trajectoryThinking:`Recorded model reasoning`,trajectoryOutput:`Tool result`,trajectoryMissingResult:`No unambiguous result is included in the loaded records. This does not imply the tool is still running.`,trajectoryStructured:`Structured result`,trajectoryEventOnly:`Only this event’s type and timestamp are available.`,trajectory_user:`User prompt`,trajectory_assistant:`Assistant`,trajectory_call:`Tool call`,trajectory_result:`Unpaired result`,trajectory_event:`Session event`,trajectory_returned:`Tool returned successfully; background work may still be active.`,trajectory_error:`Tool returned an error`,trajectory_unknown:`Outcome not established`,runtimeStatus:`Runtime status`,refreshStatus:`Refresh status`,terminalDetails:`Terminal details`,inspectionChanged:`The active session changed. Reopen this panel.`,inspectionUnavailable:`Details are unavailable.`,inspectionLoading:`Loading status…`,thinkingUnavailable:`Thinking state is unavailable.`,trustUnavailable:`Project trust status is unavailable.`,authUnavailable:`Provider status is unavailable.`,executionState:`State`,terminalCommand:`Command`,terminalDirectory:`Directory`,startedAt:`Started`,exitCode:`Exit code`,detailTruncated:`Some details are shortened to keep this view bounded.`,standardOutput:`Standard output`,standardError:`Standard error`,outputTruncated:`{{count}} bytes omitted from this output view.`,outputRecovery:`The runtime reports a retained log. This view shows only a bounded excerpt.`,modelAndThinking:`Model and reasoning`,selectedModel:`Current model`,thinkingLevel:`Thinking level`,availableThinking:`Available levels`,unknownState:`Unknown`,projectTrust:`Project trust`,trust_trusted:`This session trusts the workspace.`,trust_untrusted:`Trust for this workspace has been denied.`,trust_restricted:`Project resources are restricted pending a trust decision.`,trust_unknown:`Trust state is not available.`,trustRefreshNeeded:`The saved decision and active session differ. Refresh the session through Pi to apply it.`,providerAvailability:`Provider credentials`,credentialConfigured:`Configured`,credentialMissing:`Not configured`,noProviders:`No providers reported.`,providersBounded:`This provider list is truncated.`,authNotVerified:`Configured credentials do not guarantee a successful model request.`,configurationViaPi:`Read-only status. Manage model credentials and trust through Pi; manage OpenPI options with /openpi-setup.`,statusCaptured:`Snapshot at {{time}} · refresh for the latest state`,conversationViews:`Conversation views`,currentConversations:`Current`,archivedConversations:`Archived`,restoreConversation:`Restore conversation`,restoringConversation:`Restoring…`,loadedArchives:`Archived conversations in the loaded history`,loadedHistoryBounded:`{{sessions}} more sessions and {{workspaces}} workspace summaries are not loaded. Search covers the loaded list only.`,noLoadedArchives:`No archived conversations in this loaded list.`,restoreFailed:`Could not confirm restoration. Refresh and try again.`,execution_running:`Running`,execution_done:`Completed`,execution_killed:`Stopped`,execution_timed_out:`Timed out`,execution_failed:`Failed`,execution_uncertain:`Uncertain`,activeOnlyHint:`Only the active Web session accepts messages.`,acceptedHint:`Message accepted by OpenPI Web.`,stopTurn:`Stop current turn`,stoppingTurn:`Stopping current turn…`,stoppedTurn:`Current turn stopped.`,pendingFollowUpsHint:`{{count}} messages queued`,addWorkspace:`Add workspace`,addWorkspaceMenu:`Add workspace...`,archiveConversation:`Archive conversation`,cancel:`Cancel`,chooseWorkspaceHint:`Choose a workspace and describe the work`,close:`Close`,closeSearch:`Close search`,collapseSidebar:`Collapse sidebar`,confirmEdit:`OK`,connected:`Connected`,connecting:`Connecting`,conversationName:`Conversation name`,conversationOptions:`Conversation options`,conversationTurns:`Conversation turns`,copiedMessage:`Copied`,copyMessage:`Copy message`,copyFailed:`Copy failed. Please select and copy the message manually.`,deleteWorkspace:`Delete workspace`,describeTask:`Describe a task`,editMessage:`Edit message`,enterHint:`Enter to send, Shift+Enter for a new line.`,expandSidebar:`Expand sidebar`,importWorkspace:`Import workspace`,loadingModels:`Loading models...`,modelPreparing:`Preparing task...`,modelRetrying:`Retrying model request...`,modelRunning:`Working...`,newSession:`New session`,noConversations:`No conversations yet`,noMatching:`No matching conversations`,noModels:`No models available`,noOutput:`no output`,noSessions:`No sessions`,openSidebar:`Open sidebar`,promptMessage:`Send a message to the active Web session`,promptReadonly:`A non-active session cannot receive prompts`,promptStart:`Choose a workspace to begin.`,promptTask:`Describe what you want to build.`,queuedHint:`The message will be queued after the current turn.`,reconnecting:`Reconnecting`,removeWorkspace:`Remove from sidebar`,renameConversation:`Rename conversation`,renameWorkspace:`Rename workspace`,save:`Save`,searchConversations:`Search conversations`,searchPlaceholder:`Search conversations...`,selectModel:`Select model`,selectWorkspace:`Select workspace`,send:`Send`,stepsLabel:`steps`,switchingSession:`Switching session...`,thinkingActive:`Thinking...`,thinkingDone:`Thinking`,unavailable:`Unavailable`,ungrouped:`Ungrouped`,untitledSession:`New session`,workspaceDeleteConfirm:`The folder and conversation records will be kept. Its conversations will move to Ungrouped.`,workspaceName:`Workspace name`,workspaces:`Workspaces`}},zh:{translation:{conversationView:`会话视图`,chatView:`对话`,trajectory:`执行轨迹`,trajectoryScope:`按记录顺序展示会话消息,不表示执行耗时,也不是完整模型请求。`,trajectoryRunning:`任务仍在进行。已保存记录到达后自动更新;实时生成内容可在“对话”中查看。`,trajectoryTruncated:`当前历史不完整:省略 {{entries}} 条记录、{{parts}} 个内容片段,{{messages}} 条消息被截断。`,trajectoryEmpty:`尚无已保存记录。`,trajectoryOverview:`记录顺序总览`,trajectoryEarlier:`显示更早记录(已加载历史中还有 {{count}} 条)`,trajectoryDetails:`记录详情`,trajectoryRecordedAt:`记录时间`,trajectoryEvidenceTruncated:`此证据在会话投影中已被截断。`,trajectoryArguments:`工具参数`,trajectoryRecordedContent:`已记录内容`,trajectoryThinking:`模型返回的推理内容`,trajectoryOutput:`工具结果`,trajectoryMissingResult:`当前记录中没有可明确配对的结果。这不表示工具仍在运行。`,trajectoryStructured:`结构化结果`,trajectoryEventOnly:`当前仅提供此事件的类型和记录时间。`,trajectory_user:`用户 Prompt`,trajectory_assistant:`模型消息`,trajectory_call:`工具调用`,trajectory_result:`未配对结果`,trajectory_event:`会话事件`,trajectory_returned:`工具已成功返回;其启动的后台任务可能仍在进行。`,trajectory_error:`工具返回错误`,trajectory_unknown:`尚无法确定结果`,runtimeStatus:`运行状态`,refreshStatus:`刷新状态`,terminalDetails:`终端详情`,inspectionChanged:`当前会话已切换,请重新打开详情。`,inspectionUnavailable:`暂时无法读取详情。`,inspectionLoading:`正在读取状态…`,thinkingUnavailable:`暂时无法读取思考等级。`,trustUnavailable:`暂时无法读取项目信任状态。`,authUnavailable:`暂时无法读取服务商状态。`,executionState:`状态`,terminalCommand:`命令`,terminalDirectory:`目录`,startedAt:`启动时间`,exitCode:`退出码`,detailTruncated:`部分详情已截断,以限制页面加载量。`,standardOutput:`标准输出`,standardError:`错误输出`,outputTruncated:`此输出视图省略了 {{count}} 字节。`,outputRecovery:`运行时报告已保留日志;此处仅显示有大小限制的片段。`,modelAndThinking:`模型与思考`,selectedModel:`当前模型`,thinkingLevel:`思考等级`,availableThinking:`支持的等级`,unknownState:`未知`,projectTrust:`项目信任`,trust_trusted:`当前会话信任此工作区。`,trust_untrusted:`此工作区的信任已被拒绝。`,trust_restricted:`项目资源受到限制,等待信任决定。`,trust_unknown:`尚无法确定信任状态。`,trustRefreshNeeded:`保存的信任决定与当前会话不同,请通过 Pi 刷新会话后生效。`,providerAvailability:`服务商凭据`,credentialConfigured:`已配置`,credentialMissing:`未配置`,noProviders:`未发现服务商。`,providersBounded:`服务商列表已截断。`,authNotVerified:`凭据已配置不代表模型请求一定成功。`,configurationViaPi:`此处为只读状态。模型凭据与信任由 Pi 管理,OpenPI 选项通过 /openpi-setup 配置。`,statusCaptured:`采集于 {{time}} · 刷新查看最新状态`,conversationViews:`会话视图`,currentConversations:`当前`,archivedConversations:`已归档`,restoreConversation:`恢复会话`,restoringConversation:`正在恢复…`,loadedArchives:`已加载历史中的归档会话`,loadedHistoryBounded:`另有 {{sessions}} 个会话和 {{workspaces}} 个工作区摘要未加载。搜索仅覆盖已加载列表。`,noLoadedArchives:`已加载列表中没有归档会话。`,restoreFailed:`暂时无法确认恢复结果,请刷新后重试。`,execution_running:`运行中`,execution_done:`已完成`,execution_killed:`已停止`,execution_timed_out:`已超时`,execution_failed:`失败`,execution_uncertain:`状态不确定`,activeOnlyHint:`只有当前 Web 会话可以接收消息。`,stopTurn:`停止当前轮次`,stoppingTurn:`正在停止当前轮次…`,stoppedTurn:`当前轮次已停止。`,pendingFollowUpsHint:`{{count}} 条消息正在排队`,acceptedHint:`OpenPI Web 已接收消息。`,addWorkspace:`添加工作区`,addWorkspaceMenu:`添加工作区...`,archiveConversation:`归档会话`,cancel:`取消`,chooseWorkspaceHint:`选择工作区并描述任务`,close:`关闭`,closeSearch:`关闭搜索`,collapseSidebar:`收起侧边栏`,confirmEdit:`确定`,connected:`已连接`,connecting:`正在连接`,conversationName:`会话名称`,conversationOptions:`会话选项`,conversationTurns:`会话轮次`,copiedMessage:`已复制`,copyMessage:`复制消息`,copyFailed:`复制失败,请选中消息后手动复制。`,deleteWorkspace:`删除工作区`,describeTask:`描述任务`,editMessage:`编辑消息`,enterHint:`按 Enter 发送,Shift+Enter 换行。`,expandSidebar:`展开侧边栏`,importWorkspace:`导入工作区`,loadingModels:`正在加载模型...`,modelPreparing:`正在准备任务...`,modelRetrying:`模型请求重试中...`,modelRunning:`正在运行...`,newSession:`新建会话`,noConversations:`暂无对话`,noMatching:`没有匹配的会话`,noModels:`没有可用模型`,noOutput:`无输出`,noSessions:`暂无会话`,openSidebar:`打开侧边栏`,promptMessage:`向当前 Web 会话发送消息`,promptReadonly:`非当前会话不能接收消息`,promptStart:`选择一个工作区开始`,promptTask:`描述你想要构建的任务`,queuedHint:`当前回合结束后将发送消息。`,reconnecting:`正在重连`,removeWorkspace:`从侧边栏移除`,renameConversation:`重命名会话`,renameWorkspace:`重命名工作区`,save:`保存`,searchConversations:`搜索会话`,searchPlaceholder:`搜索会话...`,selectModel:`选择模型`,selectWorkspace:`选择工作区`,send:`发送`,stepsLabel:`个步骤`,switchingSession:`正在切换会话...`,thinkingActive:`思考中...`,thinkingDone:`思考过程`,unavailable:`不可用`,ungrouped:`未分组`,untitledSession:`新会话`,workspaceDeleteConfirm:`文件夹与会话记录会保留,其中的会话会被放到“未分组”;再次打开此目录时将是一个干净的工作区。`,workspaceName:`工作区名称`,workspaces:`工作区`}}},lx=navigator.language?.toLowerCase().startsWith(`zh`)?`zh`:`en`;Ft.use(en).init({fallbackLng:`en`,initAsync:!1,interpolation:{escapeValue:!1},lng:lx,resources:cx}),document.documentElement.lang=lx===`zh`?`zh-CN`:`en`;function ux({children:e}){let t=pn(Zb,e=>e.snapshot?.preferences?.theme)??`system`,[n,r]=(0,w.useState)(()=>window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1);(0,w.useEffect)(()=>{let e=window.matchMedia?.(`(prefers-color-scheme: dark)`);if(!e)return;let t=()=>r(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let i=t===`dark`||t===`system`&&n?`dark`:`light`;return(0,w.useEffect)(()=>{document.documentElement.dataset.theme=i},[i]),(0,L.jsx)(ln,{i18n:Ft,children:(0,L.jsx)(ax,{theme:sx,mode:i,children:e})})}var dx=document.getElementById(`root`);if(!dx)throw Error(`OpenPI Web root is missing`);(0,Be.createRoot)(dx).render((0,L.jsx)(w.StrictMode,{children:(0,L.jsx)(ux,{children:(0,L.jsx)(Qb,{})})})); \ No newline at end of file